t2-mapper/docs/_next/static/chunks/f86ccd4277098102.js
2025-12-03 14:55:39 -08:00

1 line
947 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24478,(e,t,n)=>{"use strict";n.ConcurrentRoot=1,n.ContinuousEventPriority=8,n.DefaultEventPriority=32,n.DiscreteEventPriority=2,n.IdleEventPriority=0x10000000,n.LegacyRoot=0,n.NoEventPriority=0},39695,(e,t,n)=>{"use strict";t.exports=e.r(24478)},55838,(e,t,n)=>{"use strict";var r=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,l=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,c=r[1];return o(function(){i.value=n,i.getSnapshot=t,u(i)&&c({inst:i})},[e,n,t]),s(function(){return u(i)&&c({inst:i}),e(function(){u(i)&&c({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,t,n)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var r=e.r(71645),i=e.r(2239),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,o=r.useRef,l=r.useEffect,u=r.useMemo,c=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var p=s(e,(h=u(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&d.hasValue){var t=d.value;if(i(t,e))return o=t}return o=e}if(t=o,a(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,o=n)}var s,o,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,r,i]))[0],h[1]);return l(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},30224,(e,t,n)=>{"use strict";t.exports=e.r(52822)},29779,(e,t,n)=>{"use strict";function r(e,t){var n=e.length;for(e.push(t);0<n;){var r=n-1>>>1,i=e[r];if(0<s(i,t))e[r]=t,e[n]=i,n=r;else break}}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;for(var r=0,i=e.length,a=i>>>1;r<a;){var o=2*(r+1)-1,l=e[o],u=o+1,c=e[u];if(0>s(l,n))u<i&&0>s(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[o]=n,r=o);else if(u<i&&0>s(c,n))e[r]=c,e[u]=n,r=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,y=!1,_="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=i(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,r(h,t);else break;t=i(d)}}function M(e){if(y=!1,S(e),!v)if(null!==i(h))v=!0,L();else{var t=i(d);null!==t&&N(M,t.startTime-e)}}var w=!1,E=-1,T=5,A=-1;function C(){return!(n.unstable_now()-A<T)}function R(){if(w){var e=n.unstable_now();A=e;var t=!0;try{e:{v=!1,y&&(y=!1,x(E),E=-1),g=!0;var r=m;try{t:{for(S(e),f=i(h);null!==f&&!(f.expirationTime>e&&C());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,S(e),t=!0;break t}f===i(h)&&a(h),S(e)}else a(h);f=i(h)}if(null!==f)t=!0;else{var u=i(d);null!==u&&N(M,u.startTime-e),t=!1}}break e}finally{f=null,m=r,g=!1}}}finally{t?o():w=!1}}}if("function"==typeof b)o=function(){b(R)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=R,o=function(){I.postMessage(null)}}else o=function(){_(R,0)};function L(){w||(w=!0,o())}function N(e,t){E=_(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_continueExecution=function(){v||g||(v=!0,L())},n.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"):T=0<e?Math.floor(1e3/e):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_getFirstCallbackNode=function(){return i(h)},n.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},n.unstable_scheduleCallback=function(e,t,a){var s=n.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?s+a:s,e){case 1:var o=-1;break;case 2:o=250;break;case 5:o=0x3fffffff;break;case 4:o=1e4;break;default:o=5e3}return o=a+o,e={id:p++,callback:t,priorityLevel:e,startTime:a,expirationTime:o,sortIndex:-1},a>s?(e.sortIndex=a,r(d,e),null===i(h)&&e===i(d)&&(y?(x(E),E=-1):y=!0,N(M,a-s))):(e.sortIndex=o,r(h,e),v||g||(v=!0,L())),e},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},51849,(e,t,n)=>{"use strict";t.exports=e.r(29779)},40336,(e,t,n)=>{"use strict";var r=e.i(47167);t.exports=function(t){function n(e,t,n,r){return new rP(e,t,n,r)}function i(){}function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;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."}function s(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=ii&&e[ii]||e["@@iterator"])?e:null}function o(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===ia?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case r$:return"Fragment";case rK:return"Portal";case r0:return"Profiler";case rQ:return"StrictMode";case r5:return"Suspense";case r6:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case r3:return(e.displayName||"Context")+".Provider";case r2:return(e._context.displayName||"Context")+".Consumer";case r4:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case r8:return null!==(t=e.displayName||null)?t:o(e.type)||"Memo";case r9:t=e._payload,e=e._init;try{return o(e(t))}catch(e){}}return null}function l(e){if(void 0===ie)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ie=t&&t[1]||"",it=-1<e.stack.indexOf("\n at")?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+ie+e+it}function u(e,t){if(!e||io)return"";io=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(e){if(e&&r&&"string"==typeof e.stack)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=r.DetermineComponentFrameRoot(),s=a[0],o=a[1];if(s&&o){var u=s.split("\n"),c=o.split("\n");for(i=r=0;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;for(;i<c.length&&!c[i].includes("DetermineComponentFrameRoot");)i++;if(r===u.length||i===c.length)for(r=u.length-1,i=c.length-1;1<=r&&0<=i&&u[r]!==c[i];)i--;for(;1<=r&&0<=i;r--,i--)if(u[r]!==c[i]){if(1!==r||1!==i)do if(r--,i--,0>i||u[r]!==c[i]){var h="\n"+u[r].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),h}while(1<=r&&0<=i)break}}}finally{io=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?l(n):""}function c(e){try{var t="";do t+=function(e){switch(e.tag){case 26:case 27:case 5:return l(e.type);case 16:return l("Lazy");case 13:return l("Suspense");case 19:return l("SuspenseList");case 0:case 15:return u(e.type,!1);case 11:return u(e.type.render,!1);case 1:return u(e.type,!0);default:return""}}(e),e=e.return;while(e)return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function h(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 d(e){if(h(e)!==e)throw Error(a(188))}function p(e){var t=e.alternate;if(!t){if(null===(t=h(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var s=i.alternate;if(null===s){if(null!==(r=i.return)){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return d(i),e;if(s===r)return d(i),t;s=s.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){return{current:e}}function m(e){0>a4||(e.current=a3[a4],a3[a4]=null,a4--)}function g(e,t){a3[++a4]=e.current,e.current=t}function v(e){var t=42&e;if(0!==t)return t;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:return 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 4194176&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function y(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,s=e.warmLanes;e=0!==e.finishedLanes;var o=0x7ffffff&n;return 0!==o?0!=(n=o&~i)?r=v(n):0!=(a&=o)?r=v(a):e||0!=(s=o&~s)&&(r=v(s)):0!=(o=n&~i)?r=v(o):0!==a?r=v(a):e||0!=(s=n&~s)&&(r=v(s)),0===r?0:0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(s=t&-t)||32===i&&0!=(4194176&s))?t:r}function _(e,t){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function x(){var e=a7;return 0==(4194176&(a7<<=1))&&(a7=128),e}function b(){var e=se;return 0==(0x3c00000&(se<<=1))&&(se=4194304),e}function S(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function M(e,t){e.pendingLanes|=t,0x10000000!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function w(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-a6(t);e.entangledLanes|=t,e.entanglements[r]=0x40000000|e.entanglements[r]|4194218&n}function E(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-a6(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function T(e){return 2<(e&=-e)?8<e?0!=(0x7ffffff&e)?32:0x10000000:8:2}function A(e,t){if("object"==typeof e&&null!==e){var n=sp.get(e);return void 0!==n?n:(t={value:e,source:t,stack:c(t)},sp.set(e,t),t)}return{value:e,source:t,stack:c(t)}}function C(e,t){sf[sm++]=sv,sf[sm++]=sg,sg=e,sv=t}function R(e,t,n){sy[s_++]=sb,sy[s_++]=sS,sy[s_++]=sx,sx=e;var r=sb;e=sS;var i=32-a6(r)-1;r&=~(1<<i),n+=1;var a=32-a6(t)+i;if(30<a){var s=i-i%5;a=(r&(1<<s)-1).toString(32),r>>=s,i-=s,sb=1<<32-a6(t)+i|n<<i|r,sS=a+e}else sb=1<<a|n<<i|r,sS=e}function P(e){null!==e.return&&(C(e,1),R(e,1,0))}function I(e){for(;e===sg;)sg=sf[--sm],sf[sm]=null,sv=sf[--sm],sf[sm]=null;for(;e===sx;)sx=sy[--s_],sy[s_]=null,sS=sy[--s_],sy[s_]=null,sb=sy[--s_],sy[s_]=null}function L(e,t){g(sE,t),g(sw,e),g(sM,null),e=ip(t),m(sM),g(sM,e)}function N(){m(sM),m(sw),m(sE)}function D(e){null!==e.memoizedState&&g(sT,e);var t=sM.current,n=im(t,e.type);t!==n&&(g(sw,e),g(sM,n))}function U(e){sw.current===e&&(m(sM),m(sw)),sT.current===e&&(m(sT),iT?iG._currentValue=iV:iG._currentValue2=iV)}function O(e){throw H(A(Error(a(418,"")),e)),sL}function F(e,t){if(!iR)throw Error(a(175));aT(e.stateNode,e.type,e.memoizedProps,t,e)||O(e)}function k(e){for(sA=e.return;sA;)switch(sA.tag){case 3:case 27:sI=!0;return;case 5:case 13:sI=!1;return;default:sA=sA.return}}function z(e){if(!iR||e!==sA)return!1;if(!sR)return k(e),sR=!0,!1;var t=!1;if(aK?3!==e.tag&&27!==e.tag&&(5!==e.tag||aD(e.type)&&!ib(e.type,e.memoizedProps))&&(t=!0):3!==e.tag&&(5!==e.tag||aD(e.type)&&!ib(e.type,e.memoizedProps))&&(t=!0),t&&sC&&O(e),k(e),13===e.tag){if(!iR)throw Error(a(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));sC=aR(e)}else sC=sA?a_(e.stateNode):null;return!0}function B(){iR&&(sC=sA=null,sR=!1)}function H(e){null===sP?sP=[e]:sP.push(e)}function V(){for(var e=sD,t=sU=sD=0;t<e;){var n=sN[t];sN[t++]=null;var r=sN[t];sN[t++]=null;var i=sN[t];sN[t++]=null;var a=sN[t];if(sN[t++]=null,null!==r&&null!==i){var s=r.pending;null===s?i.next=i:(i.next=s.next,s.next=i),r.pending=i}0!==a&&X(n,i,a)}}function G(e,t,n,r){sN[sD++]=e,sN[sD++]=t,sN[sD++]=n,sN[sD++]=r,sU|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function W(e,t,n,r){return G(e,t,n,r),q(e)}function j(e,t){return G(e,null,null,t),q(e)}function X(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var i=!1,a=e.return;null!==a;)a.childLanes|=n,null!==(r=a.alternate)&&(r.childLanes|=n),22===a.tag&&(null===(e=a.stateNode)||1&e._visibility||(i=!0)),e=a,a=a.return;i&&null!==t&&3===e.tag&&(a=e.stateNode,i=31-a6(n),null===(e=(a=a.hiddenUpdates)[i])?a[i]=[t]:e.push(t),t.lane=0x20000000|n)}function q(e){if(50<lc)throw lc=0,lh=null,Error(a(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}function Y(e){var t;e!==sF&&null===e.next&&(null===sF?sO=sF=e:sF=sF.next=e),sz=!0,sk||(sk=!0,t=Z,ij?iX(function(){0!=(6&oX)?st(ss,t):t()}):st(ss,t))}function J(e,t){if(!sB&&sz){sB=!0;do for(var n=!1,r=sO;null!==r;){if(!t)if(0!==e){var i=r.pendingLanes;if(0===i)var a=0;else{var s=r.suspendedLanes,o=r.pingedLanes;a=0xc000055&(a=(1<<31-a6(42|e)+1)-1&(i&~(s&~o)))?0xc000055&a|1:a?2|a:0}0!==a&&(n=!0,Q(r,a))}else a=oJ,0==(3&(a=y(r,r===oq?a:0)))||_(r,a)||(n=!0,Q(r,a));r=r.next}while(n)sB=!1}}function Z(){sz=sk=!1;var e=0;0!==sH&&(iU()&&(e=sH),sH=0);for(var t=sa(),n=null,r=sO;null!==r;){var i=r.next,a=K(r,t);0===a?(r.next=null,null===n?sO=i:n.next=i,null===i&&(sF=n)):(n=r,(0!==e||0!=(3&a))&&(sz=!0)),r=i}J(e,!1)}function K(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=-0x3c00001&e.pendingLanes;0<a;){var s=31-a6(a),o=1<<s,l=i[s];-1===l?(0==(o&n)||0!=(o&r))&&(i[s]=function(e,t){switch(e){case 1:case 2:case 4:case 8:return t+250;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}}(o,t)):l<=t&&(e.expiredLanes|=o),a&=~o}if(t=oq,n=oJ,n=y(e,e===t?n:0),r=e.callbackNode,0===n||e===t&&2===oZ||null!==e.cancelPendingCommit)return null!==r&&null!==r&&sn(r),e.callbackNode=null,e.callbackPriority=0;if(0==(3&n)||_(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&sn(r),T(n)){case 2:case 8:n=so;break;case 32:default:n=sl;break;case 0x10000000:n=su}return n=st(n,r=$.bind(null,e)),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&sn(r),e.callbackPriority=2,e.callbackNode=null,2}function $(e,t){var n=e.callbackNode;if(rS()&&e.callbackNode!==n)return null;var r=oJ;return 0===(r=y(e,e===oq?r:0))?null:(rn(e,r,t),K(e,sa()),null!=e.callbackNode&&e.callbackNode===n?$.bind(null,e):null)}function Q(e,t){if(rS())return null;rn(e,t,!0)}function ee(){return 0===sH&&(sH=x()),sH}function et(){if(0==--sG&&null!==sV){null!==sj&&(sj.status="fulfilled");var e=sV;sV=null,sW=0,sj=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function en(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function er(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ei(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ea(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,0!=(2&oX)){var i=r.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=q(e),X(e,null,n),t}return G(e,r,t,n),q(e)}function es(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,0!=(4194176&n))){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,E(e,n)}}function eo(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 s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===a?i=a=s:a=a.next=s,n=n.next}while(null!==n)null===a?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function el(){if(sq){var e=sj;if(null!==e)throw e}}function eu(e,t,n,r){sq=!1;var i=e.updateQueue;sX=!1;var a=i.firstBaseUpdate,s=i.lastBaseUpdate,o=i.shared.pending;if(null!==o){i.shared.pending=null;var l=o,u=l.next;l.next=null,null===s?a=u:s.next=u,s=l;var c=e.alternate;null!==c&&(o=(c=c.updateQueue).lastBaseUpdate)!==s&&(null===o?c.firstBaseUpdate=u:o.next=u,c.lastBaseUpdate=l)}if(null!==a){var h=i.baseState;for(s=0,c=u=l=null,o=a;;){var d=-0x20000001&o.lane,p=d!==o.lane;if(p?(oJ&d)===d:(r&d)===d){0!==d&&d===sW&&(sq=!0),null!==c&&(c=c.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var f=e,m=o;switch(d=t,m.tag){case 1:if("function"==typeof(f=m.payload)){h=f.call(n,h,d);break e}h=f;break e;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(d="function"==typeof(f=m.payload)?f.call(n,h,d):f))break e;h=rY({},h,d);break e;case 2:sX=!0}}null!==(d=o.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=i.callbacks)?i.callbacks=[d]:p.push(d))}else p={lane:d,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===c?(u=c=p,l=h):c=c.next=p,s|=d;if(null===(o=o.next))if(null===(o=i.shared.pending))break;else o=(p=o).next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}null===c&&(l=h),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,null===a&&(i.shared.lanes=0),o3|=s,e.lanes=s,e.memoizedState=h}}function ec(e,t){if("function"!=typeof e)throw Error(a(191,e));e.call(t)}function eh(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)ec(n[e],t)}function ed(e,t){if(sd(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!sY.call(t,i)||!sd(e[i],t[i]))return!1}return!0}function ep(e){return"fulfilled"===(e=e.status)||"rejected"===e}function ef(){}function em(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(ef,ef),t=n),t.status){case"fulfilled":return t.value;case"rejected":if((e=t.reason)===sJ)throw Error(a(483));throw e;default:if("string"==typeof t.status)t.then(ef,ef);else{if(null!==(e=oq)&&100<e.shellSuspendCounter)throw Error(a(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":if((e=t.reason)===sJ)throw Error(a(483));throw e}throw s$=t,sJ}}function eg(){if(null===s$)throw Error(a(459));var e=s$;return s$=null,e}function ev(e){var t=s0;return s0+=1,null===sQ&&(sQ=[]),em(sQ,e,t)}function ey(e,t){e.ref=void 0!==(t=t.props.ref)?t:null}function e_(e,t){if(t.$$typeof===rJ)throw Error(a(525));throw Error(a(31,"[object Object]"===(e=Object.prototype.toString.call(t))?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ex(e){return(0,e._init)(e._payload)}function eb(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function r(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function i(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function o(e,t){return(e=rL(e,t)).index=0,e.sibling=null,e}function l(t,n,r){return(t.index=r,e)?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=0x2000002,n):r:(t.flags|=0x2000002,n):(t.flags|=1048576,n)}function u(t){return e&&null===t.alternate&&(t.flags|=0x2000002),t}function c(e,t,n,r){return null===t||6!==t.tag?(t=rF(n,e.mode,r)).return=e:(t=o(t,n)).return=e,t}function h(e,t,n,r){var i=n.type;return i===r$?p(e,t,n.props.children,r,n.key):(null!==t&&(t.elementType===i||"object"==typeof i&&null!==i&&i.$$typeof===r9&&ex(i)===t.type)?ey(t=o(t,n.props),n):ey(t=rD(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function d(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=rk(n,e.mode,r)).return=e:(t=o(t,n.children||[])).return=e,t}function p(e,t,n,r,i){return null===t||7!==t.tag?(t=rU(n,e.mode,r,i)).return=e:(t=o(t,n)).return=e,t}function f(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=rF(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case rZ:return ey(n=rD(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case rK:return(t=rk(t,e.mode,n)).return=e,t;case r9:return f(e,t=(0,t._init)(t._payload),n)}if(il(t)||s(t))return(t=rU(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return f(e,ev(t),n);if(t.$$typeof===r3)return f(e,nl(e,t),n);e_(e,t)}return null}function m(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==i?null:c(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case rZ:return n.key===i?h(e,t,n,r):null;case rK:return n.key===i?d(e,t,n,r):null;case r9:return m(e,t,n=(i=n._init)(n._payload),r)}if(il(n)||s(n))return null!==i?null:p(e,t,n,r,null);if("function"==typeof n.then)return m(e,t,ev(n),r);if(n.$$typeof===r3)return m(e,t,nl(e,n),r);e_(e,n)}return null}function g(e,t,n,r,i){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return c(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case rZ:return h(t,e=e.get(null===r.key?n:r.key)||null,r,i);case rK:return d(t,e=e.get(null===r.key?n:r.key)||null,r,i);case r9:return g(e,t,n,r=(0,r._init)(r._payload),i)}if(il(r)||s(r))return p(t,e=e.get(n)||null,r,i,null);if("function"==typeof r.then)return g(e,t,n,ev(r),i);if(r.$$typeof===r3)return g(e,t,n,nl(t,r),i);e_(t,r)}return null}return function(c,h,d,p){try{s0=0;var v=function n(c,h,d,p){if("object"==typeof d&&null!==d&&d.type===r$&&null===d.key&&(d=d.props.children),"object"==typeof d&&null!==d){switch(d.$$typeof){case rZ:e:{for(var v=d.key;null!==h;){if(h.key===v){if((v=d.type)===r$){if(7===h.tag){r(c,h.sibling),(p=o(h,d.props.children)).return=c,c=p;break e}}else if(h.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===r9&&ex(v)===h.type){r(c,h.sibling),ey(p=o(h,d.props),d),p.return=c,c=p;break e}r(c,h);break}t(c,h),h=h.sibling}d.type===r$?(p=rU(d.props.children,c.mode,p,d.key)).return=c:(ey(p=rD(d.type,d.key,d.props,null,c.mode,p),d),p.return=c),c=p}return u(c);case rK:e:{for(v=d.key;null!==h;){if(h.key===v)if(4===h.tag&&h.stateNode.containerInfo===d.containerInfo&&h.stateNode.implementation===d.implementation){r(c,h.sibling),(p=o(h,d.children||[])).return=c,c=p;break e}else{r(c,h);break}t(c,h),h=h.sibling}(p=rk(d,c.mode,p)).return=c,c=p}return u(c);case r9:return n(c,h,d=(v=d._init)(d._payload),p)}if(il(d))return function(n,a,s,o){for(var u=null,c=null,h=a,d=a=0,p=null;null!==h&&d<s.length;d++){h.index>d?(p=h,h=null):p=h.sibling;var v=m(n,h,s[d],o);if(null===v){null===h&&(h=p);break}e&&h&&null===v.alternate&&t(n,h),a=l(v,a,d),null===c?u=v:c.sibling=v,c=v,h=p}if(d===s.length)return r(n,h),sR&&C(n,d),u;if(null===h){for(;d<s.length;d++)null!==(h=f(n,s[d],o))&&(a=l(h,a,d),null===c?u=h:c.sibling=h,c=h);return sR&&C(n,d),u}for(h=i(h);d<s.length;d++)null!==(p=g(h,n,d,s[d],o))&&(e&&null!==p.alternate&&h.delete(null===p.key?d:p.key),a=l(p,a,d),null===c?u=p:c.sibling=p,c=p);return e&&h.forEach(function(e){return t(n,e)}),sR&&C(n,d),u}(c,h,d,p);if(s(d)){if("function"!=typeof(v=s(d)))throw Error(a(150));return function(n,s,o,u){if(null==o)throw Error(a(151));for(var c=null,h=null,d=s,p=s=0,v=null,y=o.next();null!==d&&!y.done;p++,y=o.next()){d.index>p?(v=d,d=null):v=d.sibling;var _=m(n,d,y.value,u);if(null===_){null===d&&(d=v);break}e&&d&&null===_.alternate&&t(n,d),s=l(_,s,p),null===h?c=_:h.sibling=_,h=_,d=v}if(y.done)return r(n,d),sR&&C(n,p),c;if(null===d){for(;!y.done;p++,y=o.next())null!==(y=f(n,y.value,u))&&(s=l(y,s,p),null===h?c=y:h.sibling=y,h=y);return sR&&C(n,p),c}for(d=i(d);!y.done;p++,y=o.next())null!==(y=g(d,n,p,y.value,u))&&(e&&null!==y.alternate&&d.delete(null===y.key?p:y.key),s=l(y,s,p),null===h?c=y:h.sibling=y,h=y);return e&&d.forEach(function(e){return t(n,e)}),sR&&C(n,p),c}(c,h,d=v.call(d),p)}if("function"==typeof d.then)return n(c,h,ev(d),p);if(d.$$typeof===r3)return n(c,h,nl(c,d),p);e_(c,d)}return"string"==typeof d&&""!==d||"number"==typeof d||"bigint"==typeof d?(d=""+d,null!==h&&6===h.tag?(r(c,h.sibling),(p=o(h,d)).return=c):(r(c,h),(p=rF(d,c.mode,p)).return=c),u(c=p)):r(c,h)}(c,h,d,p);return sQ=null,v}catch(e){if(e===sJ)throw e;var y=n(29,e,null,c.mode);return y.lanes=p,y.return=c,y}finally{}}}function eS(e,t){g(s4,e=o1),g(s3,t),o1=e|t.baseLanes}function eM(){g(s4,o1),g(s3,s3.current)}function ew(){o1=s4.current,m(s3),m(s4)}function eE(e){var t=e.alternate;g(s8,1&s8.current),g(s5,e),null===s6&&(null===t||null!==s3.current?s6=e:null!==t.memoizedState&&(s6=e))}function eT(e){if(22===e.tag){if(g(s8,s8.current),g(s5,e),null===s6){var t=e.alternate;null!==t&&null!==t.memoizedState&&(s6=e)}}else eA(e)}function eA(){g(s8,s8.current),g(s5,s5.current)}function eC(e){m(s5),s6===e&&(s6=null),m(s8)}function eR(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||ap(n)||af(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}function eP(){throw Error(a(321))}function eI(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!sd(e[n],t[n]))return!1;return!0}function eL(e,t,n,r,i,a){return s9=a,s7=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,is.H=null===e||null===e.memoizedState?oh:od,oi=!1,a=n(r,i),oi=!1,or&&(a=eD(t,n,r,i)),eN(e),a}function eN(e){is.H=oc;var t=null!==oe&&null!==oe.next;if(s9=0,ot=oe=s7=null,on=!1,os=0,oo=null,t)throw Error(a(300));null===e||ov||null!==(e=e.dependencies)&&na(e)&&(ov=!0)}function eD(e,t,n,r){s7=e;var i=0;do{if(or&&(oo=null),os=0,or=!1,25<=i)throw Error(a(301));if(i+=1,ot=oe=null,null!=e.updateQueue){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,null!=s.memoCache&&(s.memoCache.index=0)}is.H=op,s=t(n,r)}while(or)return s}function eU(){var e=is.H,t=e.useState()[0];return t="function"==typeof t.then?eH(t):t,e=e.useState()[0],(null!==oe?oe.memoizedState:null)!==e&&(s7.flags|=1024),t}function eO(){var e=0!==oa;return oa=0,e}function eF(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ek(e){if(on){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}on=!1}s9=0,ot=oe=s7=null,or=!1,os=oa=0,oo=null}function ez(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ot?s7.memoizedState=ot=e:ot=ot.next=e,ot}function eB(){if(null===oe){var e=s7.alternate;e=null!==e?e.memoizedState:null}else e=oe.next;var t=null===ot?s7.memoizedState:ot.next;if(null!==t)ot=t,oe=e;else{if(null===e){if(null===s7.alternate)throw Error(a(467));throw Error(a(310))}e={memoizedState:(oe=e).memoizedState,baseState:oe.baseState,baseQueue:oe.baseQueue,queue:oe.queue,next:null},null===ot?s7.memoizedState=ot=e:ot=ot.next=e}return ot}function eH(e){var t=os;return os+=1,null===oo&&(oo=[]),e=em(oo,e,t),t=s7,null===(null===ot?t.memoizedState:ot.next)&&(is.H=null===(t=t.alternate)||null===t.memoizedState?oh:od),e}function eV(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return eH(e);if(e.$$typeof===r3)return no(e)}throw Error(a(438,String(e)))}function eG(e){var t=null,n=s7.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=s7.alternate;null!==r&&null!==(r=r.updateQueue)&&null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})}if(null==t&&(t={data:[],index:0}),null===n&&(n=ou(),s7.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ir;return t.index++,n}function eW(e,t){return"function"==typeof t?t(e):t}function ej(e){return eX(eB(),oe,e)}function eX(e,t,n){var r=e.queue;if(null===r)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,s=r.pending;if(null!==s){if(null!==i){var o=i.next;i.next=s.next,s.next=o}t.baseQueue=i=s,r.pending=null}if(s=e.baseState,null===i)e.memoizedState=s;else{t=i.next;var l=o=null,u=null,c=t,h=!1;do{var d=-0x20000001&c.lane;if(d!==c.lane?(oJ&d)===d:(s9&d)===d){var p=c.revertLane;if(0===p)null!==u&&(u=u.next={lane:0,revertLane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),d===sW&&(h=!0);else if((s9&p)===p){c=c.next,p===sW&&(h=!0);continue}else d={lane:0,revertLane:c.revertLane,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(l=u=d,o=s):u=u.next=d,s7.lanes|=p,o3|=p;d=c.action,oi&&n(s,d),s=c.hasEagerState?c.eagerState:n(s,d)}else p={lane:d,revertLane:c.revertLane,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(l=u=p,o=s):u=u.next=p,s7.lanes|=d,o3|=d;c=c.next}while(null!==c&&c!==t)if(null===u?o=s:u.next=l,!sd(s,e.memoizedState)&&(ov=!0,h&&null!==(n=sj)))throw n;e.memoizedState=s,e.baseState=o,e.baseQueue=u,r.lastRenderedState=s}return null===i&&(r.lanes=0),[e.memoizedState,r.dispatch]}function eq(e){var t=eB(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(null!==i){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i)sd(s,t.memoizedState)||(ov=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function eY(e,t,n){var r=s7,i=eB(),s=sR;if(s){if(void 0===n)throw Error(a(407));n=n()}else n=t();var o=!sd((oe||i).memoizedState,n);if(o&&(i.memoizedState=n,ov=!0),i=i.queue,tu(eK.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||null!==ot&&1&ot.memoizedState.tag){if(r.flags|=2048,ti(9,eZ.bind(null,r,i,n,t),{destroy:void 0},null),null===oq)throw Error(a(349));s||0!=(60&s9)||eJ(r,t,n)}return n}function eJ(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=s7.updateQueue)?(t=ou(),s7.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function eZ(e,t,n,r){t.value=n,t.getSnapshot=r,e$(t)&&eQ(e)}function eK(e,t,n){return n(function(){e$(t)&&eQ(e)})}function e$(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!sd(e,n)}catch(e){return!0}}function eQ(e){var t=j(e,2);null!==t&&rt(t,e,2)}function e0(e){var t=ez();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:eW,lastRenderedState:e},t}function e1(e,t,n,r){return e.baseState=n,eX(e,oe,"function"==typeof r?r:eW)}function e2(e,t,n,r,i){if(tR(e))throw Error(a(485));if(null!==(e=t.action)){var s={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){s.listeners.push(e)}};null!==is.T?n(!0):s.isTransition=!1,r(s),null===(n=t.pending)?(s.next=t.pending=s,e3(t,s)):(s.next=n.next,t.pending=n.next=s)}}function e3(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=is.T,s={};is.T=s;try{var o=n(i,r),l=is.S;null!==l&&l(s,o),e4(e,t,o)}catch(n){e6(e,t,n)}finally{is.T=a}}else try{a=n(i,r),e4(e,t,a)}catch(n){e6(e,t,n)}}function e4(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){e5(e,t,n)},function(n){return e6(e,t,n)}):e5(e,t,n)}function e5(e,t,n){t.status="fulfilled",t.value=n,e8(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,e3(e,n)))}function e6(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do t.status="rejected",t.reason=n,e8(t),t=t.next;while(t!==r)}e.action=null}function e8(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function e9(e,t){return t}function e7(e,t){if(sR){var n=oq.formState;if(null!==n){e:{var r=s7;if(sR){if(sC){var i=av(sC,sI);if(i){sC=a_(i),r=ay(i);break e}}O(r)}r=!1}r&&(t=n[0])}}(n=ez()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e9,lastRenderedState:t},n.queue=r,n=tT.bind(null,s7,r),r.dispatch=n,r=e0(!1);var a=tC.bind(null,s7,!1,r.queue);return r=ez(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=e2.bind(null,s7,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function te(e){return tt(eB(),oe,e)}function tt(e,t,n){t=eX(e,t,e9)[0],e=ej(eW)[0],t="object"==typeof t&&null!==t&&"function"==typeof t.then?eH(t):t;var r=eB(),i=r.queue,a=i.dispatch;return n!==r.memoizedState&&(s7.flags|=2048,ti(9,tn.bind(null,i,n),{destroy:void 0},null)),[t,a,e]}function tn(e,t){e.action=t}function tr(e){var t=eB(),n=oe;if(null!==n)return tt(t,n,e);eB(),t=t.memoizedState;var r=(n=eB()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ti(e,t,n,r){return e={tag:e,create:t,inst:n,deps:r,next:null},null===(t=s7.updateQueue)&&(t=ou(),s7.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ta(){return eB().memoizedState}function ts(e,t,n,r){var i=ez();s7.flags|=e,i.memoizedState=ti(1|t,n,{destroy:void 0},void 0===r?null:r)}function to(e,t,n,r){var i=eB();r=void 0===r?null:r;var a=i.memoizedState.inst;null!==oe&&null!==r&&eI(r,oe.memoizedState.deps)?i.memoizedState=ti(t,n,a,r):(s7.flags|=e,i.memoizedState=ti(1|t,n,a,r))}function tl(e,t){ts(8390656,8,e,t)}function tu(e,t){to(2048,8,e,t)}function tc(e,t){return to(4,2,e,t)}function th(e,t){return to(4,4,e,t)}function td(e,t){if("function"==typeof t){var n=t(e=e());return function(){"function"==typeof n?n():t(null)}}if(null!=t)return t.current=e=e(),function(){t.current=null}}function tp(e,t,n){n=null!=n?n.concat([e]):null,to(4,4,td.bind(null,t,e),n)}function tf(){}function tm(e,t){var n=eB();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&eI(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function tg(e,t){var n=eB();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&eI(t,r[1])?r[0]:(n.memoizedState=[r=e(),t],r)}function tv(e,t,n){return void 0===n||0!=(0x40000000&s9)?e.memoizedState=t:(e.memoizedState=n,e=re(),s7.lanes|=e,o3|=e,n)}function ty(e,t,n,r){return sd(n,t)?n:null!==s3.current?(sd(e=tv(e,n,r),t)||(ov=!0),e):0==(42&s9)?(ov=!0,e.memoizedState=n):(e=re(),s7.lanes|=e,o3|=e,t)}function t_(e,t,n,r,i){var a=iN();iL(0!==a&&8>a?a:8);var s=is.T,o={};is.T=o,tC(e,!1,t,n);try{var l=i(),u=is.S;if(null!==u&&u(o,l),null!==l&&"object"==typeof l&&"function"==typeof l.then){var c,h,d=(c=[],h={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},l.then(function(){h.status="fulfilled",h.value=r;for(var e=0;e<c.length;e++)(0,c[e])(r)},function(e){for(h.status="rejected",h.reason=e,e=0;e<c.length;e++)(0,c[e])(void 0)}),h);tA(e,t,d,n7(e))}else tA(e,t,r,n7(e))}catch(n){tA(e,t,{then:function(){},status:"rejected",reason:n},n7())}finally{iL(a),is.T=s}}function tx(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:iV,baseState:iV,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:eW,lastRenderedState:iV},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:eW,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function tb(){return no(iG)}function tS(){return eB().memoizedState}function tM(){return eB().memoizedState}function tw(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=n7(),r=ea(t,e=ei(n),n);null!==r&&(rt(r,t,n),es(r,t,n)),t={cache:nc()},e.payload=t;return}t=t.return}}function tE(e,t,n){var r=n7();n={lane:r,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},tR(e)?tP(t,n):null!==(n=W(e,t,n,r))&&(rt(n,e,r),tI(n,t,r))}function tT(e,t,n){tA(e,t,n,n7())}function tA(e,t,n,r){var i={lane:r,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(tR(e))tP(t,i);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,o=a(s,n);if(i.hasEagerState=!0,i.eagerState=o,sd(o,s))return G(e,t,i,0),null===oq&&V(),!1}catch(e){}finally{}if(null!==(n=W(e,t,i,r)))return rt(n,e,r),tI(n,t,r),!0}return!1}function tC(e,t,n,r){if(r={lane:2,revertLane:ee(),action:r,hasEagerState:!1,eagerState:null,next:null},tR(e)){if(t)throw Error(a(479))}else null!==(t=W(e,n,r,2))&&rt(t,e,2)}function tR(e){var t=e.alternate;return e===s7||null!==t&&t===s7}function tP(e,t){or=on=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tI(e,t,n){if(0!=(4194176&n)){var r=t.lanes;r&=e.pendingLanes,t.lanes=n|=r,E(e,n)}}function tL(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:rY({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}function tN(e,t,n,r,i,a,s){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,s):!t.prototype||!t.prototype.isPureReactComponent||!ed(n,r)||!ed(i,a)}function tD(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&&of.enqueueReplaceState(t,t.state,null)}function tU(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=rY({},n)),e)void 0===n[i]&&(n[i]=e[i]);return n}function tO(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function tF(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function tk(e,t,n){return(n=ei(n)).tag=3,n.payload={element:null},n.callback=function(){tO(e,t)},n}function tz(e){return(e=ei(e)).tag=3,e}function tB(e,t,n,r){var i=n.type.getDerivedStateFromError;if("function"==typeof i){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){tF(t,n,r)}}var s=n.stateNode;null!==s&&"function"==typeof s.componentDidCatch&&(e.callback=function(){tF(t,n,r),"function"!=typeof i&&(null===li?li=new Set([this]):li.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}function tH(e,t,n,r){t.child=null===e?s2(t,null,n,r):s1(t,e.child,n,r)}function tV(e,t,n,r,i){n=n.render;var a=t.ref;if("ref"in r){var s={};for(var o in r)"ref"!==o&&(s[o]=r[o])}else s=r;return(ns(t),r=eL(e,t,n,s,a,i),o=eO(),null===e||ov)?(sR&&o&&P(t),t.flags|=1,tH(e,t,r,i),t.child):(eF(e,t,i),t8(e,t,i))}function tG(e,t,n,r,i){if(null===e){var a=n.type;return"function"!=typeof a||rI(a)||void 0!==a.defaultProps||null!==n.compare?((e=rD(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,tW(e,t,a,r,i))}if(a=e.child,!t9(e,i)){var s=a.memoizedProps;if((n=null!==(n=n.compare)?n:ed)(s,r)&&e.ref===t.ref)return t8(e,t,i)}return t.flags|=1,(e=rL(a,r)).ref=t.ref,e.return=t,t.child=e}function tW(e,t,n,r,i){if(null!==e){var a=e.memoizedProps;if(ed(a,r)&&e.ref===t.ref)if(ov=!1,t.pendingProps=r=a,!t9(e,i))return t.lanes=e.lanes,t8(e,t,i);else 0!=(131072&e.flags)&&(ov=!0)}return tY(e,t,n,r,i)}function tj(e,t,n){var r=t.pendingProps,i=r.children,a=0!=(2&t.stateNode._pendingVisibility),s=null!==e?e.memoizedState:null;if(tq(e,t),"hidden"===r.mode||a){if(0!=(128&t.flags)){if(r=null!==s?s.baseLanes|n:n,null!==e){for(a=0,i=t.child=e.child;null!==i;)a=a|i.lanes|i.childLanes,i=i.sibling;t.childLanes=a&~r}else t.childLanes=0,t.child=null;return tX(e,t,r,n)}if(0==(0x20000000&n))return t.lanes=t.childLanes=0x20000000,tX(e,t,null!==s?s.baseLanes|n:n,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&np(t,null!==s?s.cachePool:null),null!==s?eS(t,s):eM(),eT(t)}else null!==s?(np(t,s.cachePool),eS(t,s),eA(t),t.memoizedState=null):(null!==e&&np(t,null),eM(),eA(t));return tH(e,t,i,n),t.child}function tX(e,t,n,r){var i=nd();return t.memoizedState={baseLanes:n,cachePool:i=null===i?null:{parent:iT?oE._currentValue:oE._currentValue2,pool:i}},null!==e&&np(t,null),eM(),eT(t),null!==e&&ni(e,t,r,!0),null}function tq(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=2097664);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(a(284));(null===e||e.ref!==n)&&(t.flags|=2097664)}}function tY(e,t,n,r,i){return(ns(t),n=eL(e,t,n,r,void 0,i),r=eO(),null===e||ov)?(sR&&r&&P(t),t.flags|=1,tH(e,t,n,i),t.child):(eF(e,t,i),t8(e,t,i))}function tJ(e,t,n,r,i,a){return(ns(t),t.updateQueue=null,n=eD(t,r,n,i),eN(e),r=eO(),null===e||ov)?(sR&&r&&P(t),t.flags|=1,tH(e,t,n,a),t.child):(eF(e,t,a),t8(e,t,a))}function tZ(e,t,n,r,i){if(ns(t),null===t.stateNode){var a=a5,s=n.contextType;"object"==typeof s&&null!==s&&(a=no(s)),t.memoizedState=null!==(a=new n(r,a)).state&&void 0!==a.state?a.state:null,a.updater=of,t.stateNode=a,a._reactInternals=t,(a=t.stateNode).props=r,a.state=t.memoizedState,a.refs={},en(t),s=n.contextType,a.context="object"==typeof s&&null!==s?no(s):a5,a.state=t.memoizedState,"function"==typeof(s=n.getDerivedStateFromProps)&&(tL(t,n,s,r),a.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(s=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),s!==a.state&&of.enqueueReplaceState(a,a.state,null),eu(t,r,a,i),el(),a.state=t.memoizedState),"function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){a=t.stateNode;var o=t.memoizedProps,l=tU(n,o);a.props=l;var u=a.context,c=n.contextType;s=a5,"object"==typeof c&&null!==c&&(s=no(c));var h=n.getDerivedStateFromProps;c="function"==typeof h||"function"==typeof a.getSnapshotBeforeUpdate,o=t.pendingProps!==o,c||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(o||u!==s)&&tD(t,a,r,s),sX=!1;var d=t.memoizedState;a.state=d,eu(t,r,a,i),el(),u=t.memoizedState,o||d!==u||sX?("function"==typeof h&&(tL(t,n,h,r),u=t.memoizedState),(l=sX||tN(t,n,l,r,d,u,s))?(c||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=s,r=l):("function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,er(e,t),c=tU(n,s=t.memoizedProps),a.props=c,h=t.pendingProps,d=a.context,u=n.contextType,l=a5,"object"==typeof u&&null!==u&&(l=no(u)),(u="function"==typeof(o=n.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==h||d!==l)&&tD(t,a,r,l),sX=!1,d=t.memoizedState,a.state=d,eu(t,r,a,i),el();var p=t.memoizedState;s!==h||d!==p||sX||null!==e&&null!==e.dependencies&&na(e.dependencies)?("function"==typeof o&&(tL(t,n,o,r),p=t.memoizedState),(c=sX||tN(t,n,c,r,d,p,l)||null!==e&&null!==e.dependencies&&na(e.dependencies))?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=l,r=c):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,tq(e,t),r=0!=(128&t.flags),a||r?(a=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:a.render(),t.flags|=1,null!==e&&r?(t.child=s1(t,e.child,null,i),t.child=s1(t,null,n,i)):tH(e,t,n,i),t.memoizedState=a.state,e=t.child):e=t8(e,t,i),e}function tK(e,t,n,r){return B(),t.flags|=256,tH(e,t,n,r),t.child}function t$(e){return{baseLanes:e,cachePool:nf()}}function tQ(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=o6),e}function t0(e,t,r){var i,s=t.pendingProps,o=!1,l=0!=(128&t.flags);if((i=l)||(i=(null===e||null!==e.memoizedState)&&0!=(2&s8.current)),i&&(o=!0,t.flags&=-129),i=0!=(32&t.flags),t.flags&=-33,null===e){if(sR){if(o?eE(t):eA(t),sR){var u,c=sC;(u=c)&&(null!==(c=aE(c,sI))?(t.memoizedState={dehydrated:c,treeContext:null!==sx?{id:sb,overflow:sS}:null,retryLane:0x20000000},(u=n(18,null,null,0)).stateNode=c,u.return=t,t.child=u,sA=t,sC=null,u=!0):u=!1),u||O(t)}if(null!==(c=t.memoizedState)&&null!==(c=c.dehydrated))return af(c)?t.lanes=16:t.lanes=0x20000000,null;eC(t)}return(c=s.children,s=s.fallback,o)?(eA(t),c=t2({mode:"hidden",children:c},o=t.mode),s=rU(s,o,r,null),c.return=t,s.return=t,c.sibling=s,t.child=c,(o=t.child).memoizedState=t$(r),o.childLanes=tQ(e,i,r),t.memoizedState=oy,s):(eE(t),t1(t,c))}if(null!==(u=e.memoizedState)&&null!==(c=u.dehydrated)){if(l)256&t.flags?(eE(t),t.flags&=-257,t=t3(e,t,r)):null!==t.memoizedState?(eA(t),t.child=e.child,t.flags|=128,t=null):(eA(t),o=s.fallback,c=t.mode,s=t2({mode:"visible",children:s.children},c),o=rU(o,c,r,null),o.flags|=2,s.return=t,o.return=t,s.sibling=o,t.child=s,s1(t,e.child,null,r),(s=t.child).memoizedState=t$(r),s.childLanes=tQ(e,i,r),t.memoizedState=oy,t=o);else if(eE(t),af(c))i=am(c).digest,(s=Error(a(419))).stack="",s.digest=i,H({value:s,source:null,stack:null}),t=t3(e,t,r);else if(ov||ni(e,t,r,!1),i=0!=(r&e.childLanes),ov||i){if(null!==(i=oq)){if(0!=(42&(s=r&-r)))s=1;else switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;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 0x1000000:case 0x2000000:s=64;break;case 0x10000000:s=0x8000000;break;default:s=0}if(0!==(s=0!=(s&(i.suspendedLanes|r))?0:s)&&s!==u.retryLane)throw u.retryLane=s,j(e,s),rt(i,e,s),og}ap(c)||rp(),t=t3(e,t,r)}else ap(c)?(t.flags|=128,t.child=e.child,ag(c,t=rC.bind(null,e)),t=null):(e=u.treeContext,iR&&(sC=aS(c),sA=t,sR=!0,sP=null,sI=!1,null!==e&&(sy[s_++]=sb,sy[s_++]=sS,sy[s_++]=sx,sb=e.id,sS=e.overflow,sx=t)),t=t1(t,s.children),t.flags|=4096);return t}return o?(eA(t),o=s.fallback,c=t.mode,l=(u=e.child).sibling,(s=rL(u,{mode:"hidden",children:s.children})).subtreeFlags=0x1e00000&u.subtreeFlags,null!==l?o=rL(l,o):(o=rU(o,c,r,null),o.flags|=2),o.return=t,s.return=t,s.sibling=o,t.child=s,s=o,o=t.child,null===(c=e.child.memoizedState)?c=t$(r):(null!==(u=c.cachePool)?(l=iT?oE._currentValue:oE._currentValue2,u=u.parent!==l?{parent:l,pool:l}:u):u=nf(),c={baseLanes:c.baseLanes|r,cachePool:u}),o.memoizedState=c,o.childLanes=tQ(e,i,r),t.memoizedState=oy,s):(eE(t),e=(r=e.child).sibling,(r=rL(r,{mode:"visible",children:s.children})).return=t,r.sibling=null,null!==e&&(null===(i=t.deletions)?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=r,t.memoizedState=null,r)}function t1(e,t){return(t=t2({mode:"visible",children:t},e.mode)).return=e,e.child=t}function t2(e,t){return rO(e,t,0,null)}function t3(e,t,n){return s1(t,e.child,null,n),e=t1(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function t4(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),nn(e.return,t,n)}function t5(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 t6(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(tH(e,t,r.children,n),0!=(2&(r=s8.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&&t4(e,n,t);else if(19===e.tag)t4(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;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}switch(g(s8,r),i){case"forwards":for(i=null,n=t.child;null!==n;)null!==(e=n.alternate)&&null===eR(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),t5(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===eR(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}t5(t,!0,n,null,a);break;case"together":t5(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function t8(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),o3|=t.lanes,0==(n&t.childLanes)){if(null===e)return null;else if(ni(e,t,n,!1),0==(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=rL(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=rL(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function t9(e,t){return 0!=(e.lanes&t)||!!(null!==(e=e.dependencies)&&na(e))}function t7(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)ov=!0;else{if(!t9(e,n)&&0==(128&t.flags))return ov=!1,function(e,t,n){switch(t.tag){case 3:L(t,t.stateNode.containerInfo),ne(t,oE,e.memoizedState.cache),B();break;case 27:case 5:D(t);break;case 4:L(t,t.stateNode.containerInfo);break;case 10:ne(t,t.type,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r){if(null!==r.dehydrated)return eE(t),t.flags|=128,null;if(0!=(n&t.child.childLanes))return t0(e,t,n);return eE(t),null!==(e=t8(e,t,n))?e.sibling:null}eE(t);break;case 19:var i=0!=(128&e.flags);if((r=0!=(n&t.childLanes))||(ni(e,t,n,!1),r=0!=(n&t.childLanes)),i){if(r)return t6(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),g(s8,s8.current),!r)return null;break;case 22:case 23:return t.lanes=0,tj(e,t,n);case 24:ne(t,oE,e.memoizedState.cache)}return t8(e,t,n)}(e,t,n);ov=0!=(131072&e.flags)}else ov=!1,sR&&0!=(1048576&t.flags)&&R(t,sv,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var r=t.elementType,i=r._init;if(r=i(r._payload),t.type=r,"function"==typeof r)rI(r)?(e=tU(r,e),t.tag=1,t=tZ(null,t,r,e,n)):(t.tag=0,t=tY(null,t,r,e,n));else{if(null!=r){if((i=r.$$typeof)===r4){t.tag=11,t=tV(null,t,r,e,n);break e}else if(i===r8){t.tag=14,t=tG(null,t,r,e,n);break e}}throw Error(a(306,t=o(r)||r,""))}}return t;case 0:return tY(e,t,t.type,t.pendingProps,n);case 1:return i=tU(r=t.type,t.pendingProps),tZ(e,t,r,i,n);case 3:e:{if(L(t,t.stateNode.containerInfo),null===e)throw Error(a(387));var s=t.pendingProps;r=(i=t.memoizedState).element,er(e,t),eu(t,s,null,n);var l=t.memoizedState;if(ne(t,oE,s=l.cache),s!==i.cache&&nr(t,[oE],n,!0),el(),s=l.element,iR&&i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=i,t.memoizedState=i,256&t.flags){t=tK(e,t,s,n);break e}else if(s!==r){H(r=A(Error(a(424)),t)),t=tK(e,t,s,n);break e}else for(iR&&(sC=ab(t.stateNode.containerInfo),sA=t,sR=!0,sP=null,sI=!0),n=s2(t,null,s,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling;else{if(B(),s===r){t=t8(e,t,n);break e}tH(e,t,s,n)}t=t.child}return t;case 26:if(aF)return tq(e,t),null===e?(n=aB(t.type,null,t.pendingProps,null))?t.memoizedState=n:sR||(t.stateNode=aX(t.type,t.pendingProps,sE.current,t)):t.memoizedState=aB(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(aK)return D(t),null===e&&aK&&sR&&(r=t.stateNode=a$(t.type,t.pendingProps,sE.current,sM.current,!1),sA=t,sI=!0,sC=ax(r)),r=t.pendingProps.children,null!==e||sR?tH(e,t,r,n):t.child=s1(t,null,r,n),tq(e,t),t.child;case 5:return null===e&&sR&&(aU(t.type,t.pendingProps,sM.current),(i=r=sC)&&(null!==(r=aM(r,t.type,t.pendingProps,sI))?(t.stateNode=r,sA=t,sC=ax(r),sI=!1,i=!0):i=!1),i||O(t)),D(t),i=t.type,s=t.pendingProps,l=null!==e?e.memoizedProps:null,r=s.children,ib(i,s)?r=null:null!==l&&ib(i,l)&&(t.flags|=32),null!==t.memoizedState&&(i=eL(e,t,eU,null,null,n),iT?iG._currentValue=i:iG._currentValue2=i),tq(e,t),tH(e,t,r,n),t.child;case 6:return null===e&&sR&&(aO(t.pendingProps,sM.current),(e=n=sC)&&(null!==(n=aw(n,t.pendingProps,sI))?(t.stateNode=n,sA=t,sC=null,e=!0):e=!1),e||O(t)),null;case 13:return t0(e,t,n);case 4:return L(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=s1(t,null,r,n):tH(e,t,r,n),t.child;case 11:return tV(e,t,t.type,t.pendingProps,n);case 7:return tH(e,t,t.pendingProps,n),t.child;case 8:case 12:return tH(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,ne(t,t.type,r.value),tH(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,ns(t),r=r(i=no(i)),t.flags|=1,tH(e,t,r,n),t.child;case 14:return tG(e,t,t.type,t.pendingProps,n);case 15:return tW(e,t,t.type,t.pendingProps,n);case 19:return t6(e,t,n);case 22:return tj(e,t,n);case 24:return ns(t),r=no(oE),null===e?(null===(i=nd())&&(i=oq,s=nc(),i.pooledCache=s,s.refCount++,null!==s&&(i.pooledCacheLanes|=n),i=s),t.memoizedState={parent:r,cache:i},en(t),ne(t,oE,i)):(0!=(e.lanes&n)&&(er(e,t),eu(t,null,null,n),el()),i=e.memoizedState,s=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=i),ne(t,oE,r)):(ne(t,oE,r=s.cache),r!==i.cache&&nr(t,[oE],n,!0))),tH(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ne(e,t,n){iT?(g(o_,t._currentValue),t._currentValue=n):(g(o_,t._currentValue2),t._currentValue2=n)}function nt(e){var t=o_.current;iT?e._currentValue=t:e._currentValue2=t,m(o_)}function nn(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 nr(e,t,n,r){var i=e.child;for(null!==i&&(i.return=e);null!==i;){var s=i.dependencies;if(null!==s){var o=i.child;s=s.firstContext;e:for(;null!==s;){var l=s;s=i;for(var u=0;u<t.length;u++)if(l.context===t[u]){s.lanes|=n,null!==(l=s.alternate)&&(l.lanes|=n),nn(s.return,n,e),r||(o=null);break e}s=l.next}}else if(18===i.tag){if(null===(o=i.return))throw Error(a(341));o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),nn(o,n,e),o=null}else o=i.child;if(null!==o)o.return=i;else for(o=i;null!==o;){if(o===e){o=null;break}if(null!==(i=o.sibling)){i.return=o.return,o=i;break}o=o.return}i=o}}function ni(e,t,n,r){e=null;for(var i=t,s=!1;null!==i;){if(!s){if(0!=(524288&i.flags))s=!0;else if(0!=(262144&i.flags))break}if(10===i.tag){var o=i.alternate;if(null===o)throw Error(a(387));if(null!==(o=o.memoizedProps)){var l=i.type;sd(i.pendingProps.value,o.value)||(null!==e?e.push(l):e=[l])}}else if(i===sT.current){if(null===(o=i.alternate))throw Error(a(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(null!==e?e.push(iG):e=[iG])}i=i.return}null!==e&&nr(t,e,n,r),t.flags|=262144}function na(e){for(e=e.firstContext;null!==e;){var t=e.context;if(!sd(iT?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}function ns(e){ox=e,ob=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function no(e){return nu(ox,e)}function nl(e,t){return null===ox&&ns(e),nu(e,t)}function nu(e,t){var n=iT?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:n,next:null},null===ob){if(null===e)throw Error(a(308));ob=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ob=ob.next=t;return n}function nc(){return{controller:new oS,data:new Map,refCount:0}}function nh(e){e.refCount--,0===e.refCount&&oM(ow,function(){e.controller.abort()})}function nd(){var e=oA.current;return null!==e?e:oq.pooledCache}function np(e,t){null===t?g(oA,oA.current):g(oA,t.pool)}function nf(){var e=nd();return null===e?null:{parent:iT?oE._currentValue:oE._currentValue2,pool:e}}function nm(e){e.flags|=4}function ng(e,t){if(null!==e&&e.child===t.child)return!1;if(0!=(16&t.flags))return!0;for(e=t.child;null!==e;){if(0!=(13878&e.flags)||0!=(13878&e.subtreeFlags))return!0;e=e.sibling}return!1}function nv(e,t,n,r){if(iA)for(n=t.child;null!==n;){if(5===n.tag||6===n.tag)i_(e,n.stateNode);else if(!(4===n.tag||aK&&27===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}else if(iC)for(var i=t.child;null!==i;){if(5===i.tag){var a=i.stateNode;n&&r&&(a=ah(a,i.type,i.memoizedProps)),i_(e,a)}else if(6===i.tag)a=i.stateNode,n&&r&&(a=ad(a,i.memoizedProps)),i_(e,a);else if(4!==i.tag){if(22===i.tag&&null!==i.memoizedState)null!==(a=i.child)&&(a.return=i),nv(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}}function ny(e,t){if(iC&&ng(e,t)){var n=(e=t.stateNode).containerInfo,r=ao();!function e(t,n,r,i){if(iC)for(var a=n.child;null!==a;){if(5===a.tag){var s=a.stateNode;r&&i&&(s=ah(s,a.type,a.memoizedProps)),al(t,s)}else if(6===a.tag)s=a.stateNode,r&&i&&(s=ad(s,a.memoizedProps)),al(t,s);else if(4!==a.tag){if(22===a.tag&&null!==a.memoizedState)null!==(s=a.child)&&(s.return=a),e(t,a,null===a.memoizedProps||"manual"!==a.memoizedProps.mode,!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}}(r,t,!1,!1),e.pendingChildren=r,nm(t),au(n,r)}}function n_(e,t,n,r){if(iA)e.memoizedProps!==r&&nm(t);else if(iC){var i=e.stateNode,a=e.memoizedProps;if((e=ng(e,t))||a!==r){var s=sM.current;(a=as(i,n,a,r,!e,null))===i?t.stateNode=i:(ix(a,n,r,s)&&nm(t),t.stateNode=a,e?nv(a,t,!1,!1):nm(t))}else t.stateNode=i}}function nx(e,t,n){if(iF(t,n)){if(e.flags|=0x1000000,!ik(t,n))if(rc())e.flags|=8192;else throw s$=sK,sZ}else e.flags&=-0x1000001}function nb(e,t){if(aY(t)){if(e.flags|=0x1000000,!aJ(t))if(rc())e.flags|=8192;else throw s$=sK,sZ}else e.flags&=-0x1000001}function nS(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?b():0x20000000,e.lanes|=t,o8|=t)}function nM(e,t){if(!sR)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 nw(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|=0x1e00000&i.subtreeFlags,r|=0x1e00000&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 nE(e,t){switch(I(t),t.tag){case 3:nt(oE),N();break;case 26:case 27:case 5:U(t);break;case 4:N();break;case 13:eC(t);break;case 19:m(s8);break;case 10:nt(t.type);break;case 22:case 23:eC(t),ew(),null!==e&&m(oA);break;case 24:nt(oE)}}function nT(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create;n.inst.destroy=r=a()}n=n.next}while(n!==i)}}catch(e){rw(t,t.return,e)}}function nA(e,t,n){try{var r=t.updateQueue,i=null!==r?r.lastEffect:null;if(null!==i){var a=i.next;r=a;do{if((r.tag&e)===e){var s=r.inst,o=s.destroy;if(void 0!==o){s.destroy=void 0,i=t;try{o()}catch(e){rw(i,n,e)}}}r=r.next}while(r!==a)}}catch(e){rw(t,t.return,e)}}function nC(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{eh(t,n)}catch(t){rw(e,e.return,t)}}}function nR(e,t,n){n.props=tU(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){rw(e,t,n)}}function nP(e,t){try{var n=e.ref;if(null!==n){var r=e.stateNode;switch(e.tag){case 26:case 27:case 5:var i=id(r);break;default:i=r}"function"==typeof n?e.refCleanup=n(i):n.current=i}}catch(n){rw(e,t,n)}}function nI(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(n){rw(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){rw(e,t,n)}else n.current=null}function nL(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{i4(r,t,n,e)}catch(t){rw(e,e.return,t)}}function nN(e,t,n){try{i5(e.stateNode,e.type,n,t,e)}catch(t){rw(e,e.return,t)}}function nD(e){return 5===e.tag||3===e.tag||!!aF&&26===e.tag||!!aK&&27===e.tag||4===e.tag}function nU(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||nD(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&(aK?27!==e.tag:1)&&18!==e.tag;){if(2&e.flags||null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function nO(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?i6(n,e,t):i1(n,e);else if(!(4===r||aK&&27===r)&&null!==(e=e.child))for(nO(e,t,n),e=e.sibling;null!==e;)nO(e,t,n),e=e.sibling}function nF(e,t,n){e=e.containerInfo;try{ac(e,n)}catch(e){rw(t,t.return,e)}}function nk(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:nX(e,n),4&r&&nT(5,n);break;case 1:if(nX(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){rw(n,n.return,e)}else{var i=tU(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){rw(n,n.return,e)}}64&r&&nC(n),512&r&&nP(n,n.return);break;case 3:if(nX(e,n),64&r&&null!==(r=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 27:case 5:e=id(n.child.stateNode);break;case 1:e=n.child.stateNode}try{eh(r,e)}catch(e){rw(n,n.return,e)}}break;case 26:if(aF){nX(e,n),512&r&&nP(n,n.return);break}case 27:case 5:nX(e,n),null===t&&4&r&&nL(n),512&r&&nP(n,n.return);break;case 12:default:nX(e,n);break;case 13:nX(e,n),4&r&&nH(e,n);break;case 22:if(!(i=null!==n.memoizedState||oC)){t=null!==t&&null!==t.memoizedState||oR;var a=oC,s=oR;oC=i,(oR=t)&&!s?function e(t,n,r){for(r=r&&0!=(8772&n.subtreeFlags),n=n.child;null!==n;){var i=n.alternate,a=t,s=n,o=s.flags;switch(s.tag){case 0:case 11:case 15:e(a,s,r),nT(4,s);break;case 1:if(e(a,s,r),"function"==typeof(a=(i=s).stateNode).componentDidMount)try{a.componentDidMount()}catch(e){rw(i,i.return,e)}if(null!==(a=(i=s).updateQueue)){var l=i.stateNode;try{var u=a.shared.hiddenCallbacks;if(null!==u)for(a.shared.hiddenCallbacks=null,a=0;a<u.length;a++)ec(u[a],l)}catch(e){rw(i,i.return,e)}}r&&64&o&&nC(s),nP(s,s.return);break;case 26:case 27:case 5:e(a,s,r),r&&null===i&&4&o&&nL(s),nP(s,s.return);break;case 12:default:e(a,s,r);break;case 13:e(a,s,r),r&&4&o&&nH(a,s);break;case 22:null===s.memoizedState&&e(a,s,r),nP(s,s.return)}n=n.sibling}}(e,n,0!=(8772&n.subtreeFlags)):nX(e,n),oC=a,oR=s}512&r&&("manual"===n.memoizedProps.mode?nP(n,n.return):nI(n,n.return))}}function nz(e,t,n){for(n=n.child;null!==n;)nB(e,t,n),n=n.sibling}function nB(e,t,n){if(sh&&"function"==typeof sh.onCommitFiberUnmount)try{sh.onCommitFiberUnmount(sc,n)}catch(e){}switch(n.tag){case 26:if(aF){oR||nI(n,t),nz(e,t,n),n.memoizedState?aV(n.memoizedState):n.stateNode&&aj(n.stateNode);break}case 27:if(aK){oR||nI(n,t);var r=oD,i=oU;oD=n.stateNode,nz(e,t,n),a1(n.stateNode),oD=r,oU=i;break}case 5:oR||nI(n,t);case 6:if(iA){if(r=oD,i=oU,oD=null,nz(e,t,n),oD=r,oU=i,null!==oD)if(oU)try{i7(oD,n.stateNode)}catch(e){rw(n,t,e)}else try{i9(oD,n.stateNode)}catch(e){rw(n,t,e)}}else nz(e,t,n);break;case 18:iA&&null!==oD&&(oU?aN(oD,n.stateNode):aL(oD,n.stateNode));break;case 4:iA?(r=oD,i=oU,oD=n.stateNode.containerInfo,oU=!0,nz(e,t,n),oD=r,oU=i):(iC&&nF(n.stateNode,n,ao()),nz(e,t,n));break;case 0:case 11:case 14:case 15:oR||nA(2,n,t),oR||nA(4,n,t),nz(e,t,n);break;case 1:oR||(nI(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&nR(n,t,r)),nz(e,t,n);break;case 21:default:nz(e,t,n);break;case 22:oR||nI(n,t),oR=(r=oR)||null!==n.memoizedState,nz(e,t,n),oR=r}}function nH(e,t){if(iR&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))try{aI(e)}catch(e){rw(t,t.return,e)}}function nV(e,t){var n=function(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new oI),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new oI),t;default:throw Error(a(435,e.tag))}}(e);t.forEach(function(t){var r=rR.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}function nG(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r],s=e,o=t;if(iA){var l=o;e:for(;null!==l;){switch(l.tag){case 27:case 5:oD=l.stateNode,oU=!1;break e;case 3:case 4:oD=l.stateNode.containerInfo,oU=!0;break e}l=l.return}if(null===oD)throw Error(a(160));nB(s,o,i),oD=null,oU=!1}else nB(s,o,i);null!==(s=i.alternate)&&(s.return=null),i.return=null}if(13878&t.subtreeFlags)for(t=t.child;null!==t;)nW(t,e),t=t.sibling}function nW(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:nG(t,e),nj(e),4&r&&(nA(3,e,e.return),nT(3,e),nA(5,e,e.return));break;case 1:nG(t,e),nj(e),512&r&&(oR||null===n||nI(n,n.return)),64&r&&oC&&null!==(e=e.updateQueue)&&null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r));break;case 26:if(aF){var i=oO;nG(t,e),nj(e),512&r&&(oR||null===n||nI(n,n.return)),4&r&&(r=null!==n?n.memoizedState:null,t=e.memoizedState,null===n?null===t?null===e.stateNode?e.stateNode=aG(i,e.type,e.memoizedProps,e):aW(i,e.type,e.stateNode):e.stateNode=aH(i,t,e.memoizedProps):r!==t?(null===r?null!==n.stateNode&&aj(n.stateNode):aV(r),null===t?aW(i,e.type,e.stateNode):aH(i,t,e.memoizedProps)):null===t&&null!==e.stateNode&&nN(e,e.memoizedProps,n.memoizedProps));break}case 27:if(aK&&4&r&&null===e.alternate){i=e.stateNode;var s=e.memoizedProps;try{aQ(i),a0(e.type,s,i,e)}catch(t){rw(e,e.return,t)}}case 5:if(nG(t,e),nj(e),512&r&&(oR||null===n||nI(n,n.return)),iA){if(32&e.flags){t=e.stateNode;try{ae(t)}catch(t){rw(e,e.return,t)}}4&r&&null!=e.stateNode&&(t=e.memoizedProps,nN(e,t,null!==n?n.memoizedProps:t)),1024&r&&(oP=!0)}break;case 6:if(nG(t,e),nj(e),4&r&&iA){if(null===e.stateNode)throw Error(a(162));r=e.memoizedProps,n=null!==n?n.memoizedProps:r,t=e.stateNode;try{i3(t,n,r)}catch(t){rw(e,e.return,t)}}break;case 3:if(aF?(aq(),i=oO,oO=az(t.containerInfo),nG(t,e),oO=i):nG(t,e),nj(e),4&r){if(iA&&iR&&null!==n&&n.memoizedState.isDehydrated)try{aP(t.containerInfo)}catch(t){rw(e,e.return,t)}if(iC){r=t.containerInfo,n=t.pendingChildren;try{ac(r,n)}catch(t){rw(e,e.return,t)}}}oP&&(oP=!1,function e(t){if(1024&t.subtreeFlags)for(t=t.child;null!==t;){var n=t;e(n),5===n.tag&&1024&n.flags&&iW(n.stateNode),t=t.sibling}}(e));break;case 4:aF?(n=oO,oO=az(e.stateNode.containerInfo),nG(t,e),nj(e),oO=n):(nG(t,e),nj(e)),4&r&&iC&&nF(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:default:nG(t,e),nj(e);break;case 13:nG(t,e),nj(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(lt=sa()),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,nV(e,r));break;case 22:512&r&&(oR||null===n||nI(n,n.return)),i=null!==e.memoizedState;var o=null!==n&&null!==n.memoizedState,l=oC,u=oR;if(oC=l||i,oR=u||o,nG(t,e),oR=u,oC=l,nj(e),(t=e.stateNode)._current=e,t._visibility&=-3,t._visibility|=2&t._pendingVisibility,8192&r&&(t._visibility=i?-2&t._visibility:1|t._visibility,i&&(t=oC||oR,null===n||o||t||function e(t){for(t=t.child;null!==t;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:nA(4,n,n.return),e(n);break;case 1:nI(n,n.return);var r=n.stateNode;"function"==typeof r.componentWillUnmount&&nR(n,n.return,r),e(n);break;case 26:case 27:case 5:nI(n,n.return),e(n);break;case 22:nI(n,n.return),null===n.memoizedState&&e(n);break;default:e(n)}t=t.sibling}}(e)),iA&&(null===e.memoizedProps||"manual"!==e.memoizedProps.mode))){e:if(n=null,iA)for(t=e;;){if(5===t.tag||aF&&26===t.tag||aK&&27===t.tag){if(null===n){o=n=t;try{s=o.stateNode,i?at(s):ar(o.stateNode,o.memoizedProps)}catch(e){rw(o,o.return,e)}}}else if(6===t.tag){if(null===n){o=t;try{var c=o.stateNode;i?an(c):ai(c,o.memoizedProps)}catch(e){rw(o,o.return,e)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}}4&r&&null!==(r=e.updateQueue)&&null!==(n=r.retryQueue)&&(r.retryQueue=null,nV(e,n));break;case 19:nG(t,e),nj(e),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,nV(e,r));case 21:}}function nj(e){var t=e.flags;if(2&t){try{if(iA&&(!aK||27!==e.tag)){e:{for(var n=e.return;null!==n;){if(nD(n)){var r=n;break e}n=n.return}throw Error(a(160))}switch(r.tag){case 27:if(aK){var i=r.stateNode,s=nU(e);nO(e,s,i);break}case 5:var o=r.stateNode;32&r.flags&&(ae(o),r.flags&=-33);var l=nU(e);nO(e,l,o);break;case 3:case 4:var u=r.stateNode.containerInfo,c=nU(e);!function e(t,n,r){var i=t.tag;if(5===i||6===i)t=t.stateNode,n?i8(r,t,n):i2(r,t);else if(!(4===i||aK&&27===i)&&null!==(t=t.child))for(e(t,n,r),t=t.sibling;null!==t;)e(t,n,r),t=t.sibling}(e,c,u);break;default:throw Error(a(161))}}}catch(t){rw(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function nX(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)nk(e,t.alternate,t),t=t.sibling}function nq(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&nh(n))}function nY(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&nh(e))}function nJ(e,t,n,r){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)nZ(e,t,n,r),t=t.sibling}function nZ(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:nJ(e,t,n,r),2048&i&&nT(9,t);break;case 3:nJ(e,t,n,r),2048&i&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&nh(e)));break;case 12:if(2048&i){nJ(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,s=a.id,o=a.onPostCommit;"function"==typeof o&&o(s,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){rw(t,t.return,e)}}else nJ(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,null!==t.memoizedState?4&a._visibility?nJ(e,t,n,r):nK(e,t):4&a._visibility?nJ(e,t,n,r):(a._visibility|=4,function e(t,n,r,i,a){for(a=a&&0!=(10256&n.subtreeFlags),n=n.child;null!==n;){var s=n,o=s.flags;switch(s.tag){case 0:case 11:case 15:e(t,s,r,i,a),nT(8,s);break;case 23:break;case 22:var l=s.stateNode;null!==s.memoizedState?4&l._visibility?e(t,s,r,i,a):nK(t,s):(l._visibility|=4,e(t,s,r,i,a)),a&&2048&o&&nq(s.alternate,s);break;case 24:e(t,s,r,i,a),a&&2048&o&&nY(s.alternate,s);break;default:e(t,s,r,i,a)}n=n.sibling}}(e,t,n,r,0!=(10256&t.subtreeFlags))),2048&i&&nq(t.alternate,t);break;case 24:nJ(e,t,n,r),2048&i&&nY(t.alternate,t);break;default:nJ(e,t,n,r)}}function nK(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=t,r=n.flags;switch(n.tag){case 22:nK(e,n),2048&r&&nq(n.alternate,n);break;case 24:nK(e,n),2048&r&&nY(n.alternate,n);break;default:nK(e,n)}t=t.sibling}}function n$(e){if(e.subtreeFlags&oF)for(e=e.child;null!==e;)nQ(e),e=e.sibling}function nQ(e){switch(e.tag){case 26:n$(e),e.flags&oF&&(null!==e.memoizedState?aZ(oO,e.memoizedState,e.memoizedProps):iB(e.type,e.memoizedProps));break;case 5:n$(e),e.flags&oF&&iB(e.type,e.memoizedProps);break;case 3:case 4:if(aF){var t=oO;oO=az(e.stateNode.containerInfo),n$(e),oO=t}else n$(e);break;case 22:null===e.memoizedState&&(null!==(t=e.alternate)&&null!==t.memoizedState?(t=oF,oF=0x1000000,n$(e),oF=t):n$(e));break;default:n$(e)}}function n0(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(null!==e)}}function n1(e){var t=e.deletions;if(0!=(16&e.flags)){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];oL=r,n3(r,e)}n0(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)n2(e),e=e.sibling}function n2(e){switch(e.tag){case 0:case 11:case 15:n1(e),2048&e.flags&&nA(9,e,e.return);break;case 3:case 12:default:n1(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&4&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-5,function e(t){var n=t.deletions;if(0!=(16&t.flags)){if(null!==n)for(var r=0;r<n.length;r++){var i=n[r];oL=i,n3(i,t)}n0(t)}for(t=t.child;null!==t;){switch((n=t).tag){case 0:case 11:case 15:nA(8,n,n.return),e(n);break;case 22:4&(r=n.stateNode)._visibility&&(r._visibility&=-5,e(n));break;default:e(n)}t=t.sibling}}(e)):n1(e)}}function n3(e,t){for(;null!==oL;){var n=oL;switch(n.tag){case 0:case 11:case 15:nA(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:nh(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,oL=r;else for(n=e;null!==oL;){var i=(r=oL).sibling,a=r.return;if(!function e(t){var n=t.alternate;null!==n&&(t.alternate=null,e(n)),t.child=null,t.deletions=null,t.sibling=null,5===t.tag&&null!==(n=t.stateNode)&&iO(n),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}(r),r===n){oL=null;break}if(null!==i){i.return=a,oL=i;break}oL=a}}}function n4(e){var t=iP(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(a(364));return t}if(null===(e=iY(e)))throw Error(a(362));return e.stateNode.current}function n5(e,t){var n=e.tag;switch(t.$$typeof){case oz:if(e.type===t.value)return!0;break;case oB:e:{for(n=0,t=t.value,e=[e,0];n<e.length;){var r=e[n++],i=r.tag,s=e[n++],o=t[s];if(5!==i&&26!==i&&27!==i||!iK(r)){for(;null!=o&&n5(r,o);)o=t[++s];if(s===t.length){t=!0;break e}for(r=r.child;null!==r;)e.push(r,s),r=r.sibling}}t=!1}return t;case oH:if((5===n||26===n||27===n)&&i$(e.stateNode,t.value))return!0;break;case oG:if((5===n||6===n||26===n||27===n)&&null!==(e=iZ(e))&&0<=e.indexOf(t.value))return!0;break;case oV:if((5===n||26===n||27===n)&&"string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase())return!0;break;default:throw Error(a(365))}return!1}function n6(e){switch(e.$$typeof){case oz:return"<"+(o(e.value)||"Unknown")+">";case oB:return":has("+(n6(e)||"")+")";case oH:return'[role="'+e.value+'"]';case oG:return'"'+e.value+'"';case oV:return'[data-testname="'+e.value+'"]';default:throw Error(a(365))}}function n8(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],a=i.tag,s=e[r++],o=t[s];if(5!==a&&26!==a&&27!==a||!iK(i)){for(;null!=o&&n5(i,o);)o=t[++s];if(s===t.length)n.push(i);else for(i=i.child;null!==i;)e.push(i,s),i=i.sibling}}return n}function n9(e,t){if(!iq)throw Error(a(363));e=n8(e=n4(e),t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var r=e[n++],i=r.tag;if(5===i||26===i||27===i)iK(r)||t.push(r.stateNode);else for(r=r.child;null!==r;)e.push(r),r=r.sibling}return t}function n7(){if(0!=(2&oX)&&0!==oJ)return oJ&-oJ;if(null!==is.T){var e=sW;return 0!==e?e:ee()}return iD()}function re(){0===o6&&(o6=0==(0x20000000&oJ)||sR?x():0x20000000);var e=s5.current;return null!==e&&(e.flags|=32),o6}function rt(e,t,n){(e===oq&&2===oZ||null!==e.cancelPendingCommit)&&(rl(e,0),ra(e,oJ,o6,!1)),M(e,n),(0==(2&oX)||e!==oq)&&(e===oq&&(0==(2&oX)&&(o4|=n),4===o2&&ra(e,oJ,o6,!1)),Y(e))}function rn(e,t,n){if(0!=(6&oX))throw Error(a(327));for(var r=!n&&0==(60&t)&&0==(t&e.expiredLanes)||_(e,t),i=r?function(e,t){var n=oX;oX|=2;var r=rh(),i=rd();oq!==e||oJ!==t?(lr=null,ln=sa()+500,rl(e,t)):oQ=_(e,t);e:for(;;)try{if(0!==oZ&&null!==oY){t=oY;var s=oK;t:switch(oZ){case 1:oZ=0,oK=null,rv(e,t,s,1);break;case 2:if(ep(s)){oZ=0,oK=null,rg(t);break}t=function(){2===oZ&&oq===e&&(oZ=7),Y(e)},s.then(t,t);break e;case 3:oZ=7;break e;case 4:oZ=5;break e;case 7:ep(s)?(oZ=0,oK=null,rg(t)):(oZ=0,oK=null,rv(e,t,s,7));break;case 5:var o=null;switch(oY.tag){case 26:o=oY.memoizedState;case 5:case 27:var l=oY,u=l.type,c=l.pendingProps;if(o?aJ(o):ik(u,c)){oZ=0,oK=null;var h=l.sibling;if(null!==h)oY=h;else{var d=l.return;null!==d?(oY=d,ry(d)):oY=null}break t}}oZ=0,oK=null,rv(e,t,s,5);break;case 6:oZ=0,oK=null,rv(e,t,s,6);break;case 8:ro(),o2=6;break e;default:throw Error(a(462))}}for(;null!==oY&&!sr();)rm(oY);break}catch(t){ru(e,t)}return(ob=ox=null,is.H=r,is.A=i,oX=n,null!==oY)?0:(oq=null,oJ=0,V(),o2)}(e,t):rf(e,t,!0),s=r;;){if(0===i)oQ&&!r&&ra(e,t,0,!1);else if(6===i)ra(e,t,0,!o$);else{if(n=e.current.alternate,s&&!function(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&null!==(n=t.updateQueue)&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!sd(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}(n)){i=rf(e,t,!1),s=!1;continue}if(2===i){if(s=t,e.errorRecoveryDisabledLanes&s)var o=0;else o=0!=(o=-0x20000001&e.pendingLanes)?o:0x20000000&o?0x20000000:0;if(0!==o){t=o;e:{i=o9;var l=iR&&e.current.memoizedState.isDehydrated;if(l&&(rl(e,o).flags|=256),2!==(o=rf(e,o,!1))){if(o0&&!l){e.errorRecoveryDisabledLanes|=s,o4|=s,i=4;break e}s=o7,o7=i,null!==s&&rr(s)}i=o}if(s=!1,2!==i)continue}}if(1===i){rl(e,0),ra(e,t,0,!0);break}e:{switch(r=e,i){case 0:case 1:throw Error(a(345));case 4:if((4194176&t)===t){ra(r,t,o6,!o$);break e}break;case 2:o7=null;break;case 3:case 5:break;default:throw Error(a(329))}if(r.finishedWork=n,r.finishedLanes=t,(0x3c00000&t)===t&&10<(s=lt+300-sa())){if(ra(r,t,o6,!o$),0!==y(r,0))break e;r.timeoutHandle=iM(ri.bind(null,r,n,o7,lr,le,t,o6,o4,o8,o$,2,-0,0),s);break e}ri(r,n,o7,lr,le,t,o6,o4,o8,o$,0,-0,0)}}break}Y(e)}function rr(e){null===o7?o7=e:o7.push.apply(o7,e)}function ri(e,t,n,r,i,a,s,o,l,u,c,h,d){var p=t.subtreeFlags;if((8192&p||0x1002000==(0x1002000&p))&&(iz(),nQ(t),null!==(t=iH()))){e.cancelPendingCommit=t(rx.bind(null,e,n,r,i,s,o,l,1,h,d)),ra(e,a,s,!u);return}rx(e,n,r,i,s,o,l,c,h,d)}function ra(e,t,n,r){t&=~o5,t&=~o4,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-a6(i),s=1<<a;r[a]=-1,i&=~s}0!==n&&w(e,n,t)}function rs(){return 0!=(6&oX)||(J(0,!1),!1)}function ro(){if(null!==oY){if(0===oZ)var e=oY.return;else e=oY,ob=ox=null,ek(e),sQ=null,s0=0,e=oY;for(;null!==e;)nE(e.alternate,e),e=e.return;oY=null}}function rl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;n!==iE&&(e.timeoutHandle=iE,iw(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),ro(),oq=e,oY=n=rL(e.current,null),oJ=t,oZ=0,oK=null,o$=!1,oQ=_(e,t),o0=!1,o8=o6=o5=o4=o3=o2=0,o7=o9=null,le=!1,0!=(8&t)&&(t|=32&t);var r=e.entangledLanes;if(0!==r)for(e=e.entanglements,r&=t;0<r;){var i=31-a6(r),a=1<<i;t|=e[i],r&=~a}return o1=t,V(),n}function ru(e,t){s7=null,is.H=oc,t===sJ?(t=eg(),oZ=3):t===sZ?(t=eg(),oZ=4):oZ=t===og?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,oK=t,null===oY&&(o2=1,tO(e,A(t,e.current)))}function rc(){var e=s5.current;return null===e||((4194176&oJ)===oJ?null===s6:((0x3c00000&oJ)===oJ||0!=(0x20000000&oJ))&&e===s6)}function rh(){var e=is.H;return is.H=oc,null===e?oc:e}function rd(){var e=is.A;return is.A=ok,e}function rp(){o2=4,o$||(4194176&oJ)!==oJ&&null!==s5.current||(oQ=!0),0==(0x7ffffff&o3)&&0==(0x7ffffff&o4)||null===oq||ra(oq,oJ,o6,!1)}function rf(e,t,n){var r=oX;oX|=2;var i=rh(),a=rd();(oq!==e||oJ!==t)&&(lr=null,rl(e,t)),t=!1;var s=o2;e:for(;;)try{if(0!==oZ&&null!==oY){var o=oY,l=oK;switch(oZ){case 8:ro(),s=6;break e;case 3:case 2:case 6:null===s5.current&&(t=!0);var u=oZ;if(oZ=0,oK=null,rv(e,o,l,u),n&&oQ){s=0;break e}break;default:u=oZ,oZ=0,oK=null,rv(e,o,l,u)}}(function(){for(;null!==oY;)rm(oY)})(),s=o2;break}catch(t){ru(e,t)}return t&&e.shellSuspendCounter++,ob=ox=null,oX=r,is.H=i,is.A=a,null===oY&&(oq=null,oJ=0,V()),s}function rm(e){var t=t7(e.alternate,e,o1);e.memoizedProps=e.pendingProps,null===t?ry(e):oY=t}function rg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=tJ(n,t,t.pendingProps,t.type,void 0,oJ);break;case 11:t=tJ(n,t,t.pendingProps,t.type.render,t.ref,oJ);break;case 5:ek(t);default:nE(n,t),t=t7(n,t=oY=rN(t,o1),o1)}e.memoizedProps=e.pendingProps,null===t?ry(e):oY=t}function rv(e,t,n,r){ob=ox=null,ek(t),sQ=null,s0=0;var i=t.return;try{if(function(e,t,n,r,i){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&ni(t,n,i,!0),null!==(n=s5.current)){switch(n.tag){case 13:return null===s6?rp():null===n.alternate&&0===o2&&(o2=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===sK?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=new Set([r]):t.add(r),rE(e,r,i)),!1;case 22:return n.flags|=65536,r===sK?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=new Set([r]):n.add(r),rE(e,r,i)),!1}throw Error(a(435,n.tag))}return rE(e,r,i),rp(),!1}if(sR)return null!==(t=s5.current)?(0==(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==sL&&H(A(e=Error(a(422),{cause:r}),n))):(r!==sL&&H(A(t=Error(a(423),{cause:r}),n)),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=A(r,n),i=tk(e.stateNode,r,i),eo(e,i),4!==o2&&(o2=2)),!1;var s=Error(a(520),{cause:r});if(s=A(s,n),null===o9?o9=[s]:o9.push(s),4!==o2&&(o2=2),null===t)return!0;r=A(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=tk(n.stateNode,r,e),eo(n,e),!1;case 1:if(t=n.type,s=n.stateNode,0==(128&n.flags)&&("function"==typeof t.getDerivedStateFromError||null!==s&&"function"==typeof s.componentDidCatch&&(null===li||!li.has(s))))return n.flags|=65536,i&=-i,n.lanes|=i,tB(i=tz(i),e,n,r),eo(n,i),!1}n=n.return}while(null!==n)return!1}(e,i,t,n,oJ)){o2=1,tO(e,A(n,e.current)),oY=null;return}}catch(t){if(null!==i)throw oY=i,t;o2=1,tO(e,A(n,e.current)),oY=null;return}32768&t.flags?(sR||1===r?e=!0:oQ||0!=(0x20000000&oJ)?e=!1:(o$=e=!0,(2===r||3===r||6===r)&&null!==(r=s5.current)&&13===r.tag&&(r.flags|=16384)),r_(t,e)):ry(t)}function ry(e){var t=e;do{if(0!=(32768&t.flags))return void r_(t,o$);e=t.return;var n=function(e,t,n){var r=t.pendingProps;switch(I(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return nw(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),nt(oE),N(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(null===e||null===e.child)&&(z(t)?nm(t):null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,null!==sP&&(rr(sP),sP=null))),ny(e,t),nw(t),null;case 26:if(aF){n=t.type;var i=t.memoizedState;return null===e?(nm(t),null!==i?(nw(t),nb(t,i)):(nw(t),nx(t,n,r))):i?i!==e.memoizedState?(nm(t),nw(t),nb(t,i)):(nw(t),t.flags&=-0x1000001):(iA?e.memoizedProps!==r&&nm(t):n_(e,t,n,r),nw(t),nx(t,n,r)),null}case 27:if(aK){if(U(t),n=sE.current,i=t.type,null!==e&&null!=t.stateNode)iA?e.memoizedProps!==r&&nm(t):n_(e,t,i,r);else{if(!r){if(null===t.stateNode)throw Error(a(166));return nw(t),null}e=sM.current,z(t)?F(t,e):(e=a$(i,r,n,e,!0),t.stateNode=e,nm(t))}return nw(t),null}case 5:if(U(t),n=t.type,null!==e&&null!=t.stateNode)n_(e,t,n,r);else{if(!r){if(null===t.stateNode)throw Error(a(166));return nw(t),null}e=sM.current,z(t)?F(t,e):(nv(i=iy(n,r,sE.current,e,t),t,!1,!1),t.stateNode=i,ix(i,n,r,e)&&nm(t))}return nw(t),nx(t,t.type,t.pendingProps),null;case 6:if(e&&null!=t.stateNode)n=e.memoizedProps,iA?n!==r&&nm(t):iC&&(n!==r?(t.stateNode=iS(r,sE.current,sM.current,t),nm(t)):t.stateNode=e.stateNode);else{if("string"!=typeof r&&null===t.stateNode)throw Error(a(166));if(e=sE.current,n=sM.current,z(t)){if(!iR)throw Error(a(176));if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(i=sA))switch(i.tag){case 27:case 5:r=i.memoizedProps}aA(e,n,t,r)||O(t)}else t.stateNode=iS(r,e,n,t)}return nw(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(i=z(t),null!==r&&null!==r.dehydrated){if(null===e){if(!i)throw Error(a(318));if(!iR)throw Error(a(344));if(!(i=null!==(i=t.memoizedState)?i.dehydrated:null))throw Error(a(317));aC(i,t)}else B(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;nw(t),i=!1}else null!==sP&&(rr(sP),sP=null),i=!0;if(!i){if(256&t.flags)return eC(t),t;return eC(t),null}}if(eC(t),0!=(128&t.flags))return t.lanes=n,t;if(n=null!==r,e=null!==e&&null!==e.memoizedState,n){r=t.child,i=null,null!==r.alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(i=r.alternate.memoizedState.cachePool.pool);var s=null;null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(s=r.memoizedState.cachePool.pool),s!==i&&(r.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),nS(t,t.updateQueue),nw(t),null;case 4:return N(),ny(e,t),null===e&&iI(t.stateNode.containerInfo),nw(t),null;case 10:return nt(t.type),nw(t),null;case 19:if(m(s8),null===(i=t.memoizedState))return nw(t),null;if(r=0!=(128&t.flags),null===(s=i.rendering))if(r)nM(i,!1);else{if(0!==o2||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(s=eR(e))){for(t.flags|=128,nM(i,!1),e=s.updateQueue,t.updateQueue=e,nS(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)rN(n,e),n=n.sibling;return g(s8,1&s8.current|2),t.child}e=e.sibling}null!==i.tail&&sa()>ln&&(t.flags|=128,r=!0,nM(i,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=eR(s))){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,nS(t,e),nM(i,!0),null===i.tail&&"hidden"===i.tailMode&&!s.alternate&&!sR)return nw(t),null}else 2*sa()-i.renderingStartTime>ln&&0x20000000!==n&&(t.flags|=128,r=!0,nM(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(null!==(e=i.last)?e.sibling=s:t.child=s,i.last=s)}if(null!==i.tail)return t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=sa(),t.sibling=null,e=s8.current,g(s8,r?1&e|2:1&e),t;return nw(t),null;case 22:case 23:return eC(t),ew(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?0!=(0x20000000&n)&&0==(128&t.flags)&&(nw(t),6&t.subtreeFlags&&(t.flags|=8192)):nw(t),null!==(n=t.updateQueue)&&nS(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&m(oA),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),nt(oE),nw(t),null;case 25:return null}throw Error(a(156,t.tag))}(t.alternate,t,o1);if(null!==n){oY=n;return}if(null!==(t=t.sibling)){oY=t;return}oY=t=e}while(null!==t)0===o2&&(o2=5)}function r_(e,t){do{var n=function(e,t){switch(I(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return nt(oE),N(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return U(t),null;case 13:if(eC(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));B()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return m(s8),null;case 4:return N(),null;case 10:return nt(t.type),null;case 22:case 23:return eC(t),ew(),null!==e&&m(oA),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return nt(oE),null;default:return null}}(e.alternate,e);if(null!==n){n.flags&=32767,oY=n;return}if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling)){oY=e;return}oY=e=n}while(null!==e)o2=6,oY=null}function rx(e,t,n,r,i,s,o,l,u,c){var h=is.T,d=iN();try{iL(2),is.T=null,function(e,t,n,r,i,s,o,l){do rS();while(null!==ls)if(0!=(6&oX))throw Error(a(327));var u,c,h=e.finishedWork;if(r=e.finishedLanes,null!==h){if(e.finishedWork=null,e.finishedLanes=0,h===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var d=h.lanes|h.childLanes;!function(e,t,n,r,i,a){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=s&~n;0<n;){var c=31-a6(n),h=1<<c;o[c]=0,l[c]=-1;var d=u[c];if(null!==d)for(u[c]=null,c=0;c<d.length;c++){var p=d[c];null!==p&&(p.lane&=-0x20000001)}n&=~h}0!==r&&w(e,r,0),0!==a&&0===i&&0!==e.tag&&(e.suspendedLanes|=a&~(s&~t))}(e,r,d|=sU,s,o,l),e===oq&&(oY=oq=null,oJ=0),0==(10256&h.subtreeFlags)&&0==(10256&h.flags)||la||(la=!0,ll=d,lu=n,u=sl,c=function(){return rS(!0),null},st(u,c)),n=0!=(15990&h.flags),0!=(15990&h.subtreeFlags)||n?(n=is.T,is.T=null,s=iN(),iL(2),o=oX,oX|=4,function(e,t){for(ig(e.containerInfo),oL=t;null!==oL;)if(t=(e=oL).child,0!=(1028&e.subtreeFlags)&&null!==t)t.return=e,oL=t;else for(;null!==oL;){var n=(e=oL).alternate;switch(t=e.flags,e.tag){case 0:case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(0!=(1024&t)&&null!==n){t=void 0;var r=e,i=n.memoizedProps;n=n.memoizedState;var s=r.stateNode;try{var o=tU(r.type,i,r.elementType===r.type);t=s.getSnapshotBeforeUpdate(o,n),s.__reactInternalSnapshotBeforeUpdate=t}catch(e){rw(r,r.return,e)}}break;case 3:0!=(1024&t)&&iA&&aa(e.stateNode.containerInfo);break;default:if(0!=(1024&t))throw Error(a(163))}if(null!==(t=e.sibling)){t.return=e.return,oL=t;break}oL=e.return}o=oN,oN=!1}(e,h),nW(h,e),iv(e.containerInfo),e.current=h,nk(e,h.alternate,h),si(),oX=o,iL(s),is.T=n):e.current=h,la?(la=!1,ls=e,lo=r):rb(e,d),0===(d=e.pendingLanes)&&(li=null);var p=h.stateNode;if(sh&&"function"==typeof sh.onCommitFiberRoot)try{sh.onCommitFiberRoot(sc,p,void 0,128==(128&p.current.flags))}catch(e){}if(Y(e),null!==t)for(i=e.onRecoverableError,h=0;h<t.length;h++)i((d=t[h]).value,{componentStack:d.stack});0!=(3&lo)&&rS(),d=e.pendingLanes,0!=(4194218&r)&&0!=(42&d)?e===lh?lc++:(lc=0,lh=e):lc=0,J(0,!1)}}(e,t,n,r,d,i,s,o,l,u,c)}finally{is.T=h,iL(d)}}function rb(e,t){0==(e.pooledCacheLanes&=t)&&null!=(t=e.pooledCache)&&(e.pooledCache=null,nh(t))}function rS(){if(null!==ls){var e=ls,t=ll;ll=0;var n=T(lo),r=32>n?32:n;n=is.T;var i=iN();try{if(iL(r),is.T=null,null===ls)var s=!1;else{r=lu,lu=null;var o=ls,l=lo;if(ls=null,lo=0,0!=(6&oX))throw Error(a(331));var u=oX;if(oX|=4,n2(o.current),nZ(o,o.current,l,r),oX=u,J(0,!1),sh&&"function"==typeof sh.onPostCommitFiberRoot)try{sh.onPostCommitFiberRoot(sc,o)}catch(e){}s=!0}return s}finally{iL(i),is.T=n,rb(e,t)}}return!1}function rM(e,t,n){t=A(n,t),t=tk(e.stateNode,t,2),null!==(e=ea(e,t,2))&&(M(e,2),Y(e))}function rw(e,t,n){if(3===e.tag)rM(e,e,n);else for(;null!==t;){if(3===t.tag){rM(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===li||!li.has(r))){e=A(n,e),null!==(r=ea(t,n=tz(2),2))&&(tB(n,r,t,e),M(r,2),Y(r));break}}t=t.return}}function rE(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new oj;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)||(o0=!0,i.add(n),e=rT.bind(null,e,t,n),t.then(e,e))}function rT(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,oq===e&&(oJ&n)===n&&(4===o2||3===o2&&(0x3c00000&oJ)===oJ&&300>sa()-lt?0==(2&oX)&&rl(e,0):o5|=n,o8===oJ&&(o8=0)),Y(e)}function rA(e,t){0===t&&(t=b()),null!==(e=j(e,t))&&(M(e,t),Y(e))}function rC(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),rA(e,n)}function rR(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;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}null!==r&&r.delete(t),rA(e,n)}function rP(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.refCleanup=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 rI(e){return!(!(e=e.prototype)||!e.isReactComponent)}function rL(e,t){var r=e.alternate;return null===r?((r=n(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x1e00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function rN(e,t){e.flags&=0x1e00002;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,e.dependencies=null===(t=n.dependencies)?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function rD(e,t,r,i,s,o){var l=0;if(i=e,"function"==typeof e)rI(e)&&(l=1);else if("string"==typeof e)l=aF&&aK?ak(e,r,sM.current)?26:a2(e)?27:5:aF?ak(e,r,sM.current)?26:5:aK&&a2(e)?27:5;else e:switch(e){case r$:return rU(r.children,s,o,t);case rQ:l=8,s|=24;break;case r0:return(e=n(12,r,t,2|s)).elementType=r0,e.lanes=o,e;case r5:return(e=n(13,r,t,s)).elementType=r5,e.lanes=o,e;case r6:return(e=n(19,r,t,s)).elementType=r6,e.lanes=o,e;case r7:return rO(r,s,o,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case r1:case r3:l=10;break e;case r2:l=9;break e;case r4:l=11;break e;case r8:l=14;break e;case r9:l=16,i=null;break e}l=29,r=Error(a(130,null===e?"null":typeof e,"")),i=null}return(t=n(l,r,t,s)).elementType=e,t.type=i,t.lanes=o,t}function rU(e,t,r,i){return(e=n(7,e,i,t)).lanes=r,e}function rO(e,t,r,i){(e=n(22,e,i,t)).elementType=r7,e.lanes=r;var s={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var e=s._current;if(null===e)throw Error(a(456));if(0==(2&s._pendingVisibility)){var t=j(e,2);null!==t&&(s._pendingVisibility|=2,rt(t,e,2))}},attach:function(){var e=s._current;if(null===e)throw Error(a(456));if(0!=(2&s._pendingVisibility)){var t=j(e,2);null!==t&&(s._pendingVisibility&=-3,rt(t,e,2))}}};return e.stateNode=s,e}function rF(e,t,r){return(e=n(6,e,null,t)).lanes=r,e}function rk(e,t,r){return(t=n(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function rz(e,t,n,r,i,a,s,o){this.tag=1,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=iE,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=S(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=S(0),this.hiddenUpdates=S(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function rB(e,t,r,i,a,s,o,l,u,c,h,d){return e=new rz(e,t,r,o,l,u,c,d),t=1,!0===s&&(t|=24),s=n(3,null,null,t),e.current=s,s.stateNode=e,t=nc(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:i,isDehydrated:r,cache:t},en(s),e}function rH(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw Error(a(268,e=Object.keys(e).join(",")))}return null===(e=null!==(e=p(t))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:id(e.stateNode)}function rV(e,t,n,r,i,a){i=i?a5:a5,null===r.context?r.context=i:r.pendingContext=i,(r=ei(t)).payload={element:n},null!==(a=void 0===a?null:a)&&(r.callback=a),null!==(n=ea(e,r,t))&&(rt(n,e,t),es(n,e,t))}function rG(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function rW(e,t){rG(e,t),(e=e.alternate)&&rG(e,t)}var rj={},rX=e.r(71645),rq=e.r(51849),rY=Object.assign,rJ=Symbol.for("react.element"),rZ=Symbol.for("react.transitional.element"),rK=Symbol.for("react.portal"),r$=Symbol.for("react.fragment"),rQ=Symbol.for("react.strict_mode"),r0=Symbol.for("react.profiler"),r1=Symbol.for("react.provider"),r2=Symbol.for("react.consumer"),r3=Symbol.for("react.context"),r4=Symbol.for("react.forward_ref"),r5=Symbol.for("react.suspense"),r6=Symbol.for("react.suspense_list"),r8=Symbol.for("react.memo"),r9=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var r7=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.tracing_marker");var ie,it,ir=Symbol.for("react.memo_cache_sentinel"),ii=Symbol.iterator,ia=Symbol.for("react.client.reference"),is=rX.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,io=!1,il=Array.isArray,iu=t.rendererVersion,ic=t.rendererPackageName,ih=t.extraDevToolsConfig,id=t.getPublicInstance,ip=t.getRootHostContext,im=t.getChildHostContext,ig=t.prepareForCommit,iv=t.resetAfterCommit,iy=t.createInstance,i_=t.appendInitialChild,ix=t.finalizeInitialChildren,ib=t.shouldSetTextContent,iS=t.createTextInstance,iM=t.scheduleTimeout,iw=t.cancelTimeout,iE=t.noTimeout,iT=t.isPrimaryRenderer;t.warnsIfNotActing;var iA=t.supportsMutation,iC=t.supportsPersistence,iR=t.supportsHydration,iP=t.getInstanceFromNode;t.beforeActiveInstanceBlur,t.afterActiveInstanceBlur;var iI=t.preparePortalMount;t.prepareScopeUpdate,t.getInstanceFromScope;var iL=t.setCurrentUpdatePriority,iN=t.getCurrentUpdatePriority,iD=t.resolveUpdatePriority;t.resolveEventType,t.resolveEventTimeStamp;var iU=t.shouldAttemptEagerTransition,iO=t.detachDeletedInstance;t.requestPostPaintCallback;var iF=t.maySuspendCommit,ik=t.preloadInstance,iz=t.startSuspendingCommit,iB=t.suspendInstance,iH=t.waitForCommitToBeReady,iV=t.NotPendingTransition,iG=t.HostTransitionContext,iW=t.resetFormInstance;t.bindToConsole;var ij=t.supportsMicrotasks,iX=t.scheduleMicrotask,iq=t.supportsTestSelectors,iY=t.findFiberRoot,iJ=t.getBoundingRect,iZ=t.getTextContent,iK=t.isHiddenSubtree,i$=t.matchAccessibilityRole,iQ=t.setFocusIfFocusable,i0=t.setupIntersectionObserver,i1=t.appendChild,i2=t.appendChildToContainer,i3=t.commitTextUpdate,i4=t.commitMount,i5=t.commitUpdate,i6=t.insertBefore,i8=t.insertInContainerBefore,i9=t.removeChild,i7=t.removeChildFromContainer,ae=t.resetTextContent,at=t.hideInstance,an=t.hideTextInstance,ar=t.unhideInstance,ai=t.unhideTextInstance,aa=t.clearContainer,as=t.cloneInstance,ao=t.createContainerChildSet,al=t.appendChildToContainerChildSet,au=t.finalizeContainerChildren,ac=t.replaceContainerChildren,ah=t.cloneHiddenInstance,ad=t.cloneHiddenTextInstance,ap=t.isSuspenseInstancePending,af=t.isSuspenseInstanceFallback,am=t.getSuspenseInstanceFallbackErrorDetails,ag=t.registerSuspenseInstanceRetry,av=t.canHydrateFormStateMarker,ay=t.isFormStateMarkerMatching,a_=t.getNextHydratableSibling,ax=t.getFirstHydratableChild,ab=t.getFirstHydratableChildWithinContainer,aS=t.getFirstHydratableChildWithinSuspenseInstance,aM=t.canHydrateInstance,aw=t.canHydrateTextInstance,aE=t.canHydrateSuspenseInstance,aT=t.hydrateInstance,aA=t.hydrateTextInstance,aC=t.hydrateSuspenseInstance,aR=t.getNextHydratableInstanceAfterSuspenseInstance,aP=t.commitHydratedContainer,aI=t.commitHydratedSuspenseInstance,aL=t.clearSuspenseBoundary,aN=t.clearSuspenseBoundaryFromContainer,aD=t.shouldDeleteUnhydratedTailInstances;t.diffHydratedPropsForDevWarnings,t.diffHydratedTextForDevWarnings,t.describeHydratableInstanceForDevWarnings;var aU=t.validateHydratableInstance,aO=t.validateHydratableTextInstance,aF=t.supportsResources,ak=t.isHostHoistableType,az=t.getHoistableRoot,aB=t.getResource,aH=t.acquireResource,aV=t.releaseResource,aG=t.hydrateHoistable,aW=t.mountHoistable,aj=t.unmountHoistable,aX=t.createHoistableInstance,aq=t.prepareToCommitHoistables,aY=t.mayResourceSuspendCommit,aJ=t.preloadResource,aZ=t.suspendResource,aK=t.supportsSingletons,a$=t.resolveSingletonInstance,aQ=t.clearSingleton,a0=t.acquireSingletonInstance,a1=t.releaseSingletonInstance,a2=t.isHostSingletonType,a3=[],a4=-1,a5={},a6=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(a8(e)/a9|0)|0},a8=Math.log,a9=Math.LN2,a7=128,se=4194304,st=rq.unstable_scheduleCallback,sn=rq.unstable_cancelCallback,sr=rq.unstable_shouldYield,si=rq.unstable_requestPaint,sa=rq.unstable_now,ss=rq.unstable_ImmediatePriority,so=rq.unstable_UserBlockingPriority,sl=rq.unstable_NormalPriority,su=rq.unstable_IdlePriority,sc=(rq.log,rq.unstable_setDisableYieldValue,null),sh=null,sd="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},sp=new WeakMap,sf=[],sm=0,sg=null,sv=0,sy=[],s_=0,sx=null,sb=1,sS="",sM=f(null),sw=f(null),sE=f(null),sT=f(null),sA=null,sC=null,sR=!1,sP=null,sI=!1,sL=Error(a(519)),sN=[],sD=0,sU=0,sO=null,sF=null,sk=!1,sz=!1,sB=!1,sH=0,sV=null,sG=0,sW=0,sj=null,sX=!1,sq=!1,sY=Object.prototype.hasOwnProperty,sJ=Error(a(460)),sZ=Error(a(474)),sK={then:function(){}},s$=null,sQ=null,s0=0,s1=eb(!0),s2=eb(!1),s3=f(null),s4=f(0),s5=f(null),s6=null,s8=f(0),s9=0,s7=null,oe=null,ot=null,on=!1,or=!1,oi=!1,oa=0,os=0,oo=null,ol=0,ou=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},oc={readContext:no,use:eV,useCallback:eP,useContext:eP,useEffect:eP,useImperativeHandle:eP,useLayoutEffect:eP,useInsertionEffect:eP,useMemo:eP,useReducer:eP,useRef:eP,useState:eP,useDebugValue:eP,useDeferredValue:eP,useTransition:eP,useSyncExternalStore:eP,useId:eP};oc.useCacheRefresh=eP,oc.useMemoCache=eP,oc.useHostTransitionStatus=eP,oc.useFormState=eP,oc.useActionState=eP,oc.useOptimistic=eP;var oh={readContext:no,use:eV,useCallback:function(e,t){return ez().memoizedState=[e,void 0===t?null:t],e},useContext:no,useEffect:tl,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,ts(4194308,4,td.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ts(4194308,4,e,t)},useInsertionEffect:function(e,t){ts(4,2,e,t)},useMemo:function(e,t){var n=ez();t=void 0===t?null:t;var r=e();return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ez();if(void 0!==n)var i=n(t);else i=t;return r.memoizedState=r.baseState=i,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},e=e.dispatch=tE.bind(null,s7,e),[r.memoizedState,e]},useRef:function(e){return ez().memoizedState={current:e}},useState:function(e){var t=(e=e0(e)).queue,n=tT.bind(null,s7,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tf,useDeferredValue:function(e,t){return tv(ez(),e,t)},useTransition:function(){var e=e0(!1);return e=t_.bind(null,s7,e.queue,!0,!1),ez().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=s7,i=ez();if(sR){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===oq)throw Error(a(349));0!=(60&oJ)||eJ(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,tl(eK.bind(null,r,s,e),[e]),r.flags|=2048,ti(9,eZ.bind(null,r,s,n,t),{destroy:void 0},null),n},useId:function(){var e=ez(),t=oq.identifierPrefix;if(sR){var n=sS,r=sb;t=":"+t+"R"+(n=(r&~(1<<32-a6(r)-1)).toString(32)+n),0<(n=oa++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=ol++).toString(32)+":";return e.memoizedState=t},useCacheRefresh:function(){return ez().memoizedState=tw.bind(null,s7)}};oh.useMemoCache=eG,oh.useHostTransitionStatus=tb,oh.useFormState=e7,oh.useActionState=e7,oh.useOptimistic=function(e){var t=ez();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=tC.bind(null,s7,!0,n),n.dispatch=t,[e,t]};var od={readContext:no,use:eV,useCallback:tm,useContext:no,useEffect:tu,useImperativeHandle:tp,useInsertionEffect:tc,useLayoutEffect:th,useMemo:tg,useReducer:ej,useRef:ta,useState:function(){return ej(eW)},useDebugValue:tf,useDeferredValue:function(e,t){return ty(eB(),oe.memoizedState,e,t)},useTransition:function(){var e=ej(eW)[0],t=eB().memoizedState;return["boolean"==typeof e?e:eH(e),t]},useSyncExternalStore:eY,useId:tS};od.useCacheRefresh=tM,od.useMemoCache=eG,od.useHostTransitionStatus=tb,od.useFormState=te,od.useActionState=te,od.useOptimistic=function(e,t){return e1(eB(),oe,e,t)};var op={readContext:no,use:eV,useCallback:tm,useContext:no,useEffect:tu,useImperativeHandle:tp,useInsertionEffect:tc,useLayoutEffect:th,useMemo:tg,useReducer:eq,useRef:ta,useState:function(){return eq(eW)},useDebugValue:tf,useDeferredValue:function(e,t){var n=eB();return null===oe?tv(n,e,t):ty(n,oe.memoizedState,e,t)},useTransition:function(){var e=eq(eW)[0],t=eB().memoizedState;return["boolean"==typeof e?e:eH(e),t]},useSyncExternalStore:eY,useId:tS};op.useCacheRefresh=tM,op.useMemoCache=eG,op.useHostTransitionStatus=tb,op.useFormState=tr,op.useActionState=tr,op.useOptimistic=function(e,t){var n=eB();return null!==oe?e1(n,oe,e,t):(n.baseState=e,[e,n.queue.dispatch])};var of={isMounted:function(e){return!!(e=e._reactInternals)&&h(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=n7(),i=ei(r);i.payload=t,null!=n&&(i.callback=n),null!==(t=ea(e,i,r))&&(rt(t,e,r),es(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=n7(),i=ei(r);i.tag=1,i.payload=t,null!=n&&(i.callback=n),null!==(t=ea(e,i,r))&&(rt(t,e,r),es(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=n7(),r=ei(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=ea(e,r,n))&&(rt(t,e,n),es(t,e,n))}},om="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof r.default&&"function"==typeof r.default.emit)return void r.default.emit("uncaughtException",e);console.error(e)},og=Error(a(461)),ov=!1,oy={dehydrated:null,treeContext:null,retryLane:0},o_=f(null),ox=null,ob=null,oS="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},oM=rq.unstable_scheduleCallback,ow=rq.unstable_NormalPriority,oE={$$typeof:r3,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},oT=is.S;is.S=function(e,t){"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===sV){var n=sV=[];sG=0,sW=ee(),sj={status:"pending",value:void 0,then:function(e){n.push(e)}}}sG++,t.then(et,et)}(0,t),null!==oT&&oT(e,t)};var oA=f(null),oC=!1,oR=!1,oP=!1,oI="function"==typeof WeakSet?WeakSet:Set,oL=null,oN=!1,oD=null,oU=!1,oO=null,oF=8192,ok={getCacheForType:function(e){var t=no(oE),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n}},oz=0,oB=1,oH=2,oV=3,oG=4;if("function"==typeof Symbol&&Symbol.for){var oW=Symbol.for;oz=oW("selector.component"),oB=oW("selector.has_pseudo_class"),oH=oW("selector.role"),oV=oW("selector.test_id"),oG=oW("selector.text")}var oj="function"==typeof WeakMap?WeakMap:Map,oX=0,oq=null,oY=null,oJ=0,oZ=0,oK=null,o$=!1,oQ=!1,o0=!1,o1=0,o2=0,o3=0,o4=0,o5=0,o6=0,o8=0,o9=null,o7=null,le=!1,lt=0,ln=1/0,lr=null,li=null,la=!1,ls=null,lo=0,ll=0,lu=null,lc=0,lh=null;return rj.attemptContinuousHydration=function(e){if(13===e.tag){var t=j(e,0x4000000);null!==t&&rt(t,e,0x4000000),rW(e,0x4000000)}},rj.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=n7(),n=j(e,t);null!==n&&rt(n,e,t),rW(e,t)}},rj.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var t=v(e.pendingLanes);if(0!==t){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-a6(t);e.entanglements[1]|=n,t&=~n}Y(e),0==(6&oX)&&(ln=sa()+500,J(0,!1))}}break;case 13:null!==(t=j(e,2))&&rt(t,e,2),rs(),rW(e,2)}},rj.batchedUpdates=function(e,t){return e(t)},rj.createComponentSelector=function(e){return{$$typeof:oz,value:e}},rj.createContainer=function(e,t,n,r,i,a,s,o,l,u){return rB(e,t,!1,null,n,r,a,s,o,l,u,null)},rj.createHasPseudoClassSelector=function(e){return{$$typeof:oB,value:e}},rj.createHydrationContainer=function(e,t,n,r,i,a,s,o,l,u,c,h,d){var p;return(e=rB(n,r,!0,e,i,a,o,l,u,c,h,d)).context=(p=null,a5),n=e.current,(i=ei(r=n7())).callback=null!=t?t:null,ea(n,i,r),e.current.lanes=r,M(e,r),Y(e),e},rj.createPortal=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:rK,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}},rj.createRoleSelector=function(e){return{$$typeof:oH,value:e}},rj.createTestNameSelector=function(e){return{$$typeof:oV,value:e}},rj.createTextSelector=function(e){return{$$typeof:oG,value:e}},rj.defaultOnCaughtError=function(e){console.error(e)},rj.defaultOnRecoverableError=function(e){om(e)},rj.defaultOnUncaughtError=function(e){om(e)},rj.deferredUpdates=function(e){var t=is.T,n=iN();try{return iL(32),is.T=null,e()}finally{iL(n),is.T=t}},rj.discreteUpdates=function(e,t,n,r,i){var a=is.T,s=iN();try{return iL(2),is.T=null,e(t,n,r,i)}finally{iL(s),is.T=a,0===oX&&(ln=sa()+500)}},rj.findAllNodes=n9,rj.findBoundingRects=function(e,t){if(!iq)throw Error(a(363));t=n9(e,t),e=[];for(var n=0;n<t.length;n++)e.push(iJ(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var r=n.x,i=r+n.width,s=n.y,o=s+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,p=d+u.height;if(r>=c&&s>=d&&i<=h&&o<=p){e.splice(t,1);break}if(r!==c||n.width!==u.width||p<s||d>o){if(!(s!==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}}else{d>s&&(u.height+=d-s,u.y=s),p<o&&(u.height=o-d),e.splice(t,1);break}}}return e},rj.findHostInstance=rH,rj.findHostInstanceWithNoPortals=function(e){return null===(e=null!==(e=p(e))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(4!==t.tag&&null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:id(e.stateNode)},rj.findHostInstanceWithWarning=function(e){return rH(e)},rj.flushPassiveEffects=rS,rj.flushSyncFromReconciler=function(e){var t=oX;oX|=1;var n=is.T,r=iN();try{if(iL(2),is.T=null,e)return e()}finally{iL(r),is.T=n,0==(6&(oX=t))&&J(0,!1)}},rj.flushSyncWork=rs,rj.focusWithin=function(e,t){if(!iq)throw Error(a(363));for(t=Array.from(t=n8(e=n4(e),t)),e=0;e<t.length;){var n=t[e++],r=n.tag;if(!iK(n)){if((5===r||26===r||27===r)&&iQ(n.stateNode))return!0;for(n=n.child;null!==n;)t.push(n),n=n.sibling}}return!1},rj.getFindAllNodesFailureDescription=function(e,t){if(!iq)throw Error(a(363));var n=0,r=[];e=[n4(e),0];for(var i=0;i<e.length;){var s=e[i++],o=s.tag,l=e[i++],u=t[l];if((5!==o&&26!==o&&27!==o||!iK(s))&&(n5(s,u)&&(r.push(n6(u)),++l>n&&(n=l)),l<t.length))for(s=s.child;null!==s;)e.push(s,l),s=s.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(n6(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},rj.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return id(e.child.stateNode);default:return e.child.stateNode}},rj.injectIntoDevTools=function(){var e={bundleType:0,version:iu,rendererPackageName:ic,currentDispatcherRef:is,findFiberByHostInstance:iP,reconcilerVersion:"19.0.0"};if(null!==ih&&(e.rendererConfig=ih),"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{sc=t.inject(e),sh=t}catch(e){}e=!!t.checkDCE}}return e},rj.isAlreadyRendering=function(){return!1},rj.observeVisibleRects=function(e,t,n,r){if(!iq)throw Error(a(363));var i=i0(e=n9(e,t),n,r).disconnect;return{disconnect:function(){i()}}},rj.shouldError=function(){return null},rj.shouldSuspend=function(){return!1},rj.startHostTransition=function(e,t,n,r){if(5!==e.tag)throw Error(a(476));var s=tx(e).queue;t_(e,s,t,iV,null===n?i:function(){var t=tx(e).next.queue;return tA(e,t,{},n7()),n(r)})},rj.updateContainer=function(e,t,n,r){var i=t.current,a=n7();return rV(i,a,e,t,n,r),a},rj.updateContainerSync=function(e,t,n,r){return 0===t.tag&&rS(),rV(t.current,2,e,t,n,r),2},rj},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})},98133,(e,t,n)=>{"use strict";t.exports=e.r(40336)},45015,(e,t,n)=>{"use strict";function r(e,t){var n=e.length;for(e.push(t);0<n;){var r=n-1>>>1,i=e[r];if(0<s(i,t))e[r]=t,e[n]=i,n=r;else break}}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;for(var r=0,i=e.length,a=i>>>1;r<a;){var o=2*(r+1)-1,l=e[o],u=o+1,c=e[u];if(0>s(l,n))u<i&&0>s(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[o]=n,r=o);else if(u<i&&0>s(c,n))e[r]=c,e[u]=n,r=u;else break}}return t}function s(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var h=[],d=[],p=1,f=null,m=3,g=!1,v=!1,y=!1,_="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=i(d);null!==t;){if(null===t.callback)a(d);else if(t.startTime<=e)a(d),t.sortIndex=t.expirationTime,r(h,t);else break;t=i(d)}}function M(e){if(y=!1,S(e),!v)if(null!==i(h))v=!0,L();else{var t=i(d);null!==t&&N(M,t.startTime-e)}}var w=!1,E=-1,T=5,A=-1;function C(){return!(n.unstable_now()-A<T)}function R(){if(w){var e=n.unstable_now();A=e;var t=!0;try{e:{v=!1,y&&(y=!1,x(E),E=-1),g=!0;var r=m;try{t:{for(S(e),f=i(h);null!==f&&!(f.expirationTime>e&&C());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof l){f.callback=l,S(e),t=!0;break t}f===i(h)&&a(h),S(e)}else a(h);f=i(h)}if(null!==f)t=!0;else{var u=i(d);null!==u&&N(M,u.startTime-e),t=!1}}break e}finally{f=null,m=r,g=!1}}}finally{t?o():w=!1}}}if("function"==typeof b)o=function(){b(R)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=R,o=function(){I.postMessage(null)}}else o=function(){_(R,0)};function L(){w||(w=!0,o())}function N(e,t){E=_(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_continueExecution=function(){v||g||(v=!0,L())},n.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"):T=0<e?Math.floor(1e3/e):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_getFirstCallbackNode=function(){return i(h)},n.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},n.unstable_scheduleCallback=function(e,t,a){var s=n.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?s+a:s,e){case 1:var o=-1;break;case 2:o=250;break;case 5:o=0x3fffffff;break;case 4:o=1e4;break;default:o=5e3}return o=a+o,e={id:p++,callback:t,priorityLevel:e,startTime:a,expirationTime:o,sortIndex:-1},a>s?(e.sortIndex=a,r(d,e),null===i(h)&&e===i(d)&&(y?(x(E),E=-1):y=!0,N(M,a-s))):(e.sortIndex=o,r(h,e),v||g||(v=!0,L())),e},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}},95087,(e,t,n)=>{"use strict";t.exports=e.r(45015)},16096,90072,8560,8155,46791,46712,e=>{"use strict";let t,n,r,i,a,s,o,l,u,c;e.s(["useThree",()=>pj],16096),e.s(["B",()=>pb,"C",()=>pj,"D",()=>pX,"E",()=>pS,"G",()=>pJ,"a",()=>p_,"b",()=>py,"c",()=>fa,"d",()=>fo,"e",()=>p0,"f",()=>fE,"i",()=>pg,"j",()=>ff,"k",()=>fm,"o",()=>fl,"s",()=>pO,"u",()=>px],46712),e.i(47167);var h=e.i(71645),d=e.i(39695);e.s(["ACESFilmicToneMapping",()=>ef,"AddEquation",()=>N,"AddOperation",()=>eu,"AdditiveAnimationBlendMode",()=>tH,"AdditiveBlending",()=>R,"AgXToneMapping",()=>eg,"AlphaFormat",()=>e$,"AlwaysCompare",()=>nm,"AlwaysDepth",()=>ee,"AlwaysStencilFunc",()=>no,"AmbientLight",()=>un,"AnimationAction",()=>uY,"AnimationClip",()=>lU,"AnimationLoader",()=>lG,"AnimationMixer",()=>uZ,"AnimationObjectGroup",()=>uq,"AnimationUtils",()=>lS,"ArcCurve",()=>od,"ArrayCamera",()=>uS,"ArrowHelper",()=>ck,"AttachedBindMode",()=>ey,"Audio",()=>uP,"AudioAnalyser",()=>uO,"AudioContext",()=>ug,"AudioListener",()=>uR,"AudioLoader",()=>uv,"AxesHelper",()=>cz,"BackSide",()=>E,"BasicDepthPacking",()=>tj,"BasicShadowMap",()=>x,"BatchedMesh",()=>sL,"Bone",()=>a1,"BooleanKeyframeTrack",()=>lC,"Box2",()=>cr,"Box3",()=>rf,"Box3Helper",()=>cU,"BoxGeometry",()=>ai,"BoxHelper",()=>cD,"BufferAttribute",()=>iF,"BufferGeometry",()=>i0,"BufferGeometryLoader",()=>uu,"ByteType",()=>eB,"Cache",()=>lO,"Camera",()=>ac,"CameraHelper",()=>cI,"CanvasTexture",()=>s6,"CapsuleGeometry",()=>s7,"CatmullRomCurve3",()=>oy,"CineonToneMapping",()=>ep,"CircleGeometry",()=>oe,"ClampToEdgeWrapping",()=>eA,"Clock",()=>uM,"Color",()=>iE,"ColorKeyframeTrack",()=>lR,"ColorManagement",()=>n8,"CompressedArrayTexture",()=>s4,"CompressedCubeTexture",()=>s5,"CompressedTexture",()=>s3,"CompressedTextureLoader",()=>lW,"ConeGeometry",()=>on,"ConstantAlphaFactor",()=>K,"ConstantColorFactor",()=>J,"Controls",()=>cH,"CubeCamera",()=>am,"CubeReflectionMapping",()=>eb,"CubeRefractionMapping",()=>eS,"CubeTexture",()=>ag,"CubeTextureLoader",()=>lq,"CubeUVReflectionMapping",()=>eE,"CubicBezierCurve",()=>oS,"CubicBezierCurve3",()=>oM,"CubicInterpolant",()=>lw,"CullFaceBack",()=>v,"CullFaceFront",()=>y,"CullFaceFrontBack",()=>_,"CullFaceNone",()=>g,"Curve",()=>oc,"CurvePath",()=>oP,"CustomBlending",()=>L,"CustomToneMapping",()=>em,"CylinderGeometry",()=>ot,"Cylindrical",()=>ce,"Data3DTexture",()=>rd,"DataArrayTexture",()=>rc,"DataTexture",()=>a2,"DataTextureLoader",()=>lY,"DataUtils",()=>iN,"DecrementStencilOp",()=>t6,"DecrementWrapStencilOp",()=>t9,"DefaultLoadingManager",()=>lk,"DepthFormat",()=>e1,"DepthStencilFormat",()=>e2,"DepthTexture",()=>s8,"DetachedBindMode",()=>e_,"DirectionalLight",()=>ut,"DirectionalLightHelper",()=>cC,"DiscreteInterpolant",()=>lT,"DodecahedronGeometry",()=>oi,"DoubleSide",()=>T,"DstAlphaFactor",()=>W,"DstColorFactor",()=>X,"DynamicCopyUsage",()=>nM,"DynamicDrawUsage",()=>nv,"DynamicReadUsage",()=>nx,"EdgesGeometry",()=>ou,"EllipseCurve",()=>oh,"EqualCompare",()=>nc,"EqualDepth",()=>er,"EqualStencilFunc",()=>nn,"EquirectangularReflectionMapping",()=>eM,"EquirectangularRefractionMapping",()=>ew,"Euler",()=>rK,"EventDispatcher",()=>nL,"ExternalTexture",()=>s9,"ExtrudeGeometry",()=>oQ,"FileLoader",()=>lV,"Float16BufferAttribute",()=>ij,"Float32BufferAttribute",()=>iX,"FloatType",()=>ej,"Fog",()=>aS,"FogExp2",()=>ab,"FramebufferTexture",()=>s2,"FrontSide",()=>w,"Frustum",()=>sd,"FrustumArray",()=>sm,"GLBufferAttribute",()=>u2,"GLSL1",()=>nE,"GLSL3",()=>nT,"GreaterCompare",()=>nd,"GreaterDepth",()=>ea,"GreaterEqualCompare",()=>nf,"GreaterEqualDepth",()=>ei,"GreaterEqualStencilFunc",()=>ns,"GreaterStencilFunc",()=>ni,"GridHelper",()=>cM,"Group",()=>ay,"HalfFloatType",()=>eX,"HemisphereLight",()=>lK,"HemisphereLightHelper",()=>cS,"IcosahedronGeometry",()=>o1,"ImageBitmapLoader",()=>um,"ImageLoader",()=>lX,"ImageUtils",()=>re,"IncrementStencilOp",()=>t5,"IncrementWrapStencilOp",()=>t8,"InstancedBufferAttribute",()=>a6,"InstancedBufferGeometry",()=>ul,"InstancedInterleavedBuffer",()=>u1,"InstancedMesh",()=>si,"Int16BufferAttribute",()=>iH,"Int32BufferAttribute",()=>iG,"Int8BufferAttribute",()=>ik,"IntType",()=>eG,"InterleavedBuffer",()=>aw,"InterleavedBufferAttribute",()=>aT,"Interpolant",()=>lM,"InterpolateDiscrete",()=>tD,"InterpolateLinear",()=>tU,"InterpolateSmooth",()=>tO,"InterpolationSamplingMode",()=>nI,"InterpolationSamplingType",()=>nP,"InvertStencilOp",()=>t7,"KeepStencilOp",()=>t3,"KeyframeTrack",()=>lA,"LOD",()=>aW,"LatheGeometry",()=>o2,"Layers",()=>r$,"LessCompare",()=>nu,"LessDepth",()=>et,"LessEqualCompare",()=>nh,"LessEqualDepth",()=>en,"LessEqualStencilFunc",()=>nr,"LessStencilFunc",()=>nt,"Light",()=>lZ,"LightProbe",()=>ua,"Line",()=>sH,"Line3",()=>ch,"LineBasicMaterial",()=>sN,"LineCurve",()=>ow,"LineCurve3",()=>oE,"LineDashedMaterial",()=>lg,"LineLoop",()=>sX,"LineSegments",()=>sj,"LinearFilter",()=>eD,"LinearInterpolant",()=>lE,"LinearMipMapLinearFilter",()=>ek,"LinearMipMapNearestFilter",()=>eO,"LinearMipmapLinearFilter",()=>eF,"LinearMipmapNearestFilter",()=>eU,"LinearSRGBColorSpace",()=>tQ,"LinearToneMapping",()=>eh,"LinearTransfer",()=>t0,"Loader",()=>lz,"LoaderUtils",()=>uo,"LoadingManager",()=>lF,"LoopOnce",()=>tI,"LoopPingPong",()=>tN,"LoopRepeat",()=>tL,"MOUSE",()=>f,"Material",()=>iC,"MaterialLoader",()=>us,"MathUtils",()=>nG,"Matrix2",()=>ct,"Matrix3",()=>nJ,"Matrix4",()=>rH,"MaxEquation",()=>F,"Mesh",()=>an,"MeshBasicMaterial",()=>iR,"MeshDepthMaterial",()=>lp,"MeshDistanceMaterial",()=>lf,"MeshLambertMaterial",()=>ld,"MeshMatcapMaterial",()=>lm,"MeshNormalMaterial",()=>lh,"MeshPhongMaterial",()=>lu,"MeshPhysicalMaterial",()=>ll,"MeshStandardMaterial",()=>lo,"MeshToonMaterial",()=>lc,"MinEquation",()=>O,"MirroredRepeatWrapping",()=>eC,"MixOperation",()=>el,"MultiplyBlending",()=>I,"MultiplyOperation",()=>eo,"NearestFilter",()=>eR,"NearestMipMapLinearFilter",()=>eN,"NearestMipMapNearestFilter",()=>eI,"NearestMipmapLinearFilter",()=>eL,"NearestMipmapNearestFilter",()=>eP,"NeutralToneMapping",()=>ev,"NeverCompare",()=>nl,"NeverDepth",()=>Q,"NeverStencilFunc",()=>ne,"NoBlending",()=>A,"NoColorSpace",()=>tK,"NoToneMapping",()=>ec,"NormalAnimationBlendMode",()=>tB,"NormalBlending",()=>C,"NotEqualCompare",()=>np,"NotEqualDepth",()=>es,"NotEqualStencilFunc",()=>na,"NumberKeyframeTrack",()=>lP,"Object3D",()=>ia,"ObjectLoader",()=>uc,"ObjectSpaceNormalMap",()=>tZ,"OctahedronGeometry",()=>o3,"OneFactor",()=>z,"OneMinusConstantAlphaFactor",()=>$,"OneMinusConstantColorFactor",()=>Z,"OneMinusDstAlphaFactor",()=>j,"OneMinusDstColorFactor",()=>q,"OneMinusSrcAlphaFactor",()=>G,"OneMinusSrcColorFactor",()=>H,"OrthographicCamera",()=>l7,"PCFShadowMap",()=>b,"PCFSoftShadowMap",()=>S,"Path",()=>oI,"PerspectiveCamera",()=>af,"Plane",()=>sl,"PlaneGeometry",()=>o4,"PlaneHelper",()=>cO,"PointLight",()=>l9,"PointLightHelper",()=>cy,"Points",()=>s$,"PointsMaterial",()=>sq,"PolarGridHelper",()=>cw,"PolyhedronGeometry",()=>or,"PositionalAudio",()=>uU,"PropertyBinding",()=>uX,"PropertyMixer",()=>uF,"QuadraticBezierCurve",()=>oT,"QuadraticBezierCurve3",()=>oA,"Quaternion",()=>nj,"QuaternionKeyframeTrack",()=>lL,"QuaternionLinearInterpolant",()=>lI,"RAD2DEG",()=>nO,"RED_GREEN_RGTC2_Format",()=>tR,"RED_RGTC1_Format",()=>tA,"REVISION",()=>p,"RGBADepthPacking",()=>tX,"RGBAFormat",()=>e0,"RGBAIntegerFormat",()=>e9,"RGBA_ASTC_10x10_Format",()=>tb,"RGBA_ASTC_10x5_Format",()=>ty,"RGBA_ASTC_10x6_Format",()=>t_,"RGBA_ASTC_10x8_Format",()=>tx,"RGBA_ASTC_12x10_Format",()=>tS,"RGBA_ASTC_12x12_Format",()=>tM,"RGBA_ASTC_4x4_Format",()=>tc,"RGBA_ASTC_5x4_Format",()=>th,"RGBA_ASTC_5x5_Format",()=>td,"RGBA_ASTC_6x5_Format",()=>tp,"RGBA_ASTC_6x6_Format",()=>tf,"RGBA_ASTC_8x5_Format",()=>tm,"RGBA_ASTC_8x6_Format",()=>tg,"RGBA_ASTC_8x8_Format",()=>tv,"RGBA_BPTC_Format",()=>tw,"RGBA_ETC2_EAC_Format",()=>tu,"RGBA_PVRTC_2BPPV1_Format",()=>ts,"RGBA_PVRTC_4BPPV1_Format",()=>ta,"RGBA_S3TC_DXT1_Format",()=>te,"RGBA_S3TC_DXT3_Format",()=>tt,"RGBA_S3TC_DXT5_Format",()=>tn,"RGBDepthPacking",()=>tq,"RGBFormat",()=>eQ,"RGBIntegerFormat",()=>e8,"RGB_BPTC_SIGNED_Format",()=>tE,"RGB_BPTC_UNSIGNED_Format",()=>tT,"RGB_ETC1_Format",()=>to,"RGB_ETC2_Format",()=>tl,"RGB_PVRTC_2BPPV1_Format",()=>ti,"RGB_PVRTC_4BPPV1_Format",()=>tr,"RGB_S3TC_DXT1_Format",()=>e7,"RGDepthPacking",()=>tY,"RGFormat",()=>e5,"RGIntegerFormat",()=>e6,"RawShaderMaterial",()=>ls,"Ray",()=>rB,"Raycaster",()=>u4,"RectAreaLight",()=>ur,"RedFormat",()=>e3,"RedIntegerFormat",()=>e4,"ReinhardToneMapping",()=>ed,"RenderTarget",()=>rl,"RenderTarget3D",()=>uK,"RepeatWrapping",()=>eT,"ReplaceStencilOp",()=>t4,"ReverseSubtractEquation",()=>U,"RingGeometry",()=>o5,"SIGNED_RED_GREEN_RGTC2_Format",()=>tP,"SIGNED_RED_RGTC1_Format",()=>tC,"SRGBColorSpace",()=>t$,"SRGBTransfer",()=>t1,"Scene",()=>aM,"ShaderMaterial",()=>au,"ShadowMaterial",()=>la,"Shape",()=>oL,"ShapeGeometry",()=>o6,"ShapePath",()=>cB,"ShapeUtils",()=>oZ,"ShortType",()=>eH,"Skeleton",()=>a5,"SkeletonHelper",()=>cv,"SkinnedMesh",()=>a0,"Source",()=>rn,"Sphere",()=>rL,"SphereGeometry",()=>o8,"Spherical",()=>u7,"SphericalHarmonics3",()=>ui,"SplineCurve",()=>oC,"SpotLight",()=>l3,"SpotLightHelper",()=>cp,"Sprite",()=>aB,"SpriteMaterial",()=>aA,"SrcAlphaFactor",()=>V,"SrcAlphaSaturateFactor",()=>Y,"SrcColorFactor",()=>B,"StaticCopyUsage",()=>nS,"StaticDrawUsage",()=>ng,"StaticReadUsage",()=>n_,"StereoCamera",()=>ub,"StreamCopyUsage",()=>nw,"StreamDrawUsage",()=>ny,"StreamReadUsage",()=>nb,"StringKeyframeTrack",()=>lN,"SubtractEquation",()=>D,"SubtractiveBlending",()=>P,"TOUCH",()=>m,"TangentSpaceNormalMap",()=>tJ,"TetrahedronGeometry",()=>o9,"Texture",()=>rs,"TextureLoader",()=>lJ,"TextureUtils",()=>cG,"Timer",()=>u8,"TimestampQuery",()=>nR,"TorusGeometry",()=>o7,"TorusKnotGeometry",()=>le,"Triangle",()=>ix,"TriangleFanDrawMode",()=>tW,"TriangleStripDrawMode",()=>tG,"TrianglesDrawMode",()=>tV,"TubeGeometry",()=>lt,"UVMapping",()=>ex,"Uint16BufferAttribute",()=>iV,"Uint32BufferAttribute",()=>iW,"Uint8BufferAttribute",()=>iz,"Uint8ClampedBufferAttribute",()=>iB,"Uniform",()=>u$,"UniformsGroup",()=>u0,"UniformsUtils",()=>al,"UnsignedByteType",()=>ez,"UnsignedInt101111Type",()=>eK,"UnsignedInt248Type",()=>eJ,"UnsignedInt5999Type",()=>eZ,"UnsignedIntType",()=>eW,"UnsignedShort4444Type",()=>eq,"UnsignedShort5551Type",()=>eY,"UnsignedShortType",()=>eV,"VSMShadowMap",()=>M,"Vector2",()=>nW,"Vector3",()=>nX,"Vector4",()=>ro,"VectorKeyframeTrack",()=>lD,"VideoFrameTexture",()=>s1,"VideoTexture",()=>s0,"WebGL3DRenderTarget",()=>rp,"WebGLArrayRenderTarget",()=>rh,"WebGLCoordinateSystem",()=>nA,"WebGLCubeRenderTarget",()=>av,"WebGLRenderTarget",()=>ru,"WebGPUCoordinateSystem",()=>nC,"WebXRController",()=>ax,"WireframeGeometry",()=>ln,"WrapAroundEnding",()=>tz,"ZeroCurvatureEnding",()=>tF,"ZeroFactor",()=>k,"ZeroSlopeEnding",()=>tk,"ZeroStencilOp",()=>t2,"arrayNeedsUint32",()=>nK,"cloneUniforms",()=>aa,"createCanvasElement",()=>n1,"createElementNS",()=>n0,"getByteLength",()=>cV,"getUnlitUniformColorSpace",()=>ao,"mergeUniforms",()=>as,"probeAsync",()=>n4,"warnOnce",()=>n3],90072);let p="180",f={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},m={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},g=0,v=1,y=2,_=3,x=0,b=1,S=2,M=3,w=0,E=1,T=2,A=0,C=1,R=2,P=3,I=4,L=5,N=100,D=101,U=102,O=103,F=104,k=200,z=201,B=202,H=203,V=204,G=205,W=206,j=207,X=208,q=209,Y=210,J=211,Z=212,K=213,$=214,Q=0,ee=1,et=2,en=3,er=4,ei=5,ea=6,es=7,eo=0,el=1,eu=2,ec=0,eh=1,ed=2,ep=3,ef=4,em=5,eg=6,ev=7,ey="attached",e_="detached",ex=300,eb=301,eS=302,eM=303,ew=304,eE=306,eT=1e3,eA=1001,eC=1002,eR=1003,eP=1004,eI=1004,eL=1005,eN=1005,eD=1006,eU=1007,eO=1007,eF=1008,ek=1008,ez=1009,eB=1010,eH=1011,eV=1012,eG=1013,eW=1014,ej=1015,eX=1016,eq=1017,eY=1018,eJ=1020,eZ=35902,eK=35899,e$=1021,eQ=1022,e0=1023,e1=1026,e2=1027,e3=1028,e4=1029,e5=1030,e6=1031,e8=1032,e9=1033,e7=33776,te=33777,tt=33778,tn=33779,tr=35840,ti=35841,ta=35842,ts=35843,to=36196,tl=37492,tu=37496,tc=37808,th=37809,td=37810,tp=37811,tf=37812,tm=37813,tg=37814,tv=37815,ty=37816,t_=37817,tx=37818,tb=37819,tS=37820,tM=37821,tw=36492,tE=36494,tT=36495,tA=36283,tC=36284,tR=36285,tP=36286,tI=2200,tL=2201,tN=2202,tD=2300,tU=2301,tO=2302,tF=2400,tk=2401,tz=2402,tB=2500,tH=2501,tV=0,tG=1,tW=2,tj=3200,tX=3201,tq=3202,tY=3203,tJ=0,tZ=1,tK="",t$="srgb",tQ="srgb-linear",t0="linear",t1="srgb",t2=0,t3=7680,t4=7681,t5=7682,t6=7683,t8=34055,t9=34056,t7=5386,ne=512,nt=513,nn=514,nr=515,ni=516,na=517,ns=518,no=519,nl=512,nu=513,nc=514,nh=515,nd=516,np=517,nf=518,nm=519,ng=35044,nv=35048,ny=35040,n_=35045,nx=35049,nb=35041,nS=35046,nM=35050,nw=35042,nE="100",nT="300 es",nA=2e3,nC=2001,nR={COMPUTE:"compute",RENDER:"render"},nP={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},nI={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};class nL{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return void 0!==n&&void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){let n=this._listeners;if(void 0===n)return;let r=n[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}}let nN=["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"],nD=1234567,nU=Math.PI/180,nO=180/Math.PI;function nF(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0,r=0xffffffff*Math.random()|0;return(nN[255&e]+nN[e>>8&255]+nN[e>>16&255]+nN[e>>24&255]+"-"+nN[255&t]+nN[t>>8&255]+"-"+nN[t>>16&15|64]+nN[t>>24&255]+"-"+nN[63&n|128]+nN[n>>8&255]+"-"+nN[n>>16&255]+nN[n>>24&255]+nN[255&r]+nN[r>>8&255]+nN[r>>16&255]+nN[r>>24&255]).toLowerCase()}function nk(e,t,n){return Math.max(t,Math.min(n,e))}function nz(e,t){return(e%t+t)%t}function nB(e,t,n){return(1-n)*e+n*t}function nH(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function nV(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let nG={DEG2RAD:nU,RAD2DEG:nO,generateUUID:nF,clamp:nk,euclideanModulo:nz,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:nB,damp:function(e,t,n,r){return nB(e,t,1-Math.exp(-n*r))},pingpong:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(nz(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&&(nD=e);let t=nD+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*nU},radToDeg:function(e){return e*nO},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+r)/2),c=s((t+r)/2),h=a((t-r)/2),d=s((t-r)/2),p=a((r-t)/2),f=s((r-t)/2);switch(i){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:nV,denormalize:nH};class nW{get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let 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}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(nk(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let 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}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let 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}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}constructor(e=0,t=0){nW.prototype.isVector2=!0,this.x=e,this.y=t}}class nj{static slerpFlat(e,t,n,r,i,a,s){let o=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(1===s){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==h||l!==d||u!==p){let e=1-s,t=o*h+l*d+u*p+c*f,n=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,s=Math.sin(s*a)/i}let i=s*n;if(o=o*e+h*i,l=l*e+d*i,u=u*e+p*i,c=c*e+f*i,e===1-s){let e=1/Math.sqrt(o*o+l*l+u*u+c*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,a){let s=n[r],o=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=e._x,r=e._y,i=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(r/2),c=s(i/2),h=o(n/2),d=o(r/2),p=o(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(i-l)*e,this._z=(a-r)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(i-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-r)/e,this._x=(i+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(nk(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 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}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+r*l-i*o,this._y=r*u+a*o+i*s-n*l,this._z=i*u+a*l+n*o-r*s,this._w=a*u-n*s-r*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,s=a*e._w+n*e._x+r*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let l=Math.sqrt(o),u=Math.atan2(l,s),c=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=a*c+this._w*h,this._x=n*c+this._x*h,this._y=r*c+this._y*h,this._z=i*c+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){let 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}toArray(){let 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}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}}class nX{set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(nY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(nY.setFromAxisAngle(e,t))}applyMatrix3(e){let 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}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let 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}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*r-s*n),u=2*(s*t-i*r),c=2*(i*n-a*t);return this.x=t+o*l+a*c-s*u,this.y=n+o*u+s*l-i*c,this.z=r+o*c+i*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let 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()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this.z=nk(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this.z=nk(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,s=t.y,o=t.z;return this.x=r*o-i*s,this.y=i*a-n*o,this.z=n*s-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return nq.copy(this).projectOnVector(e),this.sub(nq)}reflect(e){return this.sub(nq.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(nk(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let 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}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let 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}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){let 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}toArray(){let 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}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}constructor(e=0,t=0,n=0){nX.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}}let nq=new nX,nY=new nj;class nJ{set(e,t,n,r,i,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=r,u[2]=s,u[3]=t,u[4]=i,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],_=r[7],x=r[2],b=r[5],S=r[8];return i[0]=a*f+s*v+o*x,i[3]=a*m+s*y+o*b,i[6]=a*g+s*_+o*S,i[1]=l*f+u*v+c*x,i[4]=l*m+u*y+c*b,i[7]=l*g+u*_+c*S,i[2]=h*f+d*v+p*x,i[5]=h*m+d*y+p*b,i[8]=h*g+d*_+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*i*u+n*s*o+r*i*l-r*a*o}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*i,d=l*i-a*o,p=t*c+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(r*l-u*n)*f,e[2]=(s*n-r*a)*f,e[3]=h*f,e[4]=(u*t-r*o)*f,e[5]=(r*i-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*i)*f,this}transpose(){let 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}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,s){let o=Math.cos(i),l=Math.sin(i);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-r*l,r*o,-r*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(nZ.makeScale(e,t)),this}rotate(e){return this.premultiply(nZ.makeRotation(-e)),this}translate(e,t){return this.premultiply(nZ.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(){let 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}clone(){return new this.constructor().fromArray(this.elements)}constructor(e,t,n,r,i,a,s,o,l){nJ.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,a,s,o,l)}}let nZ=new nJ;function nK(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let n$={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function nQ(e,t){return new n$[e](t)}function n0(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function n1(){let e=n0("canvas");return e.style.display="block",e}let n2={};function n3(e){e in n2||(n2[e]=!0,console.warn(e))}function n4(e,t,n){return new Promise(function(r,i){setTimeout(function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}},n)})}let n5=new nJ().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),n6=new nJ().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),n8=function(){let e={enabled:!0,workingColorSpace:tQ,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n&&(this.spaces[t].transfer===t1&&(e.r=n9(e.r),e.g=n9(e.g),e.b=n9(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===t1&&(e.r=n7(e.r),e.g=n7(e.g),e.b=n7(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===tK?t0:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.workingColorSpace;return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.workingColorSpace;return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return n3("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return n3("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[tQ]:{primaries:t,whitePoint:r,transfer:t0,toXYZ:n5,fromXYZ:n6,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:t$},outputColorSpaceConfig:{drawingBufferColorSpace:t$}},[t$]:{primaries:t,whitePoint:r,transfer:t1,toXYZ:n5,fromXYZ:n6,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:t$}}}),e}();function n9(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function n7(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class re{static getDataURL(e){let n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/png";if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)n=e;else{void 0===t&&(t=n0("canvas")),t.width=e.width,t.height=e.height;let r=t.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=t}return n.toDataURL(r)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=n0("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=255*n9(i[e]/255);return n.putImageData(r,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*n9(t[e]/255)):t[e]=n9(t[e]);return{data:t,width:e.width,height:e.height}}}}let rt=0;class rn{getSize(e){let t=this.data;return"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(rr(r[t].image)):e.push(rr(r[t]))}else e=rr(r);n.url=e}return t||(e.images[this.uuid]=n),n}constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:rt++}),this.uuid=nF(),this.data=e,this.dataReady=!0,this.version=0}}function rr(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?re.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."),{})}let ri=0,ra=new nX;class rs extends nL{get width(){return this.source.getSize(ra).x}get height(){return this.source.getSize(ra).y}get depth(){return this.source.getSize(ra).z}get image(){return this.source.data}set image(e){void 0===e&&(e=null),this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(void 0===n){console.warn("THREE.Texture.setValues(): parameter '".concat(t,"' has value of undefined."));continue}let r=this[t];if(void 0===r){console.warn("THREE.Texture.setValues(): property '".concat(t,"' does not exist."));continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ex)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case eT:e.x=e.x-Math.floor(e.x);break;case eA:e.x=e.x<0?0:1;break;case eC: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 eT:e.y=e.y-Math.floor(e.y);break;case eA:e.y=e.y<0?0:1;break;case eC: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}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}constructor(e=rs.DEFAULT_IMAGE,t=rs.DEFAULT_MAPPING,n=eA,r=eA,i=eD,a=eF,s=e0,o=ez,l=rs.DEFAULT_ANISOTROPY,u=tK){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ri++}),this.uuid=nF(),this.name="",this.source=new rn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new nW(0,0),this.repeat=new nW(1,1),this.center=new nW(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nJ,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}}rs.DEFAULT_IMAGE=null,rs.DEFAULT_MAPPING=ex,rs.DEFAULT_ANISOTROPY=1;class ro{get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let 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}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=e.elements,s=a[0],o=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-u)&&.01>Math.abs(l-d)&&.01>Math.abs(h-p)){if(.1>Math.abs(o+u)&&.1>Math.abs(l+d)&&.1>Math.abs(h+p)&&.1>Math.abs(s+c+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+u)/4,v=(l+d)/4,y=(h+p)/4;return e>a&&e>m?e<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(e)),i=v/n):a>m?a<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(a)),i=y/r):m<.01?(n=.707106781,r=.707106781,i=0):(n=v/(i=Math.sqrt(m)),r=y/i),this.set(n,r,i,t),this}let m=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-o)*(u-o));return .001>Math.abs(m)&&(m=1),this.x=(p-h)/m,this.y=(l-d)/m,this.z=(u-o)/m,this.w=Math.acos((s+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=nk(this.x,e.x,t.x),this.y=nk(this.y,e.y,t.y),this.z=nk(this.z,e.z,t.z),this.w=nk(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=nk(this.x,e,t),this.y=nk(this.y,e,t),this.z=nk(this.z,e,t),this.w=nk(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(nk(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){let 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}toArray(){let 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}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}constructor(e=0,t=0,n=0,r=1){ro.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}}class rl extends nL{_setTextureOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={minFilter:eD,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t){let 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(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isArrayTexture=this.textures[r].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new rn(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:eD,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new ro(0,0,e,t),this.scissorTest=!1,this.viewport=new ro(0,0,e,t);let r=new rs({width:e,height:t,depth:n.depth});this.textures=[];let i=n.count;for(let e=0;e<i;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}}class ru extends rl{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class rc extends rs{addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=eR,this.minFilter=eR,this.wrapR=eA,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}}class rh extends ru{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new rc(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class rd extends rs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=eR,this.minFilter=eR,this.wrapR=eA,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rp extends ru{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new rd(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class rf{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(rg.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(rg.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=rg.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);let n=e.geometry;if(void 0!==n){let r=n.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,n=r.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,rg):rg.fromBufferAttribute(r,t),rg.applyMatrix4(e.matrixWorld),this.expandByPoint(rg);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),rv.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),rv.copy(n.boundingBox)),rv.applyMatrix4(e.matrixWorld),this.union(rv)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,rg),rg.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(rw),rE.subVectors(this.max,rw),ry.subVectors(e.a,rw),r_.subVectors(e.b,rw),rx.subVectors(e.c,rw),rb.subVectors(r_,ry),rS.subVectors(rx,r_),rM.subVectors(ry,rx);let t=[0,-rb.z,rb.y,0,-rS.z,rS.y,0,-rM.z,rM.y,rb.z,0,-rb.x,rS.z,0,-rS.x,rM.z,0,-rM.x,-rb.y,rb.x,0,-rS.y,rS.x,0,-rM.y,rM.x,0];return!!rC(t,ry,r_,rx,rE)&&!!rC(t=[1,0,0,0,1,0,0,0,1],ry,r_,rx,rE)&&(rT.crossVectors(rb,rS),rC(t=[rT.x,rT.y,rT.z],ry,r_,rx,rE))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,rg).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(rg).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(rm[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rm[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rm[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rm[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rm[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rm[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rm[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rm[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rm)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}constructor(e=new nX(Infinity,Infinity,Infinity),t=new nX(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}}let rm=[new nX,new nX,new nX,new nX,new nX,new nX,new nX,new nX],rg=new nX,rv=new rf,ry=new nX,r_=new nX,rx=new nX,rb=new nX,rS=new nX,rM=new nX,rw=new nX,rE=new nX,rT=new nX,rA=new nX;function rC(e,t,n,r,i){for(let a=0,s=e.length-3;a<=s;a+=3){rA.fromArray(e,a);let s=i.x*Math.abs(rA.x)+i.y*Math.abs(rA.y)+i.z*Math.abs(rA.z),o=t.dot(rA),l=n.dot(rA),u=r.dot(rA);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let rR=new rf,rP=new nX,rI=new nX;class rL{set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):rR.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let 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}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;rP.subVectors(e,this.center);let t=rP.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(rP,n/e),this.radius+=n}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(rI.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(rP.copy(e.center).add(rI)),this.expandByPoint(rP.copy(e.center).sub(rI)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}constructor(e=new nX,t=-1){this.isSphere=!0,this.center=e,this.radius=t}}let rN=new nX,rD=new nX,rU=new nX,rO=new nX,rF=new nX,rk=new nX,rz=new nX;class rB{set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,rN)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=rN.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(rN.copy(this.origin).addScaledVector(this.direction,t),rN.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){let i,a,s,o;rD.copy(e).add(t).multiplyScalar(.5),rU.copy(t).sub(e).normalize(),rO.copy(this.origin).sub(rD);let l=.5*e.distanceTo(t),u=-this.direction.dot(rU),c=rO.dot(this.direction),h=-rO.dot(rU),d=rO.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(i=u*h-c,a=u*c-h,o=l*p,i>=0)if(a>=-o)if(a<=o){let e=1/p;i*=e,a*=e,s=i*(i+u*a+2*c)+a*(u*i+a+2*h)+d}else s=-(i=Math.max(0,-(u*(a=l)+c)))*i+a*(a+2*h)+d;else s=-(i=Math.max(0,-(u*(a=-l)+c)))*i+a*(a+2*h)+d;else a<=-o?(a=(i=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d):a<=o?(i=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(i=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d);else a=u>0?-l:l,s=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,i),r&&r.copy(rD).addScaledVector(rU,a),s}intersectSphere(e,t){rN.subVectors(e.center,this.origin);let n=rN.dot(this.direction),r=rN.dot(rN)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let n,r,i,a,s,o,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||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),c>=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>r||((s>n||n!=n)&&(n=s),(o<r||r!=r)&&(r=o),r<0)))?null:this.at(n>=0?n:r,t)}intersectsBox(e){return null!==this.intersectBox(e,rN)}intersectTriangle(e,t,n,r,i){let a;rF.subVectors(t,e),rk.subVectors(n,e),rz.crossVectors(rF,rk);let s=this.direction.dot(rz);if(s>0){if(r)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}rO.subVectors(this.origin,e);let o=a*this.direction.dot(rk.crossVectors(rO,rk));if(o<0)return null;let l=a*this.direction.dot(rF.cross(rO));if(l<0||o+l>s)return null;let u=-a*rO.dot(rz);return u<0?null:this.at(u/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}constructor(e=new nX,t=new nX(0,0,-1)){this.origin=e,this.direction=t}}class rH{set(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new rH().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/rV.setFromMatrixColumn(e,0).length(),i=1/rV.setFromMatrixColumn(e,1).length(),a=1/rV.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}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-s*o,t[2]=i-e*l,t[6]=r+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e+i*s,t[4]=r*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-r,t[6]=i+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e-i*s,t[4]=-a*c,t[8]=r+n*s,t[1]=n+r*s,t[5]=a*u,t[9]=i-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=r*l-n,t[8]=e*l+i,t[1]=o*c,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+i,t[5]=a*u,t[9]=n*c-r,t[2]=r*c-n,t[6]=s*u,t[10]=i*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rW,e,rj)}lookAt(e,t,n){let r=this.elements;return rY.subVectors(e,t),0===rY.lengthSq()&&(rY.z=1),rY.normalize(),rX.crossVectors(n,rY),0===rX.lengthSq()&&(1===Math.abs(n.z)?rY.x+=1e-4:rY.z+=1e-4,rY.normalize(),rX.crossVectors(n,rY)),rX.normalize(),rq.crossVectors(rY,rX),r[0]=rX.x,r[4]=rq.x,r[8]=rY.x,r[1]=rX.y,r[5]=rq.y,r[9]=rY.y,r[2]=rX.z,r[6]=rq.z,r[10]=rY.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],_=n[11],x=n[15],b=r[0],S=r[4],M=r[8],w=r[12],E=r[1],T=r[5],A=r[9],C=r[13],R=r[2],P=r[6],I=r[10],L=r[14],N=r[3],D=r[7],U=r[11],O=r[15];return i[0]=a*b+s*E+o*R+l*N,i[4]=a*S+s*T+o*P+l*D,i[8]=a*M+s*A+o*I+l*U,i[12]=a*w+s*C+o*L+l*O,i[1]=u*b+c*E+h*R+d*N,i[5]=u*S+c*T+h*P+d*D,i[9]=u*M+c*A+h*I+d*U,i[13]=u*w+c*C+h*L+d*O,i[2]=p*b+f*E+m*R+g*N,i[6]=p*S+f*T+m*P+g*D,i[10]=p*M+f*A+m*I+g*U,i[14]=p*w+f*C+m*L+g*O,i[3]=v*b+y*E+_*R+x*N,i[7]=v*S+y*T+_*P+x*D,i[11]=v*M+y*A+_*I+x*U,i[15]=v*w+y*C+_*L+x*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7];return p*(i*o*c-r*l*c-i*s*h+n*l*h+r*s*d-n*o*d)+f*(t*o*d-t*l*h+i*a*h-r*a*d+r*l*u-i*o*u)+e[11]*(t*l*c-t*s*d-i*a*c+n*a*d+i*s*u-n*l*u)+e[15]*(-r*s*u-t*o*c+t*s*h+r*a*c-n*a*h+n*o*u)}transpose(){let 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}setPosition(e,t,n){let 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}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*h*l+f*o*d-s*m*d-c*o*g+s*h*g,y=p*h*l-u*m*l-p*o*d+a*m*d+u*o*g-a*h*g,_=u*f*l-p*c*l+p*s*d-a*f*d-u*s*g+a*c*g,x=p*c*o-u*f*o-p*s*h+a*f*h+u*s*m-a*c*m,b=t*v+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);let S=1/b;return e[0]=v*S,e[1]=(f*h*i-c*m*i-f*r*d+n*m*d+c*r*g-n*h*g)*S,e[2]=(s*m*i-f*o*i+f*r*l-n*m*l-s*r*g+n*o*g)*S,e[3]=(c*o*i-s*h*i-c*r*l+n*h*l+s*r*d-n*o*d)*S,e[4]=y*S,e[5]=(u*m*i-p*h*i+p*r*d-t*m*d-u*r*g+t*h*g)*S,e[6]=(p*o*i-a*m*i-p*r*l+t*m*l+a*r*g-t*o*g)*S,e[7]=(a*h*i-u*o*i+u*r*l-t*h*l-a*r*d+t*o*d)*S,e[8]=_*S,e[9]=(p*c*i-u*f*i-p*n*d+t*f*d+u*n*g-t*c*g)*S,e[10]=(a*f*i-p*s*i+p*n*l-t*f*l-a*n*g+t*s*g)*S,e[11]=(u*s*i-a*c*i-u*n*l+t*c*l+a*n*d-t*s*d)*S,e[12]=x*S,e[13]=(u*f*r-p*c*r+p*n*h-t*f*h-u*n*m+t*c*m)*S,e[14]=(p*s*r-a*f*r-p*n*o+t*f*o+a*n*m-t*s*m)*S,e[15]=(a*c*r-u*s*r+u*n*o-t*c*o-a*n*h+t*s*h)*S,this}scale(e){let 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}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];return Math.sqrt(Math.max(t,e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,s=e.y,o=e.z,l=i*a,u=i*s;return this.set(l*a+n,l*s-r*o,l*o+r*s,0,l*s+r*o,u*s+n,u*o-r*a,0,l*o-r*s,u*o+r*a,i*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,s=t._z,o=t._w,l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,p=i*c,f=a*u,m=a*c,g=s*c,v=o*l,y=o*u,_=o*c,x=n.x,b=n.y,S=n.z;return r[0]=(1-(f+g))*x,r[1]=(d+_)*x,r[2]=(p-y)*x,r[3]=0,r[4]=(d-_)*b,r[5]=(1-(h+g))*b,r[6]=(m+v)*b,r[7]=0,r[8]=(p+y)*S,r[9]=(m-v)*S,r[10]=(1-(h+f))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=rV.set(r[0],r[1],r[2]).length(),a=rV.set(r[4],r[5],r[6]).length(),s=rV.set(r[8],r[9],r[10]).length();0>this.determinant()&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],rG.copy(this);let o=1/i,l=1/a,u=1/s;return rG.elements[0]*=o,rG.elements[1]*=o,rG.elements[2]*=o,rG.elements[4]*=l,rG.elements[5]*=l,rG.elements[6]*=l,rG.elements[8]*=u,rG.elements[9]*=u,rG.elements[10]*=u,t.setFromRotationMatrix(rG),n.x=i,n.y=a,n.z=s,this}makePerspective(e,t,n,r,i,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:nA,u=arguments.length>7&&void 0!==arguments[7]&&arguments[7],c=this.elements;if(u)s=i/(a-i),o=a*i/(a-i);else if(l===nA)s=-(a+i)/(a-i),o=-2*a*i/(a-i);else if(l===nC)s=-a/(a-i),o=-a*i/(a-i);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return c[0]=2*i/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*i/(n-r),c[9]=(n+r)/(n-r),c[13]=0,c[2]=0,c[6]=0,c[10]=s,c[14]=o,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:nA,u=arguments.length>7&&void 0!==arguments[7]&&arguments[7],c=this.elements;if(u)s=1/(a-i),o=a/(a-i);else if(l===nA)s=-2/(a-i),o=-(a+i)/(a-i);else if(l===nC)s=-1/(a-i),o=-i/(a-i);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(n-r),c[9]=0,c[13]=-(n+r)/(n-r),c[2]=0,c[6]=0,c[10]=s,c[14]=o,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(){let 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}constructor(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m){rH.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m)}}let rV=new nX,rG=new rH,rW=new nX(0,0,0),rj=new nX(1,1,1),rX=new nX,rq=new nX,rY=new nX,rJ=new rH,rZ=new nj;class rK{get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n){let 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}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){let 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],s=r[8],o=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(nk(s,-1,1)),.9999999>Math.abs(s)?(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(-nk(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(nk(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,i));break;case"ZYX":this._y=Math.asin(-nk(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(nk(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-nk(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,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}setFromQuaternion(e,t,n){return rJ.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rJ,t,n)}setFromVector3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return rZ.setFromEuler(this),this.setFromQuaternion(rZ,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){let 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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}constructor(e=0,t=0,n=0,r=rK.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}}rK.DEFAULT_ORDER="XYZ";class r${set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}constructor(){this.mask=1}}let rQ=0,r0=new nX,r1=new nj,r2=new rH,r3=new nX,r4=new nX,r5=new nX,r6=new nj,r8=new nX(1,0,0),r9=new nX(0,1,0),r7=new nX(0,0,1),ie={type:"added"},it={type:"removed"},ir={type:"childadded",child:null},ii={type:"childremoved",child:null};class ia extends nL{onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return r1.setFromAxisAngle(e,t),this.quaternion.multiply(r1),this}rotateOnWorldAxis(e,t){return r1.setFromAxisAngle(e,t),this.quaternion.premultiply(r1),this}rotateX(e){return this.rotateOnAxis(r8,e)}rotateY(e){return this.rotateOnAxis(r9,e)}rotateZ(e){return this.rotateOnAxis(r7,e)}translateOnAxis(e,t){return r0.copy(e).applyQuaternion(this.quaternion),this.position.add(r0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(r8,e)}translateY(e){return this.translateOnAxis(r9,e)}translateZ(e){return this.translateOnAxis(r7,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(r2.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?r3.copy(e):r3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),r4.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?r2.lookAt(r4,r3,this.up):r2.lookAt(r3,r4,this.up),this.quaternion.setFromRotationMatrix(r2),r&&(r2.extractRotation(r.matrixWorld),r1.setFromRotationMatrix(r2),this.quaternion.premultiply(r1.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ie),ir.child=e,this.dispatchEvent(ir),ir.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(it),ii.child=e,this.dispatchEvent(ii),ii.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),r2.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),r2.multiply(e.parent.matrixWorld)),e.applyMatrix4(r2),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ie),ir.child=e,this.dispatchEvent(ir),ir.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}}getObjectsByProperty(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(r4,e,r5),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(r4,r6,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let 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),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!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.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(r.boundingBox=this.boundingBox.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);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}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)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),u=a(e.animations),c=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e){let 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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:rQ++}),this.uuid=nF(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ia.DEFAULT_UP.clone();let e=new nX,t=new rK,n=new nj,r=new nX(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new rH},normalMatrix:{value:new nJ}}),this.matrix=new rH,this.matrixWorld=new rH,this.matrixAutoUpdate=ia.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ia.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new r$,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}}ia.DEFAULT_UP=new nX(0,1,0),ia.DEFAULT_MATRIX_AUTO_UPDATE=!0,ia.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let is=new nX,io=new nX,il=new nX,iu=new nX,ic=new nX,ih=new nX,id=new nX,ip=new nX,im=new nX,ig=new nX,iv=new ro,iy=new ro,i_=new ro;class ix{static getNormal(e,t,n,r){r.subVectors(n,t),is.subVectors(e,t),r.cross(is);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){is.subVectors(r,t),io.subVectors(n,t),il.subVectors(e,t);let a=is.dot(is),s=is.dot(io),o=is.dot(il),l=io.dot(io),u=io.dot(il),c=a*l-s*s;if(0===c)return i.set(0,0,0),null;let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return i.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return null!==this.getBarycoord(e,t,n,r,iu)&&iu.x>=0&&iu.y>=0&&iu.x+iu.y<=1}static getInterpolation(e,t,n,r,i,a,s,o){return null===this.getBarycoord(e,t,n,r,iu)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(i,iu.x),o.addScaledVector(a,iu.y),o.addScaledVector(s,iu.z),o)}static getInterpolatedAttribute(e,t,n,r,i,a){return iv.setScalar(0),iy.setScalar(0),i_.setScalar(0),iv.fromBufferAttribute(e,t),iy.fromBufferAttribute(e,n),i_.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(iv,i.x),a.addScaledVector(iy,i.y),a.addScaledVector(i_,i.z),a}static isFrontFacing(e,t,n,r){return is.subVectors(n,t),io.subVectors(e,t),0>is.cross(io).dot(r)}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return is.subVectors(this.c,this.b),io.subVectors(this.a,this.b),.5*is.cross(io).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ix.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ix.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,i){return ix.getInterpolation(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return ix.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ix.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,r,i=this.a,a=this.b,s=this.c;ic.subVectors(a,i),ih.subVectors(s,i),ip.subVectors(e,i);let o=ic.dot(ip),l=ih.dot(ip);if(o<=0&&l<=0)return t.copy(i);im.subVectors(e,a);let u=ic.dot(im),c=ih.dot(im);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(i).addScaledVector(ic,n);ig.subVectors(e,s);let d=ic.dot(ig),p=ih.dot(ig);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(ih,r);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return id.subVectors(s,a),r=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(id,r);let g=1/(m+f+h);return n=f*g,r=h*g,t.copy(i).addScaledVector(ic,n).addScaledVector(ih,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}constructor(e=new nX,t=new nX,n=new nX){this.a=e,this.b=t,this.c=n}}let ib={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},iS={h:0,s:0,l:0},iM={h:0,s:0,l:0};function iw(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}class iE{set(e,t,n){return void 0===t&&void 0===n?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,n),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,n8.colorSpaceToWorking(this,t),this}setRGB(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n8.workingColorSpace;return this.r=e,this.g=t,this.b=n,n8.colorSpaceToWorking(this,r),this}setHSL(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n8.workingColorSpace;if(e=nz(e,1),t=nk(t,0,1),n=nk(n,0,1),0===t)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=iw(i,r,e+1/3),this.g=iw(i,r,e),this.b=iw(i,r,e-1/3)}return n8.colorSpaceToWorking(this,r),this}setStyle(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$;function r(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=t[1],s=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,n);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,n);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=t[1],i=r.length;if(3===i)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,n);if(6===i)return this.setHex(parseInt(r,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$,n=ib[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=n9(e.r),this.g=n9(e.g),this.b=n9(e.b),this}copyLinearToSRGB(e){return this.r=n7(e.r),this.g=n7(e.g),this.b=n7(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;return n8.workingToColorSpace(iT.copy(this),e),65536*Math.round(nk(255*iT.r,0,255))+256*Math.round(nk(255*iT.g,0,255))+Math.round(nk(255*iT.b,0,255))}getHexString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n8.workingColorSpace;n8.workingToColorSpace(iT.copy(this),r);let i=iT.r,a=iT.g,s=iT.b,o=Math.max(i,a,s),l=Math.min(i,a,s),u=(l+o)/2;if(l===o)t=0,n=0;else{let e=o-l;switch(n=u<=.5?e/(o+l):e/(2-o-l),o){case i:t=(a-s)/e+6*(a<s);break;case a:t=(s-i)/e+2;break;case s:t=(i-a)/e+4}t/=6}return e.h=t,e.s=n,e.l=u,e}getRGB(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n8.workingColorSpace;return n8.workingToColorSpace(iT.copy(this),t),e.r=iT.r,e.g=iT.g,e.b=iT.b,e}getStyle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t$;n8.workingToColorSpace(iT.copy(this),e);let t=iT.r,n=iT.g,r=iT.b;return e!==t$?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*r),")")}offsetHSL(e,t,n){return this.getHSL(iS),this.setHSL(iS.h+e,iS.s+t,iS.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,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}lerpHSL(e,t){this.getHSL(iS),e.getHSL(iM);let n=nB(iS.h,iM.h,t),r=nB(iS.s,iM.s,t),i=nB(iS.l,iM.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){let 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}toArray(){let 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}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}}let iT=new iE;iE.NAMES=ib;let iA=0;class iC extends nL{get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."));continue}let r=this[t];if(void 0===r){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."));continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let n in e){let 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()),void 0!==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()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),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),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),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&&this.attenuationDistance!==1/0&&(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!==C&&(n.blending=this.blending),this.side!==w&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==V&&(n.blendSrc=this.blendSrc),this.blendDst!==G&&(n.blendDst=this.blendDst),this.blendEquation!==N&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==en&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==no&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==t3&&(n.stencilFail=this.stencilFail),this.stencilZFail!==t3&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==t3&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),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.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),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=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:iA++}),this.uuid=nF(),this.name="",this.type="Material",this.blending=C,this.side=w,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=V,this.blendDst=G,this.blendEquation=N,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new iE(0,0,0),this.blendAlpha=0,this.depthFunc=en,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=no,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=t3,this.stencilZFail=t3,this.stencilZPass=t3,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}}class iR extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new iE(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}}let iP=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[256|e]=32768,i[e]=24,i[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,i[e]=-t-1,i[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,i[e]=13,i[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,i[e]=24,i[256|e]=24):(r[e]=31744,r[256|e]=64512,i[e]=13,i[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;(8388608&t)==0;)t<<=1,n-=8388608;t&=-8388609,n+=0x38800000,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:s,offsetTable:o}}();function iI(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=nk(e,-65504,65504),iP.floatView[0]=e;let t=iP.uint32View[0],n=t>>23&511;return iP.baseTable[n]+((8388607&t)>>iP.shiftTable[n])}function iL(e){let t=e>>10;return iP.uint32View[0]=iP.mantissaTable[iP.offsetTable[t]+(1023&e)]+iP.exponentTable[t],iP.floatView[0]}class iN{static toHalfFloat(e){return iI(e)}static fromHalfFloat(e){return iL(e)}}let iD=new nX,iU=new nW,iO=0;class iF{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)iU.fromBufferAttribute(this,t),iU.applyMatrix3(e),this.setXY(t,iU.x,iU.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)iD.fromBufferAttribute(this,t),iD.applyMatrix3(e),this.setXYZ(t,iD.x,iD.y,iD.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)iD.fromBufferAttribute(this,t),iD.applyMatrix4(e),this.setXYZ(t,iD.x,iD.y,iD.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)iD.fromBufferAttribute(this,t),iD.applyNormalMatrix(e),this.setXYZ(t,iD.x,iD.y,iD.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)iD.fromBufferAttribute(this,t),iD.transformDirection(e),this.setXYZ(t,iD.x,iD.y,iD.z);return this}set(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=nH(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=nV(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=nH(t,this.array)),t}setX(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=nH(t,this.array)),t}setY(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=nH(t,this.array)),t}setZ(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=nH(t,this.array)),t}setW(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array),i=nV(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let 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!==ng&&(e.usage=this.usage),e}constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:iO++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=ng,this.updateRanges=[],this.gpuType=ej,this.version=0}}class ik extends iF{constructor(e,t,n){super(new Int8Array(e),t,n)}}class iz extends iF{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class iB extends iF{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class iH extends iF{constructor(e,t,n){super(new Int16Array(e),t,n)}}class iV extends iF{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class iG extends iF{constructor(e,t,n){super(new Int32Array(e),t,n)}}class iW extends iF{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class ij extends iF{getX(e){let t=iL(this.array[e*this.itemSize]);return this.normalized&&(t=nH(t,this.array)),t}setX(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize]=iI(t),this}getY(e){let t=iL(this.array[e*this.itemSize+1]);return this.normalized&&(t=nH(t,this.array)),t}setY(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+1]=iI(t),this}getZ(e){let t=iL(this.array[e*this.itemSize+2]);return this.normalized&&(t=nH(t,this.array)),t}setZ(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+2]=iI(t),this}getW(e){let t=iL(this.array[e*this.itemSize+3]);return this.normalized&&(t=nH(t,this.array)),t}setW(e,t){return this.normalized&&(t=nV(t,this.array)),this.array[e*this.itemSize+3]=iI(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this.array[e+2]=iI(r),this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array),i=nV(i,this.array)),this.array[e+0]=iI(t),this.array[e+1]=iI(n),this.array[e+2]=iI(r),this.array[e+3]=iI(i),this}constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}}class iX extends iF{constructor(e,t,n){super(new Float32Array(e),t,n)}}let iq=0,iY=new rH,iJ=new ia,iZ=new nX,iK=new rf,i$=new rf,iQ=new nX;class i0 extends nL{getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(nK(e)?iW:iV)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(void 0!==n){let t=new nJ().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return iY.makeRotationFromQuaternion(e),this.applyMatrix4(iY),this}rotateX(e){return iY.makeRotationX(e),this.applyMatrix4(iY),this}rotateY(e){return iY.makeRotationY(e),this.applyMatrix4(iY),this}rotateZ(e){return iY.makeRotationZ(e),this.applyMatrix4(iY),this}translate(e,t,n){return iY.makeTranslation(e,t,n),this.applyMatrix4(iY),this}scale(e,t,n){return iY.makeScale(e,t,n),this.applyMatrix4(iY),this}lookAt(e){return iJ.lookAt(e),iJ.updateMatrix(),this.applyMatrix4(iJ.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(iZ).negate(),this.translate(iZ.x,iZ.y,iZ.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute("position",new iX(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new rf);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new nX(-1/0,-1/0,-1/0),new nX(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];iK.setFromBufferAttribute(n),this.morphTargetsRelative?(iQ.addVectors(this.boundingBox.min,iK.min),this.boundingBox.expandByPoint(iQ),iQ.addVectors(this.boundingBox.max,iK.max),this.boundingBox.expandByPoint(iQ)):(this.boundingBox.expandByPoint(iK.min),this.boundingBox.expandByPoint(iK.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new rL);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new nX,1/0);return}if(e){let n=this.boundingSphere.center;if(iK.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];i$.setFromBufferAttribute(n),this.morphTargetsRelative?(iQ.addVectors(iK.min,i$.min),iK.expandByPoint(iQ),iQ.addVectors(iK.max,i$.max),iK.expandByPoint(iQ)):(iK.expandByPoint(i$.min),iK.expandByPoint(i$.max))}iK.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)iQ.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(iQ));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],s=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)iQ.fromBufferAttribute(a,t),s&&(iZ.fromBufferAttribute(e,t),iQ.add(iZ)),r=Math.max(r,n.distanceToSquared(iQ))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let n=t.position,r=t.normal,i=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new iF(new Float32Array(4*n.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<n.count;e++)s[e]=new nX,o[e]=new nX;let l=new nX,u=new nX,c=new nX,h=new nW,d=new nW,p=new nW,f=new nX,m=new nX,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,r=g.length;t<r;++t){let r=g[t],a=r.start,v=r.count;for(let t=a,r=a+v;t<r;t+=3)!function(e,t,r){l.fromBufferAttribute(n,e),u.fromBufferAttribute(n,t),c.fromBufferAttribute(n,r),h.fromBufferAttribute(i,e),d.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),u.sub(l),c.sub(l),d.sub(h),p.sub(h);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(u).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(a),m.copy(c).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[r].add(f),o[e].add(m),o[t].add(m),o[r].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new nX,y=new nX,_=new nX,x=new nX;function b(e){_.fromBufferAttribute(r,e),x.copy(_);let t=s[e];v.copy(t),v.sub(_.multiplyScalar(_.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(o[e]);a.setXYZW(e,v.x,v.y,v.z,n<0?-1:1)}for(let t=0,n=g.length;t<n;++t){let n=g[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new iF(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new nX,i=new nX,a=new nX,s=new nX,o=new nX,l=new nX,u=new nX,c=new nX;if(e)for(let h=0,d=e.count;h<d;h+=3){let d=e.getX(h+0),p=e.getX(h+1),f=e.getX(h+2);r.fromBufferAttribute(t,d),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),u.subVectors(a,i),c.subVectors(r,i),u.cross(c),s.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(u),o.add(u),l.add(u),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),u.subVectors(a,i),c.subVectors(r,i),u.cross(c),n.setXYZ(e+0,u.x,u.y,u.z),n.setXYZ(e+1,u.x,u.y,u.z),n.setXYZ(e+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)iQ.fromBufferAttribute(e,t),iQ.normalize(),e.setXYZ(t,iQ.x,iQ.y,iQ.z)}toNonIndexed(){function e(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),s=0,o=0;for(let i=0,l=t.length;i<l;i++){s=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[o++]=n[s++]}return new iF(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i0,n=this.index.array,r=this.attributes;for(let i in r){let a=e(r[i],n);t.setAttribute(i,a)}let i=this.morphAttributes;for(let r in i){let a=[],s=i[r];for(let t=0,r=s.length;t<r;t++){let r=e(s[t],n);a.push(r)}t.morphAttributes[r]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,n=a.length;e<n;e++){let n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,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){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:iq++}),this.uuid=nF(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}}let i1=new rH,i2=new rB,i3=new rL,i4=new nX,i5=new nX,i6=new nX,i8=new nX,i9=new nX,i7=new nX,ae=new nX,at=new nX;class an extends ia{copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let s=this.morphTargetInfluences;if(i&&s){i7.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=s[n],o=i[n];0!==r&&(i9.fromBufferAttribute(o,e),a?i7.addScaledVector(i9,r):i7.addScaledVector(i9.sub(t),r))}t.add(i7)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r)null===n.boundingSphere&&n.computeBoundingSphere(),i3.copy(n.boundingSphere),i3.applyMatrix4(i),i2.copy(e.ray).recast(e.near),!1===i3.containsPoint(i2.origin)&&(null===i2.intersectSphere(i3,i4)||i2.origin.distanceToSquared(i4)>(e.far-e.near)**2)||(i1.copy(i).invert(),i2.copy(e.ray).applyMatrix4(i1),(null===n.boundingBox||!1!==i2.intersectsBox(n.boundingBox))&&this._computeIntersections(e,t,i2))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,s=i.index,o=i.attributes.position,l=i.attributes.uv,u=i.attributes.uv1,c=i.attributes.normal,h=i.groups,d=i.drawRange;if(null!==s)if(Array.isArray(a))for(let i=0,o=h.length;i<o;i++){let o=h[i],p=a[o.materialIndex],f=Math.max(o.start,d.start),m=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let i=f;i<m;i+=3){let a=s.getX(i);(r=ar(this,p,e,n,l,u,c,a,s.getX(i+1),s.getX(i+2)))&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let h=i;h<o;h+=3){let i=s.getX(h);(r=ar(this,a,e,n,l,u,c,i,s.getX(h+1),s.getX(h+2)))&&(r.faceIndex=Math.floor(h/3),t.push(r))}}else if(void 0!==o)if(Array.isArray(a))for(let i=0,s=h.length;i<s;i++){let s=h[i],p=a[s.materialIndex],f=Math.max(s.start,d.start),m=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let i=f;i<m;i+=3)(r=ar(this,p,e,n,l,u,c,i,i+1,i+2))&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}else{let i=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=i;o<s;o+=3)(r=ar(this,a,e,n,l,u,c,o,o+1,o+2))&&(r.faceIndex=Math.floor(o/3),t.push(r))}}constructor(e=new i0,t=new iR){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}}function ar(e,t,n,r,i,a,s,o,l,u){e.getVertexPosition(o,i5),e.getVertexPosition(l,i6),e.getVertexPosition(u,i8);let c=function(e,t,n,r,i,a,s,o){if(null===(t.side===E?r.intersectTriangle(s,a,i,!0,o):r.intersectTriangle(i,a,s,t.side===w,o)))return null;at.copy(o),at.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(at);return l<n.near||l>n.far?null:{distance:l,point:at.clone(),object:e}}(e,t,n,r,i5,i6,i8,ae);if(c){let e=new nX;ix.getBarycoord(ae,i5,i6,i8,e),i&&(c.uv=ix.getInterpolatedAttribute(i,o,l,u,e,new nW)),a&&(c.uv1=ix.getInterpolatedAttribute(a,o,l,u,e,new nW)),s&&(c.normal=ix.getInterpolatedAttribute(s,o,l,u,e,new nX),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:u,normal:new nX,materialIndex:0};ix.getNormal(i5,i6,i8,t.normal),c.face=t,c.barycoord=e}return c}class ai extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ai(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let s=this;r=Math.floor(r),i=Math.floor(i);let o=[],l=[],u=[],c=[],h=0,d=0;function p(e,t,n,r,i,a,p,f,m,g,v){let y=a/m,_=p/g,x=a/2,b=p/2,S=f/2,M=m+1,w=g+1,E=0,T=0,A=new nX;for(let a=0;a<w;a++){let s=a*_-b;for(let o=0;o<M;o++){let h=o*y-x;A[e]=h*r,A[t]=s*i,A[n]=S,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),E+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let n=h+t+M*e,r=h+t+M*(e+1),i=h+(t+1)+M*(e+1),a=h+(t+1)+M*e;o.push(n,r,a),o.push(r,i,a),T+=6}s.addGroup(d,T,v),d+=T,h+=E}p("z","y","x",-1,-1,n,t,e,a=Math.floor(a),i,0),p("z","y","x",1,-1,n,t,-e,a,i,1),p("x","z","y",1,1,e,n,t,r,a,2),p("x","z","y",1,-1,e,n,-t,r,a,3),p("x","y","z",1,-1,e,t,n,r,i,4),p("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(o),this.setAttribute("position",new iX(l,3)),this.setAttribute("normal",new iX(u,3)),this.setAttribute("uv",new iX(c,2))}}function aa(e){let t={};for(let n in e)for(let r in t[n]={},e[n]){let i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][r]=null):t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function as(e){let t={};for(let n=0;n<e.length;n++){let r=aa(e[n]);for(let e in r)t[e]=r[e]}return t}function ao(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:n8.workingColorSpace}let al={clone:aa,merge:as};class au extends iC{copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=aa(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let 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}toJSON(e){let t=super.toJSON(e);for(let n in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}}class ac extends ia{get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rH,this.projectionMatrix=new rH,this.projectionMatrixInverse=new rH,this.coordinateSystem=nA,this._reversedDepth=!1}}let ah=new nX,ad=new nW,ap=new nW;class af extends ac{copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*nO*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*nU*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*nO*Math.atan(Math.tan(.5*nU*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ah.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ah.x,ah.y).multiplyScalar(-e/ah.z),ah.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ah.x,ah.y).multiplyScalar(-e/ah.z)}getViewSize(e,t){return this.getViewBounds(e,ad,ap),t.subVectors(ap,ad)}setViewOffset(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()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*nU*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/s,r*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(i+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}}class am extends ia{updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,s,o]=t;for(let e of t)this.remove(e);if(e===nA)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(e===nC)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,s,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,s),e.setRenderTarget(n,3,r),e.render(t,o),e.setRenderTarget(n,4,r),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(c,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new af(-90,1,e,t);r.layers=this.layers,this.add(r);let i=new af(-90,1,e,t);i.layers=this.layers,this.add(i);let a=new af(-90,1,e,t);a.layers=this.layers,this.add(a);let s=new af(-90,1,e,t);s.layers=this.layers,this.add(s);let o=new af(-90,1,e,t);o.layers=this.layers,this.add(o);let l=new af(-90,1,e,t);l.layers=this.layers,this.add(l)}}class ag extends rs{get images(){return this.image}set images(e){this.image=e}constructor(e=[],t=eb,n,r,i,a,s,o,l,u){super(e,t,n,r,i,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}}class av extends ru{fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n=new ai(5,5,5),r=new au({name:"CubemapFromEquirect",uniforms:aa({tEquirect:{value:null}}),vertexShader:"\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include <begin_vertex>\n #include <project_vertex>\n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include <common>\n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n ",side:E,blending:A});r.uniforms.tEquirect.value=t;let i=new an(n,r),a=t.minFilter;return t.minFilter===eF&&(t.minFilter=eD),new am(1,10,this).update(e,i),t.minFilter=a,i.geometry.dispose(),i.material.dispose(),this}clear(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1};this.texture=new ag([n,n,n,n,n,n]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}}class ay extends ia{constructor(){super(),this.isGroup=!0,this.type="Group"}}let a_={type:"move"};class ax{getHandSpace(){return null===this._hand&&(this._hand=new ay,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ay,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new nX,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new nX),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ay,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new nX,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new nX),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let r of(a=!0,e.hand.values())){let e=t.getJointPose(r,n),i=this._getHandJoint(l,r);null!==e&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=null!==e}let r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],s=r.position.distanceTo(i.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(a_)))}return null!==s&&(s.visible=null!==r),null!==o&&(o.visible=null!==i),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let n=new ay;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}constructor(){this._targetRay=null,this._grip=null,this._hand=null}}class ab{clone(){return new ab(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new iE(e),this.density=t}}class aS{clone(){return new aS(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new iE(e),this.near=t,this.far=n}}class aM extends ia{copy(e,t){return super.copy(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()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new rK,this.environmentIntensity=1,this.environmentRotation=new rK,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class aw{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=nF()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=nF()),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}}constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=ng,this.updateRanges=[],this.version=0,this.uuid=nF()}}let aE=new nX;class aT{get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)aE.fromBufferAttribute(this,t),aE.applyMatrix4(e),this.setXYZ(t,aE.x,aE.y,aE.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)aE.fromBufferAttribute(this,t),aE.applyNormalMatrix(e),this.setXYZ(t,aE.x,aE.y,aE.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)aE.fromBufferAttribute(this,t),aE.transformDirection(e),this.setXYZ(t,aE.x,aE.y,aE.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=nH(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=nV(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=nV(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=nV(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=nV(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=nV(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=nH(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=nH(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=nH(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=nH(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=nV(t,this.array),n=nV(n,this.array),r=nV(r,this.array),i=nV(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}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new aT(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new iF(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)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};{console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}}class aA extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new iE(0xffffff),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}}let aC=new nX,aR=new nX,aP=new nX,aI=new nW,aL=new nW,aN=new rH,aD=new nX,aU=new nX,aO=new nX,aF=new nW,ak=new nW,az=new nW;class aB extends ia{raycast(e,t){let n,r;null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),aR.setFromMatrixScale(this.matrixWorld),aN.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),aP.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&aR.multiplyScalar(-aP.z);let i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));let a=this.center;aH(aD.set(-.5,-.5,0),aP,a,aR,n,r),aH(aU.set(.5,-.5,0),aP,a,aR,n,r),aH(aO.set(.5,.5,0),aP,a,aR,n,r),aF.set(0,0),ak.set(1,0),az.set(1,1);let s=e.ray.intersectTriangle(aD,aU,aO,!1,aC);if(null===s&&(aH(aU.set(-.5,.5,0),aP,a,aR,n,r),ak.set(0,1),null===(s=e.ray.intersectTriangle(aD,aO,aU,!1,aC))))return;let o=e.ray.origin.distanceTo(aC);o<e.near||o>e.far||t.push({distance:o,point:aC.clone(),uv:ix.getInterpolation(aC,aD,aU,aO,aF,ak,az,new nW),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}constructor(e=new aA){if(super(),this.isSprite=!0,this.type="Sprite",void 0===n){n=new i0;let e=new aw(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);n.setIndex([0,1,2,0,2,3]),n.setAttribute("position",new aT(e,3,0,!1)),n.setAttribute("uv",new aT(e,2,3,!1))}this.geometry=n,this.material=e,this.center=new nW(.5,.5),this.count=1}}function aH(e,t,n,r,i,a){aI.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(aL.x=a*aI.x-i*aI.y,aL.y=i*aI.x+a*aI.y):aL.copy(aI),e.copy(t),e.x+=aL.x,e.y+=aL.y,e.applyMatrix4(aN)}let aV=new nX,aG=new nX;class aW extends ia{copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;n=Math.abs(n);let i=this.levels;for(t=0;t<i.length&&!(n<i[t].distance);t++);return i.splice(t,0,{distance:n,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){let t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){let e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){aV.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo(aV);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){let n,r;aV.setFromMatrixPosition(e.matrixWorld),aG.setFromMatrixPosition(this.matrixWorld);let i=aV.distanceTo(aG)/e.zoom;for(n=1,t[0].object.visible=!0,r=t.length;n<r;n++){let e=t[n].distance;if(t[n].object.visible&&(e-=e*t[n].hysteresis),i>=e)t[n-1].object.visible=!1,t[n].object.visible=!0;else break}for(this._currentLevel=n-1;n<r;n++)t[n].object.visible=!1}}toJSON(e){let t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];let n=this.levels;for(let e=0,r=n.length;e<r;e++){let r=n[e];t.object.levels.push({object:r.object.uuid,distance:r.distance,hysteresis:r.hysteresis})}return t}constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}}let aj=new nX,aX=new ro,aq=new ro,aY=new nX,aJ=new rH,aZ=new nX,aK=new rL,a$=new rH,aQ=new rB;class a0 extends an{computeBoundingBox(){let e=this.geometry;null===this.boundingBox&&(this.boundingBox=new rf),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,aZ),this.boundingBox.expandByPoint(aZ)}computeBoundingSphere(){let e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new rL),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,aZ),this.boundingSphere.expandByPoint(aZ)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,r=this.matrixWorld;if(void 0!==n)null===this.boundingSphere&&this.computeBoundingSphere(),aK.copy(this.boundingSphere),aK.applyMatrix4(r),!1!==e.ray.intersectsSphere(aK)&&(a$.copy(r).invert(),aQ.copy(e.ray).applyMatrix4(a$),(null===this.boundingBox||!1!==aQ.intersectsBox(this.boundingBox))&&this._computeIntersections(e,t,aQ))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(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()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new ro,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===ey?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===e_?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,r=this.geometry;aX.fromBufferAttribute(r.attributes.skinIndex,e),aq.fromBufferAttribute(r.attributes.skinWeight,e),aj.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=aq.getComponent(e);if(0!==r){let i=aX.getComponent(e);aJ.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(aY.copy(aj).applyMatrix4(aJ),r)}}return t.applyMatrix4(this.bindMatrixInverse)}constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ey,this.bindMatrix=new rH,this.bindMatrixInverse=new rH,this.boundingBox=null,this.boundingSphere=null}}class a1 extends ia{constructor(){super(),this.isBone=!0,this.type="Bone"}}class a2 extends rs{constructor(e=null,t=1,n=1,r,i,a,s,o,l=eR,u=eR,c,h){super(null,a,s,o,l,u,r,i,c,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let a3=new rH,a4=new rH;class a5{init(){let 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(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new rH)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new rH;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){let i=e[r]?e[r].matrixWorld:a4;a3.multiplyMatrices(i,t[r]),a3.toArray(n,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new a5(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length),t=new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4);t.set(this.boneMatrices);let n=new a2(t,e,e,e0,ej);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){let r=e.bones[n],i=t[r];void 0===i&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),i=new a1),this.bones.push(i),this.boneInverses.push(new rH().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){let i=t[r];e.bones.push(i.uuid);let a=n[r];e.boneInverses.push(a.toArray())}return e}constructor(e=[],t=[]){this.uuid=nF(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}}class a6 extends iF{copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}}let a8=new rH,a9=new rH,a7=[],se=new rf,st=new rH,sn=new an,sr=new rL;class si extends an{computeBoundingBox(){let e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new rf),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,a8),se.copy(e.boundingBox).applyMatrix4(a8),this.boundingBox.union(se)}computeBoundingSphere(){let e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new rL),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,a8),sr.copy(e.boundingSphere).applyMatrix4(a8),this.boundingSphere.union(sr)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){let n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,i=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=r[i+e]}raycast(e,t){let n=this.matrixWorld,r=this.count;if((sn.geometry=this.geometry,sn.material=this.material,void 0!==sn.material)&&(null===this.boundingSphere&&this.computeBoundingSphere(),sr.copy(this.boundingSphere),sr.applyMatrix4(n),!1!==e.ray.intersectsSphere(sr)))for(let i=0;i<r;i++){this.getMatrixAt(i,a8),a9.multiplyMatrices(n,a8),sn.matrixWorld=a9,sn.raycast(e,a7);for(let e=0,n=a7.length;e<n;e++){let n=a7[e];n.instanceId=i,n.object=this,t.push(n)}a7.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new a6(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){let n=t.morphTargetInfluences,r=n.length+1;null===this.morphTexture&&(this.morphTexture=new a2(new Float32Array(r*this.count),r,this.count,e3,ej));let i=this.morphTexture.source.data.data,a=0;for(let e=0;e<n.length;e++)a+=n[e];let s=this.geometry.morphTargetsRelative?1:1-a,o=r*e;i[o]=s,i.set(n,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new a6(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,st)}}let sa=new nX,ss=new nX,so=new nJ;class sl{set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=sa.subVectors(n,t).cross(ss.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let n=e.delta(sa),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||so.getNormalMatrix(e),r=this.coplanarPoint(sa).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}constructor(e=new nX(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}}let su=new rL,sc=new nW(.5,.5),sh=new nX;class sd{set(e,t,n,r,i,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nA,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.planes,i=e.elements,a=i[0],s=i[1],o=i[2],l=i[3],u=i[4],c=i[5],h=i[6],d=i[7],p=i[8],f=i[9],m=i[10],g=i[11],v=i[12],y=i[13],_=i[14],x=i[15];if(r[0].setComponents(l-a,d-u,g-p,x-v).normalize(),r[1].setComponents(l+a,d+u,g+p,x+v).normalize(),r[2].setComponents(l+s,d+c,g+f,x+y).normalize(),r[3].setComponents(l-s,d-c,g-f,x-y).normalize(),n)r[4].setComponents(o,h,m,_).normalize(),r[5].setComponents(l-o,d-h,g-m,x-_).normalize();else if(r[4].setComponents(l-o,d-h,g-m,x-_).normalize(),t===nA)r[5].setComponents(l+o,d+h,g+m,x+_).normalize();else if(t===nC)r[5].setComponents(o,h,m,_).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),su.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),su.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(su)}intersectsSprite(e){return su.center.set(0,0,0),su.radius=.7071067811865476+sc.distanceTo(e.center),su.applyMatrix4(e.matrixWorld),this.intersectsSphere(su)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(sh.x=r.normal.x>0?e.max.x:e.min.x,sh.y=r.normal.y>0?e.max.y:e.min.y,sh.z=r.normal.z>0?e.max.z:e.min.z,0>r.distanceToPoint(sh))return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(0>t[n].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}constructor(e=new sl,t=new sl,n=new sl,r=new sl,i=new sl,a=new sl){this.planes=[e,t,n,r,i,a]}}let sp=new rH,sf=new sd;class sm{intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(sp.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),sf.setFromProjectionMatrix(sp,r.coordinateSystem,r.reversedDepth),sf.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(sp.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),sf.setFromProjectionMatrix(sp,r.coordinateSystem,r.reversedDepth),sf.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(sp.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),sf.setFromProjectionMatrix(sp,r.coordinateSystem,r.reversedDepth),sf.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(sp.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),sf.setFromProjectionMatrix(sp,r.coordinateSystem,r.reversedDepth),sf.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(sp.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),sf.setFromProjectionMatrix(sp,r.coordinateSystem,r.reversedDepth),sf.containsPoint(e))return!0}return!1}clone(){return new sm}constructor(){this.coordinateSystem=nA}}function sg(e,t){return e-t}function sv(e,t){return e.z-t.z}function sy(e,t){return t.z-e.z}let s_=new rH,sx=new iE(1,1,1),sb=new sd,sS=new sm,sM=new rf,sw=new rL,sE=new nX,sT=new nX,sA=new nX,sC=new class{push(e,t,n,r){let i=this.pool,a=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let s=i[this.index];a.push(s),this.index++,s.start=e,s.count=t,s.z=n,s.index=r}reset(){this.list.length=0,this.index=0}constructor(){this.index=0,this.pool=[],this.list=[]}},sR=new an,sP=[];function sI(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)t[r]=e[r]}else{let n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}class sL extends an{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount),t=new a2(new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4),e,e,e0,ej);this._matricesTexture=t}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount),t=new a2(new Uint32Array((e=Math.ceil(e))*e),e,e,e4,eW);this._indirectTexture=t}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount),t=new a2(new Float32Array((e=Math.ceil(e))*e*4).fill(1),e,e,e0,ej);t.colorSpace=n8.workingColorSpace,this._colorsTexture=t}_initializeGeometry(e){let t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(!1===this._geometryInitialized){for(let r in e.attributes){let{array:i,itemSize:a,normalized:s}=e.getAttribute(r),o=new iF(new i.constructor(n*a),a,s);t.setAttribute(r,o)}if(null!==e.getIndex()){let e=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new iF(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let n in t.attributes){if(!e.hasAttribute(n))throw Error('THREE.BatchedMesh: Added geometry missing "'.concat(n,'". All geometries must have consistent attributes.'));let r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error("THREE.BatchedMesh: Invalid instanceId ".concat(e,". Instance is either out of range or has been deleted."))}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error("THREE.BatchedMesh: Invalid geometryId ".concat(e,". Geometry is either out of range or has been deleted."))}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new rf);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(!1===t[n].active)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,s_),this.getBoundingBoxAt(r,sM).applyMatrix4(s_),e.union(sM)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new rL);let e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(!1===t[n].active)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,s_),this.getBoundingSphereAt(r,sw).applyMatrix4(s_),e.union(sw)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sg),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let r=this._matricesTexture;s_.identity().toArray(r.image.data,16*n),r.needsUpdate=!0;let i=this._colorsTexture;return i&&(sx.toArray(i.image.data,4*n),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this._initializeGeometry(e),this._validateGeometry(e);let i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},a=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===n?e.getAttribute("position").count:n;let s=e.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===r?s.count:r),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sg),a[t=this._availableGeometryIds.shift()]=i):(t=this._geometryCount,this._geometryCount++,a.push(i)),this.setGeometryAt(t,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,t}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);let n=this.geometry,r=null!==n.getIndex(),i=n.getIndex(),a=t.getIndex(),s=this._geometryInfo[e];if(r&&a.count>s.reservedIndexCount||t.attributes.position.count>s.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=s.vertexStart,l=s.reservedVertexCount;for(let e in s.vertexCount=t.getAttribute("position").count,n.attributes){let r=t.getAttribute(e),i=n.getAttribute(e);!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let i=e.count;for(let a=0;a<i;a++)for(let i=0;i<r;i++)t.setComponent(a+n,i,e.getComponent(a,i))}else t.array.set(e.array,n*r);t.needsUpdate=!0}(r,i,o);let a=r.itemSize;for(let e=r.count;e<l;e++){let t=o+e;for(let e=0;e<a;e++)i.setComponent(t,e,0)}i.needsUpdate=!0,i.addUpdateRange(o*a,l*a)}if(r){let e=s.indexStart,n=s.reservedIndexCount;s.indexCount=t.getIndex().count;for(let t=0;t<a.count;t++)i.setX(e+t,o+a.getX(t));for(let t=a.count;t<n;t++)i.setX(e+t,o);i.needsUpdate=!0,i.addUpdateRange(e,s.reservedIndexCount)}return s.start=r?s.indexStart:s.vertexStart,s.count=r?s.indexCount:s.vertexCount,s.boundingBox=null,null!==t.boundingBox&&(s.boundingBox=t.boundingBox.clone()),s.boundingSphere=null,null!==t.boundingSphere&&(s.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){let t=this._geometryInfo;if(e>=t.length||!1===t[e].active)return this;let n=this._instanceInfo;for(let t=0,r=n.length;t<r;t++)n[t].active&&n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0,n=this._geometryInfo,r=n.map((e,t)=>t).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let a=0,s=n.length;a<s;a++){let s=n[r[a]];if(!1!==s.active){if(null!==i.index){if(s.indexStart!==t){let{indexStart:n,vertexStart:r,reservedIndexCount:a}=s,o=i.index,l=o.array,u=e-r;for(let e=n;e<n+a;e++)l[e]=l[e]+u;o.array.copyWithin(t,n,n+a),o.addUpdateRange(t,a),s.indexStart=t}t+=s.reservedIndexCount}if(s.vertexStart!==e){let{vertexStart:t,reservedVertexCount:n}=s,r=i.attributes;for(let i in r){let a=r[i],{array:s,itemSize:o}=a;s.copyWithin(e*o,t*o,(t+n)*o),a.addUpdateRange(e*o,n*o)}s.vertexStart=e}e+=s.reservedVertexCount,s.start=i.index?s.indexStart:s.vertexStart,this._nextIndexStart=i.index?s.indexStart+s.reservedIndexCount:0,this._nextVertexStart=s.vertexStart+s.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(null===r.boundingBox){let e=new rf,t=n.index,i=n.attributes.position;for(let n=r.start,a=r.start+r.count;n<a;n++){let r=n;t&&(r=t.getX(r)),e.expandByPoint(sE.fromBufferAttribute(i,r))}r.boundingBox=e}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(null===r.boundingSphere){let t=new rL;this.getBoundingBoxAt(e,sM),sM.getCenter(t.center);let i=n.index,a=n.attributes.position,s=0;for(let e=r.start,n=r.start+r.count;e<n;e++){let n=e;i&&(n=i.getX(n)),sE.fromBufferAttribute(a,n),s=Math.max(s,t.center.distanceToSquared(sE))}t.radius=Math.sqrt(s),r.boundingSphere=t}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);let n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,16*e),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,16*e)}setColorAt(e,t){return this.validateInstanceId(e),null===this._colorsTexture&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,4*e),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,4*e)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.validateGeometryId(e);let n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){let t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(sg);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw Error("BatchedMesh: Instance ids outside the range ".concat(e," are being used. Cannot shrink instance count."));let r=new Int32Array(e),i=new Int32Array(e);sI(this._multiDrawCounts,r),sI(this._multiDrawStarts,i),this._multiDrawCounts=r,this._multiDrawStarts=i,this._maxInstanceCount=e;let a=this._indirectTexture,s=this._matricesTexture,o=this._colorsTexture;a.dispose(),this._initIndirectTexture(),sI(a.image.data,this._indirectTexture.image.data),s.dispose(),this._initMatricesTexture(),sI(s.image.data,this._matricesTexture.image.data),o&&(o.dispose(),this._initColorsTexture(),sI(o.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){let n=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error("BatchedMesh: Geometry vertex values are being used outside the range ".concat(t,". Cannot shrink further."));if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error("BatchedMesh: Geometry index values are being used outside the range ".concat(t,". Cannot shrink further."));let r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new i0,this._initializeGeometry(r));let i=this.geometry;for(let e in r.index&&sI(r.index.array,i.index.array),r.attributes)sI(r.attributes[e].array,i.attributes[e].array)}raycast(e,t){let n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,a=this.geometry;sR.material=this.material,sR.geometry.index=a.index,sR.geometry.attributes=a.attributes,null===sR.geometry.boundingBox&&(sR.geometry.boundingBox=new rf),null===sR.geometry.boundingSphere&&(sR.geometry.boundingSphere=new rL);for(let a=0,s=n.length;a<s;a++){if(!n[a].visible||!n[a].active)continue;let s=n[a].geometryIndex,o=r[s];sR.geometry.setDrawRange(o.start,o.count),this.getMatrixAt(a,sR.matrixWorld).premultiply(i),this.getBoundingBoxAt(s,sR.geometry.boundingBox),this.getBoundingSphereAt(s,sR.geometry.boundingSphere),sR.raycast(e,sP);for(let e=0,n=sP.length;e<n;e++){let n=sP[e];n.object=this,n.batchId=a,t.push(n)}sP.length=0}sR.material=null,sR.geometry.index=null,sR.geometry.attributes={},sR.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,i){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=r.getIndex(),s=null===a?1:a.array.BYTES_PER_ELEMENT,o=this._instanceInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,c=this._geometryInfo,h=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data,f=n.isArrayCamera?sS:sb;h&&!n.isArrayCamera&&(s_.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),sb.setFromProjectionMatrix(s_,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sE.setFromMatrixPosition(n.matrixWorld).applyMatrix4(s_),sT.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(s_);for(let e=0,t=o.length;e<t;e++)if(o[e].visible&&o[e].active){let t=o[e].geometryIndex;this.getMatrixAt(e,s_),this.getBoundingSphereAt(t,sw).applyMatrix4(s_);let r=!1;if(h&&(r=!f.intersectsSphere(sw,n)),!r){let n=c[t],r=sA.subVectors(sw.center,sE).dot(sT);sC.push(n.start,n.count,r,e)}}let e=sC.list,t=this.customSort;null===t?e.sort(i.transparent?sy:sv):t.call(this,e,n);for(let t=0,n=e.length;t<n;t++){let n=e[t];l[m]=n.start*s,u[m]=n.count,p[m]=n.index,m++}sC.reset()}else for(let e=0,t=o.length;e<t;e++)if(o[e].visible&&o[e].active){let t=o[e].geometryIndex,r=!1;if(h&&(this.getMatrixAt(e,s_),this.getBoundingSphereAt(t,sw).applyMatrix4(s_),r=!f.intersectsSphere(sw,n)),!r){let n=c[t];l[m]=n.start*s,u[m]=n.count,p[m]=e,m++}}d.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,n,r,i,a){this.onBeforeRender(e,null,r,i,a)}constructor(e,t,n=2*t,r){super(new i0,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}}class sN extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new iE(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}}let sD=new nX,sU=new nX,sO=new rH,sF=new rB,sk=new rL,sz=new nX,sB=new nX;class sH extends ia{copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)sD.fromBufferAttribute(t,e-1),sU.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=sD.distanceTo(sU);e.setAttribute("lineDistance",new iX(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),sk.copy(n.boundingSphere),sk.applyMatrix4(r),sk.radius+=i,!1===e.ray.intersectsSphere(sk))return;sO.copy(r).invert(),sF.copy(e.ray).applyMatrix4(sO);let s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,u=n.index,c=n.attributes.position;if(null!==u){let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=l){let n=sV(this,e,sF,o,u.getX(i),u.getX(i+1),i);n&&t.push(n)}if(this.isLineLoop){let i=sV(this,e,sF,o,u.getX(r-1),u.getX(n),r-1);i&&t.push(i)}}else{let n=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=l){let n=sV(this,e,sF,o,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=sV(this,e,sF,o,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}constructor(e=new i0,t=new sN){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}}function sV(e,t,n,r,i,a,s){let o=e.geometry.attributes.position;if(sD.fromBufferAttribute(o,i),sU.fromBufferAttribute(o,a),n.distanceSqToSegment(sD,sU,sz,sB)>r)return;sz.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(sz);if(!(l<t.near)&&!(l>t.far))return{distance:l,point:sB.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let sG=new nX,sW=new nX;class sj extends sH{computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)sG.fromBufferAttribute(t,e),sW.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+sG.distanceTo(sW);e.setAttribute("lineDistance",new iX(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}}class sX extends sH{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class sq extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new iE(0xffffff),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}}let sY=new rH,sJ=new rB,sZ=new rL,sK=new nX;class s$ extends ia{copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),sZ.copy(n.boundingSphere),sZ.applyMatrix4(r),sZ.radius+=i,!1===e.ray.intersectsSphere(sZ))return;sY.copy(r).invert(),sJ.copy(e.ray).applyMatrix4(sY);let s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=n.index,u=n.attributes.position;if(null!==l){let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n;a<i;a++){let n=l.getX(a);sK.fromBufferAttribute(u,n),sQ(sK,n,o,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(u.count,a.start+a.count);for(let a=n;a<i;a++)sK.fromBufferAttribute(u,a),sQ(sK,a,o,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}constructor(e=new i0,t=new sq){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}}function sQ(e,t,n,r,i,a,s){let o=sJ.distanceSqToPoint(e);if(o<n){let n=new nX;sJ.closestPointToPoint(e,n),n.applyMatrix4(r);let l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class s0 extends rs{clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}constructor(e,t,n,r,i=eD,a=eD,s,o,l){super(e,t,n,r,i,a,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let u=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}}class s1 extends s0{update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}constructor(e,t,n,r,i,a,s,o){super({},e,t,n,r,i,a,s,o),this.isVideoFrameTexture=!0}}class s2 extends rs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=eR,this.minFilter=eR,this.generateMipmaps=!1,this.needsUpdate=!0}}class s3 extends rs{constructor(e,t,n,r,i,a,s,o,l,u,c,h){super(null,a,s,o,l,u,r,i,c,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class s4 extends s3{addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}constructor(e,t,n,r,i,a){super(e,t,n,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=eA,this.layerUpdates=new Set}}class s5 extends s3{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,eb),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class s6 extends rs{constructor(e,t,n,r,i,a,s,o,l){super(e,t,n,r,i,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class s8 extends rs{copy(e){return super.copy(e),this.source=new rn(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}constructor(e,t,n=eW,r,i,a,s=eR,o=eR,l,u=e1,c=1){if(u!==e1&&u!==e2)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},r,i,a,s,o,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}}class s9 extends rs{copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}}class s7 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s7(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r));let a=[],s=[],o=[],l=[],u=t/2,c=Math.PI/2*e,h=t,d=2*c+h,p=2*n+(i=Math.max(1,Math.floor(i))),f=r+1,m=new nX,g=new nX;for(let v=0;v<=p;v++){let y=0,_=0,x=0,b=0;if(v<=n){let t=v/n,r=t*Math.PI/2;_=-u-e*Math.cos(r),x=e*Math.sin(r),b=-e*Math.cos(r),y=t*c}else if(v<=n+i){let r=(v-n)/i;_=-u+r*t,x=e,b=0,y=c+r*h}else{let t=(v-n-i)/n,r=t*Math.PI/2;_=u+e*Math.sin(r),x=e*Math.cos(r),b=e*Math.sin(r),y=c+h+t*c}let S=Math.max(0,Math.min(1,y/d)),M=0;0===v?M=.5/r:v===p&&(M=-.5/r);for(let e=0;e<=r;e++){let t=e/r,n=t*Math.PI*2,i=Math.sin(n),a=Math.cos(n);g.x=-x*a,g.y=_,g.z=x*i,s.push(g.x,g.y,g.z),m.set(-x*a,b,x*i),m.normalize(),o.push(m.x,m.y,m.z),l.push(t+M,S)}if(v>0){let e=(v-1)*f;for(let t=0;t<r;t++){let n=e+t,r=e+t+1,i=v*f+t,s=v*f+t+1;a.push(n,r,i),a.push(r,s,i)}}}this.setIndex(a),this.setAttribute("position",new iX(s,3)),this.setAttribute("normal",new iX(o,3)),this.setAttribute("uv",new iX(l,2))}}class oe extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oe(e.radius,e.segments,e.thetaStart,e.thetaLength)}constructor(e=1,t=32,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],s=[],o=[],l=new nX,u=new nW;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(let i=0,c=3;i<=t;i++,c+=3){let h=n+i/t*r;l.x=e*Math.cos(h),l.y=e*Math.sin(h),a.push(l.x,l.y,l.z),s.push(0,0,1),u.x=(a[c]/e+1)/2,u.y=(a[c+1]/e+1)/2,o.push(u.x,u.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute("position",new iX(a,3)),this.setAttribute("normal",new iX(s,3)),this.setAttribute("uv",new iX(o,2))}}class ot extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ot(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}constructor(e=1,t=1,n=1,r=32,i=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:s,thetaLength:o};let l=this;r=Math.floor(r),i=Math.floor(i);let u=[],c=[],h=[],d=[],p=0,f=[],m=n/2,g=0;function v(n){let i=p,a=new nW,f=new nX,v=0,y=!0===n?e:t,_=!0===n?1:-1;for(let e=1;e<=r;e++)c.push(0,m*_,0),h.push(0,_,0),d.push(.5,.5),p++;let x=p;for(let e=0;e<=r;e++){let t=e/r*o+s,n=Math.cos(t),i=Math.sin(t);f.x=y*i,f.y=m*_,f.z=y*n,c.push(f.x,f.y,f.z),h.push(0,_,0),a.x=.5*n+.5,a.y=.5*i*_+.5,d.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=x+e;!0===n?u.push(r,r+1,t):u.push(r+1,r,t),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}(function(){let a=new nX,v=new nX,y=0,_=(t-e)/n;for(let l=0;l<=i;l++){let u=[],g=l/i,y=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*o+s,l=Math.sin(i),f=Math.cos(i);v.x=y*l,v.y=-g*n+m,v.z=y*f,c.push(v.x,v.y,v.z),a.set(l,_,f).normalize(),h.push(a.x,a.y,a.z),d.push(t,1-g),u.push(p++)}f.push(u)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=f[r][n],s=f[r+1][n],o=f[r+1][n+1],l=f[r][n+1];(e>0||0!==r)&&(u.push(a,s,l),y+=3),(t>0||r!==i-1)&&(u.push(s,o,l),y+=3)}l.addGroup(g,y,0),g+=y})(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new iX(c,3)),this.setAttribute("normal",new iX(h,3)),this.setAttribute("uv",new iX(d,2))}}class on extends ot{static fromJSON(e){return new on(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}constructor(e=1,t=1,n=32,r=1,i=!1,a=0,s=2*Math.PI){super(0,e,t,n,r,i,a,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:s}}}class or extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new or(e.vertices,e.indices,e.radius,e.details)}constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};let i=[],a=[];function s(e){i.push(e.x,e.y,e.z)}function o(t,n){let r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function l(e,t,n,r){r<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}(function(e){let n=new nX,r=new nX,i=new nX;for(let a=0;a<t.length;a+=3)o(t[a+0],n),o(t[a+1],r),o(t[a+2],i),function(e,t,n,r){let i=r+1,a=[];for(let r=0;r<=i;r++){a[r]=[];let s=e.clone().lerp(n,r/i),o=t.clone().lerp(n,r/i),l=i-r;for(let e=0;e<=l;e++)0===e&&r===i?a[r][e]=s:a[r][e]=s.clone().lerp(o,e/l)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){let n=Math.floor(t/2);t%2==0?(s(a[e][n+1]),s(a[e+1][n]),s(a[e][n])):(s(a[e][n+1]),s(a[e+1][n+1]),s(a[e+1][n]))}}(n,r,i,e)})(r),function(e){let t=new nX;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}(n),function(){let e=new nX;for(let n=0;n<i.length;n+=3){var t;e.x=i[n+0],e.y=i[n+1],e.z=i[n+2];let r=u(e)/2/Math.PI+.5,s=Math.atan2(-(t=e).y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5;a.push(r,1-s)}(function(){let e=new nX,t=new nX,n=new nX,r=new nX,s=new nW,o=new nW,c=new nW;for(let h=0,d=0;h<i.length;h+=9,d+=6){e.set(i[h+0],i[h+1],i[h+2]),t.set(i[h+3],i[h+4],i[h+5]),n.set(i[h+6],i[h+7],i[h+8]),s.set(a[d+0],a[d+1]),o.set(a[d+2],a[d+3]),c.set(a[d+4],a[d+5]),r.copy(e).add(t).add(n).divideScalar(3);let p=u(r);l(s,d+0,e,p),l(o,d+2,t,p),l(c,d+4,n,p)}})(),function(){for(let e=0;e<a.length;e+=6){let t=a[e+0],n=a[e+2],r=a[e+4],i=Math.max(t,n,r),s=Math.min(t,n,r);i>.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new iX(i,3)),this.setAttribute("normal",new iX(i.slice(),3)),this.setAttribute("uv",new iX(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}class oi extends or{static fromJSON(e){return new oi(e.radius,e.detail)}constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}}let oa=new nX,os=new nX,oo=new nX,ol=new ix;class ou extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){let n=Math.cos(nU*t),r=e.getIndex(),i=e.getAttribute("position"),a=r?r.count:i.count,s=[0,0,0],o=["a","b","c"],l=[,,,],u={},c=[];for(let e=0;e<a;e+=3){r?(s[0]=r.getX(e),s[1]=r.getX(e+1),s[2]=r.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);let{a:t,b:a,c:h}=ol;if(t.fromBufferAttribute(i,s[0]),a.fromBufferAttribute(i,s[1]),h.fromBufferAttribute(i,s[2]),ol.getNormal(oo),l[0]="".concat(Math.round(1e4*t.x),",").concat(Math.round(1e4*t.y),",").concat(Math.round(1e4*t.z)),l[1]="".concat(Math.round(1e4*a.x),",").concat(Math.round(1e4*a.y),",").concat(Math.round(1e4*a.z)),l[2]="".concat(Math.round(1e4*h.x),",").concat(Math.round(1e4*h.y),",").concat(Math.round(1e4*h.z)),l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){let t=(e+1)%3,r=l[e],i=l[t],a=ol[o[e]],h=ol[o[t]],d="".concat(r,"_").concat(i),p="".concat(i,"_").concat(r);p in u&&u[p]?(oo.dot(u[p].normal)<=n&&(c.push(a.x,a.y,a.z),c.push(h.x,h.y,h.z)),u[p]=null):d in u||(u[d]={index0:s[e],index1:s[t],normal:oo.clone()})}}for(let e in u)if(u[e]){let{index0:t,index1:n}=u[e];oa.fromBufferAttribute(i,t),os.fromBufferAttribute(i,n),c.push(oa.x,oa.y,oa.z),c.push(os.x,os.y,os.z)}this.setAttribute("position",new iX(c,3))}}}class oc{getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(){let 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;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)t.push(i+=(n=this.getPoint(a/e)).distanceTo(r)),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.getLengths(),i=0,a=r.length;t=n||e*r[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=r[i=Math.floor(s+(o-s)/2)]-t)<0)s=i+1;else if(l>0)o=i-1;else{o=i;break}if(r[i=o]===t)return i/(a-1);let u=r[i],c=r[i+1];return(i+(t-u)/(c-u))/(a-1)}getTangent(e,t){let n=e-1e-4,r=e+1e-4;n<0&&(n=0),r>1&&(r=1);let i=this.getPoint(n),a=this.getPoint(r),s=t||(i.isVector2?new nW:new nX);return s.copy(a).sub(i).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new nX,r=[],i=[],a=[],s=new nX,o=new rH;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new nX)}i[0]=new nX,a[0]=new nX;let l=Number.MAX_VALUE,u=Math.abs(r[0].x),c=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=l&&(l=u,n.set(1,0,0)),c<=l&&(l=c,n.set(0,1,0)),h<=l&&n.set(0,0,1),s.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],s),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(r[t-1],r[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(nk(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(r[t],i[t])}if(!0===t){let t=Math.acos(nk(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(s.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(o.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}}class oh extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,i=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=i?0:n),!0!==this.aClockwise||i||(r===n?r=-n:r-=n);let a=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=o-this.aY;s=n*e-r*t+this.aX,o=n*t+r*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}constructor(e=0,t=0,n=1,r=1,i=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}}class od extends oh{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type="ArcCurve"}}function op(){let e=0,t=0,n=0,r=0;function i(i,a,s,o){e=i,t=s,n=-3*i+3*a-2*s-o,r=2*i-2*a+s+o}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,s,o){let l=(t-e)/a-(n-e)/(a+s)+(n-t)/s,u=(n-t)/s-(r-t)/(s+o)+(r-n)/o;i(t,n,l*=s,u*=s)},calc:function(i){let a=i*i;return e+t*i+n*a+a*i*r}}}let of=new nX,om=new op,og=new op,ov=new op;class oy extends oc{getPoint(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX,i=this.points,a=i.length,s=(a-!this.closed)*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?t=i[(o-1)%a]:(of.subVectors(i[0],i[1]).add(i[0]),t=of);let u=i[o%a],c=i[(o+1)%a];if(this.closed||o+2<a?n=i[(o+2)%a]:(of.subVectors(i[a-1],i[a-2]).add(i[a-1]),n=of),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,r=Math.pow(t.distanceToSquared(u),e),i=Math.pow(u.distanceToSquared(c),e),a=Math.pow(c.distanceToSquared(n),e);i<1e-4&&(i=1),r<1e-4&&(r=i),a<1e-4&&(a=i),om.initNonuniformCatmullRom(t.x,u.x,c.x,n.x,r,i,a),og.initNonuniformCatmullRom(t.y,u.y,c.y,n.y,r,i,a),ov.initNonuniformCatmullRom(t.z,u.z,c.z,n.z,r,i,a)}else"catmullrom"===this.curveType&&(om.initCatmullRom(t.x,u.x,c.x,n.x,this.tension),og.initCatmullRom(t.y,u.y,c.y,n.y,this.tension),ov.initCatmullRom(t.z,u.z,c.z,n.z,this.tension));return r.set(om.calc(l),og.calc(l),ov.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new nX().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}}function o_(e,t,n,r,i){let a=(r-t)*.5,s=(i-n)*.5,o=e*e;return e*o*(2*n-2*r+a+s)+(-3*n+3*r-2*a-s)*o+a*e+n}function ox(e,t,n,r){return function(e,t){let n=1-e;return n*n*t}(e,t)+2*(1-e)*e*n+e*e*r}function ob(e,t,n,r,i){return function(e,t){let n=1-e;return n*n*n*t}(e,t)+function(e,t){let n=1-e;return 3*n*n*e*t}(e,n)+3*(1-e)*e*e*r+e*e*e*i}class oS extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(ob(e,n.x,r.x,i.x,a.x),ob(e,n.y,r.y,i.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new nW,t=new nW,n=new nW,r=new nW){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}}class oM extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(ob(e,n.x,r.x,i.x,a.x),ob(e,n.y,r.y,i.y,a.y),ob(e,n.z,r.z,i.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new nX,t=new nX,n=new nX,r=new nX){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}}class ow extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nW,t=new nW){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}}class oE extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nX,t=new nX){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}}class oT extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=this.v0,r=this.v1,i=this.v2;return t.set(ox(e,n.x,r.x,i.x),ox(e,n.y,r.y,i.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nW,t=new nW,n=new nW){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}}class oA extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nX,n=this.v0,r=this.v1,i=this.v2;return t.set(ox(e,n.x,r.x,i.x),ox(e,n.y,r.y,i.y),ox(e,n.z,r.z,i.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new nX,t=new nX,n=new nX){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}}class oC extends oc{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new nW,n=this.points,r=(n.length-1)*e,i=Math.floor(r),a=r-i,s=n[0===i?i:i-1],o=n[i],l=n[i>n.length-2?n.length-1:i+1],u=n[i>n.length-3?n.length-1:i+2];return t.set(o_(a,s.x,o.x,l.x,u.x),o_(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new nW().fromArray(n))}return this}constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}}var oR=Object.freeze({__proto__:null,ArcCurve:od,CatmullRomCurve3:oy,CubicBezierCurve:oS,CubicBezierCurve3:oM,EllipseCurve:oh,LineCurve:ow,LineCurve3:oE,QuadraticBezierCurve:oT,QuadraticBezierCurve3:oA,SplineCurve:oC});class oP extends oc{add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new oR[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)e.push(t+=this.curves[n].getLength());return this.cacheLengths=e,e}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[];for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],s=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,o=a.getPoints(s);for(let t=0;t<o.length;t++){let r=o[t];e&&e.equals(r)||(n.push(r),e=r)}}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new oR[n.type]().fromJSON(n))}return this}constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}}class oI extends oP{setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new ow(this.currentPoint.clone(),new nW(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new oT(this.currentPoint.clone(),new nW(e,t),new nW(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let s=new oS(this.currentPoint.clone(),new nW(e,t),new nW(n,r),new nW(i,a));return this.curves.push(s),this.currentPoint.set(i,a),this}splineThru(e){let t=new oC([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,s,o){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,r,i,a,s,o),this}absellipse(e,t,n,r,i,a,s,o){let l=new oh(e,t,n,r,i,a,s,o);if(this.curves.length>0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}constructor(e){super(),this.type="Path",this.currentPoint=new nW,e&&this.setFromPoints(e)}}class oL extends oI{getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new oI().fromJSON(n))}return this}constructor(e){super(e),this.uuid=nF(),this.type="Shape",this.holes=[]}}function oN(e,t,n,r,i){let a;if(i===function(e,t,n,r){let i=0;for(let a=t,s=n-r;a<n;a+=r)i+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return i}(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=oX(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=oX(i/r|0,e[i],e[i+1],a);return a&&oB(a,a.next)&&(oq(a),a=a.next),a}function oD(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(oB(n,n.next)||0===oz(n.prev,n,n.next))){if(oq(n),(n=t=n.prev)===n.next)break;r=!0}else n=n.next;while(r||n!==t)return t}function oU(e,t){let n=e.x-t.x;return 0===n&&0==(n=e.y-t.y)&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function oO(e,t,n,r,i){return(e=((e=((e=((e=((e=(e-n)*i|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-r)*i|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function oF(e,t,n,r,i,a,s,o){return(i-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(r-o)>=(n-s)*(t-o)&&(n-s)*(a-o)>=(i-s)*(r-o)}function ok(e,t,n,r,i,a,s,o){return(e!==s||t!==o)&&oF(e,t,n,r,i,a,s,o)}function oz(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function oB(e,t){return e.x===t.x&&e.y===t.y}function oH(e,t,n,r){let i=oG(oz(e,t,n)),a=oG(oz(e,t,r)),s=oG(oz(n,r,e)),o=oG(oz(n,r,t));return!!(i!==a&&s!==o||0===i&&oV(e,n,t)||0===a&&oV(e,r,t)||0===s&&oV(n,e,r)||0===o&&oV(n,t,r))}function oV(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 oG(e){return e>0?1:e<0?-1:0}function oW(e,t){return 0>oz(e.prev,e,e.next)?oz(e,t,e.next)>=0&&oz(e,e.prev,t)>=0:0>oz(e,t,e.prev)||0>oz(e,e.next,t)}function oj(e,t){let n=oY(e.i,e.x,e.y),r=oY(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 oX(e,t,n,r){let i=oY(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 oq(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 oY(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class oJ{static triangulate(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;return function(e,t){let n,r,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,s=t&&t.length,o=s?t[0]*a:e.length,l=oN(e,0,o,a,!0),u=[];if(!l||l.next===l.prev)return u;if(s&&(l=function(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let s=t[n]*r,o=n<a-1?t[n+1]*r:e.length,l=oN(e,s,o,r,!1);l===l.next&&(l.steiner=!0),i.push(function(e){let 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}(l))}i.sort(oU);for(let e=0;e<i.length;e++)n=function(e,t){let n=function(e,t){let n,r=t,i=e.x,a=e.y,s=-1/0;if(oB(e,r))return r;do{if(oB(e,r.next))return r.next;if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){let e=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=i&&e>s&&(s=e,n=r.x<r.next.x?r:r.next,e===i))return n}r=r.next}while(r!==t)if(!n)return null;let o=n,l=n.x,u=n.y,c=1/0;r=n;do{if(i>=r.x&&r.x>=l&&i!==r.x&&oF(a<u?i:s,a,l,u,a<u?s:i,a,r.x,r.y)){var h,d;let t=Math.abs(a-r.y)/(i-r.x);oW(r,e)&&(t<c||t===c&&(r.x>n.x||r.x===n.x&&(h=n,d=r,0>oz(h.prev,h,d.prev)&&0>oz(d.next,h,h.next))))&&(n=r,c=t)}r=r.next}while(r!==o)return n}(e,t);if(!n)return t;let r=oj(n,e);return oD(r,r.next),oD(n,n.next)}(i[e],n);return n}(e,t,l,a)),e.length>80*a){n=1/0,r=1/0;let t=-1/0,s=-1/0;for(let i=a;i<o;i+=a){let a=e[i],o=e[i+1];a<n&&(n=a),o<r&&(r=o),a>t&&(t=a),o>s&&(s=o)}i=0!==(i=Math.max(t-n,s-r))?32767/i:0}return function e(t,n,r,i,a,s,o){if(!t)return;!o&&s&&function(e,t,n,r){let i=e;do 0===i.z&&(i.z=oO(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){let t,n=1;do{let r,i=e;e=null;let a=null;for(t=0;i;){t++;let s=i,o=0;for(let e=0;e<n&&(o++,s=s.nextZ);e++);let l=n;for(;o>0||l>0&&s;)0!==o&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,o--):(r=s,s=s.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=s}a.nextZ=null,n*=2}while(t>1)}(i)}(t,i,a,s);let l=t;for(;t.prev!==t.next;){let u=t.prev,c=t.next;if(s?function(e,t,n,r){let i=e.prev,a=e.next;if(oz(i,e,a)>=0)return!1;let s=i.x,o=e.x,l=a.x,u=i.y,c=e.y,h=a.y,d=Math.min(s,o,l),p=Math.min(u,c,h),f=Math.max(s,o,l),m=Math.max(u,c,h),g=oO(d,p,t,n,r),v=oO(f,m,t,n,r),y=e.prevZ,_=e.nextZ;for(;y&&y.z>=g&&_&&_.z<=v;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&ok(s,u,o,c,l,h,y.x,y.y)&&oz(y.prev,y,y.next)>=0||(y=y.prevZ,_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&ok(s,u,o,c,l,h,_.x,_.y)&&oz(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;y&&y.z>=g;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&ok(s,u,o,c,l,h,y.x,y.y)&&oz(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&ok(s,u,o,c,l,h,_.x,_.y)&&oz(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}(t,i,a,s):function(e){let t=e.prev,n=e.next;if(oz(t,e,n)>=0)return!1;let r=t.x,i=e.x,a=n.x,s=t.y,o=e.y,l=n.y,u=Math.min(r,i,a),c=Math.min(s,o,l),h=Math.max(r,i,a),d=Math.max(s,o,l),p=n.next;for(;p!==t;){if(p.x>=u&&p.x<=h&&p.y>=c&&p.y<=d&&ok(r,s,i,o,a,l,p.x,p.y)&&oz(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){n.push(u.i,t.i,c.i),oq(t),t=c.next,l=c.next;continue}if((t=c)===l){o?1===o?e(t=function(e,t){let n=e;do{let r=n.prev,i=n.next.next;!oB(r,i)&&oH(r,n,n.next,i)&&oW(r,i)&&oW(i,r)&&(t.push(r.i,n.i,i.i),oq(n),oq(n.next),n=e=i),n=n.next}while(n!==e)return oD(n)}(oD(t),n),n,r,i,a,s,2):2===o&&function(t,n,r,i,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,u;if(o.i!==t.i&&(l=o,u=t,l.next.i!==u.i&&l.prev.i!==u.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&oH(n,n.next,e,t))return!0;n=n.next}while(n!==e)return!1}(l,u)&&(oW(l,u)&&oW(u,l)&&function(e,t){let 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}(l,u)&&(oz(l.prev,l,u.prev)||oz(l,u.prev,u))||oB(l,u)&&oz(l.prev,l,l.next)>0&&oz(u.prev,u,u.next)>0))){let l=oj(o,t);o=oD(o,o.next),l=oD(l,l.next),e(o,n,r,i,a,s,0),e(l,n,r,i,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,n,r,i,a,s):e(oD(t),n,r,i,a,s,1);break}}}(l,u,a,n,r,i,0),u}(e,t,n)}}class oZ{static area(e){let t=e.length,n=0;for(let 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}static isClockWise(e){return 0>oZ.area(e)}static triangulateShape(e,t){let n=[],r=[],i=[];oK(e),o$(n,e);let a=e.length;t.forEach(oK);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,o$(n,t[e]);let s=oJ.triangulate(n,r);for(let e=0;e<s.length;e+=3)i.push(s.slice(e,e+3));return i}}function oK(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function o$(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class oQ extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.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)}static fromJSON(e,t){let n=[];for(let r=0,i=e.shapes.length;r<i;r++){let i=t[e.shapes[r]];n.push(i)}let r=e.options.extrudePath;return void 0!==r&&(e.options.extrudePath=new oR[r.type]().fromJSON(r)),new oQ(n,e.options)}constructor(e=new oL([new nW(.5,.5),new nW(-.5,.5),new nW(-.5,-.5),new nW(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let a=0,s=e.length;a<s;a++)!function(e){let a,s,o,l,u,c=[],h=void 0!==t.curveSegments?t.curveSegments:12,d=void 0!==t.steps?t.steps:1,p=void 0!==t.depth?t.depth:1,f=void 0===t.bevelEnabled||t.bevelEnabled,m=void 0!==t.bevelThickness?t.bevelThickness:.2,g=void 0!==t.bevelSize?t.bevelSize:m-.1,v=void 0!==t.bevelOffset?t.bevelOffset:0,y=void 0!==t.bevelSegments?t.bevelSegments:3,_=t.extrudePath,x=void 0!==t.UVGenerator?t.UVGenerator:o0,b,S=!1;_&&(b=_.getSpacedPoints(d),S=!0,f=!1,a=_.computeFrenetFrames(d,!1),s=new nX,o=new nX,l=new nX),f||(y=0,m=0,g=0,v=0);let M=e.extractPoints(h),w=M.shape,E=M.holes;if(!oZ.isClockWise(w)){w=w.reverse();for(let e=0,t=E.length;e<t;e++){let t=E[e];oZ.isClockWise(t)&&(E[e]=t.reverse())}}function T(e){let t=1e-10*1e-10,n=e[0];for(let r=1;r<=e.length;r++){let i=r%e.length,a=e[i],s=a.x-n.x,o=a.y-n.y,l=s*s+o*o,u=Math.max(Math.abs(a.x),Math.abs(a.y),Math.abs(n.x),Math.abs(n.y));if(l<=t*u*u){e.splice(i,1),r--;continue}n=a}}T(w),E.forEach(T);let A=E.length,C=w;for(let e=0;e<A;e++){let t=E[e];w=w.concat(t)}function R(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}let P=w.length;function I(e,t,n){let r,i,a,s=e.x-t.x,o=e.y-t.y,l=n.x-e.x,u=n.y-e.y,c=s*s+o*o;if(Math.abs(s*u-o*l)>Number.EPSILON){let h=Math.sqrt(c),d=Math.sqrt(l*l+u*u),p=t.x-o/h,f=t.y+s/h,m=((n.x-u/d-p)*u-(n.y+l/d-f)*l)/(s*u-o*l),g=(r=p+s*m-e.x)*r+(i=f+o*m-e.y)*i;if(g<=2)return new nW(r,i);a=Math.sqrt(g/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(r=-o,i=s,a=Math.sqrt(c)):(r=s,i=o,a=Math.sqrt(c/2))}return new nW(r/a,i/a)}let L=[];for(let e=0,t=C.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),L[e]=I(C[e],C[n],C[r]);let N=[],D,U=L.concat();for(let e=0;e<A;e++){let t=E[e];D=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),D[e]=I(t[e],t[r],t[i]);N.push(D),U=U.concat(D)}if(0===y)u=oZ.triangulateShape(C,E);else{let e=[],t=[];for(let n=0;n<y;n++){let r=n/y,i=m*Math.cos(r*Math.PI/2),a=g*Math.sin(r*Math.PI/2)+v;for(let t=0,n=C.length;t<n;t++){let n=R(C[t],L[t],a);z(n.x,n.y,-i),0===r&&e.push(n)}for(let e=0;e<A;e++){let n=E[e];D=N[e];let s=[];for(let e=0,t=n.length;e<t;e++){let t=R(n[e],D[e],a);z(t.x,t.y,-i),0===r&&s.push(t)}0===r&&t.push(s)}}u=oZ.triangulateShape(e,t)}let O=u.length,F=g+v;for(let e=0;e<P;e++){let t=f?R(w[e],U[e],F):w[e];S?(o.copy(a.normals[0]).multiplyScalar(t.x),s.copy(a.binormals[0]).multiplyScalar(t.y),l.copy(b[0]).add(o).add(s),z(l.x,l.y,l.z)):z(t.x,t.y,0)}for(let e=1;e<=d;e++)for(let t=0;t<P;t++){let n=f?R(w[t],U[t],F):w[t];S?(o.copy(a.normals[e]).multiplyScalar(n.x),s.copy(a.binormals[e]).multiplyScalar(n.y),l.copy(b[e]).add(o).add(s),z(l.x,l.y,l.z)):z(n.x,n.y,p/d*e)}for(let e=y-1;e>=0;e--){let t=e/y,n=m*Math.cos(t*Math.PI/2),r=g*Math.sin(t*Math.PI/2)+v;for(let e=0,t=C.length;e<t;e++){let t=R(C[e],L[e],r);z(t.x,t.y,p+n)}for(let e=0,t=E.length;e<t;e++){let t=E[e];D=N[e];for(let e=0,i=t.length;e<i;e++){let i=R(t[e],D[e],r);S?z(i.x,i.y+b[d-1].y,b[d-1].x+n):z(i.x,i.y,p+n)}}}function k(e,t){let i=e.length;for(;--i>=0;){let a=i,s=i-1;s<0&&(s=e.length-1);for(let e=0,i=d+2*y;e<i;e++){let i=P*e,o=P*(e+1);!function(e,t,i,a){H(e),H(t),H(a),H(t),H(i),H(a);let s=r.length/3,o=x.generateSideWallUV(n,r,s-6,s-3,s-2,s-1);V(o[0]),V(o[1]),V(o[3]),V(o[1]),V(o[2]),V(o[3])}(t+a+i,t+s+i,t+s+o,t+a+o)}}}function z(e,t,n){c.push(e),c.push(t),c.push(n)}function B(e,t,i){H(e),H(t),H(i);let a=r.length/3,s=x.generateTopUV(n,r,a-3,a-2,a-1);V(s[0]),V(s[1]),V(s[2])}function H(e){r.push(c[3*e+0]),r.push(c[3*e+1]),r.push(c[3*e+2])}function V(e){i.push(e.x),i.push(e.y)}(function(){let e=r.length/3;if(f){let e=0*P;for(let t=0;t<O;t++){let n=u[t];B(n[2]+e,n[1]+e,n[0]+e)}e=P*(d+2*y);for(let t=0;t<O;t++){let n=u[t];B(n[0]+e,n[1]+e,n[2]+e)}}else{for(let e=0;e<O;e++){let t=u[e];B(t[2],t[1],t[0])}for(let e=0;e<O;e++){let t=u[e];B(t[0]+P*d,t[1]+P*d,t[2]+P*d)}}n.addGroup(e,r.length/3-e,0)})(),function(){let e=r.length/3,t=0;k(C,0),t+=C.length;for(let e=0,n=E.length;e<n;e++){let n=E[e];k(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}()}(e[a]);this.setAttribute("position",new iX(r,3)),this.setAttribute("uv",new iX(i,2)),this.computeVertexNormals()}}let o0={generateTopUV:function(e,t,n,r,i){let a=t[3*n],s=t[3*n+1],o=t[3*r],l=t[3*r+1],u=t[3*i],c=t[3*i+1];return[new nW(a,s),new nW(o,l),new nW(u,c)]},generateSideWallUV:function(e,t,n,r,i,a){let s=t[3*n],o=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],p=t[3*i+1],f=t[3*i+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(o-c)<Math.abs(s-u)?[new nW(s,1-l),new nW(u,1-h),new nW(d,1-f),new nW(m,1-v)]:[new nW(o,1-l),new nW(c,1-h),new nW(p,1-f),new nW(g,1-v)]}};class o1 extends or{static fromJSON(e){return new o1(e.radius,e.detail)}constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[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],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}}class o2 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new o2(e.points,e.segments,e.phiStart,e.phiLength)}constructor(e=[new nW(0,-.5),new nW(.5,0),new nW(0,.5)],t=12,n=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=nk(r,0,2*Math.PI);let i=[],a=[],s=[],o=[],l=[],u=1/t,c=new nX,h=new nW,d=new nX,p=new nX,f=new nX,m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,d.x=+(g=e[t+1].y-e[t].y),d.y=-m,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,d.x=+(g=e[t+1].y-e[t].y),d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let i=0;i<=t;i++){let d=n+i*u*r,p=Math.sin(d),f=Math.cos(d);for(let n=0;n<=e.length-1;n++){c.x=e[n].x*p,c.y=e[n].y,c.z=e[n].x*f,a.push(c.x,c.y,c.z),h.x=i/t,h.y=n/(e.length-1),s.push(h.x,h.y);let r=o[3*n+0]*p,u=o[3*n+1],d=o[3*n+0]*f;l.push(r,u,d)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){let r=t+n*e.length,a=r+e.length,s=r+e.length+1,o=r+1;i.push(r,a,o),i.push(s,o,a)}this.setIndex(i),this.setAttribute("position",new iX(a,3)),this.setAttribute("uv",new iX(s,2)),this.setAttribute("normal",new iX(l,3))}}class o3 extends or{static fromJSON(e){return new o3(e.radius,e.detail)}constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}}class o4 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new o4(e.width,e.height,e.widthSegments,e.heightSegments)}constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,s=Math.floor(n),o=Math.floor(r),l=s+1,u=o+1,c=e/s,h=t/o,d=[],p=[],f=[],m=[];for(let e=0;e<u;e++){let t=e*h-a;for(let n=0;n<l;n++){let r=n*c-i;p.push(r,-t,0),f.push(0,0,1),m.push(n/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){let n=t+l*e,r=t+l*(e+1),i=t+1+l*(e+1),a=t+1+l*e;d.push(n,r,a),d.push(r,i,a)}this.setIndex(d),this.setAttribute("position",new iX(p,3)),this.setAttribute("normal",new iX(f,3)),this.setAttribute("uv",new iX(m,2))}}class o5 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new o5(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}constructor(e=.5,t=1,n=32,r=1,i=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},n=Math.max(3,n);let s=[],o=[],l=[],u=[],c=e,h=(t-e)/(r=Math.max(1,r)),d=new nX,p=new nW;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){let r=i+e/n*a;d.x=c*Math.cos(r),d.y=c*Math.sin(r),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,u.push(p.x,p.y)}c+=h}for(let e=0;e<r;e++){let t=e*(n+1);for(let e=0;e<n;e++){let r=e+t,i=r+n+1,a=r+n+2,o=r+1;s.push(r,i,o),s.push(i,a,o)}}this.setIndex(s),this.setAttribute("position",new iX(o,3)),this.setAttribute("normal",new iX(l,3)),this.setAttribute("uv",new iX(u,2))}}class o6 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){let r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){let n=[];for(let r=0,i=e.shapes.length;r<i;r++){let i=t[e.shapes[r]];n.push(i)}return new o6(n,e.curveSegments)}constructor(e=new oL([new nW(0,.5),new nW(-.5,-.5),new nW(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let n=[],r=[],i=[],a=[],s=0,o=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(s,o,t),s+=o,o=0;function l(e){let s=r.length/3,l=e.extractPoints(t),u=l.shape,c=l.holes;!1===oZ.isClockWise(u)&&(u=u.reverse());for(let e=0,t=c.length;e<t;e++){let t=c[e];!0===oZ.isClockWise(t)&&(c[e]=t.reverse())}let h=oZ.triangulateShape(u,c);for(let e=0,t=c.length;e<t;e++){let t=c[e];u=u.concat(t)}for(let e=0,t=u.length;e<t;e++){let t=u[e];r.push(t.x,t.y,0),i.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=h.length;e<t;e++){let t=h[e],r=t[0]+s,i=t[1]+s,a=t[2]+s;n.push(r,i,a),o+=3}}this.setIndex(n),this.setAttribute("position",new iX(r,3)),this.setAttribute("normal",new iX(i,3)),this.setAttribute("uv",new iX(a,2))}}class o8 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new o8(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}constructor(e=1,t=32,n=16,r=0,i=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let o=Math.min(a+s,Math.PI),l=0,u=[],c=new nX,h=new nX,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){let g=[],v=d/n,y=0;0===d&&0===a?y=.5/t:d===n&&o===Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){let o=n/t;c.x=-e*Math.cos(r+o*i)*Math.sin(a+v*s),c.y=e*Math.cos(a+v*s),c.z=e*Math.sin(r+o*i)*Math.sin(a+v*s),p.push(c.x,c.y,c.z),h.copy(c).normalize(),f.push(h.x,h.y,h.z),m.push(o+y,1-v),g.push(l++)}u.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=u[e][r+1],i=u[e][r],s=u[e+1][r],l=u[e+1][r+1];(0!==e||a>0)&&d.push(t,i,l),(e!==n-1||o<Math.PI)&&d.push(i,s,l)}this.setIndex(d),this.setAttribute("position",new iX(p,3)),this.setAttribute("normal",new iX(f,3)),this.setAttribute("uv",new iX(m,2))}}class o9 extends or{static fromJSON(e){return new o9(e.radius,e.detail)}constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}}class o7 extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new o7(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}constructor(e=1,t=.4,n=12,r=48,i=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);let a=[],s=[],o=[],l=[],u=new nX,c=new nX,h=new nX;for(let a=0;a<=n;a++)for(let d=0;d<=r;d++){let p=d/r*i,f=a/n*Math.PI*2;c.x=(e+t*Math.cos(f))*Math.cos(p),c.y=(e+t*Math.cos(f))*Math.sin(p),c.z=t*Math.sin(f),s.push(c.x,c.y,c.z),u.x=e*Math.cos(p),u.y=e*Math.sin(p),h.subVectors(c,u).normalize(),o.push(h.x,h.y,h.z),l.push(d/r),l.push(a/n)}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,s=(r+1)*(e-1)+t,o=(r+1)*e+t;a.push(n,i,o),a.push(i,s,o)}this.setIndex(a),this.setAttribute("position",new iX(s,3)),this.setAttribute("normal",new iX(o,3)),this.setAttribute("uv",new iX(l,2))}}class le extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new le(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}constructor(e=1,t=.4,n=64,r=8,i=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},n=Math.floor(n),r=Math.floor(r);let s=[],o=[],l=[],u=[],c=new nX,h=new nX,d=new nX,p=new nX,f=new nX,m=new nX,g=new nX;for(let s=0;s<=n;++s){let y=s/n*i*Math.PI*2;v(y,i,a,e,d),v(y+.01,i,a,e,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=r;++e){let i=e/r*Math.PI*2,a=-t*Math.cos(i),p=t*Math.sin(i);c.x=d.x+(a*g.x+p*f.x),c.y=d.y+(a*g.y+p*f.y),c.z=d.z+(a*g.z+p*f.z),o.push(c.x,c.y,c.z),h.subVectors(c,d).normalize(),l.push(h.x,h.y,h.z),u.push(s/n),u.push(e/r)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,o=(r+1)*(e-1)+t;s.push(n,i,o),s.push(i,a,o)}function v(e,t,n,r,i){let a=Math.cos(e),s=Math.sin(e),o=n/t*e,l=Math.cos(o);i.x=r*(2+l)*.5*a,i.y=r*(2+l)*s*.5,i.z=r*Math.sin(o)*.5}this.setIndex(s),this.setAttribute("position",new iX(o,3)),this.setAttribute("normal",new iX(l,3)),this.setAttribute("uv",new iX(u,2))}}class lt extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new lt(new oR[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}constructor(e=new oA(new nX(-1,-1,0),new nX(-1,1,0),new nX(1,1,0)),t=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};let a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let s=new nX,o=new nX,l=new nW,u=new nX,c=[],h=[],d=[],p=[];function f(i){u=e.getPointAt(i/t,u);let l=a.normals[i],d=a.binormals[i];for(let e=0;e<=r;e++){let t=e/r*Math.PI*2,i=Math.sin(t),a=-Math.cos(t);o.x=a*l.x+i*d.x,o.y=a*l.y+i*d.y,o.z=a*l.z+i*d.z,o.normalize(),h.push(o.x,o.y,o.z),s.x=u.x+n*o.x,s.y=u.y+n*o.y,s.z=u.z+n*o.z,c.push(s.x,s.y,s.z)}}(function(){for(let e=0;e<t;e++)f(e);f(!1===i?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)l.x=e/t,l.y=n/r,d.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,s=(r+1)*(e-1)+t;p.push(n,i,s),p.push(i,a,s)}}()})(),this.setIndex(p),this.setAttribute("position",new iX(c,3)),this.setAttribute("normal",new iX(h,3)),this.setAttribute("uv",new iX(d,2))}}class ln extends i0{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){let t=[],n=new Set,r=new nX,i=new nX;if(null!==e.index){let a=e.attributes.position,s=e.index,o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){let l=o[e],u=l.start,c=l.count;for(let e=u,o=u+c;e<o;e+=3)for(let o=0;o<3;o++){let l=s.getX(e+o),u=s.getX(e+(o+1)%3);r.fromBufferAttribute(a,l),i.fromBufferAttribute(a,u),!0===lr(r,i,n)&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{let a=e.attributes.position;for(let e=0,s=a.count/3;e<s;e++)for(let s=0;s<3;s++){let o=3*e+s,l=3*e+(s+1)%3;r.fromBufferAttribute(a,o),i.fromBufferAttribute(a,l),!0===lr(r,i,n)&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute("position",new iX(t,3))}}}function lr(e,t,n){let 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 li=Object.freeze({__proto__:null,BoxGeometry:ai,CapsuleGeometry:s7,CircleGeometry:oe,ConeGeometry:on,CylinderGeometry:ot,DodecahedronGeometry:oi,EdgesGeometry:ou,ExtrudeGeometry:oQ,IcosahedronGeometry:o1,LatheGeometry:o2,OctahedronGeometry:o3,PlaneGeometry:o4,PolyhedronGeometry:or,RingGeometry:o5,ShapeGeometry:o6,SphereGeometry:o8,TetrahedronGeometry:o9,TorusGeometry:o7,TorusKnotGeometry:le,TubeGeometry:lt,WireframeGeometry:ln});class la extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new iE(0),this.transparent=!0,this.fog=!0,this.setValues(e)}}class ls extends au{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class lo extends iC{copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new iE(0xffffff),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}}class ll extends lo{get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new nW(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return nk(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new iE(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new iE(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new iE(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}}class lu extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new iE(0xffffff),this.specular=new iE(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lc extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new iE(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}}class lh extends iC{copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}}class ld extends iC{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new iE(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new iE(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new rK,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lp extends iC{copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=tj,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}}class lf extends iC{copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}}class lm extends iC{copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new iE(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tJ,this.normalScale=new nW(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}}class lg extends sN{copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}}function lv(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function ly(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function l_(e){let t=e.length,n=Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function lx(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,s=0;s!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[s++]=e[r+n]}return i}function lb(e,t,n,r){let i=1,a=e[0];for(;void 0!==a&&void 0===a[r];)a=e[i++];if(void 0===a)return;let s=a[r];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[r])&&(t.push(a.time),n.push(...s)),a=e[i++];while(void 0!==a)else if(void 0!==s.toArray)do void 0!==(s=a[r])&&(t.push(a.time),s.toArray(n,n.length)),a=e[i++];while(void 0!==a)else do void 0!==(s=a[r])&&(t.push(a.time),n.push(s)),a=e[i++];while(void 0!==a)}class lS{static convertArray(e,t){return lv(e,t)}static isTypedArray(e){return ly(e)}static getKeyframeOrder(e){return l_(e)}static sortedArray(e,t,n){return lx(e,t,n)}static flattenJSON(e,t,n,r){lb(e,t,n,r)}static subclip(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30;return function(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;let s=[];for(let e=0;e<a.tracks.length;++e){let t=a.tracks[e],o=t.getValueSize(),l=[],u=[];for(let e=0;e<t.times.length;++e){let a=t.times[e]*i;if(!(a<n)&&!(a>=r)){l.push(t.times[e]);for(let n=0;n<o;++n)u.push(t.values[e*o+n])}}0!==l.length&&(t.times=lv(l,t.times.constructor),t.values=lv(u,t.values.constructor),s.push(t))}a.tracks=s;let o=1/0;for(let e=0;e<a.tracks.length;++e)o>a.tracks[e].times[0]&&(o=a.tracks[e].times[0]);for(let e=0;e<a.tracks.length;++e)a.tracks[e].shift(-1*o);return a.resetDuration(),a}(e,t,n,r,i)}static makeClipAdditive(e){let 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;return function(e){let 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);let i=n.tracks.length,a=t/r;for(let t=0;t<i;++t){let r,i=n.tracks[t],s=i.ValueTypeName;if("bool"===s||"string"===s)continue;let o=e.tracks.find(function(e){return e.name===i.name&&e.ValueTypeName===s});if(void 0===o)continue;let l=0,u=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);let c=0,h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);let d=i.times.length-1;if(a<=i.times[0]){let e=l,t=u-l;r=i.values.slice(e,t)}else if(a>=i.times[d]){let e=d*u+l,t=e+u-l;r=i.values.slice(e,t)}else{let e=i.createInterpolant(),t=l,n=u-l;e.evaluate(a),r=e.resultBuffer.slice(t,n)}"quaternion"===s&&new nj().fromArray(r).normalize().conjugate().toArray(r);let p=o.times.length;for(let e=0;e<p;++e){let t=e*h+c;if("quaternion"===s)nj.multiplyQuaternionsFlat(o.values,t,r,0,o.values,t);else{let e=h-2*c;for(let n=0;n<e;++n)o.values[t+n]-=r[n]}}}return e.blendMode=tH,e}(e,t,n,r)}}class lM{evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];n:{r:{let a;i:{a:if(!(e<r)){for(let a=n+2;;){if(void 0===r){if(e<i)break a;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,e<(r=t[++n]))break r}a=t.length;break i}if(!(e>=i)){let s=t[1];e<s&&(n=2,i=s);for(let a=n-2;;){if(void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,e>=(i=t[--n-1]))break r}a=n,n=0;break i}break n}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+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)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}}class lw extends lM{intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,s=r[i],o=r[a];if(void 0===s)switch(this.getSettings_().endingStart){case tk:i=e,s=2*t-n;break;case tz:i=r.length-2,s=t+r[i]-r[i+1];break;default:i=e,s=n}if(void 0===o)switch(this.getSettings_().endingEnd){case tk:a=e,o=2*n-t;break;case tz:a=1,o=n+r[1]-r[0];break;default:a=e-1,o=t}let l=(n-t)*.5,u=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-n),this._offsetPrev=i*u,this._offsetNext=a*u}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(r-t),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,_=d*m-d*f;for(let e=0;e!==s;++e)i[e]=g*a[u+e]+v*a[l+e]+y*a[o+e]+_*a[c+e];return i}constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:tF,endingEnd:tF}}}class lE extends lM{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=(n-t)/(r-t),c=1-u;for(let e=0;e!==s;++e)i[e]=a[l+e]*c+a[o+e]*u;return i}constructor(e,t,n,r){super(e,t,n,r)}}class lT extends lM{interpolate_(e){return this.copySampleValue_(e-1)}constructor(e,t,n,r){super(e,t,n,r)}}class lA{static toJSON(e){let t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:lv(e.times,Array),values:lv(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new lT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new lE(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new lw(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case tD:t=this.InterpolantFactoryMethodDiscrete;break;case tU:t=this.InterpolantFactoryMethodLinear;break;case tO:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return tD;case this.InterpolantFactoryMethodLinear:return tU;case this.InterpolantFactoryMethodSmooth:return tO}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;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);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==a&&a>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,a),e=!1;break}a=r}if(void 0!==r&&ly(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===tO,i=e.length-1,a=1;for(let s=1;s<i;++s){let i=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(r)i=!0;else{let e=s*n,r=e-n,a=e+n;for(let s=0;s!==n;++s){let n=t[e+s];if(n!==t[r+s]||n!==t[a+s]){i=!0;break}}}if(i){if(s!==a){e[a]=e[s];let r=s*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,s=0;s!==n;++s)t[r+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}constructor(e,t,n,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=lv(t,this.TimeBufferType),this.values=lv(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}}lA.prototype.ValueTypeName="",lA.prototype.TimeBufferType=Float32Array,lA.prototype.ValueBufferType=Float32Array,lA.prototype.DefaultInterpolation=tU;class lC extends lA{constructor(e,t,n){super(e,t,n)}}lC.prototype.ValueTypeName="bool",lC.prototype.ValueBufferType=Array,lC.prototype.DefaultInterpolation=tD,lC.prototype.InterpolantFactoryMethodLinear=void 0,lC.prototype.InterpolantFactoryMethodSmooth=void 0;class lR extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lR.prototype.ValueTypeName="color";class lP extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lP.prototype.ValueTypeName="number";class lI extends lM{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(r-t),l=e*s;for(let e=l+s;l!==e;l+=4)nj.slerpFlat(i,0,a,l-s,a,l,o);return i}constructor(e,t,n,r){super(e,t,n,r)}}class lL extends lA{InterpolantFactoryMethodLinear(e){return new lI(this.times,this.values,this.getValueSize(),e)}constructor(e,t,n,r){super(e,t,n,r)}}lL.prototype.ValueTypeName="quaternion",lL.prototype.InterpolantFactoryMethodSmooth=void 0;class lN extends lA{constructor(e,t,n){super(e,t,n)}}lN.prototype.ValueTypeName="string",lN.prototype.ValueBufferType=Array,lN.prototype.DefaultInterpolation=tD,lN.prototype.InterpolantFactoryMethodLinear=void 0,lN.prototype.InterpolantFactoryMethodSmooth=void 0;class lD extends lA{constructor(e,t,n,r){super(e,t,n,r)}}lD.prototype.ValueTypeName="vector";class lU{static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return lP;case"vector":case"vector2":case"vector3":case"vector4":return lD;case"color":return lR;case"quaternion":return lL;case"bool":case"boolean":return lC;case"string":return lN}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],n=[];lb(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i.userData=JSON.parse(e.userData||"{}"),i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=n.length;e!==r;++e)t.push(lA.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e<i;e++){let s=[],o=[];s.push((e+i-1)%i,e,(e+1)%i),o.push(0,1,0);let l=l_(s);s=lx(s,1,l),o=lx(o,1,l),r||0!==s[0]||(s.push(i),o.push(o[0])),a.push(new lP(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;Array.isArray(e)||(n=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let r={},i=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){let n=e[t],a=n.name.match(i);if(a&&a.length>1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(e,t,n,r,i){if(0!==n.length){let a=[],s=[];lb(n,a,s,r),0!==a.length&&i.push(new e(t,a,s))}},r=[],i=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e<l.length;e++){let i=l[e].keys;if(i&&0!==i.length)if(i[0].morphTargets){let e,t={};for(e=0;e<i.length;e++)if(i[e].morphTargets)for(let n=0;n<i[e].morphTargets.length;n++)t[i[e].morphTargets[n]]=-1;for(let n in t){let t=[],a=[];for(let r=0;r!==i[e].morphTargets.length;++r){let r=i[e];t.push(r.time),a.push(+(r.morphTarget===n))}r.push(new lP(".morphTargetInfluence["+n+"]",t,a))}o=t.length*a}else{let a=".bones["+t[e].name+"]";n(lD,a+".position",i,"pos",r),n(lL,a+".quaternion",i,"rot",r),n(lD,a+".scale",i,"scl",r)}}return 0===r.length?null:new this(i,o,r,s)}resetDuration(){let e=this.tracks,t=0;for(let n=0,r=e.length;n!==r;++n){let e=this.tracks[n];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}constructor(e="",t=-1,n=[],r=tB){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=nF(),this.userData={},this.duration<0&&this.resetDuration()}}let lO={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={}}};class lF{constructor(e,t,n){let r,i=this,a=!1,s=0,o=0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.abortController=new AbortController,this.itemStart=function(e){o++,!1===a&&void 0!==i.onStart&&i.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==i.onProgress&&i.onProgress(e,s,o),s===o&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){let n=l[t],r=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}let lk=new lF;class lz{load(){}loadAsync(e,t){let n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}constructor(e){this.manager=void 0!==e?e:lk,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}}lz.DEFAULT_MATERIAL_NAME="__DEFAULT";let lB={};class lH extends Error{constructor(e,t){super(e),this.response=t}}class lV extends lz{load(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let i=lO.get("file:".concat(e));if(void 0!==i)return this.manager.itemStart(e),setTimeout(()=>{t&&t(i),this.manager.itemEnd(e)},0),i;if(void 0!==lB[e])return void lB[e].push({onLoad:t,onProgress:n,onError:r});lB[e]=[],lB[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(a).then(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;let n=lB[e],r=t.body.getReader(),i=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=i?parseInt(i):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){r.read().then(r=>{let{done:i,value:l}=r;if(i)e.close();else{let r=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=l.byteLength,total:a});for(let e=0,t=n.length;e<t;e++){let t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(l),t()}},t=>{e.error(t)})}()}}))}throw new lH('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),n=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{lO.add("file:".concat(e),t);let n=lB[e];delete lB[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let n=lB[e];if(void 0===n)throw this.manager.itemError(e),t;delete lB[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}}class lG extends lz{load(e,t,n,r){let i=this,a=new lV(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)}parse(e){let t=[];for(let n=0;n<e.length;n++){let r=lU.parse(e[n]);t.push(r)}return t}constructor(e){super(e)}}class lW extends lz{load(e,t,n,r){let i=this,a=[],s=new s3,o=new lV(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(i.withCredentials);let l=0;if(Array.isArray(e))for(let u=0,c=e.length;u<c;++u)!function(u){o.load(e[u],function(e){let 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&&(s.minFilter=eD),s.image=a,s.format=n.format,s.needsUpdate=!0,t&&t(s))},n,r)}(u);else o.load(e,function(e){let n=i.parse(e,!0);if(n.isCubemap){let e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){a[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)a[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),a[t].format=n.format,a[t].width=n.width,a[t].height=n.height}s.image=a}else s.image.width=n.width,s.image.height=n.height,s.mipmaps=n.mipmaps;1===n.mipmapCount&&(s.minFilter=eD),s.format=n.format,s.needsUpdate=!0,t&&t(s)},n,r);return s}constructor(e){super(e)}}let lj=new WeakMap;class lX extends lz{load(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=lO.get("image:".concat(e));if(void 0!==a){if(!0===a.complete)i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0);else{let e=lj.get(a);void 0===e&&(e=[],lj.set(a,e)),e.push({onLoad:t,onError:r})}return a}let s=n0("img");function o(){u(),t&&t(this);let n=lj.get(this)||[];for(let e=0;e<n.length;e++){let t=n[e];t.onLoad&&t.onLoad(this)}lj.delete(this),i.manager.itemEnd(e)}function l(t){u(),r&&r(t),lO.remove("image:".concat(e));let n=lj.get(this)||[];for(let e=0;e<n.length;e++){let r=n[e];r.onError&&r.onError(t)}lj.delete(this),i.manager.itemError(e),i.manager.itemEnd(e)}function u(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),lO.add("image:".concat(e),s),i.manager.itemStart(e),s.src=e,s}constructor(e){super(e)}}class lq extends lz{load(e,t,n,r){let i=new ag;i.colorSpace=t$;let a=new lX(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;for(let n=0;n<e.length;++n)!function(n){a.load(e[n],function(e){i.images[n]=e,6==++s&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}(n);return i}constructor(e){super(e)}}class lY extends lz{load(e,t,n,r){let i=this,a=new a2,s=new lV(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(i.withCredentials),s.load(e,function(e){let n;try{n=i.parse(e)}catch(e){if(void 0===r)return void console.error(e);r(e)}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:eA,a.wrapT=void 0!==n.wrapT?n.wrapT:eA,a.magFilter=void 0!==n.magFilter?n.magFilter:eD,a.minFilter=void 0!==n.minFilter?n.minFilter:eD,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(a.colorSpace=n.colorSpace),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=eF),1===n.mipmapCount&&(a.minFilter=eD),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,r),a}constructor(e){super(e)}}class lJ extends lz{load(e,t,n,r){let i=new rs,a=new lX(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}constructor(e){super(e)}}class lZ extends ia{dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(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()),void 0!==this.target&&(t.object.target=this.target.uuid),t}constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new iE(e),this.intensity=t}}class lK extends lZ{copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.groundColor=new iE(t)}}let l$=new rH,lQ=new nX,l0=new nX;class l1{getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;lQ.setFromMatrixPosition(e.matrixWorld),t.position.copy(lQ),l0.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(l0),t.updateMatrixWorld(),l$.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(l$,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(l$)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 1!==this.intensity&&(e.intensity=this.intensity),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}constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new nW(512,512),this.mapType=ez,this.map=null,this.mapPass=null,this.matrix=new rH,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new sd,this._frameExtents=new nW(1,1),this._viewportCount=1,this._viewports=[new ro(0,0,1,1)]}}class l2 extends l1{updateMatrices(e){let t=this.camera,n=2*nO*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}constructor(){super(new af(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}}class l3 extends lZ{get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.target=new ia,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new l2}}let l4=new rH,l5=new nX,l6=new nX;class l8 extends l1{updateMatrices(e){let 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()),l5.setFromMatrixPosition(e.matrixWorld),n.position.copy(l5),l6.copy(n.position),l6.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(l6),n.updateMatrixWorld(),r.makeTranslation(-l5.x,-l5.y,-l5.z),l4.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(l4,n.coordinateSystem,n.reversedDepth)}constructor(){super(new af(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new nW(4,2),this._viewportCount=6,this._viewports=[new ro(2,1,1,1),new ro(0,1,1,1),new ro(3,1,1,1),new ro(1,1,1,1),new ro(3,0,1,1),new ro(1,0,1,1)],this._cubeDirections=[new nX(1,0,0),new nX(-1,0,0),new nX(0,0,1),new nX(0,0,-1),new nX(0,1,0),new nX(0,-1,0)],this._cubeUps=[new nX(0,1,0),new nX(0,1,0),new nX(0,1,0),new nX(0,1,0),new nX(0,0,1),new nX(0,0,-1)]}}class l9 extends lZ{get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new l8}}class l7 extends ac{copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(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()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let 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,s=r+t,o=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}}class ue extends l1{constructor(){super(new l7(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ut extends lZ{dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.target=new ia,this.shadow=new ue}}class un extends lZ{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class ur extends lZ{get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}}class ui{set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let 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}getIrradianceAt(e,t){let 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}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){let 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)}constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new nX)}}class ua extends lZ{copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}constructor(e=new ui,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}}class us extends lz{load(e,t,n,r){let i=this,a=new lV(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)}parse(e){let t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}let r=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=e.sheen),void 0!==e.sheenColor&&(r.sheenColor=new iE().setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(r.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.specularIntensity&&(r.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(r.dispersion=e.dispersion),void 0!==e.iridescence&&(r.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(r.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.thickness&&(r.thickness=e.thickness),void 0!==e.attenuationDistance&&(r.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(r.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(r.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.shadowSide&&(r.shadowSide=e.shadowSide),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(r.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(r.depthFunc=e.depthFunc),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(r.blendSrc=e.blendSrc),void 0!==e.blendDst&&(r.blendDst=e.blendDst),void 0!==e.blendEquation&&(r.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(r.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(r.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(r.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==r.blendColor&&r.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(r.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),void 0!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.alphaToCoverage&&(r.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(r.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(r.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(let t in e.uniforms){let i=e.uniforms[t];switch(r.uniforms[t]={},i.type){case"t":r.uniforms[t].value=n(i.value);break;case"c":r.uniforms[t].value=new iE().setHex(i.value);break;case"v2":r.uniforms[t].value=new nW().fromArray(i.value);break;case"v3":r.uniforms[t].value=new nX().fromArray(i.value);break;case"v4":r.uniforms[t].value=new ro().fromArray(i.value);break;case"m3":r.uniforms[t].value=new nJ().fromArray(i.value);break;case"m4":r.uniforms[t].value=new rH().fromArray(i.value);break;default:r.uniforms[t].value=i.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(r.glslVersion=e.glslVersion),void 0!==e.extensions)for(let t in e.extensions)r.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(r.lights=e.lights),void 0!==e.clipping&&(r.clipping=e.clipping),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),r.normalScale=new nW().fromArray(t)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(r.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(r.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapRotation&&r.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=new nW().fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(r.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(r.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(r.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(r.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(r.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return us.createMaterialFromType(e)}static createMaterialFromType(e){return new({ShadowMaterial:la,SpriteMaterial:aA,RawShaderMaterial:ls,ShaderMaterial:au,PointsMaterial:sq,MeshPhysicalMaterial:ll,MeshStandardMaterial:lo,MeshPhongMaterial:lu,MeshToonMaterial:lc,MeshNormalMaterial:lh,MeshLambertMaterial:ld,MeshDepthMaterial:lp,MeshDistanceMaterial:lf,MeshBasicMaterial:iR,MeshMatcapMaterial:lm,LineDashedMaterial:lg,LineBasicMaterial:sN,Material:iC})[e]}constructor(e){super(e),this.textures={}}}class uo{static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(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}}class ul extends i0{copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}}class uu extends lz{load(e,t,n,r){let i=this,a=new lV(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)}parse(e){let t={},n={};function r(e,r){if(void 0!==t[r])return t[r];let i=e.interleavedBuffers[r],a=function(e,t){if(void 0!==n[t])return n[t];let r=new Uint32Array(e.arrayBuffers[t]).buffer;return n[t]=r,r}(e,i.buffer),s=new aw(nQ(i.type,a),i.stride);return s.uuid=i.uuid,t[r]=s,s}let i=e.isInstancedBufferGeometry?new ul:new i0,a=e.data.index;if(void 0!==a){let e=nQ(a.type,a.array);i.setIndex(new iF(e,1))}let s=e.data.attributes;for(let t in s){let n,a=s[t];if(a.isInterleavedBufferAttribute)n=new aT(r(e.data,a.data),a.itemSize,a.offset,a.normalized);else{let e=nQ(a.type,a.array);n=new(a.isInstancedBufferAttribute?a6:iF)(e,a.itemSize,a.normalized)}void 0!==a.name&&(n.name=a.name),void 0!==a.usage&&n.setUsage(a.usage),i.setAttribute(t,n)}let o=e.data.morphAttributes;if(o)for(let t in o){let n=o[t],a=[];for(let t=0,i=n.length;t<i;t++){let i,s=n[t];i=s.isInterleavedBufferAttribute?new aT(r(e.data,s.data),s.itemSize,s.offset,s.normalized):new iF(nQ(s.type,s.array),s.itemSize,s.normalized),void 0!==s.name&&(i.name=s.name),a.push(i)}i.morphAttributes[t]=a}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);let l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){let t=l[e];i.addGroup(t.start,t.count,t.materialIndex)}let u=e.data.boundingSphere;return void 0!==u&&(i.boundingSphere=new rL().fromJSON(u)),e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}constructor(e){super(e)}}class uc extends lz{load(e,t,n,r){let i=this,a=""===this.path?uo.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;let s=new lV(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){let a=null;try{a=JSON.parse(n)}catch(t){void 0!==r&&r(t),console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message);return}let s=a.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase()){void 0!==r&&r(Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}i.parse(a,t)},n,r)}async loadAsync(e,t){let n=""===this.path?uo.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;let r=new lV(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);let i=JSON.parse(await r.loadAsync(e,t)),a=i.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(i)}parse(e,t){let 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)}),s=this.parseTextures(e.textures,a),o=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,i,o,s,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),this.bindLightTargets(l),void 0!==t){let e=!1;for(let t in a)if(a[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){let t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,n),i=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,i),s=this.parseMaterials(e.materials,a),o=this.parseObject(e.object,r,s,a,t),l=this.parseSkeletons(e.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}parseShapes(e){let t={};if(void 0!==e)for(let n=0,r=e.length;n<r;n++){let r=new oL().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){let n={},r={};if(t.traverse(function(e){e.isBone&&(r[e.uuid]=e)}),void 0!==e)for(let t=0,i=e.length;t<i;t++){let i=new a5().fromJSON(e[t],r);n[i.uuid]=i}return n}parseGeometries(e,t){let n={};if(void 0!==e){let r=new uu;for(let i=0,a=e.length;i<a;i++){let a,s=e[i];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(s);break;default:s.type in li?a=li[s.type].fromJSON(s,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(s.type,'"'))}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.userData&&(a.userData=s.userData),n[s.uuid]=a}}return n}parseMaterials(e,t){let n={},r={};if(void 0!==e){let i=new us;i.setTextures(t);for(let t=0,a=e.length;t<a;t++){let a=e[t];void 0===n[a.uuid]&&(n[a.uuid]=i.parse(a)),r[a.uuid]=n[a.uuid]}}return r}parseAnimations(e){let t={};if(void 0!==e)for(let n=0;n<e.length;n++){let r=e[n],i=lU.parse(r);t[i.uuid]=i}return t}parseImages(e,t){let n,r=this,i={};function a(e){if("string"==typeof e){var t;return t=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:r.resourcePath+e,r.manager.itemStart(t),n.load(t,function(){r.manager.itemEnd(t)},void 0,function(){r.manager.itemError(t),r.manager.itemEnd(t)})}return e.data?{data:nQ(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){(n=new lX(new lF(t))).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){let n=e[t],r=n.url;if(Array.isArray(r)){let e=[];for(let t=0,n=r.length;t<n;t++){let n=a(r[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new a2(n.data,n.width,n.height)))}i[n.uuid]=new rn(e)}else{let e=a(n.url);i[n.uuid]=new rn(e)}}}return i}async parseImagesAsync(e){let t,n=this,r={};async function i(e){if("string"==typeof e){let r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e;return await t.loadAsync(r)}return e.data?{data:nQ(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){(t=new lX(this.manager)).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){let n=e[t],a=n.url;if(Array.isArray(a)){let e=[];for(let t=0,n=a.length;t<n;t++){let n=a[t],r=await i(n);null!==r&&(r instanceof HTMLImageElement?e.push(r):e.push(new a2(r.data,r.width,r.height)))}r[n.uuid]=new rn(e)}else{let e=await i(n.url);r[n.uuid]=new rn(e)}}}return r}parseTextures(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])}let r={};if(void 0!==e)for(let i=0,a=e.length;i<a;i++){let a,s=e[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);let o=t[s.image],l=o.data;Array.isArray(l)?(a=new ag,6===l.length&&(a.needsUpdate=!0)):(a=l&&l.data?new a2:new rs,l&&(a.needsUpdate=!0)),a.source=o,a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.mapping&&(a.mapping=n(s.mapping,uh)),void 0!==s.channel&&(a.channel=s.channel),void 0!==s.offset&&a.offset.fromArray(s.offset),void 0!==s.repeat&&a.repeat.fromArray(s.repeat),void 0!==s.center&&a.center.fromArray(s.center),void 0!==s.rotation&&(a.rotation=s.rotation),void 0!==s.wrap&&(a.wrapS=n(s.wrap[0],ud),a.wrapT=n(s.wrap[1],ud)),void 0!==s.format&&(a.format=s.format),void 0!==s.internalFormat&&(a.internalFormat=s.internalFormat),void 0!==s.type&&(a.type=s.type),void 0!==s.colorSpace&&(a.colorSpace=s.colorSpace),void 0!==s.minFilter&&(a.minFilter=n(s.minFilter,up)),void 0!==s.magFilter&&(a.magFilter=n(s.magFilter,up)),void 0!==s.anisotropy&&(a.anisotropy=s.anisotropy),void 0!==s.flipY&&(a.flipY=s.flipY),void 0!==s.generateMipmaps&&(a.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(a.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(a.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(a.compareFunction=s.compareFunction),void 0!==s.userData&&(a.userData=s.userData),r[s.uuid]=a}return r}parseObject(e,t,n,r,i){let a,s,o;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)){let t=[];for(let r=0,i=e.length;r<i;r++){let i=e[r];void 0===n[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),t.push(n[i])}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 aM,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new iE(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 aS(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new ab(e.fog.color,e.fog.density)),""!==e.fog.name&&(a.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(a.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(a.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&a.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(a.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new af(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 l7(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 un(e.color,e.intensity);break;case"DirectionalLight":(a=new ut(e.color,e.intensity)).target=e.target||"";break;case"PointLight":a=new l9(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new ur(e.color,e.intensity,e.width,e.height);break;case"SpotLight":(a=new l3(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay)).target=e.target||"";break;case"HemisphereLight":a=new lK(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new ua().fromJSON(e);break;case"SkinnedMesh":a=new a0(s=l(e.geometry),o=u(e.material)),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":a=new an(s=l(e.geometry),o=u(e.material));break;case"InstancedMesh":s=l(e.geometry),o=u(e.material);let h=e.count,d=e.instanceMatrix,p=e.instanceColor;(a=new si(s,o,h)).instanceMatrix=new a6(new Float32Array(d.array),16),void 0!==p&&(a.instanceColor=new a6(new Float32Array(p.array),p.itemSize));break;case"BatchedMesh":s=l(e.geometry),o=u(e.material),(a=new sL(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,o)).geometry=s,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(e=>{let t=null,n=null;return void 0!==e.boundingBox&&(t=new rf().fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(n=new rL().fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(a._colorsTexture=c(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(a.boundingSphere=new rL().fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&(a.boundingBox=new rf().fromJSON(e.boundingBox));break;case"LOD":a=new aW;break;case"Line":a=new sH(l(e.geometry),u(e.material));break;case"LineLoop":a=new sX(l(e.geometry),u(e.material));break;case"LineSegments":a=new sj(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new s$(l(e.geometry),u(e.material));break;case"Sprite":a=new aB(u(e.material));break;case"Group":a=new ay;break;case"Bone":a=new a1;break;default:a=new ia}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.up&&a.up.fromArray(e.up),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(a.shadow.intensity=e.shadow.intensity),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){let s=e.children;for(let e=0;e<s.length;e++)a.add(this.parseObject(s[e],t,n,r,i))}if(void 0!==e.animations){let t=e.animations;for(let e=0;e<t.length;e++){let n=t[e];a.animations.push(i[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);let t=e.levels;for(let e=0;e<t.length;e++){let n=t[e],r=a.getObjectByProperty("uuid",n.object);void 0!==r&&a.addLevel(r,n.distance,n.hysteresis)}}return a}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){let n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){let n=t.target,r=e.getObjectByProperty("uuid",n);void 0!==r?t.target=r:t.target=new ia}})}constructor(e){super(e)}}let uh={UVMapping:ex,CubeReflectionMapping:eb,CubeRefractionMapping:eS,EquirectangularReflectionMapping:eM,EquirectangularRefractionMapping:ew,CubeUVReflectionMapping:eE},ud={RepeatWrapping:eT,ClampToEdgeWrapping:eA,MirroredRepeatWrapping:eC},up={NearestFilter:eR,NearestMipmapNearestFilter:eP,NearestMipmapLinearFilter:eL,LinearFilter:eD,LinearMipmapNearestFilter:eU,LinearMipmapLinearFilter:eF},uf=new WeakMap;class um extends lz{setOptions(e){return this.options=e,this}load(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=lO.get("image-bitmap:".concat(e));if(void 0!==a)return(i.manager.itemStart(e),a.then)?void a.then(n=>{if(!0!==uf.has(a))return t&&t(n),i.manager.itemEnd(e),n;r&&r(uf.get(a)),i.manager.itemError(e),i.manager.itemEnd(e)}):(setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(n){return lO.add("image-bitmap:".concat(e),n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),uf.set(o,t),lO.remove("image-bitmap:".concat(e)),i.manager.itemError(e),i.manager.itemEnd(e)});lO.add("image-bitmap:".concat(e),o),i.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}}class ug{static getContext(){return void 0===r&&(r=new(window.AudioContext||window.webkitAudioContext)),r}static setContext(e){r=e}}class uv extends lz{load(e,t,n,r){let i=this,a=new lV(this.manager);function s(t){r?r(t):console.error(t),i.manager.itemError(e)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(e){try{let n=e.slice(0);ug.getContext().decodeAudioData(n,function(e){t(e)}).catch(s)}catch(e){s(e)}},n,r)}constructor(e){super(e)}}let uy=new rH,u_=new rH,ux=new rH;class ub{update(e){let 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){let n,r;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,ux.copy(e.projectionMatrix);let i=t.eyeSep/2,a=i*t.near/t.focus,s=t.near*Math.tan(nU*t.fov*.5)/t.zoom;u_.elements[12]=-i,uy.elements[12]=i,n=-s*t.aspect+a,r=s*t.aspect+a,ux.elements[0]=2*t.near/(r-n),ux.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(ux),n=-s*t.aspect-a,r=s*t.aspect-a,ux.elements[0]=2*t.near/(r-n),ux.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(ux)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(u_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(uy)}constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new af,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new af,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}}}class uS extends af{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class uM{start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}}let uw=new nX,uE=new nj,uT=new nX,uA=new nX,uC=new nX;class uR extends ia{getInput(){return this.gain}removeFilter(){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}getFilter(){return this.filter}setFilter(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}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(uw,uE,uT),uA.set(0,0,-1).applyQuaternion(uE),uC.set(0,1,0).applyQuaternion(uE),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(uw.x,e),t.positionY.linearRampToValueAtTime(uw.y,e),t.positionZ.linearRampToValueAtTime(uw.z,e),t.forwardX.linearRampToValueAtTime(uA.x,e),t.forwardY.linearRampToValueAtTime(uA.y,e),t.forwardZ.linearRampToValueAtTime(uA.z,e),t.upX.linearRampToValueAtTime(uC.x,e),t.upY.linearRampToValueAtTime(uC.y,e),t.upZ.linearRampToValueAtTime(uC.z,e)}else t.setPosition(uw.x,uw.y,uw.z),t.setOrientation(uA.x,uA.y,uA.z,uC.x,uC.y,uC.z)}constructor(){super(),this.type="AudioListener",this.context=ug.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uM}}class uP extends ia{getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(!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)}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this)}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this)}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return(super.copy(e,t),"buffer"!==e.sourceType)?console.warn("THREE.Audio: Audio source type cannot be copied."):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice()),this}clone(e){return new this.constructor(this.listener).copy(this,e)}constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}}let uI=new nX,uL=new nj,uN=new nX,uD=new nX;class uU extends uP{connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(uI,uL,uN),uD.set(0,0,1).applyQuaternion(uL);let t=this.panner;if(t.positionX){let e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(uI.x,e),t.positionY.linearRampToValueAtTime(uI.y,e),t.positionZ.linearRampToValueAtTime(uI.z,e),t.orientationX.linearRampToValueAtTime(uD.x,e),t.orientationY.linearRampToValueAtTime(uD.y,e),t.orientationZ.linearRampToValueAtTime(uD.z,e)}else t.setPosition(uI.x,uI.y,uI.z),t.setOrientation(uD.x,uD.y,uD.z)}constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}}class uO{getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}}class uF{accumulate(e,t){let n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(let e=0;e!==r;++e)n[i+e]=n[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(n,i,0,e,r)}this.cumulativeWeight=a}accumulateAdditive(e){let 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}apply(e){let t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){let e=t*this._origIndex;this._mixBufferRegion(n,r,e,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){s.setValue(n,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n;e!==r;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,r,i){if(r>=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]}_slerp(e,t,n,r){nj.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,i){let a=this._workIndex*i;nj.multiplyQuaternionsFlat(e,a,e,t,e,n),nj.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,i){let a=1-r;for(let s=0;s!==i;++s){let i=t+s;e[i]=e[i]*a+e[n+s]*r}}_lerpAdditive(e,t,n,r,i){for(let a=0;a!==i;++a){let i=t+a;e[i]=e[i]+e[n+a]*r}}constructor(e,t,n){let r,i,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}}let uk="\\[\\]\\.:\\/",uz=RegExp("["+uk+"]","g"),uB="[^"+uk+"]",uH="[^"+uk.replace("\\.","")+"]",uV=/((?:WC+[\/:])*)/.source.replace("WC",uB),uG=/(WCOD+)?/.source.replace("WCOD",uH),uW=RegExp("^"+uV+uG+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uB)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uB)+"$"),uj=["material","materials","bones","map"];class uX{static create(e,t,n){return e&&e.isAnimationObjectGroup?new uX.Composite(e,t,n):new uX(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uz,"")}static parseTrackName(e){let t=uW.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let 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){let e=n.nodeName.substring(r+1);-1!==uj.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=uX.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let r=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==r){if(void 0===e[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[r]}}let a=e[r];if(void 0===a)return void console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+r+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,!0===e.isMaterial?s=this.Versioning.NeedsUpdate:!0===e.isObject3D&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=i}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}constructor(e,t,n){this.path=t,this.parsedPath=n||uX.parseTrackName(t),this.node=uX.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}uX.Composite=class{getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}constructor(e,t,n){let r=n||uX.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}},uX.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},uX.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},uX.prototype.GetterByBindingType=[uX.prototype._getValue_direct,uX.prototype._getValue_array,uX.prototype._getValue_arrayElement,uX.prototype._getValue_toArray],uX.prototype.SetterByBindingTypeAndVersioning=[[uX.prototype._setValue_direct,uX.prototype._setValue_direct_setNeedsUpdate,uX.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[uX.prototype._setValue_array,uX.prototype._setValue_array_setNeedsUpdate,uX.prototype._setValue_array_setMatrixWorldNeedsUpdate],[uX.prototype._setValue_arrayElement,uX.prototype._setValue_arrayElement_setNeedsUpdate,uX.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[uX.prototype._setValue_fromArray,uX.prototype._setValue_fromArray_setNeedsUpdate,uX.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class uq{add(){let e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,s,o=e.length,l=this.nCachedObjects_;for(let u=0,c=arguments.length;u!==c;++u){let c=arguments[u],h=c.uuid,d=t[h];if(void 0===d){d=o++,t[h]=d,e.push(c);for(let e=0;e!==a;++e)i[e].push(new uX(c,n[e],r[e]))}else if(d<l){s=e[d];let o=--l,u=e[o];t[u.uuid]=d,e[d]=u,t[h]=o,e[o]=c;for(let e=0;e!==a;++e){let t=i[e],a=t[o],s=t[d];t[d]=a,void 0===s&&(s=new uX(c,n[e],r[e])),t[o]=s}}else e[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_;for(let a=0,s=arguments.length;a!==s;++a){let s=arguments[a],o=s.uuid,l=t[o];if(void 0!==l&&l>=i){let a=i++,u=e[a];t[u.uuid]=l,e[l]=u,t[o]=a,e[a]=s;for(let e=0;e!==r;++e){let t=n[e],r=t[a],i=t[l];t[l]=r,t[a]=i}}}this.nCachedObjects_=i}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){let o=arguments[s],l=o.uuid,u=t[l];if(void 0!==u)if(delete t[l],u<i){let s=--i,o=e[s],l=--a,c=e[l];t[o.uuid]=u,e[u]=o,t[c.uuid]=s,e[s]=c,e.pop();for(let e=0;e!==r;++e){let t=n[e],r=t[s],i=t[l];t[u]=r,t[s]=i,t.pop()}}else{let i=--a,s=e[i];i>0&&(t[s.uuid]=u),e[u]=s,e.pop();for(let e=0;e!==r;++e){let t=n[e];t[u]=t[i],t.pop()}}}this.nCachedObjects_=i}subscribe_(e,t){let n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];let a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,c=Array(l);r=i.length,n[e]=r,a.push(e),s.push(t),i.push(c);for(let n=u,r=o.length;n!==r;++n){let r=o[n];c[n]=new uX(r,e,t)}return c}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){let r=this._paths,i=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=n,a[n]=o,a.pop(),i[n]=i[s],i.pop(),r[n]=r[s],r.pop()}}constructor(){this.isAnimationObjectGroup=!0,this.uuid=nF(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}}class uY{play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.fadeOut(t),this.fadeIn(t),!0===n){let n=this._clip.duration,r=e._clip.duration;e.warp(1,r/n,t),this.warp(n/r,1,t)}return this}crossFadeTo(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let r=this._mixer,i=r.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=i,o[1]=i+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled)return void this._updateWeight(e);let i=this._startTime;if(null!==i){let r=(e-i)*n;r<0||0===n?t=0:(this._startTime=null,t=n*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(this.blendMode===tH)for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulateAdditive(s);else for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulate(r,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(null!==n){let r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let 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}_updateTime(e){let t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===tN;if(0===e)return -1===i?r:a&&(1&i)==1?t-r:r;if(n===tI){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));s:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break s}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){let n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);let 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){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(a&&(1&i)==1)return t-r}return r}_setEndings(e,t,n){let r=this._interpolantSettings;n?(r.endingStart=tk,r.endingEnd=tk):(e?r.endingStart=this.zeroSlopeAtStart?tk:tF:r.endingStart=tz,t?r.endingEnd=this.zeroSlopeAtEnd?tk:tF:r.endingEnd=tz)}_scheduleFading(e,t,n){let r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=i,o[0]=t,s[1]=i+e,o[1]=n,this}constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;let i=t.tracks,a=i.length,s=Array(a),o={endingStart:tF,endingEnd:tF};for(let e=0;e!==a;++e){let t=i[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=tL,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}}let uJ=new Float32Array(1);class uZ extends nL{_bindAction(e,t){let n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,s=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName,u=l[o];void 0===u&&(u={},l[o]=u);for(let e=0;e!==i;++e){let i=r[e],l=i.name,c=u[l];if(void 0!==c)++c.referenceCount,a[e]=c;else{if(void 0!==(c=a[e])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;c=new uF(uX.create(n,l,r),i.ValueTypeName,i.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[e]=c}s[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let 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)}let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){let r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;let i=e._clip.uuid,a=this._actionsByClip,s=a[i],o=s.knownActions,l=o[o.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,o[u]=l,o.pop(),e._byClipCacheIndex=null;let c=s.actionByRoot,h=(e._localRoot||this._root).uuid;delete c[h],0===o.length&&delete a[i],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_addInactiveBinding(e,t,n){let 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)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,s=a[r],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[i],0===Object.keys(s).length&&delete a[r]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new lE(new Float32Array(2),new Float32Array(2),1,uJ)).__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i}clipAction(e,t,n){let r=t||this._root,i=r.uuid,a="string"==typeof e?lU.findByName(r,e):e,s=null!==a?a.uuid:e,o=this._actionsByClip[s],l=null;if(void 0===n&&(n=null!==a?a.blendMode:tB),void 0!==o){let e=o.actionByRoot[i];if(void 0!==e&&e.blendMode===n)return e;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;let u=new uY(this,a,t,n);return this._bindAction(u,l),this._addInactiveAction(u,s,i),u}existingAction(e,t){let n=t||this._root,r=n.uuid,i="string"==typeof e?lU.findByName(n,e):e,a=i?i.uuid:e,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[r]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==n;++s)t[s]._update(r,e,i,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){let e=i.knownActions;for(let n=0,r=e.length;n!==r;++n){let r=e[n];this._deactivateAction(r);let i=r._cacheIndex,a=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,a._cacheIndex=i,t[i]=a,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let e in n){let r=n[e].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}let r=this._bindingsByRootAndName[t];if(void 0!==r)for(let e in r){let t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}}class uK extends rl{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isRenderTarget3D=!0,this.depth=n,this.texture=new rd(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class u${clone(){return new u$(void 0===this.value.clone?this.value:this.value.clone())}constructor(e){this.value=e}}let uQ=0;class u0 extends nL{add(e){return this.uniforms.push(e),this}remove(e){let t=this.uniforms.indexOf(e);return -1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;let t=e.uniforms;this.uniforms.length=0;for(let e=0,n=t.length;e<n;e++){let n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<n.length;e++)this.uniforms.push(n[e].clone())}return this}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:uQ++}),this.name="",this.usage=ng,this.uniforms=[]}}class u1 extends aw{copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}}class u2{set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}constructor(e,t,n,r,i,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=i,this.normalized=a,this.version=0}}let u3=new rH;class u4{set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return u3.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(u3),this}intersectObject(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return u6(e,this,n,t),n.sort(u5),n}intersectObjects(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let r=0,i=e.length;r<i;r++)u6(e[r],this,n,t);return n.sort(u5),n}constructor(e,t,n=0,r=1/0){this.ray=new rB(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new r$,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}}function u5(e,t){return e.distance-t.distance}function u6(e,t,n,r){let i=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,n)&&(i=!1),!0===i&&!0===r){let r=e.children;for(let e=0,i=r.length;e<i;e++)u6(r[e],t,n,!0)}}class u8{connect(e){this._document=e,void 0!==e.hidden&&(this._pageVisibilityHandler=u9.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==e?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}}function u9(){!1===this._document.hidden&&this.reset()}class u7{set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=nk(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(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(nk(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}}class ce{set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}}class ct{identity(){return this.set(1,0,0,1),this}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}constructor(e,t,n,r){ct.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,r)}}let cn=new nW;class cr{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=cn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=Infinity,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,cn).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}constructor(e=new nW(Infinity,Infinity),t=new nW(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}}let ci=new nX,ca=new nX,cs=new nX,co=new nX,cl=new nX,cu=new nX,cc=new nX;class ch{set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ci.subVectors(e,this.start),ca.subVectors(this.end,this.start);let n=ca.dot(ca),r=ca.dot(ci)/n;return t&&(r=nk(r,0,1)),r}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cu,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:cc,a=1e-8*1e-8,s=this.start,o=e.start,l=this.end,u=e.end;cs.subVectors(l,s),co.subVectors(u,o),cl.subVectors(s,o);let c=cs.dot(cs),h=co.dot(co),d=co.dot(cl);if(c<=a&&h<=a)return r.copy(s),i.copy(o),r.sub(i),r.dot(r);if(c<=a)t=0,n=nk(n=d/h,0,1);else{let e=cs.dot(cl);if(h<=a)n=0,t=nk(-e/c,0,1);else{let r=cs.dot(co),i=c*h-r*r;t=0!==i?nk((r*d-e*h)/i,0,1):0,(n=(r*t+d)/h)<0?(n=0,t=nk(-e/c,0,1)):n>1&&(n=1,t=nk((r-e)/c,0,1))}}return r.copy(s).add(cs.multiplyScalar(t)),i.copy(o).add(co.multiplyScalar(n)),r.sub(i),r.dot(r)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}constructor(e=new nX,t=new nX){this.start=e,this.end=t}}let cd=new nX;class cp extends ia{dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),cd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(cd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let n=new i0,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){let n=e/32*Math.PI*2,i=t/32*Math.PI*2;r.push(Math.cos(n),Math.sin(n),1,Math.cos(i),Math.sin(i),1)}n.setAttribute("position",new iX(r,3));let i=new sN({fog:!1,toneMapped:!1});this.cone=new sj(n,i),this.add(this.cone),this.update()}}let cf=new nX,cm=new rH,cg=new rH;class cv extends sj{updateMatrixWorld(e){let t=this.bones,n=this.geometry,r=n.getAttribute("position");cg.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){let i=t[e];i.parent&&i.parent.isBone&&(cm.multiplyMatrices(cg,i.matrixWorld),cf.setFromMatrixPosition(cm),r.setXYZ(n,cf.x,cf.y,cf.z),cm.multiplyMatrices(cg,i.parent.matrixWorld),cf.setFromMatrixPosition(cm),r.setXYZ(n+1,cf.x,cf.y,cf.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){let n=this.geometry.getAttribute("color");for(let r=0;r<n.count;r+=2)n.setXYZ(r,e.r,e.g,e.b),n.setXYZ(r+1,t.r,t.g,t.b);return n.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e){let t=function e(t){let n=[];!0===t.isBone&&n.push(t);for(let r=0;r<t.children.length;r++)n.push(...e(t.children[r]));return n}(e),n=new i0,r=[],i=[];for(let e=0;e<t.length;e++){let n=t[e];n.parent&&n.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(0,0,0),i.push(0,0,0))}n.setAttribute("position",new iX(r,3)),n.setAttribute("color",new iX(i,3)),super(n,new sN({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;let a=new iE(255),s=new iE(65280);this.setColors(a,s)}}class cy extends an{dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}constructor(e,t,n){super(new o8(t,4,2),new iR({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}}let c_=new nX,cx=new iE,cb=new iE;class cS extends ia{dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{let t=e.geometry.getAttribute("color");cx.copy(this.light.color),cb.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){let r=e<n/2?cx:cb;t.setXYZ(e,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(c_.setFromMatrixPosition(this.light.matrixWorld).negate())}constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";let r=new o3(t);r.rotateY(.5*Math.PI),this.material=new iR({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);let i=new Float32Array(3*r.getAttribute("position").count);r.setAttribute("color",new iF(i,3)),this.add(new an(r,this.material)),this.update()}}class cM extends sj{dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=10,t=10,n=4473924,r=8947848){n=new iE(n),r=new iE(r);let i=t/2,a=e/t,s=e/2,o=[],l=[];for(let e=0,u=0,c=-s;e<=t;e++,c+=a){o.push(-s,0,c,s,0,c),o.push(c,0,-s,c,0,s);let t=e===i?n:r;t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3}let u=new i0;u.setAttribute("position",new iX(o,3)),u.setAttribute("color",new iX(l,3)),super(u,new sN({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class cw extends sj{dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=10,t=16,n=8,r=64,i=4473924,a=8947848){i=new iE(i),a=new iE(a);let s=[],o=[];if(t>1)for(let n=0;n<t;n++){let r=n/t*(2*Math.PI),l=Math.sin(r)*e,u=Math.cos(r)*e;s.push(0,0,0),s.push(l,0,u);let c=1&n?i:a;o.push(c.r,c.g,c.b),o.push(c.r,c.g,c.b)}for(let t=0;t<n;t++){let l=1&t?i:a,u=e-e/n*t;for(let e=0;e<r;e++){let t=e/r*(2*Math.PI),n=Math.sin(t)*u,i=Math.cos(t)*u;s.push(n,0,i),o.push(l.r,l.g,l.b),n=Math.sin(t=(e+1)/r*(2*Math.PI))*u,i=Math.cos(t)*u,s.push(n,0,i),o.push(l.r,l.g,l.b)}}let l=new i0;l.setAttribute("position",new iX(s,3)),l.setAttribute("color",new iX(o,3)),super(l,new sN({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}let cE=new nX,cT=new nX,cA=new nX;class cC extends ia{dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),cE.setFromMatrixPosition(this.light.matrixWorld),cT.setFromMatrixPosition(this.light.target.matrixWorld),cA.subVectors(cT,cE),this.lightPlane.lookAt(cT),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(cT),this.targetLine.scale.z=cA.length()}constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===t&&(t=1);let r=new i0;r.setAttribute("position",new iX([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let i=new sN({fog:!1,toneMapped:!1});this.lightPlane=new sH(r,i),this.add(this.lightPlane),(r=new i0).setAttribute("position",new iX([0,0,0,0,0,1],3)),this.targetLine=new sH(r,i),this.add(this.targetLine),this.update()}}let cR=new nX,cP=new ac;class cI extends sj{setColors(e,t,n,r,i){let a=this.geometry.getAttribute("color");return 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,this}update(){let e,t,n=this.geometry,r=this.pointMap;if(cP.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),!0===this.camera.reversedDepth)e=1,t=0;else if(this.camera.coordinateSystem===nA)e=-1,t=1;else if(this.camera.coordinateSystem===nC)e=0,t=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);cL("c",r,n,cP,0,0,e),cL("t",r,n,cP,0,0,t),cL("n1",r,n,cP,-1,-1,e),cL("n2",r,n,cP,1,-1,e),cL("n3",r,n,cP,-1,1,e),cL("n4",r,n,cP,1,1,e),cL("f1",r,n,cP,-1,-1,t),cL("f2",r,n,cP,1,-1,t),cL("f3",r,n,cP,-1,1,t),cL("f4",r,n,cP,1,1,t),cL("u1",r,n,cP,.7,1.1,e),cL("u2",r,n,cP,-.7,1.1,e),cL("u3",r,n,cP,0,2,e),cL("cf1",r,n,cP,-1,0,t),cL("cf2",r,n,cP,1,0,t),cL("cf3",r,n,cP,0,-1,t),cL("cf4",r,n,cP,0,1,t),cL("cn1",r,n,cP,-1,0,e),cL("cn2",r,n,cP,1,0,e),cL("cn3",r,n,cP,0,-1,e),cL("cn4",r,n,cP,0,1,e),n.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e){let t=new i0,n=new sN({color:0xffffff,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={};function s(e,t){o(e),o(t)}function o(e){r.push(0,0,0),i.push(0,0,0),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}s("n1","n2"),s("n2","n4"),s("n4","n3"),s("n3","n1"),s("f1","f2"),s("f2","f4"),s("f4","f3"),s("f3","f1"),s("n1","f1"),s("n2","f2"),s("n3","f3"),s("n4","f4"),s("p","n1"),s("p","n2"),s("p","n3"),s("p","n4"),s("u1","u2"),s("u2","u3"),s("u3","u1"),s("c","t"),s("p","c"),s("cn1","cn2"),s("cn3","cn4"),s("cf1","cf2"),s("cf3","cf4"),t.setAttribute("position",new iX(r,3)),t.setAttribute("color",new iX(i,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();let l=new iE(0xffaa00),u=new iE(0xff0000),c=new iE(43775),h=new iE(0xffffff),d=new iE(3355443);this.setColors(l,u,c,h,d)}}function cL(e,t,n,r,i,a,s){cR.set(i,a,s).unproject(r);let o=t[e];if(void 0!==o){let e=n.getAttribute("position");for(let t=0,n=o.length;t<n;t++)e.setXYZ(o[t],cR.x,cR.y,cR.z)}}let cN=new rf;class cD extends sj{update(){if(void 0!==this.object&&cN.setFromObject(this.object),cN.isEmpty())return;let e=cN.min,t=cN.max,n=this.geometry.attributes.position,r=n.array;r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=e.x,r[4]=t.y,r[5]=t.z,r[6]=e.x,r[7]=e.y,r[8]=t.z,r[9]=t.x,r[10]=e.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=e.z,r[15]=e.x,r[16]=t.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=t.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e,t=0xffff00){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new i0;i.setIndex(new iF(n,1)),i.setAttribute("position",new iF(r,3)),super(i,new sN({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}}class cU extends sj{updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e,t=0xffff00){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new i0;r.setIndex(new iF(n,1)),r.setAttribute("position",new iX([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new sN({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}}class cO extends sH{updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}constructor(e,t=1,n=0xffff00){let r=new i0;r.setAttribute("position",new iX([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new sN({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;let i=new i0;i.setAttribute("position",new iX([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),i.computeBoundingSphere(),this.add(new an(i,new iR({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}}let cF=new nX;class ck extends ia{setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{cF.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(cF,t)}}setLength(e){let 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()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}constructor(e=new nX(0,0,1),t=new nX(0,0,0),n=1,r=0xffff00,s=.2*n,o=.2*s){super(),this.type="ArrowHelper",void 0===i&&((i=new i0).setAttribute("position",new iX([0,0,0,0,1,0],3)),(a=new on(.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new sH(i,new sN({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new an(a,new iR({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}}class cz extends sj{setColors(e,t,n){let r=new iE,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}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=1){let t=new i0;t.setAttribute("position",new iX([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],3)),t.setAttribute("color",new iX([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(t,new sN({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}class cB{moveTo(e,t){return this.currentPath=new oI,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){let t,n,r,i,a,s=oZ.isClockWise,o=this.subPaths;if(0===o.length)return[];let l=[];if(1===o.length)return n=o[0],(r=new oL).curves=n.curves,l.push(r),l;let u=!s(o[0].getPoints());u=e?!u:u;let c=[],h=[],d=[],p=0;h[0]=void 0,d[p]=[];for(let r=0,a=o.length;r<a;r++)t=s(i=(n=o[r]).getPoints()),(t=e?!t:t)?(!u&&h[p]&&p++,h[p]={s:new oL,p:i},h[p].s.curves=n.curves,u&&p++,d[p]=[]):d[p].push({h:n,p:i[0]});if(!h[0])return function(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n],i=new oL;i.curves=r.curves,t.push(i)}return t}(o);if(h.length>1){let e=!1,t=0;for(let e=0,t=h.length;e<t;e++)c[e]=[];for(let n=0,r=h.length;n<r;n++){let r=d[n];for(let i=0;i<r.length;i++){let a=r[i],s=!0;for(let r=0;r<h.length;r++)(function(e,t){let n=t.length,r=!1;for(let i=n-1,a=0;a<n;i=a++){let n=t[i],s=t[a],o=s.x-n.x,l=s.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[a],o=-o,s=t[i],l=-l),e.y<n.y||e.y>s.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{let t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(s.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=s.x)return!0}}return r})(a.p,h[r].p)&&(n!==r&&t++,s?(s=!1,c[r].push(a)):e=!0);s&&c[n].push(a)}}t>0&&!1===e&&(d=c)}for(let e=0,t=h.length;e<t;e++){r=h[e].s,l.push(r),a=d[e];for(let e=0,t=a.length;e<t;e++)r.holes.push(a[e].h)}return l}constructor(){this.type="ShapePath",this.color=new iE,this.subPaths=[],this.currentPath=null}}class cH extends nL{connect(e){if(void 0===e)return void console.warn("THREE.Controls: connect() now requires an element.");null!==this.domElement&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}}function cV(e,t,n,r){let i=function(e){switch(e){case ez:case eB:return{byteLength:1,components:1};case eV:case eH:case eX:return{byteLength:2,components:1};case eq:case eY:return{byteLength:2,components:4};case eW:case eG:case ej:return{byteLength:4,components:1};case eZ:case eK:return{byteLength:4,components:3}}throw Error("Unknown texture type ".concat(e,"."))}(r);switch(n){case e$:return e*t;case e3:case e4:return e*t/i.components*i.byteLength;case e5:case e6:return e*t*2/i.components*i.byteLength;case eQ:return e*t*3/i.components*i.byteLength;case e0:case e9:return e*t*4/i.components*i.byteLength;case e7:case te:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case tt:case tn:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case ti:case ts:return Math.max(e,16)*Math.max(t,8)/4;case tr:case ta:return Math.max(e,8)*Math.max(t,8)/2;case to:case tl:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case tu:case tc:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case th:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case td:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case tp:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case tf:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case tm:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case tg:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case tv:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case ty:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case t_:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case tx:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case tb:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case tS:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case tM:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case tw:case tE:case tT:return Math.ceil(e/4)*Math.ceil(t/4)*16;case tA:case tC:return Math.ceil(e/4)*Math.ceil(t/4)*8;case tR:case tP:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error("Unable to determine texture byte length for ".concat(n," format."))}class cG{static contain(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}static cover(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}static fill(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}static getByteLength(e,t,n,r){return cV(e,t,n,r)}}function cW(){let 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 cj(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){let e=t.get(n);(!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version});return}let i=t.get(n);if(void 0===i)t.set(n,function(t,n){let r,i=t.array,a=t.usage,s=i.byteLength,o=e.createBuffer();if(e.bindBuffer(n,o),e.bufferData(n,i,a),t.onUploadCallback(),i instanceof Float32Array)r=e.FLOAT;else if("undefined"!=typeof Float16Array&&i instanceof Float16Array)r=e.HALF_FLOAT;else if(i instanceof Uint16Array)r=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)r=e.SHORT;else if(i instanceof Uint32Array)r=e.UNSIGNED_INT;else if(i instanceof Int32Array)r=e.INT;else if(i instanceof Int8Array)r=e.BYTE;else if(i instanceof Uint8Array)r=e.UNSIGNED_BYTE;else if(i instanceof Uint8ClampedArray)r=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);return{buffer:o,type:r,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:s}}(n,r));else if(i.version<n.version){if(i.size!==n.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,n,r){let i=n.array,a=n.updateRanges;if(e.bindBuffer(r,t),0===a.length)e.bufferSubData(r,0,i);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let n=a[t],r=a[e];r.start<=n.start+n.count+1?n.count=Math.max(n.count,r.start+r.count-n.start):a[++t]=r}a.length=t+1;for(let t=0,n=a.length;t<n;t++){let n=a[t];e.bufferSubData(r,n.start*i.BYTES_PER_ELEMENT,i,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(i.buffer,n,r),i.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:p}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=p),e.s(["PMREMGenerator",()=>ha,"ShaderChunk",()=>cX,"ShaderLib",()=>cY,"UniformsLib",()=>cq,"WebGLRenderer",()=>d2,"WebGLUtils",()=>dJ],8560);let cX={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return 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 vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.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 const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform 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 vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",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 vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\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 material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\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 float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return 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 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return 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 vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return 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 vec2 fab = DFGApprox( normal, viewDir, roughness );\n return 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 vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return 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 return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform 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 #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n float depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n #ifdef USE_REVERSED_DEPTH_BUFFER\n return step( depth, compare );\n #else\n return step( compare, depth );\n #endif\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( distribution.x, compare );\n #else\n float hard_shadow = step( compare, distribution.x );\n #endif\n if ( hard_shadow != 1.0 ) {\n float distance = compare - distribution.x;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n shadow = (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\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 #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_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 return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\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 #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform 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 <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\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 #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = 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 <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\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 vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #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 <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\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 <alphahash_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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - 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 <alphahash_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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\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 #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying 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 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #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>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #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 <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #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 <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #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 #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #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 <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},cq={common:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new nJ},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new nJ}},envmap:{envMap:{value:null},envMapRotation:{value:new nJ},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new nJ}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new nJ}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new nJ},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new nJ},normalScale:{value:new nW(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new nJ},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new nJ}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new nJ}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new nJ}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new iE(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0},uvTransform:{value:new nJ}},sprite:{diffuse:{value:new iE(0xffffff)},opacity:{value:1},center:{value:new nW(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new nJ},alphaMap:{value:null},alphaMapTransform:{value:new nJ},alphaTest:{value:0}}},cY={basic:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.fog]),vertexShader:cX.meshbasic_vert,fragmentShader:cX.meshbasic_frag},lambert:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,cq.lights,{emissive:{value:new iE(0)}}]),vertexShader:cX.meshlambert_vert,fragmentShader:cX.meshlambert_frag},phong:{uniforms:as([cq.common,cq.specularmap,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,cq.lights,{emissive:{value:new iE(0)},specular:{value:new iE(1118481)},shininess:{value:30}}]),vertexShader:cX.meshphong_vert,fragmentShader:cX.meshphong_frag},standard:{uniforms:as([cq.common,cq.envmap,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.roughnessmap,cq.metalnessmap,cq.fog,cq.lights,{emissive:{value:new iE(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:cX.meshphysical_vert,fragmentShader:cX.meshphysical_frag},toon:{uniforms:as([cq.common,cq.aomap,cq.lightmap,cq.emissivemap,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.gradientmap,cq.fog,cq.lights,{emissive:{value:new iE(0)}}]),vertexShader:cX.meshtoon_vert,fragmentShader:cX.meshtoon_frag},matcap:{uniforms:as([cq.common,cq.bumpmap,cq.normalmap,cq.displacementmap,cq.fog,{matcap:{value:null}}]),vertexShader:cX.meshmatcap_vert,fragmentShader:cX.meshmatcap_frag},points:{uniforms:as([cq.points,cq.fog]),vertexShader:cX.points_vert,fragmentShader:cX.points_frag},dashed:{uniforms:as([cq.common,cq.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:cX.linedashed_vert,fragmentShader:cX.linedashed_frag},depth:{uniforms:as([cq.common,cq.displacementmap]),vertexShader:cX.depth_vert,fragmentShader:cX.depth_frag},normal:{uniforms:as([cq.common,cq.bumpmap,cq.normalmap,cq.displacementmap,{opacity:{value:1}}]),vertexShader:cX.meshnormal_vert,fragmentShader:cX.meshnormal_frag},sprite:{uniforms:as([cq.sprite,cq.fog]),vertexShader:cX.sprite_vert,fragmentShader:cX.sprite_frag},background:{uniforms:{uvTransform:{value:new nJ},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:cX.background_vert,fragmentShader:cX.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new nJ}},vertexShader:cX.backgroundCube_vert,fragmentShader:cX.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:cX.cube_vert,fragmentShader:cX.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:cX.equirect_vert,fragmentShader:cX.equirect_frag},distanceRGBA:{uniforms:as([cq.common,cq.displacementmap,{referencePosition:{value:new nX},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:cX.distanceRGBA_vert,fragmentShader:cX.distanceRGBA_frag},shadow:{uniforms:as([cq.lights,cq.fog,{color:{value:new iE(0)},opacity:{value:1}}]),vertexShader:cX.shadow_vert,fragmentShader:cX.shadow_frag}};cY.physical={uniforms:as([cY.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new nJ},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new nJ},clearcoatNormalScale:{value:new nW(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new nJ},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new nJ},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new nJ},sheen:{value:0},sheenColor:{value:new iE(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new nJ},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new nJ},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new nJ},transmissionSamplerSize:{value:new nW},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new nJ},attenuationDistance:{value:0},attenuationColor:{value:new iE(0)},specularColor:{value:new iE(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new nJ},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new nJ},anisotropyVector:{value:new nW},anisotropyMap:{value:null},anisotropyMapTransform:{value:new nJ}}]),vertexShader:cX.meshphysical_vert,fragmentShader:cX.meshphysical_frag};let cJ={r:0,b:0,g:0},cZ=new rK,cK=new rH;function c$(e,t,n,r,i,a,s){let o,l,u=new iE(0),c=+(!0!==a),h=null,d=0,p=null;function f(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function m(t,n){t.getRGB(cJ,ao(e)),r.buffers.color.setClear(cJ.r,cJ.g,cJ.b,n,s)}return{getClearColor:function(){return u},setClearColor:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;u.set(e),m(u,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){m(u,c=e)},render:function(t){let n=!1,i=f(t);null===i?m(u,c):i&&i.isColor&&(m(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?r.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&r.buffers.color.setClear(0,0,0,0,s),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){let r=f(n);r&&(r.isCubeTexture||r.mapping===eE)?(void 0===l&&((l=new an(new ai(1,1,1),new au({name:"BackgroundCubeMaterial",uniforms:aa(cY.backgroundCube.uniforms),vertexShader:cY.backgroundCube.vertexShader,fragmentShader:cY.backgroundCube.fragmentShader,side:E,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),cZ.copy(n.backgroundRotation),cZ.x*=-1,cZ.y*=-1,cZ.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(cZ.y*=-1,cZ.z*=-1),l.material.uniforms.envMap.value=r,l.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(cK.makeRotationFromEuler(cZ)),l.material.toneMapped=n8.getTransfer(r.colorSpace)!==t1,(h!==r||d!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,h=r,d=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):r&&r.isTexture&&(void 0===o&&((o=new an(new o4(2,2),new au({name:"BackgroundMaterial",uniforms:aa(cY.background.uniforms),vertexShader:cY.background.vertexShader,fragmentShader:cY.background.fragmentShader,side:w,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=r,o.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,o.material.toneMapped=n8.getTransfer(r.colorSpace)!==t1,!0===r.matrixAutoUpdate&&r.updateMatrix(),o.material.uniforms.uvTransform.value.copy(r.matrix),(h!==r||d!==r.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,h=r,d=r.version,p=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))},dispose:function(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0)}}}function cQ(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=u(null),a=i,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){let t=[],r=[],i=[];for(let e=0;e<n;e++)t[e]=0,r[e]=0,i[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function c(){let e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function h(e){d(e,0)}function d(t,n){let r=a.newAttributes,i=a.enabledAttributes,s=a.attributeDivisors;r[t]=1,0===i[t]&&(e.enableVertexAttribArray(t),i[t]=1),s[t]!==n&&(e.vertexAttribDivisor(t,n),s[t]=n)}function p(){let t=a.newAttributes,n=a.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function f(t,n,r,i,a,s,o){!0===o?e.vertexAttribIPointer(t,n,r,a,s):e.vertexAttribPointer(t,n,r,i,a,s)}function m(){g(),s=!0,a!==i&&o((a=i).object)}function g(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:function(n,i,l,m,g){let v=!1,y=function(t,n,i){let a=!0===i.wireframe,s=r[t.id];void 0===s&&(s={},r[t.id]=s);let o=s[n.id];void 0===o&&(o={},s[n.id]=o);let l=o[a];return void 0===l&&(l=u(e.createVertexArray()),o[a]=l),l}(m,l,i);a!==y&&o((a=y).object),(v=function(e,t,n,r){let i=a.attributes,s=t.attributes,o=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=i[t],r=s[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===n||n.attribute!==r||r&&n.data!==r.data)return!0;o++}return a.attributesNum!==o||a.index!==r}(n,m,l,g))&&function(e,t,n,r){let i={},s=t.attributes,o=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,o++}a.attributes=i,a.attributesNum=o,a.index=r}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||s)&&(s=!1,function(n,r,i,a){c();let s=a.attributes,o=i.getAttributes(),l=r.defaultAttributeValues;for(let r in o){let i=o[r];if(i.location>=0){let o=s[r];if(void 0===o&&("instanceMatrix"===r&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===r&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){let r=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let u=l.buffer,c=l.type,p=l.bytesPerElement,m=c===e.INT||c===e.UNSIGNED_INT||o.gpuType===eG;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<i.locationSize;e++)d(i.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<i.locationSize;e++)h(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<i.locationSize;e++)f(i.location+e,s/i.locationSize,c,r,l*p,(g+s/i.locationSize*e)*p,m)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<i.locationSize;e++)d(i.location+e,o.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<i.locationSize;e++)h(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<i.locationSize;e++)f(i.location+e,s/i.locationSize,c,r,s*p,s/i.locationSize*e*p,m)}}else if(void 0!==l){let t=l[r];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(i.location,t);break;case 3:e.vertexAttrib3fv(i.location,t);break;case 4:e.vertexAttrib4fv(i.location,t);break;default:e.vertexAttrib1fv(i.location,t)}}}}p()}(n,i,l,m),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){for(let e in m(),r){let t=r[e];for(let e in t){let n=t[e];for(let e in n)l(n[e].object),delete n[e];delete t[e]}delete r[e]}},releaseStatesOfGeometry:function(e){if(void 0===r[e.id])return;let t=r[e.id];for(let e in t){let n=t[e];for(let e in n)l(n[e].object),delete n[e];delete t[e]}delete r[e.id]},releaseStatesOfProgram:function(e){for(let t in r){let n=r[t];if(void 0===n[e.id])continue;let i=n[e.id];for(let e in i)l(i[e].object),delete i[e];delete n[e.id]}},initAttributes:c,enableAttribute:h,disableUnusedAttributes:p}}function c0(e,t,n){let r;function i(t,i,a){0!==a&&(e.drawArraysInstanced(r,t,i,a),n.update(i,r,a))}this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r,1)},this.renderInstances=i,this.renderMultiDraw=function(e,i,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,e,0,i,0,a);let s=0;for(let e=0;e<a;e++)s+=i[e];n.update(s,r,1)},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)i(e[t],a[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(r,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e]*o[e];n.update(t,r,1)}}}function c1(e,t,n,r){let i;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp",o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);let l=!0===n.logarithmicDepthBuffer,u=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control"),c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),f=e.getParameter(e.MAX_VERTEX_ATTRIBS),m=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){let n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:a,textureFormatReadable:function(t){return t===e0||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){let i=n===eX&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return n===ez||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||n===ej||!!i},precision:s,logarithmicDepthBuffer:l,reversedDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function c2(e){let t=this,n=null,r=0,i=!1,a=!1,s=new sl,o=new nJ,l={value:null,needsUpdate:!1};function u(e,n,r,i){let a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){let t=r+4*a,i=n.matrixWorldInverse;o.getNormalMatrix(i),(null===u||u.length<t)&&(u=new Float32Array(t));for(let t=0,n=r;t!==a;++t,n+=4)s.copy(e[t]).applyMatrix4(i,o),s.normal.toArray(u,n),u[n+3]=s.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){let n=0!==e.length||t||0!==r||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(s,o,c){let h=s.clippingPlanes,d=s.clipIntersection,p=s.clipShadows,f=e.get(s);if(i&&null!==h&&0!==h.length&&(!a||p)){let e=a?0:r,t=4*e,i=f.clippingState||null;l.value=i,i=u(h,o,t,c);for(let e=0;e!==t;++e)i[e]=n[e];f.clippingState=i,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}else a?u(null):(l.value!==n&&(l.value=n,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0)}}function c3(e){let t=new WeakMap;function n(e,t){return t===eM?e.mapping=eb:t===ew&&(e.mapping=eS),e}function r(e){let n=e.target;n.removeEventListener("dispose",r);let i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){let a=i.mapping;if(a===eM||a===ew)if(t.has(i))return n(t.get(i).texture,i.mapping);else{let a=i.image;if(!a||!(a.height>0))return null;{let s=new av(a.height);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}}}return i},dispose:function(){t=new WeakMap}}}let c4=[.125,.215,.35,.446,.526,.582],c5=new l7,c6=new iE,c8=null,c9=0,c7=0,he=!1,ht=(1+Math.sqrt(5))/2,hn=1/ht,hr=[new nX(-ht,hn,0),new nX(ht,hn,0),new nX(-hn,0,ht),new nX(hn,0,ht),new nX(0,ht,-hn),new nX(0,ht,hn),new nX(-1,1,-1),new nX(1,1,-1),new nX(-1,1,1),new nX(1,1,1)],hi=new nX;class ha{fromScene(e){let 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,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},{size:a=256,position:s=hi}=i;c8=this._renderer.getRenderTarget(),c9=this._renderer.getActiveCubeFace(),c7=this._renderer.getActiveMipmapLevel(),he=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,r,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}fromCubemap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=hu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=hl(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(c8,c9,c7),this._renderer.xr.enabled=he,e.scissorTest=!1,ho(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===eb||e.mapping===eS?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),c8=this._renderer.getRenderTarget(),c9=this._renderer.getActiveCubeFace(),c7=this._renderer.getActiveMipmapLevel(),he=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:eD,minFilter:eD,generateMipmaps:!1,type:eX,format:e0,colorSpace:tQ,depthBuffer:!1},r=hs(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=hs(e,t,n);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){let t=[],n=[],r=[],i=e,a=e-4+1+c4.length;for(let s=0;s<a;s++){let a=Math.pow(2,i);n.push(a);let o=1/a;s>e-4?o=c4[s-e+4-1]:0===s&&(o=0),r.push(o);let l=1/(a-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];d.set(r,18*e),p.set(h,12*e);let i=[e,e,e,e,e,e];f.set(i,6*e)}let m=new i0;m.setAttribute("position",new iF(d,3)),m.setAttribute("uv",new iF(p,2)),m.setAttribute("faceIndex",new iF(f,1)),t.push(m),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(r)),this._blurMaterial=function(e,t,n){let r=new Float32Array(20),i=new nX(0,1,0);return new au({name:"SphericalGaussianBlur",defines:{n:20,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:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include <cube_uv_reflection_fragment>\n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}(r,e,t)}return r}_compileMaterial(e){let t=new an(this._lodPlanes[0],e);this._renderer.compile(t,c5)}_sceneToCubeUV(e,t,n,r,i){let a=new af(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(c6),l.toneMapping=ec,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(r),l.clearDepth(),l.setRenderTarget(null));let h=new iR({name:"PMREM.Background",side:E,depthWrite:!1,depthTest:!1}),d=new an(new ai,h),p=!1,f=e.background;f?f.isColor&&(h.color.copy(f),e.background=null,p=!0):(h.color.copy(c6),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(a.up.set(0,s[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+o[t],i.y,i.z)):1===n?(a.up.set(0,0,s[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+o[t],i.z)):(a.up.set(0,s[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+o[t]));let u=this._cubeSize;ho(r,n*u,t>2?u:0,u,u),l.setRenderTarget(r),p&&l.render(d,a),l.render(e,a)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=c,l.autoClear=u,e.background=f}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===eb||e.mapping===eS;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=hu()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=hl());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new an(this._lodPlanes[0],i);i.uniforms.envMap.value=e;let s=this._cubeSize;ho(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,c5)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;t<r;t++){let n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),i=hr[(r-t-1)%hr.length];this._blur(e,t-1,t,n,i)}t.autoClear=n}_blur(e,t,n,r,i){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)}_halfBlur(e,t,n,r,i,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let u=new an(this._lodPlanes[r],l),c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):20;f>20&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(20));let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:e<f&&(g+=2*n)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;c.envMap.value=e.texture,c.samples.value=f,c.weights.value=m,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s);let{_lodMax:v}=this;c.dTheta.value=d,c.mipInt.value=v-n;let y=this._sizeLods[r],_=4*(this._cubeSize-y);ho(t,3*y*(r>v-4?r-v+4:0),_,3*y,2*y),o.setRenderTarget(t),o.render(u,c5)}constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}}function hs(e,t,n){let r=new ru(e,t,n);return r.texture.mapping=eE,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function ho(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function hl(){return new au({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include <common>\n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}function hu(){return new au({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:hc(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n ",blending:A,depthTest:!1,depthWrite:!1})}function hc(){return"\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n "}function hh(e){let t=new WeakMap,n=null;function r(e){let n=e.target;n.removeEventListener("dispose",r);let i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){let a=i.mapping,s=a===eM||a===ew,o=a===eb||a===eS;if(s||o){let a=t.get(i),l=void 0!==a?a.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==l)return null===n&&(n=new ha(e)),(a=s?n.fromEquirectangular(i,a):n.fromCubemap(i,a)).texture.pmremVersion=i.pmremVersion,t.set(i,a),a.texture;{if(void 0!==a)return a.texture;let l=i.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new ha(e)),(a=s?n.fromEquirectangular(i):n.fromCubemap(i)).texture.pmremVersion=i.pmremVersion,t.set(i,a),i.addEventListener("dispose",r),a.texture):null}}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function hd(e){let t={};function n(n){let r;if(void 0!==t[n])return t[n];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(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){let t=n(e);return null===t&&n3("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function hp(e,t,n,r){let i={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete i[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),r.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){let n=[],r=e.index,i=e.attributes.position,s=0;if(null!==r){let e=r.array;s=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],i=e[t+1],a=e[t+2];n.push(r,i,i,a,a,r)}}else{if(void 0===i)return;let e=i.array;s=i.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,i=t+2;n.push(e,r,r,i,i,e)}}let o=new(nK(n)?iW:iV)(n,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",s),i[t.id]=!0,n.memory.geometries++),t},update:function(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=a.get(e);if(t){let n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return a.get(e)}}}function hf(e,t,n){let r,i,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(r,s,i,t*a,o),n.update(s,r,o))}this.setMode=function(e){r=e},this.setIndex=function(e){i=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(r,s,i,t*a),n.update(s,r,1)},this.renderInstances=s,this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,a,0,i,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];n.update(o,r,1)},this.renderMultiDrawInstances=function(e,o,l,u){if(0===l)return;let c=t.get("WEBGL_multi_draw");if(null===c)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],u[t]);else{c.multiDrawElementsInstancedWEBGL(r,o,0,i,e,0,u,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e]*u[e];n.update(t,r,1)}}}function hm(e){let 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.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,r,i){switch(t.calls++,r){case e.TRIANGLES:t.triangles+=n/3*i;break;case e.LINES:t.lines+=n/2*i;break;case e.LINE_STRIP:t.lines+=i*(n-1);break;case e.LINE_LOOP:t.lines+=i*n;break;case e.POINTS:t.points+=i*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r)}}}}function hg(e,t,n){let r=new WeakMap,i=new ro;return{update:function(a,s,o){let l=a.morphTargetInfluences,u=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,c=void 0!==u?u.length:0,h=r.get(s);if(void 0===h||h.count!==c){void 0!==h&&h.texture.dispose();let e=void 0!==s.morphAttributes.position,n=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],u=s.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===n&&(d=2),!0===a&&(d=3);let p=s.attributes.position.count*d,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*c),g=new rc(m,p,f,c);g.type=ej,g.needsUpdate=!0;let v=4*d;for(let t=0;t<c;t++){let r=o[t],s=l[t],c=u[t],h=p*f*4*t;for(let t=0;t<r.count;t++){let o=t*v;!0===e&&(i.fromBufferAttribute(r,t),m[h+o+0]=i.x,m[h+o+1]=i.y,m[h+o+2]=i.z,m[h+o+3]=0),!0===n&&(i.fromBufferAttribute(s,t),m[h+o+4]=i.x,m[h+o+5]=i.y,m[h+o+6]=i.z,m[h+o+7]=0),!0===a&&(i.fromBufferAttribute(c,t),m[h+o+8]=i.x,m[h+o+9]=i.y,m[h+o+10]=i.z,m[h+o+11]=4===c.itemSize?i.w:1)}}h={count:c,texture:g,size:new nW(p,f)},r.set(s,h),s.addEventListener("dispose",function e(){g.dispose(),r.delete(s),s.removeEventListener("dispose",e)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,n);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let n=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",n),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",h.texture,n),o.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}}}function hv(e,t,n,r){let i=new WeakMap;function a(e){let t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(s){let o=r.render.frame,l=s.geometry,u=t.get(s,l);if(i.get(u)!==o&&(t.update(u),i.set(u,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),i.get(s)!==o&&(n.update(s.instanceMatrix,e.ARRAY_BUFFER),null!==s.instanceColor&&n.update(s.instanceColor,e.ARRAY_BUFFER),i.set(s,o))),s.isSkinnedMesh){let e=s.skeleton;i.get(e)!==o&&(e.update(),i.set(e,o))}return u},dispose:function(){i=new WeakMap}}}let hy=new rs,h_=new s8(1,1),hx=new rc,hb=new rd,hS=new ag,hM=[],hw=[],hE=new Float32Array(16),hT=new Float32Array(9),hA=new Float32Array(4);function hC(e,t,n){let r=e[0];if(r<=0||r>0)return e;let i=t*n,a=hM[i];if(void 0===a&&(a=new Float32Array(i),hM[i]=a),0!==t){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function hR(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function hP(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function hI(e,t){let n=hw[t];void 0===n&&(n=new Int32Array(t),hw[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function hL(e,t){let n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function hN(e,t){let 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(hR(n,t))return;e.uniform2fv(this.addr,t),hP(n,t)}}function hD(e,t){let 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(hR(n,t))return;e.uniform3fv(this.addr,t),hP(n,t)}}function hU(e,t){let 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(hR(n,t))return;e.uniform4fv(this.addr,t),hP(n,t)}}function hO(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(hR(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),hP(n,t)}else{if(hR(n,r))return;hA.set(r),e.uniformMatrix2fv(this.addr,!1,hA),hP(n,r)}}function hF(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(hR(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),hP(n,t)}else{if(hR(n,r))return;hT.set(r),e.uniformMatrix3fv(this.addr,!1,hT),hP(n,r)}}function hk(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(hR(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),hP(n,t)}else{if(hR(n,r))return;hE.set(r),e.uniformMatrix4fv(this.addr,!1,hE),hP(n,r)}}function hz(e,t){let n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function hB(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(hR(n,t))return;e.uniform2iv(this.addr,t),hP(n,t)}}function hH(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(hR(n,t))return;e.uniform3iv(this.addr,t),hP(n,t)}}function hV(e,t){let 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.uniform4i(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(hR(n,t))return;e.uniform4iv(this.addr,t),hP(n,t)}}function hG(e,t){let n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function hW(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(hR(n,t))return;e.uniform2uiv(this.addr,t),hP(n,t)}}function hj(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(hR(n,t))return;e.uniform3uiv(this.addr,t),hP(n,t)}}function hX(e,t){let 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.uniform4ui(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(hR(n,t))return;e.uniform4uiv(this.addr,t),hP(n,t)}}function hq(e,t,n){let r,i=this.cache,a=n.allocateTextureUnit();i[0]!==a&&(e.uniform1i(this.addr,a),i[0]=a),this.type===e.SAMPLER_2D_SHADOW?(h_.compareFunction=nh,r=h_):r=hy,n.setTexture2D(t||r,a)}function hY(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||hb,i)}function hJ(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||hS,i)}function hZ(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||hx,i)}function hK(e,t){e.uniform1fv(this.addr,t)}function h$(e,t){let n=hC(t,this.size,2);e.uniform2fv(this.addr,n)}function hQ(e,t){let n=hC(t,this.size,3);e.uniform3fv(this.addr,n)}function h0(e,t){let n=hC(t,this.size,4);e.uniform4fv(this.addr,n)}function h1(e,t){let n=hC(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function h2(e,t){let n=hC(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function h3(e,t){let n=hC(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function h4(e,t){e.uniform1iv(this.addr,t)}function h5(e,t){e.uniform2iv(this.addr,t)}function h6(e,t){e.uniform3iv(this.addr,t)}function h8(e,t){e.uniform4iv(this.addr,t)}function h9(e,t){e.uniform1uiv(this.addr,t)}function h7(e,t){e.uniform2uiv(this.addr,t)}function de(e,t){e.uniform3uiv(this.addr,t)}function dt(e,t){e.uniform4uiv(this.addr,t)}function dn(e,t,n){let r=this.cache,i=t.length,a=hI(n,i);hR(r,a)||(e.uniform1iv(this.addr,a),hP(r,a));for(let e=0;e!==i;++e)n.setTexture2D(t[e]||hy,a[e])}function dr(e,t,n){let r=this.cache,i=t.length,a=hI(n,i);hR(r,a)||(e.uniform1iv(this.addr,a),hP(r,a));for(let e=0;e!==i;++e)n.setTexture3D(t[e]||hb,a[e])}function di(e,t,n){let r=this.cache,i=t.length,a=hI(n,i);hR(r,a)||(e.uniform1iv(this.addr,a),hP(r,a));for(let e=0;e!==i;++e)n.setTextureCube(t[e]||hS,a[e])}function da(e,t,n){let r=this.cache,i=t.length,a=hI(n,i);hR(r,a)||(e.uniform1iv(this.addr,a),hP(r,a));for(let e=0;e!==i;++e)n.setTexture2DArray(t[e]||hx,a[e])}class ds{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return hL;case 35664:return hN;case 35665:return hD;case 35666:return hU;case 35674:return hO;case 35675:return hF;case 35676:return hk;case 5124:case 35670:return hz;case 35667:case 35671:return hB;case 35668:case 35672:return hH;case 35669:case 35673:return hV;case 5125:return hG;case 36294:return hW;case 36295:return hj;case 36296:return hX;case 35678:case 36198:case 36298:case 36306:case 35682:return hq;case 35679:case 36299:case 36307:return hY;case 35680:case 36300:case 36308:case 36293:return hJ;case 36289:case 36303:case 36311:case 36292:return hZ}}(t.type)}}class dl{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return hK;case 35664:return h$;case 35665:return hQ;case 35666:return h0;case 35674:return h1;case 35675:return h2;case 35676:return h3;case 5124:case 35670:return h4;case 35667:case 35671:return h5;case 35668:case 35672:return h6;case 35669:case 35673:return h8;case 5125:return h9;case 36294:return h7;case 36295:return de;case 36296:return dt;case 35678:case 36198:case 36298:case 36306:case 35682:return dn;case 35679:case 36299:case 36307:return dr;case 35680:case 36300:case 36308:case 36293:return di;case 36289:case 36303:case 36311:case 36292:return da}}(t.type)}}class du{setValue(e,t,n){let r=this.seq;for(let i=0,a=r.length;i!==a;++i){let a=r[i];a.setValue(e,t[a.id],n)}}constructor(e){this.id=e,this.seq=[],this.map={}}}let dc=/(\w+)(\])?(\[|\.)?/g;function dh(e,t){e.seq.push(t),e.map[t.id]=t}class dd{setValue(e,t,n,r){let i=this.map[t];void 0!==i&&i.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];void 0!==r&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let i=0,a=t.length;i!==a;++i){let a=t[i],s=n[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,i=e.length;r!==i;++r){let i=e[r];i.id in t&&n.push(i)}return n}constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){let n=e.getActiveUniform(t,r),i=e.getUniformLocation(t,n.name);!function(e,t,n){let r=e.name,i=r.length;for(dc.lastIndex=0;;){let a=dc.exec(r),s=dc.lastIndex,o=a[1],l="]"===a[2],u=a[3];if(l&&(o|=0),void 0===u||"["===u&&s+2===i){dh(n,void 0===u?new ds(o,e,t):new dl(o,e,t));break}{let e=n.map[o];void 0===e&&dh(n,e=new du(o)),n=e}}}(n,i,this)}}}function dp(e,t,n){let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}let df=0,dm=new nJ;function dg(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||"").trim();if(r&&""===i)return"";let a=/ERROR: 0:(\d+)/.exec(i);if(!a)return i;{let r=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){let n=e.split("\n"),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=i;e<a;e++){let i=e+1;r.push("".concat(i===t?">":" "," ").concat(i,": ").concat(n[e]))}return r.join("\n")}(e.getShaderSource(t),r)}}let dv=new nX;function dy(e){return""!==e}function d_(e,t){let 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 dx(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let db=/^[ \t]*#include +<([\w\d./]+)>/gm;function dS(e){return e.replace(db,dw)}let dM=new Map;function dw(e,t){let n=cX[t];if(void 0===n){let e=dM.get(t);if(void 0!==e)n=cX[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return dS(n)}let dE=/#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 dT(e){return e.replace(dE,dA)}function dA(e,t,n,r){let i="";for(let e=parseInt(t);e<parseInt(n);e++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return i}function dC(e){let t="precision ".concat(e.precision," float;\n precision ").concat(e.precision," int;\n precision ").concat(e.precision," sampler2D;\n precision ").concat(e.precision," samplerCube;\n precision ").concat(e.precision," sampler3D;\n precision ").concat(e.precision," sampler2DArray;\n precision ").concat(e.precision," sampler2DShadow;\n precision ").concat(e.precision," samplerCubeShadow;\n precision ").concat(e.precision," sampler2DArrayShadow;\n precision ").concat(e.precision," isampler2D;\n precision ").concat(e.precision," isampler3D;\n precision ").concat(e.precision," isamplerCube;\n precision ").concat(e.precision," isampler2DArray;\n precision ").concat(e.precision," usampler2D;\n precision ").concat(e.precision," usampler3D;\n precision ").concat(e.precision," usamplerCube;\n precision ").concat(e.precision," usampler2DArray;\n ");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 dR(e,t,n,r){let i,a,s,o,l,u,c=e.getContext(),h=n.defines,d=n.vertexShader,p=n.fragmentShader,f=(l="SHADOWMAP_TYPE_BASIC",n.shadowMapType===b?l="SHADOWMAP_TYPE_PCF":n.shadowMapType===S?l="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===M&&(l="SHADOWMAP_TYPE_VSM"),l),m=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case eb:case eS:t="ENVMAP_TYPE_CUBE";break;case eE:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),g=(u="ENVMAP_MODE_REFLECTION",n.envMap&&n.envMapMode===eS&&(u="ENVMAP_MODE_REFRACTION"),u),v=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case eo:t="ENVMAP_BLENDING_MULTIPLY";break;case el:t="ENVMAP_BLENDING_MIX";break;case eu:t="ENVMAP_BLENDING_ADD"}return t}(n),y=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let n=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:1/t,maxMip:n}}(n),_=[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(dy).join("\n"),x=function(e){let t=[];for(let n in e){let r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(h),w=c.createProgram(),E=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(dy).join("\n")).length>0&&(i+="\n"),(a=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(dy).join("\n")).length>0&&(a+="\n")):(i=[dC(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+g:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(dy).join("\n"),a=[dC(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+m:"",n.envMap?"#define "+g:"",n.envMap?"#define "+v:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ec?"#define TONE_MAPPING":"",n.toneMapping!==ec?cX.tonemapping_pars_fragment:"",n.toneMapping!==ec?function(e,t){let n;switch(t){case eh:n="Linear";break;case ed:n="Reinhard";break;case ep:n="Cineon";break;case ef:n="ACESFilmic";break;case eg:n="AgX";break;case ev:n="Neutral";break;case em:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",cX.colorspace_pars_fragment,function(e,t){let n=function(e){n8._getMatrix(dm,n8.workingColorSpace,e);let t="mat3( ".concat(dm.elements.map(e=>e.toFixed(4))," )");switch(n8.getTransfer(e)){case t0:return[t,"LinearTransferOETF"];case t1:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return["vec4 ".concat(e,"( vec4 value ) {")," return ".concat(n[1],"( vec4( value.rgb * ").concat(n[0],", value.a ) );"),"}"].join("\n")}("linearToOutputTexel",n.outputColorSpace),function(){n8.getLuminanceCoefficients(dv);let e=dv.x.toFixed(4),t=dv.y.toFixed(4),n=dv.z.toFixed(4);return["float luminance( const in vec3 rgb ) {"," const vec3 weights = vec3( ".concat(e,", ").concat(t,", ").concat(n," );")," return dot( weights, rgb );\n}"].join("\n")}(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(dy).join("\n")),d=dx(d=d_(d=dS(d),n),n),p=dx(p=d_(p=dS(p),n),n),d=dT(d),p=dT(p),!0!==n.isRawShaderMaterial&&(E="#version 300 es\n",i=[_,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===nT?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===nT?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);let T=E+i+d,A=E+a+p,C=dp(c,c.VERTEX_SHADER,T),R=dp(c,c.FRAGMENT_SHADER,A);function P(t){if(e.debug.checkShaderErrors){let n=c.getProgramInfoLog(w)||"",r=c.getShaderInfoLog(C)||"",s=c.getShaderInfoLog(R)||"",o=n.trim(),l=r.trim(),u=s.trim(),h=!0,d=!0;if(!1===c.getProgramParameter(w,c.LINK_STATUS))if(h=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,w,C,R);else{let e=dg(c,C,"vertex"),n=dg(c,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(w,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+o+"\n"+e+"\n"+n)}else""!==o?console.warn("THREE.WebGLProgram: Program Info Log:",o):(""===l||""===u)&&(d=!1);d&&(t.diagnostics={runnable:h,programLog:o,vertexShader:{log:l,prefix:i},fragmentShader:{log:u,prefix:a}})}c.deleteShader(C),c.deleteShader(R),s=new dd(c,w),o=function(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){let r=e.getActiveAttrib(t,i),a=r.name,s=1;r.type===e.FLOAT_MAT2&&(s=2),r.type===e.FLOAT_MAT3&&(s=3),r.type===e.FLOAT_MAT4&&(s=4),n[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:s}}return n}(c,w)}c.attachShader(w,C),c.attachShader(w,R),void 0!==n.index0AttributeName?c.bindAttribLocation(w,0,n.index0AttributeName):!0===n.morphTargets&&c.bindAttribLocation(w,0,"position"),c.linkProgram(w),this.getUniforms=function(){return void 0===s&&P(this),s},this.getAttributes=function(){return void 0===o&&P(this),o};let I=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===I&&(I=c.getProgramParameter(w,37297)),I},this.destroy=function(){r.releaseStatesOfProgram(this),c.deleteProgram(w),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=df++,this.cacheKey=t,this.usedTimes=1,this.program=w,this.vertexShader=C,this.fragmentShader=R,this}let dP=0;class dI{update(e){let 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}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new dL(e),t.set(e,n)),n}constructor(){this.shaderCache=new Map,this.materialCache=new Map}}class dL{constructor(e){this.id=dP++,this.code=e,this.usedTimes=0}}function dN(e,t,n,r,i,a,s){let o=new r$,l=new dI,u=new Set,c=[],h=i.logarithmicDepthBuffer,d=i.vertexTextures,p=i.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(e){return(u.add(e),0===e)?"uv":"uv".concat(e)}return{getParameters:function(a,o,c,g,v){let y,_,x,b,S=g.fog,M=v.geometry,w=a.isMeshStandardMaterial?g.environment:null,A=(a.isMeshStandardMaterial?n:t).get(a.envMap||w),R=A&&A.mapping===eE?A.image.height:null,P=f[a.type];null!==a.precision&&(p=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");let I=M.morphAttributes.position||M.morphAttributes.normal||M.morphAttributes.color,L=void 0!==I?I.length:0,N=0;if(void 0!==M.morphAttributes.position&&(N=1),void 0!==M.morphAttributes.normal&&(N=2),void 0!==M.morphAttributes.color&&(N=3),P){let e=cY[P];y=e.vertexShader,_=e.fragmentShader}else y=a.vertexShader,_=a.fragmentShader,l.update(a),x=l.getVertexShaderID(a),b=l.getFragmentShaderID(a);let D=e.getRenderTarget(),U=e.state.buffers.depth.getReversed(),O=!0===v.isInstancedMesh,F=!0===v.isBatchedMesh,k=!!a.map,z=!!a.matcap,B=!!A,H=!!a.aoMap,V=!!a.lightMap,G=!!a.bumpMap,W=!!a.normalMap,j=!!a.displacementMap,X=!!a.emissiveMap,q=!!a.metalnessMap,Y=!!a.roughnessMap,J=a.anisotropy>0,Z=a.clearcoat>0,K=a.dispersion>0,$=a.iridescence>0,Q=a.sheen>0,ee=a.transmission>0,et=J&&!!a.anisotropyMap,en=Z&&!!a.clearcoatMap,er=Z&&!!a.clearcoatNormalMap,ei=Z&&!!a.clearcoatRoughnessMap,ea=$&&!!a.iridescenceMap,es=$&&!!a.iridescenceThicknessMap,eo=Q&&!!a.sheenColorMap,el=Q&&!!a.sheenRoughnessMap,eu=!!a.specularMap,eh=!!a.specularColorMap,ed=!!a.specularIntensityMap,ep=ee&&!!a.transmissionMap,ef=ee&&!!a.thicknessMap,em=!!a.gradientMap,eg=!!a.alphaMap,ev=a.alphaTest>0,ey=!!a.alphaHash,e_=!!a.extensions,ex=ec;a.toneMapped&&(null===D||!0===D.isXRRenderTarget)&&(ex=e.toneMapping);let eb={shaderID:P,shaderType:a.type,shaderName:a.name,vertexShader:y,fragmentShader:_,defines:a.defines,customVertexShaderID:x,customFragmentShaderID:b,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:F,batchingColor:F&&null!==v._colorsTexture,instancing:O,instancingColor:O&&null!==v.instanceColor,instancingMorph:O&&null!==v.morphTexture,supportsVertexTextures:d,outputColorSpace:null===D?e.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:tQ,alphaToCoverage:!!a.alphaToCoverage,map:k,matcap:z,envMap:B,envMapMode:B&&A.mapping,envMapCubeUVHeight:R,aoMap:H,lightMap:V,bumpMap:G,normalMap:W,displacementMap:d&&j,emissiveMap:X,normalMapObjectSpace:W&&a.normalMapType===tZ,normalMapTangentSpace:W&&a.normalMapType===tJ,metalnessMap:q,roughnessMap:Y,anisotropy:J,anisotropyMap:et,clearcoat:Z,clearcoatMap:en,clearcoatNormalMap:er,clearcoatRoughnessMap:ei,dispersion:K,iridescence:$,iridescenceMap:ea,iridescenceThicknessMap:es,sheen:Q,sheenColorMap:eo,sheenRoughnessMap:el,specularMap:eu,specularColorMap:eh,specularIntensityMap:ed,transmission:ee,transmissionMap:ep,thicknessMap:ef,gradientMap:em,opaque:!1===a.transparent&&a.blending===C&&!1===a.alphaToCoverage,alphaMap:eg,alphaTest:ev,alphaHash:ey,combine:a.combine,mapUv:k&&m(a.map.channel),aoMapUv:H&&m(a.aoMap.channel),lightMapUv:V&&m(a.lightMap.channel),bumpMapUv:G&&m(a.bumpMap.channel),normalMapUv:W&&m(a.normalMap.channel),displacementMapUv:j&&m(a.displacementMap.channel),emissiveMapUv:X&&m(a.emissiveMap.channel),metalnessMapUv:q&&m(a.metalnessMap.channel),roughnessMapUv:Y&&m(a.roughnessMap.channel),anisotropyMapUv:et&&m(a.anisotropyMap.channel),clearcoatMapUv:en&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:er&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ei&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ea&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:es&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:eo&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:el&&m(a.sheenRoughnessMap.channel),specularMapUv:eu&&m(a.specularMap.channel),specularColorMapUv:eh&&m(a.specularColorMap.channel),specularIntensityMapUv:ed&&m(a.specularIntensityMap.channel),transmissionMapUv:ep&&m(a.transmissionMap.channel),thicknessMapUv:ef&&m(a.thicknessMap.channel),alphaMapUv:eg&&m(a.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(W||J),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!M.attributes.uv&&(k||eg),fog:!!S,useFog:!0===a.fog,fogExp2:!!S&&S.isFogExp2,flatShading:!0===a.flatShading&&!1===a.wireframe,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:U,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:L,morphTextureStride:N,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ex,decodeVideoTexture:k&&!0===a.map.isVideoTexture&&n8.getTransfer(a.map.colorSpace)===t1,decodeVideoTextureEmissive:X&&!0===a.emissiveMap.isVideoTexture&&n8.getTransfer(a.emissiveMap.colorSpace)===t1,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===T,flipSided:a.side===E,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:e_&&!0===a.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(e_&&!0===a.extensions.multiDraw||F)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return eb.vertexUv1s=u.has(1),eb.vertexUv2s=u.has(2),eb.vertexUv3s=u.has(3),u.clear(),eb},getProgramCacheKey:function(t){var n,r,i,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(n=s,r=t,n.push(r.precision),n.push(r.outputColorSpace),n.push(r.envMapMode),n.push(r.envMapCubeUVHeight),n.push(r.mapUv),n.push(r.alphaMapUv),n.push(r.lightMapUv),n.push(r.aoMapUv),n.push(r.bumpMapUv),n.push(r.normalMapUv),n.push(r.displacementMapUv),n.push(r.emissiveMapUv),n.push(r.metalnessMapUv),n.push(r.roughnessMapUv),n.push(r.anisotropyMapUv),n.push(r.clearcoatMapUv),n.push(r.clearcoatNormalMapUv),n.push(r.clearcoatRoughnessMapUv),n.push(r.iridescenceMapUv),n.push(r.iridescenceThicknessMapUv),n.push(r.sheenColorMapUv),n.push(r.sheenRoughnessMapUv),n.push(r.specularMapUv),n.push(r.specularColorMapUv),n.push(r.specularIntensityMapUv),n.push(r.transmissionMapUv),n.push(r.thicknessMapUv),n.push(r.combine),n.push(r.fogExp2),n.push(r.sizeAttenuation),n.push(r.morphTargetsCount),n.push(r.morphAttributeCount),n.push(r.numDirLights),n.push(r.numPointLights),n.push(r.numSpotLights),n.push(r.numSpotLightMaps),n.push(r.numHemiLights),n.push(r.numRectAreaLights),n.push(r.numDirLightShadows),n.push(r.numPointLightShadows),n.push(r.numSpotLightShadows),n.push(r.numSpotLightShadowsWithMaps),n.push(r.numLightProbes),n.push(r.shadowMapType),n.push(r.toneMapping),n.push(r.numClippingPlanes),n.push(r.numClipIntersection),n.push(r.depthPacking),i=s,a=t,o.disableAll(),a.supportsVertexTextures&&o.enable(0),a.instancing&&o.enable(1),a.instancingColor&&o.enable(2),a.instancingMorph&&o.enable(3),a.matcap&&o.enable(4),a.envMap&&o.enable(5),a.normalMapObjectSpace&&o.enable(6),a.normalMapTangentSpace&&o.enable(7),a.clearcoat&&o.enable(8),a.iridescence&&o.enable(9),a.alphaTest&&o.enable(10),a.vertexColors&&o.enable(11),a.vertexAlphas&&o.enable(12),a.vertexUv1s&&o.enable(13),a.vertexUv2s&&o.enable(14),a.vertexUv3s&&o.enable(15),a.vertexTangents&&o.enable(16),a.anisotropy&&o.enable(17),a.alphaHash&&o.enable(18),a.batching&&o.enable(19),a.dispersion&&o.enable(20),a.batchingColor&&o.enable(21),a.gradientMap&&o.enable(22),i.push(o.mask),o.disableAll(),a.fog&&o.enable(0),a.useFog&&o.enable(1),a.flatShading&&o.enable(2),a.logarithmicDepthBuffer&&o.enable(3),a.reversedDepthBuffer&&o.enable(4),a.skinning&&o.enable(5),a.morphTargets&&o.enable(6),a.morphNormals&&o.enable(7),a.morphColors&&o.enable(8),a.premultipliedAlpha&&o.enable(9),a.shadowMapEnabled&&o.enable(10),a.doubleSided&&o.enable(11),a.flipSided&&o.enable(12),a.useDepthPacking&&o.enable(13),a.dithering&&o.enable(14),a.transmission&&o.enable(15),a.sheen&&o.enable(16),a.opaque&&o.enable(17),a.pointsUvs&&o.enable(18),a.decodeVideoTexture&&o.enable(19),a.decodeVideoTextureEmissive&&o.enable(20),a.alphaToCoverage&&o.enable(21),i.push(o.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,n=f[e.type];if(n){let e=cY[n];t=al.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){let r;for(let e=0,t=c.length;e<t;e++){let t=c[e];if(t.cacheKey===n){r=t,++r.usedTimes;break}}return void 0===r&&(r=new dR(e,n,t,a),c.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let t=c.indexOf(e);c[t]=c[c.length-1],c.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:c,dispose:function(){l.dispose()}}}function dD(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let 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 dU(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 dO(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 dF(){let e=[],t=0,n=[],r=[],i=[];function a(n,r,i,a,s,o){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:s,group:o},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=s,l.group=o),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,s,o,l,u){let c=a(e,t,s,o,l,u);s.transmission>0?r.push(c):!0===s.transparent?i.push(c):n.push(c)},unshift:function(e,t,s,o,l,u){let c=a(e,t,s,o,l,u);s.transmission>0?r.unshift(c):!0===s.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(let n=t,r=e.length;n<r;n++){let t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||dU),r.length>1&&r.sort(t||dO),i.length>1&&i.sort(t||dO)}}}function dk(){let e=new WeakMap;return{get:function(t,n){let r,i=e.get(t);return void 0===i?(r=new dF,e.set(t,[r])):n>=i.length?(r=new dF,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function dz(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":n={direction:new nX,color:new iE};break;case"SpotLight":n={position:new nX,direction:new nX,color:new iE,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new nX,color:new iE,distance:0,decay:0};break;case"HemisphereLight":n={direction:new nX,skyColor:new iE,groundColor:new iE};break;case"RectAreaLight":n={color:new iE,position:new nX,halfWidth:new nX,halfHeight:new nX}}return e[t.id]=n,n}}}let dB=0;function dH(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function dV(e){let t=new dz,n=function(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nW};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nW,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new nX);let i=new nX,a=new rH,s=new rH;return{setup:function(i){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,u=0,c=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0,y=0;i.sort(dH);for(let e=0,_=i.length;e<_;e++){let _=i[e],x=_.color,b=_.intensity,S=_.distance,M=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)a+=x.r*b,s+=x.g*b,o+=x.b*b;else if(_.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(_.sh.coefficients[e],b);y++}else if(_.isDirectionalLight){let e=t.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),_.castShadow){let e=_.shadow,t=n.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=M,r.directionalShadowMatrix[l]=_.shadow.matrix,p++}r.directional[l]=e,l++}else if(_.isSpotLight){let e=t.get(_);e.position.setFromMatrixPosition(_.matrixWorld),e.color.copy(x).multiplyScalar(b),e.distance=S,e.coneCos=Math.cos(_.angle),e.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),e.decay=_.decay,r.spot[c]=e;let i=_.shadow;if(_.map&&(r.spotLightMap[g]=_.map,g++,i.updateMatrices(_),_.castShadow&&v++),r.spotLightMatrix[c]=i.matrix,_.castShadow){let e=n.get(_);e.shadowIntensity=i.intensity,e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,r.spotShadow[c]=e,r.spotShadowMap[c]=M,m++}c++}else if(_.isRectAreaLight){let e=t.get(_);e.color.copy(x).multiplyScalar(b),e.halfWidth.set(.5*_.width,0,0),e.halfHeight.set(0,.5*_.height,0),r.rectArea[h]=e,h++}else if(_.isPointLight){let e=t.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),e.distance=_.distance,e.decay=_.decay,_.castShadow){let e=_.shadow,t=n.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[u]=t,r.pointShadowMap[u]=M,r.pointShadowMatrix[u]=_.shadow.matrix,f++}r.point[u]=e,u++}else if(_.isHemisphereLight){let e=t.get(_);e.skyColor.copy(_.color).multiplyScalar(b),e.groundColor.copy(_.groundColor).multiplyScalar(b),r.hemi[d]=e,d++}}h>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=cq.LTC_FLOAT_1,r.rectAreaLTC2=cq.LTC_FLOAT_2):(r.rectAreaLTC1=cq.LTC_HALF_1,r.rectAreaLTC2=cq.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let _=r.hash;(_.directionalLength!==l||_.pointLength!==u||_.spotLength!==c||_.rectAreaLength!==h||_.hemiLength!==d||_.numDirectionalShadows!==p||_.numPointShadows!==f||_.numSpotShadows!==m||_.numSpotMaps!==g||_.numLightProbes!==y)&&(r.directional.length=l,r.spot.length=c,r.rectArea.length=h,r.point.length=u,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-v,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=v,r.numLightProbes=y,_.directionalLength=l,_.pointLength=u,_.spotLength=c,_.rectAreaLength=h,_.hemiLength=d,_.numDirectionalShadows=p,_.numPointShadows=f,_.numSpotShadows=m,_.numSpotMaps=g,_.numLightProbes=y,r.version=dB++)},setupView:function(e,t){let n=0,o=0,l=0,u=0,c=0,h=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=r.directional[n];e.direction.setFromMatrixPosition(d.matrixWorld),i.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(h),n++}else if(d.isSpotLight){let e=r.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),e.direction.setFromMatrixPosition(d.matrixWorld),i.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(h),l++}else if(d.isRectAreaLight){let e=r.rectArea[u];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),s.identity(),a.copy(d.matrixWorld),a.premultiply(h),s.extractRotation(a),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(s),e.halfHeight.applyMatrix4(s),u++}else if(d.isPointLight){let e=r.point[o];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),o++}else if(d.isHemisphereLight){let e=r.hemi[c];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(h),c++}}},state:r}}function dG(e){let t=new dV(e),n=[],r=[],i={lightsArray:n,shadowsArray:r,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){i.camera=e,n.length=0,r.length=0},state:i,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){r.push(e)}}}function dW(e){let t=new WeakMap;return{get:function(n){let r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=t.get(n);return void 0===a?(r=new dG(e),t.set(n,[r])):i>=a.length?(r=new dG(e),a.push(r)):r=a[i],r},dispose:function(){t=new WeakMap}}}function dj(e,t,n){let r=new sd,i=new nW,a=new nW,s=new ro,o=new lp({depthPacking:tX}),l=new lf,u={},c=n.maxTextureSize,h={[w]:E,[E]:w,[T]:T},d=new au({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new nW},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new i0;f.setAttribute("position",new iF(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new an(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b;let v=this.type;function y(t,n,r,i){let a=null,s=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===r.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){let e=a.uuid,t=n.uuid,r=u[e];void 0===r&&(r={},u[e]=r);let i=r[t];void 0===i&&(i=a.clone(),r[t]=i,n.addEventListener("dispose",_)),a=i}return a.visible=n.visible,a.wireframe=n.wireframe,i===M?a.side=null!==n.shadowSide?n.shadowSide:n.side:a.side=null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=r),a}function _(e){for(let t in e.target.removeEventListener("dispose",_),u){let n=u[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}this.render=function(n,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===n.length)return;let u=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.state;_.setBlending(A),!0===_.buffers.depth.getReversed()?_.buffers.color.setClear(0,0,0,0):_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);let x=v!==M&&this.type===M,b=v===M&&this.type!==M;for(let u=0,h=n.length;u<h;u++){let h=n[u],f=h.shadow;if(void 0===f){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;i.copy(f.mapSize);let g=f.getFrameExtents();if(i.multiply(g),a.copy(f.mapSize),(i.x>c||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/g.x),i.x=a.x*g.x,f.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/g.y),i.y=a.y*g.y,f.mapSize.y=a.y)),null===f.map||!0===x||!0===b){let e=this.type!==M?{minFilter:eR,magFilter:eR}:{};null!==f.map&&f.map.dispose(),f.map=new ru(i.x,i.y,e),f.map.texture.name=h.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let v=f.getViewportCount();for(let n=0;n<v;n++){let i=f.getViewport(n);s.set(a.x*i.x,a.y*i.y,a.x*i.z,a.y*i.w),_.viewport(s),f.updateMatrices(h,n),r=f.getFrustum(),function n(i,a,s,o,l){if(!1===i.visible)return;if(i.layers.test(a.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&l===M)&&(!i.frustumCulled||r.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);let n=t.update(i),r=i.material;if(Array.isArray(r)){let t=n.groups;for(let u=0,c=t.length;u<c;u++){let c=t[u],h=r[c.materialIndex];if(h&&h.visible){let t=y(i,h,o,l);i.onBeforeShadow(e,i,a,s,n,t,c),e.renderBufferDirect(s,null,n,t,i,c),i.onAfterShadow(e,i,a,s,n,t,c)}}}else if(r.visible){let t=y(i,r,o,l);i.onBeforeShadow(e,i,a,s,n,t,null),e.renderBufferDirect(s,null,n,t,i,null),i.onAfterShadow(e,i,a,s,n,t,null)}}let u=i.children;for(let e=0,t=u.length;e<t;e++)n(u[e],a,s,o,l)}(o,l,f.camera,h,this.type)}!0!==f.isPointLightShadow&&this.type===M&&function(n,r){let a=t.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ru(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,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,p,m,null)}(f,l),f.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(u,h,f)}}let dX={[Q]:ee,[et]:ea,[er]:es,[en]:ei,[ee]:Q,[ea]:et,[es]:er,[ei]:en};function dq(e,t){let n=new function(){let t=!1,n=new ro,r=null,i=new ro(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,s,o){!0===o&&(t*=s,r*=s,a*=s),n.set(t,r,a,s),!1===i.equals(n)&&(e.clearColor(t,r,a,s),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},r=new function(){let n=!1,r=!1,i=null,a=null,s=null;return{setReversed:function(e){if(r!==e){let n=t.get("EXT_clip_control");e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),r=e;let i=s;s=null,this.setClear(i)}},getReversed:function(){return r},setTest:function(t){t?ew(e.DEPTH_TEST):eE(e.DEPTH_TEST)},setMask:function(t){i===t||n||(e.depthMask(t),i=t)},setFunc:function(t){if(r&&(t=dX[t]),a!==t){switch(t){case Q:e.depthFunc(e.NEVER);break;case ee:e.depthFunc(e.ALWAYS);break;case et:e.depthFunc(e.LESS);break;case en:e.depthFunc(e.LEQUAL);break;case er:e.depthFunc(e.EQUAL);break;case ei:e.depthFunc(e.GEQUAL);break;case ea:e.depthFunc(e.GREATER);break;case es:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){s!==t&&(r&&(t=1-t),e.clearDepth(t),s=t)},reset:function(){n=!1,i=null,a=null,s=null,r=!1}}},i=new function(){let t=!1,n=null,r=null,i=null,a=null,s=null,o=null,l=null,u=null;return{setTest:function(n){t||(n?ew(e.STENCIL_TEST):eE(e.STENCIL_TEST))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,s){(r!==t||i!==n||a!==s)&&(e.stencilFunc(t,n,s),r=t,i=n,a=s)},setOp:function(t,n,r){(s!==t||o!==n||l!==r)&&(e.stencilOp(t,n,r),s=t,o=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,s=null,o=null,l=null,u=null}}},a=new WeakMap,s=new WeakMap,o={},l={},u=new WeakMap,c=[],h=null,d=!1,p=null,f=null,m=null,_=null,x=null,b=null,S=null,M=new iE(0,0,0),w=0,eo=!1,el=null,eu=null,ec=null,eh=null,ed=null,ep=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ef=!1,em=e.getParameter(e.VERSION);-1!==em.indexOf("WebGL")?ef=parseFloat(/^WebGL (\d)/.exec(em)[1])>=1:-1!==em.indexOf("OpenGL ES")&&(ef=parseFloat(/^OpenGL ES (\d)/.exec(em)[1])>=2);let eg=null,ev={},ey=e.getParameter(e.SCISSOR_BOX),e_=e.getParameter(e.VIEWPORT),ex=new ro().fromArray(ey),eb=new ro().fromArray(e_);function eS(t,n,r,i){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<r;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let eM={};function ew(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function eE(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}eM[e.TEXTURE_2D]=eS(e.TEXTURE_2D,e.TEXTURE_2D,1),eM[e.TEXTURE_CUBE_MAP]=eS(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),eM[e.TEXTURE_2D_ARRAY]=eS(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),eM[e.TEXTURE_3D]=eS(e.TEXTURE_3D,e.TEXTURE_3D,1,1),n.setClear(0,0,0,1),r.setClear(1),i.setClear(0),ew(e.DEPTH_TEST),r.setFunc(en),eR(!1),eP(v),ew(e.CULL_FACE),eC(A);let eT={[N]:e.FUNC_ADD,[D]:e.FUNC_SUBTRACT,[U]:e.FUNC_REVERSE_SUBTRACT};eT[O]=e.MIN,eT[F]=e.MAX;let eA={[k]:e.ZERO,[z]:e.ONE,[B]:e.SRC_COLOR,[V]:e.SRC_ALPHA,[Y]:e.SRC_ALPHA_SATURATE,[X]:e.DST_COLOR,[W]:e.DST_ALPHA,[H]:e.ONE_MINUS_SRC_COLOR,[G]:e.ONE_MINUS_SRC_ALPHA,[q]:e.ONE_MINUS_DST_COLOR,[j]:e.ONE_MINUS_DST_ALPHA,[J]:e.CONSTANT_COLOR,[Z]:e.ONE_MINUS_CONSTANT_COLOR,[K]:e.CONSTANT_ALPHA,[$]:e.ONE_MINUS_CONSTANT_ALPHA};function eC(t,n,r,i,a,s,o,l,u,c){if(t===A){!0===d&&(eE(e.BLEND),d=!1);return}if(!1===d&&(ew(e.BLEND),d=!0),t!==L){if(t!==p||c!==eo){if((f!==N||x!==N)&&(e.blendEquation(e.FUNC_ADD),f=N,x=N),c)switch(t){case C:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case R:e.blendFunc(e.ONE,e.ONE);break;case P:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case I:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case C:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case R:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case P:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case I:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}m=null,_=null,b=null,S=null,M.set(0,0,0),w=0,p=t,eo=c}return}a=a||n,s=s||r,o=o||i,(n!==f||a!==x)&&(e.blendEquationSeparate(eT[n],eT[a]),f=n,x=a),(r!==m||i!==_||s!==b||o!==S)&&(e.blendFuncSeparate(eA[r],eA[i],eA[s],eA[o]),m=r,_=i,b=s,S=o),(!1===l.equals(M)||u!==w)&&(e.blendColor(l.r,l.g,l.b,u),M.copy(l),w=u),p=t,eo=!1}function eR(t){el!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),el=t)}function eP(t){t!==g?(ew(e.CULL_FACE),t!==eu&&(t===v?e.cullFace(e.BACK):t===y?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):eE(e.CULL_FACE),eu=t}function eI(t,n,r){t?(ew(e.POLYGON_OFFSET_FILL),(eh!==n||ed!==r)&&(e.polygonOffset(n,r),eh=n,ed=r)):eE(e.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:r,stencil:i},enable:ew,disable:eE,bindFramebuffer:function(t,n){return l[t]!==n&&(e.bindFramebuffer(t,n),l[t]=n,t===e.DRAW_FRAMEBUFFER&&(l[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(l[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let r=c,i=!1;if(t){void 0===(r=u.get(n))&&(r=[],u.set(n,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,i=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,i=!0);i&&e.drawBuffers(r)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:eC,setMaterial:function(t,a){t.side===T?eE(e.CULL_FACE):ew(e.CULL_FACE);let s=t.side===E;a&&(s=!s),eR(s),t.blending===C&&!1===t.transparent?eC(A):eC(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),r.setFunc(t.depthFunc),r.setTest(t.depthTest),r.setMask(t.depthWrite),n.setMask(t.colorWrite);let o=t.stencilWrite;i.setTest(o),o&&(i.setMask(t.stencilWriteMask),i.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),i.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),eI(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?ew(e.SAMPLE_ALPHA_TO_COVERAGE):eE(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:eR,setCullFace:eP,setLineWidth:function(t){t!==ec&&(ef&&e.lineWidth(t),ec=t)},setPolygonOffset:eI,setScissorTest:function(t){t?ew(e.SCISSOR_TEST):eE(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+ep-1),eg!==t&&(e.activeTexture(t),eg=t)},bindTexture:function(t,n,r){void 0===r&&(r=null===eg?e.TEXTURE0+ep-1:eg);let i=ev[r];void 0===i&&(i={type:void 0,texture:void 0},ev[r]=i),(i.type!==t||i.texture!==n)&&(eg!==r&&(e.activeTexture(r),eg=r),e.bindTexture(t,n||eM[t]),i.type=t,i.texture=n)},unbindTexture:function(){let t=ev[eg];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(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let r=s.get(n);void 0===r&&(r=new WeakMap,s.set(n,r));let i=r.get(t);void 0===i&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))},uniformBlockBinding:function(t,n){let r=s.get(n).get(t);a.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),a.set(n,r))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===ex.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),ex.copy(t))},viewport:function(t){!1===eb.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),eb.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),r.setReversed(!1),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,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),o={},eg=null,ev={},l={},u=new WeakMap,c=[],h=null,d=!1,p=null,f=null,m=null,_=null,x=null,b=null,S=null,M=new iE(0,0,0),w=0,eo=!1,el=null,eu=null,ec=null,eh=null,ed=null,ex.set(0,0,e.canvas.width,e.canvas.height),eb.set(0,0,e.canvas.width,e.canvas.height),n.reset(),r.reset(),i.reset()}}}function dY(e,t,n,r,i,a,s){let o,l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,u="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new nW,h=new WeakMap,d=new WeakMap,p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function f(e,t){return p?new OffscreenCanvas(e,t):n0("canvas")}function m(e,t,n){let r=1,i=V(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);void 0===o&&(o=f(n,a));let s=t?f(n,a):o;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+i.width+"x"+i.height+") to ("+n+"x"+a+")."),s}else"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+i.width+"x"+i.height+").");return e}function g(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function y(n,r,i,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=r;if(r===e.RED&&(i===e.FLOAT&&(o=e.R32F),i===e.HALF_FLOAT&&(o=e.R16F),i===e.UNSIGNED_BYTE&&(o=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.R8UI),i===e.UNSIGNED_SHORT&&(o=e.R16UI),i===e.UNSIGNED_INT&&(o=e.R32UI),i===e.BYTE&&(o=e.R8I),i===e.SHORT&&(o=e.R16I),i===e.INT&&(o=e.R32I)),r===e.RG&&(i===e.FLOAT&&(o=e.RG32F),i===e.HALF_FLOAT&&(o=e.RG16F),i===e.UNSIGNED_BYTE&&(o=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RG8UI),i===e.UNSIGNED_SHORT&&(o=e.RG16UI),i===e.UNSIGNED_INT&&(o=e.RG32UI),i===e.BYTE&&(o=e.RG8I),i===e.SHORT&&(o=e.RG16I),i===e.INT&&(o=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RGB8UI),i===e.UNSIGNED_SHORT&&(o=e.RGB16UI),i===e.UNSIGNED_INT&&(o=e.RGB32UI),i===e.BYTE&&(o=e.RGB8I),i===e.SHORT&&(o=e.RGB16I),i===e.INT&&(o=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),i===e.UNSIGNED_INT&&(o=e.RGBA32UI),i===e.BYTE&&(o=e.RGBA8I),i===e.SHORT&&(o=e.RGBA16I),i===e.INT&&(o=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),r===e.RGBA){let t=s?t0:n8.getTransfer(a);i===e.FLOAT&&(o=e.RGBA32F),i===e.HALF_FLOAT&&(o=e.RGBA16F),i===e.UNSIGNED_BYTE&&(o=t===t1?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function _(t,n){let r;return t?null===n||n===eW||n===eJ?r=e.DEPTH24_STENCIL8:n===ej?r=e.DEPTH32F_STENCIL8:n===eV&&(r=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===eW||n===eJ?r=e.DEPTH_COMPONENT24:n===ej?r=e.DEPTH_COMPONENT32F:n===eV&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==eR&&e.minFilter!==eD?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 b(e){let t=e.target;t.removeEventListener("dispose",b),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let n=e.source,i=d.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&M(e),0===Object.keys(i).length&&d.delete(n)}r.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function S(t){let n=t.target;n.removeEventListener("dispose",S),function(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r<n.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(n.__webglFramebuffer[t][r]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}let i=t.textures;for(let t=0,n=i.length;t<n;t++){let n=r.get(i[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),s.memory.textures--),r.remove(i[t])}r.remove(t)}(n)}function M(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=d.get(i);delete a[n.__cacheKey],s.memory.textures--}let w=0;function E(t,i){let a=r.get(t);if(t.isVideoTexture&&function(e){let t=s.render.frame;h.get(e)!==t&&(h.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&a.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(a,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}let T={[eT]:e.REPEAT,[eA]:e.CLAMP_TO_EDGE,[eC]:e.MIRRORED_REPEAT},A={[eR]:e.NEAREST,[eP]:e.NEAREST_MIPMAP_NEAREST,[eL]:e.NEAREST_MIPMAP_LINEAR,[eD]:e.LINEAR,[eU]:e.LINEAR_MIPMAP_NEAREST,[eF]:e.LINEAR_MIPMAP_LINEAR},C={[nl]:e.NEVER,[nm]:e.ALWAYS,[nu]:e.LESS,[nh]:e.LEQUAL,[nc]:e.EQUAL,[nf]:e.GEQUAL,[nd]:e.GREATER,[np]:e.NOTEQUAL};function R(n,a){if((a.type===ej&&!1===t.has("OES_texture_float_linear")&&(a.magFilter===eD||a.magFilter===eU||a.magFilter===eL||a.magFilter===eF||a.minFilter===eD||a.minFilter===eU||a.minFilter===eL||a.minFilter===eF)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,T[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,T[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,T[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,C[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&a.magFilter!==eR&&(a.minFilter===eL||a.minFilter===eF)&&(a.type!==ej||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||r.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}function P(t,n){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",b));let i=n.source,a=d.get(i);void 0===a&&(a={},d.set(i,a));let o=function(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),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.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),a[o].usedTimes++;let i=a[t.__cacheKey];void 0!==i&&(a[t.__cacheKey].usedTimes--,0===i.usedTimes&&M(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return r}function I(e,t,n){return Math.floor(Math.floor(e/n)/t)}function L(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let u=P(t,s),c=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let h=r.get(c);if(c.version!==h.__version||!0===u){let t;n.activeTexture(e.TEXTURE0+o);let r=n8.getPrimaries(n8.workingColorSpace),d=s.colorSpace===tK?null:n8.getPrimaries(s.colorSpace),p=s.colorSpace===tK||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=m(s.image,!1,i.maxTextureSize);f=H(s,f);let b=a.convert(s.format,s.colorSpace),S=a.convert(s.type),M=y(s.internalFormat,b,S,s.colorSpace,s.isVideoTexture);R(l,s);let w=s.mipmaps,E=!0!==s.isVideoTexture,T=void 0===h.__version||!0===u,A=c.dataReady,C=x(s,f);if(s.isDepthTexture)M=_(s.format===e2,s.type),T&&(E?n.texStorage2D(e.TEXTURE_2D,1,M,f.width,f.height):n.texImage2D(e.TEXTURE_2D,0,M,f.width,f.height,0,b,S,null));else if(s.isDataTexture)if(w.length>0){E&&T&&n.texStorage2D(e.TEXTURE_2D,C,M,w[0].width,w[0].height);for(let r=0,i=w.length;r<i;r++)t=w[r],E?A&&n.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,b,S,t.data):n.texImage2D(e.TEXTURE_2D,r,M,t.width,t.height,0,b,S,t.data);s.generateMipmaps=!1}else E?(T&&n.texStorage2D(e.TEXTURE_2D,C,M,f.width,f.height),A&&function(t,r,i,a){let s=t.updateRanges;if(0===s.length)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{s.sort((e,t)=>e.start-t.start);let o=0;for(let e=1;e<s.length;e++){let t=s[o],n=s[e],i=t.start+t.count,a=I(n.start,r.width,4),l=I(t.start,r.width,4);n.start<=i+1&&a===l&&I(n.start+n.count-1,r.width,4)===a?t.count=Math.max(t.count,n.start+n.count-t.start):s[++o]=n}s.length=o+1;let l=e.getParameter(e.UNPACK_ROW_LENGTH),u=e.getParameter(e.UNPACK_SKIP_PIXELS),c=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,o=s.length;t<o;t++){let o=s[t],l=Math.floor(o.start/4),u=Math.ceil(o.count/4),c=l%r.width,h=Math.floor(l/r.width);e.pixelStorei(e.UNPACK_SKIP_PIXELS,c),e.pixelStorei(e.UNPACK_SKIP_ROWS,h),n.texSubImage2D(e.TEXTURE_2D,0,c,h,u,1,i,a,r.data)}t.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,l),e.pixelStorei(e.UNPACK_SKIP_PIXELS,u),e.pixelStorei(e.UNPACK_SKIP_ROWS,c)}}(s,f,b,S)):n.texImage2D(e.TEXTURE_2D,0,M,f.width,f.height,0,b,S,f.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){E&&T&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,M,w[0].width,w[0].height,f.depth);for(let r=0,i=w.length;r<i;r++)if(t=w[r],s.format!==e0)if(null!==b)if(E){if(A)if(s.layerUpdates.size>0){let i=cV(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*i/t.data.BYTES_PER_ELEMENT,(a+1)*i/t.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,a,t.width,t.height,1,b,s)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,b,t.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,M,t.width,t.height,f.depth,0,t.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?A&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,b,S,t.data):n.texImage3D(e.TEXTURE_2D_ARRAY,r,M,t.width,t.height,f.depth,0,b,S,t.data)}else{E&&T&&n.texStorage2D(e.TEXTURE_2D,C,M,w[0].width,w[0].height);for(let r=0,i=w.length;r<i;r++)t=w[r],s.format!==e0?null!==b?E?A&&n.compressedTexSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,b,t.data):n.compressedTexImage2D(e.TEXTURE_2D,r,M,t.width,t.height,0,t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):E?A&&n.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,b,S,t.data):n.texImage2D(e.TEXTURE_2D,r,M,t.width,t.height,0,b,S,t.data)}else if(s.isDataArrayTexture)if(E){if(T&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,M,f.width,f.height,f.depth),A)if(s.layerUpdates.size>0){let t=cV(f.width,f.height,s.format,s.type);for(let r of s.layerUpdates){let i=f.data.subarray(r*t/f.data.BYTES_PER_ELEMENT,(r+1)*t/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,f.width,f.height,1,b,S,i)}s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,M,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isData3DTexture)E?(T&&n.texStorage3D(e.TEXTURE_3D,C,M,f.width,f.height,f.depth),A&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)):n.texImage3D(e.TEXTURE_3D,0,M,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isFramebufferTexture){if(T)if(E)n.texStorage2D(e.TEXTURE_2D,C,M,f.width,f.height);else{let t=f.width,r=f.height;for(let i=0;i<C;i++)n.texImage2D(e.TEXTURE_2D,i,M,t,r,0,b,S,null),t>>=1,r>>=1}}else if(w.length>0){if(E&&T){let t=V(w[0]);n.texStorage2D(e.TEXTURE_2D,C,M,t.width,t.height)}for(let r=0,i=w.length;r<i;r++)t=w[r],E?A&&n.texSubImage2D(e.TEXTURE_2D,r,0,0,b,S,t):n.texImage2D(e.TEXTURE_2D,r,M,b,S,t);s.generateMipmaps=!1}else if(E){if(T){let t=V(f);n.texStorage2D(e.TEXTURE_2D,C,M,t.width,t.height)}A&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,b,S,f)}else n.texImage2D(e.TEXTURE_2D,0,M,b,S,f);g(s)&&v(l),h.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function N(t,i,s,o,u,c){let h=a.convert(s.format,s.colorSpace),d=a.convert(s.type),p=y(s.internalFormat,h,d,s.colorSpace),f=r.get(i),m=r.get(s);if(m.__renderTarget=i,!f.__hasExternalTextures){let t=Math.max(1,i.width>>c),r=Math.max(1,i.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,p,t,r,i.depth,0,h,d,null):n.texImage2D(u,c,p,t,r,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),B(i)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,u,m.__webglTexture,0,z(i)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,u,m.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function D(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,s=_(n.stencilBuffer,a),o=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=z(n);B(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,s,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i<t.length;i++){let s=t[i],o=a.convert(s.format,s.colorSpace),u=a.convert(s.type),c=y(s.internalFormat,o,u,s.colorSpace),h=z(n);r&&!1===B(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,h,c,n.width,n.height):B(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,h,c,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,c,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function U(t,i){if(i&&i.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!(i.depthTexture&&i.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let a=r.get(i.depthTexture);a.__renderTarget=i,a.__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),E(i.depthTexture,0);let s=a.__webglTexture,o=z(i);if(i.depthTexture.format===e1)B(i)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0);else if(i.depthTexture.format===e2)B(i)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,s,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,s,0);else throw Error("Unknown depthTexture format")}function O(t){let i=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(i.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(i.__depthDisposeCallback&&i.__depthDisposeCallback(),e){let t=()=>{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");let e=t.texture.mipmaps;e&&e.length>0?U(i.__webglFramebuffer[0],t):U(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),void 0===i.__webglDepthbuffer[r])i.__webglDepthbuffer[r]=e.createRenderbuffer(),D(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),void 0===i.__webglDepthbuffer)i.__webglDepthbuffer=e.createRenderbuffer(),D(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}let F=[],k=[];function z(e){return Math.min(i.maxSamples,e.samples)}function B(e){let n=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function H(e,t){let n=e.colorSpace,r=e.format,i=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==tQ&&n!==tK&&(n8.getTransfer(n)===t1?(r!==e0||i!==ez)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function V(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=w;return e>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+i.maxTextures),w+=1,e},this.resetTextureUnits=function(){w=0},this.setTexture2D=E,this.setTexture2DArray=function(t,i){let a=r.get(t);if(!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version)return void L(a,t,i);n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)},this.setTexture3D=function(t,i){let a=r.get(t);if(!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version)return void L(a,t,i);n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,s){let o=r.get(t);if(t.version>0&&o.__version!==t.version)return void function(t,s,o){if(6!==s.image.length)return;let l=P(t,s),u=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let c=r.get(u);if(u.version!==c.__version||!0===l){let t;n.activeTexture(e.TEXTURE0+o);let r=n8.getPrimaries(n8.workingColorSpace),h=s.colorSpace===tK?null:n8.getPrimaries(s.colorSpace),d=s.colorSpace===tK||r===h?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,_=[];for(let e=0;e<6;e++)p||f?_[e]=f?s.image[e].image:s.image[e]:_[e]=m(s.image[e],!0,i.maxCubemapSize),_[e]=H(s,_[e]);let b=_[0],S=a.convert(s.format,s.colorSpace),M=a.convert(s.type),w=y(s.internalFormat,S,M,s.colorSpace),E=!0!==s.isVideoTexture,T=void 0===c.__version||!0===l,A=u.dataReady,C=x(s,b);if(R(e.TEXTURE_CUBE_MAP,s),p){E&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,w,b.width,b.height);for(let r=0;r<6;r++){t=_[r].mipmaps;for(let i=0;i<t.length;i++){let a=t[i];s.format!==e0?null!==S?E?A&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,0,0,a.width,a.height,S,a.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,w,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):E?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,0,0,a.width,a.height,S,M,a.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,w,a.width,a.height,0,S,M,a.data)}}}else{if(t=s.mipmaps,E&&T){t.length>0&&C++;let r=V(_[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,C,w,r.width,r.height)}for(let r=0;r<6;r++)if(f){E?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,_[r].width,_[r].height,S,M,_[r].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,w,_[r].width,_[r].height,0,S,M,_[r].data);for(let i=0;i<t.length;i++){let a=t[i].image[r].image;E?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i+1,0,0,a.width,a.height,S,M,a.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i+1,w,a.width,a.height,0,S,M,a.data)}}else{E?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,S,M,_[r]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,w,S,M,_[r]);for(let i=0;i<t.length;i++){let a=t[i];E?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i+1,0,0,S,M,a.image[r]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i+1,w,S,M,a.image[r])}}}g(s)&&v(e.TEXTURE_CUBE_MAP),c.__version=u.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s);n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,n,i){let a=r.get(t);void 0!==n&&N(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==i&&O(t)},this.setupRenderTarget=function(t){let i=t.texture,o=r.get(t),l=r.get(i);t.addEventListener("dispose",S);let u=t.textures,c=!0===t.isWebGLCubeRenderTarget,h=u.length>1;if(!h&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=i.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n<i.mipmaps.length;n++)o.__webglFramebuffer[t][n]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(i.mipmaps&&i.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<i.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(h)for(let t=0,n=u.length;t<n;t++){let n=r.get(u[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===B(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<u.length;n++){let r=u[n];o.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[n]);let i=a.convert(r.format,r.colorSpace),s=a.convert(r.type),l=y(r.internalFormat,i,s,r.colorSpace,!0===t.isXRRenderTarget),c=z(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,o.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),D(o.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),R(e.TEXTURE_CUBE_MAP,i);for(let n=0;n<6;n++)if(i.mipmaps&&i.mipmaps.length>0)for(let r=0;r<i.mipmaps.length;r++)N(o.__webglFramebuffer[n][r],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r);else N(o.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(i)&&v(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(let i=0,a=u.length;i<a;i++){let a=u[i],s=r.get(a),l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(l,s.__webglTexture),R(l,a),N(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+i,l,0),g(a)&&v(l)}n.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(r,l.__webglTexture),R(r,i),i.mipmaps&&i.mipmaps.length>0)for(let n=0;n<i.mipmaps.length;n++)N(o.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,r,n);else N(o.__webglFramebuffer,t,i,e.COLOR_ATTACHMENT0,r,0);g(i)&&v(r),n.unbindTexture()}t.depthBuffer&&O(t)},this.updateRenderTargetMipmap=function(t){let i=t.textures;for(let a=0,s=i.length;a<s;a++){let s=i[a];if(g(s)){let i=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D,a=r.get(s).__webglTexture;n.bindTexture(i,a),v(i),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===B(t)){let i=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),h=i.length>1;if(h)for(let t=0;t<i.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer);let d=t.texture.mipmaps;d&&d.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n<i.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),h){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[n]);let t=r.get(i[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===u&&(F.length=0,k.length=0,F.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(F.push(l),k.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,k)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,F))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),h)for(let t=0;t<i.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,c.__webglColorRenderbuffer[t]);let a=r.get(i[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&u){let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}},this.setupDepthRenderbuffer=O,this.setupFrameBufferTexture=N,this.useMultisampledRTT=B}function dJ(e,t){return{convert:function(n){let r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tK,a=n8.getTransfer(i);if(n===ez)return e.UNSIGNED_BYTE;if(n===eq)return e.UNSIGNED_SHORT_4_4_4_4;if(n===eY)return e.UNSIGNED_SHORT_5_5_5_1;if(n===eZ)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===eK)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===eB)return e.BYTE;if(n===eH)return e.SHORT;if(n===eV)return e.UNSIGNED_SHORT;if(n===eG)return e.INT;if(n===eW)return e.UNSIGNED_INT;if(n===ej)return e.FLOAT;if(n===eX)return e.HALF_FLOAT;if(n===e$)return e.ALPHA;if(n===eQ)return e.RGB;if(n===e0)return e.RGBA;if(n===e1)return e.DEPTH_COMPONENT;if(n===e2)return e.DEPTH_STENCIL;if(n===e3)return e.RED;if(n===e4)return e.RED_INTEGER;if(n===e5)return e.RG;if(n===e6)return e.RG_INTEGER;if(n===e9)return e.RGBA_INTEGER;if(n===e7||n===te||n===tt||n===tn)if(a===t1){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===e7)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===te)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===tt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===tn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===e7)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===te)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===tt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===tn)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===tr||n===ti||n===ta||n===ts){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===tr)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ti)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ta)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ts)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===to||n===tl||n===tu){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(n===to||n===tl)return a===t1?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===tu)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===tc||n===th||n===td||n===tp||n===tf||n===tm||n===tg||n===tv||n===ty||n===t_||n===tx||n===tb||n===tS||n===tM){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(n===tc)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===th)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===td)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===tp)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===tf)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===tm)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===tg)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===tv)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ty)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===t_)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===tx)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===tb)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===tS)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===tM)return a===t1?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===tw||n===tE||n===tT){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(n===tw)return a===t1?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===tE)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===tT)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===tA||n===tC||n===tR||n===tP){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(n===tA)return r.COMPRESSED_RED_RGTC1_EXT;if(n===tC)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===tR)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===tP)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===eJ?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class dZ{init(e,t){if(null===this.texture){let n=new s9(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,n=new au({vertexShader:"\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n if ( coord.x >= 1.0 ) {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n } else {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n }\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new an(new o4(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}}class dK extends nL{constructor(e,t){super();let n=this,r=null,i=1,a=null,s="local-floor",o=1,l=null,u=null,c=null,h=null,d=null,p=null,f="undefined"!=typeof XRWebGLBinding,m=new dZ,g={},v=t.getContextAttributes(),y=null,_=null,x=[],b=[],S=new nW,M=null,w=new af;w.viewport=new ro;let E=new af;E.viewport=new ro;let T=[w,E],A=new uS,C=null,R=null;function P(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function I(){r.removeEventListener("select",P),r.removeEventListener("selectstart",P),r.removeEventListener("selectend",P),r.removeEventListener("squeeze",P),r.removeEventListener("squeezestart",P),r.removeEventListener("squeezeend",P),r.removeEventListener("end",I),r.removeEventListener("inputsourceschange",L);for(let e=0;e<x.length;e++){let t=b[e];null!==t&&(b[e]=null,x[e].disconnect(t))}for(let e in C=null,R=null,m.reset(),g)delete g[e];e.setRenderTarget(y),d=null,h=null,c=null,r=null,_=null,F.stop(),n.isPresenting=!1,e.setPixelRatio(M),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:"sessionend"})}function L(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=b.indexOf(n);r>=0&&(b[r]=null,x[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=b.indexOf(n);if(-1===r){for(let e=0;e<x.length;e++)if(e>=b.length){b.push(n),r=e;break}else if(null===b[e]){b[e]=n,r=e;break}if(-1===r)break}let i=x[r];i&&i.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new ax,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return null===c&&f&&(c=new XRWebGLBinding(r,t)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(y=e.getRenderTarget(),r.addEventListener("select",P),r.addEventListener("selectstart",P),r.addEventListener("selectend",P),r.addEventListener("squeeze",P),r.addEventListener("squeezestart",P),r.addEventListener("squeezeend",P),r.addEventListener("end",I),r.addEventListener("inputsourceschange",L),!0!==v.xrCompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(S),f&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,a=null,s=null;v.depth&&(s=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?e2:e1,a=v.stencil?eJ:eW);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:i};h=(c=this.getBinding()).createProjectionLayer(o),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),_=new ru(h.textureWidth,h.textureHeight,{format:e0,type:ez,depthTexture:new s8(h.textureWidth,h.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:4*!!v.antialias,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{let n={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:i};d=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),_=new ru(d.framebufferWidth,d.framebufferHeight,{format:e0,type:ez,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await r.requestReferenceSpace(s),F.setContext(r),F.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};let N=new nX,D=new nX;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,n,i;if(null===r)return;let a=e.near,s=e.far;null!==m.texture&&(m.depthNear>0&&(a=m.depthNear),m.depthFar>0&&(s=m.depthFar)),A.near=E.near=w.near=a,A.far=E.far=w.far=s,(C!==A.near||R!==A.far)&&(r.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,R=A.far),A.layers.mask=6|e.layers.mask,w.layers.mask=3&A.layers.mask,E.layers.mask=5&A.layers.mask;let o=e.parent,l=A.cameras;U(A,o);for(let e=0;e<l.length;e++)U(l[e],o);2===l.length?function(e,t,n){N.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);let r=N.distanceTo(D),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,s=i[14]/(i[10]-1),o=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=r/(-c+h),p=-(d*c);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===i[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=s+d,n=o+d;e.projectionMatrix.makePerspective(s*c-p,s*h+(r-p),l*o/n*t,u*o/n*t,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(A,w,E):A.projectionMatrix.copy(w.projectionMatrix),t=e,n=A,null===(i=o)?t.matrix.copy(n.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(n.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(n.projectionMatrix),t.projectionMatrixInverse.copy(n.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*nO*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return A},this.getFoveation=function(){if(null!==h||null!==d)return o},this.setFoveation=function(e){o=e,null!==h&&(h.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(A)},this.getCameraTexture=function(e){return g[e]};let O=null,F=new cW;F.setAnimationLoop(function(t,i){if(u=i.getViewerPose(l||a),p=i,null!==u){let t=u.views;null!==d&&(e.setRenderTargetFramebuffer(_,d.framebuffer),e.setRenderTarget(_));let i=!1;t.length!==A.cameras.length&&(A.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(null!==d)a=d.getViewport(r);else{let t=c.getViewSubImage(h,r);a=t.viewport,0===n&&(e.setRenderTargetTextures(_,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(_))}let s=T[n];void 0===s&&((s=new af).layers.enable(n),s.viewport=new ro,T[n]=s),s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(r.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===n&&(A.matrix.copy(s.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),!0===i&&A.cameras.push(s)}let a=r.enabledFeatures;if(a&&a.includes("depth-sensing")&&"gpu-optimized"==r.depthUsage&&f){let e=(c=n.getBinding()).getDepthInformation(t[0]);e&&e.isValid&&e.texture&&m.init(e,r.renderState)}if(a&&a.includes("camera-access")&&f){e.state.unbindTexture(),c=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new s9,g[n]=e);let t=c.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<x.length;e++){let t=b[e],n=x[e];null!==t&&void 0!==n&&n.update(t,i,l||a)}O&&O(t,i),i.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:i}),p=null}),this.setAnimationLoop=function(e){O=e},this.dispose=function(){}}}let d$=new rK,dQ=new rH;function d0(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function r(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===E&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===E&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,s=i.envMapRotation;a&&(e.envMap.value=a,d$.copy(s),d$.x*=-1,d$.y*=-1,d$.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(d$.y*=-1,d$.z*=-1),e.envMapRotation.value.setFromMatrix4(dQ.makeRotationFromEuler(d$)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,ao(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,a,s,o){var l,u,c,h,d,p,f,m,g,v,y,_,x,b,S,M,w,T,A,C,R;i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),l=e,(u=i).gradientMap&&(l.gradientMap.value=u.gradientMap)):i.isMeshPhongMaterial?(r(e,i),c=e,h=i,c.specular.value.copy(h.specular),c.shininess.value=Math.max(h.shininess,1e-4)):i.isMeshStandardMaterial?(r(e,i),d=e,p=i,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),i.isMeshPhysicalMaterial&&(f=e,m=i,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===E&&f.clearcoatNormalScale.value.negate())),m.dispersion>0&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,f.specularIntensityMapTransform)))):i.isMeshMatcapMaterial?(r(e,i),v=e,(y=i).matcap&&(v.matcap.value=y.matcap)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(_=e,x=i,_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,x.map&&(_.map.value=x.map,n(x.map,_.mapTransform)),i.isLineDashedMaterial&&(b=e,S=i,b.dashSize.value=S.dashSize,b.totalSize.value=S.dashSize+S.gapSize,b.scale.value=S.scale)):i.isPointsMaterial?(M=e,w=i,T=a,A=s,M.diffuse.value.copy(w.color),M.opacity.value=w.opacity,M.size.value=w.size*T,M.scale.value=.5*A,w.map&&(M.map.value=w.map,n(w.map,M.uvTransform)),w.alphaMap&&(M.alphaMap.value=w.alphaMap,n(w.alphaMap,M.alphaMapTransform)),w.alphaTest>0&&(M.alphaTest.value=w.alphaTest)):i.isSpriteMaterial?(C=e,R=i,C.diffuse.value.copy(R.color),C.opacity.value=R.opacity,C.rotation.value=R.rotation,R.map&&(C.map.value=R.map,n(R.map,C.mapTransform)),R.alphaMap&&(C.alphaMap.value=R.alphaMap,n(R.alphaMap,C.alphaMapTransform)),R.alphaTest>0&&(C.alphaTest.value=R.alphaTest)):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function d1(e,t,n,r){let i={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function u(t){let n=t.target;n.removeEventListener("dispose",u);let r=s.indexOf(n.__bindingPointIndex);s.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(e,t){let n=t.program;r.uniformBlockBinding(e,n)},update:function(n,c){let h=i[n.id];void 0===h&&(function(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=l(i[e]),a=n%16,s=a%r.boundary,o=a+s;n+=s,0!==o&&16-o<r.storage&&(n+=16-o),t.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=r.storage}}}let r=n%16;r>0&&(n+=16-r),e.__size=n,e.__cache={}}(n),h=function(t){let n=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}(n),i[n.id]=h,n.addEventListener("dispose",u));let d=c.program;r.updateUBOMapping(n,d);let p=t.render.frame;a[n.id]!==p&&(function(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=r.length;t<n;t++){let n=Array.isArray(r[t])?r[t]:[r[t]];for(let r=0,i=n.length;r<i;r++){let i=n[r];if(!0===function(e,t,n,r){let i=e.value,a=t+"_"+n;if(void 0===r[a])return"number"==typeof i||"boolean"==typeof i?r[a]=i:r[a]=i.clone(),!0;{let e=r[a];if("number"==typeof i||"boolean"==typeof i){if(e!==i)return r[a]=i,!0}else if(!1===e.equals(i))return e.copy(i),!0}return!1}(i,t,r,a)){let t=i.__offset,n=Array.isArray(i.value)?i.value:[i.value],r=0;for(let a=0;a<n.length;a++){let s=n[a],o=l(s);"number"==typeof s||"boolean"==typeof s?(i.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+r,i.__data)):s.isMatrix3?(i.__data[0]=s.elements[0],i.__data[1]=s.elements[1],i.__data[2]=s.elements[2],i.__data[3]=0,i.__data[4]=s.elements[3],i.__data[5]=s.elements[4],i.__data[6]=s.elements[5],i.__data[7]=0,i.__data[8]=s.elements[6],i.__data[9]=s.elements[7],i.__data[10]=s.elements[8],i.__data[11]=0):(s.toArray(i.__data,r),r+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,i.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(let t in i)e.deleteBuffer(i[t]);s=[],i={},a={}}}}class d2{get coordinateSystem(){return nA}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=n8._getDrawingBufferColorSpace(e),t.unpackColorSpace=n8._getUnpackColorSpace()}constructor(e={}){let t,n,r,i,a,s,o,l,u,c,h,d,f,m,g,v,y,_,x,b,S,M,A,C,R,{canvas:P=n1(),context:I=null,depth:L=!0,stencil:N=!1,alpha:D=!1,antialias:U=!1,premultipliedAlpha:O=!0,preserveDrawingBuffer:F=!1,powerPreference:k="default",failIfMajorPerformanceCaveat:z=!1,reversedDepthBuffer:B=!1}=e;if(this.isWebGLRenderer=!0,null!==I){if("undefined"!=typeof WebGLRenderingContext&&I instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=I.getContextAttributes().alpha}else t=D;let H=new Uint32Array(4),V=new Int32Array(4),G=null,W=null,j=[],X=[];this.domElement=P,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ec,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let q=this,Y=!1;this._outputColorSpace=t$;let J=0,Z=0,K=null,$=-1,Q=null,ee=new ro,et=new ro,en=null,er=new iE(0),ei=0,ea=P.width,es=P.height,eo=1,el=null,eu=null,eh=new ro(0,0,ea,es),ed=new ro(0,0,ea,es),ep=!1,ef=new sd,em=!1,eg=!1,ev=new rH,ey=new nX,e_=new ro,ex={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},eb=!1;function eS(){return null===K?eo:1}let eM=I;function ew(e,t){return P.getContext(e,t)}try{if("setAttribute"in P&&P.setAttribute("data-engine","three.js r".concat(p)),P.addEventListener("webglcontextlost",eA,!1),P.addEventListener("webglcontextrestored",eC,!1),P.addEventListener("webglcontextcreationerror",eR,!1),null===eM){let e="webgl2";if(eM=ew(e,{alpha:!0,depth:L,stencil:N,antialias:U,premultipliedAlpha:O,preserveDrawingBuffer:F,powerPreference:k,failIfMajorPerformanceCaveat:z}),null===eM)if(ew(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function eE(){(n=new hd(eM)).init(),A=new dJ(eM,n),r=new c1(eM,n,e,A),i=new dq(eM,n),r.reversedDepthBuffer&&B&&i.buffers.depth.setReversed(!0),a=new hm(eM),s=new dD,o=new dY(eM,n,i,s,r,A,a),l=new c3(q),u=new hh(q),c=new cj(eM),C=new cQ(eM,c),h=new hp(eM,c,a,C),d=new hv(eM,h,c,a),b=new hg(eM,r,o),y=new c2(s),f=new dN(q,l,u,n,r,C,y),m=new d0(q,s),g=new dk,v=new dW(n),x=new c$(q,l,u,i,d,t,O),_=new dj(q,d,r),R=new d1(eM,a,r,i),S=new c0(eM,n,a),M=new hf(eM,n,a),a.programs=f.programs,q.capabilities=r,q.extensions=n,q.properties=s,q.renderLists=g,q.shadowMap=_,q.state=i,q.info=a}eE();let eT=new dK(q,eM);function eA(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),Y=!0}function eC(){console.log("THREE.WebGLRenderer: Context Restored."),Y=!1;let e=a.autoReset,t=_.enabled,n=_.autoUpdate,r=_.needsUpdate,i=_.type;eE(),a.autoReset=e,_.enabled=t,_.autoUpdate=n,_.needsUpdate=r,_.type=i}function eR(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eP(e){var t;let n=e.target;n.removeEventListener("dispose",eP),function(e){let t=s.get(e).programs;void 0!==t&&(t.forEach(function(e){f.releaseProgram(e)}),e.isShaderMaterial&&f.releaseShaderCache(e))}(t=n),s.remove(t)}function eI(e,t,n){!0===e.transparent&&e.side===T&&!1===e.forceSinglePass?(e.side=E,e.needsUpdate=!0,ej(e,t,n),e.side=w,e.needsUpdate=!0,ej(e,t,n),e.side=T):ej(e,t,n)}this.xr=eT,this.getContext=function(){return eM},this.getContextAttributes=function(){return eM.getContextAttributes()},this.forceContextLoss=function(){let e=n.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=n.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return eo},this.setPixelRatio=function(e){void 0!==e&&(eo=e,this.setSize(ea,es,!1))},this.getSize=function(e){return e.set(ea,es)},this.setSize=function(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(eT.isPresenting)return void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");ea=e,es=t,P.width=Math.floor(e*eo),P.height=Math.floor(t*eo),!0===n&&(P.style.width=e+"px",P.style.height=t+"px"),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(ea*eo,es*eo).floor()},this.setDrawingBufferSize=function(e,t,n){ea=e,es=t,eo=n,P.width=Math.floor(e*n),P.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(ee)},this.getViewport=function(e){return e.copy(eh)},this.setViewport=function(e,t,n,r){e.isVector4?eh.set(e.x,e.y,e.z,e.w):eh.set(e,t,n,r),i.viewport(ee.copy(eh).multiplyScalar(eo).round())},this.getScissor=function(e){return e.copy(ed)},this.setScissor=function(e,t,n,r){e.isVector4?ed.set(e.x,e.y,e.z,e.w):ed.set(e,t,n,r),i.scissor(et.copy(ed).multiplyScalar(eo).round())},this.getScissorTest=function(){return ep},this.setScissorTest=function(e){i.setScissorTest(ep=e)},this.setOpaqueSort=function(e){el=e},this.setTransparentSort=function(e){eu=e},this.getClearColor=function(e){return e.copy(x.getClearColor())},this.setClearColor=function(){x.setClearColor(...arguments)},this.getClearAlpha=function(){return x.getClearAlpha()},this.setClearAlpha=function(){x.setClearAlpha(...arguments)},this.clear=function(){let 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;if(e){let e=!1;if(null!==K){let t=K.texture.format;e=t===e9||t===e6||t===e4}if(e){let e=K.texture.type,t=e===ez||e===eW||e===eV||e===eJ||e===eq||e===eY,n=x.getClearColor(),r=x.getClearAlpha(),i=n.r,a=n.g,s=n.b;t?(H[0]=i,H[1]=a,H[2]=s,H[3]=r,eM.clearBufferuiv(eM.COLOR,0,H)):(V[0]=i,V[1]=a,V[2]=s,V[3]=r,eM.clearBufferiv(eM.COLOR,0,V))}else r|=eM.COLOR_BUFFER_BIT}t&&(r|=eM.DEPTH_BUFFER_BIT),n&&(r|=eM.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),eM.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(){P.removeEventListener("webglcontextlost",eA,!1),P.removeEventListener("webglcontextrestored",eC,!1),P.removeEventListener("webglcontextcreationerror",eR,!1),x.dispose(),g.dispose(),v.dispose(),s.dispose(),l.dispose(),u.dispose(),d.dispose(),C.dispose(),R.dispose(),f.dispose(),eT.dispose(),eT.removeEventListener("sessionstart",eN),eT.removeEventListener("sessionend",eD),eU.stop()},this.renderBufferDirect=function(e,t,a,d,p,f){let g;null===t&&(t=ex);let v=p.isMesh&&0>p.matrixWorld.determinant(),_=function(e,t,n,a,c){var h,d;!0!==t.isScene&&(t=ex),o.resetTextureUnits();let p=t.fog,f=a.isMeshStandardMaterial?t.environment:null,g=null===K?q.outputColorSpace:!0===K.isXRRenderTarget?K.texture.colorSpace:tQ,v=(a.isMeshStandardMaterial?u:l).get(a.envMap||f),_=!0===a.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,x=!!n.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),S=!!n.morphAttributes.position,M=!!n.morphAttributes.normal,w=!!n.morphAttributes.color,E=ec;a.toneMapped&&(null===K||!0===K.isXRRenderTarget)&&(E=q.toneMapping);let T=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,A=void 0!==T?T.length:0,C=s.get(a),P=W.state.lights;if(!0===em&&(!0===eg||e!==Q)){let t=e===Q&&a.id===$;y.setState(a,e,t)}let I=!1;a.version===C.__version?C.needsLights&&C.lightsStateVersion!==P.state.version||C.outputColorSpace!==g||c.isBatchedMesh&&!1===C.batching?I=!0:c.isBatchedMesh||!0!==C.batching?c.isBatchedMesh&&!0===C.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===C.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===C.instancing?I=!0:c.isInstancedMesh||!0!==C.instancing?c.isSkinnedMesh&&!1===C.skinning?I=!0:c.isSkinnedMesh||!0!==C.skinning?c.isInstancedMesh&&!0===C.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===C.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===C.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===C.instancingMorph&&null!==c.morphTexture||C.envMap!==v||!0===a.fog&&C.fog!==p||void 0!==C.numClippingPlanes&&(C.numClippingPlanes!==y.numPlanes||C.numIntersection!==y.numIntersection)||C.vertexAlphas!==_||C.vertexTangents!==x||C.morphTargets!==S||C.morphNormals!==M||C.morphColors!==w||C.toneMapping!==E?I=!0:C.morphTargetsCount!==A&&(I=!0):I=!0:I=!0:I=!0:(I=!0,C.__version=a.version);let L=C.currentProgram;!0===I&&(L=ej(a,t,c));let N=!1,D=!1,U=!1,O=L.getUniforms(),F=C.uniforms;if(i.useProgram(L.program)&&(N=!0,D=!0,U=!0),a.id!==$&&($=a.id,D=!0),N||Q!==e){i.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eM,"projectionMatrix",e.projectionMatrix),O.setValue(eM,"viewMatrix",e.matrixWorldInverse);let t=O.map.cameraPosition;void 0!==t&&t.setValue(eM,ey.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&O.setValue(eM,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&O.setValue(eM,"isOrthographic",!0===e.isOrthographicCamera),Q!==e&&(Q=e,D=!0,U=!0)}if(c.isSkinnedMesh){O.setOptional(eM,c,"bindMatrix"),O.setOptional(eM,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eM,"boneTexture",e.boneTexture,o))}c.isBatchedMesh&&(O.setOptional(eM,c,"batchingTexture"),O.setValue(eM,"batchingTexture",c._matricesTexture,o),O.setOptional(eM,c,"batchingIdTexture"),O.setValue(eM,"batchingIdTexture",c._indirectTexture,o),O.setOptional(eM,c,"batchingColorTexture"),null!==c._colorsTexture&&O.setValue(eM,"batchingColorTexture",c._colorsTexture,o));let k=n.morphAttributes;if((void 0!==k.position||void 0!==k.normal||void 0!==k.color)&&b.update(c,n,L),(D||C.receiveShadow!==c.receiveShadow)&&(C.receiveShadow=c.receiveShadow,O.setValue(eM,"receiveShadow",c.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(F.envMap.value=v,F.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(F.envMapIntensity.value=t.environmentIntensity),D&&(O.setValue(eM,"toneMappingExposure",q.toneMappingExposure),C.needsLights&&(h=F,d=U,h.ambientLightColor.needsUpdate=d,h.lightProbe.needsUpdate=d,h.directionalLights.needsUpdate=d,h.directionalLightShadows.needsUpdate=d,h.pointLights.needsUpdate=d,h.pointLightShadows.needsUpdate=d,h.spotLights.needsUpdate=d,h.spotLightShadows.needsUpdate=d,h.rectAreaLights.needsUpdate=d,h.hemisphereLights.needsUpdate=d),p&&!0===a.fog&&m.refreshFogUniforms(F,p),m.refreshMaterialUniforms(F,a,eo,es,W.state.transmissionRenderTarget[e.id]),dd.upload(eM,eZ(C),F,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(dd.upload(eM,eZ(C),F,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&O.setValue(eM,"center",c.center),O.setValue(eM,"modelViewMatrix",c.modelViewMatrix),O.setValue(eM,"normalMatrix",c.normalMatrix),O.setValue(eM,"modelMatrix",c.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];R.update(n,L),R.bind(n,L)}}return L}(e,t,a,d,p);i.setMaterial(d,v);let x=a.index,w=1;if(!0===d.wireframe){if(void 0===(x=h.getWireframeAttribute(a)))return;w=2}let E=a.drawRange,T=a.attributes.position,A=E.start*w,P=(E.start+E.count)*w;null!==f&&(A=Math.max(A,f.start*w),P=Math.min(P,(f.start+f.count)*w)),null!==x?(A=Math.max(A,0),P=Math.min(P,x.count)):null!=T&&(A=Math.max(A,0),P=Math.min(P,T.count));let I=P-A;if(I<0||I===1/0)return;C.setup(p,d,_,a,x);let L=S;if(null!==x&&(g=c.get(x),(L=M).setIndex(g)),p.isMesh)!0===d.wireframe?(i.setLineWidth(d.wireframeLinewidth*eS()),L.setMode(eM.LINES)):L.setMode(eM.TRIANGLES);else if(p.isLine){let e=d.linewidth;void 0===e&&(e=1),i.setLineWidth(e*eS()),p.isLineSegments?L.setMode(eM.LINES):p.isLineLoop?L.setMode(eM.LINE_LOOP):L.setMode(eM.LINE_STRIP)}else p.isPoints?L.setMode(eM.POINTS):p.isSprite&&L.setMode(eM.TRIANGLES);if(p.isBatchedMesh)if(null!==p._multiDrawInstances)n3("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),L.renderMultiDrawInstances(p._multiDrawStarts,p._multiDrawCounts,p._multiDrawCount,p._multiDrawInstances);else if(n.get("WEBGL_multi_draw"))L.renderMultiDraw(p._multiDrawStarts,p._multiDrawCounts,p._multiDrawCount);else{let e=p._multiDrawStarts,t=p._multiDrawCounts,n=p._multiDrawCount,r=x?c.get(x).bytesPerElement:1,i=s.get(d).currentProgram.getUniforms();for(let a=0;a<n;a++)i.setValue(eM,"_gl_DrawID",a),L.render(e[a]/r,t[a])}else if(p.isInstancedMesh)L.renderInstances(A,I,p.count);else if(a.isInstancedBufferGeometry){let e=void 0!==a._maxInstanceCount?a._maxInstanceCount:1/0,t=Math.min(a.instanceCount,e);L.renderInstances(A,I,t)}else L.render(A,I)},this.compile=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null===n&&(n=e),(W=v.get(n)).init(t),X.push(W),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),W.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let i=0;i<t.length;i++){let a=t[i];eI(a,n,e),r.add(a)}else eI(t,n,e),r.add(t)}),W=X.pop(),r},this.compileAsync=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this.compile(e,t,r);return new Promise(t=>{function r(){if(i.forEach(function(e){s.get(e).currentProgram.isReady()&&i.delete(e)}),0===i.size)return void t(e);setTimeout(r,10)}null!==n.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eL=null;function eN(){eU.stop()}function eD(){eU.start()}let eU=new cW;function eO(e,t,n,r){if(!1===e.visible)return;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)W.pushLight(e),e.castShadow&&W.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ef.intersectsSprite(e)){r&&e_.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ev);let t=d.update(e),i=e.material;i.visible&&G.push(e,t,i,n,e_.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ef.intersectsObject(e))){let t=d.update(e),i=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),e_.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),e_.copy(t.boundingSphere.center)),e_.applyMatrix4(e.matrixWorld).applyMatrix4(ev)),Array.isArray(i)){let r=t.groups;for(let a=0,s=r.length;a<s;a++){let s=r[a],o=i[s.materialIndex];o&&o.visible&&G.push(e,t,o,n,e_.z,s)}}else i.visible&&G.push(e,t,i,n,e_.z,null)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)eO(i[e],t,n,r)}function ek(e,t,n,r){let a=e.opaque,s=e.transmissive,o=e.transparent;W.setupLightsView(n),!0===em&&y.setGlobalState(q.clippingPlanes,n),r&&i.viewport(ee.copy(r)),a.length>0&&eH(a,t,n),s.length>0&&eH(s,t,n),o.length>0&&eH(o,t,n),i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),i.setPolygonOffset(!1)}function eB(e,t,r,i){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;void 0===W.state.transmissionRenderTarget[i.id]&&(W.state.transmissionRenderTarget[i.id]=new ru(1,1,{generateMipmaps:!0,type:n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float")?eX:ez,minFilter:eF,samples:4,stencilBuffer:N,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:n8.workingColorSpace}));let a=W.state.transmissionRenderTarget[i.id],s=i.viewport||ee;a.setSize(s.z*q.transmissionResolutionScale,s.w*q.transmissionResolutionScale);let l=q.getRenderTarget(),u=q.getActiveCubeFace(),c=q.getActiveMipmapLevel();q.setRenderTarget(a),q.getClearColor(er),(ei=q.getClearAlpha())<1&&q.setClearColor(0xffffff,.5),q.clear(),eb&&x.render(r);let h=q.toneMapping;q.toneMapping=ec;let d=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),W.setupLightsView(i),!0===em&&y.setGlobalState(q.clippingPlanes,i),eH(e,r,i),o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a),!1===n.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let n=0,a=t.length;n<a;n++){let a=t[n],s=a.object,o=a.geometry,l=a.material,u=a.group;if(l.side===T&&s.layers.test(i.layers)){let t=l.side;l.side=E,l.needsUpdate=!0,eG(s,r,i,o,l,u),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a))}q.setRenderTarget(l,u,c),q.setClearColor(er,ei),void 0!==d&&(i.viewport=d),q.toneMapping=h}function eH(e,t,n){let r=!0===t.isScene?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],s=a.object,o=a.geometry,l=a.group,u=a.material;!0===u.allowOverride&&null!==r&&(u=r),s.layers.test(n.layers)&&eG(s,t,n,o,u,l)}}function eG(e,t,n,r,i,a){e.onBeforeRender(q,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(q,t,n,r,e,a),!0===i.transparent&&i.side===T&&!1===i.forceSinglePass?(i.side=E,i.needsUpdate=!0,q.renderBufferDirect(n,t,r,i,e,a),i.side=w,i.needsUpdate=!0,q.renderBufferDirect(n,t,r,i,e,a),i.side=T):q.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(q,t,n,r,i,a)}function ej(e,t,n){var r;!0!==t.isScene&&(t=ex);let i=s.get(e),a=W.state.lights,o=W.state.shadowsArray,c=a.state.version,h=f.getParameters(e,a.state,o,t,n),d=f.getProgramCacheKey(h),p=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?u:l).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===p&&(e.addEventListener("dispose",eP),i.programs=p=new Map);let m=p.get(d);if(void 0!==m){if(i.currentProgram===m&&i.lightsStateVersion===c)return eK(e,h),m}else h.uniforms=f.getUniforms(e),e.onBeforeCompile(h,q),m=f.acquireProgram(h,d),p.set(d,m),i.uniforms=h.uniforms;let g=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(g.clippingPlanes=y.uniform),eK(e,h),i.needsLights=(r=e).isMeshLambertMaterial||r.isMeshToonMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isShadowMaterial||r.isShaderMaterial&&!0===r.lights,i.lightsStateVersion=c,i.needsLights&&(g.ambientLightColor.value=a.state.ambient,g.lightProbe.value=a.state.probe,g.directionalLights.value=a.state.directional,g.directionalLightShadows.value=a.state.directionalShadow,g.spotLights.value=a.state.spot,g.spotLightShadows.value=a.state.spotShadow,g.rectAreaLights.value=a.state.rectArea,g.ltc_1.value=a.state.rectAreaLTC1,g.ltc_2.value=a.state.rectAreaLTC2,g.pointLights.value=a.state.point,g.pointLightShadows.value=a.state.pointShadow,g.hemisphereLights.value=a.state.hemi,g.directionalShadowMap.value=a.state.directionalShadowMap,g.directionalShadowMatrix.value=a.state.directionalShadowMatrix,g.spotShadowMap.value=a.state.spotShadowMap,g.spotLightMatrix.value=a.state.spotLightMatrix,g.spotLightMap.value=a.state.spotLightMap,g.pointShadowMap.value=a.state.pointShadowMap,g.pointShadowMatrix.value=a.state.pointShadowMatrix),i.currentProgram=m,i.uniformsList=null,m}function eZ(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=dd.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function eK(e,t){let n=s.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,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}eU.setAnimationLoop(function(e){eL&&eL(e)}),"undefined"!=typeof self&&eU.setContext(self),this.setAnimationLoop=function(e){eL=e,eT.setAnimationLoop(e),null===e?eU.stop():eU.start()},eT.addEventListener("sessionstart",eN),eT.addEventListener("sessionend",eD),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===Y)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eT.enabled&&!0===eT.isPresenting&&(!0===eT.cameraAutoUpdate&&eT.updateCamera(t),t=eT.getCamera()),!0===e.isScene&&e.onBeforeRender(q,e,t,K),(W=v.get(e,X.length)).init(t),X.push(W),ev.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ef.setFromProjectionMatrix(ev,nA,t.reversedDepth),eg=this.localClippingEnabled,em=y.init(this.clippingPlanes,eg),(G=g.get(e,j.length)).init(),j.push(G),!0===eT.enabled&&!0===eT.isPresenting){let e=q.xr.getDepthSensingMesh();null!==e&&eO(e,t,-1/0,q.sortObjects)}eO(e,t,0,q.sortObjects),G.finish(),!0===q.sortObjects&&G.sort(el,eu),(eb=!1===eT.enabled||!1===eT.isPresenting||!1===eT.hasDepthSensing())&&x.addToRenderList(G,e),this.info.render.frame++,!0===em&&y.beginShadows();let n=W.state.shadowsArray;_.render(n,e,t),!0===em&&y.endShadows(),!0===this.info.autoReset&&this.info.reset();let r=G.opaque,i=G.transmissive;if(W.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t<a;t++)eB(r,i,e,n[t]);eb&&x.render(e);for(let t=0,r=n.length;t<r;t++){let r=n[t];ek(G,e,r,r.viewport)}}else i.length>0&&eB(r,i,e,t),eb&&x.render(e),ek(G,e,t);null!==K&&0===Z&&(o.updateMultisampleRenderTarget(K),o.updateRenderTargetMipmap(K)),!0===e.isScene&&e.onAfterRender(q,e,t),C.resetDefaultState(),$=-1,Q=null,X.pop(),X.length>0?(W=X[X.length-1],!0===em&&y.setGlobalState(q.clippingPlanes,W.state.camera)):W=null,j.pop(),G=j.length>0?j[j.length-1]:null},this.getActiveCubeFace=function(){return J},this.getActiveMipmapLevel=function(){return Z},this.getRenderTarget=function(){return K},this.setRenderTargetTextures=function(e,t,n){let r=s.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=s.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};let e$=eM.createFramebuffer();this.setRenderTarget=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;K=e,J=t,Z=n;let r=!0,a=null,l=!1,u=!1;if(e){let c=s.get(e);if(void 0!==c.__useDefaultFramebuffer)i.bindFramebuffer(eM.FRAMEBUFFER,null),r=!1;else if(void 0===c.__webglFramebuffer)o.setupRenderTarget(e);else if(c.__hasExternalTextures)o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(c.__boundDepthTexture!==t){if(null!==t&&s.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");o.setupDepthRenderbuffer(e)}}let h=e.texture;(h.isData3DTexture||h.isDataArrayTexture||h.isCompressedArrayTexture)&&(u=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(d[t])?d[t][n]:d[t],l=!0):a=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[n]:d,ee.copy(e.viewport),et.copy(e.scissor),en=e.scissorTest}else ee.copy(eh).multiplyScalar(eo).floor(),et.copy(ed).multiplyScalar(eo).floor(),en=ep;if(0!==n&&(a=e$),i.bindFramebuffer(eM.FRAMEBUFFER,a)&&r&&i.drawBuffers(e,a),i.viewport(ee),i.scissor(et),i.setScissorTest(en),l){let r=s.get(e.texture);eM.framebufferTexture2D(eM.FRAMEBUFFER,eM.COLOR_ATTACHMENT0,eM.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(u)for(let r=0;r<e.textures.length;r++){let i=s.get(e.textures[r]);eM.framebufferTextureLayer(eM.FRAMEBUFFER,eM.COLOR_ATTACHMENT0+r,i.__webglTexture,n,t)}else if(null!==e&&0!==n){let t=s.get(e.texture);eM.framebufferTexture2D(eM.FRAMEBUFFER,eM.COLOR_ATTACHMENT0,eM.TEXTURE_2D,t.__webglTexture,n)}$=-1},this.readRenderTargetPixels=function(e,t,n,a,o,l,u){let c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;if(!(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h){i.bindFramebuffer(eM.FRAMEBUFFER,h);try{let i=e.textures[c],s=i.format,u=i.type;if(!r.textureFormatReadable(s))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o&&(e.textures.length>1&&eM.readBuffer(eM.COLOR_ATTACHMENT0+c),eM.readPixels(t,n,a,o,A.convert(s),A.convert(u),l))}finally{let e=null!==K?s.get(K).__webglFramebuffer:null;i.bindFramebuffer(eM.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,a,o,l,u){let c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h)if(t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o){i.bindFramebuffer(eM.FRAMEBUFFER,h);let u=e.textures[c],d=u.format,p=u.type;if(!r.textureFormatReadable(d))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let f=eM.createBuffer();eM.bindBuffer(eM.PIXEL_PACK_BUFFER,f),eM.bufferData(eM.PIXEL_PACK_BUFFER,l.byteLength,eM.STREAM_READ),e.textures.length>1&&eM.readBuffer(eM.COLOR_ATTACHMENT0+c),eM.readPixels(t,n,a,o,A.convert(d),A.convert(p),0);let m=null!==K?s.get(K).__webglFramebuffer:null;i.bindFramebuffer(eM.FRAMEBUFFER,m);let g=eM.fenceSync(eM.SYNC_GPU_COMMANDS_COMPLETE,0);return eM.flush(),await n4(eM,g,4),eM.bindBuffer(eM.PIXEL_PACK_BUFFER,f),eM.getBufferSubData(eM.PIXEL_PACK_BUFFER,0,l),eM.deleteBuffer(f),eM.deleteSync(g),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Math.pow(2,-n),a=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),l=null!==t?t.x:0,u=null!==t?t.y:0;o.setTexture2D(e,0),eM.copyTexSubImage2D(eM.TEXTURE_2D,n,0,0,l,u,a,s),i.unbindTexture()};let eQ=eM.createFramebuffer(),e0=eM.createFramebuffer();this.copyTextureToTexture=function(e,t){let n,r,a,l,u,c,h,d,p,f,m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,g=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,v=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,y=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;null===y&&(0!==v?(n3("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),y=v,v=0):y=0);let _=e.isCompressedTexture?e.mipmaps[y]:e.image;if(null!==m)n=m.max.x-m.min.x,r=m.max.y-m.min.y,a=m.isBox3?m.max.z-m.min.z:1,l=m.min.x,u=m.min.y,c=m.isBox3?m.min.z:0;else{let t=Math.pow(2,-v);n=Math.floor(_.width*t),r=Math.floor(_.height*t),a=e.isDataArrayTexture?_.depth:e.isData3DTexture?Math.floor(_.depth*t):1,l=0,u=0,c=0}null!==g?(h=g.x,d=g.y,p=g.z):(h=0,d=0,p=0);let x=A.convert(t.format),b=A.convert(t.type);t.isData3DTexture?(o.setTexture3D(t,0),f=eM.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(o.setTexture2DArray(t,0),f=eM.TEXTURE_2D_ARRAY):(o.setTexture2D(t,0),f=eM.TEXTURE_2D),eM.pixelStorei(eM.UNPACK_FLIP_Y_WEBGL,t.flipY),eM.pixelStorei(eM.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eM.pixelStorei(eM.UNPACK_ALIGNMENT,t.unpackAlignment);let S=eM.getParameter(eM.UNPACK_ROW_LENGTH),M=eM.getParameter(eM.UNPACK_IMAGE_HEIGHT),w=eM.getParameter(eM.UNPACK_SKIP_PIXELS),E=eM.getParameter(eM.UNPACK_SKIP_ROWS),T=eM.getParameter(eM.UNPACK_SKIP_IMAGES);eM.pixelStorei(eM.UNPACK_ROW_LENGTH,_.width),eM.pixelStorei(eM.UNPACK_IMAGE_HEIGHT,_.height),eM.pixelStorei(eM.UNPACK_SKIP_PIXELS,l),eM.pixelStorei(eM.UNPACK_SKIP_ROWS,u),eM.pixelStorei(eM.UNPACK_SKIP_IMAGES,c);let C=e.isDataArrayTexture||e.isData3DTexture,R=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let o=s.get(e),f=s.get(t),m=s.get(o.__renderTarget),g=s.get(f.__renderTarget);i.bindFramebuffer(eM.READ_FRAMEBUFFER,m.__webglFramebuffer),i.bindFramebuffer(eM.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let i=0;i<a;i++)C&&(eM.framebufferTextureLayer(eM.READ_FRAMEBUFFER,eM.COLOR_ATTACHMENT0,s.get(e).__webglTexture,v,c+i),eM.framebufferTextureLayer(eM.DRAW_FRAMEBUFFER,eM.COLOR_ATTACHMENT0,s.get(t).__webglTexture,y,p+i)),eM.blitFramebuffer(l,u,n,r,h,d,n,r,eM.DEPTH_BUFFER_BIT,eM.NEAREST);i.bindFramebuffer(eM.READ_FRAMEBUFFER,null),i.bindFramebuffer(eM.DRAW_FRAMEBUFFER,null)}else if(0!==v||e.isRenderTargetTexture||s.has(e)){let o=s.get(e),m=s.get(t);i.bindFramebuffer(eM.READ_FRAMEBUFFER,eQ),i.bindFramebuffer(eM.DRAW_FRAMEBUFFER,e0);for(let e=0;e<a;e++)C?eM.framebufferTextureLayer(eM.READ_FRAMEBUFFER,eM.COLOR_ATTACHMENT0,o.__webglTexture,v,c+e):eM.framebufferTexture2D(eM.READ_FRAMEBUFFER,eM.COLOR_ATTACHMENT0,eM.TEXTURE_2D,o.__webglTexture,v),R?eM.framebufferTextureLayer(eM.DRAW_FRAMEBUFFER,eM.COLOR_ATTACHMENT0,m.__webglTexture,y,p+e):eM.framebufferTexture2D(eM.DRAW_FRAMEBUFFER,eM.COLOR_ATTACHMENT0,eM.TEXTURE_2D,m.__webglTexture,y),0!==v?eM.blitFramebuffer(l,u,n,r,h,d,n,r,eM.COLOR_BUFFER_BIT,eM.NEAREST):R?eM.copyTexSubImage3D(f,y,h,d,p+e,l,u,n,r):eM.copyTexSubImage2D(f,y,h,d,l,u,n,r);i.bindFramebuffer(eM.READ_FRAMEBUFFER,null),i.bindFramebuffer(eM.DRAW_FRAMEBUFFER,null)}else R?e.isDataTexture||e.isData3DTexture?eM.texSubImage3D(f,y,h,d,p,n,r,a,x,b,_.data):t.isCompressedArrayTexture?eM.compressedTexSubImage3D(f,y,h,d,p,n,r,a,x,_.data):eM.texSubImage3D(f,y,h,d,p,n,r,a,x,b,_):e.isDataTexture?eM.texSubImage2D(eM.TEXTURE_2D,y,h,d,n,r,x,b,_.data):e.isCompressedTexture?eM.compressedTexSubImage2D(eM.TEXTURE_2D,y,h,d,_.width,_.height,x,_.data):eM.texSubImage2D(eM.TEXTURE_2D,y,h,d,n,r,x,b,_);eM.pixelStorei(eM.UNPACK_ROW_LENGTH,S),eM.pixelStorei(eM.UNPACK_IMAGE_HEIGHT,M),eM.pixelStorei(eM.UNPACK_SKIP_PIXELS,w),eM.pixelStorei(eM.UNPACK_SKIP_ROWS,E),eM.pixelStorei(eM.UNPACK_SKIP_IMAGES,T),0===y&&t.generateMipmaps&&eM.generateMipmap(f),i.unbindTexture()},this.initRenderTarget=function(e){void 0===s.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),i.unbindTexture()},this.resetState=function(){J=0,Z=0,K=null,i.reset(),C.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}var d3=e.i(30224);e.s(["createStore",()=>d5],8155);let d4=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,i,a);return a},d5=e=>e?d4(e):d4,{useSyncExternalStoreWithSelector:d6}=d3.default,d8=e=>e,d9=(e,t)=>{let n=d5(e),r=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d8,n=arguments.length>2?arguments[2]:void 0,r=d6(e.subscribe,e.getState,e.getInitialState,t,n);return h.default.useDebugValue(r),r}(n,e,r)};return Object.assign(r,n),r},d7=(e,t)=>e?d9(e,t):d9,pe=[];function pt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(e,t)=>e===t;if(e===t)return!0;if(!e||!t)return!1;let r=e.length;if(t.length!==r)return!1;for(let i=0;i<r;i++)if(!n(e[i],t[i]))return!1;return!0}function pn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};for(let i of(null===t&&(t=[e]),pe))if(pt(t,i.keys,i.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(i,"error"))throw i.error;if(Object.prototype.hasOwnProperty.call(i,"response"))return r.lifespan&&r.lifespan>0&&(i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(i.remove,r.lifespan)),i.response;if(!n)throw i.promise}let i={keys:t,equal:r.equal,remove:()=>{let e=pe.indexOf(i);-1!==e&&pe.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...t)).then(e=>{i.response=e,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(e=>i.error=e)};if(pe.push(i),!n)throw i.promise}var pr=e.i(98133),pi=e.i(95087),pa=e.i(43476);e.s(["FiberProvider",()=>pc,"traverseFiber",()=>po,"useContextBridge",()=>pf,"useFiber",()=>ph],46791);var ps=h;function po(e,t,n){if(!e)return;if(!0===n(e))return e;let r=t?e.return:e.child;for(;r;){let e=po(r,t,n);if(e)return e;r=t?null:r.sibling}}function pl(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}(()=>{var e,t;return"undefined"!=typeof window&&((null==(e=window.document)?void 0:e.createElement)||(null==(t=window.navigator)?void 0:t.product)==="ReactNative")})()?ps.useLayoutEffect:ps.useEffect;let pu=pl(ps.createContext(null));class pc extends ps.Component{render(){return ps.createElement(pu.Provider,{value:this._reactInternals},this.props.children)}}function ph(){let e=ps.useContext(pu);if(null===e)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let t=ps.useId();return ps.useMemo(()=>{for(let n of[e,null==e?void 0:e.alternate]){if(!n)continue;let e=po(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}let pd=Symbol.for("react.context"),pp=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===pd;function pf(){let e=function(){let e=ph(),[t]=ps.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;pp(e)&&e!==pu&&!t.has(e)&&t.set(e,ps.use(pl(e))),n=n.return}return t}();return ps.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>ps.createElement(t,null,ps.createElement(n.Provider,{...r,value:e.get(n)})),e=>ps.createElement(pc,{...e})),[e])}function pm(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}h.act;let pg=e=>e&&e.hasOwnProperty("current"),pv=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),py=((e,t)=>"undefined"!=typeof window&&((null==(e=window.document)?void 0:e.createElement)||(null==(t=window.navigator)?void 0:t.product)==="ReactNative"))()?h.useLayoutEffect:h.useEffect;function p_(e){let t=h.useRef(e);return py(()=>void(t.current=e),[e]),t}function px(){let e=ph(),t=pf();return h.useMemo(()=>n=>{let{children:r}=n,i=po(e,!0,e=>e.type===h.StrictMode)?h.StrictMode:h.Fragment;return(0,pa.jsx)(i,{children:(0,pa.jsx)(t,{children:r})})},[e,t])}function pb(e){let{set:t}=e;return py(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}let pS=(e=>((e=class extends h.Component{componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}constructor(...e){super(...e),this.state={error:!1}}}).getDerivedStateFromError=()=>({error:!0}),e))();function pM(e){var t;let n="undefined"!=typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}function pw(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()}let pE={obj:e=>e===Object(e)&&!pE.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,t){let n,{arrays:r="shallow",objects:i="reference",strict:a=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(typeof e!=typeof t||!!e!=!!t)return!1;if(pE.str(e)||pE.num(e)||pE.boo(e))return e===t;let s=pE.obj(e);if(s&&"reference"===i)return e===t;let o=pE.arr(e);if(o&&"reference"===r)return e===t;if((o||s)&&e===t)return!0;for(n in e)if(!(n in t))return!1;if(s&&"shallow"===r&&"shallow"===i){for(n in a?t:e)if(!pE.equ(e[n],t[n],{strict:a,objects:"reference"}))return!1}else for(n in a?t:e)if(e[n]!==t[n])return!1;if(pE.und(n)){if(o&&0===e.length&&0===t.length||s&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}},pT=["children","key","ref"];function pA(e,t,n,r){let i=null==e?void 0:e.__r3f;return!i&&(i={root:t,type:n,parent:null,children:[],props:function(e){let t={};for(let n in e)pT.includes(n)||(t[n]=e[n]);return t}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=i)),i}function pC(e,t){let n=e[t];if(!t.includes("-"))return{root:e,key:t,target:n};for(let i of(n=e,t.split("-"))){var r;t=i,e=n,n=null==(r=n)?void 0:r[t]}return{root:e,key:t,target:n}}let pR=/-\d+$/;function pP(e,t){if(pE.str(t.props.attach)){if(pR.test(t.props.attach)){let n=t.props.attach.replace(pR,""),{root:r,key:i}=pC(e.object,n);Array.isArray(r[i])||(r[i]=[])}let{root:n,key:r}=pC(e.object,t.props.attach);t.previousAttach=n[r],n[r]=t.object}else pE.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function pI(e,t){if(pE.str(t.props.attach)){let{root:n,key:r}=pC(e.object,t.props.attach),i=t.previousAttach;void 0===i?delete n[r]:n[r]=i}else null==t.previousAttach||t.previousAttach(e.object,t.object);delete t.previousAttach}let pL=[...pT,"args","dispose","attach","object","onUpdate","dispose"],pN=new Map,pD=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],pU=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function pO(e,t){var n,r;let i=e.__r3f,a=i&&pm(i).getState(),s=null==i?void 0:i.eventCount;for(let n in t){let s=t[n];if(pL.includes(n))continue;if(i&&pU.test(n)){"function"==typeof s?i.handlers[n]=s:delete i.handlers[n],i.eventCount=Object.keys(i.handlers).length;continue}if(void 0===s)continue;let{root:o,key:l,target:u}=pC(e,n);u instanceof r$&&s instanceof r$?u.mask=s.mask:u instanceof iE&&pv(s)?u.set(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=s&&s.constructor&&u.constructor===s.constructor?u.copy(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(s)?"function"==typeof u.fromArray?u.fromArray(s):u.set(...s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof s?"function"==typeof u.setScalar?u.setScalar(s):u.set(s):(o[l]=s,a&&!a.linear&&pD.includes(l)&&null!=(r=o[l])&&r.isTexture&&o[l].format===e0&&o[l].type===ez&&(o[l].colorSpace=t$))}if(null!=i&&i.parent&&null!=a&&a.internal&&null!=(n=i.object)&&n.isObject3D&&s!==i.eventCount){let e=i.object,t=a.internal.interaction.indexOf(e);t>-1&&a.internal.interaction.splice(t,1),i.eventCount&&null!==e.raycast&&a.internal.interaction.push(e)}return i&&void 0===i.props.attach&&(i.object.isBufferGeometry?i.props.attach="geometry":i.object.isMaterial&&(i.props.attach="material")),i&&pF(i),e}function pF(e){var t;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let n=null==(t=e.root)||null==t.getState?void 0:t.getState();n&&0===n.internal.frames&&n.invalidate()}function pk(e,t){!e.manual&&(e&&e.isOrthographicCamera?(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())}let pz=e=>null==e?void 0:e.isObject3D;function pB(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function pH(e,t,n,r){let i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}let pV=e=>!!(null!=e&&e.render),pG=h.createContext(null);function pW(){let e=h.useContext(pG);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function pj(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e=>e,t=arguments.length>1?arguments[1]:void 0;return pW()(e,t)}function pX(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=pW(),r=n.getState().internal.subscribe,i=p_(e);return py(()=>r(i,t,n),[t,r,n]),null}let pq=new WeakMap;function pY(e,t){return function(n){let r;for(var i,a=arguments.length,s=Array(a>1?a-1:0),o=1;o<a;o++)s[o-1]=arguments[o];return"function"==typeof n&&(null==n||null==(i=n.prototype)?void 0:i.constructor)===n?(r=pq.get(n))||(r=new n,pq.set(n,r)):r=n,e&&e(r),Promise.all(s.map(e=>new Promise((n,i)=>r.load(e,e=>{pz(null==e?void 0:e.scene)&&Object.assign(e,function(e){let t={nodes:{},materials:{},meshes:{}};return e&&e.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material),e.isMesh&&!t.meshes[e.name]&&(t.meshes[e.name]=e)}),t}(e.scene)),n(e)},t,t=>i(Error("Could not load ".concat(e,": ").concat(null==t?void 0:t.message)))))))}}function pJ(e,t,n,r){let i=Array.isArray(t)?t:[t],a=pn(pY(n,r),[e,...i],!1,{equal:pE.equ});return Array.isArray(t)?a:a[0]}pJ.preload=function(e,t,n){let r,i=Array.isArray(t)?t:[t];pn(pY(n),[e,...i],!0,r)},pJ.clear=function(e,t){var n=[e,...Array.isArray(t)?t:[t]];if(void 0===n||0===n.length)pe.splice(0,pe.length);else{let e=pe.find(e=>pt(n,e.keys,e.equal));e&&e.remove()}};let pZ={},pK=/^three(?=[A-Z])/,p$=e=>"".concat(e[0].toUpperCase()).concat(e.slice(1)),pQ=0;function p0(e){if("function"==typeof e){let t="".concat(pQ++);return pZ[t]=e,t}Object.assign(pZ,e)}function p1(e,t){let n=p$(e),r=pZ[n];if("primitive"!==e&&!r)throw Error("R3F: ".concat(n," 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("primitive"===e&&!t.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==t.args&&!Array.isArray(t.args))throw Error("R3F: The args prop must be an array!")}function p2(e){if(e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?pP(e.parent,e):pz(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,pF(e)}}function p3(e,t,n){let r=t.root.getState();if(e.parent||e.object===r.scene){if(!t.object){var i,a;let e=pZ[p$(t.type)];t.object=null!=(i=t.props.object)?i:new e(...null!=(a=t.props.args)?a:[]),t.object.__r3f=t}if(pO(t.object,t.props),t.props.attach)pP(e,t);else if(pz(t.object)&&pz(e.object)){let r=e.object.children.indexOf(null==n?void 0:n.object);if(n&&-1!==r){let n=e.object.children.indexOf(t.object);-1!==n?(e.object.children.splice(n,1),e.object.children.splice(n<r?r-1:r,0,t.object)):(t.object.parent=e.object,e.object.children.splice(r,0,t.object),t.object.dispatchEvent({type:"added"}),e.object.dispatchEvent({type:"childadded",child:t.object}))}else e.object.add(t.object)}for(let e of t.children)p3(t,e);pF(t)}}function p4(e,t){t&&(t.parent=e,e.children.push(t),p3(e,t))}function p5(e,t,n){if(!t||!n)return;t.parent=e;let r=e.children.indexOf(n);-1!==r?e.children.splice(r,0,t):e.children.push(t),p3(e,t,n)}function p6(e){if("function"==typeof e.dispose){let t=()=>{try{e.dispose()}catch(e){}};"undefined"!=typeof IS_REACT_ACT_ENVIRONMENT?t():(0,pi.unstable_scheduleCallback)(pi.unstable_IdlePriority,t)}}function p8(e,t,n){if(!t)return;t.parent=null;let r=e.children.indexOf(t);-1!==r&&e.children.splice(r,1),t.props.attach?pI(e,t):pz(t.object)&&pz(e.object)&&(e.object.remove(t.object),function(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{pH(n.capturedMap,t,e,r)})}(pm(t),t.object));let i=null!==t.props.dispose&&!1!==n;for(let e=t.children.length-1;e>=0;e--){let n=t.children[e];p8(t,n,i)}t.children.length=0,delete t.object.__r3f,i&&"primitive"!==t.type&&"Scene"!==t.object.type&&p6(t.object),void 0===n&&pF(t)}let p9=[],p7=()=>{},fe={},ft=0,fn=function(e){let t=(0,pr.default)(e);return t.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:h.version}),t}({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,t,n){var r;return p1(e=p$(e)in pZ?e:e.replace(pK,""),t),"primitive"===e&&null!=(r=t.object)&&r.__r3f&&delete t.object.__r3f,pA(t.object,n,e,t)},removeChild:p8,appendChild:p4,appendInitialChild:p4,insertBefore:p5,appendChildToContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&p4(n,t)},removeChildFromContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&p8(n,t)},insertInContainerBefore(e,t,n){let r=e.getState().scene.__r3f;t&&n&&r&&p5(r,t,n)},getRootHostContext:()=>fe,getChildHostContext:()=>fe,commitUpdate(e,t,n,r,i){var a,s,o;p1(t,r);let l=!1;if("primitive"===e.type&&n.object!==r.object||(null==(a=r.args)?void 0:a.length)!==(null==(s=n.args)?void 0:s.length)?l=!0:null!=(o=r.args)&&o.some((e,t)=>{var r;return e!==(null==(r=n.args)?void 0:r[t])})&&(l=!0),l)p9.push([e,{...r},i]);else{let t=function(e,t){let n={};for(let r in t)if(!pL.includes(r)&&!pE.equ(t[r],e.props[r]))for(let e in n[r]=t[r],t)e.startsWith("".concat(r,"-"))&&(n[e]=t[e]);for(let r in e.props){if(pL.includes(r)||t.hasOwnProperty(r))continue;let{root:i,key:a}=pC(e.object,r);if(i.constructor&&0===i.constructor.length){let e=function(e){let t=pN.get(e.constructor);try{t||(t=new e.constructor,pN.set(e.constructor,t))}catch(e){}return t}(i);pE.und(e)||(n[a]=e[a])}else n[a]=0}return n}(e,r);Object.keys(t).length&&(Object.assign(e.props,t),pO(e.object,t))}(null===i.sibling||(4&i.flags)==0)&&function(){for(let[e]of p9){let t=e.parent;if(t)for(let n of(e.props.attach?pI(t,e):pz(e.object)&&pz(t.object)&&t.object.remove(e.object),e.children))n.props.attach?pI(e,n):pz(n.object)&&pz(e.object)&&e.object.remove(n.object);e.isHidden&&p2(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&p6(e.object)}for(let[r,i,a]of p9){r.props=i;let s=r.parent;if(s){let i=pZ[p$(r.type)];r.object=null!=(e=r.props.object)?e:new i(...null!=(t=r.props.args)?t:[]),r.object.__r3f=r;var e,t,n=r.object;for(let e of[a,a.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let t=e.ref(n);"function"==typeof t&&(e.refCleanup=t)}else e.ref&&(e.ref.current=n);for(let e of(pO(r.object,r.props),r.props.attach?pP(s,r):pz(r.object)&&pz(s.object)&&s.object.add(r.object),r.children))e.props.attach?pP(r,e):pz(e.object)&&pz(r.object)&&r.object.add(e.object);pF(r)}}p9.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>pA(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?pI(e.parent,e):pz(e.object)&&(e.object.visible=!1),e.isHidden=!0,pF(e)}},unhideInstance:p2,createTextInstance:p7,hideTextInstance:p7,unhideTextInstance:p7,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:h.createContext(null),setCurrentUpdatePriority(e){ft=e},getCurrentUpdatePriority:()=>ft,resolveUpdatePriority(){var e;if(0!==ft)return ft;switch("undefined"!=typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return d.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return d.ContinuousEventPriority;default:return d.DefaultEventPriority}},resetFormInstance(){}}),fr=new Map,fi={objects:"shallow",strict:!1};function fa(e){let t,n,r=fr.get(e),i=null==r?void 0:r.fiber,a=null==r?void 0:r.store;r&&console.warn("R3F.createRoot should only be called once!");let s="function"==typeof reportError?reportError:console.error,o=a||((e,t)=>{let n=d7((n,r)=>{let i,a=new nX,s=new nX,o=new nX;function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r().camera,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r().size,{width:i,height:l,top:u,left:c}=n,h=i/l;t.isVector3?o.copy(t):o.set(...t);let d=e.getWorldPosition(a).distanceTo(o);if(e&&e.isOrthographicCamera)return{width:i/e.zoom,height:l/e.zoom,top:u,left:c,factor:1,distance:d,aspect:h};{let t=2*Math.tan(e.fov*Math.PI/180/2)*d,n=i/l*t;return{width:n,height:t,top:u,left:c,factor:i/n,distance:d,aspect:h}}}let u=e=>n(t=>({performance:{...t.performance,current:e}})),c=new nW;return{set:n,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e(r(),t)},advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new uM,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();i&&clearTimeout(i),e.performance.current!==e.performance.min&&u(e.performance.min),i=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:l},setEvents:e=>n(t=>({...t,events:{...t.events,...e}})),setSize:function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=r().camera,u={width:e,height:t,top:i,left:a};n(e=>({size:u,viewport:{...e.viewport,...l(o,s,u)}}))},setDpr:e=>n(t=>{let n=pM(e);return{viewport:{...t.viewport,dpr:n,initialDpr:t.viewport.initialDpr||n}}}),setFrameloop:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always",t=r().clock;t.stop(),t.elapsedTime=0,"never"!==e&&(t.start(),t.elapsedTime=0),n(()=>({frameloop:e}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:h.createRef(),active:!1,frames:0,priority:0,subscribe:(e,t,n)=>{let i=r().internal;return i.priority=i.priority+ +(t>0),i.subscribers.push({ref:e,priority:t,store:n}),i.subscribers=i.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let n=r().internal;null!=n&&n.subscribers&&(n.priority=n.priority-(t>0),n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}}}),r=n.getState(),i=r.size,a=r.viewport.dpr,s=r.camera;return n.subscribe(()=>{let{camera:e,size:t,viewport:r,gl:o,set:l}=n.getState();if(t.width!==i.width||t.height!==i.height||r.dpr!==a){i=t,a=r.dpr,pk(e,t),r.dpr>0&&o.setPixelRatio(r.dpr);let n="undefined"!=typeof HTMLCanvasElement&&o.domElement instanceof HTMLCanvasElement;o.setSize(t.width,t.height,n)}e!==s&&(s=e,l(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),n.subscribe(t=>e(t)),n})(fS,fM),l=i||fn.createContainer(o,d.ConcurrentRoot,null,!1,null,"",s,s,s,null);r||fr.set(e,{fiber:l,store:o});let u=!1,c=null;return{async configure(){var r,i;let a,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c=new Promise(e=>a=e);let{gl:l,size:h,scene:d,events:p,onCreated:f,shadows:m=!1,linear:g=!1,flat:v=!1,legacy:y=!1,orthographic:_=!1,frameloop:w="always",dpr:E=[1,2],performance:T,raycaster:A,camera:C,onPointerMissed:R}=s,P=o.getState(),I=P.gl;if(!P.gl){let t={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},n="function"==typeof l?await l(t):l;I=pV(n)?n:new d2({...t,...l}),P.set({gl:I})}let L=P.raycaster;L||P.set({raycaster:L=new u4});let{params:N,...D}=A||{};if(pE.equ(D,L,fi)||pO(L,{...D}),pE.equ(N,L.params,fi)||pO(L,{params:{...L.params,...N}}),!P.camera||P.camera===n&&!pE.equ(n,C,fi)){n=C;let e=null==C?void 0:C.isCamera,t=e?C:_?new l7(0,0,0,0,.1,1e3):new af(75,0,.1,1e3);!e&&(t.position.z=5,C&&(pO(t,C),!t.manual&&("aspect"in C||"left"in C||"right"in C||"bottom"in C||"top"in C)&&(t.manual=!0,t.updateProjectionMatrix())),P.camera||null!=C&&C.rotation||t.lookAt(0,0,0)),P.set({camera:t}),L.camera=t}if(!P.scene){let e;null!=d&&d.isScene?pA(e=d,o,"",{}):(pA(e=new aM,o,"",{}),d&&pO(e,d)),P.set({scene:e})}p&&!P.events.handlers&&P.set({events:p(o)});let U=function(e,t){if(!t&&"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:n,top:r,left:i}=e.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:i}}return!t&&"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...t}}(e,h);if(pE.equ(U,P.size,fi)||P.setSize(U.width,U.height,U.top,U.left),E&&P.viewport.dpr!==pM(E)&&P.setDpr(E),P.frameloop!==w&&P.setFrameloop(w),P.onPointerMissed||P.set({onPointerMissed:R}),T&&!pE.equ(T,P.performance,fi)&&P.set(e=>({performance:{...e.performance,...T}})),!P.xr){let e=(e,t)=>{let n=o.getState();"never"!==n.frameloop&&fM(e,!0,n,t)},t=()=>{let t=o.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||fS(t)},n={connect(){let e=o.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){let e=o.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};"function"==typeof(null==(r=I.xr)?void 0:r.addEventListener)&&n.connect(),P.set({xr:n})}if(I.shadowMap){let e=I.shadowMap.enabled,t=I.shadowMap.type;I.shadowMap.enabled=!!m,pE.boo(m)?I.shadowMap.type=S:pE.str(m)?I.shadowMap.type=null!=(i=({basic:x,percentage:b,soft:S,variance:M})[m])?i:S:pE.obj(m)&&Object.assign(I.shadowMap,m),(e!==I.shadowMap.enabled||t!==I.shadowMap.type)&&(I.shadowMap.needsUpdate=!0)}return n8.enabled=!y,u||(I.outputColorSpace=g?tQ:t$,I.toneMapping=v?ec:ef),P.legacy!==y&&P.set(()=>({legacy:y})),P.linear!==g&&P.set(()=>({linear:g})),P.flat!==v&&P.set(()=>({flat:v})),!l||pE.fun(l)||pV(l)||pE.equ(l,I,fi)||pO(I,l),t=f,u=!0,a(),this},render(n){return u||c||this.configure(),c.then(()=>{fn.updateContainer((0,pa.jsx)(fs,{store:o,children:n,onCreated:t,rootElement:e}),l,null,()=>void 0)}),o},unmount(){fo(e)}}}function fs(e){let{store:t,children:n,onCreated:r,rootElement:i}=e;return py(()=>{let e=t.getState();e.set(e=>({internal:{...e.internal,active:!0}})),r&&r(e),t.getState().events.connected||null==e.events.connect||e.events.connect(i)},[]),(0,pa.jsx)(pG.Provider,{value:t,children:n})}function fo(e,t){let n=fr.get(e),r=null==n?void 0:n.fiber;if(r){let i=null==n?void 0:n.store.getState();i&&(i.internal.active=!1),fn.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{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!=(s=i.gl)&&s.xr&&i.xr.disconnect();var n,r,a,s,o=i.scene;for(let e in"Scene"!==o.type&&(null==o.dispose||o.dispose()),o){let t=o[e];(null==t?void 0:t.type)!=="Scene"&&(null==t||null==t.dispose||t.dispose())}fr.delete(e),t&&t(e)}catch(e){}},500)})}}function fl(e,t,n){return(0,pa.jsx)(fu,{children:e,container:t,state:n})}function fu(e){let{state:t={},children:n,container:r}=e,{events:i,size:a,...s}=t,o=pW(),[l]=h.useState(()=>new u4),[u]=h.useState(()=>new nW),c=p_((e,t)=>{let n;if(t.camera&&a){let r=t.camera;n=e.viewport.getCurrentViewport(r,new nX,a),r!==e.camera&&pk(r,a)}return{...e,...t,scene:r,raycaster:l,pointer:u,mouse:u,previousRoot:o,events:{...e.events,...t.events,...i},size:{...e.size,...a},viewport:{...e.viewport,...n},setEvents:e=>t.set(t=>({...t,events:{...t.events,...e}}))}}),d=h.useMemo(()=>{let e=d7((e,t)=>({...s,set:e,get:t})),t=t=>e.setState(e=>c.current(t,e));return t(o.getState()),o.subscribe(t),e},[o,r]);return(0,pa.jsx)(pa.Fragment,{children:fn.createPortal((0,pa.jsx)(pG.Provider,{value:d,children:n}),d,null)})}function fc(e,t){let n={callback:e};return t.add(n),()=>void t.delete(n)}let fh=new Set,fd=new Set,fp=new Set,ff=e=>fc(e,fh),fm=e=>fc(e,fd);function fg(e,t){if(e.size)for(let{callback:n}of e.values())n(t)}function fv(e,t){switch(e){case"before":return fg(fh,t);case"after":return fg(fd,t);case"tail":return fg(fp,t)}}function fy(e,t,n){let r=t.clock.getDelta();"never"===t.frameloop&&"number"==typeof e&&(r=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),s=t.internal.subscribers;for(let e=0;e<s.length;e++)(o=s[e]).ref.current(o.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}let f_=!1,fx=!1;function fb(e){for(let n of(u=requestAnimationFrame(fb),f_=!0,l=0,fv("before",e),fx=!0,fr.values())){var t;(c=n.store.getState()).internal.active&&("always"===c.frameloop||c.internal.frames>0)&&!(null!=(t=c.gl.xr)&&t.isPresenting)&&(l+=fy(e,c))}if(fx=!1,fv("after",e),0===l)return fv("tail",e),f_=!1,cancelAnimationFrame(u)}function fS(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!e)return fr.forEach(e=>fS(e.store.getState(),n));(null==(t=e.gl.xr)||!t.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(n>1?e.internal.frames=Math.min(60,e.internal.frames+n):fx?e.internal.frames=2:e.internal.frames=1,f_||(f_=!0,requestAnimationFrame(fb)))}function fM(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(t&&fv("before",e),n)fy(e,n,r);else for(let t of fr.values())fy(e,t.store.getState());t&&fv("after",e)}let fw={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 fE(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(n.hovered.delete(pB(e)),null!=r&&r.eventCount){let n=r.handlers,i={...e,intersections:t};null==n.onPointerOut||n.onPointerOut(i),null==n.onPointerLeave||n.onPointerLeave(i)}}}function r(e,t){for(let n=0;n<t.length;n++){let 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()=>n([]);case"onLostPointerCapture":return t=>{let{internal:r}=e.getState();"pointerId"in t&&r.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(t.pointerId)&&(r.capturedMap.delete(t.pointerId),n([]))})}}return function(a){let{onPointerMissed:s,internal:o}=e.getState();o.lastEvent.current=a;let l="onPointerMove"===i,u="onClick"===i||"onContextMenu"===i||"onDoubleClick"===i,c=function(t,n){let r=e.getState(),i=new Set,a=[],s=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e<s.length;e++){let t=pw(s[e]);t&&(t.raycaster.camera=void 0)}r.previousRoot||null==r.events.compute||r.events.compute(t,r);let o=s.flatMap(function(e){let n=pw(e);if(!n||!n.events.enabled||null===n.raycaster.camera)return[];if(void 0===n.raycaster.camera){var r;null==n.events.compute||n.events.compute(t,n,null==(r=n.previousRoot)?void 0:r.getState()),void 0===n.raycaster.camera&&(n.raycaster.camera=null)}return n.raycaster.camera?n.raycaster.intersectObject(e,!0):[]}).sort((e,t)=>{let n=pw(e.object),r=pw(t.object);return n&&r&&r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=pB(e);return!i.has(t)&&(i.add(t),!0)});for(let e of(r.events.filter&&(o=r.events.filter(o,r)),o)){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())i.has(pB(e.intersection))||a.push(e.intersection);return a}(a,l?t:void 0),h=u?function(t){let{internal:n}=e.getState(),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&&(o.initialClick=[a.offsetX,a.offsetY],o.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&h<=2&&(r(a,o.interaction),s&&s(a)),l&&n(c),!function(e,t,r,i){if(e.length){let a={stopped:!1};for(let s of e){let o=pw(s.object);if(o||s.object.traverseAncestors(e=>{let t=pw(e);if(t)return o=t,!1}),o){let{raycaster:l,pointer:u,camera:c,internal:h}=o,d=new nX(u.x,u.y,0).unproject(c),p=e=>{var t,n;return null!=(t=null==(n=h.capturedMap.get(e))?void 0:n.has(s.eventObject))&&t},f=e=>{let n={intersection:s,target:t.target};h.capturedMap.has(e)?h.capturedMap.get(e).set(s.eventObject,n):h.capturedMap.set(e,new Map([[s.eventObject,n]])),t.target.setPointerCapture(e)},m=e=>{let t=h.capturedMap.get(e);t&&pH(h.capturedMap,s.eventObject,t,e)},g={};for(let e in t){let n=t[e];"function"!=typeof n&&(g[e]=n)}let v={...s,...g,pointer:u,intersections:e,stopped:a.stopped,delta:r,unprojectedPoint:d,ray:l.ray,camera:c,stopPropagation(){let r="pointerId"in t&&h.capturedMap.get(t.pointerId);(!r||r.has(s.eventObject))&&(v.stopped=a.stopped=!0,h.hovered.size&&Array.from(h.hovered.values()).find(e=>e.eventObject===s.eventObject)&&n([...e.slice(0,e.indexOf(s)),s]))},target:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},currentTarget:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},nativeEvent:t};if(i(v),!0===a.stopped)break}}}}(c,a,h,function(e){let t=e.eventObject,n=t.__r3f;if(!(null!=n&&n.eventCount))return;let s=n.handlers;if(l){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){let t=pB(e),n=o.hovered.get(t);n?n.stopped&&e.stopPropagation():(o.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{let n=s[i];n?(!u||o.initialHits.includes(t))&&(r(a,o.interaction.filter(e=>!o.initialHits.includes(e))),n(e)):u&&o.initialHits.includes(t)&&r(a,o.interaction.filter(e=>!o.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(fw).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;let{events:n,internal:r}=e.getState();null!=(t=r.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{let{set:n,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),n(e=>({events:{...e.events,connected:t}})),r.handlers)for(let e in r.handlers){let n=r.handlers[e],[i,a]=fw[e];t.addEventListener(i,n,{passive:a})}},disconnect:()=>{let{set:t,events:n}=e.getState();if(n.connected){if(n.handlers)for(let e in n.handlers){let t=n.handlers[e],[r]=fw[e];n.connected.removeEventListener(r,t)}t(e=>({events:{...e.events,connected:void 0}}))}}}}},99749,e=>{"use strict";function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e.s(["_",()=>t])},53487,(e,t,n)=>{"use strict";let r="[^".concat("\\\\/","]"),i="[^/]",a="(?:".concat("\\/","|$)"),s="(?:^|".concat("\\/",")"),o="".concat("\\.","{1,2}").concat(a),l="(?!".concat(s).concat(o,")"),u="(?!".concat("\\.","{0,1}").concat(a,")"),c="(?!".concat(o,")"),h={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:i,END_ANCHOR:a,DOTS_SLASH:o,NO_DOT:"(?!".concat("\\.",")"),NO_DOTS:l,NO_DOT_SLASH:u,NO_DOTS_SLASH:c,QMARK_NO_DOT:"[^.".concat("\\/","]"),STAR:"".concat(i,"*?"),START_ANCHOR:s,SEP:"/"},d={...h,SLASH_LITERAL:"[".concat("\\\\/","]"),QMARK:r,STAR:"".concat(r,"*?"),DOTS_SLASH:"".concat("\\.","{1,2}(?:[").concat("\\\\/","]|$)"),NO_DOT:"(?!".concat("\\.",")"),NO_DOTS:"(?!(?:^|[".concat("\\\\/","])").concat("\\.","{1,2}(?:[").concat("\\\\/","]|$))"),NO_DOT_SLASH:"(?!".concat("\\.","{0,1}(?:[").concat("\\\\/","]|$))"),NO_DOTS_SLASH:"(?!".concat("\\.","{1,2}(?:[").concat("\\\\/","]|$))"),QMARK_NO_DOT:"[^.".concat("\\\\/","]"),START_ANCHOR:"(?:^|[".concat("\\\\/","])"),END_ANCHOR:"(?:[".concat("\\\\/","]|$)"),SEP:"\\"};t.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:"))".concat(e.STAR,")")},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?d:h}},19241,(e,t,n)=>{"use strict";var r=e.i(47167);let{REGEX_BACKSLASH:i,REGEX_REMOVE_BACKSLASH:a,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:o}=e.r(53487);n.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n.hasRegexChars=e=>s.test(e),n.isRegexChar=e=>1===e.length&&n.hasRegexChars(e),n.escapeRegex=e=>e.replace(o,"\\$1"),n.toPosixSlashes=e=>e.replace(i,"/"),n.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){let e=navigator.platform.toLowerCase();return"win32"===e||"windows"===e}return void 0!==r.default&&!!r.default.platform&&"win32"===r.default.platform},n.removeBackslashes=e=>e.replace(a,e=>"\\"===e?"":e),n.escapeLast=(e,t,r)=>{let i=e.lastIndexOf(t,r);return -1===i?e:"\\"===e[i-1]?n.escapeLast(e,t,i-1):"".concat(e.slice(0,i),"\\").concat(e.slice(i))},n.removePrefix=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},n.wrapOutput=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.contains?"":"^",i=n.contains?"":"$",a="".concat(r,"(?:").concat(e,")").concat(i);return!0===t.negated&&(a="(?:^(?!".concat(a,").*$)")),a},n.basename=function(e){let{windows:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.split(t?/[\\/]/:"/"),r=n[n.length-1];return""===r?n[n.length-2]:r}},26094,(e,t,n)=>{"use strict";let r=e.r(19241),{CHAR_ASTERISK:i,CHAR_AT:a,CHAR_BACKWARD_SLASH:s,CHAR_COMMA:o,CHAR_DOT:l,CHAR_EXCLAMATION_MARK:u,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:h,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:f,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:v,CHAR_RIGHT_SQUARE_BRACKET:y}=e.r(53487),_=e=>e===c||e===s,x=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let n,b,S=t||{},M=e.length-1,w=!0===S.parts||!0===S.scanToEnd,E=[],T=[],A=[],C=e,R=-1,P=0,I=0,L=!1,N=!1,D=!1,U=!1,O=!1,F=!1,k=!1,z=!1,B=!1,H=!1,V=0,G={value:"",depth:0,isGlob:!1},W=()=>R>=M,j=()=>C.charCodeAt(R+1),X=()=>(n=b,C.charCodeAt(++R));for(;R<M;){let e;if((b=X())===s){k=G.backslashes=!0,(b=X())===h&&(F=!0);continue}if(!0===F||b===h){for(V++;!0!==W()&&(b=X());){if(b===s){k=G.backslashes=!0,X();continue}if(b===h){V++;continue}if(!0!==F&&b===l&&(b=X())===l||!0!==F&&b===o){if(L=G.isBrace=!0,D=G.isGlob=!0,H=!0,!0===w)continue;break}if(b===g&&0==--V){F=!1,L=G.isBrace=!0,H=!0;break}}if(!0===w)continue;break}if(b===c){if(E.push(R),T.push(G),G={value:"",depth:0,isGlob:!1},!0===H)continue;if(n===l&&R===P+1){P+=2;continue}I=R+1;continue}if(!0!==S.noext&&!0==(b===f||b===a||b===i||b===m||b===u)&&j()===d){if(D=G.isGlob=!0,U=G.isExtglob=!0,H=!0,b===u&&R===P&&(B=!0),!0===w){for(;!0!==W()&&(b=X());){if(b===s){k=G.backslashes=!0,b=X();continue}if(b===v){D=G.isGlob=!0,H=!0;break}}continue}break}if(b===i){if(n===i&&(O=G.isGlobstar=!0),D=G.isGlob=!0,H=!0,!0===w)continue;break}if(b===m){if(D=G.isGlob=!0,H=!0,!0===w)continue;break}if(b===p){for(;!0!==W()&&(e=X());){if(e===s){k=G.backslashes=!0,X();continue}if(e===y){N=G.isBracket=!0,D=G.isGlob=!0,H=!0;break}}if(!0===w)continue;break}if(!0!==S.nonegate&&b===u&&R===P){z=G.negated=!0,P++;continue}if(!0!==S.noparen&&b===d){if(D=G.isGlob=!0,!0===w){for(;!0!==W()&&(b=X());){if(b===d){k=G.backslashes=!0,b=X();continue}if(b===v){H=!0;break}}continue}break}if(!0===D){if(H=!0,!0===w)continue;break}}!0===S.noext&&(U=!1,D=!1);let q=C,Y="",J="";P>0&&(Y=C.slice(0,P),C=C.slice(P),I-=P),q&&!0===D&&I>0?(q=C.slice(0,I),J=C.slice(I)):!0===D?(q="",J=C):q=C,q&&""!==q&&"/"!==q&&q!==C&&_(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),!0===S.unescape&&(J&&(J=r.removeBackslashes(J)),q&&!0===k&&(q=r.removeBackslashes(q)));let Z={prefix:Y,input:e,start:P,base:q,glob:J,isBrace:L,isBracket:N,isGlob:D,isExtglob:U,isGlobstar:O,negated:z,negatedExtglob:B};if(!0===S.tokens&&(Z.maxDepth=0,_(b)||T.push(G),Z.tokens=T),!0===S.parts||!0===S.tokens){let t;for(let n=0;n<E.length;n++){let r=t?t+1:P,i=E[n],a=e.slice(r,i);S.tokens&&(0===n&&0!==P?(T[n].isPrefix=!0,T[n].value=Y):T[n].value=a,x(T[n]),Z.maxDepth+=T[n].depth),(0!==n||""!==a)&&A.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);A.push(n),S.tokens&&(T[T.length-1].value=n,x(T[T.length-1]),Z.maxDepth+=T[T.length-1].depth)}Z.slashes=E,Z.parts=A}return Z}},17932,(e,t,n)=>{"use strict";let r=e.r(53487),i=e.r(19241),{MAX_LENGTH:a,POSIX_REGEX_SOURCE:s,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:l,REPLACEMENTS:u}=r,c=(e,t)=>{if("function"==typeof t.expandRange)return t.expandRange(...e,t);e.sort();let n="[".concat(e.join("-"),"]");try{new RegExp(n)}catch(t){return e.map(e=>i.escapeRegex(e)).join("..")}return n},h=(e,t)=>"Missing ".concat(e,': "').concat(t,'" - use "\\\\').concat(t,'" to match literal characters'),d=(e,t)=>{let n;if("string"!=typeof e)throw TypeError("Expected a string");e=u[e]||e;let p={...t},f="number"==typeof p.maxLength?Math.min(a,p.maxLength):a,m=e.length;if(m>f)throw SyntaxError("Input length: ".concat(m,", exceeds maximum allowed length: ").concat(f));let g={type:"bos",value:"",output:p.prepend||""},v=[g],y=p.capture?"":"?:",_=r.globChars(p.windows),x=r.extglobChars(_),{DOT_LITERAL:b,PLUS_LITERAL:S,SLASH_LITERAL:M,ONE_CHAR:w,DOTS_SLASH:E,NO_DOT:T,NO_DOT_SLASH:A,NO_DOTS_SLASH:C,QMARK:R,QMARK_NO_DOT:P,STAR:I,START_ANCHOR:L}=_,N=e=>"(".concat(y,"(?:(?!").concat(L).concat(e.dot?E:b,").)*?)"),D=p.dot?"":T,U=p.dot?R:P,O=!0===p.bash?N(p):I;p.capture&&(O="(".concat(O,")")),"boolean"==typeof p.noext&&(p.noextglob=p.noext);let F={input:e,index:-1,start:0,dot:!0===p.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:v};m=(e=i.removePrefix(e,F)).length;let k=[],z=[],B=[],H=g,V=()=>F.index===m-1,G=F.peek=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e[F.index+t]},W=F.advance=()=>e[++F.index]||"",j=()=>e.slice(F.index+1),X=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;F.consumed+=e,F.index+=t},q=e=>{F.output+=null!=e.output?e.output:e.value,X(e.value)},Y=()=>{let e=1;for(;"!"===G()&&("("!==G(2)||"?"===G(3));)W(),F.start++,e++;return e%2!=0&&(F.negated=!0,F.start++,!0)},J=e=>{F[e]++,B.push(e)},Z=e=>{F[e]--,B.pop()},K=e=>{if("globstar"===H.type){let t=F.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||k.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(F.output=F.output.slice(0,-H.output.length),H.type="star",H.value="*",H.output=O,F.output+=H.output)}if(k.length&&"paren"!==e.type&&(k[k.length-1].inner+=e.value),(e.value||e.output)&&q(e),H&&"text"===H.type&&"text"===e.type){H.output=(H.output||H.value)+e.value,H.value+=e.value;return}e.prev=H,v.push(e),H=e},$=(e,t)=>{let n={...x[t],conditions:1,inner:""};n.prev=H,n.parens=F.parens,n.output=F.output;let r=(p.capture?"(":"")+n.open;J("parens"),K({type:e,value:t,output:F.output?"":w}),K({type:"paren",extglob:!0,value:W(),output:r}),k.push(n)},Q=e=>{let r,i=e.close+(p.capture?")":"");if("negate"===e.type){let n=O;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(n=N(p)),(n!==O||V()||/^\)+$/.test(j()))&&(i=e.close=")$))".concat(n)),e.inner.includes("*")&&(r=j())&&/^\.[^\\/.]+$/.test(r)){let a=d(r,{...t,fastpaths:!1}).output;i=e.close=")".concat(a,")").concat(n,")")}"bos"===e.prev.type&&(F.negatedExtglob=!0)}K({type:"paren",extglob:!0,value:n,output:i}),Z("parens")};if(!1!==p.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,r=e.replace(l,(e,t,r,i,a,s)=>"\\"===i?(n=!0,e):"?"===i?t?t+i+(a?R.repeat(a.length):""):0===s?U+(a?R.repeat(a.length):""):R.repeat(r.length):"."===i?b.repeat(r.length):"*"===i?t?t+i+(a?O:""):O:t?e:"\\".concat(e));return(!0===n&&(r=!0===p.unescape?r.replace(/\\/g,""):r.replace(/\\+/g,e=>e.length%2==0?"\\\\":e?"\\":"")),r===e&&!0===p.contains)?F.output=e:F.output=i.wrapOutput(r,F,t),F}for(;!V();){if("\0"===(n=W()))continue;if("\\"===n){let e=G();if("/"===e&&!0!==p.bash||"."===e||";"===e)continue;if(!e){K({type:"text",value:n+="\\"});continue}let t=/^\\+/.exec(j()),r=0;if(t&&t[0].length>2&&(r=t[0].length,F.index+=r,r%2!=0&&(n+="\\")),!0===p.unescape?n=W():n+=W(),0===F.brackets){K({type:"text",value:n});continue}}if(F.brackets>0&&("]"!==n||"["===H.value||"[^"===H.value)){if(!1!==p.posix&&":"===n){let e=H.value.slice(1);if(e.includes("[")&&(H.posix=!0,e.includes(":"))){let e=H.value.lastIndexOf("["),t=H.value.slice(0,e),n=s[H.value.slice(e+2)];if(n){H.value=t+n,F.backtrack=!0,W(),g.output||1!==v.indexOf(H)||(g.output=w);continue}}}("["===n&&":"!==G()||"-"===n&&"]"===G())&&(n="\\".concat(n)),"]"===n&&("["===H.value||"[^"===H.value)&&(n="\\".concat(n)),!0===p.posix&&"!"===n&&"["===H.value&&(n="^"),H.value+=n,q({value:n});continue}if(1===F.quotes&&'"'!==n){n=i.escapeRegex(n),H.value+=n,q({value:n});continue}if('"'===n){F.quotes=+(1!==F.quotes),!0===p.keepQuotes&&K({type:"text",value:n});continue}if("("===n){J("parens"),K({type:"paren",value:n});continue}if(")"===n){if(0===F.parens&&!0===p.strictBrackets)throw SyntaxError(h("opening","("));let e=k[k.length-1];if(e&&F.parens===e.parens+1){Q(k.pop());continue}K({type:"paren",value:n,output:F.parens?")":"\\)"}),Z("parens");continue}if("["===n){if(!0!==p.nobracket&&j().includes("]"))J("brackets");else{if(!0!==p.nobracket&&!0===p.strictBrackets)throw SyntaxError(h("closing","]"));n="\\".concat(n)}K({type:"bracket",value:n});continue}if("]"===n){if(!0===p.nobracket||H&&"bracket"===H.type&&1===H.value.length){K({type:"text",value:n,output:"\\".concat(n)});continue}if(0===F.brackets){if(!0===p.strictBrackets)throw SyntaxError(h("opening","["));K({type:"text",value:n,output:"\\".concat(n)});continue}Z("brackets");let e=H.value.slice(1);if(!0===H.posix||"^"!==e[0]||e.includes("/")||(n="/".concat(n)),H.value+=n,q({value:n}),!1===p.literalBrackets||i.hasRegexChars(e))continue;let t=i.escapeRegex(H.value);if(F.output=F.output.slice(0,-H.value.length),!0===p.literalBrackets){F.output+=t,H.value=t;continue}H.value="(".concat(y).concat(t,"|").concat(H.value,")"),F.output+=H.value;continue}if("{"===n&&!0!==p.nobrace){J("braces");let e={type:"brace",value:n,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};z.push(e),K(e);continue}if("}"===n){let e=z[z.length-1];if(!0===p.nobrace||!e){K({type:"text",value:n,output:n});continue}let t=")";if(!0===e.dots){let e=v.slice(),n=[];for(let t=e.length-1;t>=0&&(v.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=c(n,p),F.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){let r=F.output.slice(0,e.outputIndex),i=F.tokens.slice(e.tokensIndex);for(let a of(e.value=e.output="\\{",n=t="\\}",F.output=r,i))F.output+=a.output||a.value}K({type:"brace",value:n,output:t}),Z("braces"),z.pop();continue}if("|"===n){k.length>0&&k[k.length-1].conditions++,K({type:"text",value:n});continue}if(","===n){let e=n,t=z[z.length-1];t&&"braces"===B[B.length-1]&&(t.comma=!0,e="|"),K({type:"comma",value:n,output:e});continue}if("/"===n){if("dot"===H.type&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",v.pop(),H=g;continue}K({type:"slash",value:n,output:M});continue}if("."===n){if(F.braces>0&&"dot"===H.type){"."===H.value&&(H.output=b);let e=z[z.length-1];H.type="dots",H.output+=n,H.value+=n,e.dots=!0;continue}if(F.braces+F.parens===0&&"bos"!==H.type&&"slash"!==H.type){K({type:"text",value:n,output:b});continue}K({type:"dot",value:n,output:b});continue}if("?"===n){if(!(H&&"("===H.value)&&!0!==p.noextglob&&"("===G()&&"?"!==G(2)){$("qmark",n);continue}if(H&&"paren"===H.type){let e=G(),t=n;("("!==H.value||/[!=<:]/.test(e))&&("<"!==e||/<([!=]|\w+>)/.test(j()))||(t="\\".concat(n)),K({type:"text",value:n,output:t});continue}if(!0!==p.dot&&("slash"===H.type||"bos"===H.type)){K({type:"qmark",value:n,output:P});continue}K({type:"qmark",value:n,output:R});continue}if("!"===n){if(!0!==p.noextglob&&"("===G()&&("?"!==G(2)||!/[!=<:]/.test(G(3)))){$("negate",n);continue}if(!0!==p.nonegate&&0===F.index){Y();continue}}if("+"===n){if(!0!==p.noextglob&&"("===G()&&"?"!==G(2)){$("plus",n);continue}if(H&&"("===H.value||!1===p.regex){K({type:"plus",value:n,output:S});continue}if(H&&("bracket"===H.type||"paren"===H.type||"brace"===H.type)||F.parens>0){K({type:"plus",value:n});continue}K({type:"plus",value:S});continue}if("@"===n){if(!0!==p.noextglob&&"("===G()&&"?"!==G(2)){K({type:"at",extglob:!0,value:n,output:""});continue}K({type:"text",value:n});continue}if("*"!==n){("$"===n||"^"===n)&&(n="\\".concat(n));let e=o.exec(j());e&&(n+=e[0],F.index+=e[0].length),K({type:"text",value:n});continue}if(H&&("globstar"===H.type||!0===H.star)){H.type="star",H.star=!0,H.value+=n,H.output=O,F.backtrack=!0,F.globstar=!0,X(n);continue}let t=j();if(!0!==p.noextglob&&/^\([^?]/.test(t)){$("star",n);continue}if("star"===H.type){if(!0===p.noglobstar){X(n);continue}let r=H.prev,i=r.prev,a="slash"===r.type||"bos"===r.type,s=i&&("star"===i.type||"globstar"===i.type);if(!0===p.bash&&(!a||t[0]&&"/"!==t[0])){K({type:"star",value:n,output:""});continue}let o=F.braces>0&&("comma"===r.type||"brace"===r.type),l=k.length&&("pipe"===r.type||"paren"===r.type);if(!a&&"paren"!==r.type&&!o&&!l){K({type:"star",value:n,output:""});continue}for(;"/**"===t.slice(0,3);){let n=e[F.index+4];if(n&&"/"!==n)break;t=t.slice(3),X("/**",3)}if("bos"===r.type&&V()){H.type="globstar",H.value+=n,H.output=N(p),F.output=H.output,F.globstar=!0,X(n);continue}if("slash"===r.type&&"bos"!==r.prev.type&&!s&&V()){F.output=F.output.slice(0,-(r.output+H.output).length),r.output="(?:".concat(r.output),H.type="globstar",H.output=N(p)+(p.strictSlashes?")":"|$)"),H.value+=n,F.globstar=!0,F.output+=r.output+H.output,X(n);continue}if("slash"===r.type&&"bos"!==r.prev.type&&"/"===t[0]){let e=void 0!==t[1]?"|$":"";F.output=F.output.slice(0,-(r.output+H.output).length),r.output="(?:".concat(r.output),H.type="globstar",H.output="".concat(N(p)).concat(M,"|").concat(M).concat(e,")"),H.value+=n,F.output+=r.output+H.output,F.globstar=!0,X(n+W()),K({type:"slash",value:"/",output:""});continue}if("bos"===r.type&&"/"===t[0]){H.type="globstar",H.value+=n,H.output="(?:^|".concat(M,"|").concat(N(p)).concat(M,")"),F.output=H.output,F.globstar=!0,X(n+W()),K({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-H.output.length),H.type="globstar",H.output=N(p),H.value+=n,F.output+=H.output,F.globstar=!0,X(n);continue}let r={type:"star",value:n,output:O};if(!0===p.bash){r.output=".*?",("bos"===H.type||"slash"===H.type)&&(r.output=D+r.output),K(r);continue}if(H&&("bracket"===H.type||"paren"===H.type)&&!0===p.regex){r.output=n,K(r);continue}(F.index===F.start||"slash"===H.type||"dot"===H.type)&&("dot"===H.type?(F.output+=A,H.output+=A):!0===p.dot?(F.output+=C,H.output+=C):(F.output+=D,H.output+=D),"*"!==G()&&(F.output+=w,H.output+=w)),K(r)}for(;F.brackets>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing","]"));F.output=i.escapeLast(F.output,"["),Z("brackets")}for(;F.parens>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing",")"));F.output=i.escapeLast(F.output,"("),Z("parens")}for(;F.braces>0;){if(!0===p.strictBrackets)throw SyntaxError(h("closing","}"));F.output=i.escapeLast(F.output,"{"),Z("braces")}if(!0!==p.strictSlashes&&("star"===H.type||"bracket"===H.type)&&K({type:"maybe_slash",value:"",output:"".concat(M,"?")}),!0===F.backtrack)for(let e of(F.output="",F.tokens))F.output+=null!=e.output?e.output:e.value,e.suffix&&(F.output+=e.suffix);return F};d.fastpaths=(e,t)=>{let n={...t},s="number"==typeof n.maxLength?Math.min(a,n.maxLength):a,o=e.length;if(o>s)throw SyntaxError("Input length: ".concat(o,", exceeds maximum allowed length: ").concat(s));e=u[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:h,DOTS_SLASH:d,NO_DOT:p,NO_DOTS:f,NO_DOTS_SLASH:m,STAR:g,START_ANCHOR:v}=r.globChars(n.windows),y=n.dot?f:p,_=n.dot?m:p,x=n.capture?"":"?:",b=!0===n.bash?".*?":g;n.capture&&(b="(".concat(b,")"));let S=e=>!0===e.noglobstar?b:"(".concat(x,"(?:(?!").concat(v).concat(e.dot?d:l,").)*?)"),M=e=>{switch(e){case"*":return"".concat(y).concat(h).concat(b);case".*":return"".concat(l).concat(h).concat(b);case"*.*":return"".concat(y).concat(b).concat(l).concat(h).concat(b);case"*/*":return"".concat(y).concat(b).concat(c).concat(h).concat(_).concat(b);case"**":return y+S(n);case"**/*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(_).concat(h).concat(b);case"**/*.*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(_).concat(b).concat(l).concat(h).concat(b);case"**/.*":return"(?:".concat(y).concat(S(n)).concat(c,")?").concat(l).concat(h).concat(b);default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=M(t[1]);if(!n)return;return n+l+t[2]}}},w=M(i.removePrefix(e,{negated:!1,prefix:""}));return w&&!0!==n.strictSlashes&&(w+="".concat(c,"?")),w},t.exports=d},53174,(e,t,n)=>{"use strict";let r=e.r(26094),i=e.r(17932),a=e.r(19241),s=e.r(53487),o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(e)){let r=e.map(e=>o(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=e&&"object"==typeof e&&!Array.isArray(e)&&e.tokens&&e.input;if(""===e||"string"!=typeof e&&!r)throw TypeError("Expected pattern to be a non-empty string");let i=t||{},a=i.windows,s=r?o.compileRe(e,t):o.makeRe(e,t,!1,!0),l=s.state;delete s.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=o(i.ignore,e,n)}let c=function(n){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{isMatch:c,match:h,output:d}=o.test(n,s,t,{glob:e,posix:a}),p={glob:e,state:l,regex:s,posix:a,input:n,output:d,match:h,isMatch:c};return("function"==typeof i.onResult&&i.onResult(p),!1===c)?(p.isMatch=!1,!!r&&p):u(n)?("function"==typeof i.onIgnore&&i.onIgnore(p),p.isMatch=!1,!!r&&p):("function"==typeof i.onMatch&&i.onMatch(p),!r||p)};return n&&(c.state=l),c};o.test=function(e,t,n){let{glob:r,posix:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("string"!=typeof e)throw TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};let s=n||{},l=s.format||(i?a.toPosixSlashes:null),u=e===r,c=u&&l?l(e):e;return!1===u&&(u=(c=l?l(e):e)===r),(!1===u||!0===s.capture)&&(u=!0===s.matchBase||!0===s.basename?o.matchBase(e,t,n,i):t.exec(c)),{isMatch:!!u,match:u,output:c}},o.matchBase=(e,t,n)=>(t instanceof RegExp?t:o.makeRe(t,n)).test(a.basename(e)),o.isMatch=(e,t,n)=>o(t,n)(e),o.parse=(e,t)=>Array.isArray(e)?e.map(e=>o.parse(e,t)):i(e,{...t,fastpaths:!1}),o.scan=(e,t)=>r(e,t),o.compileRe=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!0===n)return e.output;let i=t||{},a=i.contains?"":"^",s=i.contains?"":"$",l="".concat(a,"(?:").concat(e.output,")").concat(s);e&&!0===e.negated&&(l="^(?!".concat(l,").*$"));let u=o.toRegex(l,t);return!0===r&&(u.state=e),u},o.makeRe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e||"string"!=typeof e)throw TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1!==t.fastpaths&&("."===e[0]||"*"===e[0])&&(a.output=i.fastpaths(e,t)),a.output||(a=i(e,t)),o.compileRe(a,t,n,r)},o.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},o.constants=s,t.exports=o},54970,(e,t,n)=>{"use strict";let r=e.r(53174),i=e.r(19241);function a(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&(null===t.windows||void 0===t.windows)&&(t={...t,windows:i.isWindows()}),r(e,t,n)}Object.assign(a,r),t.exports=a},98223,71726,91996,e=>{"use strict";function t(e){return e.split(/(?:\r\n|\r|\n)/g).map(e=>e.trim()).filter(Boolean).filter(e=>!e.startsWith(";")).map(e=>{let t=e.match(/^(.+)\s(\d+)$/);if(!t)return{name:e,frameCount:1};{let e=parseInt(t[2],10);return{name:t[1],frameCount:e}}})}e.s(["parseImageFileList",()=>t],98223),e.s(["getActualResourceKey",()=>l,"getMissionInfo",()=>d,"getMissionList",()=>p,"getResourceKey",()=>a,"getResourceList",()=>u,"getResourceMap",()=>s,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>h],91996);var n=e.i(63738);function r(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}e.s(["normalizePath",()=>r],71726);let i=n.default;function a(e){return r(e).toLowerCase()}function s(){return i.resources}function o(e){let[t,...n]=i.resources[e],[r,a]=n[n.length-1];return[r,null!=a?a:t]}function l(e){let t=a(e);if(i.resources[t])return t;let n=t.replace(/\d+(\.(png))$/i,"$1");if(i.resources[n])return n;throw Error("Resource not found in manifest: ".concat(e))}function u(){return Object.keys(i.resources)}let c=["",".jpg",".png",".gif",".bmp"];function h(e){let t=a(e);for(let e of c){let n="".concat(t).concat(e);if(i.resources[n])return n}return t}function d(e){let t=i.missions[e];if(!t)throw Error("Mission not found: ".concat(e));return t}function p(){return Object.keys(i.missions)}},92552,(e,t,n)=>{"use strict";let r,i;function a(e,t){return t.reduce((e,t)=>{let[n,r]=t;return{type:"BinaryExpression",operator:n,left:e,right:r}},e)}function s(e,t){return{type:"UnaryExpression",operator:e,argument:t}}class o extends SyntaxError{format(e){let t="Error: "+this.message;if(this.location){let n=null,r=e.find(e=>e.source===this.location.source);r&&(n=r.text.split(/\r\n|\n|\r/g));let i=this.location.start,a=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(i):i,s=this.location.source+":"+a.line+":"+a.column;if(n){let e=this.location.end,r="".padEnd(a.line.toString().length," "),o=n[i.line-1],l=(i.line===e.line?e.column:o.length+1)-i.column||1;t+="\n --> "+s+"\n"+r+" |\n"+a.line+" | "+o+"\n"+r+" | "+"".padEnd(i.column-1," ")+"".padEnd(l,"^")}else t+="\n at "+s}return t}static buildMessage(e,t){function n(e){return e.codePointAt(0).toString(16).toUpperCase()}let r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function i(e){return r?e.replace(r,e=>"\\u{"+n(e)+"}"):e}function a(e){return i(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+n(e)))}function s(e){return i(e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+n(e)))}let o={literal:e=>'"'+a(e.text)+'"',class(e){let t=e.parts.map(e=>Array.isArray(e)?s(e[0])+"-"+s(e[1]):s(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function l(e){return o[e.type](e)}return"Expected "+function(e){let t=e.map(l);if(t.sort(),t.length>0){let e=1;for(let n=1;n<t.length;n++)t[n-1]!==t[n]&&(t[e]=t[n],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+(t?'"'+a(t)+'"':"end of input")+" found."}constructor(e,t,n,r){super(e),this.expected=t,this.found=n,this.location=r,this.name="SyntaxError"}}t.exports={StartRules:["Program"],SyntaxError:o,parse:function(e,t){let n,l={},u=(t=void 0!==t?t:{}).grammarSource,c={Program:tI},h=tI,d="package",p="function",f="datablock",m="else",g="while",v="switch$",y="switch",_="case",x="default",b="return",S="break",M="continue",w="parent",E="true",T="false",A=/^[<>]/,C=/^[+\-]/,R=/^[%*\/]/,P=/^[!\-~]/,I=/^[a-zA-Z_]/,L=/^[a-zA-Z0-9_]/,N=/^[ \t]/,D=/^[^"\\\n\r]/,U=/^[^'\\\n\r]/,O=/^[0-9a-fA-F]/,F=/^[0-9]/,k=/^[xX]/,z=/^[^\n\r]/,B=/^[\n\r]/,H=/^[ \t\n\r]/,V=tT(";",!1),G=tT("package",!1),W=tT("{",!1),j=tT("}",!1),X=tT("function",!1),q=tT("(",!1),Y=tT(")",!1),J=tT("::",!1),Z=tT(",",!1),K=tT("datablock",!1),$=tT(":",!1),Q=tT("new",!1),ee=tT("[",!1),et=tT("]",!1),en=tT("=",!1),er=tT(".",!1),ei=tT("if",!1),ea=tT("else",!1),es=tT("for",!1),eo=tT("while",!1),el=tT("do",!1),eu=tT("switch$",!1),ec=tT("switch",!1),eh=tT("case",!1),ed=tT("default",!1),ep=tT("or",!1),ef=tT("return",!1),em=tT("break",!1),eg=tT("continue",!1),ev=tT("+=",!1),ey=tT("-=",!1),e_=tT("*=",!1),ex=tT("/=",!1),eb=tT("%=",!1),eS=tT("<<=",!1),eM=tT(">>=",!1),ew=tT("&=",!1),eE=tT("|=",!1),eT=tT("^=",!1),eA=tT("?",!1),eC=tT("||",!1),eR=tT("&&",!1),eP=tT("|",!1),eI=tT("^",!1),eL=tT("&",!1),eN=tT("==",!1),eD=tT("!=",!1),eU=tT("<=",!1),eO=tT(">=",!1),eF=tA(["<",">"],!1,!1,!1),ek=tT("$=",!1),ez=tT("!$=",!1),eB=tT("@",!1),eH=tT("NL",!1),eV=tT("TAB",!1),eG=tT("SPC",!1),eW=tT("<<",!1),ej=tT(">>",!1),eX=tA(["+","-"],!1,!1,!1),eq=tA(["%","*","/"],!1,!1,!1),eY=tA(["!","-","~"],!1,!1,!1),eJ=tT("++",!1),eZ=tT("--",!1),eK=tT("*",!1),e$=tT("%",!1),eQ=tA([["a","z"],["A","Z"],"_"],!1,!1,!1),e0=tA([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),e1=tT("$",!1),e2=tT("parent",!1),e3=tA([" "," "],!1,!1,!1),e4=tT('"',!1),e5=tT("'",!1),e6=tT("\\",!1),e8=tA(['"',"\\","\n","\r"],!0,!1,!1),e9=tA(["'","\\","\n","\r"],!0,!1,!1),e7=tT("n",!1),te=tT("r",!1),tt=tT("t",!1),tn=tT("x",!1),tr=tA([["0","9"],["a","f"],["A","F"]],!1,!1,!1),ti=tT("cr",!1),ta=tT("cp",!1),ts=tT("co",!1),to=tT("c",!1),tl=tA([["0","9"]],!1,!1,!1),tu={type:"any"},tc=tT("0",!1),th=tA(["x","X"],!1,!1,!1),td=tT("-",!1),tp=tT("true",!1),tf=tT("false",!1),tm=tT("//",!1),tg=tA(["\n","\r"],!0,!1,!1),tv=tA(["\n","\r"],!1,!1,!1),ty=tT("/*",!1),t_=tT("*/",!1),tx=tA([" "," ","\n","\r"],!1,!1,!1),tb=0|t.peg$currPos,tS=[{line:1,column:1}],tM=tb,tw=t.peg$maxFailExpected||[],tE=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in c))throw Error("Can't start parsing from rule \""+t.startRule+'".');h=c[t.startRule]}function tT(e,t){return{type:"literal",text:e,ignoreCase:t}}function tA(e,t,n,r){return{type:"class",parts:e,inverted:t,ignoreCase:n,unicode:r}}function tC(t){let n,r=tS[t];if(r)return r;if(t>=tS.length)n=tS.length-1;else for(n=t;!tS[--n];);for(r={line:(r=tS[n]).line,column:r.column};n<t;)10===e.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return tS[t]=r,r}function tR(e,t,n){let r=tC(e),i=tC(t),a={source:u,start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:i.line,column:i.column}};return n&&u&&"function"==typeof u.offset&&(a.start=u.offset(a.start),a.end=u.offset(a.end)),a}function tP(e){tb<tM||(tb>tM&&(tM=tb,tw=[]),tw.push(e))}function tI(){let e,t,n;for(nh(),e=[],t=tb,(n=nl())===l&&(n=tL()),n!==l?t=n=[n,nh()]:(tb=t,t=l);t!==l;)e.push(t),t=tb,(n=nl())===l&&(n=tL()),n!==l?t=n=[n,nh()]:(tb=t,t=l);return{type:"Program",body:e.map(e=>{let[t]=e;return t}).filter(Boolean),execScriptPaths:Array.from(r),hasDynamicExec:i}}function tL(){let t,n,r,i,a,s,o,u,c,h,f,_,x,w,E,T,A;return(t=function(){let t,n,r,i,a,s,o,u;if(t=tb,e.substr(tb,7)===d?(n=d,tb+=7):(n=l,0===tE&&tP(G)),n!==l)if(nc()!==l)if((r=nr())!==l)if(nu(),123===e.charCodeAt(tb)?(i="{",tb++):(i=l,0===tE&&tP(W)),i!==l){for(nh(),a=[],s=tb,(o=nl())===l&&(o=tL()),o!==l?s=o=[o,u=nh()]:(tb=s,s=l);s!==l;)a.push(s),s=tb,(o=nl())===l&&(o=tL()),o!==l?s=o=[o,u=nh()]:(tb=s,s=l);(125===e.charCodeAt(tb)?(s="}",tb++):(s=l,0===tE&&tP(j)),s!==l)?(o=nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),t={type:"PackageDeclaration",name:r,body:a.map(e=>{let[t]=e;return t}).filter(Boolean)}):(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o;if(t=tb,e.substr(tb,8)===p?(n=p,tb+=8):(n=l,0===tE&&tP(X)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i;if(t=tb,(n=nr())!==l)if("::"===e.substr(tb,2)?(r="::",tb+=2):(r=l,0===tE&&tP(J)),r!==l)if((i=nr())!==l)t={type:"MethodName",namespace:n,method:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=nr()),t}())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=function(){let t,n,r,i,a,s,o,u;if(t=tb,(n=nr())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=nr())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=nr())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=[n,...r.map(e=>{let[,,,t]=e;return t})]}else tb=t,t=l;return t}())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l)if(nu(),(o=tH())!==l)t={type:"FunctionDeclaration",name:r,params:a||[],body:o};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&((r=tb,(i=tN())!==l)?(nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a===l&&(a=null),nu(),r=i):(tb=r,r=l),(t=r)===l&&((s=tb,(o=tD())!==l)?(nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),nu(),s=o):(tb=s,s=l),(t=s)===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h,d;if(t=tb,"if"===e.substr(tb,2)?(n="if",tb+=2):(n=l,0===tE&&tP(ei)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),(s=tL())!==l){var p;o=tb,u=nu(),e.substr(tb,4)===m?(c=m,tb+=4):(c=l,0===tE&&tP(ea)),c!==l?(h=nu(),(d=tL())!==l?o=u=[u,c,h,d]:(tb=o,o=l)):(tb=o,o=l),o===l&&(o=null),t={type:"IfStatement",test:i,consequent:s,alternate:(p=o)?p[3]:null}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h;if(t=tb,"for"===e.substr(tb,3)?(n="for",tb+=3):(n=l,0===tE&&tP(es)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())===l&&(i=null),nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a!==l)if(nu(),(s=tV())===l&&(s=null),nu(),59===e.charCodeAt(tb)?(o=";",tb++):(o=l,0===tE&&tP(V)),o!==l)if(nu(),(u=tV())===l&&(u=null),nu(),41===e.charCodeAt(tb)?(c=")",tb++):(c=l,0===tE&&tP(Y)),c!==l)if(nu(),(h=tL())!==l){var d,p;d=i,p=s,t={type:"ForStatement",init:d,test:p,update:u,body:h}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u;if(t=tb,"do"===e.substr(tb,2)?(n="do",tb+=2):(n=l,0===tE&&tP(el)),n!==l)if(nu(),(r=tL())!==l)if(nu(),e.substr(tb,5)===g?(i=g,tb+=5):(i=l,0===tE&&tP(eo)),i!==l)if(nu(),40===e.charCodeAt(tb)?(a="(",tb++):(a=l,0===tE&&tP(q)),a!==l)if(nu(),(s=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(o=")",tb++):(o=l,0===tE&&tP(Y)),o!==l)nu(),59===e.charCodeAt(tb)?(u=";",tb++):(u=l,0===tE&&tP(V)),u===l&&(u=null),t={type:"DoWhileStatement",test:s,body:r};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s;if(t=tb,e.substr(tb,5)===g?(n=g,tb+=5):(n=l,0===tE&&tP(eo)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),(s=tL())!==l)t={type:"WhileStatement",test:i,body:s};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o,u,c,h;if(t=tb,e.substr(tb,7)===v?(n=v,tb+=7):(n=l,0===tE&&tP(eu)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),123===e.charCodeAt(tb)?(s="{",tb++):(s=l,0===tE&&tP(W)),s!==l){for(nh(),o=[],u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);u!==l;)o.push(u),u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);(125===e.charCodeAt(tb)?(u="}",tb++):(u=l,0===tE&&tP(j)),u!==l)?t={type:"SwitchStatement",stringMode:!0,discriminant:i,cases:o.map(e=>{let[t]=e;return t}).filter(e=>e&&"SwitchCase"===e.type)}:(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;if(t===l)if(t=tb,e.substr(tb,6)===y?(n=y,tb+=6):(n=l,0===tE&&tP(ec)),n!==l)if(nu(),40===e.charCodeAt(tb)?(r="(",tb++):(r=l,0===tE&&tP(q)),r!==l)if(nu(),(i=tV())!==l)if(nu(),41===e.charCodeAt(tb)?(a=")",tb++):(a=l,0===tE&&tP(Y)),a!==l)if(nu(),123===e.charCodeAt(tb)?(s="{",tb++):(s=l,0===tE&&tP(W)),s!==l){for(nh(),o=[],u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);u!==l;)o.push(u),u=tb,(c=nl())===l&&(c=tB()),c!==l?u=c=[c,h=nh()]:(tb=u,u=l);(125===e.charCodeAt(tb)?(u="}",tb++):(u=l,0===tE&&tP(j)),u!==l)?t={type:"SwitchStatement",stringMode:!1,discriminant:i,cases:o.map(e=>{let[t]=e;return t}).filter(e=>e&&"SwitchCase"===e.type)}:(tb=t,t=l)}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a;if(t=tb,e.substr(tb,6)===b?(n=b,tb+=6):(n=l,0===tE&&tP(ef)),n!==l)if(r=tb,(i=nc())!==l&&(a=tV())!==l?r=i=[i,a]:(tb=r,r=l),r===l&&(r=null),i=nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a!==l){var s;t={type:"ReturnStatement",value:(s=r)?s[1]:null}}else tb=t,t=l;else tb=t,t=l;return t}())===l&&(c=tb,e.substr(tb,5)===S?(h=S,tb+=5):(h=l,0===tE&&tP(em)),h!==l?(nu(),59===e.charCodeAt(tb)?(f=";",tb++):(f=l,0===tE&&tP(V)),f!==l?c={type:"BreakStatement"}:(tb=c,c=l)):(tb=c,c=l),(t=c)===l&&(_=tb,e.substr(tb,8)===M?(x=M,tb+=8):(x=l,0===tE&&tP(eg)),x!==l?(nu(),59===e.charCodeAt(tb)?(w=";",tb++):(w=l,0===tE&&tP(V)),w!==l?_={type:"ContinueStatement"}:(tb=_,_=l)):(tb=_,_=l),(t=_)===l&&((E=tb,(T=tV())!==l&&(nu(),59===e.charCodeAt(tb)?(A=";",tb++):(A=l,0===tE&&tP(V)),A!==l))?E={type:"ExpressionStatement",expression:T}:(tb=E,E=l),(t=E)===l&&(t=tH())===l&&(t=nl())===l)))))&&(t=tb,nu(),59===e.charCodeAt(tb)?(n=";",tb++):(n=l,0===tE&&tP(V)),n!==l?(nu(),t=null):(tb=t,t=l)),t}function tN(){let t,n,r,i,a,s,o,u,c,h,d,p,m,g;if(t=tb,e.substr(tb,9)===f?(n=f,tb+=9):(n=l,0===tE&&tP(K)),n!==l)if(nc()!==l)if((r=nr())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=tO())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l){var v,y,_;if(nu(),o=tb,58===e.charCodeAt(tb)?(u=":",tb++):(u=l,0===tE&&tP($)),u!==l?(c=nu(),(h=nr())!==l?o=u=[u,c,h]:(tb=o,o=l)):(tb=o,o=l),o===l&&(o=null),u=nu(),c=tb,123===e.charCodeAt(tb)?(h="{",tb++):(h=l,0===tE&&tP(W)),h!==l){for(d=nu(),p=[],m=tU();m!==l;)p.push(m),m=tU();m=nu(),125===e.charCodeAt(tb)?(g="}",tb++):(g=l,0===tE&&tP(j)),g!==l?c=h=[h,d,p,m,g,nu()]:(tb=c,c=l)}else tb=c,c=l;c===l&&(c=null),v=a,y=o,_=c,t={type:"DatablockDeclaration",className:r,instanceName:v,parent:y?y[2]:null,body:_?_[2].filter(Boolean):[]}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}function tD(){let t,n,r,i,a,s,o,u,c,h,d,p;if(t=tb,"new"===e.substr(tb,3)?(n="new",tb+=3):(n=l,0===tE&&tP(Q)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i,a,s,o,u,c,h;if((t=tb,40===e.charCodeAt(tb)?(n="(",tb++):(n=l,0===tE&&tP(q)),n!==l&&(r=nu(),(i=tV())!==l&&(a=nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l)))?t=i:(tb=t,t=l),t===l)if(t=tb,(n=nr())!==l){var d;for(r=[],i=tb,a=nu(),91===e.charCodeAt(tb)?(s="[",tb++):(s=l,0===tE&&tP(ee)),s!==l?(o=nu(),(u=tz())!==l?(c=nu(),93===e.charCodeAt(tb)?(h="]",tb++):(h=l,0===tE&&tP(et)),h!==l?i=a=[a,s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),91===e.charCodeAt(tb)?(s="[",tb++):(s=l,0===tE&&tP(ee)),s!==l?(o=nu(),(u=tz())!==l?(c=nu(),93===e.charCodeAt(tb)?(h="]",tb++):(h=l,0===tE&&tP(et)),h!==l?i=a=[a,s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);d=n,t=r.reduce((e,t)=>{let[,,,n]=t;return{type:"IndexExpression",object:e,index:n}},d)}else tb=t,t=l;return t}())!==l)if(nu(),40===e.charCodeAt(tb)?(i="(",tb++):(i=l,0===tE&&tP(q)),i!==l)if(nu(),(a=tO())===l&&(a=null),nu(),41===e.charCodeAt(tb)?(s=")",tb++):(s=l,0===tE&&tP(Y)),s!==l){var f;if(nu(),o=tb,123===e.charCodeAt(tb)?(u="{",tb++):(u=l,0===tE&&tP(W)),u!==l){for(c=nu(),h=[],d=tU();d!==l;)h.push(d),d=tU();d=nu(),125===e.charCodeAt(tb)?(p="}",tb++):(p=l,0===tE&&tP(j)),p!==l?o=u=[u,c,h,d,p,nu()]:(tb=o,o=l)}else tb=o,o=l;o===l&&(o=null),t={type:"ObjectDeclaration",className:r,instanceName:a,body:(f=o)?f[2].filter(Boolean):[]}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}function tU(){let t,n,r;return(t=tb,(n=tD())!==l)?(nu(),59===e.charCodeAt(tb)?(r=";",tb++):(r=l,0===tE&&tP(V)),r===l&&(r=null),nu(),t=n):(tb=t,t=l),t===l&&((t=tb,(n=tN())!==l)?(nu(),59===e.charCodeAt(tb)?(r=";",tb++):(r=l,0===tE&&tP(V)),r===l&&(r=null),nu(),t=n):(tb=t,t=l),t===l&&(t=function(){let t,n,r,i,a;if(t=tb,nu(),(n=tF())!==l)if(nu(),61===e.charCodeAt(tb)?(r="=",tb++):(r=l,0===tE&&tP(en)),r!==l)if(nu(),(i=tV())!==l)nu(),59===e.charCodeAt(tb)?(a=";",tb++):(a=l,0===tE&&tP(V)),a===l&&(a=null),nu(),t={type:"Assignment",target:n,value:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t}())===l&&(t=nl())===l&&(t=function(){let t,n;if(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n!==l)for(;n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));else t=l;return t!==l&&(t=null),t}())),t}function tO(){let e;return(e=tQ())===l&&(e=nr())===l&&(e=no()),e}function tF(){let e,t,n,r;if(e=tb,(t=t9())!==l){for(n=[],r=tk();r!==l;)n.push(r),r=tk();e=n.reduce((e,t)=>"property"===t.type?{type:"MemberExpression",object:e,property:t.value}:{type:"IndexExpression",object:e,index:t.value},t)}else tb=e,e=l;return e}function tk(){let t,n,r,i;return(t=tb,46===e.charCodeAt(tb)?(n=".",tb++):(n=l,0===tE&&tP(er)),n!==l&&(nu(),(r=nr())!==l))?t={type:"property",value:r}:(tb=t,t=l),t===l&&((t=tb,91===e.charCodeAt(tb)?(n="[",tb++):(n=l,0===tE&&tP(ee)),n!==l&&(nu(),(r=tz())!==l&&(nu(),93===e.charCodeAt(tb)?(i="]",tb++):(i=l,0===tE&&tP(et)),i!==l)))?t={type:"index",value:r}:(tb=t,t=l)),t}function tz(){let t,n,r,i,a,s,o,u;if(t=tb,(n=tV())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=r.length>0?[n,...r.map(e=>{let[,,,t]=e;return t})]:n}else tb=t,t=l;return t}function tB(){let t,n,r,i,a,s,o,u,c;if(t=tb,e.substr(tb,4)===_?(n=_,tb+=4):(n=l,0===tE&&tP(eh)),n!==l)if(nc()!==l)if((r=function(){let t,n,r,i,a,s,o,u;if(t=tb,(n=t4())!==l){for(r=[],i=tb,a=nu(),"or"===e.substr(tb,2)?(s="or",tb+=2):(s=l,0===tE&&tP(ep)),s!==l&&(o=nc())!==l&&(u=t4())!==l?i=a=[a,s,o,u]:(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),"or"===e.substr(tb,2)?(s="or",tb+=2):(s=l,0===tE&&tP(ep)),s!==l&&(o=nc())!==l&&(u=t4())!==l?i=a=[a,s,o,u]:(tb=i,i=l);t=r.length>0?[n,...r.map(e=>{let[,,,t]=e;return t})]:n}else tb=t,t=l;return t}())!==l)if(nu(),58===e.charCodeAt(tb)?(i=":",tb++):(i=l,0===tE&&tP($)),i!==l){for(a=nh(),s=[],o=tb,(u=nl())===l&&(u=tL()),u!==l?o=u=[u,c=nh()]:(tb=o,o=l);o!==l;)s.push(o),o=tb,(u=nl())===l&&(u=tL()),u!==l?o=u=[u,c=nh()]:(tb=o,o=l);t={type:"SwitchCase",test:r,consequent:s.map(e=>{let[t]=e;return t}).filter(Boolean)}}else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;if(t===l)if(t=tb,e.substr(tb,7)===x?(n=x,tb+=7):(n=l,0===tE&&tP(ed)),n!==l)if(nu(),58===e.charCodeAt(tb)?(r=":",tb++):(r=l,0===tE&&tP($)),r!==l){for(nh(),i=[],a=tb,(s=nl())===l&&(s=tL()),s!==l?a=s=[s,o=nh()]:(tb=a,a=l);a!==l;)i.push(a),a=tb,(s=nl())===l&&(s=tL()),s!==l?a=s=[s,o=nh()]:(tb=a,a=l);t={type:"SwitchCase",test:null,consequent:i.map(e=>{let[t]=e;return t}).filter(Boolean)}}else tb=t,t=l;else tb=t,t=l;return t}function tH(){let t,n,r,i,a,s;if(t=tb,123===e.charCodeAt(tb)?(n="{",tb++):(n=l,0===tE&&tP(W)),n!==l){for(nh(),r=[],i=tb,(a=nl())===l&&(a=tL()),a!==l?i=a=[a,s=nh()]:(tb=i,i=l);i!==l;)r.push(i),i=tb,(a=nl())===l&&(a=tL()),a!==l?i=a=[a,s=nh()]:(tb=i,i=l);(125===e.charCodeAt(tb)?(i="}",tb++):(i=l,0===tE&&tP(j)),i!==l)?t={type:"BlockStatement",body:r.map(e=>{let[t]=e;return t}).filter(Boolean)}:(tb=t,t=l)}else tb=t,t=l;return t}function tV(){let t,n,r,i;if(t=tb,(n=tF())!==l)if(nu(),(r=tG())!==l)if(nu(),(i=tV())!==l)t={type:"AssignmentExpression",operator:r,target:n,value:i};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=function(){let t,n,r,i,a,s;if(t=tb,(n=tW())!==l)if(nu(),63===e.charCodeAt(tb)?(r="?",tb++):(r=l,0===tE&&tP(eA)),r!==l)if(nu(),(i=tV())!==l)if(nu(),58===e.charCodeAt(tb)?(a=":",tb++):(a=l,0===tE&&tP($)),a!==l)if(nu(),(s=tV())!==l)t={type:"ConditionalExpression",test:n,consequent:i,alternate:s};else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;else tb=t,t=l;return t===l&&(t=tW()),t}()),t}function tG(){let t;return 61===e.charCodeAt(tb)?(t="=",tb++):(t=l,0===tE&&tP(en)),t===l&&("+="===e.substr(tb,2)?(t="+=",tb+=2):(t=l,0===tE&&tP(ev)),t===l&&("-="===e.substr(tb,2)?(t="-=",tb+=2):(t=l,0===tE&&tP(ey)),t===l&&("*="===e.substr(tb,2)?(t="*=",tb+=2):(t=l,0===tE&&tP(e_)),t===l&&("/="===e.substr(tb,2)?(t="/=",tb+=2):(t=l,0===tE&&tP(ex)),t===l&&("%="===e.substr(tb,2)?(t="%=",tb+=2):(t=l,0===tE&&tP(eb)),t===l&&("<<="===e.substr(tb,3)?(t="<<=",tb+=3):(t=l,0===tE&&tP(eS)),t===l&&(">>="===e.substr(tb,3)?(t=">>=",tb+=3):(t=l,0===tE&&tP(eM)),t===l&&("&="===e.substr(tb,2)?(t="&=",tb+=2):(t=l,0===tE&&tP(ew)),t===l&&("|="===e.substr(tb,2)?(t="|=",tb+=2):(t=l,0===tE&&tP(eE)),t===l&&("^="===e.substr(tb,2)?(t="^=",tb+=2):(t=l,0===tE&&tP(eT)))))))))))),t}function tW(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tj())!==l){for(r=[],i=tb,s=nu(),"||"===e.substr(tb,2)?(o="||",tb+=2):(o=l,0===tE&&tP(eC)),o!==l?(u=nu(),(c=tj())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),"||"===e.substr(tb,2)?(o="||",tb+=2):(o=l,0===tE&&tP(eC)),o!==l?(u=nu(),(c=tj())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tj(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tX())!==l){for(r=[],i=tb,s=nu(),"&&"===e.substr(tb,2)?(o="&&",tb+=2):(o=l,0===tE&&tP(eR)),o!==l?(u=nu(),(c=tX())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),"&&"===e.substr(tb,2)?(o="&&",tb+=2):(o=l,0===tE&&tP(eR)),o!==l?(u=nu(),(c=tX())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tX(){let t,n,r,i,s,o,u,c,h;if(t=tb,(n=tq())!==l){for(r=[],i=tb,s=nu(),124===e.charCodeAt(tb)?(o="|",tb++):(o=l,0===tE&&tP(eP)),o!==l?(u=tb,tE++,124===e.charCodeAt(tb)?(c="|",tb++):(c=l,0===tE&&tP(eP)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tq())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),124===e.charCodeAt(tb)?(o="|",tb++):(o=l,0===tE&&tP(eP)),o!==l?(u=tb,tE++,124===e.charCodeAt(tb)?(c="|",tb++):(c=l,0===tE&&tP(eP)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tq())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tq(){let t,n,r,i,s,o,u,c;if(t=tb,(n=tY())!==l){for(r=[],i=tb,s=nu(),94===e.charCodeAt(tb)?(o="^",tb++):(o=l,0===tE&&tP(eI)),o!==l?(u=nu(),(c=tY())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),94===e.charCodeAt(tb)?(o="^",tb++):(o=l,0===tE&&tP(eI)),o!==l?(u=nu(),(c=tY())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tY(){let t,n,r,i,s,o,u,c,h;if(t=tb,(n=tJ())!==l){for(r=[],i=tb,s=nu(),38===e.charCodeAt(tb)?(o="&",tb++):(o=l,0===tE&&tP(eL)),o!==l?(u=tb,tE++,38===e.charCodeAt(tb)?(c="&",tb++):(c=l,0===tE&&tP(eL)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tJ())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),38===e.charCodeAt(tb)?(o="&",tb++):(o=l,0===tE&&tP(eL)),o!==l?(u=tb,tE++,38===e.charCodeAt(tb)?(c="&",tb++):(c=l,0===tE&&tP(eL)),tE--,c===l?u=void 0:(tb=u,u=l),u!==l?(c=nu(),(h=tJ())!==l?i=s=[s,o,u,c,h]:(tb=i,i=l)):(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function tJ(){let e,t,n,r,i,s,o,u;if(e=tb,(t=tK())!==l){for(n=[],r=tb,i=nu(),(s=tZ())!==l?(o=nu(),(u=tK())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=tZ())!==l?(o=nu(),(u=tK())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function tZ(){let t;return"=="===e.substr(tb,2)?(t="==",tb+=2):(t=l,0===tE&&tP(eN)),t===l&&("!="===e.substr(tb,2)?(t="!=",tb+=2):(t=l,0===tE&&tP(eD))),t}function tK(){let e,t,n,r,i,s,o,u;if(e=tb,(t=tQ())!==l){for(n=[],r=tb,i=nu(),(s=t$())!==l?(o=nu(),(u=tQ())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t$())!==l?(o=nu(),(u=tQ())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t$(){let t;return"<="===e.substr(tb,2)?(t="<=",tb+=2):(t=l,0===tE&&tP(eU)),t===l&&(">="===e.substr(tb,2)?(t=">=",tb+=2):(t=l,0===tE&&tP(eO)),t===l&&(t=e.charAt(tb),A.test(t)?tb++:(t=l,0===tE&&tP(eF)))),t}function tQ(){let e,t,n,r,i,s,o,u;if(e=tb,(t=t2())!==l){for(n=[],r=tb,i=nu(),(s=t1())!==l?(o=nu(),(u=t0())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t1())!==l?(o=nu(),(u=t0())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t0(){let e,t,n,r;if(e=tb,(t=tF())!==l)if(nu(),(n=tG())!==l)if(nu(),(r=tV())!==l)e={type:"AssignmentExpression",operator:n,target:t,value:r};else tb=e,e=l;else tb=e,e=l;else tb=e,e=l;return e===l&&(e=t2()),e}function t1(){let t;return"$="===e.substr(tb,2)?(t="$=",tb+=2):(t=l,0===tE&&tP(ek)),t===l&&("!$="===e.substr(tb,3)?(t="!$=",tb+=3):(t=l,0===tE&&tP(ez)),t===l&&(64===e.charCodeAt(tb)?(t="@",tb++):(t=l,0===tE&&tP(eB)),t===l&&("NL"===e.substr(tb,2)?(t="NL",tb+=2):(t=l,0===tE&&tP(eH)),t===l&&("TAB"===e.substr(tb,3)?(t="TAB",tb+=3):(t=l,0===tE&&tP(eV)),t===l&&("SPC"===e.substr(tb,3)?(t="SPC",tb+=3):(t=l,0===tE&&tP(eG))))))),t}function t2(){let e,t,n,r,i,s,o,u;if(e=tb,(t=t4())!==l){for(n=[],r=tb,i=nu(),(s=t3())!==l?(o=nu(),(u=t4())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);r!==l;)n.push(r),r=tb,i=nu(),(s=t3())!==l?(o=nu(),(u=t4())!==l?r=i=[i,s,o,u]:(tb=r,r=l)):(tb=r,r=l);e=a(t,n.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=e,e=l;return e}function t3(){let t;return"<<"===e.substr(tb,2)?(t="<<",tb+=2):(t=l,0===tE&&tP(eW)),t===l&&(">>"===e.substr(tb,2)?(t=">>",tb+=2):(t=l,0===tE&&tP(ej))),t}function t4(){let t,n,r,i,s,o,u,c;if(t=tb,(n=t5())!==l){for(r=[],i=tb,s=nu(),o=e.charAt(tb),C.test(o)?tb++:(o=l,0===tE&&tP(eX)),o!==l?(u=nu(),(c=t5())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),o=e.charAt(tb),C.test(o)?tb++:(o=l,0===tE&&tP(eX)),o!==l?(u=nu(),(c=t5())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function t5(){let t,n,r,i,s,o,u,c;if(t=tb,(n=t6())!==l){for(r=[],i=tb,s=nu(),o=e.charAt(tb),R.test(o)?tb++:(o=l,0===tE&&tP(eq)),o!==l?(u=nu(),(c=t6())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,s=nu(),o=e.charAt(tb),R.test(o)?tb++:(o=l,0===tE&&tP(eq)),o!==l?(u=nu(),(c=t6())!==l?i=s=[s,o,u,c]:(tb=i,i=l)):(tb=i,i=l);t=a(n,r.map(e=>{let[,t,,n]=e;return[t,n]}))}else tb=t,t=l;return t}function t6(){let t,n,r;return(t=tb,n=e.charAt(tb),P.test(n)?tb++:(n=l,0===tE&&tP(eY)),n!==l&&(nu(),(r=t8())!==l))?t=s(n,r):(tb=t,t=l),t===l&&((t=tb,"++"===e.substr(tb,2)?(n="++",tb+=2):(n=l,0===tE&&tP(eJ)),n===l&&("--"===e.substr(tb,2)?(n="--",tb+=2):(n=l,0===tE&&tP(eZ))),n!==l&&(nu(),(r=t8())!==l))?t=s(n,r):(tb=t,t=l),t===l&&((t=tb,42===e.charCodeAt(tb)?(n="*",tb++):(n=l,0===tE&&tP(eK)),n!==l&&(nu(),(r=t8())!==l))?t={type:"TagDereferenceExpression",argument:r}:(tb=t,t=l),t===l&&(t=function(){let t,n,r;if(t=tb,(n=t9())!==l)if(nu(),"++"===e.substr(tb,2)?(r="++",tb+=2):(r=l,0===tE&&tP(eJ)),r===l&&("--"===e.substr(tb,2)?(r="--",tb+=2):(r=l,0===tE&&tP(eZ))),r!==l)t={type:"PostfixExpression",operator:r,argument:n};else tb=t,t=l;else tb=t,t=l;return t===l&&(t=t9()),t}()))),t}function t8(){let e,t,n,r;if(e=tb,(t=tF())!==l)if(nu(),(n=tG())!==l)if(nu(),(r=tV())!==l)e={type:"AssignmentExpression",operator:n,target:t,value:r};else tb=e,e=l;else tb=e,e=l;else tb=e,e=l;return e===l&&(e=t6()),e}function t9(){let t,n,a,s,o,u,c,h,d,p;if(t=tb,(n=function(){let t,n,r,i,a,s,o,u,c,h,d,p,f,m,g,v;if(t=tb,(o=tD())===l&&(o=tN())===l&&(o=function(){let t,n,r,i;if(t=tb,34===e.charCodeAt(tb)?(n='"',tb++):(n=l,0===tE&&tP(e4)),n!==l){for(r=[],i=ni();i!==l;)r.push(i),i=ni();(34===e.charCodeAt(tb)?(i='"',tb++):(i=l,0===tE&&tP(e4)),i!==l)?t={type:"StringLiteral",value:r.join("")}:(tb=t,t=l)}else tb=t,t=l;if(t===l)if(t=tb,39===e.charCodeAt(tb)?(n="'",tb++):(n=l,0===tE&&tP(e5)),n!==l){for(r=[],i=na();i!==l;)r.push(i),i=na();(39===e.charCodeAt(tb)?(i="'",tb++):(i=l,0===tE&&tP(e5)),i!==l)?t={type:"StringLiteral",value:r.join(""),tagged:!0}:(tb=t,t=l)}else tb=t,t=l;return t}())===l&&(o=no())===l&&((u=tb,e.substr(tb,4)===E?(c=E,tb+=4):(c=l,0===tE&&tP(tp)),c===l&&(e.substr(tb,5)===T?(c=T,tb+=5):(c=l,0===tE&&tP(tf))),c!==l&&(h=tb,tE++,d=np(),tE--,d===l?h=void 0:(tb=h,h=l),h!==l))?u={type:"BooleanLiteral",value:"true"===c}:(tb=u,u=l),(o=u)===l&&((p=ne())===l&&(p=nt())===l&&(p=nn()),(o=p)===l))&&((f=tb,40===e.charCodeAt(tb)?(m="(",tb++):(m=l,0===tE&&tP(q)),m!==l&&(nu(),(g=tV())!==l&&(nu(),41===e.charCodeAt(tb)?(v=")",tb++):(v=l,0===tE&&tP(Y)),v!==l)))?f=g:(tb=f,f=l),o=f),(n=o)!==l){for(r=[],i=tb,a=nu(),(s=tk())!==l?i=a=[a,s]:(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),(s=tk())!==l?i=a=[a,s]:(tb=i,i=l);t=r.reduce((e,t)=>{let[,n]=t;return"property"===n.type?{type:"MemberExpression",object:e,property:n.value}:{type:"IndexExpression",object:e,index:n.value}},n)}else tb=t,t=l;return t}())!==l){for(a=[],s=tb,o=nu(),40===e.charCodeAt(tb)?(u="(",tb++):(u=l,0===tE&&tP(q)),u!==l?(c=nu(),(h=t7())===l&&(h=null),d=nu(),41===e.charCodeAt(tb)?(p=")",tb++):(p=l,0===tE&&tP(Y)),p!==l?s=o=[o,u,c,h,d,p]:(tb=s,s=l)):(tb=s,s=l),s===l&&(s=tb,o=nu(),(u=tk())!==l?s=o=[o,u]:(tb=s,s=l));s!==l;)a.push(s),s=tb,o=nu(),40===e.charCodeAt(tb)?(u="(",tb++):(u=l,0===tE&&tP(q)),u!==l?(c=nu(),(h=t7())===l&&(h=null),d=nu(),41===e.charCodeAt(tb)?(p=")",tb++):(p=l,0===tE&&tP(Y)),p!==l?s=o=[o,u,c,h,d,p]:(tb=s,s=l)):(tb=s,s=l),s===l&&(s=tb,o=nu(),(u=tk())!==l?s=o=[o,u]:(tb=s,s=l));t=a.reduce((e,t)=>{if("("===t[1]){var n;let[,,,a]=t;return n=a||[],"Identifier"===e.type&&"exec"===e.name.toLowerCase()&&(n.length>0&&"StringLiteral"===n[0].type?r.add(n[0].value):i=!0),{type:"CallExpression",callee:e,arguments:n}}let a=t[1];return"property"===a.type?{type:"MemberExpression",object:e,property:a.value}:{type:"IndexExpression",object:e,index:a.value}},n)}else tb=t,t=l;return t}function t7(){let t,n,r,i,a,s,o,u;if(t=tb,(n=tV())!==l){for(r=[],i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=nu(),44===e.charCodeAt(tb)?(s=",",tb++):(s=l,0===tE&&tP(Z)),s!==l?(o=nu(),(u=tV())!==l?i=a=[a,s,o,u]:(tb=i,i=l)):(tb=i,i=l);t=[n,...r.map(e=>{let[,,,t]=e;return t})]}else tb=t,t=l;return t}function ne(){let t,n,r,i,a,s,o;if(t=tb,37===e.charCodeAt(tb)?(n="%",tb++):(n=l,0===tE&&tP(e$)),n!==l){if(r=tb,i=tb,a=e.charAt(tb),I.test(a)?tb++:(a=l,0===tE&&tP(eQ)),a!==l){for(s=[],o=e.charAt(tb),L.test(o)?tb++:(o=l,0===tE&&tP(e0));o!==l;)s.push(o),o=e.charAt(tb),L.test(o)?tb++:(o=l,0===tE&&tP(e0));i=a=[a,s]}else tb=i,i=l;(r=i!==l?e.substring(r,tb):i)!==l?t={type:"Variable",scope:"local",name:r}:(tb=t,t=l)}else tb=t,t=l;return t}function nt(){let t,n,r,i,a,s,o,u,c,h,d,p,f;if(t=tb,36===e.charCodeAt(tb)?(n="$",tb++):(n=l,0===tE&&tP(e1)),n!==l){if(r=tb,i=tb,"::"===e.substr(tb,2)?(a="::",tb+=2):(a=l,0===tE&&tP(J)),a===l&&(a=null),s=e.charAt(tb),I.test(s)?tb++:(s=l,0===tE&&tP(eQ)),s!==l){for(o=[],u=e.charAt(tb),L.test(u)?tb++:(u=l,0===tE&&tP(e0));u!==l;)o.push(u),u=e.charAt(tb),L.test(u)?tb++:(u=l,0===tE&&tP(e0));if(u=[],c=tb,"::"===e.substr(tb,2)?(h="::",tb+=2):(h=l,0===tE&&tP(J)),h!==l)if(d=e.charAt(tb),I.test(d)?tb++:(d=l,0===tE&&tP(eQ)),d!==l){for(p=[],f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));f!==l;)p.push(f),f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));c=h=[h,d,p]}else tb=c,c=l;else tb=c,c=l;for(;c!==l;)if(u.push(c),c=tb,"::"===e.substr(tb,2)?(h="::",tb+=2):(h=l,0===tE&&tP(J)),h!==l)if(d=e.charAt(tb),I.test(d)?tb++:(d=l,0===tE&&tP(eQ)),d!==l){for(p=[],f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));f!==l;)p.push(f),f=e.charAt(tb),L.test(f)?tb++:(f=l,0===tE&&tP(e0));c=h=[h,d,p]}else tb=c,c=l;else tb=c,c=l;i=a=[a,s,o,u]}else tb=i,i=l;(r=i!==l?e.substring(r,tb):i)!==l?t={type:"Variable",scope:"global",name:r}:(tb=t,t=l)}else tb=t,t=l;return t}function nn(){let t,n,r,i,a,s,o,u,c,h,d;if(t=tb,n=tb,r=tb,e.substr(tb,6)===w?(i=w,tb+=6):(i=l,0===tE&&tP(e2)),i!==l){for(a=[],s=e.charAt(tb),N.test(s)?tb++:(s=l,0===tE&&tP(e3));s!==l;)a.push(s),s=e.charAt(tb),N.test(s)?tb++:(s=l,0===tE&&tP(e3));if("::"===e.substr(tb,2)?(s="::",tb+=2):(s=l,0===tE&&tP(J)),s!==l){for(o=[],u=e.charAt(tb),N.test(u)?tb++:(u=l,0===tE&&tP(e3));u!==l;)o.push(u),u=e.charAt(tb),N.test(u)?tb++:(u=l,0===tE&&tP(e3));if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));r=i=[i,a,s,o,u,c]}else tb=r,r=l}else tb=r,r=l}else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n.replace(/\s+/g,"")}),(t=n)===l){if(t=tb,n=tb,r=tb,e.substr(tb,6)===w?(i=w,tb+=6):(i=l,0===tE&&tP(e2)),i!==l){if(a=[],s=tb,"::"===e.substr(tb,2)?(o="::",tb+=2):(o=l,0===tE&&tP(J)),o!==l)if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));s=o=[o,u,c]}else tb=s,s=l;else tb=s,s=l;if(s!==l)for(;s!==l;)if(a.push(s),s=tb,"::"===e.substr(tb,2)?(o="::",tb+=2):(o=l,0===tE&&tP(J)),o!==l)if(u=e.charAt(tb),I.test(u)?tb++:(u=l,0===tE&&tP(eQ)),u!==l){for(c=[],h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));h!==l;)c.push(h),h=e.charAt(tb),L.test(h)?tb++:(h=l,0===tE&&tP(e0));s=o=[o,u,c]}else tb=s,s=l;else tb=s,s=l;else a=l;a!==l?r=i=[i,a]:(tb=r,r=l)}else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n}),(t=n)===l){if(t=tb,n=tb,r=tb,i=e.charAt(tb),I.test(i)?tb++:(i=l,0===tE&&tP(eQ)),i!==l){for(a=[],s=e.charAt(tb),L.test(s)?tb++:(s=l,0===tE&&tP(e0));s!==l;)a.push(s),s=e.charAt(tb),L.test(s)?tb++:(s=l,0===tE&&tP(e0));if(s=[],o=tb,"::"===e.substr(tb,2)?(u="::",tb+=2):(u=l,0===tE&&tP(J)),u!==l)if(c=e.charAt(tb),I.test(c)?tb++:(c=l,0===tE&&tP(eQ)),c!==l){for(h=[],d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));d!==l;)h.push(d),d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));o=u=[u,c,h]}else tb=o,o=l;else tb=o,o=l;for(;o!==l;)if(s.push(o),o=tb,"::"===e.substr(tb,2)?(u="::",tb+=2):(u=l,0===tE&&tP(J)),u!==l)if(c=e.charAt(tb),I.test(c)?tb++:(c=l,0===tE&&tP(eQ)),c!==l){for(h=[],d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));d!==l;)h.push(d),d=e.charAt(tb),L.test(d)?tb++:(d=l,0===tE&&tP(e0));o=u=[u,c,h]}else tb=o,o=l;else tb=o,o=l;r=i=[i,a,s]}else tb=r,r=l;(n=r!==l?e.substring(n,tb):r)!==l&&(n={type:"Identifier",name:n}),t=n}}return t}function nr(){let e;return(e=ne())===l&&(e=nt())===l&&(e=nn()),e}function ni(){let t,n,r;return(t=tb,92===e.charCodeAt(tb)?(n="\\",tb++):(n=l,0===tE&&tP(e6)),n!==l&&(r=ns())!==l)?t=r:(tb=t,t=l),t===l&&(t=e.charAt(tb),D.test(t)?tb++:(t=l,0===tE&&tP(e8))),t}function na(){let t,n,r;return(t=tb,92===e.charCodeAt(tb)?(n="\\",tb++):(n=l,0===tE&&tP(e6)),n!==l&&(r=ns())!==l)?t=r:(tb=t,t=l),t===l&&(t=e.charAt(tb),U.test(t)?tb++:(t=l,0===tE&&tP(e9))),t}function ns(){let t,n,r,i,a,s;return t=tb,110===e.charCodeAt(tb)?(n="n",tb++):(n=l,0===tE&&tP(e7)),n!==l&&(n="\n"),(t=n)===l&&(t=tb,114===e.charCodeAt(tb)?(n="r",tb++):(n=l,0===tE&&tP(te)),n!==l&&(n="\r"),(t=n)===l)&&(t=tb,116===e.charCodeAt(tb)?(n="t",tb++):(n=l,0===tE&&tP(tt)),n!==l&&(n=" "),(t=n)===l)&&((t=tb,120===e.charCodeAt(tb)?(n="x",tb++):(n=l,0===tE&&tP(tn)),n!==l&&(r=tb,i=tb,a=e.charAt(tb),O.test(a)?tb++:(a=l,0===tE&&tP(tr)),a!==l?(s=e.charAt(tb),O.test(s)?tb++:(s=l,0===tE&&tP(tr)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l),(r=i!==l?e.substring(r,tb):i)!==l))?t=String.fromCharCode(parseInt(r,16)):(tb=t,t=l),t===l&&(t=tb,"cr"===e.substr(tb,2)?(n="cr",tb+=2):(n=l,0===tE&&tP(ti)),n!==l&&(n="\x0f"),(t=n)===l&&(t=tb,"cp"===e.substr(tb,2)?(n="cp",tb+=2):(n=l,0===tE&&tP(ta)),n!==l&&(n="\x10"),(t=n)===l))&&(t=tb,"co"===e.substr(tb,2)?(n="co",tb+=2):(n=l,0===tE&&tP(ts)),n!==l&&(n="\x11"),(t=n)===l)&&((t=tb,99===e.charCodeAt(tb)?(n="c",tb++):(n=l,0===tE&&tP(to)),n!==l&&(r=e.charAt(tb),F.test(r)?tb++:(r=l,0===tE&&tP(tl)),r!==l))?t=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(r,10)]):(tb=t,t=l),t===l&&(t=tb,e.length>tb?(n=e.charAt(tb),tb++):(n=l,0===tE&&tP(tu)),t=n))),t}function no(){let t,n,r,i,a,s,o,u,c;if(t=tb,n=tb,r=tb,48===e.charCodeAt(tb)?(i="0",tb++):(i=l,0===tE&&tP(tc)),i!==l)if(a=e.charAt(tb),k.test(a)?tb++:(a=l,0===tE&&tP(th)),a!==l){if(s=[],o=e.charAt(tb),O.test(o)?tb++:(o=l,0===tE&&tP(tr)),o!==l)for(;o!==l;)s.push(o),o=e.charAt(tb),O.test(o)?tb++:(o=l,0===tE&&tP(tr));else s=l;s!==l?r=i=[i,a,s]:(tb=r,r=l)}else tb=r,r=l;else tb=r,r=l;if((n=r!==l?e.substring(n,tb):r)!==l&&(r=tb,tE++,i=np(),tE--,i===l?r=void 0:(tb=r,r=l),r!==l)?t={type:"NumberLiteral",value:parseInt(n,16)}:(tb=t,t=l),t===l){if(t=tb,n=tb,r=tb,45===e.charCodeAt(tb)?(i="-",tb++):(i=l,0===tE&&tP(td)),i===l&&(i=null),a=[],s=e.charAt(tb),F.test(s)?tb++:(s=l,0===tE&&tP(tl)),s!==l)for(;s!==l;)a.push(s),s=e.charAt(tb),F.test(s)?tb++:(s=l,0===tE&&tP(tl));else a=l;if(a!==l){if(s=tb,46===e.charCodeAt(tb)?(o=".",tb++):(o=l,0===tE&&tP(er)),o!==l){if(u=[],c=e.charAt(tb),F.test(c)?tb++:(c=l,0===tE&&tP(tl)),c!==l)for(;c!==l;)u.push(c),c=e.charAt(tb),F.test(c)?tb++:(c=l,0===tE&&tP(tl));else u=l;u!==l?s=o=[o,u]:(tb=s,s=l)}else tb=s,s=l;s===l&&(s=null),r=i=[i,a,s]}else tb=r,r=l;if(r===l)if(r=tb,45===e.charCodeAt(tb)?(i="-",tb++):(i=l,0===tE&&tP(td)),i===l&&(i=null),46===e.charCodeAt(tb)?(a=".",tb++):(a=l,0===tE&&tP(er)),a!==l){if(s=[],o=e.charAt(tb),F.test(o)?tb++:(o=l,0===tE&&tP(tl)),o!==l)for(;o!==l;)s.push(o),o=e.charAt(tb),F.test(o)?tb++:(o=l,0===tE&&tP(tl));else s=l;s!==l?r=i=[i,a,s]:(tb=r,r=l)}else tb=r,r=l;(n=r!==l?e.substring(n,tb):r)!==l&&(r=tb,tE++,i=np(),tE--,i===l?r=void 0:(tb=r,r=l),r!==l)?t={type:"NumberLiteral",value:parseFloat(n)}:(tb=t,t=l)}return t}function nl(){let t;return(t=function(){let t,n,r,i,a;if(t=tb,"//"===e.substr(tb,2)?(n="//",tb+=2):(n=l,0===tE&&tP(tm)),n!==l){for(r=tb,i=[],a=e.charAt(tb),z.test(a)?tb++:(a=l,0===tE&&tP(tg));a!==l;)i.push(a),a=e.charAt(tb),z.test(a)?tb++:(a=l,0===tE&&tP(tg));r=e.substring(r,tb),i=e.charAt(tb),B.test(i)?tb++:(i=l,0===tE&&tP(tv)),i===l&&(i=null),t={type:"Comment",value:r}}else tb=t,t=l;return t}())===l&&(t=function(){let t,n,r,i,a,s,o;if(t=tb,"/*"===e.substr(tb,2)?(n="/*",tb+=2):(n=l,0===tE&&tP(ty)),n!==l){for(r=tb,i=[],a=tb,s=tb,tE++,"*/"===e.substr(tb,2)?(o="*/",tb+=2):(o=l,0===tE&&tP(t_)),tE--,o===l?s=void 0:(tb=s,s=l),s!==l?(e.length>tb?(o=e.charAt(tb),tb++):(o=l,0===tE&&tP(tu)),o!==l?a=s=[s,o]:(tb=a,a=l)):(tb=a,a=l);a!==l;)i.push(a),a=tb,s=tb,tE++,"*/"===e.substr(tb,2)?(o="*/",tb+=2):(o=l,0===tE&&tP(t_)),tE--,o===l?s=void 0:(tb=s,s=l),s!==l?(e.length>tb?(o=e.charAt(tb),tb++):(o=l,0===tE&&tP(tu)),o!==l?a=s=[s,o]:(tb=a,a=l)):(tb=a,a=l);(r=e.substring(r,tb),"*/"===e.substr(tb,2)?(i="*/",tb+=2):(i=l,0===tE&&tP(t_)),i!==l)?t={type:"Comment",value:r}:(tb=t,t=l)}else tb=t,t=l;return t}()),t}function nu(){let t,n;for(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n===l&&(n=nd());n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx)),n===l&&(n=nd());return t}function nc(){let t,n,r,i;if(t=tb,n=[],r=e.charAt(tb),H.test(r)?tb++:(r=l,0===tE&&tP(tx)),r!==l)for(;r!==l;)n.push(r),r=e.charAt(tb),H.test(r)?tb++:(r=l,0===tE&&tP(tx));else n=l;if(n!==l){for(r=[],i=e.charAt(tb),H.test(i)?tb++:(i=l,0===tE&&tP(tx)),i===l&&(i=nd());i!==l;)r.push(i),i=e.charAt(tb),H.test(i)?tb++:(i=l,0===tE&&tP(tx)),i===l&&(i=nd());t=n=[n,r]}else tb=t,t=l;return t}function nh(){let t,n;for(t=[],n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));n!==l;)t.push(n),n=e.charAt(tb),H.test(n)?tb++:(n=l,0===tE&&tP(tx));return t}function nd(){let t,n,r,i,a,s;if(t=tb,"//"===e.substr(tb,2)?(n="//",tb+=2):(n=l,0===tE&&tP(tm)),n!==l){for(r=[],i=e.charAt(tb),z.test(i)?tb++:(i=l,0===tE&&tP(tg));i!==l;)r.push(i),i=e.charAt(tb),z.test(i)?tb++:(i=l,0===tE&&tP(tg));i=e.charAt(tb),B.test(i)?tb++:(i=l,0===tE&&tP(tv)),i===l&&(i=null),t=n=[n,r,i]}else tb=t,t=l;if(t===l)if(t=tb,"/*"===e.substr(tb,2)?(n="/*",tb+=2):(n=l,0===tE&&tP(ty)),n!==l){for(r=[],i=tb,a=tb,tE++,"*/"===e.substr(tb,2)?(s="*/",tb+=2):(s=l,0===tE&&tP(t_)),tE--,s===l?a=void 0:(tb=a,a=l),a!==l?(e.length>tb?(s=e.charAt(tb),tb++):(s=l,0===tE&&tP(tu)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l);i!==l;)r.push(i),i=tb,a=tb,tE++,"*/"===e.substr(tb,2)?(s="*/",tb+=2):(s=l,0===tE&&tP(t_)),tE--,s===l?a=void 0:(tb=a,a=l),a!==l?(e.length>tb?(s=e.charAt(tb),tb++):(s=l,0===tE&&tP(tu)),s!==l?i=a=[a,s]:(tb=i,i=l)):(tb=i,i=l);"*/"===e.substr(tb,2)?(i="*/",tb+=2):(i=l,0===tE&&tP(t_)),i!==l?t=n=[n,r,i]:(tb=t,t=l)}else tb=t,t=l;return t}function np(){let t;return t=e.charAt(tb),L.test(t)?tb++:(t=l,0===tE&&tP(e0)),t}r=new Set,i=!1;let nf=(n=h())!==l&&tb===e.length;function nm(){var t,r,i;throw n!==l&&tb<e.length&&tP({type:"end"}),t=tw,r=tM<e.length?function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tb,n=e.codePointAt(t);return void 0===n?"":String.fromCodePoint(n)}(tM):null,i=tM<e.length?tR(tM,tM+1):tR(tM,tM),new o(o.buildMessage(t,r),t,r,i)}return t.peg$library?{peg$result:n,peg$currPos:tb,peg$FAILED:l,peg$maxFailExpected:tw,peg$maxFailPos:tM,peg$success:nf,peg$throw:nf?void 0:nm}:nf?n:void nm()}}},62395,33870,86608,e=>{"use strict";e.s(["getFloat",()=>N,"getInt",()=>D,"getPosition",()=>U,"getProperty",()=>L,"getRotation",()=>F,"getScale",()=>O,"parseMissionScript",()=>I],62395);var t=e.i(90072);e.s(["parse",()=>T,"runServer",()=>A],86608);var n=e.i(92552),r=e.i(99749);function i(e){let t=e.indexOf("::");return -1===t?null:{namespace:e.slice(0,t),method:e.slice(t+2)}}let a={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class s{getAccessInfo(e){if("Variable"===e.type){let t=JSON.stringify(e.name),n="global"===e.scope?this.globals:this.locals;return{getter:"".concat(n,".get(").concat(t,")"),setter:e=>"".concat(n,".set(").concat(t,", ").concat(e,")"),postIncHelper:"".concat(n,".postInc(").concat(t,")"),postDecHelper:"".concat(n,".postDec(").concat(t,")")}}if("MemberExpression"===e.type){let t=this.expression(e.object),n="Identifier"===e.property.type?JSON.stringify(e.property.name):this.expression(e.property);return{getter:"".concat(this.runtime,".prop(").concat(t,", ").concat(n,")"),setter:e=>"".concat(this.runtime,".setProp(").concat(t,", ").concat(n,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".propPostInc(").concat(t,", ").concat(n,")"),postDecHelper:"".concat(this.runtime,".propPostDec(").concat(t,", ").concat(n,")")}}if("IndexExpression"===e.type){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Variable"===e.object.type){let n=JSON.stringify(e.object.name),r="global"===e.object.scope?this.globals:this.locals,i=t.join(", ");return{getter:"".concat(r,".get(").concat(n,", ").concat(i,")"),setter:e=>"".concat(r,".set(").concat(n,", ").concat(i,", ").concat(e,")"),postIncHelper:"".concat(r,".postInc(").concat(n,", ").concat(i,")"),postDecHelper:"".concat(r,".postDec(").concat(n,", ").concat(i,")")}}if("MemberExpression"===e.object.type){let n=e.object,r=this.expression(n.object),i="Identifier"===n.property.type?JSON.stringify(n.property.name):this.expression(n.property),a="".concat(this.runtime,".key(").concat(i,", ").concat(t.join(", "),")");return{getter:"".concat(this.runtime,".prop(").concat(r,", ").concat(a,")"),setter:e=>"".concat(this.runtime,".setProp(").concat(r,", ").concat(a,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".propPostInc(").concat(r,", ").concat(a,")"),postDecHelper:"".concat(this.runtime,".propPostDec(").concat(r,", ").concat(a,")")}}let n=this.expression(e.object),r=1===t.length?t[0]:"".concat(this.runtime,".key(").concat(t.join(", "),")");return{getter:"".concat(this.runtime,".getIndex(").concat(n,", ").concat(r,")"),setter:e=>"".concat(this.runtime,".setIndex(").concat(n,", ").concat(r,", ").concat(e,")"),postIncHelper:"".concat(this.runtime,".indexPostInc(").concat(n,", ").concat(r,")"),postDecHelper:"".concat(this.runtime,".indexPostDec(").concat(n,", ").concat(r,")")}}return null}generate(e){let t=[];for(let n of e.body){let e=this.statement(n);e&&t.push(e)}return t.join("\n\n")}statement(e){switch(e.type){case"Comment":return"";case"ExpressionStatement":return this.line("".concat(this.expression(e.expression),";"));case"FunctionDeclaration":return this.functionDeclaration(e);case"PackageDeclaration":return this.packageDeclaration(e);case"DatablockDeclaration":return this.datablockDeclaration(e);case"ObjectDeclaration":return this.line("".concat(this.objectDeclaration(e),";"));case"IfStatement":return this.ifStatement(e);case"ForStatement":return this.forStatement(e);case"WhileStatement":return this.whileStatement(e);case"DoWhileStatement":return this.doWhileStatement(e);case"SwitchStatement":return this.switchStatement(e);case"ReturnStatement":return this.returnStatement(e);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(e);default:throw Error("Unknown statement type: ".concat(e.type))}}functionDeclaration(e){let t=i(e.name.name);if(t){let n=t.namespace,r=t.method;this.currentClass=n.toLowerCase(),this.currentFunction=r.toLowerCase();let i=this.functionBody(e.body,e.params);return this.currentClass=null,this.currentFunction=null,"".concat(this.line("".concat(this.runtime,".registerMethod(").concat(JSON.stringify(n),", ").concat(JSON.stringify(r),", function() {")),"\n").concat(i,"\n").concat(this.line("});"))}{let t=e.name.name;this.currentFunction=t.toLowerCase();let n=this.functionBody(e.body,e.params);return this.currentFunction=null,"".concat(this.line("".concat(this.runtime,".registerFunction(").concat(JSON.stringify(t),", function() {")),"\n").concat(n,"\n").concat(this.line("});"))}}functionBody(e,t){this.indentLevel++;let n=[];n.push(this.line("const ".concat(this.locals," = ").concat(this.runtime,".locals();")));for(let e=0;e<t.length;e++)n.push(this.line("".concat(this.locals,".set(").concat(JSON.stringify(t[e].name),", arguments[").concat(e,"]);")));for(let t of e.body)n.push(this.statement(t));return this.indentLevel--,n.join("\n")}packageDeclaration(e){let t=JSON.stringify(e.name.name);this.indentLevel++;let n=e.body.map(e=>this.statement(e)).join("\n\n");return this.indentLevel--,"".concat(this.line("".concat(this.runtime,".package(").concat(t,", function() {")),"\n").concat(n,"\n").concat(this.line("});"))}datablockDeclaration(e){let t=JSON.stringify(e.className.name),n=e.instanceName?JSON.stringify(e.instanceName.name):"null",r=e.parent?JSON.stringify(e.parent.name):"null",i=this.objectBody(e.body);return this.line("".concat(this.runtime,".datablock(").concat(t,", ").concat(n,", ").concat(r,", ").concat(i,");"))}objectDeclaration(e){let t="Identifier"===e.className.type?JSON.stringify(e.className.name):this.expression(e.className),n=null===e.instanceName?"null":"Identifier"===e.instanceName.type?JSON.stringify(e.instanceName.name):this.expression(e.instanceName),r=[],i=[];for(let t of e.body)"Assignment"===t.type?r.push(t):i.push(t);let a=this.objectBody(r);if(i.length>0){let e=i.map(e=>this.objectDeclaration(e)).join(",\n");return"".concat(this.runtime,".create(").concat(t,", ").concat(n,", ").concat(a,", [\n").concat(e,"\n])")}return"".concat(this.runtime,".create(").concat(t,", ").concat(n,", ").concat(a,")")}objectBody(e){if(0===e.length)return"{}";let t=[];for(let n of e)if("Assignment"===n.type){let e=this.expression(n.value);if("Identifier"===n.target.type){let r=n.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?t.push("".concat(r,": ").concat(e)):t.push("[".concat(JSON.stringify(r),"]: ").concat(e))}else if("IndexExpression"===n.target.type){let r=this.objectPropertyKey(n.target);t.push("[".concat(r,"]: ").concat(e))}else{let r=this.expression(n.target);t.push("[".concat(r,"]: ").concat(e))}}if(t.length<=1)return"{ ".concat(t.join(", ")," }");let n=this.indent.repeat(this.indentLevel+1),r=this.indent.repeat(this.indentLevel);return"{\n".concat(n).concat(t.join(",\n"+n),"\n").concat(r,"}")}objectPropertyKey(e){let t="Identifier"===e.object.type?JSON.stringify(e.object.name):this.expression(e.object),n=Array.isArray(e.index)?e.index.map(e=>this.expression(e)).join(", "):this.expression(e.index);return"".concat(this.runtime,".key(").concat(t,", ").concat(n,")")}ifStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.consequent);if(e.alternate)if("IfStatement"===e.alternate.type){let r=this.ifStatement(e.alternate).replace(/^\s*/,"");return this.line("if (".concat(t,") ").concat(n," else ").concat(r))}else{let r=this.statementAsBlock(e.alternate);return this.line("if (".concat(t,") ").concat(n," else ").concat(r))}return this.line("if (".concat(t,") ").concat(n))}forStatement(e){let t=e.init?this.expression(e.init):"",n=e.test?this.expression(e.test):"",r=e.update?this.expression(e.update):"",i=this.statementAsBlock(e.body);return this.line("for (".concat(t,"; ").concat(n,"; ").concat(r,") ").concat(i))}whileStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.body);return this.line("while (".concat(t,") ").concat(n))}doWhileStatement(e){let t=this.statementAsBlock(e.body),n=this.expression(e.test);return this.line("do ".concat(t," while (").concat(n,");"))}switchStatement(e){if(e.stringMode)return this.switchStringStatement(e);let t=this.expression(e.discriminant);this.indentLevel++;let n=[];for(let t of e.cases)n.push(this.switchCase(t));return this.indentLevel--,"".concat(this.line("switch (".concat(t,") {")),"\n").concat(n.join("\n"),"\n").concat(this.line("}"))}switchCase(e){let t=[];if(null===e.test)t.push(this.line("default:"));else if(Array.isArray(e.test))for(let n of e.test)t.push(this.line("case ".concat(this.expression(n),":")));else t.push(this.line("case ".concat(this.expression(e.test),":")));for(let n of(this.indentLevel++,e.consequent))t.push(this.statement(n));return t.push(this.line("break;")),this.indentLevel--,t.join("\n")}switchStringStatement(e){let t=this.expression(e.discriminant),n=[];for(let t of e.cases)if(null===t.test)n.push("default: () => { ".concat(this.blockContent(t.consequent)," }"));else if(Array.isArray(t.test))for(let e of t.test)n.push("".concat(this.expression(e),": () => { ").concat(this.blockContent(t.consequent)," }"));else n.push("".concat(this.expression(t.test),": () => { ").concat(this.blockContent(t.consequent)," }"));return this.line("".concat(this.runtime,".switchStr(").concat(t,", { ").concat(n.join(", ")," });"))}returnStatement(e){return e.value?this.line("return ".concat(this.expression(e.value),";")):this.line("return;")}blockStatement(e){this.indentLevel++;let t=e.body.map(e=>this.statement(e)).join("\n");return this.indentLevel--,"{\n".concat(t,"\n").concat(this.line("}"))}statementAsBlock(e){if("BlockStatement"===e.type)return this.blockStatement(e);this.indentLevel++;let t=this.statement(e);return this.indentLevel--,"{\n".concat(t,"\n").concat(this.line("}"))}blockContent(e){return e.map(e=>this.statement(e).trim()).join(" ")}expression(e){switch(e.type){case"Identifier":return this.identifier(e);case"Variable":return this.variable(e);case"NumberLiteral":case"BooleanLiteral":return String(e.value);case"StringLiteral":return JSON.stringify(e.value);case"BinaryExpression":return this.binaryExpression(e);case"UnaryExpression":return this.unaryExpression(e);case"PostfixExpression":return this.postfixExpression(e);case"AssignmentExpression":return this.assignmentExpression(e);case"ConditionalExpression":return"(".concat(this.expression(e.test)," ? ").concat(this.expression(e.consequent)," : ").concat(this.expression(e.alternate),")");case"CallExpression":return this.callExpression(e);case"MemberExpression":return this.memberExpression(e);case"IndexExpression":return this.indexExpression(e);case"TagDereferenceExpression":return"".concat(this.runtime,".deref(").concat(this.expression(e.argument),")");case"ObjectDeclaration":return this.objectDeclaration(e);case"DatablockDeclaration":return"".concat(this.runtime,".datablock(").concat(JSON.stringify(e.className.name),", ").concat(e.instanceName?JSON.stringify(e.instanceName.name):"null",", ").concat(e.parent?JSON.stringify(e.parent.name):"null",", ").concat(this.objectBody(e.body),")");default:throw Error("Unknown expression type: ".concat(e.type))}}identifier(e){let t=i(e.name);return t&&"parent"===t.namespace.toLowerCase()?e.name:t?"".concat(this.runtime,".nsRef(").concat(JSON.stringify(t.namespace),", ").concat(JSON.stringify(t.method),")"):JSON.stringify(e.name)}variable(e){return"global"===e.scope?"".concat(this.globals,".get(").concat(JSON.stringify(e.name),")"):"".concat(this.locals,".get(").concat(JSON.stringify(e.name),")")}binaryExpression(e){let t=this.expression(e.left),n=this.expression(e.right),r=e.operator,i=this.concatExpression(t,r,n);if(i)return i;if("$="===r)return"".concat(this.runtime,".streq(").concat(t,", ").concat(n,")");if("!$="===r)return"!".concat(this.runtime,".streq(").concat(t,", ").concat(n,")");if("&&"===r||"||"===r)return"(".concat(t," ").concat(r," ").concat(n,")");let s=a[r];return s?"".concat(s,"(").concat(t,", ").concat(n,")"):"(".concat(t," ").concat(r," ").concat(n,")")}unaryExpression(e){if("++"===e.operator||"--"===e.operator){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?1:-1;return t.setter("".concat(this.runtime,".add(").concat(t.getter,", ").concat(n,")"))}}let t=this.expression(e.argument);return"~"===e.operator?"".concat(this.runtime,".bitnot(").concat(t,")"):"-"===e.operator?"".concat(this.runtime,".neg(").concat(t,")"):"".concat(e.operator).concat(t)}postfixExpression(e){let t=this.getAccessInfo(e.argument);if(t){let n="++"===e.operator?t.postIncHelper:t.postDecHelper;if(n)return n}return"".concat(this.expression(e.argument)).concat(e.operator)}assignmentExpression(e){let t=this.expression(e.value),n=e.operator,r=this.getAccessInfo(e.target);if(!r)throw Error("Unhandled assignment target type: ".concat(e.target.type));if("="===n)return r.setter(t);{let e=n.slice(0,-1),i=this.compoundAssignmentValue(r.getter,e,t);return r.setter(i)}}callExpression(e){let t=e.arguments.map(e=>this.expression(e)).join(", ");if("Identifier"===e.callee.type){let n=e.callee.name,r=i(n);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return"".concat(this.runtime,".parent(").concat(JSON.stringify(this.currentClass),", ").concat(JSON.stringify(r.method),", arguments[0]").concat(t?", "+t:"",")");else if(this.currentFunction)return"".concat(this.runtime,".parentFunc(").concat(JSON.stringify(this.currentFunction)).concat(t?", "+t:"",")");else throw Error("Parent:: call outside of function context");return r?"".concat(this.runtime,".nsCall(").concat(JSON.stringify(r.namespace),", ").concat(JSON.stringify(r.method)).concat(t?", "+t:"",")"):"".concat(this.functions,".call(").concat(JSON.stringify(n)).concat(t?", "+t:"",")")}if("MemberExpression"===e.callee.type){let n=this.expression(e.callee.object),r="Identifier"===e.callee.property.type?JSON.stringify(e.callee.property.name):this.expression(e.callee.property);return"".concat(this.runtime,".call(").concat(n,", ").concat(r).concat(t?", "+t:"",")")}let n=this.expression(e.callee);return"".concat(n,"(").concat(t,")")}memberExpression(e){let t=this.expression(e.object);return e.computed||"Identifier"!==e.property.type?"".concat(this.runtime,".prop(").concat(t,", ").concat(this.expression(e.property),")"):"".concat(this.runtime,".prop(").concat(t,", ").concat(JSON.stringify(e.property.name),")")}indexExpression(e){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if("Variable"===e.object.type){let n=JSON.stringify(e.object.name),r="global"===e.object.scope?this.globals:this.locals;return"".concat(r,".get(").concat(n,", ").concat(t.join(", "),")")}if("MemberExpression"===e.object.type){let n=e.object,r=this.expression(n.object),i="Identifier"===n.property.type?JSON.stringify(n.property.name):this.expression(n.property),a="".concat(this.runtime,".key(").concat(i,", ").concat(t.join(", "),")");return"".concat(this.runtime,".prop(").concat(r,", ").concat(a,")")}let n=this.expression(e.object);return 1===t.length?"".concat(this.runtime,".getIndex(").concat(n,", ").concat(t[0],")"):"".concat(this.runtime,".getIndex(").concat(n,", ").concat(this.runtime,".key(").concat(t.join(", "),"))")}line(e){return this.indent.repeat(this.indentLevel)+e}concatExpression(e,t,n){switch(t){case"@":return"".concat(this.runtime,".concat(").concat(e,", ").concat(n,")");case"SPC":return"".concat(this.runtime,".concat(").concat(e,', " ", ').concat(n,")");case"TAB":return"".concat(this.runtime,".concat(").concat(e,', "\\t", ').concat(n,")");case"NL":return"".concat(this.runtime,".concat(").concat(e,', "\\n", ').concat(n,")");default:return null}}compoundAssignmentValue(e,t,n){let r=this.concatExpression(e,t,n);if(r)return r;let i=a[t];return i?"".concat(i,"(").concat(e,", ").concat(n,")"):"(".concat(e," ").concat(t," ").concat(n,")")}constructor(e={}){var t,n,i,a,s;(0,r._)(this,"indent",void 0),(0,r._)(this,"runtime",void 0),(0,r._)(this,"functions",void 0),(0,r._)(this,"globals",void 0),(0,r._)(this,"locals",void 0),(0,r._)(this,"indentLevel",0),(0,r._)(this,"currentClass",null),(0,r._)(this,"currentFunction",null),this.indent=null!=(t=e.indent)?t:" ",this.runtime=null!=(n=e.runtime)?n:"$",this.functions=null!=(i=e.functions)?i:"$f",this.globals=null!=(a=e.globals)?a:"$g",this.locals=null!=(s=e.locals)?s:"$l"}}e.s(["createRuntime",()=>E,"createScriptCache",()=>b],33870);var o=e.i(54970);class l{get size(){return this.map.size}get(e){let t=this.keyLookup.get(e.toLowerCase());return void 0!==t?this.map.get(t):void 0}set(e,t){let n=e.toLowerCase(),r=this.keyLookup.get(n);return void 0!==r?this.map.set(r,t):(this.keyLookup.set(n,e),this.map.set(e,t)),this}has(e){return this.keyLookup.has(e.toLowerCase())}delete(e){let t=e.toLowerCase(),n=this.keyLookup.get(t);return void 0!==n&&(this.keyLookup.delete(t),this.map.delete(n))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(e){for(let[t,n]of this.map)e(n,t,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(e){return this.keyLookup.get(e.toLowerCase())}constructor(e){if((0,r._)(this,"map",new Map),(0,r._)(this,"keyLookup",new Map),e)for(let[t,n]of e)this.set(t,n)}}class u{get size(){return this.set.size}add(e){return this.set.add(e.toLowerCase()),this}has(e){return this.set.has(e.toLowerCase())}delete(e){return this.set.delete(e.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}constructor(e){if((0,r._)(this,"set",new Set),e)for(let t of e)this.add(t)}}function c(e){return e.replace(/\\/g,"/").toLowerCase()}function h(e){return String(null!=e?e:"")}function d(e){return Number(e)||0}function p(e){let t=h(e||"0 0 0").split(" ").map(Number);return[t[0]||0,t[1]||0,t[2]||0]}function f(e,t,n){let r=0;for(;t+r<e.length&&!n.includes(e[t+r]);)r++;return r}function m(e,t,n){let r=0;for(;t>0;){if(r>=e.length)return"";let i=f(e,r,n);if(r+i>=e.length)return"";r+=i+1,t--}let i=f(e,r,n);return 0===i?"":e.substring(r,r+i)}function g(e,t,n,r){let i=0,a=t;for(;a>0;){if(i>=e.length)return"";let t=f(e,i,r);if(i+t>=e.length)return"";i+=t+1,a--}let s=i,o=n-t+1;for(;o>0;){let t=f(e,i,r);if((i+=t)>=e.length)break;i++,o--}let l=i;return l>s&&r.includes(e[l-1])&&l--,e.substring(s,l)}function v(e,t){if(""===e)return 0;let n=0;for(let r=0;r<e.length;r++)t.includes(e[r])&&n++;return n+1}function y(e,t,n,r,i){let a=[],s=0,o=0;for(;s<e.length||o<=t;){if(s<e.length){let i=f(e,s,r);o===t?a.push(n):a.push(e.substring(s,s+i)),(s+=i)<e.length&&s++}else o===t?a.push(n):a.push("");if(++o>t&&s>=e.length)break}return a.join(i)}function _(e,t,n,r){let i=[],a=0,s=0;for(;a<e.length;){let r=f(e,a,n);s!==t&&i.push(e.substring(a,a+r)),(a+=r)<e.length&&a++,s++}return i.join(r)}function x(e){let{runtime:t,fileSystem:n}=e,r=[],i=0,a="";return{echo(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];console.log(...t.map(h))},warn(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];console.warn(...t.map(h))},error(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];console.error(...t.map(h))},call(e){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return t().$f.call(h(e),...r)},eval(e){throw Error("eval() not implemented: requires runtime parsing and execution")},collapseescape:e=>h(e).replace(/\\([ntr\\])/g,(e,t)=>"n"===t?"\n":"t"===t?" ":"r"===t?"\r":"\\"),expandescape:e=>h(e).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(e,t,n){console.warn("export(".concat(e,"): not implemented"))},quit(){console.warn("quit(): not implemented in browser")},trace(e){},isobject:e=>t().$.isObject(e),nametoid:e=>t().$.nameToId(e),strlen:e=>h(e).length,strchr(e,t){var n;let r=h(e),i=null!=(n=h(t)[0])?n:"",a=r.indexOf(i);return a>=0?r.substring(a):""},strpos:(e,t,n)=>h(e).indexOf(h(t),d(n)),strcmp(e,t){let n=h(e),r=h(t);return n<r?-1:+(n>r)},stricmp(e,t){let n=h(e).toLowerCase(),r=h(t).toLowerCase();return n<r?-1:+(n>r)},strstr:(e,t)=>h(e).indexOf(h(t)),getsubstr(e,t,n){let r=h(e),i=d(t);return void 0===n?r.substring(i):r.substring(i,i+d(n))},getword:(e,t)=>m(h(e),d(t)," \n"),getwordcount:e=>v(h(e)," \n"),getfield:(e,t)=>m(h(e),d(t)," \n"),getfieldcount:e=>v(h(e)," \n"),setword:(e,t,n)=>y(h(e),d(t),h(n)," \n"," "),setfield:(e,t,n)=>y(h(e),d(t),h(n)," \n"," "),firstword:e=>m(h(e),0," \n"),restwords:e=>g(h(e),1,1e6," \n"),trim:e=>h(e).trim(),ltrim:e=>h(e).replace(/^\s+/,""),rtrim:e=>h(e).replace(/\s+$/,""),strupr:e=>h(e).toUpperCase(),strlwr:e=>h(e).toLowerCase(),strreplace:(e,t,n)=>h(e).split(h(t)).join(h(n)),filterstring:(e,t)=>h(e),stripchars(e,t){let n=h(e),r=new Set(h(t).split(""));return n.split("").filter(e=>!r.has(e)).join("")},getfields(e,t,n){let r=void 0!==n?Number(n):1e6;return g(h(e),d(t),r," \n")},getwords(e,t,n){let r=void 0!==n?Number(n):1e6;return g(h(e),d(t),r," \n")},removeword:(e,t)=>_(h(e),d(t)," \n"," "),removefield:(e,t)=>_(h(e),d(t)," \n"," "),getrecord:(e,t)=>m(h(e),d(t),"\n"),getrecordcount:e=>v(h(e),"\n"),setrecord:(e,t,n)=>y(h(e),d(t),h(n),"\n","\n"),removerecord:(e,t)=>_(h(e),d(t),"\n","\n"),nexttoken(e,t,n){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:e=>h(e).replace(/[^\w\s-]/g,"").trim(),mabs:e=>Math.abs(d(e)),mfloor:e=>Math.floor(d(e)),mceil:e=>Math.ceil(d(e)),msqrt:e=>Math.sqrt(d(e)),mpow:(e,t)=>Math.pow(d(e),d(t)),msin:e=>Math.sin(d(e)),mcos:e=>Math.cos(d(e)),mtan:e=>Math.tan(d(e)),masin:e=>Math.asin(d(e)),macos:e=>Math.acos(d(e)),matan:(e,t)=>Math.atan2(d(e),d(t)),mlog:e=>Math.log(d(e)),getrandom(e,t){if(void 0===e)return Math.random();if(void 0===t)return Math.floor(Math.random()*(d(e)+1));let n=d(e);return Math.floor(Math.random()*(d(t)-n+1))+n},mdegtorad:e=>d(e)*(Math.PI/180),mradtodeg:e=>d(e)*(180/Math.PI),mfloatlength:(e,t)=>d(e).toFixed(d(t)),getboxcenter(e){let t=h(e).split(" ").map(Number),n=t[0]||0,r=t[1]||0,i=t[2]||0,a=t[3]||0,s=t[4]||0,o=t[5]||0;return"".concat((n+a)/2," ").concat((r+s)/2," ").concat((i+o)/2)},vectoradd(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(n+a," ").concat(r+s," ").concat(i+o)},vectorsub(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(n-a," ").concat(r-s," ").concat(i-o)},vectorscale(e,t){let[n,r,i]=p(e),a=d(t);return"".concat(n*a," ").concat(r*a," ").concat(i*a)},vectordot(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return n*a+r*s+i*o},vectorcross(e,t){let[n,r,i]=p(e),[a,s,o]=p(t);return"".concat(r*o-i*s," ").concat(i*a-n*o," ").concat(n*s-r*a)},vectorlen(e){let[t,n,r]=p(e);return Math.sqrt(t*t+n*n+r*r)},vectornormalize(e){let[t,n,r]=p(e),i=Math.sqrt(t*t+n*n+r*r);return 0===i?"0 0 0":"".concat(t/i," ").concat(n/i," ").concat(r/i)},vectordist(e,t){let[n,r,i]=p(e),[a,s,o]=p(t),l=n-a,u=r-s,c=i-o;return Math.sqrt(l*l+u*u+c*c)},matrixcreate(e,t){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(e){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(e,t){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(e,t){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(e,t){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-t().state.startTime,getrealtime:()=>Date.now(),schedule(e,n,r){for(var i=arguments.length,a=Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];let o=Number(e)||0,l=t(),u=setTimeout(()=>{l.state.pendingTimeouts.delete(u);try{l.$f.call(String(r),...a)}catch(e){throw console.error("schedule: error calling ".concat(r,":"),e),e}},o);return l.state.pendingTimeouts.add(u),u},cancel(e){clearTimeout(e),t().state.pendingTimeouts.delete(e)},iseventpending:e=>t().state.pendingTimeouts.has(e),exec(e){let n=String(null!=e?e:"");if(console.debug("exec(".concat(JSON.stringify(n),"): preparing to execute…")),!n.includes("."))return console.error("exec: invalid script file name ".concat(JSON.stringify(n),".")),!1;let r=c(n),i=t(),{executedScripts:a,scripts:s}=i.state;if(a.has(r))return console.debug("exec(".concat(JSON.stringify(n),"): skipping (already executed)")),!0;let o=s.get(r);return null==o?(console.warn("exec(".concat(JSON.stringify(n),"): script not found")),!1):(a.add(r),console.debug("exec(".concat(JSON.stringify(n),"): executing!")),i.executeAST(o),!0)},compile(e){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:e=>n?n.isFile(h(e)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(e){let t=h(e),n=t.lastIndexOf(".");return n>=0?t.substring(n):""},filebase(e){let t=h(e),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),r=t.lastIndexOf("."),i=n>=0?n+1:0,a=r>i?r:t.length;return t.substring(i,a)},filepath(e){let t=h(e),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n>=0?t.substring(0,n):""},expandfilename(e){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile(e){var t;return n?(a=h(e),r=n.findFiles(a),i=0,null!=(t=r[i++])?t:""):(console.warn("findFirstFile(): no fileSystem handler configured"),"")},findnextfile(e){var t;let s=h(e);if(s!==a){if(!n)return"";a=s,r=n.findFiles(s)}return null!=(t=r[i++])?t:""},getfilecrc:e=>h(e),iswriteablefilename:e=>!1,activatepackage(e){t().$.activatePackage(h(e))},deactivatepackage(e){t().$.deactivatePackage(h(e))},ispackage:e=>t().$.isPackage(h(e)),isactivepackage:e=>t().$.isActivePackage(h(e)),getpackagelist:()=>t().$.getPackageList(),addmessagecallback(e,t){},alxcreatesource(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0},alxgetwavelen:e=>0,alxlistenerf(e,t){},alxplay(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0},alxsetchannelvolume(e,t){},alxsourcef(e,t,n){},alxstop(e){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(e){},isjoystickdetected:()=>!1,lockmouse(e){},addmaterialmapping(e,t){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:e=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:e=>!1,isfullscreen:()=>!1,screenshot(e){},setdisplaydevice:e=>!0,setfov(e){},setinteriorrendermode(e){},setopenglanisotropy(e){},setopenglmipreduction(e){},setopenglskymipreduction(e){},setopengltexturecompressionhint(e){},setscreenmode(e,t,n,r){},setverticalsync(e){},setzoomspeed(e){},togglefullscreen(){},videosetgammacorrection(e){},snaptoggle(){},addtaggedstring:e=>0,buildtaggedstring(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return""},detag:e=>h(e),gettag:e=>0,gettaggedstring:e=>"",removetaggedstring(e){},commandtoclient(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i]},commandtoserver(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r]},cancelserverquery(){},querymasterserver(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n]},querysingleserver(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n]},setnetport:e=>!0,allowconnections(e){},startheartbeat(){},stopheartbeat(){},gotowebpage(e){},deletedatablocks(){},preloaddatablock:e=>!0,containerboxempty(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!0},containerraycast(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return""},containersearchcurrdist:()=>0,containersearchnext:()=>0,initcontainerradiussearch(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n]},calcexplosioncoverage(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1},getcontrolobjectaltitude:()=>0,getcontrolobjectspeed:()=>0,getterrainheight:e=>0,lightscene(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n]},pathonmissionloaddone(){}}}function b(){return{scripts:new Map,generatedCode:new WeakMap}}function S(e){return e.toLowerCase()}function M(e){return(0|Number(e))>>>0}function w(e){if(null==e)return null;if("string"==typeof e)return e||null;if("number"==typeof e)return String(e);throw Error("Invalid instance name type: ".concat(typeof e))}function E(){var e,t,n;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=new l,a=new l,h=new l,d=[],p=new u,f=3,m=1027,g=new Map,v=new l,y=new l,_=new l,E=new l,A=new l;if(r.globals)for(let[e,t]of Object.entries(r.globals)){if(!e.startsWith("$"))throw Error('Global variable "'.concat(e,'" must start with $, e.g. "$').concat(e,'"'));_.set(e.slice(1),t)}let C=new Set,R=new Set,P=r.ignoreScripts&&r.ignoreScripts.length>0?(0,o.default)(r.ignoreScripts,{nocase:!0}):null,I=null!=(e=r.cache)?e:b(),L=I.scripts,N=I.generatedCode,D=new Map;function U(e){let t=D.get(e);return t&&t.length>0?t[t.length-1]:void 0}function O(e,t,n){let r;(r=D.get(e))||(r=[],D.set(e,r)),r.push(t);try{return n()}finally{let t=D.get(e);t&&t.pop()}}function F(e,t){return"".concat(e.toLowerCase(),"::").concat(t.toLowerCase())}function k(e,t){var n,r;return null!=(r=null==(n=i.get(e))?void 0:n.get(t))?r:null}let z=new Set,B=null,H=null,V=(null!=(t=r.builtins)?t:x)({runtime:()=>H,fileSystem:null!=(n=r.fileSystem)?n:null});function G(e){let t=h.get(e);if(!t)return void p.add(e);if(!t.active){for(let[e,n]of(t.active=!0,d.push(t.name),t.methods)){i.has(e)||i.set(e,new l);let t=i.get(e);for(let[e,r]of n)t.has(e)||t.set(e,[]),t.get(e).push(r)}for(let[e,n]of t.functions)a.has(e)||a.set(e,[]),a.get(e).push(n)}}function W(e){var t,n;return null==e||""===e?null:"object"==typeof e&&null!=e._id?e:"string"==typeof e?null!=(t=v.get(e))?t:null:"number"==typeof e&&null!=(n=g.get(e))?n:null}function j(e,t,n){let r=W(e);if(null==r)return 0;let i=J(r[t]);return r[t]=i+n,i}function X(e,t){let n=k(e,t);return n&&n.length>0?n[n.length-1]:null}function q(e,t,n,r){let i=k(e,t);return i&&0!==i.length?{found:!0,result:O(F(e,t),i.length-1,()=>i[i.length-1](n,...r))}:{found:!1}}function Y(e,t,n,r){let i=E.get(e);if(i){let e=i.get(t);if(e)for(let t of e)t(n,...r)}}function J(e){if(null==e||""===e)return 0;let t=Number(e);return isNaN(t)?0:t}function Z(e){if(!e||""===e)return null;e.startsWith("/")&&(e=e.slice(1));let t=e.split("/"),n=null;for(let e=0;e<t.length;e++){let a=t[e];if(a){if(0===e){var r,i;n=/^\d+$/.test(a)?null!=(r=g.get(parseInt(a,10)))?r:null:null!=(i=v.get(a))?i:null}else{if(!n||!n._children)return null;let e=a.toLowerCase(),t=n._children.find(t=>{var n;return(null==(n=t._name)?void 0:n.toLowerCase())===e});n=null!=t?t:null}if(!n)return null}}return n}function K(e){return null==e||""===e?null:Z(String(e))}function $(e){function t(e,t){return e+t.join("_")}return{get(n){for(var r,i=arguments.length,a=Array(i>1?i-1:0),s=1;s<i;s++)a[s-1]=arguments[s];return null!=(r=e.get(t(n,a)))?r:""},set(n){for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];if(0===i.length)throw Error("set() requires at least a value argument");if(1===i.length)return e.set(n,i[0]),i[0];let s=i[i.length-1],o=i.slice(0,-1);return e.set(t(n,o),s),s},postInc(n){for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];let s=t(n,i),o=J(e.get(s));return e.set(s,o+1),o},postDec(n){for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];let s=t(n,i),o=J(e.get(s));return e.set(s,o-1),o}}}function Q(){return $(new l)}let ee={registerMethod:function(e,t,n){if(B)B.methods.has(e)||B.methods.set(e,new l),B.methods.get(e).set(t,n);else{i.has(e)||i.set(e,new l);let r=i.get(e);r.has(t)||r.set(t,[]),r.get(t).push(n)}},registerFunction:function(e,t){B?B.functions.set(e,t):(a.has(e)||a.set(e,[]),a.get(e).push(t))},package:function(e,t){let n=h.get(e);n||(n={name:e,active:!1,methods:new l,functions:new l},h.set(e,n));let r=B;B=n,t(),B=r,p.has(e)&&(p.delete(e),G(e))},activatePackage:G,deactivatePackage:function(e){let t=h.get(e);if(!t||!t.active)return;t.active=!1;let n=d.findIndex(t=>t.toLowerCase()===e.toLowerCase());for(let[e,r]of(-1!==n&&d.splice(n,1),t.methods)){let t=i.get(e);if(t)for(let[e,n]of r){let r=t.get(e);if(r){let e=r.indexOf(n);-1!==e&&r.splice(e,1)}}}for(let[e,n]of t.functions){let t=a.get(e);if(t){let e=t.indexOf(n);-1!==e&&t.splice(e,1)}}},create:function(e,t,n,r){let i=S(e),a=m++,s={_class:i,_className:e,_id:a};for(let[e,t]of Object.entries(n))s[S(e)]=t;s.superclass&&(s._superClass=S(String(s.superclass)),s.class&&A.set(S(String(s.class)),s._superClass)),g.set(a,s);let o=w(t);if(o&&(s._name=o,v.set(o,s)),r){for(let e of r)e._parent=s;s._children=r}let l=X(e,"onAdd");return l&&l(s),s},datablock:function(e,t,n,r){let i=S(e),a=f++,s={_class:i,_className:e,_id:a,_isDatablock:!0},o=w(n);if(o){let e=y.get(o);if(e){for(let[t,n]of Object.entries(e))t.startsWith("_")||(s[t]=n);s._parent=e}}for(let[e,t]of Object.entries(r))s[S(e)]=t;g.set(a,s);let l=w(t);return l&&(s._name=l,v.set(l,s),y.set(l,s)),s},deleteObject:function e(t){let n;if(null==t||("number"==typeof t?n=g.get(t):"string"==typeof t?n=v.get(t):"object"==typeof t&&t._id&&(n=t),!n))return!1;let r=X(n._className,"onRemove");if(r&&r(n),g.delete(n._id),n._name&&v.delete(n._name),n._isDatablock&&n._name&&y.delete(n._name),n._parent&&n._parent._children){let e=n._parent._children.indexOf(n);-1!==e&&n._parent._children.splice(e,1)}if(n._children)for(let t of[...n._children])e(t);return!0},prop:function(e,t){var n;let r=W(e);return null==r?"":null!=(n=r[S(t)])?n:""},setProp:function(e,t,n){let r=W(e);return null==r||(r[S(t)]=n),n},getIndex:function(e,t){var n;let r=W(e);return null==r?"":null!=(n=r[String(t)])?n:""},setIndex:function(e,t,n){let r=W(e);return null==r||(r[String(t)]=n),n},propPostInc:function(e,t){return j(e,S(t),1)},propPostDec:function(e,t){return j(e,S(t),-1)},indexPostInc:function(e,t){return j(e,String(t),1)},indexPostDec:function(e,t){return j(e,String(t),-1)},key:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e+n.join("_")},call:function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(null==e||("string"==typeof e||"number"==typeof e)&&null==(e=K(e)))return"";let a=e.class||e._className||e._class;if(a){let n=q(a,t,e,r);if(n.found)return Y(a,t,e,r),n.result}let s=e._superClass||A.get(a);for(;s;){let n=q(s,t,e,r);if(n.found)return Y(s,t,e,r),n.result;s=A.get(s)}let o=e._datablock||e;if(o._parent){let n=o._parent;for(;n;){let i=n._className||n._class;if(i){let n=q(i,t,e,r);if(n.found)return Y(i,t,e,r),n.result}n=n._parent}}return""},nsCall:function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];let a=k(e,t);if(!a||0===a.length)return"";let s=F(e,t),o=a[a.length-1],l=O(s,a.length-1,()=>o(...r)),u=r[0];return u&&"object"==typeof u&&Y(e,t,u,r.slice(1)),l},nsRef:function(e,t){let n=k(e,t);if(!n||0===n.length)return null;let r=F(e,t),i=n[n.length-1];return function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return O(r,n.length-1,()=>i(...t))}},parent:function(e,t,n){for(var r=arguments.length,i=Array(r>3?r-3:0),a=3;a<r;a++)i[a-3]=arguments[a];let s=k(e,t);if(!s)return"";let o=F(e,t),l=U(o);if(void 0===l||l<1)return"";let u=l-1;return O(o,u,()=>s[u](n,...i))},parentFunc:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let i=a.get(e);if(!i)return"";let s=e.toLowerCase(),o=U(s);if(void 0===o||o<1)return"";let l=o-1;return O(s,l,()=>i[l](...n))},add:function(e,t){return J(e)+J(t)},sub:function(e,t){return J(e)-J(t)},mul:function(e,t){return J(e)*J(t)},div:function(e,t){return J(e)/J(t)},neg:function(e){return-J(e)},lt:function(e,t){return J(e)<J(t)},le:function(e,t){return J(e)<=J(t)},gt:function(e,t){return J(e)>J(t)},ge:function(e,t){return J(e)>=J(t)},eq:function(e,t){return J(e)===J(t)},ne:function(e,t){return J(e)!==J(t)},mod:function(e,t){let n=0|Number(t);return 0===n?0:(0|Number(e))%n},bitand:function(e,t){return M(e)&M(t)},bitor:function(e,t){return M(e)|M(t)},bitxor:function(e,t){return M(e)^M(t)},shl:function(e,t){return M(M(e)<<(31&M(t)))},shr:function(e,t){return M(e)>>>(31&M(t))},bitnot:function(e){return~M(e)>>>0},concat:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.map(e=>String(null!=e?e:"")).join("")},streq:function(e,t){return String(null!=e?e:"").toLowerCase()===String(null!=t?t:"").toLowerCase()},switchStr:function(e,t){let n=String(null!=e?e:"").toLowerCase();for(let[e,r]of Object.entries(t))if("default"!==e&&S(e)===n)return void r();t.default&&t.default()},deref:K,nameToId:function(e){let t=Z(e);return t?t._id:-1},isObject:function(e){return null!=e&&("object"==typeof e&&!!e._id||("number"==typeof e?g.has(e):"string"==typeof e&&v.has(e)))},isFunction:function(e){return a.has(e)||e.toLowerCase()in V},isPackage:function(e){return h.has(e)},isActivePackage:function(e){var t;let n=h.get(e);return null!=(t=null==n?void 0:n.active)&&t},getPackageList:function(){return d.join(" ")},locals:Q,onMethodCalled(e,t,n){let r=E.get(e);r||(r=new l,E.set(e,r));let i=r.get(t);i||(i=[],r.set(t,i)),i.push(n)}},et={call(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let i=a.get(e);if(i&&i.length>0)return O(e.toLowerCase(),i.length-1,()=>i[i.length-1](...n));let s=V[e.toLowerCase()];return s?s(...n):(console.warn("Unknown function: ".concat(e,"(").concat(n.map(e=>JSON.stringify(e)).join(", "),")")),"")}},en=$(_),er={methods:i,functions:a,packages:h,activePackages:d,objectsById:g,objectsByName:v,datablocks:y,globals:_,executedScripts:C,failedScripts:R,scripts:L,generatedCode:N,pendingTimeouts:z,startTime:Date.now()};function ei(e){let t=function(e){let t=N.get(e);null==t&&(t=new s(void 0).generate(e),N.set(e,t));return t}(e),n=Q();Function("$","$f","$g","$l",t)(ee,et,en,n)}function ea(e,t){return{execute(){if(t){let e=c(t);er.executedScripts.add(e)}ei(e)}}}async function es(e,t,n){let i=r.loadScript;if(!i){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function a(e){var a;null==(a=r.signal)||a.throwIfAborted();let s=c(e);if(er.scripts.has(s)||er.failedScripts.has(s))return;if(P&&P(s)){console.warn("Ignoring script: ".concat(e)),er.failedScripts.add(s);return}if(n.has(s))return;let o=t.get(s);if(o)return void await o;let l=(async()=>{let r,a=await i(e);if(null==a){console.warn("Script not found: ".concat(e)),er.failedScripts.add(s);return}try{r=T(a,{filename:e})}catch(t){console.warn("Failed to parse script: ".concat(e),t),er.failedScripts.add(s);return}let o=new Set(n);o.add(s),await es(r.execScriptPaths,t,o),er.scripts.set(s,r)})();t.set(s,l),await l}await Promise.all(e.map(a))}async function eo(e){let t=r.loadScript;if(!t)throw Error("loadFromPath requires loadScript option to be set");let n=c(e);if(er.scripts.has(n))return ea(er.scripts.get(n),e);let i=await t(e);if(null==i)throw Error("Script not found: ".concat(e));return el(i,{path:e})}async function el(e,t){if(null==t?void 0:t.path){let e=c(t.path);if(er.scripts.has(e))return ea(er.scripts.get(e),t.path)}return eu(T(e,{filename:null==t?void 0:t.path}),t)}async function eu(e,t){var n;let i=new Map,a=new Set;if(null==t?void 0:t.path){let n=c(t.path);er.scripts.set(n,e),a.add(n)}let s=[...e.execScriptPaths,...null!=(n=r.preloadScripts)?n:[]];return await es(s,i,a),ea(e,null==t?void 0:t.path)}return H={$:ee,$f:et,$g:en,state:er,destroy:function(){for(let e of er.pendingTimeouts)clearTimeout(e);er.pendingTimeouts.clear()},executeAST:ei,loadFromPath:eo,loadFromSource:el,loadFromAST:eu,call:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return et.call(e,...n)},getObjectByName:e=>v.get(e)}}function T(e,t){try{return n.default.parse(e)}catch(e){if((null==t?void 0:t.filename)&&e.location)throw Error("".concat(t.filename,":").concat(e.location.start.line,":").concat(e.location.start.column,": ").concat(e.message),{cause:e});throw e}}function A(e){let{missionName:t,missionType:n,runtimeOptions:r,onMissionLoadDone:i}=e,{signal:a,fileSystem:s}=null!=r?r:{},o=E({...r,globals:{...null==r?void 0:r.globals,"$Host::Map":t,"$Host::MissionType":n}}),l="".concat(n,"Game"),u="scripts/".concat(l,".cs"),c=async function(){try{let e=await o.loadFromPath("scripts/server.cs");null==a||a.throwIfAborted(),await o.loadFromPath("scripts/DefaultGame.cs"),null==a||a.throwIfAborted();try{await o.loadFromPath(u)}catch(e){}null==a||a.throwIfAborted(),await o.loadFromPath("missions/".concat(t,".mis")),null==a||a.throwIfAborted(),e.execute(),i&&o.$.onMethodCalled("DefaultGame","missionLoadDone",i);let n=await o.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");null==a||a.throwIfAborted(),n.execute()}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;throw e}}();return{runtime:o,ready:c}}let C=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,R=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,P=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i;function I(e){var t,n,r,i,a,s;let o=T(e),{pragma:l,sections:u}=function(e){let t={},n=[],r={name:null,comments:[]};for(let i of e.body)if("Comment"===i.type){let e=function(e){let t;return(t=e.match(R))?{type:"sectionBegin",name:t[1]}:(t=e.match(P))?{type:"sectionEnd",name:t[1]}:(t=e.match(C))?{type:"definition",identifier:t[1],value:t[2]}:null}(i.value);if(e)switch(e.type){case"definition":null===r.name?t[e.identifier.toLowerCase()]=e.value:r.comments.push(i.value);break;case"sectionBegin":(null!==r.name||r.comments.length>0)&&n.push(r),r={name:e.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==r.name&&n.push(r),r={name:null,comments:[]}}else r.comments.push(i.value)}return(null!==r.name||r.comments.length>0)&&n.push(r),{pragma:t,sections:n}}(o);function c(e){var t,n;return null!=(n=null==(t=u.find(t=>t.name===e))?void 0:t.comments.map(e=>e.trimStart()).join("\n"))?n:null}return{displayName:null!=(n=l.displayname)?n:null,missionTypes:null!=(r=null==(t=l.missiontypes)?void 0:t.split(/\s+/).filter(Boolean))?r:[],missionBriefing:c("MISSION BRIEFING"),briefingWav:null!=(i=l.briefingwav)?i:null,bitmap:null!=(a=l.bitmap)?a:null,planetName:null!=(s=l.planetname)?s:null,missionBlurb:c("MISSION BLURB"),missionQuote:c("MISSION QUOTE"),missionString:c("MISSION STRING"),execScriptPaths:o.execScriptPaths,hasDynamicExec:o.hasDynamicExec,ast:o}}function L(e,t){if(e)return e[t.toLowerCase()]}function N(e,t){let n=e[t.toLowerCase()];return null==n?n:parseFloat(n)}function D(e,t){let n=e[t.toLowerCase()];return null==n?n:parseInt(n,10)}function U(e){var t;let[n,r,i]=(null!=(t=e.position)?t:"0 0 0").split(" ").map(e=>parseFloat(e));return[r||0,i||0,n||0]}function O(e){var t;let[n,r,i]=(null!=(t=e.scale)?t:"1 1 1").split(" ").map(e=>parseFloat(e));return[r||0,i||0,n||0]}function F(e){var n;let[r,i,a,s]=(null!=(n=e.rotation)?n:"1 0 0 0").split(" ").map(e=>parseFloat(e)),o=new t.Vector3(i,a,r).normalize(),l=-(Math.PI/180*s);return new t.Quaternion().setFromAxisAngle(o,l)}},12979,e=>{"use strict";e.s(["BASE_URL",()=>a,"FALLBACK_TEXTURE_URL",()=>o,"audioToUrl",()=>f,"getUrlForPath",()=>l,"iflTextureToUrl",()=>d,"interiorToUrl",()=>u,"loadDetailMapList",()=>m,"loadImageFrameList",()=>y,"loadMission",()=>g,"loadTerrain",()=>v,"shapeToUrl",()=>c,"terrainTextureToUrl",()=>h,"textureToUrl",()=>p],12979);var t=e.i(98223),n=e.i(91996),r=e.i(62395),i=e.i(71726);let a="/t2-mapper",s="".concat(a,"/base/"),o="".concat(a,"/magenta.png");function l(e,t){let r;try{r=(0,n.getActualResourceKey)(e)}catch(n){if(t)return console.warn('Resource "'.concat(e,'" not found - rendering fallback.')),t;throw n}let[i,a]=(0,n.getSourceAndPath)(r);return i?"".concat(s,"@vl2/").concat(i,"/").concat(a):"".concat(s).concat(a)}function u(e){return l("interiors/".concat(e)).replace(/\.dif$/i,".glb")}function c(e){return l("shapes/".concat(e)).replace(/\.dts$/i,".glb")}function h(e){return e=e.replace(/^terrain\./,""),l((0,n.getStandardTextureResourceKey)("textures/terrain/".concat(e)),o)}function d(e,t){let r=(0,i.normalizePath)(t).split("/"),a=r.length>1?r.slice(0,-1).join("/")+"/":"",s="".concat(a).concat(e);return l((0,n.getStandardTextureResourceKey)(s),o)}function p(e){return l((0,n.getStandardTextureResourceKey)("textures/".concat(e)),o)}function f(e){return l("audio/".concat(e))}async function m(e){let t=l("textures/".concat(e)),n=await fetch(t);return(await n.text()).split(/(?:\r\n|\r|\n)/).map(e=>{if(!(e=e.trim()).startsWith(";"))return e}).filter(Boolean)}async function g(e){let t=(0,n.getMissionInfo)(e),i=await fetch(l(t.resourcePath)),a=await i.text();return(0,r.parseMissionScript)(a)}async function v(e){let t=await fetch(l("terrains/".concat(e)));return function(e){let t=new DataView(e),n=0,r=t.getUint8(n++),i=new Uint16Array(65536),a=[],s=e=>{let r="";for(let i=0;i<e;i++){let e=t.getUint8(n+i);if(0===e)break;r+=String.fromCharCode(e)}return n+=e,r};for(let e=0;e<65536;e++){let r=t.getUint16(n,!0);n+=2,i[e]=r}n+=65536;for(let e=0;e<8;e++){let r=t.getUint8(n++),i=s(r);e<6&&r>0&&a.push(i)}let o=[];for(let e of a){let e=new Uint8Array(65536);for(let r=0;r<65536;r++){var l=t.getUint8(n++);e[r]=l}o.push(e)}return{version:r,textureNames:a,heightMap:i,alphaMaps:o}}(await t.arrayBuffer())}async function y(e){let n=l(e),r=await fetch(n),i=await r.text();return(0,t.parseImageFileList)(i)}}]);