"Sleeping" "artificial intelligence". Spoiler: Will not wake up. Seems to generate art. Finished work. https://victorgiers.com/iris
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

v3d.js 1.0MB

1
  1. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.v3d=e.v3d||{})}(this,function(e){"use strict";function t(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:0<e?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}),void 0===Object.values&&(Object.values=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}),Object.assign(t.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}});var n,r,i,a,o,s,l,c,u,h,_e="2.12.5",H=0,Y=1,q=2,k=1,V=2,N=0,be=1,Q=2,d=0,x=2,Z=0,K=1,J=2,$=3,ee=4,te=5,ne=100,p=101,f=102,m=103,v=104,g=200,y=201,_=202,b=203,w=204,A=205,M=206,T=207,S=208,L=209,C=210,re=0,ie=1,ae=2,oe=3,se=4,le=5,ce=6,ue=7,j=0,W=1,X=2,he=0,we=1,de=2,pe=3,fe=4,me=5,ve=301,ge=302,ye=303,xe=304,Ae=305,Me=306,Te=307,E=1e3,I=1001,P=1002,D=1003,O=1004,U=1005,B=1006,R=1007,F=1008,Ue=1009,z=1010,G=1011,Se=1012,Le=1013,Ce=1014,Be=1015,Ee=1016,Pe=1017,Re=1018,Fe=1019,Ie=1020,Oe=1021,ze=1022,Ge=1023,Ne=1024,De=1025,ke=Ge,Ve=1026,je=1027,We=1028,Xe=33776,He=33777,Ye=33778,qe=33779,Qe=35840,Ze=35841,Ke=35842,Je=35843,$e=36196,et=37808,tt=37809,nt=37810,rt=37811,it=37812,at=37813,ot=37814,st=37815,lt=37816,ct=37817,ut=37818,ht=37819,dt=37820,pt=37821,ft=2300,mt=2301,vt=2302,gt=2400,yt=2401,xt=2402,_t=0,bt=3e3,wt=3001,At=3007,Mt=3002,Tt=3004,St=3005,Lt=3006,Ct=3200,Et=3201,Pt=0,Rt=1,Ft="__V3DL__0000000000",It=6,Ot=0,Nt={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var i=[],e=0;e<256;e++)i[e]=(e<16?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(i[255&e]+i[e>>8&255]+i[e>>16&255]+i[e>>24&255]+"-"+i[255&t]+i[t>>8&255]+"-"+i[t>>16&15|64]+i[t>>24&255]+"-"+i[63&n|128]+i[n>>8&255]+"-"+i[n>>16&255]+i[n>>24&255]+i[255&r]+i[r>>8&255]+i[r>>16&255]+i[r>>24&255]).toUpperCase()}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:n<=e?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())},degToRad:function(e){return e*Nt.DEG2RAD},radToDeg:function(e){return e*Nt.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&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))},hashString:function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},expAverage:function(e,t,n,r){var i=Math.exp(-n/r);return e*i+(1-i)*t},angleToRange_0_2Pi:function(e){return this.clamp(e-2*Math.PI*Math.floor(e/(2*Math.PI)),0,2*Math.PI)},clampAngle:function(e,t,n){var r=this.angleToRange_0_2Pi(e-t),i=this.angleToRange_0_2Pi(n-t);return i<r&&(r=r<i/2+Math.PI?i:0),r+t}};function Dt(e,t){this.x=e||0,this.y=t||0}function Ut(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1}function Bt(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function zt(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("v3d.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(Dt.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Dt.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector2: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector2: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:(n=new Dt,r=new Dt,function(e,t){return n.set(e,e),r.set(t,t),this.clamp(n,r)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}}),Object.assign(Ut,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],l=n[r+1],c=n[r+2],u=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(u!==f||s!==h||l!==d||c!==p){var m=1-o,v=s*h+l*d+c*p+u*f,g=0<=v?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*m+h*b,l=l*m+d*b,c=c*m+p*b,u=u*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=w,l*=w,c*=w,u*=w}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}}),Object.defineProperties(Ut.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(Ut.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("v3d.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(r/2),u=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);return"XYZ"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"YXZ"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"ZXY"===a?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"ZYX"===a?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"YZX"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p):"XZY"===a&&(this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],u=n[6],h=n[10],d=r+s+h;return this._z=0<d?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(u-l)*t,this._y=(a-c)*t,(o-i)*t):s<r&&h<r?(t=2*Math.sqrt(1+r-s-h),this._w=(u-l)/t,this._x=.25*t,this._y=(i+o)/t,(a+c)/t):h<s?(t=2*Math.sqrt(1+s-r-h),this._w=(a-c)/t,this._x=(i+o)/t,this._y=.25*t,(l+u)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(o-i)/t,this._x=(a+c)/t,this._y=(l+u)/t,.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return this._w=(n<1e-6?(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),n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Nt.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return this._w=0===e?(this._x=0,this._y=0,this._z=0,1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("v3d.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions(a, b) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+r*l-i*s,this._y=r*c+a*s+i*o-n*l,this._z=i*c+a*l+n*s-r*o,this._w=a*c-n*o-r*s-i*l,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),1<=o)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*r+t*this._y,this._z=l*i+t*this._z,this.normalize()}var c=Math.sqrt(s),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Bt.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors(a, b) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(c=new Ut,function(e){return e&&e.isEuler||console.error("v3d.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(c.setFromEuler(e))}),applyAxisAngle:(l=new Ut,function(e,t){return this.applyQuaternion(l.setFromAxisAngle(e,t))}),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*r-o*n,c=s*n+o*t-i*r,u=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=l*s+h*-i+c*-o-u*-a,this.y=c*s+h*-a+u*-i-l*-o,this.z=u*s+h*-o+l*-a-c*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:(o=new Bt,s=new Bt,function(e,t){return o.set(e,e,e),s.set(t,t,t),this.clamp(o,s)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .cross() now only accepts one argument. Use .crossVectors(a, b) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:(a=new Bt,function(e){return a.copy(this).projectOnVector(e),this.sub(a)}),reflect:(i=new Bt,function(e){return this.sub(i.copy(e).multiplyScalar(2*this.dot(e)))}),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(Nt.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(zt.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=r,c[2]=o,c[3]=t,c[4]=i,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:(u=new Bt,function(e){for(var t=0,n=e.count;t<n;t++)u.x=e.getX(t),u.y=e.getY(t),u.z=e.getZ(t),u.applyMatrix3(this),e.setXYZ(t,u.x,u.y,u.z);return e}),multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*f+o*g+s*_,i[3]=a*m+o*y+s*b,i[6]=a*v+o*x+s*w,i[1]=l*f+c*g+u*_,i[4]=l*m+c*y+u*b,i[7]=l*v+c*x+u*w,i[2]=h*f+d*g+p*_,i[5]=h*m+d*y+p*b,i[8]=h*v+d*x+p*w,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*i*c+n*o*s+r*i*l-r*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("v3d.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],p=d*l-c*h,f=c*u-d*s,m=h*s-l*u,v=i*p+a*f+o*m;if(0===v){if(!0===t)throw new Error("v3d.Matrix3: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var g=1/v;return r[0]=p*g,r[1]=(o*h-d*a)*g,r[2]=(c*a-o*l)*g,r[3]=f*g,r[4]=(d*i-o*u)*g,r[5]=(o*s-c*i)*g,r[6]=m*g,r[7]=(a*u-h*i)*g,r[8]=(l*i-a*s)*g,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),l=Math.sin(i);this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-r*l,r*s,-r*(-l*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],l=r[4],c=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*l,r[6]=t*o+n*c,r[1]=-n*i+t*s,r[4]=-n*a+t*l,r[7]=-n*o+t*c,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var 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}});var Gt,kt,Vt,jt,Wt,Xt,Ht,Yt,qt,Qt,Zt,Kt,Jt,$t,en,tn,nn,rn,an,on,sn,ln,cn,un,hn,dn={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===h&&(h=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),h.width=e.width,h.height=e.height;var n=h.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=h}return 2048<t.width||2048<t.height?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},pn=0;function fn(e,t,n,r,i,a,o,s,l,c){Object.defineProperty(this,"id",{value:pn++}),this.uuid=Nt.generateUUID(),this.name="",this.image=void 0!==e?e:fn.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:fn.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:I,this.wrapT=void 0!==r?r:I,this.magFilter=void 0!==i?i:B,this.minFilter=void 0!==a?a:F,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:Ge,this.type=void 0!==s?s:Ue,this.offset=new Dt(0,0),this.repeat=new Dt(1,1),this.center=new Dt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:bt,this.version=0,this.onUpdate=null}function mn(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1}function vn(e,t,n){this.width=e,this.height=t,this.scissor=new mn(0,0,e,t),this.scissorTest=!1,this.viewport=new mn(0,0,e,t),n=n||{},this.texture=new fn(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:B,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function gn(e,t,n){vn.call(this,e,t,n),this.samples=4}function yn(e,t,n){vn.call(this,e,t,n)}function xn(e,t,n,r,i,a,o,s,l,c,u,h){fn.call(this,null,a,o,s,l,c,r,i,u,h),this.image={data:e,width:t,height:n},this.magFilter=void 0!==l?l:D,this.minFilter=void 0!==c?c:D,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function _n(e,t){this.min=void 0!==e?e:new Bt(1/0,1/0,1/0),this.max=void 0!==t?t:new Bt(-1/0,-1/0,-1/0)}function bn(e,t){this.center=void 0!==e?e:new Bt,this.radius=void 0!==t?t:0}function wn(e,t){this.normal=void 0!==e?e:new Bt(1,0,0),this.constant=void 0!==t?t:0}function An(e,t,n,r,i,a){this.planes=[void 0!==e?e:new wn,void 0!==t?t:new wn,void 0!==n?n:new wn,void 0!==r?r:new wn,void 0!==i?i:new wn,void 0!==a?a:new wn]}function Mn(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("v3d.Matrix4: the constructor no longer reads arguments. use .set() instead.")}fn.DEFAULT_IMAGE=void 0,fn.DEFAULT_MAPPING=300,fn.prototype=Object.assign(Object.create(t.prototype),{constructor:fn,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=Nt.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(dn.getDataURL(r[a]))}else i=dn.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||1<e.x)switch(this.wrapS){case E:e.x=e.x-Math.floor(e.x);break;case I:e.x=e.x<0?0:1;break;case P: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||1<e.y)switch(this.wrapT){case E:e.y=e.y-Math.floor(e.y);break;case I:e.y=e.y<0?0:1;break;case P: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}}),Object.defineProperty(fn.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(mn.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector4: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector4: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return this.z=t<1e-4?(this.x=1,this.y=0):(this.x=e.x/t,this.y=e.y/t,e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=e.elements,o=a[0],s=a[4],l=a[8],c=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(l-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+c)/4,x=(l+d)/4,_=(h+p)/4;return v<m&&g<m?i=m<.01?(n=0,r=.707106781):(r=y/(n=Math.sqrt(m)),x/n):g<v?i=v<.01?(r=0,n=.707106781):(n=y/(r=Math.sqrt(v)),_/r):g<.01?(r=n=.707106781,i=0):(n=x/(i=Math.sqrt(g)),r=_/i),this.set(n,r,i,t),this}var b=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(c-s)*(c-s));return Math.abs(b)<.001&&(b=1),this.x=(p-h)/b,this.y=(l-d)/b,this.z=(c-s)/b,this.w=Math.acos((o+u+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return void 0===Gt&&(Gt=new mn,kt=new mn),Gt.set(e,e,e,e),kt.set(t,t,t,t),this.clamp(Gt,kt)},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),vn.prototype=Object.assign(Object.create(t.prototype),{constructor:vn,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),gn.prototype=Object.assign(Object.create(vn.prototype),{constructor:gn,isWebGLMultisampleRenderTarget:!0,copy:function(e){return vn.prototype.copy.call(this,e),this.samples=e.samples,this}}),((yn.prototype=Object.create(vn.prototype)).constructor=yn).prototype.isWebGLRenderTargetCube=!0,((xn.prototype=Object.create(fn.prototype)).constructor=xn).prototype.isDataTexture=!0,Object.assign(_n.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],u=e[s+1],h=e[s+2];c<t&&(t=c),u<n&&(n=u),h<r&&(r=h),i<c&&(i=c),a<u&&(a=u),o<h&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),u=e.getY(s),h=e.getZ(s);c<t&&(t=c),u<n&&(n=u),h<r&&(r=h),i<c&&(i=c),a<u&&(a=u),o<h&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(Ht=new Bt,function(e,t){var n=Ht.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}),setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("v3d.Box3: .getCenter() target is now required"),e=new Bt),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("v3d.Box3: .getSize() target is now required"),e=new Bt),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(){var i,a,o,s=new Bt;function t(e){var t=e.geometry;if(void 0!==t)if(t.isGeometry){var n=t.vertices;for(a=0,o=n.length;a<o;a++)s.copy(n[a]),s.applyMatrix4(e.matrixWorld),i.expandByPoint(s)}else if(t.isBufferGeometry){var r=t.attributes.position;if(void 0!==r)for(a=0,o=r.count;a<o;a++)s.fromBufferAttribute(r,a).applyMatrix4(e.matrixWorld),i.expandByPoint(s)}}return function(e){return i=this,e.updateMatrixWorld(!0),e.traverse(t),this}}(),containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("v3d.Box3: .getParameter() target is now required"),t=new Bt),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:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:(Xt=new Bt,function(e){return this.clampPoint(e.center,Xt),Xt.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,n;return n=0<e.normal.x?(t=e.normal.x*this.min.x,e.normal.x*this.max.x):(t=e.normal.x*this.max.x,e.normal.x*this.min.x),0<e.normal.y?(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),0<e.normal.z?(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:function(){var s=new Bt,l=new Bt,c=new Bt,n=new Bt,r=new Bt,i=new Bt,u=new Bt,a=new Bt,h=new Bt,o=new Bt;function d(e){var t,n;for(t=0,n=e.length-3;t<=n;t+=3){u.fromArray(e,t);var r=h.x*Math.abs(u.x)+h.y*Math.abs(u.y)+h.z*Math.abs(u.z),i=s.dot(u),a=l.dot(u),o=c.dot(u);if(Math.max(-Math.max(i,a,o),Math.min(i,a,o))>r)return!1}return!0}return function(e){if(this.isEmpty())return!1;this.getCenter(a),h.subVectors(this.max,a),s.subVectors(e.a,a),l.subVectors(e.b,a),c.subVectors(e.c,a),n.subVectors(l,s),r.subVectors(c,l),i.subVectors(s,c);var t=[0,-n.z,n.y,0,-r.z,r.y,0,-i.z,i.y,n.z,0,-n.x,r.z,0,-r.x,i.z,0,-i.x,-n.y,n.x,0,-r.y,r.x,0,-i.y,i.x,0];return!!d(t)&&(!!d(t=[1,0,0,0,1,0,0,0,1])&&(o.crossVectors(n,r),d(t=[o.x,o.y,o.z])))}}(),clampPoint:function(e,t){return void 0===t&&(console.warn("v3d.Box3: .clampPoint() target is now required"),t=new Bt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:(Wt=new Bt,function(e){return Wt.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(jt=new Bt,function(e){return void 0===e&&console.error("v3d.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(jt).length(),e}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(Vt=[new Bt,new Bt,new Bt,new Bt,new Bt,new Bt,new Bt,new Bt],function(e){return this.isEmpty()||(Vt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vt)),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(bn.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(Yt=new _n,function(e,t){var n=this.center;void 0!==t?n.copy(t):Yt.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("v3d.Sphere: .clampPoint() target is now required"),t=new Bt),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("v3d.Sphere: .getBoundingBox() target is now required"),e=new _n),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(wn.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:(Kt=new Bt,Jt=new Bt,function(e,t,n){var r=Kt.subVectors(n,t).cross(Jt.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("v3d.Plane: .projectPoint() target is now required"),t=new Bt),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:(Zt=new Bt,function(e,t){void 0===t&&(console.warn("v3d.Plane: .intersectLine() target is now required"),t=new Bt);var n=e.delta(Zt),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||1<i?void 0:t.copy(n).multiplyScalar(i).add(e.start)}),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&0<n||n<0&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("v3d.Plane: .coplanarPoint() target is now required"),e=new Bt),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(qt=new Bt,Qt=new zt,function(e,t){var n=t||Qt.getNormalMatrix(e),r=this.coplanarPoint(qt).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(An.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,u-s,f-h,y-m).normalize(),t[1].setComponents(o+r,u+s,f+h,y+m).normalize(),t[2].setComponents(o+i,u+l,f+d,y+v).normalize(),t[3].setComponents(o-i,u-l,f-d,y-v).normalize(),t[4].setComponents(o-a,u-c,f-p,y-g).normalize(),t[5].setComponents(o+a,u+c,f+p,y+g).normalize(),this},intersectsObject:(tn=new bn,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),tn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(tn)}),intersectsSprite:(en=new bn,function(e){return en.center.set(0,0,0),en.radius=.7071067811865476,en.applyMatrix4(e.matrixWorld),this.intersectsSphere(en)}),intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)<r)return!1}return!0},intersectsBox:($t=new Bt,function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if($t.x=0<r.normal.x?e.max.x:e.min.x,$t.y=0<r.normal.y?e.max.y:e.min.y,$t.z=0<r.normal.z?e.max.z:e.min.z,r.distanceToPoint($t)<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}),Object.assign(Mn.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,l,c,u,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Mn).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:(hn=new Bt,function(e){var t=this.elements,n=e.elements,r=1/hn.setFromMatrixColumn(e,0).length(),i=1/hn.setFromMatrixColumn(e,1).length(),a=1/hn.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:function(e){e&&e.isEuler||console.error("v3d.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){var h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=-s*u,t[8]=l,t[1]=d+p*l,t[5]=h-f*l,t[9]=-o*s,t[2]=f-h*l,t[6]=p+d*l,t[10]=a*s}else if("YXZ"===e.order){var m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*l,t[1]=a*u,t[5]=a*c,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m-y*o,t[4]=-a*u,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*c,t[9]=y-m*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=p*l-d,t[8]=h*l+f,t[1]=s*u,t[5]=f*l+h,t[9]=d*l-p,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,_=a*l,b=o*s,w=o*l;t[0]=s*c,t[4]=w-x*u,t[8]=b*u+_,t[1]=u,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=_*u+b,t[10]=x-w*u}else if("XZY"===e.order){x=a*s,_=a*l,b=o*s,w=o*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=x*u+w,t[5]=a*c,t[9]=_*u-b,t[2]=b*u-_,t[6]=o*c,t[10]=w*u+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:(cn=new Bt(0,0,0),un=new Bt(1,1,1),function(e){return this.compose(cn,e,un)}),lookAt:(on=new Bt,sn=new Bt,ln=new Bt,function(e,t,n){var r=this.elements;return ln.subVectors(e,t),0===ln.lengthSq()&&(ln.z=1),ln.normalize(),on.crossVectors(n,ln),0===on.lengthSq()&&(1===Math.abs(n.z)?ln.x+=1e-4:ln.z+=1e-4,ln.normalize(),on.crossVectors(n,ln)),on.normalize(),sn.crossVectors(ln,on),r[0]=on.x,r[4]=sn.x,r[8]=ln.x,r[1]=on.y,r[5]=sn.y,r[9]=ln.y,r[2]=on.z,r[6]=sn.z,r[10]=ln.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("v3d.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices(a, b) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],_=n[15],b=r[0],w=r[4],A=r[8],M=r[12],T=r[1],S=r[5],L=r[9],C=r[13],E=r[2],P=r[6],R=r[10],F=r[14],I=r[3],O=r[7],N=r[11],D=r[15];return i[0]=a*b+o*T+s*E+l*I,i[4]=a*w+o*S+s*P+l*O,i[8]=a*A+o*L+s*R+l*N,i[12]=a*M+o*C+s*F+l*D,i[1]=c*b+u*T+h*E+d*I,i[5]=c*w+u*S+h*P+d*O,i[9]=c*A+u*L+h*R+d*N,i[13]=c*M+u*C+h*F+d*D,i[2]=p*b+f*T+m*E+v*I,i[6]=p*w+f*S+m*P+v*O,i[10]=p*A+f*L+m*R+v*N,i[14]=p*M+f*C+m*F+v*D,i[3]=g*b+y*T+x*E+_*I,i[7]=g*w+y*S+x*P+_*O,i[11]=g*A+y*L+x*R+_*N,i[15]=g*M+y*C+x*F+_*D,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:(an=new Bt,function(e){for(var t=0,n=e.count;t<n;t++)an.x=e.getX(t),an.y=e.getY(t),an.z=e.getZ(t),an.applyMatrix4(this),e.setXYZ(t,an.x,an.y,an.z);return e}),determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+i*s*u-r*l*u-i*o*h+n*l*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+i*a*h-r*a*d+r*l*c-i*s*c)+e[11]*(+t*l*u-t*o*d-i*a*u+n*a*d+i*o*c-n*l*c)+e[15]*(-r*o*c-t*s*u+t*o*h+r*a*u-n*a*h+n*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],h=r[7],d=r[8],p=r[9],f=r[10],m=r[11],v=r[12],g=r[13],y=r[14],x=r[15],_=p*y*h-g*f*h+g*u*m-c*y*m-p*u*x+c*f*x,b=v*f*h-d*y*h-v*u*m+l*y*m+d*u*x-l*f*x,w=d*g*h-v*p*h+v*c*m-l*g*m-d*c*x+l*p*x,A=v*p*u-d*g*u-v*c*f+l*g*f+d*c*y-l*p*y,M=i*_+a*b+o*w+s*A;if(0===M){if(!0===t)throw new Error("v3d.Matrix4: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var T=1/M;return n[0]=_*T,n[1]=(g*f*s-p*y*s-g*o*m+a*y*m+p*o*x-a*f*x)*T,n[2]=(c*y*s-g*u*s+g*o*h-a*y*h-c*o*x+a*u*x)*T,n[3]=(p*u*s-c*f*s-p*o*h+a*f*h+c*o*m-a*u*m)*T,n[4]=b*T,n[5]=(d*y*s-v*f*s+v*o*m-i*y*m-d*o*x+i*f*x)*T,n[6]=(v*u*s-l*y*s-v*o*h+i*y*h+l*o*x-i*u*x)*T,n[7]=(l*f*s-d*u*s+d*o*h-i*f*h-l*o*m+i*u*m)*T,n[8]=w*T,n[9]=(v*p*s-d*g*s-v*a*m+i*g*m+d*a*x-i*p*x)*T,n[10]=(l*g*s-v*c*s+v*a*h-i*g*h-l*a*x+i*c*x)*T,n[11]=(d*c*s-l*p*s-d*a*h+i*p*h+l*a*m-i*c*m)*T,n[12]=A*T,n[13]=(d*g*o-v*p*o+v*a*f-i*g*f-d*a*y+i*p*y)*T,n[14]=(v*c*o-l*g*o-v*a*u+i*g*u+l*a*y-i*c*y)*T,n[15]=(l*p*o-d*c*o+d*a*u-i*p*u-l*a*f+i*c*f)*T,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,l=i*a,c=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,c*o+n,c*s-r*a,0,l*s-r*o,c*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,l=i+i,c=a+a,u=o+o,h=i*l,d=i*c,p=i*u,f=a*c,m=a*u,v=o*u,g=s*l,y=s*c,x=s*u,_=n.x,b=n.y,w=n.z;return r[0]=(1-(f+v))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(h+v))*b,r[6]=(m+g)*b,r[7]=0,r[8]=(p+y)*w,r[9]=(m-g)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:(nn=new Bt,rn=new Mn,function(e,t,n){var r=this.elements,i=nn.set(r[0],r[1],r[2]).length(),a=nn.set(r[4],r[5],r[6]).length(),o=nn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],rn.copy(this);var s=1/i,l=1/a,c=1/o;return rn.elements[0]*=s,rn.elements[1]*=s,rn.elements[2]*=s,rn.elements[4]*=l,rn.elements[5]*=l,rn.elements[6]*=l,rn.elements[8]*=c,rn.elements[9]*=c,rn.elements[10]*=c,t.setFromRotationMatrix(rn),n.x=i,n.y=a,n.z=o,this}),makePerspective:function(e,t,n,r,i,a){void 0===a&&console.warn("v3d.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(t-e),l=2*i/(n-r),c=(t+e)/(t-e),u=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),l=1/(n-r),c=1/(a-i),u=(t+e)*s,h=(n+r)*l,d=(a+i)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var 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}});var Tn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D(alphaMap, vUv).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n if (diffuseColor.a < ALPHATEST)\n discard;\n else\n diffuseColor.a = 1.0;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = (texture2D(aoMap, vUv2).r - 1.0) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined(USE_ENVMAP) && defined(PHYSICAL)\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n reflectedLight.indirectSpecular *= computeSpecularOcclusion(dotNV, ambientOcclusion, material.specularRoughness);\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3(position);",beginnormal_vertex:"vec3 objectNormal = vec3(normal);\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3(tangent.xyz);\n#endif",bsdfs:"\nvec2 integrateSpecularBRDF(const in float dotNV, const in float roughness) {\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 return vec2(-1.04, 1.04) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor(float lightDistance, const in float cutoffDistance, const in float decayExponent) {\n#if defined (PHYSICALLY_CORRECT_LIGHTS)\n lightDistance = UNITS_SCALE_FACTOR * lightDistance;\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#elif defined(BLENDER_LIGHTS)\n return cutoffDistance / (cutoffDistance + pow2(lightDistance));\n#else\n if(cutoffDistance > 0.0) {\n return pow(saturate(-lightDistance / cutoffDistance + 1.0), decayExponent);\n }\n return 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {\n float fresnel = exp2((-5.55473 * dotLH - 6.98316) * dotLH);\n return (1.0 - specularColor) * fresnel + specularColor;\n}\nfloat G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n float gl = dotNL + sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n float gv = dotNV + sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n return 1.0 / (gl * gv);\n}\nfloat G_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}\nvec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in vec3 viewDir,\n const in vec3 normal, const in vec3 specularColor, const in float roughness) {\n float alpha = pow2(roughness);\n vec3 halfDir = normalize(incidentLight.direction + viewDir);\n float dotNL = saturate(dot(normal, incidentLight.direction));\n float dotNV = saturate(dot(normal, viewDir));\n float dotNH = saturate(dot(normal, halfDir));\n float dotLH = saturate(dot(incidentLight.direction, halfDir));\n vec3 F = F_Schlick(specularColor, dotLH);\n float G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (G * D);\n}\n#if NUM_RECT_AREA_LIGHTS > 0\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#endif\nvec3 BRDF_Specular_GGX_Environment(const in GeometricContext geometry,\n const in vec3 specularColor, const in float roughness, const int useCoat) {\n vec3 normal = geometry.normal;\n if (useCoat == 1) {\n normal = geometry.coatNormal;\n }\n float dotNV = saturate(dot(normal, geometry.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 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nfloat 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_Specular_BlinnPhong(const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess) {\n vec3 halfDir = normalize(incidentLight.direction + geometry.viewDir);\n float dotNH = saturate(dot(geometry.normal, halfDir));\n float dotLH = saturate(dot(incidentLight.direction, halfDir));\n vec3 F = F_Schlick(specularColor, dotLH);\n float G = G_BlinnPhong_Implicit();\n float D = D_BlinnPhong(shininess, dotNH);\n return F * (G * D);\n}\nfloat GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\n return (2.0 / pow2(ggxRoughness + 0.0001) - 2.0);\n}\nfloat BlinnExponentToGGXRoughness(const in float blinnExponent) {\n return sqrt(2.0 / (blinnExponent + 2.0));\n}",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx(vUv);\n vec2 dSTdy = dFdy(vUv);\n float Hll = bumpScale * texture2D(bumpMap, vUv).x;\n float dBx = bumpScale * texture2D(bumpMap, vUv + dSTdx).x - Hll;\n float dBy = bumpScale * texture2D(bumpMap, vUv + dSTdy).x - Hll;\n return vec2(dBx, dBy);\n }\n vec3 perturbNormalArb(vec3 surf_pos, vec3 surf_norm, vec2 dHdxy) {\n vec3 vSigmaX = vec3(dFdx(surf_pos.x), dFdx(surf_pos.y), dFdx(surf_pos.z));\n vec3 vSigmaY = vec3(dFdy(surf_pos.x), dFdy(surf_pos.y), dFdy(surf_pos.z));\n vec3 vN = surf_norm;\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n float fDet = dot(vSigmaX, R1);\n fDet *= (float(gl_FrontFacing) * 2.0 - 1.0);\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 #pragma unroll_loop\n for (int i = 0; i < UNION_CLIPPING_PLANES; i++) {\n plane = clippingPlanes[i];\n if (dot(vViewPosition, plane.xyz) > plane.w) discard;\n }\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop\n for (int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i++) {\n plane = clippingPlanes[i];\n clipped = (dot(vViewPosition, plane.xyz) > plane.w) && clipped;\n }\n if (clipped) discard;\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n #if !defined(PHYSICAL) && !defined(PHONG) && !defined(MATCAP)&& !defined(NODE)\n varying vec3 vViewPosition;\n #endif\n uniform vec4 clippingPlanes[NUM_CLIPPING_PLANES];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && !defined(PHYSICAL) && !defined(PHONG) && !defined(MATCAP) && !defined(NODE)\n varying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && !defined(PHYSICAL) && !defined(PHONG) && !defined(MATCAP) && !defined(NODE)\n vViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp(a, 0.0, 1.0)\n#define whiteCompliment(a) (1.0 - saturate(a))\n#define RECIPROCAL_3 0.333333333333\nfloat pow2(const in float 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 average(const in vec3 color) { return dot(color, vec3(0.3333)); }\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}\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};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n vec3 originalNormal;\n vec3 coatNormal;\n};\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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n float distance = dot(planeNormal, point - pointOnPlane);\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n return sign(dot(point - pointOnPlane, planeNormal));\n}\nvec3 linePlaneIntersect(in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal) {\n return lineDirection * (dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\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}\nfloat linearToRelativeLuminance(const in vec3 color) {\n vec3 weights = vec3(0.2126, 0.7152, 0.0722);\n return dot(weights, color.rgb);\n}\nfloat powCompat(const in float val, const in float power) {\n if (power == 0.0)\n return 1.0;\n else if (val < 0.0) {\n if (mod(-power, 2.0) == 0.0)\n return pow(-val, power);\n else\n return -pow(-val, power);\n } else if (val == 0.0)\n return 0.0;\n return pow(val, power);\n}\nfloat maxFromRGB(vec3 rgb) {\n return max(max(rgb.r, rgb.g), rgb.b);\n}\nbool isOrtho(const in mat4 m) {\n if (m[3][3] != 0.0)\n return true;\n else\n return false;\n}\nvec3 swizzleUpZ(const vec3 vec) {\n return vec3(vec[0], -vec[2], vec[1]);\n}\nvec3 swizzleUpY(const vec3 vec) {\n return vec3(vec[0], vec[2], -vec[1]);\n}\nvec3 xyz_to_sRGB(vec3 xyz) {\n mat3 convMat = mat3(\n 3.2406, -0.9689, 0.0557,\n -1.5372, 1.8758, -0.2040,\n -0.4986, 0.0415, 1.0570\n );\n return convMat * xyz;\n}\nvec3 xyY_to_XYZ(float x, float y, float Y) {\n float X = 0.0;\n float Z = 0.0;\n if (y != 0.0) {\n X = (Y / y) * x;\n Z = (Y / y) * (1.0 - x - y);\n }\n return vec3(X, Y, Z);\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\n#define cubeUV_faceSize (cubeUV_textureSize * 0.25)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo(vec3 dir, float roughnessLevel) {\n dir = normalize(dir) * (sqrt(3.0) + 1.0) / 2.0;\n vec3 dx = dFdx(dir);\n vec3 dy = dFdy(dir);\n float derivCoeff = cubeUV_faceSize / exp2(roughnessLevel) / 2.0;\n dx *= derivCoeff;\n dy *= derivCoeff;\n float d = max(dot(dx, dx), dot(dy, dy));\n d = clamp(d, 1.0, cubeUV_rangeClamp);\n float mipLevel = 0.5 * log2(d);\n return vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_faceSize) - 2.0)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n float a = 16.0 * cubeUV_rcpTextureSize;\n vec2 exp2_packed = exp2(vec2(roughnessLevel, mipLevel));\n vec2 rcp_exp2_packed = vec2(1.0) / exp2_packed;\n float powScale = exp2_packed.x * exp2_packed.y;\n float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n bool bRes = mipLevel == 0.0;\n scale = bRes && (scale < a) ? a : scale;\n vec3 absDir = abs(direction);\n float maxAbsVal = max(max(absDir.x, absDir.y), absDir.z);\n bool Xy = absDir.x >= absDir.y, Xz = absDir.x >= absDir.z, Yz = absDir.y >= absDir.z;\n vec3 projMax = vec3(Xy && Xz, !Xy && Yz, !Xz && !Yz);\n mat3 vecToUV = mat3(\n projMax.y + projMax.z * sign(direction.z), 0.0, projMax.x,\n 0.0, projMax.x + projMax.z, projMax.y,\n sign(-direction.x) * projMax.x, sign(direction.y) * projMax.y, projMax.z\n );\n vec2 uv = (vecToUV * (direction / maxAbsVal)).xy;\n uv = (uv + vec2(1.0)) * 0.5;\n float offCoeffX = dot(projMax, vec3(0.0, 1.0, 2.0));\n float rowBottomOrTop = (sign(dot(projMax, direction)) + 1.0) / 2.0;\n float offCoeffY = 0.5 + 0.25 * rowBottomOrTop;\n float zeroMipCoeff = a * rowBottomOrTop;\n vec2 offset = vec2(offCoeffX * scale + mipOffset, offCoeffY / powScale);\n offset.y = bRes && (offset.y < 2.0 * a) ? zeroMipCoeff : offset.y;\n float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n vec2 base = offset + vec2(texelOffset);\n return base + uv * (scale - 2.0 * texelOffset);\n}\n#define cubeUV_maxLods3 (log2(cubeUV_faceSize) - 3.0)\nvec4 textureCubeUV(sampler2D envMap, vec3 reflDir, vec3 reflDirMipLevel, float roughness) {\n float roughnessVal = roughness * cubeUV_maxLods3;\n float r0 = floor(roughnessVal);\n float r1 = r0 + 1.0;\n float rfactor = fract(roughnessVal);\n vec2 mipInfo = MipLevelInfo(reflDirMipLevel, r0);\n float l0 = mipInfo.x;\n float l1 = min(l0 + 1.0, 5.0);\n float lfactor = mipInfo.y;\n vec2 uv_r0_l0 = getCubeUV(reflDir, r0, l0);\n vec2 uv_r0_l1 = getCubeUV(reflDir, r0, l1);\n vec2 uv_r1_l0 = getCubeUV(reflDir, r1, l0);\n vec2 uv_r1_l1 = getCubeUV(reflDir, r1, l1);\n vec4 color_r0_l0 = envMapTexelToLinear(texture2D(envMap, uv_r0_l0));\n vec4 color_r0_l1 = envMapTexelToLinear(texture2D(envMap, uv_r0_l1));\n vec4 color_r1_l0 = envMapTexelToLinear(texture2D(envMap, uv_r1_l0));\n vec4 color_r1_l1 = envMapTexelToLinear(texture2D(envMap, uv_r1_l1));\n vec4 color_r0 = mix(color_r0_l0, color_r0_l1, lfactor);\n vec4 color_r1 = mix(color_r1_l0, color_r1_l1, lfactor);\n vec4 result = mix(color_r0, color_r1, rfactor);\n return vec4(result.rgb, 1.0);\n}\nvec4 textureCubeUVMaxRoughness(sampler2D envMap, vec3 reflDir) {\n vec2 uv = getCubeUV(reflDir, cubeUV_maxLods3, 0.0);\n vec4 result = envMapTexelToLinear(texture2D(envMap, uv));\n return vec4(result.rgb, 1.0);\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = normalMatrix * objectTangent;\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, uv).x * displacementScale + displacementBias);\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D(emissiveMap, vUv);\n emissiveColor.rgb = emissiveMapTexelToLinear(emissiveColor).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel(gl_FragColor);",encodings_pars_fragment:"\nvec4 LinearToLinear(in vec4 value) {\n return value;\n}\nvec4 GammaToLinear(in vec4 value, in float gammaFactor) {\n return vec4(pow(value.rgb, vec3(gammaFactor)), value.a);\n}\nvec4 LinearToGamma(in vec4 value, in float gammaFactor) {\n return vec4(pow(value.rgb, vec3(1.0 / gammaFactor)), value.a);\n}\nvec4 sRGBToLinear(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 LinearTosRGB(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}\nvec4 RGBEToLinear(in vec4 value) {\n return vec4(value.rgb * exp2(value.a * 255.0 - 128.0), 1.0);\n}\nvec4 LinearToRGBE(in vec4 value) {\n float maxComponent = max(max(value.r, value.g), value.b);\n float fExp = clamp(ceil(log2(maxComponent)), -128.0, 127.0);\n return vec4(value.rgb / exp2(fExp), (fExp + 128.0) / 255.0);\n}\nvec4 RGBMToLinear(in vec4 value, in float maxRange) {\n return vec4(value.rgb * value.a * maxRange, 1.0);\n}\nvec4 LinearToRGBM(in vec4 value, in float maxRange) {\n float maxRGB = max(value.r, max(value.g, value.b));\n float M = clamp(maxRGB / maxRange, 0.0, 1.0);\n M = ceil(M * 255.0) / 255.0;\n return vec4(value.rgb / (M * maxRange), M);\n}\nvec4 RGBDToLinear(in vec4 value, in float maxRange) {\n return vec4(value.rgb * ((maxRange / 255.0) / value.a), 1.0);\n}\nvec4 LinearToRGBD(in vec4 value, in float maxRange) {\n float maxRGB = max(value.r, max(value.g, value.b));\n float D = max(maxRange / maxRGB, 1.0);\n D = min(floor(D) / 255.0, 1.0);\n return vec4(value.rgb * (D * (255.0 / maxRange)), D);\n}\nconst mat3 cLogLuvM = mat3(0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969);\nvec4 LinearToLogLuv(in vec4 value) {\n vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w * 255.0)) / 255.0) / 255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3(6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268);\nvec4 LogLuvToLinear(in vec4 value) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n return vec4(max(vRGB, 0.0), 1.0);\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE)\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect(cameraToVertex, worldNormal);\n #else\n vec3 reflectVec = refract(cameraToVertex, worldNormal, refractionRatio);\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube(envMap, vec3(flipEnvMap * reflectVec.x, reflectVec.yz));\n #elif defined(ENVMAP_TYPE_EQUIREC)\n vec2 sampleUV;\n reflectVec = normalize(reflectVec);\n sampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(reflectVec.z, reflectVec.x) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D(envMap, sampleUV);\n #elif defined(ENVMAP_TYPE_SPHERE)\n reflectVec = normalize(reflectVec);\n vec3 reflectView = normalize((viewMatrix * vec4(reflectVec, 0.0)).xyz + vec3(0.0, 0.0, 1.0));\n vec4 envColor = texture2D(envMap, reflectView.xy * 0.5 + 0.5);\n #else\n vec4 envColor = vec4(0.0);\n #endif\n envColor = envMapTexelToLinear(envColor);\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_pars_fragment:"#if defined(USE_ENVMAP) || defined(PHYSICAL)\n uniform float reflectivity;\n uniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n #if !defined(PHYSICAL) && (defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG))\n varying vec3 vWorldPosition;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n uniform int maxMipLevel;\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE) || defined(PHYSICAL)\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(NODE)\n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#if defined(USE_ENVMAP) && defined(PHYSICAL)\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel) {\n vec3 worldNormal = inverseTransformDirection(geometry.normal, viewMatrix);\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT(envMap, queryVec, float(maxMIPLevel));\n #else\n vec4 envMapColor = textureCube(envMap, queryVec, float(maxMIPLevel));\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_CUBE_UV)\n vec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n vec4 envMapColor = textureCubeUVMaxRoughness(envMap, queryVec);\n #else\n vec4 envMapColor = vec4(0.0);\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {\n float maxMIPLevelScalar = float(maxMIPLevel);\n float desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2(pow2(blinnShininessExponent) + 1.0);\n return clamp(desiredMIPLevel, 0.0, maxMIPLevelScalar);\n }\n vec3 _getLightProbeIndirect(const float blinnShininessExponent,\n const int maxMIPLevel, vec3 directionVec, vec3 directionVecMipLevel) {\n float specularMIPLevel = getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3(flipEnvMap * directionVec.x, directionVec.yz);\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT(envMap, queryVec, specularMIPLevel);\n #else\n vec4 envMapColor = textureCube(envMap, queryVec, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_CUBE_UV)\n vec3 queryVec = vec3(flipEnvMap * directionVec.x, directionVec.yz);\n vec3 queryVecMipLevel = vec3(flipEnvMap * directionVecMipLevel.x,\n directionVecMipLevel.yz);\n vec4 envMapColor = textureCubeUV(envMap, queryVec, queryVecMipLevel,\n BlinnExponentToGGXRoughness(blinnShininessExponent));\n #elif defined(ENVMAP_TYPE_EQUIREC)\n vec2 sampleUV;\n sampleUV.y = asin(clamp(directionVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(directionVec.z, directionVec.x) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT(envMap, sampleUV, specularMIPLevel);\n #else\n vec4 envMapColor = texture2D(envMap, sampleUV, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_SPHERE)\n vec3 reflectView = normalize((viewMatrix * vec4(directionVec, 0.0)).xyz + vec3(0.0,0.0,1.0));\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT(envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel);\n #else\n vec4 envMapColor = texture2D(envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n vec3 getLightProbeIndirectRadiance(\n const GeometricContext geometry, const float blinnShininessExponent,\n const int maxMIPLevel, const int useCoat) {\n vec3 normal = geometry.normal;\n if (useCoat == 1) {\n normal = geometry.coatNormal;\n }\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 directionVec = reflect(-geometry.viewDir, normal);\n #else\n vec3 directionVec = refract(-geometry.viewDir, normal, refractionRatio);\n #endif\n directionVec = inverseTransformDirection(directionVec, viewMatrix);\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 directionVecMipLevel = reflect(-geometry.viewDir, geometry.originalNormal);\n #else\n vec3 directionVecMipLevel = refract(-geometry.viewDir, geometry.originalNormal, refractionRatio);\n #endif\n directionVecMipLevel = inverseTransformDirection(directionVecMipLevel, viewMatrix);\n return _getLightProbeIndirect(blinnShininessExponent, maxMIPLevel,\n directionVec, directionVecMipLevel);\n }\n vec3 getLightProbeIndirectRefraction(\n const GeometricContext geometry, const float blinnShininessExponent,\n const int maxMIPLevel, const float refrRatio) {\n vec3 directionVec = refract(-geometry.viewDir, geometry.normal, refrRatio);\n directionVec = inverseTransformDirection(directionVec, viewMatrix);\n vec3 directionVecMipLevel = refract(-geometry.viewDir, geometry.originalNormal, refrRatio);\n directionVecMipLevel = inverseTransformDirection(directionVecMipLevel, viewMatrix);\n return _getLightProbeIndirect(blinnShininessExponent, maxMIPLevel,\n directionVec, directionVecMipLevel);\n }\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE)\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex = normalize(worldPosition.xyz - cameraPosition);\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 fogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = whiteCompliment(exp2(- fogDensity * fogDensity * fogDepth * fogDepth * LOG2));\n #else\n float fogFactor = smoothstep(fogNear, fogFar, fogDepth);\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 fogDepth;\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 TOON\n uniform sampler2D gradientMap;\n vec3 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 texture2D(gradientMap, coord).rgb;\n #else\n return (coord.x < 0.7) ? vec3(0.7) : vec3(1.0);\n #endif\n }\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += PI * texture2D(lightMap, vUv2).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3(1.0);\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize(transformedNormal);\ngeometry.originalNormal = geometry.normal;\ngeometry.viewDir = normalize(-mvPosition.xyz);\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.originalNormal = -geometry.originalNormal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3(0.0);\nvIndirectFront = vec3(0.0);\n#ifdef DOUBLE_SIDED\n vLightBack = vec3(0.0);\n vIndirectBack = vec3(0.0);\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n getPointDirectLightIrradiance(pointLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n getSpotDirectLightIrradiance(spotLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n getDirectionalDirectLightIrradiance(directionalLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_HEMI_LIGHTS; i++) {\n vIndirectFront += getHemisphereLightIrradiance(hemisphereLights[i], geometry);\n #ifdef DOUBLE_SIDED\n vIndirectBack += getHemisphereLightIrradiance(hemisphereLights[i], backGeometry);\n #endif\n }\n#endif",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance(const in vec3 ambientLightColor) {\n vec3 irradiance = ambientLightColor;\n #if defined(BLENDER_LIGHTS) || !defined(PHYSICALLY_CORRECT_LIGHTS)\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLight directionalLights[NUM_DIR_LIGHTS];\n void getDirectionalDirectLightIrradiance(const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.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 int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLight pointLights[NUM_POINT_LIGHTS];\n void getPointDirectLightIrradiance(const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize(lVector);\n float lightDistance = length(lVector);\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor(lightDistance, pointLight.distance, pointLight.decay);\n directLight.visible = (directLight.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 int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLight spotLights[NUM_SPOT_LIGHTS];\n void getSpotDirectLightIrradiance(const in SpotLight spotLight,\n const in GeometricContext geometry, out IncidentLight directLight) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize(lVector);\n float lightDistance = length(lVector);\n float angleCos = dot(directLight.direction, spotLight.direction);\n #if defined(MT_MAX) && defined(PHYSICALLY_CORRECT_LIGHTS)\n float coneCosDecayed = 2.0 * spotLight.coneCos - spotLight.penumbraCos;\n if (angleCos > coneCosDecayed) {\n float spotEffect = pow(angleCos, log(0.5) / log(spotLight.penumbraCos) - 1.0);\n if (angleCos < spotLight.coneCos) {\n float decayFac = 1.0 + (spotLight.coneCos - angleCos)\n / (spotLight.coneCos - spotLight.penumbraCos);\n spotEffect *= pow2(decayFac) * (3.0 - 2.0 * decayFac);\n }\n directLight.color = spotLight.color * spotEffect\n * punctualLightIntensityToIrradianceFactor(lightDistance,\n spotLight.distance, spotLight.decay);\n directLight.visible = true;\n } else {\n directLight.color = vec3(0.0);\n directLight.visible = false;\n }\n #else\n if (angleCos > spotLight.coneCos) {\n float spotEffect = smoothstep(spotLight.coneCos, spotLight.penumbraCos, angleCos);\n directLight.color = spotLight.color * spotEffect\n * punctualLightIntensityToIrradianceFactor(lightDistance,\n spotLight.distance, spotLight.decay);\n directLight.visible = true;\n } else {\n directLight.color = vec3(0.0);\n directLight.visible = false;\n }\n #endif\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;\n 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 GeometricContext geometry) {\n float dotNL = dot(geometry.normal, hemiLight.direction);\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix(hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight);\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif",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;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\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 GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef TOON\n vec3 irradiance = getGradientIrradiance(geometry.normal, directLight.direction) * directLight.color;\n #else\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n #endif\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong(directLight, geometry, material.specularColor, material.specularShininess) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong(const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD(material) (0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * (1.0 - metalnessFactor);\nmaterial.specularRoughness = clamp(roughnessFactor, 0.04, 1.0);\n#ifdef STANDARD\n material.specularColor = mix(vec3(DEFAULT_SPECULAR_COEFFICIENT), diffuseColor.rgb, metalnessFactor);\n#else\n material.specularColor = mix(vec3(MAXIMUM_SPECULAR_COEFFICIENT * pow2(reflectivity)), diffuseColor.rgb, metalnessFactor);\n material.clearCoat = saturate(clearCoat);\n material.clearCoatRoughness = clamp(clearCoatRoughness, 0.04, 1.0);\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n #ifndef STANDARD\n float clearCoat;\n float clearCoatRoughness;\n #endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox(const in float roughness, const in float dotNL) {\n return DEFAULT_SPECULAR_COEFFICIENT + (1.0 - DEFAULT_SPECULAR_COEFFICIENT) * (pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical(const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[4];\n rectCoords[0] = lightPos + halfWidth - halfHeight;\n 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n #ifndef STANDARD\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.directSpecular += (1.0 - clearCoatDHR) * irradiance\n * BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.normal,\n material.specularColor, material.specularRoughness);\n reflectedLight.directDiffuse += (1.0 - clearCoatDHR) * irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n #ifndef STANDARD\n reflectedLight.directSpecular += irradiance * material.clearCoat\n * BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.coatNormal,\n vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n #endif\n}\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectSpecular_Physical(const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifndef STANDARD\n float coatDotNL = saturate(dot(geometry.coatNormal, geometry.viewDir));\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, coatDotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.indirectSpecular += (1.0 - clearCoatDHR) * radiance\n * BRDF_Specular_GGX_Environment(geometry, material.specularColor,\n material.specularRoughness, 0);\n #ifndef STANDARD\n reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat\n * BRDF_Specular_GGX_Environment(geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT),\n material.clearCoatRoughness, 1);\n #endif\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\n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n#define Material_ClearCoat_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.clearCoatRoughness)\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:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize(vViewPosition);\n#if defined(ORIGINAL_NORMAL)\n geometry.originalNormal = ORIGINAL_NORMAL;\n#else\n geometry.originalNormal = geometry.normal;\n#endif\n#if defined(COAT_NORMAL)\n geometry.coatNormal = COAT_NORMAL;\n#else\n geometry.coatNormal = geometry.normal;\n#endif\nIncidentLight directLight;\n#if (NUM_POINT_LIGHTS > 0) && defined(RE_Direct)\n PointLight pointLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n pointLight = pointLights[i];\n getPointDirectLightIrradiance(pointLight, geometry, directLight);\n #ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(pointLight.shadow, directLight.visible)) ? getPointShadow(pointShadowMap[i], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[i], pointLight.shadowCameraNear, pointLight.shadowCameraFar) : 1.0;\n #endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_SPOT_LIGHTS > 0) && defined(RE_Direct)\n SpotLight spotLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n spotLight = spotLights[i];\n getSpotDirectLightIrradiance(spotLight, geometry, directLight);\n #ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(spotLight.shadow, directLight.visible)) ? getShadow(spotShadowMap[i], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[i]) : 1.0;\n #endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_DIR_LIGHTS > 0) && defined(RE_Direct)\n DirectionalLight directionalLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n directionalLight = directionalLights[i];\n getDirectionalDirectLightIrradiance(directionalLight, geometry, directLight);\n #ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(directionalLight.shadow, directLight.visible)) ? getShadow(directionalShadowMap[i], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[i]) : 1.0;\n #endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_RECT_AREA_LIGHTS > 0) && defined(RE_Direct_RectArea)\n RectAreaLight rectAreaLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_RECT_AREA_LIGHTS; i++) {\n rectAreaLight = rectAreaLights[i];\n RE_Direct_RectArea(rectAreaLight, geometry, material, reflectedLight);\n }\n#endif\n#if defined(RE_IndirectDiffuse)\n vec3 irradiance = getAmbientLightIrradiance(ambientLightColor);\n #if (NUM_HEMI_LIGHTS > 0)\n #pragma unroll_loop\n for (int i = 0; i < NUM_HEMI_LIGHTS; i++) {\n irradiance += getHemisphereLightIrradiance(hemisphereLights[i], geometry);\n #if defined(BLENDER_LIGHTS) && !defined(PHYSICAL)\n RE_HemiSpec_Blender(hemisphereLights[i], geometry, material, reflectedLight);\n #endif\n }\n #endif\n#endif\n#if defined(RE_IndirectSpecular)\n vec3 radiance = vec3(0.0);\n vec3 clearCoatRadiance = vec3(0.0);\n#endif\n#if defined(RE_Refraction) && defined(USE_REFRACTED_LIGHT)\n vec3 refraction = vec3(0.0);\n#endif",lights_fragment_maps:"#if defined(RE_IndirectDiffuse)\n #ifdef USE_LIGHTMAP\n vec3 lightMapIrradiance = texture2D(lightMap, vUv2).xyz * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if defined(USE_ENVMAP) && defined(PHYSICAL) && defined(ENVMAP_TYPE_CUBE_UV)\n irradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel);\n #endif\n#endif\n#if defined(USE_ENVMAP) && defined(RE_IndirectSpecular)\n radiance += getLightProbeIndirectRadiance(geometry,\n Material_BlinnShininessExponent(material), maxMipLevel, 0);\n #ifndef STANDARD\n clearCoatRadiance += getLightProbeIndirectRadiance(geometry,\n Material_ClearCoat_BlinnShininessExponent(material), maxMipLevel, 1);\n #endif\n#endif\n#if defined(USE_ENVMAP) && defined(RE_Refraction) && defined(USE_REFRACTED_LIGHT)\n refraction += getLightProbeIndirectRefraction(geometry,\n Material_Refraction_BlinnShininessExponent(material), maxMipLevel,\n 1.0 / material.refractionIOR);\n#endif",lights_fragment_end:"#if defined(RE_IndirectDiffuse)\n RE_IndirectDiffuse(irradiance, geometry, material, reflectedLight);\n#endif\n#if defined(RE_IndirectSpecular)\n RE_IndirectSpecular(radiance, clearCoatRadiance, geometry, material, reflectedLight);\n#endif\n#if defined(RE_Refraction) && defined(USE_REFRACTED_LIGHT)\n RE_Refraction(refraction, material, refractedLight);\n#endif",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n uniform float logDepthBufFC;\n varying float vFragDepth;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = log2(max(EPSILON, gl_Position.w + 1.0)) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n #endif\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 texelColor = texture2D(map, vUv);\n texelColor = mapTexelToLinear(texelColor);\n diffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n vec2 uv = (uvTransform * vec3(gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1)).xy;\n vec4 mapTexel = texture2D(map, uv);\n diffuseColor *= mapTexelToLinear(mapTexel);\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n uniform mat3 uvTransform;\n uniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D(metalnessMap, vUv);\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal += (morphNormal0 - normal) * morphTargetInfluences[0];\n objectNormal += (morphNormal1 - normal) * morphTargetInfluences[1];\n objectNormal += (morphNormal2 - normal) * morphTargetInfluences[2];\n objectNormal += (morphNormal3 - normal) * morphTargetInfluences[3];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[8];\n #else\n uniform float morphTargetInfluences[4];\n #endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed += (morphTarget0 - position) * morphTargetInfluences[0];\n transformed += (morphTarget1 - position) * morphTargetInfluences[1];\n transformed += (morphTarget2 - position) * morphTargetInfluences[2];\n transformed += (morphTarget3 - position) * morphTargetInfluences[3];\n #ifndef USE_MORPHNORMALS\n transformed += (morphTarget4 - position) * morphTargetInfluences[4];\n transformed += (morphTarget5 - position) * morphTargetInfluences[5];\n transformed += (morphTarget6 - position) * morphTargetInfluences[6];\n transformed += (morphTarget7 - position) * morphTargetInfluences[7];\n #endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n vec3 fdx = vec3(dFdx(vViewPosition.x), dFdx(vViewPosition.y), dFdx(vViewPosition.z));\n vec3 fdy = vec3(dFdy(vViewPosition.x), dFdy(vViewPosition.y), dFdy(vViewPosition.z));\n vec3 normal = normalize(cross(fdx, fdy));\n#else\n vec3 normal = normalize(vNormal);\n #ifdef DOUBLE_SIDED\n normal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n #endif\n#endif\n vec3 originalNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP\n #ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n #endif\n normal = normalize(normalMatrix * normal);\n #else\n #ifdef USE_TANGENT\n normal = perturbNormalTang(vNormal);\n #else\n normal = perturbNormal2Arb(-vViewPosition, normal);\n #endif\n #endif\n#elif defined(USE_BUMPMAP)\n normal = perturbNormalArb(-vViewPosition, normal, dHdxy_fwd());\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n #ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n #elif defined(USE_TANGENT)\n \n uniform mat4 modelViewMatrix;\n varying vec4 vTangent;\n vec3 perturbNormalTang(vec3 normal) {\n vec3 normalTex = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n normalTex.xy *= normalScale;\n normalTex = normalize(normalTex);\n vec4 viewTangent = vec4(normalize((modelViewMatrix * vec4(vTangent.xyz, 0.0)).xyz), vTangent.w);\n vec3 bitangent = -viewTangent.w * cross(normal, viewTangent.xyz);\n vec3 normalOut = normalTex.x * (viewTangent.xyz) + normalTex.y * bitangent \n + normalTex.z * normal;\n normalOut = normalize(normalOut);\n return normalOut;\n }\n #else\n vec3 perturbNormal2Arb(vec3 eye_pos, vec3 surf_norm) {\n vec3 q0 = vec3(dFdx(eye_pos.x), dFdx(eye_pos.y), dFdx(eye_pos.z));\n vec3 q1 = vec3(dFdy(eye_pos.x), dFdy(eye_pos.y), dFdy(eye_pos.z));\n vec2 st0 = dFdx(vUv.st);\n vec2 st1 = dFdy(vUv.st);\n float scale = sign(st1.t * st0.s - st0.t * st1.s);\n vec3 S = normalize((q0 * st1.t - q1 * st0.t) * scale);\n vec3 T = normalize((- q0 * st1.s + q1 * st0.s) * scale);\n vec3 N = normalize(surf_norm);\n mat3 tsn = mat3(S, T, N);\n vec3 mapN = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n mapN.xy *= (float(gl_FrontFacing) * 2.0 - 1.0);\n return normalize(tsn * mapN);\n }\n #endif\n#endif",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.;\nconst float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3(256. * 256. * 256., 256. * 256., 256.);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.);\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8;\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\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 linearClipZ, const in float near, const in float far) {\n return linearClipZ * (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 invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4(transformed, 1.0);\ngl_Position = projectionMatrix * mvPosition;\n#if defined(BACKGROUND_DEPTH)\n gl_Position.z = gl_Position.w;\n#endif",dithering_fragment:"#if defined(DITHERING)\n gl_FragColor.rgb = dithering(gl_FragColor.rgb);\n#endif",dithering_pars_fragment:"#if defined(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, vUv);\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform sampler2D directionalShadowMap[NUM_DIR_LIGHTS];\n varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHTS];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform sampler2D spotShadowMap[NUM_SPOT_LIGHTS];\n varying vec4 vSpotShadowCoord[NUM_SPOT_LIGHTS];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform sampler2D pointShadowMap[NUM_POINT_LIGHTS];\n varying vec4 vPointShadowCoord[NUM_POINT_LIGHTS];\n #endif\n float texture2DCompare(sampler2D depths, vec2 uv, float compare) {\n return step(compare, unpackRGBAToDepth(texture2D(depths, uv)));\n }\n float texture2DShadowLerp(sampler2D depths, vec2 size, vec2 uv, float compare) {\n const vec2 offset = vec2(0.0, 1.0);\n vec2 texelSize = vec2(1.0) / size;\n vec2 centroidUV = floor(uv * size + 0.5) / size;\n float lb = texture2DCompare(depths, centroidUV + texelSize * offset.xx, compare);\n float lt = texture2DCompare(depths, centroidUV + texelSize * offset.xy, compare);\n float rb = texture2DCompare(depths, centroidUV + texelSize * offset.yx, compare);\n float rt = texture2DCompare(depths, centroidUV + texelSize * offset.yy, compare);\n vec2 f = fract(uv * size + 0.5);\n float a = mix(lb, lt, f.y);\n float b = mix(rb, rt, f.y);\n float c = mix(a, b, f.x);\n return c;\n }\n float getShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 (shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0);\n bool inFrustum = all(inFrustumVec);\n bvec2 frustumTestVec = bvec2(inFrustum, shadowCoord.z <= 1.0);\n bool frustumTest = all(frustumTestVec);\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 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(dx0, 0.0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, 0.0), 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 / 9.0);\n #elif defined(SHADOWMAP_TYPE_PCF_SOFT)\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 shadow = (\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(0.0, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, 0.0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, 0.0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, dy1), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(0.0, dy1), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, dy1), shadowCoord.z)\n ) * (1.0 / 9.0);\n #else\n shadow = texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z);\n #endif\n }\n return shadow;\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 shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar) {\n vec2 texelSize = vec2(1.0) / (shadowMapSize * vec2(4.0, 2.0));\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = (length(lightToPosition) - shadowCameraNear) / (shadowCameraFar - shadowCameraNear);\n dp += shadowBias;\n vec3 bd3D = normalize(lightToPosition);\n #if defined(SHADOWMAP_TYPE_PCF) || defined(SHADOWMAP_TYPE_PCF_SOFT)\n vec2 offset = vec2(- 1, 1) * shadowRadius * texelSize.y;\n return (\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 return texture2DCompare(shadowMap, cubeToUV(bd3D, texelSize.y), dp);\n #endif\n }\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform mat4 directionalShadowMatrix[NUM_DIR_LIGHTS];\n varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHTS];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform mat4 spotShadowMatrix[NUM_SPOT_LIGHTS];\n varying vec4 vSpotShadowCoord[NUM_SPOT_LIGHTS];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform mat4 pointShadowMatrix[NUM_POINT_LIGHTS];\n varying vec4 vPointShadowCoord[NUM_POINT_LIGHTS];\n #endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n vDirectionalShadowCoord[i] = directionalShadowMatrix[i] * worldPosition;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n vSpotShadowCoord[i] = spotShadowMatrix[i] * worldPosition;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n vPointShadowCoord[i] = pointShadowMatrix[i] * worldPosition;\n }\n #endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n directionalLight = directionalLights[i];\n shadow *= bool(directionalLight.shadow) ? getShadow(directionalShadowMap[i], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[i]) : 1.0;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n SpotLight spotLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n spotLight = spotLights[i];\n shadow *= bool(spotLight.shadow) ? getShadow(spotShadowMap[i], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[i]) : 1.0;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n PointLight pointLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n pointLight = pointLights[i];\n shadow *= bool(pointLight.shadow) ? getPointShadow(pointShadowMap[i], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[i], pointLight.shadowCameraNear, pointLight.shadowCameraFar) : 1.0;\n }\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 #ifdef BONE_TEXTURE\n uniform sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix(const in float i) {\n float j = i * 4.0;\n float x = mod(j, float(boneTextureSize));\n float y = floor(j / float(boneTextureSize));\n float dx = 1.0 / float(boneTextureSize);\n float dy = 1.0 / float(boneTextureSize);\n y = dy * (y + 0.5);\n vec4 v1 = texture2D(boneTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(boneTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(boneTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(boneTexture, vec2(dx * (x + 3.5), y));\n mat4 bone = mat4(v1, v2, v3, v4);\n return bone;\n }\n #else\n uniform mat4 boneMatrices[MAX_BONES];\n mat4 getBoneMatrix(const in float i) {\n mat4 bone = boneMatrices[int(i)];\n return bone;\n }\n #endif\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, vUv);\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\n#ifndef PI\n #define PI 3.14159265359\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nuniform float toneMappingBrightness;\nuniform float toneMappingContrast;\nuniform float toneMappingMidTones;\nuniform float toneMappingPhysicalScale;\nuniform bool toneMappingChromaticAdaptation;\nuniform vec3 toneMappingWhiteColor;\nuniform bool toneMappingColorDifferentiation;\nuniform bool toneMappingExteriorDaylight;\nvec3 LinearToneMapping(vec3 color) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping(vec3 color) {\n color *= toneMappingExposure;\n return saturate(color / (vec3(1.0) + color));\n}\n#define Uncharted2Helper(x) max(((x * (0.15 * x + 0.10 * 0.50) + 0.20 * 0.02) / (x * (0.15 * x + 0.50) + 0.20 * 0.30)) - 0.02 / 0.30, vec3(0.0))\nvec3 Uncharted2ToneMapping(vec3 color) {\n color *= toneMappingExposure;\n return saturate(Uncharted2Helper(color) / Uncharted2Helper(vec3(toneMappingWhitePoint)));\n}\nvec3 OptimizedCineonToneMapping(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 ACESFilmicToneMapping(vec3 color) {\n color *= toneMappingExposure;\n return saturate((color * (2.51 * color + 0.03)) / (color * (2.43 * color + 0.59) + 0.14));\n}\n#define ORDERS_OF_MAG 5.0\nfloat toneCalcBrightness(in vec3 color)\n{\n return (abs(color.r) * 0.263 + abs(color.g) * 0.655 + abs(color.b) * 0.082);\n}\nfloat toneApproximateScotopicLuminance(vec3 color)\n{\n return (0.062 * color.r + 0.608 * color.g + 0.330 * color.b);\n}\nvec3 LogarithmicMaxToneMapping(vec3 color) {\n float inputScaleFactor = toneMappingPhysicalScale / PI;\n float brightness = (toneMappingBrightness < 0.0) ? 0.0 : (toneMappingBrightness * 0.7);\n float powerBot = toneMappingExteriorDaylight ? 4.0 : 2.0;\n float res = 100.0 / ORDERS_OF_MAG;\n float mag = floor((50.0 / res));\n float power = ((brightness / 20.0 - ORDERS_OF_MAG) - powerBot) + mag;\n float stepsize = 9.0 / res;\n float step = 50.0 - (mag * res);\n float param_c = (0.02 * toneMappingContrast) * 2.0;\n float param_b = pow(10.0, power) * (1.0 + (stepsize * step));\n float param_a = param_b * (1.0 + param_c);\n param_c /= pow(2.0, toneMappingMidTones - 1.0);\n param_b *= PI;\n vec3 whiteConstancyFactor = toneMappingWhiteColor;\n if (toneMappingChromaticAdaptation) {\n float luminance = toneCalcBrightness(whiteConstancyFactor);\n whiteConstancyFactor.r = (whiteConstancyFactor.r > 0.001) ? luminance / whiteConstancyFactor.r : luminance / 0.001;\n whiteConstancyFactor.g = (whiteConstancyFactor.g > 0.001) ? luminance / whiteConstancyFactor.g : luminance / 0.001;\n whiteConstancyFactor.b = (whiteConstancyFactor.b > 0.001) ? luminance / whiteConstancyFactor.b : luminance / 0.001;\n }\n vec3 outColor = inputScaleFactor * color;\n if (toneMappingChromaticAdaptation) {\n outColor *= whiteConstancyFactor.rgb;\n }\n float luminance = toneCalcBrightness(outColor);\n if (toneMappingColorDifferentiation && (luminance < 5.62)) {\n float sLuminance = toneApproximateScotopicLuminance(outColor);\n if (luminance <= 5.62e-3) {\n outColor = vec3(sLuminance);\n } else {\n float w = (luminance - 5.62e-3) / 5.61438;\n outColor = outColor * w + sLuminance * (1.0 - w);\n }\n }\n outColor = outColor * (param_a / (param_b * outColor + param_c));\n return outColor;\n}",uv_pars_fragment:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n varying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif",uv_vertex:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n vUv = (uvTransform * vec3(uv, 1)).xy;\n#endif",uv2_pars_fragment:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n varying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n attribute vec2 uv2;\n varying vec2 vUv2;\n#endif",uv2_vertex:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n vUv2 = uv2;\n#endif",worldpos_vertex:"#if defined(USE_ENVMAP) || defined(DISTANCE) || defined (USE_SHADOWMAP) || defined(MASK) || defined(NODE)\n vec4 worldPosition = modelMatrix * vec4(transformed, 1.0);\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D(t2D, vUv);\n gl_FragColor = mapTexelToLinear(texColor);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",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}",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 = mapTexelToLinear(texColor);\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <encodings_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}",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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(1.0);\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 <logdepthbuf_fragment>\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4(vec3(1.0 - gl_FragCoord.z), opacity);\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_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}",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 <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(1.0);\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n float dist = length(vWorldPosition - referencePosition);\n dist = (dist - nearDistance) / (farDistance - nearDistance);\n dist = saturate(dist);\n gl_FragColor = packDepthToRGBA(dist);\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_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}",equirect_frag:"uniform sampler2D tEquirect;\nuniform bool invertU;\nuniform float offsetU;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize(vWorldDirection);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n \n if (invertU) {\n sampleUV.x = 1.0 - sampleUV.x;\n }\n \n sampleUV.x += offsetU;\n vec4 texColor = texture2D(tEquirect, sampleUV);\n gl_FragColor = mapTexelToLinear(texColor);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\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}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if (mod(vLineDistance, totalSize) > dashSize) {\n discard;\n }\n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_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 <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_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 #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_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 reflectedLight.indirectDiffuse += texture2D(lightMap, vUv2).xyz * lightMapIntensity;\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 gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_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 <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\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 <specularmap_fragment>\n #include <emissivemap_fragment>\n reflectedLight.indirectDiffuse = getAmbientLightIrradiance(ambientLightColor);\n #ifdef DOUBLE_SIDED\n reflectedLight.indirectDiffuse += (gl_FrontFacing) ? vIndirectFront : vIndirectBack;\n #else\n reflectedLight.indirectDiffuse += vIndirectFront;\n #endif\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert(diffuseColor.rgb);\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = (gl_FrontFacing) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert(diffuseColor.rgb) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_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 <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_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 <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_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 #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_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 matcapColor = matcapTexelToLinear(matcapColor);\n #else\n vec4 matcapColor = vec4(1.0);\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_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 <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #ifndef FLAT_SHADED\n vNormal = normalize(transformedNormal);\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 #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\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 #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\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 <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 gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#include <normalmap_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize(transformedNormal);\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <normalmap_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}",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n uniform float clearCoat;\n uniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\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 <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #define ORIGINAL_NORMAL originalNormal\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #undef ORIGINAL_NORMAL\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#include <normalmap_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize(transformedNormal);\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <normalmap_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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || (defined(USE_NORMALMAP) && !defined(OBJECTSPACE_NORMALMAP))\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4(packNormalToRGB(normal), opacity);\n}",normal_vert:"#define NORMAL\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || (defined(USE_NORMALMAP) && !defined(OBJECTSPACE_NORMALMAP))\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\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 <normalmap_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize(transformedNormal);\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <normalmap_vertex>\n #include <logdepthbuf_vertex>\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || (defined(USE_NORMALMAP) && !defined(OBJECTSPACE_NORMALMAP))\n vViewPosition = - mvPosition.xyz;\n#endif\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 <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = (projectionMatrix[2][3] == - 1.0);\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}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n gl_FragColor = vec4(color, opacity * (1.0 - getShadowMask()));\n #include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <begin_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_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 <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_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 * vec4(0.0, 0.0, 0.0, 1.0);\n vec2 scale;\n scale.x = length(vec3(modelMatrix[0].x, modelMatrix[0].y, modelMatrix[0].z));\n scale.y = length(vec3(modelMatrix[1].x, modelMatrix[1].y, modelMatrix[1].z));\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = (projectionMatrix[2][3] == - 1.0);\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}",equicube_frag:"uniform sampler2D tEquirect;\nuniform int faceIndex;\nuniform bool invertU;\nuniform float offsetU;\nvarying vec2 vUv;\n#include <common>\nvoid main() {\n vec3 direction;\n vec2 uv = vUv * 2.0 - 1.0;\n if (faceIndex==0) {\n direction = vec3(1.0, -uv.y, -uv.x);\n } else if (faceIndex==1) {\n direction = vec3(-1.0, -uv.y, uv.x);\n } else if (faceIndex==2) {\n direction = vec3(uv.x, 1.0, uv.y);\n } else if (faceIndex==3) {\n direction = vec3(uv.x, -1.0, -uv.y);\n } else if (faceIndex==4) {\n direction = vec3(uv.x, -uv.y, 1.0);\n } else {\n direction = vec3(-uv.x, -uv.y, -1.0);\n }\n direction = normalize(direction);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n if (invertU) {\n sampleUV.x = 1.0 - sampleUV.x;\n }\n \n sampleUV.x += offsetU;\n gl_FragColor = texture2D(tEquirect, sampleUV);\n}",equicube_vert:"varying vec2 vUv;\n#include <common>\nvoid main() {\n vUv = uv;\n #include <begin_vertex>\n #include <project_vertex>\n}",mask_frag:"#define MASK\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nuniform mat4 projectionMatrix;\nuniform float opacity;\nuniform sampler2D depthTexture;\nuniform vec2 cameraNearFar;\nvarying vec3 vViewPosition;\nvarying vec4 projTexCoord;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(1.0);\n diffuseColor.a = opacity;\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n float depth = unpackRGBAToDepth(texture2DProj(depthTexture, projTexCoord));\n float viewZ;\n if (isOrtho(projectionMatrix))\n viewZ = -orthographicDepthToViewZ(depth,\n cameraNearFar.x, cameraNearFar.y);\n else\n viewZ = -perspectiveDepthToViewZ(depth,\n cameraNearFar.x, cameraNearFar.y);\n float depthTest = (vViewPosition.z > viewZ) ? 1.0 : 0.0;\n gl_FragColor = vec4(0.0, depthTest, 1.0, 0.0);\n}",mask_vert:"#define MASK\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nuniform mat4 textureMatrix;\nvarying vec3 vViewPosition;\nvarying vec4 projTexCoord;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_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 vViewPosition = -mvPosition.xyz;\n #include <worldpos_vertex>\n projTexCoord = textureMatrix * worldPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}",meshnode_frag:"#define NODE\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_node_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n#if defined(NODE_GEOMETRY) || defined(NODE_NEW_GEOMETRY) || defined(NODE_VECT_TRANSFORM) || defined(NODE_TEX_COORD) || defined(NODE_MATERIAL) || defined(NODE_MATERIAL_EXT) || defined(NODE_NORMAL_MAP) || defined(NODE_LAYER_WEIGHT) || defined(NODE_FRESNEL) || defined(NODE_BUMP) || defined(NODE_BSDF_GLASS) || defined(NODE_BSDF_PRINCIPLED)\nuniform mat4 invViewMatrix;\n#endif\n#if defined(NODE_GEOMETRY) || defined(NODE_NEW_GEOMETRY) || defined(NODE_LAYER_WEIGHT) || defined(NODE_FRESNEL) || defined(NODE_BSDF_GLASS) || defined(NODE_BSDF_PRINCIPLED)\nuniform mat4 projectionMatrix;\n#endif\n#if defined(NODE_VECT_TRANSFORM) || defined(NODE_TEX_COORD)\nuniform mat4 modelMatrix;\nuniform mat4 invModelMatrix;\n#endif\n#if defined(NODE_VECT_TRANSFORM) || defined(NODE_NORMAL_MAP) || defined(NODE_NORMAL_BUMP_MAX)\nuniform mat4 modelViewMatrix;\n#endif\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX) || defined(NODE_BUMP) || defined(NODE_PHY_SUN_SKY_ENV_MAX)\nvarying vec3 vWorldPosition;\n#endif\n#include <node_common_frag>\n#include <node_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n vec4 outgoingLight = vec4(0.0);\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <node_fragment>\n #if WORLD_NODES == 1\n outgoingLight.a = 1.0;\n #endif\n #ifdef ALPHATEST\n if (outgoingLight.a < ALPHATEST)\n discard;\n else\n outgoingLight.a = 1.0;\n #endif\n gl_FragColor = vec4(outgoingLight);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnode_vert:"#define NODE\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_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>\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX) || defined(NODE_BUMP) || defined(NODE_PHY_SUN_SKY_ENV_MAX) || defined(NODE_PHY_SUN_SKY_ENV_MAX)\nvarying vec3 vWorldPosition;\n#endif\n#include <node_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize(transformedNormal);\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 vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX) || defined(NODE_BUMP) || defined(NODE_PHY_SUN_SKY_ENV_MAX)\n vWorldPosition = worldPosition.xyz;\n#endif\n #include <node_vertex>\n}",normalmap_pars_vertex:"#if defined(USE_TANGENT)\nvarying vec4 vTangent;\n#endif",normalmap_vertex:"#if defined(USE_TANGENT)\n vTangent = tangent;\n#endif",lights_node_pars_fragment:"\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct NodeMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n vec3 refractionColor;\n float refractionRoughness;\n float refractionIOR;\n #ifdef PHYSICAL\n float specularRoughness;\n #ifndef STANDARD\n float clearCoat;\n float clearCoatRoughness;\n #endif\n #else\n float diffuseIntensity;\n float specularIntensity;\n float specularHardness;\n #endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\n#define BLENDER_SPECULAR_COEFFICIENT 0.08\nfloat shadeSpecPhong(vec3 normal, vec3 lightDir, vec3 viewDir, float hard)\n{\n float specFac;\n vec3 h = normalize(lightDir + viewDir);\n float rslt = max(dot(h, normal), 0.0);\n specFac = pow(rslt, hard);\n return specFac;\n}\nfloat shadeSpecHemi(vec3 normal, vec3 lightDir, vec3 viewDir, float hard)\n{\n float specFac;\n vec3 h = normalize(lightDir + viewDir);\n float rslt = 0.5 * max(dot(h, normal), 0.0) + 0.5;\n specFac = pow(rslt, hard);\n return specFac;\n}\nfloat clearCoatDHRApprox(const in float roughness, const in float dotNL) {\n return DEFAULT_SPECULAR_COEFFICIENT + (1.0 - DEFAULT_SPECULAR_COEFFICIENT) * (pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Node(const in RectAreaLight rectAreaLight,\n const in GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[4];\n rectCoords[0] = lightPos - halfWidth - halfHeight;\n 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_Node(const in IncidentLight directLight,\n const in GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n #ifdef PHYSICAL\n #ifndef STANDARD\n float coatDotNL = saturate(dot(geometry.coatNormal, directLight.direction));\n vec3 coatIrradiance = coatDotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n coatIrradiance *= PI;\n #endif\n #endif\n #ifndef STANDARD\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, coatDotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.directSpecular += (1.0 - clearCoatDHR) * irradiance\n * BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.normal,\n material.specularColor, material.specularRoughness);\n reflectedLight.directDiffuse += (1.0 - clearCoatDHR) * irradiance\n * BRDF_Diffuse_Lambert(material.diffuseColor);\n #ifndef STANDARD\n reflectedLight.directSpecular += coatIrradiance * material.clearCoat\n * BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.coatNormal,\n vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n #endif\n #else\n reflectedLight.directDiffuse += irradiance * material.diffuseIntensity * BRDF_Diffuse_Lambert(material.diffuseColor);\n reflectedLight.directSpecular += material.specularIntensity *\n shadeSpecPhong(geometry.normal, directLight.direction,\n geometry.viewDir, material.specularHardness) *\n directLight.color * material.specularColor;\n #endif\n}\nvoid RE_IndirectDiffuse_Node(const in vec3 irradiance, const in\n GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#ifdef PHYSICAL\n void RE_IndirectSpecular_Node(const in vec3 radiance, const in vec3 clearCoatRadiance,\n const in GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight) {\n #ifndef STANDARD\n float coatDotNL = saturate(dot(geometry.coatNormal, geometry.viewDir));\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(\n material.clearCoatRoughness, coatDotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n #ifdef MT_BLENDER\n vec3 specEnv = BRDF_Specular_GGX_Environment(geometry,\n material.specularColor, material.specularRoughness, 0);\n #elif defined(MT_MAX)\n float alphaEnv = pow2(pow2(material.specularRoughness));\n vec3 specEnv = material.specularColor / (1.0 - alphaEnv + PI * alphaEnv);\n #else\n vec3 specEnv = vec3(1.0);\n #endif\n reflectedLight.indirectSpecular += (1.0 - clearCoatDHR) * radiance * specEnv;\n #ifndef STANDARD\n #ifdef MT_BLENDER\n vec3 specEnvCC = BRDF_Specular_GGX_Environment(geometry,\n vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness, 1);\n #elif defined(MT_MAX)\n vec3 specEnvCC = BRDF_Specular_GGX_Environment(geometry,\n vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness, 1);\n #else\n vec3 specEnvCC = vec3(1.0);\n #endif\n reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * specEnvCC;\n #endif\n }\n#else\n #if defined(BLENDER_LIGHTS) && NUM_HEMI_LIGHTS > 0\n void RE_HemiSpec_Blender(const in HemisphereLight hemiLight,\n const in GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight)\n {\n reflectedLight.indirectSpecular += material.specularIntensity *\n shadeSpecHemi(geometry.normal, hemiLight.direction,\n geometry.viewDir, material.specularHardness) *\n hemiLight.skyColor * material.specularColor;\n }\n #endif\n#endif\nvoid RE_Refraction_Node(const vec3 refraction, const NodeMaterial material,\n inout vec3 refractedLight) {\n refractedLight += refraction * material.refractionColor;\n}\n#ifdef MT_BLENDER\n #define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n #define Material_Refraction_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.refractionRoughness)\n#elif defined(MT_MAX)\n #define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness * exp(0.35*(1.0-pow2(material.specularRoughness))))\n #define Material_Refraction_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.refractionRoughness * exp(0.35*(1.0-pow2(material.refractionRoughness))))\n#else\n #define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n #define Material_Refraction_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.refractionRoughness)\n#endif\n#define Material_ClearCoat_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.clearCoatRoughness)\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}\n#define RE_Direct RE_Direct_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_Direct_RectArea RE_Direct_RectArea_Node\n#ifdef PHYSICAL\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#endif\n#define RE_Refraction RE_Refraction_Node",node_common_frag:"#define LUMENS_PER_WATT 683.0\n#define MAX_ENV_COORDS_DIR 0\n#define MAX_ENV_COORDS_REFLECT 1\n#define MAX_ENV_COORDS_REFRACT 2\nvec4 nodeTexelToLinear(in vec4 color, in int sourceType) {\n if (sourceType == 1)\n return sRGBToLinear(color);\n else if (sourceType == 2)\n return RGBEToLinear(color);\n else\n return color;\n}\n#if defined(NODE_COMBHSV) || defined(NODE_SEPHSV) || defined(NODE_HUE_SAT) || defined(NODE_MIX_RGB_HSV) || defined(NODE_COLOR_CORRECTION_MAX) || defined(NODE_COMPOSITE_LAYER_MAX)\nvoid hsvToRGB(vec4 hsv, out vec4 outCol)\n{\n float i, f, p, q, t, h, s, v;\n vec3 rgb;\n h = hsv[0];\n s = hsv[1];\n v = hsv[2];\n if (s == 0.0)\n rgb = vec3(v, v, v);\n else {\n if (h == 1.0)\n h = 0.0;\n h *= 6.0;\n i = floor(h);\n f = h - i;\n rgb = vec3(f, f, f);\n p = v * (1.0 - s);\n q = v * (1.0 - (s * f));\n t = v * (1.0 - (s * (1.0 - f)));\n if (i == 0.0)\n rgb = vec3(v, t, p);\n else if (i == 1.0)\n rgb = vec3(q, v, p);\n else if (i == 2.0)\n rgb = vec3(p, v, t);\n else if (i == 3.0)\n rgb = vec3(p, q, v);\n else if (i == 4.0)\n rgb = vec3(t, p, v);\n else\n rgb = vec3(v, p, q);\n }\n outCol = vec4(rgb, hsv.w);\n}\nvoid rgbToHSV(vec4 rgb, out vec4 outCol)\n{\n float cmax, cmin, h, s, v, cdelta;\n vec3 c;\n cmax = max(rgb[0], max(rgb[1], rgb[2]));\n cmin = min(rgb[0], min(rgb[1], rgb[2]));\n cdelta = cmax - cmin;\n v = cmax;\n if (cmax != 0.0)\n s = cdelta / cmax;\n else {\n s = 0.0;\n h = 0.0;\n }\n if (s == 0.0)\n h = 0.0;\n else {\n c = (vec3(cmax, cmax, cmax) - rgb.xyz) / cdelta;\n if (rgb.x == cmax) h = c[2] - c[1];\n else if (rgb.y == cmax) h = 2.0 + c[0] - c[2];\n else h = 4.0 + c[1] - c[0];\n h /= 6.0;\n if (h < 0.0)\n h += 1.0;\n }\n outCol = vec4(h, s, v, rgb.w);\n}\n#endif\nbool isPerspective(const mat4 projMatrix)\n{\n return (projMatrix[3][3] == 0.0);\n}\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX)\nvec4 sampleEquirectangular(sampler2D map, vec3 reflectVec, mat3 uvTransform, int encoding)\n{\n reflectVec = normalize(reflectVec);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(reflectVec.x, reflectVec.z) * RECIPROCAL_PI2 + 0.5;\n sampleUV.y *= -1.0;\n const float seamWidth = 0.15;\n const float seamBiasFactor = -10.0;\n float seam = max(0.0, 1.0 - abs (reflectVec.x) / seamWidth) *\n clamp (1.0 - reflectVec.z / seamWidth, 0.0, 1.0);\n sampleUV = (uvTransform * vec3(sampleUV, 1.0)).xy;\n vec4 color = texture2D(map, sampleUV, seamBiasFactor * seam);\n color = nodeTexelToLinear(color, encoding);\n return color;\n}\n#endif\n#if defined(NODE_FRESNEL) || defined(NODE_LAYER_WEIGHT) || defined(NODE_FALLOFF_MAX) || defined(NODE_BSDF_GLASS) || defined(NODE_BSDF_PRINCIPLED)\nfloat fresnelReflection(const vec3 dir, const vec3 normal, const float ior) {\n float cosTheta = clamp(abs(dot(dir, normal)), -1.0, 1.0);\n float gSquared = pow2(ior) + pow2(cosTheta) - 1.0;\n if (gSquared < 0.0) return 1.0;\n float g = sqrt(gSquared);\n return 0.5 * pow2((g - cosTheta) / (g + cosTheta))\n * (1.0 + pow2(\n ((g + cosTheta) * cosTheta - 1.0) /\n ((g - cosTheta) * cosTheta + 1.0)\n ));\n}\n#endif\n#if defined(NODE_BITMAP_MAX) || defined(NODE_BITMAP_ENV_MAX) || defined(NODE_GRADIENT_RAMP_MAX)\nmat3 calcUvTransform(float uOffset, float vOffset, float uTiling, float vTiling, float wAngle)\n{\n if (abs(uOffset) < EPSILON && abs(vOffset) < EPSILON &&\n (abs(uTiling - 1.0)) < EPSILON && (abs(vTiling - 1.0)) < EPSILON &&\n abs(wAngle) < EPSILON)\n return mat3(1.0);\n vOffset = -vOffset;\n float sx = uTiling;\n float sy = vTiling;\n float tx = -uOffset;\n float ty = -vOffset;\n float cx = uOffset + 0.5;\n float cy = vOffset + 0.5;\n float c = cos(wAngle);\n float s = sin(wAngle);\n return mat3(sx * c, -sy * s, 0.0,\n sx * s, sy * c, 0.0,\n -sx * (c * cx + s * cy) + cx + tx, -sy * (- s * cx + c * cy) + cy + ty, 1.0);\n}\n#endif\n#if defined(NODE_TEX_NOISE) || defined(NODE_TEX_WAVE)\n#define NOISE_AMP_HACK 0.75\n#define NOISE_BLENDER_MEAN 0.78\n#define NOISE_SCALE_HACK 0.5\n#define noiseModulo(x) (x - floor(x * (1.0 / 289.0)) * 289.0)\nvec4 noisePermute(vec4 x) {\n return noiseModulo(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat noisePerlin(vec3 v) {\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n vec3 x3 = x0 - D.yyy;\n i = noiseModulo(i);\n vec4 p = noisePermute(noisePermute(noisePermute(i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n float n_ = 0.142857142857;\n vec3 ns = n_ * D.wyz - D.xzx;\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1),\n dot(p2, x2), dot(p3, x3)));\n}\nfloat noiseBlender(vec3 p) {\n return 0.5 * NOISE_AMP_HACK * (noisePerlin(NOISE_SCALE_HACK * vec3(p.x, p.y, p.z))) + 0.5;\n}\nfloat noiseSmooth(vec3 p, float octaveLenPerPixel, float falloffFactor,\n float dispersionFactor) {\n float mixFac = mix(1.0, smoothstep(0.0, 1.0, octaveLenPerPixel) * falloffFactor,\n dispersionFactor);\n return mix(noiseBlender(p), NOISE_BLENDER_MEAN, mixFac);\n}\n#define MAX_OCTAVES_NUM 16\nfloat noiseTurbulence(vec3 p, float octaves, float octaveLenPerPixel,\n float falloffFactor, float dispersionFactor) {\n float fscale = 1.0;\n float amp = 1.0;\n float sum = 0.0;\n octaves = clamp(octaves, 0.0, 16.0);\n int octavesInt = int(octaves);\n for (int i = 0; i <= MAX_OCTAVES_NUM; i++) {\n if (i > octavesInt) break;\n float t = noiseSmooth(fscale * p, octaveLenPerPixel, falloffFactor,\n dispersionFactor);\n sum += t * amp;\n amp *= 0.5;\n fscale *= 2.0;\n octaveLenPerPixel *= 2.0;\n }\n float octavesFrac = fract(octaves);\n float octavesCoeff = pow(2.0, float(octavesInt));\n if (octavesFrac != 0.0) {\n float t = noiseSmooth(fscale * p, octaveLenPerPixel, falloffFactor,\n dispersionFactor);\n float sum2 = sum + t * amp;\n sum *= octavesCoeff / (2.0 * octavesCoeff - 1.0);\n sum2 *= 2.0 * octavesCoeff / (4.0 * octavesCoeff - 1.0);\n return mix(sum, sum2, octavesFrac);\n } else {\n return sum * octavesCoeff / (2.0 * octavesCoeff - 1.0);\n }\n}\n#endif",node_add_shader_frag:"void node_add_shader(vec4 color1, vec4 color2, out vec4 outColor) {\n outColor.rgb = color1.rgb + color2.rgb;\n outColor.a = clamp(color1.a + color2.a, 0.0, 1.0);\n}",node_ambient_occlusion_frag:"void node_ambient_occlusion(vec4 color, out vec4 outColor)\n{\n outColor = color;\n}",node_attribute_frag:"void node_attribute(\n vec3 paramAttr,\n out vec4 outColor, out vec3 outVector, out float outFac)\n{\n outColor = vec4(paramAttr, 1.0);\n outVector = paramAttr;\n outFac = average(paramAttr);\n}",node_background_frag:"void node_background(vec4 color, float strength, out vec4 outColor)\n{\n outColor = strength * color;\n}",node_blackbody_frag:"void node_blackbody(float temp, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}",node_brightcontrast_frag:"\nvoid node_brightcontrast(vec4 color, float bright, float contrast, out vec4 outColor)\n{\n float bminc = bright - contrast * 0.5;\n outColor.r = max((1.0 + contrast) * color.r + bminc, 0.0);\n outColor.g = max((1.0 + contrast) * color.g + bminc, 0.0);\n outColor.b = max((1.0 + contrast) * color.b + bminc, 0.0);\n outColor.a = color.a;\n}",node_bsdf_anisotropic_frag:"void node_bsdf_anisotropic(\n vec4 color, float roughness, float anisotropy, float rotation, vec3 normal, vec3 tangent,\n out vec4 outColor)\n{\n outColor = color;\n}",node_bsdf_diffuse_frag:"\nvoid node_bsdf_diffuse(\n vec3 originalNormal,\n vec4 color, float roughness, vec3 normal,\n out vec4 outColor) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n NodeMaterial material;\n material.diffuseColor = color.rgb;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #define ORIGINAL_NORMAL originalNormal\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #undef ORIGINAL_NORMAL\n outColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse, 1.0);\n}",node_bsdf_glass_frag:"void node_bsdf_glass(\n vec3 originalNormal,\n vec4 color, float roughness, float ior, vec3 normal,\n out vec4 outColor) {\n normal = swizzleUpY(normal);\n vec3 normalWorld = normal;\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n NodeMaterial material;\n material.specularColor = color.rgb;\n material.specularRoughness = clamp(roughness, 0.04, 1.0);\n material.refractionColor = color.rgb;\n material.refractionIOR = ior;\n material.refractionRoughness = pow2(roughness);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0),\n vec3(0.0), vec3(0.0));\n #define ORIGINAL_NORMAL originalNormal\n #define USE_REFRACTED_LIGHT\n vec3 refractedLight = vec3(0.0);\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #undef ORIGINAL_NORMAL\n #undef USE_REFRACTED_LIGHT\n vec3 viewWorld;\n if (isPerspective(projectionMatrix))\n viewWorld = (invViewMatrix * vec4(-vViewPosition, 0.0)).xyz;\n else\n viewWorld = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n viewWorld = normalize(viewWorld);\n float fresnel = fresnelReflection(viewWorld, normalWorld, ior);\n outColor = vec4(mix(refractedLight, reflectedLight.directSpecular\n + reflectedLight.indirectSpecular, fresnel), 1.0);\n}",node_bsdf_glossy_frag:"\nvoid node_bsdf_glossy(\n vec3 originalNormal,\n vec4 color, float roughness, vec3 normal,\n out vec4 outColor) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = normalize((viewMatrix * vec4(normal.xyz, 0.0)).xyz);\n NodeMaterial material;\n material.specularColor = vec3(1.0);\n material.specularRoughness = clamp(roughness, 0.04, 1.0);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #define ORIGINAL_NORMAL originalNormal\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #undef ORIGINAL_NORMAL\n outColor = vec4(color.rgb * (reflectedLight.directSpecular\n + reflectedLight.indirectSpecular), 1.0);\n}",node_bsdf_hair_frag:"void node_bsdf_hair(vec4 color, float offset, float roughnessU, float roughnessV, vec3 tangent, out vec4 outColor)\n{\n outColor = color;\n}",node_bsdf_principled_frag:"\nvec3 tintFromColor(vec3 color) {\n\tfloat lum = dot(color, vec3(0.3, 0.6, 0.1));\n\treturn lum > 0.0 ? color / lum : vec3(1.0);\n}\nvec3 fresnelBlend(float ior, float fresnel, vec3 fresnelColor) {\n float fresnelFac = fresnelReflection(vec3(1.0, 0.0, 0.0), vec3(1.0, 0.0, 0.0), ior);\n\tfloat mixFac = saturate((fresnel - fresnelFac) / max(1e-8, 1.0 - fresnelFac));\n\treturn mix(fresnelColor, vec3(1.0), mixFac);\n}\n#define LOW_SPECULAR_FROM 0.00016\n#define LOW_SPECULAR_TO 0.0004\n#define SPEC_SLOPE_COEFF_FROM 2.4\n#define SPEC_SLOPE_COEFF_TO 2.8\nvoid node_bsdf_principled(\n vec3 originalNormal,\n vec4 baseColor, float subsurface, vec3 subsurfaceRadius, vec4 subsurfaceColor,\n float metallic, float specular, float specularTint, float roughness,\n float anisotropic, float anisotropicRotation, float sheen, float sheenTint,\n float clearcoat, float clearcoatRoughness, float ior,\n float transmission, float transmissionRoughness, vec4 emission, float alpha,\n vec3 normal, vec3 clearcoatNormal, vec3 tangent,\n out vec4 outColor) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n vec3 normalWorld = normal;\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n NodeMaterial material;\n metallic = clamp(metallic, 0.0, 1.0);\n float dielectric = 1.0 - metallic;\n transmission *= dielectric;\n material.diffuseColor = baseColor.rgb * dielectric;\n #ifdef STANDARD\n float dielReflCoeff = BLENDER_SPECULAR_COEFFICIENT;\n #else\n float dielReflCoeff = MAXIMUM_SPECULAR_COEFFICIENT * pow2(reflectivity);\n material.clearCoat = saturate(clearcoat);\n material.clearCoatRoughness = clamp(clearcoatRoughness, 0.04, 1.0);\n #endif\n vec3 dielRefl = dielReflCoeff * specular\n * mix(vec3(1.0), tintFromColor(baseColor.rgb), specularTint);\n material.specularColor = mix(dielRefl, baseColor.rgb, metallic);\n material.specularRoughness = clamp(roughness, 0.04, 1.0);\n vec3 viewWorld;\n if (isPerspective(projectionMatrix))\n viewWorld = (invViewMatrix * vec4(-vViewPosition, 0.0)).xyz;\n else\n viewWorld = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n viewWorld = normalize(viewWorld);\n float fresnel = fresnelReflection(viewWorld, normalWorld, ior);\n vec3 fresnelColor = mix(vec3(1.0), baseColor.rgb, specularTint);\n material.specularColor = mix(material.specularColor,\n fresnelBlend(ior, fresnel, fresnelColor) * fresnel, transmission);\n material.refractionColor = baseColor.rgb;\n material.refractionIOR = ior;\n material.refractionRoughness = pow2(roughness);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #define ORIGINAL_NORMAL originalNormal\n #define USE_REFRACTED_LIGHT\n vec3 refractedLight = vec3(0.0);\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #undef ORIGINAL_NORMAL\n #undef USE_REFRACTED_LIGHT\n vec3 spec = material.specularColor;\n vec3 spec2 = spec * spec;\n vec3 spec3 = spec2 * spec;\n vec3 lowSpecCoeff = clamp(spec, LOW_SPECULAR_FROM, LOW_SPECULAR_TO);\n vec3 lowSpecMixFac = (lowSpecCoeff - LOW_SPECULAR_FROM) / (LOW_SPECULAR_TO - LOW_SPECULAR_FROM);\n vec3 lowSpecSlopeCoeff = mix(vec3(SPEC_SLOPE_COEFF_FROM), vec3(SPEC_SLOPE_COEFF_TO),\n lowSpecMixFac);\n vec3 specSlope = pow(spec, 1.0 / (lowSpecSlopeCoeff + 7e2 * spec + 2e3 * spec2 + 1e5 * spec3));\n float specCoeffBlender = max(max(specSlope.x, specSlope.y), specSlope.z);\n vec3 outColor3 = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) * (1.0 - transmission)\n + reflectedLight.directSpecular + specCoeffBlender * reflectedLight.indirectSpecular\n + refractedLight * transmission * (1.0 - fresnel)\n + emission.rgb;\n outColor = vec4(outColor3, alpha);\n}\nvoid node_bsdf_principled(\n vec3 originalNormal,\n vec4 baseColor, float subsurface, vec3 subsurfaceRadius, vec4 subsurfaceColor,\n float metallic, float specular, float specularTint, float roughness,\n float anisotropic, float anisotropicRotation, float sheen, float sheenTint,\n float clearcoat, float clearcoatRoughness, float ior,\n float transmission, float transmissionRoughness,\n vec3 normal, vec3 clearcoatNormal, vec3 tangent,\n out vec4 outColor) {\n node_bsdf_principled(originalNormal, baseColor, subsurface, subsurfaceRadius,\n subsurfaceColor, metallic, specular, specularTint, roughness,\n anisotropic, anisotropicRotation, sheen, sheenTint, clearcoat,\n clearcoatRoughness, ior, transmission, transmissionRoughness,\n vec4(0.0, 0.0, 0.0, 1.0), 1.0, normal, clearcoatNormal, tangent,\n outColor);\n}",node_bsdf_refraction_frag:"#define BSDF_REFRACTION_GGX 0\n#define BSDF_REFRACTION_BECKMANN 1\n#define BSDF_REFRACTION_SHARP 2\nvoid node_bsdf_refraction(\n vec3 originalNormal, const int distribution,\n vec4 color, float roughness, float ior, vec3 normal,\n out vec4 outColor) {\n normal = swizzleUpY(normal);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n NodeMaterial material;\n material.refractionColor = color.rgb;\n material.refractionIOR = ior;\n if (distribution == BSDF_REFRACTION_SHARP) {\n material.refractionRoughness = 0.0;\n } else {\n material.refractionRoughness = pow2(roughness);\n }\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #define ORIGINAL_NORMAL originalNormal\n #define USE_REFRACTED_LIGHT\n vec3 refractedLight = vec3(0.0);\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #undef ORIGINAL_NORMAL\n #undef USE_REFRACTED_LIGHT\n outColor = vec4(refractedLight, 1.0);\n}",node_bsdf_toon_frag:"void node_bsdf_toon(\n vec4 color, float size, float smooth, vec3 normal, \n out vec4 outColor)\n{\n outColor = color;\n}",node_bsdf_translucent_frag:"void node_bsdf_translucent(vec4 color, vec3 normal, out vec4 outColor)\n{\n outColor = color;\n}",node_bsdf_transparent_frag:"\nvoid node_bsdf_transparent(vec4 color, out vec4 outColor)\n{\n float alpha = saturate(1.0 - dot(color.rgb, vec3(0.333333)));\n outColor = vec4(0.0, 0.0, 0.0, alpha);\n}",node_bsdf_velvet_frag:"void node_bsdf_velvet(vec4 color, float sigma, vec3 normal, out vec4 outColor)\n{\n outColor = color;\n}",node_bump_frag:"\nvoid node_bump(\n const int invert,\n float strength, float bumpDist, float height, vec3 normal,\n out vec3 outNormal)\n{\n vec3 position = swizzleUpZ(vWorldPosition);\n if (invert == 1)\n bumpDist *= -1.0;\n vec3 dPdx = dFdx(position);\n vec3 dPdy = dFdy(position);\n float dHdx = dFdx(height);\n float dHdy = dFdy(height);\n vec3 tanX = cross(dPdy, normal);\n vec3 tanY = cross(normal, dPdx);\n vec3 surfaceGrad = dHdx * tanX + dHdy * tanY;\n float dotPosTanX = dot(dPdx, tanX);\n outNormal = normalize(normal * abs(dotPosTanX) - surfaceGrad * bumpDist * sign(dotPosTanX));\n outNormal = normalize(mix(normal, outNormal, max(0.0, strength)));\n}",node_camera_frag:"\nvoid node_camera(\n vec3 viewPos, const int invCamZ,\n out vec3 outViewVector, out float outViewZDepth, out float outViewDistance)\n{\n viewPos = -viewPos;\n if (invCamZ == 1)\n viewPos.z = -viewPos.z;\n outViewVector = normalize(viewPos);\n outViewZDepth = abs(viewPos.z);\n outViewDistance = length(viewPos);\n}",node_combhsv_frag:"\nvoid node_combhsv(float h, float s, float v, out vec4 col)\n{\n hsvToRGB(vec4(h, s, v, 1.0), col);\n}",node_combrgb_frag:"\nvoid node_combrgb(float r, float g, float b, out vec4 col)\n{\n col = vec4(r, g, b, 1.0);\n}",node_combxyz_frag:"void node_combxyz(float x, float y, float z, out vec3 outVector)\n{\n outVector = vec3(x, y, z);\n}",node_curve_rgb_frag:"\nvoid node_curve_rgb(sampler2D curveData, float fac, vec4 col, out vec4 outCol)\n{\n outCol.r = texture2D(curveData, vec2(texture2D(curveData, vec2(col.r, 0.0)).a, 0.0)).r;\n outCol.g = texture2D(curveData, vec2(texture2D(curveData, vec2(col.g, 0.0)).a, 0.0)).g;\n outCol.b = texture2D(curveData, vec2(texture2D(curveData, vec2(col.b, 0.0)).a, 0.0)).b;\n outCol = mix(col, outCol, fac);\n outCol.a = col.a;\n}",node_curve_vec_frag:"\nvoid node_curve_vec(sampler2D curveData, float fac, vec3 vec, out vec3 outVec)\n{\n outVec.x = texture2D(curveData, vec2((vec.x + 1.0) * 0.5, 0.0)).x;\n outVec.y = texture2D(curveData, vec2((vec.y + 1.0) * 0.5, 0.0)).y;\n outVec.z = texture2D(curveData, vec2((vec.z + 1.0) * 0.5, 0.0)).z;\n outVec = mix(vec, outVec * 2.0 - vec3(1.0), fac);\n}",node_emission_frag:"\nvoid node_emission(vec4 color, float strength, out vec4 outColor)\n{\n outColor = strength * color;\n}",node_fresnel_frag:"void node_fresnel(vec3 viewPos, float IOR, vec3 normal, out float fac)\n{\n vec3 worldDir;\n if (isPerspective(projectionMatrix))\n worldDir = (invViewMatrix * vec4(-viewPos, 0.0)).xyz;\n else\n worldDir = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n \n worldDir = normalize(swizzleUpZ(worldDir));\n float eta = max(IOR, 0.00001);\n fac = fresnelReflection(worldDir, normal, (gl_FrontFacing) ? eta : 1.0 / eta);\n}",node_gamma_frag:"\nvoid node_gamma(vec4 col, float gamma, out vec4 outCol)\n{\n outCol = col;\n if (col.r > 0.0)\n outCol.r = powCompat(col.r, gamma);\n if (col.g > 0.0)\n outCol.g = powCompat(col.g, gamma);\n if (col.b > 0.0)\n outCol.b = powCompat(col.b, gamma);\n}",node_geometry_frag:"\nvoid node_geometry(\n vec3 viewPos, vec3 viewNorm, vec3 orcoIn, vec2 uvIn, vec4 vcolIn,\n out vec3 global, out vec3 local, out vec3 view, out vec3 orco, out vec3 uv,\n out vec3 normal, out vec4 vcol, out float vcolAlpha, out float frontBack)\n{\n local = -viewPos;\n view = (projectionMatrix[3][3] == 0.0) ? normalize(local) : vec3(0.0, 0.0, -1.0);\n global = (invViewMatrix * vec4(local, 1.0)).xyz;\n global = swizzleUpZ(global);\n orco = global;\n uvIn.y = 1.0 - uvIn.y;\n uv = vec3(uvIn * 2.0 - vec2(1.0, 1.0), 0.0);\n normal = normalize(invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n normal = swizzleUpZ(normal);\n vcol = sRGBToLinear(vec4(vcolIn.rgb, 1.0));\n vcolAlpha = vcolIn.a;\n frontBack = (gl_FrontFacing) ? 1.0 : 0.0;\n}",node_gradient_ramp_max_frag:"#define GRAD_TYPE_4_CORNER 0\n#define GRAD_TYPE_BOX 1\n#define GRAD_TYPE_DIAGONAL 2\n#define GRAD_TYPE_LIGHTING 3\n#define GRAD_TYPE_LINEAR 4\n#define GRAD_TYPE_MAPPED 5\n#define GRAD_TYPE_NORMAL 6\n#define GRAD_TYPE_PONG 7\n#define GRAD_TYPE_RADIAL 8\n#define GRAD_TYPE_SPIRAL 9\n#define GRAD_TYPE_SWEEP 10\n#define GRAD_TYPE_TARTAN 11\nvoid node_gradient_ramp_max(\n sampler2D gradientData, int gradientType, vec2 uvIn, vec3 originalNormal,\n vec3 viewPos,\n vec4 sourceMap, float uOffset, float vOffset, float uTiling, float vTiling, float wAngle,\n out vec4 outCol)\n{\n uvIn = (calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle) * vec3(uvIn, 1.0)).xy;\n float coord = uvIn.x;\n uvIn.y = 1.0 - uvIn.y;\n uvIn = fract(uvIn);\n if (gradientType == GRAD_TYPE_4_CORNER) {\n coord = pow(uvIn.x, 2.0);\n } else if (gradientType == GRAD_TYPE_BOX) {\n vec2 boxUv = abs(uvIn - vec2(0.5)) * 2.0;\n coord = max(boxUv.x, boxUv.y);\n } else if (gradientType == GRAD_TYPE_DIAGONAL) {\n coord = abs(uvIn.x - uvIn.y) * sqrt(2.0);\n } else if (gradientType == GRAD_TYPE_LIGHTING) {\n IncidentLight directLight;\n GeometricContext geometry;\n geometry.position = -viewPos;\n vec3 irr = vec3(0.0);\n #if (NUM_POINT_LIGHTS > 0)\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n getPointDirectLightIrradiance(pointLights[i], geometry, directLight);\n float dotNL = saturate(dot(originalNormal, directLight.direction));\n irr += dotNL * directLight.color;\n }\n #endif\n #if (NUM_SPOT_LIGHTS > 0)\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n getSpotDirectLightIrradiance(spotLights[i], geometry, directLight);\n float dotNL = saturate(dot(originalNormal, directLight.direction));\n irr += dotNL * directLight.color;\n }\n #endif\n #if (NUM_DIR_LIGHTS > 0)\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n getDirectionalDirectLightIrradiance(directionalLights[i], geometry, directLight);\n float dotNL = saturate(dot(originalNormal, directLight.direction));\n irr += dotNL * directLight.color;\n }\n #endif\n #if defined(PHYSICALLY_CORRECT_LIGHTS)\n irr /= PI;\n #endif\n vec3 ambIrr = getAmbientLightIrradiance(ambientLightColor);\n #if !defined(PHYSICALLY_CORRECT_LIGHTS)\n ambIrr /= PI;\n #endif\n irr += ambIrr;\n coord = (irr.x + irr.y + irr.z) / 3.0;\n } else if (gradientType == GRAD_TYPE_LINEAR) {\n coord = uvIn.x;\n } else if (gradientType == GRAD_TYPE_MAPPED) {\n coord = (sourceMap.x + sourceMap.y + sourceMap.z) / 3.0;\n } else if (gradientType == GRAD_TYPE_NORMAL) {\n float angle = acos(clamp(dot(originalNormal, normalize(viewPos)), -1.0, 1.0));\n float k = 100.0;\n coord = 1.0 - sin(pow2(k) - k * sqrt(pow2(k) - pow2(angle)));\n } else if (gradientType == GRAD_TYPE_PONG) {\n float y = min(uvIn.y, uvIn.x);\n float x = max(uvIn.y, uvIn.x);\n coord = y / x;\n } else if (gradientType == GRAD_TYPE_RADIAL) {\n coord = length(uvIn - vec2(0.5)) * 2.0;\n } else if (gradientType == GRAD_TYPE_SPIRAL) {\n vec2 uvSpiral = mat2(0.0, 1.0, -1.0, 0.0) * (uvIn - vec2(0.5));\n coord = atan(uvSpiral.y, uvSpiral.x) / PI2 + 0.5;\n } else if (gradientType == GRAD_TYPE_SWEEP) {\n coord = atan(uvIn.x, uvIn.y) / PI_HALF;\n } else if (gradientType == GRAD_TYPE_TARTAN) {\n vec2 uvTartan = abs(uvIn - vec2(0.5));\n coord = 1.0 - min(uvTartan.x, uvTartan.y) * 2.0;\n }\n outCol = texture2D(gradientData, vec2(coord, 0.0));\n}",node_hair_info_frag:"void node_hair_info(\n out float isStrand, out float intercept, out float thickness, out vec3 tangentNormal)\n{\n isStrand = 0.0;\n intercept = 0.0;\n thickness = 0.0;\n tangentNormal = vec3(0.0);\n}",node_holdout_frag:"void node_holdout(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}",node_hue_sat_frag:"\nvoid node_hue_sat(float hue, float sat, float value, float fac, vec4 col, out vec4 outCol)\n{\n vec4 hsv;\n rgbToHSV(col, hsv);\n hsv[0] += (hue - 0.5);\n if (hsv[0] > 1.0) hsv[0] -= 1.0; else if (hsv[0] < 0.0) hsv[0] += 1.0;\n hsv[1] *= sat;\n if (hsv[1] > 1.0) hsv[1] = 1.0; else if (hsv[1] < 0.0) hsv[1] = 0.0;\n hsv[2] *= value;\n if (hsv[2] > 1.0) hsv[2] = 1.0; else if (hsv[2] < 0.0) hsv[2] = 0.0;\n hsvToRGB(hsv, outCol);\n outCol = mix(col, outCol, fac);\n}",node_invert_frag:"\nvoid node_invert(float fac, vec4 col, out vec4 outCol)\n{\n outCol.xyz = mix(col.xyz, vec3(1.0, 1.0, 1.0) - col.xyz, fac);\n outCol.w = col.w;\n}",node_lamp_frag:"\nvoid node_lamp(out vec4 outCol, out vec3 outLv, out float outDist, out vec4 outShadow, out float outVisibility)\n{\n outCol = vec4(0.0);\n outLv = vec3(0.0);\n outDist = 0.0;\n outShadow = vec4(0.0);\n outVisibility = 1.0;\n}",node_layer_weight_frag:"\nvoid node_layer_weight(vec3 viewPos, float blend, vec3 normal, out float fresnel, out float facing)\n{\n vec3 worldDir;\n if (isPerspective(projectionMatrix))\n worldDir = (invViewMatrix * vec4(-viewPos, 0.0)).xyz;\n else\n worldDir = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n \n worldDir = normalize(swizzleUpZ(worldDir));\n float eta = max(1.0 - blend, EPSILON);\n fresnel = fresnelReflection(worldDir, normal, (gl_FrontFacing) ? 1.0 / eta : eta);\n facing = abs(dot(worldDir, normal));\n if (blend != 0.5) {\n blend = clamp(blend, 0.0, 1.0 - EPSILON);\n blend = (blend < 0.5) ? blend * 2.0 : 0.5 / (1.0 - blend);\n facing = pow(facing, blend);\n }\n facing = 1.0 - facing;\n}",node_light_falloff_frag:"void node_light_falloff(\n float strength, float smooth,\n out float quadratic, out float linear, out float constant)\n{\n quadratic = 1.0;\n linear = 1.0;\n constant = 1.0;\n}",node_light_path_frag:"void node_light_path(\n out float isCameraRay, out float isShadowRay, out float isDiffuseRay, \n out float isGlossyRay, out float isSingularRay, out float isReflectionRay,\n out float isTransmissionRay, out float rayLength, out float rayDepth, \n out float diffuseDepth, out float glossyDepth, out float transparentDepth, \n out float transmissionDepth)\n{\n #if LIGHT_PATH_IS_CAM_RAY\n isCameraRay = 1.0;\n #else\n isCameraRay = 0.0;\n #endif\n isShadowRay = 0.0;\n isDiffuseRay = 0.0;\n isGlossyRay = 0.0;\n isSingularRay = 0.0;\n isReflectionRay = 0.0;\n isTransmissionRay = 0.0;\n rayLength = 1.0;\n rayDepth = 1.0;\n diffuseDepth = 1.0;\n glossyDepth = 1.0;\n transparentDepth = 1.0; \n transmissionDepth = 1.0;\n}",node_mapping_frag:"\nvoid node_mapping(mat4 mat, vec3 minVec, vec3 maxVec, int useMin, int useMax, vec3 vec, out vec3 outVec)\n{\n outVec = (mat * vec4(vec, 1.0)).xyz;\n if (useMin == 1)\n outVec = max(outVec, minVec);\n if (useMax == 1)\n outVec = min(outVec, maxVec);\n}",node_material_ext_frag:"\nvoid node_material_ext(\n const int useDiffuse, const int useSpec, const int invertNormal,\n const float specularIntensity, const float specularHardness,\n const int useShadeless, const int normalBlendWorld,\n const vec4 diffuseColor, const vec4 specularColor, const float diffuseIntensity,\n vec3 normal, const vec4 mirror, const float ambient,\n const float emit, const float specularAlpha, const float reflectivity,\n const float alpha, const float translucency,\n out vec4 outColor, out float outAlpha, out vec3 outNormal, out vec4 outDiffuse,\n out vec4 outSpec, out vec4 outAO)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n vec3 diffuse, specular;\n if (useShadeless == 0) {\n NodeMaterial material;\n if (useDiffuse == 1)\n material.diffuseColor = diffuseColor.rgb;\n else\n material.diffuseColor = vec3(0.0);\n if (useSpec == 1)\n material.specularColor = specularColor.rgb;\n else\n material.specularColor = vec3(0.0);\n material.diffuseIntensity = diffuseIntensity;\n material.specularHardness = specularHardness;\n material.specularIntensity = specularIntensity;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n vec3 totalEmissiveRadiance = emit * material.diffuseColor;\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n } else {\n diffuse = diffuseColor.rgb;\n specular = vec3(0.0);\n }\n outColor = vec4(diffuse + specular, 1.0);\n outAlpha = alpha - saturate(maxFromRGB(specular) * specularAlpha) * (alpha - 1.0);\n outNormal = normal;\n outDiffuse = vec4(diffuse, 1.0);\n outSpec = vec4(specular, 1.0);\n outAO = vec4(1.0, 1.0, 1.0, 1.0);\n}",node_material_frag:"\nvoid node_material(\n const int useDiffuse, const int useSpec, const int invertNormal,\n const float specularIntensity, const float specularHardness,\n const float ambient, const float emit, const float alpha,\n const int useShadeless, const int normalBlendWorld,\n const vec4 diffuseColor, const vec4 specularColor, const float diffuseIntensity,\n vec3 normal,\n out vec4 outColor, out float outAlpha, out vec3 outNormal)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n vec3 diffuse, specular;\n if (useShadeless == 0) {\n NodeMaterial material;\n if (useDiffuse == 1)\n material.diffuseColor = diffuseColor.rgb;\n else\n material.diffuseColor = vec3(0.0);\n if (useSpec == 1)\n material.specularColor = specularColor.rgb;\n else\n material.specularColor = vec3(0.0);\n material.diffuseIntensity = diffuseIntensity;\n material.specularHardness = specularHardness;\n material.specularIntensity = specularIntensity;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n vec3 totalEmissiveRadiance = emit * material.diffuseColor;\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n } else {\n diffuse = diffuseColor.rgb;\n specular = vec3(0.0);\n }\n outColor = vec4(diffuse + specular, 1.0);\n outAlpha = alpha;\n outNormal = normalize(invViewMatrix * vec4(normal, 0.0)).rgb;\n outNormal = swizzleUpZ(outNormal);\n}",node_math_frag:"\nvoid node_math_add(float val1, float val2, out float outVal)\n{\n outVal = val1 + val2;\n}\nvoid node_math_subtract(float val1, float val2, out float outVal)\n{\n outVal = val1 - val2;\n}\nvoid node_math_multiply(float val1, float val2, out float outVal)\n{\n outVal = val1 * val2;\n}\nvoid node_math_divide(float val1, float val2, out float outVal)\n{\n if (val2 == 0.0)\n outVal = 0.0;\n else\n outVal = val1 / val2;\n}\nvoid node_math_sine(float val, float val2, out float outVal)\n{\n outVal = sin(val);\n}\nvoid node_math_cosine(float val, float val2, out float outVal)\n{\n outVal = cos(val);\n}\nvoid node_math_tangent(float val, float val2, out float outVal)\n{\n outVal = tan(val);\n}\nvoid node_math_arcsine(float val, float val2, out float outVal)\n{\n if (val <= 1.0 && val >= -1.0)\n outVal = asin(val);\n else\n outVal = 0.0;\n}\nvoid node_math_arccosine(float val, float val2, out float outVal)\n{\n if (val <= 1.0 && val >= -1.0)\n outVal = acos(val);\n else\n outVal = 0.0;\n}\nvoid node_math_arctangent(float val, float val2, out float outVal)\n{\n outVal = atan(val);\n}\nvoid node_math_arctan2(float val, float val2, out float outVal)\n{\n outVal = atan(val, val2);\n}\nvoid node_math_power(float val1, float val2, out float outVal)\n{\n if (val1 >= 0.0)\n outVal = powCompat(val1, val2);\n else {\n float val2_mod_1 = mod(abs(val2), 1.0);\n if (val2_mod_1 > 0.999 || val2_mod_1 < 0.001)\n outVal = powCompat(val1, floor(val2 + 0.5));\n else\n outVal = 0.0;\n }\n}\nvoid node_math_logarithm(float val1, float val2, out float outVal)\n{\n if (val1 > 0.0 && val2 > 0.0)\n outVal = log2(val1) / log2(val2);\n else\n outVal = 0.0;\n}\nvoid node_math_sqrt(float val1, float val2, out float outVal)\n{\n outVal = sqrt(val1);\n}\nvoid node_math_maximum(float val1, float val2, out float outVal)\n{\n outVal = max(val1, val2);\n}\nvoid node_math_minimum(float val1, float val2, out float outVal)\n{\n outVal = min(val1, val2);\n}\nvoid node_math_round(float val1, float val2, out float outVal)\n{\n outVal = floor(val1 + 0.5);\n}\nvoid node_math_floor(float val1, float val2, out float outVal)\n{\n outVal = floor(val1);\n}\nvoid node_math_ceil(float val1, float val2, out float outVal)\n{\n outVal = ceil(val1);\n}\nvoid node_math_fract(float val1, float val2, out float outVal)\n{\n outVal = fract(val1);\n}\nvoid node_math_less_than(float val1, float val2, out float outVal)\n{\n if (val1 < val2)\n outVal = 1.0;\n else\n outVal = 0.0;\n}\nvoid node_math_greater_than(float val1, float val2, out float outVal)\n{\n if (val1 > val2)\n outVal = 1.0;\n else\n outVal = 0.0;\n}\nvoid node_math_modulo(float val1, float val2, out float outVal)\n{\n if (val2 == 0.0)\n outVal = 0.0;\n else\n outVal = mod(val1, val2);\n outVal = (val1 > 0.0) ? outVal : outVal - val2;\n}\nvoid node_math_absolute(float val1, float val2, out float outVal)\n{\n outVal = abs(val1);\n}",node_mix_rgb_frag:"\nvoid node_mix_rgb_mix(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_add(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 + col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_multiply(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 * col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_screen(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = vec4(1.0) - (vec4(facm) + fac * (vec4(1.0) - col2)) * (vec4(1.0) - col1);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_overlay(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n if (outCol.r < 0.5)\n outCol.r *= facm + 2.0 * fac * col2.r;\n else\n outCol.r = 1.0 - (facm + 2.0 * fac * (1.0 - col2.r)) * (1.0 - outCol.r);\n if (outCol.g < 0.5)\n outCol.g *= facm + 2.0 * fac * col2.g;\n else\n outCol.g = 1.0 - (facm + 2.0 * fac * (1.0 - col2.g)) * (1.0 - outCol.g);\n if (outCol.b < 0.5)\n outCol.b *= facm + 2.0 * fac * col2.b;\n else\n outCol.b = 1.0 - (facm + 2.0 * fac * (1.0 - col2.b)) * (1.0 - outCol.b);\n}\nvoid node_mix_rgb_subtract(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 - col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_divide(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n if (col2.r != 0.0) outCol.r = facm * outCol.r + fac * outCol.r / col2.r;\n if (col2.g != 0.0) outCol.g = facm * outCol.g + fac * outCol.g / col2.g;\n if (col2.b != 0.0) outCol.b = facm * outCol.b + fac * outCol.b / col2.b;\n}\nvoid node_mix_rgb_difference(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, abs(col1 - col2), fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_darken(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol.rgb = min(col1.rgb, col2.rgb * fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_lighten(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol.rgb = max(col1.rgb, col2.rgb * fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_dodge(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = col1;\n if (outCol.r != 0.0) {\n float tmp = 1.0 - fac * col2.r;\n if (tmp <= 0.0)\n outCol.r = 1.0;\n else if ((tmp = outCol.r / tmp) > 1.0)\n outCol.r = 1.0;\n else\n outCol.r = tmp;\n }\n if (outCol.g != 0.0) {\n float tmp = 1.0 - fac * col2.g;\n if (tmp <= 0.0)\n outCol.g = 1.0;\n else if ((tmp = outCol.g / tmp) > 1.0)\n outCol.g = 1.0;\n else\n outCol.g = tmp;\n }\n if (outCol.b != 0.0) {\n float tmp = 1.0 - fac * col2.b;\n if (tmp <= 0.0)\n outCol.b = 1.0;\n else if ((tmp = outCol.b / tmp) > 1.0)\n outCol.b = 1.0;\n else\n outCol.b = tmp;\n }\n}\nvoid node_mix_rgb_burn(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float tmp, facm = 1.0 - fac;\n outCol = col1;\n tmp = facm + fac * col2.r;\n if (tmp <= 0.0)\n outCol.r = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.r) / tmp)) < 0.0)\n outCol.r = 0.0;\n else if (tmp > 1.0)\n outCol.r = 1.0;\n else\n outCol.r = tmp;\n tmp = facm + fac * col2.g;\n if (tmp <= 0.0)\n outCol.g = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.g) / tmp)) < 0.0)\n outCol.g = 0.0;\n else if (tmp > 1.0)\n outCol.g = 1.0;\n else\n outCol.g = tmp;\n tmp = facm + fac * col2.b;\n if (tmp <= 0.0)\n outCol.b = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.b) / tmp)) < 0.0)\n outCol.b = 0.0;\n else if (tmp > 1.0)\n outCol.b = 1.0;\n else\n outCol.b = tmp;\n}\n#ifdef NODE_MIX_RGB_HSV\nvoid node_mix_rgb_hue(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2, tmp;\n rgbToHSV(col2, hsv2);\n if (hsv2.y != 0.0) {\n rgbToHSV(outCol, hsv);\n hsv.x = hsv2.x;\n hsvToRGB(hsv, tmp);\n outCol = mix(outCol, tmp, fac);\n outCol.a = col1.a;\n }\n}\nvoid node_mix_rgb_saturation(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2;\n rgbToHSV(outCol, hsv);\n if (hsv.y != 0.0) {\n rgbToHSV(col2, hsv2);\n hsv.y = facm * hsv.y + fac * hsv2.y;\n hsvToRGB(hsv, outCol);\n }\n}\nvoid node_mix_rgb_value(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n vec4 hsv, hsv2;\n rgbToHSV(col1, hsv);\n rgbToHSV(col2, hsv2);\n hsv.z = facm * hsv.z + fac * hsv2.z;\n hsvToRGB(hsv, outCol);\n}\nvoid node_mix_rgb_color(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2, tmp;\n rgbToHSV(col2, hsv2);\n if (hsv2.y != 0.0) {\n rgbToHSV(outCol, hsv);\n hsv.x = hsv2.x;\n hsv.y = hsv2.y;\n hsvToRGB(hsv, tmp);\n outCol = mix(outCol, tmp, fac);\n outCol.a = col1.a;\n }\n}\n#endif\nvoid node_mix_rgb_soft_light(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n vec4 one = vec4(1.0);\n vec4 scr = one - (one - col2) * (one - col1);\n outCol = facm * col1 + fac * ((one - col1) * col2 * col1 + col1 * scr);\n}\nvoid node_mix_rgb_linear_light(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = col1 + fac * (2.0 * (col2 - vec4(0.5)));\n}",node_mix_shader_frag:"\nvoid node_mix_shader(int transpShaderNum,\n float fac, vec4 color1, vec4 color2, out vec4 outColor)\n{\n if (transpShaderNum == 0)\n color1.rgb = color2.rgb;\n else if (transpShaderNum == 1)\n color2.rgb = color1.rgb;\n fac = clamp(fac, 0.0, 1.0);\n outColor = mix(color1, color2, fac);\n}",node_new_geometry_frag:"void node_new_geometry(\n vec3 viewPos, vec3 viewNorm, \n out vec3 position, out vec3 normal, out vec3 tangent,\n out vec3 trueNormal, out vec3 incoming, out vec3 parametric,\n out float backfacing, out float pointiness)\n{\n position = (invViewMatrix * vec4(-viewPos, 1.0)).xyz;\n position = swizzleUpZ(position);\n vec4 viewDir = isOrtho(projectionMatrix) ? vec4(0.0, 0.0, -1.0, 0.0) : vec4(normalize(-viewPos), 0.0);\n viewDir = invViewMatrix * viewDir;\n vec3 incomingVec = -swizzleUpZ(viewDir.xyz);\n #if WORLD_NODES == 1\n normal = incomingVec;\n #else\n normal = normalize(invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n normal = swizzleUpZ(normal);\n #endif\n tangent = vec3(0.0);\n trueNormal = normal;\n incoming = incomingVec;\n parametric = vec3(0.0);\n backfacing = (gl_FrontFacing) ? 0.0 : 1.0;\n #if WORLD_NODES == 1\n pointiness = 0.0;\n #else\n pointiness = 0.5;\n #endif\n}",node_normal_frag:"\nvoid node_normal(vec3 norParam, vec3 norIn, out vec3 norOut, out float dotOut)\n{\n norOut = norParam;\n dotOut = dot(normalize(norIn), norParam);\n}",node_normal_map_frag:"\nvoid node_normal_map(vec4 tangent, vec3 normal, float strength, vec4 normalColor, out vec3 normalOut)\n{\n#ifdef DOUBLE_SIDED\n normal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n#endif\n vec3 normalTex = (normalColor.xyz * 2.0 - 1.0);\n vec4 viewTangent = vec4(normalize((modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz), tangent.w);\n vec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\n normalOut = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n + normalTex.z * normal);\n normalOut = mix(normal, normalOut, strength);\n normalOut = normalize((invViewMatrix * vec4(normalOut, 0.0)).xyz);\n normalOut = swizzleUpZ(normalOut);\n}",node_object_info_frag:"\nvoid node_object_info(out vec3 location, out float objIndex, out float matIndex, out float random) {\n #if WORLD_NODES == 1\n location = vec3(0.0);\n objIndex = 0.0;\n matIndex = 0.0;\n random = 0.0;\n #else\n location = vec3(0.0);\n objIndex = 0.0;\n matIndex = 0.0;\n random = 0.5;\n #endif\n}",node_output_frag:"\nvoid node_output(vec4 rgb, float alpha, out vec4 outgoingLight)\n{\n outgoingLight = vec4(rgb.rgb, alpha);\n}",node_output_lamp_frag:"void node_output_lamp(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}",node_output_material_frag:"\nvoid node_output_material(vec4 surface, vec4 volume, float displacement, out vec4 outgoingLight) {\n outgoingLight = surface + volume;\n}\nvoid node_output_material(vec4 surface, vec4 volume, vec3 displacement, out vec4 outgoingLight) {\n outgoingLight = surface + volume;\n}",node_output_world_frag:"void node_output_world(vec4 surface, vec4 volume, out vec4 outgoingLight)\n{\n outgoingLight = surface;\n}",node_particle_info_frag:"\nvoid node_particle_info(out float index, out float age, out float lifeTime, out vec3 location,\n out float size, out vec3 velocity, out vec3 angularVelocity) {\n #if WORLD_NODES == 1\n index = 0.0;\n age = 0.0;\n lifeTime = 0.0;\n location = vec3(0.0);\n size = 0.0;\n velocity = vec3(0.0);\n angularVelocity = vec3(0.0);\n #else\n index = 0.0;\n age = 0.0;\n lifeTime = 0.0;\n location = vec3(0.0);\n size = 0.0;\n velocity = vec3(0.0);\n angularVelocity = vec3(0.0);\n #endif\n}",node_rgb_frag:"\nuniform vec4 nodeRGB[NODE_RGB_NUM];\nvoid node_rgb(vec4 color, out vec4 outColor)\n{\n outColor = color;\n}",node_rgbtobw_frag:"\nvoid node_rgbtobw(vec4 color, out float outVal) {\n outVal = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n}",node_script_frag:"void node_script(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}",node_sephsv_frag:"\nvoid node_sephsv(vec4 col, out float h, out float s, out float v)\n{\n vec4 hsv;\n rgbToHSV(col, hsv);\n h = hsv[0];\n s = hsv[1];\n v = hsv[2];\n}",node_seprgb_frag:"\nvoid node_seprgb(vec4 col, out float r, out float g, out float b)\n{\n r = col.r;\n g = col.g;\n b = col.b;\n}",node_sepxyz_frag:"void node_sepxyz(vec3 vector, out float x, out float y, out float z)\n{\n x = vector.x;\n y = vector.y;\n z = vector.z;\n}",node_shadertorgb_frag:"void node_shadertorgb(vec4 shader, out vec4 color, out float alpha) {\n color = vec4(shader.rgb, 1.0);\n alpha = shader.a;\n}",node_squeeze_frag:"\nvoid node_squeeze(float val, float width, float center, out float outVal)\n{\n outVal = 1.0 / (1.0 + pow(2.71828183, -((val - center) * width)));\n}",node_subsurface_scattering_frag:"void node_subsurface_scattering(\n vec4 color, float scale, vec3 radius, float sharpen, float textureBlur, vec3 normal,\n out vec4 outColor)\n{\n outColor = color;\n}",node_tangent_frag:"void node_tangent(out vec3 outTangent)\n{\n outTangent = vec3(0.0);\n}",node_tex_brick_frag:"void node_tex_brick(\n vec3 vector, vec4 color1, vec4 color2, vec4 mortar, float scale,\n float mortarSize, float mortarSmooth, float bias, float brickWidth,\n float rowHeight,\n out vec4 outColor, out float fac)\n{\n outColor = color1;\n}",node_tex_checker_frag:"void node_tex_checker(vec3 vector, vec4 color1, vec4 color2, float scale, \n out vec4 outColor, out float outFac)\n{\n vec3 p = vector * scale;\n p = (p + 0.00001) * 0.99999;\n float cx = floor(p.x);\n float cy = floor(p.y);\n float cz = floor(p.z);\n float result = sign(mod(cx + cy + cz, 2.0));\n outFac = max(result, 0.0);\n outColor = mix(color2, color1, outFac);\n}",node_tex_coord_frag:"uniform vec3 boundingBoxMin;\nuniform vec3 boundingBoxMax;\nvoid node_tex_coord(\n vec3 viewPos, vec3 viewNorm, vec2 uv,\n out vec3 outGenerated, out vec3 outNormal, out vec3 outUV, out vec3 outObject,\n out vec3 outCamera, out vec3 outWindow, out vec3 outReflection)\n{\n vec4 view = vec4(-viewPos, 1.0);\n vec3 loc = swizzleUpZ((invModelMatrix * invViewMatrix * view).xyz);\n #if WORLD_NODES == 1\n loc = normalize(loc);\n #endif\n #if WORLD_NODES == 1\n outGenerated = loc;\n #else\n vec3 boxMin = vec3(boundingBoxMin.x, -boundingBoxMax.z, boundingBoxMin.y);\n vec3 boxMax = vec3(boundingBoxMax.x, -boundingBoxMin.z, boundingBoxMax.y);\n vec3 boxSize = boxMax - boxMin;\n if (abs(boxSize.x) < 0.001) {\n outGenerated.x = 0.5;\n } else {\n outGenerated.x = (loc.x - boxMin.x) / boxSize.x;\n }\n if (abs(boxSize.y) < 0.001) {\n outGenerated.y = 0.5;\n } else {\n outGenerated.y = (loc.y - boxMin.y) / boxSize.y;\n }\n if (abs(boxSize.z) < 0.001) {\n outGenerated.z = 0.5;\n } else {\n outGenerated.z = (loc.z - boxMin.z) / boxSize.z;\n }\n #endif\n #if WORLD_NODES == 1\n outNormal = -loc;\n #else\n outNormal = normalize(invModelMatrix * invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n outNormal = swizzleUpZ(outNormal);\n #endif\n #if WORLD_NODES == 1\n outUV = vec3(0.0);\n #else\n uv.y = 1.0 - uv.y;\n outUV = vec3(uv, 0.0);\n #endif\n outObject = loc;\n outCamera = vec3(view.xy, -view.z);\n outWindow = vec3(0.0);\n #if WORLD_NODES == 1\n outReflection = -loc;\n #else\n vec4 reflection = (invViewMatrix * vec4(reflect(view.xyz, normalize(viewNorm)), 0.0));\n outReflection = normalize(swizzleUpZ(reflection.xyz));\n #endif\n}",node_tex_environment_frag:"void node_tex_environment(sampler2D tex, const int encoding, vec3 vector, out vec4 outColor) {\n vec3 direction = swizzleUpY(vector);\n if (length(direction) == 0.0) {\n direction = vec3(0.0, 1.0, 0.0);\n } else {\n direction = normalize(direction);\n }\n vec2 uv;\n uv.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n uv.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n uv.y = 1.0 - uv.y;\n #if WORLD_NODES == 1\n float bias = -100.0;\n #else\n const float seamWidth = 0.15;\n const float seamBiasFactor = -10.0;\n float seam = max(0.0, 1.0 - abs (direction.z) / seamWidth) *\n clamp (1.0 - direction.x / seamWidth, 0.0, 1.0);\n float bias = seamBiasFactor * seam;\n #endif\n outColor = texture2D(tex, uv, bias);\n outColor = nodeTexelToLinear(outColor, encoding);\n}",node_tex_environment_max_frag:"\nvoid node_tex_environment_max(sampler2D tex, const int encoding, vec3 vector, out vec4 outColor) {\n \n vec3 direction = swizzleUpY(vector);\n if (length(direction) == 0.0) {\n direction = vec3(0.0, 1.0, 0.0);\n } else {\n direction = normalize(direction);\n }\n vec2 uv;\n uv.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n uv.x = atan(direction.x, direction.z) * RECIPROCAL_PI2 + 0.5;\n uv.y *= -1.0;\n const float seamWidth = 0.15;\n const float seamBiasFactor = -10.0;\n float seam = max(0.0, 1.0 - abs (direction.x) / seamWidth) *\n clamp (1.0 - direction.z / seamWidth, 0.0, 1.0);\n outColor = texture2D(tex, uv, seamBiasFactor * seam);\n outColor = nodeTexelToLinear(outColor, encoding);\n}",node_tex_environment_none_frag:"void node_tex_environment_none(vec3 vector, out vec4 outColor) {\n outColor = vec4(1.0, 0.0, 1.0, 1.0);\n}",node_tex_gradient_frag:"#define TEX_GRAD_LINEAR 0\n#define TEX_GRAD_QUADRATIC 1\n#define TEX_GRAD_EASING 2\n#define TEX_GRAD_DIAGONAL 3\n#define TEX_GRAD_SPHERICAL 4\n#define TEX_GRAD_QUADRATIC_SPHERE 5\n#define TEX_GRAD_RADIAL 6\nvoid node_tex_gradient(const int type, vec3 vector, out vec4 outColor, out float outFac)\n{\n float x, y, z, r;\n x = vector.x;\n y = vector.y;\n z = vector.z;\n if (type == TEX_GRAD_LINEAR) {\n outFac = x;\n } else if (type == TEX_GRAD_QUADRATIC) {\n r = max(x, 0.0);\n outFac = pow2(r);\n } else if (type == TEX_GRAD_EASING) {\n r = min(max(x, 0.0), 1.0);\n outFac = (3.0 * pow2(r) - 2.0 * pow3(r));\n } else if (type == TEX_GRAD_DIAGONAL) {\n outFac = (x + y) * 0.5;\n } else if (type == TEX_GRAD_RADIAL) {\n outFac = atan(y, x) / PI2 + 0.5;\n } else {\n r = max(0.99999 - sqrt(x * x + y * y + z * z), 0.0);\n if (type == TEX_GRAD_QUADRATIC_SPHERE) {\n outFac = pow2(r);\n } else if (type == TEX_GRAD_SPHERICAL) {\n outFac = r;\n }\n }\n outFac = clamp(outFac, 0.0, 1.0);\n outColor = vec4(outFac, outFac, outFac, 1.0);\n}",node_tex_image_frag:"void node_tex_image(\n sampler2D ima, const int encoding, \n vec3 vector,\n out vec4 outColor, out float outAlpha)\n{\n vec2 uv = vector.xy;\n uv.y = 1.0 - uv.y;\n outColor = texture2D(ima, uv);\n outAlpha = outColor.a;\n outColor = nodeTexelToLinear(outColor, encoding);\n}",node_tex_image_none_frag:"void node_tex_image_none(vec3 vector, out vec4 color, out float alpha)\n{\n color = vec4(1.0, 0.0, 1.0, 1.0);\n alpha = 1.0;\n}",node_tex_magic_frag:"void node_tex_magic(vec3 vector, float scale, float distortion,\n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.0);\n outFac = 0.0;\n}",node_tex_musgrave_frag:"void node_tex_musgrave(\n vec3 vector, float scale, float detail, float dimension, float lacunarity,\n float offset, float gain,\n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.0);\n outFac = 0.0;\n}",node_tex_noise_frag:"\nvoid node_tex_noise(\n float falloffFactor, float dispersionFactor,\n vec3 vector, float scale, float detail, float distortion,\n out vec4 outColor, out float outFac) {\n vec3 p = vector * scale;\n vec3 dx = dFdx(p);\n vec3 dy = dFdy(p);\n float octaveLenPerPixel = (length(dx) + length(dy)) / 4.0;\n if (distortion != 0.0) {\n vec3 r, offset = vec3(13.5, 13.5, 13.5);\n r.x = noiseSmooth(p + offset, octaveLenPerPixel, falloffFactor,\n dispersionFactor) * distortion;\n r.y = noiseSmooth(p, octaveLenPerPixel, falloffFactor,\n dispersionFactor) * distortion;\n r.z = noiseSmooth(p - offset, octaveLenPerPixel, falloffFactor,\n dispersionFactor) * distortion;\n p += r;\n }\n outFac = noiseTurbulence(p, detail, octaveLenPerPixel, falloffFactor,\n dispersionFactor);\n vec3 color = vec3(outFac,\n noiseTurbulence(vec3(p.y, p.x, p.z), detail, octaveLenPerPixel,\n falloffFactor, dispersionFactor),\n noiseTurbulence(vec3(p.y, p.z, p.x), detail, octaveLenPerPixel,\n falloffFactor, dispersionFactor)\n );\n outColor = vec4(color, 1.0);\n}",node_tex_pointdensity_frag:"void node_tex_pointdensity(\n vec3 vector,\n out vec4 outColor, out float outDensity)\n{\n outColor = vec4(0.0);\n outDensity = 0.0;\n}",node_tex_sky_frag:"\n#define TEX_SKY_PREETHAM 0\n#define TEX_SKY_HOSEK_WILKIE 1\n#define Km 683.0\nvoid node_tex_sky(const int skyType, vec3 param0, vec3 param1, vec3 param2, \n vec3 param3, vec3 param4, vec3 param5, vec3 param6, vec3 param7, \n vec3 param8, vec3 radiance, vec3 sunDirection, vec3 vectorIn, \n out vec4 outColor) {\n if (length(vectorIn) == 0.0) {\n vectorIn = vec3(0.0, 1.0, 0.0);\n } else {\n vectorIn = normalize(vectorIn);\n }\n vectorIn = swizzleUpY(vectorIn);\n sunDirection = swizzleUpY(sunDirection);\n float cosGamma = clamp(dot(vectorIn, sunDirection), -1.0, 1.0);\n float cosTheta = clamp(vectorIn.y, 0.0, 1.0);\n if (skyType == TEX_SKY_PREETHAM) {\n vec3 radInternal = (1.0 + param0 * exp(param1 / cosTheta)) * (\n 1.0 + param2 * exp(param3 * acos(cosGamma)) \n + param4 * pow(cosGamma, 2.0)\n );\n vec3 XYZ = xyY_to_XYZ(radInternal.y * radiance.y,\n radInternal.z * radiance.z, radInternal.x * radiance.x);\n outColor = vec4(max(xyz_to_sRGB(XYZ), 0.0), 1.0);\n } else if (skyType == TEX_SKY_HOSEK_WILKIE) {\n float cosGammaSq = pow(cosGamma, 2.0);\n vec3 chi = (1.0 + cosGammaSq) / pow(1.0 + pow(param8, vec3(2.0))\n - 2.0 * param8 * cosGamma, vec3(1.5));\n vec3 radInternal = (1.0 + param0 * exp(param1 / (cosTheta + 0.01))) * (\n param2 + param3 * exp(param4 * acos(cosGamma)) \n + param5 * cosGammaSq + param6 * chi + param7 * sqrt(cosTheta)\n );\n outColor = vec4(max(xyz_to_sRGB(radInternal * radiance), 0.0) * PI2/Km, 1.0);\n } else {\n outColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n}",node_tex_voronoi_frag:"\nstruct VoronoiClosest {\n vec4 closestDists;\n vec4 closestInds;\n};\nvec3 worleyPermute(vec3 x) {\n return mod((34.0 * x + 1.0) * x, 289.0);\n}\n#define DISTANCE_DISTANCE 0\n#define DISTANCE_MANHATTAN 1\n#define DISTANCE_CHEBYCHEV 2\n#define DISTANCE_MINKOWSKI 3\nvec3 worleyDist(vec3 x, vec3 y, vec3 z, int distance) {\n if (distance == DISTANCE_DISTANCE) {\n return x * x + y * y + z * z;\n } else if (distance == DISTANCE_MANHATTAN) {\n return abs(x) + abs(y) + abs(z);\n } else if (distance == DISTANCE_CHEBYCHEV) {\n return max(max(abs(x), abs(y)), abs(z));\n } else if (distance == DISTANCE_MINKOWSKI) {\n return pow(sqrt(abs(x)) + sqrt(abs(y)) + sqrt(abs(z)), vec3(2.0));\n }\n return vec3(0.0);\n}\nvoid updateVoronoiClosest(inout VoronoiClosest vf, vec3 newDistances, vec3 newIndices) {\n #pragma unroll_loop\n for (int i = 0; i < 3; i++) {\n float currDist = newDistances[i];\n float currIdx = newIndices[i];\n #pragma unroll_loop\n for (int j = 0; j < 4; j++) {\n if (currDist < vf.closestDists[j]) {\n float tmp = vf.closestDists[j];\n vf.closestDists[j] = currDist;\n currDist = tmp;\n tmp = vf.closestInds[j];\n vf.closestInds[j] = currIdx;\n currIdx = tmp;\n }\n }\n }\n}\nVoronoiClosest worleyClosest(vec3 P, float jitter, int distance) {\n float K = 0.142857142857;\n float Ko = 0.428571428571;\n float K2 = 0.020408163265306;\n float Kz = 0.166666666667;\n float Kzo = 0.416666666667;\n vec3 Pi = mod(floor(P), 289.0);\n vec3 Pf = fract(P) - 0.5;\n vec3 Pfx = Pf.x + vec3(1.0, 0.0, -1.0);\n vec3 Pfy = Pf.y + vec3(1.0, 0.0, -1.0);\n vec3 Pfz = Pf.z + vec3(1.0, 0.0, -1.0);\n vec3 p = worleyPermute(Pi.x + vec3(-1.0, 0.0, 1.0));\n vec3 p1 = worleyPermute(p + Pi.y - 1.0);\n vec3 p2 = worleyPermute(p + Pi.y);\n vec3 p3 = worleyPermute(p + Pi.y + 1.0);\n vec3 p11 = worleyPermute(p1 + Pi.z - 1.0);\n vec3 p12 = worleyPermute(p1 + Pi.z);\n vec3 p13 = worleyPermute(p1 + Pi.z + 1.0);\n vec3 p21 = worleyPermute(p2 + Pi.z - 1.0);\n vec3 p22 = worleyPermute(p2 + Pi.z);\n vec3 p23 = worleyPermute(p2 + Pi.z + 1.0);\n vec3 p31 = worleyPermute(p3 + Pi.z - 1.0);\n vec3 p32 = worleyPermute(p3 + Pi.z);\n vec3 p33 = worleyPermute(p3 + Pi.z + 1.0);\n vec3 ox11 = fract(p11*K) - Ko;\n vec3 oy11 = mod(floor(p11*K), 7.0)*K - Ko;\n vec3 oz11 = floor(p11*K2)*Kz - Kzo;\n vec3 ox12 = fract(p12*K) - Ko;\n vec3 oy12 = mod(floor(p12*K), 7.0)*K - Ko;\n vec3 oz12 = floor(p12*K2)*Kz - Kzo;\n vec3 ox13 = fract(p13*K) - Ko;\n vec3 oy13 = mod(floor(p13*K), 7.0)*K - Ko;\n vec3 oz13 = floor(p13*K2)*Kz - Kzo;\n vec3 ox21 = fract(p21*K) - Ko;\n vec3 oy21 = mod(floor(p21*K), 7.0)*K - Ko;\n vec3 oz21 = floor(p21*K2)*Kz - Kzo;\n vec3 ox22 = fract(p22*K) - Ko;\n vec3 oy22 = mod(floor(p22*K), 7.0)*K - Ko;\n vec3 oz22 = floor(p22*K2)*Kz - Kzo;\n vec3 ox23 = fract(p23*K) - Ko;\n vec3 oy23 = mod(floor(p23*K), 7.0)*K - Ko;\n vec3 oz23 = floor(p23*K2)*Kz - Kzo;\n vec3 ox31 = fract(p31*K) - Ko;\n vec3 oy31 = mod(floor(p31*K), 7.0)*K - Ko;\n vec3 oz31 = floor(p31*K2)*Kz - Kzo;\n vec3 ox32 = fract(p32*K) - Ko;\n vec3 oy32 = mod(floor(p32*K), 7.0)*K - Ko;\n vec3 oz32 = floor(p32*K2)*Kz - Kzo;\n vec3 ox33 = fract(p33*K) - Ko;\n vec3 oy33 = mod(floor(p33*K), 7.0)*K - Ko;\n vec3 oz33 = floor(p33*K2)*Kz - Kzo;\n vec3 dx11 = Pfx + jitter*ox11;\n vec3 dy11 = Pfy.x + jitter*oy11;\n vec3 dz11 = Pfz.x + jitter*oz11;\n vec3 dx12 = Pfx + jitter*ox12;\n vec3 dy12 = Pfy.x + jitter*oy12;\n vec3 dz12 = Pfz.y + jitter*oz12;\n vec3 dx13 = Pfx + jitter*ox13;\n vec3 dy13 = Pfy.x + jitter*oy13;\n vec3 dz13 = Pfz.z + jitter*oz13;\n vec3 dx21 = Pfx + jitter*ox21;\n vec3 dy21 = Pfy.y + jitter*oy21;\n vec3 dz21 = Pfz.x + jitter*oz21;\n vec3 dx22 = Pfx + jitter*ox22;\n vec3 dy22 = Pfy.y + jitter*oy22;\n vec3 dz22 = Pfz.y + jitter*oz22;\n vec3 dx23 = Pfx + jitter*ox23;\n vec3 dy23 = Pfy.y + jitter*oy23;\n vec3 dz23 = Pfz.z + jitter*oz23;\n vec3 dx31 = Pfx + jitter*ox31;\n vec3 dy31 = Pfy.z + jitter*oy31;\n vec3 dz31 = Pfz.x + jitter*oz31;\n vec3 dx32 = Pfx + jitter*ox32;\n vec3 dy32 = Pfy.z + jitter*oy32;\n vec3 dz32 = Pfz.y + jitter*oz32;\n vec3 dx33 = Pfx + jitter*ox33;\n vec3 dy33 = Pfy.z + jitter*oy33;\n vec3 dz33 = Pfz.z + jitter*oz33;\n vec3 d11 = worleyDist(dx11, dy11, dz11, distance);\n vec3 d12 = worleyDist(dx12, dy12, dz12, distance);\n vec3 d13 = worleyDist(dx13, dy13, dz13, distance);\n vec3 d21 = worleyDist(dx21, dy21, dz21, distance);\n vec3 d22 = worleyDist(dx22, dy22, dz22, distance);\n vec3 d23 = worleyDist(dx23, dy23, dz23, distance);\n vec3 d31 = worleyDist(dx31, dy31, dz31, distance);\n vec3 d32 = worleyDist(dx32, dy32, dz32, distance);\n vec3 d33 = worleyDist(dx33, dy33, dz33, distance);\n VoronoiClosest vf = VoronoiClosest(vec4(1e10), vec4(0.0));\n updateVoronoiClosest(vf, d11, p11);\n updateVoronoiClosest(vf, d12, p12);\n updateVoronoiClosest(vf, d13, p13);\n updateVoronoiClosest(vf, d21, p21);\n updateVoronoiClosest(vf, d22, p22);\n updateVoronoiClosest(vf, d23, p23);\n updateVoronoiClosest(vf, d31, p31);\n updateVoronoiClosest(vf, d32, p32);\n updateVoronoiClosest(vf, d33, p33);\n return vf;\n}\n#define COLORING_INTENSITY 0\n#define COLORING_CELLS 1\n#define FEATURE_F1 0\n#define FEATURE_F2 1\n#define FEATURE_F3 2\n#define FEATURE_F4 3\n#define FEATURE_F2F1 4\nvoid node_tex_voronoi(int coloring, int distance, int feature, vec3 vector,\n float scale, float exponent, out vec4 outColor, out float outFac) {\n vector = scale * (vector - 0.0001);\n VoronoiClosest vf = worleyClosest(vector, 1.0, distance);\n vec4 vorColorData;\n if (coloring == COLORING_INTENSITY) {\n vorColorData = vf.closestDists;\n } else if (coloring == COLORING_CELLS) {\n vorColorData = vf.closestInds;\n }\n float vorColorFac;\n if (feature == FEATURE_F1) {\n vorColorFac = vorColorData.x;\n } else if (feature == FEATURE_F2) {\n vorColorFac = vorColorData.y;\n } else if (feature == FEATURE_F3) {\n vorColorFac = vorColorData.z;\n } else if (feature == FEATURE_F4) {\n vorColorFac = vorColorData.w;\n } else if (feature == FEATURE_F2F1) {\n vorColorFac = vorColorData.y - vorColorData.x;\n }\n if (coloring == COLORING_INTENSITY) {\n outFac = vorColorFac;\n outColor = vec4(vec3(outFac), 1.0);\n } else if (coloring == COLORING_CELLS) {\n vorColorFac += 1e-3;\n float r = rand(vec2(vorColorFac / 289.0));\n float g = rand(vec2(vorColorFac / 23535.0));\n float b = rand(vec2(vorColorFac / 4353.0));\n outFac = (r + g + b) / 3.0;\n outColor = vec4(r, g, b, 1.0);\n }\n}",node_tex_wave_frag:"#define TEX_WAVE_TYPE_BANDS 0\n#define TEX_WAVE_TYPE_RINGS 1\n#define TEX_WAVE_PROFILE_SIN 0\n#define TEX_WAVE_PROFILE_SAW 1\nvoid node_tex_wave(int waveType, int waveProfile, vec3 vector, float scale,\n float distortion, float detail, float detailScale, out vec4 outColor,\n out float outFac) {\n vec3 coScaled = vector * scale;\n float waveFac;\n if (waveType == TEX_WAVE_TYPE_BANDS) {\n waveFac = (coScaled.x + coScaled.y + coScaled.z) * 10.0;\n } else {\n waveFac = length(coScaled) * 20.0;\n }\n if (distortion != 0.0) {\n waveFac += distortion * noiseTurbulence(coScaled * detailScale, detail,\n 0.0, 0.0, 1.0);\n }\n if (waveProfile == TEX_WAVE_PROFILE_SIN) {\n waveFac = 0.5 + 0.5 * sin(waveFac);\n } else {\n waveFac = fract(waveFac / PI2);\n }\n outColor = vec4(waveFac, waveFac, waveFac, 1.0);\n outFac = waveFac;\n}",node_texture_cube_frag:"\nuniform float flipCubeMap;\nvoid node_texture_cube(samplerCube ima, const int encoding, vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n vec = vec3(flipCubeMap * vec.x, vec.z, -vec.y);\n color = textureCube(ima, vec);\n value = color.a;\n normal.x = 2.0 * (color.r - 0.5);\n normal.y = 2.0 * (0.5 - color.g);\n normal.z = 2.0 * (color.b - 0.5);\n color = nodeTexelToLinear(color, encoding);\n}",node_texture_frag:"\nvoid node_texture(sampler2D ima, const int encoding, vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n vec2 uv = (vec.xy + vec2(1.0, 1.0)) * 0.5;\n uv.y = 1.0 - uv.y;\n color = texture2D(ima, uv);\n value = color.a;\n normal.x = 2.0 * (color.r - 0.5);\n normal.y = 2.0 * (0.5 - color.g);\n normal.z = 2.0 * (color.b - 0.5);\n color = nodeTexelToLinear(color, encoding);\n}",node_texture_none_frag:"\nvoid node_texture_none(vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n value = 0.0;\n color = vec4(0.0);\n normal = vec3(0.0);\n}",node_uvmap_frag:"void node_uvmap(vec2 uv, out vec3 outUV) {\n #if WORLD_NODES == 1\n outUV = vec3(0.0);\n #else\n uv.y = 1.0 - uv.y;\n outUV = vec3(uv, 0.0);\n #endif\n}",node_valtorgb_frag:"\nvoid node_valtorgb(sampler2D colormap, float fac, out vec4 colOut, out float alphaOut)\n{\n colOut = texture2D(colormap, vec2(fac, 0.0));\n alphaOut = colOut.a;\n}",node_value_frag:"\nuniform float nodeValue[NODE_VALUE_NUM];\nvoid node_value(float val, out float outVal)\n{\n outVal = val;\n}",node_vect_math_frag:"\nvoid node_vect_math_add(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 + v2;\n outVal = (abs(outVec[0]) + abs(outVec[1]) + abs(outVec[2])) * RECIPROCAL_3;\n}\nvoid node_vect_math_subtract(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 - v2;\n outVal = (abs(outVec[0]) + abs(outVec[1]) + abs(outVec[2])) * RECIPROCAL_3;\n}\nvoid node_vect_math_average(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 + v2;\n outVal = length(outVec);\n outVec = normalize(outVec);\n}\nvoid node_vect_math_dot_product(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = vec3(0, 0, 0);\n outVal = dot(v1, v2);\n}\nvoid node_vect_math_cross_product(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = cross(v1, v2);\n outVal = length(outVec);\n outVec /= outVal;\n}\nvoid node_vect_math_normalize(vec3 v, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVal = length(v);\n outVec = normalize(v);\n}",node_vect_transform_frag:"\n#define VEC_TRANS_NONE 0\n#define VEC_TRANS_W_O 1\n#define VEC_TRANS_W_C 2\n#define VEC_TRANS_O_W 3\n#define VEC_TRANS_O_C 4\n#define VEC_TRANS_C_W 5\n#define VEC_TRANS_C_O 6\n#define VEC_TRANS_W_O_DIR 7\n#define VEC_TRANS_W_C_DIR 8\n#define VEC_TRANS_O_W_DIR 9\n#define VEC_TRANS_O_C_DIR 10\n#define VEC_TRANS_C_W_DIR 11\n#define VEC_TRANS_C_O_DIR 12\nvoid node_vect_transform(const int vecTransType, const int invCamZ, vec3 vIn, out vec3 vOut)\n{\n if (vecTransType == VEC_TRANS_NONE)\n vOut = vIn;\n else {\n vec4 vec;\n if (vecTransType < VEC_TRANS_W_O_DIR)\n vec = vec4(vIn.xyz, 1.0);\n else\n vec = vec4(vIn.xyz, 0.0);\n if (vecTransType == VEC_TRANS_W_O || vecTransType == VEC_TRANS_W_O_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = invModelMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_W_C || vecTransType == VEC_TRANS_W_C_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = viewMatrix * vec;\n if (invCamZ == 1)\n vec[2] = -vec[2];\n } else if (vecTransType == VEC_TRANS_O_W || vecTransType == VEC_TRANS_O_W_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = modelMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_O_C || vecTransType == VEC_TRANS_O_C_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = modelViewMatrix * vec;\n if (invCamZ == 1)\n vec[2] = -vec[2];\n } else if (vecTransType == VEC_TRANS_C_W || vecTransType == VEC_TRANS_C_W_DIR) {\n if (invCamZ == 1)\n vec[2] = -vec[2];\n vec = invViewMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_C_O || vecTransType == VEC_TRANS_C_O_DIR) {\n if (invCamZ == 1)\n vec[2] = -vec[2];\n vec = invModelMatrix * invViewMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n }\n vOut = vec.xyz;\n }\n}",node_volume_absorption_frag:"void node_volume_absorption(vec4 color, float density, out vec4 outColor)\n{\n outColor = color;\n}",node_volume_scatter_frag:"void node_volume_scatter(vec4 color, float density, float anisotropy, out vec4 outColor)\n{\n outColor = vec4(color);\n}",node_wavelength_frag:"void node_wavelength(float wavelength, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}",node_wireframe_frag:"void node_wireframe(float size, out float outFac)\n{\n outFac = 0.0;\n}",node_bitmap_none_max_frag:"void node_bitmap_none_max(out vec4 color)\n{\n color = vec4(1.0);\n}",node_bitmap_env_max_frag:"void node_bitmap_env_max(sampler2D envMap, int reflectMode, float IOR,\n const int encoding, const int alphaAsMono, const int alphaAsRGB,\n \n float uOffset, float vOffset, float uTiling, float vTiling, float wAngle, vec3 normal,\n out vec4 color, out float value)\n{\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n vec3 reflectVec;\n #if WORLD_NODES\n reflectVec = normalize(cameraToVertex);\n #else\n if (reflectMode == MAX_ENV_COORDS_REFLECT)\n reflectVec = reflect(cameraToVertex, worldNormal);\n else {\n float refrRatio = 1.0 / IOR;\n reflectVec = refract(cameraToVertex, worldNormal, refrRatio);\n }\n #endif\n mat3 uvTransform = calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle);\n color = sampleEquirectangular(envMap, reflectVec, uvTransform, encoding);\n if (alphaAsMono == 1)\n value = color.a;\n else\n value = average(color.rgb);\n if (alphaAsRGB == 1)\n color = vec4(color.a);\n}",node_bitmap_max_frag:"void node_bitmap_max(sampler2D map, const vec2 uvIn, const int encoding,\n const int alphaAsMono, const int alphaAsRGB,\n float uOffset, float vOffset, float uTiling, float vTiling, float wAngle,\n out vec4 color, out float value)\n{\n vec2 uv = (calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle) * vec3(uvIn, 1.0)).xy;\n color = texture2D(map, uv);\n color = nodeTexelToLinear(color, encoding);\n if (alphaAsMono == 1)\n value = color.a;\n else\n value = average(color.rgb);\n if (alphaAsRGB == 1)\n color = vec4(color.a);\n}",node_bump_max_frag:"void node_bump_max(sampler2D bumpMap, const vec3 eyePos, const vec3 normal, const vec2 uv,\n out vec3 normalOut)\n{\n vec2 dSTdx = dFdx(uv);\n vec2 dSTdy = dFdy(uv);\n if (any(equal(dSTdx, vec2(0.0))) || any(equal(dSTdy, vec2(0.0)))) {\n normalOut = normal;\n } else {\n const float bumpScale = 1.0;\n vec3 vSigmaX = vec3(dFdx(eyePos.x), dFdx(eyePos.y), dFdx(eyePos.z));\n vec3 vSigmaY = vec3(dFdy(eyePos.x), dFdy(eyePos.y), dFdy(eyePos.z));\n vec3 vN = normal;\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n float fDet = dot(vSigmaX, R1);\n float Hll = bumpScale * texture2D(bumpMap, uv).x;\n float dBx = bumpScale * texture2D(bumpMap, uv + dSTdx).x - Hll;\n float dBy = bumpScale * texture2D(bumpMap, uv + dSTdy).x - Hll;\n vec2 dHdxy = vec2(dBx, dBy);\n vec3 vGrad = sign(fDet) * (dHdxy.x * R1 + dHdxy.y * R2);\n normalOut = normalize(abs(fDet) * normal - vGrad);\n }\n}",node_blend_max_frag:"void node_blend_max(\n const int useCurve, const float curveLower, const float curveUpper,\n const vec4 color1, const vec4 color2, float mask,\n out vec4 color)\n{\n if (useCurve == 1)\n mask = smoothstep(curveLower, curveUpper, mask);\n else\n mask = clamp(mask, 0.0, 1.0);\n color = mix(color1, color2, mask);\n}",node_color_correction_max_frag:"#define REWIRE_RED 0\n#define REWIRE_GREEN 1\n#define REWIRE_BLUE 2\n#define REWIRE_ALPHA 3\n#define REWIRE_RED_INV 4\n#define REWIRE_GREEN_INV 5\n#define REWIRE_BLUE_INV 6\n#define REWIRE_ALPHA_INV 7\n#define REWIRE_MONOCHROME 8\n#define REWIRE_ONE 9\n#define REWIRE_ZERO 10\nfloat rewireChannel(int type, vec4 color)\n{\n if (type == REWIRE_RED)\n return color.r;\n else if (type == REWIRE_GREEN)\n return color.g;\n else if (type == REWIRE_BLUE)\n return color.b;\n else if (type == REWIRE_ALPHA)\n return color.a;\n else if (type == REWIRE_RED_INV)\n return 1.0-color.r;\n else if (type == REWIRE_GREEN_INV)\n return 1.0-color.g;\n else if (type == REWIRE_BLUE_INV)\n return 1.0-color.b;\n else if (type == REWIRE_ALPHA_INV)\n return 1.0-color.a;\n else if (type == REWIRE_MONOCHROME)\n return average(color.rgb);\n else if (type == REWIRE_ONE)\n return 1.0;\n else\n return 0.0;\n}\nvoid node_color_correction_max(const ivec4 rewire,\n const vec4 color, const float hueShift, const float saturation,\n const vec4 tint, const float tintStrength,\n const float brightness, const float contrast,\n out vec4 outColor)\n{\n if (all(equal(rewire, ivec4(REWIRE_RED, REWIRE_GREEN, REWIRE_BLUE, REWIRE_ALPHA)))) {\n outColor = color;\n } else {\n outColor.r = rewireChannel(rewire.x, color);\n outColor.g = rewireChannel(rewire.y, color);\n outColor.b = rewireChannel(rewire.z, color);\n outColor.a = rewireChannel(rewire.w, color);\n }\n vec4 hsv;\n rgbToHSV(outColor, hsv);\n hsv[0] += hueShift / 360.0;\n if (hsv[0] > 1.0)\n hsv[0] -= 1.0;\n else if (hsv[0] < 0.0)\n hsv[0] += 1.0;\n hsv[1] *= (saturation / 100.0 + 1.0);\n hsv[1] = saturate(hsv[1]);\n if (tintStrength > 0.0) {\n vec4 hsvTint;\n rgbToHSV(tint, hsvTint);\n hsv[0] = hsv[0] + (hsvTint[0] - hsv[0]) * tintStrength / 100.0;\n }\n hsvToRGB(hsv, outColor);\n outColor = (outColor - 0.5) * (contrast / 100.0 + 1.0) + 0.5 + brightness / 100.0;\n outColor = max(outColor, 0.0);\n}",node_color_map_max_frag:"void node_color_map_max(const int reverseGamma, \n const vec4 color, const float gamma, const float gain,\n out vec4 outColor)\n{\n float p = (reverseGamma == 1) ? gamma : 1.0 / gamma;\n float g = (reverseGamma == 1) ? (gain > EPSILON ? 1.0 / gain : 1.0) : gain;\n outColor = vec4(g * pow(color.rgb, vec3(p)), color.a);\n}",node_composite_layer_max_frag:"#define COMP_BLEND_NORMAL 0\n#define COMP_BLEND_AVERAGE 1\n#define COMP_BLEND_ADD 2\n#define COMP_BLEND_SUBTRACT 3\n#define COMP_BLEND_DARKEN 4\n#define COMP_BLEND_MULTIPLY 5\n#define COMP_BLEND_COLORBURN 6\n#define COMP_BLEND_LINEARBURN 7\n#define COMP_BLEND_LIGHTEN 8\n#define COMP_BLEND_SCREEN 9\n#define COMP_BLEND_COLORDODGE 10\n#define COMP_BLEND_LINEARDODGE 11\n#define COMP_BLEND_SPOT 12\n#define COMP_BLEND_SPOTBLEND 13\n#define COMP_BLEND_OVERLAY 14\n#define COMP_BLEND_SOFTLIGHT 15\n#define COMP_BLEND_HARDLIGHT 16\n#define COMP_BLEND_PINLIGHT 17\n#define COMP_BLEND_HARDMIX 18\n#define COMP_BLEND_DIFFERENCE 19\n#define COMP_BLEND_EXCLUSION 20\n#define COMP_BLEND_HUE 21\n#define COMP_BLEND_SATURATION 22\n#define COMP_BLEND_COLOR 23\n#define COMP_BLEND_VALUE 24\nvec4 calcBlending(const vec4 colorBG, const vec4 colorFG, const int blendMode) {\n if (blendMode == COMP_BLEND_NORMAL)\n return colorFG;\n else if (blendMode == COMP_BLEND_AVERAGE)\n return (colorFG + colorBG) / 2.0;\n else if (blendMode == COMP_BLEND_ADD)\n return colorBG + colorFG;\n else if (blendMode == COMP_BLEND_SUBTRACT)\n return colorBG - colorFG;\n else if (blendMode == COMP_BLEND_DARKEN)\n return min(colorFG, colorBG);\n else if (blendMode == COMP_BLEND_MULTIPLY)\n return colorBG * colorFG;\n else if (blendMode == COMP_BLEND_COLORBURN) {\n if (colorFG.r == 0.0 && colorFG.g == 0.0 && colorFG.b == 0.0)\n return vec4(0.0, 0.0, 0.0, 1.0);\n else\n return max(1.0 - (1.0 - colorBG) / colorFG, 0.0);\n } else if (blendMode == COMP_BLEND_LINEARBURN)\n return max(colorFG + colorBG - 1.0, 0.0);\n else if (blendMode == COMP_BLEND_LIGHTEN)\n return max(colorFG, colorBG);\n else if (blendMode == COMP_BLEND_SCREEN)\n return colorFG + colorBG - colorFG * colorBG;\n else if (blendMode == COMP_BLEND_COLORDODGE) {\n if (colorFG.r == 1.0 && colorFG.g == 1.0 && colorFG.b == 1.0)\n return vec4(1.0);\n else\n return min(colorBG / (1.0 - colorFG), 1.0);\n } else if (blendMode == COMP_BLEND_LINEARDODGE)\n return min(colorFG + colorBG, 1.0);\n else if (blendMode == COMP_BLEND_SPOT)\n return min(2.0 * colorFG * colorBG, 1.0);\n else if (blendMode == COMP_BLEND_SPOTBLEND)\n return min(colorFG * colorBG + colorBG, 1.0);\n else if (blendMode == COMP_BLEND_OVERLAY) {\n if (colorBG.r <= 0.5 && colorBG.g <= 0.5 && colorBG.b <= 0.5)\n return saturate(2.0 * colorFG * colorBG);\n else\n return saturate(1.0 - 2.0 * (1.0-colorFG) * (1.0-colorBG));\n } else if (blendMode == COMP_BLEND_SOFTLIGHT) {\n if (colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5)\n return saturate(colorBG * (colorBG + 2.0 * colorFG * (1.0 - colorBG)));\n else\n return saturate(colorBG + (2.0 * colorFG - 1.0) * (sqrt(colorBG) - colorBG));\n } else if (blendMode == COMP_BLEND_HARDLIGHT) {\n if (colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5)\n return saturate(2.0 * colorFG * colorBG);\n else\n return saturate(1.0 - 2.0*(1.0 - colorFG)*(1.0 - colorBG));\n } else if (blendMode == COMP_BLEND_PINLIGHT) {\n if (((colorFG.r > 0.5 && colorFG.g > 0.5 && colorFG.b > 0.5) && all(greaterThan(colorFG, colorBG))) ||\n ((colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5) && all(lessThan(colorFG, colorBG))))\n return colorFG;\n else\n return colorBG;\n } else if (blendMode == COMP_BLEND_HARDMIX) {\n if (colorFG.r + colorBG.r <= 1.0 && colorFG.g + colorBG.g <= 1.0 && colorFG.b + colorBG.b <= 1.0)\n return vec4(0.0, 0.0, 0.0, 1.0);\n else\n return vec4(1.0);\n } else if (blendMode == COMP_BLEND_DIFFERENCE)\n return abs(colorFG - colorBG);\n else if (blendMode == COMP_BLEND_EXCLUSION)\n return colorFG + colorBG - 2.0 * colorFG * colorBG;\n}\nvec4 calcBlendingHSV(const vec4 colorBG, const vec4 colorFG, const int blendMode)\n{\n vec4 hsvBG, hsvFG;\n vec4 outColor;\n if (blendMode == COMP_BLEND_HUE) {\n rgbToHSV(colorBG, hsvBG);\n rgbToHSV(colorFG, hsvFG);\n hsvToRGB(vec4(hsvFG[0], hsvBG[1], hsvBG[2], 1.0), outColor);\n } else if (blendMode == COMP_BLEND_SATURATION) {\n rgbToHSV(colorBG, hsvBG);\n rgbToHSV(colorFG, hsvFG);\n hsvToRGB(vec4(hsvBG[0], hsvFG[1], hsvBG[2], 1.0), outColor);\n } else if (blendMode == COMP_BLEND_COLOR) {\n rgbToHSV(colorBG, hsvBG);\n rgbToHSV(colorFG, hsvFG);\n hsvToRGB(vec4(hsvFG[0], hsvFG[1], hsvBG[2], 1.0), outColor);\n } else if (blendMode == COMP_BLEND_VALUE) {\n rgbToHSV(colorBG, hsvBG);\n rgbToHSV(colorFG, hsvFG);\n hsvToRGB(vec4(hsvBG[0], hsvBG[1], hsvFG[2], 1.0), outColor);\n }\n return outColor;\n}\nvoid node_composite_layer_max(const int blendMode, const float opacity, \n const vec4 colorBG, const vec4 colorFG, const vec4 mask,\n out vec4 outColor)\n{\n float fac = saturate(opacity * average(mask.rgb));\n if (blendMode < COMP_BLEND_HUE)\n outColor = calcBlending(colorBG, colorFG, blendMode);\n else\n outColor = calcBlendingHSV(colorBG, colorFG, blendMode);\n outColor = mix(colorBG, outColor, fac);\n}",node_falloff_max_frag:"void node_falloff_max(vec3 viewPos, float IOR,\n const vec4 color1, const vec4 color2, vec3 normal, out vec4 color)\n{\n float fac;\n \n vec3 dir = normalize(viewPos);\n float eta = max(IOR, 0.00001);\n fac = fresnelReflection(dir, normal, (gl_FrontFacing) ? eta : 1.0 / eta);\n color = mix(color1, color2, fac);\n}",node_map_max_frag:"\nvoid node_map_max(const vec4 colorIn, out vec4 color)\n{\n color = colorIn;\n}",node_mask_max_frag:"void node_mask_max(const int maskInverted, \n const vec4 color, vec4 mask,\n out vec4 outColor)\n{\n mask = (maskInverted == 1) ? vec4(vec3(1.0) - mask.rgb, mask.a) : mask;\n outColor = color * mask;\n}",node_material_max_frag:"\nvoid node_material_max(\n float reflectionRatio, const float refractionRatio,\n const int selfIllumColorOn,\n const vec4 ambientColor, const vec4 diffuseColor, const vec4 specularColor,\n const float glossiness, const float specularLevel, const vec4 selfIllum,\n const float opacity, const vec4 filterColor, const vec3 normal,\n const vec4 reflection, const vec4 refraction, const float displacement,\n out vec4 outColor)\n{\n vec3 diffuse, specular;\n NodeMaterial material;\n material.diffuseColor = diffuseColor.rgb;\n material.specularColor = specularColor.rgb;\n material.diffuseIntensity = 1.0;\n material.specularHardness = 4.0 * exp2(glossiness * 10.0);\n material.specularIntensity = specularLevel;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n vec3 totalEmissiveRadiance;\n if (selfIllumColorOn == 1)\n totalEmissiveRadiance = selfIllum.rgb;\n else\n totalEmissiveRadiance = vec3(selfIllum[0] * material.diffuseColor);\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n float specularStrength = maxFromRGB(specular);\n outColor = vec4(saturate(diffuse + specular), 1.0);\n float alpha = opacity - saturate(maxFromRGB(specular)) * (opacity - 1.0);\n outColor += reflection * specularColor * reflectionRatio;\n outColor += refraction * refractionRatio;\n alpha += saturate(maxFromRGB(reflection.rgb) * maxFromRGB(specularColor.rgb)) * reflectionRatio;\n alpha += saturate(maxFromRGB(refraction.rgb)) * refractionRatio;\n outColor.a = alpha;\n}",node_mix_max_frag:"void node_mix_max(const vec4 color1, const vec4 color2, const float amount, out vec4 color)\n{\n color = mix(color1, color2, clamp(amount, 0.0, 1.0));\n}",node_normal_bump_max_frag:"void node_normal_bump_max(const vec4 tangent, const vec3 normal, ivec2 flip,\n vec4 normalColor, vec3 additionalBump, float normalMult, float addBumpMult,\n out vec3 normalOut)\n{\n if (flip[0] == 1)\n normalColor.x = 1.0 - normalColor.x;\n if (flip[1] == 0)\n normalColor.y = 1.0 - normalColor.y;\n vec3 normalTex = (normalColor.xyz * 2.0 - 1.0);\n vec4 viewTangent = vec4(normalize(modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz, tangent.w);\n vec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\n normalOut = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n + normalTex.z * normal);\n normalOut = mix(normal, normalOut, normalMult);\n additionalBump = mix(normal, additionalBump, addBumpMult);\n normalOut = normalize(normalOut + additionalBump);\n}",node_output_map_max_frag:"vec4 processOutputColor(vec4 color, const bool invert, const bool clampColor, const bool alphaFromRGB,\n const float rgbLevel, const float rgbOffset, const float outputAmount)\n{\n vec3 color3 = color.rgb;\n color3 = clampColor ? saturate(color3) : color3;\n color3 = color3 * rgbLevel + vec3(rgbOffset);\n color3 = invert ? (vec3(1.0) - color3) : color3;\n color = outputAmount * vec4(color3, color.a);\n color.a = alphaFromRGB ? average(color.rgb) : color.a;\n return color;\n}\nvoid node_output_map_max(\n const bool invert, const bool clampColor, const bool alphaFromRGB,\n const vec4 color, const float rgbLevel, const float rgbOffset,\n const float outputAmount, const float bumpAmount,\n out vec4 outColor)\n{\n outColor = processOutputColor(color, invert, clampColor, alphaFromRGB, rgbLevel, rgbOffset, outputAmount);\n}\nvoid node_output_map_max(\n const bool invert, const bool clampColor, const bool alphaFromRGB, sampler2D colormap,\n vec4 color, const float rgbLevel, const float rgbOffset,\n const float outputAmount, const float bumpAmount,\n out vec4 outColor)\n{\n float r = texture2D(colormap, vec2(color.r, 0.0)).r;\n float g = texture2D(colormap, vec2(color.g, 0.0)).g;\n float b = texture2D(colormap, vec2(color.b, 0.0)).b;\n outColor = processOutputColor(vec4(r, g, b, color.a),\n invert, clampColor, alphaFromRGB, rgbLevel, rgbOffset, outputAmount);\n}",node_output_max_frag:"void node_output_max(vec4 color, out vec4 outgoingLight)\n{\n outgoingLight = color;\n}",node_physical_max_frag:"#define DEFAULT_REFLECTION_EDGE 1.0\n#define DEFAULT_REFLECTION_SLOPE 5.0\nvoid node_physical_max(\n vec3 originalNormal, const float emitLuminance, const int useCustomReflCurve,\n const float reflFacing, const float reflEdge, const float reflSlope,\n const bool roughnessInv, const bool transRoughnessLock, const bool transRoughnessInv,\n const bool thinWalled,\n const float baseWeight, const vec4 baseColor, const float reflectivity,\n const vec4 reflColor, const float roughness, const float metalness,\n const float diffRoughness, const float anisotropy, const float anisoangle,\n const float transparency, const vec4 transColor, const float transRoughness,\n const float ior, const float scattering, const vec4 sssColor,\n const float sssScale, const float emission, const vec4 emitColor,\n const float coating, const vec4 coatColor, const float coatRoughness,\n const vec3 normal, const vec3 coatNormal, const float displacement,\n const float cutout,\n out vec4 outColor)\n{\n NodeMaterial material;\n vec3 baseColorWeighted = baseWeight * baseColor.rgb;\n material.diffuseColor = baseColorWeighted * (1.0 - transparency);\n#ifndef STANDARD\n material.clearCoat = saturate(coating);\n material.clearCoatRoughness = clamp(coatRoughness, 0.04, 1.0);\n#endif\n float facing, edge, slope;\n if (useCustomReflCurve == 1) {\n facing = reflFacing;\n edge = reflEdge;\n slope = reflSlope;\n } else {\n facing = pow2((1.0 - ior) / (1.0 + ior));\n edge = DEFAULT_REFLECTION_EDGE;\n slope = DEFAULT_REFLECTION_SLOPE;\n }\n float cosTheta = saturate(dot(normal, normalize(vViewPosition)));\n float fresnelRefl = (facing + (edge - facing) * pow(1.0 - cosTheta, slope))\n * saturate(reflectivity + metalness);\n float kd = 1.0 - (metalness * (1.0 - fresnelRefl) + fresnelRefl);\n material.specularColor = mix(metalness * baseColorWeighted, reflColor.rgb, fresnelRefl);\n material.diffuseColor *= kd;\n material.specularRoughness = clamp(roughnessInv ? (1.0 - roughness) : roughness, 0.0, 1.0);\n material.refractionColor = pow(transparency * (1.0 - metalness) * transColor.rgb, vec3(2.0));\n material.refractionIOR = ior;\n float tRough;\n if (transRoughnessLock) {\n tRough = roughnessInv ? 1.0 - roughness : roughness;\n } else {\n tRough = transRoughnessInv ? 1.0 - transRoughness : transRoughness;\n }\n material.refractionRoughness = pow2(tRough);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #define ORIGINAL_NORMAL originalNormal\n #define COAT_NORMAL coatNormal\n #define USE_REFRACTED_LIGHT\n vec3 refractedLight = vec3(0.0);\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #undef USE_REFRACTED_LIGHT\n #undef COAT_NORMAL\n #undef ORIGINAL_NORMAL\n vec3 totalEmissiveRadiance = emitLuminance / LUMENS_PER_WATT * emission * emitColor.rgb;\n vec3 specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n vec3 outColor3 = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n specular + totalEmissiveRadiance;\n float alpha = 1.0;\n if (thinWalled) {\n alpha = 1.0 - saturate(transparency) + maxFromRGB(specular) * saturate(transparency);\n } else {\n outColor3 += refractedLight;\n }\n outColor = vec4(outColor3, saturate(alpha));\n}",node_phy_sun_sky_env_max_frag:"vec3 perezSky(vec3 paramA, vec3 paramB, vec3 paramC, vec3 paramD, vec3 paramE,\n vec3 radiance, vec3 sunDirection, vec3 direction)\n{\n float cosGamma = clamp(dot(direction, sunDirection), -1.0, 1.0);\n float cosTheta = clamp(direction.y, 0.0, 1.0);\n vec3 radInternal = (1.0 + paramA * exp(paramB / cosTheta)) * (\n 1.0 + paramC * exp(paramD * acos(cosGamma))\n + paramE * pow(cosGamma, 2.0)\n );\n float ciex = radInternal.y * radiance.y;\n float ciey = radInternal.z * radiance.z;\n float cieY = clamp(radInternal.x * radiance.x, 0.0, 1000000.0);\n vec3 XYZ = xyY_to_XYZ(ciex, ciey, cieY);\n return max(xyz_to_sRGB(XYZ), 0.0);\n}\n#define GROUND_SKY_SAMPLES 16\nvec3 groundSky(vec3 paramA, vec3 paramB, vec3 paramC, vec3 paramD, vec3 paramE, vec3 radiance, vec3 sunDirection, vec3 sunIlluminance)\n{\n const int horizSamples = GROUND_SKY_SAMPLES;\n const int vertSamples = GROUND_SKY_SAMPLES / 2;\n vec3 result = vec3(0.0);\n for (int horizSampleIdx = 0; horizSampleIdx < horizSamples; horizSampleIdx++) {\n float horizSample = float(horizSampleIdx) / float(horizSamples);\n float horizAngle = PI2 * horizSample;\n for (int vertSampleIdx = 0; vertSampleIdx < vertSamples; vertSampleIdx++) {\n float vertSample = float(vertSampleIdx) / float(vertSamples);\n float y = 1.0 - vertSample;\n float x = sqrt(1.0 - y*y) * cos(horizAngle);\n float z = -sqrt(1.0 - y*y) * sin(horizAngle);\n vec3 direction = vec3(x, y, z);\n vec3 sampleColor = perezSky(paramA, paramB, paramC, paramD, paramE,\n radiance, sunDirection, direction);\n \n result += direction.y * sampleColor;\n }\n }\n result /= float(horizSamples * vertSamples);\n result += (sunIlluminance * sunDirection.y) / PI;\n return result;\n}\nvoid node_phy_sun_sky_env_max(vec3 paramA, vec3 paramB, vec3 paramC, vec3 paramD, vec3 paramE,\n vec3 radiance, vec3 sunDirection, vec3 sunIlluminance, vec3 sunLuminance, \n float globalIntensity, vec4 groundColor,\n out vec4 outColor) \n{\n vec3 dir = vWorldPosition;\n if (length(dir) == 0.0) {\n dir = vec3(0.0, 0.0, -1.0);\n } else {\n dir = normalize(dir);\n }\n if (dir.y < 0.0) {\n outColor = groundColor * vec4(groundSky(paramA, paramB, paramC, paramD, paramE, radiance, sunDirection, sunIlluminance), 1.0);\n } else {\n outColor = vec4(perezSky(paramA, paramB, paramC, paramD, paramE,\n radiance, sunDirection, dir), 1.0);\n }\n outColor = globalIntensity * outColor;\n}",node_reflect_refract_max_frag:"void node_reflect_refract_max(sampler2D envMap,\n int reflectMode, const float IOR, const int encoding,\n vec3 normal, out vec4 color)\n{\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n vec3 reflectVec;\n if (reflectMode == MAX_ENV_COORDS_REFLECT)\n reflectVec = reflect(cameraToVertex, worldNormal);\n else {\n float refrRatio = 1.0 / IOR;\n reflectVec = refract(cameraToVertex, worldNormal, refrRatio);\n }\n reflectVec = normalize(reflectVec);\n color = sampleEquirectangular(envMap, reflectVec, mat3(1.0), encoding);\n}",node_reflect_refract_color_max_frag:"void node_reflect_refract_color_max(const vec4 colorIn, out vec4 color)\n{\n color = vec4(colorIn);\n}",node_rgb_multiply_max_frag:"void node_rgb_multiply_max(const vec4 color1, const vec4 color2, out vec4 color)\n{\n color = color1 * color2;\n}",node_rgb_tint_max_frag:"void node_rgb_tint_max(const vec4 color, const vec4 red, const vec4 green, const vec4 blue,\n out vec4 outColor)\n{\n mat3 tintMatrix = mat3(red.rgb, green.rgb, blue.rgb);\n outColor = vec4(tintMatrix * color.rgb, color.a);\n}",node_shellac_max_frag:"void node_shellac_max(const vec4 color1, const vec4 color2, const float amount,\n out vec4 color)\n{\n color = mix(color1, color2, clamp(amount, 0.0, 1.0));\n}",node_vertex_color_max_frag:"void node_vertex_color_max(vec3 color, out vec4 outColor)\n{\n outColor = vec4(color, 1.0);\n}",pp_plane_vert:"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",pp_brightness_contrast_frag:"\nuniform sampler2D tDiffuse;\nuniform float brightness;\nuniform float contrast;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = texture2D(tDiffuse, vUv);\n texel.rgb += brightness;\n if (contrast > 0.0)\n texel.rgb = (texel.rgb - 0.5) / (1.0 - contrast) + 0.5;\n else\n texel.rgb = (texel.rgb - 0.5) * (1.0 + contrast) + 0.5;\n gl_FragColor = texel;\n}",pp_bokeh_frag:"#include <common>\nvarying vec2 vUv;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform float maxblur;\nuniform float aperture;\nuniform float nearClip;\nuniform float farClip;\nuniform float focus;\nuniform float aspect;\nuniform float depthLeakThreshold;\n#include <packing>\nfloat getDepth(const in vec2 screenPosition) {\n#if DEPTH_PACKING == 1\n return unpackRGBAToDepth(texture2D(tDepth, screenPosition));\n#else\n return texture2D(tDepth, screenPosition).x;\n#endif\n}\nfloat getViewZ(const in float depth) {\n#if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, nearClip, farClip);\n#else\n return orthoDepthToViewZ(depth, nearClip, farClip);\n#endif\n}\nvec4 blurSample(vec2 uvOffset, vec4 centerCol, float viewZCenter) {\n float viewZ = -getViewZ(getDepth(vUv + uvOffset));\n float blurFactor = (viewZ >= viewZCenter) ? 1.0 : \n min(depthLeakThreshold * abs((focus - viewZ) / aperture), 1.0);\n return mix(centerCol, texture2D(tColor, vUv + uvOffset), blurFactor);\n}\nvoid main() {\n vec2 aspectcorrect = vec2(1.0, aspect);\n float viewZ = -getViewZ(getDepth(vUv));\n float factor = abs(focus - viewZ);\n \n float dofblur = maxblur * min(factor / aperture, 1.0);\n float dofblur9 = dofblur * 0.9;\n float dofblur7 = dofblur * 0.7;\n float dofblur4 = dofblur * 0.4;\n vec4 centerCol = texture2D(tColor, vUv);\n vec4 col = centerCol;\n col += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.15, 0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.37, 0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.40, 0.0 ) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.37, -0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.15, -0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.15, 0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.37, 0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.37, -0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.15, -0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n \n col += blurSample((vec2( 0.15, 0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2(-0.37, 0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2( 0.37, -0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2(-0.15, -0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2(-0.15, 0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2( 0.37, 0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2(-0.37, -0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2( 0.15, -0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n \n col += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2( 0.40, 0.0 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n \n col += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2( 0.4, 0.0 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\n gl_FragColor = col / 41.0;\n gl_FragColor.a = centerCol.a;\n}",pp_copy_frag:"uniform sampler2D tDiffuse;\nuniform float opacity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = (texture2D(tDiffuse, vUv));\n #if MAP_TEXELS == 1\n texel = mapTexelToLinear(texel);\n #endif\n gl_FragColor = opacity * texel;\n #if MAP_TEXELS == 1\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #endif\n}",pp_fxaa_frag:"precision highp float;\nuniform sampler2D tDiffuse;\nuniform vec2 resolution;\nvarying vec2 vUv;\n#define FXAA_PC 1\n#define FXAA_GLSL_100 1\n#define FXAA_QUALITY_PRESET 12\n#define FXAA_GREEN_AS_LUMA 1\n#ifndef FXAA_PC_CONSOLE\n #define FXAA_PC_CONSOLE 0\n#endif\n#ifndef FXAA_GLSL_120\n #define FXAA_GLSL_120 0\n#endif\n#ifndef FXAA_GLSL_130\n #define FXAA_GLSL_130 0\n#endif\n#ifndef FXAA_HLSL_3\n #define FXAA_HLSL_3 0\n#endif\n#ifndef FXAA_HLSL_4\n #define FXAA_HLSL_4 0\n#endif\n#ifndef FXAA_HLSL_5\n #define FXAA_HLSL_5 0\n#endif\n#ifndef FXAA_GREEN_AS_LUMA\n #define FXAA_GREEN_AS_LUMA 0\n#endif\n#ifndef FXAA_EARLY_EXIT\n #define FXAA_EARLY_EXIT 1\n#endif\n#ifndef FXAA_DISCARD\n #define FXAA_DISCARD 1\n#endif\n#ifndef FXAA_FAST_PIXEL_OFFSET\n #ifdef GL_EXT_gpu_shader4\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifdef GL_NV_gpu_shader5\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifdef GL_ARB_gpu_shader5\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifndef FXAA_FAST_PIXEL_OFFSET\n #define FXAA_FAST_PIXEL_OFFSET 0\n #endif\n#endif\n#ifndef FXAA_GATHER4_ALPHA\n #if (FXAA_HLSL_5 == 1)\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifdef GL_ARB_gpu_shader5\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifdef GL_NV_gpu_shader5\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifndef FXAA_GATHER4_ALPHA\n #define FXAA_GATHER4_ALPHA 0\n #endif\n#endif\n#ifndef FXAA_QUALITY_PRESET\n #define FXAA_QUALITY_PRESET 12\n#endif\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)\n #define FxaaBool bool\n #define FxaaDiscard discard\n #define FxaaFloat float\n #define FxaaFloat2 vec2\n #define FxaaFloat3 vec3\n #define FxaaFloat4 vec4\n #define FxaaHalf float\n #define FxaaHalf2 vec2\n #define FxaaHalf3 vec3\n #define FxaaHalf4 vec4\n #define FxaaInt2 ivec2\n #define FxaaSat(x) clamp(x, 0.0, 1.0)\n #define FxaaTex sampler2D\n#else\n #define FxaaBool bool\n #define FxaaDiscard clip(-1)\n #define FxaaFloat float\n #define FxaaFloat2 float2\n #define FxaaFloat3 float3\n #define FxaaFloat4 float4\n #define FxaaHalf half\n #define FxaaHalf2 half2\n #define FxaaHalf3 half3\n #define FxaaHalf4 half4\n #define FxaaSat(x) saturate(x)\n#endif\n#if (FXAA_GLSL_100 == 1)\n #define FxaaTexTop(t, p) texture2D(t, p, 0.0)\n #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)\n#endif\n#if (FXAA_GLSL_120 == 1)\n #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n #if (FXAA_FAST_PIXEL_OFFSET == 1)\n #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)\n #else\n #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n #endif\n #if (FXAA_GATHER4_ALPHA == 1)\n #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\n #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\n #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\n #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\n #endif\n#endif\n#if (FXAA_GLSL_130 == 1)\n #define FxaaTexTop(t, p) textureLod(t, p, 0.0)\n #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)\n #if (FXAA_GATHER4_ALPHA == 1)\n #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\n #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\n #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\n #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\n #endif\n#endif\n#if (FXAA_HLSL_3 == 1)\n #define FxaaInt2 float2\n #define FxaaTex sampler2D\n #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))\n #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))\n#endif\n#if (FXAA_HLSL_4 == 1)\n #define FxaaInt2 int2\n struct FxaaTex { SamplerState smpl; Texture2D tex; };\n #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\n #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\n#endif\n#if (FXAA_HLSL_5 == 1)\n #define FxaaInt2 int2\n struct FxaaTex { SamplerState smpl; Texture2D tex; };\n #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\n #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\n #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)\n #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)\n #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)\n #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)\n#endif\n#if (FXAA_GREEN_AS_LUMA == 0)\n FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }\n#else\n FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\n#endif\n#if (FXAA_PC == 1)\nFxaaFloat4 FxaaPixelShader(\n FxaaFloat2 pos,\n FxaaFloat4 fxaaConsolePosPos,\n FxaaTex tex,\n FxaaTex fxaaConsole360TexExpBiasNegOne,\n FxaaTex fxaaConsole360TexExpBiasNegTwo,\n FxaaFloat2 fxaaQualityRcpFrame,\n FxaaFloat4 fxaaConsoleRcpFrameOpt,\n FxaaFloat4 fxaaConsoleRcpFrameOpt2,\n FxaaFloat4 fxaaConsole360RcpFrameOpt2,\n FxaaFloat fxaaQualitySubpix,\n FxaaFloat fxaaQualityEdgeThreshold,\n FxaaFloat fxaaQualityEdgeThresholdMin,\n FxaaFloat fxaaConsoleEdgeSharpness,\n FxaaFloat fxaaConsoleEdgeThreshold,\n FxaaFloat fxaaConsoleEdgeThresholdMin,\n FxaaFloat4 fxaaConsole360ConstDir\n) {\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n #if (FXAA_GATHER4_ALPHA == 1)\n #if (FXAA_DISCARD == 0)\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #if (FXAA_GREEN_AS_LUMA == 0)\n #define lumaM rgbyM.w\n #else\n #define lumaM rgbyM.y\n #endif\n #endif\n #if (FXAA_GREEN_AS_LUMA == 0)\n FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);\n FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));\n #else\n FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);\n FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));\n #endif\n #if (FXAA_DISCARD == 1)\n #define lumaM luma4A.w\n #endif\n #define lumaE luma4A.z\n #define lumaS luma4A.x\n #define lumaSE luma4A.y\n #define lumaNW luma4B.w\n #define lumaN luma4B.z\n #define lumaW luma4B.x\n #else\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #if (FXAA_GREEN_AS_LUMA == 0)\n #define lumaM rgbyM.w\n #else\n #define lumaM rgbyM.y\n #endif\n #if (FXAA_GLSL_100 == 1)\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(0.0, 1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0, 0.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(0.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));\n #else\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n #endif\n #endif\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n if(earlyExit)\n #if (FXAA_DISCARD == 1)\n return rgbyM;\n #else\n return rgbyM;\n #endif\n #if (FXAA_GATHER4_ALPHA == 0)\n #if (FXAA_GLSL_100 == 1)\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0, 1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));\n #else\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n #endif\n #else\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n #endif\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = (horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if(horzSpan) posB.y += lengthSign * 0.5;\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if(horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n #if (FXAA_DISCARD == 1)\n return FxaaTexTop(tex, posM);\n #else\n return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n #endif\n}\n#endif\nvoid main() {\n gl_FragColor = FxaaPixelShader(\n vUv,\n vec4(0.0),\n tDiffuse,\n tDiffuse,\n tDiffuse,\n resolution,\n vec4(0.0),\n vec4(0.0),\n vec4(0.0),\n 0.75,\n 0.166,\n 0.0833,\n 0.0,\n 0.0,\n 0.0,\n vec4(0.0)\n );\n \n}",pp_grayscale_frag:"uniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = texture2D(tDiffuse, vUv);\n float bw = texel.r * 0.35 + texel.g * 0.45 + texel.b * 0.2;\n texel = vec4(bw, bw, bw, texel.a);\n gl_FragColor = texel;\n}",pp_outline_edge_frag:"varying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform vec2 texSize;\nuniform vec3 visibleEdgeColor;\nuniform vec3 hiddenEdgeColor;\nvoid main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n vec4 c1 = texture2D(maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D(maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D(maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D(maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r) * 0.5;\n float diff2 = (c3.r - c4.r) * 0.5;\n float d = length(vec2(diff1, diff2));\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibilityFactor = min(a1, a2);\n vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n}",pp_outline_blur_frag:"#include <common>\nvarying vec2 vUv;\nuniform sampler2D colorTexture;\nuniform vec2 texSize;\nuniform vec2 direction;\nuniform float kernelRadius;\nfloat gaussianPdf(in float x, in float sigma) {\n return 0.39894 * exp(-0.5 * x * x/(sigma * sigma))/sigma;\n}\nvoid main() {\n vec2 invSize = 1.0 / texSize;\n float weightSum = gaussianPdf(0.0, kernelRadius);\n vec3 diffuseSum = texture2D(colorTexture, vUv).rgb * weightSum;\n vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n vec2 uvOffset = delta;\n for (int i = 1; i <= MAX_RADIUS; i++) {\n float w = gaussianPdf(uvOffset.x, kernelRadius);\n vec3 sample1 = texture2D(colorTexture, vUv + uvOffset).rgb;\n vec3 sample2 = texture2D(colorTexture, vUv - uvOffset).rgb;\n diffuseSum += ((sample1 + sample2) * w);\n weightSum += (2.0 * w);\n uvOffset += delta;\n }\n gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n}",pp_outline_overlay_frag:"varying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform sampler2D edgeTexture1;\nuniform sampler2D edgeTexture2;\nuniform sampler2D patternTexture;\nuniform float edgeStrength;\nuniform float edgeGlow;\nuniform bool usePatternTexture;\nvoid main() {\n vec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n vec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n vec4 maskColor = texture2D(maskTexture, vUv);\n vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n vec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n if (usePatternTexture)\n finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n gl_FragColor = finalColor;\n}",pp_ssao_frag:"uniform float cameraNear;\nuniform float cameraFar;\n#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n#endif\nuniform float radius;\nuniform bool onlyAO;\nuniform vec2 size;\nuniform float aoClamp;\nuniform float lumInfluence;\nuniform sampler2D tDiffuse;\nuniform sampler2D tDepth;\nvarying vec2 vUv;\n#define DL 2.399963229728653 \n#define EULER 2.718281828459045\nconst int samples = 64;\nconst bool useNoise = true;\nconst float noiseAmount = 0.0004;\nconst float diffArea = 0.25;\nconst float gDisplace = 0.4;\n#include <packing>\nvec2 rand(const vec2 coord) {\n vec2 noise;\n if (useNoise) {\n float nx = dot (coord, vec2(12.9898, 78.233));\n float ny = dot (coord, vec2(12.9898, 78.233) * 2.0);\n noise = clamp(fract (43758.5453 * sin(vec2(nx, ny))), 0.0, 1.0);\n } else {\n float ff = fract(1.0 - coord.s * (size.x / 2.0));\n float gg = fract(coord.t * (size.y / 2.0));\n noise = vec2(0.25, 0.75) * vec2(ff) + vec2(0.75, 0.25) * gg;\n }\n return (noise * 2.0 - 1.0) * noiseAmount;\n}\nfloat readDepth(const in vec2 coord) {\n float cameraFarPlusNear = cameraFar + cameraNear;\n float cameraFarMinusNear = cameraFar - cameraNear;\n float cameraCoef = 2.0 * cameraNear;\n #ifdef USE_LOGDEPTHBUF\n float logz = unpackRGBAToDepth(texture2D(tDepth, coord));\n float w = pow(2.0, (logz / logDepthBufFC)) - 1.0;\n float z = (logz / w) + 1.0;\n #else\n float z = unpackRGBAToDepth(texture2D(tDepth, coord));\n #endif\n return cameraCoef / (cameraFarPlusNear - z * cameraFarMinusNear);\n}\nfloat compareDepths(const in float depth1, const in float depth2, inout int far) {\n float garea = 8.0;\n float diff = (depth1 - depth2) * 100.0;\n if (diff < gDisplace) {\n garea = diffArea;\n } else {\n far = 1;\n }\n float dd = diff - gDisplace;\n float gauss = pow(EULER, -2.0 * (dd * dd) / (garea * garea));\n return gauss;\n}\nfloat calcAO(float depth, float dw, float dh) {\n vec2 vv = vec2(dw, dh);\n vec2 coord1 = vUv + radius * vv;\n vec2 coord2 = vUv - radius * vv;\n float temp1 = 0.0;\n float temp2 = 0.0;\n int far = 0;\n temp1 = compareDepths(depth, readDepth(coord1), far);\n if (far > 0) {\n temp2 = compareDepths(readDepth(coord2), depth, far);\n temp1 += (1.0 - temp1) * temp2;\n }\n return temp1;\n}\nvoid main() {\n vec2 noise = rand(vUv);\n float depth = readDepth(vUv);\n float tt = clamp(depth, aoClamp, 1.0);\n float w = (1.0 / size.x) / tt + (noise.x * (1.0 - noise.x));\n float h = (1.0 / size.y) / tt + (noise.y * (1.0 - noise.y));\n float ao = 0.0;\n float dz = 1.0 / float(samples);\n float l = 0.0;\n float z = 1.0 - dz / 2.0;\n for (int i = 0; i <= samples; i++) {\n float r = sqrt(1.0 - z);\n float pw = cos(l) * r;\n float ph = sin(l) * r;\n ao += calcAO(depth, pw * w, ph * h);\n z = z - dz;\n l = l + DL;\n }\n ao /= float(samples);\n ao = 1.0 - ao;\n vec4 color = texture2D(tDiffuse, vUv);\n vec3 lumcoeff = vec3(0.299, 0.587, 0.114);\n float lum = dot(color.rgb, lumcoeff);\n vec3 luminance = vec3(lum);\n vec3 final = vec3(color.rgb * mix(vec3(ao), vec3(1.0), luminance * lumInfluence));\n if (onlyAO) {\n final = vec3(mix(vec3(ao), vec3(1.0), luminance * lumInfluence));\n }\n gl_FragColor = vec4(final, color.a);\n}",pp_tonemap_frag:"uniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = texture2D(tDiffuse, vUv);\n float alpha = clamp(texel.a, 0.0, 1.0);\n gl_FragColor = texel;\n gl_FragColor.rgb /= alpha;\n #include <tonemapping_fragment>\n gl_FragColor = LinearTosRGB(gl_FragColor);\n gl_FragColor.rgb *= alpha;\n}",raw_meshline_frag:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D alphaMap;\nuniform float useMap;\nuniform float useAlphaMap;\nuniform float visibility;\nuniform float alphaTest;\nuniform vec2 repeat;\nuniform vec3 color;\nuniform float opacity;\nvarying vec2 vUV;\nvarying float vCounters;\nvec4 LinearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92,\n vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\n}\nvoid main() {\n vec4 c = vec4(color, opacity);\n \n if (useMap == 1.0) {\n c *= texture2D(map, vUV * repeat);\n }\n if (useAlphaMap == 1.0) {\n c.a *= texture2D(alphaMap, vUV * repeat).a;\n }\n if (c.a < alphaTest) {\n discard;\n }\n gl_FragColor = c;\n gl_FragColor.a *= step(vCounters, visibility);\n gl_FragColor = LinearTosRGB(gl_FragColor);\n}",raw_meshline_vert:"precision highp float;\nattribute vec3 position;\nattribute vec3 previous;\nattribute vec3 next;\nattribute float side;\nattribute float width;\nattribute vec2 uv;\nattribute float counters;\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform vec2 resolution;\nuniform float lineWidth;\nuniform float sizeAttenuation;\nvarying float vCounters;\nvarying vec2 vUV;\nconst float EQ_EPS = 0.000001;\nvec2 fix(vec4 i, float aspect) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n}\nbool posEqual(vec2 pos0, vec2 pos1) {\n return length(pos0 - pos1) < EQ_EPS;\n}\nvoid main() {\n float aspect = resolution.x / resolution.y;\n vCounters = counters;\n vUV = uv;\n mat4 m = projectionMatrix * modelViewMatrix;\n vec4 finalPosition = m * vec4(position, 1.0);\n vec4 prevPos = m * vec4(previous, 1.0);\n vec4 nextPos = m * vec4(next, 1.0);\n vec2 currentP = fix(finalPosition, aspect);\n vec2 prevP = fix(prevPos, aspect);\n vec2 nextP = fix(nextPos, aspect);\n float w = lineWidth * width;\n if (sizeAttenuation == 0.0) {\n w *= finalPosition.w / resolution.x;\n }\n vec2 dir;\n if (posEqual(nextP, currentP)) {\n dir = normalize(currentP - prevP);\n } else if (posEqual(prevP, currentP)) {\n dir = normalize(nextP - currentP);\n } else {\n vec2 dir1 = normalize(currentP - prevP);\n vec2 dir2 = normalize(nextP - currentP);\n dir = normalize(dir1 + dir2);\n }\n vec2 offset = vec2(-dir.y, dir.x);\n offset.y *= aspect;\n offset *= w;\n finalPosition.xy += offset * side;\n gl_Position = finalPosition;\n}"};function Sn(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function Ln(e){for(var t={},n=0;n<e.length;n++){var r=Sn(e[n]);for(var i in r)t[i]=r[i]}return t}var Cn,En,Pn,Rn={clone:Sn,merge:Ln},Fn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function In(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}Object.assign(In.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function a(e,t,n){return n<0&&(n+=1),1<n&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(e,t,n){if(e=Nt.euclideanModulo(e,1),t=Nt.clamp(t,0,1),n=Nt.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=a(i,r,e+1/3),this.g=a(i,r,e),this.b=a(i,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("v3d.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var c,u=(c=n[1]).length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}t&&0<t.length&&(void 0!==(c=Fn[t])?this.setHex(c):console.warn("v3d.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=0<t?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(){function t(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),copyLinearToSRGB:function(){function t(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("v3d.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),l=(s+o)/2;if(s===o)n=t=0;else{var c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case r:t=(i-a)/c+(i<a?6:0);break;case i:t=(a-r)/c+2;break;case a:t=(r-i)/c+4}t/=6}return e.h=t,e.s=n,e.l=l,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:(Pn={},function(e,t,n){return this.getHSL(Pn),Pn.h+=e,Pn.s+=t,Pn.l+=n,this.setHSL(Pn.h,Pn.s,Pn.l),this}),add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:(Cn={h:0,s:0,l:0},En={h:0,s:0,l:0},function(e,t){this.getHSL(Cn),e.getHSL(En);var n=Nt.lerp(Cn.h,En.h,t),r=Nt.lerp(Cn.s,En.s,t),i=Nt.lerp(Cn.l,En.l,t);return this.setHSL(n,r,i),this}),equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}});var On,Nn,Dn={common:{diffuse:{value:new In(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new zt},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Dt(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new In(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new In(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new zt}},sprite:{diffuse:{value:new In(15658734)},opacity:{value:1},center:{value:new Dt(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new zt}},mask:{depthTexture:{value:null},cameraNearFar:{value:new Dt(.5,.5)},textureMatrix:{value:new Mn}},node:{nodeRGB:{value:[]},nodeValue:{value:[]},flipCubeMap:{value:-1}}},Un={basic:{uniforms:Ln([Dn.common,Dn.specularmap,Dn.envmap,Dn.aomap,Dn.lightmap,Dn.fog]),vertexShader:Tn.meshbasic_vert,fragmentShader:Tn.meshbasic_frag},lambert:{uniforms:Ln([Dn.common,Dn.specularmap,Dn.envmap,Dn.aomap,Dn.lightmap,Dn.emissivemap,Dn.fog,Dn.lights,{emissive:{value:new In(0)}}]),vertexShader:Tn.meshlambert_vert,fragmentShader:Tn.meshlambert_frag},phong:{uniforms:Ln([Dn.common,Dn.specularmap,Dn.envmap,Dn.aomap,Dn.lightmap,Dn.emissivemap,Dn.bumpmap,Dn.normalmap,Dn.displacementmap,Dn.gradientmap,Dn.fog,Dn.lights,{emissive:{value:new In(0)},specular:{value:new In(1118481)},shininess:{value:30}}]),vertexShader:Tn.meshphong_vert,fragmentShader:Tn.meshphong_frag},standard:{uniforms:Ln([Dn.common,Dn.envmap,Dn.aomap,Dn.lightmap,Dn.emissivemap,Dn.bumpmap,Dn.normalmap,Dn.displacementmap,Dn.roughnessmap,Dn.metalnessmap,Dn.fog,Dn.lights,{emissive:{value:new In(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Tn.meshphysical_vert,fragmentShader:Tn.meshphysical_frag},matcap:{uniforms:Ln([Dn.common,Dn.bumpmap,Dn.normalmap,Dn.displacementmap,Dn.fog,{matcap:{value:null}}]),vertexShader:Tn.meshmatcap_vert,fragmentShader:Tn.meshmatcap_frag},points:{uniforms:Ln([Dn.points,Dn.fog]),vertexShader:Tn.points_vert,fragmentShader:Tn.points_frag},dashed:{uniforms:Ln([Dn.common,Dn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Tn.linedashed_vert,fragmentShader:Tn.linedashed_frag},depth:{uniforms:Ln([Dn.common,Dn.displacementmap]),vertexShader:Tn.depth_vert,fragmentShader:Tn.depth_frag},normal:{uniforms:Ln([Dn.common,Dn.bumpmap,Dn.normalmap,Dn.displacementmap,{opacity:{value:1}}]),vertexShader:Tn.normal_vert,fragmentShader:Tn.normal_frag},sprite:{uniforms:Ln([Dn.sprite,Dn.fog]),vertexShader:Tn.sprite_vert,fragmentShader:Tn.sprite_frag},background:{uniforms:{t2D:{value:null}},vertexShader:Tn.background_vert,fragmentShader:Tn.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Tn.cube_vert,fragmentShader:Tn.cube_frag},equirect:{uniforms:{tEquirect:{value:null},invertU:{value:!1},offsetU:{value:0}},vertexShader:Tn.equirect_vert,fragmentShader:Tn.equirect_frag},distanceRGBA:{uniforms:Ln([Dn.common,Dn.displacementmap,{referencePosition:{value:new Bt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Tn.distanceRGBA_vert,fragmentShader:Tn.distanceRGBA_frag},shadow:{uniforms:Ln([Dn.lights,Dn.fog,{color:{value:new In(0)},opacity:{value:1}}]),vertexShader:Tn.shadow_vert,fragmentShader:Tn.shadow_frag},mask:{uniforms:Ln([Dn.common,Dn.displacementmap,Dn.mask]),vertexShader:Tn.mask_vert,fragmentShader:Tn.mask_frag},equicube:{uniforms:{tEquirect:{value:null},faceIndex:{value:0},invertU:{value:!1},offsetU:{value:0}},vertexShader:Tn.equicube_vert,fragmentShader:Tn.equicube_frag},node:{uniforms:Ln([Dn.common,Dn.displacementmap,Dn.envmap,Dn.fog,Dn.lights,Dn.node,{envMapIntensity:{value:1}}]),vertexShader:Tn.meshnode_vert,fragmentShader:Tn.meshnode_frag}};function Bn(){var n=null,r=!1,i=null;function a(e,t){!1!==r&&(i(e,t),n.requestAnimationFrame(a))}return{start:function(){!0!==r&&null!==i&&(n.requestAnimationFrame(a),r=!0)},stop:function(){r=!1},setAnimationLoop:function(e){i=e},setContext:function(e){n=e}}}function zn(l){var c=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),c.get(e)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var t=c.get(e);t&&(l.deleteBuffer(t.buffer),c.delete(e))},update:function(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var n,r,i,a,o,s=c.get(e);void 0===s?c.set(e,function(e,t){var n=e.array,r=e.dynamic?35048:35044,i=l.createBuffer();l.bindBuffer(t,i),l.bufferData(t,n,r),e.onUploadCallback();var a=5126;return n instanceof Float32Array?a=5126:n instanceof Float64Array?console.warn("v3d.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?a=5123:n instanceof Int16Array?a=5122:n instanceof Uint32Array?a=5125:n instanceof Int32Array?a=5124:n instanceof Int8Array?a=5120:n instanceof Uint8Array&&(a=5121),{buffer:i,type:a,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version}}(e,t)):s.version<e.version&&(n=s.buffer,i=t,a=(r=e).array,o=r.updateRange,l.bindBuffer(i,n),!1===r.dynamic?l.bufferData(i,a,35044):-1===o.count?l.bufferSubData(i,0,a):0===o.count?console.error("v3d.WebGLObjects.updateBuffer: dynamic v3d.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(l.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),s.version=e.version)},dispose:function(){c=new WeakMap}}}function Gn(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||Gn.DefaultOrder}function kn(){this.mask=1}function Vn(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}function jn(e){return void 0!==e}function Wn(e,t,n){for(var r=0;r<e.length;r++)e[r]=Nt.clamp(e[r],t,n);return e}Un.physical={uniforms:Ln([Un.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Tn.meshphysical_vert,fragmentShader:Tn.meshphysical_frag},Un.copy={defines:{MAP_TEXELS:0},uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_copy_frag},Un.bokeh={defines:{DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},aspect:{value:1},aperture:{value:.025},maxblur:{value:1},nearClip:{value:1},farClip:{value:1e3},depthLeakThreshold:{value:.2}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_bokeh_frag},Un.ssao={uniforms:{tDiffuse:{value:null},tDepth:{value:null},size:{value:new Dt(512,512)},cameraNear:{value:1},cameraFar:{value:100},radius:{value:32},onlyAO:{value:0},aoClamp:{value:.25},lumInfluence:{value:.7}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_ssao_frag},Un.fxaa={uniforms:{tDiffuse:{value:null},resolution:{value:new Dt(1/1024,1/512)}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_fxaa_frag},Un.grayscale={uniforms:{tDiffuse:{value:null}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_grayscale_frag},Un.brightness_contrast={uniforms:{tDiffuse:{value:null},brightness:{value:0},contrast:{value:0}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_brightness_contrast_frag},Un.outline_edge={uniforms:{maskTexture:{value:null},texSize:{value:new Dt(.5,.5)},visibleEdgeColor:{value:new Bt(1,1,1)},hiddenEdgeColor:{value:new Bt(1,1,1)}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_outline_edge_frag},Un.outline_blur={defines:{MAX_RADIUS:4},uniforms:{colorTexture:{value:null},texSize:{value:new Dt(.5,.5)},direction:{value:new Dt(.5,.5)},kernelRadius:{value:1}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_outline_blur_frag},Un.outline_overlay={uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_outline_overlay_frag},Un.tonemap={uniforms:{tDiffuse:{value:null}},vertexShader:Tn.pp_plane_vert,fragmentShader:Tn.pp_tonemap_frag},Gn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Gn.DefaultOrder="XYZ",Object.defineProperties(Gn.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(Gn.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=Nt.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],p=i[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a))):"ZYX"===t?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===t?(this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("v3d.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:(Nn=new Mn,function(e,t,n){return Nn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Nn,t,n)}),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(On=new Ut,function(e){return On.setFromEuler(this),this.setFromQuaternion(On,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Bt(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(kn.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},test:function(e){return 0!=(this.mask&e.mask)}});var Xn,Hn,Yn,qn,Qn,Zn,Kn,Jn,$n,er,tr,nr,rr,ir,ar,or,sr,lr,cr,ur=0;function hr(){Object.defineProperty(this,"id",{value:ur++}),this.uuid=Nt.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=hr.DefaultUp.clone();var e=new Bt,t=new Gn,n=new Ut,r=new Bt(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 Mn},normalMatrix:{value:new zt}}),this.matrix=new Mn,this.matrixWorld=new Mn,this.matrixAutoUpdate=hr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new kn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.constraints=[],this.disableChildRendering=!1}function dr(){hr.call(this),this.type="Camera",this.matrixWorldInverse=new Mn,this.projectionMatrix=new Mn,this.projectionMatrixInverse=new Mn,this.controls=null,this.viewportFit={type:Ot,initialAspect:1}}function pr(e,t,n,r,i,a){dr.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==r?r:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function fr(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new Bt,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new In,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}hr.DefaultUp=new Bt(0,1,0),hr.DefaultMatrixAutoUpdate=!0,hr.prototype=Object.assign(Object.create(t.prototype),{constructor:hr,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(cr=new Ut,function(e,t){return cr.setFromAxisAngle(e,t),this.quaternion.multiply(cr),this}),rotateOnWorldAxis:(lr=new Ut,function(e,t){return lr.setFromAxisAngle(e,t),this.quaternion.premultiply(lr),this}),rotateX:(sr=new Bt(1,0,0),function(e){return this.rotateOnAxis(sr,e)}),rotateY:(or=new Bt(0,1,0),function(e){return this.rotateOnAxis(or,e)}),rotateZ:(ar=new Bt(0,0,1),function(e){return this.rotateOnAxis(ar,e)}),translateOnAxis:(ir=new Bt,function(e,t){return ir.copy(e).applyQuaternion(this.quaternion),this.position.add(ir.multiplyScalar(t)),this}),translateX:(rr=new Bt(1,0,0),function(e){return this.translateOnAxis(rr,e)}),translateY:(nr=new Bt(0,1,0),function(e){return this.translateOnAxis(nr,e)}),translateZ:(tr=new Bt(0,0,1),function(e){return this.translateOnAxis(tr,e)}),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(er=new Mn,function(e){return e.applyMatrix4(er.getInverse(this.matrixWorld))}),lookAt:(Zn=new Ut,Kn=new Mn,Jn=new Bt,$n=new Bt,function(e,t,n){e.isVector3?Jn.copy(e):Jn.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),$n.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Kn.lookAt($n,Jn,this.up):Kn.lookAt(Jn,$n,this.up),this.quaternion.setFromRotationMatrix(Kn),r&&(Kn.extractRotation(r.matrixWorld),Zn.setFromRotationMatrix(Kn),this.quaternion.premultiply(Zn.inverse()))}),add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?console.error("v3d.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("v3d.Object3D.add: object not an instance of v3d.Object3D.",e),this},remove:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(n,1)),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn("v3d.Object3D: .getWorldPosition() target is now required"),e=new Bt),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(qn=new Bt,Qn=new Bt,function(e){return void 0===e&&(console.warn("v3d.Object3D: .getWorldQuaternion() target is now required"),e=new Ut),this.updateMatrixWorld(!0),this.matrixWorld.decompose(qn,e,Qn),e}),getWorldScale:(Hn=new Bt,Yn=new Ut,function(e){return void 0===e&&(console.warn("v3d.Object3D: .getWorldScale() target is now required"),e=new Bt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Hn,Yn,e),e}),getWorldDirection:function(e){void 0===e&&(console.warn("v3d.Object3D: .getWorldDirection() target is now required"),e=new Bt),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.updateConstraints(),this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e=!(this.matrixWorldNeedsUpdate=!1));for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(n){var e=void 0===n||"string"==typeof n,t={};e&&(n={geometries:{},materials:{},textures:{},images:{},shapes:{}},t.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(e,t){return void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(n)),t.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),!1===this.disableChildRendering&&(r.disableChildRendering=!1),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isMesh&&this.drawMode!==_t&&(r.drawMode=this.drawMode),this.isMesh||this.isLine||this.isPoints){r.geometry=i(n.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];i(n.shapes,c)}else i(n.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var u=[];for(s=0,l=this.material.length;s<l;s++)u.push(i(n.materials,this.material[s]));r.material=u}else r.material=i(n.materials,this.material);if(0<this.children.length){r.children=[];for(s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(n).object)}if(e){var h=m(n.geometries),d=m(n.materials),p=m(n.textures),f=m(n.images);o=m(n.shapes);0<h.length&&(t.geometries=h),0<d.length&&(t.materials=d),0<p.length&&(t.textures=p),0<f.length&&(t.images=f),0<o.length&&(t.shapes=o)}return t.object=r,t;function m(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.disableChildRendering=e.disableChildRendering,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this},copyTransform:(Xn=new Mn,function(e){this.matrix.copy(e.matrixWorld),this.parent&&this.matrix.multiplyMatrices(Xn.getInverse(this.parent.matrixWorld),this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)}),isVisible:function(){return this.visible},updateConstraints:function(){for(var e=0;e<this.constraints.length;e++)this.constraints[e].update(this)},getWorldPositionNU:function(e){return e.setFromMatrixPosition(this.matrixWorld)},findRoot:function(){var t=this;return this.traverseAncestors(function(e){t=e}),t}}),dr.prototype=Object.assign(Object.create(hr.prototype),{constructor:dr,isCamera:!0,copy:function(e,t){return hr.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),e.controls&&(this.controls={type:e.controls.type,enablePan:e.controls.enablePan,rotateSpeed:e.controls.rotateSpeed,moveSpeed:e.controls.moveSpeed,orbitMinDistance:e.controls.orbitMinDistance,orbitMaxDistance:e.controls.orbitMaxDistance,orbitMinPolarAngle:e.controls.orbitMinPolarAngle,orbitMaxPolarAngle:e.controls.orbitMaxPolarAngle,orbitMinAzimuthAngle:e.controls.orbitMinAzimuthAngle,orbitMaxAzimuthAngle:e.controls.orbitMaxAzimuthAngle},e.controls.orbitTarget&&(this.controls.orbitTarget=(new Bt).copy(e.controls.orbitTarget))),this.viewportFit.type=e.viewportFit.type,this.viewportFit.initialAspect=e.viewportFit.initialAspect,this},getWorldDirection:function(e){void 0===e&&(console.warn("v3d.Camera: .getWorldDirection() target is now required"),e=new Bt),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){hr.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(e){return(new this.constructor).copy(this,e)}}),pr.prototype=Object.assign(Object.create(dr.prototype),{constructor:pr,isOrthographicCamera:!0,copy:function(e,t){return dr.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var l=this.zoom/(this.view.width/this.view.fullWidth),c=this.zoom/(this.view.height/this.view.fullHeight),u=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;a=(i+=u*(this.view.offsetX/l))+u*(this.view.width/l),s=(o-=h*(this.view.offsetY/c))-h*(this.view.height/c)}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=hr.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),Object.assign(fr.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var mr,vr,gr,yr,xr,_r,br,wr=0;function Ar(){Object.defineProperty(this,"id",{value:wr+=2}),this.uuid=Nt.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Mr(e,t,n){if(Array.isArray(e))throw new TypeError("v3d.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Tr(e,t,n){Mr.call(this,new Int8Array(e),t,n)}function Sr(e,t,n){Mr.call(this,new Uint8Array(e),t,n)}function Lr(e,t,n){Mr.call(this,new Uint8ClampedArray(e),t,n)}function Cr(e,t,n){Mr.call(this,new Int16Array(e),t,n)}function Er(e,t,n){Mr.call(this,new Uint16Array(e),t,n)}function Pr(e,t,n){Mr.call(this,new Int32Array(e),t,n)}function Rr(e,t,n){Mr.call(this,new Uint32Array(e),t,n)}function Fr(e,t,n){Mr.call(this,new Float32Array(e),t,n)}function Ir(e,t,n){Mr.call(this,new Float64Array(e),t,n)}function Or(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}Ar.prototype=Object.assign(Object.create(t.prototype),{constructor:Ar,isGeometry:!0,applyMatrix:function(e){for(var t=(new zt).getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++){this.vertices[n].applyMatrix4(e)}for(n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:(br=new Mn,function(e){return br.makeRotationX(e),this.applyMatrix(br),this}),rotateY:(_r=new Mn,function(e){return _r.makeRotationY(e),this.applyMatrix(_r),this}),rotateZ:(xr=new Mn,function(e){return xr.makeRotationZ(e),this.applyMatrix(xr),this}),translate:(yr=new Mn,function(e,t,n){return yr.makeTranslation(e,t,n),this.applyMatrix(yr),this}),scale:(gr=new Mn,function(e,t,n){return gr.makeScale(e,t,n),this.applyMatrix(gr),this}),lookAt:(vr=new hr,function(e){vr.lookAt(e),vr.updateMatrix(),this.applyMatrix(vr.matrix)}),fromBufferGeometry:function(e){var o=this,t=null!==e.index?e.index.array:void 0,n=e.attributes,r=n.position.array,s=void 0!==n.normal?n.normal.array:void 0,l=void 0!==n.color?n.color.array:void 0,c=void 0!==n.uv?n.uv.array:void 0,u=void 0!==n.uv2?n.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var i=0,a=0;i<r.length;i+=3,a+=2)o.vertices.push((new Bt).fromArray(r,i)),void 0!==l&&o.colors.push((new In).fromArray(l,i));function h(e,t,n,r){var i=void 0===l?[]:[o.colors[e].clone(),o.colors[t].clone(),o.colors[n].clone()],a=new fr(e,t,n,void 0===s?[]:[(new Bt).fromArray(s,3*e),(new Bt).fromArray(s,3*t),(new Bt).fromArray(s,3*n)],i,r);o.faces.push(a),void 0!==c&&o.faceVertexUvs[0].push([(new Dt).fromArray(c,2*e),(new Dt).fromArray(c,2*t),(new Dt).fromArray(c,2*n)]),void 0!==u&&o.faceVertexUvs[1].push([(new Dt).fromArray(u,2*e),(new Dt).fromArray(u,2*t),(new Dt).fromArray(u,2*n)])}var d=e.groups;if(0<d.length)for(i=0;i<d.length;i++)for(var p=d[i],f=p.start,m=(a=f,f+p.count);a<m;a+=3)void 0!==t?h(t[a],t[a+1],t[a+2],p.materialIndex):h(a,a+1,a+2,p.materialIndex);else if(void 0!==t)for(i=0;i<t.length;i+=3)h(t[i],t[i+1],t[i+2]);else for(i=0;i<r.length/3;i+=3)h(i,i+1,i+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:(mr=new Bt,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(mr).negate(),this.translate(mr.x,mr.y,mr.z),this}),normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,r=new Mn;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new Bt,t=new Bt,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t,n,r,i,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new Bt;if(e){var s,l,c,u=new Bt,h=new Bt;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],l=this.vertices[a.b],c=this.vertices[a.c],u.subVectors(c,l),h.subVectors(s,l),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)o[(a=this.faces[r]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){var d=(a=this.faces[r]).vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var r=(n=this.faces[e]).vertexNormals;3===r.length?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for((i=this.faces[n]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new Ar;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)l=new Bt,c={a:new Bt,b:new Bt,c:new Bt},o.push(l),s.push(c)}var l,c,u=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)i=this.faces[n],l=u.faceNormals[n],c=u.vertexNormals[n],l.copy(i.normal),c.a.copy(i.vertexNormals[0]),c.b.copy(i.vertexNormals[1]),c.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)(i=this.faces[n]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new _n),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new bn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.faceVertexUvs[0],u=e.faceVertexUvs[0],h=this.colors,d=e.colors;void 0===n&&(n=0),void 0!==t&&(r=(new zt).getNormalMatrix(t));for(var p=0,f=o.length;p<f;p++){var m=o[p].clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(p=0,f=d.length;p<f;p++)h.push(d[p].clone());for(p=0,f=l.length;p<f;p++){var v,g,y,x=l[p],_=x.vertexNormals,b=x.vertexColors;(v=new fr(x.a+i,x.b+i,x.c+i)).normal.copy(x.normal),void 0!==r&&v.normal.applyMatrix3(r).normalize();for(var w=0,A=_.length;w<A;w++)g=_[w].clone(),void 0!==r&&g.applyMatrix3(r).normalize(),v.vertexNormals.push(g);v.color.copy(x.color);for(w=0,A=b.length;w<A;w++)y=b[w],v.vertexColors.push(y.clone());v.materialIndex=x.materialIndex+n,s.push(v)}for(p=0,f=u.length;p<f;p++){var M=u[p],T=[];if(void 0!==M){for(w=0,A=M.length;w<A;w++)T.push(M[w].clone());c.push(T)}}}else console.error("v3d.Geometry.merge(): geometry not an instance of v3d.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("v3d.Geometry.mergeMesh(): mesh not an instance of v3d.Mesh.",e)},mergeVertices:function(){var e,t,n,r,i,a,o,s,l={},c=[],u=[],h=Math.pow(10,4);for(n=0,r=this.vertices.length;n<r;n++)e=this.vertices[n],void 0===l[t=Math.round(e.x*h)+"_"+Math.round(e.y*h)+"_"+Math.round(e.z*h)]?(l[t]=n,c.push(this.vertices[n]),u[n]=c.length-1):u[n]=u[l[t]];var d=[];for(n=0,r=this.faces.length;n<r;n++){(i=this.faces[n]).a=u[i.a],i.b=u[i.b],i.c=u[i.c],a=[i.a,i.b,i.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(n);break}}for(n=d.length-1;0<=n;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-c.length;return this.vertices=c,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new Bt(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var r,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(r=[]),o&&o.length===t&&(i=[]);for(n=0;n<t;n++){var s=e[n]._id;r&&r.push(a[s]),i&&i.push(o[s])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}var o=[],s=[],l={},c=[],u={},h=[],d={};for(i=0;i<this.faces.length;i++){var p=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=0<p.normal.length(),v=0<p.vertexNormals.length,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=0<p.vertexColors.length,x=0;if(x=A(x=A(x=A(x=A(x=A(x=A(x=A(x=A(x,0,0),1,!0),2,!1),3,f),4,m),5,v),6,g),7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var _=this.faceVertexUvs[0][i];o.push(S(_[0]),S(_[1]),S(_[2]))}if(m&&o.push(M(p.normal)),v){var b=p.vertexNormals;o.push(M(b[0]),M(b[1]),M(b[2]))}if(g&&o.push(T(p.color)),y){var w=p.vertexColors;o.push(T(w[0]),T(w[1]),T(w[2]))}}function A(e,t,n){return n?e|1<<t:e&~(1<<t)}function M(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]||(l[t]=s.length/3,s.push(e.x,e.y,e.z)),l[t]}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]||(u[t]=c.length,c.push(e.getHex())),u[t]}function S(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=h.length/2,h.push(e.x,e.y)),d[t]}return e.data={},e.data.vertices=r,e.data.normals=s,0<c.length&&(e.data.colors=c),0<h.length&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new Ar).copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var l=e.colors;for(t=0,n=l.length;t<n;t++)this.colors.push(l[t].clone());var c=e.faces;for(t=0,n=c.length;t<n;t++)this.faces.push(c[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var h=u[r],d=[];for(a=0,o=h.length;a<o;a++){var p=h[a];d.push(p.clone())}this.faceVertexUvs[t].push(d)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],r=0,i=f[t].vertices.length;r<i;r++)m.vertices.push(f[t].vertices[r].clone());if(void 0!==f[t].normals)for(m.normals=[],r=0,i=f[t].normals.length;r<i;r++)m.normals.push(f[t].normals[r].clone());this.morphTargets.push(m)}var v=e.morphNormals;for(t=0,n=v.length;t<n;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],r=0,i=v[t].vertexNormals.length;r<i;r++){var y=v[t].vertexNormals[r],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],r=0,i=v[t].faceNormals.length;r<i;r++)g.faceNormals.push(v[t].faceNormals[r].clone());this.morphNormals.push(g)}var _=e.skinWeights;for(t=0,n=_.length;t<n;t++)this.skinWeights.push(_[t].clone());var b=e.skinIndices;for(t=0,n=b.length;t<n;t++)this.skinIndices.push(b[t].clone());var w=e.lineDistances;for(t=0,n=w.length;t<n;t++)this.lineDistances.push(w[t]);var A=e.boundingBox;null!==A&&(this.boundingBox=A.clone());var M=e.boundingSphere;return null!==M&&(this.boundingSphere=M.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Mr.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Mr.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("v3d.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.itemSize:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("v3d.BufferAttribute.copyColorsArray(): color is undefined",r),a=new In),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("v3d.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new Dt),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("v3d.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new Bt),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("v3d.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new mn),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(Tr.prototype=Object.create(Mr.prototype)).constructor=Tr,(Sr.prototype=Object.create(Mr.prototype)).constructor=Sr,(Lr.prototype=Object.create(Mr.prototype)).constructor=Lr,(Cr.prototype=Object.create(Mr.prototype)).constructor=Cr,(Er.prototype=Object.create(Mr.prototype)).constructor=Er,(Pr.prototype=Object.create(Mr.prototype)).constructor=Pr,(Rr.prototype=Object.create(Mr.prototype)).constructor=Rr,(Fr.prototype=Object.create(Mr.prototype)).constructor=Fr,(Ir.prototype=Object.create(Mr.prototype)).constructor=Ir,Object.assign(Or.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:r})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,i=e.faceVertexUvs,a=i[0]&&0<i[0].length,o=i[1]&&0<i[1].length,s=e.morphTargets,l=s.length;if(0<l){t=[];for(var c=0;c<l;c++)t[c]={name:s[c].name,data:[]};this.morphTargets.position=t}var u,h=e.morphNormals,d=h.length;if(0<d){u=[];for(c=0;c<d;c++)u[c]={name:h[c].name,data:[]};this.morphTargets.normal=u}var p=e.skinIndices,f=e.skinWeights,m=p.length===r.length,v=f.length===r.length;0<r.length&&0===n.length&&console.error("v3d.DirectGeometry: Faceless geometries are not supported.");for(c=0;c<n.length;c++){var g=n[c];this.vertices.push(r[g.a],r[g.b],r[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var _,b=g.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=g.color;this.colors.push(w,w,w)}if(!0===a)void 0!==(_=i[0][c])?this.uvs.push(_[0],_[1],_[2]):(console.warn("v3d.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new Dt,new Dt,new Dt));if(!0===o)void 0!==(_=i[1][c])?this.uvs2.push(_[0],_[1],_[2]):(console.warn("v3d.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new Dt,new Dt,new Dt));for(var A=0;A<l;A++){var M=s[A].vertices;t[A].data.push(M[g.a],M[g.b],M[g.c])}for(A=0;A<d;A++){var T=h[A].vertexNormals[c];u[A].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(p[g.a],p[g.b],p[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}});var Nr,Dr,Ur,Br,zr,Gr,kr,Vr,jr,Wr,Xr,Hr,Yr=1;function qr(){Object.defineProperty(this,"id",{value:Yr+=2}),this.uuid=Nt.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function Qr(e,t,n,r,i,a){Ar.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new Zr(e,t,n,r,i,a)),this.mergeVertices()}function Zr(e,t,n,r,i,a){qr.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};var E=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;var P=[],R=[],F=[],I=[],O=0,N=0;function o(e,t,n,r,i,a,o,s,l,c,u){var h,d,p=a/l,f=o/c,m=a/2,v=o/2,g=s/2,y=l+1,x=c+1,_=0,b=0,w=new Bt;for(d=0;d<x;d++){var A=d*f-v;for(h=0;h<y;h++){var M=h*p-m;w[e]=M*r,w[t]=A*i,w[n]=g,R.push(w.x,w.y,w.z),w[e]=0,w[t]=0,w[n]=0<s?1:-1,F.push(w.x,w.y,w.z),I.push(h/l),I.push(1-d/c),_+=1}}for(d=0;d<c;d++)for(h=0;h<l;h++){var T=O+h+y*d,S=O+h+y*(d+1),L=O+(h+1)+y*(d+1),C=O+(h+1)+y*d;P.push(T,S,C),P.push(S,L,C),b+=6}E.addGroup(N,b,u),N+=b,O+=_}o("z","y","x",-1,-1,n,t,e,a,i,0),o("z","y","x",1,-1,n,t,-e,a,i,1),o("x","z","y",1,1,e,n,t,r,a,2),o("x","z","y",1,-1,e,n,-t,r,a,3),o("x","y","z",1,-1,e,t,n,r,i,4),o("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(P),this.addAttribute("position",new Fr(R,3)),this.addAttribute("normal",new Fr(F,3)),this.addAttribute("uv",new Fr(I,2))}function Kr(e,t,n,r){Ar.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Jr(e,t,n,r)),this.mergeVertices()}function Jr(e,t,n,r){qr.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};var i,a,o=(e=e||1)/2,s=(t=t||1)/2,l=Math.floor(n)||1,c=Math.floor(r)||1,u=l+1,h=c+1,d=e/l,p=t/c,f=[],m=[],v=[],g=[];for(a=0;a<h;a++){var y=a*p-s;for(i=0;i<u;i++){var x=i*d-o;m.push(x,-y,0),v.push(0,0,1),g.push(i/l),g.push(1-a/c)}}for(a=0;a<c;a++)for(i=0;i<l;i++){var _=i+u*a,b=i+u*(a+1),w=i+1+u*(a+1),A=i+1+u*a;f.push(_,b,A),f.push(b,w,A)}this.setIndex(f),this.addAttribute("position",new Fr(m,3)),this.addAttribute("normal",new Fr(v,3)),this.addAttribute("uv",new Fr(g,2))}qr.prototype=Object.assign(Object.create(t.prototype),{constructor:qr,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(65535<Vn(e)?Rr:Er)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?("index"===e?(console.warn("v3d.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t)):this.attributes[e]=t,this):(console.warn("v3d.BufferGeometry: .addAttribute() now expects (name, attribute)."),this.addAttribute(e,new Mr(t,arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new zt).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);var r=this.attributes.tangent;void 0!==r&&((new zt).getNormalMatrix(e).applyToBufferAttribute(r),r.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(Hr=new Mn,function(e){return Hr.makeRotationX(e),this.applyMatrix(Hr),this}),rotateY:(Xr=new Mn,function(e){return Xr.makeRotationY(e),this.applyMatrix(Xr),this}),rotateZ:(Wr=new Mn,function(e){return Wr.makeRotationZ(e),this.applyMatrix(Wr),this}),translate:(jr=new Mn,function(e,t,n){return jr.makeTranslation(e,t,n),this.applyMatrix(jr),this}),scale:(Vr=new Mn,function(e,t,n){return Vr.makeScale(e,t,n),this.applyMatrix(Vr),this}),lookAt:(kr=new hr,function(e){kr.lookAt(e),kr.updateMatrix(),this.applyMatrix(kr.matrix)}),center:(Gr=new Bt,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gr).negate(),this.translate(Gr.x,Gr.y,Gr.z),this}),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Fr(3*t.vertices.length,3),r=new Fr(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new Fr(t.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.addAttribute("position",new Fr(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var r=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(r=void 0,n.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(n);r.verticesNeedUpdate=n.verticesNeedUpdate,r.normalsNeedUpdate=n.normalsNeedUpdate,r.colorsNeedUpdate=n.colorsNeedUpdate,r.uvsNeedUpdate=n.uvsNeedUpdate,r.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=r}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Or).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new Mr(t,3).copyVector3sArray(e.vertices)),0<e.normals.length){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new Mr(n,3).copyVector3sArray(e.normals))}if(0<e.colors.length){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new Mr(r,3).copyColorsArray(e.colors))}if(0<e.uvs.length){var i=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new Mr(i,2).copyVector2sArray(e.uvs))}if(0<e.uvs2.length){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new Mr(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,u=l.length;c<u;c++){var h=l[c],d=new Fr(3*h.data.length,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(0<e.skinIndices.length){var p=new Fr(4*e.skinIndices.length,4);this.addAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(0<e.skinWeights.length){var f=new Fr(4*e.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:(zr=new _n,function(){null===this.boundingBox&&(this.boundingBox=new _n);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];zr.setFromBufferAttribute(i),this.boundingBox.expandByPoint(zr.min),this.boundingBox.expandByPoint(zr.max)}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('v3d.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}),computeBoundingSphere:(Dr=new _n,Ur=new _n,Br=new Bt,function(){null===this.boundingSphere&&(this.boundingSphere=new bn);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(Dr.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];Ur.setFromBufferAttribute(a),Dr.expandByPoint(Ur.min),Dr.expandByPoint(Ur.max)}Dr.getCenter(n);var o=0;for(r=0,i=e.count;r<i;r++)Br.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(Br));if(t)for(r=0,i=t.length;r<i;r++)for(var s=0,l=(a=t[r]).count;s<l;s++)Br.fromBufferAttribute(a,r),o=Math.max(o,n.distanceToSquared(Br));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('v3d.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new Mr(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o,s,l,c=t.normal.array,u=new Bt,h=new Bt,d=new Bt,p=new Bt,f=new Bt;if(e){var m=e.array;for(i=0,a=e.count;i<a;i+=3)o=3*m[i+0],s=3*m[i+1],l=3*m[i+2],u.fromArray(n,o),h.fromArray(n,s),d.fromArray(n,l),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),c[o]+=p.x,c[o+1]+=p.y,c[o+2]+=p.z,c[s]+=p.x,c[s+1]+=p.y,c[s+2]+=p.z,c[l]+=p.x,c[l+1]+=p.y,c[l+2]+=p.z}else for(i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),h.fromArray(n,i+3),d.fromArray(n,i+6),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),c[i]=p.x,c[i+1]=p.y,c[i+2]=p.z,c[i+3]=p.x,c[i+4]=p.y,c[i+5]=p.z,c[i+6]=p.x,c[i+7]=p.y,c[i+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("v3d.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var r in n)if(void 0!==e.attributes[r])for(var i=n[r].array,a=e.attributes[r],o=a.array,s=0,l=a.itemSize*t;s<o.length;s++,l++)i[l]=o[s];return this}console.error("v3d.BufferGeometry.merge(): geometry not an instance of v3d.BufferGeometry.",e)},normalizeNormals:(Nr=new Bt,function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Nr.x=e.getX(t),Nr.y=e.getY(t),Nr.z=e.getZ(t),Nr.normalize(),e.setXYZ(t,Nr.x,Nr.y,Nr.z)}),toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=new n.constructor(t.length*r),a=0,o=0,s=0,l=t.length;s<l;s++){a=t[s]*r;for(var c=0;c<r;c++)i[o++]=n[a++]}return new Mr(i,r)}if(null===this.index)return console.warn("v3d.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new qr,n=this.index.array,r=this.attributes;for(var i in r){var a=e(r[i],n);t.addAttribute(i,a)}var o=this.morphAttributes;for(i in o){for(var s=[],l=o[i],c=0,u=l.length;c<u;c++){a=e(l[c],n);s.push(a)}t.morphAttributes[i]=s}for(var h=this.groups,d=(c=0,h.length);c<d;c++){var p=h[c];t.addGroup(p.start,p.count,p.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),0<Object.keys(this.userData).length&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a={itemSize:(d=i[n]).itemSize,type:d.array.constructor.name,array:Array.prototype.slice.call(d.array),normalized:d.normalized};""!==d.name&&(a.name=d.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],c=[],u=0,h=l.length;u<h;u++){var d;a={itemSize:(d=l[u]).itemSize,type:d.array.constructor.name,array:Array.prototype.slice.call(d.array),normalized:d.normalized};""!==d.name&&(a.name=d.name),c.push(a)}0<c.length&&(o[n]=c,s=!0)}s&&(e.data.morphAttributes=o);var p=this.groups;0<p.length&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new qr).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,r=c.length;n<r;n++)l.push(c[n].clone());this.morphAttributes[t]=l}var u=e.groups;for(n=0,r=u.length;n<r;n++){var h=u[n];this.addGroup(h.start,h.count,h.materialIndex)}var d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=e.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(Qr.prototype=Object.create(Ar.prototype)).constructor=Qr,(Zr.prototype=Object.create(qr.prototype)).constructor=Zr,(Kr.prototype=Object.create(Ar.prototype)).constructor=Kr,(Jr.prototype=Object.create(qr.prototype)).constructor=Jr;var $r=0;function ei(){Object.defineProperty(this,"id",{value:$r++}),this.uuid=Nt.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=K,this.side=N,this.flatShading=!1,this.vertexTangents=!1,this.vertexColors=d,this.opacity=1,this.transparent=!1,this.blendSrc=w,this.blendDst=A,this.blendEquation=ne,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=oe,this.depthTest=!0,this.depthWrite=!0,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.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.userData={},this.needsUpdate=!0,this.receiveShadow=!1,this.castShadow=!1,this.useHDR=!1}function ti(e){ei.call(this),this.type="MeshBasicMaterial",this.color=new In(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(e)}ei.prototype=Object.assign(Object.create(t.prototype),{constructor:ei,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("v3d."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("v3d.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.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.map&&this.map.isTexture&&(n.map=this.map.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),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.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==K&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==N&&(n.side=this.side),this.vertexColors!==d&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,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),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),0<this.alphaTest&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),1<this.wireframeLinewidth&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);0<i.length&&(n.textures=i),0<a.length&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.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.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.shadowSide=e.shadowSide,this.receiveShadow=e.receiveShadow,this.castShadow=e.castShadow,this.useHDR=e.useHDR,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((ti.prototype=Object.create(ei.prototype)).constructor=ti).prototype.isMeshBasicMaterial=!0,ti.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var ni,ri,ii,ai,oi,si,li,ci,ui,hi,di,pi,fi,mi,vi,gi,yi,xi,_i,bi,wi,Ai,Mi,Ti,Si,Li="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",Ci="void main() {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}";function Ei(e){ei.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Li,this.fragmentShader=Ci,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("v3d.ShaderMaterial: attributes should now be defined in v3d.BufferGeometry instead."),this.setValues(e))}function Pi(e,t){this.origin=void 0!==e?e:new Bt,this.direction=void 0!==t?t:new Bt}function Ri(e,t,n){this.a=void 0!==e?e:new Bt,this.b=void 0!==t?t:new Bt,this.c=void 0!==n?n:new Bt}function Fi(e,t){hr.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new qr,this.material=void 0!==t?t:new ti({color:16777215*Math.random()}),this.drawMode=_t,this.updateMorphTargets(),this.isMaterialGeneratedMesh=!1}function Ii(h,n,d,r){var p,f,m,v,g=new In(0),y=0;function x(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,r)}return{getClearColor:function(){return g},setClearColor:function(e,t){g.set(e),x(g,y=void 0!==t?t:1)},getClearAlpha:function(){return y},setClearAlpha:function(e){x(g,y=e)},dispose:function(){f&&(f.geometry.dispose(),f.material.dispose()),f=p=void 0,m&&(m.geometry.dispose(),m.material.dispose()),m=void 0,v&&(v.geometry.dispose(),v.material.dispose()),v=void 0},render:function(e,t,n,r){var i=t.background&&t.background.isSceneBackground,a=i?t.background.data:t.background;null===a?x(g,y):a&&a.isColor&&(x(a,1),r=!0),(h.autoClear||r)&&h.clear(h.autoClearColor,h.autoClearDepth,h.autoClearStencil);var o=!!i&&t.background.useHDR;if(a&&(a.isCubeTexture||a.isWebGLRenderTargetCube)){void 0===m&&((m=new Fi(new Zr(1,1,1),new Ei({type:"WebGLBackground",uniforms:Rn.clone(Un.cube.uniforms),vertexShader:Un.cube.vertexShader,fragmentShader:Un.cube.fragmentShader,side:be,depthTest:!0,depthWrite:!1,fog:!1,polygonOffset:!0,useHDR:o,defines:{BACKGROUND_DEPTH:""}}))).geometry.removeAttribute("normal"),m.geometry.removeAttribute("uv"),m.onBeforeRender=function(e,t,n){var r=n.far;this.matrixWorld.makeScale(r,r,r),this.matrixWorld.copyPosition(n.matrixWorld)}),d.update(m);var s=a.isCubeTexture?a:a.texture;m.material.uniforms.tCube.value=s;var l=a.isCubeTexture?-1:1;m.material.uniforms.tFlip.value=l,e.push(m,m.geometry,m.material,0,0,null)}else if(a&&a.isTexture)if(a.mapping===ye){var c=!!i&&t.background.equirecInvertU,u=i?t.background.equirecOffsetU:0;void 0===v&&((v=new Fi(new Zr(1,1,1),new Ei({vertexShader:Un.equirect.vertexShader,fragmentShader:Un.equirect.fragmentShader,uniforms:Un.equirect.uniforms,side:be,depthWrite:!1,polygonOffset:!0,useHDR:o,defines:{BACKGROUND_DEPTH:""}}))).geometry.removeAttribute("normal"),v.geometry.removeAttribute("uv"),v.onBeforeRender=function(e,t,n){var r=n.far;this.matrixWorld.makeScale(r,r,r),this.matrixWorld.copyPosition(n.matrixWorld)}),d.update(v),v.material.uniforms.invertU.value=c,v.material.uniforms.offsetU.value=u,v.material.uniforms.tEquirect.value=a,e.push(v,v.geometry,v.material,0,0,null)}else void 0===p&&(p=new pr(-1,1,1,-1,0,1),f=new Fi(new Jr(2,2),new ti({depthTest:!1,depthWrite:!1,fog:!1}))),d.update(f),f.material.map=a,h.renderBufferDirect(p,null,f.geometry,f.material,f,null)}}}function Oi(i,a,o,s){var l;this.setMode=function(e){l=e},this.render=function(e,t){i.drawArrays(l,e,t),o.update(t,l)},this.renderInstances=function(e,t,n){var r;if(s.isWebGL2)r=i;else if(null===(r=a.get("ANGLE_instanced_arrays")))return void console.error("v3d.WebGLBufferRenderer: using v3d.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");r[s.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](l,t,n,e.maxInstancedCount),o.update(n,l,e.maxInstancedCount)}}function Ni(t,n,e){var r;function i(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(35633,36338).precision&&0<t.getShaderPrecisionFormat(35632,36338).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(35633,36337).precision&&0<t.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,o=void 0!==e.precision?e.precision:"highp",s=i(o);s!==o&&(console.warn("v3d.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===e.logarithmicDepthBuffer,c=t.getParameter(34930),u=t.getParameter(35660),h=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),v=t.getParameter(36349),g=0<u,y=a||!!n.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;var e=n.get("EXT_texture_filter_anisotropic");return r=null!==e?t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?t.getParameter(36183):0}}function Di(){var u=this,h=null,d=0,p=!1,f=!1,m=new wn,v=new zt,g={value:null,needsUpdate:!1};function y(){g.value!==h&&(g.value=h,g.needsUpdate=0<d),u.numPlanes=d,u.numIntersection=0}function x(e,t,n,r){var i=null!==e?e.length:0,a=null;if(0!==i){if(a=g.value,!0!==r||null===a){var o=n+4*i,s=t.matrixWorldInverse;v.getNormalMatrix(s),(null===a||a.length<o)&&(a=new Float32Array(o));for(var l=0,c=n;l!==i;++l,c+=4)m.copy(e[l]).applyMatrix4(s,v),m.normal.toArray(a,c),a[c+3]=m.constant}g.value=a,g.needsUpdate=!0}return u.numPlanes=i,a}this.uniform=g,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,n){var r=0!==e.length||t||0!==d||p;return p=t,h=x(e,n,0),d=e.length,r},this.beginShadows=function(){f=!0,x(null)},this.endShadows=function(){f=!1,y()},this.setState=function(e,t,n,r,i,a){if(!p||null===e||0===e.length||f&&!n)f?x(null):y();else{var o=f?0:d,s=4*o,l=i.clippingState||null;g.value=l,l=x(e,r,s,a);for(var c=0;c!==s;++c)l[c]=h[c];i.clippingState=l,this.numIntersection=t?this.numPlanes:0,this.numPlanes+=o}}}function Ui(n){var r={};return{get:function(e){if(void 0!==r[e])return r[e];var t;switch(e){case"WEBGL_depth_texture":t=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":t=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":t=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":t=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:t=n.getExtension(e)}return null===t&&console.warn("v3d.WebGLRenderer: "+e+" extension not supported."),r[e]=t}}}function Bi(e,h,a){var o={},d={};function s(e){var t=e.target,n=o[t.id];for(var r in null!==n.index&&h.remove(n.index),n.attributes)h.remove(n.attributes[r]);t.removeEventListener("dispose",s),delete o[t.id];var i=d[n.id];i&&(h.remove(i),delete d[n.id]),a.memory.geometries--}return{get:function(e,t){var n=o[t.id];return n||(t.addEventListener("dispose",s),t.isBufferGeometry?n=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new qr).setFromObject(e)),n=t._bufferGeometry),o[t.id]=n,a.memory.geometries++,n)},update:function(e){var t=e.index,n=e.attributes;for(var r in null!==t&&h.update(t,34963),n)h.update(n[r],34962);var i=e.morphAttributes;for(var r in i)for(var a=i[r],o=0,s=a.length;o<s;o++)h.update(a[o],34962)},getWireframeAttribute:function(e){var t=d[e.id];if(t)return t;var n,r=[],i=e.index,a=e.attributes;if(null!==i)for(var o=0,s=(n=i.array).length;o<s;o+=3){var l=n[o+0],c=n[o+1],u=n[o+2];r.push(l,c,c,u,u,l)}else for(o=0,s=(n=a.position.array).length/3-1;o<s;o+=3)l=o+0,c=o+1,u=o+2,r.push(l,c,c,u,u,l);return t=new(65535<Vn(r)?Rr:Er)(r,1),h.update(t,34963),d[e.id]=t}}}function zi(i,a,o,s){var l,c,u;this.setMode=function(e){l=e},this.setIndex=function(e){c=e.type,u=e.bytesPerElement},this.render=function(e,t){i.drawElements(l,t,c,e*u),o.update(t,l)},this.renderInstances=function(e,t,n){var r;if(s.isWebGL2)r=i;else if(null===(r=a.get("ANGLE_instanced_arrays")))return void console.error("v3d.WebGLIndexedBufferRenderer: using v3d.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");r[s.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](l,n,c,t*u,e.maxInstancedCount),o.update(n,l,e.maxInstancedCount)}}function Gi(e){var r={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:r,programs:null,autoReset:!0,reset:function(){r.frame++,r.calls=0,r.triangles=0,r.points=0,r.lines=0},update:function(e,t,n){switch(n=n||1,r.calls++,t){case 4:r.triangles+=n*(e/3);break;case 5:case 6:r.triangles+=n*(e-2);break;case 1:r.lines+=n*(e/2);break;case 3:r.lines+=n*(e-1);break;case 2:r.lines+=n*e;break;case 0:r.points+=n*e;break;default:console.error("v3d.WebGLInfo: Unknown draw mode:",t)}}}}function ki(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Vi(p){var f={},m=new Float32Array(8);return{update:function(e,t,n,r){var i=e.morphTargetInfluences,a=i.length,o=f[t.id];if(void 0===o){o=[];for(var s=0;s<a;s++)o[s]=[s,0];f[t.id]=o}var l=n.morphTargets&&t.morphAttributes.position,c=n.morphNormals&&t.morphAttributes.normal;for(s=0;s<a;s++)0!==(u=o[s])[1]&&(l&&t.removeAttribute("morphTarget"+s),c&&t.removeAttribute("morphNormal"+s));for(s=0;s<a;s++)(u=o[s])[0]=s,u[1]=i[s];for(o.sort(ki),s=0;s<8;s++){var u;if(u=o[s]){var h=u[0],d=u[1];if(d){l&&t.addAttribute("morphTarget"+s,l[h]),c&&t.addAttribute("morphNormal"+s,c[h]),m[s]=d;continue}}m[s]=0}r.getUniforms().setValue(p,"morphTargetInfluences",m)}}}function ji(i,a){var o={};return{update:function(e){var t=a.render.frame,n=e.geometry,r=i.get(e,n);return o[r.id]!==t&&(n.isGeometry&&r.updateFromObject(e),i.update(r),o[r.id]=t),r},dispose:function(){o={}}}}function Wi(e,t,n,r,i,a,o,s,l,c){fn.call(this,e=void 0!==e?e:[],t=void 0!==t?t:ve,n,r,i,a,o=void 0!==o?o:ze,s,l,c),this.flipY=!1}function Xi(e,t,n,r){fn.call(this,null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=D,this.minFilter=D,this.wrapR=I,this.generateMipmaps=!1,this.flipY=!1}function Hi(e,t,n,r){fn.call(this,null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=D,this.minFilter=D,this.wrapR=I,this.generateMipmaps=!1,this.flipY=!1}((Ei.prototype=Object.create(ei.prototype)).constructor=Ei).prototype.isShaderMaterial=!0,Ei.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Sn(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Ei.prototype.toJSON=function(e){var t=ei.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var 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}}0<Object.keys(this.defines).length&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return 0<Object.keys(i).length&&(t.extensions=i),t},Object.assign(Pi.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("v3d.Ray: .at() target is now required"),t=new Bt),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:(di=new Bt,function(e){return this.origin.copy(this.at(e,di)),this}),closestPointToPoint:function(e,t){void 0===t&&(console.warn("v3d.Ray: .closestPointToPoint() target is now required"),t=new Bt),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:(hi=new Bt,function(e){var t=hi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(hi.copy(this.direction).multiplyScalar(t).add(this.origin),hi.distanceToSquared(e))}),distanceSqToSegment:(li=new Bt,ci=new Bt,ui=new Bt,function(e,t,n,r){li.copy(e).add(t).multiplyScalar(.5),ci.copy(t).sub(e).normalize(),ui.copy(this.origin).sub(li);var i,a,o,s,l=.5*e.distanceTo(t),c=-this.direction.dot(ci),u=ui.dot(this.direction),h=-ui.dot(ci),d=ui.lengthSq(),p=Math.abs(1-c*c);if(0<p)if(a=c*u-h,s=l*p,0<=(i=c*h-u))if(-s<=a)if(a<=s){var f=1/p;o=(i*=f)*(i+c*(a*=f)+2*u)+a*(c*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else o=a<=-s?-(i=Math.max(0,-(-c*l+u)))*i+(a=0<i?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):-(i=Math.max(0,-(c*l+u)))*i+(a=0<i?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=0<c?-l:l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(ci).multiplyScalar(a).add(li),o}),intersectSphere:(si=new Bt,function(e,t){si.subVectors(e.center,this.origin);var n=si.dot(this.direction),r=si.dot(si)-n*n,i=e.radius*e.radius;if(i<r)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}),intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return 0<=n?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return r=0<=l?(n=(e.min.x-h.x)*l,(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,(e.min.x-h.x)*l),(a=0<=c?(i=(e.min.y-h.y)*c,(e.max.y-h.y)*c):(i=(e.max.y-h.y)*c,(e.min.y-h.y)*c))<n||r<i?null:((n<i||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),(s=0<=u?(o=(e.min.z-h.z)*u,(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,(e.min.z-h.z)*u))<n||r<o?null:((n<o||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(0<=n?n:r,t)))},intersectsBox:(oi=new Bt,function(e){return null!==this.intersectBox(e,oi)}),intersectTriangle:(ni=new Bt,ri=new Bt,ii=new Bt,ai=new Bt,function(e,t,n,r,i){ri.subVectors(t,e),ii.subVectors(n,e),ai.crossVectors(ri,ii);var a,o=this.direction.dot(ai);if(0<o){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}ni.subVectors(this.origin,e);var s=a*this.direction.dot(ii.crossVectors(ni,ii));if(s<0)return null;var l=a*this.direction.dot(ri.cross(ni));if(l<0)return null;if(o<s+l)return null;var c=-a*ni.dot(ai);return c<0?null:this.at(c/o,i)}),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(Ri,{getNormal:(yi=new Bt,function(e,t,n,r){void 0===r&&(console.warn("v3d.Triangle: .getNormal() target is now required"),r=new Bt),r.subVectors(n,t),yi.subVectors(e,t),r.cross(yi);var i=r.lengthSq();return 0<i?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}),getBarycoord:(mi=new Bt,vi=new Bt,gi=new Bt,function(e,t,n,r,i){mi.subVectors(r,t),vi.subVectors(n,t),gi.subVectors(e,t);var a=mi.dot(mi),o=mi.dot(vi),s=mi.dot(gi),l=vi.dot(vi),c=vi.dot(gi),u=a*l-o*o;if(void 0===i&&(console.warn("v3d.Triangle: .getBarycoord() target is now required"),i=new Bt),0===u)return i.set(-2,-1,-1);var h=1/u,d=(l*s-o*c)*h,p=(a*c-o*s)*h;return i.set(1-d-p,p,d)}),containsPoint:(fi=new Bt,function(e,t,n,r){return Ri.getBarycoord(e,t,n,r,fi),0<=fi.x&&0<=fi.y&&fi.x+fi.y<=1}),getUV:(pi=new Bt,function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,pi),s.set(0,0),s.addScaledVector(i,pi.x),s.addScaledVector(a,pi.y),s.addScaledVector(o,pi.z),s})}),Object.assign(Ri.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:(Ti=new Bt,Si=new Bt,function(){return Ti.subVectors(this.c,this.b),Si.subVectors(this.a,this.b),.5*Ti.cross(Si).length()}),getMidpoint:function(e){return void 0===e&&(console.warn("v3d.Triangle: .getMidpoint() target is now required"),e=new Bt),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Ri.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("v3d.Triangle: .getPlane() target is now required"),e=new Bt),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Ri.getBarycoord(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Ri.containsPoint(e,this.a,this.b,this.c)},getUV:function(e,t,n,r,i){return Ri.getUV(e,this.a,this.b,this.c,t,n,r,i)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:(xi=new Bt,_i=new Bt,bi=new Bt,wi=new Bt,Ai=new Bt,Mi=new Bt,function(e,t){void 0===t&&(console.warn("v3d.Triangle: .closestPointToPoint() target is now required"),t=new Bt);var n,r,i=this.a,a=this.b,o=this.c;xi.subVectors(a,i),_i.subVectors(o,i),wi.subVectors(e,i);var s=xi.dot(wi),l=_i.dot(wi);if(s<=0&&l<=0)return t.copy(i);Ai.subVectors(e,a);var c=xi.dot(Ai),u=_i.dot(Ai);if(0<=c&&u<=c)return t.copy(a);var h=s*u-c*l;if(h<=0&&0<=s&&c<=0)return n=s/(s-c),t.copy(i).addScaledVector(xi,n);Mi.subVectors(e,o);var d=xi.dot(Mi),p=_i.dot(Mi);if(0<=p&&d<=p)return t.copy(o);var f=d*l-s*p;if(f<=0&&0<=l&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(_i,r);var m=c*p-d*u;if(m<=0&&0<=u-c&&0<=d-p)return bi.subVectors(o,a),r=(u-c)/(u-c+(d-p)),t.copy(a).addScaledVector(bi,r);var v=1/(m+f+h);return n=f*v,r=h*v,t.copy(i).addScaledVector(xi,n).addScaledVector(_i,r)}),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),Fi.prototype=Object.assign(Object.create(hr.prototype),{constructor:Fi,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e,t){return hr.prototype.copy.call(this,e,t),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.isMaterialGeneratedMesh=e.isMaterialGeneratedMesh,this},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(0<a.length){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=r.morphTargets;void 0!==s&&0<s.length&&console.error("v3d.Mesh.updateMorphTargets() no longer supports v3d.Geometry. Use v3d.BufferGeometry instead.")}},raycast:function(){var N=new Mn,D=new Pi,U=new bn,g=new Bt,y=new Bt,x=new Bt,_=new Bt,b=new Bt,w=new Bt,A=new Bt,M=new Bt,T=new Bt,B=new Dt,z=new Dt,G=new Dt,k=new Bt,V=new Bt;function j(e,t,n,r,i,a,o,s){if(null===(t.side===be?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==Q,s)))return null;V.copy(s),V.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(V);return l<n.near||l>n.far?null:{distance:l,point:V.clone(),object:e}}function W(e,t,n,r,i,a,o,s,l,c){g.fromBufferAttribute(i,s),y.fromBufferAttribute(i,l),x.fromBufferAttribute(i,c);var u=e.morphTargetInfluences;if(t.morphTargets&&a&&u){A.set(0,0,0),M.set(0,0,0),T.set(0,0,0);for(var h=0,d=a.length;h<d;h++){var p=u[h],f=a[h];0!==p&&(_.fromBufferAttribute(f,s),b.fromBufferAttribute(f,l),w.fromBufferAttribute(f,c),A.addScaledVector(_.sub(g),p),M.addScaledVector(b.sub(y),p),T.addScaledVector(w.sub(x),p))}g.add(A),y.add(M),x.add(T)}var m=j(e,t,n,r,g,y,x,k);if(m){o&&(B.fromBufferAttribute(o,s),z.fromBufferAttribute(o,l),G.fromBufferAttribute(o,c),m.uv=Ri.getUV(k,g,y,x,B,z,G,new Dt));var v=new fr(s,l,c);Ri.getNormal(g,y,x,v.normal),m.face=v}return m}return function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),U.copy(n.boundingSphere),U.applyMatrix4(i),!1!==e.ray.intersectsSphere(U)))if(N.getInverse(i),D.copy(e.ray).applyMatrix4(N),!0!==e.params.Mesh.omitGeometry){var a;if(null===n.boundingBox||!1!==D.intersectsBox(n.boundingBox))if(n.isBufferGeometry){var o,s,l,c,u,h,d,p,f,m=n.index,v=n.attributes.position,g=n.morphAttributes.position,y=n.attributes.uv,x=n.groups,_=n.drawRange;if(null!==m)if(Array.isArray(r))for(c=0,h=x.length;c<h;c++)for(f=r[(p=x[c]).materialIndex],u=Math.max(p.start,_.start),d=Math.min(p.start+p.count,_.start+_.count);u<d;u+=3)o=m.getX(u),s=m.getX(u+1),l=m.getX(u+2),(a=W(this,f,e,D,v,g,y,o,s,l))&&(a.faceIndex=Math.floor(u/3),a.face.materialIndex=p.materialIndex,t.push(a));else for(c=Math.max(0,_.start),h=Math.min(m.count,_.start+_.count);c<h;c+=3)o=m.getX(c),s=m.getX(c+1),l=m.getX(c+2),(a=W(this,r,e,D,v,g,y,o,s,l))&&(a.faceIndex=Math.floor(c/3),t.push(a));else if(void 0!==v)if(Array.isArray(r))for(c=0,h=x.length;c<h;c++)for(f=r[(p=x[c]).materialIndex],u=Math.max(p.start,_.start),d=Math.min(p.start+p.count,_.start+_.count);u<d;u+=3)(a=W(this,f,e,D,v,g,y,o=u,s=u+1,l=u+2))&&(a.faceIndex=Math.floor(u/3),a.face.materialIndex=p.materialIndex,t.push(a));else for(c=Math.max(0,_.start),h=Math.min(v.count,_.start+_.count);c<h;c+=3)(a=W(this,r,e,D,v,g,y,o=c,s=c+1,l=c+2))&&(a.faceIndex=Math.floor(c/3),t.push(a))}else if(n.isGeometry){var b,w,A,M,T=Array.isArray(r),S=n.vertices,L=n.faces,C=n.faceVertexUvs[0];0<C.length&&(M=C);for(var E=0,P=L.length;E<P;E++){var R=L[E],F=T?r[R.materialIndex]:r;if(void 0!==F&&(b=S[R.a],w=S[R.b],A=S[R.c],a=j(this,F,e,D,b,w,A,k))){if(M&&M[E]){var I=M[E];B.copy(I[0]),z.copy(I[1]),G.copy(I[2]),a.uv=Ri.getUV(k,b,w,A,B,z,G,new Dt)}a.face=R,a.faceIndex=E,t.push(a)}}}}else{if(null==n.boundingBox&&n.computeBoundingBox(),!D.intersectBox(n.boundingBox,k))return;V.copy(k),V.applyMatrix4(i);var O=e.ray.origin.distanceTo(V);if(O<e.near||O>e.far)return;t.push({distance:O,point:V,face:null,faceIndex:null,object:this})}}}(),clone:function(e){return new this.constructor(this.geometry,this.material).copy(this,e)},isVisible:function(){return this.isMaterialGeneratedMesh&&this.parent?this.visible&&this.parent.visible:this.visible}}),((Wi.prototype=Object.create(fn.prototype)).constructor=Wi).prototype.isCubeTexture=!0,Object.defineProperty(Wi.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),((Xi.prototype=Object.create(fn.prototype)).constructor=Xi).prototype.isDataTexture2DArray=!0,((Hi.prototype=Object.create(fn.prototype)).constructor=Hi).prototype.isDataTexture3D=!0;var Yi=new fn,qi=new Xi,Qi=new Hi,Zi=new Wi,Ki=[],Ji=[],$i=new Float32Array(16),ea=new Float32Array(9),ta=new Float32Array(4);function na(e,t,n){var r=e[0];if(r<=0||0<r)return e;var i=t*n,a=Ki[i];if(void 0===a&&(a=new Float32Array(i),Ki[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function ra(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function ia(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function aa(e,t){var n=Ji[t];void 0===n&&(n=new Int32Array(t),Ji[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function oa(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function sa(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function la(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ra(n,t))return;e.uniform2fv(this.addr,t),ia(n,t)}}function ca(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(ra(n,t))return;e.uniform3fv(this.addr,t),ia(n,t)}}function ua(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ra(n,t))return;e.uniform4fv(this.addr,t),ia(n,t)}}function ha(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ra(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),ia(n,t)}else{if(ra(n,r))return;ta.set(r),e.uniformMatrix2fv(this.addr,!1,ta),ia(n,r)}}function da(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ra(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),ia(n,t)}else{if(ra(n,r))return;ea.set(r),e.uniformMatrix3fv(this.addr,!1,ea),ia(n,r)}}function pa(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ra(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),ia(n,t)}else{if(ra(n,r))return;$i.set(r),e.uniformMatrix4fv(this.addr,!1,$i),ia(n,r)}}function fa(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||Yi,i)}function ma(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||qi,i)}function va(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||Qi,i)}function ga(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||Zi,i)}function ya(e,t){var n=this.cache;ra(n,t)||(e.uniform2iv(this.addr,t),ia(n,t))}function xa(e,t){var n=this.cache;ra(n,t)||(e.uniform3iv(this.addr,t),ia(n,t))}function _a(e,t){var n=this.cache;ra(n,t)||(e.uniform4iv(this.addr,t),ia(n,t))}function ba(e,t){var n=this.cache;ra(n,t)||(e.uniform1fv(this.addr,t),ia(n,t))}function wa(e,t){var n=this.cache;ra(n,t)||(e.uniform1iv(this.addr,t),ia(n,t))}function Aa(e,t){var n=this.cache,r=na(t,this.size,2);ra(n,r)||(e.uniform2fv(this.addr,r),this.updateCache(r))}function Ma(e,t){var n=this.cache,r=na(t,this.size,3);ra(n,r)||(e.uniform3fv(this.addr,r),this.updateCache(r))}function Ta(e,t){var n=this.cache,r=na(t,this.size,4);ra(n,r)||(e.uniform4fv(this.addr,r),this.updateCache(r))}function Sa(e,t){var n=this.cache,r=na(t,this.size,4);ra(n,r)||(e.uniformMatrix2fv(this.addr,!1,r),this.updateCache(r))}function La(e,t){var n=this.cache,r=na(t,this.size,9);ra(n,r)||(e.uniformMatrix3fv(this.addr,!1,r),this.updateCache(r))}function Ca(e,t){var n=this.cache,r=na(t,this.size,16);ra(n,r)||(e.uniformMatrix4fv(this.addr,!1,r),this.updateCache(r))}function Ea(e,t,n){var r=this.cache,i=t.length,a=aa(n,i);!1===ra(r,a)&&(e.uniform1iv(this.addr,a),ia(r,a));for(var o=0;o!==i;++o)n.safeSetTexture2D(t[o]||Yi,a[o])}function Pa(e,t,n){var r=this.cache,i=t.length,a=aa(n,i);!1===ra(r,a)&&(e.uniform1iv(this.addr,a),ia(r,a));for(var o=0;o!==i;++o)n.safeSetTextureCube(t[o]||Zi,a[o])}function Ra(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return oa;case 35664:return la;case 35665:return ca;case 35666:return ua;case 35674:return ha;case 35675:return da;case 35676:return pa;case 35678:case 36198:return fa;case 35679:return va;case 35680:return ga;case 36289:return ma;case 5124:case 35670:return sa;case 35667:case 35671:return ya;case 35668:case 35672:return xa;case 35669:case 35673:return _a}}(t.type)}function Fa(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return ba;case 35664:return Aa;case 35665:return Ma;case 35666:return Ta;case 35674:return Sa;case 35675:return La;case 35676:return Ca;case 35678:return Ea;case 35680:return Pa;case 5124:case 35670:return wa;case 35667:case 35671:return ya;case 35668:case 35672:return xa;case 35669:case 35673:return _a}}(t.type)}function Ia(e){this.id=e,this.seq=[],this.map={}}Fa.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),ia(t,e)},Ia.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var Oa=/([\w\d_]+)(\])?(\[|\.)?/g;function Na(e,t){e.seq.push(t),e.map[t.id]=t}function Da(e,t,n){var r=e.name,i=r.length;for(Oa.lastIndex=0;;){var a=Oa.exec(r),o=Oa.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===i){Na(n,void 0===c?new Ra(s,e,t):new Fa(s,e,t));break}var u=n.map[s];void 0===u&&Na(n,u=new Ia(s)),n=u}}function Ua(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Da(i,e.getUniformLocation(t,i.name),this)}}function Ba(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),!1===e.getShaderParameter(r,35713)&&console.error("v3d.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(r)&&console.warn("v3d.WebGLShader: gl.getShaderInfoLog()",35633===t?"vertex":"fragment",e.getShaderInfoLog(r),function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(n)),r}Ua.prototype.setValue=function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)},Ua.prototype.setOptional=function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)},Ua.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},Ua.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};var za=0;function Ga(e){switch(e){case bt:return["Linear","(value)"];case wt:return["sRGB","(value)"];case Mt:return["RGBE","(value)"];case Tt:return["RGBM","(value, 7.0)"];case St:return["RGBM","(value, 16.0)"];case Lt:return["RGBD","(value, 256.0)"];case At:return["Gamma","(value, float(GAMMA_FACTOR))"];default:throw new Error("unsupported encoding: "+e)}}function ka(e,t){var n=Ga(t);return"vec4 "+e+"(vec4 value) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Va(e){return""!==e}function ja(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function Wa(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function Xa(e){return e.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(e,t){var n=Tn[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Xa(n)})}function Ha(e){for(var t,n=new RegExp("#pragma unroll_loop[\\s]+?for \\(int (\\w+) \\= (\\d+)\\; (\\w+) < (\\d+)\\; (\\w+)\\+\\+\\) \\{"),r=new RegExp("\\{|\\}","g");t=n.exec(e);){var i,a;i=a=r.lastIndex=t.index+t[0].length;for(var o,s=1;(o=r.exec(e))&&("{"==o[0]?s++:"}"==o[0]&&s--,a=o.index),o&&0<s;);if(0==s){for(var l=e.substring(t.index,r.lastIndex),c=e.substring(i,a),u=new RegExp("\\["+t[1]+"\\]","g"),h="",d=parseInt(t[2]);d<parseInt(t[4]);d++)h+="{"+c.replace(u,"["+d+"]")+"}";e=e.replace(l,h)}}return e}function Ya(e,t,n,r,i,a,o,s){var l=e.context,c=r.defines,u=i.vertexShader,h=i.fragmentShader,d="SHADOWMAP_TYPE_BASIC";a.shadowMapType===k?d="SHADOWMAP_TYPE_PCF":a.shadowMapType===V&&(d="SHADOWMAP_TYPE_PCF_SOFT");var p="ENVMAP_TYPE_CUBE",f="ENVMAP_MODE_REFLECTION",m="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(r.envMap.mapping){case ve:case ge:p="ENVMAP_TYPE_CUBE";break;case Me:case Te:p="ENVMAP_TYPE_CUBE_UV";break;case ye:case xe:p="ENVMAP_TYPE_EQUIREC";break;case Ae:p="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case ge:case xe:f="ENVMAP_MODE_REFRACTION"}switch(r.combine){case j:m="ENVMAP_BLENDING_MULTIPLY";break;case W:m="ENVMAP_BLENDING_MIX";break;case X:m="ENVMAP_BLENDING_ADD"}}var v,g,y,x,_,b,w,A,M=0<e.gammaFactor?e.gammaFactor:1,T=a.unitsScaleFactor%1?String(a.unitsScaleFactor):String(a.unitsScaleFactor)+".0",S=o.isWebGL2?"":(v=r.extensions,g=a,y=t,[(v=v||{}).derivatives||g.envMapCubeUV||g.bumpMap||g.normalMap&&!g.objectSpaceNormalMap||g.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(v.fragDepth||g.logarithmicDepthBuffer)&&y.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",v.drawBuffers&&y.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(v.shaderTextureLOD||g.envMap)&&y.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Va).join("\n")),L=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(c),C=l.createProgram();if(r.isRawShaderMaterial?(0<(x=[L].filter(Va).join("\n")).length&&(x+="\n"),0<(_=[S,L].filter(Va).join("\n")).length&&(_+="\n")):(x=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,L,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+M,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+d:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(Va).join("\n"),_=[S,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,L,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+M,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+p:"",a.envMap?"#define "+f:"",a.envMap?"#define "+m:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+d:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"",a.physicallyCorrectLights?"#define UNITS_SCALE_FACTOR "+T:"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping===he||a.useHDR?"":"#define TONE_MAPPING",a.toneMapping===he||a.useHDR?"":Tn.tonemapping_pars_fragment,a.toneMapping===he||a.useHDR?"":function(e,t){var n;switch(t){case we:n="Linear";break;case de:n="Reinhard";break;case pe:n="Uncharted2";break;case fe:n="OptimizedCineon";break;case me:n="ACESFilmic";break;case It:n="LogarithmicMax";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"(vec3 color) { return "+n+"ToneMapping(color); }"}("toneMapping",a.toneMapping),a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Tn.encodings_pars_fragment:"",a.mapEncoding?ka("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?ka("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?ka("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?ka("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(b="linearToOutputTexel",w=a.outputEncoding,A=Ga(w),"vec4 "+b+"(vec4 value) { return LinearTo"+A[0]+A[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(Va).join("\n")),r.isMeshNodeMaterial&&(u=qa(u,r.nodeChunks),h=qa(h,r.nodeChunks)),u=Wa(u=ja(u=Xa(u),a),a),h=Wa(h=ja(h=Xa(h),a),a),u=Ha(u),h=Ha(h),o.isWebGL2&&!r.isRawShaderMaterial){var E=!1,P=/^\s*#version\s+300\s+es\s*\n/;r.isShaderMaterial&&null!==u.match(P)&&null!==h.match(P)&&(E=!0,u=u.replace(P,""),h=h.replace(P,"")),x=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,_=["#version 300 es\n","#define varying in",E?"":"out highp vec4 pc_fragColor;",E?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+_}var R=_+h,F=Ba(l,35633,x+u),I=Ba(l,35632,R);l.attachShader(C,F),l.attachShader(C,I),void 0!==r.index0AttributeName?l.bindAttribLocation(C,0,r.index0AttributeName):!0===a.morphTargets&&l.bindAttribLocation(C,0,"position"),l.linkProgram(C);var O,N,D=l.getProgramInfoLog(C).trim(),U=l.getShaderInfoLog(F).trim(),B=l.getShaderInfoLog(I).trim(),z=!0,G=!0;return!1===l.getProgramParameter(C,35714)?(z=!1,console.error("v3d.WebGLProgram: shader error: ",l.getError(),"35715",l.getProgramParameter(C,35715),"gl.getProgramInfoLog",D,U,B)):""!==D?console.warn("v3d.WebGLProgram: gl.getProgramInfoLog()",D):""!==U&&""!==B||(G=!1),G&&(this.diagnostics={runnable:z,material:r,programLog:D,vertexShader:{log:U,prefix:x},fragmentShader:{log:B,prefix:_}}),l.deleteShader(F),l.deleteShader(I),this.getUniforms=function(){return void 0===O&&(O=new Ua(l,C,s)),O},this.getAttributes=function(){return void 0===N&&(N=function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}(l,C)),N},this.destroy=function(){l.deleteProgram(C),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("v3d.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("v3d.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.name=i.name,this.id=za++,this.code=n,this.usedTimes=1,this.program=C,this.vertexShader=F,this.fragmentShader=I,this.profile={calcRenderTime:!1,renderTime:0,timerQueries:[],materials:[]},this.beginTimerQuery=function(e,t){if(this.profile.calcRenderTime){var n=e.getExtension(t?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query");if(n){if(t){var r=e.createQuery();e.beginQuery(n.TIME_ELAPSED_EXT,r)}else{r=n.createQueryEXT();n.beginQueryEXT(n.TIME_ELAPSED_EXT,r)}this.profile.timerQueries.push(r)}}},this.endTimerQuery=function(e,t){if(this.profile.calcRenderTime){var n=e.getExtension(t?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query");if(n){t?e.endQuery(n.TIME_ELAPSED_EXT):n.endQueryEXT(n.TIME_ELAPSED_EXT);for(var r=this.profile.timerQueries,i=r.length-1;0<=i;i--){var a=r[i],o=t?e.getQueryParameter(a,34919):n.getQueryObjectEXT(a,n.QUERY_RESULT_AVAILABLE_EXT),s=e.getParameter(n.GPU_DISJOINT_EXT);if(o&&!s){var l=t?e.getQueryParameter(a,34918):n.getQueryObjectEXT(a,n.QUERY_RESULT_EXT);this.profile.renderTime+=l/1e6,r.splice(i,1)}}}}},this}function qa(e,t){for(var n in t)e=e.replace("#include <"+n+">",t[n]);return e}function Qa(d,c,p,u){var h=[],f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite",MeshMaskMaterial:"mask",MeshNodeMaterial:"node"},a=["precision","supportsVertexTextures","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","unitsScaleFactor","useHDR"];function m(e,t){var n;return e?e.isTexture?n=e.encoding:e.isWebGLRenderTarget&&(console.warn("v3d.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=e.texture.encoding):n=wt,n===bt&&t&&(n=At),n}this.getParameters=function(e,t,n,r,i,a,o){var s=f[e.type],l=o.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(p.floatVertexTextures)return 1024;var n=p.maxVertexUniforms,r=Math.floor((n-20)/4),i=Math.min(r,t.length);return i<t.length?(console.warn("v3d.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+i+"."),0):i}(o):0,c=p.precision;null!==e.precision&&(c=p.getMaxPrecision(e.precision))!==e.precision&&console.warn("v3d.WebGLProgram.getParameters:",e.precision,"not supported, using",c,"instead.");var u=d.getRenderTarget(),h=o.geometry;return{shaderID:s,precision:c,supportsVertexTextures:p.vertexTextures,outputEncoding:m(u?u.texture:null,d.gammaOutput),map:!!e.map,mapEncoding:m(e.map,d.gammaInput),matcap:!!e.matcap,matcapEncoding:m(e.matcap,d.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:m(e.envMap,d.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===Me||e.envMap.mapping===Te),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:m(e.emissiveMap,d.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:e.normalMapType===Rt,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,combine:e.combine,vertexTangents:e.normalMap&&(e.vertexTangents||h&&h.isBufferGeometry&&h.getAttribute("tangent")),vertexColors:e.vertexColors,fog:!!r,useFog:e.fog,fogExp:r&&r.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:p.logarithmicDepthBuffer,skinning:e.skinning&&0<l,maxBones:l,useVertexTexture:p.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:d.maxMorphTargets,maxMorphNormals:d.maxMorphNormals,numDirLights:t.directional.length,numPointLights:t.point.length,numSpotLights:t.spot.length,numRectAreaLights:t.rectArea.length,numHemiLights:t.hemi.length,numClippingPlanes:i,numClipIntersection:a,dithering:e.dithering,shadowMapEnabled:d.shadowMap.enabled&&o.receiveShadow&&0<n.length,shadowMapType:d.shadowMap.type,toneMapping:d.toneMapping,physicallyCorrectLights:d.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===Q,flipSided:e.side===be,depthPacking:void 0!==e.depthPacking&&e.depthPacking,unitsScaleFactor:d.unitsScaleFactor,useHDR:!!e.useHDR}},this.getProgramCode=function(e,t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);for(var i=0;i<a.length;i++)n.push(t[a[i]]);return n.push(e.onBeforeCompile.toString()),n.push(d.gammaOutput),n.push(d.gammaFactor),void 0!==e.nodeChunksHash&&n.push(e.nodeChunksHash),n.join()},this.acquireProgram=function(e,t,n,r){for(var i,a=0,o=h.length;a<o;a++){var s=h[a];if(s.code===r){++(i=s).usedTimes;break}}void 0===i&&(i=new Ya(d,c,r,e,t,n,p,u),h.push(i));var l=i.profile.materials;return e.name&&l.indexOf(e.name)<0&&l.push(e.name),i},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},this.programs=h}function Za(){var r=new WeakMap;return{get:function(e){var t=r.get(e);return void 0===t&&(t={},r.set(e,t)),t},remove:function(e){r.delete(e)},update:function(e,t,n){r.get(e)[t]=n},dispose:function(){r=new WeakMap}}}function Ka(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id: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 Ja(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 $a(){var s=[],l=0,c=[],u=[],h={id:-1};function d(e,t,n,r,i,a){var o=s[l];return void 0===o?(o={id:e.id,object:e,geometry:t,material:n,program:n.program||h,groupOrder:r,renderOrder:e.renderOrder,z:i,group:a},s[l]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=n,o.program=n.program||h,o.groupOrder=r,o.renderOrder=e.renderOrder,o.z=i,o.group=a),l++,o}return{opaque:c,transparent:u,init:function(){l=0,c.length=0,u.length=0},push:function(e,t,n,r,i,a){var o=d(e,t,n,r,i,a);(!0===n.transparent?u:c).push(o)},unshift:function(e,t,n,r,i,a){var o=d(e,t,n,r,i,a);(!0===n.transparent?u:c).unshift(o)},sort:function(){1<c.length&&c.sort(Ka),1<u.length&&u.sort(Ja)}}}function eo(){var i={};function a(e){var t=e.target;t.removeEventListener("dispose",a),delete i[t.id]}return{get:function(e,t){var n,r=i[e.id];return void 0===r?(n=new $a,i[e.id]={},i[e.id][t.id]=n,e.addEventListener("dispose",a)):void 0===(n=r[t.id])&&(n=new $a,r[t.id]=n),n},dispose:function(){i={}}}}function to(){var n={};return{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":t={direction:new Bt,color:new In,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Dt};break;case"SpotLight":t={position:new Bt,direction:new Bt,color:new In,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Dt};break;case"PointLight":t={position:new Bt,color:new In,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Dt,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":t={direction:new Bt,skyColor:new In,groundColor:new In};break;case"RectAreaLight":t={color:new In,position:new Bt,halfWidth:new Bt,halfHeight:new Bt}}return n[e.id]=t}}}var no=0;function ro(){var b=new to,w={id:no++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},A=new Bt,M=new Mn,T=new Mn;return{setup:function(e,t,n){for(var r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=n.matrixWorldInverse,d=0,p=e.length;d<p;d++){var f=e[d],m=f.color,v=f.intensity,g=f.distance,y=f.shadow&&f.shadow.map?f.shadow.map.texture:null;if(f.isAmbientLight)r+=m.r*v,i+=m.g*v,a+=m.b*v;else if(f.isDirectionalLight){if((_=b.get(f)).color.copy(f.color).multiplyScalar(f.intensity),_.direction.setFromMatrixPosition(f.matrixWorld),A.setFromMatrixPosition(f.target.matrixWorld),_.direction.sub(A),_.direction.transformDirection(h),_.shadow=f.castShadow,f.castShadow){var x=f.shadow;_.shadowBias=x.bias,_.shadowRadius=x.radius,_.shadowMapSize=x.mapSize}w.directionalShadowMap[o]=y,w.directionalShadowMatrix[o]=f.shadow.matrix,w.directional[o]=_,o++}else if(f.isSpotLight)(_=b.get(f)).position.setFromMatrixPosition(f.matrixWorld),_.position.applyMatrix4(h),_.color.copy(m).multiplyScalar(v),_.distance=g,_.direction.setFromMatrixPosition(f.matrixWorld),A.setFromMatrixPosition(f.target.matrixWorld),_.direction.sub(A),_.direction.transformDirection(h),_.coneCos=Math.cos(f.angle),_.penumbraCos=Math.cos(f.angle*(1-f.penumbra)),_.decay=f.decay,_.shadow=f.castShadow,f.castShadow&&(x=f.shadow,_.shadowBias=x.bias,_.shadowRadius=x.radius,_.shadowMapSize=x.mapSize),w.spotShadowMap[l]=y,w.spotShadowMatrix[l]=f.shadow.matrix,w.spot[l]=_,l++;else if(f.isRectAreaLight)(_=b.get(f)).color.copy(m).multiplyScalar(v),_.position.setFromMatrixPosition(f.matrixWorld),_.position.applyMatrix4(h),T.identity(),M.copy(f.matrixWorld),M.premultiply(h),T.extractRotation(M),_.halfWidth.set(.5*f.width,0,0),_.halfHeight.set(0,.5*f.height,0),_.halfWidth.applyMatrix4(T),_.halfHeight.applyMatrix4(T),w.rectArea[c]=_,c++;else if(f.isPointLight)(_=b.get(f)).position.setFromMatrixPosition(f.matrixWorld),_.position.applyMatrix4(h),_.color.copy(f.color).multiplyScalar(f.intensity),_.distance=f.distance,_.decay=f.decay,_.shadow=f.castShadow,f.castShadow&&(x=f.shadow,_.shadowBias=x.bias,_.shadowRadius=x.radius,_.shadowMapSize=x.mapSize,_.shadowCameraNear=x.camera.near,_.shadowCameraFar=x.camera.far),w.pointShadowMap[s]=y,w.pointShadowMatrix[s]=f.shadow.matrix,w.point[s]=_,s++;else if(f.isHemisphereLight){var _;(_=b.get(f)).direction.setFromMatrixPosition(f.matrixWorld),_.direction.transformDirection(h),_.direction.normalize(),_.skyColor.copy(f.color).multiplyScalar(v),_.groundColor.copy(f.groundColor).multiplyScalar(v),w.hemi[u]=_,u++}}w.ambient[0]=r,w.ambient[1]=i,w.ambient[2]=a,w.directional.length=o,w.spot.length=l,w.rectArea.length=c,w.point.length=s,w.hemi.length=u,w.hash.stateID=w.id,w.hash.directionalLength=o,w.hash.pointLength=s,w.hash.spotLength=l,w.hash.rectAreaLength=c,w.hash.hemiLength=u,w.hash.shadowsLength=t.length},state:w}}function io(){var t=new ro,n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:t},setupLights:function(e){t.setup(n,r,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){r.push(e)}}}function ao(){var r={};function i(e){var t=e.target;t.removeEventListener("dispose",i),delete r[t.id]}return{get:function(e,t){var n;return void 0===r[e.id]?(n=new io,r[e.id]={},r[e.id][t.id]=n,e.addEventListener("dispose",i)):void 0===r[e.id][t.id]?(n=new io,r[e.id][t.id]=n):n=r[e.id][t.id],n},dispose:function(){r={}}}}function oo(e){ei.call(this),this.type="MeshDepthMaterial",this.depthPacking=Ct,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}function so(e){ei.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Bt,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(e)}function lo(x,m,e){for(var _=new An,b=new Mn,w=new Dt,A=new Dt(e,e),M=new Bt,T=new Bt,g=1,y=2,t=1+(g|y),S=new Array(t),L=new Array(t),C={},E={0:be,1:N,2:Q},P=[new Bt(1,0,0),new Bt(-1,0,0),new Bt(0,0,1),new Bt(0,0,-1),new Bt(0,1,0),new Bt(0,-1,0)],R=[new Bt(0,1,0),new Bt(0,1,0),new Bt(0,1,0),new Bt(0,1,0),new Bt(0,0,1),new Bt(0,0,-1)],F=[new mn,new mn,new mn,new mn,new mn,new mn],n=0;n!==t;++n){var r=0!=(n&g),i=0!=(n&y),a=new oo({depthPacking:Et,morphTargets:r,skinning:i});S[n]=a;var o=new so({morphTargets:r,skinning:i});L[n]=o}var I=this;function v(e,t,n,r,i,a){var o=e.geometry,s=null,l=S,c=e.customDepthMaterial;if(n&&(l=L,c=e.customDistanceMaterial),c)s=c;else{var u=!1;t.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&0<o.morphAttributes.position.length:o&&o.isGeometry&&(u=o.morphTargets&&0<o.morphTargets.length)),e.isSkinnedMesh&&!1===t.skinning&&console.warn("v3d.WebGLShadowMap: v3d.SkinnedMesh with material.skinning set to false:",e);var h=e.isSkinnedMesh&&t.skinning,d=0;u&&(d|=g),h&&(d|=y),s=l[d]}if(x.localClippingEnabled&&!0===t.clipShadows&&0!==t.clippingPlanes.length){var p=s.uuid,f=t.uuid,m=C[p];void 0===m&&(m={},C[p]=m);var v=m[f];void 0===v&&(v=s.clone(),m[f]=v),s=v}return s.visible=t.visible,s.wireframe=t.wireframe,s.side=null!=t.shadowSide?t.shadowSide:E[t.side],s.clipShadows=t.clipShadows,s.clippingPlanes=t.clippingPlanes,s.clipIntersection=t.clipIntersection,s.wireframeLinewidth=t.wireframeLinewidth,s.linewidth=t.linewidth,n&&s.isMeshDistanceMaterial&&(s.referencePosition.copy(r),s.nearDistance=i,s.farDistance=a),s}function O(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||_.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld);var i=m.update(e),a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,l=o.length;s<l;s++){var c=o[s],u=a[c.materialIndex];if(u&&u.visible){var h=v(e,u,r,T,n.near,n.far);x.renderBufferDirect(n,null,i,h,e,c)}}else if(a.visible){h=v(e,a,r,T,n.near,n.far);x.renderBufferDirect(n,null,i,h,e,null)}}for(var d=e.children,p=0,f=d.length;p<f;p++)O(d[p],t,n,r)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=k,this.render=function(e,t,n){if(!1!==I.enabled&&(!1!==I.autoUpdate||!1!==I.needsUpdate)&&0!==e.length){var r,i=x.getRenderTarget(),a=x.state;a.setBlending(Z),a.buffers.color.setClear(1,1,1,1),a.buffers.depth.setTest(!0),a.setScissorTest(!1);for(var o=0,s=e.length;o<s;o++){var l=e[o],c=l.shadow,u=l&&l.isPointLight;if(void 0!==c){var h=c.camera;if(w.copy(c.mapSize),w.min(A),u){var d=w.x,p=w.y;F[0].set(2*d,p,d,p),F[1].set(0,p,d,p),F[2].set(3*d,p,d,p),F[3].set(d,p,d,p),F[4].set(3*d,0,d,p),F[5].set(d,0,d,p),w.x*=4,w.y*=2}if(null===c.map){var f={minFilter:D,magFilter:D,format:Ge};c.map=new vn(w.x,w.y,f),c.map.texture.name=l.name+".shadowMap",h.updateProjectionMatrix()}c.isSpotLightShadow&&c.update(l);var m=c.map,v=c.matrix;T.setFromMatrixPosition(l.matrixWorld),h.position.copy(T),u?(r=6,v.makeTranslation(-T.x,-T.y,-T.z)):(r=1,M.setFromMatrixPosition(l.target.matrixWorld),h.lookAt(M),h.updateMatrixWorld(),v.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),v.multiply(h.projectionMatrix),v.multiply(h.matrixWorldInverse)),x.setRenderTarget(m),x.clear();for(var g=0;g<r;g++){if(u){M.copy(h.position),M.add(P[g]),h.up.copy(R[g]),h.lookAt(M),h.updateMatrixWorld();var y=F[g];a.viewport(y)}b.multiplyMatrices(h.projectionMatrix,h.matrixWorldInverse),_.setFromMatrix(b),O(t,n,h,u)}}else console.warn("v3d.WebGLShadowMap:",l,"has no shadow.")}I.needsUpdate=!1,x.setRenderTarget(i)}}}function co(u,n,l,r){var i=new function(){var t=!1,a=new mn,n=null,o=new mn(0,0,0,0);return{setMask:function(e){n===e||t||(u.colorMask(e,e,e,e),n=e)},setLocked:function(e){t=e},setClear:function(e,t,n,r,i){!0===i&&(e*=r,t*=r,n*=r),a.set(e,t,n,r),!1===o.equals(a)&&(u.clearColor(e,t,n,r),o.copy(a))},reset:function(){t=!1,n=null,o.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?z(2929):G(2929)},setMask:function(e){n===e||t||(u.depthMask(e),n=e)},setFunc:function(e){if(r!==e){if(e)switch(e){case re:u.depthFunc(512);break;case ie:u.depthFunc(519);break;case ae:u.depthFunc(513);break;case oe:u.depthFunc(515);break;case se:u.depthFunc(514);break;case le:u.depthFunc(518);break;case ce:u.depthFunc(516);break;case ue:u.depthFunc(517);break;default:u.depthFunc(515)}else u.depthFunc(515);r=e}},setLocked:function(e){t=e},setClear:function(e){i!==e&&(u.clearDepth(e),i=e)},reset:function(){t=!1,i=r=n=null}}},t=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){e?z(2960):G(2960)},setMask:function(e){n===e||t||(u.stencilMask(e),n=e)},setFunc:function(e,t,n){r===e&&i===t&&a===n||(u.stencilFunc(e,t,n),r=e,i=t,a=n)},setOp:function(e,t,n){o===e&&s===t&&l===n||(u.stencilOp(e,t,n),o=e,s=t,l=n)},setLocked:function(e){t=e},setClear:function(e){c!==e&&(u.clearStencil(e),c=e)},reset:function(){t=!1,c=l=s=o=a=i=r=n=null}}},e=u.getParameter(34921),o=new Uint8Array(e),s=new Uint8Array(e),c=new Uint8Array(e),h={},d=null,p=null,f=null,m=null,v=null,g=null,y=null,x=null,_=null,b=null,w=!1,A=null,M=null,T=null,S=null,L=null,C=u.getParameter(35661),E=!1,P=0,R=u.getParameter(7938);-1!==R.indexOf("WebGL")?(P=parseFloat(/^WebGL\ ([0-9])/.exec(R)[1]),E=1<=P):-1!==R.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(R)[1]),E=2<=P);var F=null,I={},O=new mn,N=new mn;function D(e,t,n){var r=new Uint8Array(4),i=u.createTexture();u.bindTexture(e,i),u.texParameteri(e,10241,9728),u.texParameteri(e,10240,9728);for(var a=0;a<n;a++)u.texImage2D(t+a,0,6408,1,1,0,6408,5121,r);return i}var U={};function B(e,t){(o[e]=1,0===s[e]&&(u.enableVertexAttribArray(e),s[e]=1),c[e]!==t)&&((r.isWebGL2?u:n.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](e,t),c[e]=t)}function z(e){!0!==h[e]&&(u.enable(e),h[e]=!0)}function G(e){!1!==h[e]&&(u.disable(e),h[e]=!1)}function k(e,t,n,r,i,a,o,s){if(e!==Z){if(f||(z(3042),f=!0),e===te)i=i||t,a=a||n,o=o||r,t===v&&i===x||(u.blendEquationSeparate(l.convert(t),l.convert(i)),v=t,x=i),n===g&&r===y&&a===_&&o===b||(u.blendFuncSeparate(l.convert(n),l.convert(r),l.convert(a),l.convert(o)),g=n,y=r,_=a,b=o),m=e,w=null;else if(e!==m||s!==w){if(v===ne&&x===ne||(u.blendEquation(32774),x=v=ne),s)switch(e){case K:u.blendFuncSeparate(1,771,1,771);break;case J:u.blendFunc(1,1);break;case $:u.blendFuncSeparate(0,0,769,771);break;case ee:u.blendFuncSeparate(0,768,0,770);break;default:console.error("v3d.WebGLState: Invalid blending: ",e)}else switch(e){case K:u.blendFuncSeparate(770,771,1,771);break;case J:u.blendFunc(770,1);break;case $:u.blendFunc(0,769);break;case ee:u.blendFunc(0,768);break;default:console.error("v3d.WebGLState: Invalid blending: ",e)}b=_=y=g=null,m=e,w=s}}else f&&(G(3042),f=!1)}function V(e){A!==e&&(e?u.frontFace(2304):u.frontFace(2305),A=e)}function j(e){e!==H?(z(2884),e!==M&&(e===Y?u.cullFace(1029):e===q?u.cullFace(1028):u.cullFace(1032))):G(2884),M=e}function W(e,t,n){e?(z(32823),S===t&&L===n||(u.polygonOffset(t,n),S=t,L=n)):G(32823)}function X(e){void 0===e&&(e=33984+C-1),F!==e&&(u.activeTexture(e),F=e)}return U[3553]=D(3553,3553,1),U[34067]=D(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),t.setClear(0),z(2929),a.setFunc(oe),V(!1),j(Y),z(2884),k(Z),{buffers:{color:i,depth:a,stencil:t},initAttributes:function(){for(var e=0,t=o.length;e<t;e++)o[e]=0},enableAttribute:function(e){B(e,0)},enableAttributeAndDivisor:B,disableUnusedAttributes:function(){for(var e=0,t=s.length;e!==t;++e)s[e]!==o[e]&&(u.disableVertexAttribArray(e),s[e]=0)},enable:z,disable:G,getCompressedTextureFormats:function(){if(null===d&&(d=[],n.get("WEBGL_compressed_texture_pvrtc")||n.get("WEBGL_compressed_texture_s3tc")||n.get("WEBGL_compressed_texture_etc1")||n.get("WEBGL_compressed_texture_astc")))for(var e=u.getParameter(34467),t=0;t<e.length;t++)d.push(e[t]);return d},useProgram:function(e){return p!==e&&(u.useProgram(e),p=e,!0)},setBlending:k,setMaterial:function(e,t){e.side===Q?G(2884):z(2884);var n=e.side===be;t&&(n=!n),V(n),e.blending===K&&!1===e.transparent?k(Z):k(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),i.setMask(e.colorWrite),W(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:V,setCullFace:j,setLineWidth:function(e){e!==T&&(E&&u.lineWidth(e),T=e)},setPolygonOffset:W,setScissorTest:function(e){e?z(3089):G(3089)},activeTexture:X,bindTexture:function(e,t){null===F&&X();var n=I[F];void 0===n&&(n={type:void 0,texture:void 0},I[F]=n),n.type===e&&n.texture===t||(u.bindTexture(e,t||U[e]),n.type=e,n.texture=t)},compressedTexImage2D:function(){try{u.compressedTexImage2D.apply(u,arguments)}catch(e){console.error("v3d.WebGLState:",e)}},texImage2D:function(){try{u.texImage2D.apply(u,arguments)}catch(e){console.error("v3d.WebGLState:",e)}},texImage3D:function(){try{u.texImage3D.apply(u,arguments)}catch(e){console.error("v3d.WebGLState:",e)}},scissor:function(e){!1===O.equals(e)&&(u.scissor(e.x,e.y,e.z,e.w),O.copy(e))},viewport:function(e){!1===N.equals(e)&&(u.viewport(e.x,e.y,e.z,e.w),N.copy(e))},reset:function(){for(var e=0;e<s.length;e++)1===s[e]&&(u.disableVertexAttribArray(e),s[e]=0);h={},I={},M=A=m=p=F=d=null,i.reset(),a.reset(),t.reset()}}}function uo(v,i,g,y,x,_,c){var u,s={},n="undefined"!=typeof OffscreenCanvas;function h(e,t){return n?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function b(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Nt.floorPowerOfTwo:Math.floor,o=a(i*e.width),s=a(i*e.height);void 0===u&&(u=h(o,s));var l=n?h(o,s):u;return l.width=o,l.height=s,l.getContext("2d").drawImage(e,0,0,o,s),console.warn("v3d.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),l}return"data"in e&&console.warn("v3d.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function w(e){return Nt.isPowerOfTwo(e.width)&&Nt.isPowerOfTwo(e.height)}function A(e,t){return e.generateMipmaps&&t&&e.minFilter!==D&&e.minFilter!==B}function M(e,t,n,r){v.generateMipmap(e),y.get(t).__maxMipLevel=Math.log(Math.max(n,r))*Math.LOG2E}function T(e,t){if(!x.isWebGL2)return e;var n=e;return 6403===e&&(5126===t&&(n=33326),5131===t&&(n=33325),5121===t&&(n=33321)),6407===e&&(5126===t&&(n=34837),5131===t&&(n=34843),5121===t&&(n=32849)),6408===e&&(5126===t&&(n=34836),5131===t&&(n=34842),5121===t&&(n=32856)),33325===n||33326===n||34842===n||34836===n?i.get("EXT_color_buffer_float"):34843!==n&&34837!==n||console.warn("v3d.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),n}function a(e){return e===D||e===O||e===U?9728:9729}function r(e){var t=e.target;t.removeEventListener("dispose",r),function(e){var t=y.get(e);if(void 0===t.__webglInit)return;v.deleteTexture(t.__webglTexture),y.remove(e)}(t),t.isVideoTexture&&delete s[t.id],c.memory.textures--}function d(e){var t=e.target;t.removeEventListener("dispose",d),function(e){var t=y.get(e),n=y.get(e.texture);if(!e)return;void 0!==n.__webglTexture&&v.deleteTexture(n.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var r=0;r<6;r++)v.deleteFramebuffer(t.__webglFramebuffer[r]),t.__webglDepthbuffer&&v.deleteRenderbuffer(t.__webglDepthbuffer[r]);else v.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&v.deleteRenderbuffer(t.__webglDepthbuffer);y.remove(e.texture),y.remove(e)}(t),c.memory.textures--}var t=0;function o(e,t){var n,r,i,a=y.get(e);if(e.isVideoTexture&&(r=(n=e).id,i=c.render.frame,s[r]!==i&&(s[r]=i,n.update())),0<e.version&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("v3d.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void f(a,e,t);console.warn("v3d.WebGLRenderer: Texture marked for update but image is incomplete")}}g.activeTexture(33984+t),g.bindTexture(3553,a.__webglTexture)}function l(e,t){var n=y.get(e);if(6===e.image.length)if(0<e.version&&n.__version!==e.version){L(n,e),g.activeTexture(33984+t),g.bindTexture(34067,n.__webglTexture),v.pixelStorei(37440,e.flipY);for(var r=e&&e.isCompressedTexture,i=e.image[0]&&e.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=r||i?i?e.image[o].image:e.image[o]:b(e.image[o],!1,!0,x.maxCubemapSize);var s=a[0],l=w(s)||x.isWebGL2,c=_.convert(e.format),u=_.convert(e.type),h=T(c,u);S(34067,e,l);for(o=0;o<6;o++)if(r)for(var d,p=a[o].mipmaps,f=0,m=p.length;f<m;f++)d=p[f],e.format!==Ge&&e.format!==ze?-1<g.getCompressedTextureFormats().indexOf(c)?g.compressedTexImage2D(34069+o,f,h,d.width,d.height,0,d.data):console.warn("v3d.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g.texImage2D(34069+o,f,h,d.width,d.height,0,c,u,d.data);else i?g.texImage2D(34069+o,0,h,a[o].width,a[o].height,0,c,u,a[o].data):g.texImage2D(34069+o,0,h,c,u,a[o]);n.__maxMipLevel=r?p.length-1:0,A(e,l)&&M(34067,e,s.width,s.height),n.__version=e.version,e.onUpdate&&e.onUpdate(e)}else g.activeTexture(33984+t),g.bindTexture(34067,n.__webglTexture)}function p(e,t){g.activeTexture(33984+t),g.bindTexture(34067,y.get(e).__webglTexture)}function S(e,t,n){var r;if(n?(v.texParameteri(e,10242,_.convert(t.wrapS)),v.texParameteri(e,10243,_.convert(t.wrapT)),32879!==e&&35866!==e||v.texParameteri(e,32882,_.convert(t.wrapR)),v.texParameteri(e,10240,_.convert(t.magFilter)),v.texParameteri(e,10241,_.convert(t.minFilter))):(v.texParameteri(e,10242,33071),v.texParameteri(e,10243,33071),32879!==e&&35866!==e||v.texParameteri(e,32882,33071),t.wrapS===I&&t.wrapT===I||console.warn("v3d.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to v3d.ClampToEdgeWrapping."),v.texParameteri(e,10240,a(t.magFilter)),v.texParameteri(e,10241,a(t.minFilter)),t.minFilter!==D&&t.minFilter!==B&&console.warn("v3d.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to v3d.NearestFilter or v3d.LinearFilter.")),r=i.get("EXT_texture_filter_anisotropic")){if(t.type===Be&&null===i.get("OES_texture_float_linear"))return;if(t.type===Ee&&null===(x.isWebGL2||i.get("OES_texture_half_float_linear")))return;(1<t.anisotropy||y.get(t).__currentAnisotropy)&&(v.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,x.getMaxAnisotropy())),y.get(t).__currentAnisotropy=t.anisotropy)}}function L(e,t){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",r),e.__webglTexture=v.createTexture(),c.memory.textures++)}function f(e,t,n){var r=3553;t.isDataTexture2DArray&&(r=35866),t.isDataTexture3D&&(r=32879),L(e,t),g.activeTexture(33984+n),g.bindTexture(r,e.__webglTexture),v.pixelStorei(37440,t.flipY),v.pixelStorei(37441,t.premultiplyAlpha),v.pixelStorei(3317,t.unpackAlignment);var i,a=(i=t,!x.isWebGL2&&(i.wrapS!==I||i.wrapT!==I||i.minFilter!==D&&i.minFilter!==B)&&!1===w(t.image)),o=b(t.image,a,!1,x.maxTextureSize),s=w(o)||x.isWebGL2,l=_.convert(t.format),c=_.convert(t.type),u=T(l,c);S(r,t,s);var h,d=t.mipmaps;if(t.isDepthTexture){if(u=6402,t.type===Be){if(!x.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");u=36012}else x.isWebGL2&&(u=33189);t.format===Ve&&6402===u&&t.type!==Se&&t.type!==Ce&&(console.warn("v3d.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),t.type=Se,c=_.convert(t.type)),t.format===je&&(u=34041,t.type!==Ie&&(console.warn("v3d.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),t.type=Ie,c=_.convert(t.type))),g.texImage2D(3553,0,u,o.width,o.height,0,l,c,null)}else if(t.isDataTexture)if(0<d.length&&s){for(var p=0,f=d.length;p<f;p++)h=d[p],g.texImage2D(3553,p,u,h.width,h.height,0,l,c,h.data);t.generateMipmaps=!1,e.__maxMipLevel=d.length-1}else g.texImage2D(3553,0,u,o.width,o.height,0,l,c,o.data),e.__maxMipLevel=0;else if(t.isCompressedTexture){for(p=0,f=d.length;p<f;p++)h=d[p],t.format!==Ge&&t.format!==ze?-1<g.getCompressedTextureFormats().indexOf(l)?g.compressedTexImage2D(3553,p,u,h.width,h.height,0,h.data):console.warn("v3d.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):g.texImage2D(3553,p,u,h.width,h.height,0,l,c,h.data);e.__maxMipLevel=d.length-1}else if(t.isDataTexture2DArray)g.texImage3D(35866,0,u,o.width,o.height,o.depth,0,l,c,o.data),e.__maxMipLevel=0;else if(t.isDataTexture3D)g.texImage3D(32879,0,u,o.width,o.height,o.depth,0,l,c,o.data),e.__maxMipLevel=0;else if(0<d.length&&s){for(p=0,f=d.length;p<f;p++)h=d[p],g.texImage2D(3553,p,u,l,c,h);t.generateMipmaps=!1,e.__maxMipLevel=d.length-1}else g.texImage2D(3553,0,u,l,c,o),e.__maxMipLevel=0;A(t,s)&&M(3553,t,o.width,o.height),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function m(e,t,n,r){var i=_.convert(t.texture.format),a=_.convert(t.texture.type),o=T(i,a);g.texImage2D(r,0,o,t.width,t.height,0,i,a,null),v.bindFramebuffer(36160,e),v.framebufferTexture2D(36160,n,r,y.get(t.texture).__webglTexture,0),v.bindFramebuffer(36160,null)}function C(e,t,n){if(v.bindRenderbuffer(36161,e),t.depthBuffer&&!t.stencilBuffer){if(n){var r=P(t);v.renderbufferStorageMultisample(36161,r,33189,t.width,t.height)}else v.renderbufferStorage(36161,33189,t.width,t.height);v.framebufferRenderbuffer(36160,36096,36161,e)}else if(t.depthBuffer&&t.stencilBuffer){if(n){r=P(t);v.renderbufferStorageMultisample(36161,r,34041,t.width,t.height)}else v.renderbufferStorage(36161,34041,t.width,t.height);v.framebufferRenderbuffer(36160,33306,36161,e)}else{var i=T(_.convert(t.texture.format),_.convert(t.texture.type));if(n){r=P(t);v.renderbufferStorageMultisample(36161,r,i,t.width,t.height)}else v.renderbufferStorage(36161,i,t.width,t.height)}v.bindRenderbuffer(36161,null)}function E(e){var t=y.get(e),n=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,t){if(t&&t.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(v.bindFramebuffer(36160,e),!t.depthTexture||!t.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of v3d.DepthTexture");y.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),o(t.depthTexture,0);var n=y.get(t.depthTexture).__webglTexture;if(t.depthTexture.format===Ve)v.framebufferTexture2D(36160,36096,3553,n,0);else{if(t.depthTexture.format!==je)throw new Error("Unknown depthTexture format");v.framebufferTexture2D(36160,33306,3553,n,0)}}(t.__webglFramebuffer,e)}else if(n){t.__webglDepthbuffer=[];for(var r=0;r<6;r++)v.bindFramebuffer(36160,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=v.createRenderbuffer(),C(t.__webglDepthbuffer[r],e)}else v.bindFramebuffer(36160,t.__webglFramebuffer),t.__webglDepthbuffer=v.createRenderbuffer(),C(t.__webglDepthbuffer,e);v.bindFramebuffer(36160,null)}function P(e){return x.isWebGL2&&e.isWebGLMultisampleRenderTarget?Math.min(x.maxSamples,e.samples):0}var R=!1,F=!1;this.allocateTextureUnit=function(){var e=t;return e>=x.maxTextures&&console.warn("v3d.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+x.maxTextures),t+=1,e},this.resetTextureUnits=function(){t=0},this.setTexture2D=o,this.setTexture2DArray=function(e,t){var n=y.get(e);0<e.version&&n.__version!==e.version?f(n,e,t):(g.activeTexture(33984+t),g.bindTexture(35866,n.__webglTexture))},this.setTexture3D=function(e,t){var n=y.get(e);0<e.version&&n.__version!==e.version?f(n,e,t):(g.activeTexture(33984+t),g.bindTexture(32879,n.__webglTexture))},this.setTextureCube=l,this.setTextureCubeDynamic=p,this.setupRenderTarget=function(e){var t=y.get(e),n=y.get(e.texture);e.addEventListener("dispose",d),n.__webglTexture=v.createTexture(),c.memory.textures++;var r=!0===e.isWebGLRenderTargetCube,i=!0===e.isWebGLMultisampleRenderTarget,a=w(e)||x.isWebGL2;if(r){t.__webglFramebuffer=[];for(var o=0;o<6;o++)t.__webglFramebuffer[o]=v.createFramebuffer()}else if(t.__webglFramebuffer=v.createFramebuffer(),i)if(x.isWebGL2){t.__webglMultisampledFramebuffer=v.createFramebuffer(),t.__webglColorRenderbuffer=v.createRenderbuffer(),v.bindRenderbuffer(36161,t.__webglColorRenderbuffer);var s=T(_.convert(e.texture.format),_.convert(e.texture.type)),l=P(e);v.renderbufferStorageMultisample(36161,l,s,e.width,e.height),v.bindFramebuffer(36160,t.__webglMultisampledFramebuffer),v.framebufferRenderbuffer(36160,36064,36161,t.__webglColorRenderbuffer),v.bindRenderbuffer(36161,null),e.depthBuffer&&(t.__webglDepthRenderbuffer=v.createRenderbuffer(),C(t.__webglDepthRenderbuffer,e,!0)),v.bindFramebuffer(36160,null)}else console.warn("v3d.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(r){for(g.bindTexture(34067,n.__webglTexture),S(34067,e.texture,a),o=0;o<6;o++)m(t.__webglFramebuffer[o],e,36064,34069+o);A(e.texture,a)&&M(34067,e.texture,e.width,e.height),g.bindTexture(34067,null)}else g.bindTexture(3553,n.__webglTexture),S(3553,e.texture,a),m(t.__webglFramebuffer,e,36064,3553),A(e.texture,a)&&M(3553,e.texture,e.width,e.height),g.bindTexture(3553,null);e.depthBuffer&&E(e)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(A(t,w(e)||x.isWebGL2)){var n=e.isWebGLRenderTargetCube?34067:3553,r=y.get(t).__webglTexture;g.bindTexture(n,r),M(n,t,e.width,e.height),g.bindTexture(n,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(x.isWebGL2){var t=y.get(e);v.bindFramebuffer(36008,t.__webglMultisampledFramebuffer),v.bindFramebuffer(36009,t.__webglFramebuffer);var n=e.width,r=e.height,i=16384;e.depthBuffer&&(i|=256),e.stencilBuffer&&(i|=1024),v.blitFramebuffer(0,0,n,r,0,0,n,r,i,9728)}else console.warn("v3d.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===R&&(console.warn("v3d.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),R=!0),e=e.texture),o(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLRenderTargetCube&&(!1===F&&(console.warn("v3d.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?l(e,t):p(e,t)}}function ho(e,n,r){return{convert:function(e){var t;if(e===E)return 10497;if(e===I)return 33071;if(e===P)return 33648;if(e===D)return 9728;if(e===O)return 9984;if(e===U)return 9986;if(e===B)return 9729;if(e===R)return 9985;if(e===F)return 9987;if(e===Ue)return 5121;if(e===Pe)return 32819;if(e===Re)return 32820;if(e===Fe)return 33635;if(e===z)return 5120;if(e===G)return 5122;if(e===Se)return 5123;if(e===Le)return 5124;if(e===Ce)return 5125;if(e===Be)return 5126;if(e===Ee){if(r.isWebGL2)return 5131;if(null!==(t=n.get("OES_texture_half_float")))return t.HALF_FLOAT_OES}if(e===Oe)return 6406;if(e===ze)return 6407;if(e===Ge)return 6408;if(e===Ne)return 6409;if(e===De)return 6410;if(e===Ve)return 6402;if(e===je)return 34041;if(e===We)return 6403;if(e===ne)return 32774;if(e===p)return 32778;if(e===f)return 32779;if(e===g)return 0;if(e===y)return 1;if(e===_)return 768;if(e===b)return 769;if(e===w)return 770;if(e===A)return 771;if(e===M)return 772;if(e===T)return 773;if(e===S)return 774;if(e===L)return 775;if(e===C)return 776;if((e===Xe||e===He||e===Ye||e===qe)&&null!==(t=n.get("WEBGL_compressed_texture_s3tc"))){if(e===Xe)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===He)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Ye)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===qe)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===Qe||e===Ze||e===Ke||e===Je)&&null!==(t=n.get("WEBGL_compressed_texture_pvrtc"))){if(e===Qe)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===Ze)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Ke)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===Je)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===$e&&null!==(t=n.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===et||e===tt||e===nt||e===rt||e===it||e===at||e===ot||e===st||e===lt||e===ct||e===ut||e===ht||e===dt||e===pt)&&null!==(t=n.get("WEBGL_compressed_texture_astc")))return e;if(e===m||e===v){if(r.isWebGL2){if(e===m)return 32775;if(e===v)return 32776}if(null!==(t=n.get("EXT_blend_minmax"))){if(e===m)return t.MIN_EXT;if(e===v)return t.MAX_EXT}}if(e===Ie){if(r.isWebGL2)return 34042;if(null!==(t=n.get("WEBGL_depth_texture")))return t.UNSIGNED_INT_24_8_WEBGL}return 0}}}function po(){hr.call(this),this.type="Group"}function fo(e,t,n,r){dr.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function mo(e){fo.call(this),this.cameras=e||[]}((oo.prototype=Object.create(ei.prototype)).constructor=oo).prototype.isMeshDepthMaterial=!0,oo.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,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},((so.prototype=Object.create(ei.prototype)).constructor=so).prototype.isMeshDistanceMaterial=!0,so.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},po.prototype=Object.assign(Object.create(hr.prototype),{constructor:po,isGroup:!0}),fo.prototype=Object.assign(Object.create(dr.prototype),{constructor:fo,isPerspectiveCamera:!0,copy:function(e,t){return dr.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Nt.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Nt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Nt.RAD2DEG*Math.atan(Math.tan(.5*Nt.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Nt.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=hr.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),mo.prototype=Object.assign(Object.create(fo.prototype),{constructor:mo,isArrayCamera:!0});var vo,go,yo={cameraLPos:new Bt,cameraRPos:new Bt,setProjectionFromUnion:function(e,t,n){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(n.matrixWorld);var r=this.cameraLPos.distanceTo(this.cameraRPos),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=r/(-u+h),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=o+f,g=s+f,y=d-m,x=p+(r-m),_=l*s/g*v,b=c*s/g*v;e.projectionMatrix.makePerspective(y,x,_,b,v,g)},translateVRCamera:function(){var i=new Bt;new Mn;return function(e,t,n){var r=e.parent;r&&!r.isScene&&(i.copy(t).applyQuaternion(e.quaternion).applyQuaternion(r.quaternion),r.position.add(i.multiplyScalar(n)))}}(),rotateVRCamera:(vo=new Ut,go=new Ut,function(e,t,n){var r=e.parent;r&&!r.isScene&&(vo.setFromAxisAngle(t,n),vo.premultiply(e.quaternion),vo.premultiply(r.quaternion),r.quaternion.multiplyQuaternions(vo,go.copy(e.quaternion).inverse()))})};function xo(r){var i=this,l=null,c=null,u=null,h=[],d=new Mn,p=new Mn,a=1,f="stage";"undefined"!=typeof window&&"VRFrameData"in window&&(c=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",e,!1));var m=new Mn,v=new Ut,g=new Bt,y=new fo;y.bounds=new mn(0,0,.5,1),y.layers.enable(1);var x=new fo;x.bounds=new mn(.5,0,.5,1),x.layers.enable(2);var _=new mo([y,x]);function b(){return null!==l&&!0===l.isPresenting}_.layers.enable(1),_.layers.enable(2);var o,s=new Dt;function e(){if(b()){var e=l.getEyeParameters("left"),t=e.renderWidth*a,n=e.renderHeight*a;o=r.getPixelRatio(),r.getSize(s),r.setDrawingBufferSize(2*t,n,1),M.start()}else i.enabled&&r.setDrawingBufferSize(s.width,s.height,o),M.stop()}var w=[];function A(e){for(var t=navigator.getGamepads&&navigator.getGamepads(),n=0,r=0,i=t.length;n<i;n++){var a=t[n];if(a&&("Daydream Controller"===a.id||"Gear VR Controller"===a.id||"Oculus Go Controller"===a.id||"OpenVR Gamepad"===a.id||a.id.startsWith("Oculus Touch")||a.id.startsWith("Spatial Controller"))){if(r===e)return a;r++}}}this.enabled=!1,this.getController=function(e){var t=h[e];return void 0===t&&((t=new po).matrixAutoUpdate=!1,t.visible=!1,h[e]=t),t},this.getDevice=function(){return l},this.setDevice=function(e){void 0!==e&&(l=e),M.setContext(e)},this.setFramebufferScaleFactor=function(e){a=e},this.setFrameOfReferenceType=function(e){f=e},this.setPoseTarget=function(e){void 0!==e&&(u=e)},this.getCamera=function(e){var t="stage"===f?1.6:0;if(!1===b())return e.position.set(0,t,0),e.rotation.set(0,0,0),e;if(l.depthNear=e.near,l.depthFar=e.far,l.getFrameData(c),"stage"===f){var n=l.stageParameters;n?d.fromArray(n.sittingToStandingTransform):d.makeTranslation(0,t,0)}var r=c.pose,i=null!==u?u:e;i.matrix.copy(d),i.matrix.decompose(i.position,i.quaternion,i.scale),null!==r.orientation&&(v.fromArray(r.orientation),i.quaternion.multiply(v)),null!==r.position&&(v.setFromRotationMatrix(d),g.fromArray(r.position),g.applyQuaternion(v),i.position.add(g)),i.updateMatrixWorld(),y.near=e.near,x.near=e.near,y.far=e.far,x.far=e.far,y.matrixWorldInverse.fromArray(c.leftViewMatrix),x.matrixWorldInverse.fromArray(c.rightViewMatrix),p.getInverse(d),"stage"===f&&(y.matrixWorldInverse.multiply(p),x.matrixWorldInverse.multiply(p));var a=i.parent;null!==a&&(m.getInverse(a.matrixWorld),y.matrixWorldInverse.multiply(m),x.matrixWorldInverse.multiply(m)),y.matrixWorld.getInverse(y.matrixWorldInverse),x.matrixWorld.getInverse(x.matrixWorldInverse),y.projectionMatrix.fromArray(c.leftProjectionMatrix),x.projectionMatrix.fromArray(c.rightProjectionMatrix),yo.setProjectionFromUnion(_,y,x);var o=l.getLayers();if(o.length){var s=o[0];null!==s.leftBounds&&4===s.leftBounds.length&&y.bounds.fromArray(s.leftBounds),null!==s.rightBounds&&4===s.rightBounds.length&&x.bounds.fromArray(s.rightBounds)}return function(){for(var e=0;e<h.length;e++){var t=h[e],n=A(e);if(void 0!==n&&void 0!==n.pose){if(null===n.pose)return;var r=n.pose;!1===r.hasPosition&&t.position.set(.2,-.6,-.05),null!==r.position&&t.position.fromArray(r.position),null!==r.orientation&&t.quaternion.fromArray(r.orientation),t.matrix.compose(t.position,t.quaternion,t.scale),t.matrix.premultiply(d),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0,t.visible=!0;var i="Daydream Controller"===n.id?0:1;w[e]!==n.buttons[i].pressed&&(w[e]=n.buttons[i].pressed,!0===w[e]?t.dispatchEvent({type:"selectstart"}):(t.dispatchEvent({type:"selectend"}),t.dispatchEvent({type:"select"})))}else t.visible=!1}}(),_},this.getStandingMatrix=function(){return d},this.isPresenting=b;var M=new Bn;this.setAnimationLoop=function(e){M.setAnimationLoop(e),b()&&M.start()},this.submitFrame=function(){b()&&l.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}var _o,bo,wo,Ao,Mo,To,So,Lo,Co,Eo,Po,Ro,Fo,Io,Oo,No,Do={checkWebGL:function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}},checkWebGL2:function(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}},checkWorkers:function(){return!!window.Worker},checkFileAPI:function(){return window.File&&window.FileReader&&window.FileList&&window.Blob},genWebGLErrorMessage:function(){var e=document.createElement("div");return e.setAttribute("class","v3d-webgl-error"),e.innerHTML=window.WebGLRenderingContext?["Your graphics card does not seem to support WebGL.<br/>",'Find out how to get it <a href="https://www.soft8soft.com/webgl-supported-browsers-and-troubleshooting/" style="color:#000">here</a>.'].join("\n"):["Your browser does not seem to support WebGL.<br/>",'Find out how to get it <a href="https://www.soft8soft.com/webgl-supported-browsers-and-troubleshooting/" style="color:#000">here</a>.'].join("\n"),e},showWebGLErrorMessage:function(e){(e=e||document.body).appendChild(Do.genWebGLErrorMessage())},checkIOS:function(){return!!navigator.userAgent.match(/iPhone|iPad|iPod/i)},checkAndroid:function(){return!!navigator.userAgent.match(/Android/i)},checkHDR:function(e){var t=e.getContext();return!!(e.capabilities.isWebGL2&&t.getExtension("EXT_color_buffer_float")&&t.getExtension("OES_texture_float_linear"))||!(!t.getExtension("OES_texture_half_float")||!t.getExtension("OES_texture_half_float_linear"))},getGPUVendor:function(e){var t=e?e.getContext():document.createElement("canvas").getContext("webgl")||document.createElement("canvas").getContext("experimental-webgl"),n=t.getExtension("WEBGL_debug_renderer_info");return null!=n?t.getParameter(n.UNMASKED_VENDOR_WEBGL):""},getGPUModel:function(e){var t=e?e.getContext():document.createElement("canvas").getContext("webgl")||document.createElement("canvas").getContext("experimental-webgl"),n=t.getExtension("WEBGL_debug_renderer_info");return null!=n?t.getParameter(n.UNMASKED_RENDERER_WEBGL):""},checkNativeWebXR:function(){var e="polyfill"in window&&"WebXRPolyfill"in window&&polyfill instanceof WebXRPolyfill;return"xr"in navigator&&(!e||e&&polyfill.nativeWebXR)}};function Uo(e,t,n,r){this.ray=new Pi(e,t),this.near=n||0,this.far=r||1/0,this.params={Mesh:{omitGeometry:!1},Line:{},LOD:{},Points:{threshold:1},Sprite:{},checkVisibility:!0},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("v3d.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Bo(e,t){return e.distance-t.distance}function zo(e,t,n,r,i){if(!(i&&(!1===e.visible||e.isMesh&&e.isMaterialGeneratedMesh&&e.parent&&!e.parent.visible)||(e.raycast(t,n),!0!==r)))for(var a=e.children,o=0,s=a.length;o<s;o++)zo(a[o],t,n,!0)}function Go(t){var n=t.context,r=null,d=null,i=1,p=null,a="stage",f=null,m=[],v=[],g=!0,y=null;function o(){return null!==d&&null!==p}var s=new fo;s.layers.enable(1),s.viewport=new mn;var l=new fo;l.layers.enable(2),l.viewport=new mn;var x=new mo([s,l]);function c(e){var t=m[v.indexOf(e.inputSource)];t&&t.dispatchEvent({type:e.type})}function u(){t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),b.stop()}function h(e,t){y=null===t?(e.matrixWorld.copy(e.matrix),null):(e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),t.matrixWorld),e.matrixWorldInverse.getInverse(e.matrixWorld)}x.layers.enable(1),x.layers.enable(2),this.enabled=!1,this.getController=function(e){var t=m[e];return void 0===t&&((t=new po).name="XR_CONTROLLER",t.matrixAutoUpdate=!1,t.visible=!1,m[e]=t),t},this.getDevice=function(){return r},this.setDevice=function(e){void 0!==e&&(r=e),e instanceof XRDevice&&n.setCompatibleXRDevice(e)},this.setFramebufferScaleFactor=function(e){i=e},this.setFrameOfReferenceType=function(e){a=e},this.setSession=function(e){null!==(d=e)&&(d.addEventListener("select",c),d.addEventListener("selectstart",c),d.addEventListener("selectend",c),d.addEventListener("end",u),d.baseLayer=new XRWebGLLayer(d,n,{framebufferScaleFactor:i}),d.requestFrameOfReference(a).then(function(e){p=e,t.setFramebuffer(d.baseLayer.framebuffer),b.setContext(d),b.start()}),v=d.getInputSources(),d.addEventListener("inputsourceschange",function(){v=d.getInputSources();for(var e=0;e<m.length;e++){m[e].userData.inputSource=v[e]}}))},this.getCamera=function(e){if(o()){var t=e.parent,n=x.cameras;h(x,t);for(var r=0;r<n.length;r++)h(n[r],t);e.matrixWorld.copy(x.matrixWorld),e.matrix.getInverse(t.matrixWorld),e.matrix.multiply(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale);for(var i=e.children,a=(r=0,i.length);r<a;r++)i[r].updateMatrixWorld(!0);return yo.setProjectionFromUnion(x,s,l),x}return e},this.isPresenting=o;var _=null;var b=new Bn;b.setAnimationLoop(function(e,t){if(null!==(f=t.getDevicePose(p)))for(var n=d.baseLayer,r=t.views,i=0;i<r.length;i++){var a=r[i],o=n.getViewport(a),s=f.getViewMatrix(a);if(g)var l=x.cameras[i];else l=x.cameras[0];l.matrix.fromArray(s).getInverse(l.matrix),l.projectionMatrix.fromArray(a.projectionMatrix),l.viewport.set(o.x,o.y,o.width,o.height),0===i&&x.matrix.copy(l.matrix)}for(i=0;i<m.length;i++){var c=m[i],u=v[i];if(u){var h=t.getInputPose(u,p);if(null!==h){"targetRay"in h?c.matrix.elements=h.targetRay.transformMatrix:"pointerMatrix"in h&&(c.matrix.elements=h.pointerMatrix),y&&c.matrix.multiplyMatrices(y,c.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.visible=!0;continue}}c.visible=!1}Do.checkNativeWebXR()||v.length==d.getInputSources().length||d.dispatchEvent("inputsourceschange"),0<m.length&&0==v.length&&((c=m[0]).matrix.copy(x.matrix),y&&c.matrix.multiplyMatrices(y,c.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.visible=!0,c.userData.inputSource=c.userData.inputSource||{handedness:"",targetRayMode:"gaze"}),_&&_(e)}),this.setAnimationLoop=function(e){_=e},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("v3d.WebXRManager: getStandingMatrix() is no longer needed."),new Mn},this.submitFrame=function(){},this.setImmersive=function(e){if((g=e)&&x.cameras.length<2){var t=new fo;t.layers.enable(2),t.viewport=new mn,x.cameras.push(t),x.layers.enable(2)}else!e&&1<x.cameras.length&&(x.layers.disable(2),x.cameras.splice(1))},this.arHitTest=function(e,t,i,a){if(d&&XRSession.prototype.requestHitTest){a=a||function(){},this.raycaster=this.raycaster||new Uo,this.raycaster.setFromCamera({x:e,y:t},x.cameras[0]);var n=this.raycaster.ray,r=new Float32Array(n.origin.toArray()),o=new Float32Array(n.direction.toArray());d.requestHitTest(r,o,p).then(function(e){if(e.length){var t=e[0],n=(new Mn).fromArray(t.hitMatrix),r=new Bt;r.setFromMatrixPosition(n),i(r)}else a()})}}}function ko(e){var r=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t=void 0!==e.context?e.context:null,n=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",u="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;console.log("Verge3D "+_e+" ("+(u?"WebGL 2.0":"WebGL 1.0")+")");var m=null,j=null;this.domElement=r,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.unitsScaleFactor=1,this.toneMapping=we,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var W,A,X,H,h,Y,q,M,T,v,y,d,p,f,S,L,C,g,Q=this,x=!1,_=null,b=null,w=null,Z=-1,E={geometry:null,program:null,wireframe:!1},K=null,P=null,R=new mn,F=new mn,I=null,J=r.width,$=r.height,ee=1,O=new mn(0,0,J,$),N=new mn(0,0,J,$),D=!1,U=new An,te=new Di,ne=!1,re=!1,B=new Mn,ie=new Mn,ae=new Bt;function z(){return null===b?ee:1}try{var G={alpha:n,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c};if(r.addEventListener("webglcontextlost",se,!1),r.addEventListener("webglcontextrestored",le,!1),null===(W=t||r.getContext("webgl",G)||r.getContext("experimental-webgl",G)))throw null!==r.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===W.getShaderPrecisionFormat&&(W.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("v3d.WebGLRenderer: "+e.message),e}function k(){A=new Ui(W),(X=new Ni(W,A,e)).isWebGL2||(A.get("WEBGL_depth_texture"),A.get("OES_texture_float"),A.get("OES_texture_half_float"),A.get("OES_texture_half_float_linear"),A.get("OES_standard_derivatives"),A.get("OES_element_index_uint"),A.get("ANGLE_instanced_arrays")),A.get("OES_texture_float_linear"),g=new ho(W,A,X),(H=new co(W,A,g,X)).scissor(F.copy(N).multiplyScalar(ee)),H.viewport(R.copy(O).multiplyScalar(ee)),h=new Gi(W),Y=new Za,q=new uo(W,A,H,Y,X,g,h),M=new zn(W),T=new Bi(W,M,h),v=new ji(T,h),S=new Vi(W),y=new Qa(Q,A,X,q),d=new eo,p=new ao,f=new Ii(Q,H,v,s),L=new Oi(W,A,h,X),C=new zi(W,A,h,X),h.programs=y.programs,Q.context=W,Q.capabilities=X,Q.extensions=A,Q.properties=Y,Q.renderLists=d,Q.state=H,Q.info=h}k();var V=null;"undefined"!=typeof navigator&&(V="xr"in navigator?new Go(Q):new xo(Q)),this.vr=V;var oe=new lo(Q,v,X.maxTextureSize);function se(e){e.preventDefault(),console.log("v3d.WebGLRenderer: Context Lost."),x=!0}function le(){console.log("v3d.WebGLRenderer: Context Restored."),x=!1,k()}function ce(e){var t,n=e.target;n.removeEventListener("dispose",ce),ue(t=n),Y.remove(t)}function ue(e){var t=Y.get(e).program;(e.program=void 0)!==t&&y.releaseProgram(t)}this.shadowMap=oe,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){var e=A.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=A.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(e){void 0!==e&&(ee=e,this.setSize(J,$,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new Dt),e.set(J,$)},this.setSize=function(e,t,n){V.isPresenting()?console.warn("v3d.WebGLRenderer: Can't change size while VR device is presenting."):(J=e,$=t,r.width=e*ee,r.height=t*ee,!1!==n&&(r.style.width=e+"px",r.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new Dt),e.set(J*ee,$*ee)},this.setDrawingBufferSize=function(e,t,n){J=e,$=t,ee=n,r.width=e*n,r.height=t*n,this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new mn),e.copy(R)},this.getViewport=function(e){return e.copy(O)},this.setViewport=function(e,t,n,r){e.isVector4?O.set(e.x,e.y,e.z,e.w):O.set(e,t,n,r),H.viewport(R.copy(O).multiplyScalar(ee))},this.getScissor=function(e){return e.copy(N)},this.setScissor=function(e,t,n,r){e.isVector4?N.set(e.x,e.y,e.z,e.w):N.set(e,t,n,r),H.scissor(F.copy(N).multiplyScalar(ee))},this.getScissorTest=function(){return D},this.setScissorTest=function(e){H.setScissorTest(D=e)},this.getClearColor=function(){return f.getClearColor()},this.setClearColor=function(){f.setClearColor.apply(f,arguments)},this.getClearAlpha=function(){return f.getClearAlpha()},this.setClearAlpha=function(){f.setClearAlpha.apply(f,arguments)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=16384),(void 0===t||t)&&(r|=256),(void 0===n||n)&&(r|=1024),W.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(){r.removeEventListener("webglcontextlost",se,!1),r.removeEventListener("webglcontextrestored",le,!1),this.disposeInternalCaches(),V.dispose(),de.stop()},this.disposeInternalCaches=function(){d.dispose(),p.dispose(),f.dispose(),M.dispose(),v.dispose(),Y.dispose()},this.renderBufferImmediate=function(e,t){H.initAttributes();var n=Y.get(e);e.hasPositions&&!n.position&&(n.position=W.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=W.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=W.createBuffer()),e.hasColors&&!n.color&&(n.color=W.createBuffer());var r=t.getAttributes();e.hasPositions&&(W.bindBuffer(34962,n.position),W.bufferData(34962,e.positionArray,35048),H.enableAttribute(r.position),W.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(W.bindBuffer(34962,n.normal),W.bufferData(34962,e.normalArray,35048),H.enableAttribute(r.normal),W.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(W.bindBuffer(34962,n.uv),W.bufferData(34962,e.uvArray,35048),H.enableAttribute(r.uv),W.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(W.bindBuffer(34962,n.color),W.bufferData(34962,e.colorArray,35048),H.enableAttribute(r.color),W.vertexAttribPointer(r.color,3,5126,!1,0,0)),H.disableUnusedAttributes(),W.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,i,a){var o=i.isMesh&&i.matrixWorld.determinant()<0;H.setMaterial(r,o);var s=ve(e,t,r,i),l=!1;E.geometry===n.id&&E.program===s.id&&E.wireframe===(!0===r.wireframe)||(E.geometry=n.id,E.program=s.id,E.wireframe=!0===r.wireframe,l=!0),i.morphTargetInfluences&&(S.update(i,n,r,s),l=!0);var c,u=n.index,h=n.attributes.position,d=1;!0===r.wireframe&&(u=T.getWireframeAttribute(n),d=2);var p=L;null!==u&&(c=M.get(u),(p=C).setIndex(c)),l&&(!function(e,t,n){if(n&&n.isInstancedBufferGeometry&&!X.isWebGL2&&null===A.get("ANGLE_instanced_arrays"))return console.error("v3d.WebGLRenderer.setupVertexAttributes: using v3d.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");H.initAttributes();var r=n.attributes,i=t.getAttributes(),a=e.defaultAttributeValues;for(var o in i){var s=i[o];if(0<=s){var l=r[o];if(void 0!==l){var c=l.normalized,u=l.itemSize,h=M.get(l);if(void 0===h)continue;var d=h.buffer,p=h.type,f=h.bytesPerElement;if(l.isInterleavedBufferAttribute){var m=l.data,v=m.stride,g=l.offset;m&&m.isInstancedInterleavedBuffer?(H.enableAttributeAndDivisor(s,m.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=m.meshPerAttribute*m.count)):H.enableAttribute(s),W.bindBuffer(34962,d),W.vertexAttribPointer(s,u,p,c,v*f,g*f)}else l.isInstancedBufferAttribute?(H.enableAttributeAndDivisor(s,l.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=l.meshPerAttribute*l.count)):H.enableAttribute(s),W.bindBuffer(34962,d),W.vertexAttribPointer(s,u,p,c,0,0)}else if(void 0!==a){var y=a[o];if(void 0!==y)switch(y.length){case 2:W.vertexAttrib2fv(s,y);break;case 3:W.vertexAttrib3fv(s,y);break;case 4:W.vertexAttrib4fv(s,y);break;default:W.vertexAttrib1fv(s,y)}}}}H.disableUnusedAttributes()}(r,s,n),null!==u&&W.bindBuffer(34963,c.buffer));var f=1/0;null!==u?f=u.count:void 0!==h&&(f=h.count);var m=n.drawRange.start*d,v=n.drawRange.count*d,g=null!==a?a.start*d:0,y=null!==a?a.count*d:1/0,x=Math.max(m,g),_=Math.min(f,m+v,g+y)-1,b=Math.max(0,_-x+1);if(0!==b){if(i.isMesh)if(!0===r.wireframe)H.setLineWidth(r.wireframeLinewidth*z()),p.setMode(1);else switch(i.drawMode){case _t:p.setMode(4);break;case 1:p.setMode(5);break;case 2:p.setMode(6)}else if(i.isLine){var w=r.linewidth;void 0===w&&(w=1),H.setLineWidth(w*z()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);s.beginTimerQuery(W,X.isWebGL2),n&&n.isInstancedBufferGeometry?0<n.maxInstancedCount&&p.renderInstances(n,x,b):p.render(x,b),s.endTimerQuery(W,X.isWebGL2)}},this.compile=function(n,e){(j=p.get(n,e)).init(),n.traverse(function(e){e.isLight&&(j.pushLight(e),e.castShadow&&j.pushShadow(e))}),j.setupLights(e),n.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var t=0;t<e.material.length;t++)me(e.material[t],n.fog,e);else me(e.material,n.fog,e)})};var he=null;var de=new Bn;function pe(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,l=o.geometry,c=void 0===r?o.material:r,u=o.group;if(n.isArrayCamera)for(var h=(P=n).cameras,d=0,p=h.length;d<p;d++){var f=h[d];if(s.layers.test(f.layers)){if("viewport"in f)H.viewport(R.copy(f.viewport));else{var m=f.bounds,v=m.x*J,g=m.y*$,y=m.z*J,x=m.w*$;H.viewport(R.set(v,g,y,x).multiplyScalar(ee))}j.setupLights(f),fe(s,t,f,l,c,u)}}else P=null,fe(s,t,n,l,c,u)}}function fe(e,t,n,r,i,a){if(e.onBeforeRender(Q,t,n,r,i,a),j=p.get(t,P||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){H.setMaterial(i);var o=ve(n,t.fog,i,e);E.geometry=null,E.program=null,E.wireframe=!1,s=o,e.render(function(e){Q.renderBufferImmediate(e,s)})}else Q.renderBufferDirect(n,t.fog,r,i,e,a);var s;e.onAfterRender(Q,t,n,r,i,a),j=p.get(t,P||n)}function me(e,t,n){var r=Y.get(e),i=j.state.lights,a=j.state.shadowsArray,o=r.lightsHash,s=i.state.hash,l=y.getParameters(e,i.state,a,t,te.numPlanes,te.numIntersection,n),c=y.getProgramCode(e,l),u=r.program,h=!0;if(void 0===u)e.addEventListener("dispose",ce);else if(u.code!==c)ue(e);else if(o.stateID!==s.stateID||o.directionalLength!==s.directionalLength||o.pointLength!==s.pointLength||o.spotLength!==s.spotLength||o.rectAreaLength!==s.rectAreaLength||o.hemiLength!==s.hemiLength||o.shadowsLength!==s.shadowsLength)o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,h=!1;else{if(void 0!==l.shaderID)return;h=!1}if(h){if(l.shaderID){var d=Un[l.shaderID];r.shader={name:e.type,uniforms:Sn(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader}}else r.shader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.onBeforeCompile(r.shader,Q),c=y.getProgramCode(e,l),u=y.acquireProgram(e,r.shader,l,c),r.program=u,e.program=u}var p=u.getAttributes();if(e.morphTargets)for(var f=e.numSupportedMorphTargets=0;f<Q.maxMorphTargets;f++)0<=p["morphTarget"+f]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(f=e.numSupportedMorphNormals=0;f<Q.maxMorphNormals;f++)0<=p["morphNormal"+f]&&e.numSupportedMorphNormals++;var m=r.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=te.numPlanes,r.numIntersection=te.numIntersection,m.clippingPlanes=te.uniform),r.fog=t,void 0===o&&(r.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,e.lights&&(m.ambientLightColor.value=i.state.ambient,m.directionalLights.value=i.state.directional,m.spotLights.value=i.state.spot,m.rectAreaLights.value=i.state.rectArea,m.pointLights.value=i.state.point,m.hemisphereLights.value=i.state.hemi,m.directionalShadowMap.value=i.state.directionalShadowMap,m.directionalShadowMatrix.value=i.state.directionalShadowMatrix,m.spotShadowMap.value=i.state.spotShadowMap,m.spotShadowMatrix.value=i.state.spotShadowMatrix,m.pointShadowMap.value=i.state.pointShadowMap,m.pointShadowMatrix.value=i.state.pointShadowMatrix),e.nodeValue&&(m.nodeValue.value=e.nodeValue),e.nodeRGBArr&&(m.nodeRGB.value=e.nodeRGBArr);var v=r.program.getUniforms(),g=Ua.seqWithValue(v.seq,m);r.uniformsList=g}function ve(e,t,n,r){q.resetTextureUnits();var i=Y.get(n),a=j.state.lights,o=i.lightsHash,s=a.state.hash;if(ne&&(re||e!==K)){var l=e===K&&n.id===Z;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,i,l)}if(!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==t?n.needsUpdate=!0:(!n.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength)&&(void 0===i.numClippingPlanes||i.numClippingPlanes===te.numPlanes&&i.numIntersection===te.numIntersection)||(n.needsUpdate=!0)),n.needsUpdate&&(me(n,t,r),n.needsUpdate=!1,n.nodeRGBArr))for(var c=0;c<n.nodeRGB.length;c++){n.nodeRGB[c].toArray(n.nodeRGBArr,4*c)}var u,h,d,p,f,m,v,g,y,x,_,b,w,A,M,T,S,L,C,E,P=!1,R=!1,F=!1,I=i.program,O=I.getUniforms(),N=i.shader.uniforms;if(H.useProgram(I.program)&&(F=R=P=!0),n.id!==Z&&(Z=n.id,R=!0),P||K!==e){if(O.setValue(W,"projectionMatrix",e.projectionMatrix),X.logarithmicDepthBuffer&&O.setValue(W,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),K!==e&&(K=e,F=R=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNodeMaterial||n.envMap){var D=O.map.cameraPosition;void 0!==D&&D.setValue(W,ae.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isMeshNodeMaterial||n.skinning)&&O.setValue(W,"viewMatrix",e.matrixWorldInverse),n.isMeshNodeMaterial&&O.setValue(W,"invViewMatrix",e.matrixWorld)}if(n.skinning){O.setOptional(W,r,"bindMatrix"),O.setOptional(W,r,"bindMatrixInverse");var U=r.skeleton;if(U){var B=U.bones;if(X.floatVertexTextures){if(void 0===U.boneTexture){var z=Math.sqrt(4*B.length);z=Nt.ceilPowerOfTwo(z),z=Math.max(z,4);var G=new Float32Array(z*z*4);G.set(U.boneMatrices);var k=new xn(G,z,z,Ge,Be);k.needsUpdate=!0,U.boneMatrices=G,U.boneTexture=k,U.boneTextureSize=z}O.setValue(W,"boneTexture",U.boneTexture,q),O.setValue(W,"boneTextureSize",U.boneTextureSize)}else O.setOptional(W,U,"boneMatrices")}}if(n.needsBoundingBox){var V=r.geometry;V&&(null===V.boundingBox&&V.computeBoundingBox(),O.setValue(W,"boundingBoxMin",V.boundingBox.min),O.setValue(W,"boundingBoxMax",V.boundingBox.max))}return R&&(O.setValue(W,"toneMappingExposure",Q.toneMappingExposure),O.setValue(W,"toneMappingWhitePoint",Q.toneMappingWhitePoint),Q.toneMapping==It&&(O.setValue(W,"toneMappingBrightness",Q.toneMappingBrightness),O.setValue(W,"toneMappingContrast",Q.toneMappingContrast),O.setValue(W,"toneMappingMidTones",Q.toneMappingMidTones),O.setValue(W,"toneMappingPhysicalScale",Q.toneMappingPhysicalScale),O.setValue(W,"toneMappingChromaticAdaptation",Q.toneMappingChromaticAdaptation),O.setValue(W,"toneMappingWhiteColor",Q.toneMappingWhiteColor),O.setValue(W,"toneMappingColorDifferentiation",Q.toneMappingColorDifferentiation),O.setValue(W,"toneMappingExteriorDaylight",Q.toneMappingExteriorDaylight)),n.lights&&(E=F,(C=N).ambientLightColor.needsUpdate=E,C.directionalLights.needsUpdate=E,C.pointLights.needsUpdate=E,C.spotLights.needsUpdate=E,C.rectAreaLights.needsUpdate=E,C.hemisphereLights.needsUpdate=E),t&&n.fog&&(L=t,(S=N).fogColor.value=L.color,L.isFog?(S.fogNear.value=L.near,S.fogFar.value=L.far):L.isFogExp2&&(S.fogDensity.value=L.density)),n.isMeshBasicMaterial?ge(N,n):n.isMeshLambertMaterial?(ge(N,n),M=N,(T=n).emissiveMap&&(M.emissiveMap.value=T.emissiveMap)):n.isMeshPhongMaterial?(ge(N,n),n.isMeshToonMaterial?(ye(w=N,A=n),A.gradientMap&&(w.gradientMap.value=A.gradientMap)):ye(N,n)):n.isMeshStandardMaterial?(ge(N,n),n.isMeshPhysicalMaterial?(xe(_=N,b=n),_.reflectivity.value=b.reflectivity,_.clearCoat.value=b.clearCoat,_.clearCoatRoughness.value=b.clearCoatRoughness):xe(N,n)):n.isMeshMatcapMaterial?(ge(N,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===be&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===be&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(N,n)):n.isMeshDepthMaterial?(ge(N,n),y=N,(x=n).displacementMap&&(y.displacementMap.value=x.displacementMap,y.displacementScale.value=x.displacementScale,y.displacementBias.value=x.displacementBias)):n.isMeshDistanceMaterial?(ge(N,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(N,n)):n.isMeshNormalMaterial?(ge(N,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===be&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===be&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(N,n)):n.isLineBasicMaterial?(g=n,(v=N).diffuse.value=g.color,v.opacity.value=g.opacity,n.isLineDashedMaterial&&(m=n,(f=N).dashSize.value=m.dashSize,f.totalSize.value=m.dashSize+m.gapSize,f.scale.value=m.scale)):n.isPointsMaterial?(p=n,(d=N).diffuse.value=p.color,d.opacity.value=p.opacity,d.size.value=p.size*ee,d.scale.value=.5*$,d.map.value=p.map,null!==p.map&&(!0===p.map.matrixAutoUpdate&&p.map.updateMatrix(),d.uvTransform.value.copy(p.map.matrix))):n.isSpriteMaterial?(h=n,(u=N).diffuse.value=h.color,u.opacity.value=h.opacity,u.rotation.value=h.rotation,u.map.value=h.map,null!==h.map&&(!0===h.map.matrixAutoUpdate&&h.map.updateMatrix(),u.uvTransform.value.copy(h.map.matrix))):n.isShadowMaterial?(N.color.value=n.color,N.opacity.value=n.opacity):n.isMeshMaskMaterial?(ge(N,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.cameraNearFar.value=t.cameraNearFar,e.depthTexture.value=t.depthTexture,e.textureMatrix.value=t.textureMatrix}(N,n)):n.isMeshNodeMaterial?function(e,t,n){n.envMap&&(e.envMap.value=n.envMap,e.envMapIntensity.value=n.envMapIntensity,e.flipEnvMap.value=n.envMap&&n.envMap.isCubeTexture?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio,e.maxMipLevel.value=Y.get(n.envMap).__maxMipLevel);for(var r in n.nodeTextures)t.setValue(W,r,n.nodeTextures[r],q);n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias)}(N,O,n):n.isMeshLineMaterial&&function(e,t){e.lineWidth.value=t.lineWidth,e.sizeAttenuation.value=t.sizeAttenuation,e.color.value=t.color,e.opacity.value=t.opacity,e.useMap.value=t.useMap,t.map&&(e.map.value=t.map);e.useAlphaMap.value=t.useAlphaMap,t.alphaMap&&(e.alphaMap.value=t.alphaMap);e.resolution.value.set(J,$),e.visibility.value=t.visibility,e.alphaTest.value=t.alphaTest,e.repeat.value=t.repeat}(N,n),void 0!==N.ltc_1&&(N.ltc_1.value=Dn.LTC_1),void 0!==N.ltc_2&&(N.ltc_2.value=Dn.LTC_2),Ua.upload(W,i.uniformsList,N,q)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Ua.upload(W,i.uniformsList,N,q),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&O.setValue(W,"center",r.center),n.isMeshNodeMaterial&&(ie.getInverse(r.matrixWorld),O.setValue(W,"invModelMatrix",ie)),O.setValue(W,"modelViewMatrix",r.modelViewMatrix),O.setValue(W,"normalMatrix",r.normalMatrix),O.setValue(W,"modelMatrix",r.matrixWorld),I}function ge(e,t){var n;e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=Y.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function ye(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===be&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===be&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function xe(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===be&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===be&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}de.setAnimationLoop(function(e){V.isPresenting()||he&&he(e)}),"undefined"!=typeof window&&de.setContext(window),this.setAnimationLoop=function(e){he=e,V.setAnimationLoop(e),de.start()},this.render=function(e,t){var n,r;if(void 0!==arguments[2]&&(console.warn("v3d.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("v3d.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),t&&t.isCamera){if(!x){E.geometry=null,E.program=null,E.wireframe=!1,Z=-1,!(K=null)===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),V.enabled&&(t=V.getCamera(t)),(j=p.get(e,t)).init(),e.onBeforeRender(Q,e,t,n||b),B.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),U.setFromMatrix(B),re=this.localClippingEnabled,ne=te.init(this.clippingPlanes,re,t),(m=d.get(e,t)).init(),function e(t,n,r,i){t.isAnnotationControl&&t.update(n);if(t.visible){var a=t.layers.test(n.layers);if(a)if(t.isGroup)r=t.renderOrder;else if(t.isLight)j.pushLight(t),t.castShadow&&j.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||U.intersectsSprite(t)){i&&ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(B);var o=v.update(t),s=t.material;m.push(t,o,s,r,ae.z,null)}}else if(t.isImmediateRenderObject)i&&ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(B),m.push(t,null,t.material,r,ae.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||U.intersectsObject(t))){i&&ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(B);var o=v.update(t),s=t.material;if(Array.isArray(s))for(var l=o.groups,c=0,u=l.length;c<u;c++){var h=l[c],d=s[h.materialIndex];d&&d.visible&&m.push(t,o,d,r,ae.z,h)}else s.visible&&m.push(t,o,s,r,ae.z,null)}}else var a=!1;if(t.disableChildRendering)return;var p=t.children;for(var c=0,u=p.length;c<u;c++){var f=p[c];!a&&f.isMesh&&f.isMaterialGeneratedMesh||e(f,n,r,i)}}(e,t,0,Q.sortObjects),!0===Q.sortObjects&&m.sort(),ne&&te.beginShadows();var i=j.state.shadowsArray;oe.render(i,e,t),j.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),f.render(m,e,t,r);var a=m.opaque,o=m.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&pe(a,e,t,s),o.length&&pe(o,e,t,s)}else a.length&&pe(a,e,t),o.length&&pe(o,e,t);null!==b&&(q.updateRenderTargetMipmap(b),q.updateMultisampleRenderTarget(b)),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1),e.onAfterRender(Q,e,t),V.enabled&&V.submitFrame(),j=m=null}}else console.error("v3d.WebGLRenderer.render: camera is not an instance of v3d.Camera.")},this.setFramebuffer=function(e){_=e},this.getRenderTarget=function(){return b},this.setRenderTarget=function(e,t,n){(b=e)&&void 0===Y.get(e).__webglFramebuffer&&q.setupRenderTarget(e);var r=_,i=!1;if(e){var a=Y.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(r=a[t||0],i=!0):r=e.isWebGLMultisampleRenderTarget?Y.get(e).__webglMultisampledFramebuffer:a,R.copy(e.viewport),F.copy(e.scissor),I=e.scissorTest}else R.copy(O).multiplyScalar(ee),F.copy(N).multiplyScalar(ee),I=D;if(w!==r&&(W.bindFramebuffer(36160,r),w=r),H.viewport(R),H.scissor(F),H.setScissorTest(I),i){var o=Y.get(e.texture);W.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,r,i,a){if(e&&e.isWebGLRenderTarget){var o=Y.get(e).__webglFramebuffer;if(o){var s=!1;o!==w&&(W.bindFramebuffer(36160,o),s=!0);try{var l=e.texture,c=l.format,u=l.type;if(c!==Ge&&g.convert(c)!==W.getParameter(35739))return void console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===Ue||g.convert(u)===W.getParameter(35738)||u===Be&&(X.isWebGL2||A.get("OES_texture_float")||A.get("WEBGL_color_buffer_float"))||u===Ee&&(X.isWebGL2?A.get("EXT_color_buffer_float"):A.get("EXT_color_buffer_half_float"))))return void console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===W.checkFramebufferStatus(36160)?0<=t&&t<=e.width-r&&0<=n&&n<=e.height-i&&W.readPixels(t,n,r,i,g.convert(c),g.convert(u),a):console.error("v3d.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&W.bindFramebuffer(36160,w)}}}else console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not v3d.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){var r=t.image.width,i=t.image.height,a=g.convert(t.format);q.setTexture2D(t,0),W.copyTexImage2D(3553,n||0,a,e.x,e.y,r,i,0)},this.copyTextureToTexture=function(e,t,n,r){var i=t.image.width,a=t.image.height,o=g.convert(n.format),s=g.convert(n.type);q.setTexture2D(n,0),t.isDataTexture?W.texSubImage2D(3553,r||0,e.x,e.y,i,a,o,s,t.image.data):W.texSubImage2D(3553,r||0,e.x,e.y,o,s,t.image)},this.updateGeometry=function(e){return v.update(e)},this.renderObject=fe,this.setCanvas=function(e){r=e,this.domElement=e}}function Vo(e,t){this.name="",this.color=new In(e),this.density=void 0!==t?t:25e-5}function jo(e,t,n){this.name="",this.color=new In(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Wo(){hr.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,this.postprocessing=[]}function Xo(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Ho(e,t,n,r){this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function Yo(e){ei.call(this),this.type="SpriteMaterial",this.color=new In(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(e)}function qo(e){if(hr.call(this),this.type="Sprite",void 0===_o){_o=new qr;var t=new Xo(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);_o.setIndex([0,1,2,0,2,3]),_o.addAttribute("position",new Ho(t,3,0,!1)),_o.addAttribute("uv",new Ho(t,2,3,!1))}this.geometry=_o,this.material=void 0!==e?e:new Yo,this.center=new Dt(.5,.5)}function Qo(){hr.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Zo(e,t){e&&e.isGeometry&&console.error("v3d.SkinnedMesh no longer supports v3d.Geometry. Use v3d.BufferGeometry instead."),Fi.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Mn,this.bindMatrixInverse=new Mn,this.normalizeSkinWeights()}function Ko(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("v3d.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Mn)}}function Jo(){hr.call(this),this.type="Bone"}function $o(e){ei.call(this),this.type="LineBasicMaterial",this.color=new In(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function es(e,t,n){1===n&&console.error("v3d.Line: parameter v3d.LinePieces no longer supported. Use v3d.LineSegments instead."),hr.call(this),this.type="Line",this.geometry=void 0!==e?e:new qr,this.material=void 0!==t?t:new $o({color:16777215*Math.random()})}function ts(e,t){es.call(this,e,t),this.type="LineSegments"}function ns(e,t){es.call(this,e,t),this.type="LineLoop"}function rs(e){ei.call(this),this.type="PointsMaterial",this.color=new In(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(e)}function is(e,t){hr.call(this),this.type="Points",this.geometry=void 0!==e?e:new qr,this.material=void 0!==t?t:new rs({color:16777215*Math.random()})}function as(e,t,n,r,i,a,o,s,l){fn.call(this,e,t,n,r,i,a,o,s,l),this.format=void 0!==o?o:ze,this.minFilter=void 0!==a?a:B,this.magFilter=void 0!==i?i:B,this.generateMipmaps=!1}function os(e,t,n,r,i,a,o,s,l,c,u,h){fn.call(this,null,a,o,s,l,c,r,i,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function ss(e,t,n,r,i,a,o,s,l){fn.call(this,e,t,n,r,i,a,o,s,l),this.needsUpdate=!0}function ls(e,t,n,r,i,a,o,s,l,c){if((c=void 0!==c?c:Ve)!==Ve&&c!==je)throw new Error("DepthTexture format must be either v3d.DepthFormat or v3d.DepthStencilFormat");void 0===n&&c===Ve&&(n=Se),void 0===n&&c===je&&(n=Ie),fn.call(this,null,r,i,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:D,this.minFilter=void 0!==s?s:D,this.flipY=!1,this.generateMipmaps=!1}function cs(e){qr.call(this),this.type="WireframeGeometry";var t,n,r,i,a,o,s,l,c,u,h=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,r=m.length;t<r;t++){var v=m[t];for(n=0;n<3;n++)s=v[f[n]],l=v[f[(n+1)%3]],d[0]=Math.min(s,l),d[1]=Math.max(s,l),void 0===p[c=d[0]+","+d[1]]&&(p[c]={index1:d[0],index2:d[1]})}for(c in p)o=p[c],u=e.vertices[o.index1],h.push(u.x,u.y,u.z),u=e.vertices[o.index2],h.push(u.x,u.y,u.z)}else if(e&&e.isBufferGeometry){var g,y,x,_,b,w;if(u=new Bt,null!==e.index){for(g=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(r=(t=(_=x[i]).start)+_.count;t<r;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),l=y.getX(t+(n+1)%3),d[0]=Math.min(s,l),d[1]=Math.max(s,l),void 0===p[c=d[0]+","+d[1]]&&(p[c]={index1:d[0],index2:d[1]});for(c in p)o=p[c],u.fromBufferAttribute(g,o.index1),h.push(u.x,u.y,u.z),u.fromBufferAttribute(g,o.index2),h.push(u.x,u.y,u.z)}else for(t=0,r=(g=e.attributes.position).count/3;t<r;t++)for(n=0;n<3;n++)b=3*t+n,u.fromBufferAttribute(g,b),h.push(u.x,u.y,u.z),w=3*t+(n+1)%3,u.fromBufferAttribute(g,w),h.push(u.x,u.y,u.z)}this.addAttribute("position",new Fr(h,3))}function us(e,t,n){Ar.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new hs(e,t,n)),this.mergeVertices()}function hs(e,t,n){qr.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var r,i,a=[],o=[],s=[],l=[],c=new Bt,u=new Bt,h=new Bt,d=new Bt,p=new Bt;e.length<3&&console.error("v3d.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=t+1;for(r=0;r<=n;r++){var m=r/n;for(i=0;i<=t;i++){var v=i/t;e(v,m,u),o.push(u.x,u.y,u.z),0<=v-1e-5?(e(v-1e-5,m,h),d.subVectors(u,h)):(e(v+1e-5,m,h),d.subVectors(h,u)),0<=m-1e-5?(e(v,m-1e-5,h),p.subVectors(u,h)):(e(v,m+1e-5,h),p.subVectors(h,u)),c.crossVectors(d,p).normalize(),s.push(c.x,c.y,c.z),l.push(v,m)}}for(r=0;r<n;r++)for(i=0;i<t;i++){var g=r*f+i,y=r*f+i+1,x=(r+1)*f+i+1,_=(r+1)*f+i;a.push(g,y,_),a.push(y,x,_)}this.setIndex(a),this.addAttribute("position",new Fr(o,3)),this.addAttribute("normal",new Fr(s,3)),this.addAttribute("uv",new Fr(l,2))}function ds(e,t,n,r){Ar.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new ps(e,t,n,r)),this.mergeVertices()}function ps(r,a,e,t){qr.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:r,indices:a,radius:e,detail:t},e=e||1;var u=[],h=[];function o(e,t,n,r){var i,a,o=Math.pow(2,r),s=[];for(i=0;i<=o;i++){s[i]=[];var l=e.clone().lerp(n,i/o),c=t.clone().lerp(n,i/o),u=o-i;for(a=0;a<=u;a++)s[i][a]=0===a&&i===o?l:l.clone().lerp(c,a/u)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var h=Math.floor(a/2);a%2==0?(d(s[i][h+1]),d(s[i+1][h]),d(s[i][h])):(d(s[i][h+1]),d(s[i+1][h+1]),d(s[i+1][h]))}}function d(e){u.push(e.x,e.y,e.z)}function s(e,t){var n=3*e;t.x=r[n+0],t.y=r[n+1],t.z=r[n+2]}function p(e,t,n,r){r<0&&1===e.x&&(h[t]=e.x-1),0===n.x&&0===n.z&&(h[t]=r/2/Math.PI+.5)}function f(e){return Math.atan2(e.z,-e.x)}!function(e){for(var t=new Bt,n=new Bt,r=new Bt,i=0;i<a.length;i+=3)s(a[i+0],t),s(a[i+1],n),s(a[i+2],r),o(t,n,r,e)}(t=t||0),function(e){for(var t=new Bt,n=0;n<u.length;n+=3)t.x=u[n+0],t.y=u[n+1],t.z=u[n+2],t.normalize().multiplyScalar(e),u[n+0]=t.x,u[n+1]=t.y,u[n+2]=t.z}(e),function(){for(var e=new Bt,t=0;t<u.length;t+=3){e.x=u[t+0],e.y=u[t+1],e.z=u[t+2];var n=f(e)/2/Math.PI+.5,r=(i=e,Math.atan2(-i.y,Math.sqrt(i.x*i.x+i.z*i.z))/Math.PI+.5);h.push(n,1-r)}var i;(function(){for(var e=new Bt,t=new Bt,n=new Bt,r=new Bt,i=new Dt,a=new Dt,o=new Dt,s=0,l=0;s<u.length;s+=9,l+=6){e.set(u[s+0],u[s+1],u[s+2]),t.set(u[s+3],u[s+4],u[s+5]),n.set(u[s+6],u[s+7],u[s+8]),i.set(h[l+0],h[l+1]),a.set(h[l+2],h[l+3]),o.set(h[l+4],h[l+5]),r.copy(e).add(t).add(n).divideScalar(3);var c=f(r);p(i,l+0,e,c),p(a,l+2,t,c),p(o,l+4,n,c)}})(),function(){for(var e=0;e<h.length;e+=6){var t=h[e+0],n=h[e+2],r=h[e+4],i=Math.max(t,n,r),a=Math.min(t,n,r);.9<i&&a<.1&&(t<.2&&(h[e+0]+=1),n<.2&&(h[e+2]+=1),r<.2&&(h[e+4]+=1))}}()}(),this.addAttribute("position",new Fr(u,3)),this.addAttribute("normal",new Fr(u.slice(),3)),this.addAttribute("uv",new Fr(h,2)),0===t?this.computeVertexNormals():this.normalizeNormals()}function fs(e,t){Ar.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ms(e,t)),this.mergeVertices()}function ms(e,t){ps.call(this,[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="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function vs(e,t){Ar.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new gs(e,t)),this.mergeVertices()}function gs(e,t){ps.call(this,[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="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ys(e,t){Ar.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new xs(e,t)),this.mergeVertices()}function xs(e,t){var n=(1+Math.sqrt(5))/2;ps.call(this,[-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="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function _s(e,t){Ar.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new bs(e,t)),this.mergeVertices()}function bs(e,t){var n=(1+Math.sqrt(5))/2,r=1/n;ps.call(this,[-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="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ws(e,t,n,r,i,a){Ar.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==a&&console.warn("v3d.TubeGeometry: taper has been removed.");var o=new As(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function As(o,s,l,c,e){qr.call(this),this.type="TubeBufferGeometry",this.parameters={path:o,tubularSegments:s,radius:l,radialSegments:c,closed:e},s=s||64,l=l||1,c=c||8,e=e||!1;var u=o.computeFrenetFrames(s,e);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var i,h,d=new Bt,p=new Bt,t=new Dt,f=new Bt,m=[],v=[],n=[],a=[];function r(e){f=o.getPointAt(e/s,f);var t=u.normals[e],n=u.binormals[e];for(h=0;h<=c;h++){var r=h/c*Math.PI*2,i=Math.sin(r),a=-Math.cos(r);p.x=a*t.x+i*n.x,p.y=a*t.y+i*n.y,p.z=a*t.z+i*n.z,p.normalize(),v.push(p.x,p.y,p.z),d.x=f.x+l*p.x,d.y=f.y+l*p.y,d.z=f.z+l*p.z,m.push(d.x,d.y,d.z)}}!function(){for(i=0;i<s;i++)r(i);r(!1===e?s:0),function(){for(i=0;i<=s;i++)for(h=0;h<=c;h++)t.x=i/s,t.y=h/c,n.push(t.x,t.y)}(),function(){for(h=1;h<=s;h++)for(i=1;i<=c;i++){var e=(c+1)*(h-1)+(i-1),t=(c+1)*h+(i-1),n=(c+1)*h+i,r=(c+1)*(h-1)+i;a.push(e,t,r),a.push(t,n,r)}}()}(),this.setIndex(a),this.addAttribute("position",new Fr(m,3)),this.addAttribute("normal",new Fr(v,3)),this.addAttribute("uv",new Fr(n,2))}function Ms(e,t,n,r,i,a,o){Ar.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},void 0!==o&&console.warn("v3d.TorusKnotGeometry: heightScale has been deprecated. Use .scale(x, y, z) instead."),this.fromBufferGeometry(new Ts(e,t,n,r,i,a)),this.mergeVertices()}function Ts(e,t,n,r,i,a){qr.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o,s,l=[],c=[],u=[],h=[],d=new Bt,p=new Bt,f=new Bt,m=new Bt,v=new Bt,g=new Bt,y=new Bt;for(o=0;o<=n;++o){var x=o/n*i*Math.PI*2;for(L(x,i,a,e,f),L(x+.01,i,a,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=r;++s){var _=s/r*Math.PI*2,b=-t*Math.cos(_),w=t*Math.sin(_);d.x=f.x+(b*y.x+w*v.x),d.y=f.y+(b*y.y+w*v.y),d.z=f.z+(b*y.z+w*v.z),c.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(o/n),h.push(s/r)}}for(s=1;s<=n;s++)for(o=1;o<=r;o++){var A=(r+1)*(s-1)+(o-1),M=(r+1)*s+(o-1),T=(r+1)*s+o,S=(r+1)*(s-1)+o;l.push(A,M,S),l.push(M,T,S)}function L(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);i.x=r*(2+l)*.5*a,i.y=r*(2+l)*o*.5,i.z=r*Math.sin(s)*.5}this.setIndex(l),this.addAttribute("position",new Fr(c,3)),this.addAttribute("normal",new Fr(u,3)),this.addAttribute("uv",new Fr(h,2))}function Ss(e,t,n,r,i){Ar.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new Ls(e,t,n,r,i)),this.mergeVertices()}function Ls(e,t,n,r,i){qr.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var a,o,s=[],l=[],c=[],u=[],h=new Bt,d=new Bt,p=new Bt;for(a=0;a<=n;a++)for(o=0;o<=r;o++){var f=o/r*i,m=a/n*Math.PI*2;d.x=(e+t*Math.cos(m))*Math.cos(f),d.y=(e+t*Math.cos(m))*Math.sin(f),d.z=t*Math.sin(m),l.push(d.x,d.y,d.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),p.subVectors(d,h).normalize(),c.push(p.x,p.y,p.z),u.push(o/r),u.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=r;o++){var v=(r+1)*a+o-1,g=(r+1)*(a-1)+o-1,y=(r+1)*(a-1)+o,x=(r+1)*a+o;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.addAttribute("position",new Fr(l,3)),this.addAttribute("normal",new Fr(c,3)),this.addAttribute("uv",new Fr(u,2))}Object.assign(Uo.prototype,{linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){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()):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)):console.error("v3d.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var r=n||[];return zo(e,this,r,t,this.params.checkVisibility),r.sort(Bo),r},intersectObjects:function(e,t,n){var r=n||[];if(!1===Array.isArray(e))return console.warn("v3d.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=e.length;i<a;i++)zo(e[i],this,r,t,this.params.checkVisibility);return r.sort(Bo),r}}),Object.assign(Vo.prototype,{isFogExp2:!0,clone:function(){return new Vo(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(jo.prototype,{isFog:!0,clone:function(){return new jo(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Wo.prototype=Object.assign(Object.create(hr.prototype),{constructor:Wo,isScene:!0,copy:function(e,t){return hr.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=hr.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Xo.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Xo.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("v3d.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.stride:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Object.defineProperties(Ho.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Ho.prototype,{isInterleavedBufferAttribute:!0,setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,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}}),((Yo.prototype=Object.create(ei.prototype)).constructor=Yo).prototype.isSpriteMaterial=!0,Yo.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},qo.prototype=Object.assign(Object.create(hr.prototype),{constructor:qo,isSprite:!0,raycast:function(){var l=new Bt,c=new Bt,u=new Bt,o=new Dt,s=new Dt,h=new Mn,d=new Bt,p=new Bt,f=new Bt,m=new Dt,v=new Dt,g=new Dt;function y(e,t,n,r,i,a){o.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(s.x=a*o.x-i*o.y,s.y=i*o.x+a*o.y):s.copy(o),e.copy(t),e.x+=s.x,e.y+=s.y,e.applyMatrix4(h)}return function(e,t){c.setFromMatrixScale(this.matrixWorld),h.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld),u.setFromMatrixPosition(this.modelViewMatrix);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;y(d.set(-.5,-.5,0),u,a,c,n,r),y(p.set(.5,-.5,0),u,a,c,n,r),y(f.set(.5,.5,0),u,a,c,n,r),m.set(0,0),v.set(1,0),g.set(1,1);var o=e.ray.intersectTriangle(d,p,f,!1,l);if(null!==o||(y(p.set(-.5,.5,0),u,a,c,n,r),v.set(0,1),null!==(o=e.ray.intersectTriangle(d,f,p,!1,l)))){var s=e.ray.origin.distanceTo(l);s<e.near||s>e.far||t.push({distance:s,point:l.clone(),uv:Ri.getUV(l,d,p,f,m,v,g,new Dt),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return hr.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}}),Qo.prototype=Object.assign(Object.create(hr.prototype),{constructor:Qo,copy:function(e){hr.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);n.splice(r,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object},raycast:(Ao=new Bt,function(e,t){Ao.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Ao);this.getObjectForDistance(n).raycast(e,t)}),update:(bo=new Bt,wo=new Bt,function(e){var t=this.levels;if(1<t.length){bo.setFromMatrixPosition(e.matrixWorld),wo.setFromMatrixPosition(this.matrixWorld);var n=bo.distanceTo(wo);t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(;r<i;r++)t[r].object.visible=!1}}),toJSON:function(e){var t=hr.prototype.toJSON.call(this,e);t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Zo.prototype=Object.assign(Object.create(Fi.prototype),{constructor:Zo,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new mn,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){Fi.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("v3d.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Object.assign(Ko.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new Mn;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:(Mo=new Mn,To=new Mn,function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:To;Mo.multiplyMatrices(o,t[i]),Mo.toArray(n,16*i)}void 0!==r&&(r.needsUpdate=!0)}),clone:function(){return new Ko(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}}}),Jo.prototype=Object.assign(Object.create(hr.prototype),{constructor:Jo,isBone:!0}),(($o.prototype=Object.create(ei.prototype)).constructor=$o).prototype.isLineBasicMaterial=!0,$o.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},es.prototype=Object.assign(Object.create(hr.prototype),{constructor:es,isLine:!0,computeLineDistances:(Eo=new Bt,Po=new Bt,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)Eo.fromBufferAttribute(t,r-1),Po.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Eo.distanceTo(Po);e.addAttribute("lineDistance",new Fr(n,1))}else console.warn("v3d.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for((n=e.lineDistances)[0]=0,r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this}),raycast:(So=new Mn,Lo=new Pi,Co=new bn,function(e,t){var n=e.linePrecision,r=this.geometry,i=this.matrixWorld;if(null===r.boundingSphere&&r.computeBoundingSphere(),Co.copy(r.boundingSphere),Co.applyMatrix4(i),Co.radius+=n,!1!==e.ray.intersectsSphere(Co)){So.getInverse(i),Lo.copy(e.ray).applyMatrix4(So);var a=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Bt,l=new Bt,c=new Bt,u=new Bt,h=this&&this.isLineSegments?2:1;if(r.isBufferGeometry){var d=r.index,p=r.attributes.position.array;if(null!==d)for(var f=d.array,m=0,v=f.length-1;m<v;m+=h){var g=f[m],y=f[m+1];s.fromArray(p,3*g),l.fromArray(p,3*y),o<Lo.distanceSqToSegment(s,l,u,c)||(u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else for(m=0,v=p.length/3-1;m<v;m+=h)s.fromArray(p,3*m),l.fromArray(p,3*m+3),o<Lo.distanceSqToSegment(s,l,u,c)||(u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else if(r.isGeometry){var x=r.vertices,_=x.length;for(m=0;m<_-1;m+=h){var b;o<Lo.distanceSqToSegment(x[m],x[m+1],u,c)||(u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}}}}),copy:function(e){return hr.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),ts.prototype=Object.assign(Object.create(es.prototype),{constructor:ts,isLineSegments:!0,computeLineDistances:(Ro=new Bt,Fo=new Bt,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)Ro.fromBufferAttribute(t,r),Fo.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Ro.distanceTo(Fo);e.addAttribute("lineDistance",new Fr(n,1))}else console.warn("v3d.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(n=e.lineDistances,r=0,i=a.length;r<i;r+=2)Ro.copy(a[r]),Fo.copy(a[r+1]),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Ro.distanceTo(Fo)}return this})}),ns.prototype=Object.assign(Object.create(es.prototype),{constructor:ns,isLineLoop:!0}),((rs.prototype=Object.create(ei.prototype)).constructor=rs).prototype.isPointsMaterial=!0,rs.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},is.prototype=Object.assign(Object.create(hr.prototype),{constructor:is,isPoints:!0,raycast:(Io=new Mn,Oo=new Pi,No=new bn,function(i,a){var o=this,e=this.geometry,s=this.matrixWorld,t=i.params.Points.threshold;if(null===e.boundingSphere&&e.computeBoundingSphere(),No.copy(e.boundingSphere),No.applyMatrix4(s),No.radius+=t,!1!==i.ray.intersectsSphere(No)){Io.getInverse(s),Oo.copy(i.ray).applyMatrix4(Io);var n=t/((this.scale.x+this.scale.y+this.scale.z)/3),l=n*n,r=new Bt,c=new Bt;if(e.isBufferGeometry){var u=e.index,h=e.attributes.position.array;if(null!==u)for(var d=u.array,p=0,f=d.length;p<f;p++){var m=d[p];r.fromArray(h,3*m),y(r,m)}else{p=0;for(var v=h.length/3;p<v;p++)r.fromArray(h,3*p),y(r,p)}}else{var g=e.vertices;for(p=0,v=g.length;p<v;p++)y(g[p],p)}}function y(e,t){var n=Oo.distanceSqToPoint(e);if(n<l){Oo.closestPointToPoint(e,c),c.applyMatrix4(s);var r=i.ray.origin.distanceTo(c);if(r<i.near||r>i.far)return;a.push({distance:r,distanceToRay:Math.sqrt(n),point:c.clone(),index:t,face:null,object:o})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),as.prototype=Object.assign(Object.create(fn.prototype),{constructor:as,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((os.prototype=Object.create(fn.prototype)).constructor=os).prototype.isCompressedTexture=!0,((ss.prototype=Object.create(fn.prototype)).constructor=ss).prototype.isCanvasTexture=!0,((ls.prototype=Object.create(fn.prototype)).constructor=ls).prototype.isDepthTexture=!0,(cs.prototype=Object.create(qr.prototype)).constructor=cs,(us.prototype=Object.create(Ar.prototype)).constructor=us,(hs.prototype=Object.create(qr.prototype)).constructor=hs,(ds.prototype=Object.create(Ar.prototype)).constructor=ds,(ps.prototype=Object.create(qr.prototype)).constructor=ps,(fs.prototype=Object.create(Ar.prototype)).constructor=fs,(ms.prototype=Object.create(ps.prototype)).constructor=ms,(vs.prototype=Object.create(Ar.prototype)).constructor=vs,(gs.prototype=Object.create(ps.prototype)).constructor=gs,(ys.prototype=Object.create(Ar.prototype)).constructor=ys,(xs.prototype=Object.create(ps.prototype)).constructor=xs,(_s.prototype=Object.create(Ar.prototype)).constructor=_s,(bs.prototype=Object.create(ps.prototype)).constructor=bs,(ws.prototype=Object.create(Ar.prototype)).constructor=ws,((As.prototype=Object.create(qr.prototype)).constructor=As).prototype.toJSON=function(){var e=qr.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},(Ms.prototype=Object.create(Ar.prototype)).constructor=Ms,(Ts.prototype=Object.create(qr.prototype)).constructor=Ts,(Ss.prototype=Object.create(Ar.prototype)).constructor=Ss,(Ls.prototype=Object.create(qr.prototype)).constructor=Ls;var Cs=function(e,t,n){n=n||2;var r,i,a,o,s,l,c,u=t&&t.length,h=u?t[0]*n:e.length,d=Es(e,0,h,n,!0),p=[];if(!d)return p;if(u&&(d=function(e,t,n,r){var i,a,o,s,l,c=[];for(i=0,a=t.length;i<a;i++)o=t[i]*r,s=i<a-1?t[i+1]*r:e.length,(l=Es(e,o,s,r,!1))===l.next&&(l.steiner=!0),c.push(zs(l));for(c.sort(Ds),i=0;i<c.length;i++)Us(c[i],n),n=Ps(n,n.next);return n}(e,t,d,n)),e.length>80*n){r=a=e[0],i=o=e[1];for(var f=n;f<h;f+=n)(s=e[f])<r&&(r=s),(l=e[f+1])<i&&(i=l),a<s&&(a=s),o<l&&(o=l);c=0!==(c=Math.max(a-r,o-i))?1/c:0}return Rs(d,p,n,r,i,c),p};function Es(e,t,n,r,i){var a,o;if(i===0<function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r))for(a=t;a<n;a+=r)o=Hs(a,e[a],e[a+1],o);else for(a=n-r;t<=a;a-=r)o=Hs(a,e[a],e[a+1],o);return o&&Vs(o,o.next)&&(Ys(o),o=o.next),o}function Ps(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Vs(r,r.next)&&0!==ks(r.prev,r,r.next))r=r.next;else{if(Ys(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function Rs(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;for(;null===i.z&&(i.z=Bs(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next,i!==e;);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,l,c=1;do{for(n=e,a=e=null,o=0;n;){for(o++,r=n,t=s=0;t<c&&(s++,r=r.nextZ);t++);for(l=c;0<s||0<l&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(n=(i=n).nextZ,s--):(r=(i=r).nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,c*=2}while(1<o)}(i)}(e,r,i,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Is(e,r,i,a):Fs(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),Ys(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Rs(e=Os(e,t,n),t,n,r,i,a,2):2===o&&Ns(e,t,n,r,i,a):Rs(Ps(e),t,n,r,i,a,1);break}}}function Fs(e){var t=e.prev,n=e,r=e.next;if(0<=ks(t,n,r))return!1;for(var i=e.next.next;i!==e.prev;){if(Gs(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=ks(i.prev,i,i.next))return!1;i=i.next}return!0}function Is(e,t,n,r){var i=e.prev,a=e,o=e.next;if(0<=ks(i,a,o))return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,c=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=Bs(s,l,t,n,r),d=Bs(c,u,t,n,r),p=e.nextZ;p&&p.z<=d;){if(p!==e.prev&&p!==e.next&&Gs(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=ks(p.prev,p,p.next))return!1;p=p.nextZ}for(p=e.prevZ;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&Gs(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=ks(p.prev,p,p.next))return!1;p=p.prevZ}return!0}function Os(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Vs(i,a)&&js(i,r,r.next,a)&&Ws(i,a)&&Ws(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Ys(r),Ys(r.next),r=e=a),r=r.next}while(r!==e);return r}function Ns(e,t,n,r,i,a){var o,s,l=e;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&(s=c,(o=l).next.i!==s.i&&o.prev.i!==s.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&js(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(o,s)&&Ws(o,s)&&Ws(s,o)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;for(;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,n!==e;);return r}(o,s))){var u=Xs(l,c);return l=Ps(l,l.next),u=Ps(u,u.next),Rs(l,t,n,r,i,a),void Rs(u,t,n,r,i,a)}c=c.next}l=l.next}while(l!==e)}function Ds(e,t){return e.x-t.x}function Us(e,t){if(t=function(e,t){var n,r=t,i=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&o<s){if((o=s)===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===o)return n.prev;var l,c=n,u=n.x,h=n.y,d=1/0;r=n.next;for(;r!==c;)i>=r.x&&r.x>=u&&i!==r.x&&Gs(a<h?i:o,a,u,h,a<h?o:i,a,r.x,r.y)&&((l=Math.abs(a-r.y)/(i-r.x))<d||l===d&&r.x>n.x)&&Ws(r,e)&&(n=r,d=l),r=r.next;return n}(e,t)){var n=Xs(t,e);Ps(n,n.next)}}function Bs(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function zs(e){for(var t=e,n=e;t.x<n.x&&(n=t),(t=t.next)!==e;);return n}function Gs(e,t,n,r,i,a,o,s){return 0<=(i-o)*(t-s)-(e-o)*(a-s)&&0<=(e-o)*(r-s)-(n-o)*(t-s)&&0<=(n-o)*(a-s)-(i-o)*(r-s)}function ks(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Vs(e,t){return e.x===t.x&&e.y===t.y}function js(e,t,n,r){return!!(Vs(e,t)&&Vs(n,r)||Vs(e,r)&&Vs(n,t))||0<ks(e,t,n)!=0<ks(e,t,r)&&0<ks(n,r,e)!=0<ks(n,r,t)}function Ws(e,t){return ks(e.prev,e,e.next)<0?0<=ks(e,t,e.next)&&0<=ks(e,e.prev,t):ks(e,t,e.prev)<0||ks(e,e.next,t)<0}function Xs(e,t){var n=new qs(e.i,e.x,e.y),r=new qs(t.i,t.x,t.y),i=e.next,a=t.prev;return(e.next=t).prev=e,(n.next=i).prev=n,(r.next=n).prev=r,(a.next=r).prev=a,r}function Hs(e,t,n,r){var i=new qs(e,t,n);return r?(i.next=r.next,(i.prev=r).next.prev=i,r.next=i):(i.prev=i).next=i,i}function Ys(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 qs(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Qs={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},isClockWise:function(e){return Qs.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Zs(e),Ks(n,e);var a=e.length;t.forEach(Zs);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Ks(n,t[o]);var s=Cs(n,r);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function Zs(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function Ks(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Js(e,t){Ar.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new $s(e,t)),this.mergeVertices()}function $s(e,Z){qr.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:Z},e=Array.isArray(e)?e:[e];for(var K=this,J=[],$=[],t=0,n=e.length;t<n;t++){r(e[t])}function r(e){var r=[],t=void 0!==Z.curveSegments?Z.curveSegments:12,l=void 0!==Z.steps?Z.steps:1,n=void 0!==Z.depth?Z.depth:100,i=void 0===Z.bevelEnabled||Z.bevelEnabled,a=void 0!==Z.bevelThickness?Z.bevelThickness:6,o=void 0!==Z.bevelSize?Z.bevelSize:a-2,c=void 0!==Z.bevelSegments?Z.bevelSegments:3,s=Z.extrudePath,u=void 0!==Z.UVGenerator?Z.UVGenerator:el;void 0!==Z.amount&&(console.warn("v3d.ExtrudeBufferGeometry: amount has been renamed to depth."),n=Z.amount);var h,d,p,f,m,v,g,y,x=!1;s&&(h=s.getSpacedPoints(l),i=!(x=!0),d=s.computeFrenetFrames(l,!1),p=new Bt,f=new Bt,m=new Bt),i||(o=a=c=0);var _=e.extractPoints(t),b=_.shape,w=_.holes;if(!Qs.isClockWise(b))for(b=b.reverse(),g=0,y=w.length;g<y;g++)v=w[g],Qs.isClockWise(v)&&(w[g]=v.reverse());var A=Qs.triangulateShape(b,w),M=b;for(g=0,y=w.length;g<y;g++)v=w[g],b=b.concat(v);function T(e,t,n){return t||console.error("v3d.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var S,L,C,E,P,R,F=b.length,I=A.length;function O(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,u=o*o+s*s,h=o*c-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=t.x-s/d,m=t.y+o/d,v=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(o*c-s*l),g=(r=f+o*v-e.x)*r+(i=m+s*v-e.y)*i;if(g<=2)return new Dt(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),a=y?(r=-s,i=o,Math.sqrt(u)):(r=o,i=s,Math.sqrt(u/2))}return new Dt(r/a,i/a)}for(var N=[],D=0,U=M.length,B=U-1,z=D+1;D<U;D++,B++,z++)B===U&&(B=0),z===U&&(z=0),N[D]=O(M[D],M[B],M[z]);var G,k,V=[],j=N.concat();for(g=0,y=w.length;g<y;g++){for(v=w[g],G=[],D=0,B=(U=v.length)-1,z=D+1;D<U;D++,B++,z++)B===U&&(B=0),z===U&&(z=0),G[D]=O(v[D],v[B],v[z]);V.push(G),j=j.concat(G)}for(S=0;S<c;S++){for(C=S/c,E=a*Math.cos(C*Math.PI/2),L=o*Math.sin(C*Math.PI/2),D=0,U=M.length;D<U;D++)X((P=T(M[D],N[D],L)).x,P.y,-E);for(g=0,y=w.length;g<y;g++)for(v=w[g],G=V[g],D=0,U=v.length;D<U;D++)X((P=T(v[D],G[D],L)).x,P.y,-E)}for(L=o,D=0;D<F;D++)P=i?T(b[D],j[D],L):b[D],x?(f.copy(d.normals[0]).multiplyScalar(P.x),p.copy(d.binormals[0]).multiplyScalar(P.y),m.copy(h[0]).add(f).add(p),X(m.x,m.y,m.z)):X(P.x,P.y,0);for(k=1;k<=l;k++)for(D=0;D<F;D++)P=i?T(b[D],j[D],L):b[D],x?(f.copy(d.normals[k]).multiplyScalar(P.x),p.copy(d.binormals[k]).multiplyScalar(P.y),m.copy(h[k]).add(f).add(p),X(m.x,m.y,m.z)):X(P.x,P.y,n/l*k);for(S=c-1;0<=S;S--){for(C=S/c,E=a*Math.cos(C*Math.PI/2),L=o*Math.sin(C*Math.PI/2),D=0,U=M.length;D<U;D++)X((P=T(M[D],N[D],L)).x,P.y,n+E);for(g=0,y=w.length;g<y;g++)for(v=w[g],G=V[g],D=0,U=v.length;D<U;D++)P=T(v[D],G[D],L),x?X(P.x,P.y+h[l-1].y,h[l-1].x+E):X(P.x,P.y,n+E)}function W(e,t){var n,r;for(D=e.length;0<=--D;){(r=(n=D)-1)<0&&(r=e.length-1);var i=0,a=l+2*c;for(i=0;i<a;i++){var o=F*i,s=F*(i+1);Y(t+n+o,t+r+o,t+r+s,t+n+s)}}}function X(e,t,n){r.push(e),r.push(t),r.push(n)}function H(e,t,n){q(e),q(t),q(n);var r=J.length/3,i=u.generateTopUV(K,J,r-3,r-2,r-1);Q(i[0]),Q(i[1]),Q(i[2])}function Y(e,t,n,r){q(e),q(t),q(r),q(t),q(n),q(r);var i=J.length/3,a=u.generateSideWallUV(K,J,i-6,i-3,i-2,i-1);Q(a[0]),Q(a[1]),Q(a[3]),Q(a[1]),Q(a[2]),Q(a[3])}function q(e){J.push(r[3*e+0]),J.push(r[3*e+1]),J.push(r[3*e+2])}function Q(e){$.push(e.x),$.push(e.y)}!function(){var e=J.length/3;if(i){var t=0,n=F*t;for(D=0;D<I;D++)H((R=A[D])[2]+n,R[1]+n,R[0]+n);for(n=F*(t=l+2*c),D=0;D<I;D++)H((R=A[D])[0]+n,R[1]+n,R[2]+n)}else{for(D=0;D<I;D++)H((R=A[D])[2],R[1],R[0]);for(D=0;D<I;D++)H((R=A[D])[0]+F*l,R[1]+F*l,R[2]+F*l)}K.addGroup(e,J.length/3-e,0)}(),function(){var e=J.length/3,t=0;for(W(M,t),t+=M.length,g=0,y=w.length;g<y;g++)W(v=w[g],t),t+=v.length;K.addGroup(e,J.length/3-e,1)}()}this.addAttribute("position",new Fr(J,3)),this.addAttribute("uv",new Fr($,2)),this.computeVertexNormals()}((Js.prototype=Object.create(Ar.prototype)).constructor=Js).prototype.toJSON=function(){var e=Ar.prototype.toJSON.call(this);return tl(this.parameters.shapes,this.parameters.options,e)},(($s.prototype=Object.create(qr.prototype)).constructor=$s).prototype.toJSON=function(){var e=qr.prototype.toJSON.call(this);return tl(this.parameters.shapes,this.parameters.options,e)};var el={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],l=t[3*r+1],c=t[3*i],u=t[3*i+1];return[new Dt(a,o),new Dt(s,l),new Dt(c,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*r],u=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],v=t[3*a+1],g=t[3*a+2];return Math.abs(s-u)<.01?[new Dt(o,1-l),new Dt(c,1-h),new Dt(d,1-f),new Dt(m,1-g)]:[new Dt(s,1-l),new Dt(u,1-h),new Dt(p,1-f),new Dt(v,1-g)]}};function tl(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function nl(e,t){Ar.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new rl(e,t)),this.mergeVertices()}function rl(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("v3d.TextGeometry: font parameter is not an instance of v3d.Font."),new Ar;var r=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),$s.call(this,r,t),this.type="TextBufferGeometry"}function il(e,t,n,r,i,a,o){Ar.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new al(e,t,n,r,i,a,o)),this.mergeVertices()}function al(e,t,n,r,i,a,o){qr.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var s,l,c=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),u=0,h=[],d=new Bt,p=new Bt,f=[],m=[],v=[],g=[];for(l=0;l<=n;l++){var y=[],x=l/n,_=0==l?.5/t:l==n?-.5/t:0;for(s=0;s<=t;s++){var b=s/t;d.x=-e*Math.cos(r+b*i)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(r+b*i)*Math.sin(a+x*o),m.push(d.x,d.y,d.z),p.copy(d).normalize(),v.push(p.x,p.y,p.z),g.push(b+_,1-x),y.push(u++)}h.push(y)}for(l=0;l<n;l++)for(s=0;s<t;s++){var w=h[l][s+1],A=h[l][s],M=h[l+1][s],T=h[l+1][s+1];(0!==l||0<a)&&f.push(w,A,T),(l!==n-1||c<Math.PI)&&f.push(A,M,T)}this.setIndex(f),this.addAttribute("position",new Fr(m,3)),this.addAttribute("normal",new Fr(v,3)),this.addAttribute("uv",new Fr(g,2))}function ol(e,t,n,r,i,a){Ar.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new sl(e,t,n,r,i,a)),this.mergeVertices()}function sl(e,t,n,r,i,a){qr.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,l,c=[],u=[],h=[],d=[],p=e,f=(t-e)/(r=void 0!==r?Math.max(1,r):1),m=new Bt,v=new Dt;for(s=0;s<=r;s++){for(l=0;l<=n;l++)o=i+l/n*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),u.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,d.push(v.x,v.y);p+=f}for(s=0;s<r;s++){var g=s*(n+1);for(l=0;l<n;l++){var y=o=l+g,x=o+n+1,_=o+n+2,b=o+1;c.push(y,x,b),c.push(x,_,b)}}this.setIndex(c),this.addAttribute("position",new Fr(u,3)),this.addAttribute("normal",new Fr(h,3)),this.addAttribute("uv",new Fr(d,2))}function ll(e,t,n,r){Ar.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new cl(e,t,n,r)),this.mergeVertices()}function cl(e,t,n,r){qr.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||2*Math.PI,r=Nt.clamp(r,0,2*Math.PI);var i,a,o,s=[],l=[],c=[],u=1/t,h=new Bt,d=new Dt;for(a=0;a<=t;a++){var p=n+a*u*r,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=e.length-1;o++)h.x=e[o].x*f,h.y=e[o].y,h.z=e[o].x*m,l.push(h.x,h.y,h.z),d.x=a/t,d.y=o/(e.length-1),c.push(d.x,d.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var v=i=o+a*e.length,g=i+e.length,y=i+e.length+1,x=i+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.addAttribute("position",new Fr(l,3)),this.addAttribute("uv",new Fr(c,2)),this.computeVertexNormals(),r===2*Math.PI){var _=this.attributes.normal.array,b=new Bt,w=new Bt,A=new Bt;for(i=t*e.length*3,o=a=0;a<e.length;a++,o+=3)b.x=_[o+0],b.y=_[o+1],b.z=_[o+2],w.x=_[i+o+0],w.y=_[i+o+1],w.z=_[i+o+2],A.addVectors(b,w).normalize(),_[o+0]=_[i+o+0]=A.x,_[o+1]=_[i+o+1]=A.y,_[o+2]=_[i+o+2]=A.z}}function ul(e,t){Ar.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("v3d.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new hl(e,t)),this.mergeVertices()}function hl(e,f){qr.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:f},f=f||12;var m=[],v=[],g=[],y=[],t=0,x=0;if(!1===Array.isArray(e))r(e);else for(var n=0;n<e.length;n++)r(e[n]),this.addGroup(t,x,n),t+=x,x=0;function r(e){var t,n,r,i=v.length/3,a=e.extractPoints(f),o=a.shape,s=a.holes;for(!1===Qs.isClockWise(o)&&(o=o.reverse()),t=0,n=s.length;t<n;t++)r=s[t],!0===Qs.isClockWise(r)&&(s[t]=r.reverse());var l=Qs.triangulateShape(o,s);for(t=0,n=s.length;t<n;t++)r=s[t],o=o.concat(r);for(t=0,n=o.length;t<n;t++){var c=o[t];v.push(c.x,c.y,0),g.push(0,0,1),y.push(c.x,c.y)}for(t=0,n=l.length;t<n;t++){var u=l[t],h=u[0]+i,d=u[1]+i,p=u[2]+i;m.push(h,d,p),x+=3}}this.setIndex(m),this.addAttribute("position",new Fr(v,3)),this.addAttribute("normal",new Fr(g,3)),this.addAttribute("uv",new Fr(y,2))}function dl(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function pl(e,t){qr.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,r,i,a,o=[],s=Math.cos(Nt.DEG2RAD*t),l=[0,0],c={},u=["a","b","c"];e.isBufferGeometry?(a=new Ar).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var h=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],v=0;v<3;v++)n=m[u[v]],r=m[u[(v+1)%3]],l[0]=Math.min(n,r),l[1]=Math.max(n,r),void 0===c[i=l[0]+","+l[1]]?c[i]={index1:l[0],index2:l[1],face1:p,face2:void 0}:c[i].face2=p;for(i in c){var g=c[i];if(void 0===g.face2||d[g.face1].normal.dot(d[g.face2].normal)<=s){var y=h[g.index1];o.push(y.x,y.y,y.z),y=h[g.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new Fr(o,3))}function fl(e,t,n,r,i,a,o,s){Ar.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new ml(e,t,n,r,i,a,o,s)),this.mergeVertices()}function ml(g,y,x,_,b,e,w,A){qr.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:g,radiusBottom:y,height:x,radialSegments:_,heightSegments:b,openEnded:e,thetaStart:w,thetaLength:A};var M=this;g=void 0!==g?g:1,y=void 0!==y?y:1,x=x||1,_=Math.floor(_)||8,b=Math.floor(b)||1,e=void 0!==e&&e,w=void 0!==w?w:0,A=void 0!==A?A:2*Math.PI;var T=[],S=[],L=[],C=[],E=0,P=[],R=x/2,F=0;function t(e){var t,n,r,i=new Dt,a=new Bt,o=0,s=!0===e?g:y,l=!0===e?1:-1;for(n=E,t=1;t<=_;t++)S.push(0,R*l,0),L.push(0,l,0),C.push(.5,.5),E++;for(r=E,t=0;t<=_;t++){var c=t/_*A+w,u=Math.cos(c),h=Math.sin(c);a.x=s*h,a.y=R*l,a.z=s*u,S.push(a.x,a.y,a.z),L.push(0,l,0),i.x=.5*u+.5,i.y=.5*h*l+.5,C.push(i.x,i.y),E++}for(t=0;t<_;t++){var d=n+t,p=r+t;!0===e?T.push(p,p+1,d):T.push(p+1,p,d),o+=3}M.addGroup(F,o,!0===e?1:2),F+=o}!function(){var e,t,n=new Bt,r=new Bt,i=0,a=(y-g)/x;for(t=0;t<=b;t++){var o=[],s=t/b,l=s*(y-g)+g;for(e=0;e<=_;e++){var c=e/_,u=c*A+w,h=Math.sin(u),d=Math.cos(u);r.x=l*h,r.y=-s*x+R,r.z=l*d,S.push(r.x,r.y,r.z),n.set(h,a,d).normalize(),L.push(n.x,n.y,n.z),C.push(c,1-s),o.push(E++)}P.push(o)}for(e=0;e<_;e++)for(t=0;t<b;t++){var p=P[t][e],f=P[t+1][e],m=P[t+1][e+1],v=P[t][e+1];T.push(p,f,v),T.push(f,m,v),i+=6}M.addGroup(F,i,0),F+=i}(),!1===e&&(0<g&&t(!0),0<y&&t(!1)),this.setIndex(T),this.addAttribute("position",new Fr(S,3)),this.addAttribute("normal",new Fr(L,3)),this.addAttribute("uv",new Fr(C,2))}function vl(e,t,n,r,i,a,o){fl.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function gl(e,t,n,r,i,a,o){ml.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function yl(e,t,n,r){Ar.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new xl(e,t,n,r)),this.mergeVertices()}function xl(e,t,n,r){qr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,a,o=[],s=[],l=[],c=[],u=new Bt,h=new Dt;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),a=0,i=3;a<=t;a++,i+=3){var d=n+a/t*r;u.x=e*Math.cos(d),u.y=e*Math.sin(d),s.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(s[i]/e+1)/2,h.y=(s[i+1]/e+1)/2,c.push(h.x,h.y)}for(i=1;i<=t;i++)o.push(i,i+1,0);this.setIndex(o),this.addAttribute("position",new Fr(s,3)),this.addAttribute("normal",new Fr(l,3)),this.addAttribute("uv",new Fr(c,2))}(nl.prototype=Object.create(Ar.prototype)).constructor=nl,(rl.prototype=Object.create($s.prototype)).constructor=rl,(il.prototype=Object.create(Ar.prototype)).constructor=il,(al.prototype=Object.create(qr.prototype)).constructor=al,(ol.prototype=Object.create(Ar.prototype)).constructor=ol,(sl.prototype=Object.create(qr.prototype)).constructor=sl,(ll.prototype=Object.create(Ar.prototype)).constructor=ll,(cl.prototype=Object.create(qr.prototype)).constructor=cl,((ul.prototype=Object.create(Ar.prototype)).constructor=ul).prototype.toJSON=function(){var e=Ar.prototype.toJSON.call(this);return dl(this.parameters.shapes,e)},((hl.prototype=Object.create(qr.prototype)).constructor=hl).prototype.toJSON=function(){var e=qr.prototype.toJSON.call(this);return dl(this.parameters.shapes,e)},(pl.prototype=Object.create(qr.prototype)).constructor=pl,(fl.prototype=Object.create(Ar.prototype)).constructor=fl,(ml.prototype=Object.create(qr.prototype)).constructor=ml,(vl.prototype=Object.create(fl.prototype)).constructor=vl,(gl.prototype=Object.create(ml.prototype)).constructor=gl,(yl.prototype=Object.create(Ar.prototype)).constructor=yl,(xl.prototype=Object.create(qr.prototype)).constructor=xl;var _l=Object.freeze({WireframeGeometry:cs,ParametricGeometry:us,ParametricBufferGeometry:hs,TetrahedronGeometry:fs,TetrahedronBufferGeometry:ms,OctahedronGeometry:vs,OctahedronBufferGeometry:gs,IcosahedronGeometry:ys,IcosahedronBufferGeometry:xs,DodecahedronGeometry:_s,DodecahedronBufferGeometry:bs,PolyhedronGeometry:ds,PolyhedronBufferGeometry:ps,TubeGeometry:ws,TubeBufferGeometry:As,TorusKnotGeometry:Ms,TorusKnotBufferGeometry:Ts,TorusGeometry:Ss,TorusBufferGeometry:Ls,TextGeometry:nl,TextBufferGeometry:rl,SphereGeometry:il,SphereBufferGeometry:al,RingGeometry:ol,RingBufferGeometry:sl,PlaneGeometry:Kr,PlaneBufferGeometry:Jr,LatheGeometry:ll,LatheBufferGeometry:cl,ShapeGeometry:ul,ShapeBufferGeometry:hl,ExtrudeGeometry:Js,ExtrudeBufferGeometry:$s,EdgesGeometry:pl,ConeGeometry:vl,ConeBufferGeometry:gl,CylinderGeometry:fl,CylinderBufferGeometry:ml,CircleGeometry:yl,CircleBufferGeometry:xl,BoxGeometry:Qr,BoxBufferGeometry:Zr});function bl(e){ei.call(this),this.type="ShadowMaterial",this.color=new In(0),this.transparent=!0,this.setValues(e)}function wl(e){Ei.call(this,e),this.type="RawShaderMaterial"}function Al(e){ei.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new In(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pt,this.normalScale=new Dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Ml(e){Al.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function Tl(e){ei.call(this),this.type="MeshPhongMaterial",this.color=new In(16777215),this.specular=new In(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pt,this.normalScale=new Dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Sl(e){Tl.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function Ll(e){ei.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pt,this.normalScale=new Dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Cl(e){ei.call(this),this.type="MeshLambertMaterial",this.color=new In(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new In(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function El(e){ei.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new In(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Pt,this.normalScale=new Dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(e)}function Pl(e){$o.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function Rl(e){ei.call(this),this.type="MeshMaskMaterial",this.skinning=!1,this.morphTargets=!1,this.side=Q,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}((bl.prototype=Object.create(ei.prototype)).constructor=bl).prototype.isShadowMaterial=!0,bl.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.color.copy(e.color),this},((wl.prototype=Object.create(Ei.prototype)).constructor=wl).prototype.isRawShaderMaterial=!0,((Al.prototype=Object.create(ei.prototype)).constructor=Al).prototype.isMeshStandardMaterial=!0,Al.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Ml.prototype=Object.create(Al.prototype)).constructor=Ml).prototype.isMeshPhysicalMaterial=!0,Ml.prototype.copy=function(e){return Al.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},((Tl.prototype=Object.create(ei.prototype)).constructor=Tl).prototype.isMeshPhongMaterial=!0,Tl.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Sl.prototype=Object.create(Tl.prototype)).constructor=Sl).prototype.isMeshToonMaterial=!0,Sl.prototype.copy=function(e){return Tl.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},((Ll.prototype=Object.create(ei.prototype)).constructor=Ll).prototype.isMeshNormalMaterial=!0,Ll.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Cl.prototype=Object.create(ei.prototype)).constructor=Cl).prototype.isMeshLambertMaterial=!0,Cl.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((El.prototype=Object.create(ei.prototype)).constructor=El).prototype.isMeshMatcapMaterial=!0,El.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((Pl.prototype=Object.create($o.prototype)).constructor=Pl).prototype.isLineDashedMaterial=!0,Pl.prototype.copy=function(e){return $o.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},((Rl.prototype=Object.create(ei.prototype)).constructor=Rl).prototype.isMeshMaskMaterial=!0,Rl.prototype.copy=function(e){return ei.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,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};var Fl={};!function(c){c.less=function(e,t,n){return n(e,t)<0},c.exchange=function(e,t,n){var r=e[t];e[t]=e[n],e[n]=r};var u=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t};c.StackNode=function(e){this.value=e,this.next=null};var e=function(){this.N=0,this.first=null};e.prototype.push=function(e){this.first=this._push(this.first,e)},e.prototype._push=function(e,t){if(null==e)return this.N++,new c.StackNode(t);var n=e;return this.N++,(e=new c.StackNode(t)).next=n,e},e.prototype.pop=function(){if(null!=this.first){var e=this.first,t=e.value;return this.first=e.next,this.N--,t}},e.prototype.size=function(){return this.N},e.prototype.isEmpty=function(){return 0==this.N},e.prototype.peep=function(){if(null!=this.first)return this.first.value},e.prototype.toArray=function(){for(var e=[],t=this.first;null!=t;)e.push(t.value),t=t.next;return e},c.Stack=e;c.QueueNode=function(e){this.value=e,this.next=null};var t=function(){this.first=null,this.last=null,this.N=0};t.prototype.enqueue=function(e){var t=this.last;this.last=new c.QueueNode(e),null!=t&&(t.next=this.last),null==this.first&&(this.first=this.last),this.N++},t.prototype.dequeue=function(){if(null!=this.first){var e=this.first,t=e.value;return this.first=e.next,null==this.first&&(this.last=null),this.N--,t}},t.prototype.size=function(){return this.N},t.prototype.isEmpty=function(){return 0==this.N},t.prototype.toArray=function(){for(var e=[],t=this.first;null!=t;)e.push(t.value),t=t.next;return e},c.Queue=t;var n=function(e){this.s=[],this.N=0,e||(e=function(e,t){return e-t}),this.compare=e};n.prototype.enqueue=function(e){for(;this.s.lengh<=this.N+1;)this.s.push(0);this.s[++this.N]=e,this.swim(this.N)},n.prototype.swim=function(e){for(;1<e;){var t=Math.floor(e/2);if(!c.less(this.s[e],this.s[t],this.compare))break;c.exchange(this.s,e,t),e=t}},n.prototype.delMin=function(){if(0!=this.N){var e=this.s[1];return c.exchange(this.s,1,this.N--),this.sink(1),e}},n.prototype.sink=function(e){for(;2*e<=this.N;){var t=2*e;if(t<this.N&&c.less(this.s[t+1],this.s[t],this.compare)&&t++,!c.less(this.s[t],this.s[e],this.compare))break;c.exchange(this.s,t,e),e=t}},n.prototype.size=function(){return this.N},n.prototype.isEmpty=function(){return 0==this.N},c.MinPQ=n;var r=function(e){this.id=[];for(var t=0;t<e;++t)this.id.push(t)};r.prototype.union=function(e,t){var n=this.root(e),r=this.root(t);r!=n&&(this.id[r]=n)},r.prototype.root=function(e){for(;this.id[e]!=e;)e=this.id[e];return e},r.prototype.connected=function(e,t){return this.root(e)==this.root(t)},c.QuickUnion=r;var i=function(e,t){this.keys=[],this.pq=[],this.qp=[];for(var n=0;n<=e;++n)this.keys.push(null),this.pq.push(0),this.qp.push(-1);this.N=0,t||(t=function(e,t){return e-t}),this.compare=t};i.prototype.insert=function(e,t){this.keys[e]=t,this.pq[++this.N]=e,this.qp[e]=this.N,this.swim(this.N)},i.prototype.decreaseKey=function(e,t){c.less(t,this.keys[e],this.compare)&&(this.keys[e]=t,this.swim(this.qp[e]))},i.prototype.minKey=function(){return this.keys[this.pq[1]]},i.prototype.min=function(){return this.pq[1]},i.prototype.delMin=function(){var e=this.pq[1];return c.exchange(this.pq,1,this.N),this.qp[this.pq[1]]=1,this.qp[this.pq[this.N]]=-1,this.keys[this.pq[this.N]]=null,this.N--,this.sink(1),e},i.prototype.swim=function(e){for(;1<e;){var t=Math.floor(e/2);if(!c.less(this.keys[this.pq[e]],this.keys[this.pq[t]],this.compare))break;c.exchange(this.pq,e,t),this.qp[this.pq[e]]=e,e=this.qp[this.pq[t]]=t}},i.prototype.sink=function(e){for(;2*e<=this.N;){var t=2*e;if(t<this.N&&c.less(this.keys[this.pq[t+1]],this.keys[this.pq[t]],this.compare)&&t++,!c.less(this.keys[this.pq[t]],this.keys[this.pq[e]],this.compare))break;c.exchange(this.pq,e,t),this.qp[this.pq[e]]=e,e=this.qp[this.pq[t]]=t}},i.prototype.containsIndex=function(e){return-1!=this.qp[e]},i.prototype.isEmpty=function(){return 0==this.N},i.prototype.size=function(){return this.N},c.IndexMinPQ=i;c.LinkMapNode=function(e){this.value=e,this.prev=null,this.next=null};var a=function(){this.first=null,this.last=null,this.map={}};a.prototype.push=function(e,t){this.map[t]=e,null===this.first?this.first=e:(this.last.next=e).prev=this.last,this.last=e},a.prototype.removeNodeByKey=function(e){var t=this.map[e],n=t.prev,r=t.next;null!==n&&null!==r?(n.next=r).prev=n:null===n&&null!==r?(this.first=r).prev=null:null!==n&&null===r?(this.last=n).next=null:(this.first=null,this.last=null),delete this.map[e]},c.LinkMap=a;var o=function(e){this.V=e,this.adjList=[],this.nodeInfo=[],this.edges={};for(var t=0;t<e;++t)this.adjList.push([]),this.nodeInfo.push({})};o.prototype.addNewEdge=function(e,t){this.adjList[e].push(t),this.adjList[t].push(e);var n=e+"_"+t;t<e&&(n=t+"_"+e),this.edges[n]=new c.Edge(e,t,0)},o.prototype.adj=function(e){return this.adjList[e]},o.prototype.node=function(e){return this.nodeInfo[e]},o.prototype.len=function(){return this.V},o.prototype.edge=function(e,t){var n=e+"_"+t;return t<e&&(n=t+"_"+e),n in this.edges?this.edges[n]:null},c.Graph=o;var h=function(e){this.V=e,this.adjList=[],this.nodeInfo=[],this.edges={};for(var t=0;t<e;++t)this.adjList.push([]),this.nodeInfo.push({})};h.prototype.removeAll=function(){this.V=0,this.adjList=[],this.nodeInfo=[],this.edges={}},h.prototype.addNode=function(e){e=e||{},this.V++,this.adjList.push([]),this.nodeInfo.push(e)},h.prototype.addNewEdge=function(e,t){this.adjList[e].push(t);var n=e+"_"+t,r=new c.Edge(e,t,0);return this.edges[n]=r},h.prototype.addEdge=function(e){var t=e.v,n=e.w;this.adjList[t].push(n);var r=t+"_"+n;this.edges[r]=e},h.prototype.removeEdge=function(e,t){for(var n=this.adjList[e],r=0;r<n.length;r++)n[r]==t&&(n.splice(r,1),r--);var i=e+"_"+t;i in this.edges&&delete this.edges[i]},h.prototype.edge=function(e,t){var n=e+"_"+t;return n in this.edges?this.edges[n]:null},h.prototype.adj=function(e){return this.adjList[e]},h.prototype.node=function(e){return this.nodeInfo[e]},h.prototype.nodeIndex=function(e){for(var t=0;t<this.V;++t)if(this.nodeInfo[t]==e)return t;return-1},h.prototype.reverse=function(){for(var e=new h(this.V),t=0;t<this.V;++t)for(var n=this.adjList[t],r=0;r<n.length;++r){var i=n[r];e.addNewEdge(i,t)}return e},h.prototype.len=function(){return this.V},h.prototype.findInEdges=function(e){for(var t=[],n=0;n<this.V;n++)for(var r=this.adjList[n],i=0;i<r.length;i++)r[i]==e&&t.push(this.edge(n,e));return t},h.prototype.findOutEdges=function(e){for(var t=[],n=this.adjList[e],r=0;r<n.length;r++)t.push(this.edge(e,n[r]));return t},h.prototype.disconnect=function(e,t){this.adjList[e].splice(0);for(var n=0;n<this.V;n++){for(var r=this.adjList[n],i=0;i<r.length;i++)r[i]==e&&(r.splice(i,1),i--);var a=n+"_"+e;a in this.edges&&delete this.edges[a],(a=e+"_"+n)in this.edges&&delete this.edges[a]}if(t){var o=new h(this.V-1);for(n=0;n<this.V;n++)if(n!=e)for(r=this.adjList[n],i=0;i<r.length;i++){var s=r[i],l=e<n?n-1:n,c=e<s?s-1:s,u=this.edge(n,s).copy();u.v=l,u.w=c,o.addEdge(u)}this.V--,this.adjList=o.adjList,this.nodeInfo.splice(e,1),this.edges=o.edges}},h.prototype.insert=function(e,t,n){for(var r=this.V,i=e.V,a=0;a<i;a++){this.adjList.push([]),this.nodeInfo.push(u(e.nodeInfo[a]));for(var o=e.adjList[a],s=0;s<o.length;s++){var l=o[s];(c=e.edge(a,l).copy()).v+=r,c.w+=r,this.addEdge(c)}}this.V+=i;for(s=0;s<t.length;s++){(c=t[s].copy()).w+=r,this.addEdge(c)}for(s=0;s<n.length;s++){var c;(c=n[s].copy()).v+=r,this.addEdge(c)}},h.prototype.vis=function(e){e=e||function(e,t){return String(e)};for(var t="digraph G {",n=0;n<this.V;n++){t+=n+' [label="'+e(n,this.nodeInfo[n])+'"];';for(var r=this.adjList[n],i=0;i<r.length;i++){t+=n+" -> "+r[i]+";"}}t+="}",console.log(t)},c.DiGraph=h;var s=function(e,t,n){this.v=e,this.w=t,this.weight=n};s.prototype.either=function(){return this.v},s.prototype.other=function(e){return e==this.v?this.w:this.v},s.prototype.from=function(){return this.v},s.prototype.to=function(){return this.w},s.prototype.copy=function(){var e=new s(0,0,0);for(var t in this)this.hasOwnProperty(t)&&(e[t]=this[t]);return e},c.Edge=s;var l=function(e){this.V=e,this.adjList=[],this.nodeInfo=[];for(var t=0;t<e;++t)this.adjList.push([]),this.nodeInfo.push({})};l.prototype.adj=function(e){return this.adjList[e]},l.prototype.edge=function(e,t){for(var n=this.adjList[e],r=0;r<n.length;++r){if(n[r].other(e)==t)return n[r]}return null},l.prototype.node=function(e){return this.nodeInfo[e]},l.prototype.addNewEdge=function(e){var t=e.either(),n=e.other(t);this.adjList[t].push(e),this.adjList[n].push(e)},c.WeightedGraph=l;var d=function(e){l.call(this,e)};(d.prototype=Object.create(c.WeightedGraph.prototype)).addNewEdge=function(e){var t=e.from();this.adjList[t].push(e)},d.prototype.edge=function(e,t){for(var n=this.adjList[e],r=0;r<n.length;++r){if(n[r].other(e)==t)return n[r]}return null},d.prototype.toDiGraph=function(){for(var e=new c.DiGraph(this.V),t=0;t<this.V;++t)for(var n=this.adjList[t],r=0;r<n.length;++r){var i=n[r].other(t);e.addNewEdge(t,i)}return e},c.WeightedDiGraph=d;var p=function(e,t,n){this.v=e,this.w=t,this.capacity=n,this.flow=0};p.prototype.residualCapacityTo=function(e){return e==this.v?this.flow:this.capacity-this.flow},p.prototype.addResidualFlowTo=function(e,t){e==this.v?this.flow-=t:e==this.w&&(this.flow+=t)},p.prototype.from=function(){return this.v},p.prototype.to=function(){return this.w},p.prototype.other=function(e){return e==this.v?this.w:this.v},c.FlowEdge=p;var f=function(e){this.V=e,this.adjList=[],this.nodeInfo=[];for(var t=0;t<e;++t)this.adjList.push([]),this.nodeInfo.push({})};f.prototype.node=function(e){return this.nodeInfo[e]},f.prototype.edge=function(e,t){for(var n=this.adjList[e],r=0;r<n.length;++r){if(n[r].other(e)==t)return n[r]}return null},f.prototype.addNewEdge=function(e){var t=e.from();this.adjList[t].push(e);var n=e.other(t);this.adjList[n].push(e)},f.prototype.adj=function(e){return this.adjList[e]},c.FlowNetwork=f;var m=function(e,t){this.s=t;var n=e.V;this.marked=[],this.edgeTo=[];for(var r=0;r<n;++r)this.marked.push(!1),this.edgeTo.push(-1);this.dfs(e,t)};m.prototype.dfs=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i]||(this.edgeTo[i]=t,this.dfs(e,i))}},m.prototype.hasPathTo=function(e){return this.marked[e]},m.prototype.pathTo=function(e){var t=new c.Stack;if(e==this.s)return[e];for(var n=e;n!=this.s;n=this.edgeTo[n])t.push(n);return t.push(this.s),t.toArray()},c.DepthFirstSearch=m;var v=function(e,t){var n=e.V;this.s=t;var r=new c.Queue;r.enqueue(t),this.marked=[],this.edgeTo=[];for(var i=0;i<n;++i)this.marked.push(!1),this.edgeTo.push(-1);for(;!r.isEmpty();){i=r.dequeue();this.marked[i]=!0;for(var a=e.adj(i),o=0;o<a.length;++o){var s=a[o];this.marked[s]||(this.edgeTo[s]=i,r.enqueue(s))}}};v.prototype.hasPathTo=function(e){return this.marked[e]},v.prototype.pathTo=function(e){var t=new c.Stack;if(e==this.s)return[e];for(var n=e;n!=this.s;n=this.edgeTo[n])t.push(n);return t.push(this.s),t.toArray()},c.BreadthFirstSearch=v;var g=function(e){this.count=0;var t=e.V;this.marked=[],this.id=[];for(var n=0;n<t;++n)this.marked.push(!1),this.id.push(-1);for(n=0;n<t;++n)this.marked[n]||(this.dfs(e,n),this.count++)};g.prototype.dfs=function(e,t){this.marked[t]=!0,this.id[t]=this.count;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i]||this.dfs(e,i)}},g.prototype.componentId=function(e){return this.id[e]},g.prototype.componentCount=function(){return this.count},c.ConnectedComponents=g;var y=function(e){this.postOrder=new c.Stack,this.marked=[];for(var t=e.V,n=0;n<t;++n)this.marked.push(!1);for(n=0;n<t;++n)this.marked[n]||this.dfs(e,n)};y.prototype.dfs=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i]||this.dfs(e,i)}this.postOrder.push(t)},y.prototype.order=function(){return this.postOrder.toArray()},c.TopologicalSort=y;var x=function(e){var t=e.V;this.count=0,this.marked=[],this.id=[];for(var n=0;n<t;++n)this.marked.push(!1),this.id.push(-1);for(var r=new c.TopologicalSort(e.reverse()).order(),i=0;i<r.length;++i){n=r[i];this.marked[n]||(this.dfs(e,n),this.count++)}};x.prototype.dfs=function(e,t){this.marked[t]=!0,this.id[t]=this.count;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i]||this.dfs(e,i)}},x.prototype.componentId=function(e){return this.id[e]},x.prototype.componentCount=function(){return this.count},c.StronglyConnectedComponents=x;c.KruskalMST=function(e){for(var t=e.V,n=new c.MinPQ(function(e,t){return e.weight-t.weight}),r=0;r<e.V;++r)for(var i=e.adj(r),a=0;a<i.length;++a)(s=i[a]).either()==r&&n.enqueue(s);this.mst=[];for(var o=new c.QuickUnion(t);!n.isEmpty()&&this.mst.length<t-1;){r=(s=n.delMin()).either();var s,l=s.other(r);o.connected(r,l)||(o.union(r,l),this.mst.push(s))}};var _=function(e){var t=e.V;this.marked=[];for(var n=0;n<t;++n)this.marked.push(!1);for(this.pq=new c.MinPQ(function(e,t){return e.weight-t.weight}),this.mst=[],this.visit(e,0);!this.pq.isEmpty()&&this.mst.length<t-1;){var r=this.pq.delMin(),i=(n=r.either(),r.other(n));this.marked[n]&&this.marked[i]||(this.mst.push(r),this.marked[n]||this.visit(e,n),this.marked[i]||this.visit(e,i))}};_.prototype.visit=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i.other(t)]||this.pq.enqueue(i)}},c.LazyPrimMST=_;var b=function(e){var t=e.V;this.pq=new c.IndexMinPQ(t,function(e,t){return e.weight-t.weight}),this.marked=[];for(var n=0;n<t;++n)this.marked.push(!1);for(this.mst=[],this.visit(e,0);!this.pq.isEmpty();){var r=this.pq.minKey(),i=this.pq.delMin();this.mst.push(r),this.marked[i]||this.visit(e,i)}};b.prototype.visit=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r],a=i.other(t);this.marked[a]||(this.pq.containsIndex(a)?this.pq.decreaseKey(a,i):this.pq.insert(a,i))}},c.EagerPrimMST=b;var w=function(e,t){var n=e.V;this.s=t,this.marked=[],this.edgeTo=[],this.cost=[],this.pq=new c.IndexMinPQ(n,function(e,t){return t});for(var r=0;r<n;++r)this.marked.push(!1),this.edgeTo.push(null),this.cost.push(Number.MAX_VALUE);for(this.cost[t]=0,this.pq.insert(t,this.cost[t]);!this.pq.isEmpty();){r=this.pq.delMin();this.marked[r]=!0;for(var i=e.adj(r),a=0;a<i.length;++a){var o=i[a];this.relax(o)}}};w.prototype.relax=function(e){var t=e.from(),n=e.to();this.cost[n]>this.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.edgeTo[n]=e,this.pq.containsIndex(n)?this.pq.decreaseKey(n,this.cost[n]):this.pq.insert(n,this.cost[n]))},w.prototype.hasPathTo=function(e){return this.marked[e]},w.prototype.pathTo=function(e){for(var t=new c.Stack,n=e;n!=this.s;n=this.edgeTo[n].from())t.push(this.edgeTo[n]);return t.toArray()},w.prototype.distanceTo=function(e){return this.cost[e]},c.Dijkstra=w;var A=function(e,t){var n=e.V;this.s=t,this.marked=[],this.edgeTo=[],this.cost=[];for(var r=0;r<n;++r)this.marked.push(!1),this.edgeTo.push(null),this.cost.push(Number.MAX_VALUE);this.cost[t]=0,this.marked[t]=!0;for(var i=0;i<n;++i)for(r=0;r<n;++r)for(var a=e.adj(r),o=0;o<a.length;++o){var s=a[o];this.relax(s)}};A.prototype.relax=function(e){var t=e.from(),n=e.to();this.cost[n]>this.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.marked[n]=!0,this.edgeTo[n]=e)},A.prototype.hasPathTo=function(e){return this.marked[e]},A.prototype.pathTo=function(e){for(var t=new c.Stack,n=e;n!=this.s;n=this.edgeTo[n].from())t.push(this.edgeTo[n]);return t.toArray()},A.prototype.distanceTo=function(e){return this.cost[e]},c.BellmanFord=A;var M=function(e,t){var n=e.V;this.s=t,this.marked=[],this.edgeTo=[],this.cost=[];for(var r=0;r<n;++r)this.marked.push(!1),this.edgeTo.push(null),this.cost.push(Number.MAX_VALUE);this.cost[t]=0,this.marked[t]=!0;for(var i=new c.TopologicalSort(e.toDiGraph()).order(),a=0;a<i.length;++a){r=i[a];for(var o=e.adj(r),s=0;s<o.length;++s){var l=o[s];this.relax(l)}}};M.prototype.relax=function(e){var t=e.from(),n=e.to();this.cost[n]>this.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.marked[n]=!0,this.edgeTo[n]=e)},M.prototype.hasPathTo=function(e){return this.marked[e]},M.prototype.pathTo=function(e){for(var t=new c.Stack,n=e;n!=this.s;n=this.edgeTo[n].from())t.push(this.edgeTo[n]);return t.toArray()},M.prototype.distanceTo=function(e){return this.cost[e]},c.TopologicalSortShortestPaths=M;var T=function(e,t,n){this.value=0;e.V;var r=Number.MAX_VALUE;for(this.marked=null,this.edgeTo=null,this.s=t,this.t=n;this.hasAugmentedPath(e);){for(var i=this.t;i!=this.s;i=this.edgeTo[i].from())r=Math.min(r,this.edgeTo[i].residualCapacityTo(i));for(i=this.t;i!=this.s;i=this.edgeTo[i].from())this.edgeTo[i].addResidualFlowTo(i,r);this.value+=r}};T.prototype.hasAugmentedPath=function(e){var t=e.V;this.marked=[],this.edgeTo=[];for(var n=0;n<t;++n)this.marked.push(!1),this.edgeTo.push(null);var r=new c.Queue;for(r.enqueue(this.s),this.marked[this.s]=!0;!r.isEmpty();){n=r.dequeue();for(var i=e.adj(n),a=0;a<i.length;++a){var o=i[a],s=o.other(n);if(!this.marked[s]&&0<o.residualCapacityTo(s)){if(this.edgeTo[s]=o,this.marked[s]=!0,s==this.t)return!0;r.enqueue(s)}}}return!1},T.prototype.minCut=function(e){for(var t=[],n=e.V,r=0;r<n;++r)for(var i=e.adj(r),a=0;a<i.length;++a){var o=i[a];o.from()==r&&0==o.residualCapacityTo(o.other(r))&&t.push(o)}return t},c.FordFulkerson=T}(Fl);var Il=[[-1.117001,-.1867262,-11.13505,12.59865,-.03937339,1.167571,.007100686,3.592678,.6083296,-1.152006,-.1926669,6.152049,-4.770802,-.08704701,.7483626,.03372718,4.464592,.4036546,-1.072371,-.2696632,.2816168,1.820571,-.3742666,2.080607,-.07675295,-2.835366,1.129329,-1.109935,-.1532764,1.198787,-.9015183,.005173015,.5749178,.1075633,4.387949,.2650413,-1.052297,-.2229452,1.952347,.5727205,-4.88507,1.984016,-.1106197,-.4898361,.8907873,-1.070108,-.1600465,1.593886,-4479251e-11,-3.306541,.9390193,.09513168,2.343583,.5335404,-1.113253,-.16996,-10.38822,11.37513,-.04040911,1.037455,.04991792,4.801919,.630271,-1.135747,-.1678594,4.970755,-4.43023,-.06657408,.3636161,.1558009,6.01337,.3959601,-1.095892,-.2732595,.7666496,1.350731,-.4401401,2.470135,-.1707929,-3.260793,1.170337,-1.073668,-.02603929,-.1944589,.4575207,.6878164,-.139077,.3690299,7.885781,.1877694,-1.070091,-.2798957,2.338478,-2.647221,-7.387808,2.32921,-.1644639,-2.00371,.9874527,-1.06712,-.1418866,1.25409,6.053048,-2.918892,.5322812,.1613053,3.018161,.527409,-1.129483,-.1890619,-9.065101,9.659923,-.03607819,.8314359,.08181661,4.768868,.6339777,-1.14642,-.1883579,3.309173,-3.127882,-.06938176,.3987113,.1400581,6.283042,.5267076,-1.128348,-.2641305,1.223176,.05514952,-.3490649,1.997784,-.04123709,-2.251251,.9483466,-1.02582,.0140469,-1.187406,2.7299,.5877588,-.276114,.4602633,8.305125,.3945001,-1.083957,-.2606679,2.207108,-7.202803,-5.968103,2.129455,-.07789512,-1.137688,.8871769,-1.062465,-.1512189,1.042881,14.27839,-4.242214,.40381,.199778,2.814449,.5803196,-1.175099,-.2410789,-11.08587,11.33404,-.018193,.6772942,.09605043,4.231166,.6239972,-1.224207,-.2883527,3.002206,-2.649612,-.04795418,.4984398,.03251434,4.851611,.6551019,-1.136955,-.2423048,1.058823,-.2489236,-.2462179,1.93314,.09106828,-.1905869,.8171065,-1.014535,-.0082625,-1.448017,2.295788,.3510334,-1.477418,.5432449,5.762796,.4908751,-1.070666,-.237978,1.844589,-5.442448,-4.012768,2.945275,.009854725,.08455959,.814503,-1.071525,-.1777132,.807659,9.925865,-3.324623,-.6367437,.2844581,2.248384,.6544022,-1.218818,-.2952382,-13.45975,13.47153,-.006814585,.5079068,.119723,3.776949,.5836961,-1.409868,-.511433,2.776539,-2.039001,-.02673769,.4145288,.0007829342,2.275883,.6629691,-1.069151,-.09434247,.7293972,-1.222473,-.1533461,2.160357,.04626837,3.852415,.859357,-1.021306,-.1149551,-1.108414,4.178343,.4013665,-2.222814,.6929462,1.392652,.4401662,-1.074251,-.2224002,1.372356,-8.858704,-3.92266,3.020018,-.01458724,1.511186,.8288064,-1.062048,-.1526582,.4921067,14.85522,-3.229936,-.8426604,.3916243,2.678994,.6689264,-1.257023,-.33647,-15.27795,15.04223,.002717715,.302991,.1636851,3.561663,.5283161,-1.635124,-.7329993,3.523939,-2.566337,-.01902543,.5505483,-.06242176,1.065992,.6654236,-.9295823,.04845834,-.299299,-.2001327,-.08019339,1.807806,.09020277,5.095372,.8639936,-1.09374,-.2148608,-.521624,2.119777,.09506454,-1.831439,.6961204,.1102084,.4384319,-1.044181,-.1849257,.9071246,-4.648901,-2.279385,2.356502,-.04169147,1.932557,.829655,-1.061451,-.1458745,.2952267,8.967214,-3.726228,-.5022316,.5684877,3.102347,.6658443,-1.332391,-.4127769,-9.328643,9.046194,.003457775,.3377425,.1530909,3.301209,.4997917,-1.932002,-.9947777,-2.042329,3.58694,-.05642182,.8130478,-.08195988,.1118294,.5617231,-.8707374,.1286999,1.820054,-4.674706,.003317471,.5919018,.1975278,6.686519,.9631727,-1.070378,-.3030579,-.9041938,6.200201,.1232207,-.3650628,.5029403,-2.903162,.3811408,-1.063035,-.1637545,.5853072,-7.889906,-1.200641,1.035018,.1192093,3.267054,.8416151,-1.053655,-.1562286,.2423683,11.28575,-4.363262,-.0731416,.5642088,2.514023,.6670457,-1.366112,-.4718287,-7.876222,7.7469,-.009182309,.4716076,.08320252,3.165603,.5392334,-2.468204,-1.33634,-5.386723,7.072672,-.08329266,.8636876,-.01978177,-.1326218,.2979222,-.9653522,-.02373416,1.81025,-6.467262,.1410706,-.4753717,.3003095,6.551163,1.151083,-.8943186,-.2487152,-.230896,8.512648,.1298402,1.034705,.2303509,-3.924095,.2982717,-1.146999,-.2318784,.08992419,-9.933614,-.886092,-.03071656,.2852012,3.046199,.8599001,-1.032399,-.1645145,.2683599,13.27701,-4.40767,.07709869,.4951727,1.957277,.6630943,-1.46907,-.6135092,-6.506263,6.661315,-.03835383,.7150413,.007784318,2.820577,.6756784,-2.501583,-1.247404,-15.23462,16.33191,-.01204803,.5896471,-.02002023,1.144647,.06177874,-2.438672,-1.127291,5.731172,-10.2135,.0616561,-.7752641,.4708254,4.176847,1.200881,-.1513427,.09792731,-1.612349,9.814289,.05188921,1.716403,-.07039255,-2.815115,.3291874,-1.318511,-.3650554,.4221268,-9.294529,-.0439752,-.8100625,.3742719,1.834166,.822345,-1.016009,-.1820264,.1278426,11.82696,-4.801528,.4947899,.4660378,1.601254,.6702359,-1.84131,-.9781779,-4.610903,4.824662,-.05100806,.6463776,-6377724e-12,2.216875,.861853,-2.376373,-1.108657,-14.89799,15.46458,.04091025,.0976178,-.01048958,2.165834,-.1609171,-4.710318,-2.261963,6.947327,-10.34828,-.1325542,.7508674,.2247553,2.873142,1.2971,.216375,-.1944345,-2.43786,10.11314,.44505,.3111492,.2751323,-1.627906,.2531213,-1.258794,-.3524641,.8425444,-10.85313,-1.154381,-.4638014,-.002781115,.4344498,.8507091,-1.018938,-.1804153,-.06354054,15.7315,-4.386999,.6211115,.5294648,1.580749,.6586655,-1.116416,-.1917524,-10.68233,12.22221,-.03668978,1.054022,.01592132,3.180583,.562737,-1.132341,-.1671286,5.976499,-4.227366,-.09542489,.8664938,.008351793,4.876068,.4492779,-1.087635,-.3173679,.4314407,1.100555,-.4410057,1.677253,-.03005925,-4.201249,1.070902,-1.083031,-.08847705,1.291773,.4546776,.3091894,.726176,.04203659,5.990615,.3704756,-1.057899,-.2246706,2.329563,-1.219656,-5.33526,.8545378,-.03906209,-.9025499,.7797348,-1.073305,-.1522553,1.767063,1.90428,-3.101673,.3995856,.02905192,2.563977,.5753067,-1.113674,-.1759694,-9.754125,10.87391,-.03841093,.9524272,.05680219,4.227034,.6029571,-1.126496,-.1680281,5.332352,-4.575579,-.06761755,.3295335,.1194896,5.570901,.4536185,-1.103074,-.2681801,.06571479,2.396522,-.455128,2.466331,-.1232022,-3.023201,1.086379,-1.053299,-.02697173,.8379121,-.9681458,.5890692,-.4872027,.2936929,7.510139,.3079122,-1.079553,-.2710448,2.462379,-.3713554,-8.534512,1.828242,-.1686398,-1.96134,.8941077,-1.069741,-.1396394,1.657868,3.236313,-2.706344,-.2948122,.1314816,2.868457,.5413403,-1.131649,-.1954455,-7.751595,8.685861,-.04910871,.8992952,.04710143,4.254818,.6821116,-1.156689,-.1884324,3.163519,-3.091522,-.06613927,-.02575883,.1640065,6.073643,.4453468,-1.079224,-.2621389,.9446437,1.448479,-.3969384,2.626638,-.08101186,-3.016355,1.076295,-1.080832,.01033057,-.3500156,-.03281419,.5655512,-1.156742,.453471,8.774122,.2772869,-1.051202,-.2679975,2.719109,-2.190316,-6.878798,2.250481,-.2030252,-2.026527,.9701096,-1.089849,-.1598589,1.564748,6.869187,-3.05367,-.6110435,.1644472,2.370452,.551177,-1.171419,-.2429746,-8.991334,9.571216,-.02772861,.6688262,.07683478,3.785611,.6347635,-1.228554,-.2917562,2.753986,-2.49178,-.04663434,.3118303,.07546506,4.463096,.5955071,-1.093124,-.2447767,.9097406,.5448296,-.2957824,2.024167,-.0005152333,-1.069081,.9369565,-1.056994,.01569507,-.8217491,1.870818,.706193,-1.483928,.5978206,6.864902,.3673332,-1.054871,-.2758129,2.712807,-5.95011,-6.554039,2.447523,-.1895171,-1.454292,.9131738,-1.100218,-.1746241,1.438505,11.15481,-3.266076,-.8837357,.19701,1.991595,.5907821,-1.207267,-.291361,-11.03767,11.40724,-.014168,.5564047,.08476262,3.371255,.6221335,-1.429698,-.5374218,2.837524,-2.221936,-.02422337,.09313758,.0719025,1.869022,.5609035,-1.002274,-.0697281,.4031308,-.3932997,-.1521923,2.390646,-.0689399,2.999661,1.017843,-1.081168,-.1178666,-.496808,3.919299,.6046866,-2.440615,.7891538,2.140835,.274047,-1.050727,-.2307688,2.276396,-9.454407,-5.505176,2.99262,-.2450942,.6078372,.9606765,-1.103752,-.1810202,1.375044,15.89095,-3.438954,-1.265669,.2475172,1.680768,.5978056,-1.244324,-.3378542,-11.11001,11.37784,-.007896794,.4808023,.09249904,3.025816,.5880239,-1.593165,-.7027621,2.220896,-1.437709,-.01534738,.06286958,.06644555,1.091727,.547008,-.9136506,.01344874,.7772636,-1.209396,-.1408978,2.433718,-.1041938,3.791244,1.037916,-1.134968,-.1803315,-.9267335,4.57667,.6851928,-2.805,.8687208,1.161483,.2571688,-1.017037,-.2053943,2.36164,-9.887818,-5.122889,3.287088,-.2594102,.8578927,.959234,-1.118723,-.1934942,1.226023,16.7414,-3.277335,-1.629809,.2765232,1.637713,.6113963,-1.314779,-.4119915,-12.4115,12.41578,.002344284,.2980837,.1414613,2.781731,.4998556,-1.926199,-1.020038,2.5692,-1.081159,-.02266833,.3588668,.008750078,-.2452171,.4796758,-.7780002,.1850647,.04445456,-2.409297,-.07816346,1.54679,-.02807227,5.998176,1.132396,-1.179326,-.357833,-.2392933,6.467883,.5904596,-1.869975,.8045839,-2.498121,.1610633,-1.009956,-.1311896,1.726577,-12.19356,-3.466239,2.343602,-.2252205,2.573681,1.027109,-1.11246,-.2063093,1.233051,20.58946,-4.578074,-1.145643,.3160192,1.420159,.5860212,-1.371689,-.4914196,-10.7661,11.07405,-.01485077,.5936218,.03685482,2.599968,.6002204,-2.436997,-1.377939,.02130141,1.079593,-.01796232,-.03933248,.1610711,-.6901181,.1206416,-.8743368,.0733137,.8734259,-3.743126,-.03151167,1.297596,-.07634926,6.532873,1.435737,-.9810197,-.3521634,-.2855205,7.134674,.6839748,-1.394841,.6952036,-4.633104,-.02173401,-1.122958,-.1691536,1.38236,-11.02913,-2.608171,1.865111,-.1345154,3.112342,1.094134,-1.075586,-.2077415,1.171477,17.9327,-4.656858,-1.036839,.3338295,1.042793,.5739374,-1.465871,-.6364486,-8.833718,9.34365,-.032236,.7552848,-3121341e-12,2.249164,.8094662,-2.448924,-1.270878,-4.823703,5.853058,-.02149127,.03581132,-.001230276,.4892553,-.1597657,-2.419809,-1.071337,1.575648,-4.98358,.009545185,.5032615,.4186266,4.634147,1.433517,-.1383278,-.02797095,-.1943067,6.679623,.411828,-.2744289,-.02118722,-4.337025,.1505072,-1.341872,-.2518572,1.027009,-6.527103,-1.081271,1.015465,.2845789,2.470371,.927812,-1.04064,-.2367454,1.100744,8.827253,-4.560794,-.7287017,.2842503,.6336593,.6327335,-1.877993,-1.025135,-4.311037,4.715016,-.04711631,.6335844,-7665398e-12,1.788017,.9001409,-2.28154,-1.137668,-10.36869,11.36254,.01961739,-.09836174,-.006734567,1.320918,-.2400807,-4.904054,-2.315781,5.735999,-8.626257,-.1255643,1.545446,.139686,2.972897,1.429934,.4077067,-.1833688,-2.450939,9.119433,.4505361,-1.340828,.397369,-1.78537,.09628711,-1.296052,-.3250526,1.813294,-10.31485,-1.38869,1.239733,-.08989196,-.3389637,.963956,-1.062181,-.2423444,.7577592,15.66938,-4.462264,-.574281,.3262259,.9461672,.6232887],[-1.127942,-.1905548,-12.52356,13.75799,-.03624732,1.055453,.01385036,4.17697,.5928345,-1.15526,-.1778135,6.216056,-5.254116,-.08787445,.8434621,.04025734,6.195322,.3111856,-1.125624,-.3217593,.5043919,1.686284,-.3536071,1.476321,-.07899019,-4.522531,1.271691,-1.081801,-.1033234,.999555,.007482946,-.06776018,1.463141,.09492021,5.612723,.1298846,-1.07532,-.2402711,2.141284,-1.203359,-4.945188,1.437221,-.0809675,-1.028378,1.004164,-1.073337,-.1516517,1.639379,2.304669,-3.214244,1.286245,.05613957,2.480902,.4999363,-1.128399,-.1857793,-10.89863,11.72984,-.03768099,.9439285,.04869335,4.845114,.6119211,-1.114002,-.139928,4.9638,-4.6855,-.07780879,.4049736,.1586297,7.770264,.3449006,-1.185472,-.3403543,.6588322,1.133713,-.4118674,2.061191,-.1882768,-4.372586,1.22353,-1.002272,.02000703,.07073269,1.485075,.5005589,.4301494,.3626541,7.921098,.1574766,-1.121006,-.3007777,2.242051,-4.571561,-7.761071,2.053404,-.1524018,-1.886162,1.018208,-1.058864,-.1358673,1.389667,8.633409,-3.437249,.7295429,.15147,2.842513,.5014325,-1.144464,-.2043799,-10.20188,10.71247,-.03256693,.7860205,.06872719,4.824771,.6259836,-1.170104,-.2118626,4.391405,-4.1989,-.07111559,.3890442,.1024831,6.282535,.5365688,-1.129171,-.255288,.2238298,.7314295,-.356273,1.881931,-.03078716,-1.03912,.9096301,-1.042294,.004450203,-.5116033,2.627589,.6098996,-.1264638,.4325281,7.080503,.4583646,-1.082293,-.2723056,2.065076,-8.143133,-7.892212,2.142231,-.0710624,-1.122398,.8338505,-1.071715,-.1426568,1.095351,17.29783,-3.851931,.4360514,.211444,2.970832,.5944389,-1.195909,-.2590449,-11.91037,12.07947,-.01589842,.6297846,.09054772,4.285959,.5933752,-1.245763,-.3316637,4.29366,-3.694011,-.04699947,.4843684,.02130425,4.097549,.6530809,-1.148742,-.1902509,-.2393233,-.2441254,-.2610918,1.846988,.03532866,2.660106,.8358294,-1.01608,-.0744496,-.5053436,4.388855,.6054987,-1.2083,.5817215,2.54357,.4726568,-1.072027,-.210144,1.518378,-10.60119,-6.016546,2.649475,-.05166992,1.571269,.8344622,-1.072365,-.1511201,.747801,19.00732,-3.950387,-.3473907,.3797211,2.782949,.6296808,-1.239423,-.3136289,-13.511,13.49468,-.007070423,.5012315,.1106008,3.803619,.5577948,-1.452524,-.5676944,2.993153,-2.277288,-.02168954,.305672,.01152338,1.852697,.6427228,-1.061421,-.04590521,.6057022,-1.096835,-.1504952,2.344921,-.05491832,5.268322,.9082253,-1.042373,-.1769498,-1.075388,3.831712,.315414,-2.416458,.7909032,-.01492892,.3854049,-1.064159,-.1892684,1.438685,-8.166362,-3.616364,3.275206,-.1203825,2.039491,.8688057,-1.07012,-.1569508,.412476,13.99683,-3.547085,-1.046326,.4973825,2.791231,.6503286,-1.283579,-.3609518,-13.35397,13.15248,-.0004431938,.3769526,.1429824,3.573613,.4998696,-1.657952,-.7627948,1.958222,-.7949816,-.02882837,.5356149,-.05191946,.8869955,.626332,-.95276,.06494189,.5361303,-2.12959,-.0925863,1.604776,.0506777,6.376055,.9138052,-1.080827,-.252312,-.7154262,4.120085,.1878228,-1.492158,.6881655,-1.446611,.4040631,-1.054075,-.1665498,.9191052,-6.636943,-1.894826,2.10781,-.03680499,2.655452,.841384,-1.061127,-.1448849,.2667493,10.34103,-4.285769,-.3874504,.5998752,3.132426,.6652753,-1.347345,-.4287832,-9.305553,9.133813,-.003173527,.3977564,.115142,3.320564,.4998134,-1.927296,-.9901372,-2.593499,4.087421,-.05833993,.8158929,-.04681279,.2423716,.4938052,-.9470092,.07325237,2.064735,-5.16754,-.01313751,.4832169,.1126295,6.970522,1.035022,-1.022557,-.2762616,-.9375748,6.696739,.2200765,-.1133253,.5492505,-3.109391,.3321914,-1.087444,-.1836263,.6225024,-8.576765,-1.107637,.7859427,.09910909,3.112938,.8596261,-1.051544,-.1546262,.2371731,12.00502,-4.527291,.07268862,.5571478,2.532873,.6662,-1.375576,-.4840019,-8.12129,8.05814,-.01445661,.5123314,.05813321,3.203219,.5442318,-2.325221,-1.241463,-7.06343,8.741369,-.0782995,.8844273,-.03471106,.1740583,.2814079,-1.2287,-.2013412,2.949042,-7.371945,.1071753,-.249197,.2265223,6.391504,1.172389,-.7601786,-.1680631,-.7584444,8.541356,.08222291,.6729633,.3206615,-3.70094,.2710054,-1.191166,-.2672347,.2927498,-9.713613,-.4783721,.2352803,.2161949,2.691481,.8745447,-1.030135,-.1653301,.2263443,12.96157,-4.650644,.007055709,.5091975,2.00037,.6603839,-1.508018,-.6460933,-6.402745,6.545995,-.0375032,.6921803,.003309819,2.797527,.6978446,-2.333308,-1.167837,-17.46787,18.6863,-.008948229,.5621946,-.03402626,1.217943,.01149865,-2.665953,-1.226307,7.169725,-11.59434,.0358342,-.3074378,.3412248,4.422122,1.283791,-.09705116,.08312991,-2.160462,10.28235,.03543357,1.032049,.105831,-2.972898,.2418628,-1.329617,-.3699557,.5560117,-9.730113,.09938865,-.3071488,.2510691,1.777111,.8705142,-1.019387,-.1893247,.1194079,12.39436,-4.799224,.2940213,.4841268,1.529724,.6582615,-1.896737,-1.005442,-6.411032,6.54822,-.03227596,.5717262,-8115192e-12,2.296704,.9000749,-2.411116,-1.225587,-17.53629,18.29393,.01247555,.2364616,-.005114637,1.603778,-.2224156,-4.707121,-2.074977,7.9423,-11.32407,-.05415654,.5446811,.1032493,4.010235,1.369802,.1010482,-.4013305,-2.674579,9.779409,.1782506,.7053045,.4200002,-2.400671,.1953165,-1.243526,-.3391255,.8848882,-9.789025,-.3997324,-.9546227,-.1044017,.6010593,.8714462,-1.014633,-.1730009,-.07738934,13.90903,-4.847307,1.076059,.5685743,1.572992,.6561432,-1.122998,-.1881183,-10.30709,11.58932,-.04079495,.9603774,.03079436,4.009235,.5060745,-1.13479,-.1539688,5.478405,-4.21727,-.1043858,.7165008,.01524765,6.473623,.4207882,-1.134957,-.3513318,.7393837,1.354415,-.4764078,1.690441,-.0549264,-5.563523,1.145743,-1.058344,-.05758503,1.16823,.3269824,.1795193,.7849011,.07441853,6.904804,.281879,-1.075194,-.2355813,2.463685,-1.536505,-7.505771,.9619712,-.06465851,-1.355492,.8489847,-1.07903,-.1465328,1.773838,2.310131,-3.136065,.3507952,.04435014,2.819225,.5689008,-1.125833,-.1870849,-9.555833,10.59713,-.04225402,.9164663,.04338796,4.40098,.6056119,-1.12744,-.1551891,4.755621,-4.408806,-.07851763,.2268284,.146007,7.048003,.3525997,-1.143788,-.3170178,.5480669,2.04183,-.4532139,2.302233,-.1887419,-4.489221,1.250967,-1.032849,.007376031,.5666073,-.2312203,.4862894,-.1748294,.357287,8.380522,.1302333,-1.093728,-.2786977,2.641272,-1.507494,-8.731243,1.684055,-.2023377,-2.176398,1.013249,-1.076578,-.1456205,1.693935,2.945003,-2.822673,-.2520033,.1517034,2.649109,.5179094,-1.146417,-.2119353,-7.187525,8.058599,-.05256438,.8375733,.03887093,4.222111,.6695347,-1.173674,-.2067025,2.899359,-2.804918,-.08473899,.003944225,.1340641,6.160887,.4527141,-1.090098,-.2599633,.9180856,1.09271,-.4215019,2.42766,-.09277667,-2.123523,1.058159,-1.08446,.008056181,-.245351,.6619567,.4668118,-.9526719,.4648454,8.001572,.3054194,-1.053728,-.2765784,2.792388,-3.489517,-8.150535,2.195757,-.2017234,-2.128017,.9326589,-1.099348,-.1593939,1.568292,7.247853,-2.933,-.5890481,.172444,2.433484,.5736558,-1.185983,-.2581184,-7.761056,8.317053,-.03351773,.6676667,.05941733,3.820727,.6324032,-1.268591,-.3398067,2.348503,-2.023779,-.05368458,.1083282,.08402858,3.910254,.5577481,-1.071353,-.1992459,.7878387,.1974702,-.3033058,2.335298,-.08205259,.7954454,.9972312,-1.089513,-.03104364,-.5995746,2.330281,.6581939,-1.821467,.6679973,5.090195,.3125161,-1.040214,-.2570934,2.660489,-6.506045,-7.053586,2.763153,-.2433632,-.7648176,.9452937,-1.116052,-.1831993,1.457694,11.63608,-3.216426,-1.045594,.2285002,1.817407,.5810396,-1.230134,-.3136264,-8.909301,9.145006,-.01055387,.4467317,.1016826,3.342964,.563384,-1.442907,-.5593147,2.156447,-1.241657,-.0351213,.3050274,.01797175,1.742358,.5977153,-1.027627,-.06481539,.4351975,-1.051677,-.2030672,1.942684,-.03615993,4.050266,.9801624,-1.08211,-.1578209,-.3397511,4.163851,.6650368,-1.84173,.7062544,.6789881,.3172623,-1.047447,-.197756,2.183364,-8.805249,-5.483962,2.551309,-.177964,1.519501,.9212536,-1.111853,-.1935736,1.394408,13.92405,-3.46543,-1.068432,.2388671,1.455336,.6233425,-1.262238,-.3546341,-10.08703,10.20084,-.001852187,.353758,.1239199,3.056093,.5132052,-1.61381,-.7355585,2.760123,-1.685253,-.02517552,.2914258,.004743448,.8689596,.5674192,-.9462336,.02950767,-.2613816,-.7398653,-.1315558,1.901042,-.06447844,4.969341,1.027342,-1.111481,-.2194054,-.09004538,3.983442,.4871278,-1.965315,.7956121,-.2363225,.2718037,-1.036397,-.1827106,1.964747,-8.870759,-4.208011,2.461215,-.2158905,1.561676,.9436866,-1.113769,-.1947819,1.30072,15.16476,-4.088732,-1.069384,.2836434,1.671451,.6229612,-1.328069,-.4244047,-8.41704,8.552244,-.006813504,.4127422,.09619897,2.854227,.505988,-1.927552,-1.02529,.9529576,.425595,-.03738779,.2584586,.04911004,-.2640913,.4138626,-.8488094,.1435988,.6356807,-2.895732,-.08473961,1.701305,-.1323908,6.499338,1.210928,-1.128313,-.3397048,-.404314,6.265097,.5482395,-2.057614,.8884087,-2.943879,.09760301,-1.039764,-.1494772,1.781915,-11.53012,-3.379232,2.517231,-.2764393,2.588849,1.05212,-1.108447,-.2012251,1.19864,19.25331,-4.423892,-1.257122,.339569,1.48122,.5880175,-1.374185,-.4967434,-7.401318,7.724021,-.02345723,.5979653,.02436346,2.65897,.6014891,-2.310933,-1.29029,-1.301909,2.557806,-.03744449,.08982861,.1090613,-.4398363,.1184329,-1.12473,-.0992183,1.366902,-4.172489,-.05078016,1.393597,-.09323843,6.452721,1.435913,-.8468477,-.2744819,-.43472,6.713362,.6127133,-1.685634,.7360941,-4.535502,-.02920866,-1.165242,-.2008697,1.438778,-10.08936,-2.214771,2.102909,-.1763085,2.859075,1.09347,-1.074614,-.2066374,1.131891,16.30063,-4.801441,-1.11259,.3595785,1.122227,.579461,-1.521515,-.6835604,-5.571044,6.028774,-.04253715,.6875746,-5279456e-12,2.18015,.8487705,-2.240415,-1.171166,-7.182771,8.417068,-.01932866,.1101887,-.01098862,.6242195,-.2393875,-2.712354,-1.19883,3.1802,-6.76813,-.002563386,.7984607,.2764376,4.695358,1.557045,-.03655172,-.02142321,-.913812,7.932786,.3516542,-.7994343,.1786761,-4.208399,.01820576,-1.36861,-.2656212,1.249397,-8.317818,-.8962772,1.423249,.1478381,2.19166,1.007748,-1.041753,-.2453366,1.061102,11.30172,-4.739312,-.9223334,.2982776,.6162931,.6080302,-1.989159,-1.09516,-2.91555,3.275339,-.05735765,.5742174,-7683288e-12,1.7634,.9001342,-2.07002,-1.086338,-10.95898,12.0696,.03780123,-.01774699,-.0005881348,1.333819,-.2605423,-5.249653,-2.38304,6.160406,-9.097138,-.1955319,1.651785,.0006016463,3.021824,1.493574,.4685432,-.2358662,-2.666433,9.685763,.5804928,-1.521875,.5668989,-1.548136,.01688642,-1.296891,-.3449031,1.928548,-11.6756,-1.627615,1.355603,-.1929074,-.6568952,1.009774,-1.067288,-.2410392,.7147961,17.8384,-4.374399,-.6588777,.3329831,1.012066,.6118645],[-1.310023,-.4407658,-36.4034,36.83292,-.008124762,.5297961,.01188633,3.13832,.5134778,-1.4241,-.5501606,-17.5351,18.22769,-.01539272,.6366826,.002661996,2.659915,.4071138,-1.103436,-.1884105,6.425322,-6.910579,-.02019861,.3553271,-.01589061,5.345985,.8790218,-1.1862,-.4307514,-3.957947,5.979352,-.05348869,1.736117,.03491346,-2.692261,.5610506,-1.006038,-.1305995,4.473513,-3.806719,.1419407,-.02148238,-.05081185,3.735362,.535828,-1.078507,-.1633754,-3.812368,4.3817,.02988122,1.754224,.1472376,3.722798,.4999157,-1.333582,-.4649908,-33.59528,34.04375,-.009384242,.5587511,.00572631,3.073145,.5425529,-1.562624,-.7107068,-14.7817,15.59839,-.01462375,.5050133,.02516017,1.604696,.2902403,-.8930158,.04068077,1.373481,-2.342752,-.02098058,.6248686,-.05258363,7.058214,1.150373,-1.262823,-.4818353,889261e-9,1.92312,-.04979718,1.040693,.1558103,-2.85248,.2420691,-.9968383,-.1200648,1.324342,-.9430889,.1931098,.4436916,-.07320456,4.215931,.7898019,-1.078185,-.1718192,-1.720191,2.358918,.02765637,1.260245,.2021941,3.395483,.5173628,-1.353023,-.4813523,-31.0492,31.40156,-.009510741,.554203,.008135471,3.136646,.5215989,-1.624704,-.7990201,-21.67125,22.46341,-.01163533,.5415746,.02618378,1.139214,.3444357,-.798361,.1417476,9.914841,-10.81503,-.01218845,.3411392,-.06137698,7.445848,1.18008,-1.266679,-.4288977,-5.818701,6.986437,-.08180711,1.397403,.2016916,-1.275731,.2592773,-1.009707,-.1537754,3.496378,-3.013726,.242115,-.2831925,.03003395,3.702862,.774632,-1.075646,-.1768747,-1.347762,1.989004,.01375836,1.76481,.1330018,3.230864,.662621,-1.375269,-.5103569,-34.42661,34.78703,-.008460009,.5408643,.004813323,3.016078,.5062069,-1.821679,-.9766461,-19.26488,19.97912,-.009822567,.3649556,.04316092,.893019,.4166527,-.6633542,.1997841,2.395592,-3.117175,-.01080884,.8983814,-.1375825,6.673463,1.115663,-1.30324,-.3612712,.08292959,.3381364,-.06078648,.3229247,.3680987,.7046755,.3144924,-.9952598,-.2039076,.4026851,.2686684,.1640712,.5186341,-.0120552,2.659613,.8030394,-1.098579,-.2151992,.6558198,-74369e-8,-.001421817,1.073701,.1886875,2.536857,.6673923,-1.457986,-.5906842,-38.12464,38.38539,-.006024357,.4741484,.01209223,2.818432,.5012433,-1.835728,-1.003405,-6.848129,7.601943,-.01277375,.4785598,.03366853,1.097701,.4636635,-.8491348,.009466365,-2.685226,2.00406,-.01168708,.6752316,-.1543371,5.674759,1.039534,-1.083379,-.150679,.7328236,-.5095568,-.08609153,.444882,.4174662,1.481556,.3942551,-1.117089,-.3337605,.2502281,.4036323,.2673899,.2829817,.0224245,2.043207,.7706902,-1.071648,-.21262,.6069466,-.00145629,-.551596,1.046755,.1985021,2.290245,.6876058,-1.483903,-.6309647,-43.80213,44.10537,-.005712161,.5195992,.002028428,2.687114,.5098321,-2.053976,-1.141473,.5109183,.08060391,-.01033983,.4066532,.04869627,1.161722,.4039525,-.6348185,.07651292,-10.31327,10.07598,-.02083688,.7359516,-.2029459,5.013257,1.077649,-1.22863,-.1650496,.04077157,-.7189167,-.0509222,.2959814,.5111496,2.540433,.361533,-1.041883,-.3278413,-.06691911,1.307364,.2166663,.3000595,-.003157136,1.389208,.7999026,-1.103556,-.2443602,.4705347,-.0009296482,-.530992,.9654511,.2142587,2.244723,.6839976,-1.555684,-.6962113,-46.47983,46.7427,-.005034895,.475509,-9.502561e-7,2.626569,.5056194,-1.998288,-1.12472,-1.629586,2.187993,-.008284384,.3845258,.0572624,1.185644,.4255812,-1.03257,-.251385,-3.721112,3.506967,-.02186561,.9436049,-.2451412,4.725724,1.039256,-.8597532,.09073332,-2.553741,1.993237,-.04390891,-.2046928,.5515623,1.909127,.3948212,-1.210482,-.4477622,-.2267805,1.219488,.1336186,.6866897,.02808997,1.600403,.7816409,-1.078168,-.2699261,.2537282,.3820684,-.4425103,.5298235,.2185217,1.728679,.6882743,-1.697968,-.8391488,-57.90105,58.1412,-.00340476,.426514,-1796301e-12,2.368442,.5324429,-2.141552,-1.17223,16.77872,-16.4147,-.005732425,.2002199,.06841834,1.485338,.3215763,-1.442946,-.7264245,-9.503706,9.650462,-.02120995,1.419263,-.2893098,3.860731,1.120857,-.5696752,.3411279,-.2931035,-.6512552,-.1068437,-1.085661,.6107549,1.459503,.3210336,-1.313839,-.5921371,-.2332222,1.648196,.2492787,1.381033,-.01993392,.981256,.8316329,-1.087464,-.3195534,.2902095,.3383709,-.8798482,.01494668,.2529703,1.452644,.669387,-2.068582,-1.118605,-50.81598,50.97486,-.003280669,.4067371,-2544951e-12,2.179497,.5778017,-1.744693,-.8537207,22.34361,-22.08318,-.005932616,.1035049,.05742772,1.97788,.2124846,-3.287515,-2.140268,-12.49566,12.40091,-.02409349,1.397821,-.2371627,2.771192,1.170496,.5502311,1.04663,2.193517,-2.2204,-.1064394,-1.017926,.4795457,1.030644,.3177516,-1.719734,-.9536198,-.6586821,1.386361,-.02513065,1.187011,.06542539,.5296055,.808266,-1.0057,-.3028096,.04470957,1.00776,-.8119016,.03153338,.2311321,1.182208,.6824758,-2.728867,-1.580388,-30.79627,30.92586,-.004197673,.3154759,-3897675e-12,1.920567,.6664791,-1.322495,-.7249275,14.7766,-14.68154,-.009044857,.05624314,.06498392,2.047389,.0636754,-6.102376,-3.473018,-9.926071,9.637797,-.01097909,1.103498,-.2424521,2.520748,1.24026,1.351796,1.018588,2.009081,-1.333394,-.1979125,-.3318292,.4476624,.9095235,.2955611,-1.774467,-1.07988,-.0808468,.2577697,-.1149295,.4975303,.002931611,-.3803171,.8002794,-.9898401,-.2542513,-.07530911,1.870355,-1.521918,.2405164,.2964615,1.3348,.6789053,-1.27973,-.4290674,-42.77972,43.43305,-.006541826,.4945086,.01425338,2.685244,.5011313,-1.449506,-.5766374,-16.88496,17.81118,-.01121649,.354502,.02287338,1.904281,.4936998,-1.02198,-.1897574,2.482462,-2.941725,-.01570448,.7532578,-.042568,5.23966,.4983116,-1.162608,-.3428049,3.974358,-1.527935,-.03919201,.8758593,.07291363,-3.455257,.8007426,-.9929985,-.08712006,-.7397313,1.348372,.09511685,.3233584,-.07549148,5.806452,.4990042,-1.084996,-.1739767,.1580475,.908818,.06871433,.5933079,.1188921,3.074079,.4999327,-1.317009,-.4661946,-42.55347,43.12782,-.005727235,.4285447,.02189854,2.60831,.51907,-1.469236,-.6282139,-12.41404,13.48765,-.0120477,.5070285,-.0007280216,1.491533,.3635064,-.9713808,-.08138038,.3709854,-1.041174,-.01814075,.506086,-.02053756,6.161431,1.093736,-1.159057,-.3698074,2.711209,-.6006479,-.04896926,.9273957,.1137712,-3.496828,.2867109,-1.011601,-.0820189,.2105725,.459752,.1478925,.213894,-.0566067,6.057755,.7859121,-1.07802,-.181158,.1646622,.8348426,.1149064,.4985738,.1376605,2.746607,.4999626,-1.325672,-.4769313,-41.11215,41.68293,-.006274997,.4649469,.01119411,2.631267,.5234546,-1.619391,-.8000253,-15.34098,16.32706,-.01012023,.4242255,.02931597,.8925807,.3314765,-.7356979,.1368406,2.972579,-3.535359,-.01318948,.460762,-.07182778,6.2541,1.236299,-1.316217,-.4194427,.03489902,1.289849,-.0475596,1.138222,.1975992,-.8991542,.2290572,-.9502188,-.1172703,1.405202,-.3061919,.1058772,-.3760592,-.01983179,3.562353,.7895959,-1.100117,-.1900567,.492503,.5250225,.1576804,1.042701,.07330743,2.796064,.6749783,-1.354183,-.5130625,-42.19268,42.71772,-.005365373,.4136743,.01235172,2.520122,.5187269,-1.741434,-.9589761,-8.230339,9.296799,-.009600162,.4994969,.02955452,.3667099,.3526999,-.6917347,.2154887,-.8760264,.2334121,-.01909621,.4748033,-.1138514,6.51536,1.225097,-1.293189,-.42187,1.620952,-.7858597,-.0376941,.6636786,.3364945,-.5341017,.2128347,-.9735521,-.1325495,1.007517,.2598258,.06762169,.001421018,-.06915987,3.185897,.8641956,-1.0948,-.1962062,.5755591,.2906259,.2625748,.7644049,.1347492,2.677126,.646546,-1.393063,-.5578338,-41.85249,42.33504,-.00543564,.4743765,.007422477,2.442801,.5211707,-1.939487,-1.128509,-8.974257,9.978383,-.007965597,.294883,.04436763,.2839868,.3440424,-.6011562,.2354877,-3.07982,2.585094,-.02002701,.7793909,-.1598414,5.834678,1.202856,-1.315676,-.3903446,1.7019,-1.304609,-.01045121,.2747707,.4143967,.3197102,.263758,-.9618628,-.1625841,1.187138,.1497802,-5590954e-12,.03178475,-.04153145,2.496096,.8195082,-1.111554,-.2365546,.7831875,.2018684,.2074369,.7395978,.122573,1.876478,.6821167,-1.427879,-.5994879,-35.31016,35.81581,-.006431497,.4554192,.0007348731,2.334619,.5233377,-1.998177,-1.206633,-21.4651,22.42237,-.005857596,.2755663,.06384795,.1358244,.3328437,-.644063,.2058571,2.155499,-2.587968,-.01840023,.8826555,-.2222452,5.847073,1.228387,-1.229071,-.3360441,-.3429599,.6179469,.00202961,.08899319,.5041624,.1882964,.225204,-1.022905,-.2101621,1.915689,-.6498794,-.03463651,.08954605,-.06797854,2.417705,.8568618,-1.082538,-.2007723,.4731009,.4077267,.1324289,.651488,.1702912,2.309383,.6600895,-1.472139,-.6499815,-34.28465,34.69659,-.005747023,.4174167,.001688597,2.323046,.5395191,-2.161176,-1.353089,-22.26827,23.29138,-.005583808,.2364793,.06096656,.001944666,.2861624,-.6593044,.1393558,4.698373,-5.193883,-.0199839,1.095635,-.2391254,5.598103,1.236193,-1.195717,-.2972715,.04648953,.3024588,.005003313,-.3754741,.5247265,-.1381312,.2493896,-1.020139,-.2253524,.3548437,.7030485,-.02107076,.4581395,-.03243757,2.453259,.8323623,-1.09877,-.243578,.8761614,.1941613,-.1990692,.3761139,.1657412,1.590503,.6741417,-1.648007,-.8205121,-44.35106,44.79801,-.004181353,.385483,-1842385e-12,2.000281,.5518363,-2.140986,-1.282239,-3.979213,4.672459,-.005008582,.242192,.06253602,.6612713,.2555851,-1.300502,-.5137898,.5179821,-.4032341,-.02066785,1.087929,-.2615309,4.225887,1.229237,-.696334,.0924106,.06936356,-.3588571,-.05461843,-.5616643,.5484166,-.04776267,.2414935,-1.233179,-.4325498,.6479813,.8368356,.2458875,.6464752,-.02897097,1.561773,.8518598,-1.051023,-.253369,1.004294,.3028083,-1.520108,.1607013,.1619975,1.131094,.6706655,-1.948249,-1.097383,-44.53697,44.94902,-.003579939,.3491605,-2500253e-12,1.740442,.6188022,-2.154253,-1.209559,4.144894,-3.562411,-.005638843,.1067169,.07594858,1.00528,.1072543,-2.513259,-1.507208,-1.602979,1.404154,-.00556075,1.24049,-.2852117,3.485252,1.349321,-.07832214,.3655626,.3856288,.6867894,-.1609523,-.6704306,.5357301,-.6457935,.1479503,-1.354784,-.5454375,.8797469,-1.466514,.713442,.5934903,-.02911178,.8643737,.9030724,-1.048324,-.2738736,.8783074,3.246188,-4.435369,.1251791,.1783486,1.064657,.6522878,-2.770408,-1.618911,-25.04031,25.31674,-.004239279,.3241013,-3764484e-12,1.586843,.7035906,-1.9135,-1.144014,-10.80587,11.53677,-.01003197,.1577515,.05217789,1.225278,.005172771,-5.293208,-2.876463,2.087053,-3.201552,.003892964,.532393,-.2034512,2.61776,1.273597,.906034,.3773409,-.6399945,3.213979,-.09112172,.6494055,.395328,.5047796,.2998695,-1.482179,-.677831,1.161775,-3.004872,.4774797,-.4969248,-.003512074,-1.30719,.7927378,-.9863181,-.1803364,.5810824,4.58057,-3.863454,.5328174,.2272821,1.771114,.6791814]],Ol=[[1.560219,1.417388,1.206927,10.91949,5.931416,7.304788,1.533049,1.560532,.3685059,13.5504,5.543711,7.792189,1.471043,1.746088,-.9299697,17.20362,5.473384,8.336416,1.355991,2.109348,-3.295855,22.64843,5.454607,9.304656,1.244963,2.547533,-5.841485,27.56879,5.576104,10.43287,1.175532,2.784634,-7.212225,29.75347,6.47298,10.92331,1.082973,3.118094,-8.934293,31.86879,8.473885,11.74019,.96925,3.349574,-10.0381,31.47654,13.38931,12.72547,.8547044,3.151538,-9.095567,25.54995,22.73219,14.10398,.758034,2.311153,-5.170814,12.29669,36.86529,15.98882,1.664273,1.574468,1.422078,9.768247,14.47338,16.44988,1.638295,1.719586,.5786675,12.39846,14.15419,17.28605,1.572623,1.921559,-.7714802,16.09246,14.20954,18.25908,1.468395,2.21197,-2.845869,20.75027,15.24822,19.37622,1.355047,2.556469,-4.96092,24.60237,16.4836,20.65648,1.291642,2.742036,-6.061967,26.02002,18.19144,21.16712,1.194565,2.97212,-7.295779,26.91805,21.2488,22.01819,1.083631,3.047021,-7.766096,24.96261,27.44264,22.91875,.9707994,2.736459,-6.308284,17.6086,37.76291,23.9215,.8574294,1.865155,-2.364707,4.337793,50.92831,25.23432],[1.632341,1.39523,1.375634,12.38193,5.921102,7.766508,1.597115,1.554617,.3932382,15.05284,5.725234,8.158155,1.522034,1.844545,-1.322862,19.18382,5.440769,8.837119,1.403048,2.290852,-4.013792,24.851,5.521888,9.845547,1.286364,2.774498,-6.648221,29.64151,5.923777,10.97075,1.213544,3.040195,-8.092676,31.86082,6.789782,11.58899,1.122622,3.347465,-9.649016,33.43824,9.347715,12.31374,1.007356,3.543858,-10.5352,32.39842,14.83962,13.31718,.8956642,3.2787,-9.254933,25.57923,24.89677,14.76166,.7985143,2.340404,-4.928274,11.41787,39.61501,16.82448,1.745162,1.639467,1.342721,11.66033,14.90124,17.74031,1.708439,1.819144,.2834399,14.48066,14.59214,18.58679,1.63172,2.094799,-1.378825,18.43198,14.63173,19.62881,1.516536,2.438729,-3.624121,22.98621,15.99782,20.70027,1.405863,2.785191,-5.705236,26.45121,17.6833,21.91903,1.344052,2.951807,-6.683851,27.44271,19.85706,22.29452,1.245827,3.182923,-7.82296,27.91395,23.27254,23.1591,1.132305,3.202593,-8.008429,25.21093,30.00014,24.05306,1.02033,2.820556,-6.238704,17.09276,40.77916,25.09949,.903157,1.863917,-1.955738,3.032665,54.3429,26.4178],[1.168084,2.156455,-3.980314,19.89302,13.28335,14.35621,1.135488,2.294701,-4.585886,20.90208,13.4784,14.67658,1.107408,2.382765,-5.112357,21.47823,14.93128,14.60882,1.054193,2.592891,-6.115,22.68967,16.35672,15.18999,1.006946,2.70542,-6.69893,22.9183,18.34324,15.70651,.9794044,2.74244,-6.805283,22.25271,20.50797,15.6313,.9413577,2.722009,-6.760707,20.98242,23.42588,16.05011,.8917923,2.59278,-6.152635,17.74141,28.58324,16.5791,.8288391,2.153434,-4.118327,10.78118,36.8171,17.38139,.7623528,1.418187,-.8845235,.7590129,46.29859,19.21657,1.352858,2.048862,-2.053393,14.05874,30.45344,30.4443,1.330497,2.126497,-2.466296,14.67559,30.90738,30.69707,1.286344,2.200436,-2.877228,14.92701,32.36288,30.77223,1.234428,2.289628,-3.404699,14.99436,34.6839,30.84842,1.17866,2.306071,-3.549159,14.11006,37.54188,30.7973,1.151366,2.333005,-3.728627,13.63374,39.05894,30.92599,1.101593,2.299422,-3.565787,11.96745,41.88472,31.02755,1.038322,2.083539,-2.649585,8.037389,47.00869,30.65948,.9596146,1.67147,-.8751538,1.679772,53.45784,30.5452,.8640731,.9858301,1.854956,-6.798097,59.36468,31.10255]],Nl={getTableValue:function(e,t,n,r,i){return Il[e][540*t+54*(n-1)+9*r+i]},getTableValueRad:function(e,t,n,r){return Ol[e][60*t+6*(n-1)+r]}};function Dl(e,r,i,a,o){return Bl(e).reduce(function(e,t,n){return e+t*Nl.getTableValue(r,i,a,n,o)},0)}function Ul(e,r,i,a){return Bl(e).reduce(function(e,t,n){return e+t*Nl.getTableValueRad(r,i,a,n)},0)}function Bl(e){var t=Math.pow(2*e/Math.PI,1/3);return[Math.pow(1-t,5),5*Math.pow(1-t,4)*t,10*Math.pow(1-t,3)*Math.pow(t,2),10*Math.pow(1-t,2)*Math.pow(t,3),5*(1-t)*Math.pow(t,4),Math.pow(t,5)]}var zl={getDistParams:function(e,t,n,r){for(var i=new Array(9),a=Math.trunc(e),o=e-a,s=0;s<9;s++){var l=Dl(n,r,0,a,s),c=Dl(n,r,1,a,s);if(i[s]=(1-t)*(1-o)*l+t*(1-o)*c,10!=a){var u=Dl(n,r,0,a+1,s),h=Dl(n,r,1,a+1,s);i[s]+=(1-t)*o*u+t*o*h}}return i},getRadiance:function(e,t,n,r){var i=Math.trunc(e),a=e-i,o=(1-t)*(1-a)*Ul(n,r,0,i)+t*(1-a)*Ul(n,r,1,i);10!=i&&(o+=(1-t)*a*Ul(n,r,0,i+1)+t*a*Ul(n,r,1,i+1));return o}};function Gl(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}function kl(e,t,n,r){Gl.call(this,e,t,n,r)}Object.assign(Gl.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(i<=e)break e;var s=t[1];e<s&&(n=2,i=s);for(o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,(i=t[--n-1])<=e)break t}a=n,n=0}for(;n<a;){var l=n+a>>>1;e<t[l]?a=l:n=l+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Gl.prototype,{beforeStart_:Gl.prototype.copySampleValue_,afterEnd_:Gl.prototype.copySampleValue_}),kl.prototype=Object.assign(Object.create(Gl.prototype),{constructor:kl,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(r-t),u=1-c,h=0;h!==o;++h)i[h]=a[l+h]*u+a[s+h]*c;return i}});var Vl=[[.1787,-1.463,-.3554,.4275,-.0227,5.3251,.1206,-2.5771,-.067,.3703],[-.0193,-.2592,-.0665,8e-4,-4e-4,.2125,-.0641,-.8989,-.0033,.0452],[-.0167,-.2608,-.095,.0092,-.0079,.2102,-.0441,-1.6537,-.0109,.0529]],jl=[[4.0453,-4.971,-.2155,2.4192],[.00166,-.00375,.00209,0,-.02903,.06377,-.03202,.00394,.11693,-.21196,.06052,.25886],[.00275,-.0061,.00317,0,-.04214,.0897,-.04153,.00516,.15346,-.26756,.0667,.26688]],Wl=function(e,t,n){return Vl[e][2*t+n]},Xl=function(e){return jl[e]};function Hl(e,t,n){return(1+e[0]*Math.exp(e[1]/Math.cos(t)))*(1+e[2]*Math.exp(e[3]*n)+e[4]*Math.pow(Math.cos(n),2))}var Yl={getDistParams:function(e,t){for(var n=new Array(5),r=0;r<5;r++)n[r]=Wl(t,r,0)*e+Wl(t,r,1);return n},getZenithParams:function(e,t,n){switch(n){case 0:var r=new mn((o=Xl(n))[0],o[1],o[2],o[3]),i=Math.tan((4/9-e/120)*(Math.PI-2*t)),a=new mn(e*i,i,e,1);return.06*r.dot(a)/Hl(this.getDistParams(e,n),0,t);case 1:case 2:var o=Xl(n),s=Math.pow(t,2),l=Math.pow(t,3);r=new Bt(o[0]*l+o[1]*s+o[2]*t+o[3],o[4]*l+o[5]*s+o[6]*t+o[7],o[8]*l+o[9]*s+o[10]*t+o[11]);return new Bt(Math.pow(e,2),e,1).dot(r)/Hl(this.getDistParams(e,n),0,t)}},getSunIlluminance:function(e,t){var n=[0,0,0];if(e[1]<0)return n;for(var r,i=[.605,.54,.445],a=[12.25,7.5,.3],o=.04608*t-.04586,s=1/(e[1]+.15*Math.pow(93.885-Math.acos(e[1])*(180/Math.PI),-1.253)),l=[1.05513096,.993359745,.903543472],c=0;c<3;c++){var u=Math.exp(.008735*-s*Math.pow(i[c],-4.08)),h=Math.exp(-s*o*Math.pow(i[c],-1.3)),d=Math.exp(.0035*-a[c]*s);n[c]=128e3*l[c]/(.212671*(r=l[c])+.71516*r+.072169*r),n[c]*=u*h*d}return n},getSunIntegral:function(e,t,n,r){var i=e,a=t,o=n;function s(e){return e*e}var l=1-cos(i),c=((s(Math.PI)-2*s(i-a))*cos(i)-s(Math.PI)*cos(a))/(2*(i-a+Math.PI)*(-i+a+Math.PI)),u=o*((.0892351-.00247875*s(o))*sin(o)+cube(o)+24*o+.029745*o*cos(o))/s(s(o)+36);return 2*Math.PI*(l+c+r*u)}};function ql(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}Object.assign(ql.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Nt.clamp(t/this.radius,-1,1))),this}});var Ql=4,Zl=6,Kl=3,Jl=12,$l=0,ec=22,tc=5,nc=2,rc=8,ic=21,ac=0,oc=9,sc=10,lc=256,cc=512,uc={BSDF_DIFFUSE:2,BSDF_GLASS:3,BSDF_GLOSSY:2,BSDF_PRINCIPLED:19,"BSDF_PRINCIPLED_<2.80.64":17,BSDF_REFRACTION:3,BUMP:3,FRESNEL:1,LAYER_WEIGHT:1};function hc(e){ei.call(this);var t,n,ge=this;function _(e,t){for(var n=e.node(t),r=(n.gltfData.type,0);r<n.gltfData.inputs.length;r++)l(e,t,n.gltfData,r)}function l(e,t,n,r,i){if(Me(e,t,r))return!1;i=i||"Input "+r;var a=n.inputs[r],o={name:n.name+" "+i,type:"",inputs:[],outputs:[]};switch(Oe(a)){case"float":o.type="VALUE",o.outputs.push(a);break;case"vec3":o.type="RGB";var s=a.slice();s.push(1),o.outputs.push(s);break;case"vec4":o.type="RGB",o.outputs.push(a);break;default:throw new Error("Unsupported group input")}e.addNode({gltfData:o});var l=new Fl.Edge(e.len()-1,t,0);l.connections=[];var c={from:0,to:r};return l.connections.push(c),e.addEdge(l),!0}function b(e,t,n){var r={inputs:[],outputs:[],removedNodes:[]};r.removedNodes.push(n);var i=w(t,"GROUP_INPUT");if(-1<i){r.removedNodes.push(i+e.len());for(var a=e.findInEdges(n),o=t.findOutEdges(i),s=0;s<a.length;s++)for(var l=a[s],c=0;c<o.length;c++)for(var u=o[c],h=0;h<l.connections.length;h++)for(var d=l.connections[h],p=0;p<u.connections.length;p++){var f=u.connections[p];if(d.to==f.from){(b=A(r.inputs,l.from(),u.to()))||((b=new Fl.Edge(l.from(),u.to(),0)).connections=[],r.inputs.push(b));var m={from:d.from,to:f.to};b.connections.push(m)}}}var v=w(t,"GROUP_OUTPUT");r.removedNodes.push(v+e.len());var g=e.findOutEdges(n),y=t.findInEdges(v);for(s=0;s<g.length;s++){var x=g[s];for(c=0;c<y.length;c++){var _=y[c];for(h=0;h<x.connections.length;h++)for(d=x.connections[h],p=0;p<_.connections.length;p++){f=_.connections[p];if(d.from==f.to){var b;(b=A(r.outputs,_.from(),x.to()))||((b=new Fl.Edge(_.from(),x.to(),0)).connections=[],r.outputs.push(b));m={from:f.from,to:d.to};b.connections.push(m)}}}}return r}function w(e,t){for(var n=0;n<e.len();n++){if(e.node(n).gltfData.type==t)return n}return-1}function ye(e,t){for(var n=0,r=0;r<e.len();r++){e.node(r).gltfData.type==t&&n++}return n}function A(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(i.from()==t&&i.to()==n)return i}return null}function c(e,t,n){for(var r=n.type,i=e.findInEdges(t),a=0;a<i.length;a++)for(var o=i[a],s=e.node(o.from()).gltfData,l=0;l<o.connections.length;l++){var c=o.connections[l];if("MATERIAL_MAX"==r&&m(s.type)&&(c.to==oc?s.reflectMode="MAX_ENV_COORDS_REFLECT":c.to==sc&&(s.reflectMode="MAX_ENV_COORDS_REFRACT")),xe(r,c.to)){if("BITMAP_MAX"==s.type||"OUTPUT_MAP_MAX"==s.type){e.removeEdge(o.from(),o.to()),"OUTPUT_MAP_MAX"==s.type&&(s=Se(e,o.from(),0).gltfData);var u={gltfData:{name:s.name+"Bump"+a,type:"BUMP_MAX",texture:s.texture,uvIndex:s.uvIndex,inputs:[],outputs:[[0,0,0]]}};e.addNode(u),v(e,e.len()-1,0,t,c.to),a=-1,i=e.findInEdges(t);break}for(var h=0;h<e.len();h++){var d=e.node(h).gltfData;if(f(d.type)){var p=d.inputs.length-1;v(e,o.from(),c.from,h,p),d.inputFactors[p]=n.inputFactors[c.to]}}}}}function f(e){return!(!m(e)&&"FALLOFF_MAX"!=e)}function m(e){return"BITMAP_ENV_MAX"==e||"REFLECT_REFRACT_MAX"==e}function xe(e,t){switch(e){case"BITMAP_ENV_MAX":return t==tc;case"FALLOFF_MAX":return t==nc;case"MATERIAL_MAX":return t==rc;case"PHYSICAL_MAX":return t==ic||t==ec;case"REFLECT_REFRACT_MAX":return t==ac;default:return!1}}function u(e,t,n){for(var r=n.blendMode.length,i=e.findInEdges(t),a=e.findOutEdges(t),o=0;o<r;o++){var s={gltfData:{name:n.name+"Layer"+o,type:"COMPOSITE_LAYER_MAX",blendMode:0!=o?n.blendMode[o]:0,opacity:n.opacity[o],inputs:[[0,0,0,0]].concat(n.inputs.slice(2*o,2*o+2)),outputs:[n.outputs[o]]}};e.addNode(s);for(var l=0;l<i.length;l++)for(var c=i[l],u=0;u<c.connections.length;u++){(d=c.connections[u]).to==2*o&&n.mapEnabled[o]?v(e,c.from(),d.from,e.len()-1,1):d.to==2*o+1&&n.maskEnabled[o]&&v(e,c.from(),d.from,e.len()-1,2)}0<o&&v(e,e.len()-2,0,e.len()-1,0)}for(o=0;o<a.length;o++){var h=a[o];for(l=0;l<h.connections.length;l++){var d=h.connections[l];v(e,e.len()-1,0,h.to(),d.to)}}}function h(e,t,n){var r=n.output,i=e.findInEdges(t),a=e.findOutEdges(t),o={gltfData:{name:n.name+"Output",type:"OUTPUT_MAP_MAX",invert:r.invert,clamp:r.clamp,alphaFromRGB:r.alphaFromRGB,inputs:[[0,0,0,0],r.rgbLevel,r.rgbOffset,r.outputAmount,r.bumpAmount],outputs:[[0,0,0,0]]}};jn(r.colorMap)&&(o.gltfData.colorMap=r.colorMap),e.addNode(o);for(var s=0;s<a.length;s++)for(var l=a[s],c=0;c<l.connections.length;c++){var u=l.connections[c];v(e,e.len()-1,0,l.to(),u.to)}e.disconnect(t,!1);for(s=0;s<i.length;s++)e.addEdge(i[s]);v(e,t,0,e.len()-1,0),delete n.output}function _e(e){return ge.nodeUVAliases[e]||"uv"}function be(e,t){return t=jn(t)?t:"color",ge.nodeVCAliases[e]||t}function we(e,t,n,r){var i=new xn(e,t,1,n,r,fn.DEFAULT_MAPPING,I,I,B,B);return i.needsUpdate=!0,i}function Ae(e){switch(e){case wt:return"1";case Mt:return"2";default:return"0"}}function v(e,t,n,r,i){e.edge(t,r)||e.addNewEdge(t,r);var a=e.edge(t,r);a.connections=a.connections||[],a.connections.push({from:n,to:i})}function Me(e,t,n){for(var r=e.findInEdges(t),i=0;i<r.length;i++)for(var a=r[i],o=0;o<a.connections.length;o++){if(a.connections[o].to==n)return!0}return!1}function Te(e,t,n){for(var r in e.edges){var i=e.edges[r];if(i.from()==t)for(var a=0;a<i.connections.length;a++){if(i.connections[a].from==n)return!0}}return!1}function Se(e,t,n){for(var r in e.edges){var i=e.edges[r];if(i.to()==t)for(var a=e.node(i.from()),o=0;o<i.connections.length;o++){if(i.connections[o].to==n)return a}}return null}function Le(e,t,n,r){for(var i in e.edges){var a=e.edges[i];if(a.to()==t)for(var o=e.node(a.from()),s=0;s<a.connections.length;s++){var l=a.connections[s];if(l.to==n){var c=o.gltfData.type;return"BITMAP_MAX"!=c&&"BITMAP_ENV_MAX"!=c||"float"!=Oe(r)?o.outputs[l.from]:o.outputs[l.from+1]}}}return null}function Ce(e,t,n,r){return{name:e.toLowerCase()+"_par_"+r+"_n"+t,type:Oe(n),value:"boolean"==typeof n?Ie(n):n}}function Ee(e,t){var n=hc.nodeTexUniName(e,t);return{name:n,type:ge.nodeTextures[n].isCubeTexture?"uniform samplerCube":"uniform sampler2D",value:t}}function Pe(e){return Re(e?"true":"false")}function Re(e){return{name:e,type:"",value:null}}function Fe(e,t){return{name:"_vary_par_"+e,type:"varying "+r(t),value:null}}function Ie(e){return e?1:0}function Oe(e){return"number"==typeof e?"float":"boolean"==typeof e?"int":r(e.length)}function r(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";case 9:return"mat3";case 16:return"mat4"}}function Ne(e,t){switch(e){case"float":return De(t);case"int":return String(t);default:for(var n=[],r=0;r<t.length;r++)n.push(De(t[r]));return e+"("+n.join(",")+")"}}function De(e){return e%1?String(e):String(e)+".0"}this.type="MeshNodeMaterial",this.defines={LIGHT_PATH_IS_CAM_RAY:1,WORLD_NODES:0},this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!0,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.profile="blender",this.nodeTextures={},this.nodeRGB=[],this.nodeRGBMap={},this.nodeRGBArr=null,this.nodeValue=null,this.nodeValueMap={},this.needsBoundingBox=!1,this.nodeGraph=null,this.additionalNodeGraphs={},this.nodeChunks={},this.nodeChunksHash=0,this.nodeVCAliases={},this.nodeUVAliases={},this.color=new In(16777215),this.envMap=null,this.envMapIntensity=1,this.advancedPBR=!1,this.reflectivity=.5,jn(e)&&this.setValues(e),this.nodeGraph||(this.nodeGraph=(t=new Fl.DiGraph(1),n=ge.color,t.node(0).gltfData={name:"ShadelessOutput",type:"OUTPUT",inputs:[[n.r,n.g,n.b,1],1],outputs:[],is_active_output:!0},t)),this.updateNodeGraph=function(){ge.nodeRGB=[],ge.nodeRGBMap={},ge.nodeValueMap={},ge.needsBoundingBox=!1,ge.nodeChunks={};var e=ge.nodeGraph;ge.nodeRGBArr=new Float32Array(4*ye(e,"RGB")),ge.nodeValue=new Float32Array(ye(e,"VALUE")),function(e){for(var t=0,n=0,r=0,i=0;i<e.len();i++){var a=(ie=(re=e.node(i)).gltfData).type;re.attributes=[],re.params=[],re.inputFactors=[],re.inputs=[],re.outputs=[],jn(ie.inputFactors)&&(re.inputFactors=ie.inputFactors.slice(0));for(var o=0;o<ie.outputs.length;o++){var s=ie.outputs[o];re.outputs.push({name:a.toLowerCase()+"_out"+o+"_n"+i,type:Oe(s),clamp:!1,normalize:!1})}switch("OUTPUT"!=a&&"OUTPUT_MATERIAL"!=a&&"OUTPUT_WORLD"!=a&&"OUTPUT_MAX"!=a||re.outputs.push({name:"outgoingLight",type:"",clamp:!1,normalize:!1}),a){case"ATTRIBUTE":if(ne=be(ie.colorLayer,"")){var l=Fe(ne,3);re.attributes.push({name:ne,type:"attribute vec3",paramVary:l}),re.params.push(l)}else re.params.push(Re("vec3(0.0)"));break;case"BSDF_DIFFUSE":case"BSDF_GLASS":case"BSDF_GLOSSY":re.params.push(Re("originalNormal"));break;case"BSDF_PRINCIPLED":re.params.push(Re("originalNormal")),(0<ie.inputs[Jl]||Me(e,i,Jl))&&(ge.advancedPBR=!0);break;case"BSDF_REFRACTION":re.params.push(Re("originalNormal")),re.params.push(Re("BSDF_REFRACTION_"+ie.distribution));break;case"BUMP":re.params.push(Ce(a,i,ie.invert,"inv")),ge.extensions.derivatives=!0;break;case"CAMERA":re.params.push(Re("vViewPosition")),0<ye(e,"OUTPUT_MATERIAL")||0<ye(e,"OUTPUT_WORLD")?re.params.push(Re("1")):re.params.push(Re("0"));break;case"CURVE_RGB":case"CURVE_VEC":if(ge.useHDR)var c=new Float32Array(4*lc),u=1;else c=new Uint8Array(4*lc),u=255;var h,d=ie.curveData.length/lc;for(o=0;o<lc;o++)h=3<d?(m=u*ie.curveData[d*o],v=u*ie.curveData[d*o+1],g=u*ie.curveData[d*o+2],u*ie.curveData[d*o+3]):(m=u*(ie.curveData[d*o]/2+.5),v=u*(ie.curveData[d*o+1]/2+.5),g=u*(ie.curveData[d*o+2]/2+.5),u),c[4*o]=Nt.clamp(m,0,u),c[4*o+1]=Nt.clamp(v,0,u),c[4*o+2]=Nt.clamp(g,0,u),c[4*o+3]=Nt.clamp(h,0,u);var p=we(c,lc,Ge,ge.useHDR?Be:Ue),f=hc.nodeTexUniName(a,t);ge.nodeTextures[f]=p,re.params.push(Ee(a,t)),t++;break;case"FRESNEL":case"LAYER_WEIGHT":re.params.push(Re("vViewPosition"));break;case"GEOMETRY":re.params.push(Re("vViewPosition")),re.params.push(Re("normal")),re.params.push(Re("vec3(0.0)")),Te(e,i,Ql)?(l=Fe(ne=_e(ie.uvLayer),2),re.attributes.push({name:ne,type:"attribute vec2",paramVary:l}),re.params.push(l)):re.params.push(Re("vec2(0.5)")),Te(e,i,Zl)?(l=Fe(ne=be(ie.colorLayer),4),re.attributes.push({name:ne,type:"attribute vec4",paramVary:l}),re.params.push(l)):re.params.push(Re("vec4(0.0)"));break;case"GRADIENT_RAMP_MAX":var m,v,g;for(u=ge.useHDR?(c=new Float32Array(4*cc),1):(c=new Uint8Array(4*cc),255),o=0;o<cc;o++)m=u*ie.gradientData[3*o],v=u*ie.gradientData[3*o+1],g=u*ie.gradientData[3*o+2],c[3*o]=Nt.clamp(m,0,u),c[3*o+1]=Nt.clamp(v,0,u),c[3*o+2]=Nt.clamp(g,0,u);p=we(c,cc,ze,ge.useHDR?Be:Ue),f=hc.nodeTexUniName(a,t),ge.nodeTextures[f]=p,re.params.push(Ee(a,t)),t++,re.params.push(Re(Ne("int",ie.gradientType))),l=Fe(ne=ie.uvIndex?"uv"+String(ie.uvIndex+1):"uv",2),re.attributes.push({name:ne,type:"attribute vec2",paramVary:l}),re.params.push(l),re.params.push(Re("originalNormal")),re.params.push(Re("vViewPosition"));break;case"MAPPING":var y=new Mn,x=new Gn;switch(x.set(ie.rotation[0],ie.rotation[1],ie.rotation[2],"ZYX"),y.makeRotationFromEuler(x),y.scale((new Bt).fromArray(ie.scale)),ie.vectorType){case"TEXTURE":y.setPosition((new Bt).fromArray(ie.translation)),y.getInverse(y);break;case"POINT":y.setPosition((new Bt).fromArray(ie.translation));break;case"VECTOR":break;case"NORMAL":re.outputs[0].normalize=!0,y.getInverse(y),y.transpose();break;default:throw new Error("v3d.MeshNodeMaterial: Unknown MAPPING vector type")}re.params.push(Ce(a,i,y.toArray(),"mat")),re.params.push(Ce(a,i,ie.min,"min")),re.params.push(Ce(a,i,ie.max,"max")),re.params.push(Ce(a,i,ie.useMin,"use_min")),re.params.push(Ce(a,i,ie.useMax,"use_max"));break;case"MATERIAL":case"MATERIAL_EXT":jn(ie.materialName)?(re.params.push(Ce(a,i,ie.useDiffuse,"use_diff")),re.params.push(Ce(a,i,ie.useSpecular,"use_spec")),re.params.push(Ce(a,i,ie.invertNormal,"inv_nor")),re.params.push(Ce(a,i,ie.specularIntensity,"spec_int")),re.params.push(Ce(a,i,ie.specularHardness,"spec_hard")),"MATERIAL"==a&&(re.params.push(Ce(a,i,ie.ambient,"ambient")),re.params.push(Ce(a,i,ie.emit,"emit")),re.params.push(Ce(a,i,ie.alpha,"alpha"))),re.params.push(Ce(a,i,ie.useShadeless,"use_shless"))):(re.params.push(Ce(a,i,!1,"use_diff")),re.params.push(Ce(a,i,!1,"use_spec")),re.params.push(Ce(a,i,!1,"inv_nor")),re.params.push(Ce(a,i,0,"spec_int")),re.params.push(Ce(a,i,0,"spec_hard")),"MATERIAL"==a&&(re.params.push(Ce(a,i,0,"ambient")),re.params.push(Ce(a,i,0,"emit")),re.params.push(Ce(a,i,0,"alpha"))),re.params.push(Ce(a,i,!1,"use_shless"))),re.params.push(Re("1"));break;case"NEW_GEOMETRY":re.params.push(Re("vViewPosition")),re.params.push(Re("normal"));break;case"NORMAL_MAP":l=Fe(ne="tangent",4),re.attributes.push({name:ne,type:"attribute vec4",paramVary:l}),re.params.push(l),re.params.push(Re("vNormal"));break;case"TEX_COORD":re.params.push(Re("vViewPosition")),re.params.push(Re("normal")),l=Fe(ne="uv",2),re.attributes.push({name:ne,type:"attribute vec2",paramVary:l}),re.params.push(l),Te(e,i,$l)&&(ge.needsBoundingBox=!0);break;case"TEX_ENVIRONMENT":case"TEX_ENVIRONMENT_MAX":case"TEX_IMAGE":var _=Ee(a,ie.texture);re.params.push(_);var b=ge.nodeTextures[_.name].encoding;re.params.push(Re(Ae(b)));break;case"TEX_GRADIENT":var w=jn(ie.gradientType)?ie.gradientType:"LINEAR";re.params.push(Re("TEX_GRAD_"+w));break;case"TEX_NOISE":var A=jn(ie.falloffFactor)?ie.falloffFactor:0,M=jn(ie.dispersionFactor)?ie.dispersionFactor:1;re.params.push(Re(Ne("float",A))),re.params.push(Re(Ne("float",M)));break;case"TEX_SKY":var T=(new Bt).fromArray(ie.sunDirection).angleTo(new Bt(0,0,1));if("PREETHAM"==ie.skyType)var S=Yl.getDistParams(ie.turbidity,0).concat([0,0,0,0]),L=Yl.getDistParams(ie.turbidity,1).concat([0,0,0,0]),C=Yl.getDistParams(ie.turbidity,2).concat([0,0,0,0]),E=Yl.getZenithParams(ie.turbidity,T,0),P=Yl.getZenithParams(ie.turbidity,T,1),R=Yl.getZenithParams(ie.turbidity,T,2);else if("HOSEK_WILKIE"==ie.skyType){var F=Math.max(Math.PI/2-T,0);S=zl.getDistParams(ie.turbidity,ie.groundAlbedo,F,0),L=zl.getDistParams(ie.turbidity,ie.groundAlbedo,F,1),C=zl.getDistParams(ie.turbidity,ie.groundAlbedo,F,2),E=zl.getRadiance(ie.turbidity,ie.groundAlbedo,F,0),P=zl.getRadiance(ie.turbidity,ie.groundAlbedo,F,1),R=zl.getRadiance(ie.turbidity,ie.groundAlbedo,F,2)}re.params.push(Re("TEX_SKY_"+ie.skyType)),re.params.push(Ce(a,i,[S[0],L[0],C[0]],"param0")),re.params.push(Ce(a,i,[S[1],L[1],C[1]],"param1")),re.params.push(Ce(a,i,[S[2],L[2],C[2]],"param2")),re.params.push(Ce(a,i,[S[3],L[3],C[3]],"param3")),re.params.push(Ce(a,i,[S[4],L[4],C[4]],"param4")),re.params.push(Ce(a,i,[S[5],L[5],C[5]],"param5")),re.params.push(Ce(a,i,[S[6],L[6],C[6]],"param6")),re.params.push(Ce(a,i,[S[7],L[7],C[7]],"param7")),re.params.push(Ce(a,i,[S[8],L[8],C[8]],"param8")),re.params.push(Ce(a,i,[E,P,R],"radiance")),re.params.push(Ce(a,i,ie.sunDirection,"sun_dir"));break;case"TEX_VORONOI":re.params.push(Re("COLORING_"+ie.coloring)),re.params.push(Re("DISTANCE_"+ie.distance)),re.params.push(Re("FEATURE_"+ie.feature));break;case"TEX_WAVE":re.params.push(Re("TEX_WAVE_TYPE_"+ie.waveType)),re.params.push(Re("TEX_WAVE_PROFILE_"+ie.waveProfile));break;case"TEXTURE":case"TEXTURE_CUBE":_=Ee("TEXTURE",ie.texture),re.params.push(_),b=ge.nodeTextures[_.name].encoding,re.params.push(Re(Ae(b))),ie.type=-1<_.type.indexOf("samplerCube")?"TEXTURE_CUBE":"TEXTURE";break;case"MATH":re.outputs[0].clamp=ie.useClamp;break;case"MIX_RGB":switch(re.gltfData.blendType){case"HUE":case"SATURATION":case"VALUE":case"COLOR":ge.defines.NODE_MIX_RGB_HSV=""}re.outputs[0].clamp=ie.useClamp;break;case"MIX_SHADER":var I=-1;for(o=1;o<3;o++){var O=Se(e,i,o);O&&"BSDF_TRANSPARENT"==O.gltfData.type&&(I=o-1)}re.params.push(Re(String(I)));break;case"NORMAL":re.params.push(Ce(a,i,ie.outputs[0],"out"));break;case"RGB":_=(new mn).fromArray(ie.outputs[0]),ge.nodeRGB.push(_),ge.nodeRGBMap[ie.name]=n,re.params.push(Re("nodeRGB["+n+"]")),n++;break;case"UVMAP":l=Fe(ne=_e(ie.uvLayer),2),re.attributes.push({name:ne,type:"attribute vec2",paramVary:l}),re.params.push(l);break;case"VALUE":_=ie.outputs[0],ge.nodeValue[r]=_,ge.nodeValueMap[ie.name]=r,re.params.push(Re("nodeValue["+r+"]")),r++;break;case"VALTORGB":var N=ie.curve,D=new kl(new Float32Array(N.input),new Float32Array(N.output),4);for(u=ge.useHDR?(c=new Float32Array(4*lc),1):(c=new Uint8Array(4*lc),255),o=0;o<lc;o++){var U=D.evaluate(o/(lc-1));c[4*o]=u*U[0],c[4*o+1]=u*U[1],c[4*o+2]=u*U[2],c[4*o+3]=u*U[3]}p=we(c,lc,Ge,ge.useHDR?Be:Ue),f=hc.nodeTexUniName(a,t),ge.nodeTextures[f]=p,re.params.push(Ee(a,t)),t++;break;case"VECT_TRANSFORM":var B=ie.vectorType,z=ie.convertFrom,G=ie.convertTo;"NORMAL"==B&&(re.outputs[0].normalize=!0);var k="";z==G?k="VEC_TRANS_NONE":(k="VEC_TRANS_"+z[0]+"_"+G[0],"VECTOR"!=B&&"NORMAL"!=B||(k+="_DIR")),re.params.push(Re(k)),0<ye(e,"OUTPUT_MATERIAL")||0<ye(e,"OUTPUT_WORLD")?re.params.push(Re("1")):re.params.push(Re("0"));break;case"BITMAP_MAX":case"BITMAP_ENV_MAX":case"REFLECT_REFRACT_MAX":var V=Ee(a,ie.texture);re.params.push(V),"BITMAP_MAX"==a?(l=Fe(ne=ie.uvIndex?"uv"+String(ie.uvIndex+1):"uv",2),re.attributes.push({name:ne,type:"attribute vec2",paramVary:l}),re.params.push(l)):(re.params.push(Re(ie.reflectMode)),re.params.push(Ce(a,i,ie.IOR,"ior"))),b=ge.nodeTextures[V.name].encoding,re.params.push(Re(Ae(b))),"BITMAP_MAX"!=a&&"BITMAP_ENV_MAX"!=a||(re.params.push(Ce(a,i,ie.alphaAsMono,"as_mono")),re.params.push(Ce(a,i,ie.alphaAsRGB,"as_rgb")),re.outputs.push({name:a.toLowerCase()+"_out1_n"+i,type:"float",clamp:!1,normalize:!1}),ie.inputs.length<5&&(ie.inputs.unshift(0,0,1,1,0),ie.inputFactors&&ie.inputFactors.unshift(0,0,0,0,0)));break;case"BLEND_MAX":re.params.push(Ce(a,i,ie.useCurve,"use_curve")),re.params.push(Ce(a,i,ie.curveLower,"curve_lower")),re.params.push(Ce(a,i,ie.curveUpper,"curve_upper"));break;case"BUMP_MAX":V=Ee("BITMAP_MAX",ie.texture),re.params.push(V),re.params.push(Re("-vViewPosition")),re.params.push(Re("normal")),l=Fe(ne=ie.uvIndex?"uv"+String(ie.uvIndex+1):"uv",2),re.attributes.push({name:ne,type:"attribute vec2",paramVary:l}),re.params.push(l),ge.extensions.derivatives=!0;break;case"COLOR_CORRECTION_MAX":var j=Ne("ivec4",[ie.rewireR,ie.rewireG,ie.rewireB,ie.rewireA]);re.params.push(Re(j));break;case"COMPOSITE_LAYER_MAX":re.params.push(Re(Ne("int",ie.blendMode)));var W=Me(e,i,1)?ie.opacity:0;re.params.push(Ce(a,i,W,"opacity"));break;case"COLOR_MAP_MAX":re.params.push(Ce(a,i,ie.reverseGamma,"rev"));break;case"FALLOFF_MAX":re.params.push(Re("-vViewPosition")),re.params.push(Ce(a,i,ie.IOR,"ior"));break;case"MASK_MAX":re.params.push(Ce(a,i,ie.maskInverted,"inv"));break;case"MATERIAL_MAX":re.params.push(Ce(a,i,ie.inputFactors[oc],"refl_ratio")),re.params.push(Ce(a,i,ie.inputFactors[sc],"refr_ratio")),ie.inputFactors[oc]=1,ie.inputFactors[sc]=1,re.params.push(Ce(a,i,ie.selfIllumColorOn,"self_ill_on"));break;case"NORMAL_BUMP_MAX":l=Fe(ne="tangent",4),re.attributes.push({name:ne,type:"attribute vec4",paramVary:l}),re.params.push(l),re.params.push(Re("normal"));var X="ivec2("+Ie(ie.flip[0])+","+Ie(ie.flip[1])+")";re.params.push(Re(X));break;case"OUTPUT_MAP_MAX":if(re.params.push(Pe(ie.invert)),re.params.push(Pe(ie.clamp)),re.params.push(Pe(ie.alphaFromRGB)),ie.colorMap){if(ge.useHDR){var H=ie.colorMap;c=new Float32Array(3*lc),u=1}else H=Wn(ie.colorMap.slice(),0,1),c=new Uint8Array(3*lc),u=255;for(d=H.length/lc,o=0;o<lc;o++)c[3*o]=u*H[d*o],c[3*o+2]=3==d?(c[3*o+1]=u*H[d*o+1],u*H[d*o+2]):(c[3*o+1]=c[3*o],c[3*o]);p=we(c,lc,ze,ge.useHDR?Be:Ue),f=hc.nodeTexUniName(a,t),ge.nodeTextures[f]=p,re.params.push(Ee(a,t)),t++}break;case"PHYSICAL_MAX":re.params.push(Re("originalNormal")),re.params.push(Ce(a,i,ie.emitLuminance,"lum"));var Y=void 0===ie.brdfMode||ie.brdfMode,q=void 0===ie.brdfLow?0:ie.brdfLow,Q=void 0===ie.brdfHigh?0:ie.brdfHigh;N=void 0===ie.brdfCurve?0:ie.brdfCurve,re.params.push(Re(Y?"0":"1")),re.params.push(Re(Ne("float",q))),re.params.push(Re(Ne("float",Q))),re.params.push(Re(Ne("float",N))),re.params.push(Pe(jn(ie.roughnessInv)&&ie.roughnessInv)),re.params.push(Pe(jn(ie.transRoughnessLock)&&ie.transRoughnessLock)),re.params.push(Pe(jn(ie.transRoughnessInv)&&ie.transRoughnessInv)),re.params.push(Pe(jn(ie.thinWalled)&&ie.thinWalled)),ge.advancedPBR=!0;break;case"PHY_SUN_SKY_ENV_MAX":var Z=15*ie.haze+2,K=new ql,J=(T=Math.PI/2-ie.sunPolarAngle,Math.PI-ie.sunAzimuthAngle);K.phi=T,K.theta=J;var $=(new Bt).setFromSpherical(K).toArray();S=Yl.getDistParams(Z,0),L=Yl.getDistParams(Z,1),C=Yl.getDistParams(Z,2),E=Yl.getZenithParams(Z,T,0),P=Yl.getZenithParams(Z,T,1),R=Yl.getZenithParams(Z,T,2),E/=.06,E*=1e3,re.params.push(Ce(a,i,[S[0],L[0],C[0]],"param_a")),re.params.push(Ce(a,i,[S[1],L[1],C[1]],"param_b")),re.params.push(Ce(a,i,[S[2],L[2],C[2]],"param_c")),re.params.push(Ce(a,i,[S[3],L[3],C[3]],"param_d")),re.params.push(Ce(a,i,[S[4],L[4],C[4]],"param_e")),re.params.push(Ce(a,i,[E,P,R],"radiance"));var ee=Yl.getSunIlluminance($,Z);re.params.push(Ce(a,i,$,"sun_dir")),re.params.push(Ce(a,i,ee,"sun_illum")),re.params.push(Ce(a,i,[0,0,0],"sun_lum"));var te=1500/Math.PI;re.params.push(Ce(a,i,ie.globalIntensity/te,"glob_int")),re.params.push(Ce(a,i,ie.groundColor,"gr_col"));break;case"REFLECT_REFRACT_COLOR_MAX":_=ie.outputs[0],re.params.push(Ce(a,i,_,"col"));break;case"VERTEX_COLOR_MAX":var ne;l=Fe(ne="color",3),re.attributes.push({name:ne,type:"attribute vec3",paramVary:l}),re.params.push(l)}}for(i=0;i<e.len();i++){var re,ie;for(a=(ie=(re=e.node(i)).gltfData).type,o=0;o<ie.inputs.length;o++){var ae=ie.inputs[o],oe=Le(e,i,o,ae),se=xe(a,o);if(oe){if(re.inputFactors.length)var le=re.inputFactors[o];else le=1;var ce=Oe(ae);if(se)var ue="normal";else ue=Ne(ce,ae);re.inputs.push({name:(he=oe.name,de=oe.type,pe=ce,fe=ue,me=le,ve=void 0,de==pe?ve=he:"float"==de&&"vec3"==pe?ve="vec3("+[he,he,he].join(",")+")":"float"==de&&"vec4"==pe?ve="vec4("+[he,he,he,he].join(",")+")":"vec3"==de&&"float"==pe?ve="("+[he+"[0]",he+"[1]",he+"[2]"].join("+")+")/3.0":"vec4"==de&&"float"==pe?ve="("+[he+"[0]",he+"[1]",he+"[2]"].join("+")+")/3.0":"vec3"==de&&"vec4"==pe?ve="vec4("+he+", 1.0)":"vec4"==de&&"vec3"==pe&&(ve="vec3("+[he+"[0]",he+"[1]",he+"[2]"].join(",")+")"),(me<1||1!=me&&"normal"==fe)&&(ve="mix("+fe+","+ve+","+De(me)+")","normal"==fe&&(ve="normalize("+ve+")")),ve),type:"",value:null})}else"MATERIAL"!=a&&"MATERIAL_EXT"!=a||o!=Kl?se?re.inputs.push({name:"normal",type:"",value:null}):re.inputs.push({name:a.toLowerCase()+"_in"+o+"_n"+i,type:Oe(ae),value:ae}):(re.inputs.push({name:"normal",type:"",value:null}),re.params[re.params.length-1].name="0")}}var he,de,pe,fe,me,ve}(e),function(e){var t=[],n=[],r=[],i=[],a=new Fl.TopologicalSort(e).order();switch("blender"==ge.profile&&(ge.defines.BLENDER_LIGHTS=""),ge.profile){case"blender":ge.defines.MT_BLENDER="",delete ge.defines.MT_MAX;break;case"max":delete ge.defines.MT_BLENDER,ge.defines.MT_MAX=""}ge.defines.NODE_RGB_NUM=ge.nodeRGB.length,ge.defines.NODE_VALUE_NUM=ge.nodeValue.length;for(var o=0;o<a.length;o++){var s=(m=e.node(a[o])).gltfData.type;ge.defines["NODE_"+s]="","OUTPUT_MATERIAL"!=s&&"PHYSICAL_MAX"!=s||(ge.defines.PHYSICAL="",ge.advancedPBR||(ge.defines.STANDARD=""));var l="node_"+s.toLowerCase()+"_vert";(h=Tn[l])&&t.indexOf(h)<0&&t.push(h);var c="node_"+s.toLowerCase()+"_frag";(d=Tn[c])&&r.indexOf(d)<0&&r.push(d);for(var u=0;u<m.attributes.length;u++){var h=(v=m.attributes[u]).type+" "+v.name+";";"uv"!=v.name&&t.indexOf(h)<0&&t.push(h)}for(u=0;u<m.params.length;u++)if(-1<(x=m.params[u]).type.indexOf("uniform")){var d=x.type+" "+x.name+";";r.indexOf(d)<0&&r.push(d)}else if(-1<x.type.indexOf("varying")){var p=x.type+" "+x.name+";";t.indexOf(p)<0&&t.push(p);var f=x.type+" "+x.name+";";r.indexOf(f)<0&&r.push(f)}else x.type&&i.push(x.type+" "+x.name+"="+Ne(x.type,x.value)+";");for(u=0;u<m.inputs.length;u++)(_=m.inputs[u]).type&&i.push(_.type+" "+_.name+"="+Ne(_.type,_.value)+";");for(u=0;u<m.outputs.length;u++)(b=m.outputs[u]).type&&i.push(b.type+" "+b.name+";")}for(o=0;o<a.length;o++){var m;if("ATTRIBUTE"==(s=(m=e.node(a[o])).gltfData.type)||"GEOMETRY"==s||"NEW_GEOMETRY"==s||"NORMAL_MAP"==s||"TEX_COORD"==s||"UVMAP"==s||"BITMAP_MAX"==s||"NORMAL_BUMP_MAX"==s||"BUMP_MAX"==s||"VERTEX_COLOR_MAX"==s||"GRADIENT_RAMP_MAX"==s)for(u=0;u<m.attributes.length;u++){var v,g=(v=m.attributes[u]).paramVary.name+"="+v.name+";";n.indexOf(g)<0&&n.push(g)}var y=[];for(u=0;u<m.params.length;u++){var x=m.params[u];y.push(x.name)}for(u=0;u<m.inputs.length;u++){var _=m.inputs[u];y.push(_.name)}for(u=0;u<m.outputs.length;u++){var b=m.outputs[u];y.push(b.name)}var w="node_"+s.toLowerCase();switch(s){case"MATH":case"VECT_MATH":w+="_"+m.gltfData.operation.toLowerCase();break;case"MIX_RGB":w+="_"+m.gltfData.blendType.toLowerCase()}for(i.push(w+"("+y.join(",")+");"),u=0;u<m.outputs.length;u++){var A=(b=m.outputs[u]).name;b.clamp&&(s=b.type,i.push(A+"=clamp("+A+","+s+"(0.0),"+s+"(1.0));")),b.normalize&&i.push(A+"=normalize("+A+");")}}ge.nodeChunks.node_pars_vertex=t.join("\n"),ge.nodeChunks.node_vertex=n.join("\n"),ge.nodeChunks.node_pars_fragment=r.join("\n"),ge.nodeChunks.node_fragment=i.join("\n"),ge.nodeChunksHash=Nt.hashString(JSON.stringify(ge.nodeChunks))}(e)},function(e){for(var t=0;t<e.len();t++){var n=e.node(t),r=n.gltfData.type;if("GROUP"!=r)if("REROUTE"!=r);else{for(e.findInEdges(t).length<1&&_(e,t),o=e.findInEdges(t),s=e.findOutEdges(t),m=(h=o[0]).connections[0],c=0;c<s.length;c++){for(d=s[c],(u=new Fl.Edge(h.from(),d.to(),0)).connections=[],f=0;f<d.connections.length;f++)v=d.connections[f],g={from:m.from,to:v.to},u.connections.push(g);e.addEdge(u)}e.disconnect(t,!0),t=-1}else{var i=n.gltfData.nodeGraph,a=ge.additionalNodeGraphs[i];if(a.len()<=2){for(var o=e.findInEdges(t),s=e.findOutEdges(t),l=Math.min(o.length,s.length),c=0;c<l;c++){var u,h=o[c],d=s[c];(u=new Fl.Edge(h.from(),d.to(),0)).connections=[];for(var p=Math.min(h.connections.length,d.connections.length),f=0;f<p;f++){var m=h.connections[f],v=d.connections[f],g={from:m.from,to:v.to};u.connections.push(g)}e.addEdge(u)}e.disconnect(t,!0),t=-1;continue}_(e,t);var y=b(e,a,t);e.insert(a,y.inputs,y.outputs);for(var x=y.removedNodes.sort(function(e,t){return t-e}),c=0;c<x.length;c++)e.disconnect(x[c],!0);t=-1}}}(ge.nodeGraph),function(e){for(var t=0;t<e.len();t++){if("TEX_IMAGE"!=(o=(s=e.node(t).gltfData).type)||Me(e,t,0)||(e.addNode({gltfData:{name:"UVMapGenerated",type:"UVMAP",uvLayer:"",inputs:[],outputs:[[0,0,0]]}}),v(e,e.len()-1,0,t,0)),("TEX_CHECKER"==o||"TEX_GRADIENT"==o||"TEX_NOISE"==o||"TEX_WAVE"==o||"TEX_VORONOI"==o||"TEX_SKY"==o)&&!Me(e,t,0)){var n={gltfData:{name:"TexCoordGenerated",type:"TEX_COORD",inputs:[],outputs:[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]}};e.addNode(n),v(e,e.len()-1,0,t,0)}"TEX_ENVIRONMENT"!=o&&"TEX_ENVIRONMENT_MAX"!=o||Me(e,t,0)||(n={gltfData:{name:"TexCoordObject",type:"TEX_COORD",inputs:[],outputs:[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]}},e.addNode(n),v(e,e.len()-1,3,t,0));var r=o;switch("BSDF_PRINCIPLED"==r&&20==s.inputs.length&&(r="BSDF_PRINCIPLED_<2.80.64"),r in uc&&!Me(e,t,uc[r])&&(e.addNode({gltfData:{name:"NewGeomNormal",type:"NEW_GEOMETRY",inputs:[],outputs:[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],0,0]}}),v(e,e.len()-1,1,t,uc[r])),"OUTPUT"==o&&"max"==ge.profile&&(s.type="OUTPUT_MAX",s.inputs.splice(1)),o){case"BLEND_MAX":case"MATERIAL_MAX":case"PHYSICAL_MAX":case"SHELLAC_MAX":2<=s.outputs.length&&(s.outputs.splice(1),console.warn("v3d.MeshNodeMaterial: trimming redundant outputs for Max nodes, please reexport your scene"))}if("NORMAL_BUMP_MAX"==o&&2==s.inputs.length&&(s.inputs.push(1,1),console.warn("v3d.MeshNodeMaterial: adding inputs to Normal Bump node, please reexport your scene")),"GRADIENT_RAMP_MAX"==o&&1==s.inputs.length&&(s.inputs.push(0,0,1,1,0),console.warn("v3d.MeshNodeMaterial: adding inputs to Gradient Ramp node, please reexport your scene")),jn(s.output)&&h(e,t,s),f(o)){if(!jn(s.inputFactors)){s.inputFactors=[];for(var i=0;i<s.inputs.length;i++)s.inputFactors.push(1)}s.inputs.push([0,0,0]),s.inputFactors.push(0)}}var a=0;for(t=0;t<e.len();t++)"MATERIAL_MAX"!=(o=(s=e.node(t).gltfData).type)&&"PHYSICAL_MAX"!=o||(c(e,t,s),"MATERIAL_MAX"==o&&(a=s.IOR));for(t=0;t<e.len();t++){var o;m(o=(s=e.node(t).gltfData).type)&&(s.IOR=a),m(o)&&!jn(s.reflectMode)&&(console.warn("v3d.MeshNodeMaterial: making indirect Reflect/Refract node Reflect"),s.reflectMode="MAX_ENV_COORDS_REFLECT")}for(t=0;t<e.len();t++)"COMPOSITE_MAX"==(s=e.node(t).gltfData).type&&(u(e,t,s),e.disconnect(t,!0));for(t=0;t<e.len();t++){var s;switch((s=e.node(t).gltfData).type){case"BSDF_DIFFUSE":case"BSDF_GLOSSY":case"MATERIAL":case"MATERIAL_EXT":case"BSDF_PRINCIPLED":l(e,t,s,0,"Color");break;case"MATERIAL_MAX":l(e,t,s,0,"Ambient Color")&&(s.inputFactors[0]=1),l(e,t,s,1,"Diffuse Color")&&(s.inputFactors[1]=1);break;case"PHYSICAL_MAX":l(e,t,s,1,"Base Color")&&(s.inputFactors[1]=1)}}}(ge.nodeGraph),dc(ge.nodeGraph),this.updateNodeGraph()}function dc(t){for(var e=-1,n=0;n<t.len();n++)if(t.node(n).gltfData.is_active_output){e=n;break}if(-1==e)t.removeAll();else{var r=new Fl.DepthFirstSearch(t.reverse(),e),i=[];for(n=0;n<t.len();n++)r.hasPathTo(n)||i.push(t.node(n));i.forEach(function(e){t.disconnect(t.nodeIndex(e),!0)})}}hc.nodeTexUniName=function(e,t){return e.toLowerCase()+"_par_tex_idx"+t},hc.nodeGraphFromGLTF=function(e){for(var t=e.nodes,n=e.edges,r=new Fl.DiGraph(t.length),i=0;i<t.length;i++){t[i];r.node(i).gltfData=t[i]}for(i=0;i<n.length;i++){var a=n[i];r.edge(a.fromNode,a.toNode)||r.addNewEdge(a.fromNode,a.toNode);var o=r.edge(a.fromNode,a.toNode);o.connections=o.connections||[],o.connections.push({from:a.fromOutput,to:a.toInput})}return dc(r),r},hc.prototype=Object.assign(Object.create(ei.prototype),{constructor:hc,isMeshNodeMaterial:!0,hasNode:function(e){for(var t=0;t<this.nodeGraph.len();t++){if(this.nodeGraph.node(t).gltfData.type==e)return!0}return!1},copy:function(e){ei.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Rn.clone(e.uniforms),this.defines=e.defines,this.linewidth=e.linewidth,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.index0AttributeName=this.index0AttributeName,this.color.copy(e.color),this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.reflectivity=e.reflectivity,this.extensions=e.extensions,this.profile=e.profile,this.nodeTextures=e.nodeTextures,this.nodeRGB=e.nodeRGB.slice(),this.nodeRGBMap=Object.assign({},e.nodeRGBMap),this.nodeRGBArr=e.nodeRGBArr.slice(),this.nodeValue=e.nodeValue.slice(),this.nodeValueMap=Object.assign({},e.nodeValueMap),this.needsBoundingBox=e.needsBoundingBox,this.nodeGraph=new Fl.DiGraph(e.nodeGraph.len());for(var t=0;t<this.nodeGraph.len();t++)this.nodeGraph.node(t).gltfData=e.nodeGraph.node(t).gltfData;for(var n in e.nodeGraph.edges){var r=e.nodeGraph.edges[n];this.nodeGraph.addNewEdge(r.from(),r.to()).connections=r.connections.slice()}return this.additionalNodeGraphs=Object.assign({},e.additionalNodeGraphs),this.nodeChunks=Object.assign({},e.nodeChunks),this.nodeChunksHash=e.nodeChunksHash,this.nodeVCAliases=Object.assign({},e.nodeVCAliases),this.nodeUVAliases=Object.assign({},e.nodeUVAliases),this},toJSON:function(e){var t=ei.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t}});var pc=Object.freeze({ShadowMaterial:bl,SpriteMaterial:Yo,RawShaderMaterial:wl,ShaderMaterial:Ei,PointsMaterial:rs,MeshPhysicalMaterial:Ml,MeshStandardMaterial:Al,MeshPhongMaterial:Tl,MeshToonMaterial:Sl,MeshNormalMaterial:Ll,MeshLambertMaterial:Cl,MeshDepthMaterial:oo,MeshDistanceMaterial:so,MeshBasicMaterial:ti,MeshMatcapMaterial:El,LineDashedMaterial:Pl,LineBasicMaterial:$o,Material:ei,MeshMaskMaterial:Rl,MeshNodeMaterial:hc}),fc={arraySlice:function(e,t,n){return fc.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(n){for(var e=n.length,t=new Array(e),r=0;r!==e;++r)t[r]=r;return t.sort(function(e,t){return n[e]-n[t]}),t},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,l=0;l!==t;++l)i[o++]=e[s+l];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),void 0!==(a=e[i++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),void 0!==(a=e[i++]););else for(;void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),void 0!==(a=e[i++]););}}};function mc(e,t,n,r){Gl.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function vc(e,t,n,r){Gl.call(this,e,t,n,r)}function gc(e,t,n,r){if(void 0===e)throw new Error("v3d.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("v3d.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=fc.convertArray(t,this.TimeBufferType),this.values=fc.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function yc(e,t,n){gc.call(this,e,t,n)}function xc(e,t,n,r){gc.call(this,e,t,n,r)}function _c(e,t,n,r){gc.call(this,e,t,n,r)}function bc(e,t,n,r){Gl.call(this,e,t,n,r)}function wc(e,t,n,r){gc.call(this,e,t,n,r)}function Ac(e,t,n,r){gc.call(this,e,t,n,r)}function Mc(e,t,n,r){gc.call(this,e,t,n,r)}function Tc(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Nt.generateUUID(),this.duration<0&&this.resetDuration()}function Sc(e){if(void 0===e.type)throw new Error("v3d.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _c;case"vector":case"vector2":case"vector3":case"vector4":return Mc;case"color":return xc;case"quaternion":return wc;case"bool":case"boolean":return yc;case"string":return Ac}throw new Error("v3d.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];fc.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}mc.prototype=Object.assign(Object.create(Gl.prototype),{constructor:mc,DefaultSettings_:{endingStart:gt,endingEnd:gt},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case yt:i=e,o=2*t-n;break;case xt:o=t+r[i=r.length-2]-r[i+1];break;default:i=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case yt:a=e,s=2*n-t;break;case xt:s=n+r[a=1]-r[0];break;default:a=e-1,s=t}var l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=i*c,this._offsetNext=a*c},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(r-t),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,_=0;_!==o;++_)i[_]=v*a[c+_]+g*a[l+_]+y*a[s+_]+x*a[u+_];return i}}),vc.prototype=Object.assign(Object.create(Gl.prototype),{constructor:vc,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(gc,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:fc.convertArray(e.times,Array),values:fc.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}),Object.assign(gc.prototype,{constructor:gc,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:mt,InterpolantFactoryMethodDiscrete:function(e){return new vc(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new kl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new mc(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case ft:t=this.InterpolantFactoryMethodDiscrete;break;case mt:t=this.InterpolantFactoryMethodLinear;break;case vt:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)return this.createInterpolant=t,this;var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("v3d.KeyframeTrack:",n),this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ft;case this.InterpolantFactoryMethodLinear:return mt;case this.InterpolantFactoryMethodSmooth:return vt}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){a<=i&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=fc.arraySlice(n,i,a),this.values=fc.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("v3d.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("v3d.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("v3d.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&s<a){console.error("v3d.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&fc.isTypedArray(r)){o=0;for(var l=r.length;o!==l;++o){var c=r[o];if(isNaN(c)){console.error("v3d.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),r=this.getInterpolation()===vt,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==l[0]))if(r)s=!0;else for(var c=o*n,u=c-n,h=c+n,d=0;d!==n;++d){var p=t[c+d];if(p!==t[u+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];var f=o*n,m=i*n;for(d=0;d!==n;++d)t[m+d]=t[f+d]}++i}}if(0<a){e[i]=e[a];for(f=a*n,m=i*n,d=0;d!==n;++d)t[m+d]=t[f+d];++i}return i!==e.length&&(this.times=fc.arraySlice(e,0,i),this.values=fc.arraySlice(t,0,i*n)),this},clone:function(){var e=fc.arraySlice(this.times,0),t=fc.arraySlice(this.values,0),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),yc.prototype=Object.assign(Object.create(gc.prototype),{constructor:yc,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ft,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),xc.prototype=Object.assign(Object.create(gc.prototype),{constructor:xc,ValueTypeName:"color"}),_c.prototype=Object.assign(Object.create(gc.prototype),{constructor:_c,ValueTypeName:"number"}),bc.prototype=Object.assign(Object.create(Gl.prototype),{constructor:bc,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(r-t),c=s+o;s!==c;s+=4)Ut.slerpFlat(i,0,a,s-o,a,s,l);return i}}),wc.prototype=Object.assign(Object.create(gc.prototype),{constructor:wc,ValueTypeName:"quaternion",DefaultInterpolation:mt,InterpolantFactoryMethodLinear:function(e){return new bc(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Ac.prototype=Object.assign(Object.create(gc.prototype),{constructor:Ac,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ft,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Mc.prototype=Object.assign(Object.create(gc.prototype),{constructor:Mc,ValueTypeName:"vector"}),Object.assign(Tc,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Sc(n[i]).scale(r));return new Tc(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},i=0,a=n.length;i!==a;++i)t.push(gc.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],l=[];s.push((o+i-1)%i,o,(o+1)%i),l.push(0,1,0);var c=fc.getKeyframeOrder(s);s=fc.sortedArray(s,1,c),l=fc.sortedArray(l,1,c),r||0!==s[0]||(s.push(i),l.push(l[0])),a.push(new _c(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new Tc(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(i);if(l&&1<l.length){var c=r[h=l[1]];c||(r[h]=c=[]),c.push(s)}}var u=[];for(var h in r)u.push(Tc.CreateFromMorphTargetSequence(h,r[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("v3d.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];fc.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],l=0;l<s.length;l++){var c=s[l].keys;if(c&&0!==c.length)if(c[0].morphTargets){for(var u={},h=0;h<c.length;h++)if(c[h].morphTargets)for(var d=0;d<c[h].morphTargets.length;d++)u[c[h].morphTargets[d]]=-1;for(var p in u){var f=[],m=[];for(d=0;d!==c[h].morphTargets.length;++d){var v=c[h];f.push(v.time),m.push(v.morphTarget===p?1:0)}r.push(new _c(".morphTargetInfluence["+p+"]",f,m))}a=u.length*(o||1)}else{var g=".bones["+t[l].name+"]";n(Mc,g+".position",c,"pos",r),n(wc,g+".quaternion",c,"rot",r),n(Mc,g+".scale",c,"scl",r)}}return 0===r.length?null:new Tc(i,a,r)}}),Object.assign(Tc.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Tc(this.name,this.duration,e)}});var Lc={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={}}};function Cc(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==r.onStart&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this}}var Ec=new Cc,Pc={};function Rc(e){this.manager=void 0!==e?e:Ec}function Fc(e){this.manager=void 0!==e?e:Ec}function Ic(e){this.manager=void 0!==e?e:Ec,this._parser=null}function Oc(e){this.manager=void 0!==e?e:Ec,this._parser=null}function Nc(e){this.manager=void 0!==e?e:Ec}function Dc(e){this.manager=void 0!==e?e:Ec}function Uc(e){this.manager=void 0!==e?e:Ec}function Bc(){this.type="Curve",this.arcLengthDivisions=200}function zc(e,t,n,r,i,a,o,s){Bc.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Gc(e,t,n,r,i,a){zc.call(this,e,t,n,n,r,i,a),this.type="ArcCurve"}function kc(){var i=0,a=0,o=0,s=0;function c(e,t,n,r){o=-3*(i=e)+3*t-2*(a=n)-r,s=2*e-2*t+n+r}return{initCatmullRom:function(e,t,n,r,i){c(t,n,i*(n-e),i*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,i,a,o){var s=(t-e)/i-(n-e)/(i+a)+(n-t)/a,l=(n-t)/a-(r-t)/(a+o)+(r-n)/o;c(t,n,s*=a,l*=a)},calc:function(e){var t=e*e;return i+a*e+o*t+s*(t*e)}}}Object.assign(Rc.prototype,{load:function(o,e,t,n){void 0===o&&(o=""),void 0!==this.path&&(o=this.path+o),o=this.manager.resolveURL(o);var s=this,r=Lc.get(o);if(void 0!==r)return s.manager.itemStart(o),setTimeout(function(){e&&e(r),s.manager.itemEnd(o)},0),r;if(void 0===Pc[o]){var i=o.match(/^data:(.*?)(;base64)?,(.*)$/);if(i){var a=i[1],l=!!i[2],c=i[3];c=decodeURIComponent(c),l&&(c=atob(c));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var d=new Uint8Array(c.length),p=0;p<c.length;p++)d[p]=c.charCodeAt(p);u="blob"===h?new Blob([d.buffer],{type:a}):d.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(c,a);break;case"json":u=JSON.parse(c);break;default:u=c}setTimeout(function(){e&&e(u),s.manager.itemEnd(o)},0)}catch(e){setTimeout(function(){n&&n(e),s.manager.itemError(o),s.manager.itemEnd(o)},0)}}else{Pc[o]=[],Pc[o].push({onLoad:e,onProgress:t,onError:n});var m=new XMLHttpRequest;for(var v in m.open("GET",o,!0),m.addEventListener("load",function(e){var t=this.response;Lc.add(o,t);var n=Pc[o];if(delete Pc[o],200===this.status||0===this.status){0===this.status&&console.warn("v3d.FileLoader: HTTP Status 0 received.");for(var r=0,i=n.length;r<i;r++){(a=n[r]).onLoad&&a.onLoad(t)}s.manager.itemEnd(o)}else{for(r=0,i=n.length;r<i;r++){var a;(a=n[r]).onError&&a.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)}},!1),m.addEventListener("progress",function(e){for(var t=Pc[o],n=0,r=t.length;n<r;n++){var i=t[n];i.onProgress&&i.onProgress(e)}},!1),m.addEventListener("error",function(e){var t=Pc[o];delete Pc[o];for(var n=0,r=t.length;n<r;n++){var i=t[n];i.onError&&i.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),m.addEventListener("abort",function(e){var t=Pc[o];delete Pc[o];for(var n=0,r=t.length;n<r;n++){var i=t[n];i.onError&&i.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return s.manager.itemStart(o),m}Pc[o].push({onLoad:e,onProgress:t,onError:n})},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),Object.assign(Fc.prototype,{load:function(e,t,n,r){var i=this,a=new Rc(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=Tc.parse(e[n]);t.push(r)}return t},setPath:function(e){return this.path=e,this}}),Object.assign(Ic.prototype,{load:function(e,a,t,r){var o=this,s=[],l=new os;l.image=s;var i=new Rc(this.manager);function n(n){i.load(e[n],function(e){var t=o._parser(e,!0);s[n]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(c+=1)&&(1===t.mipmapCount&&(l.minFilter=B),l.format=t.format,l.needsUpdate=!0,a&&a(l))},t,r)}if(i.setPath(this.path),i.setResponseType("arraybuffer"),Array.isArray(e))for(var c=0,u=0,h=e.length;u<h;++u)n(u);else i.load(e,function(e){var t=o._parser(e,!0);if(t.isCubemap)for(var n=t.mipmaps.length/t.mipmapCount,r=0;r<n;r++){s[r]={mipmaps:[]};for(var i=0;i<t.mipmapCount;i++)s[r].mipmaps.push(t.mipmaps[r*t.mipmapCount+i]),s[r].format=t.format,s[r].width=t.width,s[r].height=t.height}else l.image.width=t.width,l.image.height=t.height,l.mipmaps=t.mipmaps;1===t.mipmapCount&&(l.minFilter=B),l.format=t.format,l.needsUpdate=!0,a&&a(l)},t,r);return l},setPath:function(e){return this.path=e,this}}),Object.assign(Oc.prototype,{load:function(e,n,t,r){var i=this,a=new xn,o=new Rc(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(e){var t=i._parser(e);t&&(void 0!==t.image?a.image=t.image:void 0!==t.data&&(a.image.width=t.width,a.image.height=t.height,a.image.data=t.data),a.wrapS=void 0!==t.wrapS?t.wrapS:I,a.wrapT=void 0!==t.wrapT?t.wrapT:I,a.magFilter=void 0!==t.magFilter?t.magFilter:B,a.minFilter=void 0!==t.minFilter?t.minFilter:F,a.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(a.format=t.format),void 0!==t.type&&(a.type=t.type),void 0!==t.mipmaps&&(a.mipmaps=t.mipmaps),1===t.mipmapCount&&(a.minFilter=B),a.needsUpdate=!0,n&&n(a,t))},t,r),a},setPath:function(e){return this.path=e,this}}),Object.assign(Nc.prototype,{crossOrigin:"anonymous",load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=Lc.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout(function(){e&&e(a),i.manager.itemEnd(t)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),Lc.add(t,this),e&&e(this),i.manager.itemEnd(t)}function l(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Dc.prototype,{crossOrigin:"anonymous",load:function(e,n,t,r){var i=new Wi,a=new Nc(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(t){a.load(e[t],function(e){i.images[t]=e,6===++o&&(i.needsUpdate=!0,n&&n(i))},void 0,r)}for(var l=0;l<e.length;++l)s(l);return i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Uc.prototype,{crossOrigin:"anonymous",load:function(n,r,e,t){var i=new fn,a=new Nc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(n,function(e){i.image=e;var t=0<n.search(/\.jpe?g($|\?)/i)||0===n.search(/^data\:image\/jpeg/);i.format=t?ze:Ge,i.needsUpdate=!0,void 0!==r&&r(i)},e,t),i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Bc.prototype,{getPoint:function(){return console.warn("v3d.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(i),r.push(a),i=t;return this.cacheArcLengths=r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(0<o)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var c=r[i];return(i+(n-c)/(r[i+1]-c))/(a-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),1<n&&(n=1);var r=this.getPoint(t);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,r,i,a=new Bt,o=[],s=[],l=[],c=new Bt,u=new Mn;for(n=0;n<=e;n++)r=n/e,o[n]=this.getTangentAt(r),o[n].normalize();s[0]=new Bt,l[0]=new Bt;var h=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=h&&(h=d,a.set(1,0,0)),p<=h&&(h=p,a.set(0,1,0)),f<=h&&a.set(0,0,1),c.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],c),l[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),c.crossVectors(o[n-1],o[n]),c.length()>Number.EPSILON&&(c.normalize(),i=Math.acos(Nt.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(c,i))),l[n].crossVectors(o[n],s[n]);if(!0===t)for(i=Math.acos(Nt.clamp(s[0].dot(s[e]),-1,1)),i/=e,0<o[0].dot(c.crossVectors(s[0],s[e]))&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(u.makeRotationAxis(o[n],i*n)),l[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),((zc.prototype=Object.create(Bc.prototype)).constructor=zc).prototype.isEllipseCurve=!0,zc.prototype.getPoint=function(e,t){for(var n=t||new Dt,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;r<i;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*c-d*u+this.aX,l=h*u+d*c+this.aY}return n.set(s,l)},zc.prototype.copy=function(e){return Bc.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},zc.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},zc.prototype.fromJSON=function(e){return Bc.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},((Gc.prototype=Object.create(zc.prototype)).constructor=Gc).prototype.isArcCurve=!0;var Vc=new Bt,jc=new kc,Wc=new kc,Xc=new kc;function Hc(e,t,n,r){Bc.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}function Yc(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function qc(e,t,n,r){return(o=1-e)*o*t+2*(1-(a=e))*a*n+(i=e)*i*r;var i,a,o}function Qc(e,t,n,r,i){return(c=1-e)*c*c*t+3*(l=1-(s=e))*l*s*n+3*(1-(o=e))*o*o*r+(a=e)*a*a*i;var a,o,s,l,c}function Zc(e,t,n,r){Bc.call(this),this.type="CubicBezierCurve",this.v0=e||new Dt,this.v1=t||new Dt,this.v2=n||new Dt,this.v3=r||new Dt}function Kc(e,t,n,r){Bc.call(this),this.type="CubicBezierCurve3",this.v0=e||new Bt,this.v1=t||new Bt,this.v2=n||new Bt,this.v3=r||new Bt}function Jc(e,t){Bc.call(this),this.type="LineCurve",this.v1=e||new Dt,this.v2=t||new Dt}function $c(e,t){Bc.call(this),this.type="LineCurve3",this.v1=e||new Bt,this.v2=t||new Bt}function eu(e,t,n){Bc.call(this),this.type="QuadraticBezierCurve",this.v0=e||new Dt,this.v1=t||new Dt,this.v2=n||new Dt}function tu(e,t,n){Bc.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Bt,this.v1=t||new Bt,this.v2=n||new Bt}function nu(e){Bc.call(this),this.type="SplineCurve",this.points=e||[]}((Hc.prototype=Object.create(Bc.prototype)).constructor=Hc).prototype.isCatmullRomCurve3=!0,Hc.prototype.getPoint=function(e,t){var n,r,i,a,o=t||new Bt,s=this.points,l=s.length,c=(l-(this.closed?0:1))*e,u=Math.floor(c),h=c-u;if(this.closed?u+=0<u?0:(Math.floor(Math.abs(u)/l)+1)*l:0===h&&u===l-1&&(u=l-2,h=1),n=this.closed||0<u?s[(u-1)%l]:(Vc.subVectors(s[0],s[1]).add(s[0]),Vc),r=s[u%l],i=s[(u+1)%l],a=this.closed||u+2<l?s[(u+2)%l]:(Vc.subVectors(s[l-1],s[l-2]).add(s[l-1]),Vc),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(r),d),f=Math.pow(r.distanceToSquared(i),d),m=Math.pow(i.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),jc.initNonuniformCatmullRom(n.x,r.x,i.x,a.x,p,f,m),Wc.initNonuniformCatmullRom(n.y,r.y,i.y,a.y,p,f,m),Xc.initNonuniformCatmullRom(n.z,r.z,i.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(jc.initCatmullRom(n.x,r.x,i.x,a.x,this.tension),Wc.initCatmullRom(n.y,r.y,i.y,a.y,this.tension),Xc.initCatmullRom(n.z,r.z,i.z,a.z,this.tension));return o.set(jc.calc(h),Wc.calc(h),Xc.calc(h)),o},Hc.prototype.copy=function(e){Bc.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Hc.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Hc.prototype.fromJSON=function(e){Bc.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new Bt).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},((Zc.prototype=Object.create(Bc.prototype)).constructor=Zc).prototype.isCubicBezierCurve=!0,Zc.prototype.getPoint=function(e,t){var n=t||new Dt,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Qc(e,r.x,i.x,a.x,o.x),Qc(e,r.y,i.y,a.y,o.y)),n},Zc.prototype.copy=function(e){return Bc.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Zc.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Zc.prototype.fromJSON=function(e){return Bc.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((Kc.prototype=Object.create(Bc.prototype)).constructor=Kc).prototype.isCubicBezierCurve3=!0,Kc.prototype.getPoint=function(e,t){var n=t||new Bt,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Qc(e,r.x,i.x,a.x,o.x),Qc(e,r.y,i.y,a.y,o.y),Qc(e,r.z,i.z,a.z,o.z)),n},Kc.prototype.copy=function(e){return Bc.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Kc.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Kc.prototype.fromJSON=function(e){return Bc.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((Jc.prototype=Object.create(Bc.prototype)).constructor=Jc).prototype.isLineCurve=!0,Jc.prototype.getPoint=function(e,t){var n=t||new Dt;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Jc.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Jc.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Jc.prototype.copy=function(e){return Bc.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Jc.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Jc.prototype.fromJSON=function(e){return Bc.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},(($c.prototype=Object.create(Bc.prototype)).constructor=$c).prototype.isLineCurve3=!0,$c.prototype.getPoint=function(e,t){var n=t||new Bt;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},$c.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},$c.prototype.copy=function(e){return Bc.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},$c.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},$c.prototype.fromJSON=function(e){return Bc.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((eu.prototype=Object.create(Bc.prototype)).constructor=eu).prototype.isQuadraticBezierCurve=!0,eu.prototype.getPoint=function(e,t){var n=t||new Dt,r=this.v0,i=this.v1,a=this.v2;return n.set(qc(e,r.x,i.x,a.x),qc(e,r.y,i.y,a.y)),n},eu.prototype.copy=function(e){return Bc.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},eu.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},eu.prototype.fromJSON=function(e){return Bc.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((tu.prototype=Object.create(Bc.prototype)).constructor=tu).prototype.isQuadraticBezierCurve3=!0,tu.prototype.getPoint=function(e,t){var n=t||new Bt,r=this.v0,i=this.v1,a=this.v2;return n.set(qc(e,r.x,i.x,a.x),qc(e,r.y,i.y,a.y),qc(e,r.z,i.z,a.z)),n},tu.prototype.copy=function(e){return Bc.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},tu.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},tu.prototype.fromJSON=function(e){return Bc.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((nu.prototype=Object.create(Bc.prototype)).constructor=nu).prototype.isSplineCurve=!0,nu.prototype.getPoint=function(e,t){var n=t||new Dt,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],l=r[a],c=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Yc(o,s.x,l.x,c.x,u.x),Yc(o,s.y,l.y,c.y,u.y)),n},nu.prototype.copy=function(e){Bc.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},nu.prototype.toJSON=function(){var e=Bc.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},nu.prototype.fromJSON=function(e){Bc.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new Dt).fromArray(r))}return this};var ru,iu,au,ou=Object.freeze({ArcCurve:Gc,CatmullRomCurve3:Hc,CubicBezierCurve:Zc,CubicBezierCurve3:Kc,EllipseCurve:zc,LineCurve:Jc,LineCurve3:$c,QuadraticBezierCurve:eu,QuadraticBezierCurve3:tu,SplineCurve:nu});function su(){Bc.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function lu(e){su.call(this),this.type="Path",this.currentPoint=new Dt,e&&this.setFromPoints(e)}function cu(e){lu.call(this,e),this.uuid=Nt.generateUUID(),this.type="Shape",this.holes=[]}function uu(e,t){hr.call(this),this.type="Light",this.color=new In(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0,this.isFreeLight=void 0}function hu(e,t,n){uu.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(hr.DefaultUp),this.updateMatrix(),this.groundColor=new In(t),this.target=new hr}function du(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new Dt(512,512),this.map=null,this.matrix=new Mn}function pu(){du.call(this,new fo(50,1,.5,500))}function fu(e,t,n,r,i,a){uu.call(this,e,t),this.type="SpotLight",this.position.copy(hr.DefaultUp),this.updateMatrix(),this.target=new hr,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new pu}function mu(e,t,n,r){uu.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new du(new fo(90,1,.5,500))}function vu(){du.call(this,new pr(-5,5,5,-5,.5,500))}function gu(e,t){uu.call(this,e,t),this.type="DirectionalLight",this.position.copy(hr.DefaultUp),this.updateMatrix(),this.target=new hr,this.shadow=new vu}function yu(e,t){uu.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function xu(e,t,n,r){uu.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function _u(e){this.manager=void 0!==e?e:Ec,this.textures={}}su.prototype=Object.assign(Object.create(Bc.prototype),{constructor:su,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Jc(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];t&&t.equals(c)||(n.push(c),t=c)}return this.autoClose&&1<n.length&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Bc.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Bc.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Bc.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push((new ou[r.type]).fromJSON(r))}return this}}),lu.prototype=Object.assign(Object.create(su.prototype),{constructor:lu,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var n=new Jc(this.currentPoint.clone(),new Dt(e,t));this.curves.push(n),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,n,r){var i=new eu(this.currentPoint.clone(),new Dt(e,t),new Dt(n,r));this.curves.push(i),this.currentPoint.set(n,r)},bezierCurveTo:function(e,t,n,r,i,a){var o=new Zc(this.currentPoint.clone(),new Dt(e,t),new Dt(n,r),new Dt(i,a));this.curves.push(o),this.currentPoint.set(i,a)},splineThru:function(e){var t=new nu([this.currentPoint.clone()].concat(e));this.curves.push(t),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,n,r,i,a)},absarc:function(e,t,n,r,i,a){this.absellipse(e,t,n,n,r,i,a)},ellipse:function(e,t,n,r,i,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;this.absellipse(e+l,t+c,n,r,i,a,o,s)},absellipse:function(e,t,n,r,i,a,o,s){var l=new zc(e,t,n,r,i,a,o,s);if(0<this.curves.length){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);this.currentPoint.copy(u)},copy:function(e){return su.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=su.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return su.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),cu.prototype=Object.assign(Object.create(lu.prototype),{constructor:cu,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){lu.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=lu.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){lu.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push((new lu).fromJSON(r))}return this}}),uu.prototype=Object.assign(Object.create(hr.prototype),{constructor:uu,isLight:!0,copy:function(e){return hr.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this.receiveShadow=e.receiveShadow,this.isFreeLight=e.isFreeLight,this},toJSON:function(e){var t=hr.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),hu.prototype=Object.assign(Object.create(uu.prototype),{constructor:hu,isHemisphereLight:!0,copy:function(e){return uu.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this.target=e.target.clone(),this},updateMatrixWorld:function(e){hr.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(ru=new Bt,function(){ru.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,ru),this.target.updateMatrix()})}),Object.assign(du.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),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}}),pu.prototype=Object.assign(Object.create(du.prototype),{constructor:pu,isSpotLightShadow:!0,update:function(e){var t=this.camera,n=2*Nt.RAD2DEG*e.angle,r=this.mapSize.width/this.mapSize.height,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())}}),fu.prototype=Object.assign(Object.create(uu.prototype),{constructor:fu,isSpotLight:!0,copy:function(e){return uu.prototype.copy.call(this,e),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},updateMatrixWorld:function(e){hr.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(iu=new Bt,function(){iu.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,iu),this.target.updateMatrix()})}),mu.prototype=Object.assign(Object.create(uu.prototype),{constructor:mu,isPointLight:!0,copy:function(e){return uu.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),vu.prototype=Object.assign(Object.create(du.prototype),{constructor:vu}),gu.prototype=Object.assign(Object.create(uu.prototype),{constructor:gu,isDirectionalLight:!0,copy:function(e){return uu.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},updateMatrixWorld:function(e){hr.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(au=new Bt,function(){au.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,au),this.target.updateMatrix()})}),yu.prototype=Object.assign(Object.create(uu.prototype),{constructor:yu,isAmbientLight:!0}),xu.prototype=Object.assign(Object.create(uu.prototype),{constructor:xu,isRectAreaLight:!0,copy:function(e){return uu.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=uu.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(_u.prototype,{load:function(e,t,n,r){var i=this,a=new Rc(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},n,r)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("v3d.MaterialLoader: Undefined texture",e),t[e]}var r=new pc[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.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.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),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.vertexColors&&(r.vertexColors=e.vertexColors),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.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),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.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),1!==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.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.uniforms)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=(new In).setHex(a.value);break;case"v2":r.uniforms[i].value=(new Dt).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new Bt).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new mn).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new zt).fromArray(a.value);case"m4":r.uniforms[i].value=(new Mn).fromArray(a.value);break;default:r.uniforms[i].value=a.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.extensions)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(r.flatShading=1===e.shading),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.alphaMap&&(r.alphaMap=n(e.alphaMap),r.transparent=!0),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){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new Dt).fromArray(s)}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.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),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)),r},setPath:function(e){return this.path=e,this},setTextures:function(e){return this.textures=e,this}});var bu={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);return decodeURIComponent(escape(t))},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function wu(e){this.manager=void 0!==e?e:Ec}Object.assign(wu.prototype,{load:function(e,t,n,r){var i=this,a=new Rc(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},n,r)},parse:function(e){var t=new qr,n=e.data.index;if(void 0!==n){var r=new Au[n.type](n.array);t.setIndex(new Mr(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],s=new Mr(r=new Au[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),t.addAttribute(a,s)}var l=e.data.morphAttributes;if(l)for(var a in l){for(var c=l[a],u=[],h=0,d=c.length;h<d;h++){o=c[h],s=new Mr(r=new Au[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),u.push(s)}t.morphAttributes[a]=u}var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==p){h=0;for(var f=p.length;h!==f;++h){var m=p[h];t.addGroup(m.start,m.count,m.materialIndex)}}var v=e.data.boundingSphere;if(void 0!==v){var g=new Bt;void 0!==v.center&&g.fromArray(v.center),t.boundingSphere=new bn(g,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t},setPath:function(e){return this.path=e,this}});var Au={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Mu(e){this.manager=void 0!==e?e:Ec,this.resourcePath=""}Object.assign(Mu.prototype,{crossOrigin:"anonymous",load:function(r,i,e,a){var o=this,t=void 0===this.path?bu.extractUrlBase(r):this.path;this.resourcePath=this.resourcePath||t;var n=new Rc(o.manager);n.setPath(this.path),n.load(r,function(e){var t=null;try{t=JSON.parse(e)}catch(e){return void 0!==a&&a(e),void console.error("v3d:ObjectLoader: Can't parse "+r+".",e.message)}var n=t.metadata;void 0!==n&&void 0!==n.type&&"geometry"!==n.type.toLowerCase()?o.parse(t,i):console.error("v3d.ObjectLoader: Can't load "+r)},e,a)},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){void 0!==t&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var i=(new cu).fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var r=new wu,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new _l[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new _l[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new _l[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new _l[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new _l[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new _l[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new _l[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new _l[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new _l[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new _l[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new _l[s.type]((new ou[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new _l[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new _l[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var l=[],c=0,u=s.shapes.length;c<u;c++){var h=t[s.shapes[c]];l.push(h)}o=new _l[s.type](l,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(l=[],c=0,u=s.shapes.length;c<u;c++){h=t[s.shapes[c]];l.push(h)}var d=s.options.extrudePath;void 0!==d&&(s.options.extrudePath=(new ou[d.type]).fromJSON(d)),o=new _l[s.type](l,s.options);break;case"BufferGeometry":o=r.parse(s);break;case"Geometry":if("v3d"in window&&"LegacyJSONLoader"in v3d)o=(new v3d.LegacyJSONLoader).parse(s,this.resourcePath).geometry;else console.error('v3d.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:console.warn('v3d.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(void 0!==e){var i=new _u;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var l=[],c=0;c<s.materials.length;c++){var u=s.materials[c];void 0===n[u.uuid]&&(n[u.uuid]=i.parse(u)),l.push(n[u.uuid])}r[s.uuid]=l}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=Tc.parse(r);void 0!==r.uuid&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}if(void 0!==e&&0<e.length){var a=new Nc(new Cc(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var l=e[o],c=l.url;if(Array.isArray(c)){r[l.uuid]=[];for(var u=0,h=c.length;u<h;u++){var d=c[u],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;r[l.uuid].push(i(p))}}else{p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.resourcePath+l.url;r[l.uuid]=i(p)}}}return r},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("v3d.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o,s=e[i];void 0===s.image&&console.warn('v3d.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("v3d.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new Wi(t[s.image]):new fn(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,Pu)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],Ru),o.wrapT=n(s.wrap[1],Ru)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,Fu)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,Fu)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),r[s.uuid]=o}return r},parseObject:function(e,t,a){var n;function r(e){return void 0===t[e]&&console.warn("v3d.ObjectLoader: Undefined geometry",e),t[e]}function i(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];void 0===a[i]&&console.warn("v3d.ObjectLoader: Undefined material",i),t.push(a[i])}return t}return void 0===a[e]&&console.warn("v3d.ObjectLoader: Undefined material",e),a[e]}}switch(e.type){case"Scene":n=new Wo,void 0!==e.background&&Number.isInteger(e.background)&&(n.background=new In(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?n.fog=new jo(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(n.fog=new Vo(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":n=new fo(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(n.focus=e.focus),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.filmGauge&&(n.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(n.filmOffset=e.filmOffset),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case"OrthographicCamera":n=new pr(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case"AmbientLight":n=new yu(e.color,e.intensity);break;case"DirectionalLight":n=new gu(e.color,e.intensity);break;case"PointLight":n=new mu(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":n=new xu(e.color,e.intensity,e.width,e.height);break;case"SpotLight":n=new fu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":n=new hu(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("v3d.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=r(e.geometry),s=i(e.material);n=o.bones&&0<o.bones.length?new Zo(o,s):new Fi(o,s),void 0!==e.drawMode&&n.setDrawMode(e.drawMode);break;case"LOD":n=new Qo;break;case"Line":n=new es(r(e.geometry),i(e.material),e.mode);break;case"LineLoop":n=new ns(r(e.geometry),i(e.material));break;case"LineSegments":n=new ts(r(e.geometry),i(e.material));break;case"PointCloud":case"Points":n=new is(r(e.geometry),i(e.material));break;case"Sprite":n=new qo(i(e.material));break;case"Group":n=new po;break;default:n=new hr}if(n.uuid=e.uuid,void 0!==e.name&&(n.name=e.name),void 0!==e.matrix?(n.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(n.matrixAutoUpdate=e.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==e.position&&n.position.fromArray(e.position),void 0!==e.rotation&&n.rotation.fromArray(e.rotation),void 0!==e.quaternion&&n.quaternion.fromArray(e.quaternion),void 0!==e.scale&&n.scale.fromArray(e.scale)),void 0!==e.castShadow&&(n.castShadow=e.castShadow),void 0!==e.receiveShadow&&(n.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(n.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(n.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&n.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(n.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.frustumCulled&&(n.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(n.renderOrder=e.renderOrder),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.layers&&(n.layers.mask=e.layers),void 0!==e.children)for(var l=e.children,c=0;c<l.length;c++)n.add(this.parseObject(l[c],t,a));if("LOD"===e.type)for(var u=e.levels,h=0;h<u.length;h++){var d=u[h],p=n.getObjectByProperty("uuid",d.object);void 0!==p&&n.addLevel(p,d.distance)}return n}});var Tu,Su,Lu,Cu,Eu,Pu={UVMapping:300,CubeReflectionMapping:ve,CubeRefractionMapping:ge,EquirectangularReflectionMapping:ye,EquirectangularRefractionMapping:xe,SphericalReflectionMapping:Ae,CubeUVReflectionMapping:Me,CubeUVRefractionMapping:Te},Ru={RepeatWrapping:E,ClampToEdgeWrapping:I,MirroredRepeatWrapping:P},Fu={NearestFilter:D,NearestMipMapNearestFilter:O,NearestMipMapLinearFilter:U,LinearFilter:B,LinearMipMapNearestFilter:R,LinearMipMapLinearFilter:F};function Iu(e){"undefined"==typeof createImageBitmap&&console.warn("v3d.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("v3d.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==e?e:Ec,this.options=void 0}function Ou(){this.type="ShapePath",this.color=new In,this.subPaths=[],this.currentPath=null}function Nu(e){this.type="Font",this.data=e}function Du(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs["?"];if(a){var o,s,l,c,u,h,d,p,f=new Ou;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*t+n,s=m[v++]*t+r,f.moveTo(o,s);break;case"l":o=m[v++]*t+n,s=m[v++]*t+r,f.lineTo(o,s);break;case"q":l=m[v++]*t+n,c=m[v++]*t+r,u=m[v++]*t+n,h=m[v++]*t+r,f.quadraticCurveTo(u,h,l,c);break;case"b":l=m[v++]*t+n,c=m[v++]*t+r,u=m[v++]*t+n,h=m[v++]*t+r,d=m[v++]*t+n,p=m[v++]*t+r,f.bezierCurveTo(u,h,d,p,l,c)}}return{offsetX:a.ha*t,path:f}}}function Uu(e){this.manager=void 0!==e?e:Ec}function Bu(){}Iu.prototype={constructor:Iu,setOptions:function(e){return this.options=e,this},load:function(t,n,e,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=Lc.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout(function(){n&&n(a),i.manager.itemEnd(t)},0),a;fetch(t).then(function(e){return e.blob()}).then(function(e){return void 0===i.options?createImageBitmap(e):createImageBitmap(e,i.options)}).then(function(e){Lc.add(t,e),n&&n(e),i.manager.itemEnd(t)}).catch(function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}),i.manager.itemStart(t)},setCrossOrigin:function(){return this},setPath:function(e){return this.path=e,this}},Object.assign(Ou.prototype,{moveTo:function(e,t){this.currentPath=new lu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,n,r){this.currentPath.quadraticCurveTo(e,t,n,r)},bezierCurveTo:function(e,t,n,r,i,a){this.currentPath.bezierCurveTo(e,t,n,r,i,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new cu;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],l=s.x-o.x,c=s.y-o.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[i],c=-c),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=c*(e.x-o.x)-l*(e.y-o.y);if(0===u)return!0;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=Qs.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,l,c=[];if(1===a.length)return s=a[0],(l=new cu).curves=s.curves,c.push(l),c;var u=!i(a[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=i(h=(s=a[g]).getPoints()),(o=e?!o:o)?(!u&&f[v]&&v++,f[v]={s:new cu,p:h},f[v].s.curves=s.curves,u&&v++,m[v]=[]):m[v].push({h:s,p:h[0]});if(!f[0])return n(a);if(1<f.length){for(var x=!1,_=[],b=0,w=f.length;b<w;b++)p[b]=[];for(b=0,w=f.length;b<w;b++)for(var A=m[b],M=0;M<A.length;M++){for(var T=A[M],S=!0,L=0;L<f.length;L++)r(T.p,f[L].p)&&(b!==L&&_.push({froms:b,tos:L,hole:M}),S?(S=!1,p[L].push(T)):x=!0);S&&p[b].push(T)}0<_.length&&(x||(m=p))}g=0;for(var C=f.length;g<C;g++){l=f[g].s,c.push(l);for(var E=0,P=(d=m[g]).length;E<P;E++)l.holes.push(d[E].h)}return c}}),Object.assign(Nu.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],r=function(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,l=0,c=0;c<r.length;c++){var u=r[c];if("\n"===u)s=0,l-=a;else{var h=Du(u,i,s,l,n);s+=h.offsetX,o.push(h.path)}}return o}(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),Object.assign(Uu.prototype,{load:function(e,r,t,n){var i=this,a=new Rc(this.manager);a.setPath(this.path),a.load(e,function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("v3d.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var e=i.parse(n);r&&r(e)},t,n)},parse:function(e){return new Nu(e)},setPath:function(e){return this.path=e,this}}),Bu.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(Bu.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(Tu={NoBlending:Z,NormalBlending:K,AdditiveBlending:J,SubtractiveBlending:$,MultiplyBlending:ee,CustomBlending:te},Su=new In,Lu=new Uc,Cu=new _u,function(e,c,u){var h={};function t(e,t,n,r,i){var a,o=c+e,s=Bu.Handlers.get(o);a=null!==s?s.load(o):(Lu.setCrossOrigin(u),Lu.load(o)),void 0!==t&&(a.repeat.fromArray(t),1!==t[0]&&(a.wrapS=E),1!==t[1]&&(a.wrapT=E)),void 0!==n&&a.offset.fromArray(n),void 0!==r&&("repeat"===r[0]&&(a.wrapS=E),"mirror"===r[0]&&(a.wrapS=P),"repeat"===r[1]&&(a.wrapT=E),"mirror"===r[1]&&(a.wrapT=P)),void 0!==i&&(a.anisotropy=i);var l=Nt.generateUUID();return h[l]=a,l}var n={uuid:Nt.generateUUID(),type:"MeshLambertMaterial"};for(var r in e){var i=e[r];switch(r){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":n.name=i;break;case"blending":n.blending=Tu[i];break;case"colorAmbient":case"mapAmbient":console.warn("v3d.Loader.createMaterial:",r,"is no longer supported.");break;case"colorDiffuse":n.color=Su.fromArray(i).getHex();break;case"colorSpecular":n.specular=Su.fromArray(i).getHex();break;case"colorEmissive":n.emissive=Su.fromArray(i).getHex();break;case"specularCoef":n.shininess=i;break;case"shading":"basic"===i.toLowerCase()&&(n.type="MeshBasicMaterial"),"phong"===i.toLowerCase()&&(n.type="MeshPhongMaterial"),"standard"===i.toLowerCase()&&(n.type="MeshStandardMaterial");break;case"mapDiffuse":n.map=t(i,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":n.emissiveMap=t(i,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":n.lightMap=t(i,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":n.aoMap=t(i,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":n.bumpMap=t(i,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":n.bumpScale=i;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":n.normalMap=t(i,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":n.normalScale=i;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":n.specularMap=t(i,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":n.metalnessMap=t(i,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":n.roughnessMap=t(i,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":n.alphaMap=t(i,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":n.side=be;break;case"doubleSided":n.side=Q;break;case"transparency":console.warn("v3d.Loader.createMaterial: transparency has been renamed to opacity"),n.opacity=i;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":n[r]=i;break;case"vertexColors":!0===i&&(n.vertexColors=x),"face"===i&&(n.vertexColors=1);break;default:console.error("v3d.Loader.createMaterial: Unsupported",r,i)}}return"MeshBasicMaterial"===n.type&&delete n.emissive,"MeshPhongMaterial"!==n.type&&delete n.specular,n.opacity<1&&(n.transparent=!0),Cu.setTextures(h),Cu.parse(n)})});var zu,Gu,ku,Vu,ju,Wu,Xu,Hu,Yu,qu,Qu,Zu,Ku,Ju,$u,eh,th,nh,rh,ih={getContext:function(){return void 0===Eu&&(Eu=new(window.AudioContext||window.webkitAudioContext)),Eu},setContext:function(e){Eu=e}};function ah(e){this.manager=void 0!==e?e:Ec}function oh(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new fo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new fo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function sh(e,t,n,r){hr.call(this),this.type="CubeCamera";var a=new fo(90,1,e,t);a.up.set(0,-1,0),a.lookAt(new Bt(1,0,0)),this.add(a);var o=new fo(90,1,e,t);o.up.set(0,-1,0),o.lookAt(new Bt(-1,0,0)),this.add(o);var s=new fo(90,1,e,t);s.up.set(0,0,1),s.lookAt(new Bt(0,1,0)),this.add(s);var l=new fo(90,1,e,t);l.up.set(0,0,-1),l.lookAt(new Bt(0,-1,0)),this.add(l);var c=new fo(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new Bt(0,0,1)),this.add(c);var u=new fo(90,1,e,t);u.up.set(0,-1,0),u.lookAt(new Bt(0,0,-1)),this.add(u),r=r||{format:ze,magFilter:B,minFilter:B},this.renderTarget=new yn(n,n,r),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=e.getRenderTarget(),r=this.renderTarget,i=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,a),e.setRenderTarget(r,1),e.render(t,o),e.setRenderTarget(r,2),e.render(t,s),e.setRenderTarget(r,3),e.render(t,l),e.setRenderTarget(r,4),e.render(t,c),r.texture.generateMipmaps=i,e.setRenderTarget(r,5),e.render(t,u),e.setRenderTarget(n)},this.clear=function(e,t,n,r){for(var i=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)e.setRenderTarget(a,o),e.clear(t,n,r);e.setRenderTarget(i)}}function lh(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function ch(){hr.call(this),this.type="AudioListener",this.context=ih.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0}function uh(e){hr.call(this),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.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function hh(e){uh.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function dh(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function ph(e,t,n){this.binding=e,this.valueSize=n;var r,i=Float64Array;switch(t){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Object.assign(ah.prototype,{load:function(e,n,t,r){var i=new Rc(this.manager);i.setResponseType("arraybuffer"),i.setPath(this.path),i.load(e,function(e){var t=e.slice(0);ih.getContext().decodeAudioData(t,function(e){n(e)})},t,r)},setPath:function(e){return this.path=e,this}}),Object.assign(oh.prototype,{update:(Yu=new Mn,qu=new Mn,function(e){if(zu!==this||Gu!==e.focus||ku!==e.fov||Vu!==e.aspect*this.aspect||ju!==e.near||Wu!==e.far||Xu!==e.zoom||Hu!==this.eyeSep){zu=this,Gu=e.focus,ku=e.fov,Vu=e.aspect*this.aspect,ju=e.near,Wu=e.far,Xu=e.zoom;var t,n,r=e.projectionMatrix.clone(),i=(Hu=this.eyeSep/2)*ju/Gu,a=ju*Math.tan(Nt.DEG2RAD*ku*.5)/Xu;qu.elements[12]=-Hu,Yu.elements[12]=Hu,t=-a*Vu+i,n=a*Vu+i,r.elements[0]=2*ju/(n-t),r.elements[8]=(n+t)/(n-t),this.cameraL.projectionMatrix.copy(r),t=-a*Vu-i,n=a*Vu-i,r.elements[0]=2*ju/(n-t),r.elements[8]=(n+t)/(n-t),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(qu),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Yu)})}),(sh.prototype=Object.create(hr.prototype)).constructor=sh,Object.assign(lh.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),ch.prototype=Object.assign(Object.create(hr.prototype),{constructor:ch,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:(Qu=new Bt,Zu=new Ut,Ku=new Bt,Ju=new Bt,$u=new lh,function(e){hr.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=$u.getDelta(),this.matrixWorld.decompose(Qu,Zu,Ku),Ju.set(0,0,-1).applyQuaternion(Zu),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Qu.x,r),t.positionY.linearRampToValueAtTime(Qu.y,r),t.positionZ.linearRampToValueAtTime(Qu.z,r),t.forwardX.linearRampToValueAtTime(Ju.x,r),t.forwardY.linearRampToValueAtTime(Ju.y,r),t.forwardZ.linearRampToValueAtTime(Ju.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(Qu.x,Qu.y,Qu.z),t.setOrientation(Ju.x,Ju.y,Ju.z,n.x,n.y,n.z)})}),uh.prototype=Object.assign(Object.create(hr.prototype),{constructor:uh,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),this.startTime=this.context.currentTime,e.start(this.startTime,this.offset),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("v3d.Audio: this Audio has no playback control.")}else console.warn("v3d.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this;console.warn("v3d.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this;console.warn("v3d.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("v3d.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("v3d.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("v3d.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),hh.prototype=Object.assign(Object.create(uh.prototype),{constructor:hh,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:(eh=new Bt,th=new Ut,nh=new Bt,rh=new Bt,function(e){if(hr.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(eh,th,nh),rh.set(0,0,1).applyQuaternion(th);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(eh.x,n),t.positionY.linearRampToValueAtTime(eh.y,n),t.positionZ.linearRampToValueAtTime(eh.z,n),t.orientationX.linearRampToValueAtTime(rh.x,n),t.orientationY.linearRampToValueAtTime(rh.y,n),t.orientationZ.linearRampToValueAtTime(rh.z,n)}else t.setPosition(eh.x,eh.y,eh.z),t.setOrientation(rh.x,rh.y,rh.z)}})}),Object.assign(dh.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(ph.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*t;this._mixBufferRegion(n,r,o,1-i,t)}for(var s=t,l=t+t;s!==l;++s)if(n[s]!==n[s+t]){a.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=3*n;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,n,r,i){if(.5<=r)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){Ut.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}});var fh,mh,vh,gh,yh,xh,_h,bh,wh,Ah,Mh,Th,Sh,Lh,Ch,Eh,Ph,Rh,Fh,Ih,Oh,Nh,Dh,Uh,Bh,zh,Gh,kh,Vh,jh,Wh,Xh,Hh,Yh="\\[\\]\\.";function qh(e,t,n){var r=n||Qh.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function Qh(e,t,n){this.path=t,this.parsedPath=n||Qh.parseTrackName(t),this.node=Qh.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Zh(){this.uuid=Nt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Kh(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var r=t.tracks,i=r.length,a=new Array(i),o={endingStart:gt,endingEnd:gt},s=0;s!==i;++s){var l=r[s].createInterpolant(null);(a[s]=l).settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._pingIsEven=!0,this._startTime=null,this.time=0,this.timeStart=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}function Jh(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function $h(e){"string"==typeof e&&(console.warn("v3d.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function ed(){qr.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function td(e,t,n){Xo.call(this,e,t),this.meshPerAttribute=n||1}function nd(e,t,n,r){"number"==typeof n&&(r=n,n=!1,console.error("v3d.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Mr.call(this,e,t,n),this.meshPerAttribute=r||1}function rd(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}function id(e,t){this.min=void 0!==e?e:new Dt(1/0,1/0),this.max=void 0!==t?t:new Dt(-1/0,-1/0)}function ad(e,t){this.start=void 0!==e?e:new Bt,this.end=void 0!==t?t:new Bt}function od(e){hr.call(this),this.material=e,this.render=function(){}}function sd(e,t,n,r){this.object=e,this.size=void 0!==t?t:1;var i=void 0!==n?n:16711680,a=void 0!==r?r:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var l=new qr,c=new Fr(2*o*3,3);l.addAttribute("position",c),ts.call(this,l,new $o({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function ld(e,t){hr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new qr,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],i=0,a=1;i<32;i++,a++){var o=i/32*Math.PI*2,s=a/32*Math.PI*2;r.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.addAttribute("position",new Fr(r,3));var l=new $o({fog:!1});this.cone=new ts(n,l),this.add(this.cone),this.update()}function cd(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var r=0;r<t.children.length;r++)n.push.apply(n,e(t.children[r]));return n}(e),n=new qr,r=[],i=[],a=new In(0,0,1),o=new In(0,1,0),s=0;s<t.length;s++){var l=t[s];l.parent&&l.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.addAttribute("position",new Fr(r,3)),n.addAttribute("color",new Fr(i,3));var c=new $o({vertexColors:x,depthTest:!1,depthWrite:!1,transparent:!0});ts.call(this,n,c),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function ud(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new al(t,4,2),i=new ti({wireframe:!0,fog:!1});Fi.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function hd(e,t){this.type="RectAreaLightHelper",this.light=e,this.color=t;var n=new qr;n.addAttribute("position",new Fr([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),n.computeBoundingSphere();var r=new $o({fog:!1});es.call(this,n,r);var i=new qr;i.addAttribute("position",new Fr([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),i.computeBoundingSphere(),this.add(new Fi(i,new ti({side:be,fog:!1}))),this.update()}function dd(e,t,n){hr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new gs(t);r.rotateY(.5*Math.PI),this.material=new ti({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=x);var i=r.getAttribute("position"),a=new Float32Array(3*i.count);r.addAttribute("color",new Mr(a,3)),this.add(new Fi(r,this.material)),this.update()}function pd(e,t,n,r){e=e||10,t=t||10,n=new In(void 0!==n?n:4473924),r=new In(void 0!==r?r:8947848);for(var i=t/2,a=e/t,o=e/2,s=[],l=[],c=0,u=0,h=-o;c<=t;c++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var d=c===i?n:r;d.toArray(l,u),u+=3,d.toArray(l,u),u+=3,d.toArray(l,u),u+=3,d.toArray(l,u),u+=3}var p=new qr;p.addAttribute("position",new Fr(s,3)),p.addAttribute("color",new Fr(l,3));var f=new $o({vertexColors:x});ts.call(this,p,f)}function fd(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new In(void 0!==i?i:4473924),a=new In(void 0!==a?a:8947848);var o,s,l,c,u,h,d,p=[],f=[];for(c=0;c<=t;c++)l=c/t*(2*Math.PI),o=Math.sin(l)*e,s=Math.cos(l)*e,p.push(0,0,0),p.push(o,0,s),d=1&c?i:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(c=0;c<=n;c++)for(d=1&c?i:a,h=e-e/n*c,u=0;u<r;u++)l=u/r*(2*Math.PI),o=Math.sin(l)*h,s=Math.cos(l)*h,p.push(o,0,s),f.push(d.r,d.g,d.b),l=(u+1)/r*(2*Math.PI),o=Math.sin(l)*h,s=Math.cos(l)*h,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new qr;m.addAttribute("position",new Fr(p,3)),m.addAttribute("color",new Fr(f,3));var v=new $o({vertexColors:x});ts.call(this,m,v)}function md(e,t,n,r){this.audio=e,this.range=t||1,this.divisionsInnerAngle=n||16,this.divisionsOuterAngle=r||2;var i=new qr,a=this.divisionsInnerAngle+2*this.divisionsOuterAngle,o=new Float32Array(3*(3*a+3));i.addAttribute("position",new Mr(o,3));var s=new $o({color:65280}),l=new $o({color:16776960});es.call(this,i,[l,s]),this.update()}function vd(e,t,n,r){this.object=e,this.size=void 0!==t?t:1;var i=void 0!==n?n:16776960,a=void 0!==r?r:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("v3d.FaceNormalsHelper: only v3d.Geometry is supported. Use v3d.VertexNormalsHelper, instead.");var l=new qr,c=new Fr(2*o*3,3);l.addAttribute("position",c),ts.call(this,l,new $o({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function gd(e,t,n){hr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var r=new qr;r.addAttribute("position",new Fr([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new $o({fog:!1});this.lightPlane=new es(r,i),this.add(this.lightPlane),(r=new qr).addAttribute("position",new Fr([0,0,0,0,0,1],3)),this.targetLine=new es(r,i),this.add(this.targetLine),this.update()}function yd(e){var t=new qr,n=new $o({color:16777215,vertexColors:1}),r=[],i=[],a={},o=new In(16755200),s=new In(16711680),l=new In(43775),c=new In(16777215),u=new In(3355443);function h(e,t,n){d(e,n),d(t,n)}function d(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),h("c","t",c),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),t.addAttribute("position",new Fr(r,3)),t.addAttribute("color",new Fr(i,3)),ts.call(this,t,n),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function xd(e,t){this.object=e,void 0===t&&(t=16776960);var 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 qr;i.setIndex(new Mr(n,1)),i.addAttribute("position",new Mr(r,3)),ts.call(this,i,new $o({color:t})),this.matrixAutoUpdate=!1,this.update()}function _d(e,t){this.type="Box3Helper",this.box=e;var n=void 0!==t?t:16776960,r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new qr;i.setIndex(new Mr(r,1)),i.addAttribute("position",new Fr([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)),ts.call(this,i,new $o({color:n})),this.geometry.computeBoundingSphere()}function bd(e,t,n){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t;var r=void 0!==n?n:16776960,i=new qr;i.addAttribute("position",new Fr([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,0,1,0,0,0],3)),i.computeBoundingSphere(),es.call(this,i,new $o({color:r}));var a=new qr;a.addAttribute("position",new Fr([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Fi(a,new ti({color:r,opacity:.2,transparent:!0,depthWrite:!1})))}function wd(e,t,n,r,i,a){hr.call(this),void 0===e&&(e=new Bt(0,0,1)),void 0===t&&(t=new Bt(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===i&&(i=.2*n),void 0===a&&(a=.2*i),void 0===jh&&((jh=new qr).addAttribute("position",new Fr([0,0,0,0,1,0],3)),(Wh=new ml(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new es(jh,new $o({color:r})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Fi(Wh,new ti({color:r})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function Ad(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new qr;n.addAttribute("position",new Fr(t,3)),n.addAttribute("color",new Fr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var r=new $o({vertexColors:x});ts.call(this,n,r)}Object.assign(qh.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Qh,{Composite:qh,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Qh.Composite(e,t,n):new Qh(e,t,n)},sanitizeNodeName:(bh=new RegExp("["+Yh+"]","g"),function(e){return e.replace(/\s/g,"_").replace(bh,"")}),parseTrackName:(fh="[^"+Yh+"]",mh="[^"+Yh.replace("\\.","")+"]",vh=/(WCOD+)?/.source.replace("WCOD",mh),gh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",fh),yh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",fh),xh=new RegExp("^"+vh+gh+yh+"$"),_h=["material","materials","bones"],function(e){var t=xh.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[1],objectName:t[2],objectIndex:t[3],propertyName:t[4],propertyIndex:t[5]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==_h.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}),findNode:function(e,i){if(!i||""===i||"root"===i||"."===i||-1===i||i===e.name||i===e.uuid)return e;if(e.skeleton){var t=e.skeleton.getBoneByName(i);if(void 0!==t)return t}if(e.children){var a=function(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.name===i||n.uuid===i)return n;var r=a(n.children);if(r)return r}return null},n=a(e.children);if(n)return n}return null}}),Object.assign(Qh.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=Qh.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("v3d.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("v3d.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("v3d.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("v3d.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("v3d.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[r];if(void 0!==s){var l=this.Versioning.None;void 0!==(this.targetObject=e).needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("v3d.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes)return void console.error("v3d.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===i){i=o;break}}else{if(!e.geometry.morphTargets)return void console.error("v3d.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===i){i=o;break}}}else if("nodeValue"==r){if(i=i.replace(/"/g,""),!e.nodeValueMap)return void console.error("v3d.PropertyBinding: Trying to animate nodes in non-node material",this);if(void 0===(i=e.nodeValueMap[i]))return void console.error("v3d.PropertyBinding: Animated node not found ",this)}if(c=this.BindingType.ArrayElement,"nodeRGB"==r){if(i=i.replace(/"/g,""),!e.nodeRGBMap)return void console.error("v3d.PropertyBinding: Trying to animate nodes in non-node material",this);if(void 0===(i=e.nodeRGBMap[i]))return void console.error("v3d.PropertyBinding: Animated node not found ",this);c=this.BindingType.HasFromToArray,s=e.nodeRGB[i]}this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var u=t.nodeName;console.error("v3d.PropertyBinding: Trying to update property for track: "+u+"."+r+" but it wasn't found.",e)}}else console.error("v3d.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Qh.prototype,{_getValue_unbound:Qh.prototype.getValue,_setValue_unbound:Qh.prototype.setValue}),Object.assign(Zh.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,l=void 0,c=0,u=arguments.length;c!==u;++c){var h=arguments[c],d=h.uuid,p=r[d];if(void 0===p){p=t++,r[d]=p,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new Qh(h,i[f],a[f]))}else if(p<n){l=e[p];var v=--n,g=e[v];e[r[g.uuid]=p]=g,e[r[d]=v]=h;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[v],_=y[p];y[p]=x,void 0===_&&(_=new Qh(h,i[f],a[f])),y[v]=_}}else e[p]!==l&&console.error("v3d.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=n[l];if(void 0!==c&&t<=c){var u=t++,h=e[u];e[n[h.uuid]=c]=h,e[n[l]=u]=s;for(var d=0,p=i;d!==p;++d){var f=r[d],m=f[u],v=f[c];f[c]=m,f[u]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o].uuid,c=r[l];if(void 0!==c)if(delete r[l],c<n){var u=--n,h=e[u],d=e[g=--t];e[r[h.uuid]=c]=h,e[r[d.uuid]=u]=d,e.pop();for(var p=0,f=a;p!==f;++p){var m=(y=i[p])[u],v=y[g];y[c]=m,y[u]=v,y.pop()}}else{var g;e[r[(d=e[g=--t]).uuid]=c]=d,e.pop();for(p=0,f=a;p!==f;++p){var y;(y=i[p])[c]=y[g],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var h=c,d=s.length;h!==d;++h){var p=s[h];u[h]=new Qh(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];a[t[e[o]]=n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign(Kh.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this._pingIsEven=!0,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/o,l[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(0<s)for(var l=this._interpolants,c=this._propertyBindings,u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(r,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(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},_loopIsPing:function(e){return 2202!==this.loop||(-1==e||0==(1&e)===this._pingIsEven)},_updateTime:function(e){if(0===e)return this.time;if(2200!==this.loop&&this.repetitions<=0)return this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1}),this.time;var t=this.timeStart,n=Math.max(t,this._clip.duration),r=n-t;if(2200===this.loop)return this.time+=e,-1===this._loopCount&&(this._loopCount=0,this._setEndings(!0,!0,!1)),(this.time<t||this.time>n)&&(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=Nt.clamp(this.time,t,n),this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})),this.time;var i=2202===this.loop,a=this._loopIsPing(this._loopCount)?1:-1;this.time+=a*e;var o=this.time<t||this.time>n,s=!1;if(-1===this._loopCount&&(s=o,this._loopCount=s?-1:0,this._pingIsEven=!s,0<=e?this._setEndings(!0,0===this.repetitions,i):this._setEndings(0===this.repetitions,!0,i)),o){var l=Math.floor((this.time-t)/r);this._loopCount+=Math.abs(l);var c=this.repetitions-this._loopCount;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=Nt.clamp(this.time,t,n),this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1});else{if(1==c){var u=e<0;this._setEndings(u,!u,i)}else this._setEndings(!1,!1,i);var h=(this.time-t)%r;h<0&&(h+=r),this.time=i?n-h:h+t,s||this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}return this.time},_setEndings:function(e,t,n){var r=this._interpolantSettings;r.endingEnd=n?r.endingStart=yt:(r.endingStart=e?this.zeroSlopeAtStart?yt:gt:xt,t?this.zeroSlopeAtEnd?yt:gt:xt)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),Jh.prototype=Object.assign(Object.create(t.prototype),{constructor:Jh,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==i;++u){var h=r[u],d=h.name,p=c[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(p=new ph(Qh.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;t[n._cacheIndex=r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;s[l._byClipCacheIndex=c]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;void 0===i&&(i={},r[t]=i),(i[n]=e)._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],l=e._cacheIndex;t[s._cacheIndex=l]=s,t.pop(),delete o[i];e:{for(var c in o)break e;delete a[r]}},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&(e[(n=new kl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];t[e.__cacheIndex=r]=e,t[i.__cacheIndex=n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Tc.findByName(n,e):e,a=null!==i?i.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var l=o.actionByRoot[r];if(void 0!==l)return l;s=o.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var c=new Kh(this,i,t);return this._bindAction(c,s),this._addInactiveAction(c,a,r),c},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Tc.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0;for(var i=this._nActiveBindings=0;i!==t;++i)e[i].reset();for(i=0;i!==r;++i)n[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}var s=this._bindings,l=this._nActiveBindings;for(o=0;o!==l;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,t[u._cacheIndex=c]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),$h.prototype.clone=function(){return new $h(void 0===this.value.clone?this.value:this.value.clone())},ed.prototype=Object.assign(Object.create(qr.prototype),{constructor:ed,isInstancedBufferGeometry:!0,copy:function(e){return qr.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),td.prototype=Object.assign(Object.create(Xo.prototype),{constructor:td,isInstancedInterleavedBuffer:!0,copy:function(e){return Xo.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),nd.prototype=Object.assign(Object.create(Mr.prototype),{constructor:nd,isInstancedBufferAttribute:!0,copy:function(e){return Mr.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(rd.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}}),Object.assign(id.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(Ah=new Dt,function(e,t){var n=Ah.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("v3d.Box2: .getCenter() target is now required"),e=new Dt),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("v3d.Box2: .getSize() target is now required"),e=new Dt),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("v3d.Box2: .getParameter() target is now required"),t=new Dt),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:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("v3d.Box2: .clampPoint() target is now required"),t=new Dt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:(wh=new Dt,function(e){return wh.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(ad.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("v3d.Line3: .getCenter() target is now required"),e=new Bt),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("v3d.Line3: .delta() target is now required"),e=new Bt),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("v3d.Line3: .at() target is now required"),t=new Bt),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(Mh=new Bt,Th=new Bt,function(e,t){Mh.subVectors(e,this.start),Th.subVectors(this.end,this.start);var n=Th.dot(Th),r=Th.dot(Mh)/n;return t&&(r=Nt.clamp(r,0,1)),r}),closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("v3d.Line3: .closestPointToPoint() target is now required"),n=new Bt),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),((od.prototype=Object.create(hr.prototype)).constructor=od).prototype.isImmediateRenderObject=!0,((sd.prototype=Object.create(ts.prototype)).constructor=sd).prototype.update=(Sh=new Bt,Lh=new Bt,Ch=new zt,function(){var e=["a","b","c"];this.object.updateMatrixWorld(!0),Ch.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,n=this.geometry.attributes.position,r=this.object.geometry;if(r&&r.isGeometry)for(var i=r.vertices,a=r.faces,o=0,s=0,l=a.length;s<l;s++)for(var c=a[s],u=0,h=c.vertexNormals.length;u<h;u++){var d=i[c[e[u]]],p=c.vertexNormals[u];Sh.copy(d).applyMatrix4(t),Lh.copy(p).applyMatrix3(Ch).normalize().multiplyScalar(this.size).add(Sh),n.setXYZ(o,Sh.x,Sh.y,Sh.z),o+=1,n.setXYZ(o,Lh.x,Lh.y,Lh.z),o+=1}else if(r&&r.isBufferGeometry){var f=r.attributes.position,m=r.attributes.normal;for(u=o=0,h=f.count;u<h;u++)Sh.set(f.getX(u),f.getY(u),f.getZ(u)).applyMatrix4(t),Lh.set(m.getX(u),m.getY(u),m.getZ(u)),Lh.applyMatrix3(Ch).normalize().multiplyScalar(this.size).add(Sh),n.setXYZ(o,Sh.x,Sh.y,Sh.z),o+=1,n.setXYZ(o,Lh.x,Lh.y,Lh.z),o+=1}n.needsUpdate=!0}),((ld.prototype=Object.create(hr.prototype)).constructor=ld).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},ld.prototype.update=(Eh=new Bt,function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Eh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Eh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}),((cd.prototype=Object.create(ts.prototype)).constructor=cd).prototype.updateMatrixWorld=(Ph=new Bt,Rh=new Mn,Fh=new Mn,function(e){var t=this.bones,n=this.geometry,r=n.getAttribute("position");Fh.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(Rh.multiplyMatrices(Fh,o.matrixWorld),Ph.setFromMatrixPosition(Rh),r.setXYZ(a,Ph.x,Ph.y,Ph.z),Rh.multiplyMatrices(Fh,o.parent.matrixWorld),Ph.setFromMatrixPosition(Rh),r.setXYZ(a+1,Ph.x,Ph.y,Ph.z),a+=2)}n.getAttribute("position").needsUpdate=!0,hr.prototype.updateMatrixWorld.call(this,e)}),((ud.prototype=Object.create(Fi.prototype)).constructor=ud).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},ud.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},((hd.prototype=Object.create(es.prototype)).constructor=hd).prototype.update=function(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var e=this.material.color,t=Math.max(e.r,e.g,e.b);1<t&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}},hd.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},((dd.prototype=Object.create(hr.prototype)).constructor=dd).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},dd.prototype.update=(Ih=new Bt,Oh=new In,Nh=new In,function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Oh.copy(this.light.color),Nh.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?Oh:Nh;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(Ih.setFromMatrixPosition(this.light.matrixWorld).negate())}),pd.prototype=Object.assign(Object.create(ts.prototype),{constructor:pd,copy:function(e){return ts.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),(fd.prototype=Object.create(ts.prototype)).constructor=fd,((md.prototype=Object.create(es.prototype)).constructor=md).prototype.update=function(){var a,o,e=this.audio,s=this.range,t=this.divisionsInnerAngle,n=this.divisionsOuterAngle,r=Nt.degToRad(e.panner.coneInnerAngle),i=Nt.degToRad(e.panner.coneOuterAngle),l=r/2,c=i/2,u=0,h=0,d=this.geometry,p=d.attributes.position;function f(e,t,n,r){var i=(t-e)/n;for(p.setXYZ(u,0,0,0),h++,a=e;a<t;a+=i)o=u+h,p.setXYZ(o,Math.sin(a)*s,0,Math.cos(a)*s),p.setXYZ(o+1,Math.sin(Math.min(a+i,t))*s,0,Math.cos(Math.min(a+i,t))*s),p.setXYZ(o+2,0,0,0),h+=3;d.addGroup(u,h,r),u+=h,h=0}d.clearGroups(),f(-c,-l,n,0),f(-l,l,t,1),f(l,c,n,0),p.needsUpdate=!0,r===i&&(this.material[0].visible=!1)},md.prototype.dispose=function(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()},((vd.prototype=Object.create(ts.prototype)).constructor=vd).prototype.update=(Dh=new Bt,Uh=new Bt,Bh=new zt,function(){this.object.updateMatrixWorld(!0),Bh.getNormalMatrix(this.object.matrixWorld);for(var e=this.object.matrixWorld,t=this.geometry.attributes.position,n=this.object.geometry,r=n.vertices,i=n.faces,a=0,o=0,s=i.length;o<s;o++){var l=i[o],c=l.normal;Dh.copy(r[l.a]).add(r[l.b]).add(r[l.c]).divideScalar(3).applyMatrix4(e),Uh.copy(c).applyMatrix3(Bh).normalize().multiplyScalar(this.size).add(Dh),t.setXYZ(a,Dh.x,Dh.y,Dh.z),a+=1,t.setXYZ(a,Uh.x,Uh.y,Uh.z),a+=1}t.needsUpdate=!0}),((gd.prototype=Object.create(hr.prototype)).constructor=gd).prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},gd.prototype.update=(zh=new Bt,Gh=new Bt,kh=new Bt,function(){zh.setFromMatrixPosition(this.light.matrixWorld),Gh.setFromMatrixPosition(this.light.target.matrixWorld),kh.subVectors(Gh,zh),this.lightPlane.lookAt(Gh),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(Gh),this.targetLine.scale.z=kh.length()}),((yd.prototype=Object.create(ts.prototype)).constructor=yd).prototype.update=function(){var l,c,u=new Bt,h=new dr;function e(e,t,n,r){u.set(t,n,r).unproject(h);var i=c[e];if(void 0!==i)for(var a=l.getAttribute("position"),o=0,s=i.length;o<s;o++)a.setXYZ(i[o],u.x,u.y,u.z)}return function(){l=this.geometry,c=this.pointMap;h.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),e("c",0,0,-1),e("t",0,0,1),e("n1",-1,-1,-1),e("n2",1,-1,-1),e("n3",-1,1,-1),e("n4",1,1,-1),e("f1",-1,-1,1),e("f2",1,-1,1),e("f3",-1,1,1),e("f4",1,1,1),e("u1",.7,1.1,-1),e("u2",-.7,1.1,-1),e("u3",0,2,-1),e("cf1",-1,0,1),e("cf2",1,0,1),e("cf3",0,-1,1),e("cf4",0,1,1),e("cn1",-1,0,-1),e("cn2",1,0,-1),e("cn3",0,-1,-1),e("cn4",0,1,-1),l.getAttribute("position").needsUpdate=!0}}(),((xd.prototype=Object.create(ts.prototype)).constructor=xd).prototype.update=(Vh=new _n,function(e){if(void 0!==e&&console.warn("v3d.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Vh.setFromObject(this.object),!Vh.isEmpty()){var t=Vh.min,n=Vh.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}),xd.prototype.setFromObject=function(e){return this.object=e,this.update(),this},xd.prototype.copy=function(e){return ts.prototype.copy.call(this,e),this.object=e.object,this},xd.prototype.clone=function(){return(new this.constructor).copy(this)},((_d.prototype=Object.create(ts.prototype)).constructor=_d).prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),hr.prototype.updateMatrixWorld.call(this,e))},((bd.prototype=Object.create(es.prototype)).constructor=bd).prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?be:N,this.lookAt(this.plane.normal),hr.prototype.updateMatrixWorld.call(this,e)},((wd.prototype=Object.create(hr.prototype)).constructor=wd).prototype.setDirection=(Hh=new Bt,function(e){.99999<e.y?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Hh.set(e.z,0,-e.x).normalize(),Xh=Math.acos(e.y),this.quaternion.setFromAxisAngle(Hh,Xh))}),wd.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},wd.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},wd.prototype.copy=function(e){return hr.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},wd.prototype.clone=function(){return(new this.constructor).copy(this)},(Ad.prototype=Object.create(ts.prototype)).constructor=Ad;var Md;function Td(e){console.warn("v3d.ClosedSplineCurve3 has been deprecated. Use v3d.CatmullRomCurve3 instead."),Hc.call(this,e),this.type="catmullrom",this.closed=!0}function Sd(e){console.warn("v3d.SplineCurve3 has been deprecated. Use v3d.CatmullRomCurve3 instead."),Hc.call(this,e),this.type="catmullrom"}function Ld(e){console.warn("v3d.Spline has been removed. Use v3d.CatmullRomCurve3 instead."),Hc.call(this,e),this.type="catmullrom"}Bc.create=function(e,t){return console.log("v3d.Curve.create() has been deprecated"),e.prototype=Object.create(Bc.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Object.assign(su.prototype,{createPointsGeometry:function(e){console.warn("v3d.CurvePath: .createPointsGeometry() has been removed. Use new v3d.Geometry().setFromPoints(points) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("v3d.CurvePath: .createSpacedPointsGeometry() has been removed. Use new v3d.Geometry().setFromPoints(points) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("v3d.CurvePath: .createGeometry() has been removed. Use new v3d.Geometry().setFromPoints(points) instead.");for(var t=new Ar,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new Bt(i.x,i.y,i.z||0))}return t}}),Object.assign(lu.prototype,{fromPoints:function(e){console.warn("v3d.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Td.prototype=Object.create(Hc.prototype),Sd.prototype=Object.create(Hc.prototype),Ld.prototype=Object.create(Hc.prototype),Object.assign(Ld.prototype,{initFromArray:function(){console.error("v3d.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("v3d.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("v3d.Spline: .reparametrizeByArcLength() has been removed.")}}),pd.prototype.setColors=function(){console.error("v3d.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},cd.prototype.update=function(){console.error("v3d.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Bu.prototype,{extractUrlBase:function(e){return console.warn("v3d.Loader: .extractUrlBase() has been deprecated. Use v3d.LoaderUtils.extractUrlBase() instead."),bu.extractUrlBase(e)}}),Object.assign(Mu.prototype,{setTexturePath:function(e){return console.warn("v3d.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(id.prototype,{center:function(e){return console.warn("v3d.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("v3d.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("v3d.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("v3d.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(_n.prototype,{center:function(e){return console.warn("v3d.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("v3d.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("v3d.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("v3d.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("v3d.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),ad.prototype.center=function(e){return console.warn("v3d.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Nt,{random16:function(){return console.warn("v3d.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("v3d.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Nt.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("v3d.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Nt.ceilPowerOfTwo(e)}}),Object.assign(zt.prototype,{flattenToArrayOffset:function(e,t){return console.warn("v3d.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("v3d.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3(matrix) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("v3d.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("v3d.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute(attribute) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("v3d.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Mn.prototype,{extractPosition:function(e){return console.warn("v3d.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("v3d.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return void 0===Md&&(Md=new Bt),console.warn("v3d.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition(matrix) instead."),Md.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("v3d.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("v3d.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("v3d.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("v3d.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("v3d.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("v3d.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection(matrix) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("v3d.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},translate:function(){console.error("v3d.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("v3d.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("v3d.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("v3d.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("v3d.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(e){return console.warn("v3d.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute(attribute) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("v3d.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,a){return console.warn("v3d.Matrix4: .makeFrustum() has been removed. Use .makePerspective(left, right, top, bottom, near, far) instead."),this.makePerspective(e,t,r,n,i,a)}}),wn.prototype.isIntersectionLine=function(e){return console.warn("v3d.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Ut.prototype.multiplyVector3=function(e){return console.warn("v3d.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion(quaternion) instead."),e.applyQuaternion(this)},Object.assign(Pi.prototype,{isIntersectionBox:function(e){return console.warn("v3d.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("v3d.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("v3d.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Ri.prototype,{area:function(){return console.warn("v3d.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("v3d.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("v3d.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("v3d.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("v3d.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(Ri,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("v3d.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ri.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("v3d.Triangle: .normal() has been renamed to .getNormal()."),Ri.getNormal(e,t,n,r)}}),Object.assign(cu.prototype,{extractAllPoints:function(e){return console.warn("v3d.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("v3d.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Js(this,e)},makeGeometry:function(e){return console.warn("v3d.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ul(this,e)}}),Object.assign(Dt.prototype,{fromAttribute:function(e,t,n){return console.warn("v3d.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("v3d.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("v3d.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Bt.prototype,{setEulerFromRotationMatrix:function(){console.error("v3d.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("v3d.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("v3d.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("v3d.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("v3d.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("v3d.Vector3: .applyProjection() has been removed. Use .applyMatrix4(m) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("v3d.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("v3d.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("v3d.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(mn.prototype,{fromAttribute:function(e,t,n){return console.warn("v3d.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("v3d.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Ar.prototype,{computeTangents:function(){console.error("v3d.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("v3d.Geometry: .computeLineDistances() has been removed. Use v3d.Line.computeLineDistances() instead.")}}),Object.assign(hr.prototype,{getChildByName:function(e){return console.warn("v3d.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("v3d.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("v3d.Object3D: .translate() has been removed. Use .translateOnAxis(axis, distance) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("v3d.Object3D: .getWorldRotation() has been removed. Use v3d.Object3D.getWorldQuaternion(target) instead.")}}),Object.defineProperties(hr.prototype,{eulerOrder:{get:function(){return console.warn("v3d.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("v3d.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("v3d.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("v3d.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(Qo.prototype,{objects:{get:function(){return console.warn("v3d.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Ko.prototype,"useVertexTexture",{get:function(){console.warn("v3d.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("v3d.Skeleton: useVertexTexture has been removed.")}}),Zo.prototype.initBones=function(){console.error("v3d.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Bc.prototype,"__arcLengthDivisions",{get:function(){return console.warn("v3d.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("v3d.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),fo.prototype.setLens=function(e,t){console.warn("v3d.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(uu.prototype,{onlyShadow:{set:function(){console.warn("v3d.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("v3d.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("v3d.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("v3d.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("v3d.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("v3d.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("v3d.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("v3d.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("v3d.Light: .shadowCameraVisible has been removed. Use new v3d.CameraHelper(light.shadow.camera) instead.")}},shadowBias:{set:function(e){console.warn("v3d.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("v3d.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("v3d.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("v3d.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Mr.prototype,{length:{get:function(){return console.warn("v3d.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},copyIndicesArray:function(){console.error("v3d.BufferAttribute: .copyIndicesArray() has been removed.")}}),Object.assign(qr.prototype,{addIndex:function(e){console.warn("v3d.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,n){void 0!==n&&console.warn("v3d.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("v3d.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("v3d.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("v3d.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("v3d.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(qr.prototype,{drawcalls:{get:function(){return console.error("v3d.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("v3d.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.assign($s.prototype,{getArrays:function(){console.error("v3d.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("v3d.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("v3d.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties($h.prototype,{dynamic:{set:function(){console.warn("v3d.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("v3d.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(ei.prototype,{wrapAround:{get:function(){console.warn("v3d.Material: .wrapAround has been removed.")},set:function(){console.warn("v3d.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("v3d.Material: .overdraw has been removed.")},set:function(){console.warn("v3d.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("v3d.Material: .wrapRGB has been removed."),new In}},shading:{get:function(){console.error("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}}}),Object.defineProperties(Tl.prototype,{metal:{get:function(){return console.warn("v3d.MeshPhongMaterial: .metal has been removed. Use v3d.MeshStandardMaterial instead."),!1},set:function(){console.warn("v3d.MeshPhongMaterial: .metal has been removed. Use v3d.MeshStandardMaterial instead")}}}),Object.defineProperties(Ei.prototype,{derivatives:{get:function(){return console.warn("v3d.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("v3d. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(ko.prototype,{clearTarget:function(e,t,n,r){console.warn("v3d.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("v3d.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("v3d.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("v3d.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("v3d.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("v3d.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsFloatTextures() is now .extensions.get('OES_texture_float')."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get('OES_texture_half_float')."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("v3d.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get('OES_standard_derivatives')."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("v3d.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get('WEBGL_compressed_texture_s3tc')."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("v3d.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get('WEBGL_compressed_texture_pvrtc')."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("v3d.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get('EXT_blend_minmax')."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("v3d.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get('ANGLE_instanced_arrays')."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("v3d.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("v3d.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("v3d.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("v3d.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("v3d.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("v3d.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("v3d.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("v3d.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("v3d.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("v3d.WebGLRenderer: .setTextureCube() has been removed.")}}),Object.defineProperties(ko.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(lo.prototype,{cullFace:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(yn.prototype,{activeCubeFace:{set:function(){console.warn("v3d.WebGLRenderTargetCube: .activeCubeFace has been removed. It is now the second parameter of WebGLRenderer.setRenderTarget().")}},activeMipMapLevel:{set:function(){console.warn("v3d.WebGLRenderTargetCube: .activeMipMapLevel has been removed. It is now the third parameter of WebGLRenderer.setRenderTarget().")}}}),Object.defineProperties(vn.prototype,{wrapS:{get:function(){return console.warn("v3d.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("v3d.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("v3d.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("v3d.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("v3d.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("v3d.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("v3d.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("v3d.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("v3d.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("v3d.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("v3d.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("v3d.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("v3d.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("v3d.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("v3d.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("v3d.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("v3d.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("v3d.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("v3d.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("v3d.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(xo.prototype,{standing:{set:function(){console.warn("v3d.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("v3d.WebVRManager: .userHeight has been removed.")}}}),uh.prototype.load=function(e){console.warn("v3d.Audio: .load has been deprecated. Use v3d.AudioLoader instead.");var t=this;return(new ah).load(e,function(e){t.setBuffer(e)}),this},dh.prototype.getData=function(){return console.warn("v3d.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},sh.prototype.updateCubeMap=function(e,t){return console.warn("v3d.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var Cd={merge:function(e,t,n){var r;console.warn("v3d.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge(geometry2, matrix, materialIndexOffset) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,n)},center:function(e){return console.warn("v3d.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};dn.crossOrigin=void 0,dn.loadTexture=function(e,t,n,r){console.warn("v3d.ImageUtils.loadTexture has been deprecated. Use v3d.TextureLoader() instead.");var i=new Uc;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},dn.loadTextureCube=function(e,t,n,r){console.warn("v3d.ImageUtils.loadTextureCube has been deprecated. Use v3d.CubeTextureLoader() instead.");var i=new Dc;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},dn.loadCompressedTexture=function(){console.error("v3d.ImageUtils.loadCompressedTexture has been removed. Use v3d.DDSLoader instead.")},dn.loadCompressedTextureCube=function(){console.error("v3d.ImageUtils.loadCompressedTextureCube has been removed. Use v3d.DDSLoader instead.")};var Ed,Pd,Rd,Fd,Id,Od,Nd,Dd,Ud,Bd,zd,Gd,kd,Vd,jd,Wd,Xd,Hd,Yd,qd,Qd,Zd,Kd,Jd,$d,ep,tp,np,rp,ip,ap=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","gradientMap","lightMap","map","metalnessMap","normalMap","roughnessMap","specularMap"],op={disposeTextures:function(t){if(ap.forEach(function(e){t[e]&&t[e].isTexture&&t[e].dispose()}),"MeshNodeMaterial"==t.type)for(var e in t.nodeTextures)t.nodeTextures[e]&&t.nodeTextures[e].dispose()}};function sp(){this.name="",this.type="Constraint",this.mute=!1}function lp(e){sp.call(this),this.type="TargetConstraint",this.target=e}function cp(e){lp.call(this,e),this.type="ChildOfConstraint",this.offsetMatrix=new Mn}function up(e){lp.call(this,e),this.type="CopyLocationConstraint"}function hp(e){lp.call(this,e),this.type="CopyRotationConstraint"}function dp(e){lp.call(this,e),this.type="CopyScaleConstraint"}function pp(e){lp.call(this,e),this.type="FloorConstraint",this.floorLocation="Y",this.offset=0}function fp(){sp.call(this),this.type="LimitLocationConstraint",this.min=(new Bt).setScalar(-1/0),this.max=(new Bt).setScalar(1/0)}function mp(){sp.call(this),this.type="LimitRotationConstraint",this.axis="Y",this.min=0,this.max=2*Math.PI}function vp(){sp.call(this),this.type="LimitScaleConstraint",this.min=(new Bt).setScalar(-1/0),this.max=(new Bt).setScalar(1/0)}function gp(e){lp.call(this,e),this.type="LockedTrackConstraint",this.trackAxis="X",this.lockAxis="Y"}function yp(e){lp.call(this,e),this.type="TrackToConstraint",this.trackAxis="X",this.upAxis="Y"}Object.assign(sp.prototype,{isConstraint:!0,update:function(e){this.mute},copy:function(e){return this.name=e.name,this.mute=e.mute,this},clone:function(){return(new this.constructor).copy(this)}}),lp.prototype=Object.assign(Object.create(sp.prototype),{constructor:lp,isTargetConstraint:!0,copy:function(e){sp.prototype.copy.call(this,e),this.target=e.target}}),cp.prototype=Object.assign(Object.create(lp.prototype),{constructor:cp,isChildOfConstraint:!0,copy:function(e){lp.prototype.copy.call(this,e),this.offsetMatrix.copy(e.offsetMatrix)},update:(Ed=new Mn,Pd=(new Ut).setFromAxisAngle(new Bt(1,0,0),-Math.PI/2),function(e){lp.prototype.update.call(this,e),this.mute||(Ed.multiplyMatrices(this.target.matrixWorld,this.offsetMatrix),Ed.decompose(e.position,e.quaternion,e.scale),e.isCamera&&e.quaternion.multiply(Pd))})}),up.prototype=Object.assign(Object.create(lp.prototype),{constructor:up,isCopyLocationConstraint:!0,update:(Rd=new Ut,Fd=new Bt,function(e){lp.prototype.update.call(this,e),this.mute||(this.target.matrixWorld.decompose(e.position,Rd,Fd),e.parent&&e.parent.worldToLocal(e.position))})}),hp.prototype=Object.assign(Object.create(lp.prototype),{constructor:hp,isCopyRotationConstraint:!0,update:(Id=new Bt,Od=new Ut,Nd=new Bt,Dd=(new Ut).setFromAxisAngle(new Bt(1,0,0),-Math.PI/2),function(e){lp.prototype.update.call(this,e),this.mute||(this.target.matrixWorld.decompose(Id,e.quaternion,Nd),e.parent&&(e.parent.matrixWorld.decompose(Id,Od,Nd),e.quaternion.premultiply(Od.inverse())),e.isCamera&&e.quaternion.multiply(Dd))})}),dp.prototype=Object.assign(Object.create(lp.prototype),{constructor:dp,isCopyScaleConstraint:!0,update:function(e){lp.prototype.update.call(this,e),this.mute||e.scale.copy(this.target.scale)}}),pp.prototype=Object.assign(Object.create(lp.prototype),{constructor:pp,isFloorConstraint:!0,copy:function(e){lp.prototype.copy.call(this,e),this.floorLocation=e.floorLocation,this.offset=e.offset},update:function(e){if(lp.prototype.update.call(this,e),!this.mute){var t=e.position,n=this.target.position,r=this.offset;switch(this.floorLocation){case"X":t.x=Math.max(t.x,n.x+r);break;case"Y":t.y=Math.max(t.y,n.y+r);break;case"Z":t.z=Math.max(t.z,n.z+r);break;case"-X":t.x=Math.min(t.x,n.x+r);break;case"-Y":t.y=Math.min(t.y,n.y+r);break;case"-Z":t.z=Math.min(t.z,n.z+r)}}}}),fp.prototype=Object.assign(Object.create(sp.prototype),{constructor:fp,isLimitLocationConstraint:!0,copy:function(e){sp.prototype.copy.call(this,e),this.min.copy(e.min),this.max.copy(e.max)},update:function(e){sp.prototype.update.call(this,e),this.mute||e.position.clamp(this.min,this.max)}}),mp.prototype=Object.assign(Object.create(sp.prototype),{constructor:mp,isLimitRotationConstraint:!0,copy:function(e){sp.prototype.copy.call(this,e),this.axis=e.axis,this.min=e.min,this.max=e.max},update:(Ud=new Gn,function(e){sp.prototype.update.call(this,e),this.mute||("X"==this.axis?(Ud.setFromQuaternion(e.quaternion,"XYZ"),Ud.x=this._clampAngle(Ud.x,this.min,this.max)):"Y"==this.axis?(Ud.setFromQuaternion(e.quaternion,"YZX"),Ud.y=this._clampAngle(Ud.y,this.min,this.max)):"Z"==this.axis&&(Ud.setFromQuaternion(e.quaternion,"ZXY"),Ud.z=this._clampAngle(Ud.z,this.min,this.max)),e.quaternion.setFromEuler(Ud))}),_clampAngle:function(e,t,n){return Math.abs(n-t)<2*Math.PI&&(e=Nt.clampAngle(e,t,n)),e}}),vp.prototype=Object.assign(Object.create(sp.prototype),{constructor:vp,isLimitScaleConstraint:!0,copy:function(e){sp.prototype.copy.call(this,e),this.min.copy(e.min),this.max.copy(e.max)},update:function(e){sp.prototype.update.call(this,e),this.mute||e.scale.clamp(this.min,this.max)}}),gp.prototype=Object.assign(Object.create(lp.prototype),{constructor:gp,isLockedTrackConstraint:!0,copy:function(e){lp.prototype.copy.call(this,e),this.trackAxis=e.trackAxis,this.lockAxis=e.lockAxis},update:(Bd=new Bt,zd=new Bt,Gd=new Bt,kd=new Bt,Vd=new Bt,jd=new wn,Wd=new Bt,Xd=new Bt,Hd=new Ut,Yd=(new Ut).setFromAxisAngle(new Bt(1,0,0),-Math.PI/2),function(e){if(lp.prototype.update.call(this,e),!this.mute&&(Gd.set("X"==this.trackAxis?1:"-X"==this.trackAxis?-1:0,"Y"==this.trackAxis?1:"-Y"==this.trackAxis?-1:0,"Z"==this.trackAxis?1:"-Z"==this.trackAxis?-1:0),kd.set("X"==this.lockAxis?1:0,"Y"==this.lockAxis?1:0,"Z"==this.lockAxis?1:0),1!=Math.abs(Gd.dot(kd)))){Bd.setFromMatrixPosition(e.matrixWorld),zd.setFromMatrixPosition(this.target.matrixWorld),jd.setFromNormalAndCoplanarPoint(kd,Bd),jd.projectPoint(zd,Vd).sub(Bd);var t=0<Wd.crossVectors(Gd,Vd).dot(kd)?1:-1;e.setRotationFromAxisAngle(jd.normal,t*Gd.angleTo(Vd)),e.parent&&(e.parent.matrixWorld.decompose(Xd,Hd,Xd),e.quaternion.premultiply(Hd.inverse())),e.isCamera&&e.quaternion.multiply(Yd)}})}),yp.prototype=Object.assign(Object.create(lp.prototype),{constructor:yp,isTrackToConstraint:!0,copy:function(e){lp.prototype.copy.call(this,e),this.trackAxis=e.trackAxis,this.upAxis=e.upAxis},update:(qd=new wn,Qd=new Bt,Zd=new Bt,Kd=new Bt,Jd=new Bt,$d=new Bt,ep=new Mn,tp=new Bt,np=new Ut,rp=new Bt(0,1,0),ip=(new Ut).setFromAxisAngle(new Bt(1,0,0),-Math.PI/2),function(e){if(lp.prototype.update.call(this,e),!this.mute){var t=this.trackAxis[this.trackAxis.length-1],n=this.upAxis[this.upAxis.length-1],r="-"==this.trackAxis[0],i="-"==this.upAxis[0];if(t!=n){Qd.setFromMatrixPosition(e.matrixWorld),Zd.setFromMatrixPosition(this.target.matrixWorld),Kd.subVectors(Zd,Qd),Kd.lengthSq()?Kd.normalize():Kd.set(0,-1,0),qd.set(Kd,0),1!=Math.abs(Kd.dot(rp))?qd.projectPoint(rp,Jd).normalize():Jd.set(0,0,-1),r&&Kd.negate(),i&&Jd.negate();var a="X"==t?Kd:"X"==n?Jd:null,o="Y"==t?Kd:"Y"==n?Jd:null,s="Z"==t?Kd:"Z"==n?Jd:null;a?o?s||(s=$d.crossVectors(a,o)):o=$d.crossVectors(s,a):a=$d.crossVectors(o,s),ep.makeBasis(a,o,s),e.setRotationFromMatrix(ep),e.parent&&(e.parent.matrixWorld.decompose(tp,np,tp),e.quaternion.premultiply(np.inverse())),e.isCamera&&e.quaternion.multiply(ip)}}})});var xp={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE_BREAK:19,CAPS_LOCK:20,ESCAPE:27,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,INSERT:45,DELETE:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LEFT_WINDOW_KEY:91,RIGHT_WINDOW_KEY:92,SELECT_KEY:93,NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9:105,MULTIPLY:106,ADD:107,SUBTRACT:109,DECIMAL_POINT:110,DIVIDE:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUM_LOCK:144,SCROLL_LOCK:145,SEMI_COLON:186,EQUAL_SIGN:187,COMMA:188,DASH:189,PERIOD:190,FORWARD_SLASH:191,GRAVE_ACCENT:192,OPEN_BRACKET:219,BACK_SLASH:220,CLOSE_BRAKET:221,SINGLE_QUOTE:222};function _p(e){for(var t in this.isKeyDown={},xp)this.isKeyDown[xp[t]]=!1;this.onKeyDown=null,this.onKeyUp=null,this._domElement=e,this._keydownCb=function(e){this.isKeyDown[e.keyCode]=!0,this.onKeyDown&&this.onKeyDown(e)}.bind(this),this._keyupCb=function(e){this.isKeyDown[e.keyCode]=!1,this.onKeyUp&&this.onKeyUp(e)}.bind(this),this._domElement.addEventListener("keydown",this._keydownCb,!1),this._domElement.addEventListener("keyup",this._keyupCb,!1)}Object.assign(_p.prototype,{dispose:function(){this._domElement.removeEventListener("keydown",this._keydownCb,!1),this._domElement.removeEventListener("keyup",this._keyupCb,!1)}});function bp(e,t){var c=this;this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.enableDamping=!0,this.enableRotate=!0,this.rotateSpeed=.9,this.rotateSpeedTouch=.75,this.rotateInertia=.05,this.rotateInertiaTouch=.05,this.enableZoom=!0,this.zoomSpeed=30,this.zoomSpeedKey=.2,this.zoomInertia=.05,this.enablePan=!0,this.panSpeedKey=.15,this.panInertia=.05,this.gazeLevel=1.8,this.storyHeight=3,this.collisionMeshes=[];var l=new lh,a=new Bt,o=new Bt,s=new Bt,u=new Bt,h=new Ut,d=new Bt,p={};p[xp.W]=p[xp.S]=p[xp.A]=p[xp.D]=p[xp.UP_ARROW]=p[xp.DOWN_ARROW]=p[xp.LEFT_ARROW]=p[xp.RIGHT_ARROW]=0;var f=new _p(window),n=!(f.onKeyDown=function(e){e.keyCode in p&&(p[e.keyCode]=1)}),m=new ql,v=new ql,g=new Dt,y=1,x=1,r=new Dt,i=new Dt,_=0,b=0,w=1,A=1,M=new Dt,T=new Dt,S=1,L=1,C=new Uo(new Bt,new Bt(0,-1,0)),E=C.params.checkVisibility=!1,P=!1,R=function(){},F=new Bt,I=new Bt,O=new Bt,N=new Bt,D=0,U=new lh,B={type:"change"},z={type:"start"},G={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}},this.handleEvent=function(e){"function"==typeof this[e.type]&&this[e.type](e)};var k,V,j,W,X,H=(k=new Dt,function(e,t){return k.set((e-.5*c.screen.width-c.screen.left)/(.5*c.screen.width),(c.screen.height+2*(c.screen.top-t))/c.screen.width),k});function Y(e){!1!==c.enabled&&(e.preventDefault(),!1!==c.enableRotate&&(i.copy(H(e.pageX,e.pageY).negate()),r.copy(i),n=!0,document.addEventListener("mousemove",q,!1),document.addEventListener("mouseup",Q,!1),document.addEventListener("mouseleave",Q,!1),c.dispatchEvent(z)))}function q(e){if(!1!==c.enabled&&(e.preventDefault(),n)){if(!1===c.enableRotate)return;i.copy(H(e.pageX,e.pageY).negate()),g.add(i).sub(r),r.copy(i),y=c.rotateSpeed,x=c.rotateInertia}}function Q(e){!1!==c.enabled&&(e.preventDefault(),n=!1,document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Q),document.removeEventListener("mouseleave",Q),c.dispatchEvent(G))}function Z(e){if(!1!==c.enabled){switch(e.preventDefault(),e.stopPropagation(),e.deltaMode){case 2:if(!1===c.enableZoom)return;b-=.025*e.deltaY,w=c.zoomSpeed,A=c.zoomInertia;break;case 1:if(!1===c.enableZoom)return;b-=.01*e.deltaY,w=c.zoomSpeed,A=c.zoomInertia;break;default:if(!1===c.enableZoom)return;b-=25e-5*e.deltaY,w=c.zoomSpeed,A=c.zoomInertia}c.dispatchEvent(z),c.dispatchEvent(G)}}function K(e){if(!1!==c.enabled){var t=e.touches[0];n=!0,i.copy(H(t.pageX,t.pageY).negate()),r.copy(i),c.dispatchEvent(z)}}function J(e){if(!1!==c.enabled){e.preventDefault(),e.stopPropagation();var t=e.touches[0];!1!==c.enableRotate&&(i.copy(H(t.pageX,t.pageY).negate()),g.add(i).sub(r),r.copy(i),y=c.rotateSpeedTouch,x=c.rotateInertiaTouch)}}function $(e){if(!1!==c.enabled){switch(e.touches.length){case 0:n=!1;break;default:if(!1===c.enableRotate)return;n=!0,i.copy(H(e.touches[0].pageX,e.touches[0].pageY).negate()),r.copy(i)}c.dispatchEvent(G)}}function ee(e){!1!==c.enabled&&e.preventDefault()}this.update=(V=new Bt,function(){if(P){var e=U.getElapsedTime()/D;if(e=Nt.smootherstep(e,0,1),c.object.position.lerpVectors(F,O,e),c.object.lookAt(V.lerpVectors(I,N,e)),1<=e){for(var t in P=!1,R(),v.set(0,0,0),g.set(0,0),b=_=0,M.set(0,0),T.set(0,0),p)p[t]=0;l.getDelta()}}else c.object.isCamera||c.object.isLight?d.set(0,0,-1):d.set(0,0,1),d.applyQuaternion(c.object.quaternion).normalize(),m.setFromVector3(d),m.theta+=v.theta*y,m.phi+=v.phi*y,m.makeSafe(),d.setFromSpherical(m),a.copy(d).add(c.object.position),c.object.lookAt(a),c.object.isPerspectiveCamera?c.object.position.addScaledVector(d,_):c.object.isOrthographicCamera&&(c.object.zoom*=1+.15*_,c.object.updateProjectionMatrix()),o.copy(d).cross(c.object.up).setLength(-M.x),o.add(s.copy(c.object.up).setLength(M.y)),c.object.position.add(o),function(){var e=l.getDelta();for(var t in v.set(v.radius,g.y,g.x),g.x=c.enableDamping?Nt.expAverage(g.x,0,e,x):0,g.y=c.enableDamping?Nt.expAverage(g.y,0,e,x):0,v.set(v.radius,v.phi-g.y,v.theta-g.x),M.copy(T),T.x=c.enableDamping?Nt.expAverage(T.x,0,e,L):0,T.y=c.enableDamping?Nt.expAverage(T.y,0,e,L):0,M.sub(T),M.multiplyScalar(S),_=b,b=c.enableDamping?Nt.expAverage(b,0,e,A):0,_-=b,_*=w,p){var n=t==xp.A||t==xp.LEFT_ARROW||t==xp.D||t==xp.RIGHT_ARROW,r=t==xp.W||t==xp.UP_ARROW||t==xp.S||t==xp.DOWN_ARROW,i=n?c.panInertia:c.zoomInertia,a=n?c.panSpeedKey:c.zoomSpeedKey;if(f.isKeyDown[t])var o=p[t]=1;else{var s=p[t];p[t]=Nt.expAverage(p[t],0,e,i),o=s-p[t]}c.enabled&&(n&&!c.enablePan||r&&!c.enableZoom||(o*=60*e*a,t==xp.A||t==xp.LEFT_ARROW?M.x+=o:t==xp.D||t==xp.RIGHT_ARROW?M.x-=o:t==xp.W||t==xp.UP_ARROW?_+=o:t!=xp.S&&t!=xp.DOWN_ARROW||(_-=o)))}}();if(c.collisionMeshes.length){C.ray.origin.copy(c.object.position),C.far=c.storyHeight;var n=C.intersectObjects(c.collisionMeshes);if(0<n.length){var r=n[0];c.object.position.y=r.point.y+c.gazeLevel,E=!0}else E&&c.object.position.copy(u)}var i=!1;1e-6<u.distanceToSquared(c.object.position)&&(u.copy(c.object.position),i=!0),h.dot(c.object.quaternion)<1-1e-6&&(h.copy(c.object.quaternion),i=!0),i&&c.dispatchEvent(B)}),this.dispose=function(){this.domElement.removeEventListener("contextmenu",ee,!1),this.domElement.removeEventListener("mousedown",Y,!1),this.domElement.removeEventListener("wheel",Z,!1),this.domElement.removeEventListener("touchstart",K,!1),this.domElement.removeEventListener("touchend",$,!1),this.domElement.removeEventListener("touchmove",J,!1),document.removeEventListener("mousemove",q,!1),document.removeEventListener("mouseup",Q,!1),document.removeEventListener("mouseleave",Q,!1),f.dispose()},this.releaseFromCollision=function(){E=!1},this.tween=(j=new Bt,W=new Bt,X=new Bt,function(e,t,n,r){c.object.parent&&(e=j.copy(e),c.object.parent.worldToLocal(e));var i=c.object.getWorldPosition(W),a=X.subVectors(t,i).length(),o=c.object.getWorldDirection(X).multiplyScalar(a).add(i),s=e.manhattanDistanceTo(c.object.position),l=t.manhattanDistanceTo(o);s<1e-5&&l<1e-5||(P=!0,R="function"==typeof r?r:function(){},F.copy(c.object.position),I.copy(o),O.copy(e),N.copy(t),D=n,U.start())}),this.domElement.addEventListener("contextmenu",ee,!1),this.domElement.addEventListener("mousedown",Y,!1),this.domElement.addEventListener("wheel",Z,!1),this.domElement.addEventListener("touchstart",K,!1),this.domElement.addEventListener("touchend",$,!1),this.domElement.addEventListener("touchmove",J,!1),this.handleResize(),this.update()}Object.assign(bp.prototype,t.prototype);function wp(e,t){var c=this,a={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.enableDamping=!0,this.enableRotate=!0,this.rotateSpeed=.9,this.rotateSpeedTouch=.75,this.rotateInertia=.05,this.rotateInertiaTouch=.05,this.enableZoom=!0,this.zoomSpeed=150,this.zoomSpeedKey=.5,this.zoomSpeedTouch=20,this.zoomInertia=.05,this.zoomInertiaTouch=.05,this.enablePan=!0,this.panSpeed=20,this.panSpeedKey=.15,this.panSpeedTouch=15,this.panInertia=.05,this.panInertiaTouch=.05,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.mouseButtons={ROTATE:v3d.MOUSE.LEFT,ZOOM:v3d.MOUSE.MIDDLE,PAN:v3d.MOUSE.RIGHT};var l=new lh,r=new Bt,i=new Bt,o=new Bt,u=new Dt,s=new Bt,h=new Ut,d=a.NONE,p=new Bt,f={};f[xp.W]=f[xp.S]=f[xp.A]=f[xp.D]=f[xp.UP_ARROW]=f[xp.DOWN_ARROW]=f[xp.LEFT_ARROW]=f[xp.RIGHT_ARROW]=0;var m=new _p(window);m.onKeyDown=function(e){e.keyCode in f&&(f[e.keyCode]=1)};var v=new ql,g=new ql,y=new Dt,x=1,_=1,b=new Dt,w=new Dt,A=0,M=0,T=1,S=1,L=0,C=0,E=new Dt,P=new Dt,R=1,F=1,I=new Dt,O=new Dt,N=!1,D=function(){},U=new Bt,B=new Bt,z=new Bt,G=new Bt,k=0,V=new lh,j={type:"change"},W={type:"start"},n={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}},this.handleEvent=function(e){"function"==typeof this[e.type]&&this[e.type](e)};var X,H,Y,q,Q,Z,K=(X=new Dt,function(e,t){return X.set((e-c.screen.left)/c.screen.width,(t-c.screen.top)/c.screen.height),X}),J=(H=new Dt,function(e,t){return H.set((e-.5*c.screen.width-c.screen.left)/(.5*c.screen.width),(c.screen.height+2*(c.screen.top-t))/c.screen.width),H});function $(e){if(!1!==c.enabled){switch(e.preventDefault(),e.button){case c.mouseButtons.ROTATE:if(!1===c.enableRotate)return;w.copy(J(e.pageX,e.pageY).negate()),b.copy(w),d=a.ROTATE;break;case c.mouseButtons.ZOOM:case c.mouseButtons.PAN:if(!1===c.enablePan)return;I.copy(K(e.pageX,e.pageY)),O.copy(I),d=e.button==c.mouseButtons.PAN?a.PAN:a.ZOOM}document.addEventListener("mousemove",ee,!1),document.addEventListener("mouseup",te,!1),document.addEventListener("mouseleave",te,!1),c.dispatchEvent(W)}}function ee(e){if(!1!==c.enabled)if(e.preventDefault(),d===a.ROTATE){if(!1===c.enableRotate)return;w.copy(J(e.pageX,e.pageY).negate()),y.add(w).sub(b),b.copy(w),x=c.rotateSpeed,_=c.rotateInertia}else if(d===a.PAN||d===a.ZOOM){if(!1===c.enablePan)return;O.copy(K(e.pageX,e.pageY)),P.add(O).sub(I),I.copy(O),R=c.panSpeed,F=c.panInertia}}function te(e){!1!==c.enabled&&(e.preventDefault(),d=a.NONE,document.removeEventListener("mousemove",ee),document.removeEventListener("mouseup",te),document.removeEventListener("mouseleave",te),c.dispatchEvent(n))}function ne(e){if(!1!==c.enabled){switch(e.preventDefault(),e.stopPropagation(),e.deltaMode){case 2:if(!1===c.enableZoom)return;M-=.025*e.deltaY,T=c.zoomSpeed,S=c.zoomInertia;break;case 1:if(!1===c.enableZoom)return;M-=.01*e.deltaY,T=c.zoomSpeed,S=c.zoomInertia;break;default:if(!1===c.enableZoom)return;M-=25e-5*e.deltaY,T=c.zoomSpeed,S=c.zoomInertia}c.dispatchEvent(W),c.dispatchEvent(n)}}function re(e){if(!1!==c.enabled){var t=e.touches[0],n=e.touches[1];switch(e.touches.length){case 1:if(!1===c.enableRotate)return;d=a.TOUCH_ROTATE,w.copy(J(t.pageX,t.pageY).negate()),b.copy(w);break;default:if(!1===c.enableZoom&&!1===c.enablePan)return;if(d=a.TOUCH_ZOOM_PAN,c.enableZoom){var r=K(t.pageX-n.pageX,t.pageY-n.pageY);L=C=r.length()}if(c.enablePan){var i=K((t.pageX+n.pageX)/2,(t.pageY+n.pageY)/2);I.copy(i),O.copy(I)}}c.dispatchEvent(W)}}function ie(e){if(!1!==c.enabled){e.preventDefault(),e.stopPropagation();var t=e.touches[0],n=e.touches[1];switch(e.touches.length){case 1:if(!1===c.enableRotate)return;w.copy(J(t.pageX,t.pageY).negate()),y.add(w).sub(b),b.copy(w),x=c.rotateSpeedTouch,_=c.rotateInertiaTouch;break;default:if(!1===c.enableZoom&&!1===c.enablePan)return;var r=K(t.pageX-n.pageX,t.pageY-n.pageY),i=(C=r.length())-L;L=C;var a=K((t.pageX+n.pageX)/2,(t.pageY+n.pageY)/2);O.copy(a);var o=u.subVectors(O,I),s=o.length();I.copy(O),c.enableZoom&&Math.abs(i)>Math.abs(s)&&(M+=i,T=c.zoomSpeedTouch,S=c.zoomInertiaTouch),c.enablePan&&Math.abs(i)<=Math.abs(s)&&(P.add(o),R=c.panSpeedTouch,F=c.panInertiaTouch)}}}function ae(e){if(!1!==c.enabled){switch(e.touches.length){case 0:d=a.NONE;break;case 1:if(!1===c.enableRotate)return;d=a.TOUCH_ROTATE,w.copy(J(e.touches[0].pageX,e.touches[0].pageY).negate()),b.copy(w)}c.dispatchEvent(n)}}function oe(e){!1!==c.enabled&&e.preventDefault()}this.update=(Y=new Bt,function(){if(N){var e=V.getElapsedTime()/k;if(e=Nt.smootherstep(e,0,1),c.object.position.lerpVectors(U,z,e),c.object.lookAt(Y.lerpVectors(B,G,e)),1<=e){for(var t in N=!1,D(),g.set(0,0,0),y.set(0,0),M=A=0,E.set(0,0),P.set(0,0),f)f[t]=0;l.getDelta()}}else c.object.isCamera||c.object.isLight?p.set(0,0,-1):p.set(0,0,1),p.applyQuaternion(c.object.quaternion).normalize(),v.setFromVector3(p),v.theta+=g.theta*x,v.phi+=g.phi*x,v.theta=Math.max(c.minAzimuthAngle,Math.min(c.maxAzimuthAngle,v.theta)),v.phi=Math.max(c.minPolarAngle,Math.min(c.maxPolarAngle,v.phi)),v.makeSafe(),p.setFromSpherical(v),r.copy(p).add(c.object.position),c.object.lookAt(r),c.object.isPerspectiveCamera?c.object.position.addScaledVector(p,A):c.object.isOrthographicCamera&&(c.object.zoom*=1+.15*A,c.object.updateProjectionMatrix()),i.copy(p).cross(c.object.up).setLength(-E.x),i.add(o.copy(c.object.up).setLength(E.y)),c.object.position.add(i),function(){var e=l.getDelta();for(var t in g.set(g.radius,y.y,y.x),y.x=c.enableDamping?Nt.expAverage(y.x,0,e,_):0,y.y=c.enableDamping?Nt.expAverage(y.y,0,e,_):0,g.set(g.radius,g.phi-y.y,g.theta-y.x),E.copy(P),P.x=c.enableDamping?Nt.expAverage(P.x,0,e,F):0,P.y=c.enableDamping?Nt.expAverage(P.y,0,e,F):0,E.sub(P),E.multiplyScalar(R),A=M,M=c.enableDamping?Nt.expAverage(M,0,e,S):0,A-=M,A*=T,f){var n=t==xp.A||t==xp.LEFT_ARROW||t==xp.D||t==xp.RIGHT_ARROW,r=t==xp.W||t==xp.UP_ARROW||t==xp.S||t==xp.DOWN_ARROW,i=n?c.panInertia:c.zoomInertia,a=n?c.panSpeedKey:c.zoomSpeedKey;if(m.isKeyDown[t])var o=f[t]=1;else{var s=f[t];f[t]=Nt.expAverage(f[t],0,e,i),o=s-f[t]}c.enabled&&(n&&!c.enablePan||r&&!c.enableZoom||(o*=60*e*a,t==xp.A||t==xp.LEFT_ARROW?E.x+=o:t==xp.D||t==xp.RIGHT_ARROW?E.x-=o:t==xp.W||t==xp.UP_ARROW?A+=o:t!=xp.S&&t!=xp.DOWN_ARROW||(A-=o)))}}();var n=!1;1e-6<s.distanceToSquared(c.object.position)&&(s.copy(c.object.position),n=!0),h.dot(c.object.quaternion)<1-1e-6&&(h.copy(c.object.quaternion),n=!0),n&&c.dispatchEvent(j)}),this.dispose=function(){this.domElement.removeEventListener("contextmenu",oe,!1),this.domElement.removeEventListener("mousedown",$,!1),this.domElement.removeEventListener("wheel",ne,!1),this.domElement.removeEventListener("touchstart",re,!1),this.domElement.removeEventListener("touchend",ae,!1),this.domElement.removeEventListener("touchmove",ie,!1),document.removeEventListener("mousemove",ee,!1),document.removeEventListener("mouseup",te,!1),document.removeEventListener("mouseleave",te,!1),m.dispose()},this.tween=(q=new Bt,Q=new Bt,Z=new Bt,function(e,t,n,r){c.object.parent&&(e=q.copy(e),c.object.parent.worldToLocal(e));var i=c.object.getWorldPosition(Q),a=Z.subVectors(t,i).length(),o=c.object.getWorldDirection(Z).multiplyScalar(a).add(i),s=e.manhattanDistanceTo(c.object.position),l=t.manhattanDistanceTo(o);s<1e-5&&l<1e-5||(N=!0,D="function"==typeof r?r:function(){},U.copy(c.object.position),B.copy(o),z.copy(e),G.copy(t),k=n,V.start())}),this.domElement.addEventListener("contextmenu",oe,!1),this.domElement.addEventListener("mousedown",$,!1),this.domElement.addEventListener("wheel",ne,!1),this.domElement.addEventListener("touchstart",re,!1),this.domElement.addEventListener("touchend",ae,!1),this.domElement.addEventListener("touchmove",ie,!1),this.handleResize(),this.update()}Object.assign(wp.prototype,t.prototype);function Ap(e,t){var r,i,a,o,s,l;this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new Bt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!0,this.enableZoom=!0,this.zoomSpeed=5,this.zoomSpeedTouch=1,this.zoomInertia=.05,this.zoomInertiaTouch=.05,this.enableRotate=!0,this.rotateSpeed=1.2,this.rotateSpeedTouch=.7,this.rotateInertia=.05,this.rotateInertiaTouch=.05,this.enablePan=!0,this.panSpeed=1.3,this.panSpeedKey=15,this.panInertia=.05,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.mouseButtons={ROTATE:v3d.MOUSE.LEFT,ZOOM:v3d.MOUSE.MIDDLE,PAN:v3d.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return m.phi},this.getAzimuthalAngle=function(){return m.theta},this.saveState=function(){c.target0.copy(c.target),c.position0.copy(c.object.position),c.zoom0=c.object.zoom},this.reset=function(){c.target.copy(c.target0),c.object.position.copy(c.position0),c.object.zoom=c.zoom0,c.object.updateProjectionMatrix(),c.dispatchEvent(u),c.update(),p=d.NONE},this.update=(r=new Bt,i=(new Ut).setFromUnitVectors(e.up,new Bt(0,1,0)),a=i.clone().inverse(),o=new Bt,s=new Ut,function(){var e=c.object.position;if(this.inTween){var t=W.getElapsedTime()/j;if(t=Nt.smootherstep(t,0,1),e.lerpVectors(z,k,t),c.target.lerpVectors(G,V,t),c.object.lookAt(c.target),1<=t){for(var n in this.inTween=!1,this.tweenCallback(),v.set(0,0,0),y.set(0,0,0),g=1,R.set(0,0),_)_[n]=0;T.set(0,0),B.getDelta()}}else r.copy(e).sub(c.target),r.applyQuaternion(i),m.setFromVector3(r),c.autoRotate&&p===d.NONE&&H(2*Math.PI/60/60*c.autoRotateSpeed),m.theta+=v.theta,m.phi+=v.phi,isFinite(c.minAzimuthAngle)&&isFinite(c.maxAzimuthAngle)&&(m.theta=Nt.clampAngle(m.theta,c.minAzimuthAngle,c.maxAzimuthAngle)),m.phi=Math.max(c.minPolarAngle,Math.min(c.maxPolarAngle,m.phi)),m.makeSafe(),c.object.isPerspectiveCamera?(m.radius*=g,m.radius=Math.max(c.minDistance,Math.min(c.maxDistance,m.radius))):c.object.isOrthographicCamera&&(c.object.zoom/=g,c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom)),c.object.updateProjectionMatrix()),c.target.add(y),r.setFromSpherical(m),r.applyQuaternion(a),e.copy(c.target).add(r),c.object.lookAt(c.target),v.set(0,0,0),y.set(0,0,0),function(){var e,t,n=B.getDelta();for(var r in M.copy(T),T.x=c.enableDamping?Nt.expAverage(T.x,0,n,L):0,T.y=c.enableDamping?Nt.expAverage(T.y,0,n,L):0,M.sub(T),t=e=void 0,t=c.domElement===document?c.domElement.body:c.domElement,H(2*Math.PI*M.x/t.clientWidth*S),e=2*Math.PI*M.y/t.clientHeight*S,v.phi-=e,P.copy(R),R.x=c.enableDamping?Nt.expAverage(R.x,0,n,c.panInertia):0,R.y=c.enableDamping?Nt.expAverage(R.y,0,n,c.panInertia):0,P.sub(R),P.multiplyScalar(c.panSpeed),_){if(b.isKeyDown[r])var i=_[r]=1;else{var a=_[r];_[r]=Nt.expAverage(_[r],0,n,c.panInertia);var i=a-_[r]}c.enabled&&c.enableKeys&&c.enablePan&&(i*=60*n*c.panSpeedKey,r==xp.A||r==xp.LEFT_ARROW?P.x+=i:r==xp.D||r==xp.RIGHT_ARROW?P.x-=i:r==xp.W||r==xp.UP_ARROW?P.y+=i:r!=xp.S&&r!=xp.DOWN_ARROW||(P.y-=i))}$(P.x,P.y),g=N,N=c.enableDamping?Nt.expAverage(N,1,n,U):1,g/=N}();return!(!(x||o.distanceToSquared(c.object.position)>f||8*(1-s.dot(c.object.quaternion))>f)||(c.dispatchEvent(u),o.copy(c.object.position),s.copy(c.object.quaternion),x=!1))}),this.dispose=function(){c.domElement.removeEventListener("contextmenu",ue,!1),c.domElement.removeEventListener("mousedown",re,!1),c.domElement.removeEventListener("wheel",oe,!1),c.domElement.removeEventListener("touchstart",se,!1),c.domElement.removeEventListener("touchend",ce,!1),c.domElement.removeEventListener("touchmove",le,!1),document.removeEventListener("mousemove",ie,!1),document.removeEventListener("mouseup",ae,!1),document.removeEventListener("mouseleave",ae,!1),b.dispose()},this.tween=(l=new Bt,function(e,t,n,r){c.object.parent&&(e=l.copy(e),c.object.parent.worldToLocal(e)),e.manhattanDistanceTo(c.object.position)<1e-5&&t.manhattanDistanceTo(c.target)<1e-5||(c.inTween=!0,c.tweenCallback="function"==typeof r?r:function(){},z.copy(c.object.position),G.copy(c.target),k.copy(e),V.copy(t),j=n,W.start())});var c=this,u={type:"change"},h={type:"start"},n={type:"end"},d={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY_PAN:4},p=d.NONE,f=1e-6,m=new ql,v=new ql,g=1,y=new Bt,x=!1,_={};_[xp.W]=_[xp.S]=_[xp.A]=_[xp.D]=_[xp.UP_ARROW]=_[xp.DOWN_ARROW]=_[xp.LEFT_ARROW]=_[xp.RIGHT_ARROW]=0;var b=new _p(window);b.onKeyDown=function(e){e.keyCode in _&&(_[e.keyCode]=1)};var w=new Dt,A=new Dt,M=new Dt,T=new Dt,S=1,L=1,C=new Dt,E=new Dt,P=new Dt,R=new Dt,F=new Dt,I=new Dt,O=new Dt,N=1,D=1,U=1,B=new lh,z=new Bt,G=new Bt,k=new Bt,V=new Bt,j=0,W=new lh;function X(){return Math.pow(.95,D)}function H(e){v.theta-=e}function Y(e,t){A.set(e,t),T.add(A).sub(w),w.copy(A)}var q,Q,Z,K=(q=new Bt,function(e,t){q.setFromMatrixColumn(t,0),q.multiplyScalar(-e),y.add(q)}),J=(Q=new Bt,function(e,t){Q.setFromMatrixColumn(t,1),Q.multiplyScalar(e),y.add(Q)}),$=(Z=new Bt,function(e,t){var n=c.domElement===document?c.domElement.body:c.domElement;if(c.object.isPerspectiveCamera){var r=c.object.position;Z.copy(r).sub(c.target);var i=Z.length();i*=Math.tan(c.object.fov/2*Nt.DEG2RAD),K(2*e*i/n.clientHeight,c.object.matrix),J(2*t*i/n.clientHeight,c.object.matrix)}else c.object.isOrthographicCamera?(K(e*(c.object.right-c.object.left)/c.object.zoom/n.clientWidth,c.object.matrix),J(t*(c.object.top-c.object.bottom)/c.object.zoom/n.clientHeight,c.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),c.enablePan=!1)});function ee(e){c.object.isPerspectiveCamera?N/=e:c.object.isOrthographicCamera?(N/=e,x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),c.enableZoom=!1)}function te(e){c.object.isPerspectiveCamera?N*=e:c.object.isOrthographicCamera?(N*=e,x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),c.enableZoom=!1)}function ne(e){var t,n;t=e.clientX,n=e.clientY,E.set(t,n),R.add(E).sub(C),C.copy(E)}function re(e){if(!1!==c.enabled){switch(e.preventDefault(),e.button){case c.mouseButtons.ROTATE:if(!1===c.enableRotate)return;n=e,w.set(n.clientX,n.clientY),p=d.ROTATE;break;case c.mouseButtons.ZOOM:case c.mouseButtons.PAN:if(!1===c.enablePan)return;t=e,C.set(t.clientX,t.clientY),p=d.PAN}var t,n;p!==d.NONE&&(document.addEventListener("mousemove",ie,!1),document.addEventListener("mouseup",ae,!1),document.addEventListener("mouseleave",ae,!1),c.dispatchEvent(h))}}function ie(e){var t,n;if(!1!==c.enabled)switch(e.preventDefault(),p){case d.ROTATE:if(!1===c.enableRotate)return;Y((n=e).clientX,n.clientY),S=c.rotateSpeed,L=c.rotateInertia;break;case d.DOLLY:if(!1===c.enableZoom)return;t=e,I.set(t.clientX,t.clientY),O.subVectors(I,F),0<O.y?ee(X()):O.y<0&&te(X()),F.copy(I),c.update();break;case d.PAN:if(!1===c.enablePan)return;ne(e)}}function ae(e){!1!==c.enabled&&(document.removeEventListener("mousemove",ie,!1),document.removeEventListener("mouseup",ae,!1),document.removeEventListener("mouseleave",ae,!1),c.dispatchEvent(n),p=d.NONE)}function oe(e){var t;!1===c.enabled||!1===c.enableZoom||p!==d.NONE&&p!==d.ROTATE||(e.preventDefault(),e.stopPropagation(),c.dispatchEvent(h),t=e,D=c.zoomSpeed,U=c.zoomInertia,t.deltaY<0?te(X()):0<t.deltaY&&ee(X()),c.update(),c.dispatchEvent(n))}function se(e){if(!1!==c.enabled){switch(e.touches.length){case 1:if(!1===c.enableRotate)return;t=e,w.set(t.touches[0].pageX,t.touches[0].pageY),p=d.TOUCH_ROTATE;break;case 2:if(!1===c.enableZoom&&!1===c.enablePan)return;!function(e){if(c.enableZoom){D=c.zoomSpeedTouch,U=c.zoomInertiaTouch;var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);F.set(0,r)}if(c.enablePan){var i=.5*(e.touches[0].pageX+e.touches[1].pageX),a=.5*(e.touches[0].pageY+e.touches[1].pageY);C.set(i,a)}c.update()}(e),p=d.TOUCH_DOLLY_PAN;break;default:p=d.NONE}var t;p!==d.NONE&&c.dispatchEvent(h)}}function le(e){var t;if(!1!==c.enabled)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(!1===c.enableRotate)return;if(p!==d.TOUCH_ROTATE)return;Y((t=e).touches[0].pageX,t.touches[0].pageY),S=c.rotateSpeedTouch,L=c.rotateInertiaTouch;break;case 2:if(!1===c.enableZoom&&!1===c.enablePan)return;if(p!==d.TOUCH_DOLLY_PAN)return;!function(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);I.set(0,r),O.subVectors(I,F),F.copy(I);var i=.5*(e.touches[0].pageX+e.touches[1].pageX),a=.5*(e.touches[0].pageY+e.touches[1].pageY);E.set(i,a),P.subVectors(E,C),C.copy(E),c.enableZoom&&Math.abs(O.length())>Math.abs(P.length())&&(0<O.y?te(X()):O.y<0&&ee(X())),c.enablePan&&Math.abs(O.length())<Math.abs(P.length())&&R.add(P),c.update()}(e);break;default:p=d.NONE}}function ce(e){!1!==c.enabled&&(c.dispatchEvent(n),p=d.NONE)}function ue(e){!1!==c.enabled&&e.preventDefault()}c.domElement.addEventListener("contextmenu",ue,!1),c.domElement.addEventListener("mousedown",re,!1),c.domElement.addEventListener("wheel",oe,!1),c.domElement.addEventListener("touchstart",se,!1),c.domElement.addEventListener("touchend",ce,!1),c.domElement.addEventListener("touchmove",le,!1),this.update()}function Mp(e,t){this.sourceTexture=e,this.resolution=void 0!==t?t:256;var n=this.resolution,r={format:this.sourceTexture.format,magFilter:this.sourceTexture.magFilter,minFilter:this.sourceTexture.minFilter,type:this.sourceTexture.type,generateMipmaps:this.sourceTexture.generateMipmaps,anisotropy:this.sourceTexture.anisotropy,encoding:this.sourceTexture.encoding};this.renderTarget=new yn(n,n,r),this.renderTarget.texture.name="EquiCube.cube",this.camera=new pr(-1,1,1,-1,0,1e3),this.shader=new Ei(Un.equicube),this.planeMesh=new Fi(new Jr(2,2,0),this.shader),this.planeMesh.material.side=Q,this.scene=new Wo,this.scene.add(this.planeMesh),this.scene.add(this.camera),this.invertU=!1,this.offsetU=0,this.shader.uniforms.tEquirect.value=this.sourceTexture}function Tp(e){var t=4*(this.cubeLods=e)[0].width,n=e[0].texture,r={format:n.format,magFilter:n.magFilter,minFilter:n.minFilter,type:n.type,generateMipmaps:n.generateMipmaps,anisotropy:n.anisotropy,encoding:n.encoding===v3d.RGBEEncoding?v3d.RGBM16Encoding:n.encoding};n.type!=v3d.HalfFloatType&&n.type!=v3d.FloatType||(r.encoding=v3d.LinearEncoding),this.CubeUVRenderTarget=new v3d.WebGLRenderTarget(t,t,r),this.CubeUVRenderTarget.texture.name="PMREMCubeUVPacker.cubeUv",this.CubeUVRenderTarget.texture.mapping=v3d.CubeUVReflectionMapping,this.CubeUVRenderTarget.texture.minFilter=v3d.LinearFilter,this.CubeUVRenderTarget.texture.magFilter=v3d.LinearFilter,this.CubeUVRenderTarget.texture.generateMipmaps=!1,this.camera=new v3d.OrthographicCamera(.5*-t,.5*t,.5*-t,.5*t,0,1),this.scene=new v3d.Scene,this.objects=[];var i=new v3d.PlaneBufferGeometry(1,1),a=[];a.push(new v3d.Vector2(0,0)),a.push(new v3d.Vector2(1,0)),a.push(new v3d.Vector2(2,0)),a.push(new v3d.Vector2(0,1)),a.push(new v3d.Vector2(1,1)),a.push(new v3d.Vector2(2,1));var o=t;t=e[0].width;var s=0,l=4;this.numLods=Math.log(e[0].width)/Math.log(2)-2;for(var c=0;c<this.numLods;c++){var u=.5*(o-o/l);16<t&&(l*=2);for(var h=16<t?6:1,d=0,p=0,f=t,m=0;m<h;m++){for(var v=0;v<6;v++){var g=this.getShader();g.uniforms.envMap.value=this.cubeLods[c].texture,g.envMap=this.cubeLods[c].texture,g.uniforms.faceIndex.value=v,g.uniforms.mapSize.value=f,g.uniforms.mipLevel.value=m;var y=new v3d.Mesh(i,g);y.position.x=a[v].x*f-u+d,y.position.y=a[v].y*f-u+s+p,y.material.side=v3d.BackSide,y.scale.setScalar(f),this.scene.add(y),this.objects.push(y)}p+=1.75*f,d+=1.25*f,f/=2}s+=2*t,16<t&&(t/=2)}}function Sp(e,t,n){this.sourceTexture=e,this.resolution=void 0!==n?n:256,this.samplesPerLevel=void 0!==t?t:64;var r=e.encoding===v3d.LinearEncoding||e.encoding===v3d.GammaEncoding||e.encoding===v3d.sRGBEncoding;this.sourceTexture.minFilter=r?v3d.LinearFilter:v3d.NearestFilter,this.sourceTexture.magFilter=r?v3d.LinearFilter:v3d.NearestFilter,this.sourceTexture.generateMipmaps=this.sourceTexture.generateMipmaps&&r,this.cubeLods=[],this.flipX=!0;var i=this.resolution,a={format:this.sourceTexture.format,magFilter:this.sourceTexture.magFilter,minFilter:this.sourceTexture.minFilter,type:this.sourceTexture.type,generateMipmaps:this.sourceTexture.generateMipmaps,anisotropy:this.sourceTexture.anisotropy,encoding:this.sourceTexture.encoding};this.numLods=Math.log(i)/Math.log(2)-2;for(var o=0;o<this.numLods;o++){var s=new v3d.WebGLRenderTargetCube(i,i,a);s.texture.name="PMREMGenerator.cube"+o,s.texture.minFilter=v3d.LinearMipMapLinearFilter,s.texture.magFilter=v3d.LinearFilter,s.texture.generateMipmaps=!0,this.cubeLods.push(s),i=Math.max(16,i/2)}this.camera=new v3d.OrthographicCamera(-1,1,1,-1,0,1e3),this.shader=this.getShader(),this.shader.defines.SAMPLES_PER_LEVEL=this.samplesPerLevel,this.planeMesh=new v3d.Mesh(new v3d.PlaneBufferGeometry(2,2,0),this.shader),this.planeMesh.material.side=v3d.DoubleSide,this.scene=new v3d.Scene,this.scene.add(this.planeMesh),this.scene.add(this.camera),this.shader.uniforms.envMap.value=this.sourceTexture,this.shader.envMap=this.sourceTexture}(Ap.prototype=Object.create(t.prototype)).constructor=Ap,Object.defineProperties(Ap.prototype,{center:{get:function(){return console.warn("v3d.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("v3d.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("v3d.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("v3d.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("v3d.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("v3d.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("v3d.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("v3d.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("v3d.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("v3d.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(e){console.warn("v3d.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!e}}}),Mp.prototype={constructor:Mp,update:function(e){var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=we,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1,this.renderToCubeMapTarget(e,this.renderTarget),e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},renderToCubeMapTarget:function(e,t){this.shader.uniforms.invertU.value=this.invertU,this.shader.uniforms.offsetU.value=this.offsetU;for(var n=0;n<6;n++)this.renderToCubeMapTargetFace(e,t,n)},renderToCubeMapTargetFace:function(e,t,n){this.shader.uniforms.faceIndex.value=n,e.setRenderTarget(t,n),e.render(this.scene,this.camera)},dispose:function(){this.renderTarget.dispose(),this.planeMesh.geometry.dispose(),this.planeMesh.material.dispose()}},Tp.prototype={constructor:Tp,update:function(e){var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.gammaInput=!1,e.gammaOutput=!1,e.toneMapping=v3d.LinearToneMapping,e.toneMappingExposure=1,e.setRenderTarget(this.CubeUVRenderTarget),e.render(this.scene,this.camera),e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},getShader:function(){var e=new v3d.ShaderMaterial({uniforms:{faceIndex:{value:0},mapSize:{value:0},mipLevel:{value:0},envMap:{value:null},testColor:{value:new v3d.Vector3(1,1,1)}},vertexShader:"precision highp float; varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }",fragmentShader:"precision highp float; varying vec2 vUv; uniform samplerCube envMap; uniform float mapSize; uniform float mipLevel; uniform vec3 testColor; uniform int faceIndex; void uvApplyMipmapOffset(inout vec2 uv, float mipLevel, float mapSize) { /* convert mipmap levels [0, 5] to an empirical offset coefficient [1, 1.5] */ float offCoeff = mipLevel / 10.0 + 1.0; float offset = -offCoeff/mapSize;\n /* the same code as in PMREMGenerator for creating a border around the cube faces to avoid seams */ const float a = -1.0;\n const float b = 1.0;\n float c = -1.0 + offset;\n float d = 1.0 - offset;\n float bminusa = b - a;\n uv.x = (uv.x - a)/bminusa * d - (uv.x - b)/bminusa * c;\n uv.y = (uv.y - a)/bminusa * d - (uv.y - b)/bminusa * c;\n } vec3 faceUVToTexCubeCoords(int faceIndex, vec2 uv) { if (faceIndex == 0) { return vec3(1.0, uv.y, -uv.x); } else if (faceIndex == 1) { return vec3(uv.x, 1.0, uv.y); } else if (faceIndex == 2) { return vec3(uv.x, uv.y, 1.0); } else if (faceIndex == 3) { return vec3(-1.0, uv.y, uv.x); } else if (faceIndex == 4) { return vec3(uv.x, -1.0, -uv.y); } else { return vec3(-uv.x, uv.y, -1.0); } } void main() { vec3 sampleDirection; vec2 uv = vUv; uv = uv * 2.0 - 1.0; uv.y *= -1.0; uvApplyMipmapOffset(uv, mipLevel, mapSize); vec4 color; if (mapSize == 1.0) { /* single pixel mipmap levels have abrupt seams, let's average the cubemap color then*/ color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(0, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(1, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(2, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(3, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(4, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(5, uv))); color /= 6.0; } else { color = envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(faceIndex, uv))); } gl_FragColor = linearToOutputTexel(color); }",blending:v3d.NoBlending});return e.type="PMREMCubeUVPacker",e},dispose:function(){for(var e=0,t=this.objects.length;e<t;e++)this.objects[e].material.dispose();this.objects[0].geometry.dispose()}},Sp.prototype={constructor:Sp,update:function(e){this.shader.uniforms.envMap.value=this.sourceTexture,this.shader.envMap=this.sourceTexture;var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=v3d.LinearToneMapping,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1;for(var o=0;o<this.numLods;o++){var s=o/(this.numLods-1);this.shader.uniforms.roughness.value=.9*s,this.flipX&&(this.shader.uniforms.queryScale.value.x=0==o?-1:1);var l=this.cubeLods[o].width;this.shader.uniforms.mapSize.value=l,this.renderToCubeMapTarget(e,this.cubeLods[o]),o<5&&(this.shader.uniforms.envMap.value=this.cubeLods[o].texture)}e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},renderToCubeMapTarget:function(e,t){for(var n=0;n<6;n++)this.renderToCubeMapTargetFace(e,t,n)},renderToCubeMapTargetFace:function(e,t,n){this.shader.uniforms.faceIndex.value=n,e.setRenderTarget(t,n),e.clear(),e.render(this.scene,this.camera)},getShader:function(){var e=new v3d.ShaderMaterial({defines:{SAMPLES_PER_LEVEL:20},uniforms:{faceIndex:{value:0},roughness:{value:.5},mapSize:{value:.5},envMap:{value:null},queryScale:{value:new v3d.Vector3(1,1,1)},testColor:{value:new v3d.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"#include <common>\n varying vec2 vUv;\n uniform int faceIndex;\n uniform float roughness;\n uniform samplerCube envMap;\n uniform float mapSize;\n uniform vec3 testColor;\n uniform vec3 queryScale;\n \n float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\n float a = ggxRoughness + 0.0001;\n a *= a;\n return (2.0 / a - 2.0);\n }\n float randVanDerCorput(int n, int base) {\n float invBase = 1.0 / float(base);\n float result = 0.0;\n \n for (int i = 0; i < 32; ++i) {\n if (n > 0) {\n result += mod(float(n), 2.0) * invBase;\n invBase = invBase / 2.0;\n n = int(float(n) / 2.0);\n }\n }\n return result;\n }\n vec3 ImportanceSamplePhong(vec2 uv, mat3 vecSpace, float specPow) {\n float phi = uv.y * 2.0 * PI;\n float cosTheta = pow(1.0 - uv.x, 1.0 / (specPow + 1.0));\n float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n vec3 sampleDir = vec3(cos(phi) * sinTheta, sin(phi) * sinTheta, cosTheta);\n return vecSpace * sampleDir;\n }\n vec3 ImportanceSampleGGX(vec2 uv, mat3 vecSpace, float Roughness)\n {\n float a = Roughness * Roughness;\n float Phi = 2.0 * PI * uv.x;\n float CosTheta = sqrt((1.0 - uv.y) / (1.0 + (a*a - 1.0) * uv.y));\n float SinTheta = sqrt(abs(1.0 - CosTheta * CosTheta));\n return vecSpace * vec3(SinTheta * cos(Phi), SinTheta * sin(Phi), CosTheta);\n }\n mat3 matrixFromVector(vec3 n) {\n float a = 1.0 / (1.0 + n.z);\n float b = -n.x * n.y * a;\n vec3 b1 = vec3(1.0 - n.x * n.x * a, b, -n.x);\n vec3 b2 = vec3(b, 1.0 - n.y * n.y * a, -n.y);\n return mat3(b1, b2, n);\n }\n \n vec4 testColorMap(float Roughness) {\n vec4 color;\n if(faceIndex == 0)\n color = vec4(1.0,0.0,0.0,1.0);\n else if(faceIndex == 1)\n color = vec4(0.0,1.0,0.0,1.0);\n else if(faceIndex == 2)\n color = vec4(0.0,0.0,1.0,1.0);\n else if(faceIndex == 3)\n color = vec4(1.0,1.0,0.0,1.0);\n else if(faceIndex == 4)\n color = vec4(0.0,1.0,1.0,1.0);\n else\n color = vec4(1.0,0.0,1.0,1.0);\n color *= (1.0 - Roughness);\n return color;\n }\n void main() {\n vec3 sampleDirection;\n vec2 uv = vUv*2.0 - 1.0;\n float offset = -1.0/mapSize;\n const float a = -1.0;\n const float b = 1.0;\n float c = -1.0 + offset;\n float d = 1.0 - offset;\n float bminusa = b - a;\n uv.x = (uv.x - a)/bminusa * d - (uv.x - b)/bminusa * c;\n uv.y = (uv.y - a)/bminusa * d - (uv.y - b)/bminusa * c;\n if (faceIndex==0) {\n sampleDirection = vec3(1.0, -uv.y, -uv.x);\n } else if (faceIndex==1) {\n sampleDirection = vec3(-1.0, -uv.y, uv.x);\n } else if (faceIndex==2) {\n sampleDirection = vec3(uv.x, 1.0, uv.y);\n } else if (faceIndex==3) {\n sampleDirection = vec3(uv.x, -1.0, -uv.y);\n } else if (faceIndex==4) {\n sampleDirection = vec3(uv.x, -uv.y, 1.0);\n } else {\n sampleDirection = vec3(-uv.x, -uv.y, -1.0);\n }\n vec3 normal = normalize(sampleDirection * queryScale);\n mat3 vecSpace = matrixFromVector(normal);\n vec3 rgbColor = vec3(0.0);\n const int NumSamples = SAMPLES_PER_LEVEL;\n vec3 vect;\n float weight = 0.0;\n \n /**\n * several points from the Van der Corput sequence produce\n * spikes and make the result a bit ugly - practically these\n * are four points from the interval [0.9, 1], which are \n * also distributed evenly, let's just ignore them\n */\n float spikeInterval = exp2(floor(log2(float(NumSamples)))) / 4.0;\n \n for(int i = 0; i < NumSamples; i++) {\n if (mod(float(i) + 1.0, spikeInterval) == 0.0) continue;\n float r = randVanDerCorput(i, 2);\n vect = ImportanceSampleGGX(vec2(float(i) / float(NumSamples), r), vecSpace, roughness);\n vect = normalize(vect);\n \n /**\n * for roughness values above 0.5 don't use the dot formula, \n * just unity weights, because for this case there are\n * many sample directions that would have negative\n * weights when being calculated otherwise, thus \n * being discarded they wouldn't contribute to blurring \n * at all making it too insufficient for high roughness\n * levels\n */ \n if (roughness > 0.5) {\n vec3 color = envMapTexelToLinear(textureCube(envMap, vect)).rgb;\n rgbColor.rgb += color;\n weight += 1.0;\n } else {\n vec3 L = normalize(2.0 * dot(normal, vect) * vect - normal);\n float sampleWeight = max(dot(normal, L), 0.0);\n if (sampleWeight > 0.0) {\n vec3 color = envMapTexelToLinear(textureCube(envMap, vect)).rgb;\n rgbColor.rgb += color * sampleWeight;\n weight += sampleWeight;\n }\n }\n }\n rgbColor /= weight;\n gl_FragColor = linearToOutputTexel(vec4(rgbColor, 1.0));\n }",blending:v3d.NoBlending});return e.type="PMREMGenerator",e},dispose:function(){for(var e=0,t=this.cubeLods.length;e<t;e++)this.cubeLods[e].dispose();this.planeMesh.geometry.dispose(),this.planeMesh.material.dispose()}};var Lp,Cp=void 0!==Cp?Cp:{},Ep={};for(Lp in Cp)Cp.hasOwnProperty(Lp)&&(Ep[Lp]=Cp[Lp]);Cp.arguments=[],Cp.thisProgram="./this.program",Cp.quit=function(e,t){throw t},Cp.preRun=[];var Pp,Rp,Fp=Cp.postRun=[],Ip=!1;Fp="object"==typeof window,Pp="function"==typeof importScripts,Ip="object"==typeof process&&"function"==typeof require&&!Fp&&!Pp,Rp=!Fp&&!Ip&&!Pp;var Op,Np,Dp="";Ip?(Dp=__dirname+"/",Cp.read=function(e,t){var n;return(n=pf(e))||(Op||(Op=require("fs")),Np||(Np=require("path")),e=Np.normalize(e),n=Op.readFileSync(e)),t?n:n.toString()},Cp.readBinary=function(e){var t=Cp.read(e,!0);return t.buffer||(t=new Uint8Array(t)),kp(t.buffer),t},1<process.argv.length&&(Cp.thisProgram=process.argv[1].replace(/\\/g,"/")),Cp.arguments=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Cp),process.on("uncaughtException",function(e){if(!(e instanceof Mf))throw e}),process.on("unhandledRejection",Sf),Cp.quit=function(e){process.exit(e)},Cp.inspect=function(){return"[Emscripten Module object]"}):Rp?("undefined"!=typeof read&&(Cp.read=function(e){var t=pf(e);return t?hf(t):read(e)}),Cp.readBinary=function(e){var t;return(t=pf(e))?t:"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(kp("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?Cp.arguments=scriptArgs:void 0!==arguments&&(Cp.arguments=arguments),"function"==typeof quit&&(Cp.quit=function(e){quit(e)})):(Fp||Pp)&&(Pp?Dp=self.location.href:document.currentScript&&(Dp=document.currentScript.src),Dp=0!==Dp.indexOf("blob:")?Dp.substr(0,Dp.lastIndexOf("/")+1):"",Cp.read=function(t){try{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText}catch(e){var n=pf(t);if(n)return hf(n);throw e}},Pp&&(Cp.readBinary=function(t){try{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}catch(e){var n=pf(t);if(n)return n;throw e}}),Cp.readAsync=function(t,n,r){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){if(200==i.status||0==i.status&&i.response)n(i.response);else{var e=pf(t);e?n(e.buffer):r()}},i.onerror=r,i.send(null)},Cp.setWindowTitle=function(e){document.title=e});var Up=Cp.print||("undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null),Bp=Cp.printErr||("undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||Up);for(Lp in Ep)Ep.hasOwnProperty(Lp)&&(Cp[Lp]=Ep[Lp]);Ep=void 0;var zp=0,Gp=!1;function kp(e,t){e||Sf("Assertion failed: "+t)}function Vp(e){var t=Cp["_"+e];return kp(t,"Cannot call unknown function "+e+", make sure it is exported"),t}function jp(e,t,n,r,i){var a={string:function(e){var t=0;if(null!=e&&0!==e){var n=1+(e.length<<2);t=vf(n),function(e,t,n,r){if(!(0<r))return;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(55296<=s&&s<=57343){var l=e.charCodeAt(++o);s=65536+((1023&s)<<10)|1023&l}if(s<=127){if(a<=n)break;t[n++]=s}else if(s<=2047){if(a<=n+1)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(a<=n+2)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(a<=n+3)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}t[n]=0}(e,Yp,t,n)}return t},array:function(e){var t,n,r=vf(e.length);return t=e,n=r,Hp.set(t,n),r}};var o=Vp(e),s=[],l=0;if(r)for(var c=0;c<r.length;c++){var u=a[n[c]];s[c]=u?(0===l&&(l=yf()),u(r[c])):r[c]}var h,d,p,f=o.apply(null,s);return h=f,f="string"===t?(d=h)?function(e,t,n){for(var r=t+n,i=t;e[i]&&!(r<=i);)++i;if(16<i-t&&e.subarray&&Wp)return Wp.decode(e.subarray(t,i));for(var a="";t<i;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var l=63&e[t++];if((o=224==(240&o)?(15&o)<<12|s<<6|l:(7&o)<<18|s<<12|l<<6|63&e[t++])<65536)a+=String.fromCharCode(o);else{var c=o-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}(Yp,d,p):"":"boolean"===t?Boolean(h):h,0!==l&&gf(l),f}var Wp="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;var Xp,Hp,Yp,qp;"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var Qp=Cp.TOTAL_MEMORY||16777216;function Zp(e){for(;0<e.length;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?Cp.dynCall_v(n):Cp.dynCall_vi(n,t.arg):n(void 0===t.arg?null:t.arg)}else t()}}Qp<5242880&&Bp("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+Qp+"! (TOTAL_STACK=5242880)"),Xp=Cp.buffer?Cp.buffer:new ArrayBuffer(Qp),Cp.HEAP8=Hp=new Int8Array(Xp),Cp.HEAP16=new Int16Array(Xp),Cp.HEAP32=qp=new Int32Array(Xp),Cp.HEAPU8=Yp=new Uint8Array(Xp),Cp.HEAPU16=new Uint16Array(Xp),Cp.HEAPU32=new Uint32Array(Xp),Cp.HEAPF32=new Float32Array(Xp),Cp.HEAPF64=new Float64Array(Xp),qp[263060]=6295376;var Kp=[],Jp=[],$p=[],ef=[],tf=!1;var nf=0,rf=null,af=null;Cp.preloadedImages={},Cp.preloadedAudios={};var of=null,sf="data:application/octet-stream;base64,";function lf(e){return String.prototype.startsWith?e.startsWith(sf):0===e.indexOf(sf)}function cf(e){Sf("OOM")}var uf=!(of="data:application/octet-stream;base64,/Td6WFoAAAQEBAgICBAQECAgIEBAQFla");function hf(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];255<r&&(uf&&kp(!1,"Character code "+r+" ("+String.fromCharCode(r)+") at offset "+n+" not in 0x00-0xFF."),r&=255),t.push(String.fromCharCode(r))}return t.join("")}var df="function"==typeof atob?atob:function(e){var t,n,r,i,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");t=s.indexOf(e.charAt(c++))<<2|(i=s.indexOf(e.charAt(c++)))>>4,n=(15&i)<<4|(a=s.indexOf(e.charAt(c++)))>>2,r=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(n)),64!==o&&(l+=String.fromCharCode(r)),c<e.length;);return l};function pf(e){if(lf(e))return function(t){if("boolean"==typeof Ip&&Ip){var n;try{n=Buffer.from(t,"base64")}catch(e){n=new Buffer(t,"base64")}return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}try{for(var e=df(t),r=new Uint8Array(e.length),i=0;i<e.length;++i)r[i]=e.charCodeAt(i);return r}catch(e){throw new Error("Converting base64 string to bytes failed.")}}(e.slice(sf.length))}var ff,mf=function(e,t,n){"use asm";var H=new e.Int8Array(n),z=new e.Int16Array(n),Y=new e.Int32Array(n),q=new e.Uint8Array(n),O=new e.Uint16Array(n),r=t.i|0,i=t.j|0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0.0,N=e.Math.imul,p=t.a,f=t.b,Q=t.c,m=t.d,v=t.e,g=t.f,y=t.g,x=t.h,w=1052496,_=6295376,b=0.0;function A(e){e=e|0;var t=0;t=w;w=w+e|0;w=w+15&-16;return t|0}function M(){return w|0}function T(e){e=e|0;w=e}function S(e,t){e=e|0;t=t|0;w=e;_=t}function L(){var e=0,t=0,n=0;e=0;do{t=e>>>1;n=(0-(e&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;n=(0-(n&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;n=(0-(n&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;Y[2088+(e<<2)>>2]=0-(t&1)&-306674912^(0-(n&1)&-306674912^t)>>>1;e=e+1|0}while((e|0)!=256);return}function Z(e,t,n){e=e|0;t=t|0;n=n|0;n=~n;if(!t){t=n;t=~t;return t|0}while(1){n=Y[2088+((n&255^(q[e>>0]|0))<<2)>>2]^n>>>8;t=t+-1|0;if(!t)break;else e=e+1|0}t=~n;return t|0}function C(){var e=0,t=0,n=0,r=0,i=0;e=0;do{i=se(e|0,0,1)|0;r=Q()|0;n=ue(0,0,e&1|0,0)|0;r=se(n&-679014590^i|0,(Q()|0)&-915646571^r|0,1)|0;n=Q()|0;i=ue(0,0,i&1|0,0)|0;n=se(i&-679014590^r|0,(Q()|0)&-915646571^n|0,1)|0;i=Q()|0;r=ue(0,0,r&1|0,0)|0;i=se(r&-679014590^n|0,(Q()|0)&-915646571^i|0,1)|0;r=Q()|0;n=ue(0,0,n&1|0,0)|0;r=se(n&-679014590^i|0,(Q()|0)&-915646571^r|0,1)|0;n=Q()|0;i=ue(0,0,i&1|0,0)|0;n=se(i&-679014590^r|0,(Q()|0)&-915646571^n|0,1)|0;i=Q()|0;r=ue(0,0,r&1|0,0)|0;i=se(r&-679014590^n|0,(Q()|0)&-915646571^i|0,1)|0;r=Q()|0;n=ue(0,0,n&1|0,0)|0;r=se(n&-679014590^i|0,(Q()|0)&-915646571^r|0,1)|0;n=Q()|0;i=ue(0,0,i&1|0,0)|0;n=(Q()|0)&-915646571^n;t=40+(e<<3)|0;Y[t>>2]=i&-679014590^r;Y[t+4>>2]=n;e=e+1|0}while((e|0)!=256);return}function K(e,t,n,r){e=e|0;t=t|0;n=n|0;r=r|0;var i=0,a=0;i=~n;n=~r;if(!t){e=i;t=n;e=~e;t=~t;f(t|0);return e|0}while(1){r=40+((i&255^(q[e>>0]|0))<<3)|0;a=Y[r>>2]|0;r=Y[r+4>>2]|0;i=se(i|0,n|0,8)|0;i=a^i;n=r^(Q()|0);t=t+-1|0;if(!t)break;else e=e+1|0}a=~i;e=~n;f(e|0);return a|0}function E(e,t){e=e|0;t=t|0;var n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,L=0,C=0,E=0,P=0,R=0,F=0,I=0,O=0,N=0,D=0,U=0,B=0,z=0,G=0,k=0,V=0,j=0,W=0,X=0;j=e+36|0;if(!(Y[j>>2]|0)){Y[e>>2]=0;H[e+40>>0]=0;a=e+4|0;Y[a>>2]=0;o=e+24|0;i=o;Y[i>>2]=0;Y[i+4>>2]=0;i=e+172|0;n=e+72|0;r=n+100|0;do{Y[n>>2]=0;n=n+4|0}while((n|0)<(r|0));Y[i>>2]=12;n=0}else{n=Y[e>>2]|0;i=e+172|0;a=e+4|0;o=e+24|0}U=t+4|0;B=Y[U>>2]|0;z=t+16|0;G=Y[z>>2]|0;T=e+16|0;Y[T>>2]=B;D=t+8|0;L=e+168|0;C=e+176|0;E=e+182|0;P=e+184|0;R=e+185|0;F=e+186|0;d=e+187|0;I=e+183|0;O=e+32|0;p=e+64|0;N=e+177|0;f=e+48|0;A=e+8|0;m=e+56|0;v=e+1200|0;g=e+72|0;y=e+20|0;x=e+80|0;S=e+96|0;_=e+104|0;b=e+112|0;M=e+88|0;w=t+12|0;e:while(1){switch(n|0){case 6:{V=79;break e}case 7:{V=94;break e}case 8:{V=101;break e}case 9:{V=106;break e}case 0:{h=Y[U>>2]|0;l=(Y[D>>2]|0)-h|0;c=Y[L>>2]|0;u=(Y[i>>2]|0)-c|0;u=l>>>0<u>>>0?l:u;he(e+176+c|0,(Y[t>>2]|0)+h|0,u|0)|0;Y[U>>2]=(Y[U>>2]|0)+u;u=(Y[L>>2]|0)+u|0;h=(u|0)==(Y[i>>2]|0);Y[L>>2]=h?0:u;if(!h){n=0;break e}Y[e>>2]=1;if(oe(C,8,6)|0){n=5;break e}if((Z(E,2,0)|0)!=(q[R>>0]<<8|q[P>>0]|q[F>>0]<<16|q[d>>0]<<24|0)){n=7;break e}if(H[E>>0]|0){n=6;break e}n=H[I>>0]|0;Y[O>>2]=n&255;if((n&255)>15){n=6;break e}switch(n<<24>>24){case 0:case 1:case 4:{V=13;break}default:{n=2;break e}}break}case 1:{V=13;break}case 2:{r=Y[t>>2]|0;n=Y[D>>2]|0;s=Y[L>>2]|0;l=Y[i>>2]|0;V=17;break}case 3:{V=45;break}case 4:{V=57;break}case 5:{V=63;break}default:{V=125;break e}}do{if((V|0)==13){V=0;n=Y[U>>2]|0;l=Y[D>>2]|0;if((n|0)==(l|0)){n=0;break e}r=Y[t>>2]|0;s=H[r+n>>0]|0;if(!(s<<24>>24)){Y[U>>2]=n+1;Y[T>>2]=n;n=6;break}else{V=((s&255)<<2)+4|0;Y[p>>2]=V;Y[i>>2]=V;Y[L>>2]=0;Y[e>>2]=2;n=l;s=0;l=V;V=17;break}}}while(0);if((V|0)==17){V=0;h=Y[U>>2]|0;u=n-h|0;n=l-s|0;n=u>>>0<n>>>0?u:n;he(e+176+s|0,r+h|0,n|0)|0;Y[U>>2]=n+(Y[U>>2]|0);n=(Y[L>>2]|0)+n|0;h=(n|0)==(Y[i>>2]|0);Y[L>>2]=h?0:n;if(!h){n=0;break}c=n+-4|0;Y[i>>2]=c;c=Z(C,c,0)|0;h=Y[i>>2]|0;u=e+176+h|0;if((c|0)!=(q[u+1>>0]<<8|q[u>>0]|q[u+2>>0]<<16|q[u+3>>0]<<24|0)){n=7;break}Y[L>>2]=2;u=H[N>>0]|0;n=u&255;if(n&63|0){n=6;break}if(!(n&64)){s=-1;n=-1;l=2}else{n=Y[a>>2]|0;if(!n){l=A;Y[l>>2]=0;Y[l+4>>2]=0;l=2;n=0}else l=2;while(1){if(l>>>0>=h>>>0){n=7;break e}r=H[e+176+l>>0]|0;l=l+1|0;Y[L>>2]=l;W=r&255;s=le(W&127|0,0,n|0)|0;X=Q()|0;c=A;s=s|Y[c>>2];c=X|Y[c+4>>2];X=A;Y[X>>2]=s;Y[X+4>>2]=c;if(!(W&128))break;n=n+7|0;Y[a>>2]=n;if((n|0)==63){n=7;break e}}if(!((n|0)==0|r<<24>>24!=0)){n=7;break}Y[a>>2]=0;n=c}X=f;Y[X>>2]=s;Y[X+4>>2]=n;if(u<<24>>24<0){n=Y[a>>2]|0;if(!n){n=A;Y[n>>2]=0;Y[n+4>>2]=0;n=0}while(1){if(l>>>0>=h>>>0){n=7;break e}r=H[e+176+l>>0]|0;l=l+1|0;Y[L>>2]=l;X=r&255;s=le(X&127|0,0,n|0)|0;W=Q()|0;c=A;s=s|Y[c>>2];c=W|Y[c+4>>2];W=A;Y[W>>2]=s;Y[W+4>>2]=c;if(!(X&128))break;n=n+7|0;Y[a>>2]=n;if((n|0)==63){n=7;break e}}if(!((n|0)==0|r<<24>>24!=0)){n=7;break}Y[a>>2]=0;n=c}else{s=-1;n=-1}X=m;Y[X>>2]=s;Y[X+4>>2]=n;if((h-l|0)>>>0<2){n=7;break}n=l+1|0;Y[L>>2]=n;if((H[e+176+l>>0]|0)!=33){n=6;break}r=l+2|0;Y[L>>2]=r;if((H[e+176+n>>0]|0)!=1){n=6;break}if((h|0)==(r|0)){n=7;break}n=Y[v>>2]|0;Y[L>>2]=l+3;n=$(n,H[e+176+r>>0]|0)|0;if(n|0)break;n=Y[i>>2]|0;r=Y[L>>2]|0;while(1){if(r>>>0>=n>>>0)break;X=r;r=r+1|0;Y[L>>2]=r;if(H[e+176+X>>0]|0){n=6;break e}}Y[L>>2]=0;Y[g>>2]=0;Y[g+4>>2]=0;Y[g+8>>2]=0;Y[g+12>>2]=0;Y[e>>2]=3;V=45}if((V|0)==45){V=0;Y[T>>2]=Y[U>>2];Y[y>>2]=Y[z>>2];n=J(Y[v>>2]|0,t)|0;W=g;W=ce(Y[W>>2]|0,Y[W+4>>2]|0,(Y[U>>2]|0)-(Y[T>>2]|0)|0,0)|0;u=Q()|0;r=g;Y[r>>2]=W;Y[r+4>>2]=u;r=Y[y>>2]|0;s=(Y[z>>2]|0)-r|0;l=x;l=ce(Y[l>>2]|0,Y[l+4>>2]|0,s|0,0)|0;c=Q()|0;X=x;Y[X>>2]=l;Y[X+4>>2]=c;X=f;h=Y[X+4>>2]|0;if(u>>>0>h>>>0|((u|0)==(h|0)?W>>>0>(Y[X>>2]|0)>>>0:0)){n=7;break}X=m;W=Y[X+4>>2]|0;if(c>>>0>W>>>0|((c|0)==(W|0)?l>>>0>(Y[X>>2]|0)>>>0:0)){n=7;break}switch(Y[O>>2]|0){case 1:{r=Z((Y[w>>2]|0)+r|0,s,Y[o>>2]|0)|0;s=0;V=50;break}case 4:{V=o;r=K((Y[w>>2]|0)+r|0,s,Y[V>>2]|0,Y[V+4>>2]|0)|0;s=Q()|0;V=50;break}default:{}}if((V|0)==50){V=0;X=o;Y[X>>2]=r;Y[X+4>>2]=s}if((n|0)!=1)break;r=f;n=Y[r>>2]|0;r=Y[r+4>>2]|0;if(!((n|0)==-1&(r|0)==-1)?(X=g,!((n|0)==(Y[X>>2]|0)?(r|0)==(Y[X+4>>2]|0):0)):0){n=7;break}n=m;r=Y[n>>2]|0;n=Y[n+4>>2]|0;l=x;s=Y[l>>2]|0;l=Y[l+4>>2]|0;if(!((r|0)==-1&(n|0)==-1)){if(!((r|0)==(s|0)&(n|0)==(l|0))){n=7;break}}else{r=s;n=l}V=g;V=ce(Y[V>>2]|0,Y[V+4>>2]|0,Y[p>>2]|0,0)|0;W=Q()|0;X=S;X=ce(V|0,W|0,Y[X>>2]|0,Y[X+4>>2]|0)|0;W=Q()|0;W=ce(X|0,W|0,q[14+(Y[O>>2]|0)>>0]|0,0)|0;X=Q()|0;V=S;Y[V>>2]=W;Y[V+4>>2]=X;V=_;V=ce(Y[V>>2]|0,Y[V+4>>2]|0,r|0,n|0)|0;X=Q()|0;W=_;Y[W>>2]=V;Y[W+4>>2]=X;Y[b>>2]=Z(S,24,Y[b>>2]|0)|0;W=M;W=ce(Y[W>>2]|0,Y[W+4>>2]|0,1,0)|0;X=Q()|0;V=M;Y[V>>2]=W;Y[V+4>>2]=X;Y[e>>2]=4;V=57}if((V|0)==57){V=0;r=g;n=Y[r>>2]|0;if(!((n&3|0)==0&0==0)){s=Y[D>>2]|0;l=Y[U>>2]|0;r=Y[r+4>>2]|0;do{if((l|0)==(s|0)){n=0;break e}W=Y[t>>2]|0;X=l;l=l+1|0;Y[U>>2]=l;if(H[W+X>>0]|0){n=7;break e}n=ce(n|0,r|0,1,0)|0;r=Q()|0;X=g;Y[X>>2]=n;Y[X+4>>2]=r}while(!((n&3|0)==0&0==0))}Y[e>>2]=5;V=63}t:do{if((V|0)==63){V=0;n=Y[O>>2]|0;switch(n|0){case 1:{n=Y[D>>2]|0;r=Y[U>>2]|0;do{if((r|0)==(n|0)){n=0;break e}X=o;s=Y[a>>2]|0;X=se(Y[X>>2]|0,Y[X+4>>2]|0,s|0)|0;Q()|0;h=Y[t>>2]|0;W=r;r=r+1|0;Y[U>>2]=r;if((H[h+W>>0]|0)!=(X&255)<<24>>24){n=7;break e}X=s+8|0;Y[a>>2]=X}while(X>>>0<32);n=o;Y[n>>2]=0;Y[n+4>>2]=0;Y[a>>2]=0;n=1;break t}case 4:{n=Y[D>>2]|0;r=Y[U>>2]|0;do{if((r|0)==(n|0)){n=0;break e}X=o;s=Y[a>>2]|0;X=se(Y[X>>2]|0,Y[X+4>>2]|0,s|0)|0;Q()|0;h=Y[t>>2]|0;W=r;r=r+1|0;Y[U>>2]=r;if((H[h+W>>0]|0)!=(X&255)<<24>>24){n=7;break e}X=s+8|0;Y[a>>2]=X}while(X>>>0<64);n=o;Y[n>>2]=0;Y[n+4>>2]=0;Y[a>>2]=0;n=1;break t}default:{r=Y[a>>2]|0;s=q[14+n>>0]|0;if(r>>>0<s>>>0){l=Y[D>>2]|0;c=Y[U>>2]|0;n=r;do{if((c|0)==(l|0)){n=0;break e}c=c+1|0;Y[U>>2]=c;n=n+1|0;Y[a>>2]=n}while(n>>>0<s>>>0)}Y[a>>2]=0;n=1;break t}}}}while(0);Y[e>>2]=n}e:do{if((V|0)==79){d=e+120|0;p=e+136|0;f=e+144|0;m=e+144|0;v=e+152|0;g=e+160|0;t:while(1){u=Y[t>>2]|0;l=Y[D>>2]|0;if(!(Y[a>>2]|0)){X=A;Y[X>>2]=0;Y[X+4>>2]=0}while(1){r=Y[U>>2]|0;if(r>>>0>=l>>>0){n=0;V=86;break t}c=H[u+r>>0]|0;r=r+1|0;Y[U>>2]=r;X=c&255;n=Y[a>>2]|0;s=le(X&127|0,0,n|0)|0;W=Q()|0;h=A;s=s|Y[h>>2];h=W|Y[h+4>>2];W=A;Y[W>>2]=s;Y[W+4>>2]=h;if(!(X&128))break;X=n+7|0;Y[a>>2]=X;if((X|0)==63){n=7;V=86;break t}}if(!(c<<24>>24!=0|(n|0)==0)){n=7;V=86;break}Y[a>>2]=0;switch(Y[d>>2]|0){case 0:{X=p;Y[X>>2]=s;Y[X+4>>2]=h;X=M;if((s|0)==(Y[X>>2]|0)?(h|0)==(Y[X+4>>2]|0):0){n=1;V=91}else{n=7;break e}break}case 1:{n=2;l=f;r=h;V=90;break}case 2:{l=v;s=ce(Y[l>>2]|0,Y[l+4>>2]|0,s|0,h|0)|0;l=Q()|0;n=v;Y[n>>2]=s;Y[n+4>>2]=l;Y[g>>2]=Z(m,24,Y[g>>2]|0)|0;n=1;l=p;s=-1;r=-1;V=90;break}default:{}}if((V|0)==90){w=l;w=ce(Y[w>>2]|0,Y[w+4>>2]|0,s|0,r|0)|0;W=Q()|0;X=l;Y[X>>2]=w;Y[X+4>>2]=W;V=91}if((V|0)==91){V=0;Y[d>>2]=n}X=p;if((Y[X>>2]|0)==0&(Y[X+4>>2]|0)==0){V=93;break}}if((V|0)==86){k=Y[T>>2]|0;W=r-k|0;X=e+128|0;N=X;N=ce(Y[N>>2]|0,Y[N+4>>2]|0,W|0,0)|0;t=Q()|0;Y[X>>2]=N;Y[X+4>>2]=t;X=o;Y[X>>2]=Z(u+k|0,W,Y[o>>2]|0)|0;Y[X+4>>2]=0;break}else if((V|0)==93){Y[e>>2]=7;V=94;break}}else if((V|0)==106){s=Y[U>>2]|0;r=Y[D>>2]|0;a=Y[i>>2]|0;n=Y[t>>2]|0;V=107}else if((V|0)==125)while(1)V=125}while(0);e:do{if((V|0)==94){h=e+128|0;p=h;d=Y[p>>2]|0;p=Y[p+4>>2]|0;s=Y[T>>2]|0;n=Y[U>>2]|0;while(1){l=n-s|0;c=ce(d|0,p|0,l|0,0)|0;u=Q()|0;if((c&3|0)==0&0==0)break;r=Y[t>>2]|0;if((n|0)==(Y[D>>2]|0)){V=97;break}X=n;n=n+1|0;Y[U>>2]=n;if(H[r+X>>0]|0){n=7;break e}}if((V|0)==97){n=h;Y[n>>2]=c;Y[n+4>>2]=u;n=o;Y[n>>2]=Z(r+s|0,l,Y[o>>2]|0)|0;Y[n+4>>2]=0;n=0;break}W=Y[t>>2]|0;X=h;Y[X>>2]=c;Y[X+4>>2]=u;X=o;Y[X>>2]=Z(W+s|0,l,Y[o>>2]|0)|0;Y[X+4>>2]=0;if(!(oe(S,e+144|0,24)|0)){Y[e>>2]=8;V=101}else n=7}}while(0);e:do{if((V|0)==101){r=Y[D>>2]|0;s=Y[U>>2]|0;do{if((s|0)==(r|0)){n=0;break e}X=o;l=Y[a>>2]|0;X=se(Y[X>>2]|0,Y[X+4>>2]|0,l|0)|0;Q()|0;n=Y[t>>2]|0;W=s;s=s+1|0;Y[U>>2]=s;if((H[n+W>>0]|0)!=(X&255)<<24>>24){n=7;break e}X=l+8|0;Y[a>>2]=X}while(X>>>0<32);V=o;Y[V>>2]=0;Y[V+4>>2]=0;Y[a>>2]=0;Y[i>>2]=12;Y[e>>2]=9;a=12;V=107}}while(0);if((V|0)==107){V=r-s|0;X=Y[L>>2]|0;W=a-X|0;W=V>>>0<W>>>0?V:W;he(e+176+X|0,n+s|0,W|0)|0;Y[U>>2]=W+(Y[U>>2]|0);W=(Y[L>>2]|0)+W|0;X=(W|0)==(Y[i>>2]|0);Y[L>>2]=X?0:W;if(X){if((((oe(F,30,2)|0)==0?(k=e+180|0,X=Z(k,6,0)|0,(X|0)==(q[N>>0]<<8|q[C>>0]|q[e+178>>0]<<16|q[e+179>>0]<<24|0)):0)?(X=e+128|0,X=se(Y[X>>2]|0,Y[X+4>>2]|0,2)|0,W=Q()|0,(W|0)==0?(X|0)==(q[e+181>>0]<<8|q[k>>0]|q[E>>0]<<16|q[I>>0]<<24|0):0):0)?(H[P>>0]|0)==0:0)n=(Y[O>>2]|0)==(q[R>>0]|0)?1:7;else n=7}else n=0}r=(n|0)==0;if(!(Y[j>>2]|0)){if(!r){if((n|0)==1){X=1;return X|0}}else n=(Y[U>>2]|0)==(Y[D>>2]|0)?7:8;Y[U>>2]=B;Y[z>>2]=G;X=n;return X|0}else{if(r){if((B|0)==(Y[U>>2]|0)?(G|0)==(Y[z>>2]|0):0){n=(H[e+40>>0]|0)==0?0:8;r=1}else{n=0;r=0}}else r=0;H[e+40>>0]=r;X=n;return X|0}return 0}function P(e,t){e=e|0;t=t|0;var n=0,r=0;r=re(1208)|0;if(!r){r=0;return r|0}Y[r+36>>2]=e;n=F(e,t)|0;Y[r+1200>>2]=n;if(!n){ie(r);r=0;return r|0}else{Y[r>>2]=0;H[r+40>>0]=0;Y[r+4>>2]=0;e=r+24|0;Y[e>>2]=0;Y[e+4>>2]=0;e=r+172|0;t=r+72|0;n=t+100|0;do{Y[t>>2]=0;t=t+4|0}while((t|0)<(n|0));Y[e>>2]=12;return r|0}return 0}function R(e){e=e|0;if(!e)return;I(Y[e+1200>>2]|0);ie(e);return}function J(e,t){e=e|0;t=t|0;var n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,L=0,C=0,E=0,P=0,R=0,F=0,I=0,O=0,N=0,D=0,U=0,B=0;g=t+4|0;C=t+8|0;R=e+64|0;F=e+81|0;I=e+80|0;O=e+60|0;N=t+12|0;D=t+16|0;s=e+24|0;l=t+20|0;c=e+44|0;u=e+28|0;h=e+72|0;d=e+68|0;p=e+84|0;f=e+4|0;m=e+8|0;v=e+76|0;y=e+116|0;x=e+112|0;_=e+108|0;b=e+32|0;w=e+40|0;A=e+28388|0;M=e+28392|0;T=e+20|0;S=e+12|0;L=e+16|0;E=e+104|0;P=e+36|0;e:while(1){i=Y[g>>2]|0;r=Y[C>>2]|0;n=Y[R>>2]|0;t:do{if(i>>>0>=r>>>0){if((n|0)==7)U=5;else{n=0;U=86;break e}}else{switch(n|0){case 7:{U=5;break t}case 0:{n=Y[t>>2]|0;Y[g>>2]=i+1;n=H[n+i>>0]|0;r=n&255;if(!(n<<24>>24)){n=1;U=86;break e}if(!((n&255)>223|n<<24>>24==1)){if(H[I>>0]|0){n=7;U=86;break e}}else{H[F>>0]=1;H[I>>0]=0;if(!(Y[O>>2]|0)){o=Y[D>>2]|0;Y[s>>2]=(Y[N>>2]|0)+o;Y[c>>2]=(Y[l>>2]|0)-o}Y[u>>2]=0;Y[u+4>>2]=0;Y[u+8>>2]=0;Y[u+12>>2]=0}if(n<<24>>24>=0){if((n&255)>2){n=7;U=86;break e}Y[R>>2]=3;Y[d>>2]=8;continue e}Y[h>>2]=r<<16&2031616;Y[R>>2]=1;if((n&255)>191){H[F>>0]=0;Y[d>>2]=5;continue e}if(H[F>>0]|0){n=7;U=86;break e}Y[d>>2]=6;if((n&255)<=159)continue e;Y[p>>2]=0;Y[p+4>>2]=0;Y[p+8>>2]=0;Y[p+12>>2]=0;Y[p+16>>2]=0;n=0;do{z[e+120+(n<<1)>>1]=1024;n=n+1|0}while((n|0)!=14134);Y[e>>2]=-1;Y[f>>2]=0;Y[m>>2]=5;continue e}case 1:{o=Y[t>>2]|0;Y[g>>2]=i+1;Y[h>>2]=(q[o+i>>0]<<8)+(Y[h>>2]|0);Y[R>>2]=2;continue e}case 2:{o=Y[t>>2]|0;Y[g>>2]=i+1;Y[h>>2]=(q[o+i>>0]|0)+1+(Y[h>>2]|0);Y[R>>2]=3;continue e}case 3:{o=Y[t>>2]|0;Y[g>>2]=i+1;Y[v>>2]=q[o+i>>0]<<8;Y[R>>2]=4;continue e}case 4:{o=Y[t>>2]|0;Y[g>>2]=i+1;Y[v>>2]=(q[o+i>>0]|0)+1+(Y[v>>2]|0);Y[R>>2]=Y[d>>2];continue e}case 5:{n=Y[t>>2]|0;Y[g>>2]=i+1;n=H[n+i>>0]|0;if((n&255)>224){n=7;U=86;break e}if((n&255)>44){n=n+-45<<24>>24;r=(n&255)/45|0;n=(r*211|0)+n<<24>>24;r=r+1&255}else r=0;Y[y>>2]=(1<<r)+-1;Y[x>>2]=0;r=n&255;if((n&255)>8){n=0;do{o=r+247|0;n=n+1|0;r=o&255}while((o&255)>8);Y[x>>2]=n}else n=0;Y[_>>2]=r;if((r+n|0)>>>0>4){n=7;U=86;break e}Y[x>>2]=(1<<n)+-1;Y[p>>2]=0;Y[p+4>>2]=0;Y[p+8>>2]=0;Y[p+12>>2]=0;Y[p+16>>2]=0;n=0;do{z[e+120+(n<<1)>>1]=1024;n=n+1|0}while((n|0)!=14134);Y[e>>2]=-1;Y[f>>2]=0;Y[m>>2]=5;Y[R>>2]=6;break}case 6:break;case 8:{n=Y[v>>2]|0;n:do{if(n|0){if(r>>>0>i>>>0)o=i;else{n=0;U=86;break e}while(1){i=Y[D>>2]|0;a=Y[l>>2]|0;if(a>>>0<=i>>>0){n=0;U=86;break e}o=(r-o|0)>>>0<(a-i|0)>>>0;r=(o?r:a)-(Y[(o?g:D)>>2]|0)|0;o=Y[b>>2]|0;a=(Y[c>>2]|0)-o|0;r=r>>>0>a>>>0?a:r;r=r>>>0>n>>>0?n:r;Y[v>>2]=n-r;he((Y[s>>2]|0)+o|0,(Y[t>>2]|0)+(Y[g>>2]|0)|0,r|0)|0;n=(Y[b>>2]|0)+r|0;Y[b>>2]=n;if((Y[P>>2]|0)>>>0<n>>>0)Y[P>>2]=n;if(Y[O>>2]|0){if((n|0)==(Y[c>>2]|0))Y[b>>2]=0;he((Y[N>>2]|0)+(Y[D>>2]|0)|0,(Y[t>>2]|0)+(Y[g>>2]|0)|0,r|0)|0;n=Y[b>>2]|0}Y[u>>2]=n;Y[D>>2]=(Y[D>>2]|0)+r;o=(Y[g>>2]|0)+r|0;Y[g>>2]=o;n=Y[v>>2]|0;if(!n)break n;r=Y[C>>2]|0;if(r>>>0<=o>>>0){n=0;U=86;break e}}}}while(0);Y[R>>2]=0;continue e}default:continue e}a=Y[v>>2]|0;if(a>>>0<5){n=7;U=86;break e}n=Y[m>>2]|0;if(!n){r=Y[C>>2]|0;i=Y[g>>2]|0;n=a}else{r=Y[C>>2]|0;i=Y[g>>2]|0;do{if((i|0)==(r|0)){n=0;U=86;break e}B=Y[f>>2]<<8;a=Y[t>>2]|0;o=i;i=i+1|0;Y[g>>2]=i;Y[f>>2]=B|q[a+o>>0];n=n+-1|0;Y[m>>2]=n}while((n|0)!=0);n=Y[v>>2]|0}a=n+-5|0;Y[v>>2]=a;Y[R>>2]=7;n=i}}while(0);if((U|0)==5){n=i;a=Y[v>>2]|0}i=(Y[l>>2]|0)-(Y[D>>2]|0)|0;o=Y[h>>2]|0;o=i>>>0<o>>>0?i:o;i=Y[c>>2]|0;B=Y[b>>2]|0;Y[w>>2]=(i-B|0)>>>0>o>>>0?B+o|0:i;i=r-n|0;o=Y[A>>2]|0;if(!o){if(!a){r=0;U=46}else U=56}else{r=a;U=46}t:do{if((U|0)==46){U=0;B=42-o|0;r=r-o|0;r=B>>>0>r>>>0?r:B;i=r>>>0>i>>>0?i:r;he(e+28392+o|0,(Y[t>>2]|0)+n|0,i|0)|0;n=Y[A>>2]|0;r=i+n|0;do{if((r|0)!=(Y[v>>2]|0)){if(r>>>0<21){Y[A>>2]=r;Y[g>>2]=(Y[g>>2]|0)+i;break t}else{n=r+-21|0;break}}else{pe(e+28392+n+i|0,0,63-n-i|0)|0;n=(Y[A>>2]|0)+i|0}}while(0);Y[T>>2]=n;Y[S>>2]=M;Y[L>>2]=0;if(!(G(e)|0)){n=7;U=86;break e}n=Y[L>>2]|0;r=Y[A>>2]|0;if(n>>>0>(r+i|0)>>>0){n=7;U=86;break e}i=(Y[v>>2]|0)-n|0;Y[v>>2]=i;if(r>>>0>n>>>0){B=r-n|0;Y[A>>2]=B;de(M|0,e+28392+n|0,B|0)|0;break}else{n=(Y[g>>2]|0)+(n-r)|0;Y[g>>2]=n;Y[A>>2]=0;r=Y[C>>2]|0;a=i;U=56;break}}}while(0);if((U|0)==56){U=0;i=r-n|0;if(i>>>0>20){Y[S>>2]=Y[t>>2];Y[L>>2]=n;B=i>>>0<(a+21|0)>>>0;Y[T>>2]=(Y[(B?C:g)>>2]|0)+(B?-21:a);if(!(G(e)|0)){n=7;U=86;break}n=Y[L>>2]|0;r=n-(Y[g>>2]|0)|0;i=Y[v>>2]|0;if(i>>>0<r>>>0){n=7;U=86;break}i=i-r|0;Y[v>>2]=i;Y[g>>2]=n;r=Y[C>>2]|0}else i=a;r=r-n|0;if(r>>>0<21){B=r>>>0>i>>>0?i:r;he(M|0,(Y[t>>2]|0)+n|0,B|0)|0;Y[A>>2]=B;Y[g>>2]=(Y[g>>2]|0)+B}}n=Y[b>>2]|0;r=Y[u>>2]|0;i=n-r|0;if(Y[O>>2]|0){if((n|0)==(Y[c>>2]|0))Y[b>>2]=0;he((Y[N>>2]|0)+(Y[D>>2]|0)|0,(Y[s>>2]|0)+r|0,i|0)|0;n=Y[b>>2]|0}Y[u>>2]=n;n=(Y[D>>2]|0)+i|0;Y[D>>2]=n;B=(Y[h>>2]|0)-i|0;Y[h>>2]=B;if(B|0){if((n|0)==(Y[l>>2]|0)){n=0;U=86;break}if((Y[g>>2]|0)!=(Y[C>>2]|0))continue;if((Y[A>>2]|0)>>>0<(Y[v>>2]|0)>>>0){n=0;U=86;break}else continue}if(Y[v>>2]|0){n=7;U=86;break}if(Y[E>>2]|0){n=7;U=86;break}if(Y[f>>2]|0){n=7;U=86;break}Y[e>>2]=-1;Y[f>>2]=0;Y[m>>2]=5;Y[R>>2]=0}if((U|0)==86)return n|0;return 0}function G(e){e=e|0;var t=0,n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,L=0,C=0,E=0,P=0,R=0,F=0,I=0;I=e+24|0;R=e+32|0;t=Y[R>>2]|0;F=e+40|0;n=Y[F>>2]|0;if(((n>>>0>t>>>0?(r=e+104|0,i=Y[r>>2]|0,(i|0)!=0):0)?(o=Y[e+84>>2]|0,s=e+36|0,(Y[s>>2]|0)>>>0>o>>>0):0)?(Y[e+48>>2]|0)>>>0>o>>>0:0){a=n-t|0;a=a>>>0<i>>>0?a:i;Y[r>>2]=i-a;n=t-o+-1|0;r=e+44|0;if(t>>>0<=o>>>0)n=(Y[r>>2]|0)+n|0;P=Y[I>>2]|0;E=H[P+n>>0]|0;Y[R>>2]=t+1;H[P+t>>0]=E;t=a+-1|0;if(t|0)do{P=n+1|0;n=(P|0)==(Y[r>>2]|0)?0:P;P=Y[R>>2]|0;E=Y[I>>2]|0;C=H[E+n>>0]|0;Y[R>>2]=P+1;H[E+P>>0]=C;t=t+-1|0}while((t|0)!=0);t=Y[R>>2]|0;if((Y[s>>2]|0)>>>0<t>>>0)Y[s>>2]=t}e:do{if(t>>>0<(Y[F>>2]|0)>>>0){h=e+16|0;d=e+20|0;p=e+116|0;f=e+100|0;m=e+4|0;v=e+12|0;g=e+44|0;y=e+36|0;x=e+108|0;_=e+112|0;b=e+24|0;w=e+84|0;A=e+92|0;M=e+96|0;T=e+88|0;S=e+1756|0;L=e+104|0;C=e+1726|0;E=e+48|0;P=e+2784|0;while(1){n=Y[h>>2]|0;if(n>>>0>(Y[d>>2]|0)>>>0){n=e;break e}o=Y[p>>2]&t;a=e+120+(Y[f>>2]<<5)+(o<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;u=Y[m>>2]<<8;i=Y[v>>2]|0;Y[h>>2]=n+1;i=u|(q[i+n>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=N(t>>>11,n)|0;if(i>>>0>=r>>>0){Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);a=e+504+(Y[f>>2]<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=N(t>>>11,n)|0;t:do{if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;Y[f>>2]=(Y[f>>2]|0)>>>0<7?7:10;Y[M>>2]=Y[A>>2];Y[A>>2]=Y[T>>2];Y[T>>2]=Y[w>>2];D(e,S,o);o=Y[L>>2]|0;o=o>>>0<6?o+-2|0:3;l=1;t=Y[e>>2]|0;do{s=e+984+(o<<7)+(l<<1)|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;n=Y[h>>2]|0;Y[h>>2]=n+1;n=c|(q[u+n>>0]|0);Y[m>>2]=n}else n=Y[m>>2]|0;a=O[s>>1]|0;i=N(t>>>11,a)|0;if(n>>>0<i>>>0){Y[e>>2]=i;r=0;t=i;n=(2048-a>>5)+a|0}else{t=t-i|0;Y[e>>2]=t;Y[m>>2]=n-i;r=1;n=a-(a>>>5)|0}z[s>>1]=n;l=r|l<<1}while(l>>>0<64);t=l+-64|0;if(t>>>0<4){Y[w>>2]=t;break}n=t>>>1;c=n+-1|0;r=t&1|2;Y[w>>2]=r;if(t>>>0<14){s=r<<c;Y[w>>2]=s;l=e+1496+(s<<1)+(64-l<<1)+-2|0;s=0;t=1;while(1){o=l+(t<<1)|0;n=Y[e>>2]|0;if(n>>>0<16777216){n=n<<8;Y[e>>2]=n;i=Y[m>>2]<<8;u=Y[v>>2]|0;a=Y[h>>2]|0;Y[h>>2]=a+1;a=i|(q[u+a>>0]|0);Y[m>>2]=a}else a=Y[m>>2]|0;r=O[o>>1]|0;i=N(n>>>11,r)|0;if(a>>>0<i>>>0){Y[e>>2]=i;z[o>>1]=((2048-r|0)>>>5)+r;t=t<<1}else{Y[e>>2]=n-i;Y[m>>2]=a-i;z[o>>1]=r-(r>>>5);Y[w>>2]=(Y[w>>2]|0)+(1<<s);t=t<<1|1}s=s+1|0;if(s>>>0>=c>>>0)break t}}i=n+-5|0;o=Y[e>>2]|0;do{if(o>>>0<16777216){a=o<<8;Y[e>>2]=a;c=Y[m>>2]<<8;u=Y[v>>2]|0;t=Y[h>>2]|0;Y[h>>2]=t+1;t=c|(q[u+t>>0]|0);Y[m>>2]=t}else{a=o;t=Y[m>>2]|0}o=a>>>1;Y[e>>2]=o;n=t-o|0;u=n>>31;n=(u&o)+n|0;Y[m>>2]=n;r=(r<<1|1)+u|0;Y[w>>2]=r;i=i+-1|0}while((i|0)!=0);s=r<<4;Y[w>>2]=s;if(a>>>0<33554432){r=o<<8;Y[e>>2]=r;c=Y[v>>2]|0;u=Y[h>>2]|0;Y[h>>2]=u+1;n=n<<8|(q[c+u>>0]|0);Y[m>>2]=n}else r=o;t=O[C>>1]|0;i=N(r>>>11,t)|0;if(n>>>0<i>>>0){Y[e>>2]=i;z[C>>1]=((2048-t|0)>>>5)+t;l=2;o=s}else{u=r-i|0;Y[e>>2]=u;n=n-i|0;Y[m>>2]=n;z[C>>1]=t-(t>>>5);o=s|1;Y[w>>2]=o;l=3;i=u}a=e+1724+(l<<1)|0;if(i>>>0<16777216){i=i<<8;Y[e>>2]=i;c=Y[v>>2]|0;u=Y[h>>2]|0;Y[h>>2]=u+1;n=n<<8|(q[c+u>>0]|0);Y[m>>2]=n}r=O[a>>1]|0;t=N(i>>>11,r)|0;if(n>>>0<t>>>0){Y[e>>2]=t;z[a>>1]=((2048-r|0)>>>5)+r;o=l<<1}else{u=i-t|0;Y[e>>2]=u;n=n-t|0;Y[m>>2]=n;z[a>>1]=r-(r>>>5);Y[w>>2]=o+2;o=l<<1|1;t=u}a=e+1724+(o<<1)|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[v>>2]|0;u=Y[h>>2]|0;Y[h>>2]=u+1;n=n<<8|(q[c+u>>0]|0);Y[m>>2]=n}r=O[a>>1]|0;i=N(t>>>11,r)|0;if(n>>>0<i>>>0){Y[e>>2]=i;z[a>>1]=((2048-r|0)>>>5)+r;t=o<<1}else{Y[e>>2]=t-i;Y[m>>2]=n-i;z[a>>1]=r-(r>>>5);Y[w>>2]=(Y[w>>2]|0)+4;t=o<<1|1}a=e+1724+(t<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=N(t>>>11,n)|0;if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;break}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);Y[w>>2]=(Y[w>>2]|0)+8;break}}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);a=e+528+(Y[f>>2]<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=N(t>>>11,n)|0;do{if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;a=e+600+(Y[f>>2]<<5)+(o<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=N(t>>>11,n)|0;if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;Y[f>>2]=(Y[f>>2]|0)>>>0<7?9:11;Y[L>>2]=1;break t}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);break}}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);a=e+552+(Y[f>>2]<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=N(t>>>11,n)|0;if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;t=Y[T>>2]|0}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);a=e+576+(Y[f>>2]<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=N(t>>>11,n)|0;if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;t=Y[A>>2]|0}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);t=Y[M>>2]|0;Y[M>>2]=Y[A>>2]}Y[A>>2]=Y[T>>2]}Y[T>>2]=Y[w>>2];Y[w>>2]=t}}while(0);Y[f>>2]=(Y[f>>2]|0)>>>0<7?8:11;D(e,P,o)}}while(0);t=Y[w>>2]|0;if((Y[y>>2]|0)>>>0<=t>>>0){t=0;r=130;break}if((Y[E>>2]|0)>>>0<=t>>>0){t=0;r=130;break}i=Y[R>>2]|0;r=(Y[F>>2]|0)-i|0;n=Y[L>>2]|0;r=r>>>0<n>>>0?r:n;Y[L>>2]=n-r;n=i-t+-1|0;if(i>>>0<=t>>>0)n=(Y[g>>2]|0)+n|0;t=Y[I>>2]|0;u=H[t+n>>0]|0;Y[R>>2]=i+1;H[t+i>>0]=u;t=r+-1|0;if(t|0)do{u=n+1|0;n=(u|0)==(Y[g>>2]|0)?0:u;u=Y[R>>2]|0;c=Y[I>>2]|0;l=H[c+n>>0]|0;Y[R>>2]=u+1;H[c+u>>0]=l;t=t+-1|0}while((t|0)!=0);t=Y[R>>2]|0;if((Y[y>>2]|0)>>>0<t>>>0)Y[y>>2]=t}else{Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;n=Y[R>>2]|0;t=n+-1|0;if(!n)t=(Y[g>>2]|0)+t|0;r=(Y[y>>2]|0)==0;if(r)t=0;else t=q[(Y[b>>2]|0)+t>>0]|0;u=Y[x>>2]|0;u=((Y[_>>2]&n)<<u)+(t>>>(8-u|0))|0;if((Y[f>>2]|0)>>>0<7){t=1;n=Y[e>>2]|0;do{s=e+3812+(u*1536|0)+(t<<1)|0;if(n>>>0<16777216){n=n<<8;Y[e>>2]=n;l=Y[m>>2]<<8;c=Y[v>>2]|0;r=Y[h>>2]|0;Y[h>>2]=r+1;r=l|(q[c+r>>0]|0);Y[m>>2]=r}else r=Y[m>>2]|0;o=O[s>>1]|0;a=N(n>>>11,o)|0;if(r>>>0<a>>>0){Y[e>>2]=a;i=0;n=a;r=(2048-o>>5)+o|0}else{n=n-a|0;Y[e>>2]=n;Y[m>>2]=r-a;i=1;r=o-(o>>>5)|0}z[s>>1]=r;t=i|t<<1}while(t>>>0<256)}else{c=Y[w>>2]|0;t=n-c+-1|0;if(n>>>0>c>>>0)n=t;else n=(Y[g>>2]|0)+t|0;if(r){t=1;c=256;s=0}else{t=1;c=256;s=q[(Y[b>>2]|0)+n>>0]|0}while(1){s=s<<1;l=s&c;o=e+3812+(u*1536|0)+(l+c+t<<1)|0;n=Y[e>>2]|0;if(n>>>0<16777216){n=n<<8;Y[e>>2]=n;r=Y[m>>2]<<8;a=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=r|(q[a+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;a=O[o>>1]|0;r=N(n>>>11,a)|0;if(i>>>0<r>>>0){Y[e>>2]=r;r=1;n=(2048-a>>5)+a|0}else{Y[e>>2]=n-r;Y[m>>2]=i-r;r=0;n=a-(a>>>5)|0}z[o>>1]=n;t=t<<1|(r^1)&1;if(t>>>0>=256)break;else c=(r?c:0)^l}}c=Y[b>>2]|0;u=Y[R>>2]|0;Y[R>>2]=u+1;H[c+u>>0]=t;t=Y[R>>2]|0;if((Y[y>>2]|0)>>>0<t>>>0)Y[y>>2]=t;u=Y[f>>2]|0;Y[f>>2]=u>>>0<4?0:u-(u>>>0<10?3:6)|0}if(t>>>0>=(Y[F>>2]|0)>>>0){n=e;break e}}if((r|0)==130)return t|0}else n=e}while(0);t=Y[n>>2]|0;if(t>>>0>=16777216){e=1;return e|0}Y[n>>2]=t<<8;I=e+4|0;R=Y[I>>2]<<8;F=Y[e+12>>2]|0;P=e+16|0;e=Y[P>>2]|0;Y[P>>2]=e+1;Y[I>>2]=R|(q[F+e>>0]|0);e=1;return e|0}function D(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0;r=Y[e>>2]|0;if(r>>>0<16777216){r=r<<8;Y[e>>2]=r;a=e+4|0;p=Y[a>>2]<<8;f=Y[e+12>>2]|0;d=e+16|0;o=Y[d>>2]|0;Y[d>>2]=o+1;o=p|(q[f+o>>0]|0);Y[a>>2]=o}else{o=e+4|0;a=o;o=Y[o>>2]|0}i=O[t>>1]|0;l=N(r>>>11,i)|0;do{if(o>>>0>=l>>>0){s=r-l|0;Y[e>>2]=s;r=o-l|0;Y[a>>2]=r;z[t>>1]=i-(i>>>5);l=t+2|0;if(s>>>0<16777216){i=s<<8;Y[e>>2]=i;a=e+4|0;f=Y[e+12>>2]|0;p=e+16|0;o=Y[p>>2]|0;Y[p>>2]=o+1;o=r<<8|(q[f+o>>0]|0);Y[a>>2]=o}else{a=e+4|0;i=s;o=r}r=O[l>>1]|0;s=N(i>>>11,r)|0;if(o>>>0<s>>>0){Y[e>>2]=s;z[l>>1]=((2048-r|0)>>>5)+r;f=8;p=t+260+(n<<4)|0;r=s;c=10;break}else{c=i-s|0;Y[e>>2]=c;o=o-s|0;Y[a>>2]=o;z[l>>1]=r-(r>>>5);f=256;p=t+516|0;r=c;c=18;break}}else{Y[e>>2]=l;z[t>>1]=((2048-i|0)>>>5)+i;f=8;p=t+4+(n<<4)|0;r=l;c=2}}while(0);n=e+104|0;Y[n>>2]=c;u=e+4|0;h=e+12|0;d=e+16|0;t=1;do{l=p+(t<<1)|0;if(r>>>0<16777216){r=r<<8;Y[e>>2]=r;a=Y[h>>2]|0;s=Y[d>>2]|0;Y[d>>2]=s+1;o=o<<8|(q[a+s>>0]|0);Y[u>>2]=o}s=O[l>>1]|0;i=N(r>>>11,s)|0;if(o>>>0<i>>>0){Y[e>>2]=i;a=0;r=i;i=(2048-s>>5)+s|0}else{r=r-i|0;Y[e>>2]=r;o=o-i|0;Y[u>>2]=o;a=1;i=s-(s>>>5)|0}z[l>>1]=i;t=a|t<<1}while(t>>>0<f>>>0);Y[n>>2]=t-f+c;return}function F(e,t){e=e|0;t=t|0;var n=0,r=0;n=re(28456)|0;e:do{if(n){r=n+24|0;Y[n+60>>2]=e;Y[n+52>>2]=t;switch(e|0){case 1:break;case 2:{Y[r>>2]=0;Y[n+56>>2]=0;break e}default:break e}t=re(t)|0;Y[r>>2]=t;if(!t){ie(n);n=0}}else n=0}while(0);return n|0}function $(e,t){e=e|0;t=t|0;var n=0,r=0,i=0;n=t&255;if((t&255)>39){i=6;return i|0}r=e+48|0;n=(n&1|2)<<(n>>>1)+11;Y[r>>2]=n;t=Y[e+60>>2]|0;if(t|0){if(n>>>0>(Y[e+52>>2]|0)>>>0){i=4;return i|0}Y[e+44>>2]=n;if(((t|0)==2?(i=e+56|0,(Y[i>>2]|0)>>>0<n>>>0):0)?(n=e+24|0,ie(Y[n>>2]|0),r=re(Y[r>>2]|0)|0,Y[n>>2]=r,(r|0)==0):0){Y[i>>2]=0;i=3;return i|0}}Y[e+104>>2]=0;Y[e+64>>2]=0;H[e+80>>0]=1;Y[e+28388>>2]=0;i=0;return i|0}function I(e){e=e|0;if(!(Y[e+60>>2]|0)){ie(e);return}ie(Y[e+24>>2]|0);ie(e);return}function U(){var e=0;Y[778]=3640;Y[779]=0;Y[780]=0;Y[781]=527928;Y[782]=0;Y[783]=524288;L();C();e=P(2,8388608)|0;Y[784]=e;if(e|0){e=0;return e|0}R(0);e=1;return e|0}function B(){var e=0;switch(E(Y[784]|0,3112)|0){case 2:case 0:{e=0;break}case 1:{R(Y[784]|0);e=0;break}case 3:{R(Y[784]|0);e=1;break}case 4:{R(Y[784]|0);e=2;break}case 5:{R(Y[784]|0);e=4;break}case 6:{R(Y[784]|0);e=5;break}case 8:case 7:{R(Y[784]|0);e=6;break}default:{R(Y[784]|0);e=7}}return e|0}function k(){return Y[778]|0}function V(){return Y[781]|0}function j(e){e=e|0;Y[779]=e;return}function W(e){e=e|0;Y[780]=e>>>0<524288?e:524288;return}function X(e){e=e|0;Y[782]=e;return}function ee(e){e=e|0;Y[783]=e>>>0<524288?e:524288;return}function te(){return Y[782]|0}function ne(){return(Y[779]|0)==(Y[780]|0)|0}function re(e){e=e|0;var t=0,n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0;b=w;w=w+16|0;d=b;do{if(e>>>0<245){c=e>>>0<11?16:e+11&-8;e=c>>>3;h=Y[785]|0;n=h>>>e;if(n&3|0){t=(n&1^1)+e|0;e=3180+(t<<1<<2)|0;n=e+8|0;r=Y[n>>2]|0;i=r+8|0;a=Y[i>>2]|0;if((a|0)==(e|0))Y[785]=h&~(1<<t);else{Y[a+12>>2]=e;Y[n>>2]=a}_=t<<3;Y[r+4>>2]=_|3;_=r+_+4|0;Y[_>>2]=Y[_>>2]|1;_=i;w=b;return _|0}u=Y[787]|0;if(c>>>0>u>>>0){if(n|0){t=2<<e;t=n<<e&(t|0-t);t=(t&0-t)+-1|0;s=t>>>12&16;t=t>>>s;n=t>>>5&8;t=t>>>n;a=t>>>2&4;t=t>>>a;e=t>>>1&2;t=t>>>e;r=t>>>1&1;r=(n|s|a|e|r)+(t>>>r)|0;t=3180+(r<<1<<2)|0;e=t+8|0;a=Y[e>>2]|0;s=a+8|0;n=Y[s>>2]|0;if((n|0)==(t|0)){e=h&~(1<<r);Y[785]=e}else{Y[n+12>>2]=t;Y[e>>2]=n;e=h}_=r<<3;o=_-c|0;Y[a+4>>2]=c|3;i=a+c|0;Y[i+4>>2]=o|1;Y[a+_>>2]=o;if(u|0){r=Y[790]|0;t=u>>>3;n=3180+(t<<1<<2)|0;t=1<<t;if(!(e&t)){Y[785]=e|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=r;Y[t+12>>2]=r;Y[r+8>>2]=t;Y[r+12>>2]=n}Y[787]=o;Y[790]=i;_=s;w=b;return _|0}a=Y[786]|0;if(a){n=(a&0-a)+-1|0;i=n>>>12&16;n=n>>>i;r=n>>>5&8;n=n>>>r;o=n>>>2&4;n=n>>>o;s=n>>>1&2;n=n>>>s;l=n>>>1&1;l=Y[3444+((r|i|o|s|l)+(n>>>l)<<2)>>2]|0;n=l;s=l;l=(Y[l+4>>2]&-8)-c|0;while(1){e=Y[n+16>>2]|0;if(!e){e=Y[n+20>>2]|0;if(!e)break}o=(Y[e+4>>2]&-8)-c|0;i=o>>>0<l>>>0;n=e;s=i?e:s;l=i?o:l}o=s+c|0;if(o>>>0>s>>>0){i=Y[s+24>>2]|0;t=Y[s+12>>2]|0;do{if((t|0)==(s|0)){e=s+20|0;t=Y[e>>2]|0;if(!t){e=s+16|0;t=Y[e>>2]|0;if(!t){n=0;break}}while(1){r=t+20|0;n=Y[r>>2]|0;if(!n){r=t+16|0;n=Y[r>>2]|0;if(!n)break;else{t=n;e=r}}else{t=n;e=r}}Y[e>>2]=0;n=t}else{n=Y[s+8>>2]|0;Y[n+12>>2]=t;Y[t+8>>2]=n;n=t}}while(0);do{if(i|0){t=Y[s+28>>2]|0;e=3444+(t<<2)|0;if((s|0)==(Y[e>>2]|0)){Y[e>>2]=n;if(!n){Y[786]=a&~(1<<t);break}}else{_=i+16|0;Y[((Y[_>>2]|0)==(s|0)?_:i+20|0)>>2]=n;if(!n)break}Y[n+24>>2]=i;t=Y[s+16>>2]|0;if(t|0){Y[n+16>>2]=t;Y[t+24>>2]=n}t=Y[s+20>>2]|0;if(t|0){Y[n+20>>2]=t;Y[t+24>>2]=n}}}while(0);if(l>>>0<16){_=l+c|0;Y[s+4>>2]=_|3;_=s+_+4|0;Y[_>>2]=Y[_>>2]|1}else{Y[s+4>>2]=c|3;Y[o+4>>2]=l|1;Y[o+l>>2]=l;if(u|0){r=Y[790]|0;t=u>>>3;n=3180+(t<<1<<2)|0;t=1<<t;if(!(t&h)){Y[785]=t|h;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=r;Y[t+12>>2]=r;Y[r+8>>2]=t;Y[r+12>>2]=n}Y[787]=l;Y[790]=o}_=s+8|0;w=b;return _|0}else h=c}else h=c}else h=c}else if(e>>>0<=4294967231){e=e+11|0;c=e&-8;r=Y[786]|0;if(r){i=0-c|0;e=e>>>8;if(e){if(c>>>0>16777215)l=31;else{h=(e+1048320|0)>>>16&8;m=e<<h;s=(m+520192|0)>>>16&4;m=m<<s;l=(m+245760|0)>>>16&2;l=14-(s|h|l)+(m<<l>>>15)|0;l=c>>>(l+7|0)&1|l<<1}}else l=0;n=Y[3444+(l<<2)>>2]|0;e:do{if(!n){n=0;e=0;m=61}else{e=0;s=c<<((l|0)==31?0:25-(l>>>1)|0);a=0;while(1){o=(Y[n+4>>2]&-8)-c|0;if(o>>>0<i>>>0)if(!o){e=n;i=0;m=65;break e}else{e=n;i=o}m=Y[n+20>>2]|0;n=Y[n+16+(s>>>31<<2)>>2]|0;a=(m|0)==0|(m|0)==(n|0)?a:m;if(!n){n=a;m=61;break}else s=s<<1}}}while(0);if((m|0)==61){if((n|0)==0&(e|0)==0){e=2<<l;e=(e|0-e)&r;if(!e){h=c;break}h=(e&0-e)+-1|0;o=h>>>12&16;h=h>>>o;a=h>>>5&8;h=h>>>a;s=h>>>2&4;h=h>>>s;l=h>>>1&2;h=h>>>l;n=h>>>1&1;e=0;n=Y[3444+((a|o|s|l|n)+(h>>>n)<<2)>>2]|0}if(!n){s=e;o=i}else m=65}if((m|0)==65){a=n;while(1){h=(Y[a+4>>2]&-8)-c|0;n=h>>>0<i>>>0;i=n?h:i;e=n?a:e;n=Y[a+16>>2]|0;if(!n)n=Y[a+20>>2]|0;if(!n){s=e;o=i;break}else a=n}}if(((s|0)!=0?o>>>0<((Y[787]|0)-c|0)>>>0:0)?(u=s+c|0,u>>>0>s>>>0):0){a=Y[s+24>>2]|0;t=Y[s+12>>2]|0;do{if((t|0)==(s|0)){e=s+20|0;t=Y[e>>2]|0;if(!t){e=s+16|0;t=Y[e>>2]|0;if(!t){t=0;break}}while(1){i=t+20|0;n=Y[i>>2]|0;if(!n){i=t+16|0;n=Y[i>>2]|0;if(!n)break;else{t=n;e=i}}else{t=n;e=i}}Y[e>>2]=0}else{_=Y[s+8>>2]|0;Y[_+12>>2]=t;Y[t+8>>2]=_}}while(0);do{if(a){e=Y[s+28>>2]|0;n=3444+(e<<2)|0;if((s|0)==(Y[n>>2]|0)){Y[n>>2]=t;if(!t){r=r&~(1<<e);Y[786]=r;break}}else{_=a+16|0;Y[((Y[_>>2]|0)==(s|0)?_:a+20|0)>>2]=t;if(!t)break}Y[t+24>>2]=a;e=Y[s+16>>2]|0;if(e|0){Y[t+16>>2]=e;Y[e+24>>2]=t}e=Y[s+20>>2]|0;if(e){Y[t+20>>2]=e;Y[e+24>>2]=t}}}while(0);e:do{if(o>>>0<16){_=o+c|0;Y[s+4>>2]=_|3;_=s+_+4|0;Y[_>>2]=Y[_>>2]|1}else{Y[s+4>>2]=c|3;Y[u+4>>2]=o|1;Y[u+o>>2]=o;t=o>>>3;if(o>>>0<256){n=3180+(t<<1<<2)|0;e=Y[785]|0;t=1<<t;if(!(e&t)){Y[785]=e|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=u;Y[t+12>>2]=u;Y[u+8>>2]=t;Y[u+12>>2]=n;break}t=o>>>8;if(t){if(o>>>0>16777215)n=31;else{x=(t+1048320|0)>>>16&8;_=t<<x;y=(_+520192|0)>>>16&4;_=_<<y;n=(_+245760|0)>>>16&2;n=14-(y|x|n)+(_<<n>>>15)|0;n=o>>>(n+7|0)&1|n<<1}}else n=0;t=3444+(n<<2)|0;Y[u+28>>2]=n;e=u+16|0;Y[e+4>>2]=0;Y[e>>2]=0;e=1<<n;if(!(r&e)){Y[786]=r|e;Y[t>>2]=u;Y[u+24>>2]=t;Y[u+12>>2]=u;Y[u+8>>2]=u;break}t=Y[t>>2]|0;t:do{if((Y[t+4>>2]&-8|0)!=(o|0)){r=o<<((n|0)==31?0:25-(n>>>1)|0);while(1){n=t+16+(r>>>31<<2)|0;e=Y[n>>2]|0;if(!e)break;if((Y[e+4>>2]&-8|0)==(o|0)){t=e;break t}else{r=r<<1;t=e}}Y[n>>2]=u;Y[u+24>>2]=t;Y[u+12>>2]=u;Y[u+8>>2]=u;break e}}while(0);x=t+8|0;_=Y[x>>2]|0;Y[_+12>>2]=u;Y[x>>2]=u;Y[u+8>>2]=_;Y[u+12>>2]=t;Y[u+24>>2]=0}}while(0);_=s+8|0;w=b;return _|0}else h=c}else h=c}else h=-1}while(0);n=Y[787]|0;if(n>>>0>=h>>>0){t=n-h|0;e=Y[790]|0;if(t>>>0>15){_=e+h|0;Y[790]=_;Y[787]=t;Y[_+4>>2]=t|1;Y[e+n>>2]=t;Y[e+4>>2]=h|3}else{Y[787]=0;Y[790]=0;Y[e+4>>2]=n|3;_=e+n+4|0;Y[_>>2]=Y[_>>2]|1}_=e+8|0;w=b;return _|0}o=Y[788]|0;if(o>>>0>h>>>0){y=o-h|0;Y[788]=y;_=Y[791]|0;x=_+h|0;Y[791]=x;Y[x+4>>2]=y|1;Y[_+4>>2]=h|3;_=_+8|0;w=b;return _|0}if(!(Y[903]|0)){Y[905]=4096;Y[904]=4096;Y[906]=-1;Y[907]=-1;Y[908]=0;Y[896]=0;Y[903]=d&-16^1431655768;e=4096}else e=Y[905]|0;s=h+48|0;l=h+47|0;a=e+l|0;i=0-e|0;c=a&i;if(c>>>0<=h>>>0){_=0;w=b;return _|0}e=Y[895]|0;if(e|0?(u=Y[893]|0,d=u+c|0,d>>>0<=u>>>0|d>>>0>e>>>0):0){_=0;w=b;return _|0}e:do{if(!(Y[896]&4)){n=Y[791]|0;t:do{if(n){r=3588;while(1){d=Y[r>>2]|0;if(d>>>0<=n>>>0?(d+(Y[r+4>>2]|0)|0)>>>0>n>>>0:0)break;e=Y[r+8>>2]|0;if(!e){m=128;break t}else r=e}t=a-o&i;if(t>>>0<2147483647){e=fe(t|0)|0;if((e|0)==((Y[r>>2]|0)+(Y[r+4>>2]|0)|0)){if((e|0)!=(-1|0)){o=t;a=e;m=145;break e}}else{r=e;m=136}}else t=0}else m=128}while(0);do{if((m|0)==128){n=fe(0)|0;if((n|0)!=(-1|0)?(t=n,p=Y[904]|0,f=p+-1|0,t=((f&t|0)==0?0:(f+t&0-p)-t|0)+c|0,p=Y[893]|0,f=t+p|0,t>>>0>h>>>0&t>>>0<2147483647):0){d=Y[895]|0;if(d|0?f>>>0<=p>>>0|f>>>0>d>>>0:0){t=0;break}e=fe(t|0)|0;if((e|0)==(n|0)){o=t;a=n;m=145;break e}else{r=e;m=136}}else t=0}}while(0);do{if((m|0)==136){n=0-t|0;if(!(s>>>0>t>>>0&(t>>>0<2147483647&(r|0)!=(-1|0))))if((r|0)==(-1|0)){t=0;break}else{o=t;a=r;m=145;break e}e=Y[905]|0;e=l-t+e&0-e;if(e>>>0>=2147483647){o=t;a=r;m=145;break e}if((fe(e|0)|0)==(-1|0)){fe(n|0)|0;t=0;break}else{o=e+t|0;a=r;m=145;break e}}}while(0);Y[896]=Y[896]|4;m=143}else{t=0;m=143}}while(0);if(((m|0)==143?c>>>0<2147483647:0)?(y=fe(c|0)|0,f=fe(0)|0,v=f-y|0,g=v>>>0>(h+40|0)>>>0,!((y|0)==(-1|0)|g^1|y>>>0<f>>>0&((y|0)!=(-1|0)&(f|0)!=(-1|0))^1)):0){o=g?v:t;a=y;m=145}if((m|0)==145){t=(Y[893]|0)+o|0;Y[893]=t;if(t>>>0>(Y[894]|0)>>>0)Y[894]=t;l=Y[791]|0;e:do{if(l){t=3588;while(1){e=Y[t>>2]|0;n=Y[t+4>>2]|0;if((a|0)==(e+n|0)){m=154;break}r=Y[t+8>>2]|0;if(!r)break;else t=r}if(((m|0)==154?(x=t+4|0,(Y[t+12>>2]&8|0)==0):0)?a>>>0>l>>>0&e>>>0<=l>>>0:0){Y[x>>2]=n+o;_=(Y[788]|0)+o|0;y=l+8|0;y=(y&7|0)==0?0:0-y&7;x=l+y|0;y=_-y|0;Y[791]=x;Y[788]=y;Y[x+4>>2]=y|1;Y[l+_+4>>2]=40;Y[792]=Y[907];break}if(a>>>0<(Y[789]|0)>>>0)Y[789]=a;n=a+o|0;t=3588;while(1){if((Y[t>>2]|0)==(n|0)){m=162;break}e=Y[t+8>>2]|0;if(!e)break;else t=e}if((m|0)==162?(Y[t+12>>2]&8|0)==0:0){Y[t>>2]=a;u=t+4|0;Y[u>>2]=(Y[u>>2]|0)+o;u=a+8|0;u=a+((u&7|0)==0?0:0-u&7)|0;t=n+8|0;t=n+((t&7|0)==0?0:0-t&7)|0;c=u+h|0;s=t-u-h|0;Y[u+4>>2]=h|3;t:do{if((l|0)==(t|0)){_=(Y[788]|0)+s|0;Y[788]=_;Y[791]=c;Y[c+4>>2]=_|1}else{if((Y[790]|0)==(t|0)){_=(Y[787]|0)+s|0;Y[787]=_;Y[790]=c;Y[c+4>>2]=_|1;Y[c+_>>2]=_;break}e=Y[t+4>>2]|0;if((e&3|0)==1){o=e&-8;r=e>>>3;n:do{if(e>>>0<256){e=Y[t+8>>2]|0;n=Y[t+12>>2]|0;if((n|0)==(e|0)){Y[785]=Y[785]&~(1<<r);break}else{Y[e+12>>2]=n;Y[n+8>>2]=e;break}}else{a=Y[t+24>>2]|0;e=Y[t+12>>2]|0;do{if((e|0)==(t|0)){n=t+16|0;r=n+4|0;e=Y[r>>2]|0;if(!e){e=Y[n>>2]|0;if(!e){e=0;break}}else n=r;while(1){i=e+20|0;r=Y[i>>2]|0;if(!r){i=e+16|0;r=Y[i>>2]|0;if(!r)break;else{e=r;n=i}}else{e=r;n=i}}Y[n>>2]=0}else{_=Y[t+8>>2]|0;Y[_+12>>2]=e;Y[e+8>>2]=_}}while(0);if(!a)break;n=Y[t+28>>2]|0;r=3444+(n<<2)|0;do{if((Y[r>>2]|0)!=(t|0)){_=a+16|0;Y[((Y[_>>2]|0)==(t|0)?_:a+20|0)>>2]=e;if(!e)break n}else{Y[r>>2]=e;if(e|0)break;Y[786]=Y[786]&~(1<<n);break n}}while(0);Y[e+24>>2]=a;n=t+16|0;r=Y[n>>2]|0;if(r|0){Y[e+16>>2]=r;Y[r+24>>2]=e}n=Y[n+4>>2]|0;if(!n)break;Y[e+20>>2]=n;Y[n+24>>2]=e}}while(0);t=t+o|0;i=o+s|0}else i=s;t=t+4|0;Y[t>>2]=Y[t>>2]&-2;Y[c+4>>2]=i|1;Y[c+i>>2]=i;t=i>>>3;if(i>>>0<256){n=3180+(t<<1<<2)|0;e=Y[785]|0;t=1<<t;if(!(e&t)){Y[785]=e|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=c;Y[t+12>>2]=c;Y[c+8>>2]=t;Y[c+12>>2]=n;break}t=i>>>8;do{if(!t)r=0;else{if(i>>>0>16777215){r=31;break}x=(t+1048320|0)>>>16&8;_=t<<x;y=(_+520192|0)>>>16&4;_=_<<y;r=(_+245760|0)>>>16&2;r=14-(y|x|r)+(_<<r>>>15)|0;r=i>>>(r+7|0)&1|r<<1}}while(0);t=3444+(r<<2)|0;Y[c+28>>2]=r;e=c+16|0;Y[e+4>>2]=0;Y[e>>2]=0;e=Y[786]|0;n=1<<r;if(!(e&n)){Y[786]=e|n;Y[t>>2]=c;Y[c+24>>2]=t;Y[c+12>>2]=c;Y[c+8>>2]=c;break}t=Y[t>>2]|0;n:do{if((Y[t+4>>2]&-8|0)!=(i|0)){r=i<<((r|0)==31?0:25-(r>>>1)|0);while(1){n=t+16+(r>>>31<<2)|0;e=Y[n>>2]|0;if(!e)break;if((Y[e+4>>2]&-8|0)==(i|0)){t=e;break n}else{r=r<<1;t=e}}Y[n>>2]=c;Y[c+24>>2]=t;Y[c+12>>2]=c;Y[c+8>>2]=c;break t}}while(0);x=t+8|0;_=Y[x>>2]|0;Y[_+12>>2]=c;Y[x>>2]=c;Y[c+8>>2]=_;Y[c+12>>2]=t;Y[c+24>>2]=0}}while(0);_=u+8|0;w=b;return _|0}t=3588;while(1){e=Y[t>>2]|0;if(e>>>0<=l>>>0?(_=e+(Y[t+4>>2]|0)|0,_>>>0>l>>>0):0)break;t=Y[t+8>>2]|0}i=_+-47|0;e=i+8|0;e=i+((e&7|0)==0?0:0-e&7)|0;i=l+16|0;e=e>>>0<i>>>0?l:e;t=e+8|0;n=o+-40|0;y=a+8|0;y=(y&7|0)==0?0:0-y&7;x=a+y|0;y=n-y|0;Y[791]=x;Y[788]=y;Y[x+4>>2]=y|1;Y[a+n+4>>2]=40;Y[792]=Y[907];n=e+4|0;Y[n>>2]=27;Y[t>>2]=Y[897];Y[t+4>>2]=Y[898];Y[t+8>>2]=Y[899];Y[t+12>>2]=Y[900];Y[897]=a;Y[898]=o;Y[900]=0;Y[899]=t;t=e+24|0;do{x=t;t=t+4|0;Y[t>>2]=7}while((x+8|0)>>>0<_>>>0);if((e|0)!=(l|0)){a=e-l|0;Y[n>>2]=Y[n>>2]&-2;Y[l+4>>2]=a|1;Y[e>>2]=a;t=a>>>3;if(a>>>0<256){n=3180+(t<<1<<2)|0;e=Y[785]|0;t=1<<t;if(!(e&t)){Y[785]=e|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=l;Y[t+12>>2]=l;Y[l+8>>2]=t;Y[l+12>>2]=n;break}t=a>>>8;if(t){if(a>>>0>16777215)r=31;else{x=(t+1048320|0)>>>16&8;_=t<<x;y=(_+520192|0)>>>16&4;_=_<<y;r=(_+245760|0)>>>16&2;r=14-(y|x|r)+(_<<r>>>15)|0;r=a>>>(r+7|0)&1|r<<1}}else r=0;n=3444+(r<<2)|0;Y[l+28>>2]=r;Y[l+20>>2]=0;Y[i>>2]=0;t=Y[786]|0;e=1<<r;if(!(t&e)){Y[786]=t|e;Y[n>>2]=l;Y[l+24>>2]=n;Y[l+12>>2]=l;Y[l+8>>2]=l;break}t=Y[n>>2]|0;t:do{if((Y[t+4>>2]&-8|0)!=(a|0)){r=a<<((r|0)==31?0:25-(r>>>1)|0);while(1){n=t+16+(r>>>31<<2)|0;e=Y[n>>2]|0;if(!e)break;if((Y[e+4>>2]&-8|0)==(a|0)){t=e;break t}else{r=r<<1;t=e}}Y[n>>2]=l;Y[l+24>>2]=t;Y[l+12>>2]=l;Y[l+8>>2]=l;break e}}while(0);x=t+8|0;_=Y[x>>2]|0;Y[_+12>>2]=l;Y[x>>2]=l;Y[l+8>>2]=_;Y[l+12>>2]=t;Y[l+24>>2]=0}}else{_=Y[789]|0;if((_|0)==0|a>>>0<_>>>0)Y[789]=a;Y[897]=a;Y[898]=o;Y[900]=0;Y[794]=Y[903];Y[793]=-1;Y[798]=3180;Y[797]=3180;Y[800]=3188;Y[799]=3188;Y[802]=3196;Y[801]=3196;Y[804]=3204;Y[803]=3204;Y[806]=3212;Y[805]=3212;Y[808]=3220;Y[807]=3220;Y[810]=3228;Y[809]=3228;Y[812]=3236;Y[811]=3236;Y[814]=3244;Y[813]=3244;Y[816]=3252;Y[815]=3252;Y[818]=3260;Y[817]=3260;Y[820]=3268;Y[819]=3268;Y[822]=3276;Y[821]=3276;Y[824]=3284;Y[823]=3284;Y[826]=3292;Y[825]=3292;Y[828]=3300;Y[827]=3300;Y[830]=3308;Y[829]=3308;Y[832]=3316;Y[831]=3316;Y[834]=3324;Y[833]=3324;Y[836]=3332;Y[835]=3332;Y[838]=3340;Y[837]=3340;Y[840]=3348;Y[839]=3348;Y[842]=3356;Y[841]=3356;Y[844]=3364;Y[843]=3364;Y[846]=3372;Y[845]=3372;Y[848]=3380;Y[847]=3380;Y[850]=3388;Y[849]=3388;Y[852]=3396;Y[851]=3396;Y[854]=3404;Y[853]=3404;Y[856]=3412;Y[855]=3412;Y[858]=3420;Y[857]=3420;Y[860]=3428;Y[859]=3428;_=o+-40|0;y=a+8|0;y=(y&7|0)==0?0:0-y&7;x=a+y|0;y=_-y|0;Y[791]=x;Y[788]=y;Y[x+4>>2]=y|1;Y[a+_+4>>2]=40;Y[792]=Y[907]}}while(0);t=Y[788]|0;if(t>>>0>h>>>0){y=t-h|0;Y[788]=y;_=Y[791]|0;x=_+h|0;Y[791]=x;Y[x+4>>2]=y|1;Y[_+4>>2]=h|3;_=_+8|0;w=b;return _|0}}Y[(ae()|0)>>2]=12;_=0;w=b;return _|0}function ie(e){e=e|0;var t=0,n=0,r=0,i=0,a=0,o=0,s=0,l=0;if(!e)return;n=e+-8|0;i=Y[789]|0;e=Y[e+-4>>2]|0;t=e&-8;l=n+t|0;do{if(!(e&1)){r=Y[n>>2]|0;if(!(e&3))return;o=n+(0-r)|0;a=r+t|0;if(o>>>0<i>>>0)return;if((Y[790]|0)==(o|0)){e=l+4|0;t=Y[e>>2]|0;if((t&3|0)!=3){s=o;t=a;break}Y[787]=a;Y[e>>2]=t&-2;Y[o+4>>2]=a|1;Y[o+a>>2]=a;return}n=r>>>3;if(r>>>0<256){e=Y[o+8>>2]|0;t=Y[o+12>>2]|0;if((t|0)==(e|0)){Y[785]=Y[785]&~(1<<n);s=o;t=a;break}else{Y[e+12>>2]=t;Y[t+8>>2]=e;s=o;t=a;break}}i=Y[o+24>>2]|0;e=Y[o+12>>2]|0;do{if((e|0)==(o|0)){t=o+16|0;n=t+4|0;e=Y[n>>2]|0;if(!e){e=Y[t>>2]|0;if(!e){e=0;break}}else t=n;while(1){r=e+20|0;n=Y[r>>2]|0;if(!n){r=e+16|0;n=Y[r>>2]|0;if(!n)break;else{e=n;t=r}}else{e=n;t=r}}Y[t>>2]=0}else{s=Y[o+8>>2]|0;Y[s+12>>2]=e;Y[e+8>>2]=s}}while(0);if(i){t=Y[o+28>>2]|0;n=3444+(t<<2)|0;if((Y[n>>2]|0)==(o|0)){Y[n>>2]=e;if(!e){Y[786]=Y[786]&~(1<<t);s=o;t=a;break}}else{s=i+16|0;Y[((Y[s>>2]|0)==(o|0)?s:i+20|0)>>2]=e;if(!e){s=o;t=a;break}}Y[e+24>>2]=i;t=o+16|0;n=Y[t>>2]|0;if(n|0){Y[e+16>>2]=n;Y[n+24>>2]=e}t=Y[t+4>>2]|0;if(t){Y[e+20>>2]=t;Y[t+24>>2]=e;s=o;t=a}else{s=o;t=a}}else{s=o;t=a}}else{s=n;o=n}}while(0);if(o>>>0>=l>>>0)return;e=l+4|0;r=Y[e>>2]|0;if(!(r&1))return;if(!(r&2)){if((Y[791]|0)==(l|0)){l=(Y[788]|0)+t|0;Y[788]=l;Y[791]=s;Y[s+4>>2]=l|1;if((s|0)!=(Y[790]|0))return;Y[790]=0;Y[787]=0;return}if((Y[790]|0)==(l|0)){l=(Y[787]|0)+t|0;Y[787]=l;Y[790]=o;Y[s+4>>2]=l|1;Y[o+l>>2]=l;return}i=(r&-8)+t|0;n=r>>>3;do{if(r>>>0<256){t=Y[l+8>>2]|0;e=Y[l+12>>2]|0;if((e|0)==(t|0)){Y[785]=Y[785]&~(1<<n);break}else{Y[t+12>>2]=e;Y[e+8>>2]=t;break}}else{a=Y[l+24>>2]|0;e=Y[l+12>>2]|0;do{if((e|0)==(l|0)){t=l+16|0;n=t+4|0;e=Y[n>>2]|0;if(!e){e=Y[t>>2]|0;if(!e){n=0;break}}else t=n;while(1){r=e+20|0;n=Y[r>>2]|0;if(!n){r=e+16|0;n=Y[r>>2]|0;if(!n)break;else{e=n;t=r}}else{e=n;t=r}}Y[t>>2]=0;n=e}else{n=Y[l+8>>2]|0;Y[n+12>>2]=e;Y[e+8>>2]=n;n=e}}while(0);if(a|0){e=Y[l+28>>2]|0;t=3444+(e<<2)|0;if((Y[t>>2]|0)==(l|0)){Y[t>>2]=n;if(!n){Y[786]=Y[786]&~(1<<e);break}}else{r=a+16|0;Y[((Y[r>>2]|0)==(l|0)?r:a+20|0)>>2]=n;if(!n)break}Y[n+24>>2]=a;e=l+16|0;t=Y[e>>2]|0;if(t|0){Y[n+16>>2]=t;Y[t+24>>2]=n}e=Y[e+4>>2]|0;if(e|0){Y[n+20>>2]=e;Y[e+24>>2]=n}}}}while(0);Y[s+4>>2]=i|1;Y[o+i>>2]=i;if((s|0)==(Y[790]|0)){Y[787]=i;return}}else{Y[e>>2]=r&-2;Y[s+4>>2]=t|1;Y[o+t>>2]=t;i=t}e=i>>>3;if(i>>>0<256){n=3180+(e<<1<<2)|0;t=Y[785]|0;e=1<<e;if(!(t&e)){Y[785]=t|e;e=n;t=n+8|0}else{t=n+8|0;e=Y[t>>2]|0}Y[t>>2]=s;Y[e+12>>2]=s;Y[s+8>>2]=e;Y[s+12>>2]=n;return}e=i>>>8;if(e){if(i>>>0>16777215)r=31;else{o=(e+1048320|0)>>>16&8;l=e<<o;a=(l+520192|0)>>>16&4;l=l<<a;r=(l+245760|0)>>>16&2;r=14-(a|o|r)+(l<<r>>>15)|0;r=i>>>(r+7|0)&1|r<<1}}else r=0;e=3444+(r<<2)|0;Y[s+28>>2]=r;Y[s+20>>2]=0;Y[s+16>>2]=0;t=Y[786]|0;n=1<<r;e:do{if(!(t&n)){Y[786]=t|n;Y[e>>2]=s;Y[s+24>>2]=e;Y[s+12>>2]=s;Y[s+8>>2]=s}else{e=Y[e>>2]|0;t:do{if((Y[e+4>>2]&-8|0)!=(i|0)){r=i<<((r|0)==31?0:25-(r>>>1)|0);while(1){n=e+16+(r>>>31<<2)|0;t=Y[n>>2]|0;if(!t)break;if((Y[t+4>>2]&-8|0)==(i|0)){e=t;break t}else{r=r<<1;e=t}}Y[n>>2]=s;Y[s+24>>2]=e;Y[s+12>>2]=s;Y[s+8>>2]=s;break e}}while(0);o=e+8|0;l=Y[o>>2]|0;Y[l+12>>2]=s;Y[o>>2]=s;Y[s+8>>2]=l;Y[s+12>>2]=e;Y[s+24>>2]=0}}while(0);l=(Y[793]|0)+-1|0;Y[793]=l;if(l|0)return;e=3596;while(1){e=Y[e>>2]|0;if(!e)break;else e=e+8|0}Y[793]=-1;return}function ae(){return 3636}function oe(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,i=0;e:do{if(!n)e=0;else{while(1){r=H[e>>0]|0;i=H[t>>0]|0;if(r<<24>>24!=i<<24>>24)break;n=n+-1|0;if(!n){e=0;break e}else{e=e+1|0;t=t+1|0}}e=(r&255)-(i&255)|0}}while(0);return e|0}function se(e,t,n){e=e|0;t=t|0;n=n|0;if((n|0)<32){f(t>>>n|0);return e>>>n|(t&(1<<n)-1)<<32-n}f(0);return t>>>n-32|0}function le(e,t,n){e=e|0;t=t|0;n=n|0;if((n|0)<32){f(t<<n|(e&(1<<n)-1<<32-n)>>>32-n|0);return e<<n}f(e<<n-32|0);return 0}function ce(e,t,n,r){e=e|0;t=t|0;n=n|0;r=r|0;n=e+n>>>0;return(f(t+r+(n>>>0<e>>>0|0)>>>0|0),n|0)|0}function ue(e,t,n,r){e=e|0;t=t|0;n=n|0;r=r|0;r=t-r-(n>>>0>e>>>0|0)>>>0;return(f(r|0),e-n>>>0|0)|0}function he(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,i=0,a=0;if((n|0)>=8192){g(e|0,t|0,n|0)|0;return e|0}a=e|0;i=e+n|0;if((e&3)==(t&3)){while(e&3){if(!n)return a|0;H[e>>0]=H[t>>0]|0;e=e+1|0;t=t+1|0;n=n-1|0}n=i&-4|0;r=n-64|0;while((e|0)<=(r|0)){Y[e>>2]=Y[t>>2];Y[e+4>>2]=Y[t+4>>2];Y[e+8>>2]=Y[t+8>>2];Y[e+12>>2]=Y[t+12>>2];Y[e+16>>2]=Y[t+16>>2];Y[e+20>>2]=Y[t+20>>2];Y[e+24>>2]=Y[t+24>>2];Y[e+28>>2]=Y[t+28>>2];Y[e+32>>2]=Y[t+32>>2];Y[e+36>>2]=Y[t+36>>2];Y[e+40>>2]=Y[t+40>>2];Y[e+44>>2]=Y[t+44>>2];Y[e+48>>2]=Y[t+48>>2];Y[e+52>>2]=Y[t+52>>2];Y[e+56>>2]=Y[t+56>>2];Y[e+60>>2]=Y[t+60>>2];e=e+64|0;t=t+64|0}while((e|0)<(n|0)){Y[e>>2]=Y[t>>2];e=e+4|0;t=t+4|0}}else{n=i-4|0;while((e|0)<(n|0)){H[e>>0]=H[t>>0]|0;H[e+1>>0]=H[t+1>>0]|0;H[e+2>>0]=H[t+2>>0]|0;H[e+3>>0]=H[t+3>>0]|0;e=e+4|0;t=t+4|0}}while((e|0)<(i|0)){H[e>>0]=H[t>>0]|0;e=e+1|0;t=t+1|0}return a|0}function de(e,t,n){e=e|0;t=t|0;n=n|0;var r=0;if((t|0)<(e|0)&(e|0)<(t+n|0)){r=e;t=t+n|0;e=e+n|0;while((n|0)>0){e=e-1|0;t=t-1|0;n=n-1|0;H[e>>0]=H[t>>0]|0}e=r}else he(e,t,n)|0;return e|0}function pe(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,i=0,a=0,o=0;a=e+n|0;t=t&255;if((n|0)>=67){while(e&3){H[e>>0]=t;e=e+1|0}r=a&-4|0;o=t|t<<8|t<<16|t<<24;i=r-64|0;while((e|0)<=(i|0)){Y[e>>2]=o;Y[e+4>>2]=o;Y[e+8>>2]=o;Y[e+12>>2]=o;Y[e+16>>2]=o;Y[e+20>>2]=o;Y[e+24>>2]=o;Y[e+28>>2]=o;Y[e+32>>2]=o;Y[e+36>>2]=o;Y[e+40>>2]=o;Y[e+44>>2]=o;Y[e+48>>2]=o;Y[e+52>>2]=o;Y[e+56>>2]=o;Y[e+60>>2]=o;e=e+64|0}while((e|0)<(r|0)){Y[e>>2]=o;e=e+4|0}}while((e|0)<(a|0)){H[e>>0]=t;e=e+1|0}return a-n|0}function fe(e){e=e|0;var t=0,n=0;n=Y[i>>2]|0;t=n+e|0;if((e|0)>0&(t|0)<(n|0)|(t|0)<0){x(t|0)|0;m(12);return-1}if((t|0)>(v()|0)?(y(t|0)|0)==0:0){m(12);return-1}Y[i>>2]=t;return n|0}return{_bitshift64Lshr:se,_bitshift64Shl:le,_decompress:B,_free:ie,_get_curr_output_length:te,_get_in_buffer_ptr:k,_get_out_buffer_ptr:V,_i64Add:ce,_i64Subtract:ue,_in_buffer_set_pos:j,_in_buffer_set_size:W,_init_decompressor:U,_is_input_end_reached:ne,_malloc:re,_memcpy:he,_memmove:de,_memset:pe,_out_buffer_set_pos:X,_out_buffer_set_size:ee,_sbrk:fe,establishStackSpace:S,stackAlloc:A,stackRestore:T,stackSave:M}}({Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},{a:Sf,b:function(e){zp=e},c:function(){return zp},d:function(e){return Cp.___errno_location&&(qp[Cp.___errno_location()>>2]=e),e},e:function(){return Hp.length},f:function(e,t,n){Yp.set(Yp.subarray(t,t+n),e)},g:function(e){cf()},h:cf,i:1052480,j:1052240},Xp),vf=(Cp._bitshift64Lshr=mf._bitshift64Lshr,Cp._bitshift64Shl=mf._bitshift64Shl,Cp._decompress=mf._decompress,Cp._free=mf._free,Cp._get_curr_output_length=mf._get_curr_output_length,Cp._get_in_buffer_ptr=mf._get_in_buffer_ptr,Cp._get_out_buffer_ptr=mf._get_out_buffer_ptr,Cp._i64Add=mf._i64Add,Cp._i64Subtract=mf._i64Subtract,Cp._in_buffer_set_pos=mf._in_buffer_set_pos,Cp._in_buffer_set_size=mf._in_buffer_set_size,Cp._init_decompressor=mf._init_decompressor,Cp._is_input_end_reached=mf._is_input_end_reached,Cp._malloc=mf._malloc,Cp._memcpy=mf._memcpy,Cp._memmove=mf._memmove,Cp._memset=mf._memset,Cp._out_buffer_set_pos=mf._out_buffer_set_pos,Cp._out_buffer_set_size=mf._out_buffer_set_size,Cp._sbrk=mf._sbrk,Cp.establishStackSpace=mf.establishStackSpace,Cp.stackAlloc=mf.stackAlloc),gf=Cp.stackRestore=mf.stackRestore,yf=Cp.stackSave=mf.stackSave;if(Cp.asm=mf,Cp.cwrap=function(e,t,n,r){var i=(n=n||[]).every(function(e){return"number"===e});return"string"!==t&&i&&!r?Vp(e):function(){return jp(e,t,n,arguments)}},of)if(lf(of)||(ff=of,of=Cp.locateFile?Cp.locateFile(ff,Dp):Dp+ff),Ip||Rp){var xf=Cp.readBinary(of);Yp.set(xf,8)}else{nf++,Cp.monitorRunDependencies&&Cp.monitorRunDependencies(nf);var _f=function(e){e.byteLength&&(e=new Uint8Array(e)),Yp.set(e,8),Cp.memoryInitializerRequest&&delete Cp.memoryInitializerRequest.response,function(e){if(nf--,Cp.monitorRunDependencies&&Cp.monitorRunDependencies(nf),0==nf&&(null!==rf&&(clearInterval(rf),rf=null),af)){var t=af;af=null,t()}}()},bf=function(){Cp.readAsync(of,_f,function(){throw"could not load memory initializer "+of})},wf=pf(of);if(wf)_f(wf.buffer);else if(Cp.memoryInitializerRequest){var Af=function(){var e=Cp.memoryInitializerRequest,t=e.response;if(200!==e.status&&0!==e.status){var n=pf(Cp.memoryInitializerRequestURL);if(!n)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+e.status+", retrying "+of),void bf();t=n.buffer}_f(t)};Cp.memoryInitializerRequest.response?setTimeout(Af,0):Cp.memoryInitializerRequest.addEventListener("load",Af)}else bf()}function Mf(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Tf(e){function t(){Cp.calledRun||(Cp.calledRun=!0,Gp||(tf||(tf=!0,Zp(Jp)),Zp($p),Cp.onRuntimeInitialized&&Cp.onRuntimeInitialized(),function(){if(Cp.postRun)for("function"==typeof Cp.postRun&&(Cp.postRun=[Cp.postRun]);Cp.postRun.length;)e=Cp.postRun.shift(),ef.unshift(e);var e;Zp(ef)}()))}e=e||Cp.arguments,0<nf||(!function(){if(Cp.preRun)for("function"==typeof Cp.preRun&&(Cp.preRun=[Cp.preRun]);Cp.preRun.length;)e=Cp.preRun.shift(),Kp.unshift(e);var e;Zp(Kp)}(),0<nf||Cp.calledRun||(Cp.setStatus?(Cp.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Cp.setStatus("")},1),t()},1)):t()))}function Sf(e){throw Cp.onAbort&&Cp.onAbort(e),e=void 0!==e?(Up(e),Bp(e),JSON.stringify(e)):"",Gp=!0,1,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if((Mf.prototype=new Error).constructor=Mf,af=function e(){Cp.calledRun||Tf(),Cp.calledRun||(af=e)},Cp.run=Tf,Cp.abort=Sf,Cp.preInit)for("function"==typeof Cp.preInit&&(Cp.preInit=[Cp.preInit]);0<Cp.preInit.length;)Cp.preInit.pop()();Cp.noExitRuntime=!0,Tf();var Lf=Cp;Lf._lock=!1;var Cf,Ef,Pf,Rf={getPageParams:function(){var e=decodeURIComponent(location.href.toString()),t={};if(-1==e.indexOf("?"))return t;for(var n=e.split("#")[0].split("?")[1].split("&"),r=0;r<n.length;r++){var i=n[r].split("="),a=i[0];1==i.length?t[a]="":t[a]=i[1]}return t},updatePageParam:function(e,t,n){var r=null,i="",a=e.split("?"),o=a[0],s=a[1],l="";if(s){var c=(h=s.split("#"))[0];(r=h[1])&&(s=c),a=s.split("&");for(var u=0;u<a.length;u++)a[u].split("=")[0]!=t&&(i+=l+a[u],l="&")}else{var h;c=(h=o.split("#"))[0],r=h[1];c&&(o=c)}return r&&(n+="#"+r),o+"?"+i+(l+""+t+"="+n)},loadScript:function(e,t,n,r){var i=document.createElement("script");i.addEventListener("load",n,!1),i.addEventListener("error",r,!1),t.appendChild(i),i.src=e},drawWatermark:function(e,t){var n=["color: #fff;","opacity: 0.5;","font-size: 18px;","font-family: sans-serif;","text-align: center;","position: absolute;","bottom: 1%;","right: 1%;","user-select: none;","z-index: 9999;","pointer-events: none;","text-shadow: 1px 1px #000;"].join("\n"),r=document.createElement("div");r.setAttribute("style",n);var i=document.createTextNode(t);r.appendChild(i),e.appendChild(r)},isXML:function(e){return null!==e.match(/.*\.xml$/)},isJS:function(e){return null!==e.match(/.*\.js$/)},createLineObjectHTML:function(m,v,g,e,t,y){console.warn("v3d.AppUtils.createLineObjectHTML has been deprecated. Use v3d.LineHTML instead."),e=e||2,t=t?t.convertSRGBToLinear():new v3d.Color(1,0,.2),y=y||5;var x=new v3d.Vector3(1,0,0),n=new v3d.MeshLine;n.setGeometry([0,0,0,x.x,x.y,x.z]);var r=new v3d.MeshLineMaterial({color:t,lineWidth:e,sizeAttenuation:0}),_=new v3d.Mesh(n.geometry,r);_.name=v.name+"_LINE",v.add(_);var b=new v3d.Vector3,w=new v3d.Vector3,A=new v3d.Quaternion;m.renderCallbacks.push(function(){m.camera.updateMatrixWorld(),v.traverseAncestors(function(e){e.updateMatrixWorld()});var e=g.getBoundingClientRect(),t=(e.left+e.right)/2,n=(e.top+e.bottom)/2,r=v.getWorldPosition(b);r.project(m.camera);var i=(r.x+1)/2*m.getWidth(),a=(1-r.y)/2*m.getHeight(),o=(n-a)/(t-i),s=(e.height+2*y)/(e.width+2*y);if(Math.abs(o)>s)var l=((c=n<a?Math.min(e.bottom+y,a):Math.max(e.top-y,a))-a)/o+i;else var c=((l=i<t?Math.max(e.left-y,i):Math.min(e.right+y,i))-i)*o+a;var u=2*l/m.getWidth()-1,h=1-2*c/m.getHeight(),d=w.set(u,h,0);d.unproject(m.camera),v.worldToLocal(d);var p=d.length();_.scale.set(p,p,p),d.normalize();var f=A.setFromUnitVectors(x,d);_.setRotationFromQuaternion(f)})}};function Ff(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}Object.assign(Ff.prototype,{setCamera:function(e){},setSize:function(e,t){},dispose:function(){},render:function(e,t,n,r,i){console.error("v3d.Pass: .render() must be implemented in derived pass.")}}),Ff.FullScreenQuad=(Cf=new pr(-1,1,1,-1,0,1),Ef=new Jr(2,2),Pf=function(e){this._mesh=new Fi(Ef,e)},Object.defineProperty(Pf.prototype,"material",{get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}),Object.assign(Pf.prototype,{render:function(e){e.render(this._mesh,Cf)},dispose:function(){}}),Pf);var If={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{type:"t",value:null},luminosityThreshold:{type:"f",value:1},smoothWidth:{type:"f",value:1},defaultColor:{type:"c",value:new In(0)},defaultOpacity:{type:"f",value:0}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {","vec4 texel = texture2D(tDiffuse, vUv);","vec3 luma = vec3(0.299, 0.587, 0.114);","float v = dot(texel.xyz, luma);","vec4 outputColor = vec4(defaultColor.rgb, defaultOpacity);","float alpha = smoothstep(luminosityThreshold, luminosityThreshold + smoothWidth, v);","gl_FragColor = mix(outputColor, texel, alpha);","}"].join("\n")};function Of(e,t,n,r,i){Ff.call(this),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=r,this.resolution=void 0!==e?new Dt(e.x,e.y):new Dt(256,256),i=i||{minFilter:B,magFilter:B,format:Ge},this.clearColor=new In(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;var a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);this.renderTargetBright=new vn(a,o,i),this.renderTargetBright.texture.name="BloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(var s=0;s<this.nMips;s++){var l;(l=new vn(a,o,i)).texture.name="BloomPass.h"+s,l.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(l),(l=new vn(a,o,i)).texture.name="BloomPass.v"+s,l.texture.generateMipmaps=!1,this.renderTargetsVertical.push(l),a=Math.round(a/2),o=Math.round(o/2)}var c=If;this.highPassUniforms=Rn.clone(c.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new Ei({type:"BloomHighPass",uniforms:this.highPassUniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,defines:{}}),this.separableBlurMaterials=[];var u=[3,5,7,9,11];for(a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2),s=0;s<this.nMips;s++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(u[s])),this.separableBlurMaterials[s].uniforms.texSize.value=new Dt(a,o),a=Math.round(a/2),o=Math.round(o/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new Bt(1,1,1),new Bt(1,1,1),new Bt(1,1,1),new Bt(1,1,1),new Bt(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;var h=Un.copy;this.copyUniforms=Rn.clone(h.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new Ei({type:"BloomCopy",defines:h.defines,uniforms:this.copyUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:J,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new In,this.oldClearAlpha=1,this.basic=new ti,this.fsQuad=new Ff.FullScreenQuad(null)}function Nf(e,t){Ff.call(this),this.textureID=void 0!==t?t:"tDiffuse",e instanceof Ei?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Rn.clone(e.uniforms),this.material=new Ei({type:"ShaderPass",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Ff.FullScreenQuad(this.material)}function Df(){Nf.call(this,Un.brightness_contrast),Object.defineProperties(this,{brightness:{get:function(){return this.uniforms.brightness.value},set:function(e){this.uniforms.brightness.value=e}},contrast:{get:function(){return this.uniforms.contrast.value},set:function(e){this.uniforms.contrast.value=e}}})}function Uf(e,t,n){Ff.call(this),this.scene=e,this.camera=t;var r=new vn(n.width||window.innerWidth||1,n.height||window.innerHeight||1,{minFilter:B,magFilter:B,format:Ge});this.renderTargetDepth=r.clone(),this.renderTargetDepth.texture.name="BokehPass.depth",this.materialDepth=new oo,this.materialDepth.depthPacking=Et,this.materialDepth.blending=Z;var i=Un.bokeh,a=Rn.clone(i.uniforms);a.tDepth.value=this.renderTargetDepth.texture,a.focus.value=jn(n.focus)?n.focus:1,a.aperture.value=jn(n.aperture)?n.aperture:1,a.maxblur.value=jn(n.maxblur)?n.maxblur:1,a.depthLeakThreshold.value=jn(n.depthLeakThreshold)?n.depthLeakThreshold:.2,a.nearClip.value=t.near,a.farClip.value=t.far,a.aspect.value=t.aspect,Object.defineProperties(this,{focus:{get:function(){return this.uniforms.focus.value},set:function(e){this.uniforms.focus.value=e}},aperture:{get:function(){return this.uniforms.aperture.value},set:function(e){this.uniforms.aperture.value=e}},maxblur:{get:function(){return this.uniforms.maxblur.value},set:function(e){this.uniforms.maxblur.value=e}},depthLeakThreshold:{get:function(){return this.uniforms.depthLeakThreshold.value},set:function(e){this.uniforms.depthLeakThreshold.value=e}}}),this.materialBokeh=new Ei({type:"Bokeh",defines:i.defines,uniforms:a,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}),this.uniforms=a,this.camera2=new pr(-1,1,1,-1,0,1),this.scene2=new Wo,this.quad2=new Fi(new Jr(2,2),null),this.quad2.frustumCulled=!1,this.scene2.add(this.quad2),this.oldClearColor=new In,this.oldClearAlpha=1}function Bf(e,t){Ff.call(this),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}function zf(){Ff.call(this),this.needsSwap=!1}function Gf(e,t){if(this.renderer=e,void 0===t){var n={minFilter:B,magFilter:B,format:Ge,stencilBuffer:!1},r=e.getDrawingBufferSize();(t=new vn(r.width,r.height,n)).texture.name="EffectComposer.rt1",t.texture.encoding=wt}this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Nf(Un.copy),this._previousFrameTime=Date.now()}function kf(e,t,n,r){Nf.call(this,Un.fxaa),this.width=void 0!==n?n:512,this.height=void 0!==r?r:256,this.needsSwap=!1}Of.prototype=Object.assign(Object.create(Ff.prototype),{constructor:Of,dispose:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose()},setSize:function(e,t){var n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(var i=0;i<this.nMips;i++)this.renderTargetsHorizontal[i].setSize(n,r),this.renderTargetsVertical[i].setSize(n,r),this.separableBlurMaterials[i].uniforms.texSize.value=new Dt(n,r),n=Math.round(n/2),r=Math.round(r/2)},render:function(e,t,n,r,i){this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();var a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.context.disable(e.context.STENCIL_TEST),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);for(var o=this.renderTargetBright,s=0;s<this.nMips;s++)this.fsQuad.material=this.separableBlurMaterials[s],this.separableBlurMaterials[s].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[s].uniforms.direction.value=Of.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[s]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[s].uniforms.colorTexture.value=this.renderTargetsHorizontal[s].texture,this.separableBlurMaterials[s].uniforms.direction.value=Of.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[s]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[s];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.context.enable(e.context.STENCIL_TEST),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=a},getSeperableBlurMaterial:function(e){return new Ei({type:"BloomSeparableBlur",defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new Dt(.5,.5)},direction:{value:new Dt(.5,.5)}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"#include <common> varying vec2 vUv;\n uniform sampler2D colorTexture;\n uniform vec2 texSize; uniform vec2 direction; float gaussianPdf(in float x, in float sigma) { return 0.39894 * exp(-0.5 * x * x/(sigma * sigma))/sigma; } void main() {\n vec2 invSize = 1.0 / texSize; float fSigma = float(SIGMA); float weightSum = gaussianPdf(0.0, fSigma); vec3 diffuseSum = texture2D(colorTexture, vUv).rgb * weightSum; for(int i = 1; i < KERNEL_RADIUS; i++) { float x = float(i); float w = gaussianPdf(x, fSigma); vec2 uvOffset = direction * invSize * x; vec3 sample1 = texture2D(colorTexture, vUv + uvOffset).rgb; vec3 sample2 = texture2D(colorTexture, vUv - uvOffset).rgb; diffuseSum += (sample1 + sample2) * w; weightSum += 2.0 * w; } gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n }"})},getCompositeMaterial:function(e){return new Ei({type:"BloomComposite",defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"varying vec2 vUv; uniform sampler2D blurTexture1; uniform sampler2D blurTexture2; uniform sampler2D blurTexture3; uniform sampler2D blurTexture4; uniform sampler2D blurTexture5; uniform sampler2D dirtTexture; uniform float bloomStrength; uniform float bloomRadius; uniform float bloomFactors[NUM_MIPS]; uniform vec3 bloomTintColors[NUM_MIPS]; float lerpBloomFactor(const in float factor) { float mirrorFactor = 1.2 - factor; return mix(factor, mirrorFactor, bloomRadius); } void main() { gl_FragColor = bloomStrength * (lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv)); }"})}}),Of.BlurDirectionX=new Dt(1,0),Of.BlurDirectionY=new Dt(0,1),Nf.prototype=Object.assign(Object.create(Ff.prototype),{constructor:Nf,render:function(e,t,n,r,i){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)},dispose:function(){this.material.dispose()}}),Df.prototype=Object.assign(Object.create(Nf.prototype),{constructor:Df}),Uf.prototype=Object.assign(Object.create(Ff.prototype),{constructor:Uf,render:function(e,t,n,r,i){this.quad2.material=this.materialBokeh,this.scene.overrideMaterial=this.materialDepth,this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();e.autoClear;e.autoClear=!1,e.setClearColor(16777215),e.setClearAlpha(1),e.setRenderTarget(this.renderTargetDepth),e.clear(),e.render(this.scene,this.camera),this.uniforms.tColor.value=n.texture,this.uniforms.nearClip.value=this.camera.near,this.uniforms.farClip.value=this.camera.far,this.uniforms.aspect.value=this.camera.aspect,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),e.clear()),e.render(this.scene2,this.camera2),this.scene.overrideMaterial=null,e.setClearColor(this.oldClearColor),e.setClearAlpha(this.oldClearAlpha),e.autoClear=this.oldAutoClear},setCamera:function(e){this.camera=e},setSize:function(e,t){this.renderTargetDepth.setSize(e,t)},dispose:function(){this.renderTargetDepth.dispose()}}),Bf.prototype=Object.assign(Object.create(Ff.prototype),{constructor:Bf,render:function(e,t,n,r,i){var a,o,s=e.context,l=e.state;l.buffers.color.setMask(!1),l.buffers.depth.setMask(!1),l.buffers.color.setLocked(!0),l.buffers.depth.setLocked(!0),o=this.inverse?(a=0,1):(a=1,0),l.buffers.stencil.setTest(!0),l.buffers.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),l.buffers.stencil.setFunc(s.ALWAYS,a,4294967295),l.buffers.stencil.setClear(o),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),l.buffers.color.setLocked(!1),l.buffers.depth.setLocked(!1),l.buffers.stencil.setFunc(s.EQUAL,1,4294967295),l.buffers.stencil.setOp(s.KEEP,s.KEEP,s.KEEP)},setCamera:function(e){this.camera=e}}),zf.prototype=Object.create(Ff.prototype),Object.assign(zf.prototype,{render:function(e,t,n,r,i){e.state.buffers.stencil.setTest(!1)}}),Object.assign(Gf.prototype,{swapBuffers:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e},addPass:function(e){this.passes.push(e);var t=this.renderer.getDrawingBufferSize(new Dt);e.setSize(t.width,t.height)},insertPass:function(e,t){this.passes.splice(t,0,e)},isLastEnabledPass:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0},render:function(e){void 0===e&&(e=.001*(Date.now()-this._previousFrameTime)),this._previousFrameTime=Date.now();var t,n,r=this.renderer.getRenderTarget(),i=!1,a=this.passes.length;for(n=0;n<a;n++)if(!1!==(t=this.passes[n]).enabled){if(t.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),t.render(this.renderer,this.writeBuffer,this.readBuffer,e,i),t.needsSwap){if(i){var o=this.renderer.context;o.stencilFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),o.stencilFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}t instanceof Bf?i=!0:t instanceof zf&&(i=!1)}this.renderer.setRenderTarget(r)},reset:function(e){if(void 0===e){var t=this.renderer.getDrawingBufferSize(new Dt);(e=this.renderTarget1.clone()).setSize(t.width,t.height)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(e,t){this.renderTarget1.setSize(e,t),this.renderTarget2.setSize(e,t);for(var n=0;n<this.passes.length;n++)this.passes[n].setSize(e,t)},dispose:function(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}});var Vf=[[0,0,!((kf.prototype=Object.create(Nf.prototype)).setSize=function(e,t){this.width=e,this.height=t,this.uniforms.resolution.value.set(1/e,1/t)}),!1],[2,0,!1,!1],[1,1,!0,!0],[0,1,!0,!0],[1,0,!1,!1],[2,1,!1,!1]];function jf(e){this.manager=void 0!==e?e:Ec}Object.assign(jf.prototype,{crossOrigin:"Anonymous",load:function(e,s,t,n){var l=new Wi,r=new Nc(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);var c=0;return r.load(e,function(e){for(var t=0;t<Vf.length;t++){var n=Vf[t],r=document.createElement("canvas"),i=e.width/3,a=e.height/2;r.width=i,r.height=a;var o=r.getContext("2d");n[2]&&(o.translate(i,0),o.scale(-1,1)),n[3]&&(o.translate(0,a),o.scale(1,-1)),o.drawImage(e,n[0]*i,n[1]*a,i,a,0,0,i,a),l.images[t]=r,6===++c&&(l.needsUpdate=!0,s&&s(l))}},void 0,n),l},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}});var Wf=["","Memory allocation failed","Memory usage limit reached","Unsupported check; not verifying file integrity","Not an .xz file","Unsupported options in the .xz headers","File is corrupt","Unknown decompression bug"];function Xf(e){this.manager=void 0!==e?e:Ec}function Hf(e){this.manager=void 0!==e?e:Ec,this.type=Ue}function Yf(e,t){nl.call(this,e,t),this.type="BlenderTextGeometry",this.computeBoundingBox();var n,r,i=this.boundingBox.max.x-this.boundingBox.min.x,a=this.boundingBox.max.y-this.boundingBox.min.y;switch(t.alignX){case"left":n=0;break;case"center":n=-.5*i;break;case"right":n=-i}switch(t.alignY){case"bottom":r=0;break;case"center":r=-.5*a;break;case"top":r=-a}(0<Math.abs(n)||0<Math.abs(r))&&this.translate(n,r,0)}function qf(){this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this.geometry=new qr,this.widthCallback=null}function Qf(e,t,n,r,i){var a;if(e=e.subarray||e.slice?e:e.buffer,n=n.subarray||n.slice?n:n.buffer,e=t?e.subarray?e.subarray(t,i&&t+i):e.slice(t,i&&t+i):e,n.set)n.set(e,r);else for(a=0;a<e.length;a++)n[a+r]=e[a];return n}function Zf(e){this.headEdge=this.tailEdge=e,this.headIndex=e.index0,this.tailIndex=e.index1,this.indexCount=2}function Kf(e,t){this.index0=e,this.index1=t,this.edge0=null,this.edge1=null}function Jf(){this.geometry=new qr}function $f(e){wl.call(this),this.type="MeshLineMaterial",this.lineWidth=1,this.sizeAttenuation=1,this.color=new In(16777215),this.opacity=1,this.useMap=0,this.map=null,this.useAlphaMap=0,this.alphaMap=null,this.resolution=new Dt(1,1),this.visibility=1,this.alphaTest=0,this.repeat=new Dt(1,1),this.uniforms={lineWidth:{value:1},sizeAttenuation:{value:1},color:{value:new In(16777215)},opacity:{value:1},useMap:{value:0},map:{value:null},alphaMap:{value:null},useAlphaMap:{value:0},resolution:{value:new Dt(1,1)},visibility:{value:1},alphaTest:{value:0},repeat:{value:new Dt(1,1)}},this.vertexShader=Tn.raw_meshline_vert,this.fragmentShader=Tn.raw_meshline_frag,this.setValues(e)}Object.assign(Xf.prototype,{crossOrigin:"Anonymous",load:function(r,i,t,a){void 0===r&&(r=""),void 0!==this.path&&(r=this.path+r);var o=this,e=Lc.get(r);if(void 0!==e)return o.manager.itemStart(r),setTimeout(function(){i&&i(e),o.manager.itemEnd(r)},0),e;var n=new XMLHttpRequest;return n.open("GET",r,!0),n.addEventListener("load",function(e){var t=e.target.response;if(200===this.status||0===this.status){0===this.status&&console.warn("v3d.XZLoader: HTTP Status 0 received.");var n=function(){Lf._lock?setTimeout(n,1):o.decompressArrayBuffer(t,function(e){i&&i(e),o.manager.itemEnd(r),Lc.add(r,e)},function(e){a&&a(e),o.manager.itemEnd(r),o.manager.itemError(r)})};setTimeout(n,1)}else a&&a(e),o.manager.itemEnd(r),o.manager.itemError(r)},!1),t&&n.addEventListener("progress",function(e){t(e)},!1),n.addEventListener("error",function(e){a&&a(e),o.manager.itemEnd(r),o.manager.itemError(r)},!1),n.responseType="arraybuffer",n.send(null),o.manager.itemStart(r),n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},decompressArrayBuffer:function(e,l,c){var u=this;function h(e){var t=u._emGetInBufferPtr();Lf.HEAPU8.set(e,t),u._emInBufferSetPos(0),u._emInBufferSetSize(e.length),d()}function d(){u._emOutBufferSetPos(0)}Lf._lock=!0;var t=u._emInitDecompressor();if(0!=t)return console.error("XZLoader._emInitDecompressor: error code "+t+" ("+Wf[t]+")"),void(c&&c(t));var p=new Uint8Array(e),f=p.length,m=[],v=0,g=Math.min(524288,f),y=0;h(p.subarray(v,g)),function e(){var t,n,r=u._emDecompress();if(r)console.error("XZLoader._emDecompress: error code "+r+" ("+Wf[r]+")"),Lf._lock=!1,c&&c(r);else{var i=u._emGetCurrOutputLength();if(m.push((t=i,n=u._emGetOutBufferPtr(),new Uint8Array(Lf.HEAPU8.subarray(n,n+t)))),d(),u._emIsInputEndReached()&&(v=g,g=Math.min(g+524288,f),h(p.subarray(v,g))),v==g){var a=m.reduce(function(e,t,n,r){return e+t.length},0),o=new Uint8Array(a),s=0;m.forEach(function(e){o.set(e,s),s+=e.length}),Lf._lock=!1,l&&l(o.buffer)}else++y%2==0?setTimeout(e,1):e()}}()},_emInitDecompressor:Lf.cwrap("init_decompressor","number"),_emDecompress:Lf.cwrap("decompress","number"),_emGetInBufferPtr:Lf.cwrap("get_in_buffer_ptr","number"),_emGetOutBufferPtr:Lf.cwrap("get_out_buffer_ptr","number"),_emInBufferSetPos:Lf.cwrap("in_buffer_set_pos",null,["number"]),_emInBufferSetSize:Lf.cwrap("in_buffer_set_size",null,["number"]),_emOutBufferSetPos:Lf.cwrap("out_buffer_set_pos",null,["number"]),_emOutBufferSetSize:Lf.cwrap("out_buffer_set_size",null,["number"]),_emGetCurrOutputLength:Lf.cwrap("get_curr_output_length","number"),_emIsInputEndReached:Lf.cwrap("is_input_end_reached","number")}),(Hf.prototype=Object.create(Oc.prototype))._parser=function(e){var y=function(e,t){switch(e){case 1:console.error("v3d.RGBELoader Read Error: "+(t||""));break;case 2:console.error("v3d.RGBELoader Write Error: "+(t||""));break;case 3:console.error("v3d.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("v3d.RGBELoader: Error: "+(t||""))}return-1},l=function(e,t,n){t=t||1024;for(var r=e.pos,i=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));(i=s.indexOf("\n"))<0&&a<t&&r<e.byteLength;)o+=s,a+=s.length,r+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<i&&(!1!==n&&(e.pos+=a+i+1),o+s.slice(0,i))},t=new Uint8Array(e);t.byteLength;t.pos=0;var n,r,i,a,o,s,c=function(e){var t,n,r=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,s={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=l(e)))return y(1,"no header found");if(!(n=t.match(/^#\?(\S+)$/)))return y(3,"bad initial token");for(s.valid|=1,s.programtype=n[1],s.string+=t+"\n";!1!==(t=l(e));)if(s.string+=t+"\n","#"!==t.charAt(0)){if((n=t.match(r))&&(s.gamma=parseFloat(n[1],10)),(n=t.match(i))&&(s.exposure=parseFloat(n[1],10)),(n=t.match(a))&&(s.valid|=2,s.format=n[1]),(n=t.match(o))&&(s.valid|=4,s.height=parseInt(n[1],10),s.width=parseInt(n[2],10)),2&s.valid&&4&s.valid)break}else s.comments+=t+"\n";return 2&s.valid?4&s.valid?s:y(3,"missing image size specifier"):y(3,"missing format specifier")}(t);if(-1!==c){var u=c.width,h=c.height,d=function(e,t,n){var r,i,a,o,s,l,c,u,h,d,p,f,m,v=t,g=n;if(v<8||32767<v||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(v!==(e[2]<<8|e[3]))return y(3,"wrong scanline width");if(!(r=new Uint8Array(4*t*n))||!r.length)return y(4,"unable to allocate buffer space");for(a=i=0,u=4*v,m=new Uint8Array(4),l=new Uint8Array(u);0<g&&a<e.byteLength;){if(a+4>e.byteLength)return y(1);if(m[0]=e[a++],m[1]=e[a++],m[2]=e[a++],m[3]=e[a++],2!=m[0]||2!=m[1]||(m[2]<<8|m[3])!=v)return y(3,"bad rgbe scanline format");for(c=0;c<u&&a<e.byteLength;){if((f=128<(o=e[a++]))&&(o-=128),0===o||u<c+o)return y(3,"bad scanline data");if(f)for(s=e[a++],h=0;h<o;h++)l[c++]=s;else l.set(e.subarray(a,a+o),c),c+=o,a+=o}for(d=v,h=0;h<d;h++)p=0,r[i]=l[h+p],p+=v,r[i+1]=l[h+p],p+=v,r[i+2]=l[h+p],p+=v,r[i+3]=l[h+p],i+=4;g--}return r}(t.subarray(t.pos),u,h);if(-1!==d){if(this.type===Ue)var p=d,f=ke,m=Ue;else if(this.type===Be){for(var v=d.length/4*3,g=new Float32Array(v),x=0;x<v;x++)i=g,a=3*x,void 0,o=(n=d)[(r=4*x)+3],s=Math.pow(2,o-128)/255,i[a+0]=n[r+0]*s,i[a+1]=n[r+1]*s,i[a+2]=n[r+2]*s;p=g,f=ze,m=Be}else console.error("v3d.RGBELoader: unsupported type: ",this.type);return{width:u,height:h,data:p,header:c.string,gamma:c.gamma,exposure:c.exposure,format:f,type:m}}}return null},Hf.prototype.setType=function(e){return this.type=e,this},Hf.prototype.setCrossOrigin=function(e){return this},((Yf.prototype=Object.create(nl.prototype)).constructor=Yf).prototype.cloneWithText=function(e){var t=this.parameters.parameters;return new Yf(e,{font:t.font,size:t.size,height:t.height,curveSegments:t.curveSegments,bevelEnabled:t.bevelEnabled,bevelThickness:t.bevelThickness,bevelSize:t.bevelSize,alignX:t.alignX,alignY:t.alignY})},qf.prototype.setGeometry=function(e,t){if(this.widthCallback=t,this.positions=[],this.counters=[],e instanceof Ar)for(var n=0;n<e.vertices.length;n++){var r=e.vertices[n];t=n/e.vertices.length;this.positions.push(r.x,r.y,r.z),this.positions.push(r.x,r.y,r.z),this.counters.push(t),this.counters.push(t)}if(e instanceof Float32Array||e instanceof Array)for(n=0;n<e.length;n+=3){t=n/e.length;this.positions.push(e[n],e[n+1],e[n+2]),this.positions.push(e[n],e[n+1],e[n+2]),this.counters.push(t),this.counters.push(t)}this.process()},qf.prototype.compareV3=function(e,t){var n=6*e,r=6*t;return this.positions[n]===this.positions[r]&&this.positions[n+1]===this.positions[r+1]&&this.positions[n+2]===this.positions[r+2]},qf.prototype.copyV3=function(e){var t=6*e;return[this.positions[t],this.positions[t+1],this.positions[t+2]]},qf.prototype.process=function(){var e,t,n=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];for(var r=0;r<n;r++)this.side.push(1),this.side.push(-1);for(r=0;r<n;r++)e=this.widthCallback?this.widthCallback(r/(n-1)):1,this.width.push(e),this.width.push(e);for(r=0;r<n;r++)this.uvs.push(r/(n-1),0),this.uvs.push(r/(n-1),1);t=this.compareV3(0,n-1)?this.copyV3(n-2):this.copyV3(0),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);for(r=0;r<n-1;r++)t=this.copyV3(r),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);for(r=1;r<n;r++)t=this.copyV3(r),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]);t=this.compareV3(n-1,0)?this.copyV3(1):this.copyV3(n-1),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]);for(r=0;r<n-1;r++){var i=2*r;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}this.attributes?(this.attributes.position.copyArray(new Float32Array(this.positions)),this.attributes.position.needsUpdate=!0,this.attributes.previous.copyArray(new Float32Array(this.previous)),this.attributes.previous.needsUpdate=!0,this.attributes.next.copyArray(new Float32Array(this.next)),this.attributes.next.needsUpdate=!0,this.attributes.side.copyArray(new Float32Array(this.side)),this.attributes.side.needsUpdate=!0,this.attributes.width.copyArray(new Float32Array(this.width)),this.attributes.width.needsUpdate=!0,this.attributes.uv.copyArray(new Float32Array(this.uvs)),this.attributes.uv.needsUpdate=!0,this.attributes.counters.copyArray(new Float32Array(this.counters)),this.attributes.counters.needsUpdate=!0,this.attributes.index.copyArray(new Uint16Array(this.indices_array)),this.attributes.index.needsUpdate=!0):this.attributes={position:new Mr(new Float32Array(this.positions),3),previous:new Mr(new Float32Array(this.previous),3),next:new Mr(new Float32Array(this.next),3),side:new Mr(new Float32Array(this.side),1),width:new Mr(new Float32Array(this.width),1),uv:new Mr(new Float32Array(this.uvs),2),counters:new Mr(new Float32Array(this.counters),1),index:new Mr(new Uint16Array(this.indices_array),1)},this.geometry.addAttribute("position",this.attributes.position),this.geometry.addAttribute("previous",this.attributes.previous),this.geometry.addAttribute("next",this.attributes.next),this.geometry.addAttribute("side",this.attributes.side),this.geometry.addAttribute("width",this.attributes.width),this.geometry.addAttribute("uv",this.attributes.uv),this.geometry.addAttribute("counters",this.attributes.counters),this.geometry.setIndex(this.attributes.index)},qf.prototype.advance=function(e){var t=this.attributes.position.array,n=this.attributes.previous.array,r=this.attributes.next.array,i=t.length;Qf(t,0,n,0,i),Qf(t,6,t,0,i-6),t[i-6]=e.x,t[i-5]=e.y,t[i-4]=e.z,t[i-3]=e.x,t[i-2]=e.y,t[i-1]=e.z,Qf(t,6,r,0,i-6),r[i-6]=e.x,r[i-5]=e.y,r[i-4]=e.z,r[i-3]=e.x,r[i-2]=e.y,r[i-1]=e.z,this.attributes.position.needsUpdate=!0,this.attributes.previous.needsUpdate=!0,this.attributes.next.needsUpdate=!0},Object.assign(Zf.prototype,{mergeStrip:function(e){var t=this.headIndex,n=e.headIndex,r=this.tailIndex,i=e.tailIndex;t==n?(this.headEdge.linkToEdge(e.headEdge),e.headEdge.linkToEdge(this.headEdge),this.headEdge=e.tailEdge,this.headIndex=e.tailIndex,this.indexCount+=e.indexCount-1):t==i?(this.headEdge.linkToEdge(e.tailEdge),e.tailEdge.linkToEdge(this.headEdge),this.headEdge=e.headEdge,this.headIndex=e.headIndex,this.indexCount+=e.indexCount-1):r==n?(this.tailEdge.linkToEdge(e.headEdge),e.headEdge.linkToEdge(this.tailEdge),this.tailEdge=e.tailEdge,this.tailIndex=e.tailIndex,this.indexCount+=e.indexCount-1):r==i&&(this.tailEdge.linkToEdge(e.tailEdge),e.tailEdge.linkToEdge(this.tailEdge),this.tailEdge=e.headEdge,this.tailIndex=e.headIndex,this.indexCount+=e.indexCount-1)},getIndicesFlat:function(){for(var e=new Float32Array(this.indexCount),t=0,n=null,r=this.headEdge,i=e[t++]=this.headIndex;null!==r;){i=r.index0==i?r.index1:r.index0;e[t++]=i;var a=r.edge0;a!=n&&null!==a||(a=r.edge1),a==n&&(a=null),n=r,r=a}return e}}),Object.assign(Kf.prototype,{linkToEdge:function(e){null===this.edge0?this.edge0=e:null===this.edge1&&(this.edge1=e)}}),Object.assign(Jf.prototype,{fromBufferGeometry:function(){function m(e,t,n){var r=e.headIndex,i=e.tailIndex;return t[r][0]||t[i][0]||n[r][0]||n[i][0]||null}return function(e){var r=e.getAttribute("position"),t=e.getIndex();if(void 0!==r){var i=[];if(null!==t){(function(e){for(var t=e.length%2?e.length-1:e.length,n={},r={},i=0;i<t;i+=2){var a=(u=new Zf(new Kf(e[i],e[i+1]))).headIndex,o=u.tailIndex;n[a]=n[a]||[],n[o]=n[o]||[],r[a]=r[a]||[],r[o]=r[o]||[],n[a].push(u),r[o].push(u)}var s=new Fl.LinkMap;for(var l in n)n[l].length&&s.push(new Fl.LinkMapNode(n[l]),l);for(var c=[],u=s.first&&s.first.value[0];u;){n[a=u.headIndex].splice(n[a].indexOf(u),1),r[o=u.tailIndex].splice(r[o].indexOf(u),1),0==n[a].length&&s.removeNodeByKey(a);for(var h=m(u,n,r);null!==h;)n[a=h.headIndex].splice(n[a].indexOf(h),1),r[o=h.tailIndex].splice(r[o].indexOf(h),1),0==n[a].length&&s.removeNodeByKey(a),u.mergeStrip(h),h=m(u,n,r);c.push(u),u=s.first&&s.first.value[0]}return c})(t.array).forEach(function(e){var t=new qf,n=new Float32Array(3*e.indexCount);e.getIndicesFlat().forEach(function(e,t){n.set(r.array.subarray(3*e,3*e+3),3*t)}),t.setGeometry(n),i.push(t)})}else{var n=new qf;n.setGeometry(r.array),i.push(n)}var a=[],o=[],s=[],l=[],c=[],u=[],h=[],d=[],p=0;i.forEach(function(e){a=a.concat(e.positions),o=o.concat(e.previous),s=s.concat(e.next),l=l.concat(e.side),c=c.concat(e.width),u=u.concat(e.uvs),h=h.concat(e.counters);var t=e.indices_array.map(function(e){return e+p});d=d.concat(t),p+=e.positions.length/3}),this.geometry.addAttribute("position",new Mr(new Float32Array(a),3)),this.geometry.addAttribute("previous",new Mr(new Float32Array(o),3)),this.geometry.addAttribute("next",new Mr(new Float32Array(s),3)),this.geometry.addAttribute("side",new Mr(new Float32Array(l),1)),this.geometry.addAttribute("width",new Mr(new Float32Array(c),1)),this.geometry.addAttribute("uv",new Mr(new Float32Array(u),2)),this.geometry.addAttribute("counters",new Mr(new Float32Array(h),1));var f=65535<Vn(d)?Uint32Array:Uint16Array;this.geometry.setIndex(new Mr(new f(d),1))}}}()}),$f.prototype=Object.assign(Object.create(wl.prototype),{constructor:$f,isMeshLineMaterial:!0,copy:function(e){return wl.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.sizeAttenuation=e.sizeAttenuation,this.color.copy(e.color),this.opacity=e.opacity,this.useMap=e.useMap,this.map=e.map,this.useAlphaMap=e.useAlphaMap,this.alphaMap=e.alphaMap,this.resolution.copy(e.resolution),this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}});var em=["TEXTURE","TEX_IMAGE","TEX_ENVIRONMENT","TEX_ENVIRONMENT_MAX","BITMAP_MAX","BITMAP_ENV_MAX","REFLECT_REFRACT_MAX"];function tm(e){this.manager=void 0!==e?e:Ec,this.crossOrigin="Anonymous",this.onProgress=null}function nm(){var n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}Object.assign(tm.prototype,{load:function(e,t,n,r){var i=this;i.onProgress=n||function(){};var a=this.path&&"string"==typeof this.path?this.path:bu.extractUrlBase(e),o=-1!=e.indexOf(".xz",e.length-3);if(o)var s=new Xf(i.manager);else(s=new Rc(i.manager)).setResponseType("arraybuffer");s.load(e,function(e){i.parse(e,a,t,r,o)},function(e){if(e.lengthComputable)var t=e.loaded/e.total*100;else t=100;i.onProgress(.3*t)},r)},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e},parse:function(e,t,s,n,r){var i,l=this,a={};i=Rm(new Uint8Array(e,0,4))===om?(a[rm.KHR_BINARY_GLTF]=new cm(e),a[rm.KHR_BINARY_GLTF].content):Rm(new Uint8Array(e));var o=JSON.parse(i);void 0===o.asset||o.asset.version[0]<2?n(new Error("v3d.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")):(o.extensionsUsed&&(0<=o.extensionsUsed.indexOf(rm.S8S_V3D_DATA)&&(a[rm.S8S_V3D_DATA]=new im(o)),0<=o.extensionsUsed.indexOf(rm.S8S_V3D_MATERIAL_DATA)&&(a[rm.S8S_V3D_MATERIAL_DATA]=new am(o))),new Im(o,a,{path:t||this.path,crossOrigin:this.crossOrigin,loadBinXZ:r,onProgress:function(e){l.onProgress(e)}}).parse(function(e,t,n,r,i,a){var o={scene:e,scenes:t,world:n,cameras:r,animations:i,renderer:a};l.onProgress(100),s(o)},n))}});var rm={KHR_BINARY_GLTF:"KHR_binary_glTF",S8S_V3D_ANIMATION_DATA:"S8S_v3d_animation_data",S8S_V3D_DATA:"S8S_v3d_data",S8S_V3D_CAMERA_DATA:"S8S_v3d_camera_data",S8S_V3D_MATERIAL_DATA:"S8S_v3d_material_data",S8S_V3D_MESH_DATA:"S8S_v3d_mesh_data",S8S_V3D_NODE_DATA:"S8S_v3d_node_data",S8S_V3D_SCENE_DATA:"S8S_v3d_scene_data",S8S_V3D_TEXTURE_DATA:"S8S_v3d_texture_data"};function im(e){this.name=rm.S8S_V3D_DATA;var t=e.extensions&&e.extensions[rm.S8S_V3D_DATA]||{};this.lights={};var n=t.lights||{};for(var r in n){var i,a=n[r],o=(new In).fromArray(a.color),s=jn(a.intensity)?a.intensity:1;switch(a.type){case"point":i=new mu(o,s);break;case"directional":i=new gu(o,s);break;case"spot":i=new fu(o,s);break;case"hemisphere":i=new hu(o,new In(0,0,0),s);break;case"ambient":i=new yu(o,s)}if(i){if(jn(a.distance)&&(i.distance=a.distance),jn(a.decay)&&(i.decay=a.decay,"blender"==a.profile&&2<=a.decay&&(i.intensity/=4*Math.PI)),jn(a.angle)&&(i.angle=a.angle),jn(a.penumbra)&&(i.penumbra=a.penumbra),jn(a.shadow)){if(i.castShadow=!0,i.shadow.bias=a.shadow.bias,i.shadow.radius=a.shadow.radius,i.shadow.mapSize.width=a.shadow.mapSize,i.shadow.mapSize.height=a.shadow.mapSize,i.shadow.camera.near=a.shadow.cameraNear,i.shadow.camera.far=a.shadow.cameraFar,i.isSpotLight)i.shadow.camera.fov=a.shadow.cameraFov;else if(i.isDirectionalLight){var l=a.shadow.cameraSize/2;i.shadow.camera.bottom=-l,i.shadow.camera.left=-l,i.shadow.camera.top=l,i.shadow.camera.right=l}}else i.castShadow=!1;i.name=a.name||"light_"+r,this.lights[r]=i}}this.nodeGraphs={};var c=t.nodeGraphs||[];for(var u in c){var h=c[u];this.nodeGraphs[u]=h}}function am(e){this.name=rm.S8S_V3D_MATERIAL_DATA}im.prototype.loadCurves=function(e,t){var n=e.extensions&&e.extensions[rm.S8S_V3D_DATA]||{};this.curves={};var r=n.curves||{};for(var i in r){var a,o=r[i];switch(o.type){case"font":var s=new Nu(o.font),l=0<o.bevelSize||0<o.bevelThickness,c=new Yf(o.text,{font:s,size:o.size,height:o.height,curveSegments:o.curveSegments,bevelEnabled:l,bevelThickness:o.bevelThickness,bevelSize:o.bevelSize,bevelSegments:o.bevelSegments,alignX:o.alignX,alignY:o.alignY});if(t&&t[o.material])var u=t[o.material];else u=new Tl({color:new In(.8,.8,.8)});a=new Fi(c,u)}a&&(a.name=o.name||"curve_"+i,this.curves[i]=a)}},am.prototype.extendParams=function(e,t,n){var r=t.extensions[this.name],i=[];if(jn(r.nodeGraph)){var a=r.nodeGraph;e.nodeGraph=hc.nodeGraphFromGLTF(a);for(var o=0;o<a.nodes.length;o++){var s=a.nodes[o];if(-1<em.indexOf(s.type)){var l=hc.nodeTexUniName(s.type,s.texture);i.push(n.assignTextureNode(e,l,s.texture))}}var c=n.extensions[rm.S8S_V3D_DATA];if(c)for(var u in e.additionalNodeGraphs={},c.nodeGraphs){a=c.nodeGraphs[u];e.additionalNodeGraphs[u]=hc.nodeGraphFromGLTF(a);for(o=0;o<a.nodes.length;o++){s=a.nodes[o];if(-1<em.indexOf(s.type)){l=hc.nodeTexUniName(s.type,s.texture);i.push(n.assignTextureNode(e,l,s.texture))}}}jn(r.profile)&&(e.profile=r.profile)}return jn(r.depthWrite)&&(e.depthWrite=r.depthWrite),jn(r.dithering)&&(e.dithering=r.dithering),Promise.all(i)};var om="glTF",sm=12,lm={JSON:1313821514,BIN:5130562};function cm(e){this.name=rm.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,sm);if(this.header={magic:Rm(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==om)throw new Error("v3d.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("v3d.GLTFLoader: Legacy binary file detected. Use GLTFLoader instead.");for(var n=new DataView(e,sm),r=0;r<n.byteLength;){var i=n.getUint32(r,!0);r+=4;var a=n.getUint32(r,!0);if(r+=4,a===lm.JSON){var o=new Uint8Array(e,sm+r,i);this.content=Rm(o)}else if(a===lm.BIN){var s=sm+r;this.body=e.slice(s,s+i)}r+=i}if(null===this.content)throw new Error("v3d.GLTFLoader: JSON content not found.")}var um=0,hm=1,dm=2,pm=3,fm=4,mm=5,vm=6,gm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ym={9728:D,9729:B,9984:O,9985:R,9986:U,9987:F},xm={33071:I,33648:P,10497:E},_m={6406:Oe,6407:ze,6408:Ge,6409:Ne,6410:De},bm={5121:Ue,32819:Pe,32820:Re,33635:Fe},wm={32774:ne,32778:p,32779:f},Am={0:g,1:y,768:_,769:b,770:w,771:A,772:M,773:T,774:S,775:L,776:C},Mm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Tm={CATMULLROMSPLINE:vt,CUBICSPLINE:vt,LINEAR:mt,STEP:ft},Sm="OPAQUE",Lm="MASK",Cm={FRONT:N,BACK:be,DOUBLE:Q};function Em(e,t,n){if(!e)return Promise.resolve();var r,i=[];if("[object Array]"===Object.prototype.toString.call(e)){r=[];for(var a=e.length,o=0;o<a;o++){(l=t.call(n||this,e[o],o))&&(i.push(l),l instanceof Promise?l.then(function(e,t){r[e]=t}.bind(this,o)):r[o]=l)}}else for(var s in r={},e){var l;if(e.hasOwnProperty(s))(l=t.call(n||this,e[s],s))&&(i.push(l),l instanceof Promise?l.then(function(e,t){r[e]=t}.bind(this,s)):r[s]=l)}return Promise.all(i).then(function(){return r})}function Pm(e,t){return"string"!=typeof e||""===e?"":/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:(t||"")+e}function Rm(e){if(void 0!==window.TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);return t}function Fm(e,t,n,r){var i=e.geometry,a=e.material,o=n.targets,s=i.morphAttributes;s.position=[],s.normal=[],a.morphTargets=!0;for(var l=0,c=o.length;l<c;l++){var u,h,d=o[l],p="morphTarget"+l;if(void 0!==d.POSITION){u=r.accessors[d.POSITION].clone();for(var f=i.attributes.position,m=0,v=u.count;m<v;m++)u.setXYZ(m,u.getX(m)+f.getX(m),u.getY(m)+f.getY(m),u.getZ(m)+f.getZ(m))}else u=i.attributes.position.clone();if(void 0!==d.NORMAL){a.morphNormals=!0,h=r.accessors[d.NORMAL].clone();var g=i.attributes.normal;for(m=0,v=h.count;m<v;m++)h.setXYZ(m,h.getX(m)+g.getX(m),h.getY(m)+g.getY(m),h.getZ(m)+g.getZ(m))}else h=i.attributes.normal.clone();d.TANGENT,u.name=p,h.name=p,s.position.push(u),s.normal.push(h)}if(e.updateMorphTargets(),void 0!==t.weights)for(l=0,c=t.weights.length;l<c;l++)e.morphTargetInfluences[l]=t.weights[l]}function Im(e,t,n){this.json=e||{},this.extensions=t||{},this.options=n||{},this.onProgress=n.onProgress||function(){},this.cache=new nm}function Om(){Nf.call(this,Un.grayscale)}function Nm(e,t,n,r){this.renderScene=t,this.renderCamera=n,this.selectedObjects=void 0!==r?r:[],this.visibleEdgeColor=new In(1,1,1),this.hiddenEdgeColor=new In(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,this.renderToScreen=!1,Ff.call(this),this.resolution=void 0!==e?new Dt(e.x,e.y):new Dt(256,256);var i={minFilter:B,magFilter:B,format:Ge},a=Math.round(this.resolution.x/this.downSampleRatio),o=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new vn(this.resolution.x,this.resolution.y,i),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.renderTargetDepthBuffer=new vn(this.resolution.x,this.resolution.y,i),this.renderTargetDepthBuffer.texture.name="OutlinePass.depth",this.renderTargetDepthBuffer.texture.generateMipmaps=!1,this.renderTargetMaskDownSampleBuffer=new vn(a,o,i),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new vn(a,o,i),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new vn(Math.round(a/2),Math.round(o/2),i),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new vn(a,o,i),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new vn(Math.round(a/2),Math.round(o/2),i),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;this.separableBlurMaterial1=this.getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value=new Dt(a,o),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value=new Dt(Math.round(a/2),Math.round(o/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this.getOverlayMaterial();var s=Un.copy;this.copyUniforms=Rn.clone(s.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new Ei({defines:s.defines,uniforms:this.copyUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,blending:Z,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new In,this.oldClearAlpha=1,this.basic=new ti,this.fsQuad=new Ff.FullScreenQuad(null),this.camera=new pr(-1,1,1,-1,0,1),this.scene=new Wo,this.tempPulseColor1=new In,this.tempPulseColor2=new In,this.textureMatrix=new Mn,this._MorphingFlag=1,this._SkinningFlag=2,this._NumberOfMaterialVariants=1+(this._MorphingFlag|this._SkinningFlag),this._depthMaterials=new Array(this._NumberOfMaterialVariants),this._maskMaterials=new Array(this._NumberOfMaterialVariants);for(var l=0;l!==this._NumberOfMaterialVariants;++l){var c=0!=(l&this._MorphingFlag),u=0!=(l&this._SkinningFlag),h=new oo({blending:Z,depthPacking:Et,side:Q,morphTargets:c,skinning:u});this._depthMaterials[l]=h;var d=new Rl({side:Q,morphTargets:c,skinning:u});this._maskMaterials[l]=d}}function Dm(e,t,n,r,i){Ff.call(this),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=void 0!==i?i:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1}function Um(e,t){var n=(this.sourceTexture=e).image.width,r=e.image.height,i={format:Ge,magFilter:B,minFilter:F,type:t,generateMipmaps:!0,anisotropy:e.anisotropy,encoding:bt,wrapS:e.wrapS,wrapT:e.wrapT};this.renderTarget=new vn(n,r,i),this.renderTarget.texture.name=e.name,this.renderTarget.texture.flipY=e.flipY,this.camera=new pr(-1,1,1,-1,0,1),this.shader=new Ei({type:"RGBEToFloat",uniforms:Rn.clone(Un.copy.uniforms),vertexShader:Un.copy.vertexShader,fragmentShader:Un.copy.fragmentShader,defines:{MAP_TEXELS:1}}),this.planeMesh=new Fi(new Jr(2,2,0),this.shader),this.planeMesh.material.map=e,this.scene=new Wo,this.scene.add(this.planeMesh),this.scene.add(this.camera),this.shader.uniforms.tDiffuse.value=e,this.shader.uniforms.opacity.value=1}Im.prototype._withDependencies=function(e){for(var t={},n=0;n<e.length;n++){var r=e[n],i="load"+r.charAt(0).toUpperCase()+r.slice(1),a=this.cache.get(r);if(void 0!==a)t[r]=a;else if(this[i]){var o=this[i]();this.cache.add(r,o),t[r]=o}}return Em(t,function(e){return e})},Im.prototype.parse=function(f,e){var m=this,v=this.json;this.cache.removeAll(),this._withDependencies(["scenes","materials","cameras","animations"]).then(function(e){var t=[];e.scenes=e.scenes||[];for(var n=0;n<e.scenes.length;n++)t.push(e.scenes[n]);var r=jn(v.scene)?v.scenes[v.scene]:v.scenes[0],i=jn(v.scene)?e.scenes[v.scene]:t[0],a={};r&&((h=m.getExt(r,rm.S8S_V3D_SCENE_DATA))&&(jn(h.worldMaterial)?a.material=e.materials[h.worldMaterial]:jn(h.horizonColor)&&(a.material=new hc({color:(new In).fromArray(h.horizonColor)}))));var o=[];e.cameras=e.cameras||[];for(n=0;n<e.cameras.length;n++){var s=e.cameras[n],l=!1;s.traverseAncestors(function(e){e==i&&(l=!0)}),l&&o.push(s)}var c=[];e.animations=e.animations||[];for(n=0;n<e.animations.length;n++){var u=e.animations[n];u.clip&&void 0!==u.clip.name&&(u.clip.name=u.clip.name),c.push(u)}var h,d={};if(r&&(h=m.getExt(r,rm.S8S_V3D_SCENE_DATA))){if(jn(h.shadowMap)){switch(d.shadowMap={enabled:!0},h.shadowMap.type){case"BASIC":d.shadowMap.type=0;break;case"PCF":d.shadowMap.type=k;break;case"PCFSOFT":d.shadowMap.type=V}if(h.shadowMap.renderSingleSided)if(h.shadowMap.renderReverseSided)p=be;else p=N;else var p=Q;i.traverse(function(e){var t=e.material;t&&(t.shadowSide=p)})}if(jn(h.physicallyCorrectLights)&&(d.physicallyCorrectLights=h.physicallyCorrectLights),jn(h.aaMethod)&&(d.aaMethod=h.aaMethod),jn(h.useHDR)&&(d.useHDR=h.useHDR),jn(h.unitsScaleFactor)?d.unitsScaleFactor=h.unitsScaleFactor:d.unitsScaleFactor=1,jn(h.toneMapping))switch(h.toneMapping.type){case"logarithmicMax":d.toneMapping=It,d.toneMappingBrightness=h.toneMapping.brightness,d.toneMappingContrast=h.toneMapping.contrast,d.toneMappingMidTones=h.toneMapping.midTones,d.toneMappingPhysicalScale=h.toneMapping.physicalScale,d.toneMappingChromaticAdaptation=h.toneMapping.chromaticAdaptation,d.toneMappingWhiteColor=(new In).fromArray(h.toneMapping.whiteColor),d.toneMappingColorDifferentiation=h.toneMapping.colorDifferentiation,d.toneMappingExteriorDaylight=h.toneMapping.exteriorDaylight}}f(i,t,a,o,c,d)}).catch(e)},Im.prototype.getDependency=function(e,t){var n=e+":"+t,r=this.cache.get(n);r||(r=this["load"+e.charAt(0).toUpperCase()+e.slice(1)](t),this.cache.add(n,r));return r},Im.prototype.loadBuffer=function(e){var r=this,i=this.json.buffers[e];if(i.type&&"arraybuffer"!==i.type)throw new Error("v3d.GLTFLoader: %s buffer type is not supported.",i.type);if(void 0===i.uri&&0===e)return Promise.resolve(this.extensions[rm.KHR_BINARY_GLTF].body);var a=this.options;return new Promise(function(e){if(a.loadBinXZ)var t=Pm(i.uri,a.path)+".xz",n=new Xf;else{t=Pm(i.uri,a.path);(n=new Rc).setResponseType("arraybuffer")}n.load(t,e,function(e){if(e.lengthComputable)var t=e.loaded/e.total*100;else t=100;r.onProgress(30+.7*t)})})},Im.prototype.loadBufferView=function(e){var r=this.json.bufferViews[e];return this.getDependency("buffer",r.buffer).then(function(e){var t=r.byteLength||0,n=r.byteOffset||0;return e.slice(n,n+t)})},Im.prototype.loadAccessors=function(){var e=this,s=this.json;return Em(s.accessors,function(o){return e.getDependency("bufferView",o.bufferView).then(function(e){var t=Mm[o.type],n=gm[o.componentType],r=n.BYTES_PER_ELEMENT,i=r*t,a=s.bufferViews[o.bufferView].byteStride;return a&&a!==i?new Ho(new Xo(new n(e),a/r),t,o.byteOffset/r):new Mr(new n(e,o.byteOffset,o.count*t),t)})})},Im.prototype.loadTexture=function(e){var n=this.json,a=this.options,r=(this.extensions,window.URL||window.webkitURL),i=n.textures[e],o=n.images[i.source],s=o.uri,l=!1,c=this.getExt(i,rm.S8S_V3D_TEXTURE_DATA);if(c)var t=!!c.isCubeTexture,u="linear"==c.colorSpace||"non-color"==c.colorSpace?bt:wt;else t=!1,u=wt;return void 0!==o.bufferView&&(s=this.getDependency("bufferView",o.bufferView).then(function(e){l=!0;var t=new Blob([e],{type:o.mimeType});return s=r.createObjectURL(t)})),Promise.resolve(s).then(function(r){"hdr"!=r.split(".").pop()&&"image/vnd.radiance"!=o.mimeType||(u=Mt);var i=Bu.Handlers.get(r);return i||(i=u==Mt?new Hf:t?new jf:new Uc),i.setCrossOrigin(a.crossOrigin),new Promise(function(e,t){var n=i.load(Pm(r,a.path),e,void 0,function(e){t(n)})}).then(function(e){return e},function(e){return e.isCubeTexture&&(e.images=new Array(6).fill(document.createElement("img"))),e})}).then(function(e){!0===l&&r.revokeObjectURL(s),e.flipY=!1,void 0!==i.name&&(e.name=i.name),e.format=void 0!==i.format?_m[i.format]:Ge,void 0!==i.internalFormat&&e.format!==_m[i.internalFormat]&&console.warn("v3d.GLTFLoader: Three.js does not support texture internalFormat which is different from texture format. internalFormat will be forced to be the same value as format."),e.type=void 0!==i.type?bm[i.type]:Ue;var t=(n.samplers||{})[i.sampler]||{};return e.magFilter=ym[t.magFilter]||B,e.minFilter=ym[t.minFilter]||F,e.wrapS=xm[t.wrapS]||E,e.wrapT=xm[t.wrapT]||E,(e.encoding=u)==Mt&&(e.minFilter=B,e.magFilter=B),c&&(jn(c.anisotropy)&&(e.anisotropy=c.anisotropy),jn(c.uvTransform)&&(e.matrix=(new zt).fromArray(c.uvTransform),e.matrixAutoUpdate=!1)),e})},Im.prototype.assignTexture=function(t,n,e){return this.getDependency("texture",e).then(function(e){t[n]=e})},Im.prototype.assignTextureNode=function(t,n,e){return this.getDependency("texture",e).then(function(e){t.nodeTextures=t.nodeTextures||{},t.nodeTextures[n]=e})},Im.prototype.loadMaterials=function(){var p=this,e=this.json,f=this.extensions;return Em(e.materials,function(t){var n,r={},e=[],i=p.getExt(t,rm.S8S_V3D_MATERIAL_DATA);if(jn(t.pbrMetallicRoughness)){n=Al;var a=t.pbrMetallicRoughness;if(r.color=new In(1,1,1),r.opacity=1,Array.isArray(a.baseColorFactor)){var o=a.baseColorFactor;r.color.fromArray(o),r.opacity=o[3]}if(void 0!==a.baseColorTexture&&e.push(p.assignTexture(r,"map",a.baseColorTexture.index)),r.metalness=void 0!==a.metallicFactor?a.metallicFactor:1,r.roughness=void 0!==a.roughnessFactor?a.roughnessFactor:1,void 0!==a.metallicRoughnessTexture){var s=a.metallicRoughnessTexture.index;e.push(p.assignTexture(r,"metalnessMap",s)),e.push(p.assignTexture(r,"roughnessMap",s))}}else if(i){var l=f[rm.S8S_V3D_MATERIAL_DATA];n=hc,e.push(l.extendParams(r,t,p))}else n=Tl;!0===t.doubleSided&&(r.side=Q),i&&(jn(i.renderSide)&&(r.side=Cm[i.renderSide]),jn(i.useShadows)&&(r.receiveShadow=i.useShadows),jn(i.useCastShadows)&&(r.castShadow=i.useCastShadows));var c=t.alphaMode||Sm,u=c!==Sm,h=c===Lm;if(r.premultipliedAlpha=u,r.transparent=u,r.alphaTest=h?jn(t.alphaCutoff)?t.alphaCutoff:.5:0,u)if(i&&jn(i.blendMode)){var d=i.blendMode;r.blending=te,jn(d.blendEquation)&&(r.blendEquation=wm[d.blendEquation]),jn(d.blendEquationAlpha)&&(r.blendEquationAlpha=wm[d.blendEquationAlpha]),jn(d.srcRGB)&&(r.blendSrc=Am[d.srcRGB]),jn(d.dstRGB)&&(r.blendDst=Am[d.dstRGB]),jn(d.srcAlpha)&&(r.blendSrcAlpha=Am[d.srcAlpha]),jn(d.dstAlpha)&&(r.blendDstAlpha=Am[d.dstAlpha])}else r.blending=te,r.blendEquation=ne,r.blendSrc=y,r.blendDst=A;return void 0!==t.normalTexture&&(e.push(p.assignTexture(r,"normalMap",t.normalTexture.index)),r.normalScale=new Dt(1,1),void 0!==t.normalTexture.scale&&r.normalScale.set(t.normalTexture.scale,t.normalTexture.scale)),void 0!==t.occlusionTexture&&(e.push(p.assignTexture(r,"aoMap",t.occlusionTexture.index)),void 0!==t.occlusionTexture.strength&&(r.aoMapIntensity=t.occlusionTexture.strength)),void 0!==t.emissiveFactor&&(n===ti?r.color=(new In).fromArray(t.emissiveFactor):n!==hc&&(r.emissive=(new In).fromArray(t.emissiveFactor))),void 0!==t.emissiveTexture&&(n===ti?e.push(p.assignTexture(r,"map",t.emissiveTexture.index)):e.push(p.assignTexture(r,"emissiveMap",t.emissiveTexture.index))),Promise.all(e).then(function(){var e=new n(r);return void 0!==t.name&&(e.name=t.name),e.normalScale&&(i&&jn(i.profile)&&"max"==i.profile||(e.normalScale.y=-e.normalScale.y)),e.map&&(e.map.encoding=wt),e.emissiveMap&&(e.emissiveMap.encoding=wt),e.metalnessMap&&(e.metalnessMap.encoding=bt),e.roughnessMap&&(e.roughnessMap.encoding=bt),t.extras&&(e.userData.v3d=t.extras),(t.pbrMetallicRoughness||e.isMeshNodeMaterial)&&e.envMap&&(e.envMap.mapping=ye,e.envMap.flipY=!0),e})})},Im.prototype.loadGeometries=function(e){var s=this;return this._withDependencies(["accessors"]).then(function(o){return Em(e,function(e){var t=new qr,n=e.attributes;for(var r in n){var i=n[r];if(void 0===i)return;var a=o.accessors[i];switch(r){case"POSITION":t.addAttribute("position",a);break;case"NORMAL":t.addAttribute("normal",a);break;case"TEXCOORD_0":case"TEXCOORD0":case"TEXCOORD":t.addAttribute("uv",a);break;case"COLOR_0":case"COLOR0":case"COLOR":t.addAttribute("color",a);break;case"WEIGHTS_0":case"WEIGHT":t.addAttribute("skinWeight",a);break;case"JOINTS_0":case"JOINT":t.addAttribute("skinIndex",a);break;case"TANGENT":t.addAttribute("tangent",a);break;default:-1<r.indexOf("TEXCOORD_")&&t.addAttribute(s.texcoordToAttrName(r),a),-1<r.indexOf("COLOR_")&&t.addAttribute(s.colorToAttrName(r),a)}}return void 0!==e.indices&&t.setIndex(o.accessors[e.indices]),t})})},Im.prototype.loadMeshes=function(){var y=this,e=this.json;return this._withDependencies(["accessors","materials"]).then(function(g){return Em(e.meshes,function(d,p){var f=new po,m=d.primitives||[],v=y.getExt(d,rm.S8S_V3D_MESH_DATA);return y.loadGeometries(m).then(function(e){for(var t=0;t<m.length;t++){var n=m[t],r=e[t],i=void 0===n.material?new Al({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:N,receiveShadow:!0,castShadow:!0}):g.materials[n.material];if(i.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.addAttribute("uv2",new Mr(r.attributes.uv.array,2)),jn(r.attributes.color)&&!i.isMeshNodeMaterial)var a=!0;else a=!1;var o,s=void 0===r.attributes.normal,l=i.isMeshNodeMaterial&&(i.nodeValue.length||i.nodeRGB.length);if((a||s||l)&&(i=i.clone()),i.isMeshNodeMaterial&&v){if(v.uvLayers)for(var c in v.uvLayers)i.nodeUVAliases[c]=y.texcoordToAttrName(v.uvLayers[c]);if(v.colorLayers)for(var c in v.colorLayers)i.nodeVCAliases[c]=y.colorToAttrName(v.colorLayers[c]);i.updateNodeGraph()}if(a&&(i.vertexColors=x,i.needsUpdate=!0),s&&(i.flatShading=!0),n.mode===fm||void 0===n.mode)o=new Fi(r,i);else if(n.mode===mm)(o=new Fi(r,i)).drawMode=1;else if(n.mode===vm)(o=new Fi(r,i)).drawMode=2;else if(n.mode===hm)if(v){var u=new Jf;u.fromBufferGeometry(r);var h=new $f({color:jn(v.lineColor)?(new In).fromArray(v.lineColor):new In(1,1,1),lineWidth:jn(v.lineWidth)?v.lineWidth:1,sizeAttenuation:0});o=new Fi(u.geometry,h)}else o=new ts(r,i);else if(n.mode===pm)o=new es(r,i);else if(n.mode===dm)o=new ns(r,i);else{if(n.mode!==um)throw new Error("v3d.GLTFLoader: Primitive mode unsupported: ",n.mode);o=new is(r,i)}if(o.name=d.name||"mesh_"+p,void 0!==n.targets&&Fm(o,d,n,g),!(1<m.length))return o;o.name+="_"+t,o.isMaterialGeneratedMesh=!0,f.add(o)}return f})})})},Im.prototype.loadCameras=function(){var e=this.json,o=this;return Em(e.cameras,function(e){var t,n=e[e.type];if(n){if("perspective"===e.type){var r=n.aspectRatio||1,i=n.yfov;t=new fo(Nt.radToDeg(i),r,n.znear||1,n.zfar||2e6)}else"orthographic"===e.type&&(t=new pr(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar));jn(e.name)||(t.name=e.name);var a=o.getExt(e,rm.S8S_V3D_CAMERA_DATA);if(a){if(t.controls={},t.controls.type=a.controls,t.viewportFit.type=3,jn(a.viewportFitType))switch(a.viewportFitType){case"VERTICAL":t.viewportFit.type=1;break;case"HORIZONTAL":t.viewportFit.type=2;break;case"AUTO":t.viewportFit.type=3}jn(a.viewportFitInitialAspect)&&(t.viewportFit.initialAspect=a.viewportFitInitialAspect),jn(a.enablePan)?t.controls.enablePan=a.enablePan:t.controls.enablePan=!0,jn(a.rotateSpeed)?t.controls.rotateSpeed=a.rotateSpeed:t.controls.rotateSpeed=1,jn(a.moveSpeed)?t.controls.moveSpeed=a.moveSpeed:t.controls.moveSpeed=1,jn(a.orbitMinDistance)&&(t.controls.orbitMinDistance=a.orbitMinDistance),jn(a.orbitMaxDistance)&&(t.controls.orbitMaxDistance=a.orbitMaxDistance),jn(a.orbitMinPolarAngle)&&(t.controls.orbitMinPolarAngle=a.orbitMinPolarAngle),jn(a.orbitMaxPolarAngle)&&(t.controls.orbitMaxPolarAngle=a.orbitMaxPolarAngle),jn(a.orbitMinAzimuthAngle)?t.controls.orbitMinAzimuthAngle=a.orbitMinAzimuthAngle:t.controls.orbitMinAzimuthAngle=-1/0,jn(a.orbitMaxAzimuthAngle)?t.controls.orbitMaxAzimuthAngle=a.orbitMaxAzimuthAngle:t.controls.orbitMaxAzimuthAngle=1/0,jn(a.orbitTarget)&&(t.controls.orbitTarget=new Bt,t.controls.orbitTarget.fromArray(a.orbitTarget)),jn(a.fpsCollisionMaterial)?t.controls.collisionMaterial=a.fpsCollisionMaterial:t.controls.collisionMaterial=null,jn(a.fpsGazeLevel)?t.controls.gazeLevel=a.fpsGazeLevel:t.controls.gazeLevel=1.8,jn(a.fpsStoryHeight)?t.controls.storyHeight=a.fpsStoryHeight:t.controls.storyHeight=3}return e.extras&&(t.userData.v3d=e.extras),t}console.warn("v3d.GLTFLoader: Missing camera parameters.")})},Im.prototype.loadSkins=function(){var e=this.json;return this._withDependencies(["accessors"]).then(function(t){return Em(e.skins,function(e){return{joints:e.joints,inverseBindMatrices:t.accessors[e.inverseBindMatrices]}})})},Im.prototype.loadAnimations=function(){var R=this,e=this.json;return this._withDependencies(["accessors","nodes"]).then(function(P){return Em(e.animations,function(e,t){for(var n=[],r=-1,i=0;i<e.channels.length;i++){var a=e.channels[i],o=e.samplers[a.sampler];if(o&&-1<o.input&&-1<o.output){var s=a.target,l=void 0!==s.node?s.node:s.id,c=void 0!==e.parameters?e.parameters[o.input]:o.input,u=void 0!==e.parameters?e.parameters[o.output]:o.output,h=P.accessors[c];if(h.count<=1)continue;var d=P.accessors[u],p=P.nodes[l];if(p){var f;r=p.id,p.updateMatrix(),p.matrixAutoUpdate=!0;var m="";switch(s.path){case"weights":f=_c,m="morphTargetInfluences";break;case"rotation":f=wc,m="quaternion";break;case"translation":f=Mc,m="position";break;case"scale":f=Mc,m="scale";break;case"intensity":f=_c,m="intensity";break;default:if(f=Mc,-1<s.path.indexOf("nodeValue"))m="material.nodeValue["+s.path.match(/".*"/g)[0]+"]";else if(-1<s.path.indexOf("nodeRGB")){m="material.nodeRGB["+s.path.match(/".*"/g)[0]+"]"}}var v=p.name?p.name:p.uuid;"CATMULLROMSPLINE"==o.interpolation&&console.warn("v3d.GLTFLoader: CATMULLROMSPLINE interpolation is not supported. Using CUBICSPLINE instead.");var g=jn(o.interpolation)?Tm[o.interpolation]:mt,y=[];"weights"==s.path?p.traverse(function(e){e.isMesh&&e.material.morphTargets&&y.push(e.name?e.name:e.uuid)}):-1<s.path.indexOf("material")?p.traverse(function(e){e.isMesh&&e.material.isMeshNodeMaterial&&y.push(e.name?e.name:e.uuid)}):y.push(v);for(var x=0,_=y.length;x<_;x++){var b=fc.arraySlice(h.array,0),w=fc.arraySlice(d.array,0);if(g==vt){for(var A=new w.constructor(w.length/3),M=A.length/b.length,T=0;T<A.length/M;T++)for(var S=0;S<M;S++)A[M*T+S]=w[3*M*T+M+S];g=mt,w=A}n.push(new f(y[x]+"."+m,b,w,g))}}}}var L={clip:new Tc(l=jn(e.name)?e.name:"animation_"+t,void 0,n),nodeId:r,auto:!0,loop:2201,repetitions:1/0,startAt:0},C=R.getExt(e,rm.S8S_V3D_ANIMATION_DATA);if(C){L.auto=C.auto;var E=C.repeatInfinite?1/0:C.repeatCount;switch(C.loop){case"ONCE":L.loop=2200;break;case"REPEAT":L.loop=2201,L.repetitions=E;break;case"PING_PONG":L.loop=2202,L.repetitions=E}L.startAt=C.offset}return L})})},Im.prototype.loadNodes=function(){var _=this.json,b=this,t=_.nodes||[],e=_.skins||[],r={},i={};for(var n in e.forEach(function(e){e.joints.forEach(function(e){t[e].isBone=!0})}),t){var a=t[n];jn(a.mesh)&&(jn(r[a.mesh])||(r[a.mesh]=i[a.mesh]=0),r[a.mesh]++)}return b._withDependencies(["materials","meshes","skins","cameras"]).then(function(x){var e=b.getExt(b,rm.S8S_V3D_DATA);return e&&e.loadCurves(_,x.materials),Em(_.nodes,function(e){var t=b.getExt(e,rm.S8S_V3D_NODE_DATA);if(!0===e.isBone)return new Jo;if(void 0===e.mesh)return void 0!==e.camera?x.cameras[e.camera]:t&&jn(t.curve)?b.getExt(b,rm.S8S_V3D_DATA).curves[t.curve]:t&&jn(t.light)?b.getExt(b,rm.S8S_V3D_DATA).lights[t.light].clone():new hr;var n=x.meshes[e.mesh].clone();return 1<r[e.mesh]&&(n.name+="_instance_"+i[e.mesh]++),n}).then(function(y){return Em(y,function(h,e){var d=_.nodes[e];if(jn(d.skin)){for(var t=[],n=0<h.children.length?h.children:[h],r=0;r<n.length;r++){var i=n[r];if(i.isMesh){var a=x.skins[d.skin],o=i.geometry,s=i.material.clone();s.skinning=!0;var l=new Zo(o,s);l.morphTargetInfluences=i.morphTargetInfluences,l.name=i.name,l.isMaterialGeneratedMesh=i.isMaterialGeneratedMesh;for(var c=[],u=[],p=0,f=a.joints.length;p<f;p++){var m=a.joints[p],v=y[m];if(v){c.push(v);var g=new Mn;jn(a.inverseBindMatrices)&&g.fromArray(a.inverseBindMatrices.array,16*p),u.push(g)}else console.warn('v3d.GLTFLoader: Joint "%s" could not be found.',m)}l.bind(new Ko(c,u),l.matrixWorld),t.push(l)}}t.length&&(0<h.children.length?(h.remove.apply(h,h.children),h.add.apply(h,t)):h=t[0])}return h.traverse(function(e){var t=h==e,n=b.getExt(d,rm.S8S_V3D_NODE_DATA);if(t){if(void 0!==d.name&&(e.name=d.name),void 0!==d.matrix){var r=new Mn;r.fromArray(d.matrix),e.applyMatrix(r)}else void 0!==d.translation&&e.position.fromArray(d.translation),void 0!==d.rotation&&e.quaternion.fromArray(d.rotation),void 0!==d.scale&&e.scale.fromArray(d.scale);if((e.isDirectionalLight||e.isSpotLight||e.isHemisphereLight)&&(e.isFreeLight=!0),e.isCamera&&e.controls&&"FIRST_PERSON"==e.controls.type&&(e.controls.collisionMaterial=x.materials[e.controls.collisionMaterial]),n&&n.hidden&&(e.visible=!1),n&&jn(n.constraints))for(var i=0;i<n.constraints.length;i++){var a=n.constraints[i];if("lockedTrack"==a.type)a.trackAxis=a.trackAxis.toUpperCase(),a.lockAxis=a.lockAxis||"Y";else if("trackTo"==a.type)a.trackAxis=a.trackAxis.toUpperCase(),a.upAxis=a.upAxis||"Y";else if("floor"==a.type)a.floorLocation=a.floorLocation.toUpperCase();else if("copyTransforms"==a.type){var o=y[a.target],s=new up(o),l=new hp(o),c=new dp(o);s.name=l.name=c.name=a.name,s.mute=l.mute=c.mute=a.mute,e.constraints.push(s),e.constraints.push(l),e.constraints.push(c)}var u=null;switch(a.type){case"copyLocation":u=new up(y[a.target]);break;case"copyRotation":u=new hp(y[a.target]);break;case"copyScale":u=new dp(y[a.target]);break;case"limitLocation":(u=new fp).min.set(Number(a.minX),Number(a.minY),Number(a.minZ)),u.max.set(Number(a.maxX),Number(a.maxY),Number(a.maxZ));break;case"limitRotation":(u=new mp).axis=a.axis,u.min=a.min,u.max=a.max;break;case"limitScale":(u=new vp).min.set(Number(a.minX),Number(a.minY),Number(a.minZ)),u.max.set(Number(a.maxX),Number(a.maxY),Number(a.maxZ));break;case"lockedTrack":(u=new gp(y[a.target])).trackAxis=a.trackAxis,u.lockAxis=a.lockAxis;break;case"trackTo":(u=new yp(y[a.target])).trackAxis=a.trackAxis,u.upAxis=a.upAxis;break;case"childOf":(u=new cp(y[a.target])).offsetMatrix=(new Mn).fromArray(a.offsetMatrix);break;case"floor":(u=new pp(y[a.target])).floorLocation=a.floorLocation,u.offset=a.offset}u&&(u.name=a.name,u.mute=a.mute,e.constraints.push(u))}}e.isMesh&&(n&&jn(n.useCastShadows)?e.castShadow=n.useCastShadows:jn(e.material.castShadow)&&(e.castShadow=e.material.castShadow),n&&jn(n.useShadows)?e.receiveShadow=n.useShadows:jn(e.material.receiveShadow)&&(e.receiveShadow=e.material.receiveShadow)),d.extras&&(e.userData.v3d=d.extras),n&&(e.renderOrder=n.renderOrder,e.frustumCulled=n.frustumCulling,jn(n.groupNames)?e.groupNames=n.groupNames:e.groupNames=[])}),h})})})},Im.prototype.loadScenes=function(){var l=this.json,c=this,u=this.extensions;function h(e,t,n){var r=n[e];t.add(r),(r.isDirectionalLight||r.isSpotLight||r.isHemisphereLight)&&t.add(r.target);var i=l.nodes[e];if(i.children)for(var a=i.children,o=0,s=a.length;o<s;o++){h(a[o],r,n)}}return this._withDependencies(["nodes"]).then(function(s){return Em(l.scenes,function(e){var t=new Wo;jn(e.name)&&(t.name=e.name),e.extras&&(t.userData.v3d=e.extras);for(var n=e.nodes||[],r=0,i=n.length;r<i;r++){h(n[r],t,s.nodes)}var a=c.getExt(e,rm.S8S_V3D_SCENE_DATA);if(a){if(jn(a.light)){var o=u[rm.S8S_V3D_DATA].lights;t.add(o[a.light])}jn(a.postprocessing)&&(t.postprocessing=a.postprocessing)}return t})})},Im.prototype.getExt=function(e,t){return e.extensions&&e.extensions[t]?e.extensions[t]:null},Im.prototype.texcoordToAttrName=function(e){return"TEXCOORD_0"==e?"uv":"uv"+String(Number(e.split("TEXCOORD_")[1])+1)},Im.prototype.colorToAttrName=function(e){return"COLOR_0"==e?"color":"color"+String(Number(e.split("COLOR_")[1])+1)},Om.prototype=Object.assign(Object.create(Nf.prototype),{constructor:Om}),Nm.prototype=Object.assign(Object.create(Ff.prototype),{constructor:Nm,dispose:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()},setSize:function(e,t){this.renderTargetMaskBuffer.setSize(e,t);var n=Math.round(e/this.downSampleRatio),r=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(n,r),this.renderTargetBlurBuffer1.setSize(n,r),this.renderTargetEdgeBuffer1.setSize(n,r),this.separableBlurMaterial1.uniforms.texSize.value=new Dt(n,r),n=Math.round(n/2),r=Math.round(r/2),this.renderTargetBlurBuffer2.setSize(n,r),this.renderTargetEdgeBuffer2.setSize(n,r),this.separableBlurMaterial2.uniforms.texSize.value=new Dt(n,r)},changeVisibilityOfSelectedObjects:function(t){function e(e){e instanceof Fi&&(e.outlineVisible=t)}for(var n=0;n<this.selectedObjects.length;n++){var r=this.selectedObjects[n];e(r);for(var i=r.children,a=0;a<i.length;a++){var o=i[a];o.isMesh&&o.isMaterialGeneratedMesh&&e(o)}}},changeVisibilityOfNonSelectedObjects:function(r){var i=[];function e(e){e instanceof Fi&&i.push(e)}for(var t=0;t<this.selectedObjects.length;t++){var n=this.selectedObjects[t];e(n);for(var a=n.children,o=0;o<a.length;o++){var s=a[o];s.isMesh&&s.isMaterialGeneratedMesh&&e(s)}}this.renderScene.traverse(function(e){if(e instanceof Fi){for(var t=!1,n=0;n<i.length;n++)if(i[n].id===e.id){t=!0;break}t||(e.outlineVisible=r)}})},updateTextureMatrix:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)},getDepthMaterial:function(e,t,n){var r=e.geometry,i=null,a=this._depthMaterials,o=e.customDepthMaterial;if(n&&(a=this._maskMaterials),o)i=o;else{var s=!1;t.morphTargets&&(r&&r.isBufferGeometry?s=r.morphAttributes&&r.morphAttributes.position&&0<r.morphAttributes.position.length:r&&r.isGeometry&&(s=r.morphTargets&&0<r.morphTargets.length)),e.isSkinnedMesh&&!1===t.skinning&&console.warn("v3d.OutlinePass: v3d.SkinnedMesh with material.skinning set to false:",e);var l=e.isSkinnedMesh&&t.skinning,c=0;s&&(c|=this._MorphingFlag),l&&(c|=this._SkinningFlag),i=a[c]}i.visible=t.visible,i.wireframe=t.wireframe;var u=t.side;return i.side=u,i.clipShadows=t.clipShadows,i.clippingPlanes=t.clippingPlanes,i.clipIntersection=t.clipIntersection,i.wireframeLinewidth=t.wireframeLinewidth,i.linewidth=t.linewidth,n&&(i.cameraNearFar=new Dt(this.renderCamera.near,this.renderCamera.far),i.depthTexture=this.renderTargetDepthBuffer.texture,i.textureMatrix=this.textureMatrix),i},renderObject:function(e,t,n,r){if(t.outlineVisible&&t.isVisible()&&t.layers.test(n.layers)){var i=e.updateGeometry(t),a=t.material;if(a.visible){var o=this.getDepthMaterial(t,a,r);e.renderObject(t,this.scene,n,i,o,null)}}for(var s=t.children,l=0,c=s.length;l<c;l++)this.renderObject(e,s[l],n,r)},render:function(e,t,n,r,i){if(this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),0!==this.selectedObjects.length){this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();var a=e.autoClear;e.autoClear=!1,i&&e.context.disable(e.context.STENCIL_TEST),e.setClearColor(16777215,1);var o=this.renderScene.background;if(this.renderScene.background=null,this.changeVisibilityOfSelectedObjects(!1),e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),this.renderObject(e,this.renderScene,this.renderCamera,!1),this.changeVisibilityOfSelectedObjects(!0),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),this.renderObject(e,this.renderScene,this.renderCamera,!0),this.changeVisibilityOfNonSelectedObjects(!0),this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod){var s=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(s),this.tempPulseColor2.multiplyScalar(s)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value=new Dt(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Nm.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Nm.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=Nm.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=Nm.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,i&&e.context.enable(e.context.STENCIL_TEST),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=a}},getEdgeDetectionMaterial:function(){return new Ei(Un.outline_edge)},getSeperableBlurMaterial:function(e){var t=new Ei(Un.outline_blur);return t.defines.MAX_RADIUS=e,t},getOverlayMaterial:function(){var e=new Ei(Un.outline_overlay);return e.blending=J,e.depthTest=!1,e.depthWrite=!1,e.transparent=!0,e},setCamera:function(e){this.renderCamera=e}}),Nm.BlurDirectionX=new Dt(1,0),Nm.BlurDirectionY=new Dt(0,1),Dm.prototype=Object.assign(Object.create(Ff.prototype),{constructor:Dm,render:function(e,t,n,r,i){var a,o,s=e.autoClear;e.autoClear=!1,this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(a=e.getClearColor().getHex(),o=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(a,o),this.scene.overrideMaterial=null,e.autoClear=s},setCamera:function(e){this.camera=e}}),Um.prototype={constructor:Um,update:function(e){var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=we,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1,e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera),e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},dispose:function(){this.renderTarget.dispose(),this.planeMesh.geometry.dispose(),this.planeMesh.material.dispose()}};var Bm={renderWorldNodeMatToCubemap:function(e,t,n){t.isMeshNodeMaterial||console.error("v3d.RenderUtils.renderWorldNodeMatToCubemap(): material is not an instance of MeshNodeMaterial.");var r=new Wo,i=new sh(.1,10,n);i.renderTarget.texture.encoding=wt,i.renderTarget.texture.generateMipmaps=!1,r.add(i);var a=/Firefox/.test(navigator.userAgent)&&/Android/.test(navigator.userAgent),o=e.getContext();if(!a&&(e.capabilities.isWebGL2&&o.getExtension("EXT_color_buffer_float")&&o.getExtension("OES_texture_float_linear")||o.getExtension("OES_texture_half_float")&&o.getExtension("OES_texture_half_float_linear"))){i.renderTarget.texture.type=Ee,i.renderTarget.texture.format=Ge;window.navigator.userAgent;var s=window.navigator.platform,l=!!window.chrome&&!/Edge/.test(navigator.userAgent),c=-1!==["Macintosh","MacIntel","MacPPC","Mac68K"].indexOf(s);for(var u in t.nodeTextures){var h=t.nodeTextures[u];if(!(h.encoding!=Mt||l&&c)){var d=new Um(h,Ee);d.update(e),t.nodeTextures[u]=d.renderTarget.texture,t.updateNodeGraph()}}}var p=t.clone();p.defines.WORLD_NODES=1,p.side=be;var f=new Fi(new Zr(1,1,1),p);for(var u in r.add(f),i.update(e,r),f.material.dispose(),f.material.nodeTextures)f.material.nodeTextures[u].dispose();return f.geometry.dispose(),i.renderTarget}};function zm(e){this.data=void 0!==e?e:null,this.equirecInvertU=!1,this.equirecOffsetU=0,this.useHDR=!1}Object.assign(zm.prototype,{isSceneBackground:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(e){null===e.data?this.data=null:e.data.isColor?this.data=e.data.clone():e.data.isCubeTexture?(this.data=e.data.clone(),this.data.needsUpdate=!0):e.data.isTexture?(this.data=e.data.clone(),this.data.needsUpdate=!0):e.data.isWebGLRenderTargetCube?(this.data=e.data.clone(),this.data.texture.needsUpdate=!0):this.data=e.data,this.equirecInvertU=e.equirecInvertU,this.equirecOffsetU=e.equirecOffsetU,this.useHDR=e.useHDR},toJSON:function(e){var t={metadata:{version:4.5,type:"SceneBackground",generator:"SceneBackground.toJSON"}};return null!==this.data&&(t.data=this.data.toJSON(e)),!0===this.equirecInvertU&&(t.equirecInvertU=!0),0!==this.equirecOffsetU&&(t.equirecOffsetU=this.equirecOffsetU),t}});var Gm={createMultiMaterialObject:function(e,t){for(var n=new po,r=0,i=t.length;r<i;r++)n.add(new Fi(e,t[r]));return n},detach:function(e,t,n){e.applyMatrix(t.matrixWorld),t.remove(e),n.add(e)},attach:function(e,t,n){e.applyMatrix((new Mn).getInverse(n.matrixWorld)),t.remove(e),n.add(e)},getMaterialByName:function(e,t){var n=this.getMaterialsByName(e,t);return n.length?n[0]:null},getMaterialsByName:function(e,t){for(var n=[],r=0;r<e.materials.length;r++){var i=e.materials[r];i.name==t&&n.push(i)}var a=e.worldMaterial;return a&&a.name==t&&n.push(a),n},getAnimationActionByName:function(e,t){for(var n=0;n<e.actions.length;n++){var r=e.actions[n];if(r.getClip().name==t)return r}},checkActionIsUsed:function(n,e){return Boolean(e._propertyBindings.find(function(e){var t=e.binding.node;return t&&t.findRoot()===n}))}};function km(e,t,n,r){Nf.call(this,Un.ssao),this.width=void 0!==n?n:512,this.height=void 0!==r?r:256,this.renderToScreen=!1,this.camera2=t,this.scene2=e,this.depthMaterial=new oo,this.depthMaterial.depthPacking=Et,this.depthMaterial.blending=Z,this.depthRenderTarget=new vn(this.width,this.height,{minFilter:B,magFilter:B}),this.uniforms.tDepth.value=this.depthRenderTarget.texture,this.uniforms.size.value.set(this.width,this.height),this.uniforms.cameraNear.value=this.camera2.near,this.uniforms.cameraFar.value=this.camera2.far,this.uniforms.radius.value=4,this.uniforms.onlyAO.value=!1,this.uniforms.aoClamp.value=.25,this.uniforms.lumInfluence.value=.7;Object.defineProperties(this,{radius:{get:function(){return this.uniforms.radius.value},set:function(e){this.uniforms.radius.value=e}},onlyAO:{get:function(){return this.uniforms.onlyAO.value},set:function(e){this.uniforms.onlyAO.value=e}},aoClamp:{get:function(){return this.uniforms.aoClamp.value},set:function(e){this.uniforms.aoClamp.value=e}},lumInfluence:{get:function(){return this.uniforms.lumInfluence.value},set:function(e){this.uniforms.lumInfluence.value=e}}})}function Vm(e,t,n,r){Ff.call(this),this.scene=e,this.camera=t,this.sampleLevel=4,this.unbiased=!0,this.clearColor=void 0!==n?n:0,this.clearAlpha=void 0!==r?r:0;var i=Un.copy;this.copyUniformsAccum=Rn.clone(i.uniforms),this.copyMaterialAccum=new Ei({defines:i.defines,uniforms:this.copyUniformsAccum,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,premultipliedAlpha:!0,transparent:!0,blending:J,depthTest:!1,depthWrite:!1}),this.fsQuadAccum=new v3d.Pass.FullScreenQuad(this.copyMaterialAccum),this.copyUniformsFinal=Rn.clone(i.uniforms),this.copyMaterialFinal=new Ei({defines:i.defines,uniforms:this.copyUniformsFinal,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,premultipliedAlpha:!1,transparent:!1,blending:Z,depthTest:!1,depthWrite:!1}),this.fsQuadFinal=new v3d.Pass.FullScreenQuad(this.copyMaterialFinal),this.iterative=!1,this.iterativeFrame=0}function jm(){Nf.call(this,Un.tonemap)}(km.prototype=Object.create(Nf.prototype)).render=function(e,t,n,r,i){this.scene2.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.depthRenderTarget),e.clear(),e.render(this.scene2,this.camera2),this.scene2.overrideMaterial=null,Nf.prototype.render.call(this,e,t,n,r,i)},km.prototype.setScene=function(e){this.scene2=e},km.prototype.setCamera=function(e){this.camera2=e,this.uniforms.cameraNear.value=this.camera2.near,this.uniforms.cameraFar.value=this.camera2.far},km.prototype.setSize=function(e,t){this.width=e,this.height=t,this.uniforms.size.value.set(this.width,this.height),this.depthRenderTarget.setSize(this.width,this.height)},Vm.prototype=Object.assign(Object.create(Ff.prototype),{constructor:Vm,_getJitterOffsets:function(){return Vm.JitterVectors[Math.max(0,Math.min(this.sampleLevel,5))]},dispose:function(){this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null,this.accumRenderTarget.dispose(),this.accumRenderTarget=null)},setSize:function(e,t){this.sampleRenderTarget&&(this.sampleRenderTarget.setSize(e,t),this.accumRenderTarget.setSize(e,t))},render:function(e,t,n){this.sampleRenderTarget||(this.sampleRenderTarget=n.clone(),this.sampleRenderTarget.texture.name="SSAARenderPass.sample",this.accumRenderTarget=n.clone(),this.accumRenderTarget.texture.name="SSAARenderPass.accum");var r=this._getJitterOffsets(),i=e.autoClear;e.autoClear=!1;var a=e.getClearColor().getHex(),o=e.getClearAlpha(),s=1/r.length;this.copyUniformsAccum.tDiffuse.value=this.sampleRenderTarget.texture;var l=n.width,c=n.height;if(this.iterative)var u=this.iterativeFrame,h=this.iterativeFrame+1;else u=0,h=r.length;for(var d=u;d<h;d++){var p=r[d];this.camera.setViewOffset&&this.camera.setViewOffset(l,c,.0625*p[0],.0625*p[1],l,c);var f=s;if(this.unbiased)f+=1/32*((d+.5)/r.length-.5);this.copyUniformsAccum.opacity.value=f,e.setClearColor(this.clearColor,this.clearAlpha),e.setRenderTarget(this.sampleRenderTarget),e.clear(),e.render(this.scene,this.camera),this.iterative?e.setRenderTarget(this.accumRenderTarget):e.setRenderTarget(this.renderToScreen?null:t),0===d&&(e.setClearColor(0,0),e.clear()),this.fsQuadAccum.render(e)}this.iterative&&(this.isLastIterativeFrame()?(this.copyUniformsFinal.tDiffuse.value=this.accumRenderTarget.texture,e.setRenderTarget(this.renderToScreen?null:t),this.fsQuadFinal.render(e),this.iterativeFrame=0):this.iterativeFrame++),this.camera.clearViewOffset&&this.camera.clearViewOffset(),e.autoClear=i,e.setClearColor(a,o)},setCamera:function(e){this.camera=e},isLastIterativeFrame:function(){var e=this._getJitterOffsets();return this.iterativeFrame==e.length-1}}),Vm.JitterVectors=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],jm.prototype=Object.assign(Object.create(Nf.prototype),{constructor:jm});var Wm=["toneMapping","toneMappingBrightness","toneMappingContrast","toneMappingMidTones","toneMappingPhysicalScale","toneMappingChromaticAdaptation","toneMappingWhiteColor","toneMappingColorDifferentiation","toneMappingExteriorDaylight"];function Xm(e,t,n){if(this.container=e instanceof HTMLElement?e:document.getElementById(e),Do.checkWebGL()){this.scene=null,this.camera=null,this.clock=new lh,this.mixer=null,this.renderCallbacks=[],this.elapsed=0,this.frame=0,this.preloader=n,this.worldMaterial=null,this.worldCubemapRes=1024,this.xrImmersiveDevice=null,this.xrNonImmersiveDevice=null,this.xrContext=null,this.xrSession=null,this.xrControllers=[],void 0===(t=t||{}).alpha&&(t.alpha=!1),void 0===t.depth&&(t.depth=!0),void 0===t.stencil&&(t.stencil=!0),void 0===t.antialias&&(t.antialias=!0),void 0===t.premultipliedAlpha&&(t.premultipliedAlpha=!0),void 0===t.preserveDrawingBuffer&&(t.preserveDrawingBuffer=!1);var r=document.createElement("canvas"),i=Do.checkWebGL2();/Mali/.test(Do.getGPUModel())&&(i=!1);var a=r.getContext(i?"webgl2":"webgl",t)||r.getContext("experimental-webgl",t);this.renderer=new v3d.WebGLRenderer({canvas:r,context:a}),this.clearBkgOnLoad=!1,this.frameRateDivider=1,this.enableRender=!0,this.disableRenderTrigger=0,this.ssaaOnPause=!1,this.renderer.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(this.renderer.domElement),this.container.classList.add("v3d-container"),this.renderer.domElement.classList.add("v3d-canvas"),this.loader=new tm,this.actions=[],this.materials=[],this._cubeUVEnvRT=null,this._resizeCb=null,"0000000000"==Ft.replace("__V3DL__","")&&Rf.drawWatermark(this.container,"")}else Do.showWebGLErrorMessage(this.container)}Object.assign(Xm.prototype,{constructor:Xm,_updateRendererFromGLTF:function(e){if(e.renderer.shadowMap?(this.renderer.shadowMap.enabled=e.renderer.shadowMap.enabled,this.renderer.shadowMap.type=e.renderer.shadowMap.type):(this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=V),e.renderer.physicallyCorrectLights&&(this.renderer.physicallyCorrectLights=!0),this.aaMethod=e.renderer.aaMethod||"AUTO",this.useHDR=Boolean(e.renderer.useHDR&&Do.checkHDR(this.renderer)),this.renderer.unitsScaleFactor=e.renderer.unitsScaleFactor,e.renderer.toneMapping)for(var t=0;t<Wm.length;t++){var n=Wm[t];jn(e.renderer[n])&&(this.renderer[n]=e.renderer[n])}},_updateMaterialsFromGLTF:function(e){var n=this;e.scene&&e.scene.traverse(function(e){var t=e.material;t&&(n.useHDR&&(t.useHDR=!0,t.isMeshNodeMaterial&&t.updateNodeGraph()),-1==n.materials.indexOf(t)&&n.materials.push(t))})},_updateAnimationsFromGLTF:function(e,r){var i=this;!i.mixer&&e.animations&&e.animations.length&&(i.mixer=new Jh(i.scene)),(e.animations||[]).forEach(function(e){var t=r.getObjectById(e.nodeId);if(t){if(t.id==r.id||""!==t.name&&"root"!==t.name&&"."!==t.name&&t.name!==r.name&&t.name!==r.uuid)n=i.mixer.clipAction(e.clip,r);else var n=i.mixer.clipAction(e.clip,t);n.setLoop(e.loop,e.repetitions),n.startAt(e.startAt+i.mixer.time),n.clampWhenFinished=!0,e.auto?n.play():(n.stop(),n.paused=!0),i.actions.push(n)}})},_updateSceneCubeUVEnv:function(e){var t=this;t._cubeUVEnvRT&&t._traverseSceneForEnvUpdates(e,function(e){e.material.envMap=t._cubeUVEnvRT.texture,e.material.needsUpdate=!0})},_traverseSceneForEnvUpdates:function(e,t){e.traverse(function(e){e.isMesh&&e.material&&(e.material.isMeshStandardMaterial||e.material.isMeshPhysicalMaterial||e.material.isMeshNodeMaterial&&"PHYSICAL"in e.material.defines)&&t(e)})},_checkMSAA:function(e,t){return Math.min(t,e.capabilities.maxSamples)},_getActiveSSAAPass:function(e){return e.passes[0]instanceof Vm?e.passes[0]:null},load:function(e,t,n,r){console.warn("v3d.App.load has been deprecated. Use v3d.App.loadScene instead.");var i=this;i.loadScene(e,function(e){t(e),r&&i.run()},null,n)},loadScene:function(e,n,t,r){var i=this;i.renderer?(this.loader.load(e,function(e){i.scene=e.scene||new Wo,e.cameras&&e.cameras.length?i.camera=e.cameras[0]:(i.camera=new fo(45,i.container.offsetWidth/i.container.offsetHeight,.001,1e3),i.scene.add(i.camera)),i._updateRendererFromGLTF(e),i._updateMaterialsFromGLTF(e),i._updateAnimationsFromGLTF(e,i.scene);var t=e.world.material;t&&(i.updateEnvironment(t),i.worldMaterial=t),i.initPostprocessing(),i.onResize&&i.onResize(),i.scene.updateMatrixWorld(),i.clearBkgOnLoad&&(i.scene.background=null),n&&n(e.scene)},function(e){t&&t(e),i.preloader&&i.preloader.onUpdate(e)},function(e){console.error(e),r&&r(e)}),window.removeEventListener("resize",this._resizeCb,!1),this._resizeCb=function(){i.onResize&&i.onResize()},window.addEventListener("resize",this._resizeCb,!1)):r&&r("WebGL not found")},appendScene:function(e,n,t,r){var i=this;i.renderer?this.loader.load(e,function(e){var t=e.scene||new Wo;i.scene&&(i.scene.add(t),i._updateMaterialsFromGLTF(e),i._updateAnimationsFromGLTF(e,t),i._updateSceneCubeUVEnv(t),i.scene.updateMatrixWorld()),n&&n(t)},function(e){t&&t(e),i.preloader&&i.preloader.onUpdate(e)},function(e){console.error(e),r&&r(e)}):r&&r("WebGL not found")},unload:function(e){var n=this;function t(e){if(e.isAnnotation)e.dispose();else if(e.isMesh){e.geometry.dispose();var t=e.material;op.disposeTextures(t),t.dispose()}}if(e||(e=n.scene),e===n.scene){if(n.scene&&(n.scene.traverse(t),n.disposeEnvironment()),n.scene=null,n.controls&&n.controls.dispose&&n.controls.dispose(),n.controls=null,n.camera=null,n.materials=[],n.mixer&&(n.mixer.stopAllAction(),n.actions.forEach(function(e){n.mixer.uncacheAction(e.getClip(),e.getRoot())})),n.mixer=null,n.actions=[],n.postprocessing){if(n.postprocessing.composer)for(var r in n.postprocessing){var i=n.postprocessing[r];(i instanceof Ff||i instanceof Gf)&&i.dispose()}n.disablePostprocessing()}n.postprocessing=null,n.renderer&&n.renderer.disposeInternalCaches()}else if(n.scene&&(e.traverse(t),e.parent&&e.parent.remove(e)),n.materials=[],n.scene&&n.scene.traverse(function(e){var t=e.material;t&&-1==n.materials.indexOf(t)&&n.materials.push(t)}),n.mixer)for(var a=n.actions.length-1;0<=a;a--){var o=n.actions[a];Gm.checkActionIsUsed(n.scene,o)||(o.stop(),n.mixer.uncacheAction(o.getClip(),o.getRoot()),n.actions.splice(a,1))}},dispose:function(){if(this.scene&&this.unload(),this.renderer&&(this.renderer.forceContextLoss(),this.renderer.dispose()),this.renderer=null,this.container)for(;this.container.firstChild;)this.container.removeChild(this.container.firstChild);window.removeEventListener("resize",this._resizeCb,!1),Lc.clear()},getWidth:function(){return this.container.offsetWidth},getHeight:function(){return this.container.offsetHeight},onResize:function(){function c(e,t,n){return 2*Nt.RAD2DEG*Math.atan(Math.tan(Nt.DEG2RAD*e/2)*t/n)}return function(){var e=this.getWidth(),t=this.getHeight();if(this.renderer.setSize(e,t),this.postprocessing){var n=this.renderer.getPixelRatio();this.postprocessing.composer.setSize(e*n,t*n)}if(this.scene){var r=e/t,i=this.camera;if(i.isPerspectiveCamera)switch(i.viewportFit.type){case 1:i.aspect=r;break;case 2:i.fov=c(i.fov,i.aspect,r),i.aspect=r;break;case 3:var a=i.aspect<i.viewportFit.initialAspect,o=r<i.viewportFit.initialAspect;a&&o?i.fov=c(i.fov,i.aspect,r):a&&!o?i.fov=c(i.fov,i.aspect,i.viewportFit.initialAspect):!a&&o&&(i.fov=c(i.fov,i.viewportFit.initialAspect,r)),i.aspect=r}else if(i.isOrthographicCamera)switch(i.viewportFit.type){case 1:var s=i.top*r;i.left=-s,i.right=s;break;case 2:var l=i.right/r;i.bottom=-l,i.top=l;break;case 3:a=(i.right-i.left)/(i.top-i.bottom)<i.viewportFit.initialAspect,o=r<i.viewportFit.initialAspect;if(a&&o)s=i.right;else if(a&&!o)s=i.right*r/i.viewportFit.initialAspect;else if(!a&&o)s=i.top*i.viewportFit.initialAspect;else s=i.top*r;i.left=-s,i.right=s,i.bottom=-s/r,i.top=s/r}i.updateProjectionMatrix()}}}(),run:function(){this.preloader&&(this.preloader.onFinish(),this.preloader=null),this.animate()},animate:function(){var o=this;o.renderer.setAnimationLoop(function(){var e=o.clock.getDelta();o.elapsed=e,o.mixer&&o.mixer.update(e),o.controls&&!o.xrSession&&o.controls.update(e);for(var t=0;t<o.xrControllers.length;t++)for(var n=o.xrControllers[t],r=0;r<n.children.length;r++){var i=n.children[r];"XR_CONTROLLER_RAY"!=i.name&&"XR_CONTROLLER_RETICLE"!=i.name||(n.userData.inputSource&&"gaze"==n.userData.inputSource.targetRayMode?i.visible="XR_CONTROLLER_RAY"!=i.name:i.visible="XR_CONTROLLER_RAY"==i.name)}var a=o.renderCallbacks;for(t=0;t<a.length;t++)a[t](e,o.clock.elapsedTime);o.frame%o.frameRateDivider==0&&o.enableRender&&o.render(),o.frame++,o.disableRenderTrigger&&0==--o.disableRenderTrigger&&(o.enableRender=!1)})},enableRendering:function(){this.disableRenderTrigger=0,this.enableRender=!0,this.ssaaOnPause&&this.enableSSAA(0,!0)},disableRendering:function(e){(e||this.ssaaOnPause)&&this.enableRender&&0==this.disableRenderTrigger?(this.disableRenderTrigger=this.ssaaOnPause?16:e,this.ssaaOnPause&&this.enableSSAA(4,!0)):0==e&&(this.enableRender=!1)},setFrameRateDivider:function(e){this.frameRateDivider=e},render:function(){if(this.postprocessing){var e=this.postprocessing.composer,t=this._getActiveSSAAPass(e);t&&t.iterative?t.isLastIterativeFrame()?e.renderToScreen=!0:e.renderToScreen=!1:e.renderToScreen=!0,e.render(this.elapsed)}else this.scene&&this.camera&&this.renderer.render(this.scene,this.camera)},enableControls:function(e){var n=this.camera;if(n.controls){switch(n.controls.type){case"ORBIT":this.controls=new Ap(n,e||this.renderer.domElement),this.controls.target.copy(n.controls.orbitTarget),this.controls.minDistance=n.controls.orbitMinDistance,this.controls.maxDistance=n.controls.orbitMaxDistance,this.controls.minPolarAngle=n.controls.orbitMinPolarAngle,this.controls.maxPolarAngle=n.controls.orbitMaxPolarAngle,this.controls.minAzimuthAngle=n.controls.orbitMinAzimuthAngle,this.controls.maxAzimuthAngle=n.controls.orbitMaxAzimuthAngle;break;case"FLYING":this.controls=new wp(n,this.renderer.domElement),this.controls.panSpeedTouch*=n.controls.moveSpeed,this.controls.zoomSpeedKey*=n.controls.moveSpeed;break;case"FIRST_PERSON":this.controls=new bp(n,this.renderer.domElement),this.controls.collisionMeshes=[];var r=this;this.scene.traverse(function(e){var t=e.material;t&&n.controls.collisionMaterial&&t.name==n.controls.collisionMaterial.name&&r.controls.collisionMeshes.push(e)}),r.controls.gazeLevel=n.controls.gazeLevel,r.controls.storyHeight=n.controls.storyHeight,this.controls.zoomSpeedKey*=n.controls.moveSpeed;break;default:this.controls=null}this.controls&&(this.controls.enablePan=n.controls.enablePan,this.controls.rotateSpeed*=n.controls.rotateSpeed,this.controls.rotateSpeedTouch*=n.controls.rotateSpeed,this.controls.panSpeed*=n.controls.moveSpeed,this.controls.panSpeedKey*=n.controls.moveSpeed,this.controls.zoomSpeed*=n.controls.moveSpeed,this.controls.zoomSpeedTouch*=n.controls.moveSpeed)}},setCamera:function(e){if(this.camera=e,this.postprocessing)for(var t=this.postprocessing.composer.passes,n=0;n<t.length;n++)t[n].setCamera(e);this.controls&&this.controls.dispose(),this.enableControls(),this.onResize()},getCamera:function(){return this.camera},cleanup:function(){if(console.warn("v3d.App.cleanup has been deprecated. Use v3d.App.unload or v3d.App.dispose instead."),this.container)for(;this.container.firstChild;)this.container.removeChild(this.container.firstChild);this.loader&&this.mixer&&this.mixer.stopAllAction()},initPostprocessing:function(){(this.scene.postprocessing&&this.scene.postprocessing.length||this.useHDR||"AUTO"!=this.aaMethod)&&this.enablePostprocessing(this.scene.postprocessing||[])},enablePostprocessing:function(e){var t={format:Ge,stencilBuffer:!1};if(this.useHDR?(t.type=Ee,t.encoding=bt):(t.type=Ue,t.encoding=wt),this.postprocessing)r=this.postprocessing.composer;else{this.postprocessing={};var n=new Dm(this.scene,this.camera);this.postprocessing.renderPass=n;var r,i=0;switch(this.aaMethod){case"AUTO":case"MSAA4":i=this._checkMSAA(this.renderer,4);break;case"MSAA8":i=this._checkMSAA(this.renderer,8);break;case"MSAA16":i=this._checkMSAA(this.renderer,16)}if(i)(a=new gn(this.getWidth(),this.getHeight(),t)).samples=i;else var a=new vn(this.getWidth(),this.getHeight(),t);if((r=new Gf(this.renderer,a)).addPass(n),this.postprocessing.composer=r,this.useHDR){var o=new jm;r.addPass(o),this.postprocessing.toneMapPass=o}if(!i){var s=new kf(this.scene,this.camera);r.addPass(s),this.postprocessing.fxaaPass=s}}e.length&&this.postprocessing.copyPass&&(r.passes.splice(r.passes.indexOf(this.postprocessing.copyPass),1),this.postprocessing.copyPass=null);for(var l=0;l<e.length;l++){var c=e[l],u=r.passes.length-1;switch(r.passes[u]instanceof kf||u++,this.useHDR&&u--,c.type){case"bloom":var h=c.strength,d=c.radius,p=c.threshold;if(this.postprocessing.bloomPass){(f=this.postprocessing.bloomPass).strength=h,f.radius=d,f.threshold=p}else{var f=new Of(new Dt(this.getWidth(),this.getHeight()),h,d,p,t);r.insertPass(f,u),this.postprocessing.bloomPass=f}break;case"brightnessContrast":if(this.postprocessing.brightnessContrastPass)m=this.postprocessing.brightnessContrastPass;else{var m=new Df;r.insertPass(m,u),this.postprocessing.brightnessContrastPass=m}m.brightness=c.brightness,m.contrast=c.contrast;break;case"dof":if(this.postprocessing.bokehPass)v=this.postprocessing.bokehPass;else{var v=new Uf(this.scene,this.camera,{width:this.getWidth(),height:this.getHeight()});r.insertPass(v,u),this.postprocessing.bokehPass=v}v.focus=c.focus,v.aperture=c.aperture,v.maxblur=c.maxblur,v.depthLeakThreshold=c.depthLeakThreshold;break;case"grayscale":if(!this.postprocessing.grayscalePass){var g=new Om;r.insertPass(g,u),this.postprocessing.grayscalePass=g}break;case"outline":if(this.postprocessing.outlinePass)y=this.postprocessing.outlinePass;else{var y=new Nm(new Dt(this.getWidth(),this.getHeight()),this.scene,this.camera);r.insertPass(y,u),this.postprocessing.outlinePass=y}y.edgeStrength=c.edgeStrength,y.edgeGlow=c.edgeGlow,y.edgeThickness=c.edgeThickness,y.pulsePeriod=c.pulsePeriod,y.visibleEdgeColor.fromArray(c.visibleEdgeColor.slice(0,3)),y.hiddenEdgeColor.fromArray(c.hiddenEdgeColor.slice(0,3));break;case"ssao":if(Do.checkIOS())continue;if(this.postprocessing.ssaoPass)x=this.postprocessing.ssaoPass;else{var x=new km(this.scene,this.camera,this.getWidth(),this.getHeight());r.insertPass(x,u),this.postprocessing.ssaoPass=x}x.onlyAO=c.onlyAO||!1,x.radius=c.radius,x.aoClamp=c.aoClamp,x.lumInfluence=c.lumInfluence;break;default:console.error("v3d.App: wrong postprocessing effect")}}if(1==r.passes.length){var _=new Nf(Un.copy);r.passes.push(_),this.postprocessing.copyPass=_}},disablePostprocessing:function(e){if(this.postprocessing){var t=["bloomPass","brightnessContrastPass","bokehPass","grayscalePass","ssaoPass"];e||t.push("outlinePass");for(var n=this.postprocessing.composer,r=0;r<t.length;r++){var i=t[r];this.postprocessing[i]&&(n.passes.splice(n.passes.indexOf(this.postprocessing[i]),1),this.postprocessing[i].dispose(),this.postprocessing[i]=null)}!this.useHDR&&"AUTO"==this.aaMethod&&n.passes.length<=2&&(this.postprocessing=null)}},enableSSAA:function(e,t){this.postprocessing||this.enablePostprocessing([]);var n=this.postprocessing.composer;if(0<e&&n.passes[0]instanceof Dm){if(this.postprocessing.ssaaRenderPass)r=this.postprocessing.ssaaRenderPass;else{var r=new Vm(this.scene,this.camera);this.postprocessing.ssaaRenderPass=r}r.sampleLevel=e||4,t&&(r.iterative=!0,r.iterativeFrame=0),n.passes[0]=r,this.postprocessing.fxaaPass&&n.passes.splice(n.passes.length-1,1)}else 0<e?(n.passes[0].sampleLevel=e||4,t&&(r.iterative=!0,r.iterativeFrame=0)):0==e&&n.passes[0]instanceof Vm&&(n.passes[0]=this.postprocessing.renderPass,this.postprocessing.fxaaPass&&n.passes.push(this.postprocessing.fxaaPass))},updateEnvironment:function(e){this.disposeEnvironment(),e.useHDR=!0;var t=Bm.renderWorldNodeMatToCubemap(this.renderer,e,this.worldCubemapRes);if(e.hasNode("LIGHT_PATH")){var n=e.defines.LIGHT_PATH_IS_CAM_RAY;e.defines.LIGHT_PATH_IS_CAM_RAY=0;var r=Bm.renderWorldNodeMatToCubemap(this.renderer,e,this.worldCubemapRes);e.defines.LIGHT_PATH_IS_CAM_RAY=n,this.initPMREM(r),r.dispose()}else this.initPMREM(t);this.scene.background=new zm(t),this.scene.background.useHDR=this.useHDR},disposeEnvironment:function(){this._cubeUVEnvRT&&(this._cubeUVEnvRT.dispose(),this._traverseSceneForEnvUpdates(this.scene,function(e){e.material.envMap.dispose()})),this._cubeUVEnvRT=null;var e=this.scene.background;e&&(e.isSceneBackground&&(e=e.data),e&&(e.isTexture||e.isWebGLRenderTarget)&&e.dispose())},initPMREM:function(e){if(e.isWebGLRenderTargetCube){var t=new Sp(e.texture);t.flipX=!1,t.update(this.renderer);var n=new Tp(t.cubeLods);n.update(this.renderer),this._cubeUVEnvRT=n.CubeUVRenderTarget,this._updateSceneCubeUVEnv(this.scene),t.dispose(),n.dispose()}},checkWebXR:function(i,a,o){var s=this;"xr"in navigator&&"requestDevice"in XR.prototype?navigator.xr.requestDevice().then(function(e){if(!i){var t=document.createElement("canvas"),n=t.getContext("xrpresent");if(!n)return void o();window.document.body.appendChild(t)}var r=Xm.getXRSessionOpts(i,n);e.supportsSession(r).then(function(){i?s.xrImmersiveDevice=e:(s.xrNonImmersiveDevice=e,s.xrContext=n),a()}).catch(o)}).catch(o):o()},initWebXR:function(l,c,u,e,a){u=u||function(){},e=e||function(){},a=a||function(){};var h=this;function d(e){if(h.xrSession.removeEventListener("end",d),h.renderer.vr.setSession(null),a(),l){for(var t=0;t<h.xrControllers.length;t++){for(var n=h.xrControllers[t],r=n.children.length-1;0<=r;r--){var i=n.children[r];i.geometry.dispose(),i.material.dispose(),n.remove(i)}h.scene.remove(n)}h.xrControllers=[]}h.xrSession=null,h.onResize()}if("xr"in navigator&&"requestDevice"in XR.prototype){var t=l?h.xrImmersiveDevice:h.xrNonImmersiveDevice;h.renderer.vr.setDevice(t);var n=Xm.getXRSessionOpts(l,h.xrContext);t.requestSession(n).then(function(e){if(h.postprocessing=null,h.renderer.vr.setFrameOfReferenceType(c),(h.xrSession=e).addEventListener("end",d),l){2<=window.devicePixelRatio&&h.renderer.vr.setFramebufferScaleFactor(.5);for(var t=(new qr).setFromPoints([new Bt(0,0,0),new Bt(0,0,-1)]),n=0;n<1;n++){var r=h.renderer.vr.getController(n);h.scene.add(r),h.xrControllers.push(r);var i=new es(t);i.name="XR_CONTROLLER_RAY",i.scale.z=5,r.add(i.clone());var a=(new v3d.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAIQXpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHja7ZhZltw2DEX/uYosQSQ4LofjOdlBlp8LSqquHt12nD+X3JIKYpEg3sMDZDP/+XuZv/iIOGd8SDmWGA8+vvjiKjf5OD91n+3h93l//PWI76/s5vHAYRKucn7N8bJP7I7x7rL3a56KPTxNVOb1oL1+UK+JXL4WuOz3QmLPBY5rYlOvicRdK18utnNbRyw5PW+hX+PX9XyHgT+jJy/JxRBt8py9O1KKhfvsDp+I21BHV3dFfxfaNdGb7+Ye6vDJTbFycM7qoeC+FKmi93rGaSzCvUjY53J6ClrOHIn7csf1689Xnpvb9QvyV5A+7uwn9iekzQ7o/UDeIBQf1w/tNrzYzTOkG7enlWN8rPzKnufRXu35Rk3/1hp5rXnurvrIluO1qXsr+45xTaO1fxU5En/hyBpsPQpHJiU6PBqQrHF0W6wDxmW9HbbaZee+dttx0bvpElfnuhPbDcYMGMX1DbfXwy6XAH5IBvgOHQSre/hi97JlL9dtZuFhs4E9lsksP/lPh/nOoLU0oaw98iNW+OU00/BCkbPWHJZhIGLXFdSwA3wfbz+Kq4Bg2GHObLAeTWcA/hbsC7lkAy0MDFzPBLZpXBMQIjwIOGMFBI5oJdhoj4SwJWsJZAagiutOvGvAYkNwAyedF4mAQxawNr9Jdg91wZ1mhBAggkQjCWxITcDyPsCf5DMcqkGCDyHEkEIOJdQoUTMsxhRVUWuS5FNIMaWUU0nVZMk+hxxzyjmXXIsrguKGQj6WXEqplUUrM1d+XRlQa3NNmm+hxZZabqXV7kyX7nvosaeee+l1uCGDPB5xpJFHGXXaCZWmn2HGmWaeZdYF1ZYsv8KKK628iln1gdoF67vjJ1CzF2puI6UD0wM1rCndU1iVk6CYgZjzFsCTImDFOKeYHdl67xQ5xewoTkXQ4WRQcIZVxEDQT+vCsg/sXpALRuLvwc0AhPsdyBmF7hvIvcftI9RG3YVONkKahhrUQ8i+VdbM1eWqlfLLq/nRgO9e/0z0Z6LfNtEKlJIcBGEJdi4Y3YtQv/vMn9hbb2uO2qngQp1HkExeIqtF6sbqOjSLnimwjeScNfUo89iTZO/b7GHNot9iXc1v+ypRmpg4x9DZbZ/owSyht5CoP3X52YZQTUprFa0ItmIdx22xPvAvogdcVPyXdoNjrZpJ4+lZTtdDaj62hxnWigOhXduzQx+mQvaPZrNbk99ZfVDsDIMlgtBQLro75kMVI3Xb63P8HRXr6s2O0hI7YuI8TZLWlq8z1NZmxkfWRLdoCMcQIVAj5kCbeFkOhcg11PO8o7M6r+Z4Y/iJq4KdFVJt3w261qI9nXagWtvw6cKp96g4ZMIw/NZERidb2NYSDUzpabXiF3EzpaKqdZNqZSuTXqnN0CtBntdNmZYJStprx7kgxZCka/XWsc9qwzRVdkRnFEWjy8mRQDknXhkExoYgj6QNm96PWsKsM8EoejmdKOblTRMIQOt3ucsgJUigEUldCH5vJRCMcd1I1wWdMmKMNfyqcepalKOCefgzY9iGzOJ/Jd3Mhw9aLbrhTCyntQ44IOYBgdocpAPBbbGP1siF1bRxHYNyFKjJcD0EaAQs0EU0zcCEBBDNiuQn3CFPANTv3epZWd+CRs2zU7Og7coEZKcArFQGA8BOU5faUL/I3J0OuVAw2xqHzAHbywZiudFiNEM9XIMa3edcw7USP5WUzT5RLsA6JZ9SD/K07JoZAFUiPmdQak0CPlGYa/MptVDJT20yYguxkIT0DXQKexSrkjpz8QhlimYmdYF13enoS7Lj9CkCxcXzCa7Esl8AQBq6rDabFASNxDfMWcgaRzTRgIFeBRmje5n4GAJmnGIHE2qUtOBqhOpzOhnrHtCJiJnTPoAA9FmVwgzCETw7yqmHPwbBfIbCOxC6jSogCHVjYzWhLEk1KTQonoYhUIEbIQd4p42Wliu5ngJtT8Le6LXS6CdV5xIA+p3l6GY+dKCrHMp8mK0bSBPGK/WJ/d4U1PdiM3WhDiU9dQCRH6o4sxerpKcUyJGASZrjLVvTQ/XiJ0sAAj9ayPYW+8IbpLzW/3KkLUIvEnQKEG6FLW3OF3aksFMFtoZp+I0+giNUtd4xUutm3LTnZxLXmFQ5el3WkFEIPtPMorRGG2sfslIJ8NIaqxnbBKp7ckpOgDThLLn1kBGbnmRkvcgIlH+WkbLIoOC1LCAksc5RuviYqfE0yZeFd/2vomk+DSfceh1PLZ5k35uI3vXUvC+oKlTrUVBJ56eSyhJ5flhTzS8U1Q+v5ptF9aXK7ZuWNaXDJshY1S4xofutu27qtutxVSPSrffPqhGj39Ujan+5K9IXxXq+FPp3UhsAdw3TwQG5G3aWmEBohrt4qthpkCbBz4ntlcQXXreum5R1sbAXHs2QldBo9LOroE+gIaj52mBwabjzC2+lX17NjwbodeuhtFsPof1Q0UMOyTI0EO45g2lqG8k2i809EsB4quEkUrK1cKgW8mZb+UkcIAdcUXKyI9scHR1MY6I3jzUIZ2ODum6EgoaiEIrp9/YJmYP0QbMBnHLaCW2meqzsfm6AyYtX7S+id3W/vKle3e/OPRojdI/oDyOdRFVlrAORRx/igFKtQDte/oV654VGuvIKzMM2eCFuVB4SbD3CppXcXFE7i8guPY8i0l5XcpVqGsNjp1bjzGyCNLRgySyT5TY9R2fu2joo2cRhR6bsdCYa8P8MEJnzEqJpHiH6KEA6wXcCRHzMrwRovzykVEY/b/U/r81981+vfyb6M9H/MBF5RKaafwEjmLcIrlR0mgAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+MCAwojJyJFeN4AAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAd0lEQVR42u3YUQqAIBAFwLUDdf9zdCH7lwwEI2VnPkWQfWCvigAAAAAAgDTK1wecNWq7dpX+uaP7lw7gaZi3oUb3z3BkvwICEIAW+KcFRte3DWBGO7gCAhCAAHZ9FY6IpC3QG963gGeAAASgBRb6IwQAAAAAQCY34QUtIL9dJTwAAAAASUVORK5CYII="),o=new v3d.SpriteMaterial({map:a,sizeAttenuation:!1}),s=new v3d.Sprite(o);s.name="XR_CONTROLLER_RETICLE",s.scale.multiplyScalar(.1),s.position.z=-5,r.add(s)}}else h.container.removeChild(h.renderer.domElement),h.container.appendChild(h.xrContext.canvas),h.renderer.setCanvas(h.xrContext.canvas),h.renderer.domElement.classList.add("v3d-canvas"),h.scene.background=null,h.renderer.autoClear=!1,h.onResize();h.renderer.vr.setImmersive(l),h.renderer.vr.enabled=!0,h.renderer.vr.setSession(e),u()}).catch(e)}else e()},endWebXR:function(){this.xrSession&&this.xrSession.end()},printPerformanceInfo:function(s){var l=this;s=s||1;var c=l.renderer.info,u=c.autoReset;c.autoReset=!1,c.reset();for(var h=l.frame,e=0;e<c.programs.length;e++)c.programs[e].profile.calcRenderTime=!0;setTimeout(function(){console.log("--- Verge3D Performance Profile ("+s+"s) ---");var e=l.frame-h;console.log("FPS:",e/s),console.log("Render Calls:",c.render.calls/e),console.log("Triangles Rendered:",c.render.triangles/e),console.log("Geometry Buffers:",c.memory.geometries),console.log("Textures & Render Buffers:",c.memory.textures),console.log("Materials and Shaders:");var t=c.programs.slice(0);t.sort(function(e,t){return t.profile.renderTime-e.profile.renderTime});for(var n=0,r=0;r<t.length;r++){var i=t[r];i.profile.calcRenderTime=!1;var a=i.profile.materials,o=i.profile.renderTime;console.log(0==a.length?"System Material":a.join(","),String(Math.round(o))+"ms",i),n+=o,i.profile.renderTime=0}console.log("Total Render Time:",String(Math.round(n))+"ms"),c.autoReset=u},1e3*s)}}),Xm.getXRSessionOpts=function(e,t){var n={immersive:e,environmentIntegration:!e};return e||(n.outputContext=t),n};var Hm="SceneLoadError",Ym="LogicLoadError",qm="EditorLoadError";function Qm(e,t,n){console.warn("v3d.AppPuzzles has been deprecated. Use v3d.PuzzlesLoader instead."),Xm.call(this,e,t,n),this._editorJSFile="puzzles.min.js",this._editorCSSFile="puzzles.css",this._editorMediaDir="media/",this._libraryXML="library.xml",this.ExternalInterface={}}Qm.prototype=Object.assign(Object.create(Xm.prototype),{constructor:Qm,onSceneLoad:function(){},onEditorLoad:function(){},onLogicLoad:function(){},onLoadFinished:function(e,t,n){e&&this.run()},onError:function(e){console.error(e)},run:function(){this.enableControls(),Xm.prototype.run.call(this),v3d.PL&&v3d.PL.init(this)},_createSceneLoadError:function(e){var t=new Error(e);return t.name=Hm,t},_createLogicLoadError:function(e){var t=new Error(e);return t.name=Ym,t},_createEditorLoadError:function(e){var t=new Error(e);return t.name=qm,t},_getScenePromise:function(n){var r=this;return new Promise(function(e,t){Xm.prototype.load.call(r,n,function(){e()},function(){t(r._createSceneLoadError("Unable to load the scene file: '"+n+"'."))},!1)})},_getLogicPromise:function(n){var r=this;return new Promise(function(e,t){Rf.loadScript(n,document.body,function(){e()},function(){t(r._createLogicLoadError("Unable to load the logic file: '"+n+"'."))})})},_getEditorPromise:function(r,i){var a=this;return new Promise(function(e,t){var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=i,document.head.appendChild(n),Rf.loadScript(r,document.body,function(){e()},function(){t(a._createEditorLoadError("Unable to load the Puzzles Editor: '"+r+"'."))})})},_getLogicViaEditorPromise:function(i,a,o){var s=this;return new Promise(function(t,n){var e=i.match(/(.*)\.js$/);if(e)if(v3d.PE){var r=e[1]+".xml";v3d.PE.init(a,function(e){e?t():n(s._createLogicLoadError("Unable to load The Puzzles Editor's XML logic file: '"+r+"'."))},s,r,o)}else n(s._createLogicLoadError("Unable to load Puzzles' logic. The Puzzles Editor isn't loaded."));else n(s._createLogicLoadError("Unable to load Puzzles' logic. The provided file should be of type JS: '"+i+"'."))})},loadScene:function(e){if(1<arguments.length)Xm.prototype.loadScene.call(this,e,arguments[1],arguments[2],arguments[3]);else{var t=this;t._getScenePromise(e).then(function(){t.onSceneLoad(),t.onLoadFinished(!0,!1,!1)}).catch(function(e){switch(t.onError(e),e.name){case Hm:t.onLoadFinished(!1,!1,!1)}})}},loadSceneWithLogic:function(e,t){var n=this;n._getScenePromise(e).then(function(){return n.onSceneLoad(),n._getLogicPromise(t)}).then(function(){n.onLogicLoad(),n.onLoadFinished(!0,!0,!1)}).catch(function(e){switch(n.onError(e),e.name){case Hm:n.onLoadFinished(!1,!1,!1);break;case Ym:n.onLoadFinished(!0,!1,!1)}})},loadSceneWithEditor:function(e,t,n){var r=this,i=n+r._editorJSFile,a=n+r._editorCSSFile,o=n+r._editorMediaDir,s=n+r._libraryXML;r._getScenePromise(e).then(function(){return r.onSceneLoad(),r._getEditorPromise(i,a)}).then(function(){return r.onEditorLoad(),r._getLogicViaEditorPromise(t,o,s)}).then(function(){r.onLogicLoad(),r.onLoadFinished(!0,!0,!0)}).catch(function(e){switch(r.onError(e),e.name){case Hm:r.onLoadFinished(!1,!1,!1);break;case qm:r.onLoadFinished(!0,!1,!1);break;case Ym:r.onLoadFinished(!0,!1,!0)}})}});var Zm,Km,Jm,$m={normalizeDialectOptions:function(e){var t={delimiter:",",doublequote:!0,lineterminator:"\n",quotechar:'"',skipinitialspace:!0,skipinitialrows:0};for(var n in e)t[n.toLowerCase()]=e[n];return t},parse:function(e,t){(!t||t&&!t.lineterminator)&&(e=$m.normalizeLineTerminator(e,t));var n=$m.normalizeDialectOptions(t);e=$m.chomp(e,n.lineterminator);var r,i,a="",o=!1,s=!1,l="",c=[],u=[];for(i=function(e){var t=String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")};return!0!==s&&(""===e?e=null:!0===n.skipinitialspace&&(e=t(e)),/^\d+$/.test(e)?e=parseInt(e,10):/^\d*\.\d+$|^\d+\.\d*$/.test(e)&&(e=parseFloat(e,10))),e},r=0;r<e.length;r+=1)a=e.charAt(r),!1!==o||a!==n.delimiter&&a!==n.lineterminator?a!==n.quotechar?l+=a:o?e.charAt(r+1)===n.quotechar?(l+=n.quotechar,r+=1):o=!1:s=o=!0:(l=i(l),c.push(l),a===n.lineterminator&&(u.push(c),c=[]),l="",s=!1);return l=i(l),c.push(l),u.push(c),n.skipinitialrows&&(u=u.slice(n.skipinitialrows)),u},normalizeLineTerminator:function(e,t){return(t=t||{}).lineterminator?e:e.replace(/(\r\n|\n|\r)/gm,"\n")},chomp:function(e,t){return e.charAt(e.length-t.length)!==t?e:e.substring(0,e.length-t.length)}},ev=new Bt(1,0,0);function tv(e,t){e=void 0!==e?e:new In(1,0,0),t=void 0!==t?t:2;var n=new qf;n.setGeometry([0,0,0,ev.x,ev.y,ev.z]);var r=new $f({color:e,lineWidth:t,sizeAttenuation:0});Fi.call(this,n.geometry,r),this.elemHTML=null,this.offset=5}function nv(){}function rv(e){for(var t in nv.call(this),this.backgroundColor=new In(16777215),this.textColor=new In(24242),this.imageRotationSpeed=200,this.imageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAEyIAABMiAER9/n7AAAAB3RJTUUH4gUZDgMn9hBM7gAAIABJREFUeNrt3XdgVuXZx/HfdT8JYYmj2gLWih222rdD7XhrayvWOoAnAWuoA5IQFWtduLVqjbhwzw6oQBLUVuIgeQLVviraWtu3VdSOt9qlYh11KwJZz7nePxiKE8g64/v5q/1Dcs517vv8nuuM+5gAJFfNwuHy6NOSPiKLtg0Ko9z1Eck/KGmQpCGSBkgatvq/eE3y5ZKtXPW/9bzJH4+kxyR7XKbHFPwRzalYRnGBZDFKACTEgYUtNSDaVaadzW0XSTtLGtkLfymS9IjJ749cf5D7H9TW8aCaJnZwEAACHcCG2n1xibZd/jl5tKeZ8pK+Iin009askOw+d79DFu5Qw7gHOEAAgQ7g3Ry8aJhyneVmoVLyb2rVJfM4njr+afKFkXy+Gsrvk8w5eACBDmTb1MJgdeibIfJKN+0X3xB/N/5vk90SuTWpcdxvCHeAQAcyxE2TC18PQYe6tL+kgenYLT3q0lx511zN2+85jjNAoAPpdFDr5iqNKk06WtJ/pXhPO0zWHHlxlhor7qRrBwh0IB2mLNg1RLlpLq/QqtfIMsT/5h5mauDK2Zo18VUGA0CgA8lSVxf0+C5jLdKpMt+VgmiZSXOjktxlmj32CcoBEOhAvB3UurlKoqlmfpRkH6Ygb9NlUlOkcCmvvwEEOhA/NQuHBy+e4NJ3JQ2lIOvBdZfLz1VjxWKKARDoQP+qKnwkmJ/g0mFatdwqNjjY7T4PmqH6fIFiAAQ60Lcmt2wXgqa5NFVpee2s//3WzS5Q/bhWnowHCHSgd1Xf+rGg8AOXHSwpR0F6xR/c/Aeqr7iNUgAEOtCzpizYJkThRJcOl1RGQfqoY3c/nXvsAIEOdN/kWz4YciXHu+tYcWm9v05Vd7jsVJ6KBwh0YMMdWNgyDPDTVz+1TpD3PzfZTZHpB6rPP0I5AAIdeJ+O/PYhsvajzOw0yTelILETmev6KOo8Rdd9+xnKARDowLqmzixV+4gpJquTfAQFib0VZro66iw5X9ePeY1ygEAHMs9NNS37m9t5kj5BPRLnBXc/V0uH/VB3j+6iHCDQgSyqah5tZhdL2oViJN4j7jpVjeXNlAIEOpCZIF+4fbDoXJdXUozUudstd5zqxz5EKUCgA2l1yG1bhGLHye6aJt4lT7NVD86F3MmqH/ss5QCBDqTF2gfedJ6kLSlIZix380ukYTNUP7qNcoBAB5KsppA31+WSf4xiZNZSl52phnwjpQCBDiTN5OYvWLBLJX2dYmD1KW+x53Sc5uQfphYg0IG4O3jRh0NJ15kuHSopUBC8xar76wP8JF1b8R/KAQIdiF1HfvsQ5dpOMreTxXfJ8f5ed/NLtUnpBbp6TDvlAIEO9Le6uqDHdplk8gslDacg2ED/cPPvq76iiVKAQAf6rStv3dtCdJmkHSkGuulOt+g41Y//E6UAgQ70ldrmT1oxXCr5WIqBHlQ008woN+BMzd7nJcoBAh3oLTW3bhaUO5WFYdDLXnb3s7Wy/Ro1TSxSDhDoQE954z75RZI+REHQN/wht9wxqh/3a2oBAh3orqrm0Sa7XKbPUQz0k1YvyR2l2WOfoBQg0IENNWXBNqEYznPTZIqBGFjh5hezjCwIdGB9vfE++SmSBlIQxOy0+U+36DRecwOBDrwrN1W3TuZ9ciTEnS4dq4byv1AKEOjAGlWFL5n5FZK+QjGQoFNop8l/HHWVnKnrx7xGPUCgI8tBvnWQX+CmSYxHJNizLp2l7ZZcq7q6iHKAQEd2TC0MVpsfbaYzJA2lIEiJ+93tGDXmf0spQKAj5dxU07K/RXaxTNtSD6RykLuu42tuINCRXtWtu5iiKyV9lWIgA15x1wytbLtcTRM7KAcIdCRfbfPIULSz+D45stmv61GXjlNj+S8oBgh0JFPl/AEaVHaEmU2XNIyCIONaPdIxmlf+GKUAgY7kqGmuNLeLJI2iGP2qXdKKN/3/AZKGUJZ+s9LNL9Ly9gvVNHEl5QCBjviqat7Jgl0u1zcoRq95UdI/zfUPmf4RSU/J7Dl59LxyekFtued0w7iX3/NfqJw/QKWDhygXbaaSaISKYSuZj5TpQ0FhlLt/UtL2krag3L3A9YTLTlRj/iaKAQId8TL5lg+GUHKeS7XiPnlP6ZLrL2ZaErkvUc6XqL3kr+8b1j36A+2WD0il2yvoc8H9Cy59UdKOkko4PD0S7He5h2M1b9yfKQYIdPSvyvkDNGTQseY6XfJNKUi3LJN0r7vukexXCkMfjOVHQKYWBqs92kkWdjX30ZJ2E2sJdOuHm0k/iqx4luonvEI5QKCj71U3l5vsEkmfoBgb2YGbfuPui+Thbi0dukR3j+5K3F5MnVmq9uFfksJoM99Trq9JynF4N9jzbn66Rj04m9XmQKCjb9QUPmWRXyrTGIqxwV4y2Z2R1KpOK/Tp5fO+cshtW6jY/s0QWd5NFeINhw314OrV5u6lFCDQ0TuqbvlAsNzZLjtc3EPdwBDXrZH5jVrefpeaJhaz8+Nv8UDp9T1C5Ae4abykTRgO62XVanNR5ym67tvPUA4Q6OgZU2eWqn3kESavk7Q5BVkvy0xqjlw3amXbL1kpTFLl/EEaNKjcgh8o175a9Qod3mccufxcrWi/gjEEAh3d7Mpb9jXTpZJ2oBjv31XJ9Ct3m6My3aRZ+RWU5F0c1Lq5SosHmOxQSTtTkPcdWn9zt2msNgcCHRtuyoIdLQqXStqHYryvp8zUEHX5XF1X8Q/KsaFjrbBziKLDXHaQuN/+flrd7HjV5/9OKUCg470dWNgylPnZ7poq7pO/dzcu/Y/Lf6gV7QszdV+8t0y+fYhCx0STHylpFwryrjrM/cqoWHqurh/zGuUAgY51TZ1ZqvYRU0w6T9KWFORdvWbSzyPpKjWU/4Vy9JLq1l2CR8e62QGSl1KQd/Siu5+jle3X8IMSBDpWqSmMN/eLxPvk7+X/3HWVvOw6zdt7OeXoI1WFrUPw77nrMElbUZB3dL+H6FjNHX8fpSDQkdkgX/h58+gyyUdTjHedIovddInqx/1CMqce/TVWFw+UXq8x9xMkfZyCvI2b/IbIwylqzD9FOQh0ZMWBhS3DAD/TpSPFil7vJJK0yE3nqb78d5QjRurqgh7fZaxJp8v9yxTkbVa4+cV8zY1ARxa6HH/tOJOdJhb4eCdt5vppVJq7VLPHPkE5Yq668E2TnyLpWxTjbR536UQ1lN9MKQh0pC7MC3lzv0LSRynG27Sb1BC5TedyZRLHdst/r/o4kMZRjLe523M2TXPyD1MKAh2J72JadzEVL5dsN4rxNstNmh3l/ELNqXiaciRcVeErZv59gv1tInNdH3nXiZq333OUg0BH0tQ2jwxFO8ulQ8X3yd85yIudM1gnO4WmLNjVonAawf42r7hrhla2Xc4ysgQ6kmBqYbDa/GgznS7uk7/V6ybNiSx3gerHPks5Uq66+asmO1vSNynGm7ge9WDHqz6/iGIQ6IjnLDXVtOxvkV0s07bUYx3LzPSjKDfgIs3e5yXKkTFVha+Z/GyZ9qAY65z+7/DIjtG8cX+lFgQ64tWJXC7pixRjHa+42xUKXVeqfsIrlCPrwb5gT7NQJ+mrFGOtdjNdEQU/T3MqllEOAh39pebWUcFzF7pUybFcx0pzvyYqLZtBR463/wAu7GXyC8RX3t4cBc+4R6epsbyRBZQIdPSlybcPUa7tJHM7RdJACrJWZLKbI+s6WfUTHqcceHerb1F5uEDyj1GPtR5w+bFqqPgNpSDQ0Zvq6oIe22WSyS+UNJyCrDOU73CPTlBjxR+pBdbbGx8lOkfSBynIml87dlPkOlGN+aWUg0BHT6tqHm2myyT7PMVY59Rznwc7VfXjfk0xsNEq5w/VkLITze1kSYMoiKQ1y8hq2AzVj26jHAQ6umtS88dDLpzv8kqKsY6/uPnZqq9oohToMQcv+nAo6TrTpUPEdw7WeNJlZ6gh30gpCHRsjJpbNwvKnequaZLKKMhaS106TyvaZvMNaPSaKQt2DFGujh/S68TFYvdoGre1CHSsr90Xl2jbZbXc03ubF9x1iTYtuUJXj2mnHOgTqz4Ac5F4In6NVcvI5kpO0Nwxz1MOAh3v2pU372Nul0rakWKstdyli7Si7TI1TXydcqDP1dUF/Wung0x2Los2rfWSy36gJ4bO1N2juygHgY41pizY0aJwqaR9KMabOwGrj0qiM/lwCmLh6EVlerVrGssqr+PPLpumhvydlIJAz7ZDbtsidHbUuekISSUUZDXXXR5yJ6h+7EMUA7FTs3B4iKLz3LxGfPhozaS91XO5EzVn3L+oBYGeLZXzcxpcNtVk50j6AAVZG+SPuvnJaqhooRiIvSmFnS2KruDTxGu1memyqFh2vubtvZxyEOjpN7nlG2a6UqbPUYy1XnLXRTzwhmR27IW8uV8paTuKIUl62mWnqWHcPJaRJdDT6eBFHw65rvPdNIm6rx1+nSafG3XY6fpZ/gXqgcSqnD9Ag8qOMLPpkoZREEmme1zR0aof/yeKQaCnZaIP0qCBx5jpDElDKcharV7043RdxT8oBVKjtnlkKNpZLh0q7q9LUpdJP4rK2n6gWRNfpRwEenKtuhR3laRRFGOtBzzSCZpXfg+lQGpVt+5iiq6Q9DWKIUl61qWztN2Sa1VXF1EOAj05JrfuYCG6QtJeFGOtp1yazoQGP+oz7Q/udpQa87+nFAR6vB1Y2DIMiM5x2WFiHeg1Vrh0oVa0XaymiSspBzJnamGwOqKTze0kSYMpiIpmmhnlBpyp2fu8RDkI9Hh5Y7nW8yRtSUHWanUrHs23yQFJVYWtg/wCN02mGJKkl9x9ula2X8N3GQj0mEzS5tFmdrWkT1OMtR50C8fySVPgHaxaH/4qscTzGvd7FB2leeP/l1IQ6P1j0s0jQq7kYpcdRB3Xes7Nz9CoB2dznxx4D1Nnlqpt5NFmfpZ4zU1as9Szd56mefs9RzkI9L5RVxf02M6HmuwiyTelINLq98l/HFnxLNVPeIV6AOupZuHw4MWzec1trVfcvY7L8AR671v1KsqPJH2JYqx1p0vHqqH8L5QC2EiTm79guXCN3L9MMSRJD3jk39W8ivspBYHes6pu+UCwkhku1fIreq2/u+t4NZa3UgqgB1TOz2nIoMPM/VzxjQdp1aI0V0RRWR1rwxPoPaOmudLcrpH0QYohSVru5pdok9ILWHcd6AUHtW4eSqM6l44Ur79K0tNuPk31FU2UgkDfOJNbtrOc/1hue1MMSWseWgnhdNWPfZZyAL1sSmFni/waSV+hGNKqT7TqKM2peJpaEOjrZ/fFJdr2tWNNNl0sArHGA246QvXlf6AUQJ+GmKmqpcrMZkgaTj30irudpMZxs/mSG4G+Pr+IfyppZ4qxevLIztCKlT/hiVOgH02dv2loH3Suy48Ql+El2WJX12FqmPBPakGgv2WyzCxV24jjzTRd0gAKIpmsKSqNjta1Ff+hGkBMVDXvZGY/EW/aSNJKd52tlW2X0HAQ6KtUt+5i8rmSf4bhIEn6Pzc7UvX5uykFEEO7Ly7RqGVHmWu6pE0oiO53qYZXZ7Mc6HTlb7XCzS/m6XUgIWqbR4Yum8Ha8JJknW7R+Vrefk6Wu/VsBnpV805moYGufA2/1T1MU2N+KbUAEqa6udxkV0v6CMXQva5iTVbvrWcs0N1U1XKMmV1EVy5J+pfLj1FDxUJKASTYG59oPY1z2+p76x9dcnHWvimRnUCfdPMIy5U2SPoWs1/t5nZRtHLlBXyjHEiR2sLnrOg/kfTfFEO/dMtVZ2ndjGwEek0hb+6zJW2V+SHuusuVO0KNY//GfAdSqK4u6LGdDjfZ+ZI2y3g1nnPzatVX3EagJ93Ri8rCa8VLXH6kMv9Ev73q8pPVkP8pCzIAWWhkFg4PKl7hru9kvY0x6dJoRdvpaprYQaAn0cGLPmwlXU3i0pMk/cJDdLjmjn+SUgAZU9081mSzJI3MeCUe8KIfoOsq/kGgJ2oAF75p8p+JS+wvuvs0NVZcx1kNyLADC1uGAbra5QdkvBKvuVSrhvKbCfTYW/sU+yWSSjI+cFs954fzIQMAdOtvCQrTRdHyttPT9s56egJ9amGwtfk8mfbL+JR91s2PVH3FLZy9ALxjt17m13BvXbd5ZzhIN4x7mUCP2QC1Ab5A0lezPDpN1hR16Hv6Wf4FzloA3lNVyzgzzcx4t77UFfZTw7gHCPQ4mNy6g4VooaTtMjwon3TX4Wos/wVnKQB06xtkubsOUGN5K4Hen2oKu5v7LZI2z2xX7v7TqFh6oq4f8xpnJwAbpbrl2yb9SNIHM1qBLpeOVEP5LAK9P1QVJpj5z5XdZQ6fc/lhaqho4WwEoNumLNoqRMUfurwysw2SdF7UkD8zqWt1JDPQa5orzcP1kpdmdNz90nM+hSfYAfTO+dVmKaOrzJlrXrSy7dAkLkJjCRxsB5jbPGXztbSV7n6aGsuvYrU3AL13nr11lHnuOmX3QeNfuG2yn+pHtyVpo0OiSlxdmGJu12UyzF0Pe853UmPFlYQ5gF5VP+FxL3tmtJnOl5TF74vva75svirnJ+qWbnI69FWXgX6euB8hPXKQ/CeRDTsuab8WAaTA5JZvWPDrJPtwBve+1YeV7K+rx7QT6D3WmTd/3WS3SxqYscH0mrtNVWP+Rs4qAPrNlEVbWdR1naS9MrfvrkW+acl+SQj1+Af6lAU7WhTuVfZeTXvQiz4xzR8SAJCoZDNVFU4203mSclnaczPdGNXnD4z77c54X76uKmxtUbgta2Fu0rU+rOQrhDmAGJ2ZXI3lF7psb0n/ydRPGdd3QnXreXToG6ty/gAbPPAeZevzp+0uHZP0xQ0ApFxt80gr2nxl7Cl4d31XjeUz6dA3dMOGDLooY2H+lJt2J8wBxN6ciqd9RdseJmXqfGWma1TVsi8d+oZY9UT7/Az97vu1W8lE1Y99ljMFgESpKXzX3K9UdlbtfNlLcjtp9tgnCPT3HxyfMPf7JQ3LxC8+aW60ou27SVyVCABWnbdbdzOPmiR9KCOt+v/6gKd306zDO+O0WfG65F5XF8x9bkbC3N11etRQXkuYA0i0+nG/9hB9UdIfM7G/7l8OHcNnxG2z4hXo/9r5u8rGQxZt7nagGsvP50wAIBXmjn/Su0p2k/TLbGS6HaeaQj5WFw5isyUHL/qwlXT9JQPd+QseogrNHX8fZwAAqTN1ZmloG/kTN69N/87aM25dO6p+wit06G8uS0nX1ekPc3vGLdqDMAeQWrMO74wa84e4+zRJKf/uhI8IXhKbK63x6NAnt+5tIbot3cddj7psLzXmlzLjAWRCTXPt6k+xpnlluchDtFscGrUYdOhuFqK030te4t71dcIcQKbUV8xx6SDJOlO8l8GiMFNTZ5YS6FWtEyXtnOKDfa+Xte2hefs9x+wGkDkN5fNd0QRJK1O8l/+lthGH9fdG9O8l98r5ORs88M+SPpXSg/w7z/lemlOxjFkNINNWfTWzoNQ+K2XPeJk+rln5Fdns0AcPqkpxmP/ey9r2IcwBQFJDxa/cbayk5encQR+h9uiI/tyCfg10k09L6YF9yEsG7KtZE19lFgPAao35ez2oXCm9/G6yU1XbvEn2An1yyzckfTaFx/Qv7sU9NXufl5i9APAWc8vvcte3JaVxhcwtVVS/den9FugWdHQKD+ZTHqJ91bjfi8xaAHi3Tr38F+52gKSuFHbpR6hyfr+8ptc/gV5V+IikipQdx9c8Z2M1d/yTzFYAeL9Qz9/q0ndTuGejNGTQmOwEeoiqJZWk6AC2u1mF5uQfZpYCwHpqKJ9tptStQ2KKjsxMoJvbd9J08Nz9UNXn72Z2AsCGierzZ5jrhlTtlNteqil8Iv2BPrn1vyR9Oj2/xHS5GiuuY1oCwMa1eNGmJbUy3ZOmnQoeVaU+0EOIDkjRMVscPbHJyUxIAOiGq8e0e27AfpIeS02TLk1MfaD3x072kqUect/R3aO7mI0A0E2z93lp9ZPv7Slp+LZXzYLPpDfQawqfkvSJFByoTner1NwxzzMLAaCHNOZ/79Ixadmd4GH/9AZ6FO2ZhoPk7nVqzP+e2QcAPayhfJa5zUlFVkiVqQ10C5aGQL9XK9suZNYBQC/1fgN1tFyPpmBXdlDNraPSF+iV83NyfSPZx8ZedStOVtPEIlMOAHrJrPwKt3BwKr6j7iWj0xfoQwZ+UdJmiT4u0jGqn/A4sw0AelnDuAfcosQvOhPke6Qv0KOkd+e6Uw35RmYZAPSRx4edKynRzyu5lL4O3UxfTPAxaXezo5hdANCH7h7d5VJtwi+9b62qhdunq0OXdknsLyy3C1Sff4TZBQB9rKH8L+bRFYneByvulp5AP7CwpaRRCY3zv2nT3AxmFQD0j2hl+3RJif2SZTDtnJ5AL/XEXm53C6fo6jHtTCkA6CdNE19382mJzRHXTukJ9D76ddILfqP6/AJmEwD0s/qKWyT9T0K3/rOqnJ9LRaAH2X8l8leV/BRmEQDE5Jycs5MkRQnc9CEaOLjXH4zrk0B3+fbJGzm6RQ0Vv2EKAUBMzMk/bNJNidz24L1+pboPAt1NUtIC3d3DWcweAIiXyHNnSkrcVy6DfIfkB3ptywhJQ5NVeito3rg/M3UAIGYax/7N3OcmbrtNH09+oHfpk0mru4ciH18BgLh26SW5GZIS9U0Nd30s+YEuS9bldtM9mjv+PqYMAMTUnHH/kvzWhLXon0h8oIeELSjjsouYLQAQ9443XJywLd5UUxZtlewO3XybBFX8Xxr1wG1MFQCIucb87yXdnahtLhZ79T56rwe6y7ZOzO8ns5+qri5ipgBAErp0JW2N948ku0OXPpyQQneoJJrLFAGAhFi6yUJJTydme81HJj3QE9Ghm+lWXVvxH2YIACTE3aO7zFSflM0N7iOSG+hVt3xA0qAkFDqSz2Z2AECyRCHMluTJ6NAtwYEewsiEjIn/aHn7XUwNAEiYOeP+JdmdSdhUdyX4kruFrZJQZJM1qWlikZkBAMnjHl2XjA5dCe7Q3T+QhBpHZvOZEgCQUCFqltSRgC0dntxAV0hAoPu/Nep+vqoGAElVP+EVue5IwJZu1pvfRc98h26yW3j3HACSzYOaErCZpkElmyUy0IMU+0CPorCIqQAACdcRknHZPcptntAOXVvGvLTLlRtyDzMBABLuhnEvy3Vv7LezxJIZ6G7aPOalXaz60W3MBABIPje/PfYbWQxbJLNDl28a64Mv53I7AKRFLsQ/0HPFhF5ylw2NdWEj48tqAJAWc8b9UbJn4r2RIZkPxUk2LMb9+b81r/wxZgAApIW5mX4Z601077VGt7cvuce2QzfZrxn8AJAukSvuy3gPTmigK7YdemT2K4Y+AKRNV6wXCguWxEBftRpOfL+05k6HDgBp0zDhn7G+jx4lMdCHlG4S40P+krZb8ldGPgCkkPtv47txNiR5gR6VDIlvPf0PLPcKACnNc1l8L7sn8pK7dQ2Mb56HJQx5AEit2HboLk9gh65cbAM9chHoAJBWA/WwpGJMW8pee7asFwM9xDbQ5f4AIx4AUmpWfoWkv8Uzz700gYFejGugv6x5+ccZ8QCQXiZ7OJ4NpQYkL9CDlcX0MD8kmTPcASC9IveHYrppCQz0yGP5DrpJf2GoA0DKBX84pluWwEvuplh26JH0CCMdANIe6PojHXpP8bhecifQASD15pQ/I2kZgd4zHXpJLA9yLmKFOABIPXNJf4/hhiXxKXflYljI11b/agMApD3SpUcJ9J7gsQz0R3nCHQCyITKP47voIXH/sDx+l9xN9k+GOABkhIc4XnK35AV6HC+5mz/BCAeAjIhnh57AQA/xC/Qo0mOMcADIiBJfSqD3hBhecpcZgQ4AWXFt+XOS2gj07ovfJXcPjzPCASArzCX9m0Dvfocet0B3hcFLGeAAkCGuuJ336dB7wHOqH93G6AaADPXoFrdAtyQ+FOcxC3RnQRkAyFyHbk/GbYPo0Ltfw6cZ2QCQLZFFcWvmkhfowS1WT7mbiQ4dALLG9B8CvdsdsbjkDgDo51M/gd4TVYxVoEduBDoAZE2RQO+JfzleHXrwZxnZAJC1Dr30OQK9+/90vAK9aC8ysgEgY64f85qklQR6t34VxaxDL7VXGNkAkEnPE+jd2mQPsTqcXXqZMQ0AWWSvEuhpUszRoQNAJnmMAj2JK8V57230xsS5rt93GYMaADIpRud/dzr07nll9Vd3AAAZY/G65B4lMNCjOHXo3D8HgMzy1wj0VHXoAIBs5rnToXeLGR06AKD/E9QCHXpaGIEOAFkWo0A3HorrJi65A0BWWZzuoXsCO3RXfC65Gx06AGRWxFPu6TmWYtlXAMhuhy7uoXevQ/c4PRRHoANAZjv0KE4dOvfQu1k+VokDgMx26CV06Ok5mNFKRjQAZNSArjit5Z7ADj1W76GHNkY0AGRUaI9RBkRFOvRu1Y8OHQAyq2Or9hh16Im85E6HDgDof6Pu6YjNtjgPxXVzLwMdOgBkVV1dJKkrHg16Il9bi9M99IgOHQCyLSZduvGUe/d0EegAQKDHQBKXfrUYLSxTwiV3ACDQYxHo3EPv3l6206EDQKY5l9y7s9WxOY5lQwl0AMg0i8uT7txD71bxrt63g8EMAJlGoKdAW28utQcAINDTHejxWfqVy+0AgHgEOgvLdAtPuANA1nlM7qEnc2GZKCYdutGhA0DWmXPJPQU/y3ggDgAI9Lh8oIVL7t1QZCQDQMY5r611p3gxueTuXYxkAMi8uDR3XHLfeEaHDgCISY+ZxJXiLDYrxUWMIADIfJLGYz0Sczr0bqBDBwA647gsMJbEQI/N19YIdADIOpOnfTvo0AEA6CuJvIcem6fceSgOABCTe+jiHjodOgBg41s7Be6hJ/8oRgQ6ANChxyXQE3gPPS6vrUVccgcAWnTRoafgIBLoAIC49Oe70lkPAAAgAElEQVRJDHTjtTUAQEyC1OLy2hodehx/DQEAEhMGMbnknsilX+OxsIwZ99ABgDyPy8IyzsIy3UCgAwBi8sMiie+he1w+zsJrawCQecYl9xT8GjLuoQNA5jvjuGRBAi+5uzwePxbi8xlXAEDGmZK5lnvg0AEA4pGksWkyE7lSXEwC3enQASDzQi4mkZTEp9zp0AEAsZFL+w72YujG5PJGbD7jCgDotyhwz8VlS5LYoccjSHkoDgAQ6NCT36EDAOAxCXRP5ENxcQl0LrkDAOjQu/ErJCYPxRlPuQMAYhLoCV3LnUvuAIB4cJXQoW/8z5CYPOXOQ3EAkHmxeSguke+hc6kbABCbDp176DH9tzfk1xA/LAAAPOWe9EB3RQQ6AIAOfeOTlKVfAQAE+joS+ZQ776EDAGLD6dBj+m8DALAhkRSTDj0k8h56XDrjHAMZAOjQ6dCT36GXMZABIOt5zkNxaQj0AYxkAMg4i0lz50l8KM7jEuhOoAMABsZkO5L4lHtcPs4SCHQAoEUflPY9TP/Sr06HDgDweHTobqwU1w0EOgBkO8wtC1lAoAMA0q2yaaCU/i9v9uYl97h8PpVAB4AsGzYsPvfPE7n0a1y+h25GoANAlnn7wCzsZgYuufNQHABkWy5Ogc7Sr91AoANAlhWjQVnYzQwsLEOgA0C2hfh06IlcKc7iFOjOJ1QBILstOvfQY/xvb9hPi8qmUgY0AGSUe4yecjeecu9+lw4AyKZAh97Nn0Txucw9dOggBjQAZJUR6DH+tzdMZ+emDGgAyKooPoFuYi33bm7JJgxoAMhqgx7i09Ql8in3WAV6oEMHgMzyzbKwl9kIdI+GMaABIJuCbPMYbQ0devcCXQQ6ANCh06FvpBgt5mIEOgBkNc5d8enQjXvo3S0g99ABIKssTpfckxm6IT47GXjKHQCy26PH55I7T7nToQMANhodejdTlIfiAABx6Op4yr2bKRqbQHceigOAbKqrC5Jn4rZryMQB5ZI7AGTT458blpWsy0agc8kdALIplG4RrzxK5ENxFsWohHToAJBFHrNFZRL6cZY4+SCjGgAyKIrZE+7mXQkMdI9Thz5UUwuDGdkAkDEWxeuSe6QiHXp3rfQPMbIBIHMd+siY/cJIZKB7rGqYE4EOABkTgo2IV54n8pJ7zAI9ItABIHPcYxXokYkOvft76jwYBwBZy3PFrENXMgM9itdRjd1BBQD0Ohseq82JjIfiemBHt2FgA0DmevSt4/X7gnvoPbExH2FgA0CGVM4fpPh9aY0OvQcSfVtGNwBkyNAB20myeHXovLbWA0XURyQ3RjgAZKWRy42K3TZFibzkbh6zMg7SlF9syQgHgIyIPH6BnszX1jyKXSG7OrnsDgAZEcxieM7nKfeekdPHGeIAkBnbxXCbeA+9R7htz/gGgGxwefwC3Qj0HtpZJ9ABIBtxbpI+FbvNSuhDcV2xO7yiQweATKhq3UbS0Ph16Em8h+7eEb8jTKADQCZYDLtzKaErxZk641dJ31Q1C4cz0gEg5TzaIZ7bpfbkBbrUEdOD/FlGOgCkWwi2Q0y3rC2Bge7xDHTT5xjqAJDyBt19x3huWZTEQLfOOJYyeESgA0Ca1dUFyT4fz18aSezQPZ6B7nE9yACAnrF0p09I2oQOvcca9Jhecpc+ufqTegCANIq0U3w3riSJHbpWxLWaGjToM4x4AEinEGnnGP/aSGSHviK+R9t3ZcgDQDq5WXwD3TuTF+hmYXl889wIdABIo8r5Ocm+EN8NHNJr2ZjFS+5y+VcZ9QCQQoPKPiv5pjHduqLm7dVr2dib76Evj/EhH6maW0cx8gEgZSzsFuONe10yT1ygRxbrQJe8hC4dAFImSF+LcfC83sv73lvbHd9L7pIUXHsw9AEgXTzWga5lyQz0Xt7wbh90871Xfy8XAJAGtc2flHxEjLcwoR267JWYH/qtNXnhp5kBAJASXdon3htoCe3QzV+O/cEPxb2ZAQCQDha0b8w3MaGBXox/oJuMQAeANKicP0huX4915rheSGagl8b+krskfV1T52/KTACAhBtctoekmH+nI3oxmYHeWXw5AUOgTB0Dy5kJAJBswWxM3LcxkiU00Ac9n4RAl7kqmQoAkGB1dcFd4+MfOEm95D7r8E7F/NW11fbisjsAJNgTO+8uaWT8Az2pHfoqzyZgKJSprSzPjACAZApFPyARGxoltUOXJNPTSaixBU1iSgBAAk2dWepm+yXjl0eCA93cnklEkd2+xcdaACCBOkZ+S9IHkhHo0VMJ7tCjpxMyJEKISmqZGQCQLObRoQnZ0lc1pyKxa7krSkqHLsnNa1U5P8f0AICEmHTzCCmMS0jK/LvXO9Ne/kXyTIKGxtYaNHBfZggAJERJyaGSlyZka3v9inUvX3K3pUkaG2aaxgwBgASoqwsW2SGJyRe3J5Peof89YUPkm6pu3YWZAgAx99hO42TaNjkdY5TwDr1+7LNKxuIybxTEopOYKQAQ83yUnZyk7Y1MjyW8Q5ck/2eSiu6u/TWp+eNMFwCIqckt35D01URts+vRFAS6/pGwoZILJXYiMwYAYtqdB52auI0OpX9LfKCbW9ICXe5Wq5rCJ5g2ABAzNQs/L2nvhG31y5o75vnEB3pk9tfkjRgvDfJzmDkAELPu3IvTJVmyNtr+1hd/pvcvuUe2JImDxl0TeeIdAOLUnbfuJilxH9Myjx7ti7/T+4H+5JBHJK1M4g9BU3QBMwgAYtFmmXl0URK3PLLw53QE+t2juyT9KaEj6FuqKYxnIgFAP6tq/bak/07ktkfR/ekIdEkmX5LUMWTuV2ry7UOYTQDQT2oWDzTzpF4xdYXowdQEemRakuCh9JEQOn7AjAKA/hF82WmSkro+yD9UP+GV1AS6irl7kzyYXH68qpo/y7QCgD5WtXB7l05J6uabdH9f/a2+CfR54/6asC+vvVWJhTBLuy8uYXYBQJ+1U2ZW/KmksqTuQSR/IF2BLsncFyd7XPmXte2y7zPBAKCvuvPWQyR9PdH7EOme1AV6JFuc9LFl0pmavODLzDIA6GW1rR8180sTvhcv6mMP9tkzZH0W6LKuxSkYYiUWwnWqnD+U2QYAvWT3xSVWjK6TNCzZTaDdpbq6KH2B3jDhn5IeScFQ+3gYPPAKZhwA9FIwbbvsTElfSfp+RO539mnd+vbXit+UhsHm0iGqKhzKtAOAHlbd/FWX0vG8UpTiQI9y4aa0jDkzv0Y1LV9k9gFAD6lZONxkN0pKwxtFj+i6ij792mifBrrm5B9WOi67S1KZuW7WlEVbMQsBoJumziw175ovaes07I5LP+vrvxn6+g+a6ZYUDcFtLCreqMr5A5iNANCNMGoffpVku6Vmh8zmpz7Qo+CNq368pIWPDoMHzpbcmJIAsBFqmg9z2XfTEwt6WPX5Pr8a3eeBrjkVj0q6I01j0aVJobpwDrMSADY4zPcxDz9MVSaY39gffzf0z87aj9I2Jl06XdXNRzA7AWA9VbfuYm5NkpemZ6esU12l8zIT6Fq+siBpadrGpsmuUlVhArMUAN7H5JbtTFGrpFQt1GXSzbp+zL+zE+hNE4tu9uMUDtESM/+5qlr2ZbYCwLuF+S0fNNMvJA1P265FoXh1f/3t0G97vXzlNZKeS+FQHWCmW1XTvA+zFgDe4qDWzS2U/EKmT6Zw75Zo7vj7shfoTRNfd+nilA7ZMnO7SVWFrzF7AWC1Q27bwkqLd0naOY275+6X9+ffD/2697bJNZKeSunQHWLmt6lqwZ7MYgCZN3X+ptbVcZtkn0/l/rke1dJhP89uoNePbnPZBSkewkPMQkHVzWOZzQAyq+qWD1j7wDskpXa5bDedrrtHd2U30CWp7OlZkv6c4qE80BRuVXXLRGY1gMypbR5pVnKPpC+keC/vV0O+31dB7f9An3V4p4focElReo+1l5p0g6pbDmF2A8iMSc0ft6LdK+nTad5Nl50uWb+vgBpiUY254+8z009TPrRzJv1UNc11LBMLIPWqWz5tObtb0nYp39NWNeR/GYcNCXGpSKTiqZI9k/IDb+Z2VqguzNbUmaXMeACpVFPY3aRfKyVfTnuPU/qrnvPD47I1sQl01U94xU2HK1UfbnlnLk2x9hELdfCiYcx8AOkK85Yac79d0ubpP5f7yZpT8TSB/o6hni+YdEVGhv23rKTr15qyYBvOAABSEG8WalrOM9dcSen/pLTpHjXkY3WrOMStRtGKtlNl9r8ZmQGftSj8QTWtu3EyAJDcrnzxwFBT+Jm7vp+RPX7FQ6iNw4NwsQ50NU3scCtWSnoxIwPjQ+bRXapqOYWzAoDEqSpsbXr9bnd9JyN77O5Wqznj/hW/iwax/cVXGGPuzZJKsjIvzDQzWt52jJomdnCWABB71c1fN9l8SR/KzHna/eKoseLkOG5biG3V6vOL3HVUluaGuw63wQPvVG3zSM4UAGKtpuVoU7gjS2Eu6d5o6bDY3laI/fvQobpwvstPy9hU+Y/LDlZD/k7OGgBipXL+oDC47Ccuq8rYnj/mlttV9WOfJdA3vm+1UN1Sn8HB42a6KFredrqaJhY5iwDod7XNn7Quu1Gmz2Vsz190s6+pPv9IrBvg+NfRPFrRfpik1owNIHPXKTZ44CJNWbQVZxIA/aq6UGVFuz+DYb7CTePiHuYJ6dBXq5w/wAYPvElSPoNT6Sk3m6T6/N2cVQD0qcm3Dwmh/RqXajK490U3m6D6fCERXWCiSls5f4ANHtQkeXkGB1ZksgujsqfP0qzDOznLAOh1Vc2fNbOfS9ohg3vf5VKVGsp/lpQNTt5HQqbOLLX2EfMljc/oFLvfzQ5Sff7vnG0A9A43VRcOM+lySYMz2ZnLqtWQvz5JG53Mr37tvrgkbLvshy5NzehsW+nup6mx4kpOPAB6VM3C4ebFOZL2zWgFOtztADXmb03ahif4M55uoar1bDc/M8O/om/yUPo9zR3zPGchAN0P8+ZKc/uJpC0yWoE2d1WqsTyRD2En/7vcVYVDzfzHytCKcm/xvJsfqfqKJs5GADYuyG/dLHi4MoOvB7/Ziy6vUEPFb5K6A5aOwVgYY+43Shqa1ZFo0vwolBxFtw5gw5qilgoz+7HkIzJchb+72dikP5tkqTkctc2ftKLdqmw+jUm3DmDDHNS6eSiNZmT4WaQ1fuehpDwNzZCl6rDU3LqZRbnrZRqT5dFJtw7gvc+VzQeY21WSMr1olbluiMImh6h+dFtKzv1p46aqwslmOl+JWAmv1zznbkeqMX8TZy8Aq4J84XCLij+Uab+MV6LLXWeosfzClDVzKVVVmGCmuZJvmvluvcOO1M/yL3A2A7LKTdWtNSa/TNJmGS/Gs25hourH/TqF5/sUO2ThttYZ3SDzXTM+gOnWgaw6ZOG21lWcJWkviqHfeM4nak7F0ylt4FJu6szS0D7yXJeflIn9fc+DbU1RseNYXfftZ5jXQMrV1QU9tssRJp+hDL8BtJqb+eXRgGdPTfPS2dkJuMmte1uIGiR9KNvj2l519+/ro0t+orq6iLMekMrz3Q4WijMl241i6FmPQo3mjbs9/U1blqxa0nCupH0Y4/q9W+5w1Y99iFIAaQny24cEaz/DzU6QvJSC2EKPOms1b7/nMrG3mTzG1YUqk18jaZOMj/Yuk34U5fwMzalYxuQHktywFPLmfpWkURRDbe6q00eXXJylK5HZvadc2/pRKxbruSQlSXrSXUersbyZUgBJ68pbtrOgqySNoxiSpCVuUY3qx/8paztu2T7umf9E4Fu1eknuKM0e+wSlAGJu6sxStQ3/npmdKx56k6QuM10aLW/7gZomdmSxAMYYkDRlwY4WhbmSvkQx9Lq7naWlQ6/S3aO7KAcQQ1UL9jSFa2T6JMWQJH/Ic6FGc/IPZ7kKBPoadXVBj+18qEmX8mtXkvRHNx2u+vLfUQogJibdPCKE0gvdNInzN105gf5+als/asVolqRvUgxFJv9xVNZ+umZNfJVyAP1k98UlGrXsKHOdLWkYBZEk3e+WO4w3dQj09+GmmpYp5naJpM2ph/7jplNVn2+QzCkH0IemLNjViuFHMn2OYkiSXnfTmVredrWaJhYpB4G+fibdPMJyJVdJtj/FkCT9zhWOUsO4BygF0Mtqm0eGLpvB5fV1Imuhu76nxvxSakGgb5zq5rEmu0a83ylJkbmuj7zrxKws1gD0qTeeXp8uLq+v8R+XnayGfCOlINB7YJIVBocO/4G7Hc8KTJKkl1x+hla0z+KyF9BDqloqzOxSyT9GMVY3ELKZkXV9X/UTXqEcBHoPT7iF25uKP5ZpD4ohSf6Qezhajfl7qQWwkWqbP2lddplMYyjGWg+66Xu8aUOg93aImapbJ5v8UklbUg+5yW6KQvEEzR3/JOUA1lPNrZsF5U5113GSBlAQSdIr7l6nle3XcPWPQO87UxZtFaKu812qlRQoiF5zt7M18Omr0/yJQqDbKufnNGjgoWY6l6bgzY2BGqKo6xSezyHQ+/FXdssXzXWNWGlujf9z2TFqyN9JKYC3qG7+uklXSvZ5irEmyvWwy47i1h2BHp8fl6suw18s6YPUQ5LU6lY8WvUTHqcUyLyqwtZBfgGvoa3jJXefzuV1Aj2eDmrdPJQWz3HZdyXlKIhWuPnFGhAu0qz8CsqBzKmcP0iDBp1s5ieLj0Ct0WWuH0dd4SzdMO5lykGgx1tt4XNWjK7m86xrPeXSdG235NosfZ8YWeammpb9ze0isYbFm2NnsVvx2Cx+3pRAT7qaQt7cfyhpG4ohSfqDh2ia5o6/j1IgtSYv+LJZ7jKZ70ox1nrSZWewOAyBnvDJffsQ5dpOMrfTxKspq1sXuykqCSfx7XWkSlXhI0F+LvfJ17HqtpuGzVD96DbKQaCnZLIv3N6seKWkfSjGqolupquj5W3nqmni65QDiXVQ6+ZhQHSKu6ZJKqMga7V6Se4ofrgT6Om16jL8VeK+2pqG/d+ucLoaxs3ja25IlKkzS9U+YopJ50raioKs9aBbOFb1435NKQj09Jt8+5AQ2k9z6QRJAymIJOleV5jG19yQkB/m4839IkmfoBhrPe/mp2vUg7N5+JVAz2Cwt2xnpktk2o9iSJIikxqiYufpuu7bz1AOxE516y5m0aVyfYNirI2STpP/MLLi2XxEhUDHlJY9LLIrJP8MxZAkLXP5BbJhl/MgDWLh4EUfDiWd57lskljq+c1aPecnak7Fo5SCQMcauy8u0UeWTTXTdEkfoCCSpKVuOkOjllzPJTz0i9rmTUJXOMnNTxALw7w5Pv7kFp2g+or/oRYEOt7NG0/M8gWmN/yfm9epvqKJUqBPvPHA29mShlOQtV5093O0dNgPdffoLspBoGP9OoNPWtEul7QvxVg7ZO/woFM0N7+EWqBX1NUFPb7Tt83DBZJ/jIKsnXudJv9xVNb2A82a+Cr1INCxMWoKeXNdzsllrVUL0+TsVM0Z9y/KgR5TtWBPM7uYL6G9TaurOE0NE/5JKQh0dNfUmaVqG/49M5suaRgFkSR1mFQfhZIzNHfM85QDG23ygi9bCDMk7U4x1vGgRzpO88rvoRQEOnrapJtHhFxpnUuHiidt13jZXRcqbHIlT8Rjw4K8dYcQ/GyX78/5cJ1oeMbldVrRNpvPmhLo6PUTUfMXzMKVfPxhHU+6dC4nIbyvKQu2CVE4w6VDxGeO36zDpJ9EXSVn6voxr1EOAh19xk1VLVVm4QLJR1CPtR508++rvuI2SoF1HFjYMgzw77v0PbHm+ltOJnZjVBJOZd11Ah39qXL+0DBo4OluOo6T1Dp+6+Zn8Z4sdMhtW4TOzmlufqx4BuUtKWD/65GOU2P+txSDQEdcTFmwTSiG89w0mWK8NdjtAtXnC5QiY6pu+YBC7mhzO1bSZhRkHU+5NF3bLbmWRZsIdMQ22FlG9h253edBMwj2DDiwsKXKoqPMwzTJN6Ug6+CzxQQ6EmX3xSXadlktn3V8R79x2VlqyN9JKdL2Y3bRVvLOI83tOHFp/e0/aWU3RSXhJO6TE+hIooNaNw+lUd3qh4BKKMhbgt39TDVWLKYUCTf5lg+GXMnx7jparLf+Tn7vITpOc8ffRykIdCRdTeFT5n65pH0oxjsEu9kZqs/fTSkS5tDmD4UuO85dx0gaREHe5kmXnaGGcfMkc8pBoCNNqlu+bdLFkrajGG+bDne4RRfxVHwC1LZ+NBT9RJfXijc73slrbnaBNPQKFlsi0JFmlfMHaFDZEWZ2jqRNKMhbuB52s8v0xNAb+JpUzEwp7ByKPs1NB4pbSO8kMtf1UcidrPqxz1IOAh1ZUVXYOlh0ocsOYiy8o3+561KtbJurpokrKUc/qasL+tfOeTM/QbLdKMi7/hC9y0vseM3JP0wxCHRktutZsKtF4UpJX6AY7+hFc/00ykU/0tzxT1KOPlLbvImKocoUHSPZ9hTkXf3dXSepsbyZUhDogCQ3VbdONvmFkoZTj3cUSVrkHl2pxvF3UI5eUlP4RJAf4q6pkjanIO/qFXfN0KYlV+jqMe2UAwQ61nXwomEh13mGmx0raQAFeVdL3PyHKg68UfP2Xk45umn3xSUa9fo4cz9K0h6cm95Tl5lmRe12ln6Wf4FygEDH+3ZJ5n6ZpHEU4z29ZqafRUW/VvMq7qccGzzOPhXkNe5WxQeG1sttHqITNHf8/1EKEOjYMFUt+5r5FdzDXB/+kCtcK+/8uRr3e5F6vIva5k1UtIkmTZH0VQqyXv7q5sfzBUEQ6OieqTNL1Tb8e2Y2XSynuT6Kki12aZ5WrLyF9bIlHb2oTMuKe4XIK900QdJQhsl6edldF2pl2+VqmthBOUCgo2dMunlECKUXumkSY2e9vW7y5sjCjVq+8o5Mvf5WOX+AhgzaM0R+gJsq+DG4QbpMPjPy4llc7QGBjt4zufkLFuxqSf9NMTbISkl3ulRQsbOg6779TOr2cNXnSvcIkeXdlBefLN1wrrtcfpwaK/5IMUCgo/fV1QU9vtMh5nae+JrbxihK+q273SHpTg18+n816/DOxO3F1Jmlah/+Jcl2N2mspC9LChzejfJ3NzuBz/uCQEf/qLl1s+C5s/maW7ctl/m97rpLHu6TD3gwlq/DTS0MVpt2lvk3TPqGpF0lDeHwdes0/KrLz9WKtqu4Tw4CHf2vuuXT5rpKpj0oRo918H816Q+R636F8CcVOx7VvP2e67MtmLJoK3V17aicdgqRdnbTzpI+JSnH4emZY2zS7CjqOrNPjysIdGC9VBX2N/klMm1LMXrFK5L+ZtLf5PZYpOg5mT0jt/8o6D/qsBc01Ns1K7/i3bvsmaXq3GYzqWMrRbalZFvJ9aEQtLVcH3fp45J9TPJNKXevudstd5zqxz5EKUCgI74q5w/SkLJTzO1k8Y3q/rRS0ps/nbmJuC3S3x5z6SQ1lN9MKUCgIzkOXvThkOs6302TKQYybrmbXyINm8H3yUGgI7lqCrub6yrJP0MxkDFuspsi14lqzC+lHCDQkXy7Ly7RtstqTTpP0pYUBBnwe3ebpsb8bykFCHSkzyG3bRG6Os5y6UjxtDTS6SmXfV8N4+ZJ5pQDBDrSrap5JzO7WnycA+mxwkxXR8vbzmX9fhDoyBg31bTsb26XStqGeiC5A9luikrCSZo99gnKAQId2TX59iHKtZ1kbqdKKqMgSJAHVt8nv5dSgEAH1pjU/HHL2eWSxlEMxNzTLp2t7ZZcq7q6iHKAQAfeSdWCPc3CVZJ2oBiImQ6TfhLl/AzNqVhGOUCgA+9n6sxStQ3/nplNF9/RRjy0eqRjNK/8MUoBAh3YULXNI0OXzXDTJMYr+smDLp+mhopfUQoQ6EB31bR80WRXy/3LFAN95EV3P0cr269R08Qi5QCBDvSUurqgx3aZZPKLJX2QgqCXToudJv9xVNb2A82a+Cr1AIEO9JZDbtsidLVPd9nh4uth6FkLvOgn6bqKf1AKEOhAX5nc+l8W/HLJ96QY6KY/uux4NeTvpBQg0IH+suo1tyskfZpiYAO94O7ncp8cBDoQF1Nnlqp9xBS+5ob1tGrd9c6S83X9mNcoBwh0IG7e+Jrb98T9dbzdqnXXretk1U94nHKAQAfirqbwKYv8UpnGUAys9jt3O57vk4NAB5Jo1f31KyXtSDEy6+9ufrrqK5ooBdIsUAKkWuP4O7zsmc+7+zRJr1CQTHnJXaf6sJLPEOagQwfShPvrWTmtdZp8btRhp+tn+ReoBwh0IK1qCp8y98sk7UsxUqfVVZymhgn/pBQg0IHsBHve3GeI++tp8DuXn6iGit9QChDoQBa9sT78BZJGUpDEecTNf6D68pskc8oBAh3IuqmFwWrzo830ffH99SR4yqXpemKTObp7dBflAAh0YF0HFrYMZX6iu46TNICCxM7L7rpQK9uuUtPElZQDINCB91a1cPtg0dkunyhe74yD5ea6OuoKF+mGcS9TDoBABzZMdcung+wsl+/PfOkXHSbVR8XOOl337WcoB0CgA91T0/LfFuk8mfagGH1yalr1LrnbdDXmn6IeAIEO9HDHXtjLTNPl/mWK0Su6zK0xKg3TNXvsE5QDINCB3lVV+JrJz6Zj7zEd5roxUu5cNY79G+UACHSg74Pd/BRJ4yjGRllu0uyoq+RiXT/m35QDINCB/lXTupt5dIakvSjGennF5NdEHeFK1lsHCHQghh1782eD2ZEuVUkaSEHe5jF3zVRXmMXrZwCBDsTfoc0fUpeOMLejJW1BQfSAy67SE0NvYGU3gEAHkqe2eRMVwxSTf1fSDhnb+3aT3xRFukLzKu5nMAAEOpAO1a27BEVTXZokaXCK9/QRd9UrVzJHc8c8z4EHCHQgnQ4sbKkBUbXJpkj6dEr26nWTboxM16q+/HccZIBABzLWtbd8WuaV5naQpE8kbOvbJN3hsiatWHmLmia+zgEFCHQg495hA0kAAADFSURBVNw0uflLIYTvuHysZNvHdEOXyfU/HrxJxYEFzdt7OccOINABvJvJLdsp6FtBtqfLvyVps37akqKkh8x0RxRFd2hlx6/UNLGDAwQQ6AA21NSZpWrf+rMy/2KI9EU3fVHyHSXlev5CgZ6Q9ICblsj8AQ1o/61mTXyVgwAQ6AB6pYO/fYisbXsFbacojAqm7Vw+StJwrXqCfrCkTSUbKrlLWi75csk6JL0q6XmTlkbmS+XhCUX+hKzrz2rc70WKCyTT/wNg/R4EjK5AQAAAAABJRU5ErkJggg==",e){var n=e[t];switch(t){case"container":void 0===n?this.container=document.body:n instanceof HTMLElement?this.container=n:this.container=document.getElementById(n);break;case"textColor":this.textColor=n;break;case"backgroundColor":this.backgroundColor=n;break;case"imageURL":this.imageURL=n;break;case"imageRotationSpeed":this.imageRotationSpeed=n}}var r=["background-color: "+this.backgroundColor.getStyle()+";","position: absolute;","z-index: 1;","height: 100%;","width: 100%;"].join("\n"),i=["position: absolute;","top: 50%;","left: 50%;","margin-top: -75px;","margin-left: -75px;","width: 150px;","height: 150px;"].join("\n"),a=["width: 150px;","height: 150px;",'background-image: url("'+this.imageURL+'");',"background-repeat: no-repeat;","background-size: 150px;"].join("\n"),o=["color: "+this.textColor.getStyle()+";","text-align: center;","position: absolute;","top: 50%;","left: 50%;","margin-top: -18px;","margin-left: -43px;","min-width: 90px;","font-size: 30px;","font-family: sans-serif;","font-weight: bold;"].join("\n");this.text=document.createElement("div"),this.text.setAttribute("style",o),this.text.innerHTML="0%",this.gear=document.createElement("div"),this.gear.setAttribute("style",a),this.gearCont=document.createElement("div"),this.gearCont.setAttribute("style",i),this.background=document.createElement("div"),this.background.setAttribute("style",r),this.background.appendChild(this.gearCont),this.gearCont.appendChild(this.gear),this.gearCont.appendChild(this.text),this.container.appendChild(this.background),this.clock=new lh;var s=this,l=function(){0<s.imageRotationSpeed&&requestAnimationFrame(l);var e=s.clock.getElapsedTime()*s.imageRotationSpeed;s.gear.style.transform="rotate("+e+"deg)"};l()}tv.prototype=Object.assign(Object.create(Fi.prototype),{constructor:tv,isLineHTML:!0,onBeforeRender:(Zm=new Bt,Km=new Bt,Jm=new Ut,function(e,t,n,r,i,a){if(Fi.prototype.onBeforeRender.call(this),this.elemHTML){var o=e.domElement.offsetHeight,s=e.domElement.offsetWidth,l=this.elemHTML.getBoundingClientRect(),c=(l.left+l.right)/2,u=(l.top+l.bottom)/2,h=this.getWorldPosition(Zm).project(n),d=(h.x+1)/2*s,p=(1-h.y)/2*o,f=(u-p)/(c-d),m=(l.height+2*this.offset)/(l.width+2*this.offset);if(Math.abs(f)>m)var v=((g=u<p?Math.min(l.bottom+this.offset,p):Math.max(l.top-this.offset,p))-p)/f+d;else var g=((v=d<c?Math.max(l.left-this.offset,d):Math.min(l.right+this.offset,d))-d)*f+p;var y=2*v/s-1,x=1-2*g/o,_=Km.set(y,x,-1);_.unproject(n),this.parent&&this.parent.worldToLocal(_);var b=_.length();this.scale.setScalar(b),_.normalize();var w=Jm.setFromUnitVectors(ev,_);this.setRotationFromQuaternion(w),this.updateMatrixWorld()}})}),Object.assign(nv.prototype,{onUpdate:function(e){},onFinish:function(){}}),rv.prototype=Object.assign(Object.create(nv.prototype),{constructor:rv,onUpdate:function(e){e=Math.round(e),this.text.innerHTML=e+"%"},onFinish:function(){this.container.removeChild(this.background),this.imageRotationSpeed=0}});function iv(){}function av(e){Fi.call(this),this.type="CubeTextureHelper",this.geometry=new Qr(2,2,2,1,1,1),this.geometry.computeBoundingSphere(),this.material=new ti,this.material.envMap=e}function ov(e){hr.call(this),this.projected=new Bt,this.container=e,this.updatedCallback=null}function sv(e,t,n){ov.call(this,e),this.type="Annotation",this.character=t,this.text=n,this.annotation=document.createElement("div"),this.annotation.innerHTML=t,this.annotation.setAttribute("class","v3d-annotation"),this.container.appendChild(this.annotation),this.annotationTextVisible=!1,this.annotationText=document.createElement("div"),this.annotationText.innerHTML=n,this.annotationText.setAttribute("class","v3d-annotation-dialog"),this.annotation.appendChild(this.annotationText),this.fadeObscured=!0;var r=this.obscured=!1,i=this;function a(e){e.target==i.annotation?0==i.annotationText.innerHTML.length||i.obscured||(i.annotationTextVisible=!i.annotationTextVisible,i.annotationText.style.visibility=i.annotationTextVisible?"visible":"hidden",i.annotationTextVisible?i.annotation.style.zIndex="1":i.annotation.style.zIndex="auto"):"v3d-annotation"==e.target.getAttribute("class")&&(i.annotationTextVisible=!1,i.annotationText.style.visibility="hidden",i.annotation.style.zIndex="auto")}this._touchstartCb=function(e){a(e),r=!0},document.body.addEventListener("touchstart",this._touchstartCb,!1),this._mousedownCb=function(e){r||a(e),r=!1},document.body.addEventListener("mousedown",this._mousedownCb,!1)}Object.assign(iv.prototype,{_logicFileLoadError:function(e){var t=new Error(e);return t.name="LogicFileLoadError",t},_editorLoadError:function(e){var t=new Error(e);return t.name="EditorLoadError",t},_getLogicPromise:function(n){var r=this;return new Promise(function(e,t){Rf.loadScript(n,document.body,function(){e()},function(){t(r._logicFileLoadError("Unable to load the logic file: '"+n+"'."))})})},_getEditorPromise:function(n,e){var r=this;return new Promise(function(e,t){Rf.loadScript(n,document.body,function(){e()},function(){t(r._editorLoadError("Unable to load the Puzzles Editor: '"+n+"'."))})})},_getLogicViaEditorPromise:function(i,a){var o=this;return new Promise(function(t,n){if(v3d.PE){var e=a.split(".");e[e.length-1]="xml";var r=e.join(".");v3d.PE.init(i,r,function(e){e?t():n(o._logicFileLoadError("Unable to load the Puzzles Editor's XML logic file: '"+r+"'."))})}else n(o._editorLoadError("Unable to load Puzzles' logic. The Puzzles Editor isn't loaded."))})},loadLogic:function(e,t,n){this._getLogicPromise(e).then(function(){t&&t()},function(e){console.error(e),n&&n(e)})},loadEditorWithLogic:function(e,t,n,r){var i=this;i._getEditorPromise(e+"puzzles.min.js").then(function(){return i._getLogicViaEditorPromise(e,t)}).then(function(){n&&n()}).catch(function(e){console.error(e),r&&r(e)})}}),(av.prototype=Object.create(Fi.prototype)).constructor=av,ov.prototype=Object.assign(Object.create(hr.prototype),{constructor:ov,isAnnotationControl:!0,clone:function(){return new this.constructor(this.container).copy(this)},update:function(e){var t=this.projected;this.getWorldPosition(t).project(e);var n=this.container.offsetWidth,r=this.container.offsetHeight,i=(.5+t.x/2)*n,a=(.5-t.y/2)*r;t.x=i,t.y=a;var o=t.z<=1&&0<=i&&i<=n&&0<=a&&a<=r;this.visible=o,this.updatedCallback&&this.updatedCallback(t.x,t.y,o)}}),sv.prototype=Object.assign(Object.create(ov.prototype),{constructor:sv,isAnnotation:!0,raycast:function(){},clone:function(){return new this.constructor(this.container,this.character,this.text).copy(this)},update:function(){var i=new Uo;i.params.Mesh.omitGeometry=!0;var a=new Bt,o=new Bt,s=new Bt;return function(e){ov.prototype.update.call(this,e);var t=this.projected,n=this.annotation;if(n.style.transform="translate("+t.x+"px, "+t.y+"px)",n.style.visibility=this.visible?"visible":"hidden",this.annotationText.style.visibility=this.visible&&this.annotationTextVisible?"visible":"hidden",this.fadeObscured){e.getWorldPositionNU(a),this.getWorldPositionNU(o),s.copy(o).sub(a).normalize(),i.set(a,s),i.far=a.distanceTo(o);var r=i.intersectObject(this.findRoot(),!0);1<r.length||1==r.length&&r[0].object!=this.parent?(n.style.opacity=.25,this.obscured=!0,this.annotationText.style.visibility="hidden"):(n.style.opacity=1,this.obscured=!1)}}}(),dispose:function(){var e=this.annotation.parentElement;e&&e.removeChild(this.annotation),document.body.removeEventListener("touchstart",this._touchstartCb,!1),document.body.removeEventListener("mousedown",this._mousedownCb,!1)}});window.THREE=v3d;var lv=document.createElement("style");lv.appendChild(document.createTextNode(".v3d-container {\n \n overflow: hidden;\n}\n.v3d-canvas {\n \n position: absolute;\n}\n.v3d-annotation {\n position: absolute;\n top: -26px;\n left: -26px;\n width: auto;\n min-width: 14px;\n height: 26px;\n padding: 2px 8px;\n border: 1px solid #fff;\n border-radius: 18px;\n font-size: 16px;\n font-family: sans-serif;\n line-height: 26px;\n color: #fff;\n text-align: center;\n user-select: none;\n background: rgba(0, 0, 0, 0.8);\n}\n.v3d-annotation-dialog {\n position: absolute;\n top: 0;\n left: 0;\n margin-left: 25px;\n margin-top: 25px;\n font-family: sans-serif;\n user-select: none;\n padding: 1em;\n min-width: 200px;\n color: #fff;\n background: rgba(0, 0, 0, 0.8);\n border-radius: .5em;\n font-size: 12px;\n line-height: 1.2;\n transition: opacity .5s;\n visibility: hidden;\n}\n.v3d-webgl-error {\n background-color: white;\n position: absolute;\n width: 50%;\n left: 25%;\n text-align: center;\n border-style: solid;\n border-width: 3px;\n border-radius: 8px;\n border-color: black;\n top: 5%;\n font-size: 20px;\n font-family: sans-serif;\n padding: 10px;\n line-height: 30px;\n z-index: 10;\n}\n")),document.head.insertBefore(lv,document.head.firstChild),e.WebGLMultisampleRenderTarget=gn,e.WebGLRenderTargetCube=yn,e.WebGLRenderTarget=vn,e.WebGLRenderer=ko,e.ShaderLib=Un,e.UniformsLib=Dn,e.UniformsUtils=Rn,e.ShaderChunk=Tn,e.FogExp2=Vo,e.Fog=jo,e.Scene=Wo,e.Sprite=qo,e.LOD=Qo,e.SkinnedMesh=Zo,e.Skeleton=Ko,e.Bone=Jo,e.Mesh=Fi,e.LineSegments=ts,e.LineLoop=ns,e.Line=es,e.Points=is,e.Group=po,e.VideoTexture=as,e.DataTexture=xn,e.DataTexture2DArray=Xi,e.DataTexture3D=Hi,e.CompressedTexture=os,e.CubeTexture=Wi,e.CanvasTexture=ss,e.DepthTexture=ls,e.Texture=fn,e.AnimationLoader=Fc,e.CompressedTextureLoader=Ic,e.DataTextureLoader=Oc,e.CubeTextureLoader=Dc,e.TextureLoader=Uc,e.ObjectLoader=Mu,e.MaterialLoader=_u,e.BufferGeometryLoader=wu,e.DefaultLoadingManager=Ec,e.LoadingManager=Cc,e.ImageLoader=Nc,e.ImageBitmapLoader=Iu,e.FontLoader=Uu,e.FileLoader=Rc,e.Loader=Bu,e.LoaderUtils=bu,e.Cache=Lc,e.AudioLoader=ah,e.SpotLightShadow=pu,e.SpotLight=fu,e.PointLight=mu,e.RectAreaLight=xu,e.HemisphereLight=hu,e.DirectionalLightShadow=vu,e.DirectionalLight=gu,e.AmbientLight=yu,e.LightShadow=du,e.Light=uu,e.StereoCamera=oh,e.PerspectiveCamera=fo,e.OrthographicCamera=pr,e.CubeCamera=sh,e.ArrayCamera=mo,e.Camera=dr,e.AudioListener=ch,e.PositionalAudio=hh,e.AudioContext=ih,e.AudioAnalyser=dh,e.Audio=uh,e.VectorKeyframeTrack=Mc,e.StringKeyframeTrack=Ac,e.QuaternionKeyframeTrack=wc,e.NumberKeyframeTrack=_c,e.ColorKeyframeTrack=xc,e.BooleanKeyframeTrack=yc,e.PropertyMixer=ph,e.PropertyBinding=Qh,e.KeyframeTrack=gc,e.AnimationUtils=fc,e.AnimationObjectGroup=Zh,e.AnimationMixer=Jh,e.AnimationClip=Tc,e.Uniform=$h,e.InstancedBufferGeometry=ed,e.BufferGeometry=qr,e.Geometry=Ar,e.InterleavedBufferAttribute=Ho,e.InstancedInterleavedBuffer=td,e.InterleavedBuffer=Xo,e.InstancedBufferAttribute=nd,e.Face3=fr,e.Object3D=hr,e.Raycaster=Uo,e.Layers=kn,e.EventDispatcher=t,e.Clock=lh,e.QuaternionLinearInterpolant=bc,e.LinearInterpolant=kl,e.DiscreteInterpolant=vc,e.CubicInterpolant=mc,e.Interpolant=Gl,e.Triangle=Ri,e.Math=Nt,e.Spherical=ql,e.Cylindrical=rd,e.Plane=wn,e.Frustum=An,e.Sphere=bn,e.Ray=Pi,e.Matrix4=Mn,e.Matrix3=zt,e.Box3=_n,e.Box2=id,e.Line3=ad,e.Euler=Gn,e.Vector4=mn,e.Vector3=Bt,e.Vector2=Dt,e.Quaternion=Ut,e.Color=In,e.ImmediateRenderObject=od,e.VertexNormalsHelper=sd,e.SpotLightHelper=ld,e.SkeletonHelper=cd,e.PointLightHelper=ud,e.RectAreaLightHelper=hd,e.HemisphereLightHelper=dd,e.GridHelper=pd,e.PolarGridHelper=fd,e.PositionalAudioHelper=md,e.FaceNormalsHelper=vd,e.DirectionalLightHelper=gd,e.CameraHelper=yd,e.BoxHelper=xd,e.Box3Helper=_d,e.PlaneHelper=bd,e.ArrowHelper=wd,e.AxesHelper=Ad,e.Shape=cu,e.Path=lu,e.ShapePath=Ou,e.Font=Nu,e.CurvePath=su,e.Curve=Bc,e.ImageUtils=dn,e.ShapeUtils=Qs,e.WebGLUtils=ho,e.MaterialUtils=op,e.FirstPersonControls=bp,e.FlyingControls=wp,e.OrbitControls=Ap,e.Keys=xp,e.EquiCube=Mp,e.PMREMCubeUVPacker=Tp,e.PMREMGenerator=Sp,e.GraphUtils=Fl,e.Detector=Do,e.XZ=Lf,e.App=Xm,e.AppPuzzles=Qm,e.AppUtils=Rf,e.CSVParser=$m,e.LineHTML=tv,e.MeshLine=qf,e.MeshLineIndexed=Jf,e.MeshLineMaterial=$f,e.Preloader=nv,e.SimplePreloader=rv,e.PuzzlesLoader=iv,e.SceneUtils=Gm,e.CubeTextureHelper=av,e.Annotation=sv,e.AnnotationControl=ov,e.BloomPass=Of,e.BokehPass=Uf,e.BrightnessContrastPass=Df,e.EffectComposer=Gf,e.FXAAPass=kf,e.GrayscalePass=Om,e.MaskPass=Bf,e.ClearMaskPass=zf,e.OutlinePass=Nm,e.Pass=Ff,e.RenderPass=Dm,e.ShaderPass=Nf,e.SSAARenderPass=Vm,e.SSAOPass=km,e.ToneMapPass=jm,e.RenderUtils=Bm,e.WebVRUtils=yo,e.SceneBackground=zm,e.BlenderCubeTextureLoader=jf,e.GLTFLoader=tm,e.RGBELoader=Hf,e.XZLoader=Xf,e.WireframeGeometry=cs,e.ParametricGeometry=us,e.ParametricBufferGeometry=hs,e.TetrahedronGeometry=fs,e.TetrahedronBufferGeometry=ms,e.OctahedronGeometry=vs,e.OctahedronBufferGeometry=gs,e.IcosahedronGeometry=ys,e.IcosahedronBufferGeometry=xs,e.DodecahedronGeometry=_s,e.DodecahedronBufferGeometry=bs,e.PolyhedronGeometry=ds,e.PolyhedronBufferGeometry=ps,e.TubeGeometry=ws,e.TubeBufferGeometry=As,e.TorusKnotGeometry=Ms,e.TorusKnotBufferGeometry=Ts,e.TorusGeometry=Ss,e.TorusBufferGeometry=Ls,e.TextGeometry=nl,e.TextBufferGeometry=rl,e.SphereGeometry=il,e.SphereBufferGeometry=al,e.RingGeometry=ol,e.RingBufferGeometry=sl,e.PlaneGeometry=Kr,e.PlaneBufferGeometry=Jr,e.LatheGeometry=ll,e.LatheBufferGeometry=cl,e.ShapeGeometry=ul,e.ShapeBufferGeometry=hl,e.ExtrudeGeometry=Js,e.ExtrudeBufferGeometry=$s,e.EdgesGeometry=pl,e.ConeGeometry=vl,e.ConeBufferGeometry=gl,e.CylinderGeometry=fl,e.CylinderBufferGeometry=ml,e.CircleGeometry=yl,e.CircleBufferGeometry=xl,e.BoxGeometry=Qr,e.BoxBufferGeometry=Zr,e.ShadowMaterial=bl,e.SpriteMaterial=Yo,e.RawShaderMaterial=wl,e.ShaderMaterial=Ei,e.PointsMaterial=rs,e.MeshPhysicalMaterial=Ml,e.MeshStandardMaterial=Al,e.MeshPhongMaterial=Tl,e.MeshToonMaterial=Sl,e.MeshNormalMaterial=Ll,e.MeshLambertMaterial=Cl,e.MeshDepthMaterial=oo,e.MeshDistanceMaterial=so,e.MeshBasicMaterial=ti,e.MeshMatcapMaterial=El,e.LineDashedMaterial=Pl,e.LineBasicMaterial=$o,e.Material=ei,e.MeshMaskMaterial=Rl,e.MeshNodeMaterial=hc,e.Float64BufferAttribute=Ir,e.Float32BufferAttribute=Fr,e.Uint32BufferAttribute=Rr,e.Int32BufferAttribute=Pr,e.Uint16BufferAttribute=Er,e.Int16BufferAttribute=Cr,e.Uint8ClampedBufferAttribute=Lr,e.Uint8BufferAttribute=Sr,e.Int8BufferAttribute=Tr,e.BufferAttribute=Mr,e.ArcCurve=Gc,e.CatmullRomCurve3=Hc,e.CubicBezierCurve=Zc,e.CubicBezierCurve3=Kc,e.EllipseCurve=zc,e.LineCurve=Jc,e.LineCurve3=$c,e.QuadraticBezierCurve=eu,e.QuadraticBezierCurve3=tu,e.SplineCurve=nu,e.REVISION=_e,e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=H,e.CullFaceBack=Y,e.CullFaceFront=q,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=k,e.PCFSoftShadowMap=V,e.FrontSide=N,e.BackSide=be,e.DoubleSide=Q,e.FlatShading=1,e.SmoothShading=2,e.NoColors=d,e.FaceColors=1,e.VertexColors=x,e.NoBlending=Z,e.NormalBlending=K,e.AdditiveBlending=J,e.SubtractiveBlending=$,e.MultiplyBlending=ee,e.CustomBlending=te,e.AddEquation=ne,e.SubtractEquation=p,e.ReverseSubtractEquation=f,e.MinEquation=m,e.MaxEquation=v,e.ZeroFactor=g,e.OneFactor=y,e.SrcColorFactor=_,e.OneMinusSrcColorFactor=b,e.SrcAlphaFactor=w,e.OneMinusSrcAlphaFactor=A,e.DstAlphaFactor=M,e.OneMinusDstAlphaFactor=T,e.DstColorFactor=S,e.OneMinusDstColorFactor=L,e.SrcAlphaSaturateFactor=C,e.NeverDepth=re,e.AlwaysDepth=ie,e.LessDepth=ae,e.LessEqualDepth=oe,e.EqualDepth=se,e.GreaterEqualDepth=le,e.GreaterDepth=ce,e.NotEqualDepth=ue,e.MultiplyOperation=j,e.MixOperation=W,e.AddOperation=X,e.NoToneMapping=he,e.LinearToneMapping=we,e.ReinhardToneMapping=de,e.Uncharted2ToneMapping=pe,e.CineonToneMapping=fe,e.ACESFilmicToneMapping=me,e.UVMapping=300,e.CubeReflectionMapping=ve,e.CubeRefractionMapping=ge,e.EquirectangularReflectionMapping=ye,e.EquirectangularRefractionMapping=xe,e.SphericalReflectionMapping=Ae,e.CubeUVReflectionMapping=Me,e.CubeUVRefractionMapping=Te,e.RepeatWrapping=E,e.ClampToEdgeWrapping=I,e.MirroredRepeatWrapping=P,e.NearestFilter=D,e.NearestMipMapNearestFilter=O,e.NearestMipMapLinearFilter=U,e.LinearFilter=B,e.LinearMipMapNearestFilter=R,e.LinearMipMapLinearFilter=F,e.UnsignedByteType=Ue,e.ByteType=z,e.ShortType=G,e.UnsignedShortType=Se,e.IntType=Le,e.UnsignedIntType=Ce,e.FloatType=Be,e.HalfFloatType=Ee,e.UnsignedShort4444Type=Pe,e.UnsignedShort5551Type=Re,e.UnsignedShort565Type=Fe,e.UnsignedInt248Type=Ie,e.AlphaFormat=Oe,e.RGBFormat=ze,e.RGBAFormat=Ge,e.LuminanceFormat=Ne,e.LuminanceAlphaFormat=De,e.RGBEFormat=ke,e.DepthFormat=Ve,e.DepthStencilFormat=je,e.RedFormat=We,e.RGB_S3TC_DXT1_Format=Xe,e.RGBA_S3TC_DXT1_Format=He,e.RGBA_S3TC_DXT3_Format=Ye,e.RGBA_S3TC_DXT5_Format=qe,e.RGB_PVRTC_4BPPV1_Format=Qe,e.RGB_PVRTC_2BPPV1_Format=Ze,e.RGBA_PVRTC_4BPPV1_Format=Ke,e.RGBA_PVRTC_2BPPV1_Format=Je,e.RGB_ETC1_Format=$e,e.RGBA_ASTC_4x4_Format=et,e.RGBA_ASTC_5x4_Format=tt,e.RGBA_ASTC_5x5_Format=nt,e.RGBA_ASTC_6x5_Format=rt,e.RGBA_ASTC_6x6_Format=it,e.RGBA_ASTC_8x5_Format=at,e.RGBA_ASTC_8x6_Format=ot,e.RGBA_ASTC_8x8_Format=st,e.RGBA_ASTC_10x5_Format=lt,e.RGBA_ASTC_10x6_Format=ct,e.RGBA_ASTC_10x8_Format=ut,e.RGBA_ASTC_10x10_Format=ht,e.RGBA_ASTC_12x10_Format=dt,e.RGBA_ASTC_12x12_Format=pt,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=ft,e.InterpolateLinear=mt,e.InterpolateSmooth=vt,e.ZeroCurvatureEnding=gt,e.ZeroSlopeEnding=yt,e.WrapAroundEnding=xt,e.TrianglesDrawMode=_t,e.TriangleStripDrawMode=1,e.TriangleFanDrawMode=2,e.LinearEncoding=bt,e.sRGBEncoding=wt,e.GammaEncoding=At,e.RGBEEncoding=Mt,e.LogLuvEncoding=3003,e.RGBM7Encoding=Tt,e.RGBM16Encoding=St,e.RGBDEncoding=Lt,e.BasicDepthPacking=Ct,e.RGBADepthPacking=Et,e.TangentSpaceNormalMap=Pt,e.ObjectSpaceNormalMap=Rt,e.V3DL=Ft,e.LogarithmicMaxToneMapping=It,e.ViewportFitNone=Ot,e.ViewportFitVertical=1,e.ViewportFitHorizontal=2,e.ViewportFitAuto=3,e.CubeGeometry=Qr,e.Face4=function(e,t,n,r,i,a,o){return console.warn("v3d.Face4 has been removed. A v3d.Face3 will be created instead."),new fr(e,t,n,i,a,o)},e.LineStrip=0,e.LinePieces=1,e.MeshFaceMaterial=function(e){return console.warn("v3d.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MultiMaterial=function(e){return void 0===e&&(e=[]),console.warn("v3d.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,(e.materials=e).clone=function(){return e.slice()},e},e.PointCloud=function(e,t){return console.warn("v3d.PointCloud has been renamed to v3d.Points."),new is(e,t)},e.Particle=function(e){return console.warn("v3d.Particle has been renamed to v3d.Sprite."),new qo(e)},e.ParticleSystem=function(e,t){return console.warn("v3d.ParticleSystem has been renamed to v3d.Points."),new is(e,t)},e.PointCloudMaterial=function(e){return console.warn("v3d.PointCloudMaterial has been renamed to v3d.PointsMaterial."),new rs(e)},e.ParticleBasicMaterial=function(e){return console.warn("v3d.ParticleBasicMaterial has been renamed to v3d.PointsMaterial."),new rs(e)},e.ParticleSystemMaterial=function(e){return console.warn("v3d.ParticleSystemMaterial has been renamed to v3d.PointsMaterial."),new rs(e)},e.Vertex=function(e,t,n){return console.warn("v3d.Vertex has been removed. Use v3d.Vector3 instead."),new Bt(e,t,n)},e.DynamicBufferAttribute=function(e,t){return console.warn("v3d.DynamicBufferAttribute has been removed. Use new v3d.BufferAttribute().setDynamic(true) instead."),new Mr(e,t).setDynamic(!0)},e.Int8Attribute=function(e,t){return console.warn("v3d.Int8Attribute has been removed. Use new v3d.Int8BufferAttribute() instead."),new Tr(e,t)},e.Uint8Attribute=function(e,t){return console.warn("v3d.Uint8Attribute has been removed. Use new v3d.Uint8BufferAttribute() instead."),new Sr(e,t)},e.Uint8ClampedAttribute=function(e,t){return console.warn("v3d.Uint8ClampedAttribute has been removed. Use new v3d.Uint8ClampedBufferAttribute() instead."),new Lr(e,t)},e.Int16Attribute=function(e,t){return console.warn("v3d.Int16Attribute has been removed. Use new v3d.Int16BufferAttribute() instead."),new Cr(e,t)},e.Uint16Attribute=function(e,t){return console.warn("v3d.Uint16Attribute has been removed. Use new v3d.Uint16BufferAttribute() instead."),new Er(e,t)},e.Int32Attribute=function(e,t){return console.warn("v3d.Int32Attribute has been removed. Use new v3d.Int32BufferAttribute() instead."),new Pr(e,t)},e.Uint32Attribute=function(e,t){return console.warn("v3d.Uint32Attribute has been removed. Use new v3d.Uint32BufferAttribute() instead."),new Rr(e,t)},e.Float32Attribute=function(e,t){return console.warn("v3d.Float32Attribute has been removed. Use new v3d.Float32BufferAttribute() instead."),new Fr(e,t)},e.Float64Attribute=function(e,t){return console.warn("v3d.Float64Attribute has been removed. Use new v3d.Float64BufferAttribute() instead."),new Ir(e,t)},e.ClosedSplineCurve3=Td,e.SplineCurve3=Sd,e.Spline=Ld,e.AxisHelper=function(e){return console.warn("v3d.AxisHelper has been renamed to v3d.AxesHelper."),new Ad(e)},e.BoundingBoxHelper=function(e,t){return console.warn("v3d.BoundingBoxHelper has been deprecated. Creating a v3d.BoxHelper instead."),new xd(e,t)},e.EdgesHelper=function(e,t){return console.warn("v3d.EdgesHelper has been removed. Use v3d.EdgesGeometry instead."),new ts(new pl(e.geometry),new $o({color:void 0!==t?t:16777215}))},e.WireframeHelper=function(e,t){return console.warn("v3d.WireframeHelper has been removed. Use v3d.WireframeGeometry instead."),new ts(new cs(e.geometry),new $o({color:void 0!==t?t:16777215}))},e.XHRLoader=function(e){return console.warn("v3d.XHRLoader has been renamed to v3d.FileLoader."),new Rc(e)},e.BinaryTextureLoader=function(e){return console.warn("v3d.BinaryTextureLoader has been renamed to v3d.DataTextureLoader."),new Oc(e)},e.GeometryUtils=Cd,e.Projector=function(){console.error("v3d.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("v3d.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("v3d.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("v3d.Projector: .pickingRay() is now raycaster.setFromCamera().")}},e.CanvasRenderer=function(){console.error("v3d.CanvasRenderer has been removed")},e.JSONLoader=function(){console.error("v3d.JSONLoader has been removed.")},e.LensFlare=function(){console.error("v3d.LensFlare has been moved to /examples/js/objects/Lensflare.js")},e.ChildOfConstraint=cp,e.Constraint=sp,e.CopyLocationConstraint=up,e.CopyRotationConstraint=hp,e.CopyScaleConstraint=dp,e.FloorConstraint=pp,e.LimitLocationConstraint=fp,e.LimitRotationConstraint=mp,e.LimitScaleConstraint=vp,e.LockedTrackConstraint=gp,e.TargetConstraint=lp,e.TrackToConstraint=yp,Object.defineProperty(e,"__esModule",{value:!0})});