@netless/slide 1.1.9-beta.2 → 1.1.9-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Slide.js CHANGED
@@ -165,7 +165,7 @@ function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.p
165
165
  * @license
166
166
  * Copyright 2010-2021 Three.js Authors
167
167
  * SPDX-License-Identifier: MIT
168
- */class s{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const a=[];for(let t=0;t<256;t++)a[t]=(t<16?"0":"")+t.toString(16);const l=Math.PI/180,h=180/Math.PI;function u(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(a[255&t]+a[t>>8&255]+a[t>>16&255]+a[t>>24&255]+"-"+a[255&e]+a[e>>8&255]+"-"+a[e>>16&15|64]+a[e>>24&255]+"-"+a[63&i|128]+a[i>>8&255]+"-"+a[i>>16&255]+a[i>>24&255]+a[255&n]+a[n>>8&255]+a[n>>16&255]+a[n>>24&255]).toUpperCase()}function c(t,e,i){return Math.max(e,Math.min(i,t))}function d(t,e){return(t%e+e)%e}function p(t,e,i){return(1-i)*t+i*e}function f(t){return 0==(t&t-1)&&0!==t}function m(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class g{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}g.prototype.isVector2=!0;class v{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,o,s,a,l){const h=this.elements;return h[0]=t,h[1]=n,h[2]=s,h[3]=e,h[4]=r,h[5]=a,h[6]=i,h[7]=o,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,o=i[0],s=i[3],a=i[6],l=i[1],h=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],_=n[4],y=n[7],x=n[2],b=n[5],T=n[8];return r[0]=o*f+s*v+a*x,r[3]=o*m+s*_+a*b,r[6]=o*g+s*y+a*T,r[1]=l*f+h*v+u*x,r[4]=l*m+h*_+u*b,r[7]=l*g+h*y+u*T,r[2]=c*f+d*v+p*x,r[5]=c*m+d*_+p*b,r[8]=c*g+d*y+p*T,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],h=t[8];return e*o*h-e*s*l-i*r*h+i*s*a+n*r*l-n*o*a}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],h=t[8],u=h*o-s*l,c=s*a-h*r,d=l*r-o*a,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*l-h*i)*f,t[2]=(s*i-n*o)*f,t[3]=c*f,t[4]=(h*e-n*a)*f,t[5]=(n*r-s*e)*f,t[6]=d*f,t[7]=(i*a-l*e)*f,t[8]=(o*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,o,s){const a=Math.cos(r),l=Math.sin(r);return this.set(i*a,i*l,-i*(a*o+l*s)+o+t,-n*l,n*a,-n*(-l*o+a*s)+s+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],o=n[3],s=n[6],a=n[1],l=n[4],h=n[7];return n[0]=e*r+i*a,n[3]=e*o+i*l,n[6]=e*s+i*h,n[1]=-i*r+e*a,n[4]=-i*o+e*l,n[7]=-i*s+e*h,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let _;v.prototype.isMatrix3=!0;class y{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===_&&(_=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),_.width=t.width,_.height=t.height;const i=_.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=_}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let x=0;class b extends s{constructor(t=b.DEFAULT_IMAGE,e=b.DEFAULT_MAPPING,i=1001,n=1001,r=1006,o=1008,s=1023,a=1009,l=1,h=3e3){super(),Object.defineProperty(this,"id",{value:x++}),this.uuid=u(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=a,this.offset=new g(0,0),this.repeat=new g(1,1),this.center=new g(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new v,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={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){const n=this.image;if(void 0===n.uuid&&(n.uuid=u()),!e&&void 0===t.images[n.uuid]){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(T(n[t].image)):e.push(T(n[t]))}else e=T(n);t.images[n.uuid]={uuid:n.uuid,url:e}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function T(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?y.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}b.DEFAULT_IMAGE=void 0,b.DEFAULT_MAPPING=300,b.prototype.isTexture=!0;class E{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*i+o[8]*n+o[12]*r,this.y=o[1]*e+o[5]*i+o[9]*n+o[13]*r,this.z=o[2]*e+o[6]*i+o[10]*n+o[14]*r,this.w=o[3]*e+o[7]*i+o[11]*n+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const o=t.elements,s=o[0],a=o[4],l=o[8],h=o[1],u=o[5],c=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(a-h)<.01&&Math.abs(l-d)<.01&&Math.abs(c-p)<.01){if(Math.abs(a+h)<.1&&Math.abs(l+d)<.1&&Math.abs(c+p)<.1&&Math.abs(s+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,o=(u+1)/2,m=(f+1)/2,g=(a+h)/4,v=(l+d)/4,_=(c+p)/4;return t>o&&t>m?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=g/i,r=v/i):o>m?o<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(o),i=g/n,r=_/n):m<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(m),i=v/r,n=_/r),this.set(i,n,r,e),this}let m=Math.sqrt((p-c)*(p-c)+(l-d)*(l-d)+(h-a)*(h-a));return Math.abs(m)<.001&&(m=1),this.x=(p-c)/m,this.y=(l-d)/m,this.z=(h-a)/m,this.w=Math.acos((s+u+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}E.prototype.isVector4=!0;class S extends s{constructor(t,e,i={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new E(0,0,t,e),this.scissorTest=!1,this.viewport=new E(0,0,t,e),this.texture=new b(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}S.prototype.isWebGLRenderTarget=!0;(class extends S{constructor(t,e,i){super(t,e);const n=this.texture;this.texture=[];for(let t=0;t<i;t++)this.texture[t]=n.clone()}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,r=this.texture.length;n<r;n++)this.texture[n].image.width=t,this.texture[n].image.height=e,this.texture[n].image.depth=i;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,i=t.texture.length;e<i;e++)this.texture[e]=t.texture[e].clone();return this}}).prototype.isWebGLMultipleRenderTargets=!0;class w extends S{constructor(t,e,i){super(t,e,i),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}w.prototype.isWebGLMultisampleRenderTarget=!0;class A{constructor(t=0,e=0,i=0,n=1){this._x=t,this._y=e,this._z=i,this._w=n}static slerp(t,e,i,n){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(t,e,n)}static slerpFlat(t,e,i,n,r,o,s){let a=i[n+0],l=i[n+1],h=i[n+2],u=i[n+3];const c=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(0===s)return t[e+0]=a,t[e+1]=l,t[e+2]=h,void(t[e+3]=u);if(1===s)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||a!==c||l!==d||h!==p){let t=1-s;const e=a*c+l*d+h*p+u*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),o=Math.atan2(r,e*i);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*i;if(a=a*t+c*r,l=l*t+d*r,h=h*t+p*r,u=u*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+l*l+h*h+u*u);a*=t,l*=t,h*=t,u*=t}}t[e]=a,t[e+1]=l,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,n,r,o){const s=i[n],a=i[n+1],l=i[n+2],h=i[n+3],u=r[o],c=r[o+1],d=r[o+2],p=r[o+3];return t[e]=s*p+h*u+a*d-l*c,t[e+1]=a*p+h*c+l*u-s*d,t[e+2]=l*p+h*d+s*c-a*u,t[e+3]=h*p-s*u-a*c-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,l=s(i/2),h=s(n/2),u=s(r/2),c=a(i/2),d=a(n/2),p=a(r/2);switch(o){case"XYZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"YXZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"ZXY":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"ZYX":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"YZX":this._x=c*h*u+l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u-c*d*p;break;case"XZY":this._x=c*h*u-l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],o=e[1],s=e[5],a=e[9],l=e[2],h=e[6],u=e[10],c=i+s+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(h-a)*t,this._y=(r-l)*t,this._z=(o-n)*t}else if(i>s&&i>u){const t=2*Math.sqrt(1+i-s-u);this._w=(h-a)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(r+l)/t}else if(s>u){const t=2*Math.sqrt(1+s-i-u);this._w=(r-l)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(a+h)/t}else{const t=2*Math.sqrt(1+u-i-s);this._w=(o-n)/t,this._x=(r+l)/t,this._y=(a+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(c(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,o=t._w,s=e._x,a=e._y,l=e._z,h=e._w;return this._x=i*h+o*s+n*l-r*a,this._y=n*h+o*a+r*s-i*l,this._z=r*h+o*l+i*a-n*s,this._w=o*h-i*s-n*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,o=this._w;let s=o*t._w+i*t._x+n*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),h=Math.atan2(l,s),u=Math.sin((1-e)*h)/l,c=Math.sin(e*h)/l;return this._w=o*u+this._w*c,this._x=i*u+this._x*c,this._y=n*u+this._y*c,this._z=r*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,i){this.copy(t).slerp(e,i)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}A.prototype.isQuaternion=!0;class M{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(R.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(R.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,s=t.z,a=t.w,l=a*e+o*n-s*i,h=a*i+s*e-r*n,u=a*n+r*i-o*e,c=-r*e-o*i-s*n;return this.x=l*a+c*-r+h*-s-u*-o,this.y=h*a+c*-o+u*-r-l*-s,this.z=u*a+c*-s+l*-o-h*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-r*s,this.y=r*o-i*a,this.z=i*s-n*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return C.copy(this).projectOnVector(t),this.sub(C)}reflect(t){return this.sub(C.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(c(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}M.prototype.isVector3=!0;const C=new M,R=new A;class I{constructor(t=new M(1/0,1/0,1/0),e=new M(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.length;a<l;a+=3){const l=t[a],h=t[a+1],u=t[a+2];l<e&&(e=l),h<i&&(i=h),u<n&&(n=u),l>r&&(r=l),h>o&&(o=h),u>s&&(s=u)}return this.min.set(e,i,n),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.count;a<l;a++){const l=t.getX(a),h=t.getY(a),u=t.getZ(a);l<e&&(e=l),h<i&&(i=h),u<n&&(n=u),l>r&&(r=l),h>o&&(o=h),u>s&&(s=u)}return this.min.set(e,i,n),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=O.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),N.copy(e.boundingBox),N.applyMatrix4(t.matrixWorld),this.union(N));const i=t.children;for(let t=0,e=i.length;t<e;t++)this.expandByObject(i[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,O),O.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(G),H.subVectors(this.max,G),L.subVectors(t.a,G),D.subVectors(t.b,G),F.subVectors(t.c,G),B.subVectors(D,L),U.subVectors(F,D),k.subVectors(L,F);let e=[0,-B.z,B.y,0,-U.z,U.y,0,-k.z,k.y,B.z,0,-B.x,U.z,0,-U.x,k.z,0,-k.x,-B.y,B.x,0,-U.y,U.x,0,-k.y,k.x,0];return!!V(e,L,D,F,H)&&(e=[1,0,0,0,1,0,0,0,1],!!V(e,L,D,F,H)&&(j.crossVectors(B,U),e=[j.x,j.y,j.z],V(e,L,D,F,H)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return O.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(O).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(P[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),P[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),P[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),P[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),P[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),P[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),P[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),P[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(P)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}I.prototype.isBox3=!0;const P=[new M,new M,new M,new M,new M,new M,new M,new M],O=new M,N=new I,L=new M,D=new M,F=new M,B=new M,U=new M,k=new M,G=new M,H=new M,j=new M,z=new M;function V(t,e,i,n,r){for(let o=0,s=t.length-3;o<=s;o+=3){z.fromArray(t,o);const s=r.x*Math.abs(z.x)+r.y*Math.abs(z.y)+r.z*Math.abs(z.z),a=e.dot(z),l=i.dot(z),h=n.dot(z);if(Math.max(-Math.max(a,l,h),Math.min(a,l,h))>s)return!1}return!0}const X=new I,W=new M,Y=new M,q=new M;class Z{constructor(t=new M,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):X.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){q.subVectors(t,this.center);const e=q.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.add(q.multiplyScalar(i/t)),this.radius+=i}return this}union(t){return Y.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(W.copy(t.center).add(Y)),this.expandByPoint(W.copy(t.center).sub(Y)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const J=new M,K=new M,Q=new M,$=new M,tt=new M,et=new M,it=new M;class nt{constructor(t=new M,e=new M(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,J)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=J.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(J.copy(this.direction).multiplyScalar(e).add(this.origin),J.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){K.copy(t).add(e).multiplyScalar(.5),Q.copy(e).sub(t).normalize(),$.copy(this.origin).sub(K);const r=.5*t.distanceTo(e),o=-this.direction.dot(Q),s=$.dot(this.direction),a=-$.dot(Q),l=$.lengthSq(),h=Math.abs(1-o*o);let u,c,d,p;if(h>0)if(u=o*a-s,c=o*s-a,p=r*h,u>=0)if(c>=-p)if(c<=p){const t=1/h;u*=t,c*=t,d=u*(u+o*c+2*s)+c*(o*u+c+2*a)+l}else c=r,u=Math.max(0,-(o*c+s)),d=-u*u+c*(c+2*a)+l;else c=-r,u=Math.max(0,-(o*c+s)),d=-u*u+c*(c+2*a)+l;else c<=-p?(u=Math.max(0,-(-o*r+s)),c=u>0?-r:Math.min(Math.max(-r,-a),r),d=-u*u+c*(c+2*a)+l):c<=p?(u=0,c=Math.min(Math.max(-r,-a),r),d=c*(c+2*a)+l):(u=Math.max(0,-(o*r+s)),c=u>0?r:Math.min(Math.max(-r,-a),r),d=-u*u+c*(c+2*a)+l);else c=o>0?-r:r,u=Math.max(0,-(o*c+s)),d=-u*u+c*(c+2*a)+l;return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),n&&n.copy(Q).multiplyScalar(c).add(K),d}intersectSphere(t,e){J.subVectors(t.center,this.origin);const i=J.dot(this.direction),n=J.dot(J)-i*i,r=t.radius*t.radius;if(n>r)return null;const o=Math.sqrt(r-n),s=i-o,a=i+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,o,s,a;const l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,c=this.origin;return l>=0?(i=(t.min.x-c.x)*l,n=(t.max.x-c.x)*l):(i=(t.max.x-c.x)*l,n=(t.min.x-c.x)*l),h>=0?(r=(t.min.y-c.y)*h,o=(t.max.y-c.y)*h):(r=(t.max.y-c.y)*h,o=(t.min.y-c.y)*h),i>o||r>n?null:((r>i||i!=i)&&(i=r),(o<n||n!=n)&&(n=o),u>=0?(s=(t.min.z-c.z)*u,a=(t.max.z-c.z)*u):(s=(t.max.z-c.z)*u,a=(t.min.z-c.z)*u),i>a||s>n?null:((s>i||i!=i)&&(i=s),(a<n||n!=n)&&(n=a),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,J)}intersectTriangle(t,e,i,n,r){tt.subVectors(e,t),et.subVectors(i,t),it.crossVectors(tt,et);let o,s=this.direction.dot(it);if(s>0){if(n)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}$.subVectors(this.origin,t);const a=o*this.direction.dot(et.crossVectors($,et));if(a<0)return null;const l=o*this.direction.dot(tt.cross($));if(l<0)return null;if(a+l>s)return null;const h=-o*$.dot(it);return h<0?null:this.at(h/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class rt{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,o,s,a,l,h,u,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=h,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new rt).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/ot.setFromMatrixColumn(t,0).length(),r=1/ot.setFromMatrixColumn(t,1).length(),o=1/ot.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),s=Math.sin(i),a=Math.cos(n),l=Math.sin(n),h=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=o*h,i=o*u,n=s*h,r=s*u;e[0]=a*h,e[4]=-a*u,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-s*a,e[2]=r-t*l,e[6]=n+i*l,e[10]=o*a}else if("YXZ"===t.order){const t=a*h,i=a*u,n=l*h,r=l*u;e[0]=t+r*s,e[4]=n*s-i,e[8]=o*l,e[1]=o*u,e[5]=o*h,e[9]=-s,e[2]=i*s-n,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*h,i=a*u,n=l*h,r=l*u;e[0]=t-r*s,e[4]=-o*u,e[8]=n+i*s,e[1]=i+n*s,e[5]=o*h,e[9]=r-t*s,e[2]=-o*l,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*h,i=o*u,n=s*h,r=s*u;e[0]=a*h,e[4]=n*l-i,e[8]=t*l+r,e[1]=a*u,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,i=o*l,n=s*a,r=s*l;e[0]=a*h,e[4]=r-t*u,e[8]=n*u+i,e[1]=u,e[5]=o*h,e[9]=-s*h,e[2]=-l*h,e[6]=i*u+n,e[10]=t-r*u}else if("XZY"===t.order){const t=o*a,i=o*l,n=s*a,r=s*l;e[0]=a*h,e[4]=-u,e[8]=l*h,e[1]=t*u+r,e[5]=o*h,e[9]=i*u-n,e[2]=n*u-i,e[6]=s*h,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(at,t,lt)}lookAt(t,e,i){const n=this.elements;return ct.subVectors(t,e),0===ct.lengthSq()&&(ct.z=1),ct.normalize(),ht.crossVectors(i,ct),0===ht.lengthSq()&&(1===Math.abs(i.z)?ct.x+=1e-4:ct.z+=1e-4,ct.normalize(),ht.crossVectors(i,ct)),ht.normalize(),ut.crossVectors(ct,ht),n[0]=ht.x,n[4]=ut.x,n[8]=ct.x,n[1]=ht.y,n[5]=ut.y,n[9]=ct.y,n[2]=ht.z,n[6]=ut.z,n[10]=ct.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,o=i[0],s=i[4],a=i[8],l=i[12],h=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],_=i[7],y=i[11],x=i[15],b=n[0],T=n[4],E=n[8],S=n[12],w=n[1],A=n[5],M=n[9],C=n[13],R=n[2],I=n[6],P=n[10],O=n[14],N=n[3],L=n[7],D=n[11],F=n[15];return r[0]=o*b+s*w+a*R+l*N,r[4]=o*T+s*A+a*I+l*L,r[8]=o*E+s*M+a*P+l*D,r[12]=o*S+s*C+a*O+l*F,r[1]=h*b+u*w+c*R+d*N,r[5]=h*T+u*A+c*I+d*L,r[9]=h*E+u*M+c*P+d*D,r[13]=h*S+u*C+c*O+d*F,r[2]=p*b+f*w+m*R+g*N,r[6]=p*T+f*A+m*I+g*L,r[10]=p*E+f*M+m*P+g*D,r[14]=p*S+f*C+m*O+g*F,r[3]=v*b+_*w+y*R+x*N,r[7]=v*T+_*A+y*I+x*L,r[11]=v*E+_*M+y*P+x*D,r[15]=v*S+_*C+y*O+x*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],o=t[1],s=t[5],a=t[9],l=t[13],h=t[2],u=t[6],c=t[10],d=t[14];return t[3]*(+r*a*u-n*l*u-r*s*c+i*l*c+n*s*d-i*a*d)+t[7]*(+e*a*d-e*l*c+r*o*c-n*o*d+n*l*h-r*a*h)+t[11]*(+e*l*u-e*s*d-r*o*u+i*o*d+r*s*h-i*l*h)+t[15]*(-n*s*h-e*a*u+e*s*c+n*o*u-i*o*c+i*a*h)}transpose(){const t=this.elements;let e;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(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],h=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=u*m*l-f*c*l+f*a*d-s*m*d-u*a*g+s*c*g,_=p*c*l-h*m*l-p*a*d+o*m*d+h*a*g-o*c*g,y=h*f*l-p*u*l+p*s*d-o*f*d-h*s*g+o*u*g,x=p*u*a-h*f*a-p*s*c+o*f*c+h*s*m-o*u*m,b=e*v+i*_+n*y+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/b;return t[0]=v*T,t[1]=(f*c*r-u*m*r-f*n*d+i*m*d+u*n*g-i*c*g)*T,t[2]=(s*m*r-f*a*r+f*n*l-i*m*l-s*n*g+i*a*g)*T,t[3]=(u*a*r-s*c*r-u*n*l+i*c*l+s*n*d-i*a*d)*T,t[4]=_*T,t[5]=(h*m*r-p*c*r+p*n*d-e*m*d-h*n*g+e*c*g)*T,t[6]=(p*a*r-o*m*r-p*n*l+e*m*l+o*n*g-e*a*g)*T,t[7]=(o*c*r-h*a*r+h*n*l-e*c*l-o*n*d+e*a*d)*T,t[8]=y*T,t[9]=(p*u*r-h*f*r-p*i*d+e*f*d+h*i*g-e*u*g)*T,t[10]=(o*f*r-p*s*r+p*i*l-e*f*l-o*i*g+e*s*g)*T,t[11]=(h*s*r-o*u*r-h*i*l+e*u*l+o*i*d-e*s*d)*T,t[12]=x*T,t[13]=(h*f*n-p*u*n+p*i*c-e*f*c-h*i*m+e*u*m)*T,t[14]=(p*s*n-o*f*n-p*i*a+e*f*a+o*i*m-e*s*m)*T,t[15]=(o*u*n-h*s*n+h*i*a-e*u*a-o*i*c+e*s*c)*T,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,o=t.x,s=t.y,a=t.z,l=r*o,h=r*s;return this.set(l*o+i,l*s-n*a,l*a+n*s,0,l*s+n*a,h*s+i,h*a-n*o,0,l*a-n*s,h*a+n*o,r*a*a+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,o){return this.set(1,i,r,0,t,1,o,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,l=r+r,h=o+o,u=s+s,c=r*l,d=r*h,p=r*u,f=o*h,m=o*u,g=s*u,v=a*l,_=a*h,y=a*u,x=i.x,b=i.y,T=i.z;return n[0]=(1-(f+g))*x,n[1]=(d+y)*x,n[2]=(p-_)*x,n[3]=0,n[4]=(d-y)*b,n[5]=(1-(c+g))*b,n[6]=(m+v)*b,n[7]=0,n[8]=(p+_)*T,n[9]=(m-v)*T,n[10]=(1-(c+f))*T,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=ot.set(n[0],n[1],n[2]).length();const o=ot.set(n[4],n[5],n[6]).length(),s=ot.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],st.copy(this);const a=1/r,l=1/o,h=1/s;return st.elements[0]*=a,st.elements[1]*=a,st.elements[2]*=a,st.elements[4]*=l,st.elements[5]*=l,st.elements[6]*=l,st.elements[8]*=h,st.elements[9]*=h,st.elements[10]*=h,e.setFromRotationMatrix(st),i.x=r,i.y=o,i.z=s,this}makePerspective(t,e,i,n,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),l=2*r/(i-n),h=(e+t)/(e-t),u=(i+n)/(i-n),c=-(o+r)/(o-r),d=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=l,s[9]=u,s[13]=0,s[2]=0,s[6]=0,s[10]=c,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,i,n,r,o){const s=this.elements,a=1/(e-t),l=1/(i-n),h=1/(o-r),u=(e+t)*a,c=(i+n)*l,d=(o+r)*h;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-u,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-c,s[2]=0,s[6]=0,s[10]=-2*h,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}rt.prototype.isMatrix4=!0;const ot=new M,st=new rt,at=new M(0,0,0),lt=new M(1,1,1),ht=new M,ut=new M,ct=new M,dt=new rt,pt=new A;class ft{constructor(t=0,e=0,i=0,n=ft.DefaultOrder){this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],o=n[4],s=n[8],a=n[1],l=n[5],h=n[9],u=n[2],d=n[6],p=n[10];switch(e){case"XYZ":this._y=Math.asin(c(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-c(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(c(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-c(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(c(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-c(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return dt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(dt,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return pt.setFromEuler(this),this.setFromQuaternion(pt,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new M(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}ft.prototype.isEuler=!0,ft.DefaultOrder="XYZ",ft.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class mt{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let gt=0;const vt=new M,_t=new A,yt=new rt,xt=new M,bt=new M,Tt=new M,Et=new A,St=new M(1,0,0),wt=new M(0,1,0),At=new M(0,0,1),Mt={type:"added"},Ct={type:"removed"};class Rt extends s{constructor(){super(),Object.defineProperty(this,"id",{value:gt++}),this.uuid=u(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Rt.DefaultUp.clone();const t=new M,e=new ft,i=new A,n=new M(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new rt},normalMatrix:{value:new v}}),this.matrix=new rt,this.matrixWorld=new rt,this.matrixAutoUpdate=Rt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new mt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return _t.setFromAxisAngle(t,e),this.quaternion.multiply(_t),this}rotateOnWorldAxis(t,e){return _t.setFromAxisAngle(t,e),this.quaternion.premultiply(_t),this}rotateX(t){return this.rotateOnAxis(St,t)}rotateY(t){return this.rotateOnAxis(wt,t)}rotateZ(t){return this.rotateOnAxis(At,t)}translateOnAxis(t,e){return vt.copy(t).applyQuaternion(this.quaternion),this.position.add(vt.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(St,t)}translateY(t){return this.translateOnAxis(wt,t)}translateZ(t){return this.translateOnAxis(At,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(yt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?xt.copy(t):xt.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),bt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?yt.lookAt(bt,xt,this.up):yt.lookAt(xt,bt,this.up),this.quaternion.setFromRotationMatrix(yt),n&&(yt.extractRotation(n.matrixWorld),_t.setFromRotationMatrix(yt),this.quaternion.premultiply(_t.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Mt)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Ct)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Ct)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),yt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),yt.multiply(t.parent.matrixWorld)),t.applyMatrix4(yt),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(bt,t,Tt),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(bt,Et,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=o(t.geometries),n=o(t.materials),r=o(t.textures),s=o(t.images),a=o(t.shapes),l=o(t.skeletons),h=o(t.animations);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),a.length>0&&(i.shapes=a),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h)}return i.object=n,i;function o(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Rt.DefaultUp=new M(0,1,0),Rt.DefaultMatrixAutoUpdate=!0,Rt.prototype.isObject3D=!0;const It=new M,Pt=new M,Ot=new M,Nt=new M,Lt=new M,Dt=new M,Ft=new M,Bt=new M,Ut=new M,kt=new M;class Gt{constructor(t=new M,e=new M,i=new M){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),It.subVectors(t,e),n.cross(It);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){It.subVectors(n,e),Pt.subVectors(i,e),Ot.subVectors(t,e);const o=It.dot(It),s=It.dot(Pt),a=It.dot(Ot),l=Pt.dot(Pt),h=Pt.dot(Ot),u=o*l-s*s;if(0===u)return r.set(-2,-1,-1);const c=1/u,d=(l*a-s*h)*c,p=(o*h-s*a)*c;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Nt),Nt.x>=0&&Nt.y>=0&&Nt.x+Nt.y<=1}static getUV(t,e,i,n,r,o,s,a){return this.getBarycoord(t,e,i,n,Nt),a.set(0,0),a.addScaledVector(r,Nt.x),a.addScaledVector(o,Nt.y),a.addScaledVector(s,Nt.z),a}static isFrontFacing(t,e,i,n){return It.subVectors(i,e),Pt.subVectors(t,e),It.cross(Pt).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return It.subVectors(this.c,this.b),Pt.subVectors(this.a,this.b),.5*It.cross(Pt).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Gt.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Gt.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return Gt.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Gt.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Gt.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let o,s;Lt.subVectors(n,i),Dt.subVectors(r,i),Bt.subVectors(t,i);const a=Lt.dot(Bt),l=Dt.dot(Bt);if(a<=0&&l<=0)return e.copy(i);Ut.subVectors(t,n);const h=Lt.dot(Ut),u=Dt.dot(Ut);if(h>=0&&u<=h)return e.copy(n);const c=a*u-h*l;if(c<=0&&a>=0&&h<=0)return o=a/(a-h),e.copy(i).addScaledVector(Lt,o);kt.subVectors(t,r);const d=Lt.dot(kt),p=Dt.dot(kt);if(p>=0&&d<=p)return e.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(i).addScaledVector(Dt,s);const m=h*p-d*u;if(m<=0&&u-h>=0&&d-p>=0)return Ft.subVectors(r,n),s=(u-h)/(u-h+(d-p)),e.copy(n).addScaledVector(Ft,s);const g=1/(m+f+c);return o=f*g,s=c*g,e.copy(i).addScaledVector(Lt,o).addScaledVector(Dt,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ht=0;class jt extends s{constructor(){super(),Object.defineProperty(this,"id",{value:Ht++}),this.uuid=u(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}jt.prototype.isMaterial=!0;const zt={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},Vt={h:0,s:0,l:0},Xt={h:0,s:0,l:0};function Wt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function Yt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function qt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Zt{constructor(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=d(t,1),e=c(e,0,1),i=c(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Wt(r,n,t+1/3),this.g=Wt(r,n,t),this.b=Wt(r,n,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=zt[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=Yt(t.r),this.g=Yt(t.g),this.b=Yt(t.b),this}copyLinearToSRGB(t){return this.r=qt(t.r),this.g=qt(t.g),this.b=qt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),o=Math.min(e,i,n);let s,a;const l=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=l<=.5?t/(r+o):t/(2-r-o),r){case e:s=(i-n)/t+(i<n?6:0);break;case i:s=(n-e)/t+2;break;case n:s=(e-i)/t+4}s/=6}return t.h=s,t.s=a,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,i){return this.getHSL(Vt),Vt.h+=t,Vt.s+=e,Vt.l+=i,this.setHSL(Vt.h,Vt.s,Vt.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Vt),t.getHSL(Xt);const i=p(Vt.h,Xt.h,e),n=p(Vt.s,Xt.s,e),r=p(Vt.l,Xt.l,e);return this.setHSL(i,n,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Zt.NAMES=zt,Zt.prototype.isColor=!0,Zt.prototype.r=1,Zt.prototype.g=1,Zt.prototype.b=1;class Jt extends jt{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Zt(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=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this}}Jt.prototype.isMeshBasicMaterial=!0;const Kt=new M,Qt=new g;class $t{constructor(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new Zt),e[i++]=r.r,e[i++]=r.g,e[i++]=r.b}return this}copyVector2sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new g),e[i++]=r.x,e[i++]=r.y}return this}copyVector3sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new M),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z}return this}copyVector4sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new E),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z,e[i++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Qt.fromBufferAttribute(this,e),Qt.applyMatrix3(t),this.setXY(e,Qt.x,Qt.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Kt.fromBufferAttribute(this,e),Kt.applyMatrix3(t),this.setXYZ(e,Kt.x,Kt.y,Kt.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Kt.x=this.getX(e),Kt.y=this.getY(e),Kt.z=this.getZ(e),Kt.applyMatrix4(t),this.setXYZ(e,Kt.x,Kt.y,Kt.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Kt.x=this.getX(e),Kt.y=this.getY(e),Kt.z=this.getZ(e),Kt.applyNormalMatrix(t),this.setXYZ(e,Kt.x,Kt.y,Kt.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Kt.x=this.getX(e),Kt.y=this.getY(e),Kt.z=this.getZ(e),Kt.transformDirection(t),this.setXYZ(e,Kt.x,Kt.y,Kt.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}$t.prototype.isBufferAttribute=!0;class te extends $t{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class ee extends $t{constructor(t,e,i){super(new Int32Array(t),e,i)}}class ie extends $t{constructor(t,e,i){super(new Uint32Array(t),e,i)}}(class extends $t{constructor(t,e,i){super(new Uint16Array(t),e,i)}}).prototype.isFloat16BufferAttribute=!0;class ne extends $t{constructor(t,e,i){super(new Float32Array(t),e,i)}}function re(t){if(0===t.length)return-1/0;let e=t[0];for(let i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let oe=0;const se=new rt,ae=new Rt,le=new M,he=new I,ue=new I,ce=new M;class de extends s{constructor(){super(),Object.defineProperty(this,"id",{value:oe++}),this.uuid=u(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(re(t)>65535?ie:te)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new v).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return se.makeRotationFromQuaternion(t),this.applyMatrix4(se),this}rotateX(t){return se.makeRotationX(t),this.applyMatrix4(se),this}rotateY(t){return se.makeRotationY(t),this.applyMatrix4(se),this}rotateZ(t){return se.makeRotationZ(t),this.applyMatrix4(se),this}translate(t,e,i){return se.makeTranslation(t,e,i),this.applyMatrix4(se),this}scale(t,e,i){return se.makeScale(t,e,i),this.applyMatrix4(se),this}lookAt(t){return ae.lookAt(t),ae.updateMatrix(),this.applyMatrix4(ae.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(le).negate(),this.translate(le.x,le.y,le.z),this}setFromPoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new ne(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new I);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];he.setFromBufferAttribute(i),this.morphTargetsRelative?(ce.addVectors(this.boundingBox.min,he.min),this.boundingBox.expandByPoint(ce),ce.addVectors(this.boundingBox.max,he.max),this.boundingBox.expandByPoint(ce)):(this.boundingBox.expandByPoint(he.min),this.boundingBox.expandByPoint(he.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Z);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new M,1/0);if(t){const i=this.boundingSphere.center;if(he.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];ue.setFromBufferAttribute(i),this.morphTargetsRelative?(ce.addVectors(he.min,ue.min),he.expandByPoint(ce),ce.addVectors(he.max,ue.max),he.expandByPoint(ce)):(he.expandByPoint(ue.min),he.expandByPoint(ue.max))}he.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)ce.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(ce));if(e)for(let r=0,o=e.length;r<o;r++){const o=e[r],s=this.morphTargetsRelative;for(let e=0,r=o.count;e<r;e++)ce.fromBufferAttribute(o,e),s&&(le.fromBufferAttribute(t,e),ce.add(le)),n=Math.max(n,i.distanceToSquared(ce))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeFaceNormals(){}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,r=e.normal.array,o=e.uv.array,s=n.length/3;void 0===e.tangent&&this.setAttribute("tangent",new $t(new Float32Array(4*s),4));const a=e.tangent.array,l=[],h=[];for(let t=0;t<s;t++)l[t]=new M,h[t]=new M;const u=new M,c=new M,d=new M,p=new g,f=new g,m=new g,v=new M,_=new M;function y(t,e,i){u.fromArray(n,3*t),c.fromArray(n,3*e),d.fromArray(n,3*i),p.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*i),c.sub(u),d.sub(u),f.sub(p),m.sub(p);const r=1/(f.x*m.y-m.x*f.y);isFinite(r)&&(v.copy(c).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(r),_.copy(d).multiplyScalar(f.x).addScaledVector(c,-m.x).multiplyScalar(r),l[t].add(v),l[e].add(v),l[i].add(v),h[t].add(_),h[e].add(_),h[i].add(_))}let x=this.groups;0===x.length&&(x=[{start:0,count:i.length}]);for(let t=0,e=x.length;t<e;++t){const e=x[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)y(i[t+0],i[t+1],i[t+2])}const b=new M,T=new M,E=new M,S=new M;function w(t){E.fromArray(r,3*t),S.copy(E);const e=l[t];b.copy(e),b.sub(E.multiplyScalar(E.dot(e))).normalize(),T.crossVectors(S,e);const i=T.dot(h[t])<0?-1:1;a[4*t]=b.x,a[4*t+1]=b.y,a[4*t+2]=b.z,a[4*t+3]=i}for(let t=0,e=x.length;t<e;++t){const e=x[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)w(i[t+0]),w(i[t+1]),w(i[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new $t(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new M,r=new M,o=new M,s=new M,a=new M,l=new M,h=new M,u=new M;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),f=t.getX(c+2);n.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),o.fromBufferAttribute(e,f),h.subVectors(o,r),u.subVectors(n,r),h.cross(u),s.fromBufferAttribute(i,d),a.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(h),a.add(h),l.add(h),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),h.subVectors(o,r),u.subVectors(n,r),h.cross(u),i.setXYZ(t+0,h.x,h.y,h.z),i.setXYZ(t+1,h.x,h.y,h.z),i.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const n in i){if(void 0===t.attributes[n])continue;const r=i[n].array,o=t.attributes[n],s=o.array,a=o.itemSize*e,l=Math.min(s.length,r.length-a);for(let t=0,e=a;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)ce.fromBufferAttribute(t,e),ce.normalize(),t.setXYZ(e,ce.x,ce.y,ce.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,o=new i.constructor(e.length*n);let s=0,a=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*n;for(let t=0;t<n;t++)o[a++]=i[s++]}return new $t(o,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new de,i=this.index.array,n=this.attributes;for(const r in n){const o=t(n[r],i);e.setAttribute(r,o)}const r=this.morphAttributes;for(const n in r){const o=[],s=r[n];for(let e=0,n=s.length;e<n;e++){const n=t(s[e],i);o.push(n)}e.morphAttributes[n]=o}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,i=o.length;t<i;t++){const i=o[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],o=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];o.push(n.toJSON(t.data))}o.length>0&&(n[e]=o,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new de).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let t=0,e=o.length;t<e;t++){const e=o[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}de.prototype.isBufferGeometry=!0;const pe=new rt,fe=new nt,me=new Z,ge=new M,ve=new M,_e=new M,ye=new M,xe=new M,be=new M,Te=new M,Ee=new M,Se=new M,we=new g,Ae=new g,Me=new g,Ce=new M,Re=new M;class Ie extends Rt{constructor(t=new de,e=new Jt){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),me.copy(i.boundingSphere),me.applyMatrix4(r),!1===t.ray.intersectsSphere(me))return;if(pe.copy(r).invert(),fe.copy(t.ray).applyMatrix4(pe),null!==i.boundingBox&&!1===fe.intersectsBox(i.boundingBox))return;let o;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position,a=i.morphAttributes.position,l=i.morphTargetsRelative,h=i.attributes.uv,u=i.attributes.uv2,c=i.groups,d=i.drawRange;if(null!==r)if(Array.isArray(n))for(let i=0,p=c.length;i<p;i++){const p=c[i],f=n[p.materialIndex];for(let i=Math.max(p.start,d.start),n=Math.min(p.start+p.count,d.start+d.count);i<n;i+=3){const n=r.getX(i),c=r.getX(i+1),d=r.getX(i+2);o=Pe(this,f,t,fe,s,a,l,h,u,n,c,d),o&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=p.materialIndex,e.push(o))}}else{for(let i=Math.max(0,d.start),c=Math.min(r.count,d.start+d.count);i<c;i+=3){const c=r.getX(i),d=r.getX(i+1),p=r.getX(i+2);o=Pe(this,n,t,fe,s,a,l,h,u,c,d,p),o&&(o.faceIndex=Math.floor(i/3),e.push(o))}}else if(void 0!==s)if(Array.isArray(n))for(let i=0,r=c.length;i<r;i++){const r=c[i],p=n[r.materialIndex];for(let i=Math.max(r.start,d.start),n=Math.min(r.start+r.count,d.start+d.count);i<n;i+=3){o=Pe(this,p,t,fe,s,a,l,h,u,i,i+1,i+2),o&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=r.materialIndex,e.push(o))}}else{for(let i=Math.max(0,d.start),r=Math.min(s.count,d.start+d.count);i<r;i+=3){o=Pe(this,n,t,fe,s,a,l,h,u,i,i+1,i+2),o&&(o.faceIndex=Math.floor(i/3),e.push(o))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Pe(t,e,i,n,r,o,s,a,l,h,u,c){ge.fromBufferAttribute(r,h),ve.fromBufferAttribute(r,u),_e.fromBufferAttribute(r,c);const d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){Te.set(0,0,0),Ee.set(0,0,0),Se.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],i=o[t];0!==e&&(ye.fromBufferAttribute(i,h),xe.fromBufferAttribute(i,u),be.fromBufferAttribute(i,c),s?(Te.addScaledVector(ye,e),Ee.addScaledVector(xe,e),Se.addScaledVector(be,e)):(Te.addScaledVector(ye.sub(ge),e),Ee.addScaledVector(xe.sub(ve),e),Se.addScaledVector(be.sub(_e),e)))}ge.add(Te),ve.add(Ee),_e.add(Se)}t.isSkinnedMesh&&(t.boneTransform(h,ge),t.boneTransform(u,ve),t.boneTransform(c,_e));const p=function(t,e,i,n,r,o,s,a){let l;if(l=1===e.side?n.intersectTriangle(s,o,r,!0,a):n.intersectTriangle(r,o,s,2!==e.side,a),null===l)return null;Re.copy(a),Re.applyMatrix4(t.matrixWorld);const h=i.ray.origin.distanceTo(Re);return h<i.near||h>i.far?null:{distance:h,point:Re.clone(),object:t}}(t,e,i,n,ge,ve,_e,Ce);if(p){a&&(we.fromBufferAttribute(a,h),Ae.fromBufferAttribute(a,u),Me.fromBufferAttribute(a,c),p.uv=Gt.getUV(Ce,ge,ve,_e,we,Ae,Me,new g)),l&&(we.fromBufferAttribute(l,h),Ae.fromBufferAttribute(l,u),Me.fromBufferAttribute(l,c),p.uv2=Gt.getUV(Ce,ge,ve,_e,we,Ae,Me,new g));const t={a:h,b:u,c:c,normal:new M,materialIndex:0};Gt.getNormal(ge,ve,_e,t.normal),p.face=t}return p}Ie.prototype.isMesh=!0;class Oe extends de{constructor(t=1,e=1,i=1,n=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:o};const s=this;n=Math.floor(n),r=Math.floor(r),o=Math.floor(o);const a=[],l=[],h=[],u=[];let c=0,d=0;function p(t,e,i,n,r,o,p,f,m,g,v){const _=o/m,y=p/g,x=o/2,b=p/2,T=f/2,E=m+1,S=g+1;let w=0,A=0;const C=new M;for(let o=0;o<S;o++){const s=o*y-b;for(let a=0;a<E;a++){const c=a*_-x;C[t]=c*n,C[e]=s*r,C[i]=T,l.push(C.x,C.y,C.z),C[t]=0,C[e]=0,C[i]=f>0?1:-1,h.push(C.x,C.y,C.z),u.push(a/m),u.push(1-o/g),w+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const i=c+e+E*t,n=c+e+E*(t+1),r=c+(e+1)+E*(t+1),o=c+(e+1)+E*t;a.push(i,n,o),a.push(n,r,o),A+=6}s.addGroup(d,A,v),d+=A,c+=w}p("z","y","x",-1,-1,i,e,t,o,r,0),p("z","y","x",1,-1,i,e,-t,o,r,1),p("x","z","y",1,1,t,i,e,n,o,2),p("x","z","y",1,-1,t,i,-e,n,o,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(a),this.setAttribute("position",new ne(l,3)),this.setAttribute("normal",new ne(h,3)),this.setAttribute("uv",new ne(u,2))}static fromJSON(t){return new Oe(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Ne(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Le(t){const e={};for(let i=0;i<t.length;i++){const n=Ne(t[i]);for(const t in n)e[t]=n[t]}return e}const De={clone:Ne,merge:Le};class Fe extends jt{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.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,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ne(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}Fe.prototype.isShaderMaterial=!0;class Be extends Rt{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new rt,this.projectionMatrix=new rt,this.projectionMatrixInverse=new rt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Be.prototype.isCamera=!0;class Ue extends Be{constructor(t=50,e=1,i=.1,n=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*h*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*l*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*h*Math.atan(Math.tan(.5*l*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,o){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*l*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*n/t,e-=o.offsetY*i/s,n*=o.width/t,i*=o.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Ue.prototype.isPerspectiveCamera=!0;class ke extends Rt{constructor(t,e,i){if(super(),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=i;const n=new Ue(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new M(1,0,0)),this.add(n);const r=new Ue(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new M(-1,0,0)),this.add(r);const o=new Ue(90,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new M(0,1,0)),this.add(o);const s=new Ue(90,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new M(0,-1,0)),this.add(s);const a=new Ue(90,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new M(0,0,1)),this.add(a);const l=new Ue(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new M(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const i=this.renderTarget,[n,r,o,s,a,l]=this.children,h=t.xr.enabled,u=t.getRenderTarget();t.xr.enabled=!1;const c=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,o),t.setRenderTarget(i,3),t.render(e,s),t.setRenderTarget(i,4),t.render(e,a),i.texture.generateMipmaps=c,t.setRenderTarget(i,5),t.render(e,l),t.setRenderTarget(u),t.xr.enabled=h}}class Ge extends b{constructor(t,e,i,n,r,o,s,a,l,h){super(t=void 0!==t?t:[],e=void 0!==e?e:301,i,n,r,o,s=void 0!==s?s:1022,a,l,h),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Ge.prototype.isCubeTexture=!0;class He extends S{constructor(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),super(t,t,e),e=e||{},this.texture=new Ge(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:1006,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=1023,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new Oe(5,5,5),r=new Fe({name:"CubemapFromEquirect",uniforms:Ne(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const o=new Ie(n,r),s=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new ke(1,10,this).update(t,o),e.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}He.prototype.isWebGLCubeRenderTarget=!0;const je=new M,ze=new M,Ve=new v;class Xe{constructor(t=new M(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=je.subVectors(i,e).cross(ze.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const i=t.delta(je),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Ve.getNormalMatrix(t),n=this.coplanarPoint(je).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Xe.prototype.isPlane=!0;const We=new Z,Ye=new M;class qe{constructor(t=new Xe,e=new Xe,i=new Xe,n=new Xe,r=new Xe,o=new Xe){this.planes=[t,e,i,n,r,o]}set(t,e,i,n,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(o),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],_=i[15];return e[0].setComponents(s-n,u-a,f-c,_-m).normalize(),e[1].setComponents(s+n,u+a,f+c,_+m).normalize(),e[2].setComponents(s+r,u+l,f+d,_+g).normalize(),e[3].setComponents(s-r,u-l,f-d,_-g).normalize(),e[4].setComponents(s-o,u-h,f-p,_-v).normalize(),e[5].setComponents(s+o,u+h,f+p,_+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),We.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(We)}intersectsSprite(t){return We.center.set(0,0,0),We.radius=.7071067811865476,We.applyMatrix4(t.matrixWorld),this.intersectsSphere(We)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)<n)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(Ye.x=n.normal.x>0?t.max.x:t.min.x,Ye.y=n.normal.y>0?t.max.y:t.min.y,Ye.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Ye)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ze(){let t=null,e=!1,i=null,n=null;function r(e,o){i(e,o),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Je(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=n.get(e);void 0===o?n.set(e,function(e,n){const r=e.array,o=e.usage,s=t.createBuffer();t.bindBuffer(n,s),t.bufferData(n,r,o),e.onUploadCallback();let a=5126;return r instanceof Float32Array?a=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?i?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:r instanceof Int16Array?a=5122:r instanceof Uint32Array?a=5125:r instanceof Int32Array?a=5124:r instanceof Int8Array?a=5120:(r instanceof Uint8Array||r instanceof Uint8ClampedArray)&&(a=5121),{buffer:s,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):o.version<e.version&&(!function(e,n,r){const o=n.array,s=n.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,o):(i?t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,e,r),o.version=e.version)}}}class Ke extends de{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,o=e/2,s=Math.floor(i),a=Math.floor(n),l=s+1,h=a+1,u=t/s,c=e/a,d=[],p=[],f=[],m=[];for(let t=0;t<h;t++){const e=t*c-o;for(let i=0;i<l;i++){const n=i*u-r;p.push(n,-e,0),f.push(0,0,1),m.push(i/s),m.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<s;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),o=e+1+l*t;d.push(i,n,o),d.push(n,r,o)}this.setIndex(d),this.setAttribute("position",new ne(p,3)),this.setAttribute("normal",new ne(f,3)),this.setAttribute("uv",new ne(m,2))}static fromJSON(t){return new Ke(t.width,t.height,t.widthSegments,t.heightSegments)}}const Qe={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn 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\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn 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\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn 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\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\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\treturn 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\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSNMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tnormal, v, roughnessFactor, material.diffuseColor, totalSpecular,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {\n\t\tvec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length(vec3(modelMatrix[0].xyz));\n\t\tmodelScale.y = length(vec3(modelMatrix[1].xyz));\n\t\tmodelScale.z = length(vec3(modelMatrix[2].xyz));\n\t\treturn normalize(refractionVector) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\n\t\tif (attenuationDistance == 0.0) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\n\t\t\tvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#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\tvarying vec3 vLightBack;\n\tvarying 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_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying 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\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#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\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying 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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying 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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform vec3 attenuationColor;\n\tuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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 <transmission_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",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\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},$e={common:{diffuse:{value:new Zt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new v},uv2Transform:{value:new v},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 g(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 Zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new v}},sprite:{diffuse:{value:new Zt(16777215)},opacity:{value:1},center:{value:new g(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new v}}},ti={basic:{uniforms:Le([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.fog]),vertexShader:Qe.meshbasic_vert,fragmentShader:Qe.meshbasic_frag},lambert:{uniforms:Le([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.fog,$e.lights,{emissive:{value:new Zt(0)}}]),vertexShader:Qe.meshlambert_vert,fragmentShader:Qe.meshlambert_frag},phong:{uniforms:Le([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.fog,$e.lights,{emissive:{value:new Zt(0)},specular:{value:new Zt(1118481)},shininess:{value:30}}]),vertexShader:Qe.meshphong_vert,fragmentShader:Qe.meshphong_frag},standard:{uniforms:Le([$e.common,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.roughnessmap,$e.metalnessmap,$e.fog,$e.lights,{emissive:{value:new Zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag},toon:{uniforms:Le([$e.common,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.gradientmap,$e.fog,$e.lights,{emissive:{value:new Zt(0)}}]),vertexShader:Qe.meshtoon_vert,fragmentShader:Qe.meshtoon_frag},matcap:{uniforms:Le([$e.common,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.fog,{matcap:{value:null}}]),vertexShader:Qe.meshmatcap_vert,fragmentShader:Qe.meshmatcap_frag},points:{uniforms:Le([$e.points,$e.fog]),vertexShader:Qe.points_vert,fragmentShader:Qe.points_frag},dashed:{uniforms:Le([$e.common,$e.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qe.linedashed_vert,fragmentShader:Qe.linedashed_frag},depth:{uniforms:Le([$e.common,$e.displacementmap]),vertexShader:Qe.depth_vert,fragmentShader:Qe.depth_frag},normal:{uniforms:Le([$e.common,$e.bumpmap,$e.normalmap,$e.displacementmap,{opacity:{value:1}}]),vertexShader:Qe.normal_vert,fragmentShader:Qe.normal_frag},sprite:{uniforms:Le([$e.sprite,$e.fog]),vertexShader:Qe.sprite_vert,fragmentShader:Qe.sprite_frag},background:{uniforms:{uvTransform:{value:new v},t2D:{value:null}},vertexShader:Qe.background_vert,fragmentShader:Qe.background_frag},cube:{uniforms:Le([$e.envmap,{opacity:{value:1}}]),vertexShader:Qe.cube_vert,fragmentShader:Qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe.equirect_vert,fragmentShader:Qe.equirect_frag},distanceRGBA:{uniforms:Le([$e.common,$e.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qe.distanceRGBA_vert,fragmentShader:Qe.distanceRGBA_frag},shadow:{uniforms:Le([$e.lights,$e.fog,{color:{value:new Zt(0)},opacity:{value:1}}]),vertexShader:Qe.shadow_vert,fragmentShader:Qe.shadow_frag}};function ei(t,e,i,n,r){const o=new Zt(0);let s,a,l=0,h=null,u=0,c=null;function d(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(o,l)},render:function(i,r){let p=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?d(o,l):f&&f.isColor&&(d(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===a&&(a=new Ie(new Oe(1,1,1),new Fe({name:"BackgroundCubeMaterial",uniforms:Ne(ti.cube.uniforms),vertexShader:ti.cube.vertexShader,fragmentShader:ti.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a)),a.material.uniforms.envMap.value=f,a.material.uniforms.flipEnvMap.value=f.isCubeTexture&&f._needsFlipEnvMap?-1:1,h===f&&u===f.version&&c===t.toneMapping||(a.material.needsUpdate=!0,h=f,u=f.version,c=t.toneMapping),i.unshift(a,a.geometry,a.material,0,0,null)):f&&f.isTexture&&(void 0===s&&(s=new Ie(new Ke(2,2),new Fe({name:"BackgroundMaterial",uniforms:Ne(ti.background.uniforms),vertexShader:ti.background.vertexShader,fragmentShader:ti.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(s)),s.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),s.material.uniforms.uvTransform.value.copy(f.matrix),h===f&&u===f.version&&c===t.toneMapping||(s.material.needsUpdate=!0,h=f,u=f.version,c=t.toneMapping),i.unshift(s,s.geometry,s.material,0,0,null))}}}function ii(t,e,i,n){const r=t.getParameter(34921),o=n.isWebGL2?null:e.get("OES_vertex_array_object"),s=n.isWebGL2||null!==o,a={},l=d(null);let h=l;function u(e){return n.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function c(e){return n.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function d(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function p(){const t=h.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function f(t){m(t,0)}function m(i,r){const o=h.newAttributes,s=h.enabledAttributes,a=h.attributeDivisors;if(o[i]=1,0===s[i]&&(t.enableVertexAttribArray(i),s[i]=1),a[i]!==r){(n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),a[i]=r}}function g(){const e=h.newAttributes,i=h.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function v(e,i,r,o,s,a){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,o,s,a):t.vertexAttribIPointer(e,i,r,s,a)}function _(){y(),h!==l&&(h=l,u(h.object))}function y(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,c,_,y){let x=!1;if(s){const e=function(e,i,r){const s=!0===r.wireframe;let l=a[e.id];void 0===l&&(l={},a[e.id]=l);let h=l[i.id];void 0===h&&(h={},l[i.id]=h);let u=h[s];void 0===u&&(u=d(n.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),h[s]=u);return u}(_,c,l);h!==e&&(h=e,u(h.object)),x=function(t,e){const i=h.attributes,n=t.attributes;let r=0;for(const t in n){const e=i[t],o=n[t];if(void 0===e)return!0;if(e.attribute!==o)return!0;if(e.data!==o.data)return!0;r++}return h.attributesNum!==r||h.index!==e}(_,y),x&&function(t,e){const i={},n=t.attributes;let r=0;for(const t in n){const e=n[t],o={};o.attribute=e,e.data&&(o.data=e.data),i[t]=o,r++}h.attributes=i,h.attributesNum=r,h.index=e}(_,y)}else{const t=!0===l.wireframe;h.geometry===_.id&&h.program===c.id&&h.wireframe===t||(h.geometry=_.id,h.program=c.id,h.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==y&&i.update(y,34963),x&&(!function(r,o,s,a){if(!1===n.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=a.attributes,h=s.getAttributes(),u=o.defaultAttributeValues;for(const e in h){const n=h[e];if(n>=0){const o=l[e];if(void 0!==o){const e=o.normalized,r=o.itemSize,s=i.get(o);if(void 0===s)continue;const l=s.buffer,h=s.type,u=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const i=o.data,s=i.stride,c=o.offset;i&&i.isInstancedInterleavedBuffer?(m(n,i.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=i.meshPerAttribute*i.count)):f(n),t.bindBuffer(34962,l),v(n,r,h,e,s*u,c*u)}else o.isInstancedBufferAttribute?(m(n,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(n),t.bindBuffer(34962,l),v(n,r,h,e,0,0)}else if("instanceMatrix"===e){const e=i.get(r.instanceMatrix);if(void 0===e)continue;const o=e.buffer,s=e.type;m(n+0,1),m(n+1,1),m(n+2,1),m(n+3,1),t.bindBuffer(34962,o),t.vertexAttribPointer(n+0,4,s,!1,64,0),t.vertexAttribPointer(n+1,4,s,!1,64,16),t.vertexAttribPointer(n+2,4,s,!1,64,32),t.vertexAttribPointer(n+3,4,s,!1,64,48)}else if("instanceColor"===e){const e=i.get(r.instanceColor);if(void 0===e)continue;const o=e.buffer,s=e.type;m(n,1),t.bindBuffer(34962,o),t.vertexAttribPointer(n,3,s,!1,12,0)}else if(void 0!==u){const i=u[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n,i);break;case 3:t.vertexAttrib3fv(n,i);break;case 4:t.vertexAttrib4fv(n,i);break;default:t.vertexAttrib1fv(n,i)}}}}g()}(r,l,c,_),null!==y&&t.bindBuffer(34963,i.get(y).buffer))},reset:_,resetDefaultState:y,dispose:function(){_();for(const t in a){const e=a[t];for(const t in e){const i=e[t];for(const t in i)c(i[t].object),delete i[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const i=e[t];for(const t in i)c(i[t].object),delete i[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const i=a[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)c(n[t].object),delete n[t];delete i[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function ni(t,e,i,n){const r=n.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,n){t.drawArrays(o,e,n),i.update(n,o,1)},this.renderInstances=function(n,s,a){if(0===a)return;let l,h;if(r)l=t,h="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),h="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[h](o,n,s,a),i.update(s,o,a)}}function ri(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==i.precision?i.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=o||e.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,u=t.getParameter(34930),c=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),_=c>0,y=o||e.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:_&&y,maxSamples:o?t.getParameter(36183):0}}function oi(t){const e=this;let i=null,n=0,r=!1,o=!1;const s=new Xe,a=new v,l={value:null,needsUpdate:!1};function h(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,i,n,r){const o=null!==t?t.length:0;let h=null;if(0!==o){if(h=l.value,!0!==r||null===h){const e=n+4*o,r=i.matrixWorldInverse;a.getNormalMatrix(r),(null===h||h.length<e)&&(h=new Float32Array(e));for(let e=0,i=n;e!==o;++e,i+=4)s.copy(t[e]).applyMatrix4(r,a),s.normal.toArray(h,i),h[i+3]=s.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const s=0!==t.length||e||0!==n||r;return r=e,i=u(t,o,0),n=t.length,s},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1,h()},this.setState=function(e,s,a){const c=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===c||0===c.length||o&&!p)o?u(null):h();else{const t=o?0:n,e=4*t;let r=f.clippingState||null;l.value=r,r=u(c,s,e,a);for(let t=0;t!==e;++t)r[t]=i[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function si(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const o=r.mapping;if(303===o||304===o){if(e.has(r)){return i(e.get(r).texture,r.mapping)}{const o=r.image;if(o&&o.height>0){const s=t.getRenderTarget(),a=new He(o.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),t.setRenderTarget(s),r.addEventListener("dispose",n),i(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function ai(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function li(t,e,i,n){const r={},o=new WeakMap;function s(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",s),delete r[a.id];const l=o.get(a);l&&(e.remove(l),o.delete(a)),n.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,i.memory.geometries--}function a(t){const i=[],n=t.index,r=t.attributes.position;let s=0;if(null!==n){const t=n.array;s=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],o=t[e+2];i.push(n,r,r,o,o,n)}}else{const t=r.array;s=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const a=new(re(i)>65535?ie:te)(i,1);a.version=s;const l=o.get(t);l&&e.remove(l),o.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,i.memory.geometries++),e},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&a(t)}else a(t);return o.get(t)}}}function hi(t,e,i,n){const r=n.isWebGL2;let o,s,a;this.setMode=function(t){o=t},this.setIndex=function(t){s=t.type,a=t.bytesPerElement},this.render=function(e,n){t.drawElements(o,n,s,e*a),i.update(n,o,1)},this.renderInstances=function(n,l,h){if(0===h)return;let u,c;if(r)u=t,c="drawElementsInstanced";else if(u=e.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[c](o,l,s,n*a,h),i.update(l,o,h)}}function ui(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ci(t,e){return t[0]-e[0]}function di(t,e){return Math.abs(e[1])-Math.abs(t[1])}function pi(t){const e={},i=new Float32Array(8),n=[];for(let t=0;t<8;t++)n[t]=[t,0];return{update:function(r,o,s,a){const l=r.morphTargetInfluences,h=void 0===l?0:l.length;let u=e[o.id];if(void 0===u||u.length!==h){u=[];for(let t=0;t<h;t++)u[t]=[t,0];e[o.id]=u}for(let t=0;t<h;t++){const e=u[t];e[0]=t,e[1]=l[t]}u.sort(di);for(let t=0;t<8;t++)t<h&&u[t][1]?(n[t][0]=u[t][0],n[t][1]=u[t][1]):(n[t][0]=Number.MAX_SAFE_INTEGER,n[t][1]=0);n.sort(ci);const c=s.morphTargets&&o.morphAttributes.position,d=s.morphNormals&&o.morphAttributes.normal;let p=0;for(let t=0;t<8;t++){const e=n[t],r=e[0],s=e[1];r!==Number.MAX_SAFE_INTEGER&&s?(c&&o.getAttribute("morphTarget"+t)!==c[r]&&o.setAttribute("morphTarget"+t,c[r]),d&&o.getAttribute("morphNormal"+t)!==d[r]&&o.setAttribute("morphNormal"+t,d[r]),i[t]=s,p+=s):(c&&!0===o.hasAttribute("morphTarget"+t)&&o.deleteAttribute("morphTarget"+t),d&&!0===o.hasAttribute("morphNormal"+t)&&o.deleteAttribute("morphNormal"+t),i[t]=0)}const f=o.morphTargetsRelative?1:1-p;a.getUniforms().setValue(t,"morphTargetBaseInfluence",f),a.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function fi(t,e,i,n){let r=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const s=n.render.frame,a=t.geometry,l=e.get(t,a);return r.get(l)!==s&&(e.update(l),r.set(l,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}ti.physical={uniforms:Le([ti.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new g(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Zt(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new g},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Zt(0)}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag};class mi extends b{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}mi.prototype.isDataTexture2DArray=!0;class gi extends b{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}gi.prototype.isDataTexture3D=!0;const vi=new b,_i=new mi,yi=new gi,xi=new Ge,bi=[],Ti=[],Ei=new Float32Array(16),Si=new Float32Array(9),wi=new Float32Array(4);function Ai(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let o=bi[r];if(void 0===o&&(o=new Float32Array(r),bi[r]=o),0!==e){n.toArray(o,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(o,r)}return o}function Mi(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Ci(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function Ri(t,e){let i=Ti[e];void 0===i&&(i=new Int32Array(e),Ti[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Ii(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Pi(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Mi(i,e))return;t.uniform2fv(this.addr,e),Ci(i,e)}}function Oi(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Mi(i,e))return;t.uniform3fv(this.addr,e),Ci(i,e)}}function Ni(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Mi(i,e))return;t.uniform4fv(this.addr,e),Ci(i,e)}}function Li(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Mi(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ci(i,e)}else{if(Mi(i,n))return;wi.set(n),t.uniformMatrix2fv(this.addr,!1,wi),Ci(i,n)}}function Di(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Mi(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ci(i,e)}else{if(Mi(i,n))return;Si.set(n),t.uniformMatrix3fv(this.addr,!1,Si),Ci(i,n)}}function Fi(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Mi(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ci(i,e)}else{if(Mi(i,n))return;Ei.set(n),t.uniformMatrix4fv(this.addr,!1,Ei),Ci(i,n)}}function Bi(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Ui(t,e){const i=this.cache;Mi(i,e)||(t.uniform2iv(this.addr,e),Ci(i,e))}function ki(t,e){const i=this.cache;Mi(i,e)||(t.uniform3iv(this.addr,e),Ci(i,e))}function Gi(t,e){const i=this.cache;Mi(i,e)||(t.uniform4iv(this.addr,e),Ci(i,e))}function Hi(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function ji(t,e){const i=this.cache;Mi(i,e)||(t.uniform2uiv(this.addr,e),Ci(i,e))}function zi(t,e){const i=this.cache;Mi(i,e)||(t.uniform3uiv(this.addr,e),Ci(i,e))}function Vi(t,e){const i=this.cache;Mi(i,e)||(t.uniform4uiv(this.addr,e),Ci(i,e))}function Xi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||vi,r)}function Wi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||yi,r)}function Yi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||xi,r)}function qi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||_i,r)}function Zi(t,e){t.uniform1fv(this.addr,e)}function Ji(t,e){const i=Ai(e,this.size,2);t.uniform2fv(this.addr,i)}function Ki(t,e){const i=Ai(e,this.size,3);t.uniform3fv(this.addr,i)}function Qi(t,e){const i=Ai(e,this.size,4);t.uniform4fv(this.addr,i)}function $i(t,e){const i=Ai(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function tn(t,e){const i=Ai(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function en(t,e){const i=Ai(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function nn(t,e){t.uniform1iv(this.addr,e)}function rn(t,e){t.uniform2iv(this.addr,e)}function on(t,e){t.uniform3iv(this.addr,e)}function sn(t,e){t.uniform4iv(this.addr,e)}function an(t,e){t.uniform1uiv(this.addr,e)}function ln(t,e){t.uniform2uiv(this.addr,e)}function hn(t,e){t.uniform3uiv(this.addr,e)}function un(t,e){t.uniform4uiv(this.addr,e)}function cn(t,e,i){const n=e.length,r=Ri(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTexture2D(e[t]||vi,r[t])}function dn(t,e,i){const n=e.length,r=Ri(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTextureCube(e[t]||xi,r[t])}function pn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Ii;case 35664:return Pi;case 35665:return Oi;case 35666:return Ni;case 35674:return Li;case 35675:return Di;case 35676:return Fi;case 5124:case 35670:return Bi;case 35667:case 35671:return Ui;case 35668:case 35672:return ki;case 35669:case 35673:return Gi;case 5125:return Hi;case 36294:return ji;case 36295:return zi;case 36296:return Vi;case 35678:case 36198:case 36298:case 36306:case 35682:return Xi;case 35679:case 36299:case 36307:return Wi;case 35680:case 36300:case 36308:case 36293:return Yi;case 36289:case 36303:case 36311:case 36292:return qi}}(e.type)}function fn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Zi;case 35664:return Ji;case 35665:return Ki;case 35666:return Qi;case 35674:return $i;case 35675:return tn;case 35676:return en;case 5124:case 35670:return nn;case 35667:case 35671:return rn;case 35668:case 35672:return on;case 35669:case 35673:return sn;case 5125:return an;case 36294:return ln;case 36295:return hn;case 36296:return un;case 35678:case 36198:case 36298:case 36306:case 35682:return cn;case 35680:case 36300:case 36308:case 36293:return dn}}(e.type)}function mn(t){this.id=t,this.seq=[],this.map={}}fn.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ci(e,t)},mn.prototype.setValue=function(t,e,i){const n=this.seq;for(let r=0,o=n.length;r!==o;++r){const o=n[r];o.setValue(t,e[o.id],i)}};const gn=/(\w+)(\])?(\[|\.)?/g;function vn(t,e){t.seq.push(e),t.map[e.id]=e}function _n(t,e,i){const n=t.name,r=n.length;for(gn.lastIndex=0;;){const o=gn.exec(n),s=gn.lastIndex;let a=o[1];const l="]"===o[2],h=o[3];if(l&&(a|=0),void 0===h||"["===h&&s+2===r){vn(i,void 0===h?new pn(a,t,e):new fn(a,t,e));break}{let t=i.map[a];void 0===t&&(t=new mn(a),vn(i,t)),i=t}}}function yn(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);_n(i,t.getUniformLocation(e,i.name),this)}}function xn(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}yn.prototype.setValue=function(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)},yn.prototype.setOptional=function(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)},yn.upload=function(t,e,i,n){for(let r=0,o=e.length;r!==o;++r){const o=e[r],s=i[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},yn.seqWithValue=function(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i};let bn=0;function Tn(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function En(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(n&&""===r)return"";return"THREE.WebGLShader: gl.getShaderInfoLog() "+i+"\n"+r+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function Sn(t,e){const i=Tn(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function wn(t,e){const i=Tn(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function An(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Mn(t){return""!==t}function Cn(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Rn(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const In=/^[ \t]*#include +<([\w\d./]+)>/gm;function Pn(t){return t.replace(In,On)}function On(t,e){const i=Qe[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Pn(i)}const Nn=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ln=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Dn(t){return t.replace(Ln,Bn).replace(Nn,Fn)}function Fn(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Bn(t,e,i,n)}function Bn(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Un(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function kn(t,e,i,n){const r=t.getContext(),o=i.defines;let s=i.vertexShader,a=i.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),h=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),u=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(i),c=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),d=t.gammaFactor>0?t.gammaFactor:1,p=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission>0)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Mn).join("\n")}(i),f=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(o),m=r.createProgram();let g,v,_=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(g=[f].filter(Mn).join("\n"),g.length>0&&(g+="\n"),v=[p,f].filter(Mn).join("\n"),v.length>0&&(v+="\n")):(g=[Un(i),"#define SHADER_NAME "+i.shaderName,f,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Mn).join("\n"),v=[p,Un(i),"#define SHADER_NAME "+i.shaderName,f,i.alphaTest?"#define ALPHATEST "+i.alphaTest+(i.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.envMap?"#define "+u:"",i.envMap?"#define "+c:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.sheen?"#define USE_SHEEN":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensionShaderTextureLOD||i.envMap)&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Qe.tonemapping_pars_fragment:"",0!==i.toneMapping?An("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",Qe.encodings_pars_fragment,i.map?Sn("mapTexelToLinear",i.mapEncoding):"",i.matcap?Sn("matcapTexelToLinear",i.matcapEncoding):"",i.envMap?Sn("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMap?Sn("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.lightMap?Sn("lightMapTexelToLinear",i.lightMapEncoding):"",wn("linearToOutputTexel",i.outputEncoding),i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Mn).join("\n")),s=Pn(s),s=Cn(s,i),s=Rn(s,i),a=Pn(a),a=Cn(a,i),a=Rn(a,i),s=Dn(s),a=Dn(a),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(_="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in","300 es"===i.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===i.glslVersion?"":"#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"+v);const y=_+v+a,x=xn(r,35633,_+g+s),b=xn(r,35632,y);if(r.attachShader(m,x),r.attachShader(m,b),void 0!==i.index0AttributeName?r.bindAttribLocation(m,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(x).trim(),i=r.getShaderInfoLog(b).trim();let n=!0,o=!0;if(!1===r.getProgramParameter(m,35714)){n=!1;const e=En(r,x,"vertex"),i=En(r,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(m,35715),"gl.getProgramInfoLog",t,e,i)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==i||(o=!1);o&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:i,prefix:v}})}let T,E;return r.deleteShader(x),r.deleteShader(b),this.getUniforms=function(){return void 0===T&&(T=new yn(r,m)),T},this.getAttributes=function(){return void 0===E&&(E=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r).name;i[n]=t.getAttribLocation(e,n)}return i}(r,m)),E},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=i.shaderName,this.id=bn++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=b,this}function Gn(t,e,i,n,r,o){const s=[],a=n.isWebGL2,l=n.logarithmicDepthBuffer,h=n.floatVertexTextures,u=n.maxVertexUniforms,c=n.vertexTextures;let d=n.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmission","transmissionMap","thicknessMap"];function m(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,e}return{getParameters:function(r,s,f,g,v){const _=g.fog,y=r.isMeshStandardMaterial?g.environment:null,x=e.get(r.envMap||y),b=p[r.type],T=v.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(h)return 1024;{const t=u,i=Math.floor((t-20)/4),n=Math.min(i,e.length);return n<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+n+"."),0):n}}(v):0;let E,S;if(null!==r.precision&&(d=n.getMaxPrecision(r.precision),d!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.")),b){const t=ti[b];E=t.vertexShader,S=t.fragmentShader}else E=r.vertexShader,S=r.fragmentShader;const w=t.getRenderTarget();return{isWebGL2:a,shaderID:b,shaderName:r.type,vertexShader:E,fragmentShader:S,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,instancing:!0===v.isInstancedMesh,instancingColor:!0===v.isInstancedMesh&&null!==v.instanceColor,supportsVertexTextures:c,outputEncoding:null!==w?m(w.texture):t.outputEncoding,map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:m(x),envMapCubeUV:!!x&&(306===x.mapping||307===x.mapping),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmission:!!r.transmission,transmissionMap:!!r.transmissionMap,thicknessMap:!!r.thicknessMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&v.geometry&&v.geometry.attributes.color&&4===v.geometry.attributes.color.itemSize,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap||r.thicknessMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmission||r.transmissionMap||r.thicknessMap||!r.displacementMap),fog:!!_,useFog:r.fog,fogExp2:_&&_.isFogExp2,flatShading:!!r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:l,skinning:!0===v.isSkinnedMesh&&T>0,maxBones:T,useVertexTexture:h,morphTargets:r.morphTargets,morphNormals:r.morphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&f.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||i.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<f.length;t++)i.push(e[f[t]]);i.push(t.outputEncoding),i.push(t.gammaFactor)}return i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=p[t.type];let i;if(e){const t=ti[e];i=De.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new kn(t,i,e,r),s.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=s.indexOf(t);s[e]=s[s.length-1],s.pop(),t.destroy()}},programs:s}}function Hn(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function jn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function zn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Vn(t){const e=[];let i=0;const n=[],r=[],o=[],s={id:-1};function a(n,r,o,a,l,h){let u=e[i];const c=t.get(o);return void 0===u?(u={id:n.id,object:n,geometry:r,material:o,program:c.program||s,groupOrder:a,renderOrder:n.renderOrder,z:l,group:h},e[i]=u):(u.id=n.id,u.object=n,u.geometry=r,u.material=o,u.program=c.program||s,u.groupOrder=a,u.renderOrder=n.renderOrder,u.z=l,u.group=h),i++,u}return{opaque:n,transmissive:r,transparent:o,init:function(){i=0,n.length=0,r.length=0,o.length=0},push:function(t,e,i,s,l,h){const u=a(t,e,i,s,l,h);i.transmission>0?r.push(u):!0===i.transparent?o.push(u):n.push(u)},unshift:function(t,e,i,s,l,h){const u=a(t,e,i,s,l,h);i.transmission>0?r.unshift(u):!0===i.transparent?o.unshift(u):n.unshift(u)},finish:function(){for(let t=i,n=e.length;t<n;t++){const i=e[t];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(t,e){n.length>1&&n.sort(t||jn),r.length>1&&r.sort(e||zn),o.length>1&&o.sort(e||zn)}}}function Xn(t){let e=new WeakMap;return{get:function(i,n){let r;return!1===e.has(i)?(r=new Vn(t),e.set(i,[r])):n>=e.get(i).length?(r=new Vn(t),e.get(i).push(r)):r=e.get(i)[n],r},dispose:function(){e=new WeakMap}}}function Wn(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new M,color:new Zt};break;case"SpotLight":i={position:new M,direction:new M,color:new Zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new M,color:new Zt,distance:0,decay:0};break;case"HemisphereLight":i={direction:new M,skyColor:new Zt,groundColor:new Zt};break;case"RectAreaLight":i={color:new Zt,position:new M,halfWidth:new M,halfHeight:new M}}return t[e.id]=i,i}}}let Yn=0;function qn(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Zn(t,e){const i=new Wn,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new M);const o=new M,s=new rt,a=new rt;return{setup:function(o){let s=0,a=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,c=0,d=0,p=0,f=0,m=0,g=0;o.sort(qn);for(let t=0,e=o.length;t<e;t++){const e=o[t],v=e.color,_=e.intensity,y=e.distance,x=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=v.r*_,a+=v.g*_,l+=v.b*_;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],_);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[h]=i,r.directionalShadowMap[h]=x,r.directionalShadowMatrix[h]=e.shadow.matrix,f++}r.directional[h]=t,h++}else if(e.isSpotLight){const t=i.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(v).multiplyScalar(_),t.distance=y,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.spotShadow[c]=i,r.spotShadowMap[c]=x,r.spotShadowMatrix[c]=e.shadow.matrix,g++}r.spot[c]=t,c++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(v).multiplyScalar(_),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[d]=t,d++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[u]=i,r.pointShadowMap[u]=x,r.pointShadowMatrix[u]=e.shadow.matrix,m++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(_),t.groundColor.copy(e.groundColor).multiplyScalar(_),r.hemi[p]=t,p++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=$e.LTC_FLOAT_1,r.rectAreaLTC2=$e.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=$e.LTC_HALF_1,r.rectAreaLTC2=$e.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=a,r.ambient[2]=l;const v=r.hash;v.directionalLength===h&&v.pointLength===u&&v.spotLength===c&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(r.directional.length=h,r.spot.length=c,r.rectArea.length=d,r.point.length=u,r.hemi.length=p,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=g,v.directionalLength=h,v.pointLength=u,v.spotLength=c,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,r.version=Yn++)},setupView:function(t,e){let i=0,n=0,l=0,h=0,u=0;const c=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(c),i++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(c),l++}else if(d.isRectAreaLight){const t=r.rectArea[h];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),a.identity(),s.copy(d.matrixWorld),s.premultiply(c),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),h++}else if(d.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),n++}else if(d.isHemisphereLight){const t=r.hemi[u];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(c),t.direction.normalize(),u++}}},state:r}}function Jn(t,e){const i=new Zn(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(){i.setup(n)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function Kn(t,e){let i=new WeakMap;return{get:function(n,r=0){let o;return!1===i.has(n)?(o=new Jn(t,e),i.set(n,[o])):r>=i.get(n).length?(o=new Jn(t,e),i.get(n).push(o)):o=i.get(n)[r],o},dispose:function(){i=new WeakMap}}}class Qn extends jt{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,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.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Qn.prototype.isMeshDepthMaterial=!0;class $n extends jt{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new M,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}$n.prototype.isMeshDistanceMaterial=!0;function tr(t,e,i){let n=new qe;const r=new g,o=new g,s=new E,a=[],l=[],h={},u=i.maxTextureSize,c={0:1,1:0,2:2},d=new Fe({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new g},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new de;f.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Ie(f,d),v=this;function _(i,n){const r=e.update(m);d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,d,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,p,m,null)}function y(t){const e=t<<0;let i=a[e];return void 0===i&&(i=new Qn({depthPacking:3201,morphTargets:t}),a[e]=i),i}function x(t){const e=t<<0;let i=l[e];return void 0===i&&(i=new $n({morphTargets:t}),l[e]=i),i}function b(e,i,n,r,o,s,a){let l=null,u=y,d=e.customDepthMaterial;if(!0===r.isPointLight&&(u=x,d=e.customDistanceMaterial),void 0===d){let t=!1;!0===n.morphTargets&&(t=i.morphAttributes&&i.morphAttributes.position&&i.morphAttributes.position.length>0),l=u(t)}else l=d;if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){const t=l.uuid,e=n.uuid;let i=h[t];void 0===i&&(i={},h[t]=i);let r=i[e];void 0===r&&(r=l.clone(),i[e]=r),l=r}return l.visible=n.visible,l.wireframe=n.wireframe,l.side=3===a?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:c[n.side],l.clipShadows=n.clipShadows,l.clippingPlanes=n.clippingPlanes,l.clipIntersection=n.clipIntersection,l.wireframeLinewidth=n.wireframeLinewidth,l.linewidth=n.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=o,l.farDistance=s),l}function T(i,r,o,s,a){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===a)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let l=0,h=e.length;l<h;l++){const h=e[l],u=r[h.materialIndex];if(u&&u.visible){const e=b(i,n,u,s,o.near,o.far,a);t.renderBufferDirect(o,null,n,e,i,h)}}}else if(r.visible){const e=b(i,n,r,s,o.near,o.far,a);t.renderBufferDirect(o,null,n,e,i,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)T(l[t],r,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,i,a){if(!1===v.enabled)return;if(!1===v.autoUpdate&&!1===v.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),h=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,h=e.length;l<h;l++){const h=e[l],c=h.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;r.copy(c.mapSize);const p=c.getFrameExtents();if(r.multiply(p),o.copy(c.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(o.x=Math.floor(u/p.x),r.x=o.x*p.x,c.mapSize.x=o.x),r.y>u&&(o.y=Math.floor(u/p.y),r.y=o.y*p.y,c.mapSize.y=o.y)),null===c.map&&!c.isPointLightShadow&&3===this.type){const t={minFilter:1006,magFilter:1006,format:1023};c.map=new S(r.x,r.y,t),c.map.texture.name=h.name+".shadowMap",c.mapPass=new S(r.x,r.y,t),c.camera.updateProjectionMatrix()}if(null===c.map){const t={minFilter:1003,magFilter:1003,format:1023};c.map=new S(r.x,r.y,t),c.map.texture.name=h.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const f=c.getViewportCount();for(let t=0;t<f;t++){const e=c.getViewport(t);s.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),d.viewport(s),c.updateMatrices(h,t),n=c.getFrustum(),T(i,a,c.camera,h,this.type)}c.isPointLightShadow||3!==this.type||_(c,a),c.needsUpdate=!1}v.needsUpdate=!1,t.setRenderTarget(l,h,c)}}function er(t,e,i){const n=i.isWebGL2;const r=new function(){let e=!1;const i=new E;let n=null;const r=new E(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,o,s,a){!0===a&&(e*=s,n*=s,o*=s),i.set(e,n,o,s),!1===r.equals(i)&&(t.clearColor(e,n,o,s),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},o=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?U(2929):k(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},s=new function(){let e=!1,i=null,n=null,r=null,o=null,s=null,a=null,l=null,h=null;return{setTest:function(t){e||(t?U(2960):k(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,s){n===e&&r===i&&o===s||(t.stencilFunc(e,i,s),n=e,r=i,o=s)},setOp:function(e,i,n){s===e&&a===i&&l===n||(t.stencilOp(e,i,n),s=e,a=i,l=n)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,i=null,n=null,r=null,o=null,s=null,a=null,l=null,h=null}}};let a={},l=null,h={},u=null,c=!1,d=null,p=null,f=null,m=null,g=null,v=null,_=null,y=!1,x=null,b=null,T=null,S=null,w=null;const A=t.getParameter(35661);let M=!1,C=0;const R=t.getParameter(7938);-1!==R.indexOf("WebGL")?(C=parseFloat(/^WebGL (\d)/.exec(R)[1]),M=C>=1):-1!==R.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),M=C>=2);let I=null,P={};const O=t.getParameter(3088),N=t.getParameter(2978),L=(new E).fromArray(O),D=(new E).fromArray(N);function F(e,i,n){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,r);return o}const B={};function U(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function k(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}B[3553]=F(3553,3553,1),B[34067]=F(34067,34069,6),r.setClear(0,0,0,1),o.setClear(1),s.setClear(0),U(2929),o.setFunc(3),z(!1),V(1),U(2884),j(0);const G={100:32774,101:32778,102:32779};if(n)G[103]=32775,G[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(G[103]=t.MIN_EXT,G[104]=t.MAX_EXT)}const H={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function j(e,i,n,r,o,s,a,l){if(0!==e){if(!1===c&&(U(3042),c=!0),5===e)o=o||i,s=s||n,a=a||r,i===p&&o===g||(t.blendEquationSeparate(G[i],G[o]),p=i,g=o),n===f&&r===m&&s===v&&a===_||(t.blendFuncSeparate(H[n],H[r],H[s],H[a]),f=n,m=r,v=s,_=a),d=e,y=null;else if(e!==d||l!==y){if(100===p&&100===g||(t.blendEquation(32774),p=100,g=100),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,m=null,v=null,_=null,d=e,y=l}}else!0===c&&(k(3042),c=!1)}function z(e){x!==e&&(e?t.frontFace(2304):t.frontFace(2305),x=e)}function V(e){0!==e?(U(2884),e!==b&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):k(2884),b=e}function X(e,i,n){e?(U(32823),S===i&&w===n||(t.polygonOffset(i,n),S=i,w=n)):k(32823)}function W(e){void 0===e&&(e=33984+A-1),I!==e&&(t.activeTexture(e),I=e)}return{buffers:{color:r,depth:o,stencil:s},enable:U,disable:k,bindFramebuffer:function(e,i){return null===i&&null!==l&&(i=l),h[e]!==i&&(t.bindFramebuffer(e,i),h[e]=i,n&&(36009===e&&(h[36160]=i),36160===e&&(h[36009]=i)),!0)},bindXRFramebuffer:function(e){e!==l&&(t.bindFramebuffer(36160,e),l=e)},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:j,setMaterial:function(t,e){2===t.side?k(2884):U(2884);let i=1===t.side;e&&(i=!i),z(i),1===t.blending&&!1===t.transparent?j(0):j(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),r.setMask(t.colorWrite);const n=t.stencilWrite;s.setTest(n),n&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),X(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?U(32926):k(32926)},setFlipSided:z,setCullFace:V,setLineWidth:function(e){e!==T&&(M&&t.lineWidth(e),T=e)},setPolygonOffset:X,setScissorTest:function(t){t?U(3089):k(3089)},activeTexture:W,bindTexture:function(e,i){null===I&&W();let n=P[I];void 0===n&&(n={type:void 0,texture:void 0},P[I]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||B[e]),n.type=e,n.texture=i)},unbindTexture:function(){const e=P[I];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===L.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),L.copy(e))},viewport:function(e){!1===D.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),D.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===n&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},I=null,P={},l=null,h={},u=null,c=!1,d=null,p=null,f=null,m=null,g=null,v=null,_=null,y=!1,x=null,b=null,T=null,S=null,w=null,L.set(0,0,t.canvas.width,t.canvas.height),D.set(0,0,t.canvas.width,t.canvas.height),r.reset(),o.reset(),s.reset()}}}function ir(t,e,i,n,r,o,s){const a=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,u=r.maxTextureSize,c=r.maxSamples,d=new WeakMap;let p,g=!1;try{g="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function v(t,e){return g?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function _(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?m:Math.floor,o=n(r*t.width),s=n(r*t.height);void 0===p&&(p=v(o,s));const a=i?v(o,s):p;a.width=o,a.height=s;return a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function y(t){return f(t.width)&&f(t.height)}function x(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function b(e,i,r,o,s=1){t.generateMipmap(e);n.get(i).__maxMipLevel=Math.log2(Math.max(r,o,s))}function T(i,n,r){if(!1===a)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;return 6403===n&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===n&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===n&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function E(t){return 1003===t||1004===t||1005===t?9728:9729}function S(e){const i=e.target;i.removeEventListener("dispose",S),function(e){const i=n.get(e);if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture),n.remove(e)}(i),i.isVideoTexture&&d.delete(i),s.memory.textures--}function w(e){const i=e.target;i.removeEventListener("dispose",w),function(e){const i=e.texture,r=n.get(e),o=n.get(i);if(!e)return;void 0!==o.__webglTexture&&(t.deleteTexture(o.__webglTexture),s.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),s.memory.textures--),n.remove(i[e])}n.remove(i),n.remove(e)}(i)}let A=0;function M(t,e){const r=n.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const i=t.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==i.complete)return void N(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function C(e,r){const s=n.get(e);e.version>0&&s.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;O(e,n),i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const s=n&&(n.isCompressedTexture||n.image[0].isCompressedTexture),l=n.image[0]&&n.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=s||l?l?n.image[t].image:n.image[t]:_(n.image[t],!1,!0,h);const c=u[0],d=y(c)||a,p=o.convert(n.format),f=o.convert(n.type),m=T(n.internalFormat,p,f);let g;if(P(34067,n,d),s){for(let t=0;t<6;t++){g=u[t].mipmaps;for(let e=0;e<g.length;e++){const r=g[e];1023!==n.format&&1022!==n.format?null!==p?i.compressedTexImage2D(34069+t,e,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+t,e,m,r.width,r.height,0,p,f,r.data)}}e.__maxMipLevel=g.length-1}else{g=n.mipmaps;for(let t=0;t<6;t++)if(l){i.texImage2D(34069+t,0,m,u[t].width,u[t].height,0,p,f,u[t].data);for(let e=0;e<g.length;e++){const n=g[e].image[t].image;i.texImage2D(34069+t,e+1,m,n.width,n.height,0,p,f,n.data)}}else{i.texImage2D(34069+t,0,m,p,f,u[t]);for(let e=0;e<g.length;e++){const n=g[e];i.texImage2D(34069+t,e+1,m,p,f,n.image[t])}}e.__maxMipLevel=g.length}x(n,d)&&b(34067,n,c.width,c.height);e.__version=n.version,n.onUpdate&&n.onUpdate(n)}(s,e,r):(i.activeTexture(33984+r),i.bindTexture(34067,s.__webglTexture))}const R={1e3:10497,1001:33071,1002:33648},I={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function P(i,o,s){if(s?(t.texParameteri(i,10242,R[o.wrapS]),t.texParameteri(i,10243,R[o.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,R[o.wrapR]),t.texParameteri(i,10240,I[o.magFilter]),t.texParameteri(i,10241,I[o.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),1001===o.wrapS&&1001===o.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,E(o.magFilter)),t.texParameteri(i,10241,E(o.minFilter)),1003!==o.minFilter&&1006!==o.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(1015===o.type&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&1016===o.type&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function O(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",S),e.__webglTexture=t.createTexture(),s.memory.textures++)}function N(e,n,r){let s=3553;n.isDataTexture2DArray&&(s=35866),n.isDataTexture3D&&(s=32879),O(e,n),i.activeTexture(33984+r),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===y(n.image),h=_(n.image,l,!1,u),c=y(h)||a,d=o.convert(n.format);let p,f=o.convert(n.type),m=T(n.internalFormat,d,f);P(s,n,c);const g=n.mipmaps;if(n.isDepthTexture)m=6402,a?m=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===m&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,f=o.convert(n.type)),1027===n.format&&6402===m&&(m=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,f=o.convert(n.type))),i.texImage2D(3553,0,m,h.width,h.height,0,d,f,null);else if(n.isDataTexture)if(g.length>0&&c){for(let t=0,e=g.length;t<e;t++)p=g[t],i.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);n.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else i.texImage2D(3553,0,m,h.width,h.height,0,d,f,h.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(let t=0,e=g.length;t<e;t++)p=g[t],1023!==n.format&&1022!==n.format?null!==d?i.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=g.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,m,h.width,h.height,h.depth,0,d,f,h.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,m,h.width,h.height,h.depth,0,d,f,h.data),e.__maxMipLevel=0;else if(g.length>0&&c){for(let t=0,e=g.length;t<e;t++)p=g[t],i.texImage2D(3553,t,m,d,f,p);n.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else i.texImage2D(3553,0,m,d,f,h),e.__maxMipLevel=0;x(n,c)&&b(s,n,h.width,h.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function L(e,r,s,a,l){const h=o.convert(s.format),u=o.convert(s.type),c=T(s.internalFormat,h,u);32879===l||35866===l?i.texImage3D(l,0,c,r.width,r.height,r.depth,0,h,u,null):i.texImage2D(l,0,c,r.width,r.height,0,h,u,null),i.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,a,l,n.get(s).__webglTexture,0),i.bindFramebuffer(36160,null)}function D(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n){const e=i.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const n=B(i);t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){const e=B(i);t.renderbufferStorageMultisample(36161,e,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture[0]:i.texture,r=o.convert(e.format),s=o.convert(e.type),a=T(e.internalFormat,r,s);if(n){const e=B(i);t.renderbufferStorageMultisample(36161,e,a,i.width,i.height)}else t.renderbufferStorage(36161,a,i.width,i.height)}t.bindRenderbuffer(36161,null)}function F(e){const r=n.get(e),o=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(o)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),M(r.depthTexture,0);const o=n.get(r.depthTexture).__webglTexture;if(1026===r.depthTexture.format)t.framebufferTexture2D(36160,36096,3553,o,0);else{if(1027!==r.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,o,0)}}(r.__webglFramebuffer,e)}else if(o){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(36160,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),D(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),D(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(36160,null)}function B(t){return a&&t.isWebGLMultisampleRenderTarget?Math.min(c,t.samples):0}let U=!1,k=!1;this.allocateTextureUnit=function(){const t=A;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),A+=1,t},this.resetTextureUnits=function(){A=0},this.setTexture2D=M,this.setTexture2DArray=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?N(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?N(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=C,this.setupRenderTarget=function(e){const l=e.texture,h=n.get(e),u=n.get(l);e.addEventListener("dispose",w),!0!==e.isWebGLMultipleRenderTargets&&(u.__webglTexture=t.createTexture(),u.__version=l.version,s.memory.textures++);const c=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,m=y(e)||a;if(!a||1022!==l.format||1015!==l.type&&1016!==l.type||(l.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){h.__webglFramebuffer=[];for(let e=0;e<6;e++)h.__webglFramebuffer[e]=t.createFramebuffer()}else if(h.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const i=e.texture;for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(p)if(a){h.__webglMultisampledFramebuffer=t.createFramebuffer(),h.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,h.__webglColorRenderbuffer);const n=o.convert(l.format),r=o.convert(l.type),s=T(l.internalFormat,n,r),a=B(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(h.__webglDepthRenderbuffer=t.createRenderbuffer(),D(h.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){i.bindTexture(34067,u.__webglTexture),P(34067,l,m);for(let t=0;t<6;t++)L(h.__webglFramebuffer[t],e,l,36064,34069+t);x(l,m)&&b(34067,l,e.width,e.height),i.bindTexture(34067,null)}else if(d){const t=e.texture;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=n.get(o);i.bindTexture(3553,s.__webglTexture),P(3553,o,m),L(h.__webglFramebuffer,e,o,36064+r,3553),x(o,m)&&b(3553,o,e.width,e.height)}i.bindTexture(3553,null)}else{let t=3553;if(f)if(a){t=l.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");i.bindTexture(t,u.__webglTexture),P(t,l,m),L(h.__webglFramebuffer,e,l,36064,t),x(l,m)&&b(t,l,e.width,e.height,e.depth),i.bindTexture(t,null)}e.depthBuffer&&F(e)},this.updateRenderTargetMipmap=function(t){const e=y(t)||a,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let o=0,s=r.length;o<s;o++){const s=r[o];if(x(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=n.get(s).__webglTexture;i.bindTexture(e,r),b(e,s,t.width,t.height),i.bindTexture(e,null)}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const r=e.width,o=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024);const a=n.get(e);i.bindFramebuffer(36008,a.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,a.__webglFramebuffer),t.blitFramebuffer(0,0,r,o,0,0,r,o,s,9728),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,a.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===U&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),U=!0),t=t.texture),M(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===k&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),k=!0),t=t.texture),C(t,e)}}function nr(t,e,i){const n=i.isWebGL2;return{convert:function(t){let i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:(i=e.get("OES_texture_half_float"),null!==i?i.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return i=e.get("WEBGL_compressed_texture_etc1"),null!==i?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(i=e.get("WEBGL_compressed_texture_etc"),null!==i)){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(i=e.get("WEBGL_compressed_texture_astc"),null!==i?t:null):36492===t?(i=e.get("EXT_texture_compression_bptc"),null!==i?t:null):1020===t?n?34042:(i=e.get("WEBGL_depth_texture"),null!==i?i.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class rr extends Ue{constructor(t=[]){super(),this.cameras=t}}rr.prototype.isArrayCamera=!0;class or extends Rt{constructor(){super(),this.type="Group"}}or.prototype.isGroup=!0;const sr={type:"move"};class ar{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new or,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new or,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new or,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(sr))),l&&t.hand){o=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i);if(void 0===l.joints[n.jointName]){const t=new or;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[n.jointName]=t,l.add(t)}const r=l.joints[n.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=n.position.distanceTo(r.position),a=.02,h=.005;l.inputState.pinching&&s>a+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=a-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==s&&(s.visible=null!==n),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),this}}class lr extends s{constructor(t,e){super();const i=this,n=t.state;let r=null,o=1,s=null,a="local-floor",l=null,h=null,u=null,c=null;const d=[],p=new Map,f=new Ue;f.layers.enable(1),f.viewport=new E;const m=new Ue;m.layers.enable(2),m.viewport=new E;const g=[f,m],v=new rr;v.layers.enable(1),v.layers.enable(2);let _=null,y=null;function x(t){const e=p.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function b(){p.forEach((function(t,e){t.disconnect(e)})),p.clear(),_=null,y=null,n.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),R.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function T(t){const e=r.inputSources;for(let t=0;t<d.length;t++)p.set(e[t],d[t]);for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=p.get(i);n&&(n.dispatchEvent({type:"disconnected",data:i}),p.delete(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e],n=p.get(i);n&&n.dispatchEvent({type:"connected",data:i})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=d[t];return void 0===e&&(e=new ar,d[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=d[t];return void 0===e&&(e=new ar,d[t]=e),e.getGripSpace()},this.getHand=function(t){let e=d[t];return void 0===e&&(e=new ar,d[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getSession=function(){return r},this.setSession=async function(t){if(r=t,null!==r){r.addEventListener("select",x),r.addEventListener("selectstart",x),r.addEventListener("selectend",x),r.addEventListener("squeeze",x),r.addEventListener("squeezestart",x),r.addEventListener("squeezeend",x),r.addEventListener("end",b),r.addEventListener("inputsourceschange",T);const t=e.getContextAttributes();if(!0!==t.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers){const i={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:o},n=new XRWebGLLayer(r,e,i);r.updateRenderState({baseLayer:n})}else{let i=0;t.depth&&(i=t.stencil?34041:6402);const n={colorFormat:t.alpha?6408:6407,depthFormat:i,scaleFactor:o};h=new XRWebGLBinding(r,e),c=h.createProjectionLayer(n),u=e.createFramebuffer(),r.updateRenderState({layers:[c]})}s=await r.requestReferenceSpace(a),R.setContext(r),R.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};const S=new M,w=new M;function A(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===r)return;v.near=m.near=f.near=t.near,v.far=m.far=f.far=t.far,_===v.near&&y===v.far||(r.updateRenderState({depthNear:v.near,depthFar:v.far}),_=v.near,y=v.far);const e=t.parent,i=v.cameras;A(v,e);for(let t=0;t<i.length;t++)A(i[t],e);v.matrixWorld.decompose(v.position,v.quaternion,v.scale),t.position.copy(v.position),t.quaternion.copy(v.quaternion),t.scale.copy(v.scale),t.matrix.copy(v.matrix),t.matrixWorld.copy(v.matrixWorld);const n=t.children;for(let t=0,e=n.length;t<e;t++)n[t].updateMatrixWorld(!0);2===i.length?function(t,e,i){S.setFromMatrixPosition(e.matrixWorld),w.setFromMatrixPosition(i.matrixWorld);const n=S.distanceTo(w),r=e.projectionMatrix.elements,o=i.projectionMatrix.elements,s=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],u=(r[8]-1)/r[0],c=(o[8]+1)/o[0],d=s*u,p=s*c,f=n/(-u+c),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+f,v=a+f,_=d-m,y=p+(n-m),x=l*a/v*g,b=h*a/v*g;t.projectionMatrix.makePerspective(_,y,x,b,g,v)}(v,f,m):v.projectionMatrix.copy(f.projectionMatrix)},this.getCamera=function(){return v};let C=null;const R=new Ze;R.setAnimationLoop((function(t,i){if(l=i.getViewerPose(s),null!==l){const t=l.views,i=r.renderState.baseLayer;void 0===r.renderState.layers&&n.bindXRFramebuffer(i.framebuffer);let o=!1;t.length!==v.cameras.length&&(v.cameras.length=0,o=!0);for(let s=0;s<t.length;s++){const a=t[s];let l=null;if(void 0===r.renderState.layers)l=i.getViewport(a);else{const t=h.getViewSubImage(c,a);n.bindXRFramebuffer(u),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0),void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,36096,3553,t.depthStencilTexture,0),l=t.viewport}const d=g[s];d.matrix.fromArray(a.transform.matrix),d.projectionMatrix.fromArray(a.projectionMatrix),d.viewport.set(l.x,l.y,l.width,l.height),0===s&&v.matrix.copy(d.matrix),!0===o&&v.cameras.push(d)}}const o=r.inputSources;for(let t=0;t<d.length;t++){const e=d[t],n=o[t];e.update(n,i,s)}C&&C(t,i)})),this.setAnimationLoop=function(t){C=t},this.dispose=function(){}}}function hr(t){function e(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map),i.alphaMap&&(e.alphaMap.value=i.alphaMap),i.specularMap&&(e.specularMap.value=i.specularMap);const n=t.get(i).envMap;if(n){e.envMap.value=n,e.flipEnvMap.value=n.isCubeTexture&&n._needsFlipEnvMap?-1:1,e.reflectivity.value=i.reflectivity,e.refractionRatio.value=i.refractionRatio;const r=t.get(n).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,o;i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap&&(r=i.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),i.aoMap?o=i.aoMap:i.lightMap&&(o=i.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function i(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap),i.bumpMap&&(e.bumpMap.value=i.bumpMap,e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias);t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,o,s){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshPhongMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshStandardMaterial?(e(t,n),n.isMeshPhysicalMaterial?function(t,e,n){i(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap);e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate());t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap);e.transmission>0&&(t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height));t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap);t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)}(t,n,s):i(t,n)):n.isMeshMatcapMaterial?(e(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?(e(t,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,o):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function ur(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let c=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const m=this;let g=!1,v=0,_=0,y=null,x=-1,b=null;const T=new E,A=new E;let C=null,R=e.width,I=e.height,P=1,O=null,N=null;const L=new E(0,0,R,I),D=new E(0,0,R,I);let F=!1;const B=[],U=new qe;let k=!1,G=!1,H=null;const j=new rt,z=new M,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function X(){return null===y?P:1}let W,Y,q,Z,J,K,Q,$,tt,et,it,nt,ot,st,at,lt,ht,ut,ct,dt,pt,ft,mt=i;function gt(t,i){for(let n=0;n<t.length;n++){const r=t[n],o=e.getContext(r,i);if(null!==o)return o}return null}try{const t={alpha:n,depth:r,stencil:o,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if(e.addEventListener("webglcontextlost",yt,!1),e.addEventListener("webglcontextrestored",xt,!1),null===mt){const e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),mt=gt(e,t),null===mt)throw gt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===mt.getShaderPrecisionFormat&&(mt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function vt(){W=new ai(mt),Y=new ri(mt,W,t),W.init(Y),pt=new nr(mt,W,Y),q=new er(mt,W,Y),B[0]=1029,Z=new ui(mt),J=new Hn,K=new ir(mt,W,q,J,Y,pt,Z),Q=new si(m),$=new Je(mt,Y),ft=new ii(mt,W,$,Y),tt=new li(mt,$,Z,ft),et=new fi(mt,tt,$,Z),ut=new pi(mt),at=new oi(J),it=new Gn(m,Q,W,Y,ft,at),nt=new hr(J),ot=new Xn(J),st=new Kn(W,Y),ht=new ei(m,Q,q,et,a),lt=new tr(m,et,Y),ct=new ni(mt,W,Z,Y),dt=new hi(mt,W,Z,Y),Z.programs=it.programs,m.capabilities=Y,m.extensions=W,m.properties=J,m.renderLists=ot,m.shadowMap=lt,m.state=q,m.info=Z}vt();const _t=new lr(m,mt);function yt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function xt(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const t=Z.autoReset,e=lt.enabled,i=lt.autoUpdate,n=lt.needsUpdate,r=lt.type;vt(),Z.autoReset=t,lt.enabled=e,lt.autoUpdate=i,lt.needsUpdate=n,lt.type=r}function bt(t){const e=t.target;e.removeEventListener("dispose",bt),function(t){(function(t){const e=J.get(t).programs;void 0!==e&&e.forEach((function(t){it.releaseProgram(t)}))})(t),J.remove(t)}(e)}this.xr=_t,this.getContext=function(){return mt},this.getContextAttributes=function(){return mt.getContextAttributes()},this.forceContextLoss=function(){const t=W.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=W.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(R,I,!1))},this.getSize=function(t){return t.set(R,I)},this.setSize=function(t,i,n){_t.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=t,I=i,e.width=Math.floor(t*P),e.height=Math.floor(i*P),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return t.set(R*P,I*P).floor()},this.setDrawingBufferSize=function(t,i,n){R=t,I=i,P=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return t.copy(T)},this.getViewport=function(t){return t.copy(L)},this.setViewport=function(t,e,i,n){t.isVector4?L.set(t.x,t.y,t.z,t.w):L.set(t,e,i,n),q.viewport(T.copy(L).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(D)},this.setScissor=function(t,e,i,n){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,i,n),q.scissor(A.copy(D).multiplyScalar(P).floor())},this.getScissorTest=function(){return F},this.setScissorTest=function(t){q.setScissorTest(F=t)},this.setOpaqueSort=function(t){O=t},this.setTransparentSort=function(t){N=t},this.getClearColor=function(t){return t.copy(ht.getClearColor())},this.setClearColor=function(){ht.setClearColor.apply(ht,arguments)},this.getClearAlpha=function(){return ht.getClearAlpha()},this.setClearAlpha=function(){ht.setClearAlpha.apply(ht,arguments)},this.clear=function(t,e,i){let n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),mt.clear(n)},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(){e.removeEventListener("webglcontextlost",yt,!1),e.removeEventListener("webglcontextrestored",xt,!1),ot.dispose(),st.dispose(),J.dispose(),Q.dispose(),et.dispose(),ft.dispose(),_t.dispose(),_t.removeEventListener("sessionstart",Et),_t.removeEventListener("sessionend",St),H&&(H.dispose(),H=null),wt.stop()},this.renderBufferImmediate=function(t,e){ft.initAttributes();const i=J.get(t);t.hasPositions&&!i.position&&(i.position=mt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=mt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=mt.createBuffer()),t.hasColors&&!i.color&&(i.color=mt.createBuffer());const n=e.getAttributes();t.hasPositions&&(mt.bindBuffer(34962,i.position),mt.bufferData(34962,t.positionArray,35048),ft.enableAttribute(n.position),mt.vertexAttribPointer(n.position,3,5126,!1,0,0)),t.hasNormals&&(mt.bindBuffer(34962,i.normal),mt.bufferData(34962,t.normalArray,35048),ft.enableAttribute(n.normal),mt.vertexAttribPointer(n.normal,3,5126,!1,0,0)),t.hasUvs&&(mt.bindBuffer(34962,i.uv),mt.bufferData(34962,t.uvArray,35048),ft.enableAttribute(n.uv),mt.vertexAttribPointer(n.uv,2,5126,!1,0,0)),t.hasColors&&(mt.bindBuffer(34962,i.color),mt.bufferData(34962,t.colorArray,35048),ft.enableAttribute(n.color),mt.vertexAttribPointer(n.color,3,5126,!1,0,0)),ft.disableUnusedAttributes(),mt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,o){null===e&&(e=V);const s=r.isMesh&&r.matrixWorld.determinant()<0,a=It(t,e,n,r);q.setMaterial(n,s);let l=i.index;const h=i.attributes.position;if(null===l){if(void 0===h||0===h.count)return}else if(0===l.count)return;let u,c=1;!0===n.wireframe&&(l=tt.getWireframeAttribute(i),c=2),(n.morphTargets||n.morphNormals)&&ut.update(r,i,n,a),ft.setup(r,n,a,i,l);let d=ct;null!==l&&(u=$.get(l),d=dt,d.setIndex(u));const p=null!==l?l.count:h.count,f=i.drawRange.start*c,m=i.drawRange.count*c,g=null!==o?o.start*c:0,v=null!==o?o.count*c:1/0,_=Math.max(f,g),y=Math.min(p,f+m,g+v)-1,x=Math.max(0,y-_+1);if(0!==x){if(r.isMesh)!0===n.wireframe?(q.setLineWidth(n.wireframeLinewidth*X()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),q.setLineWidth(t*X()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(_,x,r.count);else if(i.isInstancedBufferGeometry){const t=Math.min(i.instanceCount,i._maxInstanceCount);d.renderInstances(_,x,t)}else d.render(_,x)}},this.compile=function(t,e){d=st.get(t),d.init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(),t.traverse((function(e){const i=e.material;if(i)if(Array.isArray(i))for(let n=0;n<i.length;n++){Ct(i[n],t,e)}else Ct(i,t,e)}))};let Tt=null;function Et(){wt.stop()}function St(){wt.start()}const wt=new Ze;function At(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=o.object,a=o.geometry,l=null===n?o.material:n,h=o.group;if(i.isArrayCamera){const t=i.cameras;for(let i=0,n=t.length;i<n;i++){const n=t[i];s.layers.test(n.layers)&&(q.viewport(T.copy(n.viewport)),d.setupLightsView(n),Mt(s,e,n,a,l,h))}}else Mt(s,e,i,a,l,h)}}function Mt(t,e,i,n,r,o){if(t.onBeforeRender(m,e,i,n,r,o),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const n=It(i,e,r,t);q.setMaterial(r),ft.reset(),function(t,e){t.render((function(t){m.renderBufferImmediate(t,e)}))}(t,n)}else!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,m.renderBufferDirect(i,e,n,r,t,o),r.side=0,r.needsUpdate=!0,m.renderBufferDirect(i,e,n,r,t,o),r.side=2):m.renderBufferDirect(i,e,n,r,t,o);t.onAfterRender(m,e,i,n,r,o)}function Ct(t,e,i){!0!==e.isScene&&(e=V);const n=J.get(t),r=d.state.lights,o=d.state.shadowsArray,s=r.state.version,a=it.getParameters(t,r.state,o,e,i),l=it.getProgramCacheKey(a);let h=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=Q.get(t.envMap||n.environment),void 0===h&&(t.addEventListener("dispose",bt),h=new Map,n.programs=h);let u=h.get(l);if(void 0!==u){if(n.currentProgram===u&&n.lightsStateVersion===s)return Rt(t,a),u}else a.uniforms=it.getUniforms(t),t.onBuild(a,m),t.onBeforeCompile(a,m),u=it.acquireProgram(a,l),h.set(l,u),n.uniforms=a.uniforms;const c=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=at.uniform),Rt(t,a),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=s,n.needsLights&&(c.ambientLightColor.value=r.state.ambient,c.lightProbe.value=r.state.probe,c.directionalLights.value=r.state.directional,c.directionalLightShadows.value=r.state.directionalShadow,c.spotLights.value=r.state.spot,c.spotLightShadows.value=r.state.spotShadow,c.rectAreaLights.value=r.state.rectArea,c.ltc_1.value=r.state.rectAreaLTC1,c.ltc_2.value=r.state.rectAreaLTC2,c.pointLights.value=r.state.point,c.pointLightShadows.value=r.state.pointShadow,c.hemisphereLights.value=r.state.hemi,c.directionalShadowMap.value=r.state.directionalShadowMap,c.directionalShadowMatrix.value=r.state.directionalShadowMatrix,c.spotShadowMap.value=r.state.spotShadowMap,c.spotShadowMatrix.value=r.state.spotShadowMatrix,c.pointShadowMap.value=r.state.pointShadowMap,c.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=u.getUniforms(),f=yn.seqWithValue(p.seq,c);return n.currentProgram=u,n.uniformsList=f,u}function Rt(t,e){const i=J.get(t);i.outputEncoding=e.outputEncoding,i.instancing=e.instancing,i.skinning=e.skinning,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas}function It(t,e,i,n){!0!==e.isScene&&(e=V),K.resetTextureUnits();const r=e.fog,o=i.isMeshStandardMaterial?e.environment:null,s=null===y?m.outputEncoding:y.texture.encoding,a=Q.get(i.envMap||o),l=!0===i.vertexColors&&n.geometry&&n.geometry.attributes.color&&4===n.geometry.attributes.color.itemSize,h=J.get(i),u=d.state.lights;if(!0===k&&(!0===G||t!==b)){const e=t===b&&i.id===x;at.setState(i,t,e)}let c=!1;i.version===h.__version?h.needsLights&&h.lightsStateVersion!==u.state.version||h.outputEncoding!==s||n.isInstancedMesh&&!1===h.instancing?c=!0:n.isInstancedMesh||!0!==h.instancing?n.isSkinnedMesh&&!1===h.skinning?c=!0:n.isSkinnedMesh||!0!==h.skinning?h.envMap!==a||i.fog&&h.fog!==r?c=!0:void 0===h.numClippingPlanes||h.numClippingPlanes===at.numPlanes&&h.numIntersection===at.numIntersection?h.vertexAlphas!==l&&(c=!0):c=!0:c=!0:c=!0:(c=!0,h.__version=i.version);let p=h.currentProgram;!0===c&&(p=Ct(i,e,n));let f=!1,g=!1,v=!1;const _=p.getUniforms(),T=h.uniforms;if(q.useProgram(p.program)&&(f=!0,g=!0,v=!0),i.id!==x&&(x=i.id,g=!0),f||b!==t){if(_.setValue(mt,"projectionMatrix",t.projectionMatrix),Y.logarithmicDepthBuffer&&_.setValue(mt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),b!==t&&(b=t,g=!0,v=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=_.map.cameraPosition;void 0!==e&&e.setValue(mt,z.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&_.setValue(mt,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||n.isSkinnedMesh)&&_.setValue(mt,"viewMatrix",t.matrixWorldInverse)}if(n.isSkinnedMesh){_.setOptional(mt,n,"bindMatrix"),_.setOptional(mt,n,"bindMatrixInverse");const t=n.skeleton;t&&(Y.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),_.setValue(mt,"boneTexture",t.boneTexture,K),_.setValue(mt,"boneTextureSize",t.boneTextureSize)):_.setOptional(mt,t,"boneMatrices"))}var E,S;return(g||h.receiveShadow!==n.receiveShadow)&&(h.receiveShadow=n.receiveShadow,_.setValue(mt,"receiveShadow",n.receiveShadow)),g&&(_.setValue(mt,"toneMappingExposure",m.toneMappingExposure),h.needsLights&&(S=v,(E=T).ambientLightColor.needsUpdate=S,E.lightProbe.needsUpdate=S,E.directionalLights.needsUpdate=S,E.directionalLightShadows.needsUpdate=S,E.pointLights.needsUpdate=S,E.pointLightShadows.needsUpdate=S,E.spotLights.needsUpdate=S,E.spotLightShadows.needsUpdate=S,E.rectAreaLights.needsUpdate=S,E.hemisphereLights.needsUpdate=S),r&&i.fog&&nt.refreshFogUniforms(T,r),nt.refreshMaterialUniforms(T,i,P,I,H),yn.upload(mt,h.uniformsList,T,K)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(yn.upload(mt,h.uniformsList,T,K),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&_.setValue(mt,"center",n.center),_.setValue(mt,"modelViewMatrix",n.modelViewMatrix),_.setValue(mt,"normalMatrix",n.normalMatrix),_.setValue(mt,"modelMatrix",n.matrixWorld),p}wt.setAnimationLoop((function(t){Tt&&Tt(t)})),"undefined"!=typeof window&&wt.setContext(window),this.setAnimationLoop=function(t){Tt=t,_t.setAnimationLoop(t),null===t?wt.stop():wt.start()},_t.addEventListener("sessionstart",Et),_t.addEventListener("sessionend",St),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===_t.enabled&&!0===_t.isPresenting&&(!0===_t.cameraAutoUpdate&&_t.updateCamera(e),e=_t.getCamera()),!0===t.isScene&&t.onBeforeRender(m,t,e,y),d=st.get(t,f.length),d.init(),f.push(d),j.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),U.setFromProjectionMatrix(j),G=this.localClippingEnabled,k=at.init(this.clippingPlanes,G,e),c=ot.get(t,p.length),c.init(),p.push(c),function t(e,i,n,r){if(!1===e.visible)return;if(e.layers.test(i.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(i);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||U.intersectsSprite(e)){r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j);const t=et.update(e),i=e.material;i.visible&&c.push(e,t,i,n,z.z,null)}}else if(e.isImmediateRenderObject)r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j),c.push(e,null,e.material,n,z.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==Z.render.frame&&(e.skeleton.update(),e.skeleton.frame=Z.render.frame),!e.frustumCulled||U.intersectsObject(e))){r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j);const t=et.update(e),i=e.material;if(Array.isArray(i)){const r=t.groups;for(let o=0,s=r.length;o<s;o++){const s=r[o],a=i[s.materialIndex];a&&a.visible&&c.push(e,t,a,n,z.z,s)}}else i.visible&&c.push(e,t,i,n,z.z,null)}const o=e.children;for(let e=0,s=o.length;e<s;e++)t(o[e],i,n,r)}(t,e,0,m.sortObjects),c.finish(),!0===m.sortObjects&&c.sort(O,N),!0===k&&at.beginShadows();const i=d.state.shadowsArray;lt.render(i,t,e),d.setupLights(),d.setupLightsView(e),!0===k&&at.endShadows(),!0===this.info.autoReset&&this.info.reset(),ht.render(c,t);const n=c.opaque,r=c.transmissive,o=c.transparent;n.length>0&&At(n,t,e),r.length>0&&function(t,e,i,n){if(null===H){const t=!0===s&&!0===Y.isWebGL2;H=new(t?w:S)(1024,1024,{generateMipmaps:!0,type:null!==pt.convert(1016)?1016:1009,minFilter:1008,magFilter:1003,wrapS:1001,wrapT:1001})}const r=m.getRenderTarget();m.setRenderTarget(H),m.clear();const o=m.toneMapping;m.toneMapping=0,At(t,i,n),m.toneMapping=o,K.updateMultisampleRenderTarget(H),K.updateRenderTargetMipmap(H),m.setRenderTarget(r),At(e,i,n)}(n,r,t,e),o.length>0&&At(o,t,e),null!==y&&(K.updateMultisampleRenderTarget(y),K.updateRenderTargetMipmap(y)),!0===t.isScene&&t.onAfterRender(m,t,e),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),ft.resetDefaultState(),x=-1,b=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),c=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return y},this.setRenderTarget=function(t,e=0,i=0){y=t,v=e,_=i,t&&void 0===J.get(t).__webglFramebuffer&&K.setupRenderTarget(t);let n=null,r=!1,o=!1;if(t){const i=t.texture;(i.isDataTexture3D||i.isDataTexture2DArray)&&(o=!0);const s=J.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=s[e],r=!0):n=t.isWebGLMultisampleRenderTarget?J.get(t).__webglMultisampledFramebuffer:s,T.copy(t.viewport),A.copy(t.scissor),C=t.scissorTest}else T.copy(L).multiplyScalar(P).floor(),A.copy(D).multiplyScalar(P).floor(),C=F;if(q.bindFramebuffer(36160,n)&&Y.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const i=t.texture;if(B.length!==i.length||36064!==B[0]){for(let t=0,e=i.length;t<e;t++)B[t]=36064+t;B.length=i.length,e=!0}}else 1===B.length&&36064===B[0]||(B[0]=36064,B.length=1,e=!0);else 1===B.length&&1029===B[0]||(B[0]=1029,B.length=1,e=!0);e&&(Y.isWebGL2?mt.drawBuffers(B):W.get("WEBGL_draw_buffers").drawBuffersWEBGL(B))}if(q.viewport(T),q.scissor(A),q.setScissorTest(C),r){const n=J.get(t.texture);mt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(o){const n=J.get(t.texture),r=e||0;mt.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}},this.readRenderTargetPixels=function(t,e,i,n,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=J.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){q.bindFramebuffer(36160,a);try{const s=t.texture,a=s.format,l=s.type;if(1023!==a&&pt.convert(a)!==mt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=1016===l&&(W.has("EXT_color_buffer_half_float")||Y.isWebGL2&&W.has("EXT_color_buffer_float"));if(!(1009===l||pt.convert(l)===mt.getParameter(35738)||1015===l&&(Y.isWebGL2||W.has("OES_texture_float")||W.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===mt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&mt.readPixels(e,i,n,r,pt.convert(a),pt.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==y?J.get(y).__webglFramebuffer:null;q.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),o=Math.floor(e.image.height*n);let s=pt.convert(e.format);Y.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),K.setTexture2D(e,0),mt.copyTexImage2D(3553,i,s,t.x,t.y,r,o,0),q.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,o=e.image.height,s=pt.convert(i.format),a=pt.convert(i.type);K.setTexture2D(i,0),mt.pixelStorei(37440,i.flipY),mt.pixelStorei(37441,i.premultiplyAlpha),mt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?mt.texSubImage2D(3553,n,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?mt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):mt.texSubImage2D(3553,n,t.x,t.y,s,a,e.image),0===n&&i.generateMipmaps&&mt.generateMipmap(3553),q.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,l=pt.convert(n.format),h=pt.convert(n.type);let u;if(n.isDataTexture3D)K.setTexture3D(n,0),u=32879;else{if(!n.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(n,0),u=35866}mt.pixelStorei(37440,n.flipY),mt.pixelStorei(37441,n.premultiplyAlpha),mt.pixelStorei(3317,n.unpackAlignment);const c=mt.getParameter(3314),d=mt.getParameter(32878),p=mt.getParameter(3316),f=mt.getParameter(3315),g=mt.getParameter(32877),v=i.isCompressedTexture?i.mipmaps[0]:i.image;mt.pixelStorei(3314,v.width),mt.pixelStorei(32878,v.height),mt.pixelStorei(3316,t.min.x),mt.pixelStorei(3315,t.min.y),mt.pixelStorei(32877,t.min.z),i.isDataTexture||i.isDataTexture3D?mt.texSubImage3D(u,r,e.x,e.y,e.z,o,s,a,l,h,v.data):i.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),mt.compressedTexSubImage3D(u,r,e.x,e.y,e.z,o,s,a,l,v.data)):mt.texSubImage3D(u,r,e.x,e.y,e.z,o,s,a,l,h,v),mt.pixelStorei(3314,c),mt.pixelStorei(32878,d),mt.pixelStorei(3316,p),mt.pixelStorei(3315,f),mt.pixelStorei(32877,g),0===r&&n.generateMipmaps&&mt.generateMipmap(u),q.unbindTexture()},this.initTexture=function(t){K.setTexture2D(t,0),q.unbindTexture()},this.resetState=function(){v=0,_=0,y=null,q.reset(),ft.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends ur{}).prototype.isWebGL1Renderer=!0;class cr{constructor(t,e=25e-5){this.name="",this.color=new Zt(t),this.density=e}clone(){return new cr(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}cr.prototype.isFogExp2=!0;class dr{constructor(t,e=1,i=1e3){this.name="",this.color=new Zt(t),this.near=e,this.far=i}clone(){return new dr(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}dr.prototype.isFog=!0;class pr extends Rt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}pr.prototype.isScene=!0;class fr{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=u()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=u()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=u()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}fr.prototype.isInterleavedBuffer=!0;const mr=new M;class gr{constructor(t,e,i,n=!1){this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)mr.x=this.getX(e),mr.y=this.getY(e),mr.z=this.getZ(e),mr.applyMatrix4(t),this.setXYZ(e,mr.x,mr.y,mr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)mr.x=this.getX(e),mr.y=this.getY(e),mr.z=this.getZ(e),mr.applyNormalMatrix(t),this.setXYZ(e,mr.x,mr.y,mr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)mr.x=this.getX(e),mr.y=this.getY(e),mr.z=this.getZ(e),mr.transformDirection(t),this.setXYZ(e,mr.x,mr.y,mr.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new $t(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new gr(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}gr.prototype.isInterleavedBufferAttribute=!0;class vr extends jt{constructor(t){super(),this.type="SpriteMaterial",this.color=new Zt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let _r;vr.prototype.isSpriteMaterial=!0;const yr=new M,xr=new M,br=new M,Tr=new g,Er=new g,Sr=new rt,wr=new M,Ar=new M,Mr=new M,Cr=new g,Rr=new g,Ir=new g;class Pr extends Rt{constructor(t){if(super(),this.type="Sprite",void 0===_r){_r=new de;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new fr(t,5);_r.setIndex([0,1,2,0,2,3]),_r.setAttribute("position",new gr(e,3,0,!1)),_r.setAttribute("uv",new gr(e,2,3,!1))}this.geometry=_r,this.material=void 0!==t?t:new vr,this.center=new g(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),xr.setFromMatrixScale(this.matrixWorld),Sr.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),br.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&xr.multiplyScalar(-br.z);const i=this.material.rotation;let n,r;0!==i&&(r=Math.cos(i),n=Math.sin(i));const o=this.center;Or(wr.set(-.5,-.5,0),br,o,xr,n,r),Or(Ar.set(.5,-.5,0),br,o,xr,n,r),Or(Mr.set(.5,.5,0),br,o,xr,n,r),Cr.set(0,0),Rr.set(1,0),Ir.set(1,1);let s=t.ray.intersectTriangle(wr,Ar,Mr,!1,yr);if(null===s&&(Or(Ar.set(-.5,.5,0),br,o,xr,n,r),Rr.set(0,1),s=t.ray.intersectTriangle(wr,Mr,Ar,!1,yr),null===s))return;const a=t.ray.origin.distanceTo(yr);a<t.near||a>t.far||e.push({distance:a,point:yr.clone(),uv:Gt.getUV(yr,wr,Ar,Mr,Cr,Rr,Ir,new g),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Or(t,e,i,n,r,o){Tr.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(Er.x=o*Tr.x-r*Tr.y,Er.y=r*Tr.x+o*Tr.y):Er.copy(Tr),t.copy(e),t.x+=Er.x,t.y+=Er.y,t.applyMatrix4(Sr)}Pr.prototype.isSprite=!0;const Nr=new M,Lr=new E,Dr=new E,Fr=new M,Br=new rt;class Ur extends Ie{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new rt,this.bindMatrixInverse=new rt}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new E,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;i<n;i++){t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.w=e.getW(i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const i=this.skeleton,n=this.geometry;Lr.fromBufferAttribute(n.attributes.skinIndex,t),Dr.fromBufferAttribute(n.attributes.skinWeight,t),Nr.fromBufferAttribute(n.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=Dr.getComponent(t);if(0!==n){const r=Lr.getComponent(t);Br.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),e.addScaledVector(Fr.copy(Nr).applyMatrix4(Br),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}Ur.prototype.isSkinnedMesh=!0;class kr extends Rt{constructor(){super(),this.type="Bone"}}kr.prototype.isBone=!0;class Gr extends b{constructor(t=null,e=1,i=1,n,r,o,s,a,l=1003,h=1003,u,c){super(null,o,s,a,l,h,n,r,u,c),this.image={data:t,width:e,height:i},this.magFilter=l,this.minFilter=h,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Gr.prototype.isDataTexture=!0;const Hr=new rt,jr=new rt,zr=[],Vr=new Ie;class Xr extends Ie{constructor(t,e,i){super(t,e),this.instanceMatrix=new $t(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const i=this.matrixWorld,n=this.count;if(Vr.geometry=this.geometry,Vr.material=this.material,void 0!==Vr.material)for(let r=0;r<n;r++){this.getMatrixAt(r,Hr),jr.multiplyMatrices(i,Hr),Vr.matrixWorld=jr,Vr.raycast(t,zr);for(let t=0,i=zr.length;t<i;t++){const i=zr[t];i.instanceId=r,i.object=this,e.push(i)}zr.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new $t(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Xr.prototype.isInstancedMesh=!0;class Wr extends jt{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Zt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}Wr.prototype.isLineBasicMaterial=!0;const Yr=new M,qr=new M,Zr=new rt,Jr=new nt,Kr=new Z;class Qr extends Rt{constructor(t=new de,e=new Wr){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)Yr.fromBufferAttribute(e,t-1),qr.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Yr.distanceTo(qr);t.setAttribute("lineDistance",new ne(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,o=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Kr.copy(i.boundingSphere),Kr.applyMatrix4(n),Kr.radius+=r,!1===t.ray.intersectsSphere(Kr))return;Zr.copy(n).invert(),Jr.copy(t.ray).applyMatrix4(Zr);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s,l=new M,h=new M,u=new M,c=new M,d=this.isLineSegments?2:1;if(i.isBufferGeometry){const n=i.index,r=i.attributes.position;if(null!==n){for(let i=Math.max(0,o.start),s=Math.min(n.count,o.start+o.count)-1;i<s;i+=d){const o=n.getX(i),s=n.getX(i+1);l.fromBufferAttribute(r,o),h.fromBufferAttribute(r,s);if(Jr.distanceSqToSegment(l,h,c,u)>a)continue;c.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(c);d<t.near||d>t.far||e.push({distance:d,point:u.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,o.start),n=Math.min(r.count,o.start+o.count)-1;i<n;i+=d){l.fromBufferAttribute(r,i),h.fromBufferAttribute(r,i+1);if(Jr.distanceSqToSegment(l,h,c,u)>a)continue;c.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(c);n<t.near||n>t.far||e.push({distance:n,point:u.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}else i.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Qr.prototype.isLine=!0;const $r=new M,to=new M;class eo extends Qr{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)$r.fromBufferAttribute(e,t),to.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+$r.distanceTo(to);t.setAttribute("lineDistance",new ne(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}eo.prototype.isLineSegments=!0;class io extends Qr{constructor(t,e){super(t,e),this.type="LineLoop"}}io.prototype.isLineLoop=!0;class no extends jt{constructor(t){super(),this.type="PointsMaterial",this.color=new Zt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this}}no.prototype.isPointsMaterial=!0;const ro=new rt,oo=new nt,so=new Z,ao=new M;class lo extends Rt{constructor(t=new de,e=new no){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold,o=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),so.copy(i.boundingSphere),so.applyMatrix4(n),so.radius+=r,!1===t.ray.intersectsSphere(so))return;ro.copy(n).invert(),oo.copy(t.ray).applyMatrix4(ro);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position;if(null!==r){for(let i=Math.max(0,o.start),l=Math.min(r.count,o.start+o.count);i<l;i++){const o=r.getX(i);ao.fromBufferAttribute(s,o),ho(ao,o,a,n,t,e,this)}}else{for(let i=Math.max(0,o.start),r=Math.min(s.count,o.start+o.count);i<r;i++)ao.fromBufferAttribute(s,i),ho(ao,i,a,n,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function ho(t,e,i,n,r,o,s){const a=oo.distanceSqToPoint(t);if(a<i){const i=new M;oo.closestPointToPoint(t,i),i.applyMatrix4(n);const l=r.ray.origin.distanceTo(i);if(l<r.near||l>r.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:i,index:e,face:null,object:s})}}lo.prototype.isPoints=!0;(class extends b{constructor(t,e,i,n,r,o,s,a,l){super(t,e,i,n,r,o,s,a,l),this.format=void 0!==s?s:1022,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;const h=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){h.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}).prototype.isVideoTexture=!0;class uo extends b{constructor(t,e,i,n,r,o,s,a,l,h,u,c){super(null,o,s,a,l,h,n,r,u,c),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}uo.prototype.isCompressedTexture=!0;(class extends b{constructor(t,e,i,n,r,o,s,a,l){super(t,e,i,n,r,o,s,a,l),this.needsUpdate=!0}}).prototype.isCanvasTexture=!0;(class extends b{constructor(t,e,i,n,r,o,s,a,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===h&&(i=1012),void 0===i&&1027===h&&(i=1020),super(null,n,r,o,s,a,h,i,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==a?a:1003,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isDepthTexture=!0;new M,new M,new M,new Gt;class co{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)i=this.getPoint(o/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let o;o=e||t*i[r-1];let s,a=0,l=r-1;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),s=i[n]-o,s<0)a=n+1;else{if(!(s>0)){l=n;break}l=n-1}if(n=l,i[n]===o)return n/(r-1);const h=i[n];return(n+(o-h)/(i[n+1]-h))/(r-1)}getTangent(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);const r=this.getPoint(i),o=this.getPoint(n),s=e||(r.isVector2?new g:new M);return s.copy(o).sub(r).normalize(),s}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new M,n=[],r=[],o=[],s=new M,a=new rt;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new M),n[e].normalize()}r[0]=new M,o[0]=new M;let l=Number.MAX_VALUE;const h=Math.abs(n[0].x),u=Math.abs(n[0].y),d=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),d<=l&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),o[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),o[e]=o[e-1].clone(),s.crossVectors(n[e-1],n[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(c(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(s,t))}o[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(c(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(a.makeRotationAxis(n[i],e*i)),o[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class po extends co{constructor(t=0,e=0,i=1,n=1,r=0,o=2*Math.PI,s=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a}getPoint(t,e){const i=e||new g,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=o?0:n),!0!==this.aClockwise||o||(r===n?r=-n:r-=n);const s=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=a-this.aX,n=l-this.aY;a=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}po.prototype.isEllipseCurve=!0;class fo extends po{constructor(t,e,i,n,r,o){super(t,e,i,i,n,r,o),this.type="ArcCurve"}}function mo(){let t=0,e=0,i=0,n=0;function r(r,o,s,a){t=r,e=s,i=-3*r+3*o-2*s-a,n=2*r-2*o+s+a}return{initCatmullRom:function(t,e,i,n,o){r(e,i,o*(i-t),o*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,o,s,a){let l=(e-t)/o-(i-t)/(o+s)+(i-e)/s,h=(i-e)/s-(n-e)/(s+a)+(n-i)/a;l*=s,h*=s,r(e,i,l,h)},calc:function(r){const o=r*r;return t+e*r+i*o+n*(o*r)}}}fo.prototype.isArcCurve=!0;const go=new M,vo=new mo,_o=new mo,yo=new mo;class xo extends co{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new M){const i=e,n=this.points,r=n.length,o=(r-(this.closed?0:1))*t;let s,a,l=Math.floor(o),h=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===h&&l===r-1&&(l=r-2,h=1),this.closed||l>0?s=n[(l-1)%r]:(go.subVectors(n[0],n[1]).add(n[0]),s=go);const u=n[l%r],c=n[(l+1)%r];if(this.closed||l+2<r?a=n[(l+2)%r]:(go.subVectors(n[r-1],n[r-2]).add(n[r-1]),a=go),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(c),t),n=Math.pow(c.distanceToSquared(a),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),vo.initNonuniformCatmullRom(s.x,u.x,c.x,a.x,e,i,n),_o.initNonuniformCatmullRom(s.y,u.y,c.y,a.y,e,i,n),yo.initNonuniformCatmullRom(s.z,u.z,c.z,a.z,e,i,n)}else"catmullrom"===this.curveType&&(vo.initCatmullRom(s.x,u.x,c.x,a.x,this.tension),_o.initCatmullRom(s.y,u.y,c.y,a.y,this.tension),yo.initCatmullRom(s.z,u.z,c.z,a.z,this.tension));return i.set(vo.calc(h),_o.calc(h),yo.calc(h)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new M).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function bo(t,e,i,n,r){const o=.5*(n-e),s=.5*(r-i),a=t*t;return(2*i-2*n+o+s)*(t*a)+(-3*i+3*n-2*o-s)*a+o*t+i}function To(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Eo(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}xo.prototype.isCatmullRomCurve3=!0;class So extends co{constructor(t=new g,e=new g,i=new g,n=new g){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new g){const i=e,n=this.v0,r=this.v1,o=this.v2,s=this.v3;return i.set(Eo(t,n.x,r.x,o.x,s.x),Eo(t,n.y,r.y,o.y,s.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}So.prototype.isCubicBezierCurve=!0;class wo extends co{constructor(t=new M,e=new M,i=new M,n=new M){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new M){const i=e,n=this.v0,r=this.v1,o=this.v2,s=this.v3;return i.set(Eo(t,n.x,r.x,o.x,s.x),Eo(t,n.y,r.y,o.y,s.y),Eo(t,n.z,r.z,o.z,s.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}wo.prototype.isCubicBezierCurve3=!0;class Ao extends co{constructor(t=new g,e=new g){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new g){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const i=e||new g;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Ao.prototype.isLineCurve=!0;class Mo extends co{constructor(t=new g,e=new g,i=new g){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new g){const i=e,n=this.v0,r=this.v1,o=this.v2;return i.set(To(t,n.x,r.x,o.x),To(t,n.y,r.y,o.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Mo.prototype.isQuadraticBezierCurve=!0;class Co extends co{constructor(t=new M,e=new M,i=new M){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new M){const i=e,n=this.v0,r=this.v1,o=this.v2;return i.set(To(t,n.x,r.x,o.x),To(t,n.y,r.y,o.y),To(t,n.z,r.z,o.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Co.prototype.isQuadraticBezierCurve3=!0;class Ro extends co{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new g){const i=e,n=this.points,r=(n.length-1)*t,o=Math.floor(r),s=r-o,a=n[0===o?o:o-1],l=n[o],h=n[o>n.length-2?n.length-1:o+1],u=n[o>n.length-3?n.length-1:o+2];return i.set(bo(s,a.x,l.x,h.x,u.x),bo(s,a.y,l.y,h.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new g).fromArray(i))}return this}}Ro.prototype.isSplineCurve=!0;var Io=Object.freeze({__proto__:null,ArcCurve:fo,CatmullRomCurve3:xo,CubicBezierCurve:So,CubicBezierCurve3:wo,EllipseCurve:po,LineCurve:Ao,LineCurve3:class extends co{constructor(t=new M,e=new M){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new M){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:Mo,QuadraticBezierCurve3:Co,SplineCurve:Ro});const Po=function(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let o=Oo(t,0,r,i,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,h,u,c,d,p;if(n&&(o=function(t,e,i,n){const r=[];let o,s,a,l,h;for(o=0,s=e.length;o<s;o++)a=e[o]*n,l=o<s-1?e[o+1]*n:t.length,h=Oo(t,a,l,n,!1),h===h.next&&(h.steiner=!0),r.push(zo(h));for(r.sort(ko),o=0;o<r.length;o++)Go(r[o],i),i=No(i,i.next);return i}(t,e,o,i)),t.length>80*i){a=h=t[0],l=u=t[1];for(let e=i;e<r;e+=i)c=t[e],d=t[e+1],c<a&&(a=c),d<l&&(l=d),c>h&&(h=c),d>u&&(u=d);p=Math.max(h-a,u-l),p=0!==p?1/p:0}return Lo(o,s,i,a,l,p),s};function Oo(t,e,i,n,r){let o,s;if(r===function(t,e,i,n){let r=0;for(let o=e,s=i-n;o<i;o+=n)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}(t,e,i,n)>0)for(o=e;o<i;o+=n)s=$o(o,t[o],t[o+1],s);else for(o=i-n;o>=e;o-=n)s=$o(o,t[o],t[o+1],s);return s&&Yo(s,s.next)&&(ts(s),s=s.next),s}function No(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Yo(n,n.next)&&0!==Wo(n.prev,n,n.next))n=n.next;else{if(ts(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function Lo(t,e,i,n,r,o,s){if(!t)return;!s&&o&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=jo(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,o,s,a,l,h=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,n=i,a=0,e=0;e<h&&(a++,n=n.nextZ,n);e++);for(l=h;a>0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,h*=2}while(s>1)}(r)}(t,n,r,o);let a,l,h=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,o?Fo(t,n,r,o):Do(t))e.push(a.i/i),e.push(t.i/i),e.push(l.i/i),ts(t),t=l.next,h=l.next;else if((t=l)===h){s?1===s?Lo(t=Bo(No(t),e,i),e,i,n,r,o,2):2===s&&Uo(t,e,i,n,r,o):Lo(No(t),e,i,n,r,o,1);break}}function Do(t){const e=t.prev,i=t,n=t.next;if(Wo(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(Vo(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&Wo(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Fo(t,e,i,n){const r=t.prev,o=t,s=t.next;if(Wo(r,o,s)>=0)return!1;const a=r.x<o.x?r.x<s.x?r.x:s.x:o.x<s.x?o.x:s.x,l=r.y<o.y?r.y<s.y?r.y:s.y:o.y<s.y?o.y:s.y,h=r.x>o.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,u=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,c=jo(a,l,e,i,n),d=jo(h,u,e,i,n);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Vo(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Wo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Vo(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Wo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&Vo(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Wo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Vo(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Wo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Bo(t,e,i){let n=t;do{const r=n.prev,o=n.next.next;!Yo(r,o)&&qo(r,n,n.next,o)&&Ko(r,o)&&Ko(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),ts(n),ts(n.next),n=t=o),n=n.next}while(n!==t);return No(n)}function Uo(t,e,i,n,r,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&Xo(s,t)){let a=Qo(s,t);return s=No(s,s.next),a=No(a,a.next),Lo(s,e,i,n,r,o),void Lo(a,e,i,n,r,o)}t=t.next}s=s.next}while(s!==t)}function ko(t,e){return t.x-e.x}function Go(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let o,s=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>s){if(s=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}o=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!o)return null;if(n===s)return o;const a=o,l=o.x,h=o.y;let u,c=1/0;i=o;do{n>=i.x&&i.x>=l&&n!==i.x&&Vo(r<h?n:s,r,l,h,r<h?s:n,r,i.x,i.y)&&(u=Math.abs(r-i.y)/(n-i.x),Ko(i,t)&&(u<c||u===c&&(i.x>o.x||i.x===o.x&&Ho(o,i)))&&(o=i,c=u)),i=i.next}while(i!==a);return o}(t,e)){const i=Qo(e,t);No(e,e.next),No(i,i.next)}}function Ho(t,e){return Wo(t.prev,t,e.prev)<0&&Wo(e.next,t,t.next)<0}function jo(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function zo(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Vo(t,e,i,n,r,o,s,a){return(r-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(n-a)-(i-s)*(e-a)>=0&&(i-s)*(o-a)-(r-s)*(n-a)>=0}function Xo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&qo(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Ko(t,e)&&Ko(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Wo(t.prev,t,e.prev)||Wo(t,e.prev,e))||Yo(t,e)&&Wo(t.prev,t,t.next)>0&&Wo(e.prev,e,e.next)>0)}function Wo(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Yo(t,e){return t.x===e.x&&t.y===e.y}function qo(t,e,i,n){const r=Jo(Wo(t,e,i)),o=Jo(Wo(t,e,n)),s=Jo(Wo(i,n,t)),a=Jo(Wo(i,n,e));return r!==o&&s!==a||(!(0!==r||!Zo(t,i,e))||(!(0!==o||!Zo(t,n,e))||(!(0!==s||!Zo(i,t,n))||!(0!==a||!Zo(i,e,n)))))}function Zo(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Jo(t){return t>0?1:t<0?-1:0}function Ko(t,e){return Wo(t.prev,t,t.next)<0?Wo(t,e,t.next)>=0&&Wo(t,t.prev,e)>=0:Wo(t,e,t.prev)<0||Wo(t,t.next,e)<0}function Qo(t,e){const i=new es(t.i,t.x,t.y),n=new es(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function $o(t,e,i,n){const r=new es(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function ts(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function es(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class is{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i}static isClockWise(t){return is.area(t)<0}static triangulateShape(t,e){const i=[],n=[],r=[];ns(t),rs(i,t);let o=t.length;e.forEach(ns);for(let t=0;t<e.length;t++)n.push(o),o+=e[t].length,rs(i,e[t]);const s=Po(i,n);for(let t=0;t<s.length;t+=3)r.push(s.slice(t,t+3));return r}}function ns(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function rs(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class os extends de{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++){o(t[e])}function o(t){const o=[],s=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,h=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:6,c=void 0!==e.bevelSize?e.bevelSize:u-2,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:ss;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let v,_,y,x,b,T=!1;f&&(v=f.getSpacedPoints(a),T=!0,h=!1,_=f.computeFrenetFrames(a,!1),y=new M,x=new M,b=new M),h||(p=0,u=0,c=0,d=0);const E=t.extractPoints(s);let S=E.shape;const w=E.holes;if(!is.isClockWise(S)){S=S.reverse();for(let t=0,e=w.length;t<e;t++){const e=w[t];is.isClockWise(e)&&(w[t]=e.reverse())}}const A=is.triangulateShape(S,w),C=S;for(let t=0,e=w.length;t<e;t++){const e=w[t];S=S.concat(e)}function R(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}const I=S.length,P=A.length;function O(t,e,i){let n,r,o;const s=t.x-e.x,a=t.y-e.y,l=i.x-t.x,h=i.y-t.y,u=s*s+a*a,c=s*h-a*l;if(Math.abs(c)>Number.EPSILON){const c=Math.sqrt(u),d=Math.sqrt(l*l+h*h),p=e.x-a/c,f=e.y+s/c,m=((i.x-h/d-p)*h-(i.y+l/d-f)*l)/(s*h-a*l);n=p+s*m-t.x,r=f+a*m-t.y;const v=n*n+r*r;if(v<=2)return new g(n,r);o=Math.sqrt(v/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(h)&&(t=!0),t?(n=-a,r=s,o=Math.sqrt(u)):(n=s,r=a,o=Math.sqrt(u/2))}return new g(n/o,r/o)}const N=[];for(let t=0,e=C.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),N[t]=O(C[t],C[i],C[n]);const L=[];let D,F=N.concat();for(let t=0,e=w.length;t<e;t++){const e=w[t];D=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),D[t]=O(e[t],e[n],e[r]);L.push(D),F=F.concat(D)}for(let t=0;t<p;t++){const e=t/p,i=u*Math.cos(e*Math.PI/2),n=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=C.length;t<e;t++){const e=R(C[t],N[t],n);k(e.x,e.y,-i)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],D[t],n);k(r.x,r.y,-i)}}}const B=c+d;for(let t=0;t<I;t++){const e=h?R(S[t],F[t],B):S[t];T?(x.copy(_.normals[0]).multiplyScalar(e.x),y.copy(_.binormals[0]).multiplyScalar(e.y),b.copy(v[0]).add(x).add(y),k(b.x,b.y,b.z)):k(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<I;e++){const i=h?R(S[e],F[e],B):S[e];T?(x.copy(_.normals[t]).multiplyScalar(i.x),y.copy(_.binormals[t]).multiplyScalar(i.y),b.copy(v[t]).add(x).add(y),k(b.x,b.y,b.z)):k(i.x,i.y,l/a*t)}for(let t=p-1;t>=0;t--){const e=t/p,i=u*Math.cos(e*Math.PI/2),n=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=C.length;t<e;t++){const e=R(C[t],N[t],n);k(e.x,e.y,l+i)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],D[t],n);T?k(r.x,r.y+v[a-1].y,v[a-1].x+i):k(r.x,r.y,l+i)}}}function U(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=a+2*p;t<i;t++){const i=I*t,o=I*(t+1);H(e+n+i,e+r+i,e+r+o,e+n+o)}}}function k(t,e,i){o.push(t),o.push(e),o.push(i)}function G(t,e,r){j(t),j(e),j(r);const o=n.length/3,s=m.generateTopUV(i,n,o-3,o-2,o-1);z(s[0]),z(s[1]),z(s[2])}function H(t,e,r,o){j(t),j(e),j(o),j(e),j(r),j(o);const s=n.length/3,a=m.generateSideWallUV(i,n,s-6,s-3,s-2,s-1);z(a[0]),z(a[1]),z(a[3]),z(a[1]),z(a[2]),z(a[3])}function j(t){n.push(o[3*t+0]),n.push(o[3*t+1]),n.push(o[3*t+2])}function z(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(h){let t=0,e=I*t;for(let t=0;t<P;t++){const i=A[t];G(i[2]+e,i[1]+e,i[0]+e)}t=a+2*p,e=I*t;for(let t=0;t<P;t++){const i=A[t];G(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<P;t++){const e=A[t];G(e[2],e[1],e[0])}for(let t=0;t<P;t++){const e=A[t];G(e[0]+I*a,e[1]+I*a,e[2]+I*a)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;U(C,e),e+=C.length;for(let t=0,i=w.length;t<i;t++){const i=w[t];U(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new ne(n,3)),this.setAttribute("uv",new ne(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON());return i}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}const n=t.options.extrudePath;return void 0!==n&&(t.options.extrudePath=(new Io[n.type]).fromJSON(n)),new os(i,t.options)}}const ss={generateTopUV:function(t,e,i,n,r){const o=e[3*i],s=e[3*i+1],a=e[3*n],l=e[3*n+1],h=e[3*r],u=e[3*r+1];return[new g(o,s),new g(a,l),new g(h,u)]},generateSideWallUV:function(t,e,i,n,r,o){const s=e[3*i],a=e[3*i+1],l=e[3*i+2],h=e[3*n],u=e[3*n+1],c=e[3*n+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*o],v=e[3*o+1],_=e[3*o+2];return Math.abs(a-u)<Math.abs(s-h)?[new g(s,1-l),new g(h,1-c),new g(d,1-f),new g(m,1-_)]:[new g(a,1-l),new g(u,1-c),new g(p,1-f),new g(v,1-_)]}};class as extends de{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],r=[],o=[];let s=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(s,a,e),s+=a,a=0;function l(t){const s=n.length/3,l=t.extractPoints(e);let h=l.shape;const u=l.holes;!1===is.isClockWise(h)&&(h=h.reverse());for(let t=0,e=u.length;t<e;t++){const e=u[t];!0===is.isClockWise(e)&&(u[t]=e.reverse())}const c=is.triangulateShape(h,u);for(let t=0,e=u.length;t<e;t++){const e=u[t];h=h.concat(e)}for(let t=0,e=h.length;t<e;t++){const e=h[t];n.push(e.x,e.y,0),r.push(0,0,1),o.push(e.x,e.y)}for(let t=0,e=c.length;t<e;t++){const e=c[t],n=e[0]+s,r=e[1]+s,o=e[2]+s;i.push(n,r,o),a+=3}}this.setIndex(i),this.setAttribute("position",new ne(n,3)),this.setAttribute("normal",new ne(r,3)),this.setAttribute("uv",new ne(o,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}return new as(i,t.curveSegments)}}class ls extends jt{constructor(t){super(),this.type="ShadowMaterial",this.color=new Zt(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}ls.prototype.isShadowMaterial=!0;class hs extends Fe{constructor(t){super(t),this.type="RawShaderMaterial"}}hs.prototype.isRawShaderMaterial=!0;class us extends jt{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Zt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(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.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this}}us.prototype.isMeshStandardMaterial=!0;class cs extends us{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new g(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=c(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Zt(1,1,1),this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new Zt).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this}}cs.prototype.isMeshPhysicalMaterial=!0;class ds extends jt{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Zt(16777215),this.specular=new Zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}ds.prototype.isMeshPhongMaterial=!0;class ps extends jt{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}ps.prototype.isMeshToonMaterial=!0;class fs extends jt{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}fs.prototype.isMeshNormalMaterial=!0;class ms extends jt{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}ms.prototype.isMeshLambertMaterial=!0;class gs extends jt{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}gs.prototype.isMeshMatcapMaterial=!0;class vs extends Wr{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}vs.prototype.isLineDashedMaterial=!0;const _s={arraySlice:function(t,e,i){return _s.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){const n=t.length,r=new t.constructor(n);for(let o=0,s=0;s!==n;++o){const n=i[o]*e;for(let i=0;i!==e;++i)r[s++]=t[n+i]}return r},flattenJSON:function(t,e,i,n){let r=1,o=t[0];for(;void 0!==o&&void 0===o[n];)o=t[r++];if(void 0===o)return;let s=o[n];if(void 0!==s)if(Array.isArray(s))do{s=o[n],void 0!==s&&(e.push(o.time),i.push.apply(i,s)),o=t[r++]}while(void 0!==o);else if(void 0!==s.toArray)do{s=o[n],void 0!==s&&(e.push(o.time),s.toArray(i,i.length)),o=t[r++]}while(void 0!==o);else do{s=o[n],void 0!==s&&(e.push(o.time),i.push(s)),o=t[r++]}while(void 0!==o)},subclip:function(t,e,i,n,r=30){const o=t.clone();o.name=e;const s=[];for(let t=0;t<o.tracks.length;++t){const e=o.tracks[t],a=e.getValueSize(),l=[],h=[];for(let t=0;t<e.times.length;++t){const o=e.times[t]*r;if(!(o<i||o>=n)){l.push(e.times[t]);for(let i=0;i<a;++i)h.push(e.values[t*a+i])}}0!==l.length&&(e.times=_s.convertArray(l,e.times.constructor),e.values=_s.convertArray(h,e.values.constructor),s.push(e))}o.tracks=s;let a=1/0;for(let t=0;t<o.tracks.length;++t)a>o.tracks[t].times[0]&&(a=o.tracks[t].times[0]);for(let t=0;t<o.tracks.length;++t)o.tracks[t].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,i=t,n=30){n<=0&&(n=30);const r=i.tracks.length,o=e/n;for(let e=0;e<r;++e){const n=i.tracks[e],r=n.ValueTypeName;if("bool"===r||"string"===r)continue;const s=t.tracks.find((function(t){return t.name===n.name&&t.ValueTypeName===r}));if(void 0===s)continue;let a=0;const l=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let h=0;const u=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);const c=n.times.length-1;let d;if(o<=n.times[0]){const t=a,e=l-a;d=_s.arraySlice(n.values,t,e)}else if(o>=n.times[c]){const t=c*l+a,e=t+l-a;d=_s.arraySlice(n.values,t,e)}else{const t=n.createInterpolant(),e=a,i=l-a;t.evaluate(o),d=_s.arraySlice(t.resultBuffer,e,i)}if("quaternion"===r){(new A).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let t=0;t<p;++t){const e=t*u+h;if("quaternion"===r)A.multiplyQuaternionsFlat(s.values,e,d,0,s.values,e);else{const t=u-2*h;for(let i=0;i<t;++i)s.values[e+i]-=d[i]}}}return t.blendMode=2501,t}};class ys{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let o;i:{n:if(!(t<n)){for(let o=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===o)break;if(r=n,n=e[++i],t<n)break e}o=e.length;break i}if(t>=r)break t;{const s=e[1];t<s&&(i=2,r=s);for(let o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,r=e[--i-1],t>=r)break e}o=i,i=0}}for(;i<o;){const n=i+o>>>1;t<e[n]?o=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}ys.prototype.beforeStart_=ys.prototype.copySampleValue_,ys.prototype.afterEnd_=ys.prototype.copySampleValue_;class xs extends ys{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){const n=this.parameterPositions;let r=t-2,o=t+1,s=n[r],a=n[o];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=t,s=2*e-i;break;case 2402:r=n.length-2,s=e+n[r]-n[r+1];break;default:r=t,s=i}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:o=t,a=2*i-e;break;case 2402:o=1,a=i+n[1]-n[0];break;default:o=t-1,a=e}const l=.5*(i-e),h=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(a-i),this._offsetPrev=r*h,this._offsetNext=o*h}interpolate_(t,e,i,n){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,h=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,v=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let t=0;t!==s;++t)r[t]=g*o[h+t]+v*o[l+t]+_*o[a+t]+y*o[u+t];return r}}class bs extends ys{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,h=(i-e)/(n-e),u=1-h;for(let t=0;t!==s;++t)r[t]=o[l+t]*u+o[a+t]*h;return r}}class Ts extends ys{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class Es{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=_s.convertArray(e,this.TimeBufferType),this.values=_s.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:_s.convertArray(t.times,Array),values:_s.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Ts(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new bs(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new xs(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,o=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==o&&i[o]>e;)--o;if(++o,0!==r||o!==n){r>=o&&(o=Math.max(o,1),r=o-1);const t=this.getValueSize();this.times=_s.arraySlice(i,r,o),this.values=_s.arraySlice(this.values,r*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==o&&o>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,o),t=!1;break}o=n}if(void 0!==n&&_s.isTypedArray(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=_s.arraySlice(this.times),e=_s.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=t.length-1;let o=1;for(let s=1;s<r;++s){let r=!1;const a=t[s];if(a!==t[s+1]&&(1!==s||a!==t[0]))if(n)r=!0;else{const t=s*i,n=t-i,o=t+i;for(let s=0;s!==i;++s){const i=e[t+s];if(i!==e[n+s]||i!==e[o+s]){r=!0;break}}}if(r){if(s!==o){t[o]=t[s];const n=s*i,r=o*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++o}}if(r>0){t[o]=t[r];for(let t=r*i,n=o*i,s=0;s!==i;++s)e[n+s]=e[t+s];++o}return o!==t.length?(this.times=_s.arraySlice(t,0,o),this.values=_s.arraySlice(e,0,o*i)):(this.times=t,this.values=e),this}clone(){const t=_s.arraySlice(this.times,0),e=_s.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}Es.prototype.TimeBufferType=Float32Array,Es.prototype.ValueBufferType=Float32Array,Es.prototype.DefaultInterpolation=2301;class Ss extends Es{}Ss.prototype.ValueTypeName="bool",Ss.prototype.ValueBufferType=Array,Ss.prototype.DefaultInterpolation=2300,Ss.prototype.InterpolantFactoryMethodLinear=void 0,Ss.prototype.InterpolantFactoryMethodSmooth=void 0;class ws extends Es{}ws.prototype.ValueTypeName="color";class As extends Es{}As.prototype.ValueTypeName="number";class Ms extends ys{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(i-e)/(n-e);let l=t*s;for(let t=l+s;l!==t;l+=4)A.slerpFlat(r,0,o,l-s,o,l,a);return r}}class Cs extends Es{InterpolantFactoryMethodLinear(t){return new Ms(this.times,this.values,this.getValueSize(),t)}}Cs.prototype.ValueTypeName="quaternion",Cs.prototype.DefaultInterpolation=2301,Cs.prototype.InterpolantFactoryMethodSmooth=void 0;class Rs extends Es{}Rs.prototype.ValueTypeName="string",Rs.prototype.ValueBufferType=Array,Rs.prototype.DefaultInterpolation=2300,Rs.prototype.InterpolantFactoryMethodLinear=void 0,Rs.prototype.InterpolantFactoryMethodSmooth=void 0;class Is extends Es{}Is.prototype.ValueTypeName="vector";class Ps{constructor(t,e=-1,i,n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=u(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(Os(i[t]).scale(n));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(Es.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const r=e.length,o=[];for(let t=0;t<r;t++){let s=[],a=[];s.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=_s.getKeyframeOrder(s);s=_s.sortedArray(s,1,l),a=_s.sortedArray(a,1,l),n||0!==s[0]||(s.push(r),a.push(a[0])),o.push(new As(".morphTargetInfluences["+e[t].name+"]",s,a).scale(1/i))}return new this(t,-1,o)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],o=i.name.match(r);if(o&&o.length>1){const t=o[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const o=[];for(const t in n)o.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const o=[],s=[];_s.flattenJSON(i,o,s,n),0!==o.length&&r.push(new t(e,o,s))}},n=[],r=t.name||"default",o=t.fps||30,s=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],o=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),o.push(n.morphTarget===i?1:0)}n.push(new As(".morphTargetInfluence["+i+"]",t,o))}a=t.length*(o||1)}else{const o=".bones["+e[t].name+"]";i(Is,o+".position",r,"pos",n),i(Cs,o+".quaternion",r,"rot",n),i(Is,o+".scale",r,"scl",n)}}if(0===n.length)return null;return new this(r,a,n,s)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Os(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return As;case"vector":case"vector2":case"vector3":case"vector4":return Is;case"color":return ws;case"quaternion":return Cs;case"bool":case"boolean":return Ss;case"string":return Rs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];_s.flattenJSON(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Ns={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Ls{constructor(t,e,i){const n=this;let r=!1,o=0,s=0,a=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){s++,!1===r&&void 0!==n.onStart&&n.onStart(t,o,s),r=!0},this.itemEnd=function(t){o++,void 0!==n.onProgress&&n.onProgress(t,o,s),o===s&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Ds=new Ls;class Fs{constructor(t){this.manager=void 0!==t?t:Ds,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const Bs={};class Us extends Fs{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=Ns.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;if(void 0!==Bs[t])return void Bs[t].push({onLoad:e,onProgress:i,onError:n});const s=t.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(s){const i=s[1],o=!!s[2];let a=s[3];a=decodeURIComponent(a),o&&(a=atob(a));try{let n;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const t=new Uint8Array(a.length);for(let e=0;e<a.length;e++)t[e]=a.charCodeAt(e);n="blob"===o?new Blob([t.buffer],{type:i}):t.buffer;break;case"document":const e=new DOMParser;n=e.parseFromString(a,i);break;case"json":n=JSON.parse(a);break;default:n=a}setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{Bs[t]=[],Bs[t].push({onLoad:e,onProgress:i,onError:n}),a=new XMLHttpRequest,a.open("GET",t,!0),a.addEventListener("load",(function(e){const i=this.response,n=Bs[t];if(delete Bs[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ns.add(t,i);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onLoad&&e.onLoad(i)}r.manager.itemEnd(t)}else{for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),a.addEventListener("progress",(function(e){const i=Bs[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onProgress&&n.onProgress(e)}}),!1),a.addEventListener("error",(function(e){const i=Bs[t];delete Bs[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),a.addEventListener("abort",(function(e){const i=Bs[t];delete Bs[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)a.setRequestHeader(t,this.requestHeader[t]);a.send(null)}return r.manager.itemStart(t),a}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class ks extends Fs{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=Ns.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),Ns.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return s.addEventListener("load",a,!1),s.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class Gs extends Fs{constructor(t){super(t)}load(t,e,i,n){const r=new Ge,o=new ks(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(i){o.load(t[i],(function(t){r.images[i]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(let e=0;e<t.length;++e)a(e);return r}}class Hs extends Fs{constructor(t){super(t)}load(t,e,i,n){const r=new b,o=new ks(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(i){r.image=i;const n=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}class js extends co{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ao(e,t))}getPoint(t){const e=t*this.getLength(),i=this.getCurveLengths();let n=0;for(;n<i.length;){if(i[n]>=e){const t=i[n]-e,r=this.curves[n],o=r.getLength(),s=0===o?0:1-t/o;return r.getPointAt(s)}n++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const o=r[n],s=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,a=o.getPoints(s);for(let t=0;t<a.length;t++){const n=a[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new Io[i.type]).fromJSON(i))}return this}}class zs extends js{constructor(t){super(),this.type="Path",this.currentPoint=new g,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new Ao(this.currentPoint.clone(),new g(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const r=new Mo(this.currentPoint.clone(),new g(t,e),new g(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,o){const s=new So(this.currentPoint.clone(),new g(t,e),new g(i,n),new g(r,o));return this.curves.push(s),this.currentPoint.set(r,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new Ro(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+s,e+a,i,n,r,o),this}absarc(t,e,i,n,r,o){return this.absellipse(t,e,i,i,n,r,o),this}ellipse(t,e,i,n,r,o,s,a){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+l,e+h,i,n,r,o,s,a),this}absellipse(t,e,i,n,r,o,s,a){const l=new po(t,e,i,n,r,o,s,a);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Vs extends zs{constructor(t){super(t),this.uuid=u(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new zs).fromJSON(i))}return this}}class Xs extends Rt{constructor(t,e=1){super(),this.type="Light",this.color=new Zt(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}Xs.prototype.isLight=!0;class Ws extends Xs{constructor(t,e,i){super(t,i),this.type="HemisphereLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.groundColor=new Zt(e)}copy(t){return Xs.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}Ws.prototype.isHemisphereLight=!0;const Ys=new rt,qs=new M,Zs=new M;class Js{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new g(512,512),this.map=null,this.mapPass=null,this.matrix=new rt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qe,this._frameExtents=new g(1,1),this._viewportCount=1,this._viewports=[new E(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;qs.setFromMatrixPosition(t.matrixWorld),e.position.copy(qs),Zs.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Zs),e.updateMatrixWorld(),Ys.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ys),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e.projectionMatrix),i.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Ks extends Js{constructor(){super(new Ue(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,i=2*h*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}Ks.prototype.isSpotLightShadow=!0;class Qs extends Xs{constructor(t,e,i=0,n=Math.PI/3,r=0,o=1){super(t,e),this.type="SpotLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.target=new Rt,this.distance=i,this.angle=n,this.penumbra=r,this.decay=o,this.shadow=new Ks}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Qs.prototype.isSpotLight=!0;const $s=new rt,ta=new M,ea=new M;class ia extends Js{constructor(){super(new Ue(90,1,.5,500)),this._frameExtents=new g(4,2),this._viewportCount=6,this._viewports=[new E(2,1,1,1),new E(0,1,1,1),new E(3,1,1,1),new E(1,1,1,1),new E(3,0,1,1),new E(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,n=this.matrix,r=t.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),ta.setFromMatrixPosition(t.matrixWorld),i.position.copy(ta),ea.copy(i.position),ea.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(ea),i.updateMatrixWorld(),n.makeTranslation(-ta.x,-ta.y,-ta.z),$s.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix($s)}}ia.prototype.isPointLightShadow=!0;class na extends Xs{constructor(t,e,i=0,n=1){super(t,e),this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new ia}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}na.prototype.isPointLight=!0;class ra extends Be{constructor(t=-1,e=1,i=1,n=-1,r=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,o){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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,o=i+t,s=n+e,a=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,o=r+t*this.view.width,s-=e*this.view.offsetY,a=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}ra.prototype.isOrthographicCamera=!0;class oa extends Js{constructor(){super(new ra(-5,5,5,-5,.5,500))}}oa.prototype.isDirectionalLightShadow=!0;class sa extends Xs{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.target=new Rt,this.shadow=new oa}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}sa.prototype.isDirectionalLight=!0;class aa extends Xs{constructor(t,e){super(t,e),this.type="AmbientLight"}}aa.prototype.isAmbientLight=!0;class la extends Xs{constructor(t,e,i=10,n=10){super(t,e),this.type="RectAreaLight",this.width=i,this.height=n}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}la.prototype.isRectAreaLight=!0;class ha{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new M)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,n=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*n),e.addScaledVector(o[2],.488603*r),e.addScaledVector(o[3],.488603*i),e.addScaledVector(o[4],i*n*1.092548),e.addScaledVector(o[5],n*r*1.092548),e.addScaledVector(o[6],.315392*(3*r*r-1)),e.addScaledVector(o[7],i*r*1.092548),e.addScaledVector(o[8],.546274*(i*i-n*n)),e}getIrradianceAt(t,e){const i=t.x,n=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*n),e.addScaledVector(o[2],1.023328*r),e.addScaledVector(o[3],1.023328*i),e.addScaledVector(o[4],.858086*i*n),e.addScaledVector(o[5],.858086*n*r),e.addScaledVector(o[6],.743125*r*r-.247708),e.addScaledVector(o[7],.858086*i*r),e.addScaledVector(o[8],.429043*(i*i-n*n)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this}toArray(t=[],e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}static getBasisAt(t,e){const i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}ha.prototype.isSphericalHarmonics3=!0;class ua extends Xs{constructor(t=new ha,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}ua.prototype.isLightProbe=!0;class ca{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}}class da extends de{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}da.prototype.isInstancedBufferGeometry=!0;class pa extends $t{constructor(t,e,i,n=1){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,i),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}pa.prototype.isInstancedBufferAttribute=!0;(class extends Fs{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=Ns.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(t,s).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(i){Ns.add(t,i),e&&e(i),r.manager.itemEnd(t)})).catch((function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}).prototype.isImageBitmapLoader=!0;class fa{constructor(){this.type="ShapePath",this.color=new Zt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new zs,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,o){return this.currentPath.bezierCurveTo(t,e,i,n,r,o),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function i(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],r=new Vs;r.curves=n.curves,e.push(r)}return e}function n(t,e){const i=e.length;let n=!1;for(let r=i-1,o=0;o<i;r=o++){let i=e[r],s=e[o],a=s.x-i.x,l=s.y-i.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(i=e[o],a=-a,s=e[r],l=-l),t.y<i.y||t.y>s.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=l*(t.x-i.x)-a*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(s.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=s.x)return!0}}return n}const r=is.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return i(o);let s,a,l;const h=[];if(1===o.length)return a=o[0],l=new Vs,l.curves=a.curves,h.push(l),h;let u=!r(o[0].getPoints());u=t?!u:u;const c=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,i=o.length;e<i;e++)a=o[e],p=a.getPoints(),s=r(p),s=t?!s:s,s?(!u&&d[g]&&g++,d[g]={s:new Vs,p:p},d[g].s.curves=a.curves,u&&g++,m[g]=[]):m[g].push({h:a,p:p[0]});if(!d[0])return i(o);if(d.length>1){let t=!1;const e=[];for(let t=0,e=d.length;t<e;t++)c[t]=[];for(let i=0,r=d.length;i<r;i++){const r=m[i];for(let o=0;o<r.length;o++){const s=r[o];let a=!0;for(let r=0;r<d.length;r++)n(s.p,d[r].p)&&(i!==r&&e.push({froms:i,tos:r,hole:o}),a?(a=!1,c[r].push(s)):t=!0);a&&c[i].push(s)}}e.length>0&&(t||(m=c))}for(let t=0,e=d.length;t<e;t++){l=d[t].s,h.push(l),f=m[t];for(let t=0,e=f.length;t<e;t++)l.holes.push(f[t].h)}return h}}class ma{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),r=e/i.resolution,o=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,s=[];let a=0,l=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)a=0,l-=o;else{const t=ga(e,r,a,l,i);a+=t.offsetX,s.push(t.path)}}return s}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)Array.prototype.push.apply(i,n[t].toShapes());return i}}function ga(t,e,i,n,r){const o=r.glyphs[t]||r.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const s=new fa;let a,l,h,u,c,d,p,f;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let r=0,o=t.length;r<o;){switch(t[r++]){case"m":a=t[r++]*e+i,l=t[r++]*e+n,s.moveTo(a,l);break;case"l":a=t[r++]*e+i,l=t[r++]*e+n,s.lineTo(a,l);break;case"q":h=t[r++]*e+i,u=t[r++]*e+n,c=t[r++]*e+i,d=t[r++]*e+n,s.quadraticCurveTo(c,d,h,u);break;case"b":h=t[r++]*e+i,u=t[r++]*e+n,c=t[r++]*e+i,d=t[r++]*e+n,p=t[r++]*e+i,f=t[r++]*e+n,s.bezierCurveTo(c,d,p,f,h,u)}}}return{offsetX:o.ha*e,path:s}}ma.prototype.isFont=!0;let va;const _a=function(){return void 0===va&&(va=new(window.AudioContext||window.webkitAudioContext)),va};class ya extends Fs{constructor(t){super(t)}load(t,e,i,n){const r=this,o=new Us(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(i){try{const t=i.slice(0);_a().decodeAudioData(t,(function(t){e(t)}))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)}}(class extends ua{constructor(t,e,i=1){super(void 0,i);const n=(new Zt).set(t),r=(new Zt).set(e),o=new M(n.r,n.g,n.b),s=new M(r.r,r.g,r.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)}}).prototype.isHemisphereLightProbe=!0;(class extends ua{constructor(t,e=1){super(void 0,e);const i=(new Zt).set(t);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}).prototype.isAmbientLightProbe=!0;class xa extends Rt{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}class ba{constructor(t,e,i){let n,r,o;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,r=t*n+n;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==n;++t)i[r+t]=i[t];o=e}else{o+=e;const t=e/o;this._mixBufferRegion(i,r,0,t,n)}this.cumulativeWeight=o}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-r,e)}o>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){s.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,r=n;t!==r;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,r){if(n>=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){A.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){const o=this._workIndex*r;A.multiplyQuaternionsFlat(t,o,t,e,t,i),A.slerpFlat(t,e,t,e,t,o,n)}_lerp(t,e,i,n,r){const o=1-n;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*o+t[i+s]*n}}_lerpAdditive(t,e,i,n,r){for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]+t[i+o]*n}}}const Ta=new RegExp("[\\[\\]\\.:\\/]","g"),Ea="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Sa=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),wa=/(WCOD+)?/.source.replace("WCOD",Ea),Aa=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ma=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ca=new RegExp("^"+Sa+wa+Aa+Ma+"$"),Ra=["material","materials","bones"];class Ia{constructor(t,e,i){this.path=e,this.parsedPath=i||Ia.parseTrackName(e),this.node=Ia.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new Ia.Composite(t,e,i):new Ia(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ta,"")}static parseTrackName(t){const e=Ca.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Ra.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const o=i(r.children);if(o)return o}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.node[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=Ia.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const o=t[n];if(void 0===o){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=n;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ia.Composite=class{constructor(t,e,i){const n=i||Ia.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},Ia.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ia.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ia.prototype.GetterByBindingType=[Ia.prototype._getValue_direct,Ia.prototype._getValue_array,Ia.prototype._getValue_arrayElement,Ia.prototype._getValue_toArray],Ia.prototype.SetterByBindingTypeAndVersioning=[[Ia.prototype._setValue_direct,Ia.prototype._setValue_direct_setNeedsUpdate,Ia.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_array,Ia.prototype._setValue_array_setNeedsUpdate,Ia.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_arrayElement,Ia.prototype._setValue_arrayElement_setNeedsUpdate,Ia.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_fromArray,Ia.prototype._setValue_fromArray_setNeedsUpdate,Ia.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];(class{constructor(){this.uuid=u(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,n=this._parsedPaths,r=this._bindings,o=r.length;let s=void 0,a=t.length,l=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const u=arguments[h],c=u.uuid;let d=e[c];if(void 0===d){d=a++,e[c]=d,t.push(u);for(let t=0,e=o;t!==e;++t)r[t].push(new Ia(u,i[t],n[t]))}else if(d<l){s=t[d];const a=--l,h=t[a];e[h.uuid]=d,t[d]=h,e[c]=a,t[a]=u;for(let t=0,e=o;t!==e;++t){const e=r[t],o=e[a];let s=e[d];e[d]=o,void 0===s&&(s=new Ia(u,i[t],n[t])),e[a]=s}}else t[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o],a=s.uuid,l=e[a];if(void 0!==l&&l>=r){const o=r++,h=t[o];e[h.uuid]=l,t[l]=h,e[a]=o,t[o]=s;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[o],r=e[l];e[l]=n,e[o]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_,o=t.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<r){const s=--r,a=t[s],h=--o,u=t[h];e[a.uuid]=l,t[l]=a,e[u.uuid]=s,t[s]=u,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[s],r=e[h];e[l]=n,e[s]=r,e.pop()}}else{const r=--o,s=t[r];r>0&&(e[s.uuid]=l),t[l]=s,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const r=this._bindings;if(void 0!==n)return r[n];const o=this._paths,s=this._parsedPaths,a=this._objects,l=a.length,h=this.nCachedObjects_,u=new Array(l);n=r.length,i[t]=n,o.push(t),s.push(e),r.push(u);for(let i=h,n=a.length;i!==n;++i){const n=a[i];u[i]=new Ia(n,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,r=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];e[t[s]]=i,o[i]=a,o.pop(),r[i]=r[s],r.pop(),n[i]=n[s],n.pop()}}}).prototype.isAnimationObjectGroup=!0;class Pa{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const r=e.tracks,o=r.length,s=new Array(o),a={endingStart:2400,endingEnd:2400};for(let t=0;t!==o;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){const i=this._clip.duration,n=t._clip.duration,r=n/i,o=i/n;t.warp(1,r,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,r=n.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=n._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=r,a[1]=r+i,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const n=(t-r)*i;if(n<0||0===i)return;this._startTime=null,e=i*n}e*=this._updateTimeScale(t);const o=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case 2501:for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(o),e[i].accumulateAdditive(s);break;case 2500:default:for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(o),e[i].accumulate(n,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,r=this._loopCount;const o=2202===i;if(0===t)return-1===r?n:o&&1==(1&r)?e-n:n;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(o&&1==(1&r))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(t,e,i){const n=this._mixer,r=n.time;let o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=r,a[0]=e,s[1]=r+t,a[1]=i,this}}(class extends s{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,s=t._interpolants,a=i.uuid,l=this._bindingsByRootAndName;let h=l[a];void 0===h&&(h={},l[a]=h);for(let t=0;t!==r;++t){const r=n[t],l=r.name;let u=h[l];if(void 0!==u)o[t]=u;else{if(u=o[t],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,a,l));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;u=new ba(Ia.create(i,l,n),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,a,l),o[t]=u}s[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,r=this._actionsByClip;let o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),o.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,o=this._actionsByClip,s=o[r],a=s.knownActions,l=a[a.length-1],h=t._byClipCacheIndex;l._byClipCacheIndex=h,a[h]=l,a.pop(),t._byClipCacheIndex=null;delete s.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete o[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,r=this._bindings;let o=n[e];void 0===o&&(o={},n[e]=o),o[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,o=this._bindingsByRootAndName,s=o[n],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete s[r],0===Object.keys(s).length&&delete o[n]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new bs(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){const n=e||this._root,r=n.uuid;let o="string"==typeof t?Ps.findByName(n,t):t;const s=null!==o?o.uuid:t,a=this._actionsByClip[s];let l=null;if(void 0===i&&(i=null!==o?o.blendMode:2500),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;l=a.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const h=new Pa(this,o,e,i);return this._bindAction(h,l),this._addInactiveAction(h,s,r),h}existingAction(t,e){const i=e||this._root,n=i.uuid,r="string"==typeof t?Ps.findByName(i,t):t,o=r?r.uuid:t,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[n]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let s=0;s!==i;++s){e[s]._update(n,t,r,o)}const s=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)s[t].apply(o);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){const t=r.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const r=n._cacheIndex,o=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,o._cacheIndex=r,e[r]=o,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}).prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Oa{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new Oa(void 0===this.value.clone?this.value:this.value.clone())}}(class extends fr{constructor(t,e,i=1){super(t,e),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}).prototype.isInstancedInterleavedBuffer=!0;(class{constructor(t,e,i,n,r){this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=n,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}).prototype.isGLBufferAttribute=!0;const Na=new g;class La{constructor(t=new g(1/0,1/0),e=new g(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Na.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Na.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}La.prototype.isBox2=!0;const Da=new M,Fa=new M;(class extends Rt{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}).prototype.isImmediateRenderObject=!0;const Ba=new M,Ua=new rt,ka=new rt;const Ga=new Float32Array(1);new Int32Array(Ga.buffer);Math.pow(2,8);const Ha=[.125,.215,.35,.446,.526,.582],ja=5+Ha.length,za=new Jt({side:1,depthWrite:!1,depthTest:!1}),{_lodPlanes:Va,_sizeLods:Xa,_sigmas:Wa}=(new Ie(new Oe,za),Ya());Math.sqrt(5);function Ya(){const t=[],e=[],i=[];let n=8;for(let r=0;r<ja;r++){const o=Math.pow(2,n);e.push(o);let s=1/o;r>4?s=Ha[r-8+4-1]:0==r&&(s=0),i.push(s);const a=1/(o-1),l=-a/2,h=1+a/2,u=[l,l,h,l,h,h,l,l,h,h,l,h],c=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*c),v=new Float32Array(f*d*c),_=new Float32Array(m*d*c);for(let t=0;t<c;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];g.set(n,p*d*t),v.set(u,f*d*t);const r=[t,t,t,t,t,t];_.set(r,m*d*t)}const y=new de;y.setAttribute("position",new $t(g,p)),y.setAttribute("uv",new $t(v,f)),y.setAttribute("faceIndex",new $t(_,m)),t.push(y),n>4&&n--}return{_lodPlanes:t,_sizeLods:e,_sigmas:i}}co.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(co.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},zs.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},class extends eo{constructor(t=10,e=10,i=4473924,n=8947848){i=new Zt(i),n=new Zt(n);const r=e/2,o=t/e,s=t/2,a=[],l=[];for(let t=0,h=0,u=-s;t<=e;t++,u+=o){a.push(-s,0,u,s,0,u),a.push(u,0,-s,u,0,s);const e=t===r?i:n;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const h=new de;h.setAttribute("position",new ne(a,3)),h.setAttribute("color",new ne(l,3));super(h,new Wr({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},class extends eo{constructor(t){const e=function t(e){const i=[];e&&e.isBone&&i.push(e);for(let n=0;n<e.children.length;n++)i.push.apply(i,t(e.children[n]));return i}(t),i=new de,n=[],r=[],o=new Zt(0,0,1),s=new Zt(0,1,0);for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(o.r,o.g,o.b),r.push(s.r,s.g,s.b))}i.setAttribute("position",new ne(n,3)),i.setAttribute("color",new ne(r,3));super(i,new Wr({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,n=i.getAttribute("position");ka.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(Ua.multiplyMatrices(ka,r.matrixWorld),Ba.setFromMatrixPosition(Ua),n.setXYZ(i,Ba.x,Ba.y,Ba.z),Ua.multiplyMatrices(ka,r.parent.matrixWorld),Ba.setFromMatrixPosition(Ua),n.setXYZ(i+1,Ba.x,Ba.y,Ba.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Fs.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ca.extractUrlBase(t)},Fs.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},La.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},La.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},La.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},La.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},I.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},I.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},I.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},I.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},I.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Z.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},qe.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},class{constructor(t=new M,e=new M){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Da.subVectors(t,this.start),Fa.subVectors(this.end,this.start);const i=Fa.dot(Fa);let n=Fa.dot(Da)/i;return e&&(n=c(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},v.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},v.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},v.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},v.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},v.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},v.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},rt.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},rt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},rt.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new M).setFromMatrixColumn(this,3)},rt.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},rt.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},rt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rt.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},rt.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},rt.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rt.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rt.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rt.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},rt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},rt.prototype.makeFrustum=function(t,e,i,n,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,o)},rt.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Xe.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},A.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},A.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},nt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},nt.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},nt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Gt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Gt.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Gt.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Gt.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Gt.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Gt.barycoordFromPoint=function(t,e,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Gt.getBarycoord(t,e,i,n,r)},Gt.normal=function(t,e,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Gt.getNormal(t,e,i,n)},Vs.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Vs.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new os(this,t)},Vs.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new as(this,t)},g.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},g.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},g.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},M.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},M.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},M.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},M.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},M.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},M.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},E.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},E.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Rt.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Rt.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Rt.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Rt.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Rt.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Rt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Ie.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Ie.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Ur.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Ue.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Xs.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties($t.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),$t.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},$t.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},$t.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},de.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},de.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new $t(arguments[1],arguments[2])))},de.prototype.addDrawCall=function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},de.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},de.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},de.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},de.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(de.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),fr.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},fr.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},os.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},os.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},os.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},pr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Oa.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(jt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Zt}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(Fe.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),ur.prototype.clearTarget=function(t,e,i,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,i,n)},ur.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},ur.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},ur.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},ur.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},ur.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},ur.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},ur.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},ur.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},ur.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},ur.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},ur.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},ur.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},ur.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},ur.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},ur.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},ur.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},ur.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},ur.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},ur.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},ur.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},ur.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},ur.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},ur.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},ur.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(ur.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(tr.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(S.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),xa.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new ya).load(t,(function(t){e.setBuffer(t)})),this},class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}}.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ke.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},ke.prototype.clear=function(t,e,i,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,i,n)},y.crossOrigin=void 0,y.loadTexture=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new Hs;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,i,void 0,n);return e&&(o.mapping=e),o},y.loadTextureCube=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new Gs;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,i,void 0,n);return e&&(o.mapping=e),o},y.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},y.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"130"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="130");var qa=i(6),Za=i.n(qa),Ja=i(33),Ka=i.n(Ja),Qa=i(11),$a=i.n(Qa);class tl{constructor(){this.camera=new ra(10,10,10,10),this.camera.position.z=100,this.camera.position.x=0,this.camera.position.y=0}focus(t,e){t.position.z=50}updateAspect(t,e){this.camera.left=-1*t/2,this.camera.right=t/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix()}}const el={linear:(t,e,i,n)=>i*t/n+e,easeIn:(t,e,i,n)=>i*(t/=n)*t+e,strongEaseIn:(t,e,i,n)=>i*(t/=n)*t*t*t*t+e,strongEaseOut:(t,e,i,n)=>i*((t=t/n-1)*t*t*t*t+1)+e,sineaseIn:(t,e,i,n)=>i*(t/=n)*t*t+e,sineaseOut:(t,e,i,n)=>i*((t=t/n-1)*t*t+1)+e},il=new b;class nl{constructor(){this.camera=new tl,this.mesh=new Ie,this.material=null,this.geometry=null}applyOptions(t){}addObjects(t){this.mesh.position.z=50,t.add(this.mesh)}setSize(t,e){this.camera.updateAspect(t,e),this.geometry=new Ke(t,e,1,1),this.material=new Fe({fragmentShader:this.fragmentShader,vertexShader:"\nvarying vec2 vUv;\nvoid main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"}),this.material.uniforms={width:{value:t},height:{value:e},timePercent:{value:0},texturePrev:{value:il},textureNext:{value:il}},this.applyOptions(this.options),this.mesh.geometry=this.geometry,this.mesh.material=this.material}setPrevTexture(t){this.material.uniforms.texturePrev.value=t}setNextTexture(t){this.material.uniforms.textureNext.value=t}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}var rl=i(72),ol=i.n(rl),sl=i(73),al=i.n(sl);var ll=i(74),hl=i.n(ll);var ul=i(75),cl=i.n(ul);var dl=i(76),pl=i.n(dl);var fl=i(77),ml=i.n(fl);var gl=i(78),vl=i.n(gl);var _l=i(79),yl=i.n(_l);var xl=i(80),bl=i.n(xl);var Tl=i(81),El=i.n(Tl);var Sl=i(82),wl=i.n(Sl);var Al=i(83),Ml=i.n(Al);var Cl=i(84),Rl=i.n(Cl);var Il=i(85),Pl=i.n(Il);class Ol{constructor(){this.camera=new Ue(60,1,1,2e3),this.camera.position.z=1e3,this.camera.position.x=0,this.camera.position.y=0}updateAspect(t,e){this.camera.aspect=t/e,this.camera.updateProjectionMatrix()}focus(t,e){const i=.5*e/Math.tan(Math.PI/6);t.position.z=1e3-i}}class Nl{constructor(){this.prevTexture=il,this.nextTexture=il,this.geometry=new de,this.material=null,this.camera=new Ol,this.mesh=new Ie,this.textureWidth=0,this.textureHeight=0}horizontalSegments(){return Math.ceil(this.verticalSegments*this.textureWidth/this.textureHeight)}applyOptions(t){this.options=t}initMesh(t,e){const i=[],n=[],r=[],o=this.verticalSegments,s=this.horizontalSegments(),a=t/2,l=e/2,h=t/s,u=e/o,c=this.extraAttributes(),d=Object.keys(c),p=d.reduce((t,e)=>(t[e]=[],t),{});for(let t=0;t<o;t++){const e=t*u-l;for(let i=0;i<s;i++){const l=i*h-a;n.push(l,-e,0),r.push(1*i/s,1-1*t/o),d.forEach(e=>p[e].push(...c[e].generator(t,i))),n.push(l+h,-e,0),r.push(1*(i+1)/s,1-1*t/o),d.forEach(e=>p[e].push(...c[e].generator(t,i))),n.push(l,-e-u,0),r.push(1*i/s,1-1*(t+1)/o),d.forEach(e=>p[e].push(...c[e].generator(t,i))),n.push(l+h,-e-u,0),r.push(1*(i+1)/s,1-1*(t+1)/o),d.forEach(e=>p[e].push(...c[e].generator(t,i)))}}for(let t=0;t<o*s;t++){const e=4*t,n=e+1,r=e+2,o=e+3;i.push(n,e,o),i.push(e,r,o)}return this.geometry.setIndex(i),this.geometry.setAttribute("position",new ne(n,3)),this.geometry.setAttribute("uv",new ne(new Float32Array(r),2)),d.forEach(t=>{const{threeType:e,jsType:i,itemSize:n}=c[t];this.geometry.setAttribute(t,new e(new i(p[t]),n))}),{verticalSegments:o,horizontalSegments:s,segmentWidth:h,segmentHeight:u}}setSize(t,e){this.textureWidth=t,this.textureHeight=e,this.camera.updateAspect(t,e),this.camera.focus(this.mesh,e),this.material=new Fe({fragmentShader:this.fragmentShader,vertexShader:this.vertexShader,side:2}),this.mesh.geometry=this.geometry,this.material.transparent=!0,this.mesh.material=this.material;const{verticalSegments:i,horizontalSegments:n,segmentWidth:r,segmentHeight:o}=this.initMesh(t,e);this.material.uniforms={segmentWidth:{value:r},segmentHeight:{value:o},verticalSegments:{value:i},horizontalSegments:{value:n},timePercent:{value:0},texturePrev:{value:il},textureNext:{value:il}},this.applyOptions(this.options)}setPrevTexture(t){this.prevTexture=t,this.material.uniforms.texturePrev.value=t}setNextTexture(t){this.nextTexture=t,this.material.uniforms.textureNext.value=t}addObjects(t){t.add(this.mesh)}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}var Ll=i(86),Dl=i.n(Ll),Fl=i(87),Bl=i.n(Fl);var Ul=i(88),kl=i.n(Ul),Gl=i(89),Hl=i.n(Gl);var jl=i(90),zl=i.n(jl),Vl=i(91),Xl=i.n(Vl);var Wl=i(92),Yl=i.n(Wl),ql=i(93),Zl=i.n(ql);var Jl=i(94),Kl=i.n(Jl),Ql=i(95),$l=i.n(Ql);var th=i(96),eh=i.n(th),ih=i(97),nh=i.n(ih);class rh extends Nl{constructor(){super(...arguments),this.duration=1250,this.options=[],this.fragmentShader=nh.a,this.vertexShader=eh.a,this.verticalSegments=100}addObjects(t){t.add(this.mesh),t.background=this.nextTexture}extraAttributes(){return{}}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"invX"===t.name);this.material.uniforms.option={value:(null==e?void 0:e.value)?Number(e.value):0}}}var oh=i(98),sh=i.n(oh),ah=i(99),lh=i.n(ah);var hh=i(100),uh=i.n(hh);var ch=i(101),dh=i.n(ch);var ph=i(102),fh=i.n(ph);var mh=i(103),gh=i.n(mh),vh=i(104),_h=i.n(vh);var yh=i(105),xh=i.n(yh);var bh=i(46),Th=i.n(bh),Eh=i(47),Sh=i.n(Eh);var wh=i(106),Ah=i.n(wh),Mh=i(107),Ch=i.n(Mh);const Rh={RandomLines:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=al.a,this.options=[{name:"dir",value:"horz"}]}genRandomLines(){let t=[1];for(let e=20;e--;){let e=t.sort((t,e)=>e-t)[0],i=t.indexOf(e),n=Math.random(),r=e*n,o=e*(1-n);t.splice(i,1),t.push(r,o)}let e=t.length;for(;e;){let i=Math.floor(Math.random()*e--);[t[i],t[e]]=[t[e],t[i]]}return t}applyOptions(t){var e,i;super.applyOptions(t),this.material.uniforms.direction={value:"horz"===(null===(i=null===(e=this.options)||void 0===e?void 0:e[0])||void 0===i?void 0:i.value)?0:1}}setSize(t,e){super.setSize(t,e),this.material.uniforms.lines={value:this.genRandomLines()},this.material.vertexShader=ol.a}},Shape:class extends nl{constructor(){super(...arguments),this.duration=800,this.fragmentShader=hl.a,this.options=[]}},Ripples:class extends nl{constructor(){super(...arguments),this.duration=1400,this.fragmentShader=cl.a,this.options=[{name:"dir",value:"center"}],this.optionsMap={center:0,ru:1,lu:2,ld:3,rd:4}}applyOptions(t){var e,i;super.applyOptions(t);const n=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:null===(e=this.optionsMap)||void 0===e?void 0:e[null!==(i=null==n?void 0:n.value)&&void 0!==i?i:"center"]}}},Erase:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=pl.a,this.options=[],this.defaultDir="right",this.optionsMap={[this.defaultDir]:0,d:1,r:2,u:3}}applyOptions(t){var e,i;super.applyOptions(t);const n=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:null===(e=this.optionsMap)||void 0===e?void 0:e[null!==(i=null==n?void 0:n.value)&&void 0!==i?i:this.defaultDir]}}},Dissolve:class extends nl{constructor(){super(...arguments),this.duration=1200,this.fragmentShader=ml.a,this.options=[],this.dissolveIndices={}}random40(){return Math.ceil(40*Math.random())}setSize(t,e){super.setSize(t,e);for(let t=0;t<1600;t++){let t=this.random40(),e=this.random40();for(;void 0!==this.dissolveIndices[`${t}_${e}`];)t=this.random40(),e=this.random40();this.dissolveIndices[`${t}_${e}`]=0}this.material.uniforms.dissolveTexture={value:this.genDissolveToTexture()}}genDissolveToTexture(){var t=new Uint8Array(4800);for(let e=0;e<1600;e++){const i=e%40+1,n=Math.floor(e/40)+1,r=3*e;0===this.dissolveIndices[`${i}_${n}`]?(t[r]=0,t[r+1]=0,t[r+2]=0):(t[r]=255,t[r+1]=255,t[r+2]=255)}return new Gr(t,40,40,1022)}updateAnimation(t){const e=1600*t-Object.keys(this.dissolveIndices).filter(t=>1===this.dissolveIndices[t]).length;for(let t=0;t<e;t++){const t=Object.keys(this.dissolveIndices).filter(t=>0===this.dissolveIndices[t]),e=Math.ceil(Math.random()*t.length)-1;this.dissolveIndices[t[e]]=1}this.material.uniforms.dissolveTexture.value=this.genDissolveToTexture()}},Smooth:class extends nl{constructor(){super(...arguments),this.duration=2e3,this.fragmentShader=vl.a,this.options=[]}},FadeInOut:class extends nl{constructor(){super(...arguments),this.duration=700,this.fragmentShader=yl.a,this.options=[]}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"thruBlk"===t.name);this.material.uniforms.option={value:"1"===(null==e?void 0:e.value)?1:0}}},Push:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=bl.a,this.options=[],this.optionsMap={u:0,r:1,d:2,l:3}}applyOptions(t){var e,i;super.applyOptions(t);const n=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:null===(e=this.optionsMap)||void 0===e?void 0:e[null!==(i=null==n?void 0:n.value)&&void 0!==i?i:"l"]}}},Separation:class extends nl{constructor(){super(...arguments),this.duration=1500,this.fragmentShader=El.a,this.options=[]}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"orient"===t.name),i=this.options.find(t=>"dir"===t.name);this.material.uniforms.orient={value:"vert"===(null==e?void 0:e.value)},this.material.uniforms.direction={value:"in"===(null==i?void 0:i.value)}}},Display:class extends nl{constructor(){super(...arguments),this.duration=3400,this.fragmentShader=wl.a,this.options=[]}applyOptions(t){const e=this.options.find(t=>"dir"===t.name),i=this.options.find(t=>"thruBlk"===t.name);this.material.uniforms.direction={value:"r"===(null==e?void 0:e.value)},this.material.uniforms.thruBlk={value:"1"===(null==i?void 0:i.value)}}},Uncover:class extends nl{constructor(){super(...arguments),this.duration=750,this.fragmentShader=Ml.a,this.options=[],this.defaultDir="right",this.optionsMap={[this.defaultDir]:0,d:1,r:2,u:3,ld:4,lu:5,rd:6,ru:7},this.selfOptionsList=[{x:-1,y:0},{x:0,y:-1},{x:1,y:0},{x:0,y:1},{x:-1,y:-1},{x:-1,y:1},{x:1,y:-1},{x:1,y:1}]}applyOptions(t){var e;super.applyOptions(t);const i=this.options.find(t=>"dir"===t.name),n=this.optionsMap[null!==(e=null==i?void 0:i.value)&&void 0!==e?e:this.defaultDir],r=this.selfOptionsList[n];this.material.uniforms.optionX={value:r.x},this.material.uniforms.optionY={value:r.y}}},Cover:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=Rl.a,this.options=[],this.defaultDir="right",this.optionsMap={[this.defaultDir]:0,d:1,r:2,u:3,ld:4,lu:5,rd:6,ru:7},this.selfOptionsList=[{x:-1,y:0},{x:0,y:-1},{x:1,y:0},{x:0,y:1},{x:-1,y:-1},{x:-1,y:1},{x:1,y:-1},{x:1,y:1}]}applyOptions(t){var e;super.applyOptions(t);const i=this.options.find(t=>"dir"===t.name),n=this.optionsMap[null!==(e=null==i?void 0:i.value)&&void 0!==e?e:this.defaultDir],r=this.selfOptionsList[n];this.material.uniforms.optionX={value:r.x},this.material.uniforms.optionY={value:r.y}}},Flash:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=Pl.a,this.options=[]}},Checkerboard:class extends Nl{constructor(){super(...arguments),this.duration=2500,this.options=[{name:"dir",value:"horz"}],this.fragmentShader=Bl.a,this.vertexShader=Dl.a,this.vIndex="",this.delay=0,this.verticalSegments=5}extraAttributes(){return{times:{threeType:ne,jsType:Float32Array,itemSize:1,generator:(t,e)=>(this.vIndex!==`${t}${e}`&&(this.delay=.3*Math.random(),this.vIndex=`${t}${e}`),[this.delay])},segment:{threeType:ne,jsType:Float32Array,itemSize:2,generator:(t,e)=>[e,t]},option:{threeType:ee,jsType:Int32Array,itemSize:1,generator:()=>[this.options.find(t=>"dir"===t.name&&"horz"===t.value)?0:1]}}}},Vortex:class{constructor(){this.duration=4e3,this.geometry=new de,this.material=new Fe({fragmentShader:Hl.a,vertexShader:kl.a,side:2}),this.camera=new Ol,this.mesh=new Ie}initData(t,e){const i=[],n=[],r=[],o=[],s=[],a=[],l=Math.ceil(124*t/e),h=t/2,u=e/2,c=t/l,d=e/124;for(let t=0;t<124;t++){const e=t*d-u;for(let i=0;i<l;i++){const u=i*c-h,p=Math.ceil((i+1)/((l+1)/12)),f=.4/p,m=(p-1)*f+Math.random()*f;n.push(u,-e,0),o.push(1*i/l,1-1*t/124),r.push(0,0,1),s.push(i,t),a.push(m),n.push(u+c,-e,0),o.push(1*(i+1)/l,1-1*t/124),r.push(0,0,1),s.push(i,t),a.push(m),n.push(u,-e-d,0),o.push(1*i/l,1-1*(t+1)/124),r.push(0,0,1),s.push(i,t),a.push(m),n.push(u+c,-e-d,0),o.push(1*(i+1)/l,1-1*(t+1)/124),r.push(0,0,1),s.push(i,t),a.push(m)}}for(let t=0;t<124*l;t++){const e=4*t,n=e+1,r=e+2,o=e+3;i.push(n,e,o),i.push(e,r,o)}return this.geometry.setIndex(i),this.geometry.setAttribute("position",new ne(n,3)),this.geometry.setAttribute("normal",new ne(r,3)),this.geometry.setAttribute("uv",new ne(new Float32Array(o),2)),this.geometry.setAttribute("segment",new ne(new Float32Array(s),2)),this.geometry.setAttribute("times",new ne(new Float32Array(a),1)),{verticalSegments:124,horizontalSegments:l,segmentWidth:c,segmentHeight:d}}setSize(t,e){const{verticalSegments:i,horizontalSegments:n,segmentWidth:r,segmentHeight:o}=this.initData(t,e);this.material.uniforms={duration:{value:this.duration},segmentWidth:{value:r},segmentHeight:{value:o},verticalSegments:{value:i},horizontalSegments:{value:n},timePercent:{value:0},texturePrev:{value:il},textureNext:{value:il}},this.camera.updateAspect(t,e),this.camera.focus(this.mesh,e),this.mesh.geometry=this.geometry;new ds({side:2,vertexColors:!0}).wireframe=!0,this.material.transparent=!0,this.mesh.material=this.material}setPrevTexture(t){this.material.uniforms.texturePrev.value=t}setNextTexture(t){this.material.uniforms.textureNext.value=t}addObjects(t){t.add(this.mesh)}updateAnimation(t){let e=(t-.4)/.2;e<0?e=0:e>1&&(e=1),this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}},WindowShades:class{constructor(){this.duration=1600,this.geometry=new de,this.material=new Fe({fragmentShader:Xl.a,vertexShader:zl.a,side:2}),this.horizontalSegments=16,this.meshToCameraDistance=0,this.camera=new Ol,this.mesh=new Ie}initData(t,e){const i=[],n=[],r=[],o=[],s=[],a=[],l=t/2,h=e/2,u=t/this.horizontalSegments;for(let t=0;t<this.horizontalSegments;t++){const e=Math.abs(t-Math.ceil(this.horizontalSegments/2))*(.3/Math.ceil(this.horizontalSegments/2)),i=t*u-l;n.push(i,h,0),r.push(0),o.push(t/this.horizontalSegments,1),s.push(t),a.push(e),n.push(i+u,h,0),r.push(0),o.push((t+1)/this.horizontalSegments,1),s.push(t),a.push(e),n.push(i,-1*h,0),r.push(0),o.push(t/this.horizontalSegments,0),s.push(t),a.push(e),n.push(i+u,-1*h,0),o.push((t+1)/this.horizontalSegments,0),r.push(0),s.push(t),a.push(e),n.push(i+u,h,0),r.push(1),o.push(t/this.horizontalSegments,1),s.push(t),a.push(e),n.push(i+u,h,-1*u),r.push(1),o.push((t+1)/this.horizontalSegments,1),s.push(t),a.push(e),n.push(i+u,-1*h,0),r.push(1),o.push(t/this.horizontalSegments,0),s.push(t),a.push(e),n.push(i+u,-1*h,-1*u),o.push((t+1)/this.horizontalSegments,0),r.push(1),s.push(t),a.push(e)}for(let t=0;t<this.horizontalSegments;t++){const e=8*t,n=e+1,r=e+2,o=e+3,s=e+4,a=e+5,l=e+6,h=e+7;i.push(n,e,o),i.push(e,r,o),i.push(a,s,h),i.push(s,l,h)}this.geometry.setIndex(i),this.geometry.setAttribute("position",new ne(n,3)),this.geometry.setAttribute("uv",new ne(new Float32Array(o),2)),this.geometry.setAttribute("index",new ne(new Float32Array(s),1)),this.geometry.setAttribute("type",new ne(new Float32Array(r),1)),this.geometry.setAttribute("delay",new ne(new Float32Array(a),1))}setPrevTexture(t){this.material.uniforms.texturePrev.value=t}setNextTexture(t){this.material.uniforms.textureNext.value=t}setSize(t,e){this.initData(t,e),this.material.uniforms={segments:{value:this.horizontalSegments},segmentWidth:{value:t/this.horizontalSegments},timePercent:{value:0},texturePrev:{value:il},textureNext:{value:il}},this.meshToCameraDistance=.5*e/Math.tan(Math.PI/6),this.camera.updateAspect(t,e),this.camera.focus(this.mesh,e),this.mesh.geometry=this.geometry,this.material.transparent=!0,this.mesh.material=this.material}addObjects(t){t.add(this.mesh)}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}},Curtain:class extends Nl{constructor(){super(...arguments),this.duration=6e3,this.options=[],this.fragmentShader=Zl.a,this.vertexShader=Yl.a,this.verticalSegments=100}extraAttributes(){return{isLeft:{threeType:ne,jsType:Float32Array,itemSize:1,generator:(t,e)=>[e<this.horizontalSegments()/2?1:0]}}}addObjects(t){super.addObjects(t),this.mesh.position.z+=20,t.background=this.nextTexture}},Fall:class extends Nl{constructor(){super(...arguments),this.zCurveLimit=100,this.duration=2e3,this.options=[{name:"invX",value:"0"}],this.verticalSegments=100,this.fragmentShader=$l.a,this.vertexShader=Kl.a}extraAttributes(){return{}}setSize(t,e){var i;super.setSize(t,e);const n=this.options.find(t=>"invX"===t.name);this.material.uniforms.zCurveLimit={value:this.zCurveLimit},this.material.uniforms.aCoefficient={value:this.zCurveLimit/(this.textureHeight/2*(this.textureHeight/2))},this.material.uniforms.option={value:null!==(i=null==n?void 0:n.value)&&void 0!==i?i:0}}addObjects(t){t.add(this.mesh),t.background=this.nextTexture}updateAnimation(t){this.material.uniforms.timePercent.value=t}},Suspension:class extends rh{constructor(){super(...arguments),this.duration=2e3,this.fragmentShader=lh.a,this.vertexShader=sh.a}addObjects(t){t.add(this.mesh),t.background=this.prevTexture}},Clock:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=uh.a,this.options=[]}},Combing:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=dh.a,this.options=[]}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:"vert"===(null==e?void 0:e.value)?1:0}}},Scale:class extends nl{constructor(){super(...arguments),this.duration=900,this.fragmentShader=fh.a,this.options=[]}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:"in"===(null==e?void 0:e.value)?0:1}}},PeelOff:rh,Flip:class extends Nl{constructor(){super(...arguments),this.duration=1250,this.options=[],this.fragmentShader=_h.a,this.vertexShader=gh.a,this.verticalSegments=1}extraAttributes(){return{}}applyOptions(t){const e=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:"l"===(null==e?void 0:e.value)?1:0}}},Strips:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=xh.a,this.options=[],this.defaultDir="lu",this.optionsMap={[this.defaultDir]:0,ld:1,rd:2,ru:3}}applyOptions(t){var e,i;super.applyOptions(t);const n=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:null===(e=this.optionsMap)||void 0===e?void 0:e[null!==(i=null==n?void 0:n.value)&&void 0!==i?i:this.defaultDir]}}},Gallery:class{constructor(){this.camera=new Ol,this.duration=1600,this.options=[],this.gap=10,this.group=new or,this.prevMesh=new Ie,this.nextMesh=new Ie,this.width=100,this.height=100,this.prevMaterial=new Fe({vertexShader:Th.a,fragmentShader:Sh.a,side:2,uniforms:{galleryTexture:{value:il},galleryHeight:{value:1}}}),this.nextMaterial=new Fe({vertexShader:Th.a,fragmentShader:Sh.a,side:2,uniforms:{galleryTexture:{value:il},galleryHeight:{value:1}}})}get isRight(){const t=this.options.find(t=>"dir"===t.name);return!t||"r"===t.value}addObjects(t){this.group.add(this.prevMesh),this.group.add(this.nextMesh),t.add(this.group)}dispose(){this.prevMaterial.dispose(),this.nextMaterial.dispose(),this.prevMesh.geometry.dispose(),this.nextMesh.geometry.dispose()}setNextTexture(t){this.nextMaterial.uniforms.galleryTexture.value=t,this.nextMesh.material=this.nextMaterial}setPrevTexture(t){this.prevMaterial.uniforms.galleryTexture.value=t,this.prevMesh.material=this.prevMaterial}setSize(t,e){this.camera.updateAspect(t,e),this.camera.focus(this.prevMesh,e),this.width=t,this.height=e,this.gap=this.width/20,this.prevMaterial.uniforms.galleryHeight.value=e,this.nextMaterial.uniforms.galleryHeight.value=e;const i=new Ke(t,1.2*e+8,1,1);this.prevMesh.geometry=i;const n=new Ke(t,1.2*e+8,1,1);this.nextMesh.geometry=n,this.nextMesh.position.z=this.prevMesh.position.z,this.isRight?this.nextMesh.position.x=t+this.gap:this.nextMesh.position.x=-1*(t+this.gap)}updateAnimation(t){if(t<.3){const e=t/.3;this.isRight?(this.group.position.z=.25*this.height*-1*e,this.group.rotation.y=Math.PI/12*-1*e):(this.group.position.z=.25*this.height*-1*e,this.group.rotation.y=Math.PI/12*e)}else if(t>=.3&&t<.7){const e=(t-.3)/.4;this.isRight?(this.group.position.z=-1*(.25*this.height+.55*this.height*e),this.group.position.x=-1*(this.width+this.gap)*e):(this.group.position.z=-1*(.25*this.height+.55*this.height*e),this.group.position.x=(this.width+this.gap)*e)}else{const e=(t-.7)/.3;this.isRight?(this.group.position.x=-1*(this.width+this.gap),this.group.position.z=.8*this.height*-1*(1-e),this.group.rotation.y=Math.PI/12*-1*(1-e)):(this.group.position.x=this.width+this.gap,this.group.position.z=.8*this.height*-1*(1-e),this.group.rotation.y=Math.PI/12*(1-e))}}},Switch:class{constructor(){this.camera=new Ol,this.duration=6e3,this.options=[],this.prevMesh=new Ie,this.nextMesh=new Ie,this.width=100,this.height=100,this.depth=1,this.prevDepth=1}addObjects(t){t.add(this.prevMesh),t.add(this.nextMesh)}dispose(){Array.isArray(this.prevMesh.material)?this.prevMesh.material.forEach(t=>t.dispose()):this.prevMesh.material.dispose(),this.prevMesh.geometry.dispose(),Array.isArray(this.nextMesh.material)?this.nextMesh.material.forEach(t=>t.dispose()):this.nextMesh.material.dispose(),this.nextMesh.geometry.dispose()}setNextTexture(t){const e=new Jt({map:t});this.nextMesh.material=e}setPrevTexture(t){const e=new Jt({map:t});this.prevMesh.material=e}setSize(t,e){this.camera.updateAspect(t,e),this.camera.focus(this.prevMesh,e),this.width=t,this.height=e,this.depth=e/2;const i=new Ke(t,e,1,1);this.prevMesh.geometry=i;const n=new Ke(t,e,1,1);this.nextMesh.geometry=n,this.prevDepth=this.prevMesh.position.z}updateAnimation(t){const e=this.options.find(t=>"dir"===t.name);if(t<.5){const e=t/.5;this.prevMesh.position.x=this.width/2*e,this.prevMesh.rotation.y=-Math.PI/10*e,this.nextMesh.position.x=-this.width/2*e,this.nextMesh.rotation.y=Math.PI/10*e,this.nextMesh.position.z=this.prevDepth-this.depth*(1-e)}else{const e=(t-.5)/.5;this.prevMesh.position.x=this.width/2*(1-e),this.prevMesh.rotation.y=-Math.PI/10*(1-e),this.prevMesh.position.z=this.prevDepth-this.depth*e,this.nextMesh.position.x=-this.width/2*(1-e),this.nextMesh.rotation.y=Math.PI/10*(1-e)}if(e&&"l"===e.value)if(t<.5){const e=t/.5;this.prevMesh.position.x=-this.width/2*e,this.prevMesh.rotation.y=Math.PI/10*e,this.nextMesh.position.x=this.width/2*e,this.nextMesh.rotation.y=-Math.PI/10*e}else{const e=(t-.5)/.5;this.prevMesh.position.x=-this.width/2*(1-e),this.prevMesh.rotation.y=Math.PI/10*(1-e),this.nextMesh.position.x=this.width/2*(1-e),this.nextMesh.rotation.y=-Math.PI/10*(1-e)}}},Prism:class{constructor(){this.camera=new Ol,this.duration=6e3,this.preset=null,this.presetZ=0,this.mesh=new Ie,this.width=100,this.height=100}addObjects(t){this.mesh.geometry=this.box,t.add(this.mesh)}dispose(){Array.isArray(this.mesh.material)?this.mesh.material.forEach(t=>t.dispose()):this.mesh.material.dispose(),this.mesh.geometry.dispose()}setNextTexture(t){const e=Array.isArray(this.mesh.material)?this.mesh.material:[];e.push(new Jt({map:t})),e.push(new Jt({map:t})),e.push(new Jt({map:t})),this.mesh.material=e}setPrevTexture(t){const e=Array.isArray(this.mesh.material)?this.mesh.material:[];e.push(new Jt({map:t})),e.push(new Jt({map:t})),e.push(new Jt({map:t})),this.mesh.material=e}setSize(t,e){this.camera.updateAspect(t,e),this.camera.focus(this.mesh,e),this.mesh.position.z-=t/2,this.width=t,this.height=e,this.box=new Oe(t,e,t,1,1,1),this.mesh.geometry=this.box}updateAnimation(t){null===this.preset&&(this.preset=t>0?0:Math.PI/2,this.presetZ=this.mesh.position.z);const e=Math.PI/2*t,i=(Math.sqrt(2)-1)*(this.width/2);this.mesh.rotation.y=this.preset+e,this.mesh.position.z=t<=.5?this.presetZ-t/.5*i:this.presetZ-(1-(t-.5)/.5)*i}},Doors:class{constructor(){this.camera=new Ol,this.duration=1600,this.options=[],this.width=100,this.preMaterial=new Fe({fragmentShader:Ch.a,vertexShader:Ah.a,uniforms:{prevTexture:{value:il},timePercent:{value:0},offset:{value:0}}}),this.prevGeometry=new de,this.prevMesh=new Ie,this.nextMesh=new Ie}addObjects(t){this.prevMesh.material=this.preMaterial,this.prevMesh.geometry=this.prevGeometry,this.prevMesh.material.transparent=!0,t.add(this.prevMesh),t.add(this.nextMesh)}setNextTexture(t){this.nextMesh.material=new Jt({map:t})}setPrevTexture(t){this.preMaterial.uniforms.prevTexture.value=t}setSize(t,e){this.width=t,this.camera.updateAspect(t,e),this.camera.focus(this.prevMesh,e);const i=t/2,n=e/2;this.preMaterial.uniforms.offset.value=t/2,this.prevGeometry.setIndex([0,1,2,3,4,5,6,7,8,9,10,11]);const r=this.options.find(t=>"dir"===t.name),o=r&&"vert"===r.value?0:1;this.preMaterial.uniforms.option={value:o},1===o?(this.prevGeometry.setAttribute("position",new ne([-i,n,0,-i,0,0,i,n,0,-i,0,0,i,0,0,i,n,0,-i,0,0,-i,-n,0,i,0,0,-i,-n,0,i,-n,0,i,0,0],3)),this.prevGeometry.setAttribute("uv",new ne([0,1,0,.5,1,1,0,.5,1,.5,1,1,0,.5,0,0,1,.5,0,0,1,0,1,.5],2))):(this.prevGeometry.setAttribute("position",new ne([-i,n,0,-i,-n,0,0,n,0,-i,-n,0,0,-n,0,0,n,0,0,n,0,0,-n,0,i,n,0,0,-n,0,i,-n,0,i,n,0],3)),this.prevGeometry.setAttribute("uv",new ne([0,1,0,0,.5,1,0,0,.5,0,.5,1,.5,1,.5,0,1,1,.5,0,1,0,1,1],2))),this.prevGeometry.setAttribute("left",new ne([1,1,1,1,1,1,0,0,0,0,0,0],1)),this.nextMesh.geometry=new Ke(t,e,1,1),this.nextMesh.position.z=this.prevMesh.position.z-t/4}updateAnimation(t){this.preMaterial.uniforms.timePercent.value=t,this.nextMesh.position.z=this.prevMesh.position.z-(1-t)*(this.width/4)}dispose(){}}};class Ih{constructor(){this.startTime=0,this.lastTime=0,this.lastFPSTime=0,this.renderingDuration=16,this.reverse=!1,this.scene=new pr,this.delay=0,this.easeFn=el.linear,this.preset=null,this.onTransactionEnd=()=>{},this.isTransactionStartApplied=!1,this.prevTexture=null,this.nextTexture=null,this.animationId=null,this.config=null,this.renderer=new ur({alpha:!0,premultipliedAlpha:!0}),this.isPlaying=!1,this.animate=(t=-1)=>{var e,i,n;if(!this.fps(t))return void(this.animationId=window.requestAnimationFrame(this.animate));this.renderer.clear(),t>this.delay&&0===this.lastTime&&(this.lastTime=t,this.startTime=t);let r=0;this.lastTime>0&&r<1&&(r=this.easeFn(t-this.startTime,0,1,null!==(i=null===(e=this.preset)||void 0===e?void 0:e.duration)&&void 0!==i?i:0)),r>1&&(r=1),null===(n=this.preset)||void 0===n||n.updateAnimation(this.reverse?1-r:r),this.rerender(),this.isTransactionStartApplied||(this.isTransactionStartApplied=!0),r<1?this.animationId=window.requestAnimationFrame(this.animate):this.onTransactionEnd()}}initPlayer(t){this.config=t,this.reverse=t.reverse,t.delay&&Number.isInteger(t.delay)&&(this.delay=t.delay),t.easeFn&&(this.easeFn=el[t.easeFn]),t.maxFPS&&Number.isInteger(t.maxFPS)&&t.maxFPS>0&&(this.renderingDuration=Math.ceil(1e3/t.maxFPS)),this.startTime=0,this.lastTime=0,this.scene.clear(),this.renderer.shadowMap.enabled=!0,this.renderer.autoClear=!1,this.renderer.setClearColor(t.clearColor||0),this.isTransactionStartApplied=!1,this.renderer.setSize(t.stageWidth,t.stageHeight),this.preset=new Rh[t.presetType],t.options&&(this.preset.options=t.options),t.duration&&Number.isInteger(t.duration)&&(this.preset.duration=t.duration),this.preset.setSize(t.stageWidth,t.stageHeight)}setPrevTexture(t){var e,i,n,r;t.needsUpdate=!0,this.reverse?(this.nextTexture=t,null===(e=this.preset)||void 0===e||e.setNextTexture(t)):(this.prevTexture=t,null===(i=this.preset)||void 0===i||i.setPrevTexture(t)),null===(n=this.preset)||void 0===n||n.addObjects(this.scene),null===(r=this.preset)||void 0===r||r.updateAnimation(this.reverse?1:0),this.rerender()}setNextTexture(t){var e,i;t.needsUpdate=!0,this.reverse?(this.prevTexture=t,null===(e=this.preset)||void 0===e||e.setPrevTexture(t)):(this.nextTexture=t,null===(i=this.preset)||void 0===i||i.setNextTexture(t))}play(){return new Promise(t=>{this.onTransactionEnd=t,this.animate(),this.isPlaying=!0})}rerender(){var t;this.renderer.clear(),(null===(t=this.preset)||void 0===t?void 0:t.camera.camera)&&this.renderer.render(this.scene,this.preset.camera.camera)}fps(t){if(t<=0)return!0;if(this.lastFPSTime<0)return this.lastFPSTime=t,!0;return t-this.lastFPSTime>=this.renderingDuration&&(this.lastFPSTime=t,!0)}skip(){var t;null===(t=this.preset)||void 0===t||t.updateAnimation(this.reverse?0:1),this.rerender(),this.dispose(),this.onTransactionEnd()}dispose(){var t,e,i;window.cancelAnimationFrame(this.animationId),this.renderer.clear(),this.isPlaying=!1,null===(t=this.preset)||void 0===t||t.dispose(),null===(e=this.prevTexture)||void 0===e||e.dispose(),null===(i=this.nextTexture)||void 0===i||i.dispose();for(let t=this.scene.children.length-1;t>=0;t--){const e=this.scene.children[t];this.scene.remove(e)}this.scene.background=null}destroy(){this.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose()}}i(139);var Ph=i(3),Oh=i(5);Oh.c.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});var Nh=function(){function t(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Ph.isMobile.tablet||Ph.isMobile.phone)&&this.createTouchHook();var e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex=2..toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),t.prototype.createTouchHook=function(){var t=this,e=document.createElement("button");e.style.width="1px",e.style.height="1px",e.style.position="absolute",e.style.top="-1000px",e.style.left="-1000px",e.style.zIndex=2..toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",(function(){t._isMobileAccessibility=!0,t.activate(),t.destroyTouchHook()})),document.body.appendChild(e),this._hookDiv=e},t.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},t.prototype.activate=function(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),null===(t=this.renderer.view.parentNode)||void 0===t||t.appendChild(this.div))},t.prototype.deactivate=function(){var t;this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),null===(t=this.div.parentNode)||void 0===t||t.removeChild(this.div))},t.prototype.updateAccessibleObjects=function(t){if(t.visible&&t.accessibleChildren){t.accessible&&t.interactive&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);var e=t.children;if(e)for(var i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}},t.prototype.update=function(){var t=performance.now();if(!(Ph.isMobile.android.device&&t<this.androidUpdateCount)&&(this.androidUpdateCount=t+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var e=this.renderer.view.getBoundingClientRect(),i=e.left,n=e.top,r=e.width,o=e.height,s=this.renderer,a=s.width,l=s.height,h=s.resolution,u=r/a*h,c=o/l*h,d=this.div;d.style.left=i+"px",d.style.top=n+"px",d.style.width=a+"px",d.style.height=l+"px";for(var p=0;p<this.children.length;p++){var f=this.children[p];if(f.renderId!==this.renderId)f._accessibleActive=!1,Object(Ph.removeItems)(this.children,p,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,p--;else{d=f._accessibleDiv;var m=f.hitArea,g=f.worldTransform;f.hitArea?(d.style.left=(g.tx+m.x*g.a)*u+"px",d.style.top=(g.ty+m.y*g.d)*c+"px",d.style.width=m.width*g.a*u+"px",d.style.height=m.height*g.d*c+"px"):(m=f.getBounds(),this.capHitArea(m),d.style.left=m.x*u+"px",d.style.top=m.y*c+"px",d.style.width=m.width*u+"px",d.style.height=m.height*c+"px",d.title!==f.accessibleTitle&&null!==f.accessibleTitle&&(d.title=f.accessibleTitle),d.getAttribute("aria-label")!==f.accessibleHint&&null!==f.accessibleHint&&d.setAttribute("aria-label",f.accessibleHint)),f.accessibleTitle===d.title&&f.tabIndex===d.tabIndex||(d.title=f.accessibleTitle,d.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}},t.prototype.updateDebugHTML=function(t){t.innerHTML="type: "+t.type+"</br> title : "+t.title+"</br> tabIndex: "+t.tabIndex},t.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);var e=this.renderer,i=e.width,n=e.height;t.x+t.width>i&&(t.width=i-t.x),t.y+t.height>n&&(t.height=n-t.y)},t.prototype.addChild=function(t){var e=this.pool.pop();e||((e=document.createElement("button")).style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="displayObject "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},t.prototype._onClick=function(t){var e=this.renderer.plugins.interaction,i=t.target.displayObject,n=e.eventData;e.dispatchEvent(i,"click",n),e.dispatchEvent(i,"pointertap",n),e.dispatchEvent(i,"tap",n)},t.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction,i=t.target.displayObject,n=e.eventData;e.dispatchEvent(i,"mouseover",n)},t.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction,i=t.target.displayObject,n=e.eventData;e.dispatchEvent(i,"mouseout",n)},t.prototype._onKeyDown=function(t){9===t.keyCode&&this.activate()},t.prototype._onMouseMove=function(t){0===t.movementX&&0===t.movementY||this.deactivate()},t.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},t}(),Lh=i(1),Dh=i(7),Fh=function(){function t(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new Lh.g,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(t.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),t.prototype.getLocalPosition=function(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)},t.prototype.copyEvent=function(t){"isPrimary"in t&&t.isPrimary&&(this.isPrimary=!0),this.button="button"in t&&t.button;var e="buttons"in t&&t.buttons;this.buttons=Number.isInteger(e)?e:"which"in t&&t.which,this.width="width"in t&&t.width,this.height="height"in t&&t.height,this.tiltX="tiltX"in t&&t.tiltX,this.tiltY="tiltY"in t&&t.tiltY,this.pointerType="pointerType"in t&&t.pointerType,this.pressure="pressure"in t&&t.pressure,this.rotationAngle="rotationAngle"in t&&t.rotationAngle,this.twist="twist"in t&&t.twist||0,this.tangentialPressure="tangentialPressure"in t&&t.tangentialPressure||0},t.prototype.reset=function(){this.isPrimary=!1},t}(),Bh=function(t,e){return(Bh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};var Uh=function(){function t(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return t.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},t.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},t}(),kh=function(){function t(e){this._pointerId=e,this._flags=t.FLAGS.NONE}return t.prototype._doSet=function(t,e){this._flags=e?this._flags|t:this._flags&~t},Object.defineProperty(t.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"none",{get:function(){return this._flags===t.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return 0!=(this._flags&t.FLAGS.OVER)},set:function(e){this._doSet(t.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightDown",{get:function(){return 0!=(this._flags&t.FLAGS.RIGHT_DOWN)},set:function(e){this._doSet(t.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftDown",{get:function(){return 0!=(this._flags&t.FLAGS.LEFT_DOWN)},set:function(e){this._doSet(t.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),t.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),t}(),Gh=function(){function t(){this._tempPoint=new Lh.g}return t.prototype.recursiveFindHit=function(t,e,i,n,r){if(!e||!e.visible)return!1;var o=t.data.global,s=!1,a=r=e.interactive||r,l=!0;if(e.hitArea?(n&&(e.worldTransform.applyInverse(o,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?s=!0:(n=!1,l=!1)),a=!1):e._mask&&n&&(e._mask.containsPoint&&e._mask.containsPoint(o)||(n=!1)),l&&e.interactiveChildren&&e.children)for(var h=e.children,u=h.length-1;u>=0;u--){var c=h[u],d=this.recursiveFindHit(t,c,i,n,a);if(d){if(!c.parent)continue;a=!1,d&&(t.target&&(n=!1),s=!0)}}return r&&(n&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(s=!0),e.interactive&&(s&&!t.target&&(t.target=e),i&&i(t,e,!!s))),s},t.prototype.findHit=function(t,e,i,n){this.recursiveFindHit(t,e,i,n,!1)},t}(),Hh={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Oh.c.mixin(Hh);var jh={target:null,data:{global:null}},zh=function(t){function e(e,i){var n=t.call(this)||this;return i=i||{},n.renderer=e,n.autoPreventDefault=void 0===i.autoPreventDefault||i.autoPreventDefault,n.interactionFrequency=i.interactionFrequency||10,n.mouse=new Fh,n.mouse.identifier=1,n.mouse.global.set(-999999),n.activeInteractionData={},n.activeInteractionData[1]=n.mouse,n.interactionDataPool=[],n.eventData=new Uh,n.interactionDOMElement=null,n.moveWhenInside=!1,n.eventsAdded=!1,n.tickerAdded=!1,n.mouseOverRenderer=!("PointerEvent"in globalThis),n.supportsTouchEvents="ontouchstart"in globalThis,n.supportsPointerEvents=!!globalThis.PointerEvent,n.onPointerUp=n.onPointerUp.bind(n),n.processPointerUp=n.processPointerUp.bind(n),n.onPointerCancel=n.onPointerCancel.bind(n),n.processPointerCancel=n.processPointerCancel.bind(n),n.onPointerDown=n.onPointerDown.bind(n),n.processPointerDown=n.processPointerDown.bind(n),n.onPointerMove=n.onPointerMove.bind(n),n.processPointerMove=n.processPointerMove.bind(n),n.onPointerOut=n.onPointerOut.bind(n),n.processPointerOverOut=n.processPointerOverOut.bind(n),n.onPointerOver=n.onPointerOver.bind(n),n.cursorStyles={default:"inherit",pointer:"pointer"},n.currentCursorMode=null,n.cursor=null,n.resolution=1,n.delayedEvents=[],n.search=new Gh,n._tempDisplayObject=new Oh.d,n._eventListenerOptions={capture:!0,passive:!1},n._useSystemTicker=void 0===i.useSystemTicker||i.useSystemTicker,n.setTargetElement(n.renderer.view,n.renderer.resolution),n}return function(t,e){function i(){this.constructor=t}Bh(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),Object.defineProperty(e.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),e.prototype.hitTest=function(t,e){return jh.target=null,jh.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(jh,e,null,!0),jh.target},e.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},e.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(Dh.a.system.add(this.tickerUpdate,this,Dh.c.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(Dh.a.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},e.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},e.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},e.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())},e.prototype.update=function(){if(this.interactionDOMElement)if(this._didMove)this._didMove=!1;else{for(var t in this.cursor=null,this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(t)){var e=this.activeInteractionData[t];if(e.originalEvent&&"touch"!==e.pointerType){var i=this.configureInteractionEventForDOMEvent(this.eventData,e.originalEvent,e);this.processInteractive(i,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},e.prototype.setCursorMode=function(t){t=t||"default";var e=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(e=!1),this.currentCursorMode!==t){this.currentCursorMode=t;var i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.interactionDOMElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.interactionDOMElement.style,i)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.interactionDOMElement.style.cursor=t)}},e.prototype.dispatchEvent=function(t,e,i){i.stopPropagationHint&&t!==i.stopsPropagatingAt||(i.currentTarget=t,i.type=e,t.emit(e,i),t[e]&&t[e](i))},e.prototype.delayDispatchEvent=function(t,e,i){this.delayedEvents.push({displayObject:t,eventString:e,eventData:i})},e.prototype.mapPositionToPoint=function(t,e,i){var n;n=this.interactionDOMElement.parentElement?this.interactionDOMElement.getBoundingClientRect():{x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var r=1/this.resolution;t.x=(e-n.left)*(this.interactionDOMElement.width/n.width)*r,t.y=(i-n.top)*(this.interactionDOMElement.height/n.height)*r},e.prototype.processInteractive=function(t,e,i,n){var r=this.search.findHit(t,e,i,n),o=this.delayedEvents;if(!o.length)return r;t.stopPropagationHint=!1;var s=o.length;this.delayedEvents=[];for(var a=0;a<s;a++){var l=o[a],h=l.displayObject,u=l.eventString,c=l.eventData;c.stopsPropagatingAt===h&&(c.stopPropagationHint=!0),this.dispatchEvent(h,u,c)}return r},e.prototype.onPointerDown=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var i=e.length,n=0;n<i;n++){var r=e[n],o=this.getInteractionDataForPointerId(r),s=this.configureInteractionEventForDOMEvent(this.eventData,r,o);if(s.data.originalEvent=t,this.processInteractive(s,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",s),"touch"===r.pointerType)this.emit("touchstart",s);else if("mouse"===r.pointerType||"pen"===r.pointerType){var a=2===r.button;this.emit(a?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(t,e,i){var n=t.data,r=t.data.identifier;if(i)if(e.trackedPointers[r]||(e.trackedPointers[r]=new kh(r)),this.dispatchEvent(e,"pointerdown",t),"touch"===n.pointerType)this.dispatchEvent(e,"touchstart",t);else if("mouse"===n.pointerType||"pen"===n.pointerType){var o=2===n.button;o?e.trackedPointers[r].rightDown=!0:e.trackedPointers[r].leftDown=!0,this.dispatchEvent(e,o?"rightdown":"mousedown",t)}},e.prototype.onPointerComplete=function(t,e,i){for(var n=this.normalizeToPointerData(t),r=n.length,o=t.target!==this.interactionDOMElement?"outside":"",s=0;s<r;s++){var a=n[s],l=this.getInteractionDataForPointerId(a),h=this.configureInteractionEventForDOMEvent(this.eventData,a,l);if(h.data.originalEvent=t,this.processInteractive(h,this.lastObjectRendered,i,e||!o),this.emit(e?"pointercancel":"pointerup"+o,h),"mouse"===a.pointerType||"pen"===a.pointerType){var u=2===a.button;this.emit(u?"rightup"+o:"mouseup"+o,h)}else"touch"===a.pointerType&&(this.emit(e?"touchcancel":"touchend"+o,h),this.releaseInteractionDataForPointerId(a.pointerId))}},e.prototype.onPointerCancel=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!0,this.processPointerCancel)},e.prototype.processPointerCancel=function(t,e){var i=t.data,n=t.data.identifier;void 0!==e.trackedPointers[n]&&(delete e.trackedPointers[n],this.dispatchEvent(e,"pointercancel",t),"touch"===i.pointerType&&this.dispatchEvent(e,"touchcancel",t))},e.prototype.onPointerUp=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!1,this.processPointerUp)},e.prototype.processPointerUp=function(t,e,i){var n=t.data,r=t.data.identifier,o=e.trackedPointers[r],s="touch"===n.pointerType,a="mouse"===n.pointerType||"pen"===n.pointerType,l=!1;if(a){var h=2===n.button,u=kh.FLAGS,c=h?u.RIGHT_DOWN:u.LEFT_DOWN,d=void 0!==o&&o.flags&c;i?(this.dispatchEvent(e,h?"rightup":"mouseup",t),d&&(this.dispatchEvent(e,h?"rightclick":"click",t),l=!0)):d&&this.dispatchEvent(e,h?"rightupoutside":"mouseupoutside",t),o&&(h?o.rightDown=!1:o.leftDown=!1)}i?(this.dispatchEvent(e,"pointerup",t),s&&this.dispatchEvent(e,"touchend",t),o&&(a&&!l||this.dispatchEvent(e,"pointertap",t),s&&(this.dispatchEvent(e,"tap",t),o.over=!1))):o&&(this.dispatchEvent(e,"pointerupoutside",t),s&&this.dispatchEvent(e,"touchendoutside",t)),o&&o.none&&delete e.trackedPointers[r]},e.prototype.onPointerMove=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);"mouse"!==e[0].pointerType&&"pen"!==e[0].pointerType||(this._didMove=!0,this.cursor=null);for(var i=e.length,n=0;n<i;n++){var r=e[n],o=this.getInteractionDataForPointerId(r),s=this.configureInteractionEventForDOMEvent(this.eventData,r,o);s.data.originalEvent=t,this.processInteractive(s,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",s),"touch"===r.pointerType&&this.emit("touchmove",s),"mouse"!==r.pointerType&&"pen"!==r.pointerType||this.emit("mousemove",s)}"mouse"===e[0].pointerType&&this.setCursorMode(this.cursor)}},e.prototype.processPointerMove=function(t,e,i){var n=t.data,r="touch"===n.pointerType,o="mouse"===n.pointerType||"pen"===n.pointerType;o&&this.processPointerOverOut(t,e,i),this.moveWhenInside&&!i||(this.dispatchEvent(e,"pointermove",t),r&&this.dispatchEvent(e,"touchmove",t),o&&this.dispatchEvent(e,"mousemove",t))},e.prototype.onPointerOut=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t)[0];"mouse"===e.pointerType&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var i=this.getInteractionDataForPointerId(e),n=this.configureInteractionEventForDOMEvent(this.eventData,e,i);n.data.originalEvent=e,this.processInteractive(n,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",n),"mouse"===e.pointerType||"pen"===e.pointerType?this.emit("mouseout",n):this.releaseInteractionDataForPointerId(i.identifier)}},e.prototype.processPointerOverOut=function(t,e,i){var n=t.data,r=t.data.identifier,o="mouse"===n.pointerType||"pen"===n.pointerType,s=e.trackedPointers[r];i&&!s&&(s=e.trackedPointers[r]=new kh(r)),void 0!==s&&(i&&this.mouseOverRenderer?(s.over||(s.over=!0,this.delayDispatchEvent(e,"pointerover",t),o&&this.delayDispatchEvent(e,"mouseover",t)),o&&null===this.cursor&&(this.cursor=e.cursor)):s.over&&(s.over=!1,this.dispatchEvent(e,"pointerout",this.eventData),o&&this.dispatchEvent(e,"mouseout",t),s.none&&delete e.trackedPointers[r]))},e.prototype.onPointerOver=function(t){var e=this.normalizeToPointerData(t)[0],i=this.getInteractionDataForPointerId(e),n=this.configureInteractionEventForDOMEvent(this.eventData,e,i);n.data.originalEvent=e,"mouse"===e.pointerType&&(this.mouseOverRenderer=!0),this.emit("pointerover",n),"mouse"!==e.pointerType&&"pen"!==e.pointerType||this.emit("mouseover",n)},e.prototype.getInteractionDataForPointerId=function(t){var e,i=t.pointerId;return 1===i||"mouse"===t.pointerType?e=this.mouse:this.activeInteractionData[i]?e=this.activeInteractionData[i]:((e=this.interactionDataPool.pop()||new Fh).identifier=i,this.activeInteractionData[i]=e),e.copyEvent(t),e},e.prototype.releaseInteractionDataForPointerId=function(t){var e=this.activeInteractionData[t];e&&(delete this.activeInteractionData[t],e.reset(),this.interactionDataPool.push(e))},e.prototype.configureInteractionEventForDOMEvent=function(t,e,i){return t.data=i,this.mapPositionToPoint(i.global,e.clientX,e.clientY),"touch"===e.pointerType&&(e.globalX=i.global.x,e.globalY=i.global.y),i.originalEvent=e,t.reset(),t},e.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var i=0,n=t.changedTouches.length;i<n;i++){var r=t.changedTouches[i];void 0===r.button&&(r.button=t.touches.length?1:0),void 0===r.buttons&&(r.buttons=t.touches.length?1:0),void 0===r.isPrimary&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===r.width&&(r.width=r.radiusX||1),void 0===r.height&&(r.height=r.radiusY||1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="touch"),void 0===r.pointerId&&(r.pointerId=r.identifier||0),void 0===r.pressure&&(r.pressure=r.force||.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),void 0===r.layerX&&(r.layerX=r.offsetX=r.clientX),void 0===r.layerY&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,e.push(r)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{var o=t;void 0===o.isPrimary&&(o.isPrimary=!0),void 0===o.width&&(o.width=1),void 0===o.height&&(o.height=1),void 0===o.tiltX&&(o.tiltX=0),void 0===o.tiltY&&(o.tiltY=0),void 0===o.pointerType&&(o.pointerType="mouse"),void 0===o.pointerId&&(o.pointerId=1),void 0===o.pressure&&(o.pressure=.5),void 0===o.twist&&(o.twist=0),void 0===o.tangentialPressure&&(o.tangentialPressure=0),o.isNormalized=!0,e.push(o)}return e},e.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},e}(Ph.EventEmitter),Vh=i(2),Xh=function(){function t(e){var i=this;this.stage=new Oh.b,e=Object.assign({forceCanvas:!1},e),this.renderer=Object(Vh.y)(e),t._plugins.forEach((function(t){t.init.call(i,e)}))}return t.registerPlugin=function(e){t._plugins.push(e)},t.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(t.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),t.prototype.destroy=function(e,i){var n=this,r=t._plugins.slice(0);r.reverse(),r.forEach((function(t){t.destroy.call(n)})),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null},t._plugins=[],t}(),Wh=function(){function t(){}return t.init=function(t){var e=this;Object.defineProperty(this,"resizeTo",{set:function(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){e._resizeTo&&(e.cancelResize(),e._resizeId=requestAnimationFrame((function(){return e.resize()})))},this.cancelResize=function(){e._resizeId&&(cancelAnimationFrame(e._resizeId),e._resizeId=null)},this.resize=function(){if(e._resizeTo){var t,i;if(e.cancelResize(),e._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{var n=e._resizeTo;t=n.clientWidth,i=n.clientHeight}e.renderer.resize(t,i)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},t.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},t}();Xh.registerPlugin(Wh);
168
+ */class s{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const a=[];for(let t=0;t<256;t++)a[t]=(t<16?"0":"")+t.toString(16);const l=Math.PI/180,h=180/Math.PI;function u(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(a[255&t]+a[t>>8&255]+a[t>>16&255]+a[t>>24&255]+"-"+a[255&e]+a[e>>8&255]+"-"+a[e>>16&15|64]+a[e>>24&255]+"-"+a[63&i|128]+a[i>>8&255]+"-"+a[i>>16&255]+a[i>>24&255]+a[255&n]+a[n>>8&255]+a[n>>16&255]+a[n>>24&255]).toUpperCase()}function c(t,e,i){return Math.max(e,Math.min(i,t))}function d(t,e){return(t%e+e)%e}function p(t,e,i){return(1-i)*t+i*e}function f(t){return 0==(t&t-1)&&0!==t}function m(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class g{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}g.prototype.isVector2=!0;class v{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,o,s,a,l){const h=this.elements;return h[0]=t,h[1]=n,h[2]=s,h[3]=e,h[4]=r,h[5]=a,h[6]=i,h[7]=o,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,o=i[0],s=i[3],a=i[6],l=i[1],h=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],_=n[4],y=n[7],x=n[2],b=n[5],T=n[8];return r[0]=o*f+s*v+a*x,r[3]=o*m+s*_+a*b,r[6]=o*g+s*y+a*T,r[1]=l*f+h*v+u*x,r[4]=l*m+h*_+u*b,r[7]=l*g+h*y+u*T,r[2]=c*f+d*v+p*x,r[5]=c*m+d*_+p*b,r[8]=c*g+d*y+p*T,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],h=t[8];return e*o*h-e*s*l-i*r*h+i*s*a+n*r*l-n*o*a}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],h=t[8],u=h*o-s*l,c=s*a-h*r,d=l*r-o*a,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*l-h*i)*f,t[2]=(s*i-n*o)*f,t[3]=c*f,t[4]=(h*e-n*a)*f,t[5]=(n*r-s*e)*f,t[6]=d*f,t[7]=(i*a-l*e)*f,t[8]=(o*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,o,s){const a=Math.cos(r),l=Math.sin(r);return this.set(i*a,i*l,-i*(a*o+l*s)+o+t,-n*l,n*a,-n*(-l*o+a*s)+s+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],o=n[3],s=n[6],a=n[1],l=n[4],h=n[7];return n[0]=e*r+i*a,n[3]=e*o+i*l,n[6]=e*s+i*h,n[1]=-i*r+e*a,n[4]=-i*o+e*l,n[7]=-i*s+e*h,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let _;v.prototype.isMatrix3=!0;class y{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===_&&(_=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),_.width=t.width,_.height=t.height;const i=_.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=_}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let x=0;class b extends s{constructor(t=b.DEFAULT_IMAGE,e=b.DEFAULT_MAPPING,i=1001,n=1001,r=1006,o=1008,s=1023,a=1009,l=1,h=3e3){super(),Object.defineProperty(this,"id",{value:x++}),this.uuid=u(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=a,this.offset=new g(0,0),this.repeat=new g(1,1),this.center=new g(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new v,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={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){const n=this.image;if(void 0===n.uuid&&(n.uuid=u()),!e&&void 0===t.images[n.uuid]){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(T(n[t].image)):e.push(T(n[t]))}else e=T(n);t.images[n.uuid]={uuid:n.uuid,url:e}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function T(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?y.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}b.DEFAULT_IMAGE=void 0,b.DEFAULT_MAPPING=300,b.prototype.isTexture=!0;class E{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*i+o[8]*n+o[12]*r,this.y=o[1]*e+o[5]*i+o[9]*n+o[13]*r,this.z=o[2]*e+o[6]*i+o[10]*n+o[14]*r,this.w=o[3]*e+o[7]*i+o[11]*n+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const o=t.elements,s=o[0],a=o[4],l=o[8],h=o[1],u=o[5],c=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(a-h)<.01&&Math.abs(l-d)<.01&&Math.abs(c-p)<.01){if(Math.abs(a+h)<.1&&Math.abs(l+d)<.1&&Math.abs(c+p)<.1&&Math.abs(s+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,o=(u+1)/2,m=(f+1)/2,g=(a+h)/4,v=(l+d)/4,_=(c+p)/4;return t>o&&t>m?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=g/i,r=v/i):o>m?o<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(o),i=g/n,r=_/n):m<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(m),i=v/r,n=_/r),this.set(i,n,r,e),this}let m=Math.sqrt((p-c)*(p-c)+(l-d)*(l-d)+(h-a)*(h-a));return Math.abs(m)<.001&&(m=1),this.x=(p-c)/m,this.y=(l-d)/m,this.z=(h-a)/m,this.w=Math.acos((s+u+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}E.prototype.isVector4=!0;class S extends s{constructor(t,e,i={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new E(0,0,t,e),this.scissorTest=!1,this.viewport=new E(0,0,t,e),this.texture=new b(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}S.prototype.isWebGLRenderTarget=!0;(class extends S{constructor(t,e,i){super(t,e);const n=this.texture;this.texture=[];for(let t=0;t<i;t++)this.texture[t]=n.clone()}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,r=this.texture.length;n<r;n++)this.texture[n].image.width=t,this.texture[n].image.height=e,this.texture[n].image.depth=i;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,i=t.texture.length;e<i;e++)this.texture[e]=t.texture[e].clone();return this}}).prototype.isWebGLMultipleRenderTargets=!0;class w extends S{constructor(t,e,i){super(t,e,i),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}w.prototype.isWebGLMultisampleRenderTarget=!0;class A{constructor(t=0,e=0,i=0,n=1){this._x=t,this._y=e,this._z=i,this._w=n}static slerp(t,e,i,n){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(t,e,n)}static slerpFlat(t,e,i,n,r,o,s){let a=i[n+0],l=i[n+1],h=i[n+2],u=i[n+3];const c=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(0===s)return t[e+0]=a,t[e+1]=l,t[e+2]=h,void(t[e+3]=u);if(1===s)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||a!==c||l!==d||h!==p){let t=1-s;const e=a*c+l*d+h*p+u*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),o=Math.atan2(r,e*i);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*i;if(a=a*t+c*r,l=l*t+d*r,h=h*t+p*r,u=u*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+l*l+h*h+u*u);a*=t,l*=t,h*=t,u*=t}}t[e]=a,t[e+1]=l,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,n,r,o){const s=i[n],a=i[n+1],l=i[n+2],h=i[n+3],u=r[o],c=r[o+1],d=r[o+2],p=r[o+3];return t[e]=s*p+h*u+a*d-l*c,t[e+1]=a*p+h*c+l*u-s*d,t[e+2]=l*p+h*d+s*c-a*u,t[e+3]=h*p-s*u-a*c-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,l=s(i/2),h=s(n/2),u=s(r/2),c=a(i/2),d=a(n/2),p=a(r/2);switch(o){case"XYZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"YXZ":this._x=c*h*u+l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"ZXY":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u-c*d*p;break;case"ZYX":this._x=c*h*u-l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u+c*d*p;break;case"YZX":this._x=c*h*u+l*d*p,this._y=l*d*u+c*h*p,this._z=l*h*p-c*d*u,this._w=l*h*u-c*d*p;break;case"XZY":this._x=c*h*u-l*d*p,this._y=l*d*u-c*h*p,this._z=l*h*p+c*d*u,this._w=l*h*u+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],o=e[1],s=e[5],a=e[9],l=e[2],h=e[6],u=e[10],c=i+s+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(h-a)*t,this._y=(r-l)*t,this._z=(o-n)*t}else if(i>s&&i>u){const t=2*Math.sqrt(1+i-s-u);this._w=(h-a)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(r+l)/t}else if(s>u){const t=2*Math.sqrt(1+s-i-u);this._w=(r-l)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(a+h)/t}else{const t=2*Math.sqrt(1+u-i-s);this._w=(o-n)/t,this._x=(r+l)/t,this._y=(a+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(c(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,o=t._w,s=e._x,a=e._y,l=e._z,h=e._w;return this._x=i*h+o*s+n*l-r*a,this._y=n*h+o*a+r*s-i*l,this._z=r*h+o*l+i*a-n*s,this._w=o*h-i*s-n*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,o=this._w;let s=o*t._w+i*t._x+n*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),h=Math.atan2(l,s),u=Math.sin((1-e)*h)/l,c=Math.sin(e*h)/l;return this._w=o*u+this._w*c,this._x=i*u+this._x*c,this._y=n*u+this._y*c,this._z=r*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,i){this.copy(t).slerp(e,i)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}A.prototype.isQuaternion=!0;class M{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(R.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(R.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,s=t.z,a=t.w,l=a*e+o*n-s*i,h=a*i+s*e-r*n,u=a*n+r*i-o*e,c=-r*e-o*i-s*n;return this.x=l*a+c*-r+h*-s-u*-o,this.y=h*a+c*-o+u*-r-l*-s,this.z=u*a+c*-s+l*-o-h*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-r*s,this.y=r*o-i*a,this.z=i*s-n*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return C.copy(this).projectOnVector(t),this.sub(C)}reflect(t){return this.sub(C.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(c(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}M.prototype.isVector3=!0;const C=new M,R=new A;class I{constructor(t=new M(1/0,1/0,1/0),e=new M(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.length;a<l;a+=3){const l=t[a],h=t[a+1],u=t[a+2];l<e&&(e=l),h<i&&(i=h),u<n&&(n=u),l>r&&(r=l),h>o&&(o=h),u>s&&(s=u)}return this.min.set(e,i,n),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.count;a<l;a++){const l=t.getX(a),h=t.getY(a),u=t.getZ(a);l<e&&(e=l),h<i&&(i=h),u<n&&(n=u),l>r&&(r=l),h>o&&(o=h),u>s&&(s=u)}return this.min.set(e,i,n),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=O.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),N.copy(e.boundingBox),N.applyMatrix4(t.matrixWorld),this.union(N));const i=t.children;for(let t=0,e=i.length;t<e;t++)this.expandByObject(i[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,O),O.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(G),H.subVectors(this.max,G),L.subVectors(t.a,G),D.subVectors(t.b,G),F.subVectors(t.c,G),B.subVectors(D,L),U.subVectors(F,D),k.subVectors(L,F);let e=[0,-B.z,B.y,0,-U.z,U.y,0,-k.z,k.y,B.z,0,-B.x,U.z,0,-U.x,k.z,0,-k.x,-B.y,B.x,0,-U.y,U.x,0,-k.y,k.x,0];return!!V(e,L,D,F,H)&&(e=[1,0,0,0,1,0,0,0,1],!!V(e,L,D,F,H)&&(j.crossVectors(B,U),e=[j.x,j.y,j.z],V(e,L,D,F,H)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return O.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(O).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(P[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),P[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),P[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),P[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),P[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),P[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),P[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),P[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(P)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}I.prototype.isBox3=!0;const P=[new M,new M,new M,new M,new M,new M,new M,new M],O=new M,N=new I,L=new M,D=new M,F=new M,B=new M,U=new M,k=new M,G=new M,H=new M,j=new M,z=new M;function V(t,e,i,n,r){for(let o=0,s=t.length-3;o<=s;o+=3){z.fromArray(t,o);const s=r.x*Math.abs(z.x)+r.y*Math.abs(z.y)+r.z*Math.abs(z.z),a=e.dot(z),l=i.dot(z),h=n.dot(z);if(Math.max(-Math.max(a,l,h),Math.min(a,l,h))>s)return!1}return!0}const X=new I,W=new M,Y=new M,q=new M;class Z{constructor(t=new M,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):X.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){q.subVectors(t,this.center);const e=q.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.add(q.multiplyScalar(i/t)),this.radius+=i}return this}union(t){return Y.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(W.copy(t.center).add(Y)),this.expandByPoint(W.copy(t.center).sub(Y)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const J=new M,K=new M,Q=new M,$=new M,tt=new M,et=new M,it=new M;class nt{constructor(t=new M,e=new M(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,J)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=J.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(J.copy(this.direction).multiplyScalar(e).add(this.origin),J.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){K.copy(t).add(e).multiplyScalar(.5),Q.copy(e).sub(t).normalize(),$.copy(this.origin).sub(K);const r=.5*t.distanceTo(e),o=-this.direction.dot(Q),s=$.dot(this.direction),a=-$.dot(Q),l=$.lengthSq(),h=Math.abs(1-o*o);let u,c,d,p;if(h>0)if(u=o*a-s,c=o*s-a,p=r*h,u>=0)if(c>=-p)if(c<=p){const t=1/h;u*=t,c*=t,d=u*(u+o*c+2*s)+c*(o*u+c+2*a)+l}else c=r,u=Math.max(0,-(o*c+s)),d=-u*u+c*(c+2*a)+l;else c=-r,u=Math.max(0,-(o*c+s)),d=-u*u+c*(c+2*a)+l;else c<=-p?(u=Math.max(0,-(-o*r+s)),c=u>0?-r:Math.min(Math.max(-r,-a),r),d=-u*u+c*(c+2*a)+l):c<=p?(u=0,c=Math.min(Math.max(-r,-a),r),d=c*(c+2*a)+l):(u=Math.max(0,-(o*r+s)),c=u>0?r:Math.min(Math.max(-r,-a),r),d=-u*u+c*(c+2*a)+l);else c=o>0?-r:r,u=Math.max(0,-(o*c+s)),d=-u*u+c*(c+2*a)+l;return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),n&&n.copy(Q).multiplyScalar(c).add(K),d}intersectSphere(t,e){J.subVectors(t.center,this.origin);const i=J.dot(this.direction),n=J.dot(J)-i*i,r=t.radius*t.radius;if(n>r)return null;const o=Math.sqrt(r-n),s=i-o,a=i+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,o,s,a;const l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,c=this.origin;return l>=0?(i=(t.min.x-c.x)*l,n=(t.max.x-c.x)*l):(i=(t.max.x-c.x)*l,n=(t.min.x-c.x)*l),h>=0?(r=(t.min.y-c.y)*h,o=(t.max.y-c.y)*h):(r=(t.max.y-c.y)*h,o=(t.min.y-c.y)*h),i>o||r>n?null:((r>i||i!=i)&&(i=r),(o<n||n!=n)&&(n=o),u>=0?(s=(t.min.z-c.z)*u,a=(t.max.z-c.z)*u):(s=(t.max.z-c.z)*u,a=(t.min.z-c.z)*u),i>a||s>n?null:((s>i||i!=i)&&(i=s),(a<n||n!=n)&&(n=a),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,J)}intersectTriangle(t,e,i,n,r){tt.subVectors(e,t),et.subVectors(i,t),it.crossVectors(tt,et);let o,s=this.direction.dot(it);if(s>0){if(n)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}$.subVectors(this.origin,t);const a=o*this.direction.dot(et.crossVectors($,et));if(a<0)return null;const l=o*this.direction.dot(tt.cross($));if(l<0)return null;if(a+l>s)return null;const h=-o*$.dot(it);return h<0?null:this.at(h/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class rt{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,o,s,a,l,h,u,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=h,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new rt).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/ot.setFromMatrixColumn(t,0).length(),r=1/ot.setFromMatrixColumn(t,1).length(),o=1/ot.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),s=Math.sin(i),a=Math.cos(n),l=Math.sin(n),h=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=o*h,i=o*u,n=s*h,r=s*u;e[0]=a*h,e[4]=-a*u,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-s*a,e[2]=r-t*l,e[6]=n+i*l,e[10]=o*a}else if("YXZ"===t.order){const t=a*h,i=a*u,n=l*h,r=l*u;e[0]=t+r*s,e[4]=n*s-i,e[8]=o*l,e[1]=o*u,e[5]=o*h,e[9]=-s,e[2]=i*s-n,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*h,i=a*u,n=l*h,r=l*u;e[0]=t-r*s,e[4]=-o*u,e[8]=n+i*s,e[1]=i+n*s,e[5]=o*h,e[9]=r-t*s,e[2]=-o*l,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*h,i=o*u,n=s*h,r=s*u;e[0]=a*h,e[4]=n*l-i,e[8]=t*l+r,e[1]=a*u,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,i=o*l,n=s*a,r=s*l;e[0]=a*h,e[4]=r-t*u,e[8]=n*u+i,e[1]=u,e[5]=o*h,e[9]=-s*h,e[2]=-l*h,e[6]=i*u+n,e[10]=t-r*u}else if("XZY"===t.order){const t=o*a,i=o*l,n=s*a,r=s*l;e[0]=a*h,e[4]=-u,e[8]=l*h,e[1]=t*u+r,e[5]=o*h,e[9]=i*u-n,e[2]=n*u-i,e[6]=s*h,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(at,t,lt)}lookAt(t,e,i){const n=this.elements;return ct.subVectors(t,e),0===ct.lengthSq()&&(ct.z=1),ct.normalize(),ht.crossVectors(i,ct),0===ht.lengthSq()&&(1===Math.abs(i.z)?ct.x+=1e-4:ct.z+=1e-4,ct.normalize(),ht.crossVectors(i,ct)),ht.normalize(),ut.crossVectors(ct,ht),n[0]=ht.x,n[4]=ut.x,n[8]=ct.x,n[1]=ht.y,n[5]=ut.y,n[9]=ct.y,n[2]=ht.z,n[6]=ut.z,n[10]=ct.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,o=i[0],s=i[4],a=i[8],l=i[12],h=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],_=i[7],y=i[11],x=i[15],b=n[0],T=n[4],E=n[8],S=n[12],w=n[1],A=n[5],M=n[9],C=n[13],R=n[2],I=n[6],P=n[10],O=n[14],N=n[3],L=n[7],D=n[11],F=n[15];return r[0]=o*b+s*w+a*R+l*N,r[4]=o*T+s*A+a*I+l*L,r[8]=o*E+s*M+a*P+l*D,r[12]=o*S+s*C+a*O+l*F,r[1]=h*b+u*w+c*R+d*N,r[5]=h*T+u*A+c*I+d*L,r[9]=h*E+u*M+c*P+d*D,r[13]=h*S+u*C+c*O+d*F,r[2]=p*b+f*w+m*R+g*N,r[6]=p*T+f*A+m*I+g*L,r[10]=p*E+f*M+m*P+g*D,r[14]=p*S+f*C+m*O+g*F,r[3]=v*b+_*w+y*R+x*N,r[7]=v*T+_*A+y*I+x*L,r[11]=v*E+_*M+y*P+x*D,r[15]=v*S+_*C+y*O+x*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],o=t[1],s=t[5],a=t[9],l=t[13],h=t[2],u=t[6],c=t[10],d=t[14];return t[3]*(+r*a*u-n*l*u-r*s*c+i*l*c+n*s*d-i*a*d)+t[7]*(+e*a*d-e*l*c+r*o*c-n*o*d+n*l*h-r*a*h)+t[11]*(+e*l*u-e*s*d-r*o*u+i*o*d+r*s*h-i*l*h)+t[15]*(-n*s*h-e*a*u+e*s*c+n*o*u-i*o*c+i*a*h)}transpose(){const t=this.elements;let e;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(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],h=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=u*m*l-f*c*l+f*a*d-s*m*d-u*a*g+s*c*g,_=p*c*l-h*m*l-p*a*d+o*m*d+h*a*g-o*c*g,y=h*f*l-p*u*l+p*s*d-o*f*d-h*s*g+o*u*g,x=p*u*a-h*f*a-p*s*c+o*f*c+h*s*m-o*u*m,b=e*v+i*_+n*y+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/b;return t[0]=v*T,t[1]=(f*c*r-u*m*r-f*n*d+i*m*d+u*n*g-i*c*g)*T,t[2]=(s*m*r-f*a*r+f*n*l-i*m*l-s*n*g+i*a*g)*T,t[3]=(u*a*r-s*c*r-u*n*l+i*c*l+s*n*d-i*a*d)*T,t[4]=_*T,t[5]=(h*m*r-p*c*r+p*n*d-e*m*d-h*n*g+e*c*g)*T,t[6]=(p*a*r-o*m*r-p*n*l+e*m*l+o*n*g-e*a*g)*T,t[7]=(o*c*r-h*a*r+h*n*l-e*c*l-o*n*d+e*a*d)*T,t[8]=y*T,t[9]=(p*u*r-h*f*r-p*i*d+e*f*d+h*i*g-e*u*g)*T,t[10]=(o*f*r-p*s*r+p*i*l-e*f*l-o*i*g+e*s*g)*T,t[11]=(h*s*r-o*u*r-h*i*l+e*u*l+o*i*d-e*s*d)*T,t[12]=x*T,t[13]=(h*f*n-p*u*n+p*i*c-e*f*c-h*i*m+e*u*m)*T,t[14]=(p*s*n-o*f*n-p*i*a+e*f*a+o*i*m-e*s*m)*T,t[15]=(o*u*n-h*s*n+h*i*a-e*u*a-o*i*c+e*s*c)*T,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,o=t.x,s=t.y,a=t.z,l=r*o,h=r*s;return this.set(l*o+i,l*s-n*a,l*a+n*s,0,l*s+n*a,h*s+i,h*a-n*o,0,l*a-n*s,h*a+n*o,r*a*a+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,o){return this.set(1,i,r,0,t,1,o,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,l=r+r,h=o+o,u=s+s,c=r*l,d=r*h,p=r*u,f=o*h,m=o*u,g=s*u,v=a*l,_=a*h,y=a*u,x=i.x,b=i.y,T=i.z;return n[0]=(1-(f+g))*x,n[1]=(d+y)*x,n[2]=(p-_)*x,n[3]=0,n[4]=(d-y)*b,n[5]=(1-(c+g))*b,n[6]=(m+v)*b,n[7]=0,n[8]=(p+_)*T,n[9]=(m-v)*T,n[10]=(1-(c+f))*T,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=ot.set(n[0],n[1],n[2]).length();const o=ot.set(n[4],n[5],n[6]).length(),s=ot.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],st.copy(this);const a=1/r,l=1/o,h=1/s;return st.elements[0]*=a,st.elements[1]*=a,st.elements[2]*=a,st.elements[4]*=l,st.elements[5]*=l,st.elements[6]*=l,st.elements[8]*=h,st.elements[9]*=h,st.elements[10]*=h,e.setFromRotationMatrix(st),i.x=r,i.y=o,i.z=s,this}makePerspective(t,e,i,n,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),l=2*r/(i-n),h=(e+t)/(e-t),u=(i+n)/(i-n),c=-(o+r)/(o-r),d=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=l,s[9]=u,s[13]=0,s[2]=0,s[6]=0,s[10]=c,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,i,n,r,o){const s=this.elements,a=1/(e-t),l=1/(i-n),h=1/(o-r),u=(e+t)*a,c=(i+n)*l,d=(o+r)*h;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-u,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-c,s[2]=0,s[6]=0,s[10]=-2*h,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}rt.prototype.isMatrix4=!0;const ot=new M,st=new rt,at=new M(0,0,0),lt=new M(1,1,1),ht=new M,ut=new M,ct=new M,dt=new rt,pt=new A;class ft{constructor(t=0,e=0,i=0,n=ft.DefaultOrder){this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],o=n[4],s=n[8],a=n[1],l=n[5],h=n[9],u=n[2],d=n[6],p=n[10];switch(e){case"XYZ":this._y=Math.asin(c(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-c(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(c(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-c(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(c(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-c(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return dt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(dt,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return pt.setFromEuler(this),this.setFromQuaternion(pt,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new M(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}ft.prototype.isEuler=!0,ft.DefaultOrder="XYZ",ft.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class mt{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let gt=0;const vt=new M,_t=new A,yt=new rt,xt=new M,bt=new M,Tt=new M,Et=new A,St=new M(1,0,0),wt=new M(0,1,0),At=new M(0,0,1),Mt={type:"added"},Ct={type:"removed"};class Rt extends s{constructor(){super(),Object.defineProperty(this,"id",{value:gt++}),this.uuid=u(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Rt.DefaultUp.clone();const t=new M,e=new ft,i=new A,n=new M(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new rt},normalMatrix:{value:new v}}),this.matrix=new rt,this.matrixWorld=new rt,this.matrixAutoUpdate=Rt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new mt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return _t.setFromAxisAngle(t,e),this.quaternion.multiply(_t),this}rotateOnWorldAxis(t,e){return _t.setFromAxisAngle(t,e),this.quaternion.premultiply(_t),this}rotateX(t){return this.rotateOnAxis(St,t)}rotateY(t){return this.rotateOnAxis(wt,t)}rotateZ(t){return this.rotateOnAxis(At,t)}translateOnAxis(t,e){return vt.copy(t).applyQuaternion(this.quaternion),this.position.add(vt.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(St,t)}translateY(t){return this.translateOnAxis(wt,t)}translateZ(t){return this.translateOnAxis(At,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(yt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?xt.copy(t):xt.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),bt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?yt.lookAt(bt,xt,this.up):yt.lookAt(xt,bt,this.up),this.quaternion.setFromRotationMatrix(yt),n&&(yt.extractRotation(n.matrixWorld),_t.setFromRotationMatrix(yt),this.quaternion.premultiply(_t.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Mt)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Ct)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Ct)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),yt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),yt.multiply(t.parent.matrixWorld)),t.applyMatrix4(yt),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(bt,t,Tt),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(bt,Et,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=o(t.geometries),n=o(t.materials),r=o(t.textures),s=o(t.images),a=o(t.shapes),l=o(t.skeletons),h=o(t.animations);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),a.length>0&&(i.shapes=a),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h)}return i.object=n,i;function o(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Rt.DefaultUp=new M(0,1,0),Rt.DefaultMatrixAutoUpdate=!0,Rt.prototype.isObject3D=!0;const It=new M,Pt=new M,Ot=new M,Nt=new M,Lt=new M,Dt=new M,Ft=new M,Bt=new M,Ut=new M,kt=new M;class Gt{constructor(t=new M,e=new M,i=new M){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),It.subVectors(t,e),n.cross(It);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){It.subVectors(n,e),Pt.subVectors(i,e),Ot.subVectors(t,e);const o=It.dot(It),s=It.dot(Pt),a=It.dot(Ot),l=Pt.dot(Pt),h=Pt.dot(Ot),u=o*l-s*s;if(0===u)return r.set(-2,-1,-1);const c=1/u,d=(l*a-s*h)*c,p=(o*h-s*a)*c;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Nt),Nt.x>=0&&Nt.y>=0&&Nt.x+Nt.y<=1}static getUV(t,e,i,n,r,o,s,a){return this.getBarycoord(t,e,i,n,Nt),a.set(0,0),a.addScaledVector(r,Nt.x),a.addScaledVector(o,Nt.y),a.addScaledVector(s,Nt.z),a}static isFrontFacing(t,e,i,n){return It.subVectors(i,e),Pt.subVectors(t,e),It.cross(Pt).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return It.subVectors(this.c,this.b),Pt.subVectors(this.a,this.b),.5*It.cross(Pt).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Gt.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Gt.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return Gt.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Gt.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Gt.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let o,s;Lt.subVectors(n,i),Dt.subVectors(r,i),Bt.subVectors(t,i);const a=Lt.dot(Bt),l=Dt.dot(Bt);if(a<=0&&l<=0)return e.copy(i);Ut.subVectors(t,n);const h=Lt.dot(Ut),u=Dt.dot(Ut);if(h>=0&&u<=h)return e.copy(n);const c=a*u-h*l;if(c<=0&&a>=0&&h<=0)return o=a/(a-h),e.copy(i).addScaledVector(Lt,o);kt.subVectors(t,r);const d=Lt.dot(kt),p=Dt.dot(kt);if(p>=0&&d<=p)return e.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(i).addScaledVector(Dt,s);const m=h*p-d*u;if(m<=0&&u-h>=0&&d-p>=0)return Ft.subVectors(r,n),s=(u-h)/(u-h+(d-p)),e.copy(n).addScaledVector(Ft,s);const g=1/(m+f+c);return o=f*g,s=c*g,e.copy(i).addScaledVector(Lt,o).addScaledVector(Dt,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ht=0;class jt extends s{constructor(){super(),Object.defineProperty(this,"id",{value:Ht++}),this.uuid=u(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}jt.prototype.isMaterial=!0;const zt={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},Vt={h:0,s:0,l:0},Xt={h:0,s:0,l:0};function Wt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function Yt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function qt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Zt{constructor(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=d(t,1),e=c(e,0,1),i=c(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Wt(r,n,t+1/3),this.g=Wt(r,n,t),this.b=Wt(r,n,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=zt[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=Yt(t.r),this.g=Yt(t.g),this.b=Yt(t.b),this}copyLinearToSRGB(t){return this.r=qt(t.r),this.g=qt(t.g),this.b=qt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),o=Math.min(e,i,n);let s,a;const l=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=l<=.5?t/(r+o):t/(2-r-o),r){case e:s=(i-n)/t+(i<n?6:0);break;case i:s=(n-e)/t+2;break;case n:s=(e-i)/t+4}s/=6}return t.h=s,t.s=a,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,i){return this.getHSL(Vt),Vt.h+=t,Vt.s+=e,Vt.l+=i,this.setHSL(Vt.h,Vt.s,Vt.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Vt),t.getHSL(Xt);const i=p(Vt.h,Xt.h,e),n=p(Vt.s,Xt.s,e),r=p(Vt.l,Xt.l,e);return this.setHSL(i,n,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Zt.NAMES=zt,Zt.prototype.isColor=!0,Zt.prototype.r=1,Zt.prototype.g=1,Zt.prototype.b=1;class Jt extends jt{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Zt(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=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this}}Jt.prototype.isMeshBasicMaterial=!0;const Kt=new M,Qt=new g;class $t{constructor(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new Zt),e[i++]=r.r,e[i++]=r.g,e[i++]=r.b}return this}copyVector2sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new g),e[i++]=r.x,e[i++]=r.y}return this}copyVector3sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new M),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z}return this}copyVector4sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new E),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z,e[i++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Qt.fromBufferAttribute(this,e),Qt.applyMatrix3(t),this.setXY(e,Qt.x,Qt.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Kt.fromBufferAttribute(this,e),Kt.applyMatrix3(t),this.setXYZ(e,Kt.x,Kt.y,Kt.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Kt.x=this.getX(e),Kt.y=this.getY(e),Kt.z=this.getZ(e),Kt.applyMatrix4(t),this.setXYZ(e,Kt.x,Kt.y,Kt.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Kt.x=this.getX(e),Kt.y=this.getY(e),Kt.z=this.getZ(e),Kt.applyNormalMatrix(t),this.setXYZ(e,Kt.x,Kt.y,Kt.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Kt.x=this.getX(e),Kt.y=this.getY(e),Kt.z=this.getZ(e),Kt.transformDirection(t),this.setXYZ(e,Kt.x,Kt.y,Kt.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}$t.prototype.isBufferAttribute=!0;class te extends $t{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class ee extends $t{constructor(t,e,i){super(new Int32Array(t),e,i)}}class ie extends $t{constructor(t,e,i){super(new Uint32Array(t),e,i)}}(class extends $t{constructor(t,e,i){super(new Uint16Array(t),e,i)}}).prototype.isFloat16BufferAttribute=!0;class ne extends $t{constructor(t,e,i){super(new Float32Array(t),e,i)}}function re(t){if(0===t.length)return-1/0;let e=t[0];for(let i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let oe=0;const se=new rt,ae=new Rt,le=new M,he=new I,ue=new I,ce=new M;class de extends s{constructor(){super(),Object.defineProperty(this,"id",{value:oe++}),this.uuid=u(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(re(t)>65535?ie:te)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new v).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return se.makeRotationFromQuaternion(t),this.applyMatrix4(se),this}rotateX(t){return se.makeRotationX(t),this.applyMatrix4(se),this}rotateY(t){return se.makeRotationY(t),this.applyMatrix4(se),this}rotateZ(t){return se.makeRotationZ(t),this.applyMatrix4(se),this}translate(t,e,i){return se.makeTranslation(t,e,i),this.applyMatrix4(se),this}scale(t,e,i){return se.makeScale(t,e,i),this.applyMatrix4(se),this}lookAt(t){return ae.lookAt(t),ae.updateMatrix(),this.applyMatrix4(ae.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(le).negate(),this.translate(le.x,le.y,le.z),this}setFromPoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new ne(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new I);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];he.setFromBufferAttribute(i),this.morphTargetsRelative?(ce.addVectors(this.boundingBox.min,he.min),this.boundingBox.expandByPoint(ce),ce.addVectors(this.boundingBox.max,he.max),this.boundingBox.expandByPoint(ce)):(this.boundingBox.expandByPoint(he.min),this.boundingBox.expandByPoint(he.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Z);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new M,1/0);if(t){const i=this.boundingSphere.center;if(he.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];ue.setFromBufferAttribute(i),this.morphTargetsRelative?(ce.addVectors(he.min,ue.min),he.expandByPoint(ce),ce.addVectors(he.max,ue.max),he.expandByPoint(ce)):(he.expandByPoint(ue.min),he.expandByPoint(ue.max))}he.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)ce.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(ce));if(e)for(let r=0,o=e.length;r<o;r++){const o=e[r],s=this.morphTargetsRelative;for(let e=0,r=o.count;e<r;e++)ce.fromBufferAttribute(o,e),s&&(le.fromBufferAttribute(t,e),ce.add(le)),n=Math.max(n,i.distanceToSquared(ce))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeFaceNormals(){}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,r=e.normal.array,o=e.uv.array,s=n.length/3;void 0===e.tangent&&this.setAttribute("tangent",new $t(new Float32Array(4*s),4));const a=e.tangent.array,l=[],h=[];for(let t=0;t<s;t++)l[t]=new M,h[t]=new M;const u=new M,c=new M,d=new M,p=new g,f=new g,m=new g,v=new M,_=new M;function y(t,e,i){u.fromArray(n,3*t),c.fromArray(n,3*e),d.fromArray(n,3*i),p.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*i),c.sub(u),d.sub(u),f.sub(p),m.sub(p);const r=1/(f.x*m.y-m.x*f.y);isFinite(r)&&(v.copy(c).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(r),_.copy(d).multiplyScalar(f.x).addScaledVector(c,-m.x).multiplyScalar(r),l[t].add(v),l[e].add(v),l[i].add(v),h[t].add(_),h[e].add(_),h[i].add(_))}let x=this.groups;0===x.length&&(x=[{start:0,count:i.length}]);for(let t=0,e=x.length;t<e;++t){const e=x[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)y(i[t+0],i[t+1],i[t+2])}const b=new M,T=new M,E=new M,S=new M;function w(t){E.fromArray(r,3*t),S.copy(E);const e=l[t];b.copy(e),b.sub(E.multiplyScalar(E.dot(e))).normalize(),T.crossVectors(S,e);const i=T.dot(h[t])<0?-1:1;a[4*t]=b.x,a[4*t+1]=b.y,a[4*t+2]=b.z,a[4*t+3]=i}for(let t=0,e=x.length;t<e;++t){const e=x[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)w(i[t+0]),w(i[t+1]),w(i[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new $t(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new M,r=new M,o=new M,s=new M,a=new M,l=new M,h=new M,u=new M;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),f=t.getX(c+2);n.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),o.fromBufferAttribute(e,f),h.subVectors(o,r),u.subVectors(n,r),h.cross(u),s.fromBufferAttribute(i,d),a.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(h),a.add(h),l.add(h),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),h.subVectors(o,r),u.subVectors(n,r),h.cross(u),i.setXYZ(t+0,h.x,h.y,h.z),i.setXYZ(t+1,h.x,h.y,h.z),i.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const n in i){if(void 0===t.attributes[n])continue;const r=i[n].array,o=t.attributes[n],s=o.array,a=o.itemSize*e,l=Math.min(s.length,r.length-a);for(let t=0,e=a;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)ce.fromBufferAttribute(t,e),ce.normalize(),t.setXYZ(e,ce.x,ce.y,ce.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,o=new i.constructor(e.length*n);let s=0,a=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*n;for(let t=0;t<n;t++)o[a++]=i[s++]}return new $t(o,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new de,i=this.index.array,n=this.attributes;for(const r in n){const o=t(n[r],i);e.setAttribute(r,o)}const r=this.morphAttributes;for(const n in r){const o=[],s=r[n];for(let e=0,n=s.length;e<n;e++){const n=t(s[e],i);o.push(n)}e.morphAttributes[n]=o}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,i=o.length;t<i;t++){const i=o[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],o=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];o.push(n.toJSON(t.data))}o.length>0&&(n[e]=o,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new de).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let t=0,e=o.length;t<e;t++){const e=o[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}de.prototype.isBufferGeometry=!0;const pe=new rt,fe=new nt,me=new Z,ge=new M,ve=new M,_e=new M,ye=new M,xe=new M,be=new M,Te=new M,Ee=new M,Se=new M,we=new g,Ae=new g,Me=new g,Ce=new M,Re=new M;class Ie extends Rt{constructor(t=new de,e=new Jt){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),me.copy(i.boundingSphere),me.applyMatrix4(r),!1===t.ray.intersectsSphere(me))return;if(pe.copy(r).invert(),fe.copy(t.ray).applyMatrix4(pe),null!==i.boundingBox&&!1===fe.intersectsBox(i.boundingBox))return;let o;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position,a=i.morphAttributes.position,l=i.morphTargetsRelative,h=i.attributes.uv,u=i.attributes.uv2,c=i.groups,d=i.drawRange;if(null!==r)if(Array.isArray(n))for(let i=0,p=c.length;i<p;i++){const p=c[i],f=n[p.materialIndex];for(let i=Math.max(p.start,d.start),n=Math.min(p.start+p.count,d.start+d.count);i<n;i+=3){const n=r.getX(i),c=r.getX(i+1),d=r.getX(i+2);o=Pe(this,f,t,fe,s,a,l,h,u,n,c,d),o&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=p.materialIndex,e.push(o))}}else{for(let i=Math.max(0,d.start),c=Math.min(r.count,d.start+d.count);i<c;i+=3){const c=r.getX(i),d=r.getX(i+1),p=r.getX(i+2);o=Pe(this,n,t,fe,s,a,l,h,u,c,d,p),o&&(o.faceIndex=Math.floor(i/3),e.push(o))}}else if(void 0!==s)if(Array.isArray(n))for(let i=0,r=c.length;i<r;i++){const r=c[i],p=n[r.materialIndex];for(let i=Math.max(r.start,d.start),n=Math.min(r.start+r.count,d.start+d.count);i<n;i+=3){o=Pe(this,p,t,fe,s,a,l,h,u,i,i+1,i+2),o&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=r.materialIndex,e.push(o))}}else{for(let i=Math.max(0,d.start),r=Math.min(s.count,d.start+d.count);i<r;i+=3){o=Pe(this,n,t,fe,s,a,l,h,u,i,i+1,i+2),o&&(o.faceIndex=Math.floor(i/3),e.push(o))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Pe(t,e,i,n,r,o,s,a,l,h,u,c){ge.fromBufferAttribute(r,h),ve.fromBufferAttribute(r,u),_e.fromBufferAttribute(r,c);const d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){Te.set(0,0,0),Ee.set(0,0,0),Se.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],i=o[t];0!==e&&(ye.fromBufferAttribute(i,h),xe.fromBufferAttribute(i,u),be.fromBufferAttribute(i,c),s?(Te.addScaledVector(ye,e),Ee.addScaledVector(xe,e),Se.addScaledVector(be,e)):(Te.addScaledVector(ye.sub(ge),e),Ee.addScaledVector(xe.sub(ve),e),Se.addScaledVector(be.sub(_e),e)))}ge.add(Te),ve.add(Ee),_e.add(Se)}t.isSkinnedMesh&&(t.boneTransform(h,ge),t.boneTransform(u,ve),t.boneTransform(c,_e));const p=function(t,e,i,n,r,o,s,a){let l;if(l=1===e.side?n.intersectTriangle(s,o,r,!0,a):n.intersectTriangle(r,o,s,2!==e.side,a),null===l)return null;Re.copy(a),Re.applyMatrix4(t.matrixWorld);const h=i.ray.origin.distanceTo(Re);return h<i.near||h>i.far?null:{distance:h,point:Re.clone(),object:t}}(t,e,i,n,ge,ve,_e,Ce);if(p){a&&(we.fromBufferAttribute(a,h),Ae.fromBufferAttribute(a,u),Me.fromBufferAttribute(a,c),p.uv=Gt.getUV(Ce,ge,ve,_e,we,Ae,Me,new g)),l&&(we.fromBufferAttribute(l,h),Ae.fromBufferAttribute(l,u),Me.fromBufferAttribute(l,c),p.uv2=Gt.getUV(Ce,ge,ve,_e,we,Ae,Me,new g));const t={a:h,b:u,c:c,normal:new M,materialIndex:0};Gt.getNormal(ge,ve,_e,t.normal),p.face=t}return p}Ie.prototype.isMesh=!0;class Oe extends de{constructor(t=1,e=1,i=1,n=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:o};const s=this;n=Math.floor(n),r=Math.floor(r),o=Math.floor(o);const a=[],l=[],h=[],u=[];let c=0,d=0;function p(t,e,i,n,r,o,p,f,m,g,v){const _=o/m,y=p/g,x=o/2,b=p/2,T=f/2,E=m+1,S=g+1;let w=0,A=0;const C=new M;for(let o=0;o<S;o++){const s=o*y-b;for(let a=0;a<E;a++){const c=a*_-x;C[t]=c*n,C[e]=s*r,C[i]=T,l.push(C.x,C.y,C.z),C[t]=0,C[e]=0,C[i]=f>0?1:-1,h.push(C.x,C.y,C.z),u.push(a/m),u.push(1-o/g),w+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const i=c+e+E*t,n=c+e+E*(t+1),r=c+(e+1)+E*(t+1),o=c+(e+1)+E*t;a.push(i,n,o),a.push(n,r,o),A+=6}s.addGroup(d,A,v),d+=A,c+=w}p("z","y","x",-1,-1,i,e,t,o,r,0),p("z","y","x",1,-1,i,e,-t,o,r,1),p("x","z","y",1,1,t,i,e,n,o,2),p("x","z","y",1,-1,t,i,-e,n,o,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(a),this.setAttribute("position",new ne(l,3)),this.setAttribute("normal",new ne(h,3)),this.setAttribute("uv",new ne(u,2))}static fromJSON(t){return new Oe(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Ne(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Le(t){const e={};for(let i=0;i<t.length;i++){const n=Ne(t[i]);for(const t in n)e[t]=n[t]}return e}const De={clone:Ne,merge:Le};class Fe extends jt{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.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,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ne(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}Fe.prototype.isShaderMaterial=!0;class Be extends Rt{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new rt,this.projectionMatrix=new rt,this.projectionMatrixInverse=new rt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Be.prototype.isCamera=!0;class Ue extends Be{constructor(t=50,e=1,i=.1,n=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*h*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*l*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*h*Math.atan(Math.tan(.5*l*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,o){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*l*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*n/t,e-=o.offsetY*i/s,n*=o.width/t,i*=o.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Ue.prototype.isPerspectiveCamera=!0;class ke extends Rt{constructor(t,e,i){if(super(),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=i;const n=new Ue(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new M(1,0,0)),this.add(n);const r=new Ue(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new M(-1,0,0)),this.add(r);const o=new Ue(90,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new M(0,1,0)),this.add(o);const s=new Ue(90,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new M(0,-1,0)),this.add(s);const a=new Ue(90,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new M(0,0,1)),this.add(a);const l=new Ue(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new M(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const i=this.renderTarget,[n,r,o,s,a,l]=this.children,h=t.xr.enabled,u=t.getRenderTarget();t.xr.enabled=!1;const c=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,o),t.setRenderTarget(i,3),t.render(e,s),t.setRenderTarget(i,4),t.render(e,a),i.texture.generateMipmaps=c,t.setRenderTarget(i,5),t.render(e,l),t.setRenderTarget(u),t.xr.enabled=h}}class Ge extends b{constructor(t,e,i,n,r,o,s,a,l,h){super(t=void 0!==t?t:[],e=void 0!==e?e:301,i,n,r,o,s=void 0!==s?s:1022,a,l,h),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Ge.prototype.isCubeTexture=!0;class He extends S{constructor(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),super(t,t,e),e=e||{},this.texture=new Ge(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:1006,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=1023,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new Oe(5,5,5),r=new Fe({name:"CubemapFromEquirect",uniforms:Ne(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const o=new Ie(n,r),s=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new ke(1,10,this).update(t,o),e.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}He.prototype.isWebGLCubeRenderTarget=!0;const je=new M,ze=new M,Ve=new v;class Xe{constructor(t=new M(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=je.subVectors(i,e).cross(ze.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const i=t.delta(je),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Ve.getNormalMatrix(t),n=this.coplanarPoint(je).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Xe.prototype.isPlane=!0;const We=new Z,Ye=new M;class qe{constructor(t=new Xe,e=new Xe,i=new Xe,n=new Xe,r=new Xe,o=new Xe){this.planes=[t,e,i,n,r,o]}set(t,e,i,n,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(o),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],_=i[15];return e[0].setComponents(s-n,u-a,f-c,_-m).normalize(),e[1].setComponents(s+n,u+a,f+c,_+m).normalize(),e[2].setComponents(s+r,u+l,f+d,_+g).normalize(),e[3].setComponents(s-r,u-l,f-d,_-g).normalize(),e[4].setComponents(s-o,u-h,f-p,_-v).normalize(),e[5].setComponents(s+o,u+h,f+p,_+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),We.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(We)}intersectsSprite(t){return We.center.set(0,0,0),We.radius=.7071067811865476,We.applyMatrix4(t.matrixWorld),this.intersectsSphere(We)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)<n)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(Ye.x=n.normal.x>0?t.max.x:t.min.x,Ye.y=n.normal.y>0?t.max.y:t.min.y,Ye.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Ye)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ze(){let t=null,e=!1,i=null,n=null;function r(e,o){i(e,o),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Je(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=n.get(e);void 0===o?n.set(e,function(e,n){const r=e.array,o=e.usage,s=t.createBuffer();t.bindBuffer(n,s),t.bufferData(n,r,o),e.onUploadCallback();let a=5126;return r instanceof Float32Array?a=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?i?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:r instanceof Int16Array?a=5122:r instanceof Uint32Array?a=5125:r instanceof Int32Array?a=5124:r instanceof Int8Array?a=5120:(r instanceof Uint8Array||r instanceof Uint8ClampedArray)&&(a=5121),{buffer:s,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):o.version<e.version&&(!function(e,n,r){const o=n.array,s=n.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,o):(i?t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,e,r),o.version=e.version)}}}class Ke extends de{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,o=e/2,s=Math.floor(i),a=Math.floor(n),l=s+1,h=a+1,u=t/s,c=e/a,d=[],p=[],f=[],m=[];for(let t=0;t<h;t++){const e=t*c-o;for(let i=0;i<l;i++){const n=i*u-r;p.push(n,-e,0),f.push(0,0,1),m.push(i/s),m.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<s;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),o=e+1+l*t;d.push(i,n,o),d.push(n,r,o)}this.setIndex(d),this.setAttribute("position",new ne(p,3)),this.setAttribute("normal",new ne(f,3)),this.setAttribute("uv",new ne(m,2))}static fromJSON(t){return new Ke(t.width,t.height,t.widthSegments,t.heightSegments)}}const Qe={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn 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\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn 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\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn 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\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\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\treturn 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\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSNMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tnormal, v, roughnessFactor, material.diffuseColor, totalSpecular,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {\n\t\tvec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length(vec3(modelMatrix[0].xyz));\n\t\tmodelScale.y = length(vec3(modelMatrix[1].xyz));\n\t\tmodelScale.z = length(vec3(modelMatrix[2].xyz));\n\t\treturn normalize(refractionVector) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\n\t\tif (attenuationDistance == 0.0) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\n\t\t\tvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#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\tvarying vec3 vLightBack;\n\tvarying 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_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying 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\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#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\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying 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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying 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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform vec3 attenuationColor;\n\tuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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 <transmission_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",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\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},$e={common:{diffuse:{value:new Zt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new v},uv2Transform:{value:new v},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 g(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 Zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new v}},sprite:{diffuse:{value:new Zt(16777215)},opacity:{value:1},center:{value:new g(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new v}}},ti={basic:{uniforms:Le([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.fog]),vertexShader:Qe.meshbasic_vert,fragmentShader:Qe.meshbasic_frag},lambert:{uniforms:Le([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.fog,$e.lights,{emissive:{value:new Zt(0)}}]),vertexShader:Qe.meshlambert_vert,fragmentShader:Qe.meshlambert_frag},phong:{uniforms:Le([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.fog,$e.lights,{emissive:{value:new Zt(0)},specular:{value:new Zt(1118481)},shininess:{value:30}}]),vertexShader:Qe.meshphong_vert,fragmentShader:Qe.meshphong_frag},standard:{uniforms:Le([$e.common,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.roughnessmap,$e.metalnessmap,$e.fog,$e.lights,{emissive:{value:new Zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag},toon:{uniforms:Le([$e.common,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.gradientmap,$e.fog,$e.lights,{emissive:{value:new Zt(0)}}]),vertexShader:Qe.meshtoon_vert,fragmentShader:Qe.meshtoon_frag},matcap:{uniforms:Le([$e.common,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.fog,{matcap:{value:null}}]),vertexShader:Qe.meshmatcap_vert,fragmentShader:Qe.meshmatcap_frag},points:{uniforms:Le([$e.points,$e.fog]),vertexShader:Qe.points_vert,fragmentShader:Qe.points_frag},dashed:{uniforms:Le([$e.common,$e.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qe.linedashed_vert,fragmentShader:Qe.linedashed_frag},depth:{uniforms:Le([$e.common,$e.displacementmap]),vertexShader:Qe.depth_vert,fragmentShader:Qe.depth_frag},normal:{uniforms:Le([$e.common,$e.bumpmap,$e.normalmap,$e.displacementmap,{opacity:{value:1}}]),vertexShader:Qe.normal_vert,fragmentShader:Qe.normal_frag},sprite:{uniforms:Le([$e.sprite,$e.fog]),vertexShader:Qe.sprite_vert,fragmentShader:Qe.sprite_frag},background:{uniforms:{uvTransform:{value:new v},t2D:{value:null}},vertexShader:Qe.background_vert,fragmentShader:Qe.background_frag},cube:{uniforms:Le([$e.envmap,{opacity:{value:1}}]),vertexShader:Qe.cube_vert,fragmentShader:Qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe.equirect_vert,fragmentShader:Qe.equirect_frag},distanceRGBA:{uniforms:Le([$e.common,$e.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qe.distanceRGBA_vert,fragmentShader:Qe.distanceRGBA_frag},shadow:{uniforms:Le([$e.lights,$e.fog,{color:{value:new Zt(0)},opacity:{value:1}}]),vertexShader:Qe.shadow_vert,fragmentShader:Qe.shadow_frag}};function ei(t,e,i,n,r){const o=new Zt(0);let s,a,l=0,h=null,u=0,c=null;function d(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(o,l)},render:function(i,r){let p=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?d(o,l):f&&f.isColor&&(d(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===a&&(a=new Ie(new Oe(1,1,1),new Fe({name:"BackgroundCubeMaterial",uniforms:Ne(ti.cube.uniforms),vertexShader:ti.cube.vertexShader,fragmentShader:ti.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a)),a.material.uniforms.envMap.value=f,a.material.uniforms.flipEnvMap.value=f.isCubeTexture&&f._needsFlipEnvMap?-1:1,h===f&&u===f.version&&c===t.toneMapping||(a.material.needsUpdate=!0,h=f,u=f.version,c=t.toneMapping),i.unshift(a,a.geometry,a.material,0,0,null)):f&&f.isTexture&&(void 0===s&&(s=new Ie(new Ke(2,2),new Fe({name:"BackgroundMaterial",uniforms:Ne(ti.background.uniforms),vertexShader:ti.background.vertexShader,fragmentShader:ti.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(s)),s.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),s.material.uniforms.uvTransform.value.copy(f.matrix),h===f&&u===f.version&&c===t.toneMapping||(s.material.needsUpdate=!0,h=f,u=f.version,c=t.toneMapping),i.unshift(s,s.geometry,s.material,0,0,null))}}}function ii(t,e,i,n){const r=t.getParameter(34921),o=n.isWebGL2?null:e.get("OES_vertex_array_object"),s=n.isWebGL2||null!==o,a={},l=d(null);let h=l;function u(e){return n.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function c(e){return n.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function d(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function p(){const t=h.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function f(t){m(t,0)}function m(i,r){const o=h.newAttributes,s=h.enabledAttributes,a=h.attributeDivisors;if(o[i]=1,0===s[i]&&(t.enableVertexAttribArray(i),s[i]=1),a[i]!==r){(n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),a[i]=r}}function g(){const e=h.newAttributes,i=h.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function v(e,i,r,o,s,a){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,o,s,a):t.vertexAttribIPointer(e,i,r,s,a)}function _(){y(),h!==l&&(h=l,u(h.object))}function y(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,c,_,y){let x=!1;if(s){const e=function(e,i,r){const s=!0===r.wireframe;let l=a[e.id];void 0===l&&(l={},a[e.id]=l);let h=l[i.id];void 0===h&&(h={},l[i.id]=h);let u=h[s];void 0===u&&(u=d(n.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),h[s]=u);return u}(_,c,l);h!==e&&(h=e,u(h.object)),x=function(t,e){const i=h.attributes,n=t.attributes;let r=0;for(const t in n){const e=i[t],o=n[t];if(void 0===e)return!0;if(e.attribute!==o)return!0;if(e.data!==o.data)return!0;r++}return h.attributesNum!==r||h.index!==e}(_,y),x&&function(t,e){const i={},n=t.attributes;let r=0;for(const t in n){const e=n[t],o={};o.attribute=e,e.data&&(o.data=e.data),i[t]=o,r++}h.attributes=i,h.attributesNum=r,h.index=e}(_,y)}else{const t=!0===l.wireframe;h.geometry===_.id&&h.program===c.id&&h.wireframe===t||(h.geometry=_.id,h.program=c.id,h.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==y&&i.update(y,34963),x&&(!function(r,o,s,a){if(!1===n.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=a.attributes,h=s.getAttributes(),u=o.defaultAttributeValues;for(const e in h){const n=h[e];if(n>=0){const o=l[e];if(void 0!==o){const e=o.normalized,r=o.itemSize,s=i.get(o);if(void 0===s)continue;const l=s.buffer,h=s.type,u=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const i=o.data,s=i.stride,c=o.offset;i&&i.isInstancedInterleavedBuffer?(m(n,i.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=i.meshPerAttribute*i.count)):f(n),t.bindBuffer(34962,l),v(n,r,h,e,s*u,c*u)}else o.isInstancedBufferAttribute?(m(n,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(n),t.bindBuffer(34962,l),v(n,r,h,e,0,0)}else if("instanceMatrix"===e){const e=i.get(r.instanceMatrix);if(void 0===e)continue;const o=e.buffer,s=e.type;m(n+0,1),m(n+1,1),m(n+2,1),m(n+3,1),t.bindBuffer(34962,o),t.vertexAttribPointer(n+0,4,s,!1,64,0),t.vertexAttribPointer(n+1,4,s,!1,64,16),t.vertexAttribPointer(n+2,4,s,!1,64,32),t.vertexAttribPointer(n+3,4,s,!1,64,48)}else if("instanceColor"===e){const e=i.get(r.instanceColor);if(void 0===e)continue;const o=e.buffer,s=e.type;m(n,1),t.bindBuffer(34962,o),t.vertexAttribPointer(n,3,s,!1,12,0)}else if(void 0!==u){const i=u[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n,i);break;case 3:t.vertexAttrib3fv(n,i);break;case 4:t.vertexAttrib4fv(n,i);break;default:t.vertexAttrib1fv(n,i)}}}}g()}(r,l,c,_),null!==y&&t.bindBuffer(34963,i.get(y).buffer))},reset:_,resetDefaultState:y,dispose:function(){_();for(const t in a){const e=a[t];for(const t in e){const i=e[t];for(const t in i)c(i[t].object),delete i[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const i=e[t];for(const t in i)c(i[t].object),delete i[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const i=a[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)c(n[t].object),delete n[t];delete i[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function ni(t,e,i,n){const r=n.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,n){t.drawArrays(o,e,n),i.update(n,o,1)},this.renderInstances=function(n,s,a){if(0===a)return;let l,h;if(r)l=t,h="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),h="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[h](o,n,s,a),i.update(s,o,a)}}function ri(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==i.precision?i.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=o||e.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,u=t.getParameter(34930),c=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),_=c>0,y=o||e.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:_&&y,maxSamples:o?t.getParameter(36183):0}}function oi(t){const e=this;let i=null,n=0,r=!1,o=!1;const s=new Xe,a=new v,l={value:null,needsUpdate:!1};function h(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,i,n,r){const o=null!==t?t.length:0;let h=null;if(0!==o){if(h=l.value,!0!==r||null===h){const e=n+4*o,r=i.matrixWorldInverse;a.getNormalMatrix(r),(null===h||h.length<e)&&(h=new Float32Array(e));for(let e=0,i=n;e!==o;++e,i+=4)s.copy(t[e]).applyMatrix4(r,a),s.normal.toArray(h,i),h[i+3]=s.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const s=0!==t.length||e||0!==n||r;return r=e,i=u(t,o,0),n=t.length,s},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1,h()},this.setState=function(e,s,a){const c=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===c||0===c.length||o&&!p)o?u(null):h();else{const t=o?0:n,e=4*t;let r=f.clippingState||null;l.value=r,r=u(c,s,e,a);for(let t=0;t!==e;++t)r[t]=i[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function si(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const o=r.mapping;if(303===o||304===o){if(e.has(r)){return i(e.get(r).texture,r.mapping)}{const o=r.image;if(o&&o.height>0){const s=t.getRenderTarget(),a=new He(o.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),t.setRenderTarget(s),r.addEventListener("dispose",n),i(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function ai(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function li(t,e,i,n){const r={},o=new WeakMap;function s(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",s),delete r[a.id];const l=o.get(a);l&&(e.remove(l),o.delete(a)),n.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,i.memory.geometries--}function a(t){const i=[],n=t.index,r=t.attributes.position;let s=0;if(null!==n){const t=n.array;s=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],o=t[e+2];i.push(n,r,r,o,o,n)}}else{const t=r.array;s=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const a=new(re(i)>65535?ie:te)(i,1);a.version=s;const l=o.get(t);l&&e.remove(l),o.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,i.memory.geometries++),e},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&a(t)}else a(t);return o.get(t)}}}function hi(t,e,i,n){const r=n.isWebGL2;let o,s,a;this.setMode=function(t){o=t},this.setIndex=function(t){s=t.type,a=t.bytesPerElement},this.render=function(e,n){t.drawElements(o,n,s,e*a),i.update(n,o,1)},this.renderInstances=function(n,l,h){if(0===h)return;let u,c;if(r)u=t,c="drawElementsInstanced";else if(u=e.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[c](o,l,s,n*a,h),i.update(l,o,h)}}function ui(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ci(t,e){return t[0]-e[0]}function di(t,e){return Math.abs(e[1])-Math.abs(t[1])}function pi(t){const e={},i=new Float32Array(8),n=[];for(let t=0;t<8;t++)n[t]=[t,0];return{update:function(r,o,s,a){const l=r.morphTargetInfluences,h=void 0===l?0:l.length;let u=e[o.id];if(void 0===u||u.length!==h){u=[];for(let t=0;t<h;t++)u[t]=[t,0];e[o.id]=u}for(let t=0;t<h;t++){const e=u[t];e[0]=t,e[1]=l[t]}u.sort(di);for(let t=0;t<8;t++)t<h&&u[t][1]?(n[t][0]=u[t][0],n[t][1]=u[t][1]):(n[t][0]=Number.MAX_SAFE_INTEGER,n[t][1]=0);n.sort(ci);const c=s.morphTargets&&o.morphAttributes.position,d=s.morphNormals&&o.morphAttributes.normal;let p=0;for(let t=0;t<8;t++){const e=n[t],r=e[0],s=e[1];r!==Number.MAX_SAFE_INTEGER&&s?(c&&o.getAttribute("morphTarget"+t)!==c[r]&&o.setAttribute("morphTarget"+t,c[r]),d&&o.getAttribute("morphNormal"+t)!==d[r]&&o.setAttribute("morphNormal"+t,d[r]),i[t]=s,p+=s):(c&&!0===o.hasAttribute("morphTarget"+t)&&o.deleteAttribute("morphTarget"+t),d&&!0===o.hasAttribute("morphNormal"+t)&&o.deleteAttribute("morphNormal"+t),i[t]=0)}const f=o.morphTargetsRelative?1:1-p;a.getUniforms().setValue(t,"morphTargetBaseInfluence",f),a.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function fi(t,e,i,n){let r=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const s=n.render.frame,a=t.geometry,l=e.get(t,a);return r.get(l)!==s&&(e.update(l),r.set(l,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}ti.physical={uniforms:Le([ti.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new g(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Zt(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new g},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Zt(0)}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag};class mi extends b{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}mi.prototype.isDataTexture2DArray=!0;class gi extends b{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}gi.prototype.isDataTexture3D=!0;const vi=new b,_i=new mi,yi=new gi,xi=new Ge,bi=[],Ti=[],Ei=new Float32Array(16),Si=new Float32Array(9),wi=new Float32Array(4);function Ai(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let o=bi[r];if(void 0===o&&(o=new Float32Array(r),bi[r]=o),0!==e){n.toArray(o,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(o,r)}return o}function Mi(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Ci(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function Ri(t,e){let i=Ti[e];void 0===i&&(i=new Int32Array(e),Ti[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Ii(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Pi(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Mi(i,e))return;t.uniform2fv(this.addr,e),Ci(i,e)}}function Oi(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Mi(i,e))return;t.uniform3fv(this.addr,e),Ci(i,e)}}function Ni(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Mi(i,e))return;t.uniform4fv(this.addr,e),Ci(i,e)}}function Li(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Mi(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ci(i,e)}else{if(Mi(i,n))return;wi.set(n),t.uniformMatrix2fv(this.addr,!1,wi),Ci(i,n)}}function Di(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Mi(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ci(i,e)}else{if(Mi(i,n))return;Si.set(n),t.uniformMatrix3fv(this.addr,!1,Si),Ci(i,n)}}function Fi(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Mi(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ci(i,e)}else{if(Mi(i,n))return;Ei.set(n),t.uniformMatrix4fv(this.addr,!1,Ei),Ci(i,n)}}function Bi(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Ui(t,e){const i=this.cache;Mi(i,e)||(t.uniform2iv(this.addr,e),Ci(i,e))}function ki(t,e){const i=this.cache;Mi(i,e)||(t.uniform3iv(this.addr,e),Ci(i,e))}function Gi(t,e){const i=this.cache;Mi(i,e)||(t.uniform4iv(this.addr,e),Ci(i,e))}function Hi(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function ji(t,e){const i=this.cache;Mi(i,e)||(t.uniform2uiv(this.addr,e),Ci(i,e))}function zi(t,e){const i=this.cache;Mi(i,e)||(t.uniform3uiv(this.addr,e),Ci(i,e))}function Vi(t,e){const i=this.cache;Mi(i,e)||(t.uniform4uiv(this.addr,e),Ci(i,e))}function Xi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||vi,r)}function Wi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||yi,r)}function Yi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||xi,r)}function qi(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||_i,r)}function Zi(t,e){t.uniform1fv(this.addr,e)}function Ji(t,e){const i=Ai(e,this.size,2);t.uniform2fv(this.addr,i)}function Ki(t,e){const i=Ai(e,this.size,3);t.uniform3fv(this.addr,i)}function Qi(t,e){const i=Ai(e,this.size,4);t.uniform4fv(this.addr,i)}function $i(t,e){const i=Ai(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function tn(t,e){const i=Ai(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function en(t,e){const i=Ai(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function nn(t,e){t.uniform1iv(this.addr,e)}function rn(t,e){t.uniform2iv(this.addr,e)}function on(t,e){t.uniform3iv(this.addr,e)}function sn(t,e){t.uniform4iv(this.addr,e)}function an(t,e){t.uniform1uiv(this.addr,e)}function ln(t,e){t.uniform2uiv(this.addr,e)}function hn(t,e){t.uniform3uiv(this.addr,e)}function un(t,e){t.uniform4uiv(this.addr,e)}function cn(t,e,i){const n=e.length,r=Ri(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTexture2D(e[t]||vi,r[t])}function dn(t,e,i){const n=e.length,r=Ri(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTextureCube(e[t]||xi,r[t])}function pn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Ii;case 35664:return Pi;case 35665:return Oi;case 35666:return Ni;case 35674:return Li;case 35675:return Di;case 35676:return Fi;case 5124:case 35670:return Bi;case 35667:case 35671:return Ui;case 35668:case 35672:return ki;case 35669:case 35673:return Gi;case 5125:return Hi;case 36294:return ji;case 36295:return zi;case 36296:return Vi;case 35678:case 36198:case 36298:case 36306:case 35682:return Xi;case 35679:case 36299:case 36307:return Wi;case 35680:case 36300:case 36308:case 36293:return Yi;case 36289:case 36303:case 36311:case 36292:return qi}}(e.type)}function fn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Zi;case 35664:return Ji;case 35665:return Ki;case 35666:return Qi;case 35674:return $i;case 35675:return tn;case 35676:return en;case 5124:case 35670:return nn;case 35667:case 35671:return rn;case 35668:case 35672:return on;case 35669:case 35673:return sn;case 5125:return an;case 36294:return ln;case 36295:return hn;case 36296:return un;case 35678:case 36198:case 36298:case 36306:case 35682:return cn;case 35680:case 36300:case 36308:case 36293:return dn}}(e.type)}function mn(t){this.id=t,this.seq=[],this.map={}}fn.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ci(e,t)},mn.prototype.setValue=function(t,e,i){const n=this.seq;for(let r=0,o=n.length;r!==o;++r){const o=n[r];o.setValue(t,e[o.id],i)}};const gn=/(\w+)(\])?(\[|\.)?/g;function vn(t,e){t.seq.push(e),t.map[e.id]=e}function _n(t,e,i){const n=t.name,r=n.length;for(gn.lastIndex=0;;){const o=gn.exec(n),s=gn.lastIndex;let a=o[1];const l="]"===o[2],h=o[3];if(l&&(a|=0),void 0===h||"["===h&&s+2===r){vn(i,void 0===h?new pn(a,t,e):new fn(a,t,e));break}{let t=i.map[a];void 0===t&&(t=new mn(a),vn(i,t)),i=t}}}function yn(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);_n(i,t.getUniformLocation(e,i.name),this)}}function xn(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}yn.prototype.setValue=function(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)},yn.prototype.setOptional=function(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)},yn.upload=function(t,e,i,n){for(let r=0,o=e.length;r!==o;++r){const o=e[r],s=i[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},yn.seqWithValue=function(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i};let bn=0;function Tn(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function En(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(n&&""===r)return"";return"THREE.WebGLShader: gl.getShaderInfoLog() "+i+"\n"+r+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function Sn(t,e){const i=Tn(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function wn(t,e){const i=Tn(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function An(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Mn(t){return""!==t}function Cn(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Rn(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const In=/^[ \t]*#include +<([\w\d./]+)>/gm;function Pn(t){return t.replace(In,On)}function On(t,e){const i=Qe[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Pn(i)}const Nn=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ln=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Dn(t){return t.replace(Ln,Bn).replace(Nn,Fn)}function Fn(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Bn(t,e,i,n)}function Bn(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Un(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function kn(t,e,i,n){const r=t.getContext(),o=i.defines;let s=i.vertexShader,a=i.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),h=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),u=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(i),c=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),d=t.gammaFactor>0?t.gammaFactor:1,p=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission>0)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Mn).join("\n")}(i),f=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(o),m=r.createProgram();let g,v,_=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(g=[f].filter(Mn).join("\n"),g.length>0&&(g+="\n"),v=[p,f].filter(Mn).join("\n"),v.length>0&&(v+="\n")):(g=[Un(i),"#define SHADER_NAME "+i.shaderName,f,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Mn).join("\n"),v=[p,Un(i),"#define SHADER_NAME "+i.shaderName,f,i.alphaTest?"#define ALPHATEST "+i.alphaTest+(i.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.envMap?"#define "+u:"",i.envMap?"#define "+c:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.sheen?"#define USE_SHEEN":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensionShaderTextureLOD||i.envMap)&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Qe.tonemapping_pars_fragment:"",0!==i.toneMapping?An("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",Qe.encodings_pars_fragment,i.map?Sn("mapTexelToLinear",i.mapEncoding):"",i.matcap?Sn("matcapTexelToLinear",i.matcapEncoding):"",i.envMap?Sn("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMap?Sn("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.lightMap?Sn("lightMapTexelToLinear",i.lightMapEncoding):"",wn("linearToOutputTexel",i.outputEncoding),i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Mn).join("\n")),s=Pn(s),s=Cn(s,i),s=Rn(s,i),a=Pn(a),a=Cn(a,i),a=Rn(a,i),s=Dn(s),a=Dn(a),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(_="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in","300 es"===i.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===i.glslVersion?"":"#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"+v);const y=_+v+a,x=xn(r,35633,_+g+s),b=xn(r,35632,y);if(r.attachShader(m,x),r.attachShader(m,b),void 0!==i.index0AttributeName?r.bindAttribLocation(m,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(x).trim(),i=r.getShaderInfoLog(b).trim();let n=!0,o=!0;if(!1===r.getProgramParameter(m,35714)){n=!1;const e=En(r,x,"vertex"),i=En(r,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(m,35715),"gl.getProgramInfoLog",t,e,i)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==i||(o=!1);o&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:i,prefix:v}})}let T,E;return r.deleteShader(x),r.deleteShader(b),this.getUniforms=function(){return void 0===T&&(T=new yn(r,m)),T},this.getAttributes=function(){return void 0===E&&(E=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r).name;i[n]=t.getAttribLocation(e,n)}return i}(r,m)),E},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=i.shaderName,this.id=bn++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=b,this}function Gn(t,e,i,n,r,o){const s=[],a=n.isWebGL2,l=n.logarithmicDepthBuffer,h=n.floatVertexTextures,u=n.maxVertexUniforms,c=n.vertexTextures;let d=n.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmission","transmissionMap","thicknessMap"];function m(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,e}return{getParameters:function(r,s,f,g,v){const _=g.fog,y=r.isMeshStandardMaterial?g.environment:null,x=e.get(r.envMap||y),b=p[r.type],T=v.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(h)return 1024;{const t=u,i=Math.floor((t-20)/4),n=Math.min(i,e.length);return n<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+n+"."),0):n}}(v):0;let E,S;if(null!==r.precision&&(d=n.getMaxPrecision(r.precision),d!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.")),b){const t=ti[b];E=t.vertexShader,S=t.fragmentShader}else E=r.vertexShader,S=r.fragmentShader;const w=t.getRenderTarget();return{isWebGL2:a,shaderID:b,shaderName:r.type,vertexShader:E,fragmentShader:S,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,instancing:!0===v.isInstancedMesh,instancingColor:!0===v.isInstancedMesh&&null!==v.instanceColor,supportsVertexTextures:c,outputEncoding:null!==w?m(w.texture):t.outputEncoding,map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:m(x),envMapCubeUV:!!x&&(306===x.mapping||307===x.mapping),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmission:!!r.transmission,transmissionMap:!!r.transmissionMap,thicknessMap:!!r.thicknessMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&v.geometry&&v.geometry.attributes.color&&4===v.geometry.attributes.color.itemSize,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap||r.thicknessMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmission||r.transmissionMap||r.thicknessMap||!r.displacementMap),fog:!!_,useFog:r.fog,fogExp2:_&&_.isFogExp2,flatShading:!!r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:l,skinning:!0===v.isSkinnedMesh&&T>0,maxBones:T,useVertexTexture:h,morphTargets:r.morphTargets,morphNormals:r.morphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&f.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||i.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<f.length;t++)i.push(e[f[t]]);i.push(t.outputEncoding),i.push(t.gammaFactor)}return i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=p[t.type];let i;if(e){const t=ti[e];i=De.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new kn(t,i,e,r),s.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=s.indexOf(t);s[e]=s[s.length-1],s.pop(),t.destroy()}},programs:s}}function Hn(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function jn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function zn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Vn(t){const e=[];let i=0;const n=[],r=[],o=[],s={id:-1};function a(n,r,o,a,l,h){let u=e[i];const c=t.get(o);return void 0===u?(u={id:n.id,object:n,geometry:r,material:o,program:c.program||s,groupOrder:a,renderOrder:n.renderOrder,z:l,group:h},e[i]=u):(u.id=n.id,u.object=n,u.geometry=r,u.material=o,u.program=c.program||s,u.groupOrder=a,u.renderOrder=n.renderOrder,u.z=l,u.group=h),i++,u}return{opaque:n,transmissive:r,transparent:o,init:function(){i=0,n.length=0,r.length=0,o.length=0},push:function(t,e,i,s,l,h){const u=a(t,e,i,s,l,h);i.transmission>0?r.push(u):!0===i.transparent?o.push(u):n.push(u)},unshift:function(t,e,i,s,l,h){const u=a(t,e,i,s,l,h);i.transmission>0?r.unshift(u):!0===i.transparent?o.unshift(u):n.unshift(u)},finish:function(){for(let t=i,n=e.length;t<n;t++){const i=e[t];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(t,e){n.length>1&&n.sort(t||jn),r.length>1&&r.sort(e||zn),o.length>1&&o.sort(e||zn)}}}function Xn(t){let e=new WeakMap;return{get:function(i,n){let r;return!1===e.has(i)?(r=new Vn(t),e.set(i,[r])):n>=e.get(i).length?(r=new Vn(t),e.get(i).push(r)):r=e.get(i)[n],r},dispose:function(){e=new WeakMap}}}function Wn(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new M,color:new Zt};break;case"SpotLight":i={position:new M,direction:new M,color:new Zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new M,color:new Zt,distance:0,decay:0};break;case"HemisphereLight":i={direction:new M,skyColor:new Zt,groundColor:new Zt};break;case"RectAreaLight":i={color:new Zt,position:new M,halfWidth:new M,halfHeight:new M}}return t[e.id]=i,i}}}let Yn=0;function qn(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Zn(t,e){const i=new Wn,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new M);const o=new M,s=new rt,a=new rt;return{setup:function(o){let s=0,a=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,c=0,d=0,p=0,f=0,m=0,g=0;o.sort(qn);for(let t=0,e=o.length;t<e;t++){const e=o[t],v=e.color,_=e.intensity,y=e.distance,x=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=v.r*_,a+=v.g*_,l+=v.b*_;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],_);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[h]=i,r.directionalShadowMap[h]=x,r.directionalShadowMatrix[h]=e.shadow.matrix,f++}r.directional[h]=t,h++}else if(e.isSpotLight){const t=i.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(v).multiplyScalar(_),t.distance=y,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.spotShadow[c]=i,r.spotShadowMap[c]=x,r.spotShadowMatrix[c]=e.shadow.matrix,g++}r.spot[c]=t,c++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(v).multiplyScalar(_),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[d]=t,d++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[u]=i,r.pointShadowMap[u]=x,r.pointShadowMatrix[u]=e.shadow.matrix,m++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(_),t.groundColor.copy(e.groundColor).multiplyScalar(_),r.hemi[p]=t,p++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=$e.LTC_FLOAT_1,r.rectAreaLTC2=$e.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=$e.LTC_HALF_1,r.rectAreaLTC2=$e.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=a,r.ambient[2]=l;const v=r.hash;v.directionalLength===h&&v.pointLength===u&&v.spotLength===c&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(r.directional.length=h,r.spot.length=c,r.rectArea.length=d,r.point.length=u,r.hemi.length=p,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=g,v.directionalLength=h,v.pointLength=u,v.spotLength=c,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,r.version=Yn++)},setupView:function(t,e){let i=0,n=0,l=0,h=0,u=0;const c=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(c),i++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(c),l++}else if(d.isRectAreaLight){const t=r.rectArea[h];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),a.identity(),s.copy(d.matrixWorld),s.premultiply(c),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),h++}else if(d.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),n++}else if(d.isHemisphereLight){const t=r.hemi[u];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(c),t.direction.normalize(),u++}}},state:r}}function Jn(t,e){const i=new Zn(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(){i.setup(n)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function Kn(t,e){let i=new WeakMap;return{get:function(n,r=0){let o;return!1===i.has(n)?(o=new Jn(t,e),i.set(n,[o])):r>=i.get(n).length?(o=new Jn(t,e),i.get(n).push(o)):o=i.get(n)[r],o},dispose:function(){i=new WeakMap}}}class Qn extends jt{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,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.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Qn.prototype.isMeshDepthMaterial=!0;class $n extends jt{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new M,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}$n.prototype.isMeshDistanceMaterial=!0;function tr(t,e,i){let n=new qe;const r=new g,o=new g,s=new E,a=[],l=[],h={},u=i.maxTextureSize,c={0:1,1:0,2:2},d=new Fe({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new g},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new de;f.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Ie(f,d),v=this;function _(i,n){const r=e.update(m);d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,d,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,p,m,null)}function y(t){const e=t<<0;let i=a[e];return void 0===i&&(i=new Qn({depthPacking:3201,morphTargets:t}),a[e]=i),i}function x(t){const e=t<<0;let i=l[e];return void 0===i&&(i=new $n({morphTargets:t}),l[e]=i),i}function b(e,i,n,r,o,s,a){let l=null,u=y,d=e.customDepthMaterial;if(!0===r.isPointLight&&(u=x,d=e.customDistanceMaterial),void 0===d){let t=!1;!0===n.morphTargets&&(t=i.morphAttributes&&i.morphAttributes.position&&i.morphAttributes.position.length>0),l=u(t)}else l=d;if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){const t=l.uuid,e=n.uuid;let i=h[t];void 0===i&&(i={},h[t]=i);let r=i[e];void 0===r&&(r=l.clone(),i[e]=r),l=r}return l.visible=n.visible,l.wireframe=n.wireframe,l.side=3===a?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:c[n.side],l.clipShadows=n.clipShadows,l.clippingPlanes=n.clippingPlanes,l.clipIntersection=n.clipIntersection,l.wireframeLinewidth=n.wireframeLinewidth,l.linewidth=n.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=o,l.farDistance=s),l}function T(i,r,o,s,a){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===a)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let l=0,h=e.length;l<h;l++){const h=e[l],u=r[h.materialIndex];if(u&&u.visible){const e=b(i,n,u,s,o.near,o.far,a);t.renderBufferDirect(o,null,n,e,i,h)}}}else if(r.visible){const e=b(i,n,r,s,o.near,o.far,a);t.renderBufferDirect(o,null,n,e,i,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)T(l[t],r,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,i,a){if(!1===v.enabled)return;if(!1===v.autoUpdate&&!1===v.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),h=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,h=e.length;l<h;l++){const h=e[l],c=h.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;r.copy(c.mapSize);const p=c.getFrameExtents();if(r.multiply(p),o.copy(c.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(o.x=Math.floor(u/p.x),r.x=o.x*p.x,c.mapSize.x=o.x),r.y>u&&(o.y=Math.floor(u/p.y),r.y=o.y*p.y,c.mapSize.y=o.y)),null===c.map&&!c.isPointLightShadow&&3===this.type){const t={minFilter:1006,magFilter:1006,format:1023};c.map=new S(r.x,r.y,t),c.map.texture.name=h.name+".shadowMap",c.mapPass=new S(r.x,r.y,t),c.camera.updateProjectionMatrix()}if(null===c.map){const t={minFilter:1003,magFilter:1003,format:1023};c.map=new S(r.x,r.y,t),c.map.texture.name=h.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const f=c.getViewportCount();for(let t=0;t<f;t++){const e=c.getViewport(t);s.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),d.viewport(s),c.updateMatrices(h,t),n=c.getFrustum(),T(i,a,c.camera,h,this.type)}c.isPointLightShadow||3!==this.type||_(c,a),c.needsUpdate=!1}v.needsUpdate=!1,t.setRenderTarget(l,h,c)}}function er(t,e,i){const n=i.isWebGL2;const r=new function(){let e=!1;const i=new E;let n=null;const r=new E(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,o,s,a){!0===a&&(e*=s,n*=s,o*=s),i.set(e,n,o,s),!1===r.equals(i)&&(t.clearColor(e,n,o,s),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},o=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?U(2929):k(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},s=new function(){let e=!1,i=null,n=null,r=null,o=null,s=null,a=null,l=null,h=null;return{setTest:function(t){e||(t?U(2960):k(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,s){n===e&&r===i&&o===s||(t.stencilFunc(e,i,s),n=e,r=i,o=s)},setOp:function(e,i,n){s===e&&a===i&&l===n||(t.stencilOp(e,i,n),s=e,a=i,l=n)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,i=null,n=null,r=null,o=null,s=null,a=null,l=null,h=null}}};let a={},l=null,h={},u=null,c=!1,d=null,p=null,f=null,m=null,g=null,v=null,_=null,y=!1,x=null,b=null,T=null,S=null,w=null;const A=t.getParameter(35661);let M=!1,C=0;const R=t.getParameter(7938);-1!==R.indexOf("WebGL")?(C=parseFloat(/^WebGL (\d)/.exec(R)[1]),M=C>=1):-1!==R.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),M=C>=2);let I=null,P={};const O=t.getParameter(3088),N=t.getParameter(2978),L=(new E).fromArray(O),D=(new E).fromArray(N);function F(e,i,n){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,r);return o}const B={};function U(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function k(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}B[3553]=F(3553,3553,1),B[34067]=F(34067,34069,6),r.setClear(0,0,0,1),o.setClear(1),s.setClear(0),U(2929),o.setFunc(3),z(!1),V(1),U(2884),j(0);const G={100:32774,101:32778,102:32779};if(n)G[103]=32775,G[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(G[103]=t.MIN_EXT,G[104]=t.MAX_EXT)}const H={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function j(e,i,n,r,o,s,a,l){if(0!==e){if(!1===c&&(U(3042),c=!0),5===e)o=o||i,s=s||n,a=a||r,i===p&&o===g||(t.blendEquationSeparate(G[i],G[o]),p=i,g=o),n===f&&r===m&&s===v&&a===_||(t.blendFuncSeparate(H[n],H[r],H[s],H[a]),f=n,m=r,v=s,_=a),d=e,y=null;else if(e!==d||l!==y){if(100===p&&100===g||(t.blendEquation(32774),p=100,g=100),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,m=null,v=null,_=null,d=e,y=l}}else!0===c&&(k(3042),c=!1)}function z(e){x!==e&&(e?t.frontFace(2304):t.frontFace(2305),x=e)}function V(e){0!==e?(U(2884),e!==b&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):k(2884),b=e}function X(e,i,n){e?(U(32823),S===i&&w===n||(t.polygonOffset(i,n),S=i,w=n)):k(32823)}function W(e){void 0===e&&(e=33984+A-1),I!==e&&(t.activeTexture(e),I=e)}return{buffers:{color:r,depth:o,stencil:s},enable:U,disable:k,bindFramebuffer:function(e,i){return null===i&&null!==l&&(i=l),h[e]!==i&&(t.bindFramebuffer(e,i),h[e]=i,n&&(36009===e&&(h[36160]=i),36160===e&&(h[36009]=i)),!0)},bindXRFramebuffer:function(e){e!==l&&(t.bindFramebuffer(36160,e),l=e)},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:j,setMaterial:function(t,e){2===t.side?k(2884):U(2884);let i=1===t.side;e&&(i=!i),z(i),1===t.blending&&!1===t.transparent?j(0):j(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),r.setMask(t.colorWrite);const n=t.stencilWrite;s.setTest(n),n&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),X(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?U(32926):k(32926)},setFlipSided:z,setCullFace:V,setLineWidth:function(e){e!==T&&(M&&t.lineWidth(e),T=e)},setPolygonOffset:X,setScissorTest:function(t){t?U(3089):k(3089)},activeTexture:W,bindTexture:function(e,i){null===I&&W();let n=P[I];void 0===n&&(n={type:void 0,texture:void 0},P[I]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||B[e]),n.type=e,n.texture=i)},unbindTexture:function(){const e=P[I];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===L.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),L.copy(e))},viewport:function(e){!1===D.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),D.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===n&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},I=null,P={},l=null,h={},u=null,c=!1,d=null,p=null,f=null,m=null,g=null,v=null,_=null,y=!1,x=null,b=null,T=null,S=null,w=null,L.set(0,0,t.canvas.width,t.canvas.height),D.set(0,0,t.canvas.width,t.canvas.height),r.reset(),o.reset(),s.reset()}}}function ir(t,e,i,n,r,o,s){const a=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,u=r.maxTextureSize,c=r.maxSamples,d=new WeakMap;let p,g=!1;try{g="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function v(t,e){return g?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function _(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?m:Math.floor,o=n(r*t.width),s=n(r*t.height);void 0===p&&(p=v(o,s));const a=i?v(o,s):p;a.width=o,a.height=s;return a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function y(t){return f(t.width)&&f(t.height)}function x(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function b(e,i,r,o,s=1){t.generateMipmap(e);n.get(i).__maxMipLevel=Math.log2(Math.max(r,o,s))}function T(i,n,r){if(!1===a)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;return 6403===n&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===n&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===n&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function E(t){return 1003===t||1004===t||1005===t?9728:9729}function S(e){const i=e.target;i.removeEventListener("dispose",S),function(e){const i=n.get(e);if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture),n.remove(e)}(i),i.isVideoTexture&&d.delete(i),s.memory.textures--}function w(e){const i=e.target;i.removeEventListener("dispose",w),function(e){const i=e.texture,r=n.get(e),o=n.get(i);if(!e)return;void 0!==o.__webglTexture&&(t.deleteTexture(o.__webglTexture),s.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),s.memory.textures--),n.remove(i[e])}n.remove(i),n.remove(e)}(i)}let A=0;function M(t,e){const r=n.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const i=t.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==i.complete)return void N(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function C(e,r){const s=n.get(e);e.version>0&&s.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;O(e,n),i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const s=n&&(n.isCompressedTexture||n.image[0].isCompressedTexture),l=n.image[0]&&n.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=s||l?l?n.image[t].image:n.image[t]:_(n.image[t],!1,!0,h);const c=u[0],d=y(c)||a,p=o.convert(n.format),f=o.convert(n.type),m=T(n.internalFormat,p,f);let g;if(P(34067,n,d),s){for(let t=0;t<6;t++){g=u[t].mipmaps;for(let e=0;e<g.length;e++){const r=g[e];1023!==n.format&&1022!==n.format?null!==p?i.compressedTexImage2D(34069+t,e,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+t,e,m,r.width,r.height,0,p,f,r.data)}}e.__maxMipLevel=g.length-1}else{g=n.mipmaps;for(let t=0;t<6;t++)if(l){i.texImage2D(34069+t,0,m,u[t].width,u[t].height,0,p,f,u[t].data);for(let e=0;e<g.length;e++){const n=g[e].image[t].image;i.texImage2D(34069+t,e+1,m,n.width,n.height,0,p,f,n.data)}}else{i.texImage2D(34069+t,0,m,p,f,u[t]);for(let e=0;e<g.length;e++){const n=g[e];i.texImage2D(34069+t,e+1,m,p,f,n.image[t])}}e.__maxMipLevel=g.length}x(n,d)&&b(34067,n,c.width,c.height);e.__version=n.version,n.onUpdate&&n.onUpdate(n)}(s,e,r):(i.activeTexture(33984+r),i.bindTexture(34067,s.__webglTexture))}const R={1e3:10497,1001:33071,1002:33648},I={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function P(i,o,s){if(s?(t.texParameteri(i,10242,R[o.wrapS]),t.texParameteri(i,10243,R[o.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,R[o.wrapR]),t.texParameteri(i,10240,I[o.magFilter]),t.texParameteri(i,10241,I[o.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),1001===o.wrapS&&1001===o.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,E(o.magFilter)),t.texParameteri(i,10241,E(o.minFilter)),1003!==o.minFilter&&1006!==o.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(1015===o.type&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&1016===o.type&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function O(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",S),e.__webglTexture=t.createTexture(),s.memory.textures++)}function N(e,n,r){let s=3553;n.isDataTexture2DArray&&(s=35866),n.isDataTexture3D&&(s=32879),O(e,n),i.activeTexture(33984+r),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===y(n.image),h=_(n.image,l,!1,u),c=y(h)||a,d=o.convert(n.format);let p,f=o.convert(n.type),m=T(n.internalFormat,d,f);P(s,n,c);const g=n.mipmaps;if(n.isDepthTexture)m=6402,a?m=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===m&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,f=o.convert(n.type)),1027===n.format&&6402===m&&(m=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,f=o.convert(n.type))),i.texImage2D(3553,0,m,h.width,h.height,0,d,f,null);else if(n.isDataTexture)if(g.length>0&&c){for(let t=0,e=g.length;t<e;t++)p=g[t],i.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);n.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else i.texImage2D(3553,0,m,h.width,h.height,0,d,f,h.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(let t=0,e=g.length;t<e;t++)p=g[t],1023!==n.format&&1022!==n.format?null!==d?i.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=g.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,m,h.width,h.height,h.depth,0,d,f,h.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,m,h.width,h.height,h.depth,0,d,f,h.data),e.__maxMipLevel=0;else if(g.length>0&&c){for(let t=0,e=g.length;t<e;t++)p=g[t],i.texImage2D(3553,t,m,d,f,p);n.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else i.texImage2D(3553,0,m,d,f,h),e.__maxMipLevel=0;x(n,c)&&b(s,n,h.width,h.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function L(e,r,s,a,l){const h=o.convert(s.format),u=o.convert(s.type),c=T(s.internalFormat,h,u);32879===l||35866===l?i.texImage3D(l,0,c,r.width,r.height,r.depth,0,h,u,null):i.texImage2D(l,0,c,r.width,r.height,0,h,u,null),i.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,a,l,n.get(s).__webglTexture,0),i.bindFramebuffer(36160,null)}function D(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n){const e=i.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const n=B(i);t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){const e=B(i);t.renderbufferStorageMultisample(36161,e,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture[0]:i.texture,r=o.convert(e.format),s=o.convert(e.type),a=T(e.internalFormat,r,s);if(n){const e=B(i);t.renderbufferStorageMultisample(36161,e,a,i.width,i.height)}else t.renderbufferStorage(36161,a,i.width,i.height)}t.bindRenderbuffer(36161,null)}function F(e){const r=n.get(e),o=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(o)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),M(r.depthTexture,0);const o=n.get(r.depthTexture).__webglTexture;if(1026===r.depthTexture.format)t.framebufferTexture2D(36160,36096,3553,o,0);else{if(1027!==r.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,o,0)}}(r.__webglFramebuffer,e)}else if(o){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(36160,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),D(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),D(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(36160,null)}function B(t){return a&&t.isWebGLMultisampleRenderTarget?Math.min(c,t.samples):0}let U=!1,k=!1;this.allocateTextureUnit=function(){const t=A;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),A+=1,t},this.resetTextureUnits=function(){A=0},this.setTexture2D=M,this.setTexture2DArray=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?N(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?N(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=C,this.setupRenderTarget=function(e){const l=e.texture,h=n.get(e),u=n.get(l);e.addEventListener("dispose",w),!0!==e.isWebGLMultipleRenderTargets&&(u.__webglTexture=t.createTexture(),u.__version=l.version,s.memory.textures++);const c=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,m=y(e)||a;if(!a||1022!==l.format||1015!==l.type&&1016!==l.type||(l.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){h.__webglFramebuffer=[];for(let e=0;e<6;e++)h.__webglFramebuffer[e]=t.createFramebuffer()}else if(h.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const i=e.texture;for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(p)if(a){h.__webglMultisampledFramebuffer=t.createFramebuffer(),h.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,h.__webglColorRenderbuffer);const n=o.convert(l.format),r=o.convert(l.type),s=T(l.internalFormat,n,r),a=B(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(h.__webglDepthRenderbuffer=t.createRenderbuffer(),D(h.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){i.bindTexture(34067,u.__webglTexture),P(34067,l,m);for(let t=0;t<6;t++)L(h.__webglFramebuffer[t],e,l,36064,34069+t);x(l,m)&&b(34067,l,e.width,e.height),i.bindTexture(34067,null)}else if(d){const t=e.texture;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=n.get(o);i.bindTexture(3553,s.__webglTexture),P(3553,o,m),L(h.__webglFramebuffer,e,o,36064+r,3553),x(o,m)&&b(3553,o,e.width,e.height)}i.bindTexture(3553,null)}else{let t=3553;if(f)if(a){t=l.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");i.bindTexture(t,u.__webglTexture),P(t,l,m),L(h.__webglFramebuffer,e,l,36064,t),x(l,m)&&b(t,l,e.width,e.height,e.depth),i.bindTexture(t,null)}e.depthBuffer&&F(e)},this.updateRenderTargetMipmap=function(t){const e=y(t)||a,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let o=0,s=r.length;o<s;o++){const s=r[o];if(x(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=n.get(s).__webglTexture;i.bindTexture(e,r),b(e,s,t.width,t.height),i.bindTexture(e,null)}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const r=e.width,o=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024);const a=n.get(e);i.bindFramebuffer(36008,a.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,a.__webglFramebuffer),t.blitFramebuffer(0,0,r,o,0,0,r,o,s,9728),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,a.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===U&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),U=!0),t=t.texture),M(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===k&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),k=!0),t=t.texture),C(t,e)}}function nr(t,e,i){const n=i.isWebGL2;return{convert:function(t){let i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:(i=e.get("OES_texture_half_float"),null!==i?i.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return i=e.get("WEBGL_compressed_texture_etc1"),null!==i?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(i=e.get("WEBGL_compressed_texture_etc"),null!==i)){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(i=e.get("WEBGL_compressed_texture_astc"),null!==i?t:null):36492===t?(i=e.get("EXT_texture_compression_bptc"),null!==i?t:null):1020===t?n?34042:(i=e.get("WEBGL_depth_texture"),null!==i?i.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class rr extends Ue{constructor(t=[]){super(),this.cameras=t}}rr.prototype.isArrayCamera=!0;class or extends Rt{constructor(){super(),this.type="Group"}}or.prototype.isGroup=!0;const sr={type:"move"};class ar{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new or,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new or,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new or,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(sr))),l&&t.hand){o=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i);if(void 0===l.joints[n.jointName]){const t=new or;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[n.jointName]=t,l.add(t)}const r=l.joints[n.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=n.position.distanceTo(r.position),a=.02,h=.005;l.inputState.pinching&&s>a+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=a-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==s&&(s.visible=null!==n),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),this}}class lr extends s{constructor(t,e){super();const i=this,n=t.state;let r=null,o=1,s=null,a="local-floor",l=null,h=null,u=null,c=null;const d=[],p=new Map,f=new Ue;f.layers.enable(1),f.viewport=new E;const m=new Ue;m.layers.enable(2),m.viewport=new E;const g=[f,m],v=new rr;v.layers.enable(1),v.layers.enable(2);let _=null,y=null;function x(t){const e=p.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function b(){p.forEach((function(t,e){t.disconnect(e)})),p.clear(),_=null,y=null,n.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),R.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function T(t){const e=r.inputSources;for(let t=0;t<d.length;t++)p.set(e[t],d[t]);for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=p.get(i);n&&(n.dispatchEvent({type:"disconnected",data:i}),p.delete(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e],n=p.get(i);n&&n.dispatchEvent({type:"connected",data:i})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=d[t];return void 0===e&&(e=new ar,d[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=d[t];return void 0===e&&(e=new ar,d[t]=e),e.getGripSpace()},this.getHand=function(t){let e=d[t];return void 0===e&&(e=new ar,d[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getSession=function(){return r},this.setSession=async function(t){if(r=t,null!==r){r.addEventListener("select",x),r.addEventListener("selectstart",x),r.addEventListener("selectend",x),r.addEventListener("squeeze",x),r.addEventListener("squeezestart",x),r.addEventListener("squeezeend",x),r.addEventListener("end",b),r.addEventListener("inputsourceschange",T);const t=e.getContextAttributes();if(!0!==t.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers){const i={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:o},n=new XRWebGLLayer(r,e,i);r.updateRenderState({baseLayer:n})}else{let i=0;t.depth&&(i=t.stencil?34041:6402);const n={colorFormat:t.alpha?6408:6407,depthFormat:i,scaleFactor:o};h=new XRWebGLBinding(r,e),c=h.createProjectionLayer(n),u=e.createFramebuffer(),r.updateRenderState({layers:[c]})}s=await r.requestReferenceSpace(a),R.setContext(r),R.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};const S=new M,w=new M;function A(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===r)return;v.near=m.near=f.near=t.near,v.far=m.far=f.far=t.far,_===v.near&&y===v.far||(r.updateRenderState({depthNear:v.near,depthFar:v.far}),_=v.near,y=v.far);const e=t.parent,i=v.cameras;A(v,e);for(let t=0;t<i.length;t++)A(i[t],e);v.matrixWorld.decompose(v.position,v.quaternion,v.scale),t.position.copy(v.position),t.quaternion.copy(v.quaternion),t.scale.copy(v.scale),t.matrix.copy(v.matrix),t.matrixWorld.copy(v.matrixWorld);const n=t.children;for(let t=0,e=n.length;t<e;t++)n[t].updateMatrixWorld(!0);2===i.length?function(t,e,i){S.setFromMatrixPosition(e.matrixWorld),w.setFromMatrixPosition(i.matrixWorld);const n=S.distanceTo(w),r=e.projectionMatrix.elements,o=i.projectionMatrix.elements,s=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],u=(r[8]-1)/r[0],c=(o[8]+1)/o[0],d=s*u,p=s*c,f=n/(-u+c),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+f,v=a+f,_=d-m,y=p+(n-m),x=l*a/v*g,b=h*a/v*g;t.projectionMatrix.makePerspective(_,y,x,b,g,v)}(v,f,m):v.projectionMatrix.copy(f.projectionMatrix)},this.getCamera=function(){return v};let C=null;const R=new Ze;R.setAnimationLoop((function(t,i){if(l=i.getViewerPose(s),null!==l){const t=l.views,i=r.renderState.baseLayer;void 0===r.renderState.layers&&n.bindXRFramebuffer(i.framebuffer);let o=!1;t.length!==v.cameras.length&&(v.cameras.length=0,o=!0);for(let s=0;s<t.length;s++){const a=t[s];let l=null;if(void 0===r.renderState.layers)l=i.getViewport(a);else{const t=h.getViewSubImage(c,a);n.bindXRFramebuffer(u),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0),void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,36096,3553,t.depthStencilTexture,0),l=t.viewport}const d=g[s];d.matrix.fromArray(a.transform.matrix),d.projectionMatrix.fromArray(a.projectionMatrix),d.viewport.set(l.x,l.y,l.width,l.height),0===s&&v.matrix.copy(d.matrix),!0===o&&v.cameras.push(d)}}const o=r.inputSources;for(let t=0;t<d.length;t++){const e=d[t],n=o[t];e.update(n,i,s)}C&&C(t,i)})),this.setAnimationLoop=function(t){C=t},this.dispose=function(){}}}function hr(t){function e(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map),i.alphaMap&&(e.alphaMap.value=i.alphaMap),i.specularMap&&(e.specularMap.value=i.specularMap);const n=t.get(i).envMap;if(n){e.envMap.value=n,e.flipEnvMap.value=n.isCubeTexture&&n._needsFlipEnvMap?-1:1,e.reflectivity.value=i.reflectivity,e.refractionRatio.value=i.refractionRatio;const r=t.get(n).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,o;i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap&&(r=i.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),i.aoMap?o=i.aoMap:i.lightMap&&(o=i.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function i(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap),i.bumpMap&&(e.bumpMap.value=i.bumpMap,e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias);t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,o,s){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshPhongMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshStandardMaterial?(e(t,n),n.isMeshPhysicalMaterial?function(t,e,n){i(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap);e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate());t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap);e.transmission>0&&(t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height));t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap);t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)}(t,n,s):i(t,n)):n.isMeshMatcapMaterial?(e(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?(e(t,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,o):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function ur(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let c=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const m=this;let g=!1,v=0,_=0,y=null,x=-1,b=null;const T=new E,A=new E;let C=null,R=e.width,I=e.height,P=1,O=null,N=null;const L=new E(0,0,R,I),D=new E(0,0,R,I);let F=!1;const B=[],U=new qe;let k=!1,G=!1,H=null;const j=new rt,z=new M,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function X(){return null===y?P:1}let W,Y,q,Z,J,K,Q,$,tt,et,it,nt,ot,st,at,lt,ht,ut,ct,dt,pt,ft,mt=i;function gt(t,i){for(let n=0;n<t.length;n++){const r=t[n],o=e.getContext(r,i);if(null!==o)return o}return null}try{const t={alpha:n,depth:r,stencil:o,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if(e.addEventListener("webglcontextlost",yt,!1),e.addEventListener("webglcontextrestored",xt,!1),null===mt){const e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),mt=gt(e,t),null===mt)throw gt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===mt.getShaderPrecisionFormat&&(mt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function vt(){W=new ai(mt),Y=new ri(mt,W,t),W.init(Y),pt=new nr(mt,W,Y),q=new er(mt,W,Y),B[0]=1029,Z=new ui(mt),J=new Hn,K=new ir(mt,W,q,J,Y,pt,Z),Q=new si(m),$=new Je(mt,Y),ft=new ii(mt,W,$,Y),tt=new li(mt,$,Z,ft),et=new fi(mt,tt,$,Z),ut=new pi(mt),at=new oi(J),it=new Gn(m,Q,W,Y,ft,at),nt=new hr(J),ot=new Xn(J),st=new Kn(W,Y),ht=new ei(m,Q,q,et,a),lt=new tr(m,et,Y),ct=new ni(mt,W,Z,Y),dt=new hi(mt,W,Z,Y),Z.programs=it.programs,m.capabilities=Y,m.extensions=W,m.properties=J,m.renderLists=ot,m.shadowMap=lt,m.state=q,m.info=Z}vt();const _t=new lr(m,mt);function yt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function xt(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const t=Z.autoReset,e=lt.enabled,i=lt.autoUpdate,n=lt.needsUpdate,r=lt.type;vt(),Z.autoReset=t,lt.enabled=e,lt.autoUpdate=i,lt.needsUpdate=n,lt.type=r}function bt(t){const e=t.target;e.removeEventListener("dispose",bt),function(t){(function(t){const e=J.get(t).programs;void 0!==e&&e.forEach((function(t){it.releaseProgram(t)}))})(t),J.remove(t)}(e)}this.xr=_t,this.getContext=function(){return mt},this.getContextAttributes=function(){return mt.getContextAttributes()},this.forceContextLoss=function(){const t=W.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=W.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(R,I,!1))},this.getSize=function(t){return t.set(R,I)},this.setSize=function(t,i,n){_t.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=t,I=i,e.width=Math.floor(t*P),e.height=Math.floor(i*P),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return t.set(R*P,I*P).floor()},this.setDrawingBufferSize=function(t,i,n){R=t,I=i,P=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return t.copy(T)},this.getViewport=function(t){return t.copy(L)},this.setViewport=function(t,e,i,n){t.isVector4?L.set(t.x,t.y,t.z,t.w):L.set(t,e,i,n),q.viewport(T.copy(L).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(D)},this.setScissor=function(t,e,i,n){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,i,n),q.scissor(A.copy(D).multiplyScalar(P).floor())},this.getScissorTest=function(){return F},this.setScissorTest=function(t){q.setScissorTest(F=t)},this.setOpaqueSort=function(t){O=t},this.setTransparentSort=function(t){N=t},this.getClearColor=function(t){return t.copy(ht.getClearColor())},this.setClearColor=function(){ht.setClearColor.apply(ht,arguments)},this.getClearAlpha=function(){return ht.getClearAlpha()},this.setClearAlpha=function(){ht.setClearAlpha.apply(ht,arguments)},this.clear=function(t,e,i){let n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),mt.clear(n)},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(){e.removeEventListener("webglcontextlost",yt,!1),e.removeEventListener("webglcontextrestored",xt,!1),ot.dispose(),st.dispose(),J.dispose(),Q.dispose(),et.dispose(),ft.dispose(),_t.dispose(),_t.removeEventListener("sessionstart",Et),_t.removeEventListener("sessionend",St),H&&(H.dispose(),H=null),wt.stop()},this.renderBufferImmediate=function(t,e){ft.initAttributes();const i=J.get(t);t.hasPositions&&!i.position&&(i.position=mt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=mt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=mt.createBuffer()),t.hasColors&&!i.color&&(i.color=mt.createBuffer());const n=e.getAttributes();t.hasPositions&&(mt.bindBuffer(34962,i.position),mt.bufferData(34962,t.positionArray,35048),ft.enableAttribute(n.position),mt.vertexAttribPointer(n.position,3,5126,!1,0,0)),t.hasNormals&&(mt.bindBuffer(34962,i.normal),mt.bufferData(34962,t.normalArray,35048),ft.enableAttribute(n.normal),mt.vertexAttribPointer(n.normal,3,5126,!1,0,0)),t.hasUvs&&(mt.bindBuffer(34962,i.uv),mt.bufferData(34962,t.uvArray,35048),ft.enableAttribute(n.uv),mt.vertexAttribPointer(n.uv,2,5126,!1,0,0)),t.hasColors&&(mt.bindBuffer(34962,i.color),mt.bufferData(34962,t.colorArray,35048),ft.enableAttribute(n.color),mt.vertexAttribPointer(n.color,3,5126,!1,0,0)),ft.disableUnusedAttributes(),mt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,o){null===e&&(e=V);const s=r.isMesh&&r.matrixWorld.determinant()<0,a=It(t,e,n,r);q.setMaterial(n,s);let l=i.index;const h=i.attributes.position;if(null===l){if(void 0===h||0===h.count)return}else if(0===l.count)return;let u,c=1;!0===n.wireframe&&(l=tt.getWireframeAttribute(i),c=2),(n.morphTargets||n.morphNormals)&&ut.update(r,i,n,a),ft.setup(r,n,a,i,l);let d=ct;null!==l&&(u=$.get(l),d=dt,d.setIndex(u));const p=null!==l?l.count:h.count,f=i.drawRange.start*c,m=i.drawRange.count*c,g=null!==o?o.start*c:0,v=null!==o?o.count*c:1/0,_=Math.max(f,g),y=Math.min(p,f+m,g+v)-1,x=Math.max(0,y-_+1);if(0!==x){if(r.isMesh)!0===n.wireframe?(q.setLineWidth(n.wireframeLinewidth*X()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),q.setLineWidth(t*X()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(_,x,r.count);else if(i.isInstancedBufferGeometry){const t=Math.min(i.instanceCount,i._maxInstanceCount);d.renderInstances(_,x,t)}else d.render(_,x)}},this.compile=function(t,e){d=st.get(t),d.init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(),t.traverse((function(e){const i=e.material;if(i)if(Array.isArray(i))for(let n=0;n<i.length;n++){Ct(i[n],t,e)}else Ct(i,t,e)}))};let Tt=null;function Et(){wt.stop()}function St(){wt.start()}const wt=new Ze;function At(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=o.object,a=o.geometry,l=null===n?o.material:n,h=o.group;if(i.isArrayCamera){const t=i.cameras;for(let i=0,n=t.length;i<n;i++){const n=t[i];s.layers.test(n.layers)&&(q.viewport(T.copy(n.viewport)),d.setupLightsView(n),Mt(s,e,n,a,l,h))}}else Mt(s,e,i,a,l,h)}}function Mt(t,e,i,n,r,o){if(t.onBeforeRender(m,e,i,n,r,o),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const n=It(i,e,r,t);q.setMaterial(r),ft.reset(),function(t,e){t.render((function(t){m.renderBufferImmediate(t,e)}))}(t,n)}else!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,m.renderBufferDirect(i,e,n,r,t,o),r.side=0,r.needsUpdate=!0,m.renderBufferDirect(i,e,n,r,t,o),r.side=2):m.renderBufferDirect(i,e,n,r,t,o);t.onAfterRender(m,e,i,n,r,o)}function Ct(t,e,i){!0!==e.isScene&&(e=V);const n=J.get(t),r=d.state.lights,o=d.state.shadowsArray,s=r.state.version,a=it.getParameters(t,r.state,o,e,i),l=it.getProgramCacheKey(a);let h=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=Q.get(t.envMap||n.environment),void 0===h&&(t.addEventListener("dispose",bt),h=new Map,n.programs=h);let u=h.get(l);if(void 0!==u){if(n.currentProgram===u&&n.lightsStateVersion===s)return Rt(t,a),u}else a.uniforms=it.getUniforms(t),t.onBuild(a,m),t.onBeforeCompile(a,m),u=it.acquireProgram(a,l),h.set(l,u),n.uniforms=a.uniforms;const c=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=at.uniform),Rt(t,a),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=s,n.needsLights&&(c.ambientLightColor.value=r.state.ambient,c.lightProbe.value=r.state.probe,c.directionalLights.value=r.state.directional,c.directionalLightShadows.value=r.state.directionalShadow,c.spotLights.value=r.state.spot,c.spotLightShadows.value=r.state.spotShadow,c.rectAreaLights.value=r.state.rectArea,c.ltc_1.value=r.state.rectAreaLTC1,c.ltc_2.value=r.state.rectAreaLTC2,c.pointLights.value=r.state.point,c.pointLightShadows.value=r.state.pointShadow,c.hemisphereLights.value=r.state.hemi,c.directionalShadowMap.value=r.state.directionalShadowMap,c.directionalShadowMatrix.value=r.state.directionalShadowMatrix,c.spotShadowMap.value=r.state.spotShadowMap,c.spotShadowMatrix.value=r.state.spotShadowMatrix,c.pointShadowMap.value=r.state.pointShadowMap,c.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=u.getUniforms(),f=yn.seqWithValue(p.seq,c);return n.currentProgram=u,n.uniformsList=f,u}function Rt(t,e){const i=J.get(t);i.outputEncoding=e.outputEncoding,i.instancing=e.instancing,i.skinning=e.skinning,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas}function It(t,e,i,n){!0!==e.isScene&&(e=V),K.resetTextureUnits();const r=e.fog,o=i.isMeshStandardMaterial?e.environment:null,s=null===y?m.outputEncoding:y.texture.encoding,a=Q.get(i.envMap||o),l=!0===i.vertexColors&&n.geometry&&n.geometry.attributes.color&&4===n.geometry.attributes.color.itemSize,h=J.get(i),u=d.state.lights;if(!0===k&&(!0===G||t!==b)){const e=t===b&&i.id===x;at.setState(i,t,e)}let c=!1;i.version===h.__version?h.needsLights&&h.lightsStateVersion!==u.state.version||h.outputEncoding!==s||n.isInstancedMesh&&!1===h.instancing?c=!0:n.isInstancedMesh||!0!==h.instancing?n.isSkinnedMesh&&!1===h.skinning?c=!0:n.isSkinnedMesh||!0!==h.skinning?h.envMap!==a||i.fog&&h.fog!==r?c=!0:void 0===h.numClippingPlanes||h.numClippingPlanes===at.numPlanes&&h.numIntersection===at.numIntersection?h.vertexAlphas!==l&&(c=!0):c=!0:c=!0:c=!0:(c=!0,h.__version=i.version);let p=h.currentProgram;!0===c&&(p=Ct(i,e,n));let f=!1,g=!1,v=!1;const _=p.getUniforms(),T=h.uniforms;if(q.useProgram(p.program)&&(f=!0,g=!0,v=!0),i.id!==x&&(x=i.id,g=!0),f||b!==t){if(_.setValue(mt,"projectionMatrix",t.projectionMatrix),Y.logarithmicDepthBuffer&&_.setValue(mt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),b!==t&&(b=t,g=!0,v=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=_.map.cameraPosition;void 0!==e&&e.setValue(mt,z.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&_.setValue(mt,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||n.isSkinnedMesh)&&_.setValue(mt,"viewMatrix",t.matrixWorldInverse)}if(n.isSkinnedMesh){_.setOptional(mt,n,"bindMatrix"),_.setOptional(mt,n,"bindMatrixInverse");const t=n.skeleton;t&&(Y.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),_.setValue(mt,"boneTexture",t.boneTexture,K),_.setValue(mt,"boneTextureSize",t.boneTextureSize)):_.setOptional(mt,t,"boneMatrices"))}var E,S;return(g||h.receiveShadow!==n.receiveShadow)&&(h.receiveShadow=n.receiveShadow,_.setValue(mt,"receiveShadow",n.receiveShadow)),g&&(_.setValue(mt,"toneMappingExposure",m.toneMappingExposure),h.needsLights&&(S=v,(E=T).ambientLightColor.needsUpdate=S,E.lightProbe.needsUpdate=S,E.directionalLights.needsUpdate=S,E.directionalLightShadows.needsUpdate=S,E.pointLights.needsUpdate=S,E.pointLightShadows.needsUpdate=S,E.spotLights.needsUpdate=S,E.spotLightShadows.needsUpdate=S,E.rectAreaLights.needsUpdate=S,E.hemisphereLights.needsUpdate=S),r&&i.fog&&nt.refreshFogUniforms(T,r),nt.refreshMaterialUniforms(T,i,P,I,H),yn.upload(mt,h.uniformsList,T,K)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(yn.upload(mt,h.uniformsList,T,K),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&_.setValue(mt,"center",n.center),_.setValue(mt,"modelViewMatrix",n.modelViewMatrix),_.setValue(mt,"normalMatrix",n.normalMatrix),_.setValue(mt,"modelMatrix",n.matrixWorld),p}wt.setAnimationLoop((function(t){Tt&&Tt(t)})),"undefined"!=typeof window&&wt.setContext(window),this.setAnimationLoop=function(t){Tt=t,_t.setAnimationLoop(t),null===t?wt.stop():wt.start()},_t.addEventListener("sessionstart",Et),_t.addEventListener("sessionend",St),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===_t.enabled&&!0===_t.isPresenting&&(!0===_t.cameraAutoUpdate&&_t.updateCamera(e),e=_t.getCamera()),!0===t.isScene&&t.onBeforeRender(m,t,e,y),d=st.get(t,f.length),d.init(),f.push(d),j.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),U.setFromProjectionMatrix(j),G=this.localClippingEnabled,k=at.init(this.clippingPlanes,G,e),c=ot.get(t,p.length),c.init(),p.push(c),function t(e,i,n,r){if(!1===e.visible)return;if(e.layers.test(i.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(i);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||U.intersectsSprite(e)){r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j);const t=et.update(e),i=e.material;i.visible&&c.push(e,t,i,n,z.z,null)}}else if(e.isImmediateRenderObject)r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j),c.push(e,null,e.material,n,z.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==Z.render.frame&&(e.skeleton.update(),e.skeleton.frame=Z.render.frame),!e.frustumCulled||U.intersectsObject(e))){r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j);const t=et.update(e),i=e.material;if(Array.isArray(i)){const r=t.groups;for(let o=0,s=r.length;o<s;o++){const s=r[o],a=i[s.materialIndex];a&&a.visible&&c.push(e,t,a,n,z.z,s)}}else i.visible&&c.push(e,t,i,n,z.z,null)}const o=e.children;for(let e=0,s=o.length;e<s;e++)t(o[e],i,n,r)}(t,e,0,m.sortObjects),c.finish(),!0===m.sortObjects&&c.sort(O,N),!0===k&&at.beginShadows();const i=d.state.shadowsArray;lt.render(i,t,e),d.setupLights(),d.setupLightsView(e),!0===k&&at.endShadows(),!0===this.info.autoReset&&this.info.reset(),ht.render(c,t);const n=c.opaque,r=c.transmissive,o=c.transparent;n.length>0&&At(n,t,e),r.length>0&&function(t,e,i,n){if(null===H){const t=!0===s&&!0===Y.isWebGL2;H=new(t?w:S)(1024,1024,{generateMipmaps:!0,type:null!==pt.convert(1016)?1016:1009,minFilter:1008,magFilter:1003,wrapS:1001,wrapT:1001})}const r=m.getRenderTarget();m.setRenderTarget(H),m.clear();const o=m.toneMapping;m.toneMapping=0,At(t,i,n),m.toneMapping=o,K.updateMultisampleRenderTarget(H),K.updateRenderTargetMipmap(H),m.setRenderTarget(r),At(e,i,n)}(n,r,t,e),o.length>0&&At(o,t,e),null!==y&&(K.updateMultisampleRenderTarget(y),K.updateRenderTargetMipmap(y)),!0===t.isScene&&t.onAfterRender(m,t,e),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),ft.resetDefaultState(),x=-1,b=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),c=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return y},this.setRenderTarget=function(t,e=0,i=0){y=t,v=e,_=i,t&&void 0===J.get(t).__webglFramebuffer&&K.setupRenderTarget(t);let n=null,r=!1,o=!1;if(t){const i=t.texture;(i.isDataTexture3D||i.isDataTexture2DArray)&&(o=!0);const s=J.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=s[e],r=!0):n=t.isWebGLMultisampleRenderTarget?J.get(t).__webglMultisampledFramebuffer:s,T.copy(t.viewport),A.copy(t.scissor),C=t.scissorTest}else T.copy(L).multiplyScalar(P).floor(),A.copy(D).multiplyScalar(P).floor(),C=F;if(q.bindFramebuffer(36160,n)&&Y.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const i=t.texture;if(B.length!==i.length||36064!==B[0]){for(let t=0,e=i.length;t<e;t++)B[t]=36064+t;B.length=i.length,e=!0}}else 1===B.length&&36064===B[0]||(B[0]=36064,B.length=1,e=!0);else 1===B.length&&1029===B[0]||(B[0]=1029,B.length=1,e=!0);e&&(Y.isWebGL2?mt.drawBuffers(B):W.get("WEBGL_draw_buffers").drawBuffersWEBGL(B))}if(q.viewport(T),q.scissor(A),q.setScissorTest(C),r){const n=J.get(t.texture);mt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(o){const n=J.get(t.texture),r=e||0;mt.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}},this.readRenderTargetPixels=function(t,e,i,n,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=J.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){q.bindFramebuffer(36160,a);try{const s=t.texture,a=s.format,l=s.type;if(1023!==a&&pt.convert(a)!==mt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=1016===l&&(W.has("EXT_color_buffer_half_float")||Y.isWebGL2&&W.has("EXT_color_buffer_float"));if(!(1009===l||pt.convert(l)===mt.getParameter(35738)||1015===l&&(Y.isWebGL2||W.has("OES_texture_float")||W.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===mt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&mt.readPixels(e,i,n,r,pt.convert(a),pt.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==y?J.get(y).__webglFramebuffer:null;q.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),o=Math.floor(e.image.height*n);let s=pt.convert(e.format);Y.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),K.setTexture2D(e,0),mt.copyTexImage2D(3553,i,s,t.x,t.y,r,o,0),q.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,o=e.image.height,s=pt.convert(i.format),a=pt.convert(i.type);K.setTexture2D(i,0),mt.pixelStorei(37440,i.flipY),mt.pixelStorei(37441,i.premultiplyAlpha),mt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?mt.texSubImage2D(3553,n,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?mt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):mt.texSubImage2D(3553,n,t.x,t.y,s,a,e.image),0===n&&i.generateMipmaps&&mt.generateMipmap(3553),q.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,l=pt.convert(n.format),h=pt.convert(n.type);let u;if(n.isDataTexture3D)K.setTexture3D(n,0),u=32879;else{if(!n.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(n,0),u=35866}mt.pixelStorei(37440,n.flipY),mt.pixelStorei(37441,n.premultiplyAlpha),mt.pixelStorei(3317,n.unpackAlignment);const c=mt.getParameter(3314),d=mt.getParameter(32878),p=mt.getParameter(3316),f=mt.getParameter(3315),g=mt.getParameter(32877),v=i.isCompressedTexture?i.mipmaps[0]:i.image;mt.pixelStorei(3314,v.width),mt.pixelStorei(32878,v.height),mt.pixelStorei(3316,t.min.x),mt.pixelStorei(3315,t.min.y),mt.pixelStorei(32877,t.min.z),i.isDataTexture||i.isDataTexture3D?mt.texSubImage3D(u,r,e.x,e.y,e.z,o,s,a,l,h,v.data):i.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),mt.compressedTexSubImage3D(u,r,e.x,e.y,e.z,o,s,a,l,v.data)):mt.texSubImage3D(u,r,e.x,e.y,e.z,o,s,a,l,h,v),mt.pixelStorei(3314,c),mt.pixelStorei(32878,d),mt.pixelStorei(3316,p),mt.pixelStorei(3315,f),mt.pixelStorei(32877,g),0===r&&n.generateMipmaps&&mt.generateMipmap(u),q.unbindTexture()},this.initTexture=function(t){K.setTexture2D(t,0),q.unbindTexture()},this.resetState=function(){v=0,_=0,y=null,q.reset(),ft.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends ur{}).prototype.isWebGL1Renderer=!0;class cr{constructor(t,e=25e-5){this.name="",this.color=new Zt(t),this.density=e}clone(){return new cr(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}cr.prototype.isFogExp2=!0;class dr{constructor(t,e=1,i=1e3){this.name="",this.color=new Zt(t),this.near=e,this.far=i}clone(){return new dr(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}dr.prototype.isFog=!0;class pr extends Rt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}pr.prototype.isScene=!0;class fr{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=u()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=u()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=u()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}fr.prototype.isInterleavedBuffer=!0;const mr=new M;class gr{constructor(t,e,i,n=!1){this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)mr.x=this.getX(e),mr.y=this.getY(e),mr.z=this.getZ(e),mr.applyMatrix4(t),this.setXYZ(e,mr.x,mr.y,mr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)mr.x=this.getX(e),mr.y=this.getY(e),mr.z=this.getZ(e),mr.applyNormalMatrix(t),this.setXYZ(e,mr.x,mr.y,mr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)mr.x=this.getX(e),mr.y=this.getY(e),mr.z=this.getZ(e),mr.transformDirection(t),this.setXYZ(e,mr.x,mr.y,mr.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new $t(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new gr(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}gr.prototype.isInterleavedBufferAttribute=!0;class vr extends jt{constructor(t){super(),this.type="SpriteMaterial",this.color=new Zt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let _r;vr.prototype.isSpriteMaterial=!0;const yr=new M,xr=new M,br=new M,Tr=new g,Er=new g,Sr=new rt,wr=new M,Ar=new M,Mr=new M,Cr=new g,Rr=new g,Ir=new g;class Pr extends Rt{constructor(t){if(super(),this.type="Sprite",void 0===_r){_r=new de;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new fr(t,5);_r.setIndex([0,1,2,0,2,3]),_r.setAttribute("position",new gr(e,3,0,!1)),_r.setAttribute("uv",new gr(e,2,3,!1))}this.geometry=_r,this.material=void 0!==t?t:new vr,this.center=new g(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),xr.setFromMatrixScale(this.matrixWorld),Sr.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),br.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&xr.multiplyScalar(-br.z);const i=this.material.rotation;let n,r;0!==i&&(r=Math.cos(i),n=Math.sin(i));const o=this.center;Or(wr.set(-.5,-.5,0),br,o,xr,n,r),Or(Ar.set(.5,-.5,0),br,o,xr,n,r),Or(Mr.set(.5,.5,0),br,o,xr,n,r),Cr.set(0,0),Rr.set(1,0),Ir.set(1,1);let s=t.ray.intersectTriangle(wr,Ar,Mr,!1,yr);if(null===s&&(Or(Ar.set(-.5,.5,0),br,o,xr,n,r),Rr.set(0,1),s=t.ray.intersectTriangle(wr,Mr,Ar,!1,yr),null===s))return;const a=t.ray.origin.distanceTo(yr);a<t.near||a>t.far||e.push({distance:a,point:yr.clone(),uv:Gt.getUV(yr,wr,Ar,Mr,Cr,Rr,Ir,new g),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Or(t,e,i,n,r,o){Tr.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(Er.x=o*Tr.x-r*Tr.y,Er.y=r*Tr.x+o*Tr.y):Er.copy(Tr),t.copy(e),t.x+=Er.x,t.y+=Er.y,t.applyMatrix4(Sr)}Pr.prototype.isSprite=!0;const Nr=new M,Lr=new E,Dr=new E,Fr=new M,Br=new rt;class Ur extends Ie{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new rt,this.bindMatrixInverse=new rt}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new E,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;i<n;i++){t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.w=e.getW(i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const i=this.skeleton,n=this.geometry;Lr.fromBufferAttribute(n.attributes.skinIndex,t),Dr.fromBufferAttribute(n.attributes.skinWeight,t),Nr.fromBufferAttribute(n.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=Dr.getComponent(t);if(0!==n){const r=Lr.getComponent(t);Br.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),e.addScaledVector(Fr.copy(Nr).applyMatrix4(Br),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}Ur.prototype.isSkinnedMesh=!0;class kr extends Rt{constructor(){super(),this.type="Bone"}}kr.prototype.isBone=!0;class Gr extends b{constructor(t=null,e=1,i=1,n,r,o,s,a,l=1003,h=1003,u,c){super(null,o,s,a,l,h,n,r,u,c),this.image={data:t,width:e,height:i},this.magFilter=l,this.minFilter=h,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Gr.prototype.isDataTexture=!0;const Hr=new rt,jr=new rt,zr=[],Vr=new Ie;class Xr extends Ie{constructor(t,e,i){super(t,e),this.instanceMatrix=new $t(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const i=this.matrixWorld,n=this.count;if(Vr.geometry=this.geometry,Vr.material=this.material,void 0!==Vr.material)for(let r=0;r<n;r++){this.getMatrixAt(r,Hr),jr.multiplyMatrices(i,Hr),Vr.matrixWorld=jr,Vr.raycast(t,zr);for(let t=0,i=zr.length;t<i;t++){const i=zr[t];i.instanceId=r,i.object=this,e.push(i)}zr.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new $t(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Xr.prototype.isInstancedMesh=!0;class Wr extends jt{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Zt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}Wr.prototype.isLineBasicMaterial=!0;const Yr=new M,qr=new M,Zr=new rt,Jr=new nt,Kr=new Z;class Qr extends Rt{constructor(t=new de,e=new Wr){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)Yr.fromBufferAttribute(e,t-1),qr.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Yr.distanceTo(qr);t.setAttribute("lineDistance",new ne(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,o=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Kr.copy(i.boundingSphere),Kr.applyMatrix4(n),Kr.radius+=r,!1===t.ray.intersectsSphere(Kr))return;Zr.copy(n).invert(),Jr.copy(t.ray).applyMatrix4(Zr);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s,l=new M,h=new M,u=new M,c=new M,d=this.isLineSegments?2:1;if(i.isBufferGeometry){const n=i.index,r=i.attributes.position;if(null!==n){for(let i=Math.max(0,o.start),s=Math.min(n.count,o.start+o.count)-1;i<s;i+=d){const o=n.getX(i),s=n.getX(i+1);l.fromBufferAttribute(r,o),h.fromBufferAttribute(r,s);if(Jr.distanceSqToSegment(l,h,c,u)>a)continue;c.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(c);d<t.near||d>t.far||e.push({distance:d,point:u.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,o.start),n=Math.min(r.count,o.start+o.count)-1;i<n;i+=d){l.fromBufferAttribute(r,i),h.fromBufferAttribute(r,i+1);if(Jr.distanceSqToSegment(l,h,c,u)>a)continue;c.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(c);n<t.near||n>t.far||e.push({distance:n,point:u.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}else i.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Qr.prototype.isLine=!0;const $r=new M,to=new M;class eo extends Qr{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)$r.fromBufferAttribute(e,t),to.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+$r.distanceTo(to);t.setAttribute("lineDistance",new ne(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}eo.prototype.isLineSegments=!0;class io extends Qr{constructor(t,e){super(t,e),this.type="LineLoop"}}io.prototype.isLineLoop=!0;class no extends jt{constructor(t){super(),this.type="PointsMaterial",this.color=new Zt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this}}no.prototype.isPointsMaterial=!0;const ro=new rt,oo=new nt,so=new Z,ao=new M;class lo extends Rt{constructor(t=new de,e=new no){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold,o=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),so.copy(i.boundingSphere),so.applyMatrix4(n),so.radius+=r,!1===t.ray.intersectsSphere(so))return;ro.copy(n).invert(),oo.copy(t.ray).applyMatrix4(ro);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position;if(null!==r){for(let i=Math.max(0,o.start),l=Math.min(r.count,o.start+o.count);i<l;i++){const o=r.getX(i);ao.fromBufferAttribute(s,o),ho(ao,o,a,n,t,e,this)}}else{for(let i=Math.max(0,o.start),r=Math.min(s.count,o.start+o.count);i<r;i++)ao.fromBufferAttribute(s,i),ho(ao,i,a,n,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function ho(t,e,i,n,r,o,s){const a=oo.distanceSqToPoint(t);if(a<i){const i=new M;oo.closestPointToPoint(t,i),i.applyMatrix4(n);const l=r.ray.origin.distanceTo(i);if(l<r.near||l>r.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:i,index:e,face:null,object:s})}}lo.prototype.isPoints=!0;(class extends b{constructor(t,e,i,n,r,o,s,a,l){super(t,e,i,n,r,o,s,a,l),this.format=void 0!==s?s:1022,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;const h=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){h.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}).prototype.isVideoTexture=!0;class uo extends b{constructor(t,e,i,n,r,o,s,a,l,h,u,c){super(null,o,s,a,l,h,n,r,u,c),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}uo.prototype.isCompressedTexture=!0;(class extends b{constructor(t,e,i,n,r,o,s,a,l){super(t,e,i,n,r,o,s,a,l),this.needsUpdate=!0}}).prototype.isCanvasTexture=!0;(class extends b{constructor(t,e,i,n,r,o,s,a,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===h&&(i=1012),void 0===i&&1027===h&&(i=1020),super(null,n,r,o,s,a,h,i,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==a?a:1003,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isDepthTexture=!0;new M,new M,new M,new Gt;class co{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)i=this.getPoint(o/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let o;o=e||t*i[r-1];let s,a=0,l=r-1;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),s=i[n]-o,s<0)a=n+1;else{if(!(s>0)){l=n;break}l=n-1}if(n=l,i[n]===o)return n/(r-1);const h=i[n];return(n+(o-h)/(i[n+1]-h))/(r-1)}getTangent(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);const r=this.getPoint(i),o=this.getPoint(n),s=e||(r.isVector2?new g:new M);return s.copy(o).sub(r).normalize(),s}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new M,n=[],r=[],o=[],s=new M,a=new rt;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new M),n[e].normalize()}r[0]=new M,o[0]=new M;let l=Number.MAX_VALUE;const h=Math.abs(n[0].x),u=Math.abs(n[0].y),d=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),d<=l&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),o[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),o[e]=o[e-1].clone(),s.crossVectors(n[e-1],n[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(c(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(s,t))}o[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(c(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(a.makeRotationAxis(n[i],e*i)),o[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class po extends co{constructor(t=0,e=0,i=1,n=1,r=0,o=2*Math.PI,s=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a}getPoint(t,e){const i=e||new g,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=o?0:n),!0!==this.aClockwise||o||(r===n?r=-n:r-=n);const s=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=a-this.aX,n=l-this.aY;a=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}po.prototype.isEllipseCurve=!0;class fo extends po{constructor(t,e,i,n,r,o){super(t,e,i,i,n,r,o),this.type="ArcCurve"}}function mo(){let t=0,e=0,i=0,n=0;function r(r,o,s,a){t=r,e=s,i=-3*r+3*o-2*s-a,n=2*r-2*o+s+a}return{initCatmullRom:function(t,e,i,n,o){r(e,i,o*(i-t),o*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,o,s,a){let l=(e-t)/o-(i-t)/(o+s)+(i-e)/s,h=(i-e)/s-(n-e)/(s+a)+(n-i)/a;l*=s,h*=s,r(e,i,l,h)},calc:function(r){const o=r*r;return t+e*r+i*o+n*(o*r)}}}fo.prototype.isArcCurve=!0;const go=new M,vo=new mo,_o=new mo,yo=new mo;class xo extends co{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new M){const i=e,n=this.points,r=n.length,o=(r-(this.closed?0:1))*t;let s,a,l=Math.floor(o),h=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===h&&l===r-1&&(l=r-2,h=1),this.closed||l>0?s=n[(l-1)%r]:(go.subVectors(n[0],n[1]).add(n[0]),s=go);const u=n[l%r],c=n[(l+1)%r];if(this.closed||l+2<r?a=n[(l+2)%r]:(go.subVectors(n[r-1],n[r-2]).add(n[r-1]),a=go),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(c),t),n=Math.pow(c.distanceToSquared(a),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),vo.initNonuniformCatmullRom(s.x,u.x,c.x,a.x,e,i,n),_o.initNonuniformCatmullRom(s.y,u.y,c.y,a.y,e,i,n),yo.initNonuniformCatmullRom(s.z,u.z,c.z,a.z,e,i,n)}else"catmullrom"===this.curveType&&(vo.initCatmullRom(s.x,u.x,c.x,a.x,this.tension),_o.initCatmullRom(s.y,u.y,c.y,a.y,this.tension),yo.initCatmullRom(s.z,u.z,c.z,a.z,this.tension));return i.set(vo.calc(h),_o.calc(h),yo.calc(h)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new M).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function bo(t,e,i,n,r){const o=.5*(n-e),s=.5*(r-i),a=t*t;return(2*i-2*n+o+s)*(t*a)+(-3*i+3*n-2*o-s)*a+o*t+i}function To(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Eo(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}xo.prototype.isCatmullRomCurve3=!0;class So extends co{constructor(t=new g,e=new g,i=new g,n=new g){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new g){const i=e,n=this.v0,r=this.v1,o=this.v2,s=this.v3;return i.set(Eo(t,n.x,r.x,o.x,s.x),Eo(t,n.y,r.y,o.y,s.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}So.prototype.isCubicBezierCurve=!0;class wo extends co{constructor(t=new M,e=new M,i=new M,n=new M){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new M){const i=e,n=this.v0,r=this.v1,o=this.v2,s=this.v3;return i.set(Eo(t,n.x,r.x,o.x,s.x),Eo(t,n.y,r.y,o.y,s.y),Eo(t,n.z,r.z,o.z,s.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}wo.prototype.isCubicBezierCurve3=!0;class Ao extends co{constructor(t=new g,e=new g){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new g){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const i=e||new g;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Ao.prototype.isLineCurve=!0;class Mo extends co{constructor(t=new g,e=new g,i=new g){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new g){const i=e,n=this.v0,r=this.v1,o=this.v2;return i.set(To(t,n.x,r.x,o.x),To(t,n.y,r.y,o.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Mo.prototype.isQuadraticBezierCurve=!0;class Co extends co{constructor(t=new M,e=new M,i=new M){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new M){const i=e,n=this.v0,r=this.v1,o=this.v2;return i.set(To(t,n.x,r.x,o.x),To(t,n.y,r.y,o.y),To(t,n.z,r.z,o.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Co.prototype.isQuadraticBezierCurve3=!0;class Ro extends co{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new g){const i=e,n=this.points,r=(n.length-1)*t,o=Math.floor(r),s=r-o,a=n[0===o?o:o-1],l=n[o],h=n[o>n.length-2?n.length-1:o+1],u=n[o>n.length-3?n.length-1:o+2];return i.set(bo(s,a.x,l.x,h.x,u.x),bo(s,a.y,l.y,h.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new g).fromArray(i))}return this}}Ro.prototype.isSplineCurve=!0;var Io=Object.freeze({__proto__:null,ArcCurve:fo,CatmullRomCurve3:xo,CubicBezierCurve:So,CubicBezierCurve3:wo,EllipseCurve:po,LineCurve:Ao,LineCurve3:class extends co{constructor(t=new M,e=new M){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new M){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:Mo,QuadraticBezierCurve3:Co,SplineCurve:Ro});const Po=function(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let o=Oo(t,0,r,i,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,h,u,c,d,p;if(n&&(o=function(t,e,i,n){const r=[];let o,s,a,l,h;for(o=0,s=e.length;o<s;o++)a=e[o]*n,l=o<s-1?e[o+1]*n:t.length,h=Oo(t,a,l,n,!1),h===h.next&&(h.steiner=!0),r.push(zo(h));for(r.sort(ko),o=0;o<r.length;o++)Go(r[o],i),i=No(i,i.next);return i}(t,e,o,i)),t.length>80*i){a=h=t[0],l=u=t[1];for(let e=i;e<r;e+=i)c=t[e],d=t[e+1],c<a&&(a=c),d<l&&(l=d),c>h&&(h=c),d>u&&(u=d);p=Math.max(h-a,u-l),p=0!==p?1/p:0}return Lo(o,s,i,a,l,p),s};function Oo(t,e,i,n,r){let o,s;if(r===function(t,e,i,n){let r=0;for(let o=e,s=i-n;o<i;o+=n)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}(t,e,i,n)>0)for(o=e;o<i;o+=n)s=$o(o,t[o],t[o+1],s);else for(o=i-n;o>=e;o-=n)s=$o(o,t[o],t[o+1],s);return s&&Yo(s,s.next)&&(ts(s),s=s.next),s}function No(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Yo(n,n.next)&&0!==Wo(n.prev,n,n.next))n=n.next;else{if(ts(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function Lo(t,e,i,n,r,o,s){if(!t)return;!s&&o&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=jo(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,o,s,a,l,h=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,n=i,a=0,e=0;e<h&&(a++,n=n.nextZ,n);e++);for(l=h;a>0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,h*=2}while(s>1)}(r)}(t,n,r,o);let a,l,h=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,o?Fo(t,n,r,o):Do(t))e.push(a.i/i),e.push(t.i/i),e.push(l.i/i),ts(t),t=l.next,h=l.next;else if((t=l)===h){s?1===s?Lo(t=Bo(No(t),e,i),e,i,n,r,o,2):2===s&&Uo(t,e,i,n,r,o):Lo(No(t),e,i,n,r,o,1);break}}function Do(t){const e=t.prev,i=t,n=t.next;if(Wo(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(Vo(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&Wo(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Fo(t,e,i,n){const r=t.prev,o=t,s=t.next;if(Wo(r,o,s)>=0)return!1;const a=r.x<o.x?r.x<s.x?r.x:s.x:o.x<s.x?o.x:s.x,l=r.y<o.y?r.y<s.y?r.y:s.y:o.y<s.y?o.y:s.y,h=r.x>o.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,u=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,c=jo(a,l,e,i,n),d=jo(h,u,e,i,n);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Vo(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Wo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Vo(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Wo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&Vo(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Wo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Vo(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&Wo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Bo(t,e,i){let n=t;do{const r=n.prev,o=n.next.next;!Yo(r,o)&&qo(r,n,n.next,o)&&Ko(r,o)&&Ko(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),ts(n),ts(n.next),n=t=o),n=n.next}while(n!==t);return No(n)}function Uo(t,e,i,n,r,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&Xo(s,t)){let a=Qo(s,t);return s=No(s,s.next),a=No(a,a.next),Lo(s,e,i,n,r,o),void Lo(a,e,i,n,r,o)}t=t.next}s=s.next}while(s!==t)}function ko(t,e){return t.x-e.x}function Go(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let o,s=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>s){if(s=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}o=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!o)return null;if(n===s)return o;const a=o,l=o.x,h=o.y;let u,c=1/0;i=o;do{n>=i.x&&i.x>=l&&n!==i.x&&Vo(r<h?n:s,r,l,h,r<h?s:n,r,i.x,i.y)&&(u=Math.abs(r-i.y)/(n-i.x),Ko(i,t)&&(u<c||u===c&&(i.x>o.x||i.x===o.x&&Ho(o,i)))&&(o=i,c=u)),i=i.next}while(i!==a);return o}(t,e)){const i=Qo(e,t);No(e,e.next),No(i,i.next)}}function Ho(t,e){return Wo(t.prev,t,e.prev)<0&&Wo(e.next,t,t.next)<0}function jo(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function zo(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Vo(t,e,i,n,r,o,s,a){return(r-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(n-a)-(i-s)*(e-a)>=0&&(i-s)*(o-a)-(r-s)*(n-a)>=0}function Xo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&qo(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Ko(t,e)&&Ko(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Wo(t.prev,t,e.prev)||Wo(t,e.prev,e))||Yo(t,e)&&Wo(t.prev,t,t.next)>0&&Wo(e.prev,e,e.next)>0)}function Wo(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Yo(t,e){return t.x===e.x&&t.y===e.y}function qo(t,e,i,n){const r=Jo(Wo(t,e,i)),o=Jo(Wo(t,e,n)),s=Jo(Wo(i,n,t)),a=Jo(Wo(i,n,e));return r!==o&&s!==a||(!(0!==r||!Zo(t,i,e))||(!(0!==o||!Zo(t,n,e))||(!(0!==s||!Zo(i,t,n))||!(0!==a||!Zo(i,e,n)))))}function Zo(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Jo(t){return t>0?1:t<0?-1:0}function Ko(t,e){return Wo(t.prev,t,t.next)<0?Wo(t,e,t.next)>=0&&Wo(t,t.prev,e)>=0:Wo(t,e,t.prev)<0||Wo(t,t.next,e)<0}function Qo(t,e){const i=new es(t.i,t.x,t.y),n=new es(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function $o(t,e,i,n){const r=new es(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function ts(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function es(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class is{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i}static isClockWise(t){return is.area(t)<0}static triangulateShape(t,e){const i=[],n=[],r=[];ns(t),rs(i,t);let o=t.length;e.forEach(ns);for(let t=0;t<e.length;t++)n.push(o),o+=e[t].length,rs(i,e[t]);const s=Po(i,n);for(let t=0;t<s.length;t+=3)r.push(s.slice(t,t+3));return r}}function ns(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function rs(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class os extends de{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++){o(t[e])}function o(t){const o=[],s=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,h=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:6,c=void 0!==e.bevelSize?e.bevelSize:u-2,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:ss;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let v,_,y,x,b,T=!1;f&&(v=f.getSpacedPoints(a),T=!0,h=!1,_=f.computeFrenetFrames(a,!1),y=new M,x=new M,b=new M),h||(p=0,u=0,c=0,d=0);const E=t.extractPoints(s);let S=E.shape;const w=E.holes;if(!is.isClockWise(S)){S=S.reverse();for(let t=0,e=w.length;t<e;t++){const e=w[t];is.isClockWise(e)&&(w[t]=e.reverse())}}const A=is.triangulateShape(S,w),C=S;for(let t=0,e=w.length;t<e;t++){const e=w[t];S=S.concat(e)}function R(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}const I=S.length,P=A.length;function O(t,e,i){let n,r,o;const s=t.x-e.x,a=t.y-e.y,l=i.x-t.x,h=i.y-t.y,u=s*s+a*a,c=s*h-a*l;if(Math.abs(c)>Number.EPSILON){const c=Math.sqrt(u),d=Math.sqrt(l*l+h*h),p=e.x-a/c,f=e.y+s/c,m=((i.x-h/d-p)*h-(i.y+l/d-f)*l)/(s*h-a*l);n=p+s*m-t.x,r=f+a*m-t.y;const v=n*n+r*r;if(v<=2)return new g(n,r);o=Math.sqrt(v/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(h)&&(t=!0),t?(n=-a,r=s,o=Math.sqrt(u)):(n=s,r=a,o=Math.sqrt(u/2))}return new g(n/o,r/o)}const N=[];for(let t=0,e=C.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),N[t]=O(C[t],C[i],C[n]);const L=[];let D,F=N.concat();for(let t=0,e=w.length;t<e;t++){const e=w[t];D=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),D[t]=O(e[t],e[n],e[r]);L.push(D),F=F.concat(D)}for(let t=0;t<p;t++){const e=t/p,i=u*Math.cos(e*Math.PI/2),n=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=C.length;t<e;t++){const e=R(C[t],N[t],n);k(e.x,e.y,-i)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],D[t],n);k(r.x,r.y,-i)}}}const B=c+d;for(let t=0;t<I;t++){const e=h?R(S[t],F[t],B):S[t];T?(x.copy(_.normals[0]).multiplyScalar(e.x),y.copy(_.binormals[0]).multiplyScalar(e.y),b.copy(v[0]).add(x).add(y),k(b.x,b.y,b.z)):k(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<I;e++){const i=h?R(S[e],F[e],B):S[e];T?(x.copy(_.normals[t]).multiplyScalar(i.x),y.copy(_.binormals[t]).multiplyScalar(i.y),b.copy(v[t]).add(x).add(y),k(b.x,b.y,b.z)):k(i.x,i.y,l/a*t)}for(let t=p-1;t>=0;t--){const e=t/p,i=u*Math.cos(e*Math.PI/2),n=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=C.length;t<e;t++){const e=R(C[t],N[t],n);k(e.x,e.y,l+i)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=R(e[t],D[t],n);T?k(r.x,r.y+v[a-1].y,v[a-1].x+i):k(r.x,r.y,l+i)}}}function U(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=a+2*p;t<i;t++){const i=I*t,o=I*(t+1);H(e+n+i,e+r+i,e+r+o,e+n+o)}}}function k(t,e,i){o.push(t),o.push(e),o.push(i)}function G(t,e,r){j(t),j(e),j(r);const o=n.length/3,s=m.generateTopUV(i,n,o-3,o-2,o-1);z(s[0]),z(s[1]),z(s[2])}function H(t,e,r,o){j(t),j(e),j(o),j(e),j(r),j(o);const s=n.length/3,a=m.generateSideWallUV(i,n,s-6,s-3,s-2,s-1);z(a[0]),z(a[1]),z(a[3]),z(a[1]),z(a[2]),z(a[3])}function j(t){n.push(o[3*t+0]),n.push(o[3*t+1]),n.push(o[3*t+2])}function z(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(h){let t=0,e=I*t;for(let t=0;t<P;t++){const i=A[t];G(i[2]+e,i[1]+e,i[0]+e)}t=a+2*p,e=I*t;for(let t=0;t<P;t++){const i=A[t];G(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<P;t++){const e=A[t];G(e[2],e[1],e[0])}for(let t=0;t<P;t++){const e=A[t];G(e[0]+I*a,e[1]+I*a,e[2]+I*a)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;U(C,e),e+=C.length;for(let t=0,i=w.length;t<i;t++){const i=w[t];U(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new ne(n,3)),this.setAttribute("uv",new ne(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON());return i}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}const n=t.options.extrudePath;return void 0!==n&&(t.options.extrudePath=(new Io[n.type]).fromJSON(n)),new os(i,t.options)}}const ss={generateTopUV:function(t,e,i,n,r){const o=e[3*i],s=e[3*i+1],a=e[3*n],l=e[3*n+1],h=e[3*r],u=e[3*r+1];return[new g(o,s),new g(a,l),new g(h,u)]},generateSideWallUV:function(t,e,i,n,r,o){const s=e[3*i],a=e[3*i+1],l=e[3*i+2],h=e[3*n],u=e[3*n+1],c=e[3*n+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*o],v=e[3*o+1],_=e[3*o+2];return Math.abs(a-u)<Math.abs(s-h)?[new g(s,1-l),new g(h,1-c),new g(d,1-f),new g(m,1-_)]:[new g(a,1-l),new g(u,1-c),new g(p,1-f),new g(v,1-_)]}};class as extends de{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],r=[],o=[];let s=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(s,a,e),s+=a,a=0;function l(t){const s=n.length/3,l=t.extractPoints(e);let h=l.shape;const u=l.holes;!1===is.isClockWise(h)&&(h=h.reverse());for(let t=0,e=u.length;t<e;t++){const e=u[t];!0===is.isClockWise(e)&&(u[t]=e.reverse())}const c=is.triangulateShape(h,u);for(let t=0,e=u.length;t<e;t++){const e=u[t];h=h.concat(e)}for(let t=0,e=h.length;t<e;t++){const e=h[t];n.push(e.x,e.y,0),r.push(0,0,1),o.push(e.x,e.y)}for(let t=0,e=c.length;t<e;t++){const e=c[t],n=e[0]+s,r=e[1]+s,o=e[2]+s;i.push(n,r,o),a+=3}}this.setIndex(i),this.setAttribute("position",new ne(n,3)),this.setAttribute("normal",new ne(r,3)),this.setAttribute("uv",new ne(o,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}return new as(i,t.curveSegments)}}class ls extends jt{constructor(t){super(),this.type="ShadowMaterial",this.color=new Zt(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}ls.prototype.isShadowMaterial=!0;class hs extends Fe{constructor(t){super(t),this.type="RawShaderMaterial"}}hs.prototype.isRawShaderMaterial=!0;class us extends jt{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Zt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(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.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this}}us.prototype.isMeshStandardMaterial=!0;class cs extends us{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new g(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=c(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Zt(1,1,1),this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new Zt).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this}}cs.prototype.isMeshPhysicalMaterial=!0;class ds extends jt{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Zt(16777215),this.specular=new Zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}ds.prototype.isMeshPhongMaterial=!0;class ps extends jt{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}ps.prototype.isMeshToonMaterial=!0;class fs extends jt{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}fs.prototype.isMeshNormalMaterial=!0;class ms extends jt{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}ms.prototype.isMeshLambertMaterial=!0;class gs extends jt{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new g(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}gs.prototype.isMeshMatcapMaterial=!0;class vs extends Wr{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}vs.prototype.isLineDashedMaterial=!0;const _s={arraySlice:function(t,e,i){return _s.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){const n=t.length,r=new t.constructor(n);for(let o=0,s=0;s!==n;++o){const n=i[o]*e;for(let i=0;i!==e;++i)r[s++]=t[n+i]}return r},flattenJSON:function(t,e,i,n){let r=1,o=t[0];for(;void 0!==o&&void 0===o[n];)o=t[r++];if(void 0===o)return;let s=o[n];if(void 0!==s)if(Array.isArray(s))do{s=o[n],void 0!==s&&(e.push(o.time),i.push.apply(i,s)),o=t[r++]}while(void 0!==o);else if(void 0!==s.toArray)do{s=o[n],void 0!==s&&(e.push(o.time),s.toArray(i,i.length)),o=t[r++]}while(void 0!==o);else do{s=o[n],void 0!==s&&(e.push(o.time),i.push(s)),o=t[r++]}while(void 0!==o)},subclip:function(t,e,i,n,r=30){const o=t.clone();o.name=e;const s=[];for(let t=0;t<o.tracks.length;++t){const e=o.tracks[t],a=e.getValueSize(),l=[],h=[];for(let t=0;t<e.times.length;++t){const o=e.times[t]*r;if(!(o<i||o>=n)){l.push(e.times[t]);for(let i=0;i<a;++i)h.push(e.values[t*a+i])}}0!==l.length&&(e.times=_s.convertArray(l,e.times.constructor),e.values=_s.convertArray(h,e.values.constructor),s.push(e))}o.tracks=s;let a=1/0;for(let t=0;t<o.tracks.length;++t)a>o.tracks[t].times[0]&&(a=o.tracks[t].times[0]);for(let t=0;t<o.tracks.length;++t)o.tracks[t].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,i=t,n=30){n<=0&&(n=30);const r=i.tracks.length,o=e/n;for(let e=0;e<r;++e){const n=i.tracks[e],r=n.ValueTypeName;if("bool"===r||"string"===r)continue;const s=t.tracks.find((function(t){return t.name===n.name&&t.ValueTypeName===r}));if(void 0===s)continue;let a=0;const l=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let h=0;const u=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);const c=n.times.length-1;let d;if(o<=n.times[0]){const t=a,e=l-a;d=_s.arraySlice(n.values,t,e)}else if(o>=n.times[c]){const t=c*l+a,e=t+l-a;d=_s.arraySlice(n.values,t,e)}else{const t=n.createInterpolant(),e=a,i=l-a;t.evaluate(o),d=_s.arraySlice(t.resultBuffer,e,i)}if("quaternion"===r){(new A).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let t=0;t<p;++t){const e=t*u+h;if("quaternion"===r)A.multiplyQuaternionsFlat(s.values,e,d,0,s.values,e);else{const t=u-2*h;for(let i=0;i<t;++i)s.values[e+i]-=d[i]}}}return t.blendMode=2501,t}};class ys{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let o;i:{n:if(!(t<n)){for(let o=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===o)break;if(r=n,n=e[++i],t<n)break e}o=e.length;break i}if(t>=r)break t;{const s=e[1];t<s&&(i=2,r=s);for(let o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,r=e[--i-1],t>=r)break e}o=i,i=0}}for(;i<o;){const n=i+o>>>1;t<e[n]?o=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}ys.prototype.beforeStart_=ys.prototype.copySampleValue_,ys.prototype.afterEnd_=ys.prototype.copySampleValue_;class xs extends ys{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){const n=this.parameterPositions;let r=t-2,o=t+1,s=n[r],a=n[o];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=t,s=2*e-i;break;case 2402:r=n.length-2,s=e+n[r]-n[r+1];break;default:r=t,s=i}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:o=t,a=2*i-e;break;case 2402:o=1,a=i+n[1]-n[0];break;default:o=t-1,a=e}const l=.5*(i-e),h=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(a-i),this._offsetPrev=r*h,this._offsetNext=o*h}interpolate_(t,e,i,n){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,h=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,v=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let t=0;t!==s;++t)r[t]=g*o[h+t]+v*o[l+t]+_*o[a+t]+y*o[u+t];return r}}class bs extends ys{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,h=(i-e)/(n-e),u=1-h;for(let t=0;t!==s;++t)r[t]=o[l+t]*u+o[a+t]*h;return r}}class Ts extends ys{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class Es{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=_s.convertArray(e,this.TimeBufferType),this.values=_s.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:_s.convertArray(t.times,Array),values:_s.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Ts(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new bs(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new xs(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,o=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==o&&i[o]>e;)--o;if(++o,0!==r||o!==n){r>=o&&(o=Math.max(o,1),r=o-1);const t=this.getValueSize();this.times=_s.arraySlice(i,r,o),this.values=_s.arraySlice(this.values,r*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==o&&o>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,o),t=!1;break}o=n}if(void 0!==n&&_s.isTypedArray(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=_s.arraySlice(this.times),e=_s.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=t.length-1;let o=1;for(let s=1;s<r;++s){let r=!1;const a=t[s];if(a!==t[s+1]&&(1!==s||a!==t[0]))if(n)r=!0;else{const t=s*i,n=t-i,o=t+i;for(let s=0;s!==i;++s){const i=e[t+s];if(i!==e[n+s]||i!==e[o+s]){r=!0;break}}}if(r){if(s!==o){t[o]=t[s];const n=s*i,r=o*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++o}}if(r>0){t[o]=t[r];for(let t=r*i,n=o*i,s=0;s!==i;++s)e[n+s]=e[t+s];++o}return o!==t.length?(this.times=_s.arraySlice(t,0,o),this.values=_s.arraySlice(e,0,o*i)):(this.times=t,this.values=e),this}clone(){const t=_s.arraySlice(this.times,0),e=_s.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}Es.prototype.TimeBufferType=Float32Array,Es.prototype.ValueBufferType=Float32Array,Es.prototype.DefaultInterpolation=2301;class Ss extends Es{}Ss.prototype.ValueTypeName="bool",Ss.prototype.ValueBufferType=Array,Ss.prototype.DefaultInterpolation=2300,Ss.prototype.InterpolantFactoryMethodLinear=void 0,Ss.prototype.InterpolantFactoryMethodSmooth=void 0;class ws extends Es{}ws.prototype.ValueTypeName="color";class As extends Es{}As.prototype.ValueTypeName="number";class Ms extends ys{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(i-e)/(n-e);let l=t*s;for(let t=l+s;l!==t;l+=4)A.slerpFlat(r,0,o,l-s,o,l,a);return r}}class Cs extends Es{InterpolantFactoryMethodLinear(t){return new Ms(this.times,this.values,this.getValueSize(),t)}}Cs.prototype.ValueTypeName="quaternion",Cs.prototype.DefaultInterpolation=2301,Cs.prototype.InterpolantFactoryMethodSmooth=void 0;class Rs extends Es{}Rs.prototype.ValueTypeName="string",Rs.prototype.ValueBufferType=Array,Rs.prototype.DefaultInterpolation=2300,Rs.prototype.InterpolantFactoryMethodLinear=void 0,Rs.prototype.InterpolantFactoryMethodSmooth=void 0;class Is extends Es{}Is.prototype.ValueTypeName="vector";class Ps{constructor(t,e=-1,i,n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=u(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(Os(i[t]).scale(n));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(Es.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const r=e.length,o=[];for(let t=0;t<r;t++){let s=[],a=[];s.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=_s.getKeyframeOrder(s);s=_s.sortedArray(s,1,l),a=_s.sortedArray(a,1,l),n||0!==s[0]||(s.push(r),a.push(a[0])),o.push(new As(".morphTargetInfluences["+e[t].name+"]",s,a).scale(1/i))}return new this(t,-1,o)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],o=i.name.match(r);if(o&&o.length>1){const t=o[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const o=[];for(const t in n)o.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const o=[],s=[];_s.flattenJSON(i,o,s,n),0!==o.length&&r.push(new t(e,o,s))}},n=[],r=t.name||"default",o=t.fps||30,s=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],o=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),o.push(n.morphTarget===i?1:0)}n.push(new As(".morphTargetInfluence["+i+"]",t,o))}a=t.length*(o||1)}else{const o=".bones["+e[t].name+"]";i(Is,o+".position",r,"pos",n),i(Cs,o+".quaternion",r,"rot",n),i(Is,o+".scale",r,"scl",n)}}if(0===n.length)return null;return new this(r,a,n,s)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Os(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return As;case"vector":case"vector2":case"vector3":case"vector4":return Is;case"color":return ws;case"quaternion":return Cs;case"bool":case"boolean":return Ss;case"string":return Rs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];_s.flattenJSON(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Ns={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Ls{constructor(t,e,i){const n=this;let r=!1,o=0,s=0,a=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){s++,!1===r&&void 0!==n.onStart&&n.onStart(t,o,s),r=!0},this.itemEnd=function(t){o++,void 0!==n.onProgress&&n.onProgress(t,o,s),o===s&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Ds=new Ls;class Fs{constructor(t){this.manager=void 0!==t?t:Ds,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const Bs={};class Us extends Fs{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=Ns.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;if(void 0!==Bs[t])return void Bs[t].push({onLoad:e,onProgress:i,onError:n});const s=t.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(s){const i=s[1],o=!!s[2];let a=s[3];a=decodeURIComponent(a),o&&(a=atob(a));try{let n;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const t=new Uint8Array(a.length);for(let e=0;e<a.length;e++)t[e]=a.charCodeAt(e);n="blob"===o?new Blob([t.buffer],{type:i}):t.buffer;break;case"document":const e=new DOMParser;n=e.parseFromString(a,i);break;case"json":n=JSON.parse(a);break;default:n=a}setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{Bs[t]=[],Bs[t].push({onLoad:e,onProgress:i,onError:n}),a=new XMLHttpRequest,a.open("GET",t,!0),a.addEventListener("load",(function(e){const i=this.response,n=Bs[t];if(delete Bs[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ns.add(t,i);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onLoad&&e.onLoad(i)}r.manager.itemEnd(t)}else{for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),a.addEventListener("progress",(function(e){const i=Bs[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onProgress&&n.onProgress(e)}}),!1),a.addEventListener("error",(function(e){const i=Bs[t];delete Bs[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),a.addEventListener("abort",(function(e){const i=Bs[t];delete Bs[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)a.setRequestHeader(t,this.requestHeader[t]);a.send(null)}return r.manager.itemStart(t),a}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class ks extends Fs{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=Ns.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),Ns.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return s.addEventListener("load",a,!1),s.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class Gs extends Fs{constructor(t){super(t)}load(t,e,i,n){const r=new Ge,o=new ks(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(i){o.load(t[i],(function(t){r.images[i]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(let e=0;e<t.length;++e)a(e);return r}}class Hs extends Fs{constructor(t){super(t)}load(t,e,i,n){const r=new b,o=new ks(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(i){r.image=i;const n=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=n?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}class js extends co{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ao(e,t))}getPoint(t){const e=t*this.getLength(),i=this.getCurveLengths();let n=0;for(;n<i.length;){if(i[n]>=e){const t=i[n]-e,r=this.curves[n],o=r.getLength(),s=0===o?0:1-t/o;return r.getPointAt(s)}n++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const o=r[n],s=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,a=o.getPoints(s);for(let t=0;t<a.length;t++){const n=a[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new Io[i.type]).fromJSON(i))}return this}}class zs extends js{constructor(t){super(),this.type="Path",this.currentPoint=new g,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new Ao(this.currentPoint.clone(),new g(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const r=new Mo(this.currentPoint.clone(),new g(t,e),new g(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,o){const s=new So(this.currentPoint.clone(),new g(t,e),new g(i,n),new g(r,o));return this.curves.push(s),this.currentPoint.set(r,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new Ro(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+s,e+a,i,n,r,o),this}absarc(t,e,i,n,r,o){return this.absellipse(t,e,i,i,n,r,o),this}ellipse(t,e,i,n,r,o,s,a){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+l,e+h,i,n,r,o,s,a),this}absellipse(t,e,i,n,r,o,s,a){const l=new po(t,e,i,n,r,o,s,a);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Vs extends zs{constructor(t){super(t),this.uuid=u(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new zs).fromJSON(i))}return this}}class Xs extends Rt{constructor(t,e=1){super(),this.type="Light",this.color=new Zt(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}Xs.prototype.isLight=!0;class Ws extends Xs{constructor(t,e,i){super(t,i),this.type="HemisphereLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.groundColor=new Zt(e)}copy(t){return Xs.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}Ws.prototype.isHemisphereLight=!0;const Ys=new rt,qs=new M,Zs=new M;class Js{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new g(512,512),this.map=null,this.mapPass=null,this.matrix=new rt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qe,this._frameExtents=new g(1,1),this._viewportCount=1,this._viewports=[new E(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;qs.setFromMatrixPosition(t.matrixWorld),e.position.copy(qs),Zs.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Zs),e.updateMatrixWorld(),Ys.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ys),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e.projectionMatrix),i.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Ks extends Js{constructor(){super(new Ue(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,i=2*h*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}Ks.prototype.isSpotLightShadow=!0;class Qs extends Xs{constructor(t,e,i=0,n=Math.PI/3,r=0,o=1){super(t,e),this.type="SpotLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.target=new Rt,this.distance=i,this.angle=n,this.penumbra=r,this.decay=o,this.shadow=new Ks}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Qs.prototype.isSpotLight=!0;const $s=new rt,ta=new M,ea=new M;class ia extends Js{constructor(){super(new Ue(90,1,.5,500)),this._frameExtents=new g(4,2),this._viewportCount=6,this._viewports=[new E(2,1,1,1),new E(0,1,1,1),new E(3,1,1,1),new E(1,1,1,1),new E(3,0,1,1),new E(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,n=this.matrix,r=t.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),ta.setFromMatrixPosition(t.matrixWorld),i.position.copy(ta),ea.copy(i.position),ea.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(ea),i.updateMatrixWorld(),n.makeTranslation(-ta.x,-ta.y,-ta.z),$s.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix($s)}}ia.prototype.isPointLightShadow=!0;class na extends Xs{constructor(t,e,i=0,n=1){super(t,e),this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new ia}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}na.prototype.isPointLight=!0;class ra extends Be{constructor(t=-1,e=1,i=1,n=-1,r=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,o){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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,o=i+t,s=n+e,a=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,o=r+t*this.view.width,s-=e*this.view.offsetY,a=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}ra.prototype.isOrthographicCamera=!0;class oa extends Js{constructor(){super(new ra(-5,5,5,-5,.5,500))}}oa.prototype.isDirectionalLightShadow=!0;class sa extends Xs{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Rt.DefaultUp),this.updateMatrix(),this.target=new Rt,this.shadow=new oa}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}sa.prototype.isDirectionalLight=!0;class aa extends Xs{constructor(t,e){super(t,e),this.type="AmbientLight"}}aa.prototype.isAmbientLight=!0;class la extends Xs{constructor(t,e,i=10,n=10){super(t,e),this.type="RectAreaLight",this.width=i,this.height=n}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}la.prototype.isRectAreaLight=!0;class ha{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new M)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,n=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*n),e.addScaledVector(o[2],.488603*r),e.addScaledVector(o[3],.488603*i),e.addScaledVector(o[4],i*n*1.092548),e.addScaledVector(o[5],n*r*1.092548),e.addScaledVector(o[6],.315392*(3*r*r-1)),e.addScaledVector(o[7],i*r*1.092548),e.addScaledVector(o[8],.546274*(i*i-n*n)),e}getIrradianceAt(t,e){const i=t.x,n=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*n),e.addScaledVector(o[2],1.023328*r),e.addScaledVector(o[3],1.023328*i),e.addScaledVector(o[4],.858086*i*n),e.addScaledVector(o[5],.858086*n*r),e.addScaledVector(o[6],.743125*r*r-.247708),e.addScaledVector(o[7],.858086*i*r),e.addScaledVector(o[8],.429043*(i*i-n*n)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this}toArray(t=[],e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}static getBasisAt(t,e){const i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}ha.prototype.isSphericalHarmonics3=!0;class ua extends Xs{constructor(t=new ha,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}ua.prototype.isLightProbe=!0;class ca{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}}class da extends de{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}da.prototype.isInstancedBufferGeometry=!0;class pa extends $t{constructor(t,e,i,n=1){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,i),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}pa.prototype.isInstancedBufferAttribute=!0;(class extends Fs{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=Ns.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(t,s).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(i){Ns.add(t,i),e&&e(i),r.manager.itemEnd(t)})).catch((function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}).prototype.isImageBitmapLoader=!0;class fa{constructor(){this.type="ShapePath",this.color=new Zt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new zs,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,o){return this.currentPath.bezierCurveTo(t,e,i,n,r,o),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function i(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],r=new Vs;r.curves=n.curves,e.push(r)}return e}function n(t,e){const i=e.length;let n=!1;for(let r=i-1,o=0;o<i;r=o++){let i=e[r],s=e[o],a=s.x-i.x,l=s.y-i.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(i=e[o],a=-a,s=e[r],l=-l),t.y<i.y||t.y>s.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=l*(t.x-i.x)-a*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(s.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=s.x)return!0}}return n}const r=is.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return i(o);let s,a,l;const h=[];if(1===o.length)return a=o[0],l=new Vs,l.curves=a.curves,h.push(l),h;let u=!r(o[0].getPoints());u=t?!u:u;const c=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,i=o.length;e<i;e++)a=o[e],p=a.getPoints(),s=r(p),s=t?!s:s,s?(!u&&d[g]&&g++,d[g]={s:new Vs,p:p},d[g].s.curves=a.curves,u&&g++,m[g]=[]):m[g].push({h:a,p:p[0]});if(!d[0])return i(o);if(d.length>1){let t=!1;const e=[];for(let t=0,e=d.length;t<e;t++)c[t]=[];for(let i=0,r=d.length;i<r;i++){const r=m[i];for(let o=0;o<r.length;o++){const s=r[o];let a=!0;for(let r=0;r<d.length;r++)n(s.p,d[r].p)&&(i!==r&&e.push({froms:i,tos:r,hole:o}),a?(a=!1,c[r].push(s)):t=!0);a&&c[i].push(s)}}e.length>0&&(t||(m=c))}for(let t=0,e=d.length;t<e;t++){l=d[t].s,h.push(l),f=m[t];for(let t=0,e=f.length;t<e;t++)l.holes.push(f[t].h)}return h}}class ma{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),r=e/i.resolution,o=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,s=[];let a=0,l=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)a=0,l-=o;else{const t=ga(e,r,a,l,i);a+=t.offsetX,s.push(t.path)}}return s}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)Array.prototype.push.apply(i,n[t].toShapes());return i}}function ga(t,e,i,n,r){const o=r.glyphs[t]||r.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const s=new fa;let a,l,h,u,c,d,p,f;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let r=0,o=t.length;r<o;){switch(t[r++]){case"m":a=t[r++]*e+i,l=t[r++]*e+n,s.moveTo(a,l);break;case"l":a=t[r++]*e+i,l=t[r++]*e+n,s.lineTo(a,l);break;case"q":h=t[r++]*e+i,u=t[r++]*e+n,c=t[r++]*e+i,d=t[r++]*e+n,s.quadraticCurveTo(c,d,h,u);break;case"b":h=t[r++]*e+i,u=t[r++]*e+n,c=t[r++]*e+i,d=t[r++]*e+n,p=t[r++]*e+i,f=t[r++]*e+n,s.bezierCurveTo(c,d,p,f,h,u)}}}return{offsetX:o.ha*e,path:s}}ma.prototype.isFont=!0;let va;const _a=function(){return void 0===va&&(va=new(window.AudioContext||window.webkitAudioContext)),va};class ya extends Fs{constructor(t){super(t)}load(t,e,i,n){const r=this,o=new Us(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(i){try{const t=i.slice(0);_a().decodeAudioData(t,(function(t){e(t)}))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)}}(class extends ua{constructor(t,e,i=1){super(void 0,i);const n=(new Zt).set(t),r=(new Zt).set(e),o=new M(n.r,n.g,n.b),s=new M(r.r,r.g,r.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)}}).prototype.isHemisphereLightProbe=!0;(class extends ua{constructor(t,e=1){super(void 0,e);const i=(new Zt).set(t);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}).prototype.isAmbientLightProbe=!0;class xa extends Rt{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}class ba{constructor(t,e,i){let n,r,o;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,r=t*n+n;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==n;++t)i[r+t]=i[t];o=e}else{o+=e;const t=e/o;this._mixBufferRegion(i,r,0,t,n)}this.cumulativeWeight=o}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-r,e)}o>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){s.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,r=n;t!==r;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,r){if(n>=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){A.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){const o=this._workIndex*r;A.multiplyQuaternionsFlat(t,o,t,e,t,i),A.slerpFlat(t,e,t,e,t,o,n)}_lerp(t,e,i,n,r){const o=1-n;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*o+t[i+s]*n}}_lerpAdditive(t,e,i,n,r){for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]+t[i+o]*n}}}const Ta=new RegExp("[\\[\\]\\.:\\/]","g"),Ea="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Sa=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),wa=/(WCOD+)?/.source.replace("WCOD",Ea),Aa=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ma=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Ca=new RegExp("^"+Sa+wa+Aa+Ma+"$"),Ra=["material","materials","bones"];class Ia{constructor(t,e,i){this.path=e,this.parsedPath=i||Ia.parseTrackName(e),this.node=Ia.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new Ia.Composite(t,e,i):new Ia(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ta,"")}static parseTrackName(t){const e=Ca.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Ra.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const o=i(r.children);if(o)return o}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.node[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=Ia.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const o=t[n];if(void 0===o){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=n;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ia.Composite=class{constructor(t,e,i){const n=i||Ia.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},Ia.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ia.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ia.prototype.GetterByBindingType=[Ia.prototype._getValue_direct,Ia.prototype._getValue_array,Ia.prototype._getValue_arrayElement,Ia.prototype._getValue_toArray],Ia.prototype.SetterByBindingTypeAndVersioning=[[Ia.prototype._setValue_direct,Ia.prototype._setValue_direct_setNeedsUpdate,Ia.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_array,Ia.prototype._setValue_array_setNeedsUpdate,Ia.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_arrayElement,Ia.prototype._setValue_arrayElement_setNeedsUpdate,Ia.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ia.prototype._setValue_fromArray,Ia.prototype._setValue_fromArray_setNeedsUpdate,Ia.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];(class{constructor(){this.uuid=u(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,n=this._parsedPaths,r=this._bindings,o=r.length;let s=void 0,a=t.length,l=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const u=arguments[h],c=u.uuid;let d=e[c];if(void 0===d){d=a++,e[c]=d,t.push(u);for(let t=0,e=o;t!==e;++t)r[t].push(new Ia(u,i[t],n[t]))}else if(d<l){s=t[d];const a=--l,h=t[a];e[h.uuid]=d,t[d]=h,e[c]=a,t[a]=u;for(let t=0,e=o;t!==e;++t){const e=r[t],o=e[a];let s=e[d];e[d]=o,void 0===s&&(s=new Ia(u,i[t],n[t])),e[a]=s}}else t[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o],a=s.uuid,l=e[a];if(void 0!==l&&l>=r){const o=r++,h=t[o];e[h.uuid]=l,t[l]=h,e[a]=o,t[o]=s;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[o],r=e[l];e[l]=n,e[o]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_,o=t.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<r){const s=--r,a=t[s],h=--o,u=t[h];e[a.uuid]=l,t[l]=a,e[u.uuid]=s,t[s]=u,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[s],r=e[h];e[l]=n,e[s]=r,e.pop()}}else{const r=--o,s=t[r];r>0&&(e[s.uuid]=l),t[l]=s,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const r=this._bindings;if(void 0!==n)return r[n];const o=this._paths,s=this._parsedPaths,a=this._objects,l=a.length,h=this.nCachedObjects_,u=new Array(l);n=r.length,i[t]=n,o.push(t),s.push(e),r.push(u);for(let i=h,n=a.length;i!==n;++i){const n=a[i];u[i]=new Ia(n,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,r=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];e[t[s]]=i,o[i]=a,o.pop(),r[i]=r[s],r.pop(),n[i]=n[s],n.pop()}}}).prototype.isAnimationObjectGroup=!0;class Pa{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const r=e.tracks,o=r.length,s=new Array(o),a={endingStart:2400,endingEnd:2400};for(let t=0;t!==o;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){const i=this._clip.duration,n=t._clip.duration,r=n/i,o=i/n;t.warp(1,r,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,r=n.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=n._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=r,a[1]=r+i,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const n=(t-r)*i;if(n<0||0===i)return;this._startTime=null,e=i*n}e*=this._updateTimeScale(t);const o=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case 2501:for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(o),e[i].accumulateAdditive(s);break;case 2500:default:for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(o),e[i].accumulate(n,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,r=this._loopCount;const o=2202===i;if(0===t)return-1===r?n:o&&1==(1&r)?e-n:n;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(o&&1==(1&r))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(t,e,i){const n=this._mixer,r=n.time;let o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=r,a[0]=e,s[1]=r+t,a[1]=i,this}}(class extends s{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,s=t._interpolants,a=i.uuid,l=this._bindingsByRootAndName;let h=l[a];void 0===h&&(h={},l[a]=h);for(let t=0;t!==r;++t){const r=n[t],l=r.name;let u=h[l];if(void 0!==u)o[t]=u;else{if(u=o[t],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,a,l));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;u=new ba(Ia.create(i,l,n),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,a,l),o[t]=u}s[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,r=this._actionsByClip;let o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),o.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,o=this._actionsByClip,s=o[r],a=s.knownActions,l=a[a.length-1],h=t._byClipCacheIndex;l._byClipCacheIndex=h,a[h]=l,a.pop(),t._byClipCacheIndex=null;delete s.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete o[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,r=this._bindings;let o=n[e];void 0===o&&(o={},n[e]=o),o[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,o=this._bindingsByRootAndName,s=o[n],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete s[r],0===Object.keys(s).length&&delete o[n]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new bs(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){const n=e||this._root,r=n.uuid;let o="string"==typeof t?Ps.findByName(n,t):t;const s=null!==o?o.uuid:t,a=this._actionsByClip[s];let l=null;if(void 0===i&&(i=null!==o?o.blendMode:2500),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;l=a.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const h=new Pa(this,o,e,i);return this._bindAction(h,l),this._addInactiveAction(h,s,r),h}existingAction(t,e){const i=e||this._root,n=i.uuid,r="string"==typeof t?Ps.findByName(i,t):t,o=r?r.uuid:t,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[n]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let s=0;s!==i;++s){e[s]._update(n,t,r,o)}const s=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)s[t].apply(o);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){const t=r.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const r=n._cacheIndex,o=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,o._cacheIndex=r,e[r]=o,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}).prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Oa{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new Oa(void 0===this.value.clone?this.value:this.value.clone())}}(class extends fr{constructor(t,e,i=1){super(t,e),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}).prototype.isInstancedInterleavedBuffer=!0;(class{constructor(t,e,i,n,r){this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=n,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}).prototype.isGLBufferAttribute=!0;const Na=new g;class La{constructor(t=new g(1/0,1/0),e=new g(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Na.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Na.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}La.prototype.isBox2=!0;const Da=new M,Fa=new M;(class extends Rt{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}).prototype.isImmediateRenderObject=!0;const Ba=new M,Ua=new rt,ka=new rt;const Ga=new Float32Array(1);new Int32Array(Ga.buffer);Math.pow(2,8);const Ha=[.125,.215,.35,.446,.526,.582],ja=5+Ha.length,za=new Jt({side:1,depthWrite:!1,depthTest:!1}),{_lodPlanes:Va,_sizeLods:Xa,_sigmas:Wa}=(new Ie(new Oe,za),Ya());Math.sqrt(5);function Ya(){const t=[],e=[],i=[];let n=8;for(let r=0;r<ja;r++){const o=Math.pow(2,n);e.push(o);let s=1/o;r>4?s=Ha[r-8+4-1]:0==r&&(s=0),i.push(s);const a=1/(o-1),l=-a/2,h=1+a/2,u=[l,l,h,l,h,h,l,l,h,h,l,h],c=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*c),v=new Float32Array(f*d*c),_=new Float32Array(m*d*c);for(let t=0;t<c;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];g.set(n,p*d*t),v.set(u,f*d*t);const r=[t,t,t,t,t,t];_.set(r,m*d*t)}const y=new de;y.setAttribute("position",new $t(g,p)),y.setAttribute("uv",new $t(v,f)),y.setAttribute("faceIndex",new $t(_,m)),t.push(y),n>4&&n--}return{_lodPlanes:t,_sizeLods:e,_sigmas:i}}co.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(co.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},zs.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},class extends eo{constructor(t=10,e=10,i=4473924,n=8947848){i=new Zt(i),n=new Zt(n);const r=e/2,o=t/e,s=t/2,a=[],l=[];for(let t=0,h=0,u=-s;t<=e;t++,u+=o){a.push(-s,0,u,s,0,u),a.push(u,0,-s,u,0,s);const e=t===r?i:n;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const h=new de;h.setAttribute("position",new ne(a,3)),h.setAttribute("color",new ne(l,3));super(h,new Wr({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},class extends eo{constructor(t){const e=function t(e){const i=[];e&&e.isBone&&i.push(e);for(let n=0;n<e.children.length;n++)i.push.apply(i,t(e.children[n]));return i}(t),i=new de,n=[],r=[],o=new Zt(0,0,1),s=new Zt(0,1,0);for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(o.r,o.g,o.b),r.push(s.r,s.g,s.b))}i.setAttribute("position",new ne(n,3)),i.setAttribute("color",new ne(r,3));super(i,new Wr({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,n=i.getAttribute("position");ka.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(Ua.multiplyMatrices(ka,r.matrixWorld),Ba.setFromMatrixPosition(Ua),n.setXYZ(i,Ba.x,Ba.y,Ba.z),Ua.multiplyMatrices(ka,r.parent.matrixWorld),Ba.setFromMatrixPosition(Ua),n.setXYZ(i+1,Ba.x,Ba.y,Ba.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Fs.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ca.extractUrlBase(t)},Fs.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},La.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},La.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},La.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},La.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},I.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},I.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},I.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},I.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},I.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Z.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},qe.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},class{constructor(t=new M,e=new M){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Da.subVectors(t,this.start),Fa.subVectors(this.end,this.start);const i=Fa.dot(Fa);let n=Fa.dot(Da)/i;return e&&(n=c(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},v.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},v.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},v.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},v.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},v.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},v.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},rt.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},rt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},rt.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new M).setFromMatrixColumn(this,3)},rt.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},rt.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},rt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rt.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},rt.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},rt.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rt.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rt.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rt.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},rt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},rt.prototype.makeFrustum=function(t,e,i,n,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,o)},rt.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Xe.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},A.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},A.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},nt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},nt.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},nt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Gt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Gt.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Gt.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Gt.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Gt.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Gt.barycoordFromPoint=function(t,e,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Gt.getBarycoord(t,e,i,n,r)},Gt.normal=function(t,e,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Gt.getNormal(t,e,i,n)},Vs.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Vs.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new os(this,t)},Vs.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new as(this,t)},g.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},g.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},g.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},M.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},M.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},M.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},M.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},M.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},M.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},E.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},E.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Rt.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Rt.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Rt.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Rt.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Rt.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Rt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Ie.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Ie.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Ur.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Ue.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Xs.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties($t.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),$t.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},$t.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},$t.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},de.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},de.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new $t(arguments[1],arguments[2])))},de.prototype.addDrawCall=function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},de.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},de.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},de.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},de.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(de.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),fr.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},fr.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},os.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},os.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},os.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},pr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Oa.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(jt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Zt}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(Fe.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),ur.prototype.clearTarget=function(t,e,i,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,i,n)},ur.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},ur.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},ur.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},ur.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},ur.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},ur.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},ur.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},ur.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},ur.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},ur.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},ur.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},ur.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},ur.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},ur.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},ur.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},ur.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},ur.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},ur.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},ur.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},ur.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},ur.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},ur.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},ur.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},ur.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(ur.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(tr.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(S.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),xa.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new ya).load(t,(function(t){e.setBuffer(t)})),this},class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}}.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ke.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},ke.prototype.clear=function(t,e,i,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,i,n)},y.crossOrigin=void 0,y.loadTexture=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new Hs;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,i,void 0,n);return e&&(o.mapping=e),o},y.loadTextureCube=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new Gs;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,i,void 0,n);return e&&(o.mapping=e),o},y.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},y.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"130"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="130");var qa=i(6),Za=i.n(qa),Ja=i(33),Ka=i.n(Ja),Qa=i(11),$a=i.n(Qa);class tl{constructor(){this.camera=new ra(10,10,10,10),this.camera.position.z=100,this.camera.position.x=0,this.camera.position.y=0}focus(t,e){t.position.z=50}updateAspect(t,e){this.camera.left=-1*t/2,this.camera.right=t/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix()}}const el={linear:(t,e,i,n)=>i*t/n+e,easeIn:(t,e,i,n)=>i*(t/=n)*t+e,strongEaseIn:(t,e,i,n)=>i*(t/=n)*t*t*t*t+e,strongEaseOut:(t,e,i,n)=>i*((t=t/n-1)*t*t*t*t+1)+e,sineaseIn:(t,e,i,n)=>i*(t/=n)*t*t+e,sineaseOut:(t,e,i,n)=>i*((t=t/n-1)*t*t+1)+e},il=new b;class nl{constructor(){this.camera=new tl,this.mesh=new Ie,this.material=null,this.geometry=null}applyOptions(t){}addObjects(t){this.mesh.position.z=50,t.add(this.mesh)}setSize(t,e){this.camera.updateAspect(t,e),this.geometry=new Ke(t,e,1,1),this.material=new Fe({fragmentShader:this.fragmentShader,vertexShader:"\nvarying vec2 vUv;\nvoid main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"}),this.material.uniforms={width:{value:t},height:{value:e},timePercent:{value:0},texturePrev:{value:il},textureNext:{value:il}},this.applyOptions(this.options),this.mesh.geometry=this.geometry,this.mesh.material=this.material}setPrevTexture(t){this.material.uniforms.texturePrev.value=t}setNextTexture(t){this.material.uniforms.textureNext.value=t}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}var rl=i(72),ol=i.n(rl),sl=i(73),al=i.n(sl);var ll=i(74),hl=i.n(ll);var ul=i(75),cl=i.n(ul);var dl=i(76),pl=i.n(dl);var fl=i(77),ml=i.n(fl);var gl=i(78),vl=i.n(gl);var _l=i(79),yl=i.n(_l);var xl=i(80),bl=i.n(xl);var Tl=i(81),El=i.n(Tl);var Sl=i(82),wl=i.n(Sl);var Al=i(83),Ml=i.n(Al);var Cl=i(84),Rl=i.n(Cl);var Il=i(85),Pl=i.n(Il);class Ol{constructor(){this.camera=new Ue(60,1,1,2e3),this.camera.position.z=1e3,this.camera.position.x=0,this.camera.position.y=0}updateAspect(t,e){this.camera.aspect=t/e,this.camera.updateProjectionMatrix()}focus(t,e){const i=.5*e/Math.tan(Math.PI/6);t.position.z=1e3-i}}class Nl{constructor(){this.prevTexture=il,this.nextTexture=il,this.geometry=new de,this.material=null,this.camera=new Ol,this.mesh=new Ie,this.textureWidth=0,this.textureHeight=0}horizontalSegments(){return Math.ceil(this.verticalSegments*this.textureWidth/this.textureHeight)}applyOptions(t){this.options=t}initMesh(t,e){const i=[],n=[],r=[],o=this.verticalSegments,s=this.horizontalSegments(),a=t/2,l=e/2,h=t/s,u=e/o,c=this.extraAttributes(),d=Object.keys(c),p=d.reduce((t,e)=>(t[e]=[],t),{});for(let t=0;t<o;t++){const e=t*u-l;for(let i=0;i<s;i++){const l=i*h-a;n.push(l,-e,0),r.push(1*i/s,1-1*t/o),d.forEach(e=>p[e].push(...c[e].generator(t,i))),n.push(l+h,-e,0),r.push(1*(i+1)/s,1-1*t/o),d.forEach(e=>p[e].push(...c[e].generator(t,i))),n.push(l,-e-u,0),r.push(1*i/s,1-1*(t+1)/o),d.forEach(e=>p[e].push(...c[e].generator(t,i))),n.push(l+h,-e-u,0),r.push(1*(i+1)/s,1-1*(t+1)/o),d.forEach(e=>p[e].push(...c[e].generator(t,i)))}}for(let t=0;t<o*s;t++){const e=4*t,n=e+1,r=e+2,o=e+3;i.push(n,e,o),i.push(e,r,o)}return this.geometry.setIndex(i),this.geometry.setAttribute("position",new ne(n,3)),this.geometry.setAttribute("uv",new ne(new Float32Array(r),2)),d.forEach(t=>{const{threeType:e,jsType:i,itemSize:n}=c[t];this.geometry.setAttribute(t,new e(new i(p[t]),n))}),{verticalSegments:o,horizontalSegments:s,segmentWidth:h,segmentHeight:u}}setSize(t,e){this.textureWidth=t,this.textureHeight=e,this.camera.updateAspect(t,e),this.camera.focus(this.mesh,e),this.material=new Fe({fragmentShader:this.fragmentShader,vertexShader:this.vertexShader,side:2}),this.mesh.geometry=this.geometry,this.material.transparent=!0,this.mesh.material=this.material;const{verticalSegments:i,horizontalSegments:n,segmentWidth:r,segmentHeight:o}=this.initMesh(t,e);this.material.uniforms={segmentWidth:{value:r},segmentHeight:{value:o},verticalSegments:{value:i},horizontalSegments:{value:n},timePercent:{value:0},texturePrev:{value:il},textureNext:{value:il}},this.applyOptions(this.options)}setPrevTexture(t){this.prevTexture=t,this.material.uniforms.texturePrev.value=t}setNextTexture(t){this.nextTexture=t,this.material.uniforms.textureNext.value=t}addObjects(t){t.add(this.mesh)}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}var Ll=i(86),Dl=i.n(Ll),Fl=i(87),Bl=i.n(Fl);var Ul=i(88),kl=i.n(Ul),Gl=i(89),Hl=i.n(Gl);var jl=i(90),zl=i.n(jl),Vl=i(91),Xl=i.n(Vl);var Wl=i(92),Yl=i.n(Wl),ql=i(93),Zl=i.n(ql);var Jl=i(94),Kl=i.n(Jl),Ql=i(95),$l=i.n(Ql);var th=i(96),eh=i.n(th),ih=i(97),nh=i.n(ih);class rh extends Nl{constructor(){super(...arguments),this.duration=1250,this.options=[],this.fragmentShader=nh.a,this.vertexShader=eh.a,this.verticalSegments=100}addObjects(t){t.add(this.mesh),t.background=this.nextTexture}extraAttributes(){return{}}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"invX"===t.name);this.material.uniforms.option={value:(null==e?void 0:e.value)?Number(e.value):0}}}var oh=i(98),sh=i.n(oh),ah=i(99),lh=i.n(ah);var hh=i(100),uh=i.n(hh);var ch=i(101),dh=i.n(ch);var ph=i(102),fh=i.n(ph);var mh=i(103),gh=i.n(mh),vh=i(104),_h=i.n(vh);var yh=i(105),xh=i.n(yh);var bh=i(46),Th=i.n(bh),Eh=i(47),Sh=i.n(Eh);var wh=i(106),Ah=i.n(wh),Mh=i(107),Ch=i.n(Mh);const Rh={RandomLines:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=al.a,this.options=[{name:"dir",value:"horz"}]}genRandomLines(){let t=[1];for(let e=20;e--;){let e=t.sort((t,e)=>e-t)[0],i=t.indexOf(e),n=Math.random(),r=e*n,o=e*(1-n);t.splice(i,1),t.push(r,o)}let e=t.length;for(;e;){let i=Math.floor(Math.random()*e--);[t[i],t[e]]=[t[e],t[i]]}return t}applyOptions(t){super.applyOptions(t),this.material.uniforms.direction={value:"horz"===this.options[0].value?1:0}}setSize(t,e){super.setSize(t,e),this.material.uniforms.lines={value:this.genRandomLines()},this.material.vertexShader=ol.a}},Shape:class extends nl{constructor(){super(...arguments),this.duration=800,this.fragmentShader=hl.a,this.options=[]}},Ripples:class extends nl{constructor(){super(...arguments),this.duration=1400,this.fragmentShader=cl.a,this.options=[{name:"dir",value:"center"}],this.optionsMap={center:0,ru:1,lu:2,ld:3,rd:4}}applyOptions(t){var e,i,n,r;super.applyOptions(t);const o=this.options.find(t=>"dir"===t.name);console.log(null===(e=this.optionsMap)||void 0===e?void 0:e[null!==(i=null==o?void 0:o.value)&&void 0!==i?i:"center"]),this.material.uniforms.option={value:null===(n=this.optionsMap)||void 0===n?void 0:n[null!==(r=null==o?void 0:o.value)&&void 0!==r?r:"center"]}}},Erase:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=pl.a,this.options=[],this.defaultDir="right",this.optionsMap={[this.defaultDir]:0,d:1,r:2,u:3}}applyOptions(t){var e,i;super.applyOptions(t);const n=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:null===(e=this.optionsMap)||void 0===e?void 0:e[null!==(i=null==n?void 0:n.value)&&void 0!==i?i:this.defaultDir]}}},Dissolve:class extends nl{constructor(){super(...arguments),this.duration=1200,this.fragmentShader=ml.a,this.options=[],this.dissolveIndices={}}random40(){return Math.ceil(40*Math.random())}setSize(t,e){super.setSize(t,e);for(let t=0;t<1600;t++){let t=this.random40(),e=this.random40();for(;void 0!==this.dissolveIndices[`${t}_${e}`];)t=this.random40(),e=this.random40();this.dissolveIndices[`${t}_${e}`]=0}this.material.uniforms.dissolveTexture={value:this.genDissolveToTexture()}}genDissolveToTexture(){var t=new Uint8Array(4800);for(let e=0;e<1600;e++){const i=e%40+1,n=Math.floor(e/40)+1,r=3*e;0===this.dissolveIndices[`${i}_${n}`]?(t[r]=0,t[r+1]=0,t[r+2]=0):(t[r]=255,t[r+1]=255,t[r+2]=255)}return new Gr(t,40,40,1022)}updateAnimation(t){const e=1600*t-Object.keys(this.dissolveIndices).filter(t=>1===this.dissolveIndices[t]).length;for(let t=0;t<e;t++){const t=Object.keys(this.dissolveIndices).filter(t=>0===this.dissolveIndices[t]),e=Math.ceil(Math.random()*t.length)-1;this.dissolveIndices[t[e]]=1}this.material.uniforms.dissolveTexture.value=this.genDissolveToTexture()}},Smooth:class extends nl{constructor(){super(...arguments),this.duration=2e3,this.fragmentShader=vl.a,this.options=[]}},FadeInOut:class extends nl{constructor(){super(...arguments),this.duration=700,this.fragmentShader=yl.a,this.options=[]}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"thruBlk"===t.name);this.material.uniforms.option={value:"1"===(null==e?void 0:e.value)?1:0}}},Push:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=bl.a,this.options=[],this.optionsMap={u:0,r:1,d:2,l:3}}applyOptions(t){var e,i;super.applyOptions(t);const n=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:null===(e=this.optionsMap)||void 0===e?void 0:e[null!==(i=null==n?void 0:n.value)&&void 0!==i?i:"l"]}}},Separation:class extends nl{constructor(){super(...arguments),this.duration=1500,this.fragmentShader=El.a,this.options=[]}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"orient"===t.name),i=this.options.find(t=>"dir"===t.name);this.material.uniforms.orient={value:"vert"===(null==e?void 0:e.value)},this.material.uniforms.direction={value:"in"===(null==i?void 0:i.value)}}},Display:class extends nl{constructor(){super(...arguments),this.duration=3400,this.fragmentShader=wl.a,this.options=[]}applyOptions(t){const e=this.options.find(t=>"dir"===t.name),i=this.options.find(t=>"thruBlk"===t.name);this.material.uniforms.direction={value:"r"===(null==e?void 0:e.value)},this.material.uniforms.thruBlk={value:"1"===(null==i?void 0:i.value)}}},Uncover:class extends nl{constructor(){super(...arguments),this.duration=750,this.fragmentShader=Ml.a,this.options=[],this.defaultDir="right",this.optionsMap={[this.defaultDir]:0,d:1,r:2,u:3,ld:4,lu:5,rd:6,ru:7},this.selfOptionsList=[{x:-1,y:0},{x:0,y:-1},{x:1,y:0},{x:0,y:1},{x:-1,y:-1},{x:-1,y:1},{x:1,y:-1},{x:1,y:1}]}applyOptions(t){var e;super.applyOptions(t);const i=this.options.find(t=>"dir"===t.name),n=this.optionsMap[null!==(e=null==i?void 0:i.value)&&void 0!==e?e:this.defaultDir],r=this.selfOptionsList[n];this.material.uniforms.optionX={value:r.x},this.material.uniforms.optionY={value:r.y}}},Cover:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=Rl.a,this.options=[],this.defaultDir="right",this.optionsMap={[this.defaultDir]:0,d:1,r:2,u:3,ld:4,lu:5,rd:6,ru:7},this.selfOptionsList=[{x:-1,y:0},{x:0,y:-1},{x:1,y:0},{x:0,y:1},{x:-1,y:-1},{x:-1,y:1},{x:1,y:-1},{x:1,y:1}]}applyOptions(t){var e;super.applyOptions(t);const i=this.options.find(t=>"dir"===t.name),n=this.optionsMap[null!==(e=null==i?void 0:i.value)&&void 0!==e?e:this.defaultDir],r=this.selfOptionsList[n];this.material.uniforms.optionX={value:r.x},this.material.uniforms.optionY={value:r.y}}},Flash:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=Pl.a,this.options=[]}},Checkerboard:class extends Nl{constructor(){super(...arguments),this.duration=2500,this.options=[{name:"dir",value:"horz"}],this.fragmentShader=Bl.a,this.vertexShader=Dl.a,this.vIndex="",this.delay=0,this.verticalSegments=5}extraAttributes(){return{times:{threeType:ne,jsType:Float32Array,itemSize:1,generator:(t,e)=>(this.vIndex!==`${t}${e}`&&(this.delay=.3*Math.random(),this.vIndex=`${t}${e}`),[this.delay])},segment:{threeType:ne,jsType:Float32Array,itemSize:2,generator:(t,e)=>[e,t]},option:{threeType:ee,jsType:Int32Array,itemSize:1,generator:()=>[this.options.find(t=>"dir"===t.name&&"horz"===t.value)?0:1]}}}},Vortex:class{constructor(){this.duration=4e3,this.geometry=new de,this.material=new Fe({fragmentShader:Hl.a,vertexShader:kl.a,side:2}),this.camera=new Ol,this.mesh=new Ie}initData(t,e){const i=[],n=[],r=[],o=[],s=[],a=[],l=Math.ceil(124*t/e),h=t/2,u=e/2,c=t/l,d=e/124;for(let t=0;t<124;t++){const e=t*d-u;for(let i=0;i<l;i++){const u=i*c-h,p=Math.ceil((i+1)/((l+1)/12)),f=.4/p,m=(p-1)*f+Math.random()*f;n.push(u,-e,0),o.push(1*i/l,1-1*t/124),r.push(0,0,1),s.push(i,t),a.push(m),n.push(u+c,-e,0),o.push(1*(i+1)/l,1-1*t/124),r.push(0,0,1),s.push(i,t),a.push(m),n.push(u,-e-d,0),o.push(1*i/l,1-1*(t+1)/124),r.push(0,0,1),s.push(i,t),a.push(m),n.push(u+c,-e-d,0),o.push(1*(i+1)/l,1-1*(t+1)/124),r.push(0,0,1),s.push(i,t),a.push(m)}}for(let t=0;t<124*l;t++){const e=4*t,n=e+1,r=e+2,o=e+3;i.push(n,e,o),i.push(e,r,o)}return this.geometry.setIndex(i),this.geometry.setAttribute("position",new ne(n,3)),this.geometry.setAttribute("normal",new ne(r,3)),this.geometry.setAttribute("uv",new ne(new Float32Array(o),2)),this.geometry.setAttribute("segment",new ne(new Float32Array(s),2)),this.geometry.setAttribute("times",new ne(new Float32Array(a),1)),{verticalSegments:124,horizontalSegments:l,segmentWidth:c,segmentHeight:d}}setSize(t,e){const{verticalSegments:i,horizontalSegments:n,segmentWidth:r,segmentHeight:o}=this.initData(t,e);this.material.uniforms={duration:{value:this.duration},segmentWidth:{value:r},segmentHeight:{value:o},verticalSegments:{value:i},horizontalSegments:{value:n},timePercent:{value:0},texturePrev:{value:il},textureNext:{value:il}},this.camera.updateAspect(t,e),this.camera.focus(this.mesh,e),this.mesh.geometry=this.geometry;new ds({side:2,vertexColors:!0}).wireframe=!0,this.material.transparent=!0,this.mesh.material=this.material}setPrevTexture(t){this.material.uniforms.texturePrev.value=t}setNextTexture(t){this.material.uniforms.textureNext.value=t}addObjects(t){t.add(this.mesh)}updateAnimation(t){let e=(t-.4)/.2;e<0?e=0:e>1&&(e=1),this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}},WindowShades:class{constructor(){this.duration=1600,this.geometry=new de,this.material=new Fe({fragmentShader:Xl.a,vertexShader:zl.a,side:2}),this.horizontalSegments=16,this.meshToCameraDistance=0,this.camera=new Ol,this.mesh=new Ie}initData(t,e){const i=[],n=[],r=[],o=[],s=[],a=[],l=t/2,h=e/2,u=t/this.horizontalSegments;for(let t=0;t<this.horizontalSegments;t++){const e=Math.abs(t-Math.ceil(this.horizontalSegments/2))*(.3/Math.ceil(this.horizontalSegments/2)),i=t*u-l;n.push(i,h,0),r.push(0),o.push(t/this.horizontalSegments,1),s.push(t),a.push(e),n.push(i+u,h,0),r.push(0),o.push((t+1)/this.horizontalSegments,1),s.push(t),a.push(e),n.push(i,-1*h,0),r.push(0),o.push(t/this.horizontalSegments,0),s.push(t),a.push(e),n.push(i+u,-1*h,0),o.push((t+1)/this.horizontalSegments,0),r.push(0),s.push(t),a.push(e),n.push(i+u,h,0),r.push(1),o.push(t/this.horizontalSegments,1),s.push(t),a.push(e),n.push(i+u,h,-1*u),r.push(1),o.push((t+1)/this.horizontalSegments,1),s.push(t),a.push(e),n.push(i+u,-1*h,0),r.push(1),o.push(t/this.horizontalSegments,0),s.push(t),a.push(e),n.push(i+u,-1*h,-1*u),o.push((t+1)/this.horizontalSegments,0),r.push(1),s.push(t),a.push(e)}for(let t=0;t<this.horizontalSegments;t++){const e=8*t,n=e+1,r=e+2,o=e+3,s=e+4,a=e+5,l=e+6,h=e+7;i.push(n,e,o),i.push(e,r,o),i.push(a,s,h),i.push(s,l,h)}this.geometry.setIndex(i),this.geometry.setAttribute("position",new ne(n,3)),this.geometry.setAttribute("uv",new ne(new Float32Array(o),2)),this.geometry.setAttribute("index",new ne(new Float32Array(s),1)),this.geometry.setAttribute("type",new ne(new Float32Array(r),1)),this.geometry.setAttribute("delay",new ne(new Float32Array(a),1))}setPrevTexture(t){this.material.uniforms.texturePrev.value=t}setNextTexture(t){this.material.uniforms.textureNext.value=t}setSize(t,e){this.initData(t,e),this.material.uniforms={segments:{value:this.horizontalSegments},segmentWidth:{value:t/this.horizontalSegments},timePercent:{value:0},texturePrev:{value:il},textureNext:{value:il}},this.meshToCameraDistance=.5*e/Math.tan(Math.PI/6),this.camera.updateAspect(t,e),this.camera.focus(this.mesh,e),this.mesh.geometry=this.geometry,this.material.transparent=!0,this.mesh.material=this.material}addObjects(t){t.add(this.mesh)}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}},Curtain:class extends Nl{constructor(){super(...arguments),this.duration=6e3,this.options=[],this.fragmentShader=Zl.a,this.vertexShader=Yl.a,this.verticalSegments=100}extraAttributes(){return{isLeft:{threeType:ne,jsType:Float32Array,itemSize:1,generator:(t,e)=>[e<this.horizontalSegments()/2?1:0]}}}addObjects(t){super.addObjects(t),this.mesh.position.z+=20,t.background=this.nextTexture}},Fall:class extends Nl{constructor(){super(...arguments),this.zCurveLimit=100,this.duration=2e3,this.options=[{name:"invX",value:"0"}],this.verticalSegments=100,this.fragmentShader=$l.a,this.vertexShader=Kl.a}extraAttributes(){return{}}setSize(t,e){var i;super.setSize(t,e);const n=this.options.find(t=>"invX"===t.name);this.material.uniforms.zCurveLimit={value:this.zCurveLimit},this.material.uniforms.aCoefficient={value:this.zCurveLimit/(this.textureHeight/2*(this.textureHeight/2))},this.material.uniforms.option={value:null!==(i=null==n?void 0:n.value)&&void 0!==i?i:0}}addObjects(t){t.add(this.mesh),t.background=this.nextTexture}updateAnimation(t){this.material.uniforms.timePercent.value=t}},Suspension:class extends rh{constructor(){super(...arguments),this.duration=2e3,this.fragmentShader=lh.a,this.vertexShader=sh.a}addObjects(t){t.add(this.mesh),t.background=this.prevTexture}},Clock:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=uh.a,this.options=[]}},Combing:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=dh.a,this.options=[]}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:"vert"===(null==e?void 0:e.value)?1:0}}},Scale:class extends nl{constructor(){super(...arguments),this.duration=900,this.fragmentShader=fh.a,this.options=[]}applyOptions(t){super.applyOptions(t);const e=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:"in"===(null==e?void 0:e.value)?0:1}}},PeelOff:rh,Flip:class extends Nl{constructor(){super(...arguments),this.duration=1250,this.options=[],this.fragmentShader=_h.a,this.vertexShader=gh.a,this.verticalSegments=1}extraAttributes(){return{}}applyOptions(t){const e=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:"l"===(null==e?void 0:e.value)?1:0}}},Strips:class extends nl{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=xh.a,this.options=[],this.defaultDir="lu",this.optionsMap={[this.defaultDir]:0,ld:1,rd:2,ru:3}}applyOptions(t){var e,i;super.applyOptions(t);const n=this.options.find(t=>"dir"===t.name);this.material.uniforms.option={value:null===(e=this.optionsMap)||void 0===e?void 0:e[null!==(i=null==n?void 0:n.value)&&void 0!==i?i:this.defaultDir]}}},Gallery:class{constructor(){this.camera=new Ol,this.duration=1600,this.options=[],this.gap=10,this.group=new or,this.prevMesh=new Ie,this.nextMesh=new Ie,this.width=100,this.height=100,this.prevMaterial=new Fe({vertexShader:Th.a,fragmentShader:Sh.a,side:2,uniforms:{galleryTexture:{value:il},galleryHeight:{value:1}}}),this.nextMaterial=new Fe({vertexShader:Th.a,fragmentShader:Sh.a,side:2,uniforms:{galleryTexture:{value:il},galleryHeight:{value:1}}})}get isRight(){const t=this.options.find(t=>"dir"===t.name);return!t||"r"===t.value}addObjects(t){this.group.add(this.prevMesh),this.group.add(this.nextMesh),t.add(this.group)}dispose(){this.prevMaterial.dispose(),this.nextMaterial.dispose(),this.prevMesh.geometry.dispose(),this.nextMesh.geometry.dispose()}setNextTexture(t){this.nextMaterial.uniforms.galleryTexture.value=t,this.nextMesh.material=this.nextMaterial}setPrevTexture(t){this.prevMaterial.uniforms.galleryTexture.value=t,this.prevMesh.material=this.prevMaterial}setSize(t,e){this.camera.updateAspect(t,e),this.camera.focus(this.prevMesh,e),this.width=t,this.height=e,this.gap=this.width/20,this.prevMaterial.uniforms.galleryHeight.value=e,this.nextMaterial.uniforms.galleryHeight.value=e;const i=new Ke(t,1.2*e+8,1,1);this.prevMesh.geometry=i;const n=new Ke(t,1.2*e+8,1,1);this.nextMesh.geometry=n,this.nextMesh.position.z=this.prevMesh.position.z,this.isRight?this.nextMesh.position.x=t+this.gap:this.nextMesh.position.x=-1*(t+this.gap)}updateAnimation(t){if(t<.3){const e=t/.3;this.isRight?(this.group.position.z=.25*this.height*-1*e,this.group.rotation.y=Math.PI/12*-1*e):(this.group.position.z=.25*this.height*-1*e,this.group.rotation.y=Math.PI/12*e)}else if(t>=.3&&t<.7){const e=(t-.3)/.4;this.isRight?(this.group.position.z=-1*(.25*this.height+.55*this.height*e),this.group.position.x=-1*(this.width+this.gap)*e):(this.group.position.z=-1*(.25*this.height+.55*this.height*e),this.group.position.x=(this.width+this.gap)*e)}else{const e=(t-.7)/.3;this.isRight?(this.group.position.x=-1*(this.width+this.gap),this.group.position.z=.8*this.height*-1*(1-e),this.group.rotation.y=Math.PI/12*-1*(1-e)):(this.group.position.x=this.width+this.gap,this.group.position.z=.8*this.height*-1*(1-e),this.group.rotation.y=Math.PI/12*(1-e))}}},Switch:class{constructor(){this.camera=new Ol,this.duration=6e3,this.options=[],this.prevMesh=new Ie,this.nextMesh=new Ie,this.width=100,this.height=100,this.depth=1,this.prevDepth=1}addObjects(t){t.add(this.prevMesh),t.add(this.nextMesh)}dispose(){Array.isArray(this.prevMesh.material)?this.prevMesh.material.forEach(t=>t.dispose()):this.prevMesh.material.dispose(),this.prevMesh.geometry.dispose(),Array.isArray(this.nextMesh.material)?this.nextMesh.material.forEach(t=>t.dispose()):this.nextMesh.material.dispose(),this.nextMesh.geometry.dispose()}setNextTexture(t){const e=new Jt({map:t});this.nextMesh.material=e}setPrevTexture(t){const e=new Jt({map:t});this.prevMesh.material=e}setSize(t,e){this.camera.updateAspect(t,e),this.camera.focus(this.prevMesh,e),this.width=t,this.height=e,this.depth=e/2;const i=new Ke(t,e,1,1);this.prevMesh.geometry=i;const n=new Ke(t,e,1,1);this.nextMesh.geometry=n,this.prevDepth=this.prevMesh.position.z}updateAnimation(t){const e=this.options.find(t=>"dir"===t.name);if(t<.5){const e=t/.5;this.prevMesh.position.x=this.width/2*e,this.prevMesh.rotation.y=-Math.PI/10*e,this.nextMesh.position.x=-this.width/2*e,this.nextMesh.rotation.y=Math.PI/10*e,this.nextMesh.position.z=this.prevDepth-this.depth*(1-e)}else{const e=(t-.5)/.5;this.prevMesh.position.x=this.width/2*(1-e),this.prevMesh.rotation.y=-Math.PI/10*(1-e),this.prevMesh.position.z=this.prevDepth-this.depth*e,this.nextMesh.position.x=-this.width/2*(1-e),this.nextMesh.rotation.y=Math.PI/10*(1-e)}if(e&&"l"===e.value)if(t<.5){const e=t/.5;this.prevMesh.position.x=-this.width/2*e,this.prevMesh.rotation.y=Math.PI/10*e,this.nextMesh.position.x=this.width/2*e,this.nextMesh.rotation.y=-Math.PI/10*e}else{const e=(t-.5)/.5;this.prevMesh.position.x=-this.width/2*(1-e),this.prevMesh.rotation.y=Math.PI/10*(1-e),this.nextMesh.position.x=this.width/2*(1-e),this.nextMesh.rotation.y=-Math.PI/10*(1-e)}}},Prism:class{constructor(){this.camera=new Ol,this.duration=6e3,this.preset=null,this.presetZ=0,this.mesh=new Ie,this.width=100,this.height=100}addObjects(t){this.mesh.geometry=this.box,t.add(this.mesh)}dispose(){Array.isArray(this.mesh.material)?this.mesh.material.forEach(t=>t.dispose()):this.mesh.material.dispose(),this.mesh.geometry.dispose()}setNextTexture(t){const e=Array.isArray(this.mesh.material)?this.mesh.material:[];e.push(new Jt({map:t})),e.push(new Jt({map:t})),e.push(new Jt({map:t})),this.mesh.material=e}setPrevTexture(t){const e=Array.isArray(this.mesh.material)?this.mesh.material:[];e.push(new Jt({map:t})),e.push(new Jt({map:t})),e.push(new Jt({map:t})),this.mesh.material=e}setSize(t,e){this.camera.updateAspect(t,e),this.camera.focus(this.mesh,e),this.mesh.position.z-=t/2,this.width=t,this.height=e,this.box=new Oe(t,e,t,1,1,1),this.mesh.geometry=this.box}updateAnimation(t){null===this.preset&&(this.preset=t>0?0:Math.PI/2,this.presetZ=this.mesh.position.z);const e=Math.PI/2*t,i=(Math.sqrt(2)-1)*(this.width/2);this.mesh.rotation.y=this.preset+e,this.mesh.position.z=t<=.5?this.presetZ-t/.5*i:this.presetZ-(1-(t-.5)/.5)*i}},Doors:class{constructor(){this.camera=new Ol,this.duration=1600,this.options=[],this.width=100,this.preMaterial=new Fe({fragmentShader:Ch.a,vertexShader:Ah.a,uniforms:{prevTexture:{value:il},timePercent:{value:0},offset:{value:0}}}),this.prevGeometry=new de,this.prevMesh=new Ie,this.nextMesh=new Ie}addObjects(t){this.prevMesh.material=this.preMaterial,this.prevMesh.geometry=this.prevGeometry,this.prevMesh.material.transparent=!0,t.add(this.prevMesh),t.add(this.nextMesh)}setNextTexture(t){this.nextMesh.material=new Jt({map:t})}setPrevTexture(t){this.preMaterial.uniforms.prevTexture.value=t}setSize(t,e){this.width=t,this.camera.updateAspect(t,e),this.camera.focus(this.prevMesh,e);const i=t/2,n=e/2;this.preMaterial.uniforms.offset.value=t/2,this.prevGeometry.setIndex([0,1,2,3,4,5,6,7,8,9,10,11]);const r=this.options.find(t=>"dir"===t.name),o=r&&"vert"===r.value?0:1;this.preMaterial.uniforms.option={value:o},1===o?(this.prevGeometry.setAttribute("position",new ne([-i,n,0,-i,0,0,i,n,0,-i,0,0,i,0,0,i,n,0,-i,0,0,-i,-n,0,i,0,0,-i,-n,0,i,-n,0,i,0,0],3)),this.prevGeometry.setAttribute("uv",new ne([0,1,0,.5,1,1,0,.5,1,.5,1,1,0,.5,0,0,1,.5,0,0,1,0,1,.5],2))):(this.prevGeometry.setAttribute("position",new ne([-i,n,0,-i,-n,0,0,n,0,-i,-n,0,0,-n,0,0,n,0,0,n,0,0,-n,0,i,n,0,0,-n,0,i,-n,0,i,n,0],3)),this.prevGeometry.setAttribute("uv",new ne([0,1,0,0,.5,1,0,0,.5,0,.5,1,.5,1,.5,0,1,1,.5,0,1,0,1,1],2))),this.prevGeometry.setAttribute("left",new ne([1,1,1,1,1,1,0,0,0,0,0,0],1)),this.nextMesh.geometry=new Ke(t,e,1,1),this.nextMesh.position.z=this.prevMesh.position.z-t/4}updateAnimation(t){this.preMaterial.uniforms.timePercent.value=t,this.nextMesh.position.z=this.prevMesh.position.z-(1-t)*(this.width/4)}dispose(){}}};class Ih{constructor(){this.startTime=0,this.lastTime=0,this.lastFPSTime=0,this.renderingDuration=16,this.reverse=!1,this.scene=new pr,this.delay=0,this.easeFn=el.linear,this.preset=null,this.onTransactionEnd=()=>{},this.isTransactionStartApplied=!1,this.prevTexture=null,this.nextTexture=null,this.animationId=null,this.config=null,this.renderer=new ur({alpha:!0,premultipliedAlpha:!0}),this.isPlaying=!1,this.animate=(t=-1)=>{var e,i,n;if(!this.fps(t))return void(this.animationId=window.requestAnimationFrame(this.animate));this.renderer.clear(),t>this.delay&&0===this.lastTime&&(this.lastTime=t,this.startTime=t);let r=0;this.lastTime>0&&r<1&&(r=this.easeFn(t-this.startTime,0,1,null!==(i=null===(e=this.preset)||void 0===e?void 0:e.duration)&&void 0!==i?i:0)),r>1&&(r=1),null===(n=this.preset)||void 0===n||n.updateAnimation(this.reverse?1-r:r),this.rerender(),this.isTransactionStartApplied||(this.isTransactionStartApplied=!0),r<1?this.animationId=window.requestAnimationFrame(this.animate):this.onTransactionEnd()}}initPlayer(t){this.config=t,this.reverse=t.reverse,t.delay&&Number.isInteger(t.delay)&&(this.delay=t.delay),t.easeFn&&(this.easeFn=el[t.easeFn]),t.maxFPS&&Number.isInteger(t.maxFPS)&&t.maxFPS>0&&(this.renderingDuration=Math.ceil(1e3/t.maxFPS)),this.startTime=0,this.lastTime=0,this.scene.clear(),this.renderer.shadowMap.enabled=!0,this.renderer.autoClear=!1,this.renderer.setClearColor(t.clearColor||0),this.isTransactionStartApplied=!1,this.renderer.setSize(t.stageWidth,t.stageHeight),this.preset=new Rh[t.presetType],t.options&&(this.preset.options=t.options),t.duration&&Number.isInteger(t.duration)&&(this.preset.duration=t.duration),this.preset.setSize(t.stageWidth,t.stageHeight)}setPrevTexture(t){var e,i,n,r;t.needsUpdate=!0,this.reverse?(this.nextTexture=t,null===(e=this.preset)||void 0===e||e.setNextTexture(t)):(this.prevTexture=t,null===(i=this.preset)||void 0===i||i.setPrevTexture(t)),null===(n=this.preset)||void 0===n||n.addObjects(this.scene),null===(r=this.preset)||void 0===r||r.updateAnimation(this.reverse?1:0),this.rerender()}setNextTexture(t){var e,i;t.needsUpdate=!0,this.reverse?(this.prevTexture=t,null===(e=this.preset)||void 0===e||e.setPrevTexture(t)):(this.nextTexture=t,null===(i=this.preset)||void 0===i||i.setNextTexture(t))}play(){return new Promise(t=>{this.onTransactionEnd=t,this.animate(),this.isPlaying=!0})}rerender(){var t;this.renderer.clear(),(null===(t=this.preset)||void 0===t?void 0:t.camera.camera)&&this.renderer.render(this.scene,this.preset.camera.camera)}fps(t){if(t<=0)return!0;if(this.lastFPSTime<0)return this.lastFPSTime=t,!0;return t-this.lastFPSTime>=this.renderingDuration&&(this.lastFPSTime=t,!0)}skip(){var t;null===(t=this.preset)||void 0===t||t.updateAnimation(this.reverse?0:1),this.rerender(),this.dispose(),this.onTransactionEnd()}dispose(){var t,e,i;window.cancelAnimationFrame(this.animationId),this.renderer.clear(),this.isPlaying=!1,null===(t=this.preset)||void 0===t||t.dispose(),null===(e=this.prevTexture)||void 0===e||e.dispose(),null===(i=this.nextTexture)||void 0===i||i.dispose();for(let t=this.scene.children.length-1;t>=0;t--){const e=this.scene.children[t];this.scene.remove(e)}this.scene.background=null}destroy(){this.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose()}}i(139);var Ph=i(3),Oh=i(5);Oh.c.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});var Nh=function(){function t(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Ph.isMobile.tablet||Ph.isMobile.phone)&&this.createTouchHook();var e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex=2..toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),t.prototype.createTouchHook=function(){var t=this,e=document.createElement("button");e.style.width="1px",e.style.height="1px",e.style.position="absolute",e.style.top="-1000px",e.style.left="-1000px",e.style.zIndex=2..toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",(function(){t._isMobileAccessibility=!0,t.activate(),t.destroyTouchHook()})),document.body.appendChild(e),this._hookDiv=e},t.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},t.prototype.activate=function(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),null===(t=this.renderer.view.parentNode)||void 0===t||t.appendChild(this.div))},t.prototype.deactivate=function(){var t;this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),null===(t=this.div.parentNode)||void 0===t||t.removeChild(this.div))},t.prototype.updateAccessibleObjects=function(t){if(t.visible&&t.accessibleChildren){t.accessible&&t.interactive&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);var e=t.children;if(e)for(var i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}},t.prototype.update=function(){var t=performance.now();if(!(Ph.isMobile.android.device&&t<this.androidUpdateCount)&&(this.androidUpdateCount=t+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var e=this.renderer.view.getBoundingClientRect(),i=e.left,n=e.top,r=e.width,o=e.height,s=this.renderer,a=s.width,l=s.height,h=s.resolution,u=r/a*h,c=o/l*h,d=this.div;d.style.left=i+"px",d.style.top=n+"px",d.style.width=a+"px",d.style.height=l+"px";for(var p=0;p<this.children.length;p++){var f=this.children[p];if(f.renderId!==this.renderId)f._accessibleActive=!1,Object(Ph.removeItems)(this.children,p,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,p--;else{d=f._accessibleDiv;var m=f.hitArea,g=f.worldTransform;f.hitArea?(d.style.left=(g.tx+m.x*g.a)*u+"px",d.style.top=(g.ty+m.y*g.d)*c+"px",d.style.width=m.width*g.a*u+"px",d.style.height=m.height*g.d*c+"px"):(m=f.getBounds(),this.capHitArea(m),d.style.left=m.x*u+"px",d.style.top=m.y*c+"px",d.style.width=m.width*u+"px",d.style.height=m.height*c+"px",d.title!==f.accessibleTitle&&null!==f.accessibleTitle&&(d.title=f.accessibleTitle),d.getAttribute("aria-label")!==f.accessibleHint&&null!==f.accessibleHint&&d.setAttribute("aria-label",f.accessibleHint)),f.accessibleTitle===d.title&&f.tabIndex===d.tabIndex||(d.title=f.accessibleTitle,d.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}},t.prototype.updateDebugHTML=function(t){t.innerHTML="type: "+t.type+"</br> title : "+t.title+"</br> tabIndex: "+t.tabIndex},t.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);var e=this.renderer,i=e.width,n=e.height;t.x+t.width>i&&(t.width=i-t.x),t.y+t.height>n&&(t.height=n-t.y)},t.prototype.addChild=function(t){var e=this.pool.pop();e||((e=document.createElement("button")).style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="displayObject "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},t.prototype._onClick=function(t){var e=this.renderer.plugins.interaction,i=t.target.displayObject,n=e.eventData;e.dispatchEvent(i,"click",n),e.dispatchEvent(i,"pointertap",n),e.dispatchEvent(i,"tap",n)},t.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction,i=t.target.displayObject,n=e.eventData;e.dispatchEvent(i,"mouseover",n)},t.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction,i=t.target.displayObject,n=e.eventData;e.dispatchEvent(i,"mouseout",n)},t.prototype._onKeyDown=function(t){9===t.keyCode&&this.activate()},t.prototype._onMouseMove=function(t){0===t.movementX&&0===t.movementY||this.deactivate()},t.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},t}(),Lh=i(1),Dh=i(7),Fh=function(){function t(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new Lh.g,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(t.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),t.prototype.getLocalPosition=function(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)},t.prototype.copyEvent=function(t){"isPrimary"in t&&t.isPrimary&&(this.isPrimary=!0),this.button="button"in t&&t.button;var e="buttons"in t&&t.buttons;this.buttons=Number.isInteger(e)?e:"which"in t&&t.which,this.width="width"in t&&t.width,this.height="height"in t&&t.height,this.tiltX="tiltX"in t&&t.tiltX,this.tiltY="tiltY"in t&&t.tiltY,this.pointerType="pointerType"in t&&t.pointerType,this.pressure="pressure"in t&&t.pressure,this.rotationAngle="rotationAngle"in t&&t.rotationAngle,this.twist="twist"in t&&t.twist||0,this.tangentialPressure="tangentialPressure"in t&&t.tangentialPressure||0},t.prototype.reset=function(){this.isPrimary=!1},t}(),Bh=function(t,e){return(Bh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};var Uh=function(){function t(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return t.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},t.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},t}(),kh=function(){function t(e){this._pointerId=e,this._flags=t.FLAGS.NONE}return t.prototype._doSet=function(t,e){this._flags=e?this._flags|t:this._flags&~t},Object.defineProperty(t.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"none",{get:function(){return this._flags===t.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return 0!=(this._flags&t.FLAGS.OVER)},set:function(e){this._doSet(t.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightDown",{get:function(){return 0!=(this._flags&t.FLAGS.RIGHT_DOWN)},set:function(e){this._doSet(t.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftDown",{get:function(){return 0!=(this._flags&t.FLAGS.LEFT_DOWN)},set:function(e){this._doSet(t.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),t.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),t}(),Gh=function(){function t(){this._tempPoint=new Lh.g}return t.prototype.recursiveFindHit=function(t,e,i,n,r){if(!e||!e.visible)return!1;var o=t.data.global,s=!1,a=r=e.interactive||r,l=!0;if(e.hitArea?(n&&(e.worldTransform.applyInverse(o,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?s=!0:(n=!1,l=!1)),a=!1):e._mask&&n&&(e._mask.containsPoint&&e._mask.containsPoint(o)||(n=!1)),l&&e.interactiveChildren&&e.children)for(var h=e.children,u=h.length-1;u>=0;u--){var c=h[u],d=this.recursiveFindHit(t,c,i,n,a);if(d){if(!c.parent)continue;a=!1,d&&(t.target&&(n=!1),s=!0)}}return r&&(n&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(s=!0),e.interactive&&(s&&!t.target&&(t.target=e),i&&i(t,e,!!s))),s},t.prototype.findHit=function(t,e,i,n){this.recursiveFindHit(t,e,i,n,!1)},t}(),Hh={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Oh.c.mixin(Hh);var jh={target:null,data:{global:null}},zh=function(t){function e(e,i){var n=t.call(this)||this;return i=i||{},n.renderer=e,n.autoPreventDefault=void 0===i.autoPreventDefault||i.autoPreventDefault,n.interactionFrequency=i.interactionFrequency||10,n.mouse=new Fh,n.mouse.identifier=1,n.mouse.global.set(-999999),n.activeInteractionData={},n.activeInteractionData[1]=n.mouse,n.interactionDataPool=[],n.eventData=new Uh,n.interactionDOMElement=null,n.moveWhenInside=!1,n.eventsAdded=!1,n.tickerAdded=!1,n.mouseOverRenderer=!("PointerEvent"in globalThis),n.supportsTouchEvents="ontouchstart"in globalThis,n.supportsPointerEvents=!!globalThis.PointerEvent,n.onPointerUp=n.onPointerUp.bind(n),n.processPointerUp=n.processPointerUp.bind(n),n.onPointerCancel=n.onPointerCancel.bind(n),n.processPointerCancel=n.processPointerCancel.bind(n),n.onPointerDown=n.onPointerDown.bind(n),n.processPointerDown=n.processPointerDown.bind(n),n.onPointerMove=n.onPointerMove.bind(n),n.processPointerMove=n.processPointerMove.bind(n),n.onPointerOut=n.onPointerOut.bind(n),n.processPointerOverOut=n.processPointerOverOut.bind(n),n.onPointerOver=n.onPointerOver.bind(n),n.cursorStyles={default:"inherit",pointer:"pointer"},n.currentCursorMode=null,n.cursor=null,n.resolution=1,n.delayedEvents=[],n.search=new Gh,n._tempDisplayObject=new Oh.d,n._eventListenerOptions={capture:!0,passive:!1},n._useSystemTicker=void 0===i.useSystemTicker||i.useSystemTicker,n.setTargetElement(n.renderer.view,n.renderer.resolution),n}return function(t,e){function i(){this.constructor=t}Bh(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,t),Object.defineProperty(e.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),e.prototype.hitTest=function(t,e){return jh.target=null,jh.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(jh,e,null,!0),jh.target},e.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},e.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(Dh.a.system.add(this.tickerUpdate,this,Dh.c.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(Dh.a.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},e.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},e.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},e.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())},e.prototype.update=function(){if(this.interactionDOMElement)if(this._didMove)this._didMove=!1;else{for(var t in this.cursor=null,this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(t)){var e=this.activeInteractionData[t];if(e.originalEvent&&"touch"!==e.pointerType){var i=this.configureInteractionEventForDOMEvent(this.eventData,e.originalEvent,e);this.processInteractive(i,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},e.prototype.setCursorMode=function(t){t=t||"default";var e=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(e=!1),this.currentCursorMode!==t){this.currentCursorMode=t;var i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.interactionDOMElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.interactionDOMElement.style,i)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.interactionDOMElement.style.cursor=t)}},e.prototype.dispatchEvent=function(t,e,i){i.stopPropagationHint&&t!==i.stopsPropagatingAt||(i.currentTarget=t,i.type=e,t.emit(e,i),t[e]&&t[e](i))},e.prototype.delayDispatchEvent=function(t,e,i){this.delayedEvents.push({displayObject:t,eventString:e,eventData:i})},e.prototype.mapPositionToPoint=function(t,e,i){var n;n=this.interactionDOMElement.parentElement?this.interactionDOMElement.getBoundingClientRect():{x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var r=1/this.resolution;t.x=(e-n.left)*(this.interactionDOMElement.width/n.width)*r,t.y=(i-n.top)*(this.interactionDOMElement.height/n.height)*r},e.prototype.processInteractive=function(t,e,i,n){var r=this.search.findHit(t,e,i,n),o=this.delayedEvents;if(!o.length)return r;t.stopPropagationHint=!1;var s=o.length;this.delayedEvents=[];for(var a=0;a<s;a++){var l=o[a],h=l.displayObject,u=l.eventString,c=l.eventData;c.stopsPropagatingAt===h&&(c.stopPropagationHint=!0),this.dispatchEvent(h,u,c)}return r},e.prototype.onPointerDown=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(var i=e.length,n=0;n<i;n++){var r=e[n],o=this.getInteractionDataForPointerId(r),s=this.configureInteractionEventForDOMEvent(this.eventData,r,o);if(s.data.originalEvent=t,this.processInteractive(s,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",s),"touch"===r.pointerType)this.emit("touchstart",s);else if("mouse"===r.pointerType||"pen"===r.pointerType){var a=2===r.button;this.emit(a?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(t,e,i){var n=t.data,r=t.data.identifier;if(i)if(e.trackedPointers[r]||(e.trackedPointers[r]=new kh(r)),this.dispatchEvent(e,"pointerdown",t),"touch"===n.pointerType)this.dispatchEvent(e,"touchstart",t);else if("mouse"===n.pointerType||"pen"===n.pointerType){var o=2===n.button;o?e.trackedPointers[r].rightDown=!0:e.trackedPointers[r].leftDown=!0,this.dispatchEvent(e,o?"rightdown":"mousedown",t)}},e.prototype.onPointerComplete=function(t,e,i){for(var n=this.normalizeToPointerData(t),r=n.length,o=t.target!==this.interactionDOMElement?"outside":"",s=0;s<r;s++){var a=n[s],l=this.getInteractionDataForPointerId(a),h=this.configureInteractionEventForDOMEvent(this.eventData,a,l);if(h.data.originalEvent=t,this.processInteractive(h,this.lastObjectRendered,i,e||!o),this.emit(e?"pointercancel":"pointerup"+o,h),"mouse"===a.pointerType||"pen"===a.pointerType){var u=2===a.button;this.emit(u?"rightup"+o:"mouseup"+o,h)}else"touch"===a.pointerType&&(this.emit(e?"touchcancel":"touchend"+o,h),this.releaseInteractionDataForPointerId(a.pointerId))}},e.prototype.onPointerCancel=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!0,this.processPointerCancel)},e.prototype.processPointerCancel=function(t,e){var i=t.data,n=t.data.identifier;void 0!==e.trackedPointers[n]&&(delete e.trackedPointers[n],this.dispatchEvent(e,"pointercancel",t),"touch"===i.pointerType&&this.dispatchEvent(e,"touchcancel",t))},e.prototype.onPointerUp=function(t){this.supportsTouchEvents&&"touch"===t.pointerType||this.onPointerComplete(t,!1,this.processPointerUp)},e.prototype.processPointerUp=function(t,e,i){var n=t.data,r=t.data.identifier,o=e.trackedPointers[r],s="touch"===n.pointerType,a="mouse"===n.pointerType||"pen"===n.pointerType,l=!1;if(a){var h=2===n.button,u=kh.FLAGS,c=h?u.RIGHT_DOWN:u.LEFT_DOWN,d=void 0!==o&&o.flags&c;i?(this.dispatchEvent(e,h?"rightup":"mouseup",t),d&&(this.dispatchEvent(e,h?"rightclick":"click",t),l=!0)):d&&this.dispatchEvent(e,h?"rightupoutside":"mouseupoutside",t),o&&(h?o.rightDown=!1:o.leftDown=!1)}i?(this.dispatchEvent(e,"pointerup",t),s&&this.dispatchEvent(e,"touchend",t),o&&(a&&!l||this.dispatchEvent(e,"pointertap",t),s&&(this.dispatchEvent(e,"tap",t),o.over=!1))):o&&(this.dispatchEvent(e,"pointerupoutside",t),s&&this.dispatchEvent(e,"touchendoutside",t)),o&&o.none&&delete e.trackedPointers[r]},e.prototype.onPointerMove=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t);"mouse"!==e[0].pointerType&&"pen"!==e[0].pointerType||(this._didMove=!0,this.cursor=null);for(var i=e.length,n=0;n<i;n++){var r=e[n],o=this.getInteractionDataForPointerId(r),s=this.configureInteractionEventForDOMEvent(this.eventData,r,o);s.data.originalEvent=t,this.processInteractive(s,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",s),"touch"===r.pointerType&&this.emit("touchmove",s),"mouse"!==r.pointerType&&"pen"!==r.pointerType||this.emit("mousemove",s)}"mouse"===e[0].pointerType&&this.setCursorMode(this.cursor)}},e.prototype.processPointerMove=function(t,e,i){var n=t.data,r="touch"===n.pointerType,o="mouse"===n.pointerType||"pen"===n.pointerType;o&&this.processPointerOverOut(t,e,i),this.moveWhenInside&&!i||(this.dispatchEvent(e,"pointermove",t),r&&this.dispatchEvent(e,"touchmove",t),o&&this.dispatchEvent(e,"mousemove",t))},e.prototype.onPointerOut=function(t){if(!this.supportsTouchEvents||"touch"!==t.pointerType){var e=this.normalizeToPointerData(t)[0];"mouse"===e.pointerType&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var i=this.getInteractionDataForPointerId(e),n=this.configureInteractionEventForDOMEvent(this.eventData,e,i);n.data.originalEvent=e,this.processInteractive(n,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",n),"mouse"===e.pointerType||"pen"===e.pointerType?this.emit("mouseout",n):this.releaseInteractionDataForPointerId(i.identifier)}},e.prototype.processPointerOverOut=function(t,e,i){var n=t.data,r=t.data.identifier,o="mouse"===n.pointerType||"pen"===n.pointerType,s=e.trackedPointers[r];i&&!s&&(s=e.trackedPointers[r]=new kh(r)),void 0!==s&&(i&&this.mouseOverRenderer?(s.over||(s.over=!0,this.delayDispatchEvent(e,"pointerover",t),o&&this.delayDispatchEvent(e,"mouseover",t)),o&&null===this.cursor&&(this.cursor=e.cursor)):s.over&&(s.over=!1,this.dispatchEvent(e,"pointerout",this.eventData),o&&this.dispatchEvent(e,"mouseout",t),s.none&&delete e.trackedPointers[r]))},e.prototype.onPointerOver=function(t){var e=this.normalizeToPointerData(t)[0],i=this.getInteractionDataForPointerId(e),n=this.configureInteractionEventForDOMEvent(this.eventData,e,i);n.data.originalEvent=e,"mouse"===e.pointerType&&(this.mouseOverRenderer=!0),this.emit("pointerover",n),"mouse"!==e.pointerType&&"pen"!==e.pointerType||this.emit("mouseover",n)},e.prototype.getInteractionDataForPointerId=function(t){var e,i=t.pointerId;return 1===i||"mouse"===t.pointerType?e=this.mouse:this.activeInteractionData[i]?e=this.activeInteractionData[i]:((e=this.interactionDataPool.pop()||new Fh).identifier=i,this.activeInteractionData[i]=e),e.copyEvent(t),e},e.prototype.releaseInteractionDataForPointerId=function(t){var e=this.activeInteractionData[t];e&&(delete this.activeInteractionData[t],e.reset(),this.interactionDataPool.push(e))},e.prototype.configureInteractionEventForDOMEvent=function(t,e,i){return t.data=i,this.mapPositionToPoint(i.global,e.clientX,e.clientY),"touch"===e.pointerType&&(e.globalX=i.global.x,e.globalY=i.global.y),i.originalEvent=e,t.reset(),t},e.prototype.normalizeToPointerData=function(t){var e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var i=0,n=t.changedTouches.length;i<n;i++){var r=t.changedTouches[i];void 0===r.button&&(r.button=t.touches.length?1:0),void 0===r.buttons&&(r.buttons=t.touches.length?1:0),void 0===r.isPrimary&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===r.width&&(r.width=r.radiusX||1),void 0===r.height&&(r.height=r.radiusY||1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="touch"),void 0===r.pointerId&&(r.pointerId=r.identifier||0),void 0===r.pressure&&(r.pressure=r.force||.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),void 0===r.layerX&&(r.layerX=r.offsetX=r.clientX),void 0===r.layerY&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,e.push(r)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{var o=t;void 0===o.isPrimary&&(o.isPrimary=!0),void 0===o.width&&(o.width=1),void 0===o.height&&(o.height=1),void 0===o.tiltX&&(o.tiltX=0),void 0===o.tiltY&&(o.tiltY=0),void 0===o.pointerType&&(o.pointerType="mouse"),void 0===o.pointerId&&(o.pointerId=1),void 0===o.pressure&&(o.pressure=.5),void 0===o.twist&&(o.twist=0),void 0===o.tangentialPressure&&(o.tangentialPressure=0),o.isNormalized=!0,e.push(o)}return e},e.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},e}(Ph.EventEmitter),Vh=i(2),Xh=function(){function t(e){var i=this;this.stage=new Oh.b,e=Object.assign({forceCanvas:!1},e),this.renderer=Object(Vh.y)(e),t._plugins.forEach((function(t){t.init.call(i,e)}))}return t.registerPlugin=function(e){t._plugins.push(e)},t.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(t.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),t.prototype.destroy=function(e,i){var n=this,r=t._plugins.slice(0);r.reverse(),r.forEach((function(t){t.destroy.call(n)})),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null},t._plugins=[],t}(),Wh=function(){function t(){}return t.init=function(t){var e=this;Object.defineProperty(this,"resizeTo",{set:function(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){e._resizeTo&&(e.cancelResize(),e._resizeId=requestAnimationFrame((function(){return e.resize()})))},this.cancelResize=function(){e._resizeId&&(cancelAnimationFrame(e._resizeId),e._resizeId=null)},this.resize=function(){if(e._resizeTo){var t,i;if(e.cancelResize(),e._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{var n=e._resizeTo;t=n.clientWidth,i=n.clientHeight}e.renderer.resize(t,i)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},t.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},t}();Xh.registerPlugin(Wh);
169
169
  /*!
170
170
  * @pixi/extract - v6.4.2
171
171
  * Compiled Thu, 02 Jun 2022 15:39:26 UTC
@@ -340,4 +340,4 @@ cp.prototype._renderCanvas=function(t){this._autoResolution&&this._resolution!==
340
340
  * pixi.js-legacy is licensed under the MIT License.
341
341
  * http://www.opensource.org/licenses/mit-license
342
342
  */
343
- om.a.registerPlugin("accessibility",Nh),om.a.registerPlugin("extract",pm),om.a.registerPlugin("graphics",lm),om.a.registerPlugin("interaction",zh),om.a.registerPlugin("mesh",sm.a),om.a.registerPlugin("prepare",vm),om.a.registerPlugin("sprite",cm);class bm extends Za.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(t=>{const e=t-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(1e3*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=t,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}!function(t){t.ResourceError="RESOURCE_ERROR",t.RuntimeError="RUNTIME_ERROR",t.RuntimeWarn="RUNTIME_WARN",t.CanvasCrash="CANVAS_CRASH"}(gm||(gm={}));class Tm extends Error{constructor(t,e){var i,n;super(e),i=this,n=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(i,n):i.__proto__&&(i.__proto__=n),this.errorType=t,this.errorMsg=e}static transform(t){return t instanceof Tm?t:new Tm(gm.RuntimeError,t.message)}}function Em(){return function(t,e,i){const n=i.value;i.value=function(...t){try{return n.apply(this,t)}catch(t){throw new Tm(gm.RuntimeWarn,t.message)}}}}var Sm=i(48),wm=i.n(Sm),Am=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function Mm(){return r()}const Cm="__delay_resolve_result__";function Rm(t){return new Promise(e=>{setTimeout(()=>{e(Cm)},t)})}function Im(t,e){return Am(this,void 0,void 0,(function*(){const i=yield Promise.race([t(),Rm(e)]);return i===Cm?Cm:i}))}function Pm(t,e){return Am(this,void 0,void 0,(function*(){const i=Date.now();for(;!t()&&Date.now()-i<e;)yield Rm(16)}))}var Om=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function Nm(t,e){return Om(this,void 0,void 0,(function*(){const i=yield Im(()=>fetch(t),e);if(i===Cm)throw new Tm(gm.ResourceError,`"${t}" loaded timeout"`);if(!i.ok)throw new Tm(gm.ResourceError,`"${t}" loaded failed with status "${i.status}"`);return i}))}class Lm{constructor(t,e,i,n,r,o){this.timeout=15e3,this.useCache=!1,this.taskId="",this.delegate=null,this.urlInterrupter=null,this.useCache=e,this.localStorage=t,this.logger=i,this.timeout=n,this.delegate=r||null,this.urlInterrupter=o||null}attachTaskId(t){this.taskId=t}fetchJson(t){return Om(this,void 0,void 0,(function*(){let e=t;const i=t;if(this.urlInterrupter&&"function"==typeof this.urlInterrupter){const t=Date.now();e=yield this.urlInterrupter(e),this.logger.info("use url interrupter, time: "+(Date.now()-t),this.taskId)}let n;if(this.useCache&&(this.logger.info("load resource from cache. "+i,this.taskId||""),n=yield this.localStorage.getItem(i)),n)return this.logger.info("cache hit. "+i,this.taskId||""),n;{let t;if(this.delegate){this.logger.info("load resource by delegate. "+i,this.taskId||"");const n=Date.now(),r=yield Im(()=>this.delegate.loadJson(e),this.timeout);if(this.logger.info(`load resource by delegate end. ${i}, time: ${Date.now()-n}`,this.taskId||""),r===Cm)throw new Tm(gm.ResourceError,`"${i}" loaded timeout"`);t=JSON.parse(r)}else{this.logger.info("load resource from server. "+i,this.taskId||"");const n=Date.now();t=yield(yield Nm(""+e,this.timeout)).json(),this.logger.info(`load resource from server end. ${i}, time: ${Date.now()-n}`,this.taskId||"")}return this.logger.info("load end. "+i,this.taskId||""),this.useCache&&this.localStorage.setItem(i,t).catch(()=>{}),t}}))}fetchPng(t,e){return Om(this,void 0,void 0,(function*(){let i=t;const n=t;if(this.urlInterrupter&&"function"==typeof this.urlInterrupter){const t=Date.now();i=yield this.urlInterrupter(i),this.logger.info("use url interrupter, time: "+(Date.now()-t),this.taskId)}let r;const o=n+"-v2";if(this.useCache&&(this.logger.info("load resource from cache. "+n,this.taskId||""),r=yield this.localStorage.getItem(o)),r){const{scale:t,scaledBase64:e}=r;this.logger.info("cache hit. "+n,this.taskId||"");return{baseTexture:new Vh.c(e,{resolution:1}),scale:t}}{let t;if(this.delegate){this.logger.info("load resource by delegate. "+n,this.taskId||"");const e=Date.now();if(t=yield Im(()=>this.delegate.loadImage(i),this.timeout),this.logger.info(`load resource by delegate end. ${n}, time: ${Date.now()-e}`,this.taskId||""),t===Cm)throw new Tm(gm.ResourceError,`"${n}" loaded timeout"`)}else{this.logger.info("load resource from server. "+n,this.taskId||"");const e=Date.now(),r=yield Nm(i,this.timeout);this.logger.info(`load resource from server end. ${n}, time: ${Date.now()-e}`,this.taskId||""),t=yield r.blob()}r=yield function(t){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=()=>{i(new Tm(gm.ResourceError,"Failed parse blob data."))},n.readAsDataURL(t)})}(t);const s=document.createElement("img");s.src=r,yield new Promise((t,e)=>{s.onload=()=>t(""),s.onerror=()=>e(new Error("load sprite image failed"))});let a=e;const l=s.width||1,h=s.height||1,u=2048,c=2048;if(l>u||h>c){a*=u/l;const t=a*h;t>c&&(a*=h/t)}const d=document.createElement("canvas"),p=Math.ceil(s.width*a),f=Math.ceil(s.height*a);d.width=p,d.height=f;d.getContext("2d").drawImage(s,0,0,p,f);const m=d.toDataURL("image/png"),g=new Vh.c(m,{resolution:1});return this.logger.info("load end. "+n,this.taskId||""),this.useCache&&this.localStorage.setItem(o,{scale:a,scaledBase64:m}).catch(()=>{}),{baseTexture:g,scale:a}}}))}destroy(){}}var Dm=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Fm{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(xd.b.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);let{length:t}=this.callbackList;for(let e=0;e<t;e++){const i=this.callbackList[e];if(i&&!i.applied){if(!(i.triggerTime<=this.timestamp))break;i.running=!0,i.fn(),i.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const i=Mm(),n=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:n,id:i,applied:!1,running:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),i}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&!this.callbackList[e].running&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return Dm(this,void 0,void 0,(function*(){const i=this.timestamp;for(;!t()&&this.timestamp-i<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var Bm=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function Um(t,e,i){return i?Math.floor(parseFloat(t)*e):Math.ceil(parseFloat(t)*e)}const km={w:!1,h:!1,x:!0,y:!0};class Gm{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.loader=t}getTexture(t){return this.textures[t]||null}getFrameData(t){return this.frames[t]}getGifFrames(t){return this.gifs[t]?this.gifs[t].filter(t=>!!t):[]}loadSpriteSheetItem(t,e,i,n){return Bm(this,void 0,void 0,(function*(){const r=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${i}.json`),{baseTexture:o,scale:s}=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${i}.png`,n);!function(t,e){t.meta&&t.meta.size&&["w","h"].forEach(i=>{t.meta.size[i]=Um(t.meta.size[i],e,km[i])}),t.frames&&Object.keys(t.frames).forEach(i=>{t.frames[i].frame&&["x","y","w","h"].forEach(n=>{t.frames[i].frame[n]=Um(t.frames[i].frame[n],e,km[n])}),t.frames[i].spriteSourceSize&&["x","y","w","h"].forEach(n=>{t.frames[i].spriteSourceSize[n]=Um(t.frames[i].spriteSourceSize[n],e,km[n])}),t.frames[i].sourceSize&&["w","h"].forEach(n=>{t.frames[i].sourceSize[n]=Um(t.frames[i].sourceSize[n],e,km[n])})})}(r,s);const a=new Ap(o,r);yield new Promise(t=>{a.parse(()=>t(""))}),this.spriteSheets.push(a),Object.keys(a.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const i=e[1];this.gifs[i]||(this.gifs[i]=[]);const n=parseInt(e[2],10);this.gifs[i][n]=a.textures[t]}else this.frames[t]=r.frames[t],this.textures[t]=a.textures[t]})}))}destroy(){this.spriteSheets.forEach(t=>t.destroy(!0)),this.spriteSheets=[],this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null)}}var Hm=i(18),jm=i.n(Hm),zm=i(13),Vm=i.n(zm);function Xm(t,e,i){let n,r;const o=Math.round(t)%360;if(o%180==0)n=Math.cos(o*(Math.PI/180))*e,r=0;else if(o%90==0)n=0,r=Math.sin(o*(Math.PI/180))*i;else{const t=function(t){const e=t*Math.PI/180;return Math.tan(e)}(o);n=e*i/Math.sqrt(Math.pow(i,2)+Math.pow(e*t,2)),(o>90&&o<270||o<-90&&o>-270)&&(n=-n),r=t*n}return{x:n,y:r}}function Wm(t,e,i,n,r,o){const s=t,a=e;let l,h,u,c,d;if(0===Math.round(n))l=r,h=o,d=0;else if(Math.round(n)>=360)l=r,h=o,u=r+2*t*Math.abs(Math.cos(-i/180*Math.PI)),c=o+2*e*Math.sin(-i/180*Math.PI),d=1;else{const t=-i,e=-(i+n),{x:u,y:c}=Xm(t,s,a),p=r-u,f=o+c,{x:m,y:g}=Xm(e,s,a);l=m+p,h=f-g,d=n>=-360&&n<-180?1:n>=-180&&n<0||n>0&&n<180?0:1}return{radiusX:s,radiusY:a,xAxisRotation:0,largeArcFlag:d,sweepFlag:n>0?1:0,endX:l,endY:h,middleX:u,middleY:c}}class Ym{constructor(){this.pool=[]}getObject(t){const e=this.pool.find(t=>!t.isUsed);if(e)return e.isUsed=!0,e.obj;{const e={obj:this.createObject(),isUsed:!0,group:t};return this.pool.push(e),e.obj}}collectObject(t){const e=this.pool.find(e=>e.obj===t);e&&(e.isUsed=!1,this.resetObject(e.obj))}collectObjectByGroup(t){this.pool.filter(e=>e.group===t).forEach(t=>this.collectObject(t.obj))}}const qm=new class extends Ym{createObject(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t}resetObject(t){t.removeAttribute("viewBox"),t.removeAttribute("width"),t.removeAttribute("height"),t.innerHTML=""}};const Zm=new class extends Ym{createObject(){return document.createElement("img")}resetObject(t){t.removeAttribute("src")}};var Jm=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Km{constructor(t){this.imgElements=[],this.svgElements=[],this.idToHashMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.hashToIdMap=Object.create(null),this.maxResolution=t}render(t,e,i,n){return Jm(this,void 0,void 0,(function*(){const{items:e,width:r,height:o}=t,s=Zm.getObject(i),a=new Vh.c(s,{width:r*n,height:o*n,resolution:1}),l=qm.getObject(i);this.imgElements.push(s),this.svgElements.push(l),l.setAttribute("viewBox",`0 0 ${r} ${o}`),l.setAttribute("width",""+r),l.setAttribute("height",""+o);const h={};e.forEach(t=>{const{item:e,x:i,y:r}=t,o=i+2,s=r+2;e.pathsData.forEach(t=>{let e="";t.cmds.forEach(([i,n])=>{e+=i+" ",e+=n.map(e=>(Vm()(e)||(e.x=e.x+t.offset.x+o,e.y=e.y+t.offset.y+s),e)).reduce((t,e)=>(Vm()(e)?t+=e+" ":t+=`${e.x} ${e.y} `,t),""),e+=" "}),t.pathElement.setAttribute("d",e),l.appendChild(t.pathElement)});const u=e.width-4-2*e.padding,c=e.height-4-2*e.padding;this.textures[e.hash]={texture:new Vh.t(a,new Lh.j((o+2)*n,(s+2)*n,u*n,c*n)),pivot:e.pivot,scale:1/n},h[e.hash]=this.hashToIdMap[e.hash]});const u=(c='<?xml version="1.0" encoding="utf-8"?>'+l.outerHTML,"data:image/svg+xml,"+encodeURIComponent(c).replace(/'/g,"%27").replace(/"/g,"%22"));var c;const d=document.createElement("img");d.src=u,yield new Promise((t,e)=>{d.onload=()=>t(""),d.onerror=()=>e()});const p=document.createElement("canvas");p.width=d.width*n,p.height=d.height*n;p.getContext("2d").drawImage(d,0,0,p.width,p.height),s.src=p.toDataURL("image/png"),yield new Promise((t,e)=>{s.onload=()=>t(""),s.onerror=()=>e()})}))}getGraphicsData(t){const e=this.idToHashMap[t]||"";return this.textures[e]||null}addGraphics(t,e,i,n,r,o,s,a,l,h,u){var c,d;if(!s&&!l)return t;const p=jm()(i+(null!==(d=null===(c=null==s?void 0:s.width)||void 0===c?void 0:c.toString())&&void 0!==d?d:0)+l+h+u);if(this.hashToIdMap[p]||(this.hashToIdMap[p]=[]),this.hashToIdMap[p].push(t),this.idToHashMap[t]=p,this.graphics.findIndex(t=>t.hash===p)<0){const{graphicsWidth:t,graphicsHeight:i,pathsData:a,pivot:c,padding:d}=function(t,e,i,n,r,o,s,a,l){var h;const u=[],c={x:Math.abs(r.x),y:Math.abs(r.y)};let d=0,p=0,f=0,m=0,g=0,v="none";const _=null!==(h=null==n?void 0:n.width)&&void 0!==h?h:0;return s?(d=e,p=i,g=0):(v=l||"#ff0000",g=_,f=.5*_,m=.5*_,d=e+_,p=i+_,c.x+=.5*_,c.y+=.5*_),d+=Math.abs(r.x),p+=Math.abs(r.y),f+=Math.abs(r.x),m+=Math.abs(r.y),d+=4,p+=4,f+=2,m+=2,d=Math.ceil(d),p=Math.ceil(p),t.forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","path");"none"!==t.fill&&s?e.setAttribute("fill",a||"#ff0000"):e.setAttribute("fill","none"),t.hasStroke&&!s&&(e.setAttribute("stroke-linecap",(null==n?void 0:n.cap)||"butt"),e.setAttribute("stroke-linejoin",(null==n?void 0:n.join)||"miter"),e.setAttribute("stroke-width",g.toString()),e.setAttribute("stroke",v),(null==n?void 0:n.dash)&&e.setAttribute("stroke-dasharray",n.dash));const{scale:i}=t,r=t.path.trim().split(" ");let o={x:0,y:0};const l={offset:{x:f,y:m},cmds:[],pathElement:e};for(let t=0;t<r.length;t+=2){const e=r[t],n=r[t+1];if("M"===e){let[t,e]=n.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*i.x,e=e/9525*i.y,l.cmds.push(["M",[{x:t,y:e}]])}else if("A"===e){const[t,e,r,s]=n.split(",").map(t=>Number(t)),a=r/Math.PI*180,h=s/Math.PI*180,u=Wm(t,e,a,h,o.x,o.y);Math.round(h)>=360?(o={x:u.endX,y:u.endY},l.cmds.push(["A",[u.radiusX/9525*i.x,u.radiusY/9525*i.y,u.xAxisRotation,u.largeArcFlag,u.sweepFlag,{x:u.middleX/9525*i.x,y:u.middleY/9525*i.y}]]),l.cmds.push(["A",[u.radiusX/9525*i.x,u.radiusY/9525*i.y,u.xAxisRotation,u.largeArcFlag,u.sweepFlag,{x:u.endX/9525*i.x,y:u.endY/9525*i.y}]])):(o={x:u.endX,y:u.endY},l.cmds.push(["A",[u.radiusX/9525*i.x,u.radiusY/9525*i.y,u.xAxisRotation,u.largeArcFlag,u.sweepFlag,{x:u.endX/9525*i.x,y:u.endY/9525*i.y}]]))}else if("L"===e){let[t,e]=n.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*i.x,e=e/9525*i.y,l.cmds.push(["L",[{x:t,y:e}]])}else if("QB"===e){let[t,e,r,s]=n.split(",").map(t=>Number(t));o={x:r,y:s},t=t/9525*i.x,e=e/9525*i.y,r=r/9525*i.x,s=s/9525*i.y,l.cmds.push(["Q",[{x:t,y:e},{x:r,y:s}]])}else if("CB"===e){let[t,e,r,s,a,h]=n.split(",").map(t=>Number(t));o={x:a,y:h},t=t/9525*i.x,e=e/9525*i.y,r=r/9525*i.x,s=s/9525*i.y,a=a/9525*i.x,h=h/9525*i.y,l.cmds.push(["C",[{x:t,y:e},{x:r,y:s},{x:a,y:h}]])}else"C"===e&&l.cmds.push(["Z",[]])}u.push(l)}),{graphicsWidth:d,graphicsHeight:p,pivot:c,padding:2,pathsData:u}}(e,r,o,s,n,0,l,h,u);this.graphics.push({hash:p,pathsData:a,pivot:c,width:t,height:i,padding:d})}return t}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});return function t(e){const i=[],n=e.filter(t=>{const e=t.width<2048&&t.height<2048;return e||i.push(t),e}).sort((t,e)=>t.width*t.height-e.width*e.height);let r=n.length+1,o=2050,s=2050;const a=[];let l=null;for(;(o>2048||s>2048)&&n.length>0;)r-=1,l=wm()(n.slice(0,r)),o=l.width,s=l.height;return l&&a.push(l),i.forEach(t=>{const e=wm()([t]);a.push(e)}),r<n.length?a.concat(t(n.slice(r))):a}(this.graphics)}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy(!0)}),this.textures=Object.create(null),this.imgElements.forEach(t=>Zm.collectObject(t)),this.svgElements.forEach(t=>qm.collectObject(t)),this.graphics=[]}}class Qm{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,i){const n=`${e}_${t}`;if(this.runningTimeNodes[n])try{this.runningTimeNodes[n].dispose(!0)}catch(t){}this.runningTimeNodes[n]=i}removeRunningTimeNode(t,e){const i=`${e}_${t}`;delete this.runningTimeNodes[i]}}class $m{constructor(t){this.eventHub=t,this.targets=Object.create(null)}getTargets(){return Object.keys(this.targets).map(t=>this.targets[t])}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,i={type:"el",index:0,id:""}){var n,r;let o=this.targets[t.id];return"shape"!==t.type?o:("shape"===t.type&&t.txEl&&(o=null!==(n=null==o?void 0:o.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==n?n:null),"shape"===t.type&&t.bg&&0===i.index&&(e=!1,o=null!==(r=null==o?void 0:o.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",i.id)),e&&o?o.getIterateEntry(i.type,i.index,i.id):(o||this.eventHub.emit("IterateTimeNodeEnd",i.id),o))}clearTargets(){this.targets=Object.create(null)}}class tg{constructor(t){this.target=t}get color(){return this.target.strokeColorFilter.currentColor}set color(t){this.target.strokeColorFilter.color=t}get on(){return this.target.strokeActive?"true":"false"}set on(t){this.target.strokeActive="true"===t}}class eg{constructor(t){this.applyCommand=(t,e)=>{this.target.applyCommand(t,e)},this.target=t}}class ig{constructor(t){this.target=t}get color(){return this.target.pptColorFilter.currentColor}set color(t){this.target.pptColorActive&&(this.target.pptColorFilter.color=t)}get on(){return this.target.pptColorActive?"true":"false"}set on(t){this.target.pptColorActive="true"===t}get designColor(){return this.target.pptColorFilter.designColor}toString(){return this.color}}class ng{constructor(t){this.target=t}get color(){return this.target.fillColorFilter.currentColor}set color(t){this.target.fillActive&&(this.target.fillColorFilter.color=t)}get on(){return this.target.fillActive?"true":"false"}set on(t){this.target.fillActive="true"===t}get designColor(){return this.target.fillColorFilter.designColor}}class rg{constructor(t,e,i){this.hardHidden=!1,this.designRotation=0,this.target=t,!0===e&&(this.hardHidden=!0),this.designRotation=i}get opacity(){return this.target.alpha}set opacity(t){this.target.alpha=t}get rotation(){return this.target.rotation/Math.PI*180}set rotation(t){this.target.rotation=t/180*Math.PI+this.designRotation}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class og{constructor(t,e){this.actions=[],this.ctx=e,this.object=t,this.object.interactive=!0}reset(t){this.object.interactive=!1,this.object.removeAllListeners(),this.object=t,this.object.interactive=!0}addAction(t,e){this.actions.push([t,e]),"click"===e?(this.object.addListener("pointertap",()=>this.handleAction(t)),this.object.cursor="pointer"):"hover"===e&&this.object.addListener("mouseover",()=>this.handleAction(t))}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new Lh.k(0,0,this.object.width,this.object.height)}handleAction(t){this.ctx.eventHub.emit(jy.hyperlinkTrigger,t),this.execAction(t)}execAction(t){var e,i;if(this.ctx.eventHub.emit(jy.userInput),"ppaction://hlinksldjump"===t.action){const i=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);i&&i[1]&&this.ctx.eventHub.emit(jy.requestGotoSlide,Number(i[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit(jy.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit(jy.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit(jy.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit(jy.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit(jy.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action?this.ctx.eventHub.emit(jy.requestGotoSlide,-1):""===t.action&&(null===(i=t.target)||void 0===i?void 0:i.startsWith("http"))&&this.ctx.eventHub.emit(jy.requestOpenUrl,t.target)}}function sg(t,e,i=5){return Math.abs(t-e)<=Math.pow(10,-i)}function ag(t){return Math.floor(1e6*t)/1e6}class lg{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const i=new lg;return i.point=t,i.slope=e,i}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return sg(this.slope,t.slope)?this.distanceToPoint(t.point):-1}distanceToPoint(t){let e=0;if(Math.tan(this.slope)*(t.x-this.point.x)+this.point.y===t.y)return 0;e=this.slope>=Math.PI/2?this.slope-Math.PI/2:Math.PI/2+this.slope;const i=lg.fromPointSlope(t,e),n=this.crossPoint(i);return n?Math.ceil(Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))):0}crossPoint(t){if(sg(t.slope,this.slope))return null;let e=0,i=0;const n=Math.tan(t.slope),r=Math.tan(this.slope),{x:o,y:s}=this.point,{x:a,y:l}=t.point;return sg(this.slope,Math.PI/2)?(e=this.point.x,i=n*(e-a)+l):sg(t.slope,Math.PI/2)?(e=t.point.x,i=r*(e-o)+s):sg(this.slope,Math.PI)||sg(this.slope,0)?(i=this.point.y,e=(i-l)/n+a):sg(t.slope,Math.PI)||sg(t.slope,0)?(i=t.point.y,e=(i-s)/r+o):(e=(n*a-l+s-r*o)/(n-r),i=r*(e-o)+s),{x:e,y:i}}}class hg{constructor(t,e,i){var n,r,o,s,a,l;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new Lh.j(0,0,1,1),this.pptX=0,this.pptY=0,this.presetSubType=0,this.designWidth=0,this.designHeight=0,this.designX=0,this.designY=0,this.hasPreset=!1,this.container=new Oh.b,this.animationFilterQueue=[],this.ctx=e,this.style=new rg(this.container,!!t.hardHidden,t.rotation||0),this.designGlobalPosition={x:i.parentGlobalPos.x+(null!==(r=null===(n=t.position)||void 0===n?void 0:n.x)&&void 0!==r?r:0),y:i.parentGlobalPos.y+(null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)},(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new og(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(l=this.hyperlink)||void 0===l||l.addAction(t.hlinkClick,"click"))),this.ctx.clock.waitUntil(()=>{try{return!!this.container.width}catch(t){return!1}},3e3).then(()=>{try{this.designWidth=this.designWidth||this.container.width}catch(t){}}),this.ctx.clock.waitUntil(()=>{try{return!!this.container.height}catch(t){return!1}},3e3).then(()=>{try{this.designHeight=this.designHeight||this.container.height}catch(t){}})}updateScale(){this.container&&(this.container.scale.x=this.designScale.x*this.scaleExt.x*this.scaleOrigin.x,this.container.scale.y=this.designScale.y*this.scaleExt.y*this.scaleOrigin.y)}updateTransform(t){var e,i,n,r,o,s,a,l;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(i=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,this.designY=null!==(r=null===(n=t.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0;const h=this.designWidth/2,u=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=h,this.container.pivot.y=u;const c=null!==(s=null===(o=t.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0,d=null!==(l=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==l?l:0;this.container.x=c+h,this.container.y=d+u,t.scale&&(this.designScale={x:t.scale.x,y:t.scale.y},this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y),t.rotation&&(this.container.rotation=t.rotation);const p=new Jd;p.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(p),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=c,this.bound.y=d,this.bound.width=this.designWidth,this.bound.height=this.designHeight}addToAnimationFilterQueue(t){this.animationFilterQueue.push(t)}removeAnimationFilterQueue(t){const e=this.animationFilterQueue.findIndex(e=>e===t);e<0||this.animationFilterQueue.splice(e,1)}getFirstAnimationFilter(){return this.animationFilterQueue.length>0?this.animationFilterQueue[0]:null}get scale(){return this.scaleOrigin}set scale(t){this.scaleOrigin.x=t.x,this.scaleOrigin.y=t.y,this.updateScale()}get design_ppt_w(){return ag(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return ag((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return ag(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return ag(this.designY/this.ctx.stageHeight)}get ppt_w(){return this.scaleExt.x*this.scaleOrigin.x*this.designWidth/this.ctx.stageWidth}set ppt_w(t){this.designWidth&&(this.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale())}get ppt_h(){const t=this.designHeight||this.container.height;return this.scaleExt.y*this.scaleOrigin.y*t/this.ctx.stageHeight}set ppt_h(t){this.designHeight&&(this.scaleExt.y=t*this.ctx.stageHeight/this.designHeight,this.updateScale())}get ppt_x(){return(this.container.position.x-this.container.pivot.x)/this.ctx.stageWidth}set ppt_x(t){this.pptX=t;const e=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=t*this.ctx.stageWidth+this.container.pivot.x*e}get ppt_y(){return(this.container.position.y-this.container.pivot.y)/this.ctx.stageHeight}set ppt_y(t){this.pptY=t;const e=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=t*this.ctx.stageHeight+this.container.pivot.y*e}get r(){return this.container.rotation}set r(t){this.container.rotation=t}set xshear(t){this.container.skew.x=t}get xshear(){return this.container.skew.x}set yshear(t){this.container.skew.y=t}get yshear(){return this.container.skew.y}}var ug=i(112),cg=i.n(ug);class dg{constructor(t){if(this._isInit=!1,this.h=0,this.s=0,this.l=0,this.a=1,t){this._isInit=!0;const e=t.match(/-?[0-9]+/g);e&&(this.h=parseInt(e[0],10),this.s=parseInt(e[1],10)/100,this.l=parseInt(e[2],10)/100)}}isInit(){return this._isInit}by(t,e){e.h=Math.max(Math.min(this.h+t.h,359),0),e.s=Math.max(Math.min(this.s+t.s,1),0),e.l=Math.max(Math.min(this.l+t.l,1),0),e.a=Math.max(Math.min(this.a+t.a,1),0)}fromHexString(t){const[e,i,n,r]=mg(t);let o=0,s=0,a=0;const l=Math.max(e,i,n),h=Math.min(e,i,n),u=l-h;a=(l+h)/2,0===u?o=0:l===e?o=(i-n)/u%6*60:l===i?o=60*((n-e)/u+2):l===n&&(o=60*((e-i)/u+4)),s=0===u?0:u/(1-Math.abs(2*a-1)),this.h=o,this.s=s,this.l=a,this.a=r}interpolationFrom(t,e,i){const n=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,o=t.l+(this.l-t.l)*e,s=t.a+(this.a-t.a)*e;i.h=Math.max(Math.min(n,359),0),i.s=Math.max(Math.min(r,1),0),i.l=Math.max(Math.min(o,1),0),i.a=Math.max(Math.min(s,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:i,l:n}=this;if(e<360&&e>=0&&i<=1&&i>=0&&n<=1&&n>=0){let r,o,s;const a=(1-Math.abs(2*n-1))*i,l=a*(1-Math.abs(e/60%2-1)),h=n-a/2;[r,o,s]=e>=0&&e<60?[a,l,0]:e>=60&&e<120?[l,a,0]:e>=120&&e<180?[0,a,l]:e>=180&&e<240?[0,l,a]:e>=240&&e<300?[l,0,a]:[a,0,l],t=[r+h,o+h,s+h,this.a]}return gg(t)}}class pg{constructor(t){this._isInit=!1,this.r=0,this.g=0,this.b=0,this.a=0,t&&(this._isInit=!0,this.fromHexString(t))}fromHexString(t){const[e,i,n,r]=mg(t);this.r=e,this.g=i,this.b=n,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,i){i.r=t.r+(this.r-t.r)*e,i.g=t.g+(this.g-t.g)*e,i.b=t.b+(this.b-t.b)*e,i.a=t.a+(this.a-t.a)*e}by(t,e){e.r=Math.min(Math.max(this.r+t.r,0),255),e.g=Math.min(Math.max(this.g+t.g,0),255),e.b=Math.min(Math.max(this.b+t.b,0),255),e.a=Math.min(Math.max(this.a+t.a,0),1)}toHexString(){return gg([this.r,this.g,this.b,this.a])}}function fg(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function mg(t){return 0===(t=t.replace(/^#/,"")).substring(6,8).length&&(t+="FF"),[parseInt(t.substring(0,2).padStart(8,"0"),16)/255,parseInt(t.substring(2,4).padStart(8,"0"),16)/255,parseInt(t.substring(4,6).padStart(8,"0"),16)/255,parseInt(t.substring(6,8).padStart(8,"0"),16)/255]}function gg(t){return"#"+Math.round(255*t[0]).toString(16).padStart(2,"0")+Math.round(255*t[1]).toString(16).padStart(2,"0")+Math.round(255*t[2]).toString(16).padStart(2,"0")+Math.round(255*t[3]).toString(16).padStart(2,"0")}function vg(t,e,i){const n=mg(t),r=mg(e),o=Math.round(255*(n[0]+(r[0]-n[0])*i)),s=Math.round(255*(n[1]+(r[1]-n[1])*i)),a=Math.round(255*(n[2]+(r[2]-n[2])*i)),l=Math.round(255*(n[3]+(r[3]-n[3])*i));return"#"+o.toString(16).padStart(2,"0")+s.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")}class _g extends Vh.k{constructor(){super(void 0,"\nvarying vec2 vTextureCoord;\n\nuniform vec4 color;\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n\n if (texColor.a > 0.0) {\n vec4 resultColor = color;\n resultColor = resultColor * texColor.a;\n gl_FragColor = resultColor;\n } else {\n gl_FragColor = texColor;\n }\n}\n",{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF",this.designColor="#FFFFFFFF"}set color(t){this.currentColor=t;const e=mg(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const yg=new rm.ColorMatrixFilter;yg.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const xg=new rm.ColorMatrixFilter;xg.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const bg=new rm.ColorMatrixFilter;bg.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Tg=new rm.ColorMatrixFilter;Tg.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const Eg={darken:yg,darkenLess:xg,lightenLess:Tg,lighten:bg};class Sg extends hg{constructor(t,e,i){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,i),this.fillColorFilter=new _g,this.fill=new ng(this),this.json=t,this.ctx=e,this.parentGlobalPos=i.parentGlobalPos,this.global={x:i.parentGlobalPos.x+t.x,y:i.parentGlobalPos.y+t.y},this.updateTransform({position:{x:t.x,y:t.y},width:t.width,height:t.height})}get fillActive(){var t,e;return(null!==(e=null===(t=this.container.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,i;t?(null!==(i=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==i?i:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}clearOnSlideChange(){}initOnReuse(){}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(t){const e=t*this.ctx.stageWidth-this.global.x,i=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*i}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,i=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*i}get design_ppt_x(){return ag(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return ag(this.global.y/this.ctx.stageHeight)}}class wg{constructor(t,e,i,n,r,o,s,a,l,h,u){this.ctx=t,this.type=e,this.lineWidth=i,this.width=n,this.height=r,this.fillColor=o,this.isHorz=s,this.renderContainer=new Oh.b,this.ghcTextureId=`${a}-text-p${l}-l${h}-u${u}-underLine`}createPaths(){if("ww"===this.type)return null;{let t=`M 0,0 L ${9525*this.width},0`,[e,i]=[this.width,this.lineWidth];return this.isHorz||(t="M 0,0 L 0,"+9525*this.height,[e,i]=[this.lineWidth,this.height]),{paths:[{id:Mm(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:jm()(t)}],width:e,height:i}}}getLineStyle(){const t={width:this.lineWidth};return"dotted"===this.type&&(t.dash=""+this.lineWidth),t}preRender(){const t=this.createPaths();if(t){const{paths:e,width:i,height:n}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ctx.graphicsTexture.addGraphics(this.ghcTextureId,e,r,{x:0,y:0},i,n,this.getLineStyle(),this.ctx.objectPoolGroup,!1,null,this.fillColor)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new ep,this.sprite.texture=t.texture,this.sprite.pivot.x=t.pivot.x,this.sprite.scale.x=t.scale,this.sprite.scale.y=t.scale)}}destroy(){var t;null===(t=this.sprite)||void 0===t||t.destroy({texture:!0})}}const Ag=134217729;function Mg(t,e,i,n,r){let o,s,a,l,h=e[0],u=n[0],c=0,d=0;u>h==u>-h?(o=h,h=e[++c]):(o=u,u=n[++d]);let p=0;if(c<t&&d<i)for(u>h==u>-h?(s=h+o,a=o-(s-h),h=e[++c]):(s=u+o,a=o-(s-u),u=n[++d]),o=s,0!==a&&(r[p++]=a);c<t&&d<i;)u>h==u>-h?(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=e[++c]):(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=n[++d]),o=s,0!==a&&(r[p++]=a);for(;c<t;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=e[++c],o=s,0!==a&&(r[p++]=a);for(;d<i;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=n[++d],o=s,0!==a&&(r[p++]=a);return 0===o&&0!==p||(r[p++]=o),p}function Cg(t,e){let i=e[0];for(let n=1;n<t;n++)i+=e[n];return i}function Rg(t){return new Float64Array(t)}const Ig=Rg(4),Pg=Rg(8),Og=Rg(12),Ng=Rg(16),Lg=Rg(4);function Dg(t,e,i,n,r,o){const s=(e-o)*(i-r),a=(t-r)*(n-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const h=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*h?l:-function(t,e,i,n,r,o,s){let a,l,h,u,c,d,p,f,m,g,v,_,y,x,b,T,E,S;const w=t-r,A=i-r,M=e-o,C=n-o;x=w*C,d=Ag*w,p=d-(d-w),f=w-p,d=Ag*C,m=d-(d-C),g=C-m,b=f*g-(x-p*m-f*m-p*g),T=M*A,d=Ag*M,p=d-(d-M),f=M-p,d=Ag*A,m=d-(d-A),g=A-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,c=b-v,Ig[0]=b-(v+c)+(c-E),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,Ig[1]=y-(v+c)+(c-T),S=_+v,c=S-_,Ig[2]=_-(S-c)+(v-c),Ig[3]=S;let R=Cg(4,Ig),I=22204460492503146e-32*s;if(R>=I||-R>=I)return R;if(c=t-w,a=t-(w+c)+(c-r),c=i-A,h=i-(A+c)+(c-r),c=e-M,l=e-(M+c)+(c-o),c=n-C,u=n-(C+c)+(c-o),0===a&&0===l&&0===h&&0===u)return R;if(I=11093356479670487e-47*s+33306690738754706e-32*Math.abs(R),R+=w*u+C*a-(M*h+A*l),R>=I||-R>=I)return R;x=a*C,d=Ag*a,p=d-(d-a),f=a-p,d=Ag*C,m=d-(d-C),g=C-m,b=f*g-(x-p*m-f*m-p*g),T=l*A,d=Ag*l,p=d-(d-l),f=l-p,d=Ag*A,m=d-(d-A),g=A-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,c=b-v,Lg[0]=b-(v+c)+(c-E),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,Lg[1]=y-(v+c)+(c-T),S=_+v,c=S-_,Lg[2]=_-(S-c)+(v-c),Lg[3]=S;const P=Mg(4,Ig,4,Lg,Pg);x=w*u,d=Ag*w,p=d-(d-w),f=w-p,d=Ag*u,m=d-(d-u),g=u-m,b=f*g-(x-p*m-f*m-p*g),T=M*h,d=Ag*M,p=d-(d-M),f=M-p,d=Ag*h,m=d-(d-h),g=h-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,c=b-v,Lg[0]=b-(v+c)+(c-E),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,Lg[1]=y-(v+c)+(c-T),S=_+v,c=S-_,Lg[2]=_-(S-c)+(v-c),Lg[3]=S;const O=Mg(P,Pg,4,Lg,Og);x=a*u,d=Ag*a,p=d-(d-a),f=a-p,d=Ag*u,m=d-(d-u),g=u-m,b=f*g-(x-p*m-f*m-p*g),T=l*h,d=Ag*l,p=d-(d-l),f=l-p,d=Ag*h,m=d-(d-h),g=h-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,c=b-v,Lg[0]=b-(v+c)+(c-E),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,Lg[1]=y-(v+c)+(c-T),S=_+v,c=S-_,Lg[2]=_-(S-c)+(v-c),Lg[3]=S;const N=Mg(O,Og,4,Lg,Ng);return Ng[N-1]}(t,e,i,n,r,o,h)}Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(8),Rg(8),Rg(8),Rg(4),Rg(8),Rg(8),Rg(8),Rg(12);Rg(192),Rg(192);Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(4),Rg(4),Rg(4),Rg(8),Rg(16),Rg(16),Rg(16),Rg(32),Rg(32),Rg(48),Rg(64);Rg(1152),Rg(1152);Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(1152),Rg(1152),Rg(1152),Rg(1152),Rg(1152),Rg(2304),Rg(2304),Rg(3456),Rg(5760),Rg(8),Rg(8),Rg(8),Rg(16),Rg(24),Rg(48),Rg(48),Rg(96),Rg(192),Rg(384),Rg(384),Rg(384),Rg(768);Rg(96),Rg(96),Rg(96),Rg(1152);const Fg=Math.pow(2,-52),Bg=new Uint32Array(512);class Ug{static from(t,e=Vg,i=Xg){const n=t.length,r=new Float64Array(2*n);for(let o=0;o<n;o++){const n=t[o];r[2*o]=e(n),r[2*o+1]=i(n)}return new Ug(r)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*i),this._halfedges=new Int32Array(3*i),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:i,_hullTri:n,_hullHash:r}=this,o=t.length>>1;let s=1/0,a=1/0,l=-1/0,h=-1/0;for(let e=0;e<o;e++){const i=t[2*e],n=t[2*e+1];i<s&&(s=i),n<a&&(a=n),i>l&&(l=i),n>h&&(h=n),this._ids[e]=e}const u=(s+l)/2,c=(a+h)/2;let d,p,f,m=1/0;for(let e=0;e<o;e++){const i=kg(u,c,t[2*e],t[2*e+1]);i<m&&(d=e,m=i)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<o;e++){if(e===d)continue;const i=kg(g,v,t[2*e],t[2*e+1]);i<m&&i>0&&(p=e,m=i)}let _=t[2*p],y=t[2*p+1],x=1/0;for(let e=0;e<o;e++){if(e===d||e===p)continue;const i=Hg(g,v,_,y,t[2*e],t[2*e+1]);i<x&&(f=e,x=i)}let b=t[2*f],T=t[2*f+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];jg(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let i=0;for(let t=0,n=-1/0;t<o;t++){const r=this._ids[t];this._dists[r]>n&&(e[i++]=r,n=this._dists[r])}return this.hull=e.subarray(0,i),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Dg(g,v,_,y,b,T)<0){const t=p,e=_,i=y;p=f,_=b,y=T,f=t,b=e,T=i}const E=function(t,e,i,n,r,o){const s=i-t,a=n-e,l=r-t,h=o-e,u=s*s+a*a,c=l*l+h*h,d=.5/(s*h-a*l);return{x:t+(h*u-a*c)*d,y:e+(s*c-l*u)*d}}(g,v,_,y,b,T);this._cx=E.x,this._cy=E.y;for(let e=0;e<o;e++)this._dists[e]=kg(t[2*e],t[2*e+1],E.x,E.y);jg(this._ids,this._dists,0,o-1),this._hullStart=d;let S=3;i[d]=e[f]=p,i[p]=e[d]=f,i[f]=e[p]=d,n[d]=0,n[p]=1,n[f]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=p,r[this._hashKey(b,T)]=f,this.trianglesLen=0,this._addTriangle(d,p,f,-1,-1,-1);for(let o,s,a=0;a<this._ids.length;a++){const l=this._ids[a],h=t[2*l],u=t[2*l+1];if(a>0&&Math.abs(h-o)<=Fg&&Math.abs(u-s)<=Fg)continue;if(o=h,s=u,l===d||l===p||l===f)continue;let c=0;for(let t=0,e=this._hashKey(h,u);t<this._hashSize&&(c=r[(e+t)%this._hashSize],-1===c||c===i[c]);t++);c=e[c];let m,g=c;for(;m=i[g],Dg(h,u,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===c){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,l,i[g],-1,-1,n[g]);n[l]=this._legalize(v+2),n[g]=v,S++;let _=i[g];for(;m=i[_],Dg(h,u,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,l,m,n[l],-1,n[_]),n[l]=this._legalize(v+2),i[_]=_,S--,_=m;if(g===c)for(;m=e[g],Dg(h,u,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,l,g,-1,n[g],n[m]),this._legalize(v+2),n[m]=v,i[g]=g,S--,g=m;this._hullStart=e[l]=g,i[g]=e[_]=l,i[l]=_,r[this._hashKey(h,u)]=l,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(S);for(let t=0,e=this._hullStart;t<S;t++)this.hull[t]=e,e=i[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const i=t/(Math.abs(t)+Math.abs(e));return(e>0?3-i:1+i)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:i,coords:n}=this;let r=0,o=0;for(;;){const s=i[t],a=t-t%3;if(o=a+(t+2)%3,-1===s){if(0===r)break;t=Bg[--r];continue}const l=s-s%3,h=a+(t+1)%3,u=l+(s+2)%3,c=e[o],d=e[t],p=e[h],f=e[u];if(Gg(n[2*c],n[2*c+1],n[2*d],n[2*d+1],n[2*p],n[2*p+1],n[2*f],n[2*f+1])){e[t]=f,e[s]=c;const n=i[u];if(-1===n){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,n),this._link(s,i[o]),this._link(o,u);const a=l+(s+1)%3;r<Bg.length&&(Bg[r++]=a)}else{if(0===r)break;t=Bg[--r]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,i,n,r,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=e,this._triangles[s+2]=i,this._link(s,n),this._link(s+1,r),this._link(s+2,o),this.trianglesLen+=3,s}}function kg(t,e,i,n){const r=t-i,o=e-n;return r*r+o*o}function Gg(t,e,i,n,r,o,s,a){const l=t-s,h=e-a,u=i-s,c=n-a,d=r-s,p=o-a,f=u*u+c*c,m=d*d+p*p;return l*(c*m-f*p)-h*(u*m-f*d)+(l*l+h*h)*(u*p-c*d)<0}function Hg(t,e,i,n,r,o){const s=i-t,a=n-e,l=r-t,h=o-e,u=s*s+a*a,c=l*l+h*h,d=.5/(s*h-a*l),p=(h*u-a*c)*d,f=(s*c-l*u)*d;return p*p+f*f}function jg(t,e,i,n){if(n-i<=20)for(let r=i+1;r<=n;r++){const n=t[r],o=e[n];let s=r-1;for(;s>=i&&e[t[s]]>o;)t[s+1]=t[s--];t[s+1]=n}else{let r=i+1,o=n;zg(t,i+n>>1,r),e[t[i]]>e[t[n]]&&zg(t,i,n),e[t[r]]>e[t[n]]&&zg(t,r,n),e[t[i]]>e[t[r]]&&zg(t,i,r);const s=t[r],a=e[s];for(;;){do{r++}while(e[t[r]]<a);do{o--}while(e[t[o]]>a);if(o<r)break;zg(t,r,o)}t[i+1]=t[o],t[o]=s,n-r+1>=o-i?(jg(t,e,r,n),jg(t,e,i,o-1)):(jg(t,e,i,o-1),jg(t,e,r,n))}}function zg(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Vg(t){return t[0]}function Xg(t){return t[1]}function Wg(t,e,i){let n=null;const r=new Oh.b;if(t.stopList.sort((t,e)=>t.pos-e.pos),!t.stopList.find(t=>0===t.pos)){const e=t.stopList[0];t.stopList.unshift({pos:0,color:e.color})}if(!t.stopList.find(t=>1===t.pos)){const e=t.stopList[t.stopList.length-1];t.stopList.push({pos:1,color:e.color})}const o=t=>{const e=[];for(let i=0,n=t.length;i<n-1;i++){const n=t[i],r=t[i+1],o=n.pos+.5*(r.pos-n.pos),s=vg(n.color,r.color,.5),a=2*i;e[a]=n,e[a+1]={color:s,pos:o},e[a+2]=r}return e};if(t.stopList=o(t.stopList),t.stopList=o(t.stopList),n=t.line?Yg(t,e,i):t.path?function(t,e,i){var n,r,o;const s=[],a={x:0,y:0};if("circle"===(null===(n=t.path)||void 0===n?void 0:n.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(o=t.path)||void 0===o?void 0:o.path)){const n=e/2,r=i/2,o=Math.sqrt(n*n+r*r);t.stopList.forEach(t=>{if(0===t.pos)s.push({point:{x:0,y:0},color:t.color});else{const e=o*t.pos,i=new zs;i.absellipse(0,0,e,e,0,2*Math.PI,!1,0),i.getPoints(50).forEach(e=>{s.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=n,a.y=r})}return{points:s,position:a}}(t,e,i):Yg(t,e,i),n){const t=[],o=[],{position:s,points:a}=n,l=Ug.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<l.triangles.length;e+=3)t.push(a[l.triangles[e]].point.x,a[l.triangles[e]].point.y),t.push(a[l.triangles[e+1]].point.x,a[l.triangles[e+1]].point.y),t.push(a[l.triangles[e+2]].point.x,a[l.triangles[e+2]].point.y),o.push(...mg(a[l.triangles[e]].color)),o.push(...mg(a[l.triangles[e+1]].color)),o.push(...mg(a[l.triangles[e+2]].color));const h=new Vh.l;h.addAttribute("aVertexPosition",t,2),h.addAttribute("aColor",o,4);const u=Vh.r.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec4 aColor;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec4 vColor;\n void main() {\n vColor = aColor;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","precision mediump float; \n varying vec4 vColor;\n void main() {\n float alpha = vColor.a;\n vec4 color = vColor;\n color.a = 1.0;\n gl_FragColor = color * alpha;\n }\n "),c=new Jd;c.drawRect(0,0,e+1,i+1),r.mask=c,r.addChild(c);const d=new Dp.a(h,u);d.position.x=s.x,d.position.y=s.y,r.addChild(d)}return r}function Yg(t,e,i){const n=e/2,r=i/2,o=[{x:-n,y:r},{x:-n,y:-r},{x:n,y:r},{x:n,y:-r}],s=[lg.fromPointSlope({x:-n,y:0},Math.PI/2),lg.fromPointSlope({x:0,y:r},0),lg.fromPointSlope({x:n,y:0},Math.PI/2),lg.fromPointSlope({x:0,y:-r},0)],a=[],l=t.stopList.slice(1,t.stopList.length-1).map(o=>{var l,h,u;const c=2*Math.PI;let d=null!==(h=null===(l=t.line)||void 0===l?void 0:l.ang)&&void 0!==h?h:0;for(;d>c;)d-=c;for(;d<0;)d+=c;const p={x:0,y:0};sg(d,Math.PI/2)?(p.x=0,p.y=i/2-o.pos*i):sg(d,0)?(p.x=o.pos*e-e/2,p.y=0):(p.x=o.pos*e-e/2,p.y=i/2-o.pos*i),d>Math.PI/2&&d<=Math.PI&&(p.x*=-1),d>Math.PI&&d<=2*Math.PI&&(p.y*=-1);const f=lg.fromPointSlope(p,Math.PI/2-((null===(u=t.line)||void 0===u?void 0:u.ang)||0)),m=s.map(t=>f.crossPoint(t)).filter(t=>t&&t.x<=n&&t.x>=-n&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:o.color})).sort((t,e)=>e.point.y-t.point.y);a.push(...m);let g=Math.abs(m[1].point.x-m[0].point.x)/10;for(let t=20;t--;){const e=t%2==0?1:-1,i=p.x+e*g,s=f.resolveY(i);i<=n&&i>=-n&&s<=r&&s>=-r&&a.push({point:{x:i,y:s},color:o.color}),g+=g}return f});let h=[],u=[];t:for(let e=0;e<o.length;e++){const i=o[e];for(let e=0;e<l.length-1;e++){const n=l[e],r=l[e+1],o=n.distanceToLinearEquation(r),s=n.distanceToPoint(i),h=r.distanceToPoint(i);if(s<o&&h<o){const n=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],l=vg(n.color,r.color,s/o);a.splice(e+1,0,{point:i,color:l});continue t}}const n=l[0],r=l[l.length-1],s=n.distanceToPoint(i),c=r.distanceToPoint(i);s<=c?h.push({point:i,dis:s}):u.push({point:i,dis:c})}h=h.sort((t,e)=>e.dis-t.dis);const c=h.map((e,i)=>{if(0===i)return{point:e.point,color:t.stopList[0].color};{const i=t.stopList[0].color,n=t.stopList[1].color;return{point:e.point,color:vg(i,n,1-(0===h[0].dis?1:e.dis/h[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);u=u.sort((t,e)=>e.dis-t.dis);const d=u.map((e,i)=>{if(0===i)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const i=t.stopList[t.stopList.length-2].color,n=t.stopList[t.stopList.length-1].color;return{point:e.point,color:vg(i,n,0===u[0].dis?0:e.dis/u[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),p=c.concat(...a).concat(d);for(let t=0;t<p.length;t++)p[t].point.x+=n,p[t].point.y=-p[t].point.y+r;return{points:p,position:{x:0,y:0}}}const qg="\nvec3 rgb2hsl(vec3 rgb) {\n float cMax = max(max(rgb.r, rgb.g), rgb.b);\n float cMin = min(min(rgb.r, rgb.g), rgb.b);\n float delta = cMax - cMin;\n \n float h = 0.0;\n if (delta == 0.0) {\n h = 0.0;\n } else if (cMax == rgb.r) {\n h = 60.0 * mod(((rgb.g - rgb.b) / delta), 6.0);\n } else if (cMax == rgb.g ) {\n h = 60.0 * ((rgb.b - rgb.r) / delta + 2.0);\n } else if (cMax == rgb.b) {\n h = 60.0 * ((rgb.r - rgb.g) / delta + 4.0);\n }\n \n float l = (cMax + cMin) / 2.0;\n \n float s = 0.0;\n if (delta == 0.0) {\n s = 0.0;\n } else {\n s = delta / (1.0 - abs(2.0 * l - 1.0));\n }\n \n return vec3(h, s, l);\n}\n",Zg=[qg],Jg={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n mat3 rgb2yuv = mat3(\n 0.2126, 0.7152, 0.0722,\n -0.09991, -0.33609, 0.43600,\n 0.615, -0.5586, -0.05639\n );\n vec3 yuv = texColor.rgb * rgb2yuv;\n if (yuv.x >= 0.49 || texColor.a < 0.9) {\n return vec4(1.0, 1.0, 1.0, 1.0) * texColor.a;\n } else {\n return vec4(0.0, 0.0, 0.0, 1.0) * texColor.a;\n }\n}\n",alphaModFix:"\nvec4 transform(vec4 texColor, float arg) {\n return texColor * arg;\n}\n",alphaBiLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a < arg) {\n result.a = 0.0;\n } else {\n result.a = 1.0;\n }\n return result;\n}\n",alphaCeiling:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a > 0.0) {\n result.a = 1.0;\n }\n return result;\n}\n",alphaFloor:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a < 1.0) {\n result.a = 0.0;\n }\n return result;\n}\n",grayscl:"\nvec4 transform(vec4 texColor, float arg) {\n float avg = (texColor.r + texColor.g + texColor.b) / 3.0;\n return vec4(avg, avg, avg, texColor.a);\n}\n"};class Kg extends Vh.k{constructor(t,e){var i;super(void 0,(i=Jg[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${Zg.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const Qg=[qg],$g={clrChange:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float epsilon = 0.001;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= arg2.a;\n return arg2;\n } else {\n return texColor;\n }\n}\n",changeBulletColor:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n if (texColor.a == 0.0) {\n return texColor;\n } else {\n return arg2;\n }\n}\n",duotone:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float avg = (texColor.r + texColor.g + texColor.b) / 3.0;\n\n vec3 hsl = rgb2hsl(vec3(avg, avg, avg));\n\n vec3 result = arg2.rgb * hsl.z + arg1.rgb * (1.0 - hsl.z);\n\n return vec4(result * texColor.a, texColor.a);\n}\n"};class tv extends Vh.k{constructor(t,e,i){var n;super(void 0,(n=$g[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${Qg.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(i)})}}const ev=[qg],iv={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n vec3 rgb = texColor.rgb / texColor.a;\n\n // 对比度\n highp float C = arg2 * 255.0;\n highp float F = (259.0 * (255.0 + C)) / (255.0 * (259.0 - C));\n rgb.rgb = F * (rgb.rgb - 0.5) + 0.5;\n\n // 亮度\n rgb.rgb += arg1;\n\n rgb.rgb *= texColor.a;\n return vec4(rgb, texColor.a);\n}\n"};class nv extends Vh.k{constructor(t,e,i){var n;super(void 0,(n=iv[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${ev.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:e,arg2:i})}}const rv=[qg],ov={alphaInv:"\nvec4 transform(vec4 texColor, vec4 arg1) {\n float alpha = 1.0 - texColor.a;\n arg1.rgb = arg1.rgb * alpha;\n arg1.a = alpha;\n return arg1;\n}\n"};class sv extends Vh.k{constructor(t,e){var i;super(void 0,(i=ov[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform sampler2D uSampler;\n\n${rv.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1);\n}\n`),{arg1:Float32Array.from(e)})}}class av{constructor(t,e,i,n,r){this.ctx=t,this.fillStyle=e,this.width=i,this.height=n,this.config=r,this.clonedObjects=[],this._displayObject=null,this.gradientHash=jm()(`${JSON.stringify(e)}${Math.ceil(i)}${Math.ceil(n)}`)}get displayObject(){return this._displayObject||(this._displayObject=this.createDisplayObject()),this._displayObject}set displayObject(t){this._displayObject&&this._displayObject.destroy({children:!0,texture:!0}),this._displayObject=t}get hasFill(){return!!this.fillStyle&&"noFill"!==this.fillStyle.fillType}createDisplayObject(){var t;if(!this.fillStyle)return null;if(this.config.useSlideBackgroundFill&&this.ctx.bgTexture){const t=new ep;return t.texture=this.ctx.bgTexture,t}if("solidFill"===this.fillStyle.fillType||"noFill"===this.fillStyle.fillType)return null;if("gradientFill"===this.fillStyle.fillType){const t=new ep,e=Wg(JSON.parse(JSON.stringify(this.fillStyle)),this.width,this.height),i=Vh.p.create({width:this.width,height:this.height,resolution:this.ctx.renderer.resolution});return this.ctx.renderer.render(e,{renderTexture:i}),e.destroy({children:!0,texture:!0}),t.texture=i,t}if("blipFill"===this.fillStyle.fillType){const{src:e,filters:i}=this.fillStyle,n=this.ctx.spriteTexture.getTexture(e),r=this.ctx.spriteTexture.getFrameData(e);if(n){const e=new ep;if(e.texture=n,i.length>0&&this.config.useFilter&&(this.ctx.featureList||{}).filter&&(e.filters=function(t,e){const i=[];return t.forEach(t=>{const n=((null==e?void 0:e.filter)||[]).indexOf(t.type)>=0;if(["biLevel","alphaBiLevel","alphaCeiling","alphaModFix","alphaFloor","grayscl"].indexOf(t.type)>=0&&n)i.push(new Kg(t.type,t.args[0]||0));else if(["clrChange","changeBulletColor","duotone"].indexOf(t.type)>=0&&n){const e=mg(t.args[0]),n=mg(t.args[1]);i.push(new tv(t.type,e,n))}else if("lum"===t.type&&n)i.push(new nv(t.type,t.args[0],t.args[1]));else if("alphaInv"===t.type&&n){const e=mg(t.args[0]);i.push(new sv(t.type,e))}}),i}(i,this.ctx.featureList)),this.config.fillFloat){const{l:i,t:n,r:r,b:o}=this.config.fillFloat.fillRect,s=this.width*(1-i-r),a=this.height*(1-n-o),l=null!==(t=this.config.shapeRotation)&&void 0!==t?t:0,h=new Jd;h.drawRect(0,0,s,a),h.pivot.x=s/2,h.pivot.y=a/2,h.rotation=l;const u=h.getBounds(),c=u.width,d=u.height;e.width=c,e.height=d,e.anchor.x=.5,e.anchor.y=.5,e.rotation=-1*l,e.name="math-texture",0===l?(e.position.x=c/2+i*this.width,e.position.y=d/2+n*this.height):(e.position.x=this.width/2,e.position.y=this.height/2)}else e.width=this.width,e.height=this.height,r.rotate&&(e.position.x=this.width/2,e.position.y=this.height/2,e.anchor.x=.5,e.anchor.y=.5,e.rotation=r.rotate/180*Math.PI);return e}}else if("gifFill"===this.fillStyle.fillType){const{src:t,delays:e}=this.fillStyle,i=this.ctx.spriteTexture.getGifFrames(t).map((t,i)=>({texture:t,time:e[i]||20})),n=new im(i,!0);n.name=Mm(),n.width=this.width,n.height=this.height;const r=this.fillStyle.loop;let o=1;return n.onLoop=()=>{o+=1,r>0&&o>r&&n.gotoAndStop(n.totalFrames)},n}return null}isSolidFill(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)}getSolidFillColor(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)?this.fillStyle.color:"#000000"}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}class lv extends Vh.k{}var hv=i(113),uv=i.n(hv),cv=i(114),dv=i.n(cv);class pv extends lv{constructor(t){super(uv.a,dv.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uGlowColor:mg(t.color),uSdfSampler:Vh.t.WHITE,uSdfReady:0,uSdfMaxDis:0,uRad:t.rad/2,uSdfPosition:new Float32Array([0,0])}),this.priority=3,this.json=t}filterAreaJustify(t){const e=Math.ceil(this.json.rad),i=Math.ceil(t.width+2*e),n=Math.ceil(t.height+2*e);return new Lh.j(t.x-e,t.y-e,i,n)}sdfBox(t,e){const i=Math.ceil(this.json.rad),n=Math.ceil(t+2*i),r=Math.ceil(e+2*i);return new Lh.j(i,i,n,r)}}var fv=i(19),mv=i.n(fv),gv=i(115),vv=i.n(gv);class _v extends lv{constructor(t){super(mv.a,vv.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uRad:t.rad,uSdfSampler:Vh.t.WHITE,uSdfReady:0,uSdfMaxDis:1}),this.priority=2,this.json=t}filterAreaJustify(t){return t}sdfBox(t,e){return new Lh.j(0,0,t,e)}}class yv{}var xv=i(116),bv=i.n(xv);class Tv extends Vh.k{constructor(t){super(mv.a,bv.a,{uColor:mg(t)})}}class Ev extends yv{constructor(t,e,i){super(),this.order=1,this.outputTexture=Vh.t.WHITE,this.frameTextures=[],this.json=t,this.effectContainer=e,this.outputSprite=new ep,this.targetScale=i,this.outputSprite.scale.x=this.json.sx,this.outputSprite.scale.y=this.json.sy,this.outputSprite.skew.x=(this.targetScale.x>0?1:-1)*this.json.kx,this.outputSprite.skew.y=(this.targetScale.y>0?1:-1)*this.json.ky,this.outputSprite.filters=[new rm.BlurFilter(this.json.blurRad/2,4),new Tv(this.json.color)]}updateFrame(t){const e=this.frameTextures[t];if(e){const t=this.effectContainer.getBounds(),i=(this.effectContainer.width-e.width)/2,n=(this.effectContainer.height-e.height)/2,r=new Lh.g(t.x,t.y),o=new Lh.g(t.x,t.y);switch(this.json.align){case"tl":o.x=t.x,o.y=t.y;break;case"t":o.x=t.x+t.width/2,o.y=t.y,r.x+=t.width/2;break;case"tr":o.x=t.x+t.width,o.y=t.y,r.x+=t.width;break;case"l":o.x=t.x,o.y=t.y+t.height/2,r.y+=t.height/2;break;case"ctr":o.x=t.x+t.width/2,o.y=t.y+t.height/2,r.x+=t.width/2,r.y+=t.height/2;break;case"r":o.x=t.x+t.width,o.y=t.y+t.height/2,r.x+=t.width,r.y+=t.height/2;break;case"bl":o.x=t.x,o.y=t.y+t.height,r.y+=t.height;break;case"b":o.x=t.x+t.width/2,o.y=t.y+t.height,r.x+=t.width/2,r.y+=t.height;break;case"br":o.x=t.x+t.width,o.y=t.y+t.height,r.x+=t.width,r.y+=t.height}const s=this.effectContainer.toLocal(o);this.outputSprite.pivot.x=s.x,this.outputSprite.pivot.y=s.y;const a=new Lh.g(this.json.dist,0),l=new Lh.d;l.rotate(this.json.dir),l.translate(r.x+i,r.y+n),l.apply({x:a.x,y:a.y},a);const h=this.effectContainer.toLocal(a);this.outputSprite.position.x=h.x,this.outputSprite.position.y=h.y,this.outputSprite.texture=e}}createOutput(t,e){this.frameTextures[e]=t}setFrameOffset(t,e){}}var Sv=i(117),wv=i.n(Sv);class Av extends Vh.k{constructor(t,e){super(mv.a,wv.a,{uStartAlpha:t.startAlpha,uEndAlpha:t.endAlpha,uStartPos:t.startPos,uEndPos:t.endPos,uHeight:e}),console.log(this)}}class Mv extends yv{constructor(t,e,i,n,r){super(),this.order=2,this.outputSprite=new ep,this.outputTexture=Vh.t.WHITE,this.frameTextures=[],this.json=t,this.shapeScaleX=n,this.effectContainer=e,this.rotation=i,this.ctx=r,this.outputSprite.anchor.x=.5,this.outputSprite.anchor.y=.5;const o=this.effectContainer.getBounds();this.outputSprite.filters=[new rm.BlurFilter(this.json.blurRad/2,4),new Av(this.json,o.height)],this.outputSprite.alpha=.5,this.outputSprite.rotation=-1===this.shapeScaleX?Math.PI+2*this.rotation:Math.PI-2*this.rotation,this.outputSprite.scale.x=-1}updateFrame(t){const e=this.frameTextures[t];e&&(this.outputSprite.texture=e)}createOutput(t,e){this.frameTextures[e]=t}setFrameOffset(t,e){const i=this.effectContainer.getBounds(),n=new Lh.g(i.x+i.width/2,i.y+i.height/2),r=new Lh.g(n.x,n.y+i.height+this.json.dist),o=this.effectContainer.toLocal(r);this.outputSprite.position.x=o.x+t,this.outputSprite.position.y=o.y+e}}var Cv=i(118),Rv=i.n(Cv);class Iv extends lv{constructor(t){super(mv.a,Rv.a,{}),this.priority=1,this.json=t}filterAreaJustify(t){return t}sdfBox(){return null}}var Pv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Ov extends Za.a{constructor(t,e,i,n,r,o){super(),this.effects=[],this.attachs=[],this.frames=new Map,this._targetContainer=new Oh.b,this.frameCount=1,this.ctx=n,this.originWidth=t.width,this.originHeight=t.height,this.cacheKey=i,this.sourceSprite=new ep;for(const i of e)switch(i.type){case"innerShadow":this.effects.push(new Iv(i));break;case"softEdge":this.effects.push(new _v(i));break;case"glow":this.effects.push(new pv(i));break;case"reflection":this.attachs.push(new Mv(i,t,r,o.x,this.ctx));break;case"outerShadow":this.attachs.push(new Ev(i,t,o))}this.effects=this.effects.sort((t,e)=>t.priority-e.priority),this.attachs=this.attachs.sort((t,e)=>t.order-e.order);for(const t of this.attachs)this._targetContainer.addChild(t.outputSprite);this.sourceSprite.name="effect-sprite";const s=new Lh.j(0,0,this.originWidth,this.originHeight),a=this.effects.map(t=>t.filterAreaJustify(s)),l=a.map(t=>t.x),h=a.map(t=>t.y),u=a.map(t=>t.width),c=a.map(t=>t.height);this.filterArea=new Lh.j(Math.min(...l,0),Math.min(...h,0),Math.max(...u,this.originWidth),Math.max(...c,this.originHeight)),this.sourceSprite.filters=this.effects,this.sourceSprite.filterArea=new Lh.j(0,0,this.filterArea.width,this.filterArea.height),this._targetSprite=new ep,this._targetSprite.name="effect-sprite",this._targetContainer.sortableChildren=!0,this._targetSprite.zIndex=999,this._targetContainer.addChild(this._targetSprite)}get container(){return this._targetContainer}getSdfTexture(t,e){return Pv(this,void 0,void 0,(function*(){const i=`${this.cacheKey}_${t}`,n=this.effects.map(t=>({sdfRect:t.sdfBox(e.width,e.height)})).reduce((t,e)=>e.sdfRect?(t.width<e.sdfRect.width&&(t.width=e.sdfRect.width),t.height<e.sdfRect.height&&(t.height=e.sdfRect.height),t):t,new Lh.j(0,0));return 0===n.width||0===n.height?null:this.ctx.sdfManager.getSdf(e,n,i)}))}setFrameCount(t){this.frameCount=t}updateFrame(t){const e=this.frames.get(t);if(e){this._targetSprite.texture=e.texture,this._targetSprite.pivot.x=e.pivotX,this._targetSprite.pivot.y=e.pivotY;for(const e of this.attachs)e.updateFrame(t)}}hasFrame(t){return this.frames.has(t)}setFrameOffset(t,e){this._targetContainer.position.x=-1*t,this._targetContainer.position.y=-1*e,this.attachs.forEach(i=>i.setFrameOffset(t,e))}createFrame(t,e){var i,n;return Pv(this,void 0,void 0,(function*(){const r=e.width,o=e.height;if(this.frames.has(t))return;const s=yield this.getSdfTexture(t,e),a=null!==(i=null==s?void 0:s.texture.width)&&void 0!==i?i:0,l=null!==(n=null==s?void 0:s.texture.height)&&void 0!==n?n:0;for(const t of this.effects){const i=t.sdfBox(e.width,e.height);i&&s&&(t.uniforms.uSdfSampler=s.texture,t.uniforms.uSdfIsReady=1,t.uniforms.uSdfMaxDis=s.maxDis,t.uniforms.uSdfPosition=new Float32Array([(s.texture.width-i.width)/2/s.texture.width,(s.texture.height-i.height)/2/s.texture.height])),t.uniforms.uShapeFilterArea=new Float32Array([0,0,this.filterArea.width,this.filterArea.height])}this.sourceSprite.texture=e;const h=(this.filterArea.width-this.sourceSprite.width)/2,u=(this.filterArea.height-this.sourceSprite.height)/2;this.sourceSprite.x=h,this.sourceSprite.y=u;const c=Math.max(r,a,this.filterArea.width),d=Math.max(o,l,this.filterArea.height),p=Vh.p.create({width:c,height:d,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.sourceSprite,{renderTexture:p}),this.frames.set(t,{texture:p,pivotX:-1*(this.originWidth-c)/2,pivotY:-1*(this.originWidth-c)/2});for(const e of this.attachs)e.createOutput(p,t);Array.from(this.frames.keys()).length===this.frameCount&&this.emit("ready")}))}}var Nv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Lv extends Sg{constructor(t,e,i){var n;super(t,e,i),this.textureContainer=new Oh.b,this.underline=null,this.cacheSprite=new ep,this.effectContainer=new Oh.b,this.effectObject=null;const{shapeId:r,paragraphIndex:o,lineIndex:s,unitIndex:a,lineHeight:l,width:h,underLine:u,fill:c,height:d,isHorz:p,lineWidth:f}=t,m="solidFill"===(null===(n=null==c?void 0:c.fill)||void 0===n?void 0:n.fillType)?c.fill.color:null;if(u){const t=p?l/16:f/16;this.underline=new wg(e,u.type,t,h,d,m,p,r,o,s,a)}if(this.textGraphics=this.createTextGraphics(),this.textFill=this.createTextFill(),this.strokeGraphics=this.createStrokeGraphics(),this.strokeFill=this.createStrokeFill(),this.effectContainer.name="effect-container",this.effectContainer.zIndex=1,this.container.addChild(this.effectContainer),t.effectIndexList&&t.effectIndexList.length&&i.effectList){const{effectList:e}=i;this.effectList=t.effectIndexList.map(t=>{const i=e[t];return"outerShadow"===i.type&&i.dist>5&&(i.dist=5),e[t]}),this.ctx.slideScopeEventHub.once("slide-render",t=>{if(this.ctx.slideIndex===t&&this.effectObject){const t=this.getEffectTexture();if(t){const{texture:e,offsetX:i,offsetY:n}=t;this.effectObject.setFrameOffset(i,n),this.effectObject.createFrame(1,e)}}})}}getEffectTexture(){const{lineHeight:t,fillLineHeight:e,isHorz:i,lineWidth:n}=this.json,r=this.effectContainer.getLocalBounds();let o=0,s=0;for(const t of this.effectContainer.children)t.pivot.x>o&&(o=t.pivot.x),t.pivot.y>s&&(s=t.pivot.y);const a=new Lh.d;a.translate(o,s);const l=Vh.p.create({width:i?r.width:n,height:i?Math.max(e,t):r.height,resolution:2});return this.ctx.renderer.render(this.effectContainer,{renderTexture:l,transform:a}),{texture:l,offsetX:o,offsetY:s}}createStrokeFill(){const{stroke:t,lineWidth:e,lineHeight:i}=this.json;return new av(this.ctx,null==t?void 0:t.fill,e,i,{useFilter:!1,useSlideBackgroundFill:!1})}createStrokeGraphics(){const{stroke:t}=this.json,e=(null==t?void 0:t.key)?{fillType:"blipFill",src:t.key,filters:[]}:void 0;return new av(this.ctx,e,(null==t?void 0:t.width)||0,(null==t?void 0:t.height)||0,{useFilter:!1,useSlideBackgroundFill:!1})}createTextFill(){const{isHorz:t,fill:e,lineWidth:i,lineHeight:n,fillLineHeight:r}=this.json;return t?new av(this.ctx,null==e?void 0:e.fill,i,Math.max(r,n),{useFilter:!1,useSlideBackgroundFill:!1}):new av(this.ctx,null==e?void 0:e.fill,r,n,{useFilter:!1,useSlideBackgroundFill:!1})}createTextGraphics(){var t;const{fill:e,content:i}=this.json;let n="#000000";"solidFill"===(null===(t=null==e?void 0:e.fill)||void 0===t?void 0:t.fillType)&&(n=e.fill.color);const r=(null==e?void 0:e.key)?{fillType:"blipFill",src:e.key,filters:[{type:"changeBulletColor",args:["#000000",n]}]}:void 0;return new av(this.ctx,r,(null==e?void 0:e.width)||0,(null==e?void 0:e.height)||0,{useFilter:"◾"===i,useSlideBackgroundFill:!1})}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,i,n,r;const{isHorz:o}=this.json;t.position={x:o&&null!==(i=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,y:o?0:null!==(r=null===(n=t.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0},t.width=o?this.json.width:this.json.lineWidth,t.height=o?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){var t;null===(t=this.underline)||void 0===t||t.preRender()}render(t){t.addSubMTask(()=>Nv(this,void 0,void 0,(function*(){this.doRender()})),"@TextUnitImpl[doRender]"),t.addSubMTask(()=>Nv(this,void 0,void 0,(function*(){var t;if(this.effectList&&this.effectList.length>0){const e=`${this.ctx.taskId}_${this.ctx.slideIndex}_${null===(t=this.json.fill)||void 0===t?void 0:t.key}_${this.json.effectIndexList}`;this.effectObject=new Ov(this.effectContainer,this.effectList,e,this.ctx,0,new Lh.g(1,1)),this.effectObject.on("ready",()=>{var t;this.effectContainer.visible=!1,this.effectObject.container.zIndex=10,this.container.addChild(this.effectObject.container),null===(t=this.effectObject)||void 0===t||t.updateFrame(1)})}})),"@ShapeImpl[post.render]")}doRender(){let t=!1;const{lineWidth:e,lineHeight:i,baseLine:n,isHorz:r,underline:o,height:s,width:a,highlightColor:l,x:h,y:u,content:c,fillLineHeight:d,fill:p}=this.json;let f=!1!==this.json.needFill;if(p&&p.fill&&"solidFill"!==p.fill.fillType&&(f=!0),l){const t=new Jd,[n,o]=fg(l);t.beginFill(n,o),t.drawRect(0,0,r?a:e,r?i:s),t.endFill(),this.textureContainer.addChild(t)}if(this.textGraphics.displayObject){const e=this.textGraphics.displayObject;if(r&&(e.position.y=u>0?u:0),f){const i=this.textFill.displayObject;if(i)i.mask=e,i.addChild(e),i.position.x=-h,e.position.x+=h,t=!0,this.textureContainer.addChild(i);else if(this.textFill.isSolidFill()){const i=new _g;i.color=this.textFill.getSolidFillColor(),e.filters=[i],t=!0,this.textureContainer.addChild(e)}}else this.textureContainer.addChild(e)}if(this.strokeGraphics.displayObject){const e=this.strokeGraphics.displayObject;if(f){const i=this.strokeFill.displayObject;if(i)i.mask=e,i.addChild(e),r?i.position.y=u>0?u:0:i.position.x=h,this.textureContainer.addChild(i);else if(this.strokeFill.isSolidFill()){r?e.position.y=u>0?u:0:e.position.x=h;const i=new _g;i.color=this.strokeFill.getSolidFillColor(),e.filters=[i],t=!0,this.textureContainer.addChild(e)}}else r?e.position.y=u>0?u:0:e.position.x=h,this.textureContainer.addChild(e)}if(this.underline&&(this.underline.render(),this.underline.sprite)){r?(this.underline.sprite.position.y=o?o-i/16:n,this.underline.sprite.position.x=0):(this.underline.sprite.position.x=0,this.underline.sprite.position.y=0);const t=this.textFill.getClonedDisplayObject();t?(t.mask=this.underline.sprite,t.addChild(this.underline.sprite),this.textureContainer.addChild(t)):this.textureContainer.addChild(this.underline.sprite)}if(t){const t=Vh.p.create({width:r?a:e,height:r?Math.max(d,i):s,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.textureContainer,{renderTexture:t}),this.cacheSprite.texture=t,r&&u<0&&(this.cacheSprite.position.y=u),this.effectContainer.addChild(this.cacheSprite)}else this.effectContainer.addChild(this.textureContainer);this.container.name=c}destroy(){this.textFill.destroy(),this.textGraphics.destroy(),this.strokeFill.destroy(),this.strokeGraphics.destroy(),this.cacheSprite.texture.destroy(!0),this.cacheSprite.destroy(),this.textureContainer.destroy(),this.container.destroy()}}var Dv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Fv extends Sg{constructor(t,e,i){super(t,e,i),this.units=[],this.isHorz=!0,this.hyperLinkMap=new Map,this.hyperLinkContainerMap=new Map,this.effectList=[],i.effectList&&(this.effectList=i.effectList)}getIterateElements(){return this.units}getIterateEntry(t,e,i){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}preRender(){}createUnits(t,e,i,n){for(let r=0,o=this.json.textUnits.length;r<o;r++)n.addSubMTask(()=>Dv(this,void 0,void 0,(function*(){const n=this.json.textUnits[r],{height:o,width:s,fillHeight:a,baseline:l,y:h,underline:u}=this.json,c=new Lv(Object.assign(Object.assign({},n),{lineHeight:o,lineWidth:s,baseLine:l-h,underline:u,fillLineHeight:a||o,isHorz:this.isHorz,shapeId:t,paragraphIndex:e,lineIndex:i,unitIndex:r}),this.ctx,{parentGlobalPos:this.global,effectList:this.effectList});if(c.preRender(),this.units.push(c),n.hyperlink||n.hlinkHover){const t=new og(c.container,this.ctx);n.hyperlink&&t.addAction(n.hyperlink,"click"),n.hlinkHover&&t.addAction(n.hlinkHover,"hover"),this.container.sortableChildren=!0}})),"@TextLineImpl[createUnits]")}render(t){for(const e of this.units.reverse())e.render(t),t.addSubMTask(()=>Dv(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextLineImpl[container.addChild]")}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1}),this.hyperLinkMap.clear();for(const t of this.hyperLinkContainerMap.values())t.destroy({children:!0,baseTexture:!0,texture:!0});this.hyperLinkContainerMap.clear()}}var Bv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Uv extends Sg{constructor(t,e,i){super(t,e,i),this.iterateElements=[],this.lines=[],this.effectList=[],this.isHorz=!0,i.effectList&&(this.effectList=i.effectList)}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const t=this.lines.reduce((t,e)=>t=t.concat(e.getIterateElements()),[]);return this.iterateElements=t,t}getIterateEntry(t,e,i){const n=this.getIterateElements();return n[e]?n[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}preRender(){}createLines(t,e,i){for(let n=0,r=this.json.lines.length;n<r;n++)i.addSubMTask(()=>Bv(this,void 0,void 0,(function*(){const r=this.json.lines[n],o=new Fv(r,this.ctx,{parentGlobalPos:this.global,effectList:this.effectList});o.isHorz=this.isHorz,o.container.name="line-"+n,o.createUnits(t,e,n,i),this.lines.push(o)})),"@TextParagraphImpl[createLines]")}render(t){for(const e of this.lines)e.render(t),t.addSubMTask(()=>Bv(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextParagraphImpl[container.addChild]")}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}function kv(t,e,i){let n,r;const o=Math.round(t)%360;if(o%180==0)n=Math.cos(o*(Math.PI/180))*e,r=0;else if(o%90==0)n=0,r=-Math.sin(o*(Math.PI/180))*i;else{const t=Math.tan(o*Math.PI/180);n=e*i/Math.sqrt(Math.pow(i,2)+Math.pow(e*t,2)),(o>90&&o<270||o<-90&&o>-270)&&(n=-n),r=-t*n}return{x:n,y:r}}function Gv(t,e,i,n,r,o){const s=kv((r=-r)/Math.PI*180,i,n),a=t.x-s.x,l=t.y-s.y;return{centerX:a/9525*e.x,centerY:l/9525*e.y,rx:i/9525*e.x,ry:n/9525*e.y,st:-r,end:-r+o,aClockWise:o<0}}function Hv(t){const e=new zs,{scale:i}=t;let n={x:0,y:0};const r=t.path.trim().split(" ");for(let t=0;t<r.length;t+=2){const o=r[t],s=r[t+1];if("M"===o){let[t,r]=s.split(",").map(t=>Number(t));n={x:t,y:r},t=t/9525*i.x,r=r/9525*i.y,e.moveTo(t,r)}else if("A"===o){const[t,r,o,a]=s.split(",").map(t=>Number(t)),{centerX:l,centerY:h,rx:u,ry:c,st:d,end:p,aClockWise:f}=Gv(n,i,t,r,o,a);e.absellipse(l,h,u,c,d,p,f,0)}else if("L"===o){let[t,r]=s.split(",").map(t=>Number(t));n={x:t,y:r},t=t/9525*i.x,r=r/9525*i.y,e.lineTo(t,r)}else if("QB"===o){let[t,r,o,a]=s.split(",").map(t=>Number(t));n={x:o,y:a},t=t/9525*i.x,r=r/9525*i.y,o=o/9525*i.x,a=a/9525*i.y,e.quadraticCurveTo(t,r,o,a)}else if("CB"===o){let[t,r,o,a,l,h]=s.split(",").map(t=>Number(t));n={x:l,y:h},t=t/9525*i.x,r=r/9525*i.y,o=o/9525*i.x,a=a/9525*i.y,l=l/9525*i.x,h=h/9525*i.y,e.bezierCurveTo(t,r,o,a,l,h)}else if("C"===o)try{e.closePath()}catch(t){}}return e}function jv(t,e){return t.curves.map(t=>t.getPoints(e)).reduce((t,e)=>t.concat(e),[])}const zv={textCirclePour:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textStop:{top:t=>jv(t,100),bottom:t=>jv(t,100)},textPlain:{top:t=>jv(t,100),bottom:t=>jv(t,100)},textTriangle:{top:t=>jv(t,50),bottom:t=>jv(t,101)},textTriangleInverted:{bottom:t=>jv(t,50),top:t=>jv(t,101)},textChevron:{bottom:t=>jv(t,50),top:t=>jv(t,50)},textChevronInverted:{bottom:t=>jv(t,50),top:t=>jv(t,50)},textRingInside:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textRingOutside:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textArchUpPour:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textArchDownPour:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textCurveUp:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textCurveDown:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textCanUp:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textCanDown:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textWave1:{top:t=>t.getPoints(180),bottom:t=>t.getPoints(180)},textWave2:{top:t=>t.getPoints(180),bottom:t=>t.getPoints(180)},textDoubleWave1:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textWave4:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textInflate:{top:t=>t.getPoints(180),bottom:t=>t.getPoints(180)},textDeflate:{top:t=>t.getPoints(180),bottom:t=>t.getPoints(180)},textInflateBottom:{top:t=>jv(t,180),bottom:t=>t.getPoints(180)},textDeflateBottom:{top:t=>jv(t,180),bottom:t=>t.getPoints(180)},textInflateTop:{bottom:t=>jv(t,180),top:t=>t.getPoints(180)},textDeflateTop:{bottom:t=>jv(t,180),top:t=>t.getPoints(180)},textFadeRight:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textFadeLeft:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textFadeUp:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textFadeDown:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textSlantUp:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textSlantDown:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textCascadeUp:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textCascadeDown:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textArchUp:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textArchDown:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textCircle:{bottom:t=>jv(t,180),top:t=>jv(t,180)}};function Vv(t,e,i,n,r){const o=t.trim().split(" "),[s,a]=o[1].split(",").map(t=>parseFloat(t)),[l,h,u,c]=o[3].split(",").map(t=>parseFloat(t)),d=function(t,e,i,n,r,o){const s=Math.abs(o*Math.sqrt((i*i+n*n)/2)),a=Math.ceil(s/9525/10);let l=0,h=r,u={x:t+i*Math.cos(h),y:e+n*Math.sin(h)};for(let r=0;r<a;r+=1){h+=o/a;const r={x:t+i*Math.cos(h),y:e+n*Math.sin(h)};l+=Math.sqrt(Math.pow(r.x-u.x,2)+Math.pow(r.y-u.y,2)),u=r}return l}(s,a,l,h,u,c);r*=Math.min(1,d/9525/n);const p=new Lh.d;p.translate(r+e/2,0),p.rotate(2*Math.PI-u);const f=new Lh.g(0,0),m=p.apply(f);m.x+=e/2,m.y=i/2-m.y;const g=l+9525*r,v=h+9525*r;return`M ${9525*m.x},${9525*m.y} A ${g},${v},${u},${c}`}var Xv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Wv{constructor(t,e,i,n,r){var o;this.iterateElements=[],this.paragraphs=[],this.effectList=[],this.container=new Oh.b,this.textContainer=new Oh.b,this.textColorFilter=new _g,this.json=t,this.ctx=e,this.shapeRotation=r,this.parentGlobalPos=n,this.iterateType=i,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+t.position.x,y:this.parentGlobalPos.y+t.position.y},this.container.position.x=t.position.x,this.container.position.y=t.position.y,this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y;const s=new Jd;s.drawRect(0,0,t.width,t.height),this.container.addChild(s),this.container.addChild(this.textContainer),this.textColorFilter.currentColor="#000000FF",this.textColorFilter.designColor="#000000FF",this.effectList=null!==(o=t.effectList)&&void 0!==o?o:[]}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}set color(t){var e;(null!==(e=this.container.filters)&&void 0!==e?e:[]).length>0&&(this.textColorFilter.color=t)}get color(){return this.textColorFilter.color}get on(){var t;return(null!==(t=this.container.filters)&&void 0!==t?t:[]).length>0?"true":"false"}set on(t){var e;"true"===t?(null!==(e=this.container.filters)&&void 0!==e?e:[]).indexOf(this.textColorFilter)<0&&(this.container.filters=[this.textColorFilter]):this.container.filters=[]}getTextElement(t,e){return"paragraph"===t?this.paragraphs[e[0]]:null}getIterateEntry(t,e){return this.iterateElements[t]?this.iterateElements[t]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(t=>{t.destroy()}),this.textColorFilter.destroy()}createParagraphs(t,e){for(let i=0,n=this.json.paragraphs.length;i<n;i++)e.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){var n;const r=this.json.paragraphs[i],o=new Uv(r,this.ctx,{parentGlobalPos:this.global,effectList:this.effectList});o.isHorz=null===(n=this.json.isHorz)||void 0===n||n,o.createLines(t,i,e),e.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){this.iterateElements=this.iterateElements.concat(o.getIterateElements()),o.container.name="段落-"+i,this.paragraphs.push(o)})),"@TextBodyImpl[paragraphs.push]")})),"@TextBodyImpl[createParagraphs]")}render(t){for(const e of this.paragraphs)e.render(t),t.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){this.textContainer.addChild(e.container)})),"@TextBodyImpl[container.addChild]");t.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)})),"@TextBodyImpl[reset width]"),t.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){if(this.json.presetTextShape){const t=this.json.paragraphs.map(t=>t.x).reduce((t,e)=>Math.min(t,e)),e=this.json.paragraphs[0].y,i=this.textContainer.getBounds(),{width:n,height:r}=i,{geometry:o,type:s}=this.json.presetTextShape;if(o.paths){const i=Vh.p.create({width:n,height:r,resolution:this.ctx.renderer.resolution}),a=new Lh.d;a.translate(-t,-e),this.ctx.renderer.render(this.textContainer,{renderTexture:i,transform:a});const l=void 0!==this.json.isHorz&&!this.json.isHorz;if(["textCircle","textArchUp","textArchDown"].indexOf(this.json.presetTextShape.type)>=0){const t=Vv(o.paths[0].path,this.json.width,this.json.height,n,r);o.paths.unshift(Object.assign(Object.assign({},o.paths[0]),{path:t}))}const h=function(t,e,i,n){if(!zv[i])return null;const r=zv[i].top(Hv(e)),o=zv[i].bottom(Hv(t));if(r.length!==o.length)return null;const s=Math.min(r.length,o.length),a=1/(s-1),l=[],h=[],u=new Array(2*s).fill("").map((t,e)=>e);for(let t=0;t<s;t++)l.push(r[t].x,r[t].y),n?h.push(1,a*t):h.push(a*t,0),l.push(o[t].x,o[t].y),n?h.push(0,a*t):h.push(a*t,1);return{vertices:new Float32Array(l),uvs:new Float32Array(h),drawMode:Sc.f.TRIANGLE_STRIP,indices:new Uint16Array(u)}}(o.paths[1],o.paths[0],s,l);if(h){const t=new tm.b(i,h.vertices,h.uvs,h.indices,h.drawMode);this.textContainer.visible=!1,this.container.addChild(t)}}}})),"presetTextShape")}}class Yv{constructor(t){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=t.id,this.type=t.type,this.heightSize=t.heightSize,this.widthSize=t.widthSize,this.fillStyle=t.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=t.lineWidth||1,this.position=t.position||{x:0,y:0},this.rotate=t.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"triangle":this.pivot={x:.7*this.width,y:this.height/2};break;case"arrow":case"stealth":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+jm()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class qv{constructor(t,e,i,n,r,o,s,a,l,h,u){this.id=t,this.ctx=e,this.paths=i,this.hash=n,this.nept=r,this.width=o,this.height=s,this.lineStyle=a,this.shouldFill=l,this.bgColor=h,this.lnColor=u,this.clonedObjects=[],this._displayObject=null,this.isRectangle=!1,this.isPureRect=!1,this.isColoredPureRect=!1,this.isRectangle=this.rectangleDetect(i),this.isRectangle&&l?this.bgColor?this.isColoredPureRect=!0:this.isPureRect=!0:this.ctx.graphicsTexture.addGraphics(this.id,this.paths,this.hash,this.nept,this.width,this.height,this.lineStyle,this.ctx.objectPoolGroup,this.shouldFill,this.bgColor,this.lnColor)}get displayObject(){return this._displayObject}pointDis(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}rectangleDetect(t){if(1!==t.length)return!1;const e=t[0].path.trim().split(" ");if(10!==e.length)return!1;const i=[],n=[];for(let t=0;t<e.length;t+=2){const r=e[t],o=e[t+1],[s,a]=o.split(",").map(t=>Number(t)/100);i.push(r),n.push({x:s,y:a})}if("MLLLC"===i.join("")||"MLLLCC"===i.join(""))return!0;for(let t=0;t<3;t++){const e=n[t],i=n[t+1];if(e.x!==i.x&&e.y!==i.y)return!1}const r=n.slice(0,4).reduce((t,e)=>t+e.x,0)/4,o=n.slice(0,4).reduce((t,e)=>t+e.y,0)/4;if(Number.isNaN(r)||Number.isNaN(o))return!1;const s={x:r,y:o};return sg(this.pointDis(s,n[0]),this.pointDis(s,n[1]))&&sg(this.pointDis(s,n[0]),this.pointDis(s,n[2]))&&sg(this.pointDis(s,n[0]),this.pointDis(s,n[3]))&&this.pointDis(s,n[0])===this.pointDis(s,n[1])}createDisplayObject(){if(this.isPureRect){const t=new Jd;return t.beginFill(0,1),t.drawRect(0,0,this.width,this.height),t}if(this.isColoredPureRect&&this.bgColor){const t=new Jd,[e,i]=fg(this.bgColor);return t.beginFill(e,i),t.drawRect(0,0,this.width,this.height),t}{const t=new ep,e=this.ctx.graphicsTexture.getGraphicsData(this.id);return e?(t.texture=e.texture,t.pivot.x=e.pivot.x,t.pivot.y=e.pivot.y,t.scale.x=e.scale,t.scale.y=e.scale,t):null}}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}render(){this._displayObject=this.createDisplayObject()}isNeedMask(t,e){let i=!1;return this._displayObject&&(i=!(this.isRectangle&&Math.abs(t-this._displayObject.width)<2&&Math.abs(e-this._displayObject.height)<2&&this.shouldFill)),i}addArrows(t){var e;null===(e=this._displayObject)||void 0===e||e.addChild(t)}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var Zv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};const Jv={pivot:{x:0,y:0},width:0,height:0};class Kv extends hg{constructor(t,e,i){var n,r,o,s,a,l,h,u,c;super(t,e,i),this.renderContainer=new Oh.b,this.needCacheAsBitMap=!1,this.backgroundGraphics=null,this.effectList=[],this.strokeGraphics=null,this.ghco=null,this.useGroupFill=!1,this.arrowList=[],this.fillColorFilter=new _g,this.strokeColorFilter=new _g,this.pptColorFilter=new _g,this.id="",this.ppt_c=new ig(this),this.fill=new ng(this),this.stroke=new tg(this),this.effectObject=null,this.effectContainer=new Oh.b,this.effectDisposer=()=>{},this.json=t,this.option=i,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i.groupFillStyle&&(this.json.fillStyle=i.groupFillStyle,this.useGroupFill=!0),this.id=t.id;const{fillStyle:d,lineStyle:p}=this.json;this.container.sortableChildren=!0,this.container.name=t.id+"_container_[Shape]",this.effectContainer.name="effect-container",this.effectContainer.zIndex=1,this.container.addChild(this.effectContainer),this.renderContainer.name=t.id+"_render_container_[Shape]",this.generateArrowList(),this.backgroundFill=this.createBackgroundFill(),this.backgroundGraphics=this.createBackgroundGraphics(),this.strokeFill=this.createStrokeFill(),this.strokeGraphics=this.createStrokeGraphics();try{this.ghco=new qv(this.json.id+"-path-graphics-text-wrap",this.ctx,null!==(o=null===(r=null===(n=this.json.textBody)||void 0===n?void 0:n.presetTextShape)||void 0===r?void 0:r.geometry.paths)&&void 0!==o?o:[],null!==(l=null===(a=null===(s=this.json.textBody)||void 0===s?void 0:s.presetTextShape)||void 0===a?void 0:a.geometry.hash)&&void 0!==l?l:"",{x:0,y:0},(null===(h=this.json.textBody)||void 0===h?void 0:h.width)||100,(null===(u=this.json.textBody)||void 0===u?void 0:u.height)||100,{width:2,fill:{fillType:"solidFill",color:"#FF0000FF"}},!1,null,null)}catch(t){this.ctx.logger.error(t.message,this.ctx.taskId)}this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null==d?void 0:d.fillType)&&(this.fillColorFilter.currentColor=d.color,this.fillColorFilter.designColor=d.color),"solidFill"===(null===(c=null==p?void 0:p.fill)||void 0===c?void 0:c.fillType)&&(this.strokeColorFilter.currentColor=p.fill.color,this.strokeColorFilter.designColor=p.fill.color),this.updateTransform(this.json),t.textBody&&(this.text=new Wv(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y},this.json.rotation||0)),this.container.hitArea=new Lh.k(1,1,this.json.width,this.json.height),this.ctx.slideScopeEventHub.once("slide-render",t=>{if(this.ctx.slideIndex===t&&this.effectObject){const t=this.getEffectTexture();if(t){const{texture:e,offsetX:i,offsetY:n}=t;this.effectObject.setFrameOffset(i,n),this.effectObject.createFrame(1,e)}}})}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e,i,n,r,o,s;return this.strokeFill.displayObject?(null!==(i=null===(e=null===(t=this.strokeFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==i?i:-1)>0:(null!==(s=null===(o=null===(r=null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set strokeActive(t){var e,i,n,r,o,s;const{displayObject:a}=this.strokeFill;t?a&&(null!==(i=null===(e=a.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==i?i:-1)<0?a.filters=[this.strokeColorFilter]:(null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)&&(null!==(o=null===(r=this.strokeGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.strokeColorFilter))&&void 0!==o?o:-1)<0&&(this.strokeGraphics.displayObject.filters=[this.strokeColorFilter]):a?a.filters=[]:(null===(s=this.strokeGraphics)||void 0===s?void 0:s.displayObject)&&(this.strokeGraphics.displayObject.filters=[])}get pptColorActive(){var t,e;return(null!==(e=null===(t=this.renderContainer.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set pptColorActive(t){this.renderContainer.filters=t?[this.pptColorFilter]:[]}get fillActive(){var t,e,i,n,r,o,s;return this.backgroundFill.displayObject?(null!==(i=null===(e=null===(t=this.backgroundFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==i?i:-1)>0:(null!==(s=null===(o=null===(r=null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set fillActive(t){var e,i,n,r,o,s;t?this.backgroundFill.displayObject&&(null!==(i=null===(e=this.backgroundFill.displayObject.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==i?i:-1)<0?this.backgroundFill.displayObject.filters=[this.fillColorFilter]:(null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)&&(null!==(o=null===(r=this.backgroundGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.fillColorFilter))&&void 0!==o?o:-1)<0&&(this.backgroundGraphics.displayObject.filters=[this.fillColorFilter]):this.backgroundFill.displayObject?this.backgroundFill.displayObject.filters=[]:(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.displayObject)&&(this.backgroundGraphics.displayObject.filters=[])}getTextElement(t,e){var i,n;return null!==(n=null===(i=this.text)||void 0===i?void 0:i.getTextElement(t,e))&&void 0!==n?n:null}getBgElement(){return this}getIterateEntry(t,e,i){return 0===e?this:"el"===t?(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null):this.text?this.text.getIterateEntry(e-1,i)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}getEffectTexture(){const t=this.effectContainer.getLocalBounds();let e=0,i=0;for(const t of this.effectContainer.children)t.pivot.x>e&&(e=t.pivot.x),t.pivot.y>i&&(i=t.pivot.y);const n=new Lh.d;if(n.translate(e,i),0===this.effectContainer.children.length)return null;const r=Vh.p.create({width:t.width,height:t.height,resolution:this.ctx.renderer.resolution});return this.ctx.renderer.render(this.effectContainer,{renderTexture:r,transform:n}),{texture:r,offsetX:e,offsetY:i}}createStrokeGraphics(){var t,e,i,n;const{id:r,geometry:o,lineStyle:s}=this.json,{width:a,height:l,pivot:h}=(null==o?void 0:o.lineTransform)||Jv,u=a||this.json.width,c=l||this.json.height,d="solidFill"===(null===(t=null==s?void 0:s.fill)||void 0===t?void 0:t.fillType)?s.fill.color:null;return s&&"noFill"!==(null===(e=s.fill)||void 0===e?void 0:e.fillType)?new qv(r+"-path-graphics",this.ctx,null!==(i=null==o?void 0:o.paths)&&void 0!==i?i:[],null!==(n=null==o?void 0:o.hash)&&void 0!==n?n:"",h||{x:0,y:0},u,c,s,!1,null,d):null}createStrokeFill(){const[t,e]=this.calculateFillObjectOffset(),{geometry:i,lineStyle:n,width:r,height:o}=this.json,s=(null==i?void 0:i.lineTransform)||Jv,a=Vm()(null==n?void 0:n.width)?n.width:1;return new av(this.ctx,null==n?void 0:n.fill,(s.width||r)+a+t,Math.max((s.height||o)+a,e),{useFilter:!0,useSlideBackgroundFill:!1})}createBackgroundGraphics(){var t;const{geometry:e,lineStyle:i,fillStyle:n,id:r}=this.json,{width:o,height:s,pivot:a}=(null==e?void 0:e.lineTransform)||Jv,l=o||this.json.width,h=s||this.json.height,u="solidFill"===(null==n?void 0:n.fillType)?n.color:null;return n&&"noFill"!==n.fillType||this.json.isPicture?new qv(r+"-bg-graphics",this.ctx,null!==(t=null==e?void 0:e.paths)&&void 0!==t?t:[],(null==e?void 0:e.hash)||"",a||{x:0,y:0},l,h,i,!0,u,null):null}createBackgroundFill(){var t,e,i,n;const{fillStyle:r,width:o,height:s,lineStyle:a,geometry:l}=this.json,h=(null==l?void 0:l.fillTransform)||Jv,u={useFilter:!0,useSlideBackgroundFill:this.json.useBgFill,fillFloat:this.json.fillFloat,shapeRotation:this.json.rotation},c=this.useGroupFill&&(null===(t=this.option.groupSize)||void 0===t?void 0:t.w)?this.option.groupSize.w:h.width||o,d=this.useGroupFill&&(null===(e=this.option.groupSize)||void 0===e?void 0:e.h)?this.option.groupSize.h:h.height||s;return new av(this.ctx,r,c+(null!==(i=null==a?void 0:a.width)&&void 0!==i?i:0),d+(null!==(n=null==a?void 0:a.width)&&void 0!==n?n:0),u)}createBackground(){var t,e,i,n,r,o,s,a,l,h,u,c;const{pivot:d,width:p,height:f}=(null===(t=this.json.geometry)||void 0===t?void 0:t.fillTransform)||Jv,{displayObject:m}=this.backgroundFill;m?(this.json.useBgFill&&(null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)?(this.needCacheAsBitMap=!0,m.mask=this.backgroundGraphics.displayObject,m.pivot.x=(null===(n=this.json.position)||void 0===n?void 0:n.x)||0,m.pivot.y=(null===(r=this.json.position)||void 0===r?void 0:r.y)||0,this.effectContainer.addChild(this.backgroundGraphics.displayObject)):"gifFill"===(null===(o=this.json.fillStyle)||void 0===o?void 0:o.fillType)?(m.height=f||this.designHeight,m.width=p||this.designWidth,m instanceof im&&m.play(),(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.isNeedMask(m.width,m.height))&&(m.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.effectContainer.addChild(this.backgroundGraphics.displayObject))):(null===(a=this.backgroundGraphics)||void 0===a?void 0:a.isNeedMask(m.width,m.height))&&(this.json.fillFloat||(this.needCacheAsBitMap=!0,m.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.effectContainer.addChild(this.backgroundGraphics.displayObject))),this.json.fillFloat||(m.x=d.x,m.y=d.y),this.useGroupFill&&(m.x-=null!==(h=null===(l=this.json.position)||void 0===l?void 0:l.x)&&void 0!==h?h:0,m.y-=null!==(c=null===(u=this.json.position)||void 0===u?void 0:u.y)&&void 0!==c?c:0),this.effectContainer.addChild(m)):this.backgroundFill.hasFill&&(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.displayObject)&&this.effectContainer.addChild(this.backgroundGraphics.displayObject)}createPathFill(){var t,e,i;const{displayObject:n}=this.strokeFill,r=null===(t=this.strokeGraphics)||void 0===t?void 0:t.displayObject,[o,s]=this.calculateFillObjectOffset();n?((null===(e=this.strokeGraphics)||void 0===e?void 0:e.isNeedMask(n.width,n.height))&&r&&(this.needCacheAsBitMap=!0,n.pivot.x=r.pivot.x,n.pivot.y=r.pivot.y,r.pivot.x=0,r.pivot.y=0,n.mask=r,n.addChild(r),n.position.x=-o/2,n.position.y=-s/2,r.position.x=o/2,r.position.y=s/2),this.effectContainer.addChild(n)):this.strokeFill.hasFill&&(null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)&&this.effectContainer.addChild(this.strokeGraphics.displayObject)}createFilledPathMask(){var t,e,i;const n=(null===(e=null===(t=this.json.geometry)||void 0===t?void 0:t.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of n){const e=this.ctx.graphicsTexture.getGraphicsData(t.id);if(e){const n=new ep(e.texture);n.pivot.x=e.pivot.x,n.pivot.y=e.pivot.y,n.scale.x=e.scale,n.scale.y=e.scale;const r=this.backgroundFill.getClonedDisplayObject(),o=null===(i=this.backgroundGraphics)||void 0===i?void 0:i.getClonedDisplayObject(),s=r||o;s&&(this.backgroundFill.displayObject&&(s.pivot.x=this.backgroundFill.displayObject.pivot.x,s.pivot.y=this.backgroundFill.displayObject.pivot.y),s.mask=n,s.filters=[Eg[t.fill]],this.needCacheAsBitMap=!0,this.effectContainer.addChild(s),this.effectContainer.addChild(n))}}}createArrow(){this.arrowList.length&&this.arrowList.forEach(t=>{var e;const i=this.ctx.graphicsTexture.getGraphicsData(t.graphicsId);if(i){const{texture:n}=i,r=new ep(n);r.pivot.x=t.pivot.x,r.pivot.y=t.pivot.y,r.position.x=t.position.x,r.position.y=t.position.y,r.rotation=t.rotate/180*Math.PI,r.scale.x=i.scale,r.scale.y=i.scale,null===(e=this.backgroundGraphics)||void 0===e||e.addArrows(r)}})}generateArrowList(){var t,e;const{lineArrowList:i,lineStyle:n,id:r}=this.json,o="solidFill"===(null===(t=null==n?void 0:n.fill)||void 0===t?void 0:t.fillType)?n.fill.color:null;null===(e=i||[])||void 0===e||e.forEach((t,e)=>{var i,s;const a=new Yv(Object.assign(Object.assign({},t),{fillStyle:null==n?void 0:n.fill,lineWidth:null!==(i=null==n?void 0:n.width)&&void 0!==i?i:0}));a.graphicsId=`${r}-arrow-${e}-graphics`,a.textureId=`${r}-arrow-${e}-fill`,this.ctx.graphicsTexture.addGraphics(a.graphicsId,null!==(s=a.paths)&&void 0!==s?s:[],a.hash,{x:0,y:0},a.width,a.height,void 0,this.ctx.objectPoolGroup,!0,o,null),this.arrowList.push(a)})}calculateFillObjectOffset(){let[t,e]=[0,0];return this.arrowList.length&&(t=this.arrowList.reduce((t,e)=>Math.max(t,e.width),0),e=this.arrowList.reduce((t,e)=>Math.max(t,e.height),0)),[t,e]}preRender(t){var e,i,n;const{lineStyle:r,geometry:o}=this.json,{width:s,height:a}=(null==o?void 0:o.lineTransform)||Jv,l=s||this.json.width,h=a||this.json.height,u=(null===(e=null==o?void 0:o.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[],c="solidFill"===(null===(i=null==r?void 0:r.fill)||void 0===i?void 0:i.fillType)?r.fill.color:null;t.addSubMTask(()=>Zv(this,void 0,void 0,(function*(){for(const t of u)this.ctx.graphicsTexture.addGraphics(t.id,[t],t.hash,((null==o?void 0:o.lineTransform)||Jv).pivot,l,h,r,this.ctx.objectPoolGroup,!0,null,c)})),"@ShapeImpl[addGraphics]"),null===(n=this.text)||void 0===n||n.createParagraphs(this.json.id,t)}subClassRender(){return Zv(this,void 0,void 0,(function*(){}))}render(t){t.addSubMTask(()=>Zv(this,void 0,void 0,(function*(){var t,e;null===(t=this.strokeGraphics)||void 0===t||t.render(),null===(e=this.backgroundGraphics)||void 0===e||e.render(),this.createBackground(),yield this.subClassRender(),this.createFilledPathMask(),this.createPathFill(),this.createArrow()})),"@ShapeImpl[render]"),this.text&&this.text.render(t),t.addSubMTask(()=>Zv(this,void 0,void 0,(function*(){var t,e,i,n,r,o,s,a,l,h,u,c,d;if("wd"===(null===(t=this.json.textBody)||void 0===t?void 0:t.iterateType)||"lt"===(null===(e=this.json.textBody)||void 0===e?void 0:e.iterateType)){if(this.renderContainer.addChild(this.container),this.text){const{x:t,y:e}=null!==(i=this.json.scale)&&void 0!==i?i:{x:1,y:1};this.text.container.scale.x=e<0?-Math.abs(t):Math.abs(t),this.text.container.scale.y=e,this.text.container.position.x=(null!==(r=null===(n=this.json.position)||void 0===n?void 0:n.x)&&void 0!==r?r:0)+this.text.x,this.text.container.position.y=(null!==(s=null===(o=this.json.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)+this.text.y,this.text.container.scale.y<0&&(this.text.container.position.y+=this.text.height),this.text.container.scale.x<0&&(this.text.container.position.x+=this.json.width),this.json.textRotation&&(this.text.container.rotation=this.json.textRotation),this.renderContainer.addChild(this.text.container)}}else{if(this.text){if(this.json.textRotation){this.text.container.rotation=this.json.textRotation;const{width:t,height:e}=this.text,{x:i,y:n}=this.text.container.position;this.text.container.pivot.x=t/2,this.text.container.pivot.y=e/2,this.text.container.x=i+t/2,this.text.container.y=n+e/2}if(cg()(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const t=this.json.rotation||0;this.text.container.rotation=-t;const{width:e}=this.text;this.text.container.position.x=e}this.text.container.zIndex=100;const t=null===(a=this.json.effectList)||void 0===a?void 0:a.find(t=>"outerShadow"===t.type),e=null===(l=this.json.effectList)||void 0===l?void 0:l.find(t=>"softEdge"===t.type),i=null===(h=this.json.effectList)||void 0===h?void 0:h.find(t=>"glow"===t.type);t&&1!==t.sx||e||i?this.container.addChild(this.text.container):this.effectContainer.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.needCacheAsBitMap,"background"===this.json.id&&this.ctx.hasBackgroundFillShape){const t=Vh.p.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:t}),this.ctx.bgTexture=t}this.json.effectList&&this.json.effectList.length>0&&(null===(u=this.ctx.featureList)||void 0===u?void 0:u.effect)&&!this.ctx.forceCanvas&&!this.json.media&&(this.effectObject=new Ov(this.effectContainer,this.json.effectList,`${this.ctx.taskId}_${this.ctx.slideIndex}_${this.json.id}`,this.ctx,this.json.rotation||0,new Lh.g((null===(c=this.json.scale)||void 0===c?void 0:c.x)||1,(null===(d=this.json.scale)||void 0===d?void 0:d.y)||1)),function(t){var e,i,n;return"gifFill"===(null===(e=t.fillStyle)||void 0===e?void 0:e.fillType)||("gifFill"===(null===(n=null===(i=t.lineStyle)||void 0===i?void 0:i.fill)||void 0===n?void 0:n.fillType)||!!t.picFill&&"gifFill"===t.picFill.fillType)}(this.json)&&this.effectObject.setFrameCount(-1),this.effectObject.on("ready",()=>{var t;this.effectContainer.visible=!1,this.effectObject.container.zIndex=10,this.container.addChild(this.effectObject.container),null===(t=this.effectObject)||void 0===t||t.updateFrame(1)}))})),"@ShapeImpl[post.render]")}clearOnSlideChange(){}initOnReuse(){}destroy(){var t,e,i,n;null===(t=this.text)||void 0===t||t.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.backgroundFill.destroy(),null===(e=this.backgroundGraphics)||void 0===e||e.destroy(),this.strokeFill.destroy(),null===(i=this.strokeGraphics)||void 0===i||i.destroy(),this.renderContainer.destroy(),null===(n=this.arrowRenderTexture)||void 0===n||n.destroy(!0),this.arrowList=[],this.effectDisposer()}}var Qv=i(119);const $v=new(i.n(Qv).a),t_=$v.getDevice(),e_=$v.getBrowser(),i_=$v.getOS(),n_={isDesktop(){let t=!0;return"mobile"===t_.type&&(t=!1),/Samsung/.test(e_.name||"")&&(t=!1),window.__nativeTags&&window.__nativeTags.platform&&(t=!1),t},isIOS(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^ios/i.test(window.__nativeTags.platform)&&(t=!0),i_.name&&/iOS/.test(i_.name)&&(t=!0),t},isAndroid(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^android/i.test(window.__nativeTags.platform)&&(t=!0),i_.name&&/android/i.test(i_.name)&&(t=!0),t},isLowGpuMemory(){var t,e;const i=null!==(e=null===(t=window.__nativeTags)||void 0===t?void 0:t.platform)&&void 0!==e?e:"";if(i){const t=i.split(" ");if(t[1]){if(/^iPad/.test(t[1])){const e=t[1].match(/^iPad(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=6)}if(/^iPhone/.test(t[1])){const e=t[1].match(/^iPhone(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=9)}return!1}return!1}return!0}};var r_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function o_(t,e){for(const i in e)t.style[i]=e[i]}const s_={medianContainerClass:"median-container",hoverHiddeDelay:1500,portalWidth:300,portalHeight:50,hiddenOpacity:"0",hoverOpacity:"1",opacityAnimationTime:.4};class a_{constructor(t){var e,i;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.fullScreenButton=document.createElement("div"),this.exitFullScreenButton=document.createElement("div"),this.medianIsEnd=!1,this.pickBookmarkIndex=0,this.playCallBackList=[],this.duration=0,this.isVideo=!1,this.start=0,this.end=0,this.fullscreenStatus=!1,this.fadeState={in:!1,out:!1},this.changeMediaProgress=t=>{if(this.ctx.isPlayerPaused())return void this.ctx.logger.info("Media controller prevent seek event with paused state",this.ctx.taskId);t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.medianIsEnd=!1,"interactive"!==this.ctx.mode&&this.jumpToTime(e),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(jy.mediaSeek,{id:this.targetId,time:e,isPlaying:this.media.isPlaying}),this.delayHide()},this.jumpToTime=(t=0)=>r_(this,void 0,void 0,(function*(){yield Pm(()=>!!this.duration,3e3);const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e,this.changeBookmarkIndex(e,e>this.media.currentTime))})),this.showController=t=>{t.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=a_.formatTime(this.duration)},this.playMedia=()=>r_(this,void 0,void 0,(function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(t=>{t()}),this.delayHide()})),this.pauseMedia=()=>r_(this,void 0,void 0,(function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()})),this.onMouseOut=t=>{t.stopPropagation(),this.hide()},this.mediaTimeUpdate=()=>r_(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;if((this.duration>0&&Math.abs(t-this.duration)<.3||t>this.duration)&&(yield this.pauseMedia(),this.medianIsEnd=!0,this.jumpToTime(),this.ctx.eventHub.emit(jy.mediaStop,{id:this.targetId}),this.onClickCancelFullScreenButtonHandle()),this.currentTime.innerText=a_.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString(),this.bookmarkList&&this.bookmarkList.length>0){const t=this.bookmarkList[this.pickBookmarkIndex];t&&t.time.toFixed(0)===this.media.currentTime.toFixed(0)&&(this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${t.name}`),this.pickBookmarkIndex+=1)}this.fadeHit(t)})),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.fadeState={in:!1,out:!1},this.fadeHit(0),this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(t=>{t()})},this._playMediaFromCtrl=()=>{this.playMediaFromCtrl(!1)},this._pauseMediaFromCtrl=()=>{this.pauseMediaFromCtrl(!1),this.delayHide()},this.onClickFullScreenButtonHandle=()=>{this.fullscreenPlay()},this.onClickCancelFullScreenButtonHandle=()=>{this.fullscreenStatus=!1,this.media.requestCancelFullscreen(),this.ctx.eventHub.emit(jy.fullscreenChange,{targetId:this.targetId,state:!1}),this.delayHide()},this.onFullScreenChange=t=>{const{status:e,targetId:i,slideIndex:n}=t;this.changeFullScreenState(e,i,n),this.delayHide()},this.onContainerSizeChange=()=>{this.setControllerPosition()},this.onControllerShowStatusChange=({slideIndex:t,targetId:e,status:i})=>{if(t===this.ctx.slideIndex){if(this.targetId===e){const{hiddenOpacity:t,hoverOpacity:e}=s_;i?(this.mediaController.style.opacity=e,this.mediaController.style.display="flex"):this.mediaController.style.opacity=t}this.delayHide()}},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.target=t.target,this.media=t.media,this.info=t.info,this.shapeId=t.shapeId,this.canvasElement=t.canvasElement,"video"===this.media.type&&(this.isVideo=!0),this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=null!==(e=this.info.cut.start)&&void 0!==e?e:0,this.end=null!==(i=this.info.cut.end)&&void 0!==i?i:0),this.info.bookmarkList&&(this.bookmarkList=this.info.bookmarkList.sort((t,e)=>t.time-e.time))}get clippedDuration(){return this.duration}getMedianContainer(){var t;const{medianContainerClass:e}=s_;let i=null===(t=this.canvasElement.parentElement)||void 0===t?void 0:t.querySelector("."+e);i||(i=document.createElement("div"),i.className=e,this.canvasElement.parentElement.appendChild(i)),this.container=i}static formatTime(t){let e="00:00";if(t){const i=Math.floor(t/60),n=String(i<0?0:i).padStart(2,"0"),r=Math.floor(t%60);e=`${n}:${String(r<0?0:r).padStart(2,"0")}`}return e}generatePlayButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"viewBox","0 0 512 512"),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"width",e.toString());const n=document.createElementNS("http://www.w3.org/2000/svg","polyline");return n.setAttributeNS(null,"points","35 0, 477 256, 35 512"),n.setAttributeNS(null,"fill","#000000"),i.appendChild(n),i}generatePauseButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");o_(i,{height:t+"px"}),i.setAttributeNS(null,"viewBox","0 0 512 512"),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"width",e.toString());const n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttributeNS(null,"x","35"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","148"),n.setAttributeNS(null,"height","512");const r=n.cloneNode(!0);return r.setAttributeNS(null,"x","330"),i.append(n,r),i}generateFullScreenButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");o_(i,{height:t+"px",width:e+"px"}),i.setAttributeNS(null,"width",e.toString()),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"viewBox","0 0 1024 1024");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d","M918.116352 107.409408c10.186752 10.175488 10.186752 26.691584 0 36.87936L653.734912 407.038976c-10.187776 10.187776-26.703872 10.187776-36.891648 0-10.175488-10.187776-10.175488-26.703872 0.013312-36.891648l264.38144-262.73792c10.174464-10.187776 26.69056-10.200064 36.87936-0.013312L918.117376 107.409408zM878.281728 148.096l-161.155072-0.44544c-11.283456 0.279552-20.85888-8.226816-21.90336-19.458048l0-13.421568c0.318464-10.671104 8.889344-19.241984 19.560448-19.560448l187.030528 0.827392c0.1792-0.037888 0.357376-0.0768 0.523264-0.089088l9.549824-0.229376c5.005312-0.152576 9.843712 1.770496 13.372416 5.336064 3.32288 3.629056 4.9664 8.49408 4.545536 13.40928l-1.032192 9.537536c0 0.191488 0.70144 0.318464 0.70144 0.49664l-0.534528 188.279808c-0.54784 9.984-9.092096 17.637376-19.076096 17.089536-0.165888-0.012288-0.319488-0.0256-0.484352-0.037888L896.009216 329.8304c-10.379264-0.0512-18.733056-8.506368-18.681856-18.885632 0.013312-0.191488 0.013312-0.381952 0.013312-0.585728L878.281728 148.096zM105.884672 916.661248c-10.187776-10.175488-10.200064-26.691584-0.013312-36.87936 0 0 0-0.013312 0.013312-0.013312l265.19552-262.73792c10.35264-10.008576 26.86976-9.729024 36.866048 0.636928 9.766912 10.110976 9.766912 26.131456 0 36.242432L143.579136 916.661248C133.072896 926.848 116.3776 926.848 105.884672 916.661248L105.884672 916.661248zM146.533376 875.973632l161.154048 0.433152c11.283456-0.292864 20.85888 8.213504 21.891072 19.458048l0 13.38368c-0.292864 10.672128-8.876032 19.255296-19.560448 19.561472l-187.858944-0.828416c-0.165888 0.037888-0.344064 0.075776-0.509952 0.089088l-9.550848 0.229376c-5.004288 0.152576-9.831424-1.782784-13.35808-5.336064-3.323904-3.629056-4.979712-8.493056-4.54656-13.395968l1.031168-9.537536c0-0.191488-0.712704-0.330752-0.700416-0.509952l0.534528-188.278784c0.534528-9.984 9.066496-17.625088 19.050496-17.089536 0.165888 0.013312 0.330752 0.0256 0.508928 0.037888l14.212096 0c10.365952 0.0512 18.719744 8.507392 18.656256 18.873344 0 0.191488 0 0.395264-0.013312 0.598016L146.533376 875.973632zM918.116352 916.661248c10.186752-10.175488 10.200064-26.691584 0.012288-36.87936 0 0 0-0.013312-0.012288-0.013312l-264.38144-262.73792c-10.365952-10.008576-26.86976-9.729024-36.87936 0.636928-9.766912 10.110976-9.766912 26.131456 0 36.242432L881.22368 916.661248c10.186752 10.186752 26.703872 10.186752 36.891648 0.013312L918.115328 916.661248 918.116352 916.661248zM878.281728 875.973632l-161.168384 0.433152c-11.270144-0.292864-20.845568 8.213504-21.890048 19.458048l0 13.38368c0.306176 10.672128 8.889344 19.241984 19.560448 19.561472l187.030528-0.828416c0.1792 0.037888 0.357376 0.075776 0.523264 0.089088l9.549824 0.229376c5.005312 0.152576 9.843712-1.782784 13.372416-5.336064 3.32288-3.629056 4.978688-8.493056 4.545536-13.395968l-1.032192-9.537536c0-0.191488 0.70144-0.330752 0.70144-0.509952l-0.534528-188.278784c-0.54784-9.984-9.092096-17.637376-19.076096-17.089536-0.165888 0.013312-0.319488 0.0256-0.484352 0.037888L896.009216 694.19008c-10.379264 0.0512-18.733056 8.507392-18.681856 18.885632 0 0.191488 0.013312 0.381952 0.013312 0.584704L878.281728 875.973632zM105.884672 107.409408c-10.187776 10.175488-10.187776 26.691584 0 36.87936l265.19552 262.750208c10.187776 10.187776 26.691584 10.187776 36.87936 0s10.175488-26.703872-0.012288-36.891648l-264.368128-262.73792C133.072896 97.222656 116.3776 97.222656 105.884672 107.409408L105.884672 107.409408zM146.533376 148.096l161.154048-0.44544c11.283456 0.292864 20.85888-8.213504 21.891072-19.458048l0-13.421568c-0.306176-10.671104-8.889344-19.241984-19.560448-19.560448l-187.858944 0.827392c-0.165888-0.0512-0.344064-0.0768-0.509952-0.089088l-9.550848-0.229376c-5.004288-0.152576-9.831424 1.782784-13.35808 5.336064-3.323904 3.629056-4.979712 8.49408-4.54656 13.40928l1.031168 9.537536c0 0.191488-0.712704 0.318464-0.700416 0.49664l0.534528 188.279808c0.534528 9.970688 9.066496 17.624064 19.050496 17.089536 0.165888-0.012288 0.330752-0.0256 0.508928-0.037888l14.212096 0c10.365952-0.0512 18.719744-8.506368 18.656256-18.87232 0-0.191488 0-0.395264-0.013312-0.598016L146.533376 148.096z"),i.appendChild(n),document.body.appendChild(i),i}generateExitFullScreenButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");o_(i,{height:t+"px",width:e+"px"}),i.setAttributeNS(null,"width",e.toString()),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"viewBox","0 0 1024 1024");const n=document.createElementNS("http://www.w3.org/2000/svg","path"),r=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d","M716.8 998.4a25.6 25.6 0 0 1-25.6-25.6v-256a25.6 25.6 0 0 1 25.6-25.6h256a25.6 25.6 0 1 1 0 51.2h-230.4v230.4a25.6 25.6 0 0 1-25.6 25.6zM307.2 998.4a25.6 25.6 0 0 1-25.6-25.6v-230.4H51.2a25.6 25.6 0 1 1 0-51.2h256a25.6 25.6 0 0 1 25.6 25.6v256a25.6 25.6 0 0 1-25.6 25.6zM972.8 332.8h-256a25.6 25.6 0 0 1-25.6-25.6v-256a25.6 25.6 0 1 1 51.2 0v230.4h230.4a25.6 25.6 0 1 1 0 51.2zM307.2 332.8h-256a25.6 25.6 0 1 1 0-51.2h230.4V51.2a25.6 25.6 0 1 1 51.2 0v256a25.6 25.6 0 0 1-25.6 25.6z"),r.setAttributeNS(null,"d","M307.2 332.8a25.6 25.6 0 0 1-18.112-7.488L56.896 93.12a25.6 25.6 0 0 1 36.224-36.224l232.192 232.192A25.6 25.6 0 0 1 307.2 332.8zM716.8 332.8a25.6 25.6 0 0 1-18.112-43.712L930.88 56.896a25.6 25.6 0 0 1 36.224 36.224l-232.192 232.192a25.472 25.472 0 0 1-18.112 7.488zM948.992 974.592a25.6 25.6 0 0 1-18.112-7.488l-232.192-232.192a25.6 25.6 0 0 1 36.224-36.224l232.192 232.192a25.6 25.6 0 0 1-18.112 43.712zM75.008 974.592a25.6 25.6 0 0 1-18.112-43.712l232.192-232.192a25.6 25.6 0 0 1 36.224 36.224l-232.192 232.192a25.472 25.472 0 0 1-18.112 7.488z"),i.appendChild(n),i.appendChild(r),document.body.appendChild(i),i}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px",display:"flex",justifyContent:"center",alignItems:"center"};o_(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=this.generatePlayButton();o_(e,{height:"20px"}),this.playButton.appendChild(e),o_(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const i=this.generatePauseButton();if(o_(i,{height:"20px"}),this.pauseButton.appendChild(i),!this.isVideo)return;const n=this.generateFullScreenButton(20,20);this.fullScreenButton.appendChild(n),o_(this.fullScreenButton,Object.assign(Object.assign({},t),{display:"block"}));const r=this.generateExitFullScreenButton(20,20);this.exitFullScreenButton.appendChild(r),o_(this.exitFullScreenButton,Object.assign(Object.assign({},t),{display:"none"}))}createTimer(){const t=document.createElement("div");o_(t,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",t.append(this.currentTime,e,this.totalTime),t}createProgress(){const t={flex:"1",position:"relative"};this.isVideo||(t.marginRight="10px"),o_(this.progress,t);const e=document.createElement("div");o_(e,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(e),o_(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),e.appendChild(this.currentProgress)}fadeHit(t){if(!this.info.fade)return;const{start:e,end:i}=this.info.fade;e&&!this.fadeState.in&&t>=0&&(this.fadeState.in=!0,this.media.fadeIn(0,e)),i&&!this.fadeState.out&&t>=this.duration-i/1e3&&(this.fadeState.out=!0,this.media.fadeOut(0,i))}changeBookmarkIndex(t,e){if(this.bookmarkList&&0!==this.bookmarkList.length){if(this.pickBookmarkIndex>0)for(let e=0;e<this.pickBookmarkIndex;e++)if(this.bookmarkList[e].time>t){this.pickBookmarkIndex=e;break}if(e){let e=this.pickBookmarkIndex-1;for(let i=0;i<this.bookmarkList.length;i++)this.bookmarkList[i].time<t&&(e=i);for(let t=this.pickBookmarkIndex;t<=e;t++){const e=this.bookmarkList[t];e&&this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`)}this.pickBookmarkIndex=e+1}}}playMediaFromCtrl(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent play event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.playMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(jy.mediaPlay,{id:this.targetId,time:this.media.currentTime-this.start,_stateOnly:t}))}pauseMediaFromCtrl(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent pause event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.pauseMedia(),"local"===this.ctx.mode||this.ctx.isRendering||this.ctx.eventHub.emit(jy.mediaPause,{id:this.targetId,time:this.media.currentTime-this.start,_stateOnly:t}))}setControllerPosition(){var t;const{target:e}=this,{portalWidth:i,portalHeight:n}=s_,{stageWidth:r,stageHeight:o}=this.ctx,s=e.getGlobalPosition(),a=Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale")),l=r*a,h=1/a*(i>l?l/i:1);s.y=s.y+this.height-n,s.x=Math.max(s.x,0),s.x=Math.min(s.x,r-i*h),s.y=Math.max(s.y,0),s.y=Math.min(s.y,o-n),o_(this.mediaController,{height:n+"px",borderRadius:n/2+"px",width:i+"px",flexDirection:"row",alignItems:"center",position:"absolute",left:s.x+"px",top:s.y+"px",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${h})`,transformOrigin:"0 100%"}),this.fullscreenStatus&&o_(this.mediaController,{left:"0",top:o-n+"px"})}createMediaController(){this.setControllerPosition(),o_(this.mediaController,{display:"none",transition:`opacity ${s_.opacityAnimationTime}s`}),this.createButton();const t=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,t,this.progress),this.isVideo&&this.mediaController.append(this.fullScreenButton,this.exitFullScreenButton),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(t){this.playCallBackList.push(t)}fullscreenPlay(){this.fullscreenStatus=!0,"interactive"!==this.ctx.mode&&this.media.requestFullscreen(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(jy.fullscreenChange,{targetId:this.targetId,state:!0}),this.delayHide()}changeFullScreenState(t,e,i){i===this.ctx.slideIndex&&(t&&this.targetId===e?this.fullscreenStatus=t:this.fullscreenStatus=!1,this.fullscreenStatus?(this.fullScreenButton.style.display="none",this.exitFullScreenButton.style.display="block"):(this.fullScreenButton.style.display="block",this.exitFullScreenButton.style.display="none"),this.setControllerPosition())}bindEvent(){n_.isDesktop()&&(this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.mediaController.addEventListener("mouseover",this.showController,!1)),this.progress.addEventListener("click",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this._playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this._pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1),this.containerObserver=new MutationObserver(this.onContainerSizeChange),this.container&&this.containerObserver.observe(this.container,{attributes:!0,attributeFilter:["data-scale","style"]}),this.isVideo&&(this.ctx.globalEventHub.on("onFullscreenChange",this.onFullScreenChange),this.ctx.globalEventHub.on("controllerShowStatusChange",this.onControllerShowStatusChange),this.fullScreenButton.addEventListener("click",this.onClickFullScreenButtonHandle,!1),this.exitFullScreenButton.addEventListener("click",this.onClickCancelFullScreenButtonHandle,!1))}unbindEvent(){var t;n_.isDesktop()&&(this.mediaController.removeEventListener("mouseout",this.onMouseOut,!1),this.mediaController.removeEventListener("mouseover",this.showController,!1)),this.progress.removeEventListener("click",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",this._playMediaFromCtrl,!1),this.pauseButton.removeEventListener("click",this._pauseMediaFromCtrl,!1),this.media.removeAllListeners(),null===(t=this.containerObserver)||void 0===t||t.disconnect(),this.isVideo&&(this.ctx.globalEventHub.removeListener("onFullscreenChange",this.onFullScreenChange),this.ctx.globalEventHub.removeListener("controllerShowStatusChange",this.onControllerShowStatusChange),this.fullScreenButton.removeEventListener("click",this.onClickFullScreenButtonHandle,!1),this.exitFullScreenButton.removeEventListener("click",this.onClickCancelFullScreenButtonHandle,!1))}show(){this.setControllerPosition(),this.mediaController.style.opacity=s_.hoverOpacity,this.fullscreenStatus||(this.mediaController.style.display="flex"),this.delayHide()}hide(){this.fullscreenStatus?this.mediaController.style.opacity=s_.hiddenOpacity:this.mediaController.style.display="none"}delayHide(){clearTimeout(this.autoHiddenTimer),this.autoHiddenTimer=setTimeout(()=>{this.hide()},s_.hoverHiddeDelay)}destroy(){var t;this.unbindEvent(),this.playCallBackList=[],null===(t=this.container)||void 0===t||t.removeChild(this.mediaController)}}var l_=i(120);class h_ extends Za.a{constructor(t,e){super(),this.isGlobalPause=!1,this.lastTime=-1,this.howl=null,this.rctClient=null,this.isHowlEnd=!1,this.isHowlLoadEmit=!1,this.staticEventId=1001,this.url=t,this.runningAudio=e,zy.RtcAudioClazz?(this.rctClient=new zy.RtcAudioClazz(t),this.rctClient.on("load",()=>this.emit("load")),this.rctClient.on("pause",()=>this.emit("pause")),this.rctClient.on("play",()=>this.emit("play")),this.rctClient.on("resumeAllAudioInterruptByAudioSessionChanged",()=>{this.emit("resumeAllAudioInterruptByAudioSessionChanged")})):(this.howl=new l_.Howl({src:[t]}),[this.staticEventId]=this.howl._getSoundIds(),this.howl.load(),this.howl.on("load",()=>{this.isHowlLoadEmit=!0,this.emit("load")}),this.howl.on("pause",()=>this.emit("pause")),this.howl.on("play",()=>{this.isHowlLoadEmit||this.emit("load"),this.isHowlEnd=!1,this.emit("play")}),this.howl.on("end",()=>{this.isHowlEnd=!0}))}startTimeChangeEmit(){this.currentTime!==this.lastTime&&(this.lastTime=this.currentTime,this.emit("timeupdate",this.lastTime)),this.isPaused||setTimeout(()=>{this.isPaused||this.startTimeChangeEmit()},300)}play(){var t,e,i;this.runningAudio.has(this.url)&&(null===(t=this.runningAudio.get(this.url))||void 0===t||t.stop(),this.runningAudio.delete(this.url)),this.isHowlEnd=!1,this.lastTime=-1,null===(e=this.howl)||void 0===e||e.play(this.staticEventId),null===(i=this.rctClient)||void 0===i||i.play(),this.startTimeChangeEmit(),this.runningAudio.set(this.url,this)}fade(t,e,i){this.howl&&this.howl.fade(t,e,i)}pause(){var t,e;null===(t=this.howl)||void 0===t||t.pause(this.staticEventId),null===(e=this.rctClient)||void 0===e||e.pause(),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}globalPause(){this.isPaused||(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}stop(){var t;null===(t=this.howl)||void 0===t||t.pause(this.staticEventId),this.rctClient&&(this.rctClient.pause(),this.rctClient.currentTime=0),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}destroy(){var t,e,i,n,r,o,s,a;null===(t=this.howl)||void 0===t||t.stop(this.staticEventId),null===(e=this.howl)||void 0===e||e.unload(),null===(i=this.rctClient)||void 0===i||i.pause(),null===(n=this.rctClient)||void 0===n||n.destroy(),null===(r=this.rctClient)||void 0===r||r.removeAllListeners("load"),null===(o=this.rctClient)||void 0===o||o.removeAllListeners("play"),null===(s=this.rctClient)||void 0===s||s.removeAllListeners("pause"),null===(a=this.rctClient)||void 0===a||a.removeAllListeners("resumeAllAudioInterruptByAudioSessionChanged"),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}get currentTime(){return this.rctClient?this.rctClient.currentTime:this.howl?this.howl.seek(this.staticEventId):-1}set currentTime(t){this.rctClient?this.rctClient.currentTime=t:this.howl&&this.howl.seek(t,this.staticEventId)}get duration(){return this.rctClient?this.rctClient.duration:this.howl?this.howl.duration(this.staticEventId):0}get isPaused(){return this.rctClient?this.rctClient.isPaused:!!this.howl&&!this.howl.playing(this.staticEventId)}volume(t){this.rctClient?this.rctClient.volume(t):this.howl&&this.howl.volume(t)}}var u_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class c_ extends Za.a{constructor(t){var e,i,n,r,o;super(),this.type="video",this.sprite=new ep,this.isPlaying=!1,this.isGlobalPause=!1,this.fullscreen=!1,this.url="",this.isLoaded=!1,this.onVideoResourceLoaded=()=>{this.isLoaded=!0},this.onVideoStalled=()=>{this.ctx.logger.warn(this.url+", Failed to fetch data, but trying.",this.ctx.taskId)},this.updateVolume=t=>{this.rtcAudio.volume(t)},this.syncFullscreenVideoState=t=>{const{targetId:e,state:i,slideIndex:n}=t;n===this.ctx.slideIndex&&e===this.id&&(i?(this.requestFullscreen(),this.ctx.latestChangeFullscreenTargetId=e):this.requestCancelFullscreen())},this.id=t.id,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(i=t.video.cut)||void 0===i?void 0:i.end,this.fullscreen=null!==(n=t.video.fullscreen)&&void 0!==n&&n,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this;const s=t.video.src;this.videoResource=new Vh.w(s,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0}),null===(r=this.videoElement)||void 0===r||r.addEventListener("stalled",this.onVideoStalled),null===(o=this.videoElement)||void 0===o||o.addEventListener("loadedmetadata",this.onVideoResourceLoaded),this.url=t.video.src;let a=t.video.src.replace(/4$/,"3");this.ctx.loaderDelegate&&(a=this.ctx.loaderDelegate.redirectMedia(a),this.ctx.logger.info(`redirect media url from ${t.video.src.replace(/4$/,"3")} to ${a} by delegate.`,t.ctx.taskId)),this.rtcAudio=new h_(a,t.ctx.runningAudio),this.rtcAudio.on("timeupdate",t=>{if(this.videoElement){const e=this.videoElement.currentTime;Math.abs(e-t)>.5&&this.videoElement.fastSeek(t)}}),this.rtcAudio.on("resumeAllAudioInterruptByAudioSessionChanged",()=>{var t;null===(t=this.videoElement)||void 0===t||t.pause(),setTimeout(()=>{var t;this.rtcAudio.isPaused||null===(t=this.videoElement)||void 0===t||t.play()},200)});const{video:l,width:h,height:u,target:c}=t;this.controller=new a_({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,width:h,height:u,target:c,media:this,info:l,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=h,this.sprite.height=u,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const d=new Vh.c(null,{height:u,width:h});d.resource=this.videoResource,this.videoResource.bind(d),this.sprite=new ep,this.sprite.visible=!1,this.sprite.texture=new Vh.t(d),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",t=>{t.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",t=>{t.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(t=>{var e;null===(e=this.videoElement)||void 0===e||e.addEventListener(t,()=>{"timeupdate"===t&&this.isPlaying,this.emit(t)})}),this.ctx.activeMedia.add(this),this.ctx.volumeAdjuster.on("update",this.updateVolume),this.ctx.globalEventHub.on("syncFullscreenVideoState",this.syncFullscreenVideoState)}get videoElement(){return this.videoResource.source}get currentTime(){var t,e;return null!==(e=null===(t=this.videoElement)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}set currentTime(t){this.rtcAudio.currentTime=t,this.videoElement&&(this.videoElement.currentTime=t)}get paused(){var t,e;return null===(e=null===(t=this.videoElement)||void 0===t?void 0:t.paused)||void 0===e||e}get duration(){var t,e;return null!==(e=null===(t=this.videoElement)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}get clippedDuration(){return this.controller.clippedDuration}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return u_(this,void 0,void 0,(function*(){this.isPlaying=!0,this.updateVolume(this.ctx.volumeAdjuster.volume),yield this.load(),yield this.ctx.clock.waitUntil(()=>{const t=this.videoElement;return!!(t&&t.videoWidth>0)},3e3);const t=this.videoElement;t&&t.videoWidth<=0||(this.videoElement&&(this.videoElement.volume=0,this.videoElement.muted=!0),this.rtcAudio.on("play",()=>{var t;null===(t=this.videoElement)||void 0===t||t.play(),this.fullscreen&&this.controller.fullscreenPlay()}),this.rtcAudio.play())}))}load(){return this.videoResource.load()}pause(){this.isPlaying=!1,this.ctx.logger.warn(this.url+", pause video manual.",this.ctx.taskId),this.ctx.logger.warn(this.url+", pause rtc audio manual.",this.ctx.taskId),this.rtcAudio.on("pause",()=>{var t;null===(t=this.videoElement)||void 0===t||t.pause()}),this.rtcAudio.pause()}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause(),this.ctx.eventHub.emit(jy.mediaStop,{id:this.id})}requestFullscreen(){return u_(this,void 0,void 0,(function*(){yield Pm(()=>this.isLoaded,5e3);const t=new Vh.t(this.sprite.texture.baseTexture);this.ctx.globalEventHub.emit("requestFullscreen",{texture:t,index:this.ctx.slideIndex,targetId:this.id})}))}requestCancelFullscreen(){this.ctx.globalEventHub.emit("requestCancelFullscreen",{targetId:this.id,index:this.ctx.slideIndex})}destroy(){var t,e,i;this.ctx.volumeAdjuster.removeListener("update",this.updateVolume),this.ctx.globalEventHub.removeListener("syncFullscreenVideoState",this.syncFullscreenVideoState),null===(t=this.videoElement)||void 0===t||t.removeEventListener("stalled",this.onVideoStalled),null===(e=this.videoElement)||void 0===e||e.removeEventListener("loadedmetadata",this.onVideoResourceLoaded),this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(i=this.videoResource)||void 0===i||i.destroy(),this.rtcAudio.destroy(),this.stop(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}fadeIn(t,e){this.rtcAudio.fade(t,this.ctx.volumeAdjuster.volume,e)}fadeOut(t,e){this.rtcAudio.fade(this.ctx.volumeAdjuster.volume,t,e)}}var d_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class p_ extends Za.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.isGlobalPause=!1,this.updateVolume=t=>{this.audioPlayer.volume(t)},this.id=t.id;const e=t.audio.src;this.audioPlayer=new h_(e,t.ctx.runningAudio),t.audio.cut&&(this.start=t.audio.cut.start,this.end=t.audio.cut.end),this.ctx=t.ctx,this.ctx.medias[this.id]=this;const{width:i,height:n,target:r}=t;this.controller=new a_({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,height:n,width:i,target:r,media:this,info:t.audio,canvasElement:t.canvasElement}),this.audioPlayer.on("load",()=>this.emit("durationchange")),this.audioPlayer.on("timeupdate",()=>this.emit("timeupdate")),this.audioPlayer.on("pause",()=>this.emit("pause")),this.audioPlayer.on("play",()=>this.emit("play")),this.ctx.activeMedia.add(this),this.ctx.volumeAdjuster.on("update",this.updateVolume)}get currentTime(){return this.audioPlayer.currentTime}set currentTime(t){this.audioPlayer.currentTime=t}get clippedDuration(){return this.controller.clippedDuration}get paused(){return this.audioPlayer.isPaused}get isPaused(){return this.audioPlayer.isPaused}get duration(){return this.audioPlayer.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return d_(this,void 0,void 0,(function*(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent play event with paused state",this.ctx.taskId):(this.updateVolume(this.ctx.volumeAdjuster.volume),this.isPlaying=!0,this.audioPlayer.play())}))}pause(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent pause event with paused state",this.ctx.taskId):(this.isPlaying=!1,this.audioPlayer.pause())}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent seek event with paused state",this.ctx.taskId):this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause(),this.ctx.eventHub.emit(jy.mediaStop,{id:this.id})}requestFullscreen(){}requestCancelFullscreen(){}destroy(){this.ctx.volumeAdjuster.removeListener("update",this.updateVolume),this.stop(),this.controller.destroy(),this.ctx.activeMedia.delete(this),this.audioPlayer.destroy()}fadeIn(t,e){this.audioPlayer.fade(t,this.ctx.volumeAdjuster.volume,e)}fadeOut(t,e){this.audioPlayer.fade(this.ctx.volumeAdjuster.volume,t,e)}}var f_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class m_ extends Kv{constructor(t,e,i){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0,isPicture:!0}),e,i),this.isInteractiveOutside=!1,this.cmd=new eg(this),this.media=null==t?void 0:t.media,this.container.name=t.id+"_container_[Picture]",this.renderContainer.name=t.id+"_render_container_[Picture]",this.picFill=new av(this.ctx,t.picFill,t.width,t.height,{useFilter:!0,useSlideBackgroundFill:!1})}applyCommand(t,e){var i,n,r,o;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),r=Number(e[1]||"0");null===(i=this.mediaPlayer)||void 0===i||i.controller.playMediaFromCtrl(!0),Math.abs(r)>.1&&(null===(n=this.mediaPlayer)||void 0===n||n.controller.jumpToTime(r))}else"custom-pause"===t?null===(r=this.mediaPlayer)||void 0===r||r.controller.pauseMediaFromCtrl(!0):"togglePause"===t?this.mediaPlayer&&(this.mediaPlayer.isPlaying?this.mediaPlayer.controller.pauseMediaFromCtrl(!0):this.mediaPlayer.controller.playMediaFromCtrl(!0)):"stop"===t&&(null===(o=this.mediaPlayer)||void 0===o||o.stop())}renderPic(){var t,e,i,n,r,o;return f_(this,void 0,void 0,(function*(){const{displayObject:s}=this.picFill;if(s){s.name=this.json.id+"_pic_fill_[Picture]";const a=null===(t=this.backgroundGraphics)||void 0===t?void 0:t.getClonedDisplayObject();if((null===(e=this.backgroundGraphics)||void 0===e?void 0:e.isNeedMask(s.width,s.height))&&a&&(s.mask=a,this.effectContainer.addChild(a)),s.width=this.designWidth,s.height=this.designHeight,s instanceof im&&this.ctx.slideScopeEventHub.once("slide-render",t=>{var e;this.ctx.slideIndex===t&&(null===(e=this.effectObject)||void 0===e||e.setFrameCount(s.totalFrames),s.play(),s.onFrameChange=t=>{if(this.effectObject)if(this.effectObject.hasFrame(t))this.effectObject.updateFrame(t);else{const e=this.getEffectTexture();e&&(this.effectObject.createFrame(t,e.texture),this.effectObject.setFrameOffset(e.offsetX,e.offsetY))}})}),this.effectContainer.addChild(s),this.media){let t=this.media.src;if("audio"===this.media.type&&/mp4$/.test(t)&&(t=t.replace(/mp4$/,"mp3")),this.ctx.urlInterrupter){const e=Date.now();t=yield this.ctx.urlInterrupter(t),this.ctx.logger.info("redirect media url by interrupter. time: "+(Date.now()-e),this.ctx.taskId)}this.ctx.loaderDelegate&&(t=this.ctx.loaderDelegate.redirectMedia(t),this.ctx.logger.info(`redirect media url to ${t} by delegate.`,this.ctx.taskId)),this.media.src=t}if("video"===(null===(i=this.media)||void 0===i?void 0:i.type)&&this.media.src){if(this.mediaPlayer=new c_({id:this.json.id+"-video",shapeId:this.json.id,ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,target:s,container:this.effectContainer,canvasElement:this.ctx.view}),(null===(n=this.mediaPlayer)||void 0===n?void 0:n.sprite)&&a){const t=null===(r=this.backgroundGraphics)||void 0===r?void 0:r.getClonedDisplayObject();t&&(this.mediaPlayer.sprite.mask=t,this.container.addChild(t))}}else"audio"===(null===(o=this.media)||void 0===o?void 0:o.type)&&this.media.src&&(this.mediaPlayer=new p_({id:this.json.id+"-audio",shapeId:this.json.id,ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,target:s,canvasElement:this.ctx.view,fade:this.media.fade}));this.mediaPlayer&&(this.isInteractiveOutside=!!this.container.interactive,this.container.interactive=!0,n_.isDesktop()?(this.container.on("mouseover",()=>{this.mediaPlayer.showController()}),this.container.on("mouseout",()=>{this.mediaPlayer.hideController()},!1)):this.container.on("pointerdown",()=>{this.mediaPlayer.showController()}))}}))}preRender(t){super.preRender(t)}subClassRender(){return f_(this,void 0,void 0,(function*(){yield this.renderPic()}))}clearOnSlideChange(){super.clearOnSlideChange(),this.mediaPlayer&&(this.container.interactive=!1,this.mediaPlayer.stop(),this.mediaPlayer.hideController())}initOnReuse(){super.initOnReuse(),this.mediaPlayer&&(this.container.interactive=!0)}destroy(){this.mediaPlayer&&(this.picFill.displayObject&&!this.isInteractiveOutside&&(this.container.interactive=!1),this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picFill.destroy()}}var g_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class v_ extends hg{constructor(t,e,i,n){super(t,e,i),this.children=[],this.cacheSprite=new ep,this.cacheContainer=new Oh.b,this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i.groupFillStyle&&(this.json.fillStyle=i.groupFillStyle),this.container.name=t.id+"_container_[Container]",this.cacheContainer.name=t.id+"_cache_container_[Container]",this.ctx.timingTargets.addTarget(t.id,this),this.updateTransform(this.json),this.fillObject=new av(this.ctx,t.fillStyle,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1}),this.createChildren(n)}createChildren(t){var e,i,n,r;const o={x:null!==(i=null===(e=this.json.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,y:null!==(r=null===(n=this.json.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0};for(let e=0,i=this.json.children.length;e<i;e++)t.addSubMTask(()=>g_(this,void 0,void 0,(function*(){let i=this.json.children[e],n=null;if(!(!this.ctx.featureList||!this.ctx.featureList.smartArt)&&("Shape"===(null==i?void 0:i.type)||"Picture"===(null==i?void 0:i.type))&&this.ctx.smartArtShapeList){const{id:t}=i,e=this.ctx.smartArtShapeList.find(e=>e.id===t);e&&(i=e)}const r={parentGlobalPos:o,groupFillStyle:this.json.fillStyle,groupSize:{w:this.json.width,h:this.json.height}};"Shape"===(null==i?void 0:i.type)?n=new Kv(i,this.ctx,r):"Picture"===(null==i?void 0:i.type)?n=new m_(i,this.ctx,r):"Container"===(null==i?void 0:i.type)&&(n=new v_(i,this.ctx,r,t)),n&&this.children.push(n)})),"@ContainerImpl[child.init]")}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(t){for(const e of this.children)t.addSubMTask(()=>g_(this,void 0,void 0,(function*(){e.preRender(t)})),"@ContainerImpl[child.preRender]")}getBgElement(){return null}getIterateEntry(t,e,i){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}getTextElement(){return null}render(t){for(const e of this.children)e.render(t),t.addSubMTask(()=>g_(this,void 0,void 0,(function*(){this.cacheContainer.addChild(e.renderContainer)})),"@ContainerImpl[child.render]");t.addSubMTask(()=>g_(this,void 0,void 0,(function*(){this.container.addChild(this.cacheContainer)})),"@ContainerImpl[child.append]")}clearOnSlideChange(){this.children.forEach(t=>t.clearOnSlideChange())}initOnReuse(){this.children.forEach(t=>t.initOnReuse())}isChildrenInteractive(){for(const t of this.json.children)if("Container"===(null==t?void 0:t.type)||"Stage"===(null==t?void 0:t.type)||(null==t?void 0:t.hlinkHover)||(null==t?void 0:t.hlinkClick))return!0;return!1}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.cacheContainer.destroy({children:!0,texture:!0,baseTexture:!0})}}class __ extends Za.a{constructor(t,e,i,n){super(),this.cond={},this.timeoutIds=[],this.condHandle=(t,e={})=>{if(t)if(t.delay&&t.delay>0){const i=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger(e))},t.delay);this.timeoutIds.push(i)}else this.cond[t.event]=!0,this.detectTrigger(e);else this.detectTrigger(e)},this.id=t,this.ctx=n,this.eventHubs=i,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=(...e)=>{this.condHandle(t,e)};t.event&&(/^shape/.test(t.event)||/^time/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.global.addListener(t.event,e)):/^runtime/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):/^self/.test(t.event)?t.delay&&t.delay>0&&(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):this.cond[t.event]=!1)}isTrigger(){return Object.keys(this.cond).every(t=>!!this.cond[t])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(t=>"self"!==t).every(t=>!!this.cond[t])}detectTrigger(t){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const e=this.triggerParams;this.triggerParams=void 0,this.emit("active",e,t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class y_ extends Za.a{constructor(t){super(),this.isTimeNodeEndSync=!1,this.interactiveListeners=[],this.runtimeNodeEventHub=new Za.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=(t=!1)=>{var e,i,n,r,o,s;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.seekToStart(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToStart(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.seekToStart(),null===(s=this.commonTimeNode.children[this.currentSeqIndex])||void 0===s||s.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide",t)},this.handleNext=(t,e)=>{var i,n,r,o;if(this.isTimeNodeEndSync&&(this.isTimeNodeEndSync=!1,this.currentSeqState="idle",this.currentSeqIndex=0),!this.hasNext()&&this.isMainSeq&&e)this.globalEventHub.emit("c:next slide",t);else{if(this.isInteractiveSeq){this.globalEventHub.emit("shape slide onNext"+(this.json.ctn.id||""));const t={result:null};this.findChildInfiniteRepeat(this.commonTimeNode,t),1===this.commonTimeNode.children.length&&t.result&&(t.result.json.subTnLst||[]).length>0&&0===this.currentSeqIndex&&"running"===this.currentSeqState&&this.commonTimeNode.allChildrenEndHandle()}"idle"===this.currentSeqState?null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.startTimeNodeForce()):"end"===this.currentSeqState&&(this.incrSeqIndex(),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.startTimeNodeForce())}};const{json:e,iterateType:i,isIterate:n,isSub:r,parent:o,ctx:s,eventHub:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=n,this.json=e,this.ctx=s,this.globalEventHub=a,this.commonTimeNode=new by({json:e.ctn,isSub:r,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:i,iterateIndex:l,iterateId:h,isInInteractiveSeq:u||this.isInteractiveSeq,fromSeqId:this.isInteractiveSeq?this.json.ctn.id:""}),this.bindShapeEvent(),this.nextConds=new __("mainSeq",e.nextCondLst,{global:a,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new __("mainSeq",e.preCondLst,{global:a,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(jy.mainSeqStepStart,e)}),this.commonTimeNode.on("childTimeNodeEnd",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext(!1,!0)}),this.isMainSeq&&this.ctx.eventHub.emit(jy.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.isTimeNodeEndSync=!0,this.commonTimeNode.resetForRepeat()}),this.commonTimeNode.on("timeNodeDestroy",()=>{this.interactiveListeners.forEach(([t,e])=>{t&&e&&t.interactiveContainer.removeListener("pointerdown",e)}),this.interactiveListeners=[]}),this.nextConds.on("active",(t,e)=>{Array.isArray(e)?this.handleNext(e[0],e[1]):this.handleNext(e,!0)}),this.prevConds.on("active",(t,e)=>{Array.isArray(e)?this.handlePrev(e[0]):this.handlePrev(e)})}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit(jy.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(jy.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:t,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(t){this._currentSeqState=t,this.isMainSeq?this.ctx.eventHub.emit(jy.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(jy.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:t}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&"idle"===this.currentSeqState)}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&"end"===this.currentSeqState)}findChildInfiniteRepeat(t,e){t.isInfiniteRepeat()?e.result=t:t.children.map(t=>t.commonTimeNode).forEach(t=>this.findChildInfiniteRepeat(t,e))}bindShapeEvent(){"interactiveSeq"===this.json.ctn.nodeType&&this.json.nextCondLst.forEach(t=>{if(/^shape/.test(t.event)){const e=t.event.split(" ")[1];if(e){const t=this.ctx.timingTargets.getTargetById(e);if(t){t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer";const i=()=>{this.ctx.eventHub.emit(jy.userInput);const t=`shape ${e} onClick`,{mode:i}=this.ctx;"interactive"!==i&&"sync"!==i||this.ctx.eventHub.emit(jy.interactiveSeqAction,{action:t,seqId:this.json.ctn.id}),"sync"!==i&&"local"!==i||this.globalEventHub.emit(t)};t.interactiveContainer.on("pointerdown",i),this.interactiveListeners.push([t,i])}}}})}setCurrentStep(t,e){const{length:i}=this.commonTimeNode.children;if(t>i)return;this.isInteractiveSeq&&0===this.commonTimeNode.applyCount&&(this.commonTimeNode.applyCount=1);let n=t;if(this.commonTimeNode.seekToStart(),-1===n&&(n=i-1),0!==n||"start"!==e){if(n>=0&&n<i)for(let t=0;t<=n;t++){const i=this.commonTimeNode.children[t];t!==n?i.commonTimeNode.seekToEnd(!1,!0):"start"===e?i.commonTimeNode.seekToStart():"end"===e&&i.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=n,this.currentSeqState="start"===e?"idle":"end"}}}function x_(t,e,i){const n=e.split(".");n.reduce((r,o,s)=>{if(r)return s!==n.length-1?r[o]:void(r[o]=i);console.warn(`${t} not support ${e}`)},t)}function b_(t,e){if(!e)return null;return e.split(".").reduce((i,n)=>{if(i)return i[n];console.warn(`${t} not support ${e}`)},t)}class T_{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new Za.a,this.basicOnTimeNodeEnd=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr,e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.removeRunningTimeNode(e,this.modifyAttrKey)}},this.basicOnTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){const e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:i,json:n,ctx:r,parent:o,eventHub:s,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}=t;this.json=n,this.id=n.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=s,this.commonTimeNode=new by({json:n.cBhvr.ctn,isSub:i,eventHubs:{global:s,runtime:this.runtimeNodeEventHub},ctx:r,parent:o,isIterate:e,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}),this.timingTarget=this.ctx.timingTargets.getTarget(n.cBhvr.target,e,{type:a,index:l,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.basicOnTimeLineStart),this.commonTimeNode.on("timeNodeEnd",this.basicOnTimeNodeEnd)}getTargetId(t){let e=t.id;return"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),e}}class E_ extends T_{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=b_(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&x_(this.timingTarget,t,this.startVal)},this.onSeekToEnd=()=>{const t=this.json.cBhvr.attrList[0],e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&x_(this.timingTarget,t,e)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:t,delta:e})=>{if(e/t>=1){const t=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&x_(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}var S_=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};class w_{constructor(t,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:t=>t/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:t=>t/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=t.val.value,this.time=t.time,t.fmla&&(this.fmla=this.parseFmla(t.fmla))}parseFmla(t){let e=t.replace(/#ppt_h/g,`(${this.timingTarget.design_ppt_h})`);return e=e.replace(/#ppt_w/g,`(${this.timingTarget.design_ppt_w})`),e=e.replace(/#ppt_x/g,`(${this.timingTarget.design_ppt_x})`),e=e.replace(/#ppt_y/g,`(${this.timingTarget.design_ppt_y})`),e=e.replace(/ppt_w/g,"vars.ppt_w"),e=e.replace(/ppt_h/g,"vars.ppt_h"),e=e.replace(/ppt_x/g,"vars.ppt_x"),e=e.replace(/ppt_y/g,"vars.ppt_y"),e=e.replace(/#/g,"vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(t=>{const i=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(i,(e,i,n)=>`${i}math.${t}${n}`)}),new Function("vars","math","$","return "+e)}}class A_ extends w_{constructor(t,e,i){super(t,e),this.value=t.val.value,i&&(this.fmla=this.parseFmla(i))}resolveValue(){return this.value}interpolationFrom(t,e,i){const n=t.resolveValue(i),r=n+(this.resolveValue()-n)*e;return t.fmla?t.fmla(i,this.math,r):r}}S_([Em()],A_.prototype,"interpolationFrom",null);class M_ extends w_{constructor(t,e){var i;super(t,e),this.value=null===(i=t.val)||void 0===i?void 0:i.value}interpolationFrom(t,e,i){let n=t.resolveValue(i);return e>this.time&&(n=this.resolveValue()),n}resolveValue(){return this.value||""}}S_([Em()],M_.prototype,"interpolationFrom",null);class C_ extends w_{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,i){const n=t.resolveValue(i),r=n+(this.resolveValue(i)-n)*e;return t.fmla?t.fmla(i,this.math,r):r}}S_([Em()],C_.prototype,"interpolationFrom",null);class R_ extends w_{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return vg(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}S_([Em()],R_.prototype,"interpolationFrom",null);class I_ extends T_{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=b_(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,i,n;(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(n=this.timingTarget)||void 0===n?void 0:n.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t,n=this.keyFrames.findIndex(t=>i<=t[0]),{attrList:r}=this.json.cBhvr;if(n<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&x_(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const o=n-1,s=this.keyFrames[n],a=this.keyFrames[o]||s,l=s[0]-a[0]==0?1:(i-a[0])/(s[0]-a[0]),h=s[1].interpolationFrom(a[1],l,this.vars);this.timingTarget&&r&&r[0]&&x_(this.timingTarget,r[0],h)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&x_(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var t;const{valueType:e}=this.json;if(this.json.tavLst.length<=0)if(this.json.to){if(this.json.from||this.startVal){const t={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if("num"===e&&this.timingTarget){const e=new C_(t,this.timingTarget);this.keyFrames.push([t.time,e])}}const t={time:1,val:{type:"string",value:this.json.to},fmla:""};if("num"===e&&this.timingTarget){const e=new C_(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const i={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new C_(i,this.timingTarget);this.keyFrames.push([i.time,t])}const n={time:1,val:{type:"string",value:((null===(t=i.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new C_(n,this.timingTarget);this.keyFrames.push([n.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let i=null;"string"===t.val.type?"num"===e?i=new C_(t,this.timingTarget):"str"===e&&(i=new M_(t,this.timingTarget)):"number"===t.val.type?i=new A_(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,i=new R_(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),i&&this.keyFrames.push([t.time,i])}}}class P_ extends Vh.k{constructor(t,e,i){super(t,e,i)}set percent(t){this.uniforms.percent=t}set transition(t){this.uniforms.transition=t}}var O_=i(121),N_=i.n(O_),L_=i(122),D_=i.n(L_);var F_=i(123),B_=i.n(F_);var U_=i(124),k_=i.n(U_),G_=i(9),H_=i.n(G_);var j_=i(125),z_=i.n(j_);var V_=i(126),X_=i.n(V_);const W_="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAr5QTFRFAAAATwAAOQAAZgAAKwAAPAAAPQAA7AAA/wAA/QAAugAA5QAAsQAAwQAAsAAAfwAAawAASQAAZAAAOAAAJwAALAAALQAAqQAAiwAAmgAA5AAA7QAAtQAAhQAALwAAfAAAXwAAYQAAigAAuQAAfgAAswAAcgAArQAAqgAAZwAAaQAAMgAAGAAAiAAAjwAA1gAA6QAA+wAA7wAA2AAAbQAA2gAA3QAAuwAA3wAA2QAAxQAA0QAAzwAA0gAAXQAAYAAADAAADwAAGQAALgAAjgAAcAAAzQAAwgAA+gAA3AAAGwAAoAAAowAAcQAAVwAA1QAAIQAAWQAA5wAAsgAAuAAASwAAbwAARwAAMAAAnAAAUQAAaAAA9wAA4gAAPwAAbAAAOwAAlwAA0wAAjQAAvAAAwwAAkwAAQQAAvgAAnwAAvQAA0AAA2wAAwAAAWwAATQAACwAABwAAQgAAtgAAgwAAvwAAgQAAlgAAEAAAxgAAtwAAmAAARgAAjAAAdwAAqwAArwAAywAAYgAACAAAmwAAHwAApQAA8QAAdAAAbgAAFgAAgAAAogAAewAAXgAA6AAA9gAA/AAAzgAA3gAAkgAAngAAdQAARAAAmQAATgAAUgAAJQAAIgAAqAAARQAAPgAAxwAACQAAAgAAMQAAiQAAhwAA4AAAUAAABQAAeQAAygAA9AAAFQAAVQAAyAAANQAA4wAAKAAAWAAAZQAApwAA4QAAyQAAXAAAkQAArAAAdgAApgAAHgAA8gAA/gAA6gAA8wAAFwAAHQAAhgAArgAAnQAANAAASAAA7gAAlQAAJgAA+AAA8AAANwAAJAAAHAAANgAAkAAAKQAAoQAAzAAABgAAFAAATAAAeAAAAQAADgAAggAA6wAAEQAAfQAAVAAA9QAAIAAADQAAEgAAVgAA5gAAQAAABAAA1wAA+QAAUHExBAAAJDlJREFUeJwlevk/lPv7/2XtOrKNsWcbzGCMJSmSpSxJZtQkjPEOg5mxRWns+xpZyr5ECGmcLIOsdVK2oyJbcVI0J8fp/Bff2+d7/+BhPO6Z1+u+ruf1XF4GAEAGZOXkFRQBTiD+dgKVTiqrqKqpq5M0ZMmaWtoAOrp6+qcMDMFIzdiEYmpmbqJBpVlYWtFJitYMG1sbFTskLvvTDmcQHM+ec3ImXp13uYCubvB/l7sHkC9eAk8jcy9Eb5/LvldQzQ+v+jsw1ZAlfwYDAK5dZ98IvIlBwXRNXVYIJ9TpLJUb9j9LvBVOj4jkRVGj/Y1i8AwiH09eEwhjMU4uXtsiAWLlqInMcLh+28okKRnuhNy945lic0+Uqu7NdErDdB/5DBo7MwuE4J+dw8jIzcsvwEIUFFGEisWQm1ACpcZlxF7vl1c8YMCJyqrqGio+fFRbVw8NjU2uec0isNWhVuq2XMPzmjcRBVHhSWCtXaPR2mZoybHzL0TUfmxPabeR6yg/+6QTY83VQNOkSwkbumsgkgzwtKe8tDdHYM7ts3sW1Q/Pn3PEWaGmYjoje+B3ewx9bM4V0LNfDB5XL3/o5v1hSBi5fzvQkQESOkQOwiiwI++5YBdkDjFIrKEx3cZK4Ti8eAlZpjcnYMSHKG0ygKKVeFSLRpOZNL9p19Ku1Q9enKlp45lZiQGr7hlWS17RKWp03mv8481cQnwBUNTAXwIUeAvsJwCCTnV4FyJC9CrKYDnOT91DpRZSG8Bsn7pAw2Ihd7Hn7R0hynXezjQcvQTyMGgUjV12kiW75XaR7Z9OK9kD0/j6ckfyk/fcPHCkvkz48NG/r3p4FeRpoQa9JA74sJAOcLubirEPqXqTpZ1hNzUN5exoNVbk5RmSOQqcJix5yWvvRZZ9nyay+tqAsb6U76oAwo3wgXvJkK6sCpOYQBTIdT6cg92rSxWh16pdV2c8NnDzfQhveqvND4k6aAB0ssWnHuL2yZQ7AHLzJTgUrreyZeWewhawpw1RMDWYHLP1OcNQgKzwlKVP5JV5crB7cZ+NRJ6AB3wx/x3RsEufEkozLu+g7+zkekfLbFQo8byEubp5ld7Ot2CQKxJ7qguZxF4SB3ozQF2pCEIbcaFxg6eAr0/MbeHb1DCK+vQCA3j4YTcwjNiWyEgcq1dRlfnXsq31K3hhhvNX/CYM0JC+asxk91d+7ahTr6AAaTAn3U2lTBfjIc1pr5VEX94yw8uIZhWQVAHQj66iLErxDLqNmN0wuO9hYf6FN+boQb1FjENYJAiWKrru2ejWzoZX6M9A91p2Sw1TTRT/rdDQsyiOT1f6br4fKm6Fpeb9qocNfvYOLPAuczuA5BTbeVT2O/ghlkYEScGHX0Df3StfyMT4iYHCTEQTLj04iWePVx6aomPYGLc08OXB+drJLqoq42/wXqB5eagtaqR+ZAPsymG8utBxt1rO8zFTPHITA50gCMQ4Gw7tQBZFo0DBsWb5ExlyKoBbvRAO7jdv6U8jMYne4Y+iWXmg53gvbNYsGg+gU3elEnaeXB/ufFUKJiyZdNZemo10NviBxr65KE1k/Rijg8KTan5647eoiJQAYPIL+9fuHPb/VSMucg/bcJHzKt557SPRYF8voq1+2SIWmSgQCZo2ZjhlymMigEZdZQ3MzX6wmmMTECwNWieLpWDlKihSZ2sVVwNX9AmecOXtMHP7C/WwPzvKbZqiJIYFZ7PuZngFJmNi9YatOLLQU77vGbS6PzGdsQVn/Ad7nQyALeZVbm01GA72t5bvR/aWTWVIIEVDwDJanzjqAc8QuFl4Yr9/2WTdPVPmHCtY7ZEZ4mJoDqURsbWcaHwtmIqJWrIXshpck5ilsHlYM34YFFXTG3dGzKrDMBxB8gsDn7G3bW/TDpe51ALDmy5KQW8lUgg4guspE7TN7wCTbFWnf7gBB16vuHtYoXsWo14j1cD9/Z+oyj5GF95jqI9KG0s6YtJ0N0jtISrVAZQcIO251QuKrBIaH7k2hLK/Mw8pyNmCnott3tGm6XjT9DsZUps7H8DCHwjc731hFRtTaF2UQ572Ca4Qp/On0RVdmFD0A219YL4DcFBN/lnfBvNr12E0W2MSZatepyNLVIbbFIg7jaYfoR/4W1VUKqL6zsF4NpNiq4orZEhCEjExd7AQ2j+B6GMOPmekeA7+DsM0IAsIqj31xrtAzvWqBsjmIWC6+uBONItM9R+HA8rGHxptX9JAF/G0L6QEiy3McdFEhp4+YNA0FHNwnW0/RFFEtwHRb/hwQsbzX/heYihsB6nNVJssfHnqQe/acYKMv8LqcRe7aEF7Y6ugtWxKLILeNmlzVF277PqxIg8dSxpo5gsaMBFxfgwvdWBhOvzOHHHzx4JUHLNpyc8LUzkLcfiIv3A2jQxpeQ1iL4IKUJ1dTmigtKLpgi6QjX2d8ISbHl1B8bH0UEbnI2DMVm5h4+6Ko+kTd3VVSVPGkpp4/p+BW7/faCjBhlD7MoDqRpcOJxz6lBe8gWYtBP80qaKf86k0FP9L1ziS+Y1m8MPaWpcD8BXkG2flILIvKvoC/hr8upkS1N2pwbQD5NtZmC6iNb2JUVJTRDoZxTXibAjQDp3w/y5Bhld8zynk7OU1S3S3LPnJLvjhzcfUaKeYeJwtkmPDDbYpWt0gTaf8e/gL32vUwV1i7lHVD65CN0n+CySLiHLZfbSx/XYollUUj09xeL/Cjqg2DUp2eM7igsEZPyXlnve63tfjYjZSbBwtUf7mlAhvX0N/CzxFIKE25lol9uEzuf4B95AK6EAVtXBSn3XGA6bVuISAxQuuFKTClSg4xz/VEivy43BYA1UY4x7aSd/i1RMdwdgzi68x0JEYIfLBbEMag6Kcur0R3WGGtXvT2744+WPE4QaWz1rrbq5fEmwQTMwOLPRNs2jAJiPTPpAjXA48lyGNDo/aEnNyEv39YQtTIKcLY2gVw/SWl2eGCgmvgRKcowIU96xWM6PvyJhk/4dRHbP4A2JaG+uq0xb1J15Gaa++VgngHKhh3L3grVzTsa95kyjw3wgZLYViuASK6smRQA8Ds39GAisCnrN+wiGik1BsIZfpFhk9aVvJNr+pUWJbSmxoOAqRzseBsHsCPJ+9EvFA6HLDuymPuB3VbLuUAeRzs5AnmhdV52drj6JdA/9JE6GEWqDZIrYYlrYCDM7hLcefRsAoFiZc4P3tYx5qFsH9ttFzAL0L/lgSwvjbS4Hlik7xGLuSVfejKzFhvtnHF3039B8VGq1UCpg4+cLt0KMDi46N3M5F9YWHiD/InKc21mDdj2pCGZNgqLihu2j14oFnH9dxycOd1FsVBZ+cMEBkuu0U7wwPJEfc9SWATH9MuG0EvfyJPxuf9enmuy3ipIOtB/Tq8fRSfpzQFs03/H+7yBgpxgsOgaPD69B90NfAH5SMhqmB4xns1ARtQlmao4VcBTRTDeuo6wPwzlIp/AQcGagk6KNOsPIQxV8P+wi/EIUDDVLWFGWvjTzIZnkLRH1UoJhWpXMTjPAjt3UAX17p6WGAJwxrWKi26AC0+gNR2jzhlwfEJrgvQCombOyaY8/bLwB9fMvueMLQvWNkBKGC0lq0Ht3KzP5jCcE4StVpESb3tdp2iHeZtLDMQ26rGa6n0GpULC4tIz4jBBxadsL3wHdFQPwahEAq1xR5rwJkcKwXQrx0f6F7awZw4fPbGa1gUiXJVpYOUgng1Il6/kdwHeGfQlS+PdZEZ/WbBBOmQjvC0LG6wpXRfApSSh5UP+GjCtGd2HwGkHtuvHkJDGvpqBlcXLXap5CKR9eJRzlgZ8W4zK891g7/yQl4SpDRz5B6E6FEUxFv8K/4i/p8Hn1DOZxLx2FQHi3X/cwgM0LCK+TZnTMszAMO3JUIXyO6zOQNiThG4OXOrwJNCE8XwV95JJ175KWLydZwJE882VhaOGyWMiSKcP771g4kaYKUFB2Dmz0JUdUk75Pplh8T7VBZwUY90zTpUDwWxIJNQ4p3+oSPgHVcJUQVskdpHklpVCunu2AMvq7HI2HuekbnizilxbZeVzVwQLUBT133fJUvswkKMu+OHgCDmIJX9+b8TDTiXIyTQUrXPXFm5NsIOF7X6snH0GkbLAqxPlJ9ecWoX5Ywy8Vl/GgAlgE21JAfp4T0F8NwItrDq/BXLuXDsET46eLTOOKK5svMyhZ3Ah1ePwHOvYdijiwWbAEJnbIP5V95SOcbXM43qIJm+5G32UABbhvaNNvRffVynh4jmDDQ3V+XtC1dHWnr5PFwd9Ds2UdVaIEHmECBo9V1OAz0w9Q7ZONc7xXtF+8+ETCmmX+G7+2+flmEDTEww2Dr5eQAbJggPltoLQ9vmismCRLQYIvSsXqDWOIS85DgRSlAhWjGdOxACJXNVdyGoSxA1lu2eETiYQrdn23iL9SxSRCa5LgEX0CruBRSxHIQWrdV/mq5qOUyNgs9QUYv+xsmlhwRichkxSqZko2RwH46USV7CUofNLnT23rewuaB+3Y+8g82zzjibgmdChhbQRFk34o/zPECaRHy7wKj5wlFDE8H30Jva81PwVlVT/UNLeH5C/T9cIDrBy3capubs5y2F7ATbAwpRvThn7BsaBvwbu0BBMDxHEtAsSE3DVOdF+kWWcXsfX3AFYeWSbrZP/TS/H80MGryotBYxj1U8rWXomZeevT+aQ0crFNLeulQLpiCr0J3rB5jTS3MR+wbSYRJirC2/5eEGCMHpzOUFWEplMsWaW0SVaCL8y8rZVI4hiy4qyEC7CW0YwNHTGLxvJ2vW6GNMctZQNF8YFxN+y/di6ENOZNtphmlCkIZsU3uvDqzlidm8vQCrkUfzYk6D4AYr6tk+mccy/i8xBKFQzibM/wWTIysZ6cDt/XhySBb1niUMBJRN+ILdWbj7Z6dnUgLZELPYXWeyXNhzV48NvUbAWzWEC0lD8PwVIGTt6rveS3h3gX3XiVRg1O5poRFvgPCL17nEx324dKJT5AC5OU7RFWXuEp0U1v+MRgY7mxikdoB4lle086YyXrr61aA8eVem+VOaY1TKn/sOxOeRhIcR4AZLNrygau7faIG/T/vTPO010Kbci6K9mAYPE3+D/Q/02VDHhOfPxxTud5MF+8KsrdY8Bw4TELjh26cdDiBfCo2ptEyDRsJrRk1KZcvgta3ckuK5CRPn7AxcptUHMpozoAU68b9ElVYL1uhaVz7RTJwRJ15W+0X8HZs7gUMi9wPAEik099Y6ilYhW7j1KNLmlFXlRwAb+NvU+PbN1AfHY1t+/sN4J1JVfn7FDYLloP1Scsg9GA3s2b6XMPgHYNbve6n3ghsmK0WGyzvNrCU7t0veADh7RGOKA7vXwYQc0uuPZMJMUQMLbBdz+2kFzkStJJNFEvH/f/cT1wnXJfsflkfnn+qJe89nGfU5c6Fpsd3vp8y31fD+eHg8uZSYXdwqcoBT9DS0aTRKoaZrdSqk0KtkFZb4+BBqXAnpKdyVLXBuP5clrK5wxSYyIWrghPCaNnLhJkp/A3x8fsMgMczROQeBhpGULvpU+ZNQqKLZQMr2c5uvEvEMHOemnBn5rN1M88Y+/TkhOxUIBP/2P2jr1+oIelfW2KEQFOnrjfGzrGWUsS6YsjIBTxTDwc64bw+fGhfW5AnvnpxLYAJDBm2lJ6rvaNZZMrsfTANYByHtYSbJahyNwhmaepqjdIPb+zS9jVAgfRHPZEjU1Gd3rhA/5cI2/I7HkyV/yE2rhd7VLRC+6h3nRnBwqHqGw2HNB46i9yPFIYrAbBjbP8Xiw3DuyzbyCf9d4TVDRcSKQussrgoejwBiAjYwZi0qcQK8KuYyotDvMBHuWgDgNhVUXyHsaOlkxmK4H0+NoRd5BhMX9v+E0DX3JzZF4fOt9EZhbDdj5dngkuAUBvofWKvSxgvWN/JXhGtuib/SxfY8KRQCXuP9M9m4RKN/YNl9WjkI76xL/vI3tkUW8UwNyBJ97wf3vZkr8zgZWjt09M51pPhhhhIa5n7iOjQUKxcVfAILZl0T4jc7FxaD1109JL9Ca0sSBbrEuNCQcFBiIv+SZSJPYe/1EYItPw54SrCk2fKxMmvjDJ19ORWT937dR9t2yrEWeJCbBTuaVFvARwhlXYkVrmPmMoeHL//5uHAvRj2Y8axOXO33AUsW/qXsBWn9CxkKIYN1C7xCb9tfTfE+3+m+utf4yM6L/i+ic02U8cQ2F98GKWj7KuD2pLDXkPCLCOzaCvJfwOemmSw+9kphfUY4yI+yj5/MmQxX+dJTNMaPNhkZY4Wbc3tEQKBn08wseAkoa6qqIQUIOD3kPmDGdgoM1ToC4KklkiDUBk4Uk/Fidp8zCJcFBMgHj+etTxbRFeHvwhf80CiSt3z3DIFYl6k1lWLVvRBn0lpMVKj6PITC0tar9jbVAPhHP8k4rhblOqCcOdqrAPy67Z1WL4TfMfVx0GLrHQJyH8iQUus8lkFKuv5kcYrNvW13YfKuZ89ORAmC15BmyKxBFilYKq8dxQRWdqGLLb8Rij6WrIs7/mxVyFptbrarK6uDO1v3yxzOWQjtaz2W/01pTvN/Omyfx8D2VGPK80olW8HfnliYW8J7UjIcIlewB+DJW6whrBEqHlPOAQ8W/xs1Hn5GmuasOM+K9M5T9RYI+PMwnvMsCTG6r+dbVXfMESA2YjneGLq0D1CQv4w2JrzNXBsshiH+QHHQa2Mr/AZ4I3FCYwSF30Bqgti3TOnZKmjAfxUANcv/0JqQQ2HHnOhMOwJodHns6/25Jg743Q1lQ+KbmEPuPq51Bt83snYTH17IxKtNv2roT2epeJDTPX4a0X9SZHNHJqSie0RtRDgKb5JGNRAJr4h2aypQVI68DWseD13hXjPfFQtgcpsWw3+bHWbYNMQ5bN4cjo9d8aBirB8/oJdnePZQoxNeCAZZbotwjOCA0wROeUdcuZjnmA4UdjXjcB5b5xb9AZYmwdFSH2DdhvscW5z5QnIMnYTFRngKajbkSdjvvVyWw6LwIJWxlYhshBPGlg4xDUFZOFLf2UlA4MUe8DA8TIea+IX2smNzuP0vmleE8ArQR+UsNqTqekrljgz0+vhX5+FaB5qs3t9J5cPuwScX+MPS/UkluQXNh5WrJFM9p4CGban0P71P43YKxglb2X+cyKQ94h/diX4v9RaCpnBsnLBEiBNo/0idpiYrznuGrJbXrCBGfcS8UOZNOTvW4hnUTwJkuVcBHodNx3R8t5LtTDmf9/EmsNByWOE4XyHplSzut+ilAlOYAW6FAoMlRP17j9CYvp40MImU7d5GfS2Drx+GW3yciuygcSeJPwW0wzd8Jx7iITtZPchNXC6aPAtKQrB2xa8z53r/+NXr2nhyLPFySAhSY0IYOQBgKT6h3kSWUhtwoeuSh11H23xn6OOue1lRwSZFtnWn9cdSaaEGqWp9dYsa7+ChyZcubQzxJjXzXLk9h89vBXfZGDIlvpsP4QIbmPMjqxhqsBfefv19nkI6ATGqFQsHNSKV1bi5RDhNzYOR3Ckunra8gfjADKT/ll0bAtT+Gyj2d7NLfv1oX/s3Dxbwcs6upK916xmn4Cn9qoUPECeybc02KdxfxGRB0zT8l0Zikliu1neuQQ0TmnzytBG1jCdcA7AUAfwLbEnAjIqNRI/tr3AS3HHzaJJ1AVHLTuHM72nkWqYVDDf+j66wmI+h8Lmvxl4OGEXnX3JOrwBz08R7ELtwHigs810rOj0viiWN/+sC7Ni5oBKQ6bZk8eHN3PYLZzQgVjEb5jNex3lMrEC0EzpQ3faNx4xd523exujDDnuf5ZP5S7v7/UuKqkqW2X94NfxXy7549ho3WWi6n1Vt7ABUIeJc5cdqWkRZrf4aNACabeODzxEINKtnW6CGh5734US98i9pjARiQfrdT+ax6iuaQ68hRSbykUQcJUr4DoFBkm4wgd2hq4tBIt5iGqkmIYjIK97X2Ac+y7Al6Eas2r5VF3EkYVixIGsqzlkm0RXA05xqwaznFZjzk8V80Y+iIDhMyNdfSpEMp3IheR2cbKGSnSfWK1HK5rU73te+Y+mp46Jt6oD3xe3/MKUzoD2UBzNmu3iQW2uCJHd2ne9t/x3h7lnn4kBxCEAK//UgVlyjyz9W5JHgDWu3g3OlGHBZO/680MjgZCrLsuOfLU+5jPl2Pxck02uqzyqmPlhPA0isbdnhRis6Qh/S179zV226tq30IMf1KqJ+bHgSCHhjM64dbIL8GGt21vGOEXP+/AJcER6NjIb286TKSzTCCidNp6Zf3rpsWZnG5dNhuEqU94Fd2sYHaDOgM3A3LO9nxQazFRTOJsT7cD4eScDOsG8UfQGqlmCqM7L0/3ZpnWylRSPqBu/B+eHEfYNZO+0QTaWrYVbLURYIK4TWR8iESRGfHHQWgthnGCFSR6XhpDR2Xtq0uhr2QQvOUVv8Giw6ImYIgOdd8OPo1dxm1hQCQV84zTzso6krY75wTfRjcwV5Geb/tJ4owfFd8kC7FDPX9B9mBYVZ0zuK21vYoVpvazdgKlwKfwFKZSgPgFfDQtTRYNOvy6JNZ7OeYCWEFJq/hygT5KPD9mIbenEBsAvHdzCG/K5iPb4S4aP/YhnMDJHIP/icNM6ztIK9gkRRdA71nyoMef+2jb3neklwx0pHH2SIdKb2jwOWG3JCmYK4Iva+7eEG0a3If9Da4KaFAGMYlTTCfFBFSoyK7YMSwyuICgV8M49c7bf4VqtKi5LOaLKCJlVZ5zBpLrIr9LvsMNctO/oiM3ab/MknNJPPbnirNLPbGflQrRr2aJJYXg/QIsh8k1PXzz+z9w5gIxiXea4P0RlO2OUDqhJdvv8EBpRLy6Z9p8GR+FFKgDHcGsMkkbMnJz0q7hAhDVdF3sCfBM6hj2P4SlE5njIsBmSky6FhkNYd2UfgLt37a35+BEvupCA+Jh5kmC5dWaGeQNmz35EEQvhwZG3qxKo/RZr66hM7IJ5Won7gh78anK172Zt3buKAMKyMDjzdR9ufcCZ0zU4DOA5RKIgkAMTbytB3LQFlT5MH/An6qfRJPjj2dg5WFP3mdlZkwFePrA+3eN2Wu0A+WAFKZrztzJRibcqCweEddxU/PSGWxOnjHtOUDzfDk9lEvDDj39cFH1E9dVeQLGVI3Qgeo0M34dZ6K/3cb9BBZcZf8uS+BivagqBuLW31L60FMADuX1jiTur3n1ZrBrIgpkFO//0OmyT9qWthHcnwzLRswTdDbgUflRNCAvfaODDSX8vQLo7QBDltK42Y/OdFbS1zUYFLv6qSiV43zDiUrcAtbEqoMVBPa37+RMTuT1gmrJVH1qqYsi12cyakNWPLrTGqg9NO1KY2vPwISkCnxobu6FodJWlXUwABhb1LwveepTps6Tt0E8j+tabfLiI+MdLLWSxLqA1cJON1hz8aZkisUWXUMhNOQpLrIR062CCV3Bg0ZwlU9OhbKefT1NjDog/g2q+TAW89zQllayE0d/y9qAdSAucb3iKOXZYzSSmdealQNS1IL3qMUpowYU6uuO7LEqyPD05MgXvXy6frzzrkpBXlAx+J30gur7J4OT/ziwA3fvIcKvLAHet4sqms0BCkZk6CKbyRPu8Xqwsv5KGfYcI4thniGI9nFwFwt1bfZm9racBom20+/R8n0upa1EAueM5b9A7lN3BE9empZqOTj5NkKNeCf630MV2jeKeEP8cImJ5W9l3gYGDg1wPxxZcmBvsZ4qZXUMim6a/M2jKAsHtYvPN1A0FsH3AAbpFvCxA200RpdN9ME2nSQL2g5pg9OIw6KkYT3gKe7QmWrItoXK1c/XBbJQ6pVOca2BzfQfoOCTygsFljpEPDG+tBLrte+jUDP2DcYKLisBjhgtTZnAmgmg8/Aus/awVIZGqScBZ1xa/82qG7rzT0BDLldEs0sP5HS8oNhU3lhDue5NS0TUt0T7YTZvSGH0HEYEs97dJ7xpNO1TKokYmLWenco4PvNEsv2hQ85pcgDjlA29jwVT9IoAcXQGCnhPG8fgYyhJ64NNzBiWf5p1XdoBx+xtXoPiVbK44FcHipEqTaar9/ruKsdneZuJmevOHPOjhmtvwVVX8Nmx+/eftj7gZmxlF3ocI/n5T0byPxzPfMi24AxSQeAGjdI3Q4hc5ffAT7v7F89ZNEgj6fheuHl2hjRQlG4EMMwpiAnsm1HT499a+zKPMejH0uAfnT4JyItDTiDQ4l5DoO/sQZ0HkzGpiM8KQNwaHk0Un9WaO+yuA1ZTV9z8Jm13bqwTlfNHncIi8M/kHQMFhMF7Imo2mUw/Sox7Bh3W6UplqvEiy+g2NvVzFPCtGkHSTLuFSL2CtGzpPY+E5O0PK3HSbUnBzNBZodkNnUAlch2Zk9/9F8JuAYBirgoVpE7QyheJ33WDOysDFYMSXBdm20XfXCWcGzsGyvXE8FJN7EadsGjIDzZ+GtIUEBWuQ6o87kaDvo4eplYs4dz6P06lSSCA0yAvpXKD1djjC8dnWdYtWsLpl4Fplhje74Y6i/M7VMSQnRvD54/CC4LPzx4vghhIOzVo6bLzl7QIHPvVyM/drqBBZ3tW1lYqvXfauRfH5WHe+RcHI+xxeqDECqJ9tdXLyy9L7RqxyUaZKwmlAux+zEzdzITSRlr36YuSm0LBhTpkivodWytR6BNULFxftqF42QqKLmoog9WlYNRb4GtNm93bHuxBvV5VcOUeY6N/9xDutwbqYhaN3rIzpg1M6XfrYctTdA5Msr2v4Aydmb+Nl2/Eqw+jSXYvctmuDHYUAei0pUc6E5N1bULPEjHAr+HI3gwDjpDg0nE2fMkXneCumq9ifZR5IKUOqn0aDIfN64olrhaHfV4msozkdG/3j5HHqsf5Els8kwvDrCaK4/BXb+YzYC00mJEOu8njPsKgB9dG+FjqqeToCsJKLTvHS+iQTnqFquCJ+yCckuDaHLnP4GzroGg7BelrYZWStEFay3j+vkEuXHy3B2zG5xBqSx+/pxoEOv+OfiCfq5QMCCNq26xXC+1DZ+eQdH2jJ9FXSh9yrISZTk56jTzMIzG9+Ye+pumQffxmh2lcvPXjmNWL3PoOgRpkx4o/TZzE2y3IMtEZNxpNUlBqFlnBVXuPS0TIBkF+ZfvW3y2bGWD14zb8Cju5+wiSW1pIIRRtD0DeaxOLIvup5BZ2R2QfQVx6ryHH4H/rls/fRJy6KIdsJ/qVsWrBZaKgKOhP0GOUjA16wS+vlpcmot72SIWJWQDwyiD04TLSU6LyObtnOC2W5QA0OCGXHtlTi9Cyh95AIL8UU6AaQOaDSDfuf3DbxO4065WUdqPZ6Zj9S26jGlhDs/3mX1c4h+to5J2UwvgO3dkFtmKMBF3OuQvskMsOO8R5FnXblT4zMUpkjhs3m1ygag6zQWKfFOQCFM8jmAFtaCpCqDX77xqhE3B99uGU3UT+41SufAp9fQENvgk5lwqneywazIE9IpGT8v23sBPibAHG34mLWiivxnjk8p2S5ofshihnLQd4CU5ABpVcMX/5Hg39Jm55k+hgxugBCGIR5KmY+qz6US5/wKYimBbjTOSBlyD9OiYpWxtoLH6PcoaUdK0dW4vKR121dfMwumvgSBf8g0fsVN0w8jbplh7Df1FVC9wZuTbZStSswGJu6IngHRvBgOFag8F3hwPVNuUYjxNngNURuMvnnOvway+3l+1sK7aILbzdSzAxUCtG9/CaaHsBFIVzMWEH7upNL6Hr6P+oI4i+VqT6NyQrYUMkRXYd2P1ZjEMDaJ1rrurxTBgTfMw9cZe8SHIAz0JA7jpgDmr+InVbg0HrkFNZVhQ2uBKn75tLEZwfMp2azBhkglsAXDPx2BccwTDGmnsjRDh2jHh9ynTQY4vLqcuv/NWRlP8sFHWyxSmm38ikF1UoTywoZL0oFE4I4ujqIcvCuo+0ABPohIMdyq8EqgTcogXcYNCGdgvytDCA/fwt2eG78+OAANOgmKkOI8WdjE3FaFdqW6rx/oOBunJoqMLOwnPtv67Cw7PY8c4jFvek2G/hk1Thivu5Pf2iV8YDA8DyziBPz6MKlF9XQlRt7ZRV09nZrygwo00ME7IpFuOiEsUrd14UcCvNC/DPkbFmqB1uQIg477mFiq2niVADUYnvdjiQPNpFfMTo4yg4X+tDW3rmH2WE9E2rY0ES40wM6QRwaQL5/fepJULkj3Zc6L1ItuWmO6zXbvou399GBCPcQwB2+rRpubsw03qWL2iRyHH9Afl/YHuFYa8v7zEXDEigXJo9RAtTM4BTzElQhSgePv55AmHTo4W9v4SmkPDlLIhOpcXBK4GO2AnyzeN0MaKP7umX9bZAfc5LA84bxj3frYCxezbP9KG7QeJzevIhiAU4p/j+y2OyMV2mxNgAAAABJRU5ErkJggg==";var Y_=i(127),q_=i.n(Y_);var Z_=i(128),J_=i.n(Z_);var K_=i(129),Q_=i.n(K_);var $_=i(130),ty=i.n($_);var ey=i(131),iy=i.n(ey);var ny=i(132),ry=i.n(ny);var oy=i(133),sy=i.n(oy);var ay=i(134),ly=i.n(ay);var hy=i(135),uy=i.n(hy);const cy={wipe:class extends P_{constructor(t){super(D_.a,N_.a,{percent:0,direction:1,transition:0});let e=1;"up"===t?e=1:"down"===t?e=2:"left"===t?e=3:"right"===t&&(e=4),this.uniforms.direction=e}},fade:class extends P_{constructor(t){super(void 0,B_.a,{percent:0,transition:1});let e=1;"out"===t?e=-1:"in"===t&&(e=1),this.uniforms.transition=Math.pow(e,e)}},blinds:class extends P_{constructor(t){super(H_.a,k_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="vertical"===t?1:0}},checkerboard:class extends P_{constructor(t){super(H_.a,z_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="down"===t?1:0}},dissolve:class extends P_{constructor(t){super(H_.a,X_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.setTextTure()}setTextTure(){this.uniforms.dissolveSampler=Vh.t.from(W_)}},randombar:class extends P_{constructor(t){super(H_.a,q_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="vertical"===t?1:0,this.setTextTure()}setTextTure(){this.uniforms.dissolveSampler=Vh.t.from(W_)}},circle:class extends P_{constructor(t){super(H_.a,J_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="out"===t?1:0}},box:class extends P_{constructor(t){super(H_.a,Q_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="out"===t?1:0}},diamond:class extends P_{constructor(t){super(H_.a,ty.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="out"===t?1:0}},plus:class extends P_{constructor(t){super(H_.a,iy.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="out"===t?1:0}},barn:class extends P_{constructor(t){super(H_.a,ry.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="inHorizontal"===t?1:"outHorizontal"===t?2:"outVertical"===t?3:0}},strips:class extends P_{constructor(t){super(H_.a,sy.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="upLeft"===t?1:"downRight"===t?2:"upRight"===t?3:0}},wedge:class extends P_{constructor(t){super(H_.a,ly.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])})}},wheel:class extends P_{constructor(t){super(H_.a,uy.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option=Number(t)||1}}};class dy extends T_{constructor(t){var e;super(t),this.filterType="",this.isConflict=!1,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{var i;const n=e/t;if(this.filter){this.filter.percent=this.commonTimeNode.applyTimeFilter(n);const t=null===(i=this.timingTarget)||void 0===i?void 0:i.container.getBounds();t&&(this.filter.uniforms.uBoundRect=new Float32Array([t.x,t.y,t.width,t.height]))}n>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{var t;if((null===(t=this.timingTarget)||void 0===t?void 0:t.container.filters)&&this.filter){this.timingTarget.removeAnimationFilterQueue(this.filter);const t=this.timingTarget.getFirstAnimationFilter();this.timingTarget.container.filters=t?[t]:[]}})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[],this.filter&&this.timingTarget.removeAnimationFilterQueue(this.filter))},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[],this.filter&&this.timingTarget.removeAnimationFilterQueue(this.filter))},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.addToAnimationFilterQueue(this.filter),this.timingTarget.container.filters&&0!==this.timingTarget.container.filters.length||(this.timingTarget.container.filters=[this.filter]))}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let i=1;"out"===t.json.transition&&(i=-1);const n=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(n){const t=n[1],e=n[3];cy[t]&&(this.filter=new cy[t](e),this.filterType=`${t}-${e}`,this.filter&&(this.filter.transition=i))}}get modifyAttrKey(){return this.filterType}}class py extends T_{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startPos=null,this.onTimeNodeStart=()=>{var t,e;this.startPos={x:(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_x)||0,y:(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_y)||0}},this.onTimeUpdate=({duration:t,delta:e})=>{var i;const n=e/t,r=null===(i=this.path)||void 0===i?void 0:i.getPoint(n);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{this.timingTarget&&this.startPos&&(this.timingTarget.ppt_x=this.startPos.x,this.timingTarget.ppt_y=this.startPos.y)},this.onSeekToEnd=()=>{var t,e,i;const n=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(i=this.path)||void 0===i?void 0:i.getPoint(n>0?1:0);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new zs,i=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(i)for(const t of i){const[i,...n]=t.trim().replace(/\s+/g," ").split(" ");if("M"===i){const[t,i]=n.map(t=>Number(t));e.moveTo(t,i)}else if("L"===i){const[t,i]=n.map(t=>Number(t));e.lineTo(t,i)}else if("C"===i){const[t,i,r,o,s,a]=n.map(t=>Number(t));e.bezierCurveTo(t,i,r,o,s,a)}else if("Z"===i)e.closePath();else if("E"===i)console.warn("not implements");else if("c"===i){const[t,i,r,o,s,a]=n.map(t=>Number(t)),l=e.currentPoint;e.bezierCurveTo(t+l.x,i+l.y,r+l.x,o+l.y,s+l.x,a+l.y)}else if("l"===i){const t=e.currentPoint,[i,r]=n.map(t=>Number(t));e.lineTo(i+t.x,r+t.y)}else if("m"===i){const t=e.currentPoint,[i,r]=n.map(t=>Number(t));e.moveTo(i+t.x,r+t.y)}}this.path=e}}class fy extends T_{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=t=>{t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{var i,n,r,o,s;const a=e/t,l={x:1,y:1};if(this.to){const t=null!==(i=this.from)&&void 0!==i?i:{x:null!==(r=null===(n=this.startVal)||void 0===n?void 0:n.x)&&void 0!==r?r:1,y:null!==(s=null===(o=this.startVal)||void 0===o?void 0:o.y)&&void 0!==s?s:1};l.x=t.x+(this.to.x-t.x)*a,l.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};l.x=1+(t.x-1)*a,l.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=l)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=t.json.from,this.to=t.json.to,this.by=t.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class my extends T_{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isTimelineStart=!1,this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{if(this.isTimelineStart)return;this.isTimelineStart=!0,t.isReverse||this.updateCurrentValue(),this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to);const e=this.json.cBhvr.attrList[0],[i]=e.split(".");x_(this.timingTarget,i+".on","true")},this.onTimeNodeEnd=()=>{const t=this.json.cBhvr.attrList[0];if("remove"===this.json.cBhvr.ctn.fill){const[e]=t.split(".");x_(this.timingTarget,e+".on","false")}this.isTimelineStart=!1},this.onSeekToStart=()=>{var t;const e=this.json.cBhvr.attrList[0];if(this.timingTarget){this.onTimeUpdate({duration:1,delta:0});const i="ppt_c.color"===e||"text.color"===e;if((null===(t=this.timingTarget.fill)||void 0===t?void 0:t.designColor.toUpperCase())===this.from.toHexString().toUpperCase()||i){const[t]=e.split(".");x_(this.timingTarget,t+".on","false")}}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=this.json.cBhvr.attrList[0],e=b_(this.timingTarget,t);e&&(this.startColorString=e)}},this.onTimeUpdate=({delta:t,duration:e})=>{const i=t/e;if(this.to.interpolationFrom(this.from,i,this.target),this.timingTarget){const t=this.json.cBhvr.attrList[0];x_(this.timingTarget,t,this.target.toHexString())}},this.onSeekToEnd=()=>{this.isTimelineStart||this.onTimelineStart({isReverse:!1,activeCount:0,id:""}),this.onTimeUpdate({duration:1,delta:1})},this.replaceAttrToRelation(),"rgb"===this.json.clrSpc?(this.from=new pg(this.json.from),this.to=new pg(this.json.to),this.by=new pg(this.json.by),this.target=new pg):(this.from=new dg(this.json.from),this.to=new dg(this.json.to),this.by=new dg(this.json.by),this.target=new dg),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}replaceAttrToRelation(){const t=this.json.cBhvr.attrList[0];"ppt_c"!==t?"style.color"===t&&(this.json.cBhvr.attrList[0]="text.color"):this.json.cBhvr.attrList[0]="ppt_c.color"}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const t=this.json.cBhvr.attrList[0],e=b_(this.timingTarget,t);e&&(this.currentColorString=e)}}}class gy extends T_{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=t=>{this.lastVal=null,t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t;let n=0,r=0;if(void 0!==this.from&&void 0!==this.to){n=this.from,r=this.to;const t=n+(r-n)*i;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*i-this.lastVal;this.lastVal=this.by*i,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;Vm()(null===(t=this.timingTarget)||void 0===t?void 0:t.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&null!==this.startVal&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var t;this.currentVal=null===(t=this.timingTarget)||void 0===t?void 0:t.r}}class vy extends T_{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:i,cmdType:n}=this.json;!this.isApplied&&i&&n&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(i,n))},this.onSeekToStart=()=>{var t,e;this.commonTimeNode.isInInteractiveSeq||null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("seekToStart",this.onSeekToStart),this.commonTimeNode.on("seekToEnd",this.onSeekToEnd)}get modifyAttrKey(){var t,e,i,n;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(n=null===(i=this.json)||void 0===i?void 0:i.cmdType)&&void 0!==n?n:"")}}class _y{constructor(t){this.runtimeNodeEventHub=new Za.a,this.onVolumeUpdate=t=>{this.audio.volume(t)},this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy(),this.ctx.activeMedia.delete(this.audio),this.ctx.volumeAdjuster.off("update",this.onVolumeUpdate)};const{json:e,isIterate:i,isSub:n,eventHub:r,ctx:o,parent:s,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new by({json:e.cMediaNode.ctn,isSub:n,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:i,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c});let d=e.cMediaNode.tgtEl;o.loaderDelegate&&(d=o.loaderDelegate.redirectMedia(d),o.logger.info(`redirect media url from ${e.cMediaNode.tgtEl} to ${d} by delegate.`,o.taskId)),this.audio=new h_(d,o.runningAudio),o.activeMedia.add(this.audio),this.commonTimeNode.on("timelineStart",()=>{this.audio.volume(o.volumeAdjuster.volume),this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy),this.ctx=o,this.ctx.volumeAdjuster.on("update",this.onVolumeUpdate)}}function yy(t){return function(t){var e;return!!(null===(e=t)||void 0===e?void 0:e.cBhvr)}(t)?t.cBhvr.ctn:function(t){var e,i;return!!(null===(i=null===(e=t)||void 0===e?void 0:e.cMediaNode)||void 0===i?void 0:i.ctn)}(t)?t.cMediaNode.ctn:t.ctn}var xy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class by extends Za.a{constructor(t){var e,i;super(),this.uuid=Mm(),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.tmFilter=[],this.timeDelta=0,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.isInfiniteRepeat()?this.repeatTimeNodeEnd():this.seekToEnd(!1,!0))},this.handleActive=(t=!0)=>{if(this.isActive=!0,this.isConflictDispose=!1,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if("never"===this.json.restart)return;"whenNotActive"!==this.json.restart&&"always"!==this.json.restart||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(t))}else this.startTimeLine(t)},this.updateTimeLine=t=>{const e=t/(xd.b.TARGET_FPMS||.06);this.timeDelta+=e,this.duration-this.timeDelta<=e&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(t=!1)=>{(this.isTimeNodeEnd()||t)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:n,isIterate:r,ctx:o,eventHubs:s,parent:a,json:l,iterateType:h,iterateId:u,iterateIndex:c,isInInteractiveSeq:d,fromSeqId:p}=t;this.isSub=n,this.fromSeqId=p,this.isInInteractiveSeq=d,this.isIterate=r,this.parentTimeNode=a,this.json=l,this.ctx=o,this.iterateIndex=c,this.eventHubs=s,this.iterateType=h,this.iterateId=u,this.tmFilter=null!==(i=null===(e=l.tmFilter)||void 0===e?void 0:e.split(";").map(t=>t.split(",").map(t=>parseFloat(t.trim()))))&&void 0!==i?i:[];const f=Number(this.json.dur),m=this.json.spd||1;if(this.isNegativeSpeed=m<0,Number.isNaN(f)||(this.duration=f/Math.abs(m)),this.uuid+="--"+this.json.id,this.setPreStyle(),l.childTnLst&&this.createChildren(l.childTnLst),this.startConds=new __(this.json.id||"",l.stCondLst,s,this.ctx),this.endConds=new __(this.json.id||"",l.endCondLst,s,this.ctx),l.endSync&&(this.endSync=new __(this.json.id||"",[l.endSync],s,this.ctx),this.endSync.on("active",()=>{var t;"interactiveSeq"===this.json.nodeType&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),null===(t=this.endSync)||void 0===t||t.reset())})),this.startConds.on("active",t=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(t))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(t=>t.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&"nextClick"===this.json.masterRel){const t="shape slide onNext"+this.fromSeqId;this.startConds.addCond({event:t})}this.json.iterate&&!1===this.isIterate&&this.createIterateShadow()}createIterateShadow(){const t=Mm();let e=!0,i=0;const n=i=>{i===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",n))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",n);e;){const e=JSON.parse(JSON.stringify(this.json)),n=new by({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:i,iterateId:t,isInInteractiveSeq:this.isInInteractiveSeq,fromSeqId:this.fromSeqId});this.iterateShadows[i]=n,i+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let i=null;const n={json:t,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId,isInInteractiveSeq:this.isInInteractiveSeq,fromSeqId:this.fromSeqId};return"seq"===t.type?i=new y_(n):"par"===t.type?i=new Ty(n):"set"===t.type?i=new E_(n):"anim"===t.type?i=new I_(n):"animEffect"===t.type?i=new dy(n):"animMotion"===t.type?i=new py(n):"animScale"===t.type?i=new fy(n):"animClr"===t.type?i=new my(n):"animRot"===t.type?i=new gy(n):"cmd"===t.type?i=new vy(n):"audio"===t.type&&(i=new _y(n)),i}createSubList(t){this.subList&&this.subList.forEach(t=>t.commonTimeNode.destroy()),this.subList=[],t.forEach(t=>{const e=this.createTimeNode(t,!0);e&&this.subList.push(e)})}bindCommonTimeNodeEvent(t){t.commonTimeNode.on("timeNodeStart",t=>{this.emit("childTimeNodeStart",t)}),t.commonTimeNode.on("timeNodeEnd",t=>{this.emit("childTimeNodeEnd",t),this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return yy(t).presetOrder}function i(t){return/^slide/.test(t)?"slide":/^layout/.test(t)?"layout":/^master/.test(t)?"master":"unknow"}const n=["master","layout","slide","unknow"];if(t&&t[0]&&e(t[0])){[...t].sort((t,r)=>{var o,s,a,l;const h=yy(t).id,u=yy(r).id;if(h&&u){const a=i(h),l=i(u);if(a===l)return(null!==(o=e(t))&&void 0!==o?o:0)-(null!==(s=e(r))&&void 0!==s?s:0);return n.indexOf(a)-n.indexOf(l)}return(null!==(a=e(t))&&void 0!==a?a:0)-(null!==(l=e(r))&&void 0!==l?l:0)}).forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}else t.forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(t=>t.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.isInInteractiveSeq&&this.isInfiniteRepeat()&&this.repeatTimeNodeEnd(),this.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.isEndEventsEmitted=!1,this.timeDelta=0;const t=1e3/this.ctx.ticker.maxFPS;this.duration<=t&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(jy.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit(jy.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit(jy.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return xy(this,void 0,void 0,(function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const t of this.iterateShadows){if(this.isIterateEnd)break;t.children.forEach(t=>{t.commonTimeNode.startTimeNode()}),t.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}}))}applyTimeFilter(t){if(!this.tmFilter.every(t=>Vm()(t[0])&&Vm()(t[1])))return t;for(let e=0;e<this.tmFilter.length;e++){const i=this.tmFilter[e];if(t<i[0]){const n=this.tmFilter[e-1];return(t-n[0])/(i[0]-n[0])*(i[1]-n[1])+n[1]}}return this.tmFilter.length>0?this.tmFilter[this.tmFilter.length-1][1]:t}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}findTargets(){const t=[],e=i=>{i.forEach(i=>{var n,r,o;i.cBhvr&&i.cBhvr.target&&t.findIndex(t=>t.id===i.cBhvr.target.id)<0&&t.push(i.cBhvr.target),(null===(r=null===(n=null==i?void 0:i.cBhvr)||void 0===n?void 0:n.ctn)||void 0===r?void 0:r.childTnLst)&&i.cBhvr.ctn.childTnLst.length>0&&e(i.cBhvr.ctn.childTnLst),(null===(o=null==i?void 0:i.ctn)||void 0===o?void 0:o.childTnLst)&&i.ctn.childTnLst.length>0&&e(i.ctn.childTnLst)})};return e(this.json.childTnLst||[]),t}setPreStyle(){this.json.presetClass&&this.findTargets().forEach(t=>{if(this.json.iterate){let e=0,i=!0;for(;i;){const n=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});n&&(this.setPreStyleForTarget(n),e+=1),i=!!n}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,i;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const n=null===(i=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===i?void 0:i.filter(t=>"set"===t.type&&"visible"===t.to);(null==n?void 0:n.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===this.json.presetClass||"emph"===this.json.presetClass)&&(t.hasPreset=!0,t.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(t=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(t);const e=this.json.stCondLst.filter(t=>/^self/.test(t.event||""))[0];e&&this.startConds.condHandle(e);const i=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];i&&this.endConds.condHandle(i),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy())}seekToStart(t=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(t));if(t)for(let t=this.subList.length-1;t>=0;t--){const e=this.subList[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}if(this.children.length>1)for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}repeatTimeNodeEnd(){this.dispose(),this.children.forEach(t=>{t.commonTimeNode.isActive=!1,t.commonTimeNode.dispose()})}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(jy.animateEnd);try{this.ctx.ticker.remove(this.updateTimeLine)}catch(t){}this.startConds.reset(),this.endConds.reset()}seekToEnd(t,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const i=this.json.autoRev||t;if(i?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(i,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(i,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEndWhenDetectEndSync(){if(this.isInInteractiveSeq&&this.isInfiniteRepeat())return!0;let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}isTimeNodeEnd(){let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(t=>t.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(t=>t.commonTimeNode.destroy()),this.clearSubList()}}class Ty extends Za.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new Za.a;const{json:e,iterateType:i,isIterate:n,isSub:r,parent:o,ctx:s,eventHub:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}=t;this.id=e.ctn.id,this.json=e,this.ctx=s,this.isIterate=n,this.globalEventHub=a,this.commonTimeNode=new by({json:e.ctn,isSub:r,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:i,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),t.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end")),"exit"===this.commonTimeNode.json.presetClass&&this.commonTimeNode.children.length>=1&&this.commonTimeNode.children[this.commonTimeNode.children.length-1]instanceof E_&&this.commonTimeNode.children.forEach(t=>{t instanceof E_||"function"!=typeof t.onSeekToStart||t.onSeekToStart()})})}}var Ey=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Sy{constructor(t,e,i){this.json=t,this.ctx=i,this.globalEventHub=e;const n=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);n&&(this.tmRoot=new Ty({json:n,isSub:!1,isIterate:!1,eventHub:e,ctx:i,parent:null,iterateType:"el",iterateIndex:0,iterateId:"",isInInteractiveSeq:!1,fromSeqId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,i,n;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(n=null===(i=t.json)||void 0===i?void 0:i.ctn)||void 0===n?void 0:n.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var i,n,r;return"seq"===(null===(i=e.json)||void 0===i?void 0:i.type)&&(null===(r=null===(n=e.json)||void 0===n?void 0:n.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return Ey(this,void 0,void 0,(function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.startTimeNode()):null===(e=this.mainSeq)||void 0===e||e.commonTimeNode.startTimeNode()}))}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var t;null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.collectStartValue()}setMainSeqStep(t,e){var i;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(i=this.mainSeq)||void 0===i||i.setCurrentStep(t,e)}destroy(){var t;this.globalEventHub.removeAllListeners(),null===(t=this.tmRoot)||void 0===t||t.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(t){const e=this.findSeq(t);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(t,e,i){const n=this.findSeq(t);n&&n.setCurrentStep(e,i)}resetAllInteractiveSeq(){var t;((null===(t=this.tmRoot)||void 0===t?void 0:t.commonTimeNode.children.filter(t=>{var e,i,n;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"interactiveSeq"===(null===(n=null===(i=t.json)||void 0===i?void 0:i.ctn)||void 0===n?void 0:n.nodeType)}))||[]).forEach(t=>{t.setCurrentStep(0,"start")})}applyInteractiveAction(t){this.globalEventHub.emit(t)}}var wy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Ay extends v_{constructor(t,e,i,n){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,{parentGlobalPos:i},n),this.isRendered=!1,this.isTimingStartValueCollected=!1,this.json=t,this.json.smartArtShapeList&&(e.smartArtShapeList=this.json.smartArtShapeList),e.hasBackgroundFillShape=this.detectUseBackgroundFill(this.json),this.container.visible=!1,this.ctx=e;const r=new Jd;r.beginFill(16777215),r.drawRect(0,0,t.width,t.height),r.endFill(),this.container.addChild(r)}detectUseBackgroundFill(t){return!!t&&("Picture"===t.type||"Shape"===t.type?t.useBgFill:!(!t.children||!Array.isArray(t.children))&&t.children.some(t=>this.detectUseBackgroundFill(t)))}initOnReuse(){super.initOnReuse(),this.ctx.timingEventHub.on("c:prev slide",t=>{this.ctx.eventHub.emit(jy.requestPrevSlide,t)}),this.ctx.timingEventHub.on("c:next slide",(t,e)=>{this.ctx.eventHub.emit(jy.requestNextSlide,t,e)})}get interactiveContainer(){return this.container}render(t){if(this.isRendered)return;this.collectAnimatedIds().forEach(t=>this.ctx.animatedIds.add(t)),this.isRendered=!0,super.render(t),t.addSubMTask(()=>wy(this,void 0,void 0,(function*(){this.ctx.eventHub.emit("StageRenderEnd")})),"@StageImpl[emit.StageRenderEnd]")}isListTimeNode(t){return["excel","seq","par"].indexOf(t.type)>=0}isAnimatedTimeNode(t){return!!t.cBhvr}collectAnimatedIdsForTimeNode(t,e){var i;this.isListTimeNode(t)?null===(i=t.ctn.childTnLst)||void 0===i||i.forEach(t=>{this.collectAnimatedIdsForTimeNode(t,e)}):this.isAnimatedTimeNode(t)&&e.push(t.cBhvr.target.id)}collectAnimatedIds(){const t=[];return this.json.timing&&this.json.timing.timeNodeList.forEach(e=>{this.collectAnimatedIdsForTimeNode(e,t)}),t}createTiming(){this.json.timing&&!this.timing&&(this.timing=new Sy(this.json.timing,this.ctx.timingEventHub,this.ctx))}startTiming(){var t;return(null===(t=this.timing)||void 0===t?void 0:t.start())||Promise.resolve()}setMainSeqApplied(){var t;null===(t=this.timing)||void 0===t||t.setMainSeqApplied()}setMainSeqStep(t,e){var i;null===(i=this.timing)||void 0===i||i.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;this.isTimingStartValueCollected||(this.isTimingStartValueCollected=!0,null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue())}hasTiming(){return!!this.timing}clearOnSlideChange(){this.ctx.eventHub.removeAllListeners(),this.ctx.timingEventHub.removeAllListeners(),super.clearOnSlideChange()}clearOnTransactionEnd(){var t,e;this.ctx.timingTargets.getTargets().forEach(t=>{t.hasPreset=!1}),null===(t=this.timing)||void 0===t||t.resetAllInteractiveSeq(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0}destroy(){var t,e;this.isTimingStartValueCollected=!1,this.isRendered=!1,this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),null===(t=this.ctx.bgTexture)||void 0===t||t.destroy(!0),this.ctx.spriteTexture.destroy(),this.ctx.timingEventHub.removeAllListeners(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0,super.destroy()}mainSeqStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqStep())&&void 0!==e?e:0}mainSeqLength(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqLength())&&void 0!==e?e:0}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(t,e){var i;this.hasTiming()&&(null===(i=this.timing)||void 0===i?void 0:i.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onNext",t,e)):this.ctx.eventHub.emit(jy.requestNextSlide,t,e)}prevStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onPrev",t)):this.ctx.eventHub.emit(jy.requestPrevSlide,t)}applyInteractiveAction(t){var e;null===(e=this.timing)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.timing)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,i){var n;null===(n=this.timing)||void 0===n||n.setInteractiveSeqState(t,e,i)}setMediaState(t,e,i){return wy(this,void 0,void 0,(function*(){const n=this.ctx.medias[t];n&&(e?i?(yield Pm(()=>n.clippedDuration>0,5e3),i<n.clippedDuration&&(n.once("play",()=>{n.seek(i)}),yield n.play())):yield n.play():(i&&n.seek(i),yield n.pause()))}))}setMediaCurrentTime(t,e){const i=this.ctx.medias[t];i&&i.seek(e)}}class My{constructor(t){this.ticker=t,this.tasks=[],this.couldRunning=!1,this.applyNext=()=>{const t=this.tasks[0];t&&t.applyNext()},t.add(this.applyNext)}addTask(t){this.tasks.push(t),t.once("task-finish",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)}),t.once("task-error",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)})}start(){this.couldRunning=!0}stop(){this.couldRunning=!1}}var Cy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};const Ry=t=>new Promise(e=>setTimeout(e,t));class Iy extends Za.a{constructor(t,e,i){super(),this.slideIndex=t,this.taskId=e,this.logger=i,this.uuid=Mm(),this.isCancel=!1,this.tasks=[]}addMTask(t,e){this.tasks.push({fn:t,state:"wait",sub:[],name:e})}addSubMTask(t,e){let i=this.tasks.findIndex(t=>"running"===t.state);i<0&&(i=0),this.tasks[i].sub.push({fn:t,state:"wait",sub:[],name:e})}cancel(){this.tasks=[],this.isCancel=!0}applyNext(){if(this.tasks.some(t=>"running"===t.state))return;if(this.tasks.some(t=>"error"===t.state))return;if(this.tasks.every(t=>"finish"===t.state))return void(this.isCancel||this.emit("task-finish"));const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(e=>{t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",Tm.transform(e),this.slideIndex)}))}applyAll(){return Cy(this,void 0,void 0,(function*(){for(;!this.tasks.every(t=>"finish"===t.state);)if(this.tasks.some(t=>"running"===t.state))yield Ry(16);else{if(this.tasks.some(t=>"error"===t.state))return;{const t=this.tasks.find(t=>"wait"===t.state);if(t){t.state="running";try{if((yield Im(()=>t.fn.apply(null),6e4))===Cm)throw new Tm(gm.RuntimeError,`subtask ${t.name} apply timeout`);if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}catch(e){let i;i=(null==e?void 0:e.errorType)?e:new Tm(gm.RuntimeError,`subtask ${t.name} error. ${e}`),t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",Tm.transform(i),this.slideIndex);break}}}}!this.isCancel&&this.tasks.every(t=>"finish"===t.state)&&this.emit("task-finish")}))}}var Py=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Oy{constructor(t,e){if(this.renderer=t,this.localStorage=e,this.outputData=new Map,this.loadingSdfKeys=new Set,!Oy.worker){const t=new Blob(['\nself.onmessage = function(e) {\n var data = e.data.data;\n var key = e.data.key;\n var height = Math.ceil(e.data.height);\n var width = Math.ceil(e.data.width);\n if (!data || !key) {\n return;\n }\n var maxDis = 0;\n var d = [];\n var p = [];\n var maxInt = Number.MAX_SAFE_INTEGER || 255 * 255 * 255;\n var setD = function(x, y, v) { d[y * width + x] = v; };\n var getD = function(x, y) { return d[y * width + x]; };\n var setP = function(x, y, v) { p[y * width + x] = v; };\n var getP = function(x, y) { return p[y * width + x]; };\n var isContains = function(x, y) { return x >= 0 && x < width && y >= 0 && y < height; };\n var isInterior = function(x, y) { return data[(y * width + x) * 4 + 3] > 10; };\n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n var c = isInterior(x, y);\n var t = isContains(x, y - 1) ? isInterior(x, y - 1) : false;\n var b = isContains(x, y + 1) ? isInterior(x, y + 1) : false;\n var l = isContains(x - 1, y) ? isInterior(x - 1, y) : false;\n var r = isContains(x + 1, y) ? isInterior(x + 1, y) : false;\n if (c !== t || c !== b || c !== l || c !== r) {\n setD(x, y, 0);\n setP(x, y, [x, y]);\n } else {\n setD(x, y, maxInt);\n setP(x, y, [-1, -1]);\n }\n }\n }\n \n var f = function (x, y, dir) {\n var d1 = 1;\n var d2 = Math.sqrt(2);\n var dx;\n var dy;\n var od;\n switch (dir) {\n case "TL": dx = -1; dy = -1; od = d2; break;\n case "T": dx = 0; dy = -1; od = d1; break;\n case "TR": dx = 1; dy = -1; od = d2; break;\n case "L": dx = -1; dy = 0; od = d1; break;\n case "R": dx = 1; dy = 0; od = d1; break;\n case "BL": dx = -1; dy = 1; od = d2; break;\n case "B": dx = 0; dy = 1; od = d1; break;\n case "BR": dx = 1; dy = 1; od = d2; break;\n }\n var b = isContains(x + dx, y + dy);\n var cb = b ? getD(x + dx, y + dy) : maxInt;\n if (cb + od < getD(x, y)) {\n var p = b ? getP(x + dx, y + dy) : [-1, -1];\n var dis = Math.sqrt(Math.pow(x - p[0], 2) + Math.pow(y - p[1], 2));\n setP(x, y, p);\n setD(x, y, dis);\n if (dis > maxDis) {\n maxDis = dis;\n }\n }\n };\n \n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n var dirs = ["TL", "T", "TR", "L"];\n for (var i = 0; i < dirs.length; ++ i) {\n var dir = dirs[i];\n f(x, y, dir);\n }\n }\n }\n\n for (var y = height - 1; y >= 0; -- y) {\n for (var x = width - 1; x >= 0; -- x) {\n var dirs = ["R", "BL", "B", "BR"];\n for (var i = 0; i < dirs.length; ++ i) {\n var dir = dirs[i];\n f(x, y, dir);\n }\n }\n }\n\n var outputData = [];\n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n outputData.push(isInterior(x, y) ? 255: 0);\n outputData.push(0);\n outputData.push(0);\n outputData.push(Math.ceil(getD(x, y) / maxDis * 255));\n }\n }\n self.postMessage({\n key, outputData, maxDis\n });\n};\n'],{type:"text/javascript"});Oy.worker=new Worker(URL.createObjectURL(t)),Oy.worker.onmessage=t=>{this.outputData.set(t.data.key,{data:t.data.outputData,maxDis:t.data.maxDis})},this.outputData.set("111","222")}}createSdfByWorker(t,e,i,n,r,o,s,a){const l=document.createElement("canvas");l.width=r,l.height=o;const h=l.getContext("2d");if(!h||!Oy.worker)return;h.drawImage(s,t,e,i,n);const{data:u}=h.getImageData(0,0,r,o);Oy.worker.postMessage({data:u,key:a,width:r,height:o})}createSdf(t,e,i){const n=document.createElement("canvas");n.width=t,n.height=e;const r=n.getContext("2d");if(!r)return{src:"",maxDis:1};r.drawImage(i,0,0);let o=0;const{data:s}=r.getImageData(0,0,t,e),a=[],l=[],h=function(e,i,n){a[i*t+e]=n},u=function(e,i){return a[i*t+e]},c=function(e,i,n){l[i*t+e]=n},d=function(e,i){return l[i*t+e]},p=function(i,n){return i>=0&&i<t&&n>=0&&n<e},f=function(e,i){return s[4*(i*t+e)+3]>10};for(let i=0;i<e;++i)for(let e=0;e<t;++e){const t=f(e,i),n=!!p(e,i-1)&&f(e,i-1),r=!!p(e,i+1)&&f(e,i+1),o=!!p(e-1,i)&&f(e-1,i),s=!!p(e+1,i)&&f(e+1,i);t!==n||t!==r||t!==o||t!==s?(h(e,i,0),c(e,i,[e,i])):(h(e,i,Number.MAX_SAFE_INTEGER),c(e,i,[-1,-1]))}const m=function(t,e,i){const n=Math.sqrt(2);let r,s,a;switch(i){case"TL":r=-1,s=-1,a=n;break;case"T":r=0,s=-1,a=1;break;case"TR":r=1,s=-1,a=n;break;case"L":r=-1,s=0,a=1;break;case"R":r=1,s=0,a=1;break;case"BL":r=-1,s=1,a=n;break;case"B":r=0,s=1,a=1;break;case"BR":r=1,s=1,a=n}const l=p(t+r,e+s);if((l?u(t+r,e+s):Number.MAX_SAFE_INTEGER)+a<u(t,e)){const i=l?d(t+r,e+s):[-1,-1],n=Math.sqrt(Math.pow(t-i[0],2)+Math.pow(e-i[1],2));c(t,e,i),h(t,e,n),n>o&&(o=n)}};for(let i=0;i<e;++i)for(let e=0;e<t;++e){const t=["TL","T","TR","L"];for(const n of t)m(e,i,n)}for(let i=e-1;i>=0;--i)for(let e=t-1;e>=0;--e){const t=["R","BL","B","BR"];for(const n of t)m(e,i,n)}const g=[];for(let i=0;i<e;++i)for(let e=0;e<t;++e)g.push(0,0,0,Math.ceil(u(e,i)/o*255));return r.putImageData(new ImageData(Uint8ClampedArray.from(g),t,e),0,0),{src:n.toDataURL("image/png"),maxDis:o}}getSdf(t,e,i){return Py(this,void 0,void 0,(function*(){const n=Math.ceil(e.width),r=Math.ceil(e.height),o=Math.ceil(e.width-t.width)/2,s=Math.ceil(e.height-t.height)/2;let a=yield this.localStorage.getItem(`sdf-${i}-src`),l=yield this.localStorage.getItem(`sdf-${i}-maxDis`);if(!(a&&l||this.loadingSdfKeys.has(i))){this.loadingSdfKeys.add(i);const e=this.renderer.plugins.extract.image(t,"image/png");e.addEventListener("load",()=>{this.createSdfByWorker(o,s,t.width,t.height,n,r,e,i)}),e.addEventListener("error",()=>null),yield Pm(()=>!!this.outputData.has(i),2e3),this.loadingSdfKeys.delete(i);const h=this.outputData.get(i);if(h){this.outputData.delete(i);const t=document.createElement("canvas");t.width=n,t.height=r;const e=t.getContext("2d");if(!e)return null;e.putImageData(new ImageData(Uint8ClampedArray.from(h.data),n,r),0,0),a=t.toDataURL("image/png"),l=h.maxDis,this.localStorage.setItem(`sdf-${i}-src`,a).catch(()=>{}),this.localStorage.setItem(`sdf-${i}-maxDis`,l).catch(()=>{})}}if(!a||!l)return null;return document.createElement("img").src=a,Vh.t.fromURL(a).then(t=>({texture:t,maxDis:l})).catch(()=>null)}))}}Oy.worker=null;var Ny=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Ly{constructor(t,e,i,n,r,o,s,a,l,h,u,c,d,p,f,m,g){this.loader=t,this.mode=e,this.renderer=i,this.ticker=n,this.view=r,this.clock=o,this.objPoolGroup=s,this.errorChannel=a,this.localstorage=l,this.logger=h,this.loaderDelegate=u,this.urlInterrupter=c,this.isPlayerPaused=d,this.maxResolution=p,this.volumeAdjuster=f,this.forceCanvas=m,this.globalEventHub=g,this.currentStageIndex=0,this.cacheCount=n_.isDesktop()?2:1,this.stageStates=Object.create(null),this.stageJsons=Object.create(null),this.stageCtxs=Object.create(null),this.stageImpls=Object.create(null),this.taskId="",this.url="",this.runningAudio=new Map,this.activeMedia=new Set,this.microTaskManager=new My(n),this.sdfManager=new Oy(i,l)}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Ny(this,void 0,void 0,(function*(){const e=new Gm(this.loader),i=new Za.a,n={taskId:this.taskId,mode:this.mode,renderer:this.renderer,graphicsTexture:new Km(this.maxResolution),stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new $m(i),eventHub:i,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new Qm,clock:this.clock,spriteTexture:e,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new Za.a,logger:this.logger,sdfManager:this.sdfManager,loaderDelegate:this.loaderDelegate,runningAudio:this.runningAudio,activeMedia:this.activeMedia,isPlayerPaused:this.isPlayerPaused,timingEventHub:new Za.a,maxResolution:this.maxResolution,animatedIds:new Set,volumeAdjuster:this.volumeAdjuster,forceCanvas:this.forceCanvas,globalEventHub:this.globalEventHub,latestChangeFullscreenTargetId:"",isRendering:!1,urlInterrupter:this.urlInterrupter};this.stageCtxs[t]=n})),"@StagePool[createCtx]")}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Ny(this,void 0,void 0,(function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`);this.stageJsons[t]=e,this.stageCtxs[t].stageWidth=e.width,this.stageCtxs[t].stageHeight=e.height,this.stageCtxs[t].featureList=e.featureList})),"@StagePool[loadStageJson]")}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const i=this.stageJsons[t],{spriteTexture:n,stageWidth:r,stageHeight:o}=this.stageCtxs[t],{coloredSheets:s,sheets:a}=i,l=s||a;return l&&l.forEach(t=>{e.addSubMTask(()=>{let e=1;if(r>this.maxResolution.x||o>this.maxResolution.y){e=this.maxResolution.x/r;const t=e*o;t>this.maxResolution.y&&(e*=this.maxResolution.y/t)}return n.loadSpriteSheetItem(this.url,this.taskId,t,e)},"@StagePool[spriteTexture.loadSpriteSheetItem]")}),Promise.resolve()},"@StagePool[loadSpriteSheets]")}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const i=this.stageJsons[t],n=this.stageCtxs[t],r=new Ay(i,n,{x:0,y:0},e);return this.stageImpls[t]=r,Promise.resolve()},"@StagePool[createStage]")}preRenderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>(this.stageImpls[t].preRender(e),Promise.resolve()),"@StagePool[preRenderStage]")}createGraphicsTexture(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Ny(this,void 0,void 0,(function*(){const i=this.stageCtxs[t];i.graphicsTexture.pack().forEach((n,r)=>{e.addSubMTask(()=>{const{stageWidth:e,stageHeight:o}=this.stageCtxs[t];let s=1;if(e>this.maxResolution.x||o>this.maxResolution.y){s=this.maxResolution.x/e;const t=s*o;t>this.maxResolution.y&&(s*=this.maxResolution.y/t)}return i.graphicsTexture.render(n,r,this.objPoolGroup,s)},"@StagePool[graphicsTexture.render]")})})),"@StagePool[createGraphicsTexture]")}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Ny(this,void 0,void 0,(function*(){const i=this.stageImpls[t];yield i.render(e)})),"@StagePool[renderStage]")}destroyStageByIndex(t){"load"===this.stageStates[t].state&&this.stageStates[t].task.cancel(),delete this.stageStates[t];this.stageImpls[t].destroy(),delete this.stageImpls[t],delete this.stageCtxs[t]}destroyStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);Math.abs(this.currentStageIndex-e)>this.cacheCount&&this.destroyStageByIndex(e)})}destroyAllStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);this.destroyStageByIndex(e)})}preload(t,e=!1){if(this.stageImpls[t]||this.stageStates[t])return Promise.resolve();const i=new Iy(t,this.taskId,this.logger);return i.on("task-error",(t,e)=>{delete this.stageStates[e],delete this.stageImpls[e],delete this.stageCtxs[e],this.errorChannel.emit("error",t,e)}),this.stageStates[t]={state:"load",task:i},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(i),e?i.applyAll():new Promise(e=>{i.once("task-finish",()=>{this.stageStates[t].state="finish";Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),e()})})}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return Ny(this,void 0,void 0,(function*(){this.currentStageIndex=t;const e=this.stageStates[t];return"finish"===(null==e?void 0:e.state)&&this.stageImpls[t]?this.stageImpls[t]:"load"===(null==e?void 0:e.state)?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])}))}destroy(){this.runningAudio.clear()}}var Dy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Fy{constructor(t){var e;this.logger=t,this.taskId="",this.isIndexDBReady=!1,this.memoryCache=new Map,null===(e=Fy.localCache)||void 0===e||e.ready(t=>{t||(this.isIndexDBReady=!0)}).catch(()=>{t.warn("local storage not ready",this.taskId)})}get couldUseIndexDBCache(){return this.isIndexDBReady&&this.taskId.length>0}attachTaskId(t){this.taskId=t}getItem(t){return Dy(this,void 0,void 0,(function*(){let e=null;if(this.couldUseIndexDBCache&&Fy.localCache)try{e=yield Im(()=>Fy.localCache.getItem(`${this.taskId}/${t}`),500)}catch(t){}return e=e===Cm?null:e,e||this.memoryCache.get(t)||null}))}setItem(t,e,i=!1){return Dy(this,void 0,void 0,(function*(){if(!this.couldUseIndexDBCache)return i&&this.memoryCache.set(t,e),Promise.resolve();if(Fy.localCache){let n=null;try{n=yield Im(()=>Fy.localCache.setItem(`${this.taskId}/${t}`,e).catch(()=>{i&&this.memoryCache.set(t,e)}),500)}catch(t){}n!==Cm&&null!==n||!i||this.memoryCache.set(t,e)}}))}dispose(){var t;this.memoryCache=new Map,this.couldUseIndexDBCache&&(null===(t=Fy.localCache)||void 0===t||t.keys().then(t=>{t.filter(t=>t.indexOf(this.taskId)>=0).forEach(t=>{var e;null===(e=Fy.localCache)||void 0===e||e.removeItem(t).catch(()=>{})})}).catch(()=>{}))}}Fy.localCache=null;try{Fy.localCache=o.createInstance({name:"slide_local_cache",driver:o.INDEXEDDB,version:1})}catch(t){}const By=new Lh.j;class Uy{constructor(t){this.localStorage=t}canvas(t,e,i,n){let r,o,s,a=!1,l=!1;t&&(t instanceof Vh.p?s=t:(s=e.generateTexture(t),l=!0)),s?(r=s.baseTexture.resolution,o=s.frame,a=!1,e.renderTexture.bind(s)):(r=e.resolution,a=!0,o=By,o.width=e.width,o.height=e.height,e.renderTexture.bind(null));const h=Math.floor(o.width*r+1e-4),u=Math.floor(o.height*r+1e-4);let c=document.createElement("canvas");c.width=h,c.height=u;const d=c.getContext("2d");if(!d)throw new Error("ctx");if(i)d.putImageData(i,0,0);else{const t=d.getImageData(0,0,h,u),i=new Uint8Array(4*h*u),{gl:s}=e;s.readPixels(o.x*r,o.y*r,h,u,s.RGBA,s.UNSIGNED_BYTE,i),Uy.arrayPostDivide(i,t.data),d.putImageData(t,0,0),n&&this.localStorage.setItem(n,t).catch(()=>{})}if(a){const t=document.createElement("canvas");t.width=h,t.height=u;const e=t.getContext("2d");e.scale(1,-1),e.drawImage(c,0,-u),c=t}return l&&(null==s||s.destroy(!0)),c}static arrayPostDivide(t,e){for(let i=0;i<t.length;i+=4){const n=e[i+3]=t[i+3];0!==n?(e[i]=Math.round(Math.min(255*t[i]/n,255)),e[i+1]=Math.round(Math.min(255*t[i+1]/n,255)),e[i+2]=Math.round(Math.min(255*t[i+2]/n,255))):(e[i]=t[i],e[i+1]=t[i+1],e[i+2]=t[i+2])}}}class ky extends Za.a{constructor(){super(...arguments),this._volume=.5}get volume(){return this._volume}set volume(t){t<0&&(t=0),t>1&&(t=1),this._volume=t,this.emit("update",this._volume)}}var Gy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};Ph.skipHello();const Hy={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip",gallery:"Gallery",switch:"Switch",prism:"Prism",doors:"Doors"},jy={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqAction:"interactiveSeqAction",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",mediaStop:"mediaStop",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",requestOpenUrl:"requestOpenUrl",userInput:"userInput",fullscreenChange:"fullscreenChange",changeLocalFullscreenState:"changeLocalFullscreenState"};class zy extends Za.a{constructor(t,e={}){super(),this.errorChannel=new Za.a,this.transactionPlayer=null,this.isForward=!0,this.drawCall=0,this.scale=1,this._isPaused=!1,this.maxResolution=new Lh.g(0,0),this.isNVIDIA=!1,this.fps=new bm,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.globalEventHub=new Za.a,this.globalVideoBackground=new Jd,this.globalVideoSprite=new ep,this.onMousemoveTimeout=null,this.cacheFunctionMap=new Map,this.isPlayerPaused=()=>this._isPaused,this.onWebGLLost=()=>{this.errorChannel.emit("error",new Tm(gm.CanvasCrash,"webgl context lost."))},this.fullscreenOnMousemove=({index:t,targetId:e})=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:t,targetId:e,status:!0}),this.onMousemoveTimeout&&clearTimeout(this.onMousemoveTimeout),this.onMousemoveTimeout=setTimeout(()=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:t,targetId:e,status:!1})},s_.hoverHiddeDelay)},this.fullscreenOnMouseleave=({index:t,targetId:e})=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:t,targetId:e,status:!1})},this.calculateFullscreenVideoPosition=t=>{const{width:e,height:i}=t,{designWidth:n,designHeight:r}=this,o=Math.min(n/e,r/i);return{x:(n-e*o)/2,y:(r-i*o)/2,width:e*o,height:i*o}},this.onRequestFullscreenVideo=t=>{const{texture:e,index:i,targetId:n}=t;if(i!==this.currentIndex)return void e.destroy(!1);this.onRequestCancelFullscreenVideo(),this.globalVideoBackground.width=this.designWidth,this.globalVideoBackground.height=this.designHeight,this.globalVideoBackground.beginFill(0,1),this.globalVideoBackground.drawRect(0,0,this.designWidth,this.designHeight),this.globalVideoBackground.endFill(),this.globalVideoBackground.interactive=!0,this.app.stage.addChild(this.globalVideoBackground);const{x:r,y:o,width:s,height:a}=this.calculateFullscreenVideoPosition(e);this.globalVideoSprite.texture=e,this.globalVideoSprite.width=s,this.globalVideoSprite.height=a,this.globalVideoSprite.position.x=r,this.globalVideoSprite.position.y=o,this.globalVideoBackground.addChild(this.globalVideoSprite),this.globalEventHub.emit("onFullscreenChange",{status:!0,targetId:n,slideIndex:this.currentIndex}),this.clearFullscreenEventListenersWithAppView();const l={handleEvent:()=>{var t;null===(t=this.currentStage)||void 0===t||t.ctx.eventHub.emit(jy.userInput)}};if(this.app.view.addEventListener("pointerdown",l,!1),this.cacheFunctionMap.set("pointerdown",l),n_.isDesktop()){const t={handleEvent:()=>{this.fullscreenOnMouseleave({index:i,targetId:n})}};this.app.view.addEventListener("mouseout",t,!1);const e={handleEvent:()=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:i,targetId:n,status:!0})}};this.app.view.addEventListener("mouseover",e,!1);const r={handleEvent:()=>{this.fullscreenOnMousemove({index:i,targetId:n})}};this.app.view.addEventListener("mousemove",r,!1),this.cacheFunctionMap.set("mouseover",e),this.cacheFunctionMap.set("mousemove",r),this.cacheFunctionMap.set("mouseout",t)}else{const t={handleEvent:()=>{this.fullscreenOnMousemove({index:i,targetId:n})}};this.app.view.addEventListener("touchstart",t,!1),this.cacheFunctionMap.set("touchstart",t)}},this.onRequestCancelFullscreenVideo=(t=!1)=>{var e,i;this.globalVideoSprite.texture.destroy(!1),this.globalVideoBackground.removeChild(this.globalVideoSprite),this.app.stage.removeChild(this.globalVideoBackground),this.globalEventHub.emit("onFullscreenChange",{status:!1,slideIndex:this.currentIndex,targetId:null===(e=this.currentStage)||void 0===e?void 0:e.ctx.latestChangeFullscreenTargetId}),this.clearFullscreenEventListenersWithAppView(),t&&this.emit(jy.changeLocalFullscreenState,{status:!1,slideIndex:this.currentIndex,targetId:null===(i=this.currentStage)||void 0===i?void 0:i.ctx.latestChangeFullscreenTargetId})},this.logger=t.logger,this.mode=t.mode,this.volumeAdjuster=t.volumeAdjuster,this.localStorage=new Fy(this.logger),this.cachedExtract=new Uy(this.localStorage),this.config={minFPS:$a()(e.minFPS)?30:e.minFPS,maxFPS:$a()(e.maxFPS)?40:e.maxFPS,resolution:$a()(e.resolution)?1:e.resolution,autoFPS:!$a()(e.autoFPS)&&e.autoFPS,autoResolution:!$a()(e.autoResolution)&&e.autoResolution,transactionBgColor:$a()(e.transactionBgColor)?0:e.transactionBgColor,maxResolutionLevel:this.getMaxResolution(e.maxResolutionLevel),forceCanvas:!$a()(e.forceCanvas)&&e.forceCanvas,enableNvidiaDetect:!$a()(e.enableNvidiaDetect)&&e.enableNvidiaDetect},this.updateMaxResolutionLevel(this.config.maxResolutionLevel),this.loader=new Lm(this.localStorage,t.useLocalCache,this.logger,t.resourceTimeout,t.loadDelegate,t.urlInterrupter);const i=Ph.isWebGLSupported();this.app=new Xh({antialias:!0,autoDensity:!1,backgroundColor:16777215,forceCanvas:this.config.forceCanvas||!i}),this.updateConfig(this.config),this.app.ticker.maxFPS=60,this.app.ticker.minFPS=this.config.minFPS,this.app.ticker.maxFPS=this.config.maxFPS,this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const n=this.app.renderer;if(n.gl){const{drawElements:t}=n.gl,e=n.gl.getExtension("WEBGL_debug_renderer_info"),i=n.gl.getParameter(e.UNMASKED_RENDERER_WEBGL);/nvidia/i.test(i)&&this.config.enableNvidiaDetect&&(this.isNVIDIA=!0),n.gl.drawElements=(...e)=>{t.call(n.gl,...e),this.drawCall+=1}}this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=.7*this.scale,e=this.app.renderer.resolution,i=Math.max(t,e-.1);i>=t&&this.updateResolution(i)}}else if(t>this.config.maxFPS&&this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,i=Math.min(t,e+.1);i<=this.config.resolution&&this.updateResolution(i)}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,Dh.c.LOW),this.clock=new Fm(this.app.ticker),this.objPoolGroup=Mm(),this.stagePool=new Ly(this.loader,this.mode,this.app.renderer,this.app.ticker,this.app.view,this.clock,this.objPoolGroup,this.errorChannel,this.localStorage,this.logger,t.loadDelegate,t.urlInterrupter,this.isPlayerPaused,this.maxResolution,this.volumeAdjuster,this.config.forceCanvas,this.globalEventHub),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost);try{this.config.forceCanvas||(this.transactionPlayer=new Ih)}catch(t){/Error creating WebGL context/.test(t.message)?this.errorChannel.emit("error",new Tm(gm.CanvasCrash,"webgl context lost.")):this.errorChannel.emit("error",new Tm(gm.RuntimeWarn,t.message))}this.globalEventHub.on("requestFullscreen",this.onRequestFullscreenVideo),this.globalEventHub.on("requestCancelFullscreen",this.onRequestCancelFullscreenVideo)}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}getMaxResolution(t){return!$a()(t)&&Number.isInteger(t)?(t<1&&(t=1),t>4&&(t=4),t):zy.platform.isAndroid()||zy.platform.isIOS()?2:4}updateMaxResolutionLevel(t){t<0&&(t=0),t>4&&(t=4);const e=[640,960,1280,1920,3200][t],i=[360,540,720,1080,1800][t];this.maxResolution.set(e,i)}updateConfig(t){$a()(t.maxFPS)||$a()(t.minFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS,this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),$a()(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),$a()(t.autoFPS)||(this.config.autoFPS=t.autoFPS),$a()(t.autoResolution)||(this.config.autoResolution=t.autoResolution),$a()(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&this.logger.info("ppt player update config: "+JSON.stringify(this.config),this.taskId),$a()(t.maxResolutionLevel)||(this.config.maxResolutionLevel=t.maxResolutionLevel,this.updateMaxResolutionLevel(this.config.maxResolutionLevel))}preload(t){return Gy(this,void 0,void 0,(function*(){t<1||t>this.slideCount||(this.logger.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),this.logger.info(`preload slide ${t} end`,this.taskId))}))}setResourceData(t,e){this.logger.info("ppt player init config: "+JSON.stringify(this.config),t),this.logger.info("set resource to "+e,t),this.taskId=t,this.url=e,this.stagePool.setResourceData(t,e),this.localStorage.attachTaskId(t),this.loader.attachTaskId(t)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}translateEvent(t,e){e.forEach(e=>{t.on(e,(...t)=>{var i,n,r,o;e===jy.requestGotoSlide&&t[0]!==this.currentIndex&&(null===(n=null===(i=this.currentStage)||void 0===i?void 0:i.timing)||void 0===n||n.setMainSeqStep(0,"start"),null===(o=null===(r=this.currentStage)||void 0===r?void 0:r.timing)||void 0===o||o.destroy()),this.emit(e,...t)})})}renderSlide(t){var e,i,n;return Gy(this,void 0,void 0,(function*(){if(this._isPaused)return void this.logger.info("ppt play prevent render slide with paused state",this.taskId);const r=Date.now();this.logger.info("render slide "+t,this.taskId),this.emit(jy.renderStart,t);const o=yield this.stagePool.getStage(t),s=`snapshot-${t}-${this.isForward?"start":"end"}`,a=yield this.localStorage.getItem(s);if(!o)return;o.ctx.isRendering=!0,this.translateEvent(o.ctx.eventHub,[jy.mainSeqStepChange,jy.mainSeqStateChange,jy.hyperlinkTrigger,jy.interactiveSeqAction,jy.mainSeqStepStart,jy.mainSeqStepEnd,jy.animateStart,jy.animateEnd,jy.mediaPlay,jy.mediaPause,jy.mediaSeek,jy.mediaStop,jy.requestGotoSlide,jy.requestOpenUrl,jy.requestNextSlide,jy.requestPrevSlide,jy.interactiveSeqStateChange,jy.userInput,jy.fullscreenChange,jy.changeLocalFullscreenState]),this.currentIndex=Number(t);const{width:l,height:h,slideCount:u}=o.json;this.slideCount=u,this.designWidth=l,this.designHeight=h,null===(e=this.currentStage)||void 0===e||e.clearOnSlideChange();const c=this.currentStage;this.currentStage=o,o.initOnReuse(),o.createTiming(),o.container.visible=!0,o.collectMainSeqStartValue(),this.isForward?o.setMainSeqStep(0,"start"):o.setMainSeqStep(-1,"end"),this.onRequestCancelFullscreenVideo(!0);let d=!1;if(Ph.isWebGLSupported()&&!this.config.forceCanvas&&o.json.transition&&o.json.transition.type&&this.app.stage.children.length>0&&this.view&&c){let{transition:t}=o.json;!this.isForward&&(null==c?void 0:c.json.transition)&&(t=c.json.transition);const e=this.getTransactionTexture(c,this.view,null,null);this.initTransactionPlayer(t),null===(i=this.transactionPlayer)||void 0===i||i.setPrevTexture(e),d=!0}if(this.app.stage.addChild(o.container),this.updateResolution(this.config.resolution*this.scale),c&&(c.clearOnTransactionEnd(),this.app.stage.removeChild(c.container)),o.json.transition&&o.json.transition.type&&this.app.stage.children.length>0&&this.view&&this.transactionPlayer&&d){const t=yield this.getTransactionTexture(o,this.view,s,a);this.transactionPlayer.setNextTexture(t),yield this.transactionPlayer.play();const e=this.transactionPlayer.renderer.domElement;if(this.view.parentElement&&e)try{this.view.parentElement.removeChild(e)}catch(t){}null===(n=this.transactionPlayer)||void 0===n||n.dispose()}this.isForward?yield o.startTiming():o.setMainSeqApplied(),o.ctx.slideScopeEventHub.emit("slide-render",o.ctx.slideIndex),this.emit(jy.renderEnd,t),this.emit(jy.slideChange,t),o.ctx.isRendering=!1,this.preload(t+1).catch(e=>{this.errorChannel.emit("error",Tm.transform(e),t+1)}),this.preload(t-1).catch(e=>{this.errorChannel.emit("error",Tm.transform(e),t-1)}),this.logger.info(`render slide ${t} done, time: ${Date.now()-r}ms`,this.taskId)}))}getTransactionTexture(t,e,i,n){const r=Vh.p.create({width:t.json.width,height:t.json.height,resolution:1});this.app.renderer.render(t.container,{renderTexture:r});const o=this.cachedExtract.canvas(r,this.app.renderer,n,i);return new b(o)}renderToBase64(t,e,i){return Gy(this,void 0,void 0,(function*(){const n=yield this.stagePool.getStage(t);if(n){const{width:r,height:o}=n.json;this.designWidth=r,this.designHeight=o;const s=Vh.p.create({width:this.designWidth,height:this.designHeight,resolution:e});n.container.visible=!0,this.app.renderer.render(n.container,{renderTexture:s});const a=this.app.renderer.plugins.extract.base64(s,i);return this.stagePool.destroyStageByIndex(t),a}return"__null__"}))}renderMainSeqToBase64(t,e,i){return Gy(this,void 0,void 0,(function*(){const n=[],r=yield this.stagePool.getStage(t);if(r.createTiming(),r){const{width:t,height:o}=r.json;this.designWidth=t,this.designHeight=o;const s=Vh.p.create({width:this.designWidth,height:this.designHeight,resolution:e});r.container.visible=!0;const a=r.mainSeqLength();r.setMainSeqStep(0,"start"),this.app.renderer.render(r.container,{renderTexture:s});const l=this.app.renderer.plugins.extract.base64(s,i);n.push(l);for(let t=0;t<a;t+=1){r.setMainSeqStep(t,"end"),this.app.renderer.render(r.container,{renderTexture:s});const e=this.app.renderer.plugins.extract.base64(s,i);n.push(e)}}return n}))}snapshotWithTimingEnd(t){return Gy(this,void 0,void 0,(function*(){const e=yield this.stagePool.getStage(t);if(e){const{width:i,height:n}=e.json;this.designWidth=i,this.designHeight=n;const r=Vh.p.create({width:this.designWidth,height:this.designHeight,resolution:1});e.container.visible=!0,e.initOnReuse(),e.createTiming(),e.collectMainSeqStartValue(),e.setMainSeqStep(-1,"end"),this.app.renderer.render(e.container,{renderTexture:r});const o=this.app.renderer.plugins.extract.base64(r,"image/png");return t!==this.currentIndex&&this.stagePool.destroyStageByIndex(t),o}return null}))}getBase64(t){if(!t.container.transform)return null;const e=Vh.p.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const i=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),i}initTransactionPlayer(t){var e,i,n,r,o;const s=null===(e=this.view)||void 0===e?void 0:e.parentElement;if(this.view&&s&&Hy[t.type]&&this.transactionPlayer){const e=null===(i=this.transactionPlayer)||void 0===i?void 0:i.renderer.domElement;this.transactionPlayer.initPlayer({reverse:!this.isForward,stageWidth:this.view.width,stageHeight:this.view.height,presetType:Hy[t.type],duration:null===(r=null===(n=this.currentStage)||void 0===n?void 0:n.json.transition)||void 0===r?void 0:r.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil(null!==(o=this.config.maxFPS)&&void 0!==o?o:60),options:t.options}),e&&(e.style.position="absolute",e.style.zIndex="9",e.style.left="0",e.style.top="0",e.style.width=this.view.style.width,e.style.height=this.view.style.height),s.appendChild(e)}}scaleView(t,e,i){var n;this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px");const r=null===(n=this.transactionPlayer)||void 0===n?void 0:n.renderer.domElement;if(r&&this.view&&(r.style.width=this.view.style.width,r.style.height=this.view.style.height),e){this.scale=t;const e=this.scale*this.config.resolution;this.updateResolution(e,i)}}updateResolution(t,e){this.app.ticker.addOnce(()=>{let i=n_.isDesktop()?t:1;for(;i*this.designWidth>this.maxResolution.x||i*this.designHeight>this.maxResolution.y;)i-=.1;this.app.renderer.resolution=i,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight),Ka()(e)&&e()})}nextStep(t,e){var i;if(this._isPaused)this.logger.info("ppt play prevent next step with paused state",this.taskId);else{this.logger.info("ppt play trigger next step",this.taskId);try{this.onRequestCancelFullscreenVideo(!0),null===(i=this.currentStage)||void 0===i||i.nextStep(t,e)}catch(t){this.errorChannel.emit("error",Tm.transform(t),this.currentIndex)}}}prevStep(t=!1){var e;if(this._isPaused)this.logger.info("ppt play prevent prev step with paused state",this.taskId);else{this.logger.info("ppt play trigger prev step",this.taskId);try{this.onRequestCancelFullscreenVideo(!0),null===(e=this.currentStage)||void 0===e||e.prevStep(t)}catch(t){this.errorChannel.emit("error",Tm.transform(t),this.currentIndex)}}}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var i;null===(i=this.currentStage)||void 0===i||i.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},Dh.c.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,i){var n;null===(n=this.currentStage)||void 0===n||n.setInteractiveSeqState(t,e,i)}setMediaState(t,e,i){var n;return Gy(this,void 0,void 0,(function*(){yield null===(n=this.currentStage)||void 0===n?void 0:n.setMediaState(t,e,i)}))}setMediaCurrentTime(t,e){var i;null===(i=this.currentStage)||void 0===i||i.setMediaCurrentTime(t,e)}pause(){var t;this.app.ticker.stop(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalPause()}),this._isPaused=!0}resume(){var t;this._isPaused=!1,this.app.ticker.start(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalResume()})}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}clearLocalCache(){this.localStorage.dispose()}static clearLocalCache(){var t;null===(t=Fy.localCache)||void 0===t||t.clear().catch(()=>{})}clearFullscreenEventListenersWithAppView(){["mousemove","mouseout","mouseover","touchstart","pointerdown"].forEach(t=>{this.cacheFunctionMap.has(t)&&(this.app.view.removeEventListener(t,this.cacheFunctionMap.get(t),!1),this.cacheFunctionMap.delete(t))})}syncFullscreenVideoState(t){this.globalEventHub.emit("syncFullscreenVideoState",t)}destroy(){var t,e;try{this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost);try{this.app.renderer.filter.texturePool.clear(!0)}catch(t){}qm.collectObjectByGroup(this.objPoolGroup),Zm.collectObjectByGroup(this.objPoolGroup),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage(),this.stagePool.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0}),null===(e=Oy.worker)||void 0===e||e.terminate()}catch(t){}}}zy.platform=n_,zy.RtcAudioClazz=null;var Vy=new Map;var Xy,Wy=i(136),Yy=i.n(Wy),qy=i(49),Zy=i.n(qy),Jy=i(50),Ky=i.n(Jy),Qy=[],$y="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Xy||(Xy={}));var tx,ex=function(t){return Object.freeze(t)},ix=function(t,e){this.inlineSize=t,this.blockSize=e,ex(this)},nx=function(){function t(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,ex(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),rx=function(t){return t instanceof SVGElement&&"getBBox"in t},ox=function(t){if(rx(t)){var e=t.getBBox(),i=e.width,n=e.height;return!i&&!n}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},sx=function(t){var e;if(t instanceof Element)return!0;var i=null===(e=null==t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView;return!!(i&&t instanceof i.Element)},ax="undefined"!=typeof window?window:{},lx=new WeakMap,hx=/auto|scroll/,ux=/^tb|vertical/,cx=/msie|trident/i.test(ax.navigator&&ax.navigator.userAgent),dx=function(t){return parseFloat(t||"0")},px=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!1),new ix((i?e:t)||0,(i?t:e)||0)},fx=ex({devicePixelContentBoxSize:px(),borderBoxSize:px(),contentBoxSize:px(),contentRect:new nx(0,0,0,0)}),mx=function(t,e){if(void 0===e&&(e=!1),lx.has(t)&&!e)return lx.get(t);if(ox(t))return lx.set(t,fx),fx;var i=getComputedStyle(t),n=rx(t)&&t.ownerSVGElement&&t.getBBox(),r=!cx&&"border-box"===i.boxSizing,o=ux.test(i.writingMode||""),s=!n&&hx.test(i.overflowY||""),a=!n&&hx.test(i.overflowX||""),l=n?0:dx(i.paddingTop),h=n?0:dx(i.paddingRight),u=n?0:dx(i.paddingBottom),c=n?0:dx(i.paddingLeft),d=n?0:dx(i.borderTopWidth),p=n?0:dx(i.borderRightWidth),f=n?0:dx(i.borderBottomWidth),m=c+h,g=l+u,v=(n?0:dx(i.borderLeftWidth))+p,_=d+f,y=a?t.offsetHeight-_-t.clientHeight:0,x=s?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,T=r?g+_:0,E=n?n.width:dx(i.width)-b-x,S=n?n.height:dx(i.height)-T-y,w=E+m+x+v,A=S+g+y+_,M=ex({devicePixelContentBoxSize:px(Math.round(E*devicePixelRatio),Math.round(S*devicePixelRatio),o),borderBoxSize:px(w,A,o),contentBoxSize:px(E,S,o),contentRect:new nx(c,l,E,S)});return lx.set(t,M),M},gx=function(t,e,i){var n=mx(t,i),r=n.borderBoxSize,o=n.contentBoxSize,s=n.devicePixelContentBoxSize;switch(e){case Xy.DEVICE_PIXEL_CONTENT_BOX:return s;case Xy.BORDER_BOX:return r;default:return o}},vx=function(t){var e=mx(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=ex([e.borderBoxSize]),this.contentBoxSize=ex([e.contentBoxSize]),this.devicePixelContentBoxSize=ex([e.devicePixelContentBoxSize])},_x=function(t){if(ox(t))return 1/0;for(var e=0,i=t.parentNode;i;)e+=1,i=i.parentNode;return e},yx=function(){var t=1/0,e=[];Qy.forEach((function(i){if(0!==i.activeTargets.length){var n=[];i.activeTargets.forEach((function(e){var i=new vx(e.target),r=_x(e.target);n.push(i),e.lastReportedSize=gx(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){i.callback.call(i.observer,n,i.observer)})),i.activeTargets.splice(0,i.activeTargets.length)}}));for(var i=0,n=e;i<n.length;i++){(0,n[i])()}return t},xx=function(t){Qy.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(i){i.isActive()&&(_x(i.target)>t?e.activeTargets.push(i):e.skippedTargets.push(i))}))}))},bx=function(){var t,e=0;for(xx(e);Qy.some((function(t){return t.activeTargets.length>0}));)e=yx(),xx(e);return Qy.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:$y}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=$y),window.dispatchEvent(t)),e>0},Tx=[],Ex=function(t){if(!tx){var e=0,i=document.createTextNode("");new MutationObserver((function(){return Tx.splice(0).forEach((function(t){return t()}))})).observe(i,{characterData:!0}),tx=function(){i.textContent="".concat(e?e--:e++)}}Tx.push(t),tx()},Sx=0,wx={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ax=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Mx=function(t){return void 0===t&&(t=0),Date.now()+t},Cx=!1,Rx=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!Cx){Cx=!0;var i,n=Mx(t);i=function(){var i=!1;try{i=bx()}finally{if(Cx=!1,t=n-Mx(),!Sx)return;i?e.run(1e3):t>0?e.run(t):e.start()}},Ex((function(){requestAnimationFrame(i)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,wx)};document.body?e():ax.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ax.forEach((function(e){return ax.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Ax.forEach((function(e){return ax.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),Ix=function(t){!Sx&&t>0&&Rx.start(),!(Sx+=t)&&Rx.stop()},Px=function(){function t(t,e){this.target=t,this.observedBox=e||Xy.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=gx(this.target,this.observedBox,!0);return t=this.target,rx(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),Ox=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},Nx=new WeakMap,Lx=function(t,e){for(var i=0;i<t.length;i+=1)if(t[i].target===e)return i;return-1},Dx=function(){function t(){}return t.connect=function(t,e){var i=new Ox(t,e);Nx.set(t,i)},t.observe=function(t,e,i){var n=Nx.get(t),r=0===n.observationTargets.length;Lx(n.observationTargets,e)<0&&(r&&Qy.push(n),n.observationTargets.push(new Px(e,i&&i.box)),Ix(1),Rx.schedule())},t.unobserve=function(t,e){var i=Nx.get(t),n=Lx(i.observationTargets,e),r=1===i.observationTargets.length;n>=0&&(r&&Qy.splice(Qy.indexOf(i),1),i.observationTargets.splice(n,1),Ix(-1))},t.disconnect=function(t){var e=this,i=Nx.get(t);i.observationTargets.slice().forEach((function(i){return e.unobserve(t,i.target)})),i.activeTargets.splice(0,i.activeTargets.length)},t}(),Fx=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Dx.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!sx(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Dx.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!sx(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Dx.unobserve(this,t)},t.prototype.disconnect=function(){Dx.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),Bx=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},Ux=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},kx=function(){function t(t,e,i,n,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=i,this.index=t,this.slideIndex=e,this.eventHub=n,this.id=r}return t.prototype.apply=function(){return Bx(this,void 0,void 0,(function(){var t;return Ux(this,(function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return t=e.sent(),this.eventHub.emit("task-error",{task:this,error:t}),[3,4];case 4:return[2]}}))}))},t}(),Gx=function(){function t(){var t=this;this.eventHub=new Za.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var i,n=t.tasks.findIndex((function(t){return t.index===e.index})),r=n+1;r>=0&&(null===(i=t.tasks[r])||void 0===i||i.apply()),n>=0&&(t.tasks.splice(n,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var i=e.task,n=t.tasks.findIndex((function(t){return t.index===i.index}));n>=0&&(t.tasks.splice(n,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,i=new Set,n=0,r=this.tasks.length;n<r;n++)"idle"===this.tasks[n].state&&"idle"===(null===(t=this.tasks[n+1])||void 0===t?void 0:t.state)&&i.add(n);Array.from(i).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,i){var n=new kx(this.index++,e,t,this.eventHub,i);this.tasks.push(n),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&n.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t.prototype.destroy=function(){this.eventHub.removeAllListeners()},t}();function Hx(t,e){var i=t.__state.conversionName.toString(),n=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),l=t.s.toFixed(1),h=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===i||"SIX_CHAR_HEX"===i){for(var u=t.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return"CSS_RGB"===i?"rgb("+n+","+r+","+o+")":"CSS_RGBA"===i?"rgba("+n+","+r+","+o+","+s+")":"HEX"===i?"0x"+t.hex.toString(16):"RGB_ARRAY"===i?"["+n+","+r+","+o+"]":"RGBA_ARRAY"===i?"["+n+","+r+","+o+","+s+"]":"RGB_OBJ"===i?"{r:"+n+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===i?"{r:"+n+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===i?"{h:"+a+",s:"+l+",v:"+h+"}":"HSVA_OBJ"===i?"{h:"+a+",s:"+l+",v:"+h+",a:"+s+"}":"unknown format"}var jx=Array.prototype.forEach,zx=Array.prototype.slice,Vx={BREAK:{},extend:function(t){return this.each(zx.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(e[i])||(t[i]=e[i])}.bind(this))}),this),t},defaults:function(t){return this.each(zx.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(t[i])&&(t[i]=e[i])}.bind(this))}),this),t},compose:function(){var t=zx.call(arguments);return function(){for(var e=zx.call(arguments),i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},each:function(t,e,i){if(t)if(jx&&t.forEach&&t.forEach===jx)t.forEach(e,i);else if(t.length===t.length+0){var n,r=void 0;for(r=0,n=t.length;r<n;r++)if(r in t&&e.call(i,t[r],r)===this.BREAK)return}else for(var o in t)if(e.call(i,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,i){var n=void 0;return function(){var r=this,o=arguments;function s(){n=null,i||t.apply(r,o)}var a=i||!n;clearTimeout(n),n=setTimeout(s,e),a&&t.apply(r,o)}},toArray:function(t){return t.toArray?t.toArray():zx.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},Xx=[{litmus:Vx.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:Hx},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:Hx},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:Hx},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:Hx}}},{litmus:Vx.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:Vx.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:Vx.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(Vx.isNumber(t.r)&&Vx.isNumber(t.g)&&Vx.isNumber(t.b)&&Vx.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(Vx.isNumber(t.r)&&Vx.isNumber(t.g)&&Vx.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(Vx.isNumber(t.h)&&Vx.isNumber(t.s)&&Vx.isNumber(t.v)&&Vx.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(Vx.isNumber(t.h)&&Vx.isNumber(t.s)&&Vx.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],Wx=void 0,Yx=void 0,qx=function(){Yx=!1;var t=arguments.length>1?Vx.toArray(arguments):arguments[0];return Vx.each(Xx,(function(e){if(e.litmus(t))return Vx.each(e.conversions,(function(e,i){if(Wx=e.read(t),!1===Yx&&!1!==Wx)return Yx=Wx,Wx.conversionName=i,Wx.conversion=e,Vx.BREAK})),Vx.BREAK})),Yx},Zx=void 0,Jx={hsv_to_rgb:function(t,e,i){var n=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=i*(1-e),s=i*(1-r*e),a=i*(1-(1-r)*e),l=[[i,a,o],[s,i,o],[o,i,a],[o,s,i],[a,o,i],[i,o,s]][n];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,i){var n=Math.min(t,e,i),r=Math.max(t,e,i),o=r-n,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-i)/o:e===r?2+(i-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,i){var n=this.hex_with_component(0,2,t);return n=this.hex_with_component(n,1,e),n=this.hex_with_component(n,0,i)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,i){return i<<(Zx=8*e)|t&~(255<<Zx)}},Kx="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qx=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},$x=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),tb=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0},eb=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},ib=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},nb=function(){function t(){if(Qx(this,t),this.__state=qx.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return $x(t,[{key:"toString",value:function(){return Hx(this)}},{key:"toHexString",value:function(){return Hx(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function rb(t,e,i){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||nb.recalculateRGB(this,e,i),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(nb.recalculateRGB(this,e,i),this.__state.space="RGB"),this.__state[e]=t}})}function ob(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||nb.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(nb.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}nb.recalculateRGB=function(t,e,i){if("HEX"===t.__state.space)t.__state[e]=Jx.component_from_hex(t.__state.hex,i);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");Vx.extend(t.__state,Jx.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},nb.recalculateHSV=function(t){var e=Jx.rgb_to_hsv(t.r,t.g,t.b);Vx.extend(t.__state,{s:e.s,v:e.v}),Vx.isNaN(e.h)?Vx.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},nb.COMPONENTS=["r","g","b","h","s","v","hex","a"],rb(nb.prototype,"r",2),rb(nb.prototype,"g",1),rb(nb.prototype,"b",0),ob(nb.prototype,"h"),ob(nb.prototype,"s"),ob(nb.prototype,"v"),Object.defineProperty(nb.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(nb.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=Jx.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var sb=function(){function t(e,i){Qx(this,t),this.initialValue=e[i],this.domElement=document.createElement("div"),this.object=e,this.property=i,this.__onChange=void 0,this.__onFinishChange=void 0}return $x(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),ab={};Vx.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){Vx.each(t,(function(t){ab[t]=e}))}));var lb=/(\d+(\.\d+)?)px/;function hb(t){if("0"===t||Vx.isUndefined(t))return 0;var e=t.match(lb);return Vx.isNull(e)?0:parseFloat(e[1])}var ub={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,i){var n=i,r=e;Vx.isUndefined(r)&&(r=!0),Vx.isUndefined(n)&&(n=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),n&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,i,n){var r=i||{},o=ab[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;s.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var h=s.initKeyboardEvent||s.initKeyEvent;Vx.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(e,r.bubbles||!1,r.cancelable||!0)}Vx.defaults(s,n),t.dispatchEvent(s)},bind:function(t,e,i,n){var r=n||!1;return t.addEventListener?t.addEventListener(e,i,r):t.attachEvent&&t.attachEvent("on"+e,i),ub},unbind:function(t,e,i,n){var r=n||!1;return t.removeEventListener?t.removeEventListener(e,i,r):t.detachEvent&&t.detachEvent("on"+e,i),ub},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var i=t.className.split(/ +/);-1===i.indexOf(e)&&(i.push(e),t.className=i.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return ub},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var i=t.className.split(/ +/),n=i.indexOf(e);-1!==n&&(i.splice(n,1),t.className=i.join(" "))}else t.className=void 0;return ub},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return hb(e["border-left-width"])+hb(e["border-right-width"])+hb(e["padding-left"])+hb(e["padding-right"])+hb(e.width)},getHeight:function(t){var e=getComputedStyle(t);return hb(e["border-top-width"])+hb(e["border-bottom-width"])+hb(e["padding-top"])+hb(e["padding-bottom"])+hb(e.height)},getOffset:function(t){var e=t,i={left:0,top:0};if(e.offsetParent)do{i.left+=e.offsetLeft,i.top+=e.offsetTop,e=e.offsetParent}while(e);return i},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},cb=function(t){function e(t,i){Qx(this,e);var n=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n;return n.__prev=n.getValue(),n.__checkbox=document.createElement("input"),n.__checkbox.setAttribute("type","checkbox"),ub.bind(n.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),n.domElement.appendChild(n.__checkbox),n.updateDisplay(),n}return eb(e,t),$x(e,[{key:"setValue",value:function(t){var i=tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),i}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sb),db=function(t){function e(t,i,n){Qx(this,e);var r=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=n,s=r;if(r.__select=document.createElement("select"),Vx.isArray(o)){var a={};Vx.each(o,(function(t){a[t]=t})),o=a}return Vx.each(o,(function(t,e){var i=document.createElement("option");i.innerHTML=e,i.setAttribute("value",t),s.__select.appendChild(i)})),r.updateDisplay(),ub.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),r.domElement.appendChild(r.__select),r}return eb(e,t),$x(e,[{key:"setValue",value:function(t){var i=tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),i}},{key:"updateDisplay",value:function(){return ub.isActive(this.__select)?this:(this.__select.value=this.getValue(),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(sb),pb=function(t){function e(t,i){Qx(this,e);var n=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n;function o(){r.setValue(r.__input.value)}return n.__input=document.createElement("input"),n.__input.setAttribute("type","text"),ub.bind(n.__input,"keyup",o),ub.bind(n.__input,"change",o),ub.bind(n.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),ub.bind(n.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),n.updateDisplay(),n.domElement.appendChild(n.__input),n}return eb(e,t),$x(e,[{key:"updateDisplay",value:function(){return ub.isActive(this.__input)||(this.__input.value=this.getValue()),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sb);function fb(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var mb=function(t){function e(t,i,n){Qx(this,e);var r=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=n||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,Vx.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=fb(r.__impliedStep),r}return eb(e,t),$x(e,[{key:"setValue",value:function(t){var i=t;return void 0!==this.__min&&i<this.__min?i=this.__min:void 0!==this.__max&&i>this.__max&&(i=this.__max),void 0!==this.__step&&i%this.__step!=0&&(i=Math.round(i/this.__step)*this.__step),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,i)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=fb(t),this}}]),e}(sb);var gb=function(t){function e(t,i,n){Qx(this,e);var r=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,n));r.__truncationSuspended=!1;var o=r,s=void 0;function a(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function l(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function h(){ub.unbind(window,"mousemove",l),ub.unbind(window,"mouseup",h),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),ub.bind(r.__input,"change",(function(){var t=parseFloat(o.__input.value);Vx.isNaN(t)||o.setValue(t)})),ub.bind(r.__input,"blur",(function(){a()})),ub.bind(r.__input,"mousedown",(function(t){ub.bind(window,"mousemove",l),ub.bind(window,"mouseup",h),s=t.clientY})),ub.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return eb(e,t),$x(e,[{key:"updateDisplay",value:function(){var t,i,n;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),i=this.__precision,n=Math.pow(10,i),Math.round(t*n)/n),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(mb);function vb(t,e,i,n,r){return n+(t-e)/(i-e)*(r-n)}var _b=function(t){function e(t,i,n,r,o){Qx(this,e);var s=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,{min:n,max:r,step:o})),a=s;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(vb(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function h(){ub.unbind(window,"mousemove",l),ub.unbind(window,"mouseup",h),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function u(t){var e=t.touches[0].clientX,i=a.__background.getBoundingClientRect();a.setValue(vb(e,i.left,i.right,a.__min,a.__max))}function c(){ub.unbind(window,"touchmove",u),ub.unbind(window,"touchend",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),ub.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),ub.bind(window,"mousemove",l),ub.bind(window,"mouseup",h),l(t)})),ub.bind(s.__background,"touchstart",(function(t){if(1!==t.touches.length)return;ub.bind(window,"touchmove",u),ub.bind(window,"touchend",c),u(t)})),ub.addClass(s.__background,"slider"),ub.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return eb(e,t),$x(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(mb),yb=function(t){function e(t,i,n){Qx(this,e);var r=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===n?"Fire":n,ub.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),ub.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return eb(e,t),$x(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(sb),xb=function(t){function e(t,i){Qx(this,e);var n=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));n.__color=new nb(n.getValue()),n.__temp=new nb(0);var r=n;n.domElement=document.createElement("div"),ub.makeSelectable(n.domElement,!1),n.__selector=document.createElement("div"),n.__selector.className="selector",n.__saturation_field=document.createElement("div"),n.__saturation_field.className="saturation-field",n.__field_knob=document.createElement("div"),n.__field_knob.className="field-knob",n.__field_knob_border="2px solid ",n.__hue_knob=document.createElement("div"),n.__hue_knob.className="hue-knob",n.__hue_field=document.createElement("div"),n.__hue_field.className="hue-field",n.__input=document.createElement("input"),n.__input.type="text",n.__input_textShadow="0 1px 1px ",ub.bind(n.__input,"keydown",(function(t){13===t.keyCode&&c.call(this)})),ub.bind(n.__input,"blur",c),ub.bind(n.__selector,"mousedown",(function(){ub.addClass(this,"drag").bind(window,"mouseup",(function(){ub.removeClass(r.__selector,"drag")}))})),ub.bind(n.__selector,"touchstart",(function(){ub.addClass(this,"drag").bind(window,"touchend",(function(){ub.removeClass(r.__selector,"drag")}))}));var o,s=document.createElement("div");function a(t){p(t),ub.bind(window,"mousemove",p),ub.bind(window,"touchmove",p),ub.bind(window,"mouseup",h),ub.bind(window,"touchend",h)}function l(t){f(t),ub.bind(window,"mousemove",f),ub.bind(window,"touchmove",f),ub.bind(window,"mouseup",u),ub.bind(window,"touchend",u)}function h(){ub.unbind(window,"mousemove",p),ub.unbind(window,"touchmove",p),ub.unbind(window,"mouseup",h),ub.unbind(window,"touchend",h),d()}function u(){ub.unbind(window,"mousemove",f),ub.unbind(window,"touchmove",f),ub.unbind(window,"mouseup",u),ub.unbind(window,"touchend",u),d()}function c(){var t=qx(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),i=t.touches&&t.touches[0]||t,n=i.clientX,o=i.clientY,s=(n-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),i=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return i>1?i=1:i<0&&(i=0),r.__color.h=360*i,r.setValue(r.__color.toOriginal()),!1}return Vx.extend(n.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Vx.extend(n.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:n.__field_knob_border+(n.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Vx.extend(n.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Vx.extend(n.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Vx.extend(s.style,{width:"100%",height:"100%",background:"none"}),Tb(s,"top","rgba(0,0,0,0)","#000"),Vx.extend(n.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=n.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Vx.extend(n.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:n.__input_textShadow+"rgba(0,0,0,0.7)"}),ub.bind(n.__saturation_field,"mousedown",a),ub.bind(n.__saturation_field,"touchstart",a),ub.bind(n.__field_knob,"mousedown",a),ub.bind(n.__field_knob,"touchstart",a),ub.bind(n.__hue_field,"mousedown",l),ub.bind(n.__hue_field,"touchstart",l),n.__saturation_field.appendChild(s),n.__selector.appendChild(n.__field_knob),n.__selector.appendChild(n.__saturation_field),n.__selector.appendChild(n.__hue_field),n.__hue_field.appendChild(n.__hue_knob),n.domElement.appendChild(n.__input),n.domElement.appendChild(n.__selector),n.updateDisplay(),n}return eb(e,t),$x(e,[{key:"updateDisplay",value:function(){var t=qx(this.getValue());if(!1!==t){var e=!1;Vx.each(nb.COMPONENTS,(function(i){if(!Vx.isUndefined(t[i])&&!Vx.isUndefined(this.__color.__state[i])&&t[i]!==this.__color.__state[i])return e=!0,{}}),this),e&&Vx.extend(this.__color.__state,t)}Vx.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var i=this.__color.v<.5||this.__color.s>.5?255:0,n=255-i;Vx.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+i+","+i+","+i+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,Tb(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Vx.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+i+","+i+","+i+")",textShadow:this.__input_textShadow+"rgba("+n+","+n+","+n+",.7)"})}}]),e}(sb),bb=["-moz-","-o-","-webkit-","-ms-",""];function Tb(t,e,i,n){t.style.background="",Vx.each(bb,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+i+" 0%, "+n+" 100%); "}))}var Eb=function(t,e){var i=e||document,n=document.createElement("style");n.type="text/css",n.innerHTML=t;var r=i.getElementsByTagName("head")[0];try{r.appendChild(n)}catch(t){}},Sb='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',wb=function(t,e){var i=t[e];return Vx.isArray(arguments[2])||Vx.isObject(arguments[2])?new db(t,e,arguments[2]):Vx.isNumber(i)?Vx.isNumber(arguments[2])&&Vx.isNumber(arguments[3])?Vx.isNumber(arguments[4])?new _b(t,e,arguments[2],arguments[3],arguments[4]):new _b(t,e,arguments[2],arguments[3]):Vx.isNumber(arguments[4])?new gb(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new gb(t,e,{min:arguments[2],max:arguments[3]}):Vx.isString(i)?new pb(t,e):Vx.isFunction(i)?new yb(t,e,""):Vx.isBoolean(i)?new cb(t,e):null};var Ab=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},Mb=function(){function t(){Qx(this,t),this.backgroundElement=document.createElement("div"),Vx.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),ub.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Vx.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;ub.bind(this.backgroundElement,"click",(function(){e.hide()}))}return $x(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),Vx.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",ub.unbind(t.domElement,"webkitTransitionEnd",e),ub.unbind(t.domElement,"transitionend",e),ub.unbind(t.domElement,"oTransitionEnd",e)};ub.bind(this.domElement,"webkitTransitionEnd",e),ub.bind(this.domElement,"transitionend",e),ub.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-ub.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-ub.getHeight(this.domElement)/2+"px"}}]),t}();Eb(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var Cb=function(){try{return!!window.localStorage}catch(t){return!1}}(),Rb=void 0,Ib=!0,Pb=void 0,Ob=!1,Nb=[],Lb=function t(e){var i=this,n=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),ub.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=Vx.defaults(n,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),n=Vx.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),Vx.isUndefined(n.load)?n.load={preset:"Default"}:n.preset&&(n.load.preset=n.preset),Vx.isUndefined(n.parent)&&n.hideable&&Nb.push(this),n.resizable=Vx.isUndefined(n.parent)&&n.resizable,n.autoPlace&&Vx.isUndefined(n.scrollable)&&(n.scrollable=!0);var r,o=Cb&&"true"===localStorage.getItem(Gb(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return n.parent}},scrollable:{get:function(){return n.scrollable}},autoPlace:{get:function(){return n.autoPlace}},closeOnTop:{get:function(){return n.closeOnTop}},preset:{get:function(){return i.parent?i.getRoot().preset:n.load.preset},set:function(t){i.parent?i.getRoot().preset=t:n.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),i.revert()}},width:{get:function(){return n.width},set:function(t){n.width=t,Xb(i,t)}},name:{get:function(){return n.name},set:function(t){n.name=t,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(e){n.closed=e,n.closed?ub.addClass(i.__ul,t.CLASS_CLOSED):ub.removeClass(i.__ul,t.CLASS_CLOSED),this.onResize(),i.__closeButton&&(i.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return o},set:function(t){Cb&&(o=t,t?ub.bind(window,"unload",s):ub.unbind(window,"unload",s),localStorage.setItem(Gb(i,"isLocal"),t))}}}),Vx.isUndefined(n.parent)){if(this.closed=n.closed||!1,ub.addClass(this.domElement,t.CLASS_MAIN),ub.makeSelectable(this.domElement,!1),Cb&&o){i.useLocalStorage=!0;var l=localStorage.getItem(Gb(this,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,ub.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),n.closeOnTop?(ub.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(ub.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),ub.bind(this.__closeButton,"click",(function(){i.closed=!i.closed}))}else{void 0===n.closed&&(n.closed=!0);var h=document.createTextNode(n.name);ub.addClass(h,"controller-name"),a=Db(i,h);ub.addClass(this.__ul,t.CLASS_CLOSED),ub.addClass(a,"title"),ub.bind(a,"click",(function(t){return t.preventDefault(),i.closed=!i.closed,!1})),n.closed||(this.closed=!1)}n.autoPlace&&(Vx.isUndefined(n.parent)&&(Ib&&(Pb=document.createElement("div"),ub.addClass(Pb,"dg"),ub.addClass(Pb,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(Pb),Ib=!1),Pb.appendChild(this.domElement),ub.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||Xb(i,n.width)),this.__resizeHandler=function(){i.onResizeDebounced()},ub.bind(window,"resize",this.__resizeHandler),ub.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),ub.bind(this.__ul,"transitionend",this.__resizeHandler),ub.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&Vb(this),s=function(){Cb&&"true"===localStorage.getItem(Gb(i,"isLocal"))&&localStorage.setItem(Gb(i,"gui"),JSON.stringify(i.getSaveObject()))},this.saveToLocalStorageIfPossible=s,n.parent||((r=i.getRoot()).width+=1,Vx.defer((function(){r.width-=1})))};function Db(t,e,i){var n=document.createElement("li");return e&&n.appendChild(e),i?t.__ul.insertBefore(n,i):t.__ul.appendChild(n),t.onResize(),n}function Fb(t){ub.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&ub.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function Bb(t,e){var i=t.__preset_select[t.__preset_select.selectedIndex];i.innerHTML=e?i.value+"*":i.value}function Ub(t,e){var i=t.getRoot(),n=i.__rememberedObjects.indexOf(e.object);if(-1!==n){var r=i.__rememberedObjectIndecesToControllers[n];if(void 0===r&&(r={},i.__rememberedObjectIndecesToControllers[n]=r),r[e.property]=e,i.load&&i.load.remembered){var o=i.load.remembered,s=void 0;if(o[t.preset])s=o[t.preset];else{if(!o.Default)return;s=o.Default}if(s[n]&&void 0!==s[n][e.property]){var a=s[n][e.property];e.initialValue=a,e.setValue(a)}}}}function kb(t,e,i,n){if(void 0===e[i])throw new Error('Object "'+e+'" has no property "'+i+'"');var r=void 0;if(n.color)r=new xb(e,i);else{var o=[e,i].concat(n.factoryArgs);r=wb.apply(t,o)}n.before instanceof sb&&(n.before=n.before.__li),Ub(t,r),ub.addClass(r.domElement,"c");var s=document.createElement("span");ub.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l=Db(t,a,n.before);return ub.addClass(l,Lb.CLASS_CONTROLLER_ROW),r instanceof xb?ub.addClass(l,"color"):ub.addClass(l,Kx(r.getValue())),function(t,e,i){if(i.__li=e,i.__gui=t,Vx.extend(i,{options:function(e){if(arguments.length>1){var n=i.__li.nextElementSibling;return i.remove(),kb(t,i.object,i.property,{before:n,factoryArgs:[Vx.toArray(arguments)]})}if(Vx.isArray(e)||Vx.isObject(e)){var r=i.__li.nextElementSibling;return i.remove(),kb(t,i.object,i.property,{before:r,factoryArgs:[e]})}},name:function(t){return i.__li.firstElementChild.firstElementChild.innerHTML=t,i},listen:function(){return i.__gui.listen(i),i},remove:function(){return i.__gui.remove(i),i}}),i instanceof _b){var n=new gb(i.object,i.property,{min:i.__min,max:i.__max,step:i.__step});Vx.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=i[t],r=n[t];i[t]=n[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(n,t),e.apply(i,t)}})),ub.addClass(e,"has-slider"),i.domElement.insertBefore(n.domElement,i.domElement.firstElementChild)}else if(i instanceof gb){var r=function(e){if(Vx.isNumber(i.__min)&&Vx.isNumber(i.__max)){var n=i.__li.firstElementChild.firstElementChild.innerHTML,r=i.__gui.__listening.indexOf(i)>-1;i.remove();var o=kb(t,i.object,i.property,{before:i.__li.nextElementSibling,factoryArgs:[i.__min,i.__max,i.__step]});return o.name(n),r&&o.listen(),o}return e};i.min=Vx.compose(r,i.min),i.max=Vx.compose(r,i.max)}else i instanceof cb?(ub.bind(e,"click",(function(){ub.fakeEvent(i.__checkbox,"click")})),ub.bind(i.__checkbox,"click",(function(t){t.stopPropagation()}))):i instanceof yb?(ub.bind(e,"click",(function(){ub.fakeEvent(i.__button,"click")})),ub.bind(e,"mouseover",(function(){ub.addClass(i.__button,"hover")})),ub.bind(e,"mouseout",(function(){ub.removeClass(i.__button,"hover")}))):i instanceof xb&&(ub.addClass(e,"color"),i.updateDisplay=Vx.compose((function(t){return e.style.borderLeftColor=i.__color.toString(),t}),i.updateDisplay),i.updateDisplay());i.setValue=Vx.compose((function(e){return t.getRoot().__preset_select&&i.isModified()&&Bb(t.getRoot(),!0),e}),i.setValue)}(t,l,r),t.__controllers.push(r),r}function Gb(t,e){return document.location.href+"."+e}function Hb(t,e,i){var n=document.createElement("option");n.innerHTML=e,n.value=e,t.__preset_select.appendChild(n),i&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function jb(t,e){e.style.display=t.useLocalStorage?"block":"none"}function zb(t){var e=t.__save_row=document.createElement("li");ub.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),ub.addClass(e,"save-row");var i=document.createElement("span");i.innerHTML="&nbsp;",ub.addClass(i,"button gears");var n=document.createElement("span");n.innerHTML="Save",ub.addClass(n,"button"),ub.addClass(n,"save");var r=document.createElement("span");r.innerHTML="New",ub.addClass(r,"button"),ub.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",ub.addClass(o,"button"),ub.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?Vx.each(t.load.remembered,(function(e,i){Hb(t,i,i===t.preset)})):Hb(t,"Default",!1),ub.bind(s,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(s),e.appendChild(i),e.appendChild(n),e.appendChild(r),e.appendChild(o),Cb){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(Gb(0,"isLocal"))&&l.setAttribute("checked","checked"),jb(t,a),ub.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,jb(t,a)}))}var h=document.getElementById("dg-new-constructor");ub.bind(h,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||Rb.hide()})),ub.bind(i,"click",(function(){h.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),Rb.show(),h.focus(),h.select()})),ub.bind(n,"click",(function(){t.save()})),ub.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),ub.bind(o,"click",(function(){t.revert()}))}function Vb(t){var e=void 0;function i(i){return i.preventDefault(),t.width+=e-i.clientX,t.onResize(),e=i.clientX,!1}function n(){ub.removeClass(t.__closeButton,Lb.CLASS_DRAG),ub.unbind(window,"mousemove",i),ub.unbind(window,"mouseup",n)}function r(r){return r.preventDefault(),e=r.clientX,ub.addClass(t.__closeButton,Lb.CLASS_DRAG),ub.bind(window,"mousemove",i),ub.bind(window,"mouseup",n),!1}t.__resize_handle=document.createElement("div"),Vx.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),ub.bind(t.__resize_handle,"mousedown",r),ub.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function Xb(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function Wb(t,e){var i={};return Vx.each(t.__rememberedObjects,(function(n,r){var o={},s=t.__rememberedObjectIndecesToControllers[r];Vx.each(s,(function(t,i){o[i]=e?t.initialValue:t.getValue()})),i[r]=o})),i}Lb.toggleHide=function(){Ob=!Ob,Vx.each(Nb,(function(t){t.domElement.style.display=Ob?"none":""}))},Lb.CLASS_AUTO_PLACE="a",Lb.CLASS_AUTO_PLACE_CONTAINER="ac",Lb.CLASS_MAIN="main",Lb.CLASS_CONTROLLER_ROW="cr",Lb.CLASS_TOO_TALL="taller-than-window",Lb.CLASS_CLOSED="closed",Lb.CLASS_CLOSE_BUTTON="close-button",Lb.CLASS_CLOSE_TOP="close-top",Lb.CLASS_CLOSE_BOTTOM="close-bottom",Lb.CLASS_DRAG="drag",Lb.DEFAULT_WIDTH=245,Lb.TEXT_CLOSED="Close Controls",Lb.TEXT_OPEN="Open Controls",Lb._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||Lb.toggleHide()},ub.bind(window,"keydown",Lb._keydownHandler,!1),Vx.extend(Lb.prototype,{add:function(t,e){return kb(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return kb(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;Vx.defer((function(){e.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&Pb.removeChild(this.domElement);var t=this;Vx.each(this.__folders,(function(e){t.removeFolder(e)})),ub.unbind(window,"keydown",Lb._keydownHandler,!1),Fb(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var i=new Lb(e);this.__folders[t]=i;var n=Db(this,i.domElement);return ub.addClass(n,"folder"),i},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],Fb(t);var e=this;Vx.each(t.__folders,(function(e){t.removeFolder(e)})),Vx.defer((function(){e.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=ub.getOffset(t.__ul).top,i=0;Vx.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(i+=ub.getHeight(e))})),window.innerHeight-e-20<i?(ub.addClass(t.domElement,Lb.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(ub.removeClass(t.domElement,Lb.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&Vx.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:Vx.debounce((function(){this.onResize()}),50),remember:function(){if(Vx.isUndefined(Rb)&&((Rb=new Mb).domElement.innerHTML=Sb),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;Vx.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&zb(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&Xb(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=Wb(this)),t.folders={},Vx.each(this.__folders,(function(e,i){t.folders[i]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Wb(this),Bb(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=Wb(this,!0)),this.load.remembered[t]=Wb(this),this.preset=t,Hb(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){Vx.each(this.__controllers,(function(e){this.getRoot().load.remembered?Ub(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),Vx.each(this.__folders,(function(t){t.revert(t)})),t||Bb(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&Ab.call(window,(function(){t(e)}));Vx.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){Vx.each(this.__controllers,(function(t){t.updateDisplay()})),Vx.each(this.__folders,(function(t){t.updateDisplay()}))}});var Yb=Lb,qb=function(){function t(t){this.player=t}return Object.defineProperty(t.prototype,"frameRate",{get:function(){return this.player.fps.value},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawFrames",{get:function(){return this.player.runtime.fps},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawCall",{get:function(){return this.player.runtime.drawCall},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this.player.config.resolution},set:function(t){this.player.updateConfig({resolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var t,e;return(null===(t=this.player.view)||void 0===t?void 0:t.width)+"*"+(null===(e=this.player.view)||void 0===e?void 0:e.height)},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFPS",{get:function(){return this.player.config.minFPS},set:function(t){this.player.updateConfig({minFPS:t,maxFPS:this.player.config.maxFPS})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFPS",{get:function(){return this.player.config.maxFPS},set:function(t){this.player.updateConfig({maxFPS:t,minFPS:this.player.config.minFPS})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoResolution",{get:function(){return this.player.config.autoResolution},set:function(t){this.player.updateConfig({autoResolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoFPS",{get:function(){return this.player.config.autoFPS},set:function(t){this.player.updateConfig({autoFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundColor",{get:function(){return this.player.config.transactionBgColor},set:function(t){this.player.updateConfig({transactionBgColor:t})},enumerable:!1,configurable:!0}),t}(),Zb=function(){function t(t,e){var i;this.config=new qb(t),this.anchor=e,i=this.createControllerGUI(),this.gui=i[0],this.controller=i[1],this.createStats()}return t.prototype.createStats=function(){var t=this;this.stateId=setInterval((function(){t.controller.frameRate.updateDisplay(),t.controller.size.updateDisplay(),t.controller.minFPS.updateDisplay(),t.controller.drawFrames.updateDisplay(),t.controller.maxFPS.updateDisplay(),t.controller.resolution.updateDisplay(),t.controller.autoFps.updateDisplay(),t.controller.autoResolution.updateDisplay(),t.controller.drawCall.updateDisplay()}),16)},t.prototype.createControllerGUI=function(){var t=new Yb({autoPlace:!0,closed:!0});t.domElement.style.opacity=".6",t.domElement.style.transformOrigin="100% 0",t.domElement.style.transform="scale(1)",this.anchor.appendChild(t.domElement),t.domElement.style.position="absolute",t.domElement.style.right="0",t.domElement.style.top="0",t.domElement.style.zIndex="2";var e={frameRate:t.add(this.config,"frameRate"),drawFrames:t.add(this.config,"drawFrames"),drawCall:t.add(this.config,"drawCall"),size:t.add(this.config,"size"),minFPS:t.add(this.config,"minFPS",0,60),maxFPS:t.add(this.config,"maxFPS",0,60),resolution:t.add(this.config,"resolution",.5,8,.5),autoResolution:t.add(this.config,"autoResolution"),autoFps:t.add(this.config,"autoFPS"),transactionBgColor:t.addColor(this.config,"backgroundColor")};return[t,e]},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.anchor.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),Jb=function(){function t(t){var e=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){e.isScheduling=!0;var t=e.tasks.shift();t&&!e.isDestroy&&e.fn(t).then((function(){e.tasks.length>0?window.requestAnimationFrame(e.schedule):e.isScheduling=!1}))},this.fn=t}return t.prototype.destroy=function(){this.isDestroy=!0},t.prototype.addTask=function(t){this.tasks.push(t),this.isScheduling||this.schedule()},t}(),Kb=function(){function t(t){this.autoUnlock=Object.create(null),this.locks=Object.create(null),this.available=!1,this.available=t}return t.prototype.addLock=function(t,e){var i=this;this.available&&(this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete i.locks[t]}),3e3))},t.prototype.unlock=function(t,e){this.available&&e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.available&&!!this.locks[t]},t}(),Qb=function(){function t(){var t=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){t.isScheduling=!0;var e=t.tasks.shift();e&&!t.isDestroy&&(e.status="running",e.fn.apply(null).then((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})).catch((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})))}}return t.prototype.getRunningTask=function(){return this.tasks[0]&&"running"===this.tasks[0].status?this.tasks[0]:null},t.prototype.addTask=function(t,e){var i={type:t,status:"wait",fn:e},n=this.getRunningTask();n&&t===n.type||(this.tasks=this.tasks.filter((function(e){return e.type!==t})),this.tasks.push(i),this.isScheduling||this.schedule())},t.prototype.destroy=function(){this.isDestroy=!0},t}(),$b=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},tT=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eT=function(){function t(){var t=this;this.logList=[],this.checkTimer=null,this.retryTimes=0,this.enable=!1,this.uploadLoggerGlobalEvent=function(e){"@slide/_upload_log_"===e.data.type&&t.start()},this.config={checkTime:3e3,buffer:300},window.addEventListener("message",this.uploadLoggerGlobalEvent),this.start()}return t.prototype.start=function(){return $b(this,void 0,void 0,(function(){var t=this;return tT(this,(function(e){return clearInterval(this.checkTimer),this.checkTimer=setInterval((function(){return $b(t,void 0,void 0,(function(){return tT(this,(function(t){switch(t.label){case 0:return[4,this.uploadLog()];case 1:return t.sent(),[2]}}))}))}),this.config.checkTime),[2]}))}))},t.prototype.pause=function(){clearInterval(this.checkTimer)},t.prototype.addLog=function(t,e,i,n){this.logList.push({level:e,taskId:i,message:t,randomId:n})},t.prototype.destroy=function(){clearInterval(this.checkTimer),window.removeEventListener("message",this.uploadLoggerGlobalEvent)},t.prototype.uploadLog=function(t){return void 0===t&&(t=!1),$b(this,void 0,void 0,(function(){var e,i,n,r=this;return tT(this,(function(o){switch(o.label){case 0:if(!(this.logList.length>=this.config.buffer||t))return[2];e=this.logList.splice(0),i=function(){r.logList=e.concat(r.logList),r.retryTimes>3&&r.pause(),r.retryTimes+=1},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,fetch("https://netless-ppt-plugin-dev.cn-hangzhou.log.aliyuncs.com/logstores/netless-ppt-plugin-dev/track",{method:"POST",headers:{"x-log-apiversion":"0.6.0","Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify({__topic__:"netless-ppt-plugin-dev",__source__:"netless-ppt-plugin-dev",__logs__:e})})];case 2:return o.sent().ok?this.retryTimes=0:i(),[3,4];case 3:return n=o.sent(),console.warn(n),i(),[3,4];case 4:return[2]}}))}))},t.prototype.setEnable=function(t){this.enable!==t&&(t?this.start():this.pause())},t}(),iT=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},nT=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function rT(t,e,i){return iT(this,void 0,void 0,(function(){var n,r,o,s;return nT(this,(function(a){switch(a.label){case 0:return n=document.createElement("div"),(r=new vT({anchor:n,renderOptions:{minFPS:1,maxFPS:1,resolution:1},mode:"local",interactive:!1,useLocalCache:!0})).setResource(t,e),[4,r.getSlideCountAsync()];case 1:o=a.sent(),s=1,a.label=2;case 2:return s<=o?[4,r.player.stagePool.preload(s,!0)]:[3,5];case 3:a.sent(),i(Math.round(s/o*100)/100),a.label=4;case 4:return s++,[3,2];case 5:return r.destroy(),[2]}}))}))}var oT=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),sT=function(){return(sT=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},aT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},lT=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},hT=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},uT=window.ResizeObserver||Fx,cT=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function dT(t,e){return lT(this,void 0,void 0,(function(){var i;return hT(this,(function(n){switch(n.label){case 0:i=Date.now(),n.label=1;case 1:return!t()&&Date.now()-i<e?[4,cT(50)]:[3,3];case 2:return n.sent(),i=Date.now(),[3,1];case 3:return[2]}}))}))}var pT={syncDispatch:"syncDispatch",syncReceive:"syncReceive",syncEventLag:"syncEventLag",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange",slideStepEnd:"slideEnd",slideStepStart:"slideStart"},fT={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},mT="";try{mT="1.1.9-beta.1"}catch(t){mT="dev -"}var gT=null;try{(gT=o.createInstance({name:"__slide_local_log__",driver:o.INDEXEDDB,version:1})).ready((function(t){})).catch((function(t){}))}catch(t){}var vT=function(t){function e(i){var n=t.call(this)||this;return n.iosResetCache=[],n.needClearCacheImage=!1,n.version=mT,n.__slideState=Ky()(fT),n.userInputTime=0,n.isSyncingSlideState=!1,n.frozenTaskManager=new Qb,n.randomId=r(),n.resize=!1,n.isAnimating=!1,n.renderingTaskManager=new Gx,n.isLoading=!1,n.interactive=!0,n.renderingIndex=0,n.frameWidth=1,n.frameHeight=1,n.frame=document.createElement("div"),n.canvasContainer=document.createElement("div"),n.medianController=document.createElement("div"),n.frameResizeObserver=new uT((function(){return n.frameResizeHandler()})),n.timestamp=function(){return Date.now()},n.mode="local",n.enableGlobalClick=!1,n.lastEmitedState=null,n.playerController=null,n.isInitResized=!1,n.cacheImage=document.createElement("img"),n.isTouchStart=!1,n.touchStartId=void 0,n.taskId="",n.volumeAdjuster=new ky,n.designWidth=0,n.designHeight=0,n._slideCount=0,n._dispatchIncrId=0,n._receiveIncrId=0,n._updateVolumeByStaticAdjuster=function(t){n.volumeAdjuster.volume=t},n.recoverHandler=function(t){if("@slide/_recover_"===t.data.type&&t.data.slideId===n.randomId){var e=t.data,i=e.recoverBy,r=e.payload;if(!r)return;"renderOtherPage"===i&&r.slideIndex?n.doRenderSlide(r.slideIndex).catch((function(t){n.logger.error(t,n.taskId)})):"reloadCurrentPage"===i&&n.doRenderSlide(n.renderingIndex).catch((function(t){n.logger.error(t,n.taskId)}))}},n.userInputHandle=function(){n.userInputTime=Date.now()},n.handleViewClick=function(){setTimeout((function(){var t=Date.now();Math.abs(t-n.userInputTime)>500&&n.enableGlobalClick&&n.nextStep()}))},n.handleViewTouchStart=function(){window.clearTimeout(n.touchStartId),n.isTouchStart=!0,n.touchStartId=setTimeout((function(){n.isTouchStart=!1}),350)},n.handleViewTouchEnd=function(){n.isTouchStart&&(n.isTouchStart=!1,n.handleViewClick())},n.handleSlideRef=function(){console.log(n),window.__slide=n},n.receiveSyncHandler=function(t){return lT(n,void 0,void 0,(function(){var e,i,n,r,o,s=this;return hT(this,(function(a){switch(a.label){case 0:return Vm()(t.incrId)&&(t.incrId&&t.incrId-this._receiveIncrId!=1&&this.emit(pT.syncEventLag),this._receiveIncrId=t.incrId||0),this.logger.info("sync receive "+JSON.stringify(t),this.taskId),"nextStep"!==t.type?[3,1]:(this.mainSeqStep!==t.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(t.next,"start"),this.player.nextTick((function(){s.doNextStep(!0,t.clientId||"")}))):this.doNextStep(!0,t.clientId||""),[3,6]);case 1:return"prevStep"!==t.type?[3,2]:(0===this.mainSeqStep&&"idle"===this.mainSeqState||this.mainSeqStep===t.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep(!0):(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){s.doPrevStep(!0)}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.action):this.__slideState.interactiveSeqState[t.seqId]?this.__slideState.interactiveSeqState[t.seqId].step+=1:this.__slideState.interactiveSeqState[t.seqId]={step:0,state:"end"},[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return a.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(i=this.player)||void 0===i||i.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!1),this.__slideState.mediaState[t.id]=t.state):"mediaSeek"===t.type?(null===(r=this.player)||void 0===r||r.setMediaCurrentTime(t.id,t.time),this.__slideState.mediaState[t.id]=t.state):"mediaFullscreen"===t.type&&(t.targetId&&this.__slideState.mediaState[t.targetId]?this.__slideState.mediaState[t.targetId].fullscreen=t.state:this.__slideState.mediaState[t.targetId]={fullscreen:t.state,type:"pause",time:0},null===(o=this.player)||void 0===o||o.syncFullscreenVideoState({targetId:t.targetId,state:t.state,slideIndex:t.slideIndex})),a.label=6;case 6:return[2]}}))}))},n.handlePrevSlide=function(t){return void 0===t&&(t=!1),lT(n,void 0,void 0,(function(){var e,i;return hT(this,(function(n){return this.player?((e=this.player.prevSlideIndex)>=1&&((null===(i=this.config.navigatorDelegate)||void 0===i?void 0:i.gotoPage)?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!1):this.renderSlide(e,!1)),[2]):[2]}))}))},n.handleNextSlide=function(t){return void 0===t&&(t=!1),lT(n,void 0,void 0,(function(){var e,i;return hT(this,(function(n){return this.player?((e=this.player.nextSlideIndex)<=this.slideCount&&((null===(i=this.config.navigatorDelegate)||void 0===i?void 0:i.gotoPage)?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!0):this.renderSlide(e,!0)),[2]):[2]}))}))},n.handleGotoSlide=function(t){if(t<=n.slideCount&&t>=1){var e=n.slideState.currentSlideIndex<=t;n.renderSlide(t,e)}else-1===t&&n.renderSlide(n.slideCount,!0)},e.instances.push(n),n.config=n.initSlideConfig(i),e.trackLogger.setEnable(!!n.config.enableTracking),n.logger={info:function(t,i){var r;e.appendLogString("INFO - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n"),e.trackLogger.addLog(t,"info",i,n.randomId);var o=null===(r=n.config.logger)||void 0===r?void 0:r.info;o&&o("["+i+"] "+t)},warn:function(t,i){var r;e.appendLogString("WARN - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n"),e.trackLogger.addLog(t,"warn",i,n.randomId);var o=null===(r=n.config.logger)||void 0===r?void 0:r.warn;o&&o("["+i+"] "+t)},error:function(t,i){var r;e.appendLogString("ERROR - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n"),e.trackLogger.addLog(t,"error",i,n.randomId);var o=null===(r=n.config.logger)||void 0===r?void 0:r.error;o&&o("["+i+"] "+t)}},n.logger.info("new slide with clientId: "+n.config.clientId+", version: "+n.version,n.taskId),n.anchor=n.config.anchor,n.syncQueue=new Jb(n.receiveSyncHandler),n.lock=new Kb("interactive"===n.mode),n.cacheImage.style.position="absolute",n.cacheImage.style.zIndex="100",n.setMedianControllerAttribute(),n.canvasContainer.style.position="relative",n.canvasContainer.style.fontSize="0",n.canvasContainer.appendChild(n.medianController),n.frame.appendChild(n.canvasContainer),n.frameResizeObserver.observe(n.frame),n.on(pT.syncReceive,(function(t){n.lock.unlock(t.type,t.uuid),n.syncQueue.addTask(t)})),n.renderingTaskManager.eventHub.on("task-error",(function(t){var e=t.error,i=t.task,r=Tm.transform(e);r.errorType===gm.RuntimeWarn?n.logger.warn(r.message,n.taskId):n.logger.error(r.message,n.taskId),n.isLoading=!1,n.reportError(r,i.slideIndex)})),window.addEventListener("__slide_ref__",n.handleSlideRef),n.resizeView=Zy()(n.resizeView.bind(n),50),n.player=n.initPlayer(n.config),n.config.controller&&n.createController(),n.player.view&&n.canvasContainer.appendChild(n.player.view),n.handleViewClick=Zy()(n.handleViewClick,300),n.player.errorChannel.on("error",(function(t,e){var i=Tm.transform(t);i.errorType===gm.RuntimeWarn?n.logger.warn(i.message,n.taskId):n.logger.error(i.message,n.taskId),n.isLoading=!1,n.reportError(t,e)})),window.addEventListener("message",n.recoverHandler),e.volumeAdjuster.on("update",n._updateVolumeByStaticAdjuster),n.volumeAdjuster.volume=e.volumeAdjuster.volume,n}var i,n;return oT(e,t),e.flushLog=function(t){return void 0===t&&(t=!1),lT(this,void 0,void 0,(function(){return hT(this,(function(i){switch(i.label){case 0:if(!(e._tempLog.length>131072||t&&e._tempLog.length>0))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null==gT?void 0:gT.setItem("run_time_log_"+e._tempLogIndex,e._tempLog)];case 2:return i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:e._tempLog="",e._tempLogIndex+=1,i.label=5;case 5:return[2]}}))}))},e.stopRemoteLog=function(){e.remoteLogAddress=null},e.startRemoteLog=function(t){return lT(this,void 0,void 0,(function(){var i,n,r,o,s;return hT(this,(function(a){switch(a.label){case 0:return e.remoteLogAddress=t,[4,e.flushLog(!0)];case 1:if(a.sent(),!gT)return[3,13];i=[],a.label=2;case 2:return a.trys.push([2,4,,5]),[4,gT.keys()];case 3:return i=(a.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),[3,5];case 4:return a.sent(),[3,5];case 5:n=0,r=i,a.label=6;case 6:if(!(n<r.length))return[3,13];o=r[n],o.replace("run_time_log_",""),s="",a.label=7;case 7:return a.trys.push([7,9,,10]),[4,gT.getItem(o)];case 8:return s=a.sent()||"",[3,10];case 9:return a.sent(),[3,10];case 10:return[4,fetch(e.remoteLogAddress+"/logs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log:s})})];case 11:a.sent(),a.label=12;case 12:return n++,[3,6];case 13:return[2]}}))}))},e.appendLogString=function(t){e._tempLog+=t,e.remoteLogAddress&&fetch(e.remoteLogAddress+"/logs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log:t})}).catch((function(){}))},Object.defineProperty(e.prototype,"dispatchIncrId",{get:function(){return this._dispatchIncrId++},enumerable:!1,configurable:!0}),e.prototype.reportError=function(t,i){this.emit(pT.renderError,{error:t,index:i}),window.postMessage({type:"@slide/_error_",errorType:t.errorType,errorMsg:t.errorMsg,slideId:this.randomId,slideIndex:i,customMessage:"@slide/_error_"},"*"),e.trackLogger.uploadLog(!0)},e.prototype.initSlideConfig=function(t){return t.timestamp&&(this.timestamp=t.timestamp),t.rtcAudio&&(zy.RtcAudioClazz=t.rtcAudio),this.mode=t.mode,this.anchor=t.anchor,this.anchor.appendChild(this.frame),this.enableGlobalClick=!$a()(t.enableGlobalClick)&&t.enableGlobalClick,this.resize=t.resize||!1,this.interactive=t.interactive,this.frame.style.cssText=t.fixedFrameSize?"width:"+t.fixedFrameSize.width+"px;height:"+t.fixedFrameSize.height+"px;":"width:100%;height:100%",this.frame.style.cssText+="display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",t.fixedFrameSize&&(this.frameWidth=t.fixedFrameSize.width,this.frameHeight=t.fixedFrameSize.height),t},e.prototype.initPlayer=function(t){var e,i,n,r=this,o=new zy({mode:this.mode,useLocalCache:!!$a()(this.config.useLocalCache)||this.config.useLocalCache,logger:this.logger,resourceTimeout:$a()(this.config.resourceTimeout)?15e3:this.config.resourceTimeout,loadDelegate:this.config.loaderDelegate,volumeAdjuster:this.volumeAdjuster,urlInterrupter:this.config.urlInterrupter},t.renderOptions);return o.setInteractive(this.interactive),o.updateConfig(t.renderOptions||{}),o.on(jy.renderStart,(function(t){r.isLoading=!0,r.emit(pT.renderStart,t),window.postMessage({type:"@slide/_render_start_",taskId:r.taskId,index:t},"*")})),o.on(jy.renderEnd,(function(t){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(pT.renderEnd,t),window.postMessage({type:"@slide/_render_end_",taskId:r.taskId,index:t},"*")})),o.on(jy.slideChange,(function(t){r.__slideState.currentSlideIndex=t,r.emitStateChange(),r.emit(pT.slideChange,t)})),o.on(jy.mainSeqStateChange,(function(t){r.__slideState.mainSeqState=t,r.emitStateChange()})),o.on(jy.mainSeqStepChange,(function(t){r.__slideState.mainSeqStep=t,r.emitStateChange()})),o.on(jy.interactiveSeqStateChange,(function(t){var e=t.id,i=t.state;r.__slideState.interactiveSeqState[e]=i,r.emitStateChange()})),o.on(jy.animateStart,(function(){!0!==r.isAnimating&&(r.isAnimating=!0,r.emit(pT.animateStart))})),o.on(jy.animateEnd,(function(){!1!==r.isAnimating&&(r.isAnimating=!1,r.emit(pT.animateEnd))})),o.on(jy.interactiveSeqAction,(function(t){var e=t.action,i=t.seqId;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",action:e,seqId:i}),r.emitStateChange()})),o.on(jy.mainSeqStepStart,(function(t){r.emit(pT.mainSeqStepStart,t)})),o.on(jy.mainSeqStepEnd,(function(t){r.emit(pT.mainSeqStepEnd,t)})),o.on(jy.mediaPlay,(function(t){var e,i=null!==(e=r.__slideState.mediaState[t.id])&&void 0!==e?e:{};i.type="play",i.time=r.timestamp()-1e3*t.time,r.__slideState.mediaState[t.id]=i,t._stateOnly?"interactive"===r.config.mode&&r.receiveSyncHandler({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:i}).catch((function(t){r.logger.error(null==t?void 0:t.message,r.taskId)})):r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:i}),r.emitStateChange()})),o.on(jy.mediaStop,(function(t){delete r.__slideState.mediaState[t.id],r.emitStateChange()})),o.on(jy.mediaPause,(function(t){var e,i=null!==(e=r.__slideState.mediaState[t.id])&&void 0!==e?e:{};i.type="pause",i.time=t.time,r.__slideState.mediaState[t.id]=i,t._stateOnly?"interactive"===r.config.mode&&r.receiveSyncHandler({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:i}).catch((function(t){r.logger.error(null==t?void 0:t.message,r.taskId)})):r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:i}),r.emitStateChange()})),o.on(jy.mediaSeek,(function(t){var e,i=null!==(e=r.__slideState.mediaState[t.id])&&void 0!==e?e:{};t.isPlaying?(i.type="play",i.time=r.timestamp()-1e3*t.time):(i.type="pause",i.time=t.time),r.__slideState.mediaState[t.id]=i,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:i}),r.emitStateChange()})),o.on(jy.requestPrevSlide,(function(t){r.handlePrevSlide(t)})),o.on(jy.requestNextSlide,(function(t){r.handleNextSlide(t)})),o.on(jy.requestGotoSlide,(function(t){var e;(null===(e=r.config.navigatorDelegate)||void 0===e?void 0:e.gotoPage)?r.config.navigatorDelegate.gotoPage(t):r.handleGotoSlide(t)})),o.on(jy.requestOpenUrl,(function(t){var e;console.log(r.config.navigatorDelegate),(null===(e=r.config.navigatorDelegate)||void 0===e?void 0:e.openUrl)&&r.config.navigatorDelegate.openUrl(t)})),o.on(jy.fullscreenChange,(function(t){var e,i=t.targetId,n=t.state;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaFullscreen",targetId:i,state:n});var o=null!==(e=r.__slideState.mediaState[i])&&void 0!==e?e:{};o.fullscreen=n,r.__slideState.mediaState[i]=o,r.emitStateChange()})),o.on(jy.changeLocalFullscreenState,(function(t){t.slideIndex===r.__slideState.currentSlideIndex?(t.targetId&&r.__slideState.mediaState[t.targetId]&&(r.__slideState.mediaState[t.targetId].fullscreen=t.status),r.emitStateChange()):r.logger.info("event slideIndex: "+t.slideIndex+", current slideIndex: "+r.__slideState.currentSlideIndex,r.taskId)})),null===(e=o.view)||void 0===e||e.addEventListener("touchend",this.handleViewTouchEnd),null===(i=o.view)||void 0===i||i.addEventListener("touchstart",this.handleViewTouchStart),null===(n=o.view)||void 0===n||n.addEventListener("click",this.handleViewClick),o.on(jy.userInput,this.userInputHandle),o},e.prototype.createController=function(){this.player&&(this.playerController=new Zb(this.player,this.frame))},e.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2",this.medianController.style.fontSize="16px"},e.prototype.frameResizeHandler=function(){if(!this.config.fixedFrameSize){var t=this.frame.getBoundingClientRect(),e=t.width,i=t.height;this.frameWidth=e,this.frameHeight=i,this.resizeView()}},e.prototype.updateFixedFrameSize=function(t,e,i){this.config.fixedFrameSize&&(this.frameWidth=t,this.frameHeight=e,this.frame.style.width=t+"px",this.frame.style.height=e+"px",this.resizeView(i))},e.prototype.resizeView=function(t){var e,i,n=this,r=this.width,o=this.height;if(r>0&&o>0){var s=this.frameWidth/r,a=s*o;a>this.frameHeight&&(s*=this.frameHeight/a),null===(e=this.player)||void 0===e||e.scaleView(s,this.resize,t),this.cacheImage.style.transform="scale("+s+")",this.medianController.style.transform="scale("+s+")",this.medianController.setAttribute("data-scale",s.toString()),this.isInitResized||(this.isInitResized=!0,null===(i=this.player)||void 0===i||i.clock.setTimeout((function(){n.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,i,n;return lT(this,void 0,void 0,(function(){var r,o=this;return hT(this,(function(s){switch(s.label){case 0:return this.isSyncingSlideState=!0,this.logger.info("stateChange receive "+JSON.stringify(t),this.taskId),t.taskId&&t.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=t.taskId,null===(e=this.player)||void 0===e||e.setResourceData(t.taskId,this.__slideState.url)),t.url&&t.url!==this.__slideState.url&&(this.__slideState.url=t.url,null===(i=this.player)||void 0===i||i.setResourceData(this.__slideState.taskId,t.url)),Number.isInteger(t.currentSlideIndex)&&t.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=t.currentSlideIndex,[4,this.doRenderSlide(t.currentSlideIndex)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[4,null===(n=this.player)||void 0===n?void 0:n.clock.waitUntil((function(){var e,i;return(null===(e=o.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(i=o.player)||void 0===i?void 0:i.currentStage)}),3e3)];case 3:return s.sent(),r=!1,Number.isInteger(t.mainSeqStep)&&t.mainSeqStep!==this.__slideState.mainSeqStep&&(r=!0,this.__slideState.mainSeqStep=t.mainSeqStep),t.mainSeqState&&t.mainSeqState!==this.__slideState.mainSeqState&&(r=!0,this.__slideState.mainSeqState=t.mainSeqState),r&&this.setMainSeqStep(this.__slideState.mainSeqStep,"idle"===this.__slideState.mainSeqState?"start":"end"),t.interactiveSeqState&&(this.initInteractiveSeq(t),this.__slideState.interactiveSeqState=t.interactiveSeqState),[4,cT(1500)];case 4:return s.sent(),t.mediaState&&(this.initMedia(t),this.__slideState.mediaState=t.mediaState),this.isSyncingSlideState=!1,[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var i in t.interactiveSeqState){var n=t.interactiveSeqState[i];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(i,n.step,"idle"===n.state?"start":"end")}},e.prototype.initMedia=function(t){var e,i,n;for(var r in t.mediaState){var o=t.mediaState[r],s=this.__slideState.mediaState[r];if(null===(e=this.player)||void 0===e||e.syncFullscreenVideoState({targetId:r,state:!!o.fullscreen,slideIndex:this.slideState.currentSlideIndex}),!s||o.type!==s.type||o.time!==s.time)if("play"===o.type){var a=(this.timestamp()-o.time)/1e3;null===(i=this.player)||void 0===i||i.setMediaState(r,!0,a)}else null===(n=this.player)||void 0===n||n.setMediaState(r,!1,o.time)}},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),e.prototype.getSizeAsync=function(){return lT(this,void 0,void 0,(function(){var t;return hT(this,(function(e){switch(e.label){case 0:if(this.width>0&&this.height>0)return[2,[this.width,this.height]];e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,e.sent().json()];case 3:return[2,[(t=e.sent()).width,t.height]];case 4:return e.sent(),[2,[0,0]];case 5:return[2]}}))}))},e.prototype.getSlideCountAsync=function(){return lT(this,void 0,void 0,(function(){return hT(this,(function(t){switch(t.label){case 0:if(this._slideCount>0)return[2,this._slideCount];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,t.sent().json()];case 3:return[2,t.sent().slideCount];case 4:return t.sent(),[2,0];case 5:return[2]}}))}))},Object.defineProperty(e.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqLength",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqStep",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqState",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderOptions",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawCall",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"runtimeFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),e.prototype.updateRenderOption=function(t){this.player&&(this.player.updateConfig(t),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},e.prototype.setResource=function(t,e){var i;this.taskId=t,null===(i=this.player)||void 0===i||i.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e})},e.prototype._renderSlide=function(t){var e;return lT(this,void 0,void 0,(function(){var i=this;return hT(this,(function(n){switch(n.label){case 0:return this.renderingIndex=t,this.player&&t===this.player.currentIndex?[2]:((zy.platform.isIOS()||zy.platform.isAndroid())&&this.iosResetCache.indexOf(t)<0&&this.iosResetCache.push(t),[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)]);case 1:return n.sent(),this.__slideState.currentSlideIndex=t,this.resizeView(),this.__slideState.interactiveSeqState={},this.__slideState.mediaState={},this.emitStateChange(),setTimeout((function(){var t,e;if("hidden"===(null===(e=null===(t=i.player)||void 0===t?void 0:t.view)||void 0===e?void 0:e.style.visibility)&&(i.player.view.style.visibility="visible"),"hidden"===i.frame.style.visibility&&(i.frame.style.visibility="visible"),i.needClearCacheImage)try{i.frame.removeChild(i.cacheImage)}catch(t){}}),100),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){var i=Number(t);(i!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(i>this.slideCount&&this.slideCount>0||this.poseRenderSlide(i,e))}},e.prototype.needCreateNewPlayer=function(){var t=zy.platform.isLowGpuMemory()?15:30;return(zy.platform.isIOS()||zy.platform.isAndroid())&&this.iosResetCache.length>t},e.prototype.poseRenderSlide=function(t,e){"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e}):"sync"===this.mode?(this.doRenderSlide(t,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e})):this.doRenderSlide(t,e)},e.prototype.doRenderSlide=function(t,e){var i,n,r,o=this;if(void 0===e&&(e=!0),!this.player)return Promise.resolve();if(this.needCreateNewPlayer()&&(this.iosResetCache=[],this.iosNewPlayer=this.initPlayer(this.config),this.iosNewPlayer.setResourceData(this.__slideState.taskId,this.__slideState.url)),this.iosNewPlayer){var s=this.player.getSnapshot();this.cacheImage.src=s,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(i=this.playerController)||void 0===i||i.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,(null===(n=this.config)||void 0===n?void 0:n.controller)&&this.createController(),this.needClearCacheImage=!0,(null===(r=null==this?void 0:this.player)||void 0===r?void 0:r.view)&&(this.player.view.style.visibility="hidden",this.canvasContainer.appendChild(this.player.view))}var a=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return o._renderSlide(t)}),t,a),new Promise((function(t){o.renderingTaskManager.eventHub.once("task-end-"+a,t)}))},e.prototype.getSnapshot=function(){var t,e;return null!==(e=null===(t=this.player)||void 0===t?void 0:t.getSnapshot())&&void 0!==e?e:null},e.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive?(this.hasNextStep()||this.emit(pT.slideStepEnd),this.player.mainSeqHasNextStep()?"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):"sync"===this.mode?(this.doNextStep(!1,""),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep(!1,""):this.handleNextSlide()):this.logger.info("prevent nextStep. isLoading: "+this.isLoading+", player: "+!!this.player+", interactive: "+this.interactive,this.taskId)},e.prototype.doNextStep=function(t,e){if(this.player){var i=!this.config.clientId||e===this.config.clientId;this.player.nextStep(t,i);var n=this.player.mainSeqStep();this.__slideState.mainSeqStep=n,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive?(this.hasPrevStep()||this.emit(pT.slideStepStart),this.player.mainSeqHasPrevStep()?"interactive"===this.mode?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):"sync"===this.mode?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide()):this.logger.info("prevent nextStep. isLoading: "+this.isLoading+", player: "+this.player+", interactive: "+this.interactive,this.taskId)},e.prototype.doPrevStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.prevStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.isSlideStateReady=function(t){return t.taskId.length>0&&t.url.length>0&&t.currentSlideIndex>0},e.prototype.emitStateChange=function(){if("local"!==this.mode&&!this.isSyncingSlideState){var t=this.slideState;!Yy()(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(pT.stateChange,t),this.logger.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var e=Math.random().toString(32).substr(2);this.lock.addLock(t.type,e);var i=sT(sT({},t),{uuid:e,clientId:this.config.clientId});"sync"===this.config.mode&&(i.incrId=this.dispatchIncrId),this.emit(pT.syncDispatch,i),this.logger.info("sync dispatch "+JSON.stringify(i),this.taskId)}},e.prototype.setMainSeqStep=function(t,e){var i;null===(i=this.player)||void 0===i||i.setMainSeqStep(t,e)},e.prototype.setInteractive=function(t){var e;this.interactive=t,null===(e=this.player)||void 0===e||e.setInteractive(t)},e.prototype.pause=function(){var t;null===(t=this.player)||void 0===t||t.pause()},e.prototype.resume=function(){var t;null===(t=this.player)||void 0===t||t.resume()},e.prototype._doFrozen=function(){var t;return lT(this,void 0,void 0,(function(){var e,i,n,r=this;return hT(this,(function(o){switch(o.label){case 0:return this.logger.info("frozen with player["+!!this.player+"]",this.taskId),this.view&&this.player?[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]:[3,2];case 1:for(i in o.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)n=this.__slideState.mediaState[i],this.__slideState.mediaState[i]=sT(sT({},n),{frozenTime:this.timestamp()});o.label=2;case 2:return[2]}}))}))},e.prototype.frozen=function(){var t=this;this.frozenTaskManager.addTask("frozen",(function(){return t._doFrozen()}))},e.prototype._doRelease=function(){var t,e;return lT(this,void 0,void 0,(function(){var i,n,r,o;return hT(this,(function(s){switch(s.label){case 0:if(this.logger.info("do release slide",this.taskId),this.player)return[2];for(n in this.player=this.initPlayer(this.config),(null===(t=this.config)||void 0===t?void 0:t.controller)&&this.createController(),this.player.view&&(this.canvasContainer.appendChild(this.player.view),this.player.view.style.visibility="hidden"),i=this.__slideState,this.__slideState=Ky()(fT),i.mediaState)"play"===(r=i.mediaState[n]).type&&(o=Math.max(null!==(e=r.frozenTime)&&void 0!==e?e:0,r.time),r.time=this.timestamp()-(o-r.time),r.frozenTime=void 0);return[4,this.setSlideState(i)];case 1:return s.sent(),[4,this.player.clock.delay(333)];case 2:s.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return[2]}}))}))},e.prototype.release=function(){var t=this;this.frozenTaskManager.addTask("release",(function(){return t._doRelease()}))},e.prototype._doDestroy=function(){var t,i,n,r,o=this;this.logger.info("do destroy slide",this.taskId);var s=e.instances.findIndex((function(t){return t.randomId===o.randomId}));s>=0&&e.instances.splice(s,1),this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),null===(t=this.player)||void 0===t||t.removeAllListeners(),null===(i=this.player)||void 0===i||i.destroy(),null===(n=this.player)||void 0===n||n.removeAllListeners(),this.logger={warn:function(){return{}},info:function(){return{}},error:function(){return{}}},this.syncQueue.destroy(),this.renderingTaskManager.destroy(),this.frozenTaskManager.destroy(),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.removeEventListener("message",this.recoverHandler),this.removeAllListeners();try{(null===(r=this.player)||void 0===r?void 0:r.view)&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch(t){}e.volumeAdjuster.off("update",this._updateVolumeByStaticAdjuster)},e.prototype.waitLoadEnd=function(){return lT(this,void 0,void 0,(function(){var t;return hT(this,(function(e){switch(e.label){case 0:t=0,e.label=1;case 1:return this.isLoading&&t<10?[4,cT(100)]:[3,3];case 2:return e.sent(),t+=1,[3,1];case 3:return[2]}}))}))},e.prototype.preload=function(t){return this.player?this.player.preload(t):Promise.resolve()},e.prototype.destroy=function(){var t=this;this.logger.info("pre destroy slide",""),this.isLoading?this.waitLoadEnd().then((function(){t._doDestroy()})):this._doDestroy()},e.prototype.clearSlideCache=function(){var t;null===(t=this.player)||void 0===t||t.clearLocalCache()},e.prototype.hasNextStep=function(){if(!this.player)return!1;var t=this.player.currentIndex===this.slideCount,e=0===this.mainSeqLength||this.mainSeqStep>=this.mainSeqLength-1,i="end"===this.mainSeqState||"running"===this.mainSeqState||null==this.mainSeqState;return!(t&&e&&i)},e.prototype.hasPrevStep=function(){if(!this.player)return!1;var t=1===this.player.currentIndex,e=0===this.mainSeqLength||0===this.mainSeqStep,i="idle"===this.mainSeqState||null===this.mainSeqState;return!(t&&e&&i)},e.prototype.snapshot=function(){return lT(this,void 0,void 0,(function(){return hT(this,(function(t){return this.player?[2,this.player.getSnapshot()]:[2,null]}))}))},e.prototype.snapshotWithTimingEnd=function(t){return lT(this,void 0,void 0,(function(){return hT(this,(function(e){return this.player?[2,this.player.snapshotWithTimingEnd(t)]:[2,null]}))}))},e.prototype.updateGlobalVolume=function(t){this.volumeAdjuster.volume=t},e.prototype.getGlobalVolume=function(){return this.volumeAdjuster.volume},e.clearLocalCache=function(){zy.clearLocalCache()},e.disposeLocalCache=function(){},i=e,e.preloadResource=rT,e.instances=[],e._tempFrozenIds=[],e._tempLog="",e._tempLogIndex=1,e.remoteLogAddress=null,e.usePlugin=function(t){t.context({logger:{info:function(t){e.appendLogString("INFO - "+(new Date).toISOString()+" - "+t+"\n")},warn:function(t){e.appendLogString("WARN - "+(new Date).toISOString()+" - "+t+"\n")},error:function(t){e.appendLogString("ERROR - "+(new Date).toISOString()+" - "+t+"\n")}}}),function(t){var e=Vy.get(t.hookPoint)||[];e.push(t),Vy.set(t.hookPoint,e)}(t)},e.volumeAdjuster=new ky,e.trackLogger=new eT,e.handleFrozenAllSlide=function(){e.instances.forEach((function(t){t.player&&(e._tempFrozenIds.push(t.randomId),t.frozen())}))},e.handleReleaseAllSlide=function(){e._tempFrozenIds.forEach((function(t){var i=e.instances.find((function(e){return e.randomId===t}));i&&i.release()})),e._tempFrozenIds=[]},e.handleLogReport=function(t){return lT(void 0,void 0,void 0,(function(){var n,r,o,s,a,l;return hT(i,(function(i){switch(i.label){case 0:return[4,e.flushLog(!0)];case 1:if(i.sent(),!gT)return[3,12];n=[],i.label=2;case 2:return i.trys.push([2,4,,5]),[4,gT.keys()];case 3:return n=(i.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),[3,5];case 4:return i.sent(),[3,5];case 5:if(0===n.length)return window.postMessage({type:"@slide/_report_log_",log:"",index:1,total:1,customMessage:"@slide/_report_log_",sessionId:t},"*"),[2];r=0,o=n,i.label=6;case 6:if(!(r<o.length))return[3,12];s=o[r],a=s.replace("run_time_log_",""),l="",i.label=7;case 7:return i.trys.push([7,9,,10]),[4,gT.getItem(s)];case 8:return l=i.sent()||"",[3,10];case 9:return i.sent(),[3,10];case 10:window.postMessage({type:"@slide/_report_log_",log:l,index:parseInt(a,10),total:n.length,customMessage:"@slide/_report_log_",sessionId:t},"*"),i.label=11;case 11:return r++,[3,6];case 12:return[2]}}))}))},e.handleLogDownload=function(){return lT(void 0,void 0,void 0,(function(){var t,n,r,o,s,a,l;return hT(i,(function(i){switch(i.label){case 0:return i.trys.push([0,7,,8]),[4,e.flushLog(!0)];case 1:return i.sent(),t="",gT?[4,gT.keys()]:[3,6];case 2:n=(i.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),r=0,o=n,i.label=3;case 3:return r<o.length?(s=o[r],a=t,[4,gT.getItem(s)]):[3,6];case 4:t=a+(i.sent()||""),i.label=5;case 5:return r++,[3,3];case 6:return(l=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),l.setAttribute("download","slide_log"),l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l),[3,8];case 7:return i.sent(),[3,8];case 8:return[2]}}))}))},aT([(n="Slide.initConfig",function(t,e,i){var r=i.value;i.value=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=Vy.get(n)||[],o=t,s=0,a=i;s<a.length;s++){var l=a[s];try{o=l.before(o)}catch(t){}if(!Array.isArray(o)||o.length!==t.length)throw new Error("plugin before hook return invalid args")}for(var h=r.bind(this).apply(void 0,o),u=0,c=i.reverse();u<c.length;u++){l=c[u];try{h=l.after(h)}catch(t){}if(!h)throw new Error("plugin after hook return undefined result")}return h}})],e.prototype,"initSlideConfig",null),e}(Za.a);null==gT||gT.clear().catch((function(){})),window.addEventListener("__slide_log__",vT.handleLogDownload),window.addEventListener("message",(function(t){if("@slide/_request_log_"===t.data.type)vT.handleLogReport(t.data.sessionId).catch((function(){}));else if("@slide/_request_frozen_"===t.data.type)vT.handleFrozenAllSlide();else if("@slide/_request_release_"===t.data.type)vT.handleReleaseAllSlide();else if("@slide/_update_volume_"===t.data.type){var e=.5;try{e=parseFloat(t.data.volume.toString())}catch(t){}vT.volumeAdjuster.volume=e}else"@slide/_get_volume_"===t.data.type?window.postMessage({type:"@slide/_report_volume_",volume:vT.volumeAdjuster.volume,customMessage:"@slide/_report_volume_"},"*"):"@slide/_preload_slide_"===t.data.type&&vT.preloadResource(t.data.taskId,t.data.prefix,(function(e){window.postMessage({type:"@slide/_preload_slide_progress_",taskId:t.data.taskId,progress:e},"*")})).catch((function(e){window.postMessage({type:"@slide/_preload_slide_error_",taskId:t.data.taskId,error:e},"*")}))})),window.setInterval((function(){vT.flushLog().catch((function(){}))}),2e3)}]);
343
+ om.a.registerPlugin("accessibility",Nh),om.a.registerPlugin("extract",pm),om.a.registerPlugin("graphics",lm),om.a.registerPlugin("interaction",zh),om.a.registerPlugin("mesh",sm.a),om.a.registerPlugin("prepare",vm),om.a.registerPlugin("sprite",cm);class bm extends Za.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(t=>{const e=t-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(1e3*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=t,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}!function(t){t.ResourceError="RESOURCE_ERROR",t.RuntimeError="RUNTIME_ERROR",t.RuntimeWarn="RUNTIME_WARN",t.CanvasCrash="CANVAS_CRASH"}(gm||(gm={}));class Tm extends Error{constructor(t,e){var i,n;super(e),i=this,n=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(i,n):i.__proto__&&(i.__proto__=n),this.errorType=t,this.errorMsg=e}static transform(t){return t instanceof Tm?t:new Tm(gm.RuntimeError,t.message)}}function Em(){return function(t,e,i){const n=i.value;i.value=function(...t){try{return n.apply(this,t)}catch(t){throw new Tm(gm.RuntimeWarn,t.message)}}}}var Sm=i(48),wm=i.n(Sm),Am=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function Mm(){return r()}const Cm="__delay_resolve_result__";function Rm(t){return new Promise(e=>{setTimeout(()=>{e(Cm)},t)})}function Im(t,e){return Am(this,void 0,void 0,(function*(){const i=yield Promise.race([t(),Rm(e)]);return i===Cm?Cm:i}))}function Pm(t,e){return Am(this,void 0,void 0,(function*(){const i=Date.now();for(;!t()&&Date.now()-i<e;)yield Rm(16)}))}var Om=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function Nm(t,e){return Om(this,void 0,void 0,(function*(){const i=yield Im(()=>fetch(t),e);if(i===Cm)throw new Tm(gm.ResourceError,`"${t}" loaded timeout"`);if(!i.ok)throw new Tm(gm.ResourceError,`"${t}" loaded failed with status "${i.status}"`);return i}))}class Lm{constructor(t,e,i,n,r,o){this.timeout=15e3,this.useCache=!1,this.taskId="",this.delegate=null,this.urlInterrupter=null,this.useCache=e,this.localStorage=t,this.logger=i,this.timeout=n,this.delegate=r||null,this.urlInterrupter=o||null}attachTaskId(t){this.taskId=t}fetchJson(t){return Om(this,void 0,void 0,(function*(){let e=t;const i=t;if(this.urlInterrupter&&"function"==typeof this.urlInterrupter){const t=Date.now();e=yield this.urlInterrupter(e),this.logger.info("use url interrupter, time: "+(Date.now()-t),this.taskId)}let n;if(this.useCache&&(this.logger.info("load resource from cache. "+i,this.taskId||""),n=yield this.localStorage.getItem(i)),n)return this.logger.info("cache hit. "+i,this.taskId||""),n;{let t;if(this.delegate){this.logger.info("load resource by delegate. "+i,this.taskId||"");const n=Date.now(),r=yield Im(()=>this.delegate.loadJson(e),this.timeout);if(this.logger.info(`load resource by delegate end. ${i}, time: ${Date.now()-n}`,this.taskId||""),r===Cm)throw new Tm(gm.ResourceError,`"${i}" loaded timeout"`);t=JSON.parse(r)}else{this.logger.info("load resource from server. "+i,this.taskId||"");const n=Date.now();t=yield(yield Nm(""+e,this.timeout)).json(),this.logger.info(`load resource from server end. ${i}, time: ${Date.now()-n}`,this.taskId||"")}return this.logger.info("load end. "+i,this.taskId||""),this.useCache&&this.localStorage.setItem(i,t).catch(()=>{}),t}}))}fetchPng(t,e){return Om(this,void 0,void 0,(function*(){let i=t;const n=t;if(this.urlInterrupter&&"function"==typeof this.urlInterrupter){const t=Date.now();i=yield this.urlInterrupter(i),this.logger.info("use url interrupter, time: "+(Date.now()-t),this.taskId)}let r;const o=n+"-v2";if(this.useCache&&(this.logger.info("load resource from cache. "+n,this.taskId||""),r=yield this.localStorage.getItem(o)),r){const{scale:t,scaledBase64:e}=r;this.logger.info("cache hit. "+n,this.taskId||"");return{baseTexture:new Vh.c(e,{resolution:1}),scale:t}}{let t;if(this.delegate){this.logger.info("load resource by delegate. "+n,this.taskId||"");const e=Date.now();if(t=yield Im(()=>this.delegate.loadImage(i),this.timeout),this.logger.info(`load resource by delegate end. ${n}, time: ${Date.now()-e}`,this.taskId||""),t===Cm)throw new Tm(gm.ResourceError,`"${n}" loaded timeout"`)}else{this.logger.info("load resource from server. "+n,this.taskId||"");const e=Date.now(),r=yield Nm(i,this.timeout);this.logger.info(`load resource from server end. ${n}, time: ${Date.now()-e}`,this.taskId||""),t=yield r.blob()}r=yield function(t){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=()=>{i(new Tm(gm.ResourceError,"Failed parse blob data."))},n.readAsDataURL(t)})}(t);const s=document.createElement("img");s.src=r,yield new Promise((t,e)=>{s.onload=()=>t(""),s.onerror=()=>e(new Error("load sprite image failed"))});let a=e;const l=s.width||1,h=s.height||1,u=2048,c=2048;if(l>u||h>c){a*=u/l;const t=a*h;t>c&&(a*=h/t)}const d=document.createElement("canvas"),p=Math.ceil(s.width*a),f=Math.ceil(s.height*a);d.width=p,d.height=f;d.getContext("2d").drawImage(s,0,0,p,f);const m=d.toDataURL("image/png"),g=new Vh.c(m,{resolution:1});return this.logger.info("load end. "+n,this.taskId||""),this.useCache&&this.localStorage.setItem(o,{scale:a,scaledBase64:m}).catch(()=>{}),{baseTexture:g,scale:a}}}))}destroy(){}}var Dm=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Fm{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(xd.b.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);let{length:t}=this.callbackList;for(let e=0;e<t;e++){const i=this.callbackList[e];if(i&&!i.applied){if(!(i.triggerTime<=this.timestamp))break;i.running=!0,i.fn(),i.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const i=Mm(),n=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:n,id:i,applied:!1,running:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),i}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&!this.callbackList[e].running&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return Dm(this,void 0,void 0,(function*(){const i=this.timestamp;for(;!t()&&this.timestamp-i<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var Bm=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function Um(t,e,i){return i?Math.floor(parseFloat(t)*e):Math.ceil(parseFloat(t)*e)}const km={w:!1,h:!1,x:!0,y:!0};class Gm{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.loader=t}getTexture(t){return this.textures[t]||null}getFrameData(t){return this.frames[t]}getGifFrames(t){return this.gifs[t]?this.gifs[t].filter(t=>!!t):[]}loadSpriteSheetItem(t,e,i,n){return Bm(this,void 0,void 0,(function*(){const r=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${i}.json`),{baseTexture:o,scale:s}=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${i}.png`,n);!function(t,e){t.meta&&t.meta.size&&["w","h"].forEach(i=>{t.meta.size[i]=Um(t.meta.size[i],e,km[i])}),t.frames&&Object.keys(t.frames).forEach(i=>{t.frames[i].frame&&["x","y","w","h"].forEach(n=>{t.frames[i].frame[n]=Um(t.frames[i].frame[n],e,km[n])}),t.frames[i].spriteSourceSize&&["x","y","w","h"].forEach(n=>{t.frames[i].spriteSourceSize[n]=Um(t.frames[i].spriteSourceSize[n],e,km[n])}),t.frames[i].sourceSize&&["w","h"].forEach(n=>{t.frames[i].sourceSize[n]=Um(t.frames[i].sourceSize[n],e,km[n])})})}(r,s);const a=new Ap(o,r);yield new Promise(t=>{a.parse(()=>t(""))}),this.spriteSheets.push(a),Object.keys(a.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const i=e[1];this.gifs[i]||(this.gifs[i]=[]);const n=parseInt(e[2],10);this.gifs[i][n]=a.textures[t]}else this.frames[t]=r.frames[t],this.textures[t]=a.textures[t]})}))}destroy(){this.spriteSheets.forEach(t=>t.destroy(!0)),this.spriteSheets=[],this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null)}}var Hm=i(18),jm=i.n(Hm),zm=i(13),Vm=i.n(zm);function Xm(t,e,i){let n,r;const o=Math.round(t)%360;if(o%180==0)n=Math.cos(o*(Math.PI/180))*e,r=0;else if(o%90==0)n=0,r=Math.sin(o*(Math.PI/180))*i;else{const t=function(t){const e=t*Math.PI/180;return Math.tan(e)}(o);n=e*i/Math.sqrt(Math.pow(i,2)+Math.pow(e*t,2)),(o>90&&o<270||o<-90&&o>-270)&&(n=-n),r=t*n}return{x:n,y:r}}function Wm(t,e,i,n,r,o){const s=t,a=e;let l,h,u,c,d;if(0===Math.round(n))l=r,h=o,d=0;else if(Math.round(n)>=360)l=r,h=o,u=r+2*t*Math.abs(Math.cos(-i/180*Math.PI)),c=o+2*e*Math.sin(-i/180*Math.PI),d=1;else{const t=-i,e=-(i+n),{x:u,y:c}=Xm(t,s,a),p=r-u,f=o+c,{x:m,y:g}=Xm(e,s,a);l=m+p,h=f-g,d=n>=-360&&n<-180?1:n>=-180&&n<0||n>0&&n<180?0:1}return{radiusX:s,radiusY:a,xAxisRotation:0,largeArcFlag:d,sweepFlag:n>0?1:0,endX:l,endY:h,middleX:u,middleY:c}}class Ym{constructor(){this.pool=[]}getObject(t){const e=this.pool.find(t=>!t.isUsed);if(e)return e.isUsed=!0,e.obj;{const e={obj:this.createObject(),isUsed:!0,group:t};return this.pool.push(e),e.obj}}collectObject(t){const e=this.pool.find(e=>e.obj===t);e&&(e.isUsed=!1,this.resetObject(e.obj))}collectObjectByGroup(t){this.pool.filter(e=>e.group===t).forEach(t=>this.collectObject(t.obj))}}const qm=new class extends Ym{createObject(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t}resetObject(t){t.removeAttribute("viewBox"),t.removeAttribute("width"),t.removeAttribute("height"),t.innerHTML=""}};const Zm=new class extends Ym{createObject(){return document.createElement("img")}resetObject(t){t.removeAttribute("src")}};var Jm=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Km{constructor(t){this.imgElements=[],this.svgElements=[],this.idToHashMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.hashToIdMap=Object.create(null),this.maxResolution=t}render(t,e,i,n){return Jm(this,void 0,void 0,(function*(){const{items:e,width:r,height:o}=t,s=Zm.getObject(i),a=new Vh.c(s,{width:r*n,height:o*n,resolution:1}),l=qm.getObject(i);this.imgElements.push(s),this.svgElements.push(l),l.setAttribute("viewBox",`0 0 ${r} ${o}`),l.setAttribute("width",""+r),l.setAttribute("height",""+o);const h={};e.forEach(t=>{const{item:e,x:i,y:r}=t,o=i+2,s=r+2;e.pathsData.forEach(t=>{let e="";t.cmds.forEach(([i,n])=>{e+=i+" ",e+=n.map(e=>(Vm()(e)||(e.x=e.x+t.offset.x+o,e.y=e.y+t.offset.y+s),e)).reduce((t,e)=>(Vm()(e)?t+=e+" ":t+=`${e.x} ${e.y} `,t),""),e+=" "}),t.pathElement.setAttribute("d",e),l.appendChild(t.pathElement)});const u=e.width-4-2*e.padding,c=e.height-4-2*e.padding;this.textures[e.hash]={texture:new Vh.t(a,new Lh.j((o+2)*n,(s+2)*n,u*n,c*n)),pivot:e.pivot,scale:1/n},h[e.hash]=this.hashToIdMap[e.hash]});const u=(c='<?xml version="1.0" encoding="utf-8"?>'+l.outerHTML,"data:image/svg+xml,"+encodeURIComponent(c).replace(/'/g,"%27").replace(/"/g,"%22"));var c;const d=document.createElement("img");d.src=u,yield new Promise((t,e)=>{d.onload=()=>t(""),d.onerror=()=>e()});const p=document.createElement("canvas");p.width=d.width*n,p.height=d.height*n;p.getContext("2d").drawImage(d,0,0,p.width,p.height),s.src=p.toDataURL("image/png"),yield new Promise((t,e)=>{s.onload=()=>t(""),s.onerror=()=>e()})}))}getGraphicsData(t){const e=this.idToHashMap[t]||"";return this.textures[e]||null}addGraphics(t,e,i,n,r,o,s,a,l,h,u){var c,d;if(!s&&!l)return t;const p=jm()(i+(null!==(d=null===(c=null==s?void 0:s.width)||void 0===c?void 0:c.toString())&&void 0!==d?d:0)+l+h+u);if(this.hashToIdMap[p]||(this.hashToIdMap[p]=[]),this.hashToIdMap[p].push(t),this.idToHashMap[t]=p,this.graphics.findIndex(t=>t.hash===p)<0){const{graphicsWidth:t,graphicsHeight:i,pathsData:a,pivot:c,padding:d}=function(t,e,i,n,r,o,s,a,l){var h;const u=[],c={x:Math.abs(r.x),y:Math.abs(r.y)};let d=0,p=0,f=0,m=0,g=0,v="none";const _=null!==(h=null==n?void 0:n.width)&&void 0!==h?h:0;return s?(d=e,p=i,g=0):(v=l||"#ff0000",g=_,f=.5*_,m=.5*_,d=e+_,p=i+_,c.x+=.5*_,c.y+=.5*_),d+=Math.abs(r.x),p+=Math.abs(r.y),f+=Math.abs(r.x),m+=Math.abs(r.y),d+=4,p+=4,f+=2,m+=2,d=Math.ceil(d),p=Math.ceil(p),t.forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","path");"none"!==t.fill&&s?e.setAttribute("fill",a||"#ff0000"):e.setAttribute("fill","none"),t.hasStroke&&!s&&(e.setAttribute("stroke-linecap",(null==n?void 0:n.cap)||"butt"),e.setAttribute("stroke-linejoin",(null==n?void 0:n.join)||"miter"),e.setAttribute("stroke-width",g.toString()),e.setAttribute("stroke",v),(null==n?void 0:n.dash)&&e.setAttribute("stroke-dasharray",n.dash));const{scale:i}=t,r=t.path.trim().split(" ");let o={x:0,y:0};const l={offset:{x:f,y:m},cmds:[],pathElement:e};for(let t=0;t<r.length;t+=2){const e=r[t],n=r[t+1];if("M"===e){let[t,e]=n.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*i.x,e=e/9525*i.y,l.cmds.push(["M",[{x:t,y:e}]])}else if("A"===e){const[t,e,r,s]=n.split(",").map(t=>Number(t)),a=r/Math.PI*180,h=s/Math.PI*180,u=Wm(t,e,a,h,o.x,o.y);Math.round(h)>=360?(o={x:u.endX,y:u.endY},l.cmds.push(["A",[u.radiusX/9525*i.x,u.radiusY/9525*i.y,u.xAxisRotation,u.largeArcFlag,u.sweepFlag,{x:u.middleX/9525*i.x,y:u.middleY/9525*i.y}]]),l.cmds.push(["A",[u.radiusX/9525*i.x,u.radiusY/9525*i.y,u.xAxisRotation,u.largeArcFlag,u.sweepFlag,{x:u.endX/9525*i.x,y:u.endY/9525*i.y}]])):(o={x:u.endX,y:u.endY},l.cmds.push(["A",[u.radiusX/9525*i.x,u.radiusY/9525*i.y,u.xAxisRotation,u.largeArcFlag,u.sweepFlag,{x:u.endX/9525*i.x,y:u.endY/9525*i.y}]]))}else if("L"===e){let[t,e]=n.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*i.x,e=e/9525*i.y,l.cmds.push(["L",[{x:t,y:e}]])}else if("QB"===e){let[t,e,r,s]=n.split(",").map(t=>Number(t));o={x:r,y:s},t=t/9525*i.x,e=e/9525*i.y,r=r/9525*i.x,s=s/9525*i.y,l.cmds.push(["Q",[{x:t,y:e},{x:r,y:s}]])}else if("CB"===e){let[t,e,r,s,a,h]=n.split(",").map(t=>Number(t));o={x:a,y:h},t=t/9525*i.x,e=e/9525*i.y,r=r/9525*i.x,s=s/9525*i.y,a=a/9525*i.x,h=h/9525*i.y,l.cmds.push(["C",[{x:t,y:e},{x:r,y:s},{x:a,y:h}]])}else"C"===e&&l.cmds.push(["Z",[]])}u.push(l)}),{graphicsWidth:d,graphicsHeight:p,pivot:c,padding:2,pathsData:u}}(e,r,o,s,n,0,l,h,u);this.graphics.push({hash:p,pathsData:a,pivot:c,width:t,height:i,padding:d})}return t}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});return function t(e){const i=[],n=e.filter(t=>{const e=t.width<2048&&t.height<2048;return e||i.push(t),e}).sort((t,e)=>t.width*t.height-e.width*e.height);let r=n.length+1,o=2050,s=2050;const a=[];let l=null;for(;(o>2048||s>2048)&&n.length>0;)r-=1,l=wm()(n.slice(0,r)),o=l.width,s=l.height;return l&&a.push(l),i.forEach(t=>{const e=wm()([t]);a.push(e)}),r<n.length?a.concat(t(n.slice(r))):a}(this.graphics)}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy(!0)}),this.textures=Object.create(null),this.imgElements.forEach(t=>Zm.collectObject(t)),this.svgElements.forEach(t=>qm.collectObject(t)),this.graphics=[]}}class Qm{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,i){const n=`${e}_${t}`;if(this.runningTimeNodes[n])try{this.runningTimeNodes[n].dispose(!0)}catch(t){}this.runningTimeNodes[n]=i}removeRunningTimeNode(t,e){const i=`${e}_${t}`;delete this.runningTimeNodes[i]}}class $m{constructor(t){this.eventHub=t,this.targets=Object.create(null)}getTargets(){return Object.keys(this.targets).map(t=>this.targets[t])}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,i={type:"el",index:0,id:""}){var n,r;let o=this.targets[t.id];return"shape"!==t.type?o:("shape"===t.type&&t.txEl&&(o=null!==(n=null==o?void 0:o.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==n?n:null),"shape"===t.type&&t.bg&&0===i.index&&(e=!1,o=null!==(r=null==o?void 0:o.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",i.id)),e&&o?o.getIterateEntry(i.type,i.index,i.id):(o||this.eventHub.emit("IterateTimeNodeEnd",i.id),o))}clearTargets(){this.targets=Object.create(null)}}class tg{constructor(t){this.target=t}get color(){return this.target.strokeColorFilter.currentColor}set color(t){this.target.strokeColorFilter.color=t}get on(){return this.target.strokeActive?"true":"false"}set on(t){this.target.strokeActive="true"===t}}class eg{constructor(t){this.applyCommand=(t,e)=>{this.target.applyCommand(t,e)},this.target=t}}class ig{constructor(t){this.target=t}get color(){return this.target.pptColorFilter.currentColor}set color(t){this.target.pptColorActive&&(this.target.pptColorFilter.color=t)}get on(){return this.target.pptColorActive?"true":"false"}set on(t){this.target.pptColorActive="true"===t}get designColor(){return this.target.pptColorFilter.designColor}toString(){return this.color}}class ng{constructor(t){this.target=t}get color(){return this.target.fillColorFilter.currentColor}set color(t){this.target.fillActive&&(this.target.fillColorFilter.color=t)}get on(){return this.target.fillActive?"true":"false"}set on(t){this.target.fillActive="true"===t}get designColor(){return this.target.fillColorFilter.designColor}}class rg{constructor(t,e,i){this.hardHidden=!1,this.designRotation=0,this.target=t,!0===e&&(this.hardHidden=!0),this.designRotation=i}get opacity(){return this.target.alpha}set opacity(t){this.target.alpha=t}get rotation(){return this.target.rotation/Math.PI*180}set rotation(t){this.target.rotation=t/180*Math.PI+this.designRotation}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class og{constructor(t,e){this.actions=[],this.ctx=e,this.object=t,this.object.interactive=!0}reset(t){this.object.interactive=!1,this.object.removeAllListeners(),this.object=t,this.object.interactive=!0}addAction(t,e){this.actions.push([t,e]),"click"===e?(this.object.addListener("pointertap",()=>this.handleAction(t)),this.object.cursor="pointer"):"hover"===e&&this.object.addListener("mouseover",()=>this.handleAction(t))}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new Lh.k(0,0,this.object.width,this.object.height)}handleAction(t){this.ctx.eventHub.emit(jy.hyperlinkTrigger,t),this.execAction(t)}execAction(t){var e,i;if(this.ctx.eventHub.emit(jy.userInput),"ppaction://hlinksldjump"===t.action){const i=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);i&&i[1]&&this.ctx.eventHub.emit(jy.requestGotoSlide,Number(i[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit(jy.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit(jy.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit(jy.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit(jy.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit(jy.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action?this.ctx.eventHub.emit(jy.requestGotoSlide,-1):""===t.action&&(null===(i=t.target)||void 0===i?void 0:i.startsWith("http"))&&this.ctx.eventHub.emit(jy.requestOpenUrl,t.target)}}function sg(t,e,i=5){return Math.abs(t-e)<=Math.pow(10,-i)}function ag(t){return Math.floor(1e6*t)/1e6}class lg{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const i=new lg;return i.point=t,i.slope=e,i}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return sg(this.slope,t.slope)?this.distanceToPoint(t.point):-1}distanceToPoint(t){let e=0;if(Math.tan(this.slope)*(t.x-this.point.x)+this.point.y===t.y)return 0;e=this.slope>=Math.PI/2?this.slope-Math.PI/2:Math.PI/2+this.slope;const i=lg.fromPointSlope(t,e),n=this.crossPoint(i);return n?Math.ceil(Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2))):0}crossPoint(t){if(sg(t.slope,this.slope))return null;let e=0,i=0;const n=Math.tan(t.slope),r=Math.tan(this.slope),{x:o,y:s}=this.point,{x:a,y:l}=t.point;return sg(this.slope,Math.PI/2)?(e=this.point.x,i=n*(e-a)+l):sg(t.slope,Math.PI/2)?(e=t.point.x,i=r*(e-o)+s):sg(this.slope,Math.PI)||sg(this.slope,0)?(i=this.point.y,e=(i-l)/n+a):sg(t.slope,Math.PI)||sg(t.slope,0)?(i=t.point.y,e=(i-s)/r+o):(e=(n*a-l+s-r*o)/(n-r),i=r*(e-o)+s),{x:e,y:i}}}class hg{constructor(t,e,i){var n,r,o,s,a,l;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new Lh.j(0,0,1,1),this.pptX=0,this.pptY=0,this.presetSubType=0,this.designWidth=0,this.designHeight=0,this.designX=0,this.designY=0,this.hasPreset=!1,this.container=new Oh.b,this.animationFilterQueue=[],this.ctx=e,this.style=new rg(this.container,!!t.hardHidden,t.rotation||0),this.designGlobalPosition={x:i.parentGlobalPos.x+(null!==(r=null===(n=t.position)||void 0===n?void 0:n.x)&&void 0!==r?r:0),y:i.parentGlobalPos.y+(null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)},(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new og(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(l=this.hyperlink)||void 0===l||l.addAction(t.hlinkClick,"click"))),this.ctx.clock.waitUntil(()=>{try{return!!this.container.width}catch(t){return!1}},3e3).then(()=>{try{this.designWidth=this.designWidth||this.container.width}catch(t){}}),this.ctx.clock.waitUntil(()=>{try{return!!this.container.height}catch(t){return!1}},3e3).then(()=>{try{this.designHeight=this.designHeight||this.container.height}catch(t){}})}updateScale(){this.container&&(this.container.scale.x=this.designScale.x*this.scaleExt.x*this.scaleOrigin.x,this.container.scale.y=this.designScale.y*this.scaleExt.y*this.scaleOrigin.y)}updateTransform(t){var e,i,n,r,o,s,a,l;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(i=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,this.designY=null!==(r=null===(n=t.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0;const h=this.designWidth/2,u=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=h,this.container.pivot.y=u;const c=null!==(s=null===(o=t.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0,d=null!==(l=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==l?l:0;this.container.x=c+h,this.container.y=d+u,t.scale&&(this.designScale={x:t.scale.x,y:t.scale.y},this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y),t.rotation&&(this.container.rotation=t.rotation);const p=new Jd;p.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(p),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=c,this.bound.y=d,this.bound.width=this.designWidth,this.bound.height=this.designHeight}addToAnimationFilterQueue(t){this.animationFilterQueue.push(t)}removeAnimationFilterQueue(t){const e=this.animationFilterQueue.findIndex(e=>e===t);e<0||this.animationFilterQueue.splice(e,1)}getFirstAnimationFilter(){return this.animationFilterQueue.length>0?this.animationFilterQueue[0]:null}get scale(){return this.scaleOrigin}set scale(t){this.scaleOrigin.x=t.x,this.scaleOrigin.y=t.y,this.updateScale()}get design_ppt_w(){return ag(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return ag((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return ag(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return ag(this.designY/this.ctx.stageHeight)}get ppt_w(){return this.scaleExt.x*this.scaleOrigin.x*this.designWidth/this.ctx.stageWidth}set ppt_w(t){this.designWidth&&(this.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale())}get ppt_h(){const t=this.designHeight||this.container.height;return this.scaleExt.y*this.scaleOrigin.y*t/this.ctx.stageHeight}set ppt_h(t){this.designHeight&&(this.scaleExt.y=t*this.ctx.stageHeight/this.designHeight,this.updateScale())}get ppt_x(){return(this.container.position.x-this.container.pivot.x)/this.ctx.stageWidth}set ppt_x(t){this.pptX=t;const e=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=t*this.ctx.stageWidth+this.container.pivot.x*e}get ppt_y(){return(this.container.position.y-this.container.pivot.y)/this.ctx.stageHeight}set ppt_y(t){this.pptY=t;const e=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=t*this.ctx.stageHeight+this.container.pivot.y*e}get r(){return this.container.rotation}set r(t){this.container.rotation=t}set xshear(t){this.container.skew.x=t}get xshear(){return this.container.skew.x}set yshear(t){this.container.skew.y=t}get yshear(){return this.container.skew.y}}var ug=i(112),cg=i.n(ug);class dg{constructor(t){if(this._isInit=!1,this.h=0,this.s=0,this.l=0,this.a=1,t){this._isInit=!0;const e=t.match(/-?[0-9]+/g);e&&(this.h=parseInt(e[0],10),this.s=parseInt(e[1],10)/100,this.l=parseInt(e[2],10)/100)}}isInit(){return this._isInit}by(t,e){e.h=Math.max(Math.min(this.h+t.h,359),0),e.s=Math.max(Math.min(this.s+t.s,1),0),e.l=Math.max(Math.min(this.l+t.l,1),0),e.a=Math.max(Math.min(this.a+t.a,1),0)}fromHexString(t){const[e,i,n,r]=mg(t);let o=0,s=0,a=0;const l=Math.max(e,i,n),h=Math.min(e,i,n),u=l-h;a=(l+h)/2,0===u?o=0:l===e?o=(i-n)/u%6*60:l===i?o=60*((n-e)/u+2):l===n&&(o=60*((e-i)/u+4)),s=0===u?0:u/(1-Math.abs(2*a-1)),this.h=o,this.s=s,this.l=a,this.a=r}interpolationFrom(t,e,i){const n=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,o=t.l+(this.l-t.l)*e,s=t.a+(this.a-t.a)*e;i.h=Math.max(Math.min(n,359),0),i.s=Math.max(Math.min(r,1),0),i.l=Math.max(Math.min(o,1),0),i.a=Math.max(Math.min(s,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:i,l:n}=this;if(e<360&&e>=0&&i<=1&&i>=0&&n<=1&&n>=0){let r,o,s;const a=(1-Math.abs(2*n-1))*i,l=a*(1-Math.abs(e/60%2-1)),h=n-a/2;[r,o,s]=e>=0&&e<60?[a,l,0]:e>=60&&e<120?[l,a,0]:e>=120&&e<180?[0,a,l]:e>=180&&e<240?[0,l,a]:e>=240&&e<300?[l,0,a]:[a,0,l],t=[r+h,o+h,s+h,this.a]}return gg(t)}}class pg{constructor(t){this._isInit=!1,this.r=0,this.g=0,this.b=0,this.a=0,t&&(this._isInit=!0,this.fromHexString(t))}fromHexString(t){const[e,i,n,r]=mg(t);this.r=e,this.g=i,this.b=n,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,i){i.r=t.r+(this.r-t.r)*e,i.g=t.g+(this.g-t.g)*e,i.b=t.b+(this.b-t.b)*e,i.a=t.a+(this.a-t.a)*e}by(t,e){e.r=Math.min(Math.max(this.r+t.r,0),255),e.g=Math.min(Math.max(this.g+t.g,0),255),e.b=Math.min(Math.max(this.b+t.b,0),255),e.a=Math.min(Math.max(this.a+t.a,0),1)}toHexString(){return gg([this.r,this.g,this.b,this.a])}}function fg(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function mg(t){return 0===(t=t.replace(/^#/,"")).substring(6,8).length&&(t+="FF"),[parseInt(t.substring(0,2).padStart(8,"0"),16)/255,parseInt(t.substring(2,4).padStart(8,"0"),16)/255,parseInt(t.substring(4,6).padStart(8,"0"),16)/255,parseInt(t.substring(6,8).padStart(8,"0"),16)/255]}function gg(t){return"#"+Math.round(255*t[0]).toString(16).padStart(2,"0")+Math.round(255*t[1]).toString(16).padStart(2,"0")+Math.round(255*t[2]).toString(16).padStart(2,"0")+Math.round(255*t[3]).toString(16).padStart(2,"0")}function vg(t,e,i){const n=mg(t),r=mg(e),o=Math.round(255*(n[0]+(r[0]-n[0])*i)),s=Math.round(255*(n[1]+(r[1]-n[1])*i)),a=Math.round(255*(n[2]+(r[2]-n[2])*i)),l=Math.round(255*(n[3]+(r[3]-n[3])*i));return"#"+o.toString(16).padStart(2,"0")+s.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")}class _g extends Vh.k{constructor(){super(void 0,"\nvarying vec2 vTextureCoord;\n\nuniform vec4 color;\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n\n if (texColor.a > 0.0) {\n vec4 resultColor = color;\n resultColor = resultColor * texColor.a;\n gl_FragColor = resultColor;\n } else {\n gl_FragColor = texColor;\n }\n}\n",{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF",this.designColor="#FFFFFFFF"}set color(t){this.currentColor=t;const e=mg(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const yg=new rm.ColorMatrixFilter;yg.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const xg=new rm.ColorMatrixFilter;xg.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const bg=new rm.ColorMatrixFilter;bg.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Tg=new rm.ColorMatrixFilter;Tg.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const Eg={darken:yg,darkenLess:xg,lightenLess:Tg,lighten:bg};class Sg extends hg{constructor(t,e,i){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,i),this.fillColorFilter=new _g,this.fill=new ng(this),this.json=t,this.ctx=e,this.parentGlobalPos=i.parentGlobalPos,this.global={x:i.parentGlobalPos.x+t.x,y:i.parentGlobalPos.y+t.y},this.updateTransform({position:{x:t.x,y:t.y},width:t.width,height:t.height})}get fillActive(){var t,e;return(null!==(e=null===(t=this.container.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,i;t?(null!==(i=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==i?i:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}clearOnSlideChange(){}initOnReuse(){}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(t){const e=t*this.ctx.stageWidth-this.global.x,i=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*i}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,i=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*i}get design_ppt_x(){return ag(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return ag(this.global.y/this.ctx.stageHeight)}}class wg{constructor(t,e,i,n,r,o,s,a,l,h,u){this.ctx=t,this.type=e,this.lineWidth=i,this.width=n,this.height=r,this.fillColor=o,this.isHorz=s,this.renderContainer=new Oh.b,this.ghcTextureId=`${a}-text-p${l}-l${h}-u${u}-underLine`}createPaths(){if("ww"===this.type)return null;{let t=`M 0,0 L ${9525*this.width},0`,[e,i]=[this.width,this.lineWidth];return this.isHorz||(t="M 0,0 L 0,"+9525*this.height,[e,i]=[this.lineWidth,this.height]),{paths:[{id:Mm(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:jm()(t)}],width:e,height:i}}}getLineStyle(){const t={width:this.lineWidth};return"dotted"===this.type&&(t.dash=""+this.lineWidth),t}preRender(){const t=this.createPaths();if(t){const{paths:e,width:i,height:n}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ctx.graphicsTexture.addGraphics(this.ghcTextureId,e,r,{x:0,y:0},i,n,this.getLineStyle(),this.ctx.objectPoolGroup,!1,null,this.fillColor)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new ep,this.sprite.texture=t.texture,this.sprite.pivot.x=t.pivot.x,this.sprite.scale.x=t.scale,this.sprite.scale.y=t.scale)}}destroy(){var t;null===(t=this.sprite)||void 0===t||t.destroy({texture:!0})}}const Ag=134217729;function Mg(t,e,i,n,r){let o,s,a,l,h=e[0],u=n[0],c=0,d=0;u>h==u>-h?(o=h,h=e[++c]):(o=u,u=n[++d]);let p=0;if(c<t&&d<i)for(u>h==u>-h?(s=h+o,a=o-(s-h),h=e[++c]):(s=u+o,a=o-(s-u),u=n[++d]),o=s,0!==a&&(r[p++]=a);c<t&&d<i;)u>h==u>-h?(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=e[++c]):(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=n[++d]),o=s,0!==a&&(r[p++]=a);for(;c<t;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=e[++c],o=s,0!==a&&(r[p++]=a);for(;d<i;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=n[++d],o=s,0!==a&&(r[p++]=a);return 0===o&&0!==p||(r[p++]=o),p}function Cg(t,e){let i=e[0];for(let n=1;n<t;n++)i+=e[n];return i}function Rg(t){return new Float64Array(t)}const Ig=Rg(4),Pg=Rg(8),Og=Rg(12),Ng=Rg(16),Lg=Rg(4);function Dg(t,e,i,n,r,o){const s=(e-o)*(i-r),a=(t-r)*(n-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const h=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*h?l:-function(t,e,i,n,r,o,s){let a,l,h,u,c,d,p,f,m,g,v,_,y,x,b,T,E,S;const w=t-r,A=i-r,M=e-o,C=n-o;x=w*C,d=Ag*w,p=d-(d-w),f=w-p,d=Ag*C,m=d-(d-C),g=C-m,b=f*g-(x-p*m-f*m-p*g),T=M*A,d=Ag*M,p=d-(d-M),f=M-p,d=Ag*A,m=d-(d-A),g=A-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,c=b-v,Ig[0]=b-(v+c)+(c-E),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,Ig[1]=y-(v+c)+(c-T),S=_+v,c=S-_,Ig[2]=_-(S-c)+(v-c),Ig[3]=S;let R=Cg(4,Ig),I=22204460492503146e-32*s;if(R>=I||-R>=I)return R;if(c=t-w,a=t-(w+c)+(c-r),c=i-A,h=i-(A+c)+(c-r),c=e-M,l=e-(M+c)+(c-o),c=n-C,u=n-(C+c)+(c-o),0===a&&0===l&&0===h&&0===u)return R;if(I=11093356479670487e-47*s+33306690738754706e-32*Math.abs(R),R+=w*u+C*a-(M*h+A*l),R>=I||-R>=I)return R;x=a*C,d=Ag*a,p=d-(d-a),f=a-p,d=Ag*C,m=d-(d-C),g=C-m,b=f*g-(x-p*m-f*m-p*g),T=l*A,d=Ag*l,p=d-(d-l),f=l-p,d=Ag*A,m=d-(d-A),g=A-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,c=b-v,Lg[0]=b-(v+c)+(c-E),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,Lg[1]=y-(v+c)+(c-T),S=_+v,c=S-_,Lg[2]=_-(S-c)+(v-c),Lg[3]=S;const P=Mg(4,Ig,4,Lg,Pg);x=w*u,d=Ag*w,p=d-(d-w),f=w-p,d=Ag*u,m=d-(d-u),g=u-m,b=f*g-(x-p*m-f*m-p*g),T=M*h,d=Ag*M,p=d-(d-M),f=M-p,d=Ag*h,m=d-(d-h),g=h-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,c=b-v,Lg[0]=b-(v+c)+(c-E),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,Lg[1]=y-(v+c)+(c-T),S=_+v,c=S-_,Lg[2]=_-(S-c)+(v-c),Lg[3]=S;const O=Mg(P,Pg,4,Lg,Og);x=a*u,d=Ag*a,p=d-(d-a),f=a-p,d=Ag*u,m=d-(d-u),g=u-m,b=f*g-(x-p*m-f*m-p*g),T=l*h,d=Ag*l,p=d-(d-l),f=l-p,d=Ag*h,m=d-(d-h),g=h-m,E=f*g-(T-p*m-f*m-p*g),v=b-E,c=b-v,Lg[0]=b-(v+c)+(c-E),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-T,c=y-v,Lg[1]=y-(v+c)+(c-T),S=_+v,c=S-_,Lg[2]=_-(S-c)+(v-c),Lg[3]=S;const N=Mg(O,Og,4,Lg,Ng);return Ng[N-1]}(t,e,i,n,r,o,h)}Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(8),Rg(8),Rg(8),Rg(4),Rg(8),Rg(8),Rg(8),Rg(12);Rg(192),Rg(192);Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(8),Rg(4),Rg(4),Rg(4),Rg(8),Rg(16),Rg(16),Rg(16),Rg(32),Rg(32),Rg(48),Rg(64);Rg(1152),Rg(1152);Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(4),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(24),Rg(1152),Rg(1152),Rg(1152),Rg(1152),Rg(1152),Rg(2304),Rg(2304),Rg(3456),Rg(5760),Rg(8),Rg(8),Rg(8),Rg(16),Rg(24),Rg(48),Rg(48),Rg(96),Rg(192),Rg(384),Rg(384),Rg(384),Rg(768);Rg(96),Rg(96),Rg(96),Rg(1152);const Fg=Math.pow(2,-52),Bg=new Uint32Array(512);class Ug{static from(t,e=Vg,i=Xg){const n=t.length,r=new Float64Array(2*n);for(let o=0;o<n;o++){const n=t[o];r[2*o]=e(n),r[2*o+1]=i(n)}return new Ug(r)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*i),this._halfedges=new Int32Array(3*i),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:i,_hullTri:n,_hullHash:r}=this,o=t.length>>1;let s=1/0,a=1/0,l=-1/0,h=-1/0;for(let e=0;e<o;e++){const i=t[2*e],n=t[2*e+1];i<s&&(s=i),n<a&&(a=n),i>l&&(l=i),n>h&&(h=n),this._ids[e]=e}const u=(s+l)/2,c=(a+h)/2;let d,p,f,m=1/0;for(let e=0;e<o;e++){const i=kg(u,c,t[2*e],t[2*e+1]);i<m&&(d=e,m=i)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<o;e++){if(e===d)continue;const i=kg(g,v,t[2*e],t[2*e+1]);i<m&&i>0&&(p=e,m=i)}let _=t[2*p],y=t[2*p+1],x=1/0;for(let e=0;e<o;e++){if(e===d||e===p)continue;const i=Hg(g,v,_,y,t[2*e],t[2*e+1]);i<x&&(f=e,x=i)}let b=t[2*f],T=t[2*f+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];jg(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let i=0;for(let t=0,n=-1/0;t<o;t++){const r=this._ids[t];this._dists[r]>n&&(e[i++]=r,n=this._dists[r])}return this.hull=e.subarray(0,i),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Dg(g,v,_,y,b,T)<0){const t=p,e=_,i=y;p=f,_=b,y=T,f=t,b=e,T=i}const E=function(t,e,i,n,r,o){const s=i-t,a=n-e,l=r-t,h=o-e,u=s*s+a*a,c=l*l+h*h,d=.5/(s*h-a*l);return{x:t+(h*u-a*c)*d,y:e+(s*c-l*u)*d}}(g,v,_,y,b,T);this._cx=E.x,this._cy=E.y;for(let e=0;e<o;e++)this._dists[e]=kg(t[2*e],t[2*e+1],E.x,E.y);jg(this._ids,this._dists,0,o-1),this._hullStart=d;let S=3;i[d]=e[f]=p,i[p]=e[d]=f,i[f]=e[p]=d,n[d]=0,n[p]=1,n[f]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=p,r[this._hashKey(b,T)]=f,this.trianglesLen=0,this._addTriangle(d,p,f,-1,-1,-1);for(let o,s,a=0;a<this._ids.length;a++){const l=this._ids[a],h=t[2*l],u=t[2*l+1];if(a>0&&Math.abs(h-o)<=Fg&&Math.abs(u-s)<=Fg)continue;if(o=h,s=u,l===d||l===p||l===f)continue;let c=0;for(let t=0,e=this._hashKey(h,u);t<this._hashSize&&(c=r[(e+t)%this._hashSize],-1===c||c===i[c]);t++);c=e[c];let m,g=c;for(;m=i[g],Dg(h,u,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===c){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,l,i[g],-1,-1,n[g]);n[l]=this._legalize(v+2),n[g]=v,S++;let _=i[g];for(;m=i[_],Dg(h,u,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,l,m,n[l],-1,n[_]),n[l]=this._legalize(v+2),i[_]=_,S--,_=m;if(g===c)for(;m=e[g],Dg(h,u,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,l,g,-1,n[g],n[m]),this._legalize(v+2),n[m]=v,i[g]=g,S--,g=m;this._hullStart=e[l]=g,i[g]=e[_]=l,i[l]=_,r[this._hashKey(h,u)]=l,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(S);for(let t=0,e=this._hullStart;t<S;t++)this.hull[t]=e,e=i[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const i=t/(Math.abs(t)+Math.abs(e));return(e>0?3-i:1+i)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:i,coords:n}=this;let r=0,o=0;for(;;){const s=i[t],a=t-t%3;if(o=a+(t+2)%3,-1===s){if(0===r)break;t=Bg[--r];continue}const l=s-s%3,h=a+(t+1)%3,u=l+(s+2)%3,c=e[o],d=e[t],p=e[h],f=e[u];if(Gg(n[2*c],n[2*c+1],n[2*d],n[2*d+1],n[2*p],n[2*p+1],n[2*f],n[2*f+1])){e[t]=f,e[s]=c;const n=i[u];if(-1===n){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,n),this._link(s,i[o]),this._link(o,u);const a=l+(s+1)%3;r<Bg.length&&(Bg[r++]=a)}else{if(0===r)break;t=Bg[--r]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,i,n,r,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=e,this._triangles[s+2]=i,this._link(s,n),this._link(s+1,r),this._link(s+2,o),this.trianglesLen+=3,s}}function kg(t,e,i,n){const r=t-i,o=e-n;return r*r+o*o}function Gg(t,e,i,n,r,o,s,a){const l=t-s,h=e-a,u=i-s,c=n-a,d=r-s,p=o-a,f=u*u+c*c,m=d*d+p*p;return l*(c*m-f*p)-h*(u*m-f*d)+(l*l+h*h)*(u*p-c*d)<0}function Hg(t,e,i,n,r,o){const s=i-t,a=n-e,l=r-t,h=o-e,u=s*s+a*a,c=l*l+h*h,d=.5/(s*h-a*l),p=(h*u-a*c)*d,f=(s*c-l*u)*d;return p*p+f*f}function jg(t,e,i,n){if(n-i<=20)for(let r=i+1;r<=n;r++){const n=t[r],o=e[n];let s=r-1;for(;s>=i&&e[t[s]]>o;)t[s+1]=t[s--];t[s+1]=n}else{let r=i+1,o=n;zg(t,i+n>>1,r),e[t[i]]>e[t[n]]&&zg(t,i,n),e[t[r]]>e[t[n]]&&zg(t,r,n),e[t[i]]>e[t[r]]&&zg(t,i,r);const s=t[r],a=e[s];for(;;){do{r++}while(e[t[r]]<a);do{o--}while(e[t[o]]>a);if(o<r)break;zg(t,r,o)}t[i+1]=t[o],t[o]=s,n-r+1>=o-i?(jg(t,e,r,n),jg(t,e,i,o-1)):(jg(t,e,i,o-1),jg(t,e,r,n))}}function zg(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Vg(t){return t[0]}function Xg(t){return t[1]}function Wg(t,e,i){let n=null;const r=new Oh.b;if(t.stopList.sort((t,e)=>t.pos-e.pos),!t.stopList.find(t=>0===t.pos)){const e=t.stopList[0];t.stopList.unshift({pos:0,color:e.color})}if(!t.stopList.find(t=>1===t.pos)){const e=t.stopList[t.stopList.length-1];t.stopList.push({pos:1,color:e.color})}const o=t=>{const e=[];for(let i=0,n=t.length;i<n-1;i++){const n=t[i],r=t[i+1],o=n.pos+.5*(r.pos-n.pos),s=vg(n.color,r.color,.5),a=2*i;e[a]=n,e[a+1]={color:s,pos:o},e[a+2]=r}return e};if(t.stopList=o(t.stopList),t.stopList=o(t.stopList),n=t.line?Yg(t,e,i):t.path?function(t,e,i){var n,r,o;const s=[],a={x:0,y:0};if("circle"===(null===(n=t.path)||void 0===n?void 0:n.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(o=t.path)||void 0===o?void 0:o.path)){const n=e/2,r=i/2,o=Math.sqrt(n*n+r*r);t.stopList.forEach(t=>{if(0===t.pos)s.push({point:{x:0,y:0},color:t.color});else{const e=o*t.pos,i=new zs;i.absellipse(0,0,e,e,0,2*Math.PI,!1,0),i.getPoints(50).forEach(e=>{s.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=n,a.y=r})}return{points:s,position:a}}(t,e,i):Yg(t,e,i),n){const t=[],o=[],{position:s,points:a}=n,l=Ug.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<l.triangles.length;e+=3)t.push(a[l.triangles[e]].point.x,a[l.triangles[e]].point.y),t.push(a[l.triangles[e+1]].point.x,a[l.triangles[e+1]].point.y),t.push(a[l.triangles[e+2]].point.x,a[l.triangles[e+2]].point.y),o.push(...mg(a[l.triangles[e]].color)),o.push(...mg(a[l.triangles[e+1]].color)),o.push(...mg(a[l.triangles[e+2]].color));const h=new Vh.l;h.addAttribute("aVertexPosition",t,2),h.addAttribute("aColor",o,4);const u=Vh.r.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec4 aColor;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec4 vColor;\n void main() {\n vColor = aColor;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","precision mediump float; \n varying vec4 vColor;\n void main() {\n float alpha = vColor.a;\n vec4 color = vColor;\n color.a = 1.0;\n gl_FragColor = color * alpha;\n }\n "),c=new Jd;c.drawRect(0,0,e+1,i+1),r.mask=c,r.addChild(c);const d=new Dp.a(h,u);d.position.x=s.x,d.position.y=s.y,r.addChild(d)}return r}function Yg(t,e,i){const n=e/2,r=i/2,o=[{x:-n,y:r},{x:-n,y:-r},{x:n,y:r},{x:n,y:-r}],s=[lg.fromPointSlope({x:-n,y:0},Math.PI/2),lg.fromPointSlope({x:0,y:r},0),lg.fromPointSlope({x:n,y:0},Math.PI/2),lg.fromPointSlope({x:0,y:-r},0)],a=[],l=t.stopList.slice(1,t.stopList.length-1).map(o=>{var l,h,u;const c=2*Math.PI;let d=null!==(h=null===(l=t.line)||void 0===l?void 0:l.ang)&&void 0!==h?h:0;for(;d>c;)d-=c;for(;d<0;)d+=c;const p={x:0,y:0};sg(d,Math.PI/2)?(p.x=0,p.y=i/2-o.pos*i):sg(d,0)?(p.x=o.pos*e-e/2,p.y=0):(p.x=o.pos*e-e/2,p.y=i/2-o.pos*i),d>Math.PI/2&&d<=Math.PI&&(p.x*=-1),d>Math.PI&&d<=2*Math.PI&&(p.y*=-1);const f=lg.fromPointSlope(p,Math.PI/2-((null===(u=t.line)||void 0===u?void 0:u.ang)||0)),m=s.map(t=>f.crossPoint(t)).filter(t=>t&&t.x<=n&&t.x>=-n&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:o.color})).sort((t,e)=>e.point.y-t.point.y);a.push(...m);let g=Math.abs(m[1].point.x-m[0].point.x)/10;for(let t=20;t--;){const e=t%2==0?1:-1,i=p.x+e*g,s=f.resolveY(i);i<=n&&i>=-n&&s<=r&&s>=-r&&a.push({point:{x:i,y:s},color:o.color}),g+=g}return f});let h=[],u=[];t:for(let e=0;e<o.length;e++){const i=o[e];for(let e=0;e<l.length-1;e++){const n=l[e],r=l[e+1],o=n.distanceToLinearEquation(r),s=n.distanceToPoint(i),h=r.distanceToPoint(i);if(s<o&&h<o){const n=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],l=vg(n.color,r.color,s/o);a.splice(e+1,0,{point:i,color:l});continue t}}const n=l[0],r=l[l.length-1],s=n.distanceToPoint(i),c=r.distanceToPoint(i);s<=c?h.push({point:i,dis:s}):u.push({point:i,dis:c})}h=h.sort((t,e)=>e.dis-t.dis);const c=h.map((e,i)=>{if(0===i)return{point:e.point,color:t.stopList[0].color};{const i=t.stopList[0].color,n=t.stopList[1].color;return{point:e.point,color:vg(i,n,1-(0===h[0].dis?1:e.dis/h[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);u=u.sort((t,e)=>e.dis-t.dis);const d=u.map((e,i)=>{if(0===i)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const i=t.stopList[t.stopList.length-2].color,n=t.stopList[t.stopList.length-1].color;return{point:e.point,color:vg(i,n,0===u[0].dis?0:e.dis/u[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),p=c.concat(...a).concat(d);for(let t=0;t<p.length;t++)p[t].point.x+=n,p[t].point.y=-p[t].point.y+r;return{points:p,position:{x:0,y:0}}}const qg="\nvec3 rgb2hsl(vec3 rgb) {\n float cMax = max(max(rgb.r, rgb.g), rgb.b);\n float cMin = min(min(rgb.r, rgb.g), rgb.b);\n float delta = cMax - cMin;\n \n float h = 0.0;\n if (delta == 0.0) {\n h = 0.0;\n } else if (cMax == rgb.r) {\n h = 60.0 * mod(((rgb.g - rgb.b) / delta), 6.0);\n } else if (cMax == rgb.g ) {\n h = 60.0 * ((rgb.b - rgb.r) / delta + 2.0);\n } else if (cMax == rgb.b) {\n h = 60.0 * ((rgb.r - rgb.g) / delta + 4.0);\n }\n \n float l = (cMax + cMin) / 2.0;\n \n float s = 0.0;\n if (delta == 0.0) {\n s = 0.0;\n } else {\n s = delta / (1.0 - abs(2.0 * l - 1.0));\n }\n \n return vec3(h, s, l);\n}\n",Zg=[qg],Jg={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n mat3 rgb2yuv = mat3(\n 0.2126, 0.7152, 0.0722,\n -0.09991, -0.33609, 0.43600,\n 0.615, -0.5586, -0.05639\n );\n vec3 yuv = texColor.rgb * rgb2yuv;\n if (yuv.x >= 0.49 || texColor.a < 0.9) {\n return vec4(1.0, 1.0, 1.0, 1.0) * texColor.a;\n } else {\n return vec4(0.0, 0.0, 0.0, 1.0) * texColor.a;\n }\n}\n",alphaModFix:"\nvec4 transform(vec4 texColor, float arg) {\n return texColor * arg;\n}\n",alphaBiLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a < arg) {\n result.a = 0.0;\n } else {\n result.a = 1.0;\n }\n return result;\n}\n",alphaCeiling:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a > 0.0) {\n result.a = 1.0;\n }\n return result;\n}\n",alphaFloor:"\nvec4 transform(vec4 texColor, float arg) {\n vec4 result = vec4(texColor);\n result.rgb = result.rgb / texColor.a;\n if (texColor.a < 1.0) {\n result.a = 0.0;\n }\n return result;\n}\n",grayscl:"\nvec4 transform(vec4 texColor, float arg) {\n float avg = (texColor.r + texColor.g + texColor.b) / 3.0;\n return vec4(avg, avg, avg, texColor.a);\n}\n"};class Kg extends Vh.k{constructor(t,e){var i;super(void 0,(i=Jg[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${Zg.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const Qg=[qg],$g={clrChange:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float epsilon = 0.001;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= arg2.a;\n return arg2;\n } else {\n return texColor;\n }\n}\n",changeBulletColor:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n if (texColor.a == 0.0) {\n return texColor;\n } else {\n return arg2;\n }\n}\n",duotone:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float avg = (texColor.r + texColor.g + texColor.b) / 3.0;\n\n vec3 hsl = rgb2hsl(vec3(avg, avg, avg));\n\n vec3 result = arg2.rgb * hsl.z + arg1.rgb * (1.0 - hsl.z);\n\n return vec4(result * texColor.a, texColor.a);\n}\n"};class tv extends Vh.k{constructor(t,e,i){var n;super(void 0,(n=$g[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${Qg.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(i)})}}const ev=[qg],iv={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n vec3 rgb = texColor.rgb / texColor.a;\n\n // 对比度\n highp float C = arg2 * 255.0;\n highp float F = (259.0 * (255.0 + C)) / (255.0 * (259.0 - C));\n rgb.rgb = F * (rgb.rgb - 0.5) + 0.5;\n\n // 亮度\n rgb.rgb += arg1;\n\n rgb.rgb *= texColor.a;\n return vec4(rgb, texColor.a);\n}\n"};class nv extends Vh.k{constructor(t,e,i){var n;super(void 0,(n=iv[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${ev.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:e,arg2:i})}}const rv=[qg],ov={alphaInv:"\nvec4 transform(vec4 texColor, vec4 arg1) {\n float alpha = 1.0 - texColor.a;\n arg1.rgb = arg1.rgb * alpha;\n arg1.a = alpha;\n return arg1;\n}\n"};class sv extends Vh.k{constructor(t,e){var i;super(void 0,(i=ov[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform sampler2D uSampler;\n\n${rv.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1);\n}\n`),{arg1:Float32Array.from(e)})}}class av{constructor(t,e,i,n,r){this.ctx=t,this.fillStyle=e,this.width=i,this.height=n,this.config=r,this.clonedObjects=[],this._displayObject=null,this.gradientHash=jm()(`${JSON.stringify(e)}${Math.ceil(i)}${Math.ceil(n)}`)}get displayObject(){return this._displayObject||(this._displayObject=this.createDisplayObject()),this._displayObject}set displayObject(t){this._displayObject&&this._displayObject.destroy({children:!0,texture:!0}),this._displayObject=t}get hasFill(){return!!this.fillStyle&&"noFill"!==this.fillStyle.fillType}createDisplayObject(){var t;if(!this.fillStyle)return null;if(this.config.useSlideBackgroundFill&&this.ctx.bgTexture){const t=new ep;return t.texture=this.ctx.bgTexture,t}if("solidFill"===this.fillStyle.fillType||"noFill"===this.fillStyle.fillType)return null;if("gradientFill"===this.fillStyle.fillType){const t=new ep,e=Wg(JSON.parse(JSON.stringify(this.fillStyle)),this.width,this.height),i=Vh.p.create({width:this.width,height:this.height,resolution:this.ctx.renderer.resolution});return this.ctx.renderer.render(e,{renderTexture:i}),e.destroy({children:!0,texture:!0}),t.texture=i,t}if("blipFill"===this.fillStyle.fillType){const{src:e,filters:i}=this.fillStyle,n=this.ctx.spriteTexture.getTexture(e),r=this.ctx.spriteTexture.getFrameData(e);if(n){const e=new ep;if(e.texture=n,i.length>0&&this.config.useFilter&&(this.ctx.featureList||{}).filter&&(e.filters=function(t,e){const i=[];return t.forEach(t=>{const n=((null==e?void 0:e.filter)||[]).indexOf(t.type)>=0;if(["biLevel","alphaBiLevel","alphaCeiling","alphaModFix","alphaFloor","grayscl"].indexOf(t.type)>=0&&n)i.push(new Kg(t.type,t.args[0]||0));else if(["clrChange","changeBulletColor","duotone"].indexOf(t.type)>=0&&n){const e=mg(t.args[0]),n=mg(t.args[1]);i.push(new tv(t.type,e,n))}else if("lum"===t.type&&n)i.push(new nv(t.type,t.args[0],t.args[1]));else if("alphaInv"===t.type&&n){const e=mg(t.args[0]);i.push(new sv(t.type,e))}}),i}(i,this.ctx.featureList)),this.config.fillFloat){const{l:i,t:n,r:r,b:o}=this.config.fillFloat.fillRect,s=this.width*(1-i-r),a=this.height*(1-n-o),l=null!==(t=this.config.shapeRotation)&&void 0!==t?t:0,h=new Jd;h.drawRect(0,0,s,a),h.pivot.x=s/2,h.pivot.y=a/2,h.rotation=l;const u=h.getBounds(),c=u.width,d=u.height;e.width=c,e.height=d,e.anchor.x=.5,e.anchor.y=.5,e.rotation=-1*l,e.name="math-texture",0===l?(e.position.x=c/2+i*this.width,e.position.y=d/2+n*this.height):(e.position.x=this.width/2,e.position.y=this.height/2)}else e.width=this.width,e.height=this.height,r.rotate&&(e.position.x=this.width/2,e.position.y=this.height/2,e.anchor.x=.5,e.anchor.y=.5,e.rotation=r.rotate/180*Math.PI);return e}}else if("gifFill"===this.fillStyle.fillType){const{src:t,delays:e}=this.fillStyle,i=this.ctx.spriteTexture.getGifFrames(t).map((t,i)=>({texture:t,time:e[i]||20})),n=new im(i,!0);n.name=Mm(),n.width=this.width,n.height=this.height;const r=this.fillStyle.loop;let o=1;return n.onLoop=()=>{o+=1,r>0&&o>r&&n.gotoAndStop(n.totalFrames)},n}return null}isSolidFill(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)}getSolidFillColor(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)?this.fillStyle.color:"#000000"}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}class lv extends Vh.k{}var hv=i(113),uv=i.n(hv),cv=i(114),dv=i.n(cv);class pv extends lv{constructor(t){super(uv.a,dv.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uGlowColor:mg(t.color),uSdfSampler:Vh.t.WHITE,uSdfReady:0,uSdfMaxDis:0,uRad:t.rad/2,uSdfPosition:new Float32Array([0,0])}),this.priority=3,this.json=t}filterAreaJustify(t){const e=Math.ceil(this.json.rad),i=Math.ceil(t.width+2*e),n=Math.ceil(t.height+2*e);return new Lh.j(t.x-e,t.y-e,i,n)}sdfBox(t,e){const i=Math.ceil(this.json.rad),n=Math.ceil(t+2*i),r=Math.ceil(e+2*i);return new Lh.j(i,i,n,r)}}var fv=i(19),mv=i.n(fv),gv=i(115),vv=i.n(gv);class _v extends lv{constructor(t){super(mv.a,vv.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uRad:t.rad,uSdfSampler:Vh.t.WHITE,uSdfReady:0,uSdfMaxDis:1}),this.priority=2,this.json=t}filterAreaJustify(t){return t}sdfBox(t,e){return new Lh.j(0,0,t,e)}}class yv{}var xv=i(116),bv=i.n(xv);class Tv extends Vh.k{constructor(t){super(mv.a,bv.a,{uColor:mg(t)})}}class Ev extends yv{constructor(t,e,i){super(),this.order=1,this.outputTexture=Vh.t.WHITE,this.frameTextures=[],this.json=t,this.effectContainer=e,this.outputSprite=new ep,this.targetScale=i,this.outputSprite.scale.x=this.json.sx,this.outputSprite.scale.y=this.json.sy,this.outputSprite.skew.x=(this.targetScale.x>0?1:-1)*this.json.kx,this.outputSprite.skew.y=(this.targetScale.y>0?1:-1)*this.json.ky,this.outputSprite.filters=[new rm.BlurFilter(this.json.blurRad/2,4),new Tv(this.json.color)]}updateFrame(t){const e=this.frameTextures[t];if(e){const t=this.effectContainer.getBounds(),i=(this.effectContainer.width-e.width)/2,n=(this.effectContainer.height-e.height)/2,r=new Lh.g(t.x,t.y),o=new Lh.g(t.x,t.y);switch(this.json.align){case"tl":o.x=t.x,o.y=t.y;break;case"t":o.x=t.x+t.width/2,o.y=t.y,r.x+=t.width/2;break;case"tr":o.x=t.x+t.width,o.y=t.y,r.x+=t.width;break;case"l":o.x=t.x,o.y=t.y+t.height/2,r.y+=t.height/2;break;case"ctr":o.x=t.x+t.width/2,o.y=t.y+t.height/2,r.x+=t.width/2,r.y+=t.height/2;break;case"r":o.x=t.x+t.width,o.y=t.y+t.height/2,r.x+=t.width,r.y+=t.height/2;break;case"bl":o.x=t.x,o.y=t.y+t.height,r.y+=t.height;break;case"b":o.x=t.x+t.width/2,o.y=t.y+t.height,r.x+=t.width/2,r.y+=t.height;break;case"br":o.x=t.x+t.width,o.y=t.y+t.height,r.x+=t.width,r.y+=t.height}const s=this.effectContainer.toLocal(o);this.outputSprite.pivot.x=s.x,this.outputSprite.pivot.y=s.y;const a=new Lh.g(this.json.dist,0),l=new Lh.d;l.rotate(this.json.dir),l.translate(r.x+i,r.y+n),l.apply({x:a.x,y:a.y},a);const h=this.effectContainer.toLocal(a);this.outputSprite.position.x=h.x,this.outputSprite.position.y=h.y,this.outputSprite.texture=e}}createOutput(t,e){this.frameTextures[e]=t}setFrameOffset(t,e){}}var Sv=i(117),wv=i.n(Sv);class Av extends Vh.k{constructor(t,e){super(mv.a,wv.a,{uStartAlpha:t.startAlpha,uEndAlpha:t.endAlpha,uStartPos:t.startPos,uEndPos:t.endPos,uHeight:e}),console.log(this)}}class Mv extends yv{constructor(t,e,i,n,r){super(),this.order=2,this.outputSprite=new ep,this.outputTexture=Vh.t.WHITE,this.frameTextures=[],this.json=t,this.shapeScaleX=n,this.effectContainer=e,this.rotation=i,this.ctx=r,this.outputSprite.anchor.x=.5,this.outputSprite.anchor.y=.5;const o=this.effectContainer.getBounds();this.outputSprite.filters=[new rm.BlurFilter(this.json.blurRad/2,4),new Av(this.json,o.height)],this.outputSprite.alpha=.5,this.outputSprite.rotation=-1===this.shapeScaleX?Math.PI+2*this.rotation:Math.PI-2*this.rotation,this.outputSprite.scale.x=-1}updateFrame(t){const e=this.frameTextures[t];e&&(this.outputSprite.texture=e)}createOutput(t,e){this.frameTextures[e]=t}setFrameOffset(t,e){const i=this.effectContainer.getBounds(),n=new Lh.g(i.x+i.width/2,i.y+i.height/2),r=new Lh.g(n.x,n.y+i.height+this.json.dist),o=this.effectContainer.toLocal(r);this.outputSprite.position.x=o.x+t,this.outputSprite.position.y=o.y+e}}var Cv=i(118),Rv=i.n(Cv);class Iv extends lv{constructor(t){super(mv.a,Rv.a,{}),this.priority=1,this.json=t}filterAreaJustify(t){return t}sdfBox(){return null}}var Pv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Ov extends Za.a{constructor(t,e,i,n,r,o){super(),this.effects=[],this.attachs=[],this.frames=new Map,this._targetContainer=new Oh.b,this.frameCount=1,this.ctx=n,this.originWidth=t.width,this.originHeight=t.height,this.cacheKey=i,this.sourceSprite=new ep;for(const i of e)switch(i.type){case"innerShadow":this.effects.push(new Iv(i));break;case"softEdge":this.effects.push(new _v(i));break;case"glow":this.effects.push(new pv(i));break;case"reflection":this.attachs.push(new Mv(i,t,r,o.x,this.ctx));break;case"outerShadow":this.attachs.push(new Ev(i,t,o))}this.effects=this.effects.sort((t,e)=>t.priority-e.priority),this.attachs=this.attachs.sort((t,e)=>t.order-e.order);for(const t of this.attachs)this._targetContainer.addChild(t.outputSprite);this.sourceSprite.name="effect-sprite";const s=new Lh.j(0,0,this.originWidth,this.originHeight),a=this.effects.map(t=>t.filterAreaJustify(s)),l=a.map(t=>t.x),h=a.map(t=>t.y),u=a.map(t=>t.width),c=a.map(t=>t.height);this.filterArea=new Lh.j(Math.min(...l,0),Math.min(...h,0),Math.max(...u,this.originWidth),Math.max(...c,this.originHeight)),this.sourceSprite.filters=this.effects,this.sourceSprite.filterArea=new Lh.j(0,0,this.filterArea.width,this.filterArea.height),this._targetSprite=new ep,this._targetSprite.name="effect-sprite",this._targetContainer.sortableChildren=!0,this._targetSprite.zIndex=999,this._targetContainer.addChild(this._targetSprite)}get container(){return this._targetContainer}getSdfTexture(t,e){return Pv(this,void 0,void 0,(function*(){const i=`${this.cacheKey}_${t}`,n=this.effects.map(t=>({sdfRect:t.sdfBox(e.width,e.height)})).reduce((t,e)=>e.sdfRect?(t.width<e.sdfRect.width&&(t.width=e.sdfRect.width),t.height<e.sdfRect.height&&(t.height=e.sdfRect.height),t):t,new Lh.j(0,0));return 0===n.width||0===n.height?null:this.ctx.sdfManager.getSdf(e,n,i)}))}setFrameCount(t){this.frameCount=t}updateFrame(t){const e=this.frames.get(t);if(e){this._targetSprite.texture=e.texture,this._targetSprite.pivot.x=e.pivotX,this._targetSprite.pivot.y=e.pivotY;for(const e of this.attachs)e.updateFrame(t)}}hasFrame(t){return this.frames.has(t)}setFrameOffset(t,e){this._targetContainer.position.x=-1*t,this._targetContainer.position.y=-1*e,this.attachs.forEach(i=>i.setFrameOffset(t,e))}createFrame(t,e){var i,n;return Pv(this,void 0,void 0,(function*(){const r=e.width,o=e.height;if(this.frames.has(t))return;const s=yield this.getSdfTexture(t,e),a=null!==(i=null==s?void 0:s.texture.width)&&void 0!==i?i:0,l=null!==(n=null==s?void 0:s.texture.height)&&void 0!==n?n:0;for(const t of this.effects){const i=t.sdfBox(e.width,e.height);i&&s&&(t.uniforms.uSdfSampler=s.texture,t.uniforms.uSdfIsReady=1,t.uniforms.uSdfMaxDis=s.maxDis,t.uniforms.uSdfPosition=new Float32Array([(s.texture.width-i.width)/2/s.texture.width,(s.texture.height-i.height)/2/s.texture.height])),t.uniforms.uShapeFilterArea=new Float32Array([0,0,this.filterArea.width,this.filterArea.height])}this.sourceSprite.texture=e;const h=(this.filterArea.width-this.sourceSprite.width)/2,u=(this.filterArea.height-this.sourceSprite.height)/2;this.sourceSprite.x=h,this.sourceSprite.y=u;const c=Math.max(r,a,this.filterArea.width),d=Math.max(o,l,this.filterArea.height),p=Vh.p.create({width:c,height:d,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.sourceSprite,{renderTexture:p}),this.frames.set(t,{texture:p,pivotX:-1*(this.originWidth-c)/2,pivotY:-1*(this.originWidth-c)/2});for(const e of this.attachs)e.createOutput(p,t);Array.from(this.frames.keys()).length===this.frameCount&&this.emit("ready")}))}}var Nv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Lv extends Sg{constructor(t,e,i){var n;super(t,e,i),this.textureContainer=new Oh.b,this.underline=null,this.cacheSprite=new ep,this.effectContainer=new Oh.b,this.effectObject=null;const{shapeId:r,paragraphIndex:o,lineIndex:s,unitIndex:a,lineHeight:l,width:h,underLine:u,fill:c,height:d,isHorz:p,lineWidth:f}=t,m="solidFill"===(null===(n=null==c?void 0:c.fill)||void 0===n?void 0:n.fillType)?c.fill.color:null;if(u){const t=p?l/16:f/16;this.underline=new wg(e,u.type,t,h,d,m,p,r,o,s,a)}if(this.textGraphics=this.createTextGraphics(),this.textFill=this.createTextFill(),this.strokeGraphics=this.createStrokeGraphics(),this.strokeFill=this.createStrokeFill(),this.effectContainer.name="effect-container",this.effectContainer.zIndex=1,this.container.addChild(this.effectContainer),t.effectIndexList&&t.effectIndexList.length&&i.effectList){const{effectList:e}=i;this.effectList=t.effectIndexList.map(t=>{const i=e[t];return"outerShadow"===i.type&&i.dist>5&&(i.dist=5),e[t]}),this.ctx.slideScopeEventHub.once("slide-render",t=>{if(this.ctx.slideIndex===t&&this.effectObject){const t=this.getEffectTexture();if(t){const{texture:e,offsetX:i,offsetY:n}=t;this.effectObject.setFrameOffset(i,n),this.effectObject.createFrame(1,e)}}})}}getEffectTexture(){const{lineHeight:t,fillLineHeight:e,isHorz:i,lineWidth:n}=this.json,r=this.effectContainer.getLocalBounds();let o=0,s=0;for(const t of this.effectContainer.children)t.pivot.x>o&&(o=t.pivot.x),t.pivot.y>s&&(s=t.pivot.y);const a=new Lh.d;a.translate(o,s);const l=Vh.p.create({width:i?r.width:n,height:i?Math.max(e,t):r.height,resolution:2});return this.ctx.renderer.render(this.effectContainer,{renderTexture:l,transform:a}),{texture:l,offsetX:o,offsetY:s}}createStrokeFill(){const{stroke:t,lineWidth:e,lineHeight:i}=this.json;return new av(this.ctx,null==t?void 0:t.fill,e,i,{useFilter:!1,useSlideBackgroundFill:!1})}createStrokeGraphics(){const{stroke:t}=this.json,e=(null==t?void 0:t.key)?{fillType:"blipFill",src:t.key,filters:[]}:void 0;return new av(this.ctx,e,(null==t?void 0:t.width)||0,(null==t?void 0:t.height)||0,{useFilter:!1,useSlideBackgroundFill:!1})}createTextFill(){const{isHorz:t,fill:e,lineWidth:i,lineHeight:n,fillLineHeight:r}=this.json;return t?new av(this.ctx,null==e?void 0:e.fill,i,Math.max(r,n),{useFilter:!1,useSlideBackgroundFill:!1}):new av(this.ctx,null==e?void 0:e.fill,r,n,{useFilter:!1,useSlideBackgroundFill:!1})}createTextGraphics(){var t;const{fill:e,content:i}=this.json;let n="#000000";"solidFill"===(null===(t=null==e?void 0:e.fill)||void 0===t?void 0:t.fillType)&&(n=e.fill.color);const r=(null==e?void 0:e.key)?{fillType:"blipFill",src:e.key,filters:[{type:"changeBulletColor",args:["#000000",n]}]}:void 0;return new av(this.ctx,r,(null==e?void 0:e.width)||0,(null==e?void 0:e.height)||0,{useFilter:"◾"===i,useSlideBackgroundFill:!1})}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,i,n,r;const{isHorz:o}=this.json;t.position={x:o&&null!==(i=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,y:o?0:null!==(r=null===(n=t.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0},t.width=o?this.json.width:this.json.lineWidth,t.height=o?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){var t;null===(t=this.underline)||void 0===t||t.preRender()}render(t){t.addSubMTask(()=>Nv(this,void 0,void 0,(function*(){this.doRender()})),"@TextUnitImpl[doRender]"),t.addSubMTask(()=>Nv(this,void 0,void 0,(function*(){var t;if(this.effectList&&this.effectList.length>0){const e=`${this.ctx.taskId}_${this.ctx.slideIndex}_${null===(t=this.json.fill)||void 0===t?void 0:t.key}_${this.json.effectIndexList}`;this.effectObject=new Ov(this.effectContainer,this.effectList,e,this.ctx,0,new Lh.g(1,1)),this.effectObject.on("ready",()=>{var t;this.effectContainer.visible=!1,this.effectObject.container.zIndex=10,this.container.addChild(this.effectObject.container),null===(t=this.effectObject)||void 0===t||t.updateFrame(1)})}})),"@ShapeImpl[post.render]")}doRender(){let t=!1;const{lineWidth:e,lineHeight:i,baseLine:n,isHorz:r,underline:o,height:s,width:a,highlightColor:l,x:h,y:u,content:c,fillLineHeight:d,fill:p}=this.json;let f=!1!==this.json.needFill;if(p&&p.fill&&"solidFill"!==p.fill.fillType&&(f=!0),l){const t=new Jd,[n,o]=fg(l);t.beginFill(n,o),t.drawRect(0,0,r?a:e,r?i:s),t.endFill(),this.textureContainer.addChild(t)}if(this.textGraphics.displayObject){const e=this.textGraphics.displayObject;if(r&&(e.position.y=u>0?u:0),f){const i=this.textFill.displayObject;if(i)i.mask=e,i.addChild(e),i.position.x=-h,e.position.x+=h,t=!0,this.textureContainer.addChild(i);else if(this.textFill.isSolidFill()){const i=new _g;i.color=this.textFill.getSolidFillColor(),e.filters=[i],t=!0,this.textureContainer.addChild(e)}}else this.textureContainer.addChild(e)}if(this.strokeGraphics.displayObject){const e=this.strokeGraphics.displayObject;if(f){const i=this.strokeFill.displayObject;if(i)i.mask=e,i.addChild(e),r?i.position.y=u>0?u:0:i.position.x=h,this.textureContainer.addChild(i);else if(this.strokeFill.isSolidFill()){r?e.position.y=u>0?u:0:e.position.x=h;const i=new _g;i.color=this.strokeFill.getSolidFillColor(),e.filters=[i],t=!0,this.textureContainer.addChild(e)}}else r?e.position.y=u>0?u:0:e.position.x=h,this.textureContainer.addChild(e)}if(this.underline&&(this.underline.render(),this.underline.sprite)){r?(this.underline.sprite.position.y=o?o-i/16:n,this.underline.sprite.position.x=0):(this.underline.sprite.position.x=0,this.underline.sprite.position.y=0);const t=this.textFill.getClonedDisplayObject();t?(t.mask=this.underline.sprite,t.addChild(this.underline.sprite),this.textureContainer.addChild(t)):this.textureContainer.addChild(this.underline.sprite)}if(t){const t=Vh.p.create({width:r?a:e,height:r?Math.max(d,i):s,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.textureContainer,{renderTexture:t}),this.cacheSprite.texture=t,r&&u<0&&(this.cacheSprite.position.y=u),this.effectContainer.addChild(this.cacheSprite)}else this.effectContainer.addChild(this.textureContainer);this.container.name=c}destroy(){this.textFill.destroy(),this.textGraphics.destroy(),this.strokeFill.destroy(),this.strokeGraphics.destroy(),this.cacheSprite.texture.destroy(!0),this.cacheSprite.destroy(),this.textureContainer.destroy(),this.container.destroy()}}var Dv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Fv extends Sg{constructor(t,e,i){super(t,e,i),this.units=[],this.isHorz=!0,this.hyperLinkMap=new Map,this.hyperLinkContainerMap=new Map,this.effectList=[],i.effectList&&(this.effectList=i.effectList)}getIterateElements(){return this.units}getIterateEntry(t,e,i){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}preRender(){}createUnits(t,e,i,n){for(let r=0,o=this.json.textUnits.length;r<o;r++)n.addSubMTask(()=>Dv(this,void 0,void 0,(function*(){const n=this.json.textUnits[r],{height:o,width:s,fillHeight:a,baseline:l,y:h,underline:u}=this.json,c=new Lv(Object.assign(Object.assign({},n),{lineHeight:o,lineWidth:s,baseLine:l-h,underline:u,fillLineHeight:a||o,isHorz:this.isHorz,shapeId:t,paragraphIndex:e,lineIndex:i,unitIndex:r}),this.ctx,{parentGlobalPos:this.global,effectList:this.effectList});if(c.preRender(),this.units.push(c),n.hyperlink||n.hlinkHover){const t=new og(c.container,this.ctx);n.hyperlink&&t.addAction(n.hyperlink,"click"),n.hlinkHover&&t.addAction(n.hlinkHover,"hover"),this.container.sortableChildren=!0}})),"@TextLineImpl[createUnits]")}render(t){for(const e of this.units.reverse())e.render(t),t.addSubMTask(()=>Dv(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextLineImpl[container.addChild]")}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1}),this.hyperLinkMap.clear();for(const t of this.hyperLinkContainerMap.values())t.destroy({children:!0,baseTexture:!0,texture:!0});this.hyperLinkContainerMap.clear()}}var Bv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Uv extends Sg{constructor(t,e,i){super(t,e,i),this.iterateElements=[],this.lines=[],this.effectList=[],this.isHorz=!0,i.effectList&&(this.effectList=i.effectList)}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const t=this.lines.reduce((t,e)=>t=t.concat(e.getIterateElements()),[]);return this.iterateElements=t,t}getIterateEntry(t,e,i){const n=this.getIterateElements();return n[e]?n[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}preRender(){}createLines(t,e,i){for(let n=0,r=this.json.lines.length;n<r;n++)i.addSubMTask(()=>Bv(this,void 0,void 0,(function*(){const r=this.json.lines[n],o=new Fv(r,this.ctx,{parentGlobalPos:this.global,effectList:this.effectList});o.isHorz=this.isHorz,o.container.name="line-"+n,o.createUnits(t,e,n,i),this.lines.push(o)})),"@TextParagraphImpl[createLines]")}render(t){for(const e of this.lines)e.render(t),t.addSubMTask(()=>Bv(this,void 0,void 0,(function*(){this.container.addChild(e.container)})),"@TextParagraphImpl[container.addChild]")}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}function kv(t,e,i){let n,r;const o=Math.round(t)%360;if(o%180==0)n=Math.cos(o*(Math.PI/180))*e,r=0;else if(o%90==0)n=0,r=-Math.sin(o*(Math.PI/180))*i;else{const t=Math.tan(o*Math.PI/180);n=e*i/Math.sqrt(Math.pow(i,2)+Math.pow(e*t,2)),(o>90&&o<270||o<-90&&o>-270)&&(n=-n),r=-t*n}return{x:n,y:r}}function Gv(t,e,i,n,r,o){const s=kv((r=-r)/Math.PI*180,i,n),a=t.x-s.x,l=t.y-s.y;return{centerX:a/9525*e.x,centerY:l/9525*e.y,rx:i/9525*e.x,ry:n/9525*e.y,st:-r,end:-r+o,aClockWise:o<0}}function Hv(t){const e=new zs,{scale:i}=t;let n={x:0,y:0};const r=t.path.trim().split(" ");for(let t=0;t<r.length;t+=2){const o=r[t],s=r[t+1];if("M"===o){let[t,r]=s.split(",").map(t=>Number(t));n={x:t,y:r},t=t/9525*i.x,r=r/9525*i.y,e.moveTo(t,r)}else if("A"===o){const[t,r,o,a]=s.split(",").map(t=>Number(t)),{centerX:l,centerY:h,rx:u,ry:c,st:d,end:p,aClockWise:f}=Gv(n,i,t,r,o,a);e.absellipse(l,h,u,c,d,p,f,0)}else if("L"===o){let[t,r]=s.split(",").map(t=>Number(t));n={x:t,y:r},t=t/9525*i.x,r=r/9525*i.y,e.lineTo(t,r)}else if("QB"===o){let[t,r,o,a]=s.split(",").map(t=>Number(t));n={x:o,y:a},t=t/9525*i.x,r=r/9525*i.y,o=o/9525*i.x,a=a/9525*i.y,e.quadraticCurveTo(t,r,o,a)}else if("CB"===o){let[t,r,o,a,l,h]=s.split(",").map(t=>Number(t));n={x:l,y:h},t=t/9525*i.x,r=r/9525*i.y,o=o/9525*i.x,a=a/9525*i.y,l=l/9525*i.x,h=h/9525*i.y,e.bezierCurveTo(t,r,o,a,l,h)}else if("C"===o)try{e.closePath()}catch(t){}}return e}function jv(t,e){return t.curves.map(t=>t.getPoints(e)).reduce((t,e)=>t.concat(e),[])}const zv={textCirclePour:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textStop:{top:t=>jv(t,100),bottom:t=>jv(t,100)},textPlain:{top:t=>jv(t,100),bottom:t=>jv(t,100)},textTriangle:{top:t=>jv(t,50),bottom:t=>jv(t,101)},textTriangleInverted:{bottom:t=>jv(t,50),top:t=>jv(t,101)},textChevron:{bottom:t=>jv(t,50),top:t=>jv(t,50)},textChevronInverted:{bottom:t=>jv(t,50),top:t=>jv(t,50)},textRingInside:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textRingOutside:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textArchUpPour:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textArchDownPour:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textCurveUp:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textCurveDown:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textCanUp:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textCanDown:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textWave1:{top:t=>t.getPoints(180),bottom:t=>t.getPoints(180)},textWave2:{top:t=>t.getPoints(180),bottom:t=>t.getPoints(180)},textDoubleWave1:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textWave4:{top:t=>t.getPoints(360),bottom:t=>t.getPoints(360)},textInflate:{top:t=>t.getPoints(180),bottom:t=>t.getPoints(180)},textDeflate:{top:t=>t.getPoints(180),bottom:t=>t.getPoints(180)},textInflateBottom:{top:t=>jv(t,180),bottom:t=>t.getPoints(180)},textDeflateBottom:{top:t=>jv(t,180),bottom:t=>t.getPoints(180)},textInflateTop:{bottom:t=>jv(t,180),top:t=>t.getPoints(180)},textDeflateTop:{bottom:t=>jv(t,180),top:t=>t.getPoints(180)},textFadeRight:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textFadeLeft:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textFadeUp:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textFadeDown:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textSlantUp:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textSlantDown:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textCascadeUp:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textCascadeDown:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textArchUp:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textArchDown:{bottom:t=>jv(t,180),top:t=>jv(t,180)},textCircle:{bottom:t=>jv(t,180),top:t=>jv(t,180)}};function Vv(t,e,i,n,r){const o=t.trim().split(" "),[s,a]=o[1].split(",").map(t=>parseFloat(t)),[l,h,u,c]=o[3].split(",").map(t=>parseFloat(t)),d=function(t,e,i,n,r,o){const s=Math.abs(o*Math.sqrt((i*i+n*n)/2)),a=Math.ceil(s/9525/10);let l=0,h=r,u={x:t+i*Math.cos(h),y:e+n*Math.sin(h)};for(let r=0;r<a;r+=1){h+=o/a;const r={x:t+i*Math.cos(h),y:e+n*Math.sin(h)};l+=Math.sqrt(Math.pow(r.x-u.x,2)+Math.pow(r.y-u.y,2)),u=r}return l}(s,a,l,h,u,c);r*=Math.min(1,d/9525/n);const p=new Lh.d;p.translate(r+e/2,0),p.rotate(2*Math.PI-u);const f=new Lh.g(0,0),m=p.apply(f);m.x+=e/2,m.y=i/2-m.y;const g=l+9525*r,v=h+9525*r;return`M ${9525*m.x},${9525*m.y} A ${g},${v},${u},${c}`}var Xv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Wv{constructor(t,e,i,n,r){var o;this.iterateElements=[],this.paragraphs=[],this.effectList=[],this.container=new Oh.b,this.textContainer=new Oh.b,this.textColorFilter=new _g,this.json=t,this.ctx=e,this.shapeRotation=r,this.parentGlobalPos=n,this.iterateType=i,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+t.position.x,y:this.parentGlobalPos.y+t.position.y},this.container.position.x=t.position.x,this.container.position.y=t.position.y,this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y;const s=new Jd;s.drawRect(0,0,t.width,t.height),this.container.addChild(s),this.container.addChild(this.textContainer),this.textColorFilter.currentColor="#000000FF",this.textColorFilter.designColor="#000000FF",this.effectList=null!==(o=t.effectList)&&void 0!==o?o:[]}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}set color(t){var e;(null!==(e=this.container.filters)&&void 0!==e?e:[]).length>0&&(this.textColorFilter.color=t)}get color(){return this.textColorFilter.color}get on(){var t;return(null!==(t=this.container.filters)&&void 0!==t?t:[]).length>0?"true":"false"}set on(t){var e;"true"===t?(null!==(e=this.container.filters)&&void 0!==e?e:[]).indexOf(this.textColorFilter)<0&&(this.container.filters=[this.textColorFilter]):this.container.filters=[]}getTextElement(t,e){return"paragraph"===t?this.paragraphs[e[0]]:null}getIterateEntry(t,e){return this.iterateElements[t]?this.iterateElements[t]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(t=>{t.destroy()}),this.textColorFilter.destroy()}createParagraphs(t,e){for(let i=0,n=this.json.paragraphs.length;i<n;i++)e.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){var n;const r=this.json.paragraphs[i],o=new Uv(r,this.ctx,{parentGlobalPos:this.global,effectList:this.effectList});o.isHorz=null===(n=this.json.isHorz)||void 0===n||n,o.createLines(t,i,e),e.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){this.iterateElements=this.iterateElements.concat(o.getIterateElements()),o.container.name="段落-"+i,this.paragraphs.push(o)})),"@TextBodyImpl[paragraphs.push]")})),"@TextBodyImpl[createParagraphs]")}render(t){for(const e of this.paragraphs)e.render(t),t.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){this.textContainer.addChild(e.container)})),"@TextBodyImpl[container.addChild]");t.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)})),"@TextBodyImpl[reset width]"),t.addSubMTask(()=>Xv(this,void 0,void 0,(function*(){if(this.json.presetTextShape){const t=this.json.paragraphs.map(t=>t.x).reduce((t,e)=>Math.min(t,e)),e=this.json.paragraphs[0].y,i=this.textContainer.getBounds(),{width:n,height:r}=i,{geometry:o,type:s}=this.json.presetTextShape;if(o.paths){const i=Vh.p.create({width:n,height:r,resolution:this.ctx.renderer.resolution}),a=new Lh.d;a.translate(-t,-e),this.ctx.renderer.render(this.textContainer,{renderTexture:i,transform:a});const l=void 0!==this.json.isHorz&&!this.json.isHorz;if(["textCircle","textArchUp","textArchDown"].indexOf(this.json.presetTextShape.type)>=0){const t=Vv(o.paths[0].path,this.json.width,this.json.height,n,r);o.paths.unshift(Object.assign(Object.assign({},o.paths[0]),{path:t}))}const h=function(t,e,i,n){if(!zv[i])return null;const r=zv[i].top(Hv(e)),o=zv[i].bottom(Hv(t));if(r.length!==o.length)return null;const s=Math.min(r.length,o.length),a=1/(s-1),l=[],h=[],u=new Array(2*s).fill("").map((t,e)=>e);for(let t=0;t<s;t++)l.push(r[t].x,r[t].y),n?h.push(1,a*t):h.push(a*t,0),l.push(o[t].x,o[t].y),n?h.push(0,a*t):h.push(a*t,1);return{vertices:new Float32Array(l),uvs:new Float32Array(h),drawMode:Sc.f.TRIANGLE_STRIP,indices:new Uint16Array(u)}}(o.paths[1],o.paths[0],s,l);if(h){const t=new tm.b(i,h.vertices,h.uvs,h.indices,h.drawMode);this.textContainer.visible=!1,this.container.addChild(t)}}}})),"presetTextShape")}}class Yv{constructor(t){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=t.id,this.type=t.type,this.heightSize=t.heightSize,this.widthSize=t.widthSize,this.fillStyle=t.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=t.lineWidth||1,this.position=t.position||{x:0,y:0},this.rotate=t.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"triangle":this.pivot={x:.7*this.width,y:this.height/2};break;case"arrow":case"stealth":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+jm()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class qv{constructor(t,e,i,n,r,o,s,a,l,h,u){this.id=t,this.ctx=e,this.paths=i,this.hash=n,this.nept=r,this.width=o,this.height=s,this.lineStyle=a,this.shouldFill=l,this.bgColor=h,this.lnColor=u,this.clonedObjects=[],this._displayObject=null,this.isRectangle=!1,this.isPureRect=!1,this.isColoredPureRect=!1,this.isRectangle=this.rectangleDetect(i),this.isRectangle&&l?this.bgColor?this.isColoredPureRect=!0:this.isPureRect=!0:this.ctx.graphicsTexture.addGraphics(this.id,this.paths,this.hash,this.nept,this.width,this.height,this.lineStyle,this.ctx.objectPoolGroup,this.shouldFill,this.bgColor,this.lnColor)}get displayObject(){return this._displayObject}pointDis(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}rectangleDetect(t){if(1!==t.length)return!1;const e=t[0].path.trim().split(" ");if(10!==e.length)return!1;const i=[],n=[];for(let t=0;t<e.length;t+=2){const r=e[t],o=e[t+1],[s,a]=o.split(",").map(t=>Number(t)/100);i.push(r),n.push({x:s,y:a})}if("MLLLC"===i.join("")||"MLLLCC"===i.join(""))return!0;for(let t=0;t<3;t++){const e=n[t],i=n[t+1];if(e.x!==i.x&&e.y!==i.y)return!1}const r=n.slice(0,4).reduce((t,e)=>t+e.x,0)/4,o=n.slice(0,4).reduce((t,e)=>t+e.y,0)/4;if(Number.isNaN(r)||Number.isNaN(o))return!1;const s={x:r,y:o};return sg(this.pointDis(s,n[0]),this.pointDis(s,n[1]))&&sg(this.pointDis(s,n[0]),this.pointDis(s,n[2]))&&sg(this.pointDis(s,n[0]),this.pointDis(s,n[3]))&&this.pointDis(s,n[0])===this.pointDis(s,n[1])}createDisplayObject(){if(this.isPureRect){const t=new Jd;return t.beginFill(0,1),t.drawRect(0,0,this.width,this.height),t}if(this.isColoredPureRect&&this.bgColor){const t=new Jd,[e,i]=fg(this.bgColor);return t.beginFill(e,i),t.drawRect(0,0,this.width,this.height),t}{const t=new ep,e=this.ctx.graphicsTexture.getGraphicsData(this.id);return e?(t.texture=e.texture,t.pivot.x=e.pivot.x,t.pivot.y=e.pivot.y,t.scale.x=e.scale,t.scale.y=e.scale,t):null}}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}render(){this._displayObject=this.createDisplayObject()}isNeedMask(t,e){let i=!1;return this._displayObject&&(i=!(this.isRectangle&&Math.abs(t-this._displayObject.width)<2&&Math.abs(e-this._displayObject.height)<2&&this.shouldFill)),i}addArrows(t){var e;null===(e=this._displayObject)||void 0===e||e.addChild(t)}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var Zv=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};const Jv={pivot:{x:0,y:0},width:0,height:0};class Kv extends hg{constructor(t,e,i){var n,r,o,s,a,l,h,u,c;super(t,e,i),this.renderContainer=new Oh.b,this.needCacheAsBitMap=!1,this.backgroundGraphics=null,this.effectList=[],this.strokeGraphics=null,this.ghco=null,this.useGroupFill=!1,this.arrowList=[],this.fillColorFilter=new _g,this.strokeColorFilter=new _g,this.pptColorFilter=new _g,this.id="",this.ppt_c=new ig(this),this.fill=new ng(this),this.stroke=new tg(this),this.effectObject=null,this.effectContainer=new Oh.b,this.effectDisposer=()=>{},this.json=t,this.option=i,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i.groupFillStyle&&(this.json.fillStyle=i.groupFillStyle,this.useGroupFill=!0),this.id=t.id;const{fillStyle:d,lineStyle:p}=this.json;this.container.sortableChildren=!0,this.container.name=t.id+"_container_[Shape]",this.effectContainer.name="effect-container",this.effectContainer.zIndex=1,this.container.addChild(this.effectContainer),this.renderContainer.name=t.id+"_render_container_[Shape]",this.generateArrowList(),this.backgroundFill=this.createBackgroundFill(),this.backgroundGraphics=this.createBackgroundGraphics(),this.strokeFill=this.createStrokeFill(),this.strokeGraphics=this.createStrokeGraphics();try{this.ghco=new qv(this.json.id+"-path-graphics-text-wrap",this.ctx,null!==(o=null===(r=null===(n=this.json.textBody)||void 0===n?void 0:n.presetTextShape)||void 0===r?void 0:r.geometry.paths)&&void 0!==o?o:[],null!==(l=null===(a=null===(s=this.json.textBody)||void 0===s?void 0:s.presetTextShape)||void 0===a?void 0:a.geometry.hash)&&void 0!==l?l:"",{x:0,y:0},(null===(h=this.json.textBody)||void 0===h?void 0:h.width)||100,(null===(u=this.json.textBody)||void 0===u?void 0:u.height)||100,{width:2,fill:{fillType:"solidFill",color:"#FF0000FF"}},!1,null,null)}catch(t){this.ctx.logger.error(t.message,this.ctx.taskId)}this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null==d?void 0:d.fillType)&&(this.fillColorFilter.currentColor=d.color,this.fillColorFilter.designColor=d.color),"solidFill"===(null===(c=null==p?void 0:p.fill)||void 0===c?void 0:c.fillType)&&(this.strokeColorFilter.currentColor=p.fill.color,this.strokeColorFilter.designColor=p.fill.color),this.updateTransform(this.json),t.textBody&&(this.text=new Wv(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y},this.json.rotation||0)),this.container.hitArea=new Lh.k(1,1,this.json.width,this.json.height),this.ctx.slideScopeEventHub.once("slide-render",t=>{if(this.ctx.slideIndex===t&&this.effectObject){const t=this.getEffectTexture();if(t){const{texture:e,offsetX:i,offsetY:n}=t;this.effectObject.setFrameOffset(i,n),this.effectObject.createFrame(1,e)}}})}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e,i,n,r,o,s;return this.strokeFill.displayObject?(null!==(i=null===(e=null===(t=this.strokeFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==i?i:-1)>0:(null!==(s=null===(o=null===(r=null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set strokeActive(t){var e,i,n,r,o,s;const{displayObject:a}=this.strokeFill;t?a&&(null!==(i=null===(e=a.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==i?i:-1)<0?a.filters=[this.strokeColorFilter]:(null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)&&(null!==(o=null===(r=this.strokeGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.strokeColorFilter))&&void 0!==o?o:-1)<0&&(this.strokeGraphics.displayObject.filters=[this.strokeColorFilter]):a?a.filters=[]:(null===(s=this.strokeGraphics)||void 0===s?void 0:s.displayObject)&&(this.strokeGraphics.displayObject.filters=[])}get pptColorActive(){var t,e;return(null!==(e=null===(t=this.renderContainer.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set pptColorActive(t){this.renderContainer.filters=t?[this.pptColorFilter]:[]}get fillActive(){var t,e,i,n,r,o,s;return this.backgroundFill.displayObject?(null!==(i=null===(e=null===(t=this.backgroundFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==i?i:-1)>0:(null!==(s=null===(o=null===(r=null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set fillActive(t){var e,i,n,r,o,s;t?this.backgroundFill.displayObject&&(null!==(i=null===(e=this.backgroundFill.displayObject.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==i?i:-1)<0?this.backgroundFill.displayObject.filters=[this.fillColorFilter]:(null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)&&(null!==(o=null===(r=this.backgroundGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.fillColorFilter))&&void 0!==o?o:-1)<0&&(this.backgroundGraphics.displayObject.filters=[this.fillColorFilter]):this.backgroundFill.displayObject?this.backgroundFill.displayObject.filters=[]:(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.displayObject)&&(this.backgroundGraphics.displayObject.filters=[])}getTextElement(t,e){var i,n;return null!==(n=null===(i=this.text)||void 0===i?void 0:i.getTextElement(t,e))&&void 0!==n?n:null}getBgElement(){return this}getIterateEntry(t,e,i){return 0===e?this:"el"===t?(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null):this.text?this.text.getIterateEntry(e-1,i)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}getEffectTexture(){const t=this.effectContainer.getLocalBounds();let e=0,i=0;for(const t of this.effectContainer.children)t.pivot.x>e&&(e=t.pivot.x),t.pivot.y>i&&(i=t.pivot.y);const n=new Lh.d;if(n.translate(e,i),0===this.effectContainer.children.length)return null;const r=Vh.p.create({width:t.width,height:t.height,resolution:this.ctx.renderer.resolution});return this.ctx.renderer.render(this.effectContainer,{renderTexture:r,transform:n}),{texture:r,offsetX:e,offsetY:i}}createStrokeGraphics(){var t,e,i,n;const{id:r,geometry:o,lineStyle:s}=this.json,{width:a,height:l,pivot:h}=(null==o?void 0:o.lineTransform)||Jv,u=a||this.json.width,c=l||this.json.height,d="solidFill"===(null===(t=null==s?void 0:s.fill)||void 0===t?void 0:t.fillType)?s.fill.color:null;return s&&"noFill"!==(null===(e=s.fill)||void 0===e?void 0:e.fillType)?new qv(r+"-path-graphics",this.ctx,null!==(i=null==o?void 0:o.paths)&&void 0!==i?i:[],null!==(n=null==o?void 0:o.hash)&&void 0!==n?n:"",h||{x:0,y:0},u,c,s,!1,null,d):null}createStrokeFill(){const[t,e]=this.calculateFillObjectOffset(),{geometry:i,lineStyle:n,width:r,height:o}=this.json,s=(null==i?void 0:i.lineTransform)||Jv,a=Vm()(null==n?void 0:n.width)?n.width:1;return new av(this.ctx,null==n?void 0:n.fill,(s.width||r)+a+t,Math.max((s.height||o)+a,e),{useFilter:!0,useSlideBackgroundFill:!1})}createBackgroundGraphics(){var t;const{geometry:e,lineStyle:i,fillStyle:n,id:r}=this.json,{width:o,height:s,pivot:a}=(null==e?void 0:e.lineTransform)||Jv,l=o||this.json.width,h=s||this.json.height,u="solidFill"===(null==n?void 0:n.fillType)?n.color:null;return n&&"noFill"!==n.fillType||this.json.isPicture?new qv(r+"-bg-graphics",this.ctx,null!==(t=null==e?void 0:e.paths)&&void 0!==t?t:[],(null==e?void 0:e.hash)||"",a||{x:0,y:0},l,h,i,!0,u,null):null}createBackgroundFill(){var t,e,i,n;const{fillStyle:r,width:o,height:s,lineStyle:a,geometry:l}=this.json,h=(null==l?void 0:l.fillTransform)||Jv,u={useFilter:!0,useSlideBackgroundFill:this.json.useBgFill,fillFloat:this.json.fillFloat,shapeRotation:this.json.rotation},c=this.useGroupFill&&(null===(t=this.option.groupSize)||void 0===t?void 0:t.w)?this.option.groupSize.w:h.width||o,d=this.useGroupFill&&(null===(e=this.option.groupSize)||void 0===e?void 0:e.h)?this.option.groupSize.h:h.height||s;return new av(this.ctx,r,c+(null!==(i=null==a?void 0:a.width)&&void 0!==i?i:0),d+(null!==(n=null==a?void 0:a.width)&&void 0!==n?n:0),u)}createBackground(){var t,e,i,n,r,o,s,a,l,h,u,c;const{pivot:d,width:p,height:f}=(null===(t=this.json.geometry)||void 0===t?void 0:t.fillTransform)||Jv,{displayObject:m}=this.backgroundFill;m?(this.json.useBgFill&&(null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)?(this.needCacheAsBitMap=!0,m.mask=this.backgroundGraphics.displayObject,m.pivot.x=(null===(n=this.json.position)||void 0===n?void 0:n.x)||0,m.pivot.y=(null===(r=this.json.position)||void 0===r?void 0:r.y)||0,this.effectContainer.addChild(this.backgroundGraphics.displayObject)):"gifFill"===(null===(o=this.json.fillStyle)||void 0===o?void 0:o.fillType)?(m.height=f||this.designHeight,m.width=p||this.designWidth,m instanceof im&&m.play(),(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.isNeedMask(m.width,m.height))&&(m.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.effectContainer.addChild(this.backgroundGraphics.displayObject))):(null===(a=this.backgroundGraphics)||void 0===a?void 0:a.isNeedMask(m.width,m.height))&&(this.json.fillFloat||(this.needCacheAsBitMap=!0,m.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.effectContainer.addChild(this.backgroundGraphics.displayObject))),this.json.fillFloat||(m.x=d.x,m.y=d.y),this.useGroupFill&&(m.x-=null!==(h=null===(l=this.json.position)||void 0===l?void 0:l.x)&&void 0!==h?h:0,m.y-=null!==(c=null===(u=this.json.position)||void 0===u?void 0:u.y)&&void 0!==c?c:0),this.effectContainer.addChild(m)):this.backgroundFill.hasFill&&(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.displayObject)&&this.effectContainer.addChild(this.backgroundGraphics.displayObject)}createPathFill(){var t,e,i;const{displayObject:n}=this.strokeFill,r=null===(t=this.strokeGraphics)||void 0===t?void 0:t.displayObject,[o,s]=this.calculateFillObjectOffset();n?((null===(e=this.strokeGraphics)||void 0===e?void 0:e.isNeedMask(n.width,n.height))&&r&&(this.needCacheAsBitMap=!0,n.pivot.x=r.pivot.x,n.pivot.y=r.pivot.y,r.pivot.x=0,r.pivot.y=0,n.mask=r,n.addChild(r),n.position.x=-o/2,n.position.y=-s/2,r.position.x=o/2,r.position.y=s/2),this.effectContainer.addChild(n)):this.strokeFill.hasFill&&(null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)&&this.effectContainer.addChild(this.strokeGraphics.displayObject)}createFilledPathMask(){var t,e,i;const n=(null===(e=null===(t=this.json.geometry)||void 0===t?void 0:t.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of n){const e=this.ctx.graphicsTexture.getGraphicsData(t.id);if(e){const n=new ep(e.texture);n.pivot.x=e.pivot.x,n.pivot.y=e.pivot.y,n.scale.x=e.scale,n.scale.y=e.scale;const r=this.backgroundFill.getClonedDisplayObject(),o=null===(i=this.backgroundGraphics)||void 0===i?void 0:i.getClonedDisplayObject(),s=r||o;s&&(this.backgroundFill.displayObject&&(s.pivot.x=this.backgroundFill.displayObject.pivot.x,s.pivot.y=this.backgroundFill.displayObject.pivot.y),s.mask=n,s.filters=[Eg[t.fill]],this.needCacheAsBitMap=!0,this.effectContainer.addChild(s),this.effectContainer.addChild(n))}}}createArrow(){this.arrowList.length&&this.arrowList.forEach(t=>{var e;const i=this.ctx.graphicsTexture.getGraphicsData(t.graphicsId);if(i){const{texture:n}=i,r=new ep(n);r.pivot.x=t.pivot.x,r.pivot.y=t.pivot.y,r.position.x=t.position.x,r.position.y=t.position.y,r.rotation=t.rotate/180*Math.PI,r.scale.x=i.scale,r.scale.y=i.scale,null===(e=this.backgroundGraphics)||void 0===e||e.addArrows(r)}})}generateArrowList(){var t,e;const{lineArrowList:i,lineStyle:n,id:r}=this.json,o="solidFill"===(null===(t=null==n?void 0:n.fill)||void 0===t?void 0:t.fillType)?n.fill.color:null;null===(e=i||[])||void 0===e||e.forEach((t,e)=>{var i,s;const a=new Yv(Object.assign(Object.assign({},t),{fillStyle:null==n?void 0:n.fill,lineWidth:null!==(i=null==n?void 0:n.width)&&void 0!==i?i:0}));a.graphicsId=`${r}-arrow-${e}-graphics`,a.textureId=`${r}-arrow-${e}-fill`,this.ctx.graphicsTexture.addGraphics(a.graphicsId,null!==(s=a.paths)&&void 0!==s?s:[],a.hash,{x:0,y:0},a.width,a.height,void 0,this.ctx.objectPoolGroup,!0,o,null),this.arrowList.push(a)})}calculateFillObjectOffset(){let[t,e]=[0,0];return this.arrowList.length&&(t=this.arrowList.reduce((t,e)=>Math.max(t,e.width),0),e=this.arrowList.reduce((t,e)=>Math.max(t,e.height),0)),[t,e]}preRender(t){var e,i,n;const{lineStyle:r,geometry:o}=this.json,{width:s,height:a}=(null==o?void 0:o.lineTransform)||Jv,l=s||this.json.width,h=a||this.json.height,u=(null===(e=null==o?void 0:o.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[],c="solidFill"===(null===(i=null==r?void 0:r.fill)||void 0===i?void 0:i.fillType)?r.fill.color:null;t.addSubMTask(()=>Zv(this,void 0,void 0,(function*(){for(const t of u)this.ctx.graphicsTexture.addGraphics(t.id,[t],t.hash,((null==o?void 0:o.lineTransform)||Jv).pivot,l,h,r,this.ctx.objectPoolGroup,!0,null,c)})),"@ShapeImpl[addGraphics]"),null===(n=this.text)||void 0===n||n.createParagraphs(this.json.id,t)}subClassRender(){return Zv(this,void 0,void 0,(function*(){}))}render(t){t.addSubMTask(()=>Zv(this,void 0,void 0,(function*(){var t,e;null===(t=this.strokeGraphics)||void 0===t||t.render(),null===(e=this.backgroundGraphics)||void 0===e||e.render(),this.createBackground(),yield this.subClassRender(),this.createFilledPathMask(),this.createPathFill(),this.createArrow()})),"@ShapeImpl[render]"),this.text&&this.text.render(t),t.addSubMTask(()=>Zv(this,void 0,void 0,(function*(){var t,e,i,n,r,o,s,a,l,h,u,c,d;if("wd"===(null===(t=this.json.textBody)||void 0===t?void 0:t.iterateType)||"lt"===(null===(e=this.json.textBody)||void 0===e?void 0:e.iterateType)){if(this.renderContainer.addChild(this.container),this.text){const{x:t,y:e}=null!==(i=this.json.scale)&&void 0!==i?i:{x:1,y:1};this.text.container.scale.x=e<0?-Math.abs(t):Math.abs(t),this.text.container.scale.y=e,this.text.container.position.x=(null!==(r=null===(n=this.json.position)||void 0===n?void 0:n.x)&&void 0!==r?r:0)+this.text.x,this.text.container.position.y=(null!==(s=null===(o=this.json.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)+this.text.y,this.text.container.scale.y<0&&(this.text.container.position.y+=this.text.height),this.text.container.scale.x<0&&(this.text.container.position.x+=this.json.width),this.json.textRotation&&(this.text.container.rotation=this.json.textRotation),this.renderContainer.addChild(this.text.container)}}else{if(this.text){if(this.json.textRotation){this.text.container.rotation=this.json.textRotation;const{width:t,height:e}=this.text,{x:i,y:n}=this.text.container.position;this.text.container.pivot.x=t/2,this.text.container.pivot.y=e/2,this.text.container.x=i+t/2,this.text.container.y=n+e/2}if(cg()(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const t=this.json.rotation||0;this.text.container.rotation=-t;const{width:e}=this.text;this.text.container.position.x=e}this.text.container.zIndex=100;const t=null===(a=this.json.effectList)||void 0===a?void 0:a.find(t=>"outerShadow"===t.type),e=null===(l=this.json.effectList)||void 0===l?void 0:l.find(t=>"softEdge"===t.type),i=null===(h=this.json.effectList)||void 0===h?void 0:h.find(t=>"glow"===t.type);t&&1!==t.sx||e||i?this.container.addChild(this.text.container):this.effectContainer.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.needCacheAsBitMap,"background"===this.json.id&&this.ctx.hasBackgroundFillShape){const t=Vh.p.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:t}),this.ctx.bgTexture=t}this.json.effectList&&this.json.effectList.length>0&&(null===(u=this.ctx.featureList)||void 0===u?void 0:u.effect)&&!this.ctx.forceCanvas&&!this.json.media&&(this.effectObject=new Ov(this.effectContainer,this.json.effectList,`${this.ctx.taskId}_${this.ctx.slideIndex}_${this.json.id}`,this.ctx,this.json.rotation||0,new Lh.g((null===(c=this.json.scale)||void 0===c?void 0:c.x)||1,(null===(d=this.json.scale)||void 0===d?void 0:d.y)||1)),function(t){var e,i,n;return"gifFill"===(null===(e=t.fillStyle)||void 0===e?void 0:e.fillType)||("gifFill"===(null===(n=null===(i=t.lineStyle)||void 0===i?void 0:i.fill)||void 0===n?void 0:n.fillType)||!!t.picFill&&"gifFill"===t.picFill.fillType)}(this.json)&&this.effectObject.setFrameCount(-1),this.effectObject.on("ready",()=>{var t;this.effectContainer.visible=!1,this.effectObject.container.zIndex=10,this.container.addChild(this.effectObject.container),null===(t=this.effectObject)||void 0===t||t.updateFrame(1)}))})),"@ShapeImpl[post.render]")}clearOnSlideChange(){}initOnReuse(){}destroy(){var t,e,i,n;null===(t=this.text)||void 0===t||t.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.backgroundFill.destroy(),null===(e=this.backgroundGraphics)||void 0===e||e.destroy(),this.strokeFill.destroy(),null===(i=this.strokeGraphics)||void 0===i||i.destroy(),this.renderContainer.destroy(),null===(n=this.arrowRenderTexture)||void 0===n||n.destroy(!0),this.arrowList=[],this.effectDisposer()}}var Qv=i(119);const $v=new(i.n(Qv).a),t_=$v.getDevice(),e_=$v.getBrowser(),i_=$v.getOS(),n_={isDesktop(){let t=!0;return"mobile"===t_.type&&(t=!1),/Samsung/.test(e_.name||"")&&(t=!1),window.__nativeTags&&window.__nativeTags.platform&&(t=!1),t},isIOS(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^ios/i.test(window.__nativeTags.platform)&&(t=!0),i_.name&&/iOS/.test(i_.name)&&(t=!0),t},isAndroid(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^android/i.test(window.__nativeTags.platform)&&(t=!0),i_.name&&/android/i.test(i_.name)&&(t=!0),t},isLowGpuMemory(){var t,e;const i=null!==(e=null===(t=window.__nativeTags)||void 0===t?void 0:t.platform)&&void 0!==e?e:"";if(i){const t=i.split(" ");if(t[1]){if(/^iPad/.test(t[1])){const e=t[1].match(/^iPad(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=6)}if(/^iPhone/.test(t[1])){const e=t[1].match(/^iPhone(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=9)}return!1}return!1}return!0}};var r_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};function o_(t,e){for(const i in e)t.style[i]=e[i]}const s_={medianContainerClass:"median-container",hoverHiddeDelay:1500,portalWidth:300,portalHeight:50,hiddenOpacity:"0",hoverOpacity:"1",opacityAnimationTime:.4};class a_{constructor(t){var e,i;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.fullScreenButton=document.createElement("div"),this.exitFullScreenButton=document.createElement("div"),this.medianIsEnd=!1,this.pickBookmarkIndex=0,this.playCallBackList=[],this.duration=0,this.isVideo=!1,this.start=0,this.end=0,this.fullscreenStatus=!1,this.fadeState={in:!1,out:!1},this.changeMediaProgress=t=>{if(this.ctx.isPlayerPaused())return void this.ctx.logger.info("Media controller prevent seek event with paused state",this.ctx.taskId);t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.medianIsEnd=!1,"interactive"!==this.ctx.mode&&this.jumpToTime(e),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(jy.mediaSeek,{id:this.targetId,time:e,isPlaying:this.media.isPlaying}),this.delayHide()},this.jumpToTime=(t=0)=>r_(this,void 0,void 0,(function*(){yield Pm(()=>!!this.duration,3e3);const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e,this.changeBookmarkIndex(e,e>this.media.currentTime))})),this.showController=t=>{t.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=a_.formatTime(this.duration)},this.playMedia=()=>r_(this,void 0,void 0,(function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(t=>{t()}),this.delayHide()})),this.pauseMedia=()=>r_(this,void 0,void 0,(function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()})),this.onMouseOut=t=>{t.stopPropagation(),this.hide()},this.mediaTimeUpdate=()=>r_(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;if(this.duration>0&&(Math.abs(t-this.duration)<.3||t>this.duration)&&(yield this.pauseMedia(),this.medianIsEnd=!0,this.jumpToTime(),this.ctx.eventHub.emit(jy.mediaStop,{id:this.targetId}),this.onClickCancelFullScreenButtonHandle()),this.currentTime.innerText=a_.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString(),this.bookmarkList&&this.bookmarkList.length>0){const t=this.bookmarkList[this.pickBookmarkIndex];t&&t.time.toFixed(0)===this.media.currentTime.toFixed(0)&&(this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${t.name}`),this.pickBookmarkIndex+=1)}this.fadeHit(t)})),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.fadeState={in:!1,out:!1},this.fadeHit(0),this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(t=>{t()}),this.media.currentTime<this.start&&this.jumpToTime()},this._playMediaFromCtrl=()=>{this.playMediaFromCtrl(!1)},this._pauseMediaFromCtrl=()=>{this.pauseMediaFromCtrl(!1),this.delayHide()},this.onClickFullScreenButtonHandle=()=>{this.fullscreenPlay()},this.onClickCancelFullScreenButtonHandle=()=>{this.fullscreenStatus=!1,this.media.requestCancelFullscreen(),this.ctx.eventHub.emit(jy.fullscreenChange,{targetId:this.targetId,state:!1}),this.delayHide()},this.onFullScreenChange=t=>{const{status:e,targetId:i,slideIndex:n}=t;this.changeFullScreenState(e,i,n),this.delayHide()},this.onContainerSizeChange=()=>{this.setControllerPosition()},this.onControllerShowStatusChange=({slideIndex:t,targetId:e,status:i})=>{if(t===this.ctx.slideIndex){if(this.targetId===e){const{hiddenOpacity:t,hoverOpacity:e}=s_;i?(this.mediaController.style.opacity=e,this.mediaController.style.display="flex"):this.mediaController.style.opacity=t}this.delayHide()}},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.target=t.target,this.media=t.media,this.info=t.info,this.shapeId=t.shapeId,this.canvasElement=t.canvasElement,"video"===this.media.type&&(this.isVideo=!0),this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=null!==(e=this.info.cut.start)&&void 0!==e?e:0,this.end=null!==(i=this.info.cut.end)&&void 0!==i?i:0),this.info.bookmarkList&&(this.bookmarkList=this.info.bookmarkList.sort((t,e)=>t.time-e.time))}get clippedDuration(){return this.duration}getMedianContainer(){var t;const{medianContainerClass:e}=s_;let i=null===(t=this.canvasElement.parentElement)||void 0===t?void 0:t.querySelector("."+e);i||(i=document.createElement("div"),i.className=e,this.canvasElement.parentElement.appendChild(i)),this.container=i}static formatTime(t){let e="00:00";if(t){const i=Math.floor(t/60),n=String(i<0?0:i).padStart(2,"0"),r=Math.floor(t%60);e=`${n}:${String(r<0?0:r).padStart(2,"0")}`}return e}generatePlayButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"viewBox","0 0 512 512"),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"width",e.toString());const n=document.createElementNS("http://www.w3.org/2000/svg","polyline");return n.setAttributeNS(null,"points","35 0, 477 256, 35 512"),n.setAttributeNS(null,"fill","#000000"),i.appendChild(n),i}generatePauseButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");o_(i,{height:t+"px"}),i.setAttributeNS(null,"viewBox","0 0 512 512"),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"width",e.toString());const n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttributeNS(null,"x","35"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","148"),n.setAttributeNS(null,"height","512");const r=n.cloneNode(!0);return r.setAttributeNS(null,"x","330"),i.append(n,r),i}generateFullScreenButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");o_(i,{height:t+"px",width:e+"px"}),i.setAttributeNS(null,"width",e.toString()),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"viewBox","0 0 1024 1024");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d","M918.116352 107.409408c10.186752 10.175488 10.186752 26.691584 0 36.87936L653.734912 407.038976c-10.187776 10.187776-26.703872 10.187776-36.891648 0-10.175488-10.187776-10.175488-26.703872 0.013312-36.891648l264.38144-262.73792c10.174464-10.187776 26.69056-10.200064 36.87936-0.013312L918.117376 107.409408zM878.281728 148.096l-161.155072-0.44544c-11.283456 0.279552-20.85888-8.226816-21.90336-19.458048l0-13.421568c0.318464-10.671104 8.889344-19.241984 19.560448-19.560448l187.030528 0.827392c0.1792-0.037888 0.357376-0.0768 0.523264-0.089088l9.549824-0.229376c5.005312-0.152576 9.843712 1.770496 13.372416 5.336064 3.32288 3.629056 4.9664 8.49408 4.545536 13.40928l-1.032192 9.537536c0 0.191488 0.70144 0.318464 0.70144 0.49664l-0.534528 188.279808c-0.54784 9.984-9.092096 17.637376-19.076096 17.089536-0.165888-0.012288-0.319488-0.0256-0.484352-0.037888L896.009216 329.8304c-10.379264-0.0512-18.733056-8.506368-18.681856-18.885632 0.013312-0.191488 0.013312-0.381952 0.013312-0.585728L878.281728 148.096zM105.884672 916.661248c-10.187776-10.175488-10.200064-26.691584-0.013312-36.87936 0 0 0-0.013312 0.013312-0.013312l265.19552-262.73792c10.35264-10.008576 26.86976-9.729024 36.866048 0.636928 9.766912 10.110976 9.766912 26.131456 0 36.242432L143.579136 916.661248C133.072896 926.848 116.3776 926.848 105.884672 916.661248L105.884672 916.661248zM146.533376 875.973632l161.154048 0.433152c11.283456-0.292864 20.85888 8.213504 21.891072 19.458048l0 13.38368c-0.292864 10.672128-8.876032 19.255296-19.560448 19.561472l-187.858944-0.828416c-0.165888 0.037888-0.344064 0.075776-0.509952 0.089088l-9.550848 0.229376c-5.004288 0.152576-9.831424-1.782784-13.35808-5.336064-3.323904-3.629056-4.979712-8.493056-4.54656-13.395968l1.031168-9.537536c0-0.191488-0.712704-0.330752-0.700416-0.509952l0.534528-188.278784c0.534528-9.984 9.066496-17.625088 19.050496-17.089536 0.165888 0.013312 0.330752 0.0256 0.508928 0.037888l14.212096 0c10.365952 0.0512 18.719744 8.507392 18.656256 18.873344 0 0.191488 0 0.395264-0.013312 0.598016L146.533376 875.973632zM918.116352 916.661248c10.186752-10.175488 10.200064-26.691584 0.012288-36.87936 0 0 0-0.013312-0.012288-0.013312l-264.38144-262.73792c-10.365952-10.008576-26.86976-9.729024-36.87936 0.636928-9.766912 10.110976-9.766912 26.131456 0 36.242432L881.22368 916.661248c10.186752 10.186752 26.703872 10.186752 36.891648 0.013312L918.115328 916.661248 918.116352 916.661248zM878.281728 875.973632l-161.168384 0.433152c-11.270144-0.292864-20.845568 8.213504-21.890048 19.458048l0 13.38368c0.306176 10.672128 8.889344 19.241984 19.560448 19.561472l187.030528-0.828416c0.1792 0.037888 0.357376 0.075776 0.523264 0.089088l9.549824 0.229376c5.005312 0.152576 9.843712-1.782784 13.372416-5.336064 3.32288-3.629056 4.978688-8.493056 4.545536-13.395968l-1.032192-9.537536c0-0.191488 0.70144-0.330752 0.70144-0.509952l-0.534528-188.278784c-0.54784-9.984-9.092096-17.637376-19.076096-17.089536-0.165888 0.013312-0.319488 0.0256-0.484352 0.037888L896.009216 694.19008c-10.379264 0.0512-18.733056 8.507392-18.681856 18.885632 0 0.191488 0.013312 0.381952 0.013312 0.584704L878.281728 875.973632zM105.884672 107.409408c-10.187776 10.175488-10.187776 26.691584 0 36.87936l265.19552 262.750208c10.187776 10.187776 26.691584 10.187776 36.87936 0s10.175488-26.703872-0.012288-36.891648l-264.368128-262.73792C133.072896 97.222656 116.3776 97.222656 105.884672 107.409408L105.884672 107.409408zM146.533376 148.096l161.154048-0.44544c11.283456 0.292864 20.85888-8.213504 21.891072-19.458048l0-13.421568c-0.306176-10.671104-8.889344-19.241984-19.560448-19.560448l-187.858944 0.827392c-0.165888-0.0512-0.344064-0.0768-0.509952-0.089088l-9.550848-0.229376c-5.004288-0.152576-9.831424 1.782784-13.35808 5.336064-3.323904 3.629056-4.979712 8.49408-4.54656 13.40928l1.031168 9.537536c0 0.191488-0.712704 0.318464-0.700416 0.49664l0.534528 188.279808c0.534528 9.970688 9.066496 17.624064 19.050496 17.089536 0.165888-0.012288 0.330752-0.0256 0.508928-0.037888l14.212096 0c10.365952-0.0512 18.719744-8.506368 18.656256-18.87232 0-0.191488 0-0.395264-0.013312-0.598016L146.533376 148.096z"),i.appendChild(n),document.body.appendChild(i),i}generateExitFullScreenButton(t=20,e=20){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");o_(i,{height:t+"px",width:e+"px"}),i.setAttributeNS(null,"width",e.toString()),i.setAttributeNS(null,"height",t.toString()),i.setAttributeNS(null,"viewBox","0 0 1024 1024");const n=document.createElementNS("http://www.w3.org/2000/svg","path"),r=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d","M716.8 998.4a25.6 25.6 0 0 1-25.6-25.6v-256a25.6 25.6 0 0 1 25.6-25.6h256a25.6 25.6 0 1 1 0 51.2h-230.4v230.4a25.6 25.6 0 0 1-25.6 25.6zM307.2 998.4a25.6 25.6 0 0 1-25.6-25.6v-230.4H51.2a25.6 25.6 0 1 1 0-51.2h256a25.6 25.6 0 0 1 25.6 25.6v256a25.6 25.6 0 0 1-25.6 25.6zM972.8 332.8h-256a25.6 25.6 0 0 1-25.6-25.6v-256a25.6 25.6 0 1 1 51.2 0v230.4h230.4a25.6 25.6 0 1 1 0 51.2zM307.2 332.8h-256a25.6 25.6 0 1 1 0-51.2h230.4V51.2a25.6 25.6 0 1 1 51.2 0v256a25.6 25.6 0 0 1-25.6 25.6z"),r.setAttributeNS(null,"d","M307.2 332.8a25.6 25.6 0 0 1-18.112-7.488L56.896 93.12a25.6 25.6 0 0 1 36.224-36.224l232.192 232.192A25.6 25.6 0 0 1 307.2 332.8zM716.8 332.8a25.6 25.6 0 0 1-18.112-43.712L930.88 56.896a25.6 25.6 0 0 1 36.224 36.224l-232.192 232.192a25.472 25.472 0 0 1-18.112 7.488zM948.992 974.592a25.6 25.6 0 0 1-18.112-7.488l-232.192-232.192a25.6 25.6 0 0 1 36.224-36.224l232.192 232.192a25.6 25.6 0 0 1-18.112 43.712zM75.008 974.592a25.6 25.6 0 0 1-18.112-43.712l232.192-232.192a25.6 25.6 0 0 1 36.224 36.224l-232.192 232.192a25.472 25.472 0 0 1-18.112 7.488z"),i.appendChild(n),i.appendChild(r),document.body.appendChild(i),i}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px",display:"flex",justifyContent:"center",alignItems:"center"};o_(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=this.generatePlayButton();o_(e,{height:"20px"}),this.playButton.appendChild(e),o_(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const i=this.generatePauseButton();if(o_(i,{height:"20px"}),this.pauseButton.appendChild(i),!this.isVideo)return;const n=this.generateFullScreenButton(20,20);this.fullScreenButton.appendChild(n),o_(this.fullScreenButton,Object.assign(Object.assign({},t),{display:"block"}));const r=this.generateExitFullScreenButton(20,20);this.exitFullScreenButton.appendChild(r),o_(this.exitFullScreenButton,Object.assign(Object.assign({},t),{display:"none"}))}createTimer(){const t=document.createElement("div");o_(t,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",t.append(this.currentTime,e,this.totalTime),t}createProgress(){const t={flex:"1",position:"relative"};this.isVideo||(t.marginRight="10px"),o_(this.progress,t);const e=document.createElement("div");o_(e,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(e),o_(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),e.appendChild(this.currentProgress)}fadeHit(t){if(!this.info.fade)return;const{start:e,end:i}=this.info.fade;e&&!this.fadeState.in&&t>=0&&(this.fadeState.in=!0,this.media.fadeIn(0,e)),i&&!this.fadeState.out&&t>=this.duration-i/1e3&&(this.fadeState.out=!0,this.media.fadeOut(0,i))}changeBookmarkIndex(t,e){if(this.bookmarkList&&0!==this.bookmarkList.length){if(this.pickBookmarkIndex>0)for(let e=0;e<this.pickBookmarkIndex;e++)if(this.bookmarkList[e].time>t){this.pickBookmarkIndex=e;break}if(e){let e=this.pickBookmarkIndex-1;for(let i=0;i<this.bookmarkList.length;i++)this.bookmarkList[i].time<t&&(e=i);for(let t=this.pickBookmarkIndex;t<=e;t++){const e=this.bookmarkList[t];e&&this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${e.name}`)}this.pickBookmarkIndex=e+1}}}playMediaFromCtrl(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent play event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.playMedia(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(jy.mediaPlay,{id:this.targetId,time:this.media.currentTime-this.start,_stateOnly:t}))}pauseMediaFromCtrl(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Media controller prevent pause event with paused state",this.ctx.taskId):("interactive"!==this.ctx.mode&&this.pauseMedia(),"local"===this.ctx.mode||this.ctx.isRendering||this.ctx.eventHub.emit(jy.mediaPause,{id:this.targetId,time:this.media.currentTime-this.start,_stateOnly:t}))}setControllerPosition(){var t;const{target:e}=this,{portalWidth:i,portalHeight:n}=s_,{stageWidth:r,stageHeight:o}=this.ctx,s=e.getGlobalPosition(),a=Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale")),l=r*a,h=1/a*(i>l?l/i:1);s.y=s.y+this.height-n,s.x=Math.max(s.x,0),s.x=Math.min(s.x,r-i*h),s.y=Math.max(s.y,0),s.y=Math.min(s.y,o-n),o_(this.mediaController,{height:n+"px",borderRadius:n/2+"px",width:i+"px",flexDirection:"row",alignItems:"center",position:"absolute",left:s.x+"px",top:s.y+"px",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${h})`,transformOrigin:"0 100%"}),this.fullscreenStatus&&o_(this.mediaController,{left:"0",top:o-n+"px"})}createMediaController(){this.setControllerPosition(),o_(this.mediaController,{display:"none",transition:`opacity ${s_.opacityAnimationTime}s`}),this.createButton();const t=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,t,this.progress),this.isVideo&&this.mediaController.append(this.fullScreenButton,this.exitFullScreenButton),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(t){this.playCallBackList.push(t)}fullscreenPlay(){this.fullscreenStatus=!0,"interactive"!==this.ctx.mode&&this.media.requestFullscreen(),"local"!==this.ctx.mode&&this.ctx.eventHub.emit(jy.fullscreenChange,{targetId:this.targetId,state:!0}),this.delayHide()}changeFullScreenState(t,e,i){i===this.ctx.slideIndex&&(t&&this.targetId===e?this.fullscreenStatus=t:this.fullscreenStatus=!1,this.fullscreenStatus?(this.fullScreenButton.style.display="none",this.exitFullScreenButton.style.display="block"):(this.fullScreenButton.style.display="block",this.exitFullScreenButton.style.display="none"),this.setControllerPosition())}bindEvent(){n_.isDesktop()&&(this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.mediaController.addEventListener("mouseover",this.showController,!1)),this.progress.addEventListener("click",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this._playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this._pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1),this.containerObserver=new MutationObserver(this.onContainerSizeChange),this.container&&this.containerObserver.observe(this.container,{attributes:!0,attributeFilter:["data-scale","style"]}),this.isVideo&&(this.ctx.globalEventHub.on("onFullscreenChange",this.onFullScreenChange),this.ctx.globalEventHub.on("controllerShowStatusChange",this.onControllerShowStatusChange),this.fullScreenButton.addEventListener("click",this.onClickFullScreenButtonHandle,!1),this.exitFullScreenButton.addEventListener("click",this.onClickCancelFullScreenButtonHandle,!1))}unbindEvent(){var t;n_.isDesktop()&&(this.mediaController.removeEventListener("mouseout",this.onMouseOut,!1),this.mediaController.removeEventListener("mouseover",this.showController,!1)),this.progress.removeEventListener("click",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",this._playMediaFromCtrl,!1),this.pauseButton.removeEventListener("click",this._pauseMediaFromCtrl,!1),this.media.removeAllListeners(),null===(t=this.containerObserver)||void 0===t||t.disconnect(),this.isVideo&&(this.ctx.globalEventHub.removeListener("onFullscreenChange",this.onFullScreenChange),this.ctx.globalEventHub.removeListener("controllerShowStatusChange",this.onControllerShowStatusChange),this.fullScreenButton.removeEventListener("click",this.onClickFullScreenButtonHandle,!1),this.exitFullScreenButton.removeEventListener("click",this.onClickCancelFullScreenButtonHandle,!1))}show(){this.setControllerPosition(),this.mediaController.style.opacity=s_.hoverOpacity,this.fullscreenStatus||(this.mediaController.style.display="flex"),this.delayHide()}hide(){this.fullscreenStatus?this.mediaController.style.opacity=s_.hiddenOpacity:this.mediaController.style.display="none"}delayHide(){clearTimeout(this.autoHiddenTimer),this.autoHiddenTimer=setTimeout(()=>{this.hide()},s_.hoverHiddeDelay)}destroy(){var t;this.unbindEvent(),this.playCallBackList=[],null===(t=this.container)||void 0===t||t.removeChild(this.mediaController)}}var l_=i(120);class h_ extends Za.a{constructor(t,e,i){var n,r;super(),this.isGlobalPause=!1,this.lastTime=-1,this.howl=null,this.rctClient=null,this.isHowlEnd=!1,this.isHowlLoadEmit=!1,this.staticEventId=1001,this._catParams=void 0,this.url=t,this.runningAudio=e,i&&(this._catParams=i),zy.RtcAudioClazz?(this.rctClient=new zy.RtcAudioClazz(t,null===(n=this._catParams)||void 0===n?void 0:n.start,null===(r=this._catParams)||void 0===r?void 0:r.end),console.log("rctClient",this.rctClient),this.rctClient.on("load",()=>this.emit("load")),this.rctClient.on("pause",()=>this.emit("pause")),this.rctClient.on("play",()=>{this.startTimeChangeEmit(),this.emit("play")}),this.rctClient.on("resumeAllAudioInterruptByAudioSessionChanged",()=>{this.emit("resumeAllAudioInterruptByAudioSessionChanged")})):(this.howl=new l_.Howl({src:[t]}),[this.staticEventId]=this.howl._getSoundIds(),this.howl.load(),this.howl.on("load",()=>{this.isHowlLoadEmit=!0,this.emit("load")}),this.howl.on("pause",()=>this.emit("pause")),this.howl.on("play",()=>{this.isHowlLoadEmit||this.emit("load"),this.isHowlEnd=!1,this.startTimeChangeEmit(),this.emit("play")}),this.howl.on("end",()=>{this.isHowlEnd=!0}))}startTimeChangeEmit(){this.currentTime!==this.lastTime&&(this.lastTime=this.currentTime,this.emit("timeupdate",this.lastTime)),this.isPaused||setTimeout(()=>{this.isPaused||this.startTimeChangeEmit()},300)}play(){var t,e,i;this.runningAudio.has(this.url)&&(null===(t=this.runningAudio.get(this.url))||void 0===t||t.stop(),this.runningAudio.delete(this.url)),this.isHowlEnd=!1,this.lastTime=-1,null===(e=this.howl)||void 0===e||e.play(this.staticEventId),null===(i=this.rctClient)||void 0===i||i.play(),this.runningAudio.set(this.url,this)}fade(t,e,i){this.howl&&this.howl.fade(t,e,i)}pause(){var t,e;null===(t=this.howl)||void 0===t||t.pause(this.staticEventId),null===(e=this.rctClient)||void 0===e||e.pause(),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}globalPause(){this.isPaused||(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}stop(){var t;null===(t=this.howl)||void 0===t||t.pause(this.staticEventId),this.rctClient&&(this.rctClient.pause(),this.rctClient.currentTime=0,setTimeout(()=>{var t;console.log("current time: "+(null===(t=this.rctClient)||void 0===t?void 0:t.currentTime))})),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}destroy(){var t,e,i,n,r,o,s,a;null===(t=this.howl)||void 0===t||t.stop(this.staticEventId),null===(e=this.howl)||void 0===e||e.unload(),null===(i=this.rctClient)||void 0===i||i.pause(),null===(n=this.rctClient)||void 0===n||n.destroy(),null===(r=this.rctClient)||void 0===r||r.removeAllListeners("load"),null===(o=this.rctClient)||void 0===o||o.removeAllListeners("play"),null===(s=this.rctClient)||void 0===s||s.removeAllListeners("pause"),null===(a=this.rctClient)||void 0===a||a.removeAllListeners("resumeAllAudioInterruptByAudioSessionChanged"),this.runningAudio.has(this.url)&&this.runningAudio.delete(this.url)}get currentTime(){return this.rctClient?this.rctClient.currentTime:this.howl?this.howl.seek(this.staticEventId):-1}set currentTime(t){this.rctClient?this.rctClient.currentTime=t:this.howl&&this.howl.seek(t,this.staticEventId)}get duration(){return this.rctClient?this.rctClient.duration:this.howl?this.howl.duration(this.staticEventId):0}get isPaused(){return this.rctClient?this.rctClient.isPaused:!!this.howl&&!this.howl.playing(this.staticEventId)}volume(t){this.rctClient?this.rctClient.volume(t):this.howl&&this.howl.volume(t)}}var u_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class c_ extends Za.a{constructor(t){var e,i,n,r,o,s,a;super(),this.type="video",this.sprite=new ep,this.isPlaying=!1,this.isGlobalPause=!1,this.fullscreen=!1,this.url="",this.isLoaded=!1,this.onVideoResourceLoaded=()=>{this.isLoaded=!0},this.onVideoStalled=()=>{this.ctx.logger.warn(this.url+", Failed to fetch data, but trying.",this.ctx.taskId)},this.updateVolume=t=>{this.rtcAudio.volume(t)},this.syncFullscreenVideoState=t=>{const{targetId:e,state:i,slideIndex:n}=t;n===this.ctx.slideIndex&&e===this.id&&(i?(this.requestFullscreen(),this.ctx.latestChangeFullscreenTargetId=e):this.requestCancelFullscreen())},this.id=t.id,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(i=t.video.cut)||void 0===i?void 0:i.end,this.fullscreen=null!==(n=t.video.fullscreen)&&void 0!==n&&n,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this;const l=t.video.src;this.videoResource=new Vh.w(l,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0}),null===(r=this.videoElement)||void 0===r||r.addEventListener("stalled",this.onVideoStalled),null===(o=this.videoElement)||void 0===o||o.addEventListener("loadedmetadata",this.onVideoResourceLoaded),this.url=t.video.src;let h=t.video.src.replace(/4$/,"3");this.ctx.loaderDelegate&&(h=this.ctx.loaderDelegate.redirectMedia(h),this.ctx.logger.info(`redirect media url from ${t.video.src.replace(/4$/,"3")} to ${h} by delegate.`,t.ctx.taskId)),this.rtcAudio=new h_(h,t.ctx.runningAudio,{start:null===(s=t.video.cut)||void 0===s?void 0:s.start,end:null===(a=t.video.cut)||void 0===a?void 0:a.end}),this.rtcAudio.on("timeupdate",t=>{if(this.videoElement){const e=this.videoElement.currentTime;Math.abs(e-t)>.5&&this.videoElement.fastSeek(t)}}),this.rtcAudio.on("resumeAllAudioInterruptByAudioSessionChanged",()=>{var t;null===(t=this.videoElement)||void 0===t||t.pause(),setTimeout(()=>{var t;this.rtcAudio.isPaused||null===(t=this.videoElement)||void 0===t||t.play()},200)});const{video:u,width:c,height:d,target:p}=t;this.controller=new a_({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,width:c,height:d,target:p,media:this,info:u,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=c,this.sprite.height=d,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const f=new Vh.c(null,{height:d,width:c});f.resource=this.videoResource,this.videoResource.bind(f),this.sprite=new ep,this.sprite.visible=!1,this.sprite.texture=new Vh.t(f),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",t=>{t.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",t=>{t.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(t=>{var e;null===(e=this.videoElement)||void 0===e||e.addEventListener(t,()=>{"timeupdate"===t&&this.isPlaying,this.emit(t)})}),this.ctx.activeMedia.add(this),this.ctx.volumeAdjuster.on("update",this.updateVolume),this.ctx.globalEventHub.on("syncFullscreenVideoState",this.syncFullscreenVideoState)}get videoElement(){return this.videoResource.source}get currentTime(){var t,e;return null!==(e=null===(t=this.videoElement)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}set currentTime(t){this.rtcAudio.currentTime=t,this.videoElement&&(this.videoElement.currentTime=t)}get paused(){var t,e;return null===(e=null===(t=this.videoElement)||void 0===t?void 0:t.paused)||void 0===e||e}get duration(){var t,e;return null!==(e=null===(t=this.videoElement)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}get clippedDuration(){return this.controller.clippedDuration}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return u_(this,void 0,void 0,(function*(){this.isPlaying=!0,this.updateVolume(this.ctx.volumeAdjuster.volume),yield this.load(),yield this.ctx.clock.waitUntil(()=>{const t=this.videoElement;return!!(t&&t.videoWidth>0)},3e3);const t=this.videoElement;t&&t.videoWidth<=0||(this.videoElement&&(this.videoElement.volume=0,this.videoElement.muted=!0),this.rtcAudio.on("play",()=>{var t;null===(t=this.videoElement)||void 0===t||t.play(),this.fullscreen&&this.controller.fullscreenPlay()}),this.rtcAudio.play())}))}load(){return this.videoResource.load()}pause(){this.isPlaying=!1,this.ctx.logger.warn(this.url+", pause video manual.",this.ctx.taskId),this.ctx.logger.warn(this.url+", pause rtc audio manual.",this.ctx.taskId),this.rtcAudio.on("pause",()=>{var t;null===(t=this.videoElement)||void 0===t||t.pause()}),this.rtcAudio.pause()}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause(),this.ctx.eventHub.emit(jy.mediaStop,{id:this.id})}requestFullscreen(){return u_(this,void 0,void 0,(function*(){yield Pm(()=>this.isLoaded,5e3);const t=new Vh.t(this.sprite.texture.baseTexture);this.ctx.globalEventHub.emit("requestFullscreen",{texture:t,index:this.ctx.slideIndex,targetId:this.id})}))}requestCancelFullscreen(){this.ctx.globalEventHub.emit("requestCancelFullscreen",{targetId:this.id,index:this.ctx.slideIndex})}destroy(){var t,e,i;this.ctx.volumeAdjuster.removeListener("update",this.updateVolume),this.ctx.globalEventHub.removeListener("syncFullscreenVideoState",this.syncFullscreenVideoState),null===(t=this.videoElement)||void 0===t||t.removeEventListener("stalled",this.onVideoStalled),null===(e=this.videoElement)||void 0===e||e.removeEventListener("loadedmetadata",this.onVideoResourceLoaded),this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(i=this.videoResource)||void 0===i||i.destroy(),this.rtcAudio.destroy(),this.stop(),this.controller.destroy(),this.ctx.activeMedia.delete(this)}fadeIn(t,e){this.rtcAudio.fade(t,this.ctx.volumeAdjuster.volume,e)}fadeOut(t,e){this.rtcAudio.fade(this.ctx.volumeAdjuster.volume,t,e)}}var d_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class p_ extends Za.a{constructor(t){var e,i;super(),this.type="audio",this.isPlaying=!1,this.isGlobalPause=!1,this.updateVolume=t=>{this.audioPlayer.volume(t)},this.id=t.id;const n=t.audio.src;this.audioPlayer=new h_(n,t.ctx.runningAudio,{start:null===(e=t.audio.cut)||void 0===e?void 0:e.start,end:null===(i=t.audio.cut)||void 0===i?void 0:i.end}),t.audio.cut&&(this.start=t.audio.cut.start,this.end=t.audio.cut.end),this.ctx=t.ctx,this.ctx.medias[this.id]=this;const{width:r,height:o,target:s}=t;this.controller=new a_({targetId:t.id,shapeId:t.shapeId,ctx:t.ctx,height:o,width:r,target:s,media:this,info:t.audio,canvasElement:t.canvasElement}),this.audioPlayer.on("load",()=>this.emit("durationchange")),this.audioPlayer.on("timeupdate",()=>this.emit("timeupdate")),this.audioPlayer.on("pause",()=>this.emit("pause")),this.audioPlayer.on("play",()=>this.emit("play")),this.ctx.activeMedia.add(this),this.ctx.volumeAdjuster.on("update",this.updateVolume)}get currentTime(){return this.audioPlayer.currentTime}set currentTime(t){this.audioPlayer.currentTime=t}get clippedDuration(){return this.controller.clippedDuration}get paused(){return this.audioPlayer.isPaused}get isPaused(){return this.audioPlayer.isPaused}get duration(){return this.audioPlayer.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return d_(this,void 0,void 0,(function*(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent play event with paused state",this.ctx.taskId):(this.updateVolume(this.ctx.volumeAdjuster.volume),this.isPlaying=!0,this.audioPlayer.play())}))}pause(){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent pause event with paused state",this.ctx.taskId):(this.isPlaying=!1,this.audioPlayer.pause())}globalPause(){this.isPlaying&&(this.isGlobalPause=!0,this.pause())}globalResume(){this.isGlobalPause&&(this.isGlobalPause=!1,this.play())}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.ctx.isPlayerPaused()?this.ctx.logger.info("Audio player prevent seek event with paused state",this.ctx.taskId):this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause(),this.ctx.eventHub.emit(jy.mediaStop,{id:this.id})}requestFullscreen(){}requestCancelFullscreen(){}destroy(){this.ctx.volumeAdjuster.removeListener("update",this.updateVolume),this.stop(),this.controller.destroy(),this.ctx.activeMedia.delete(this),this.audioPlayer.destroy()}fadeIn(t,e){this.audioPlayer.fade(t,this.ctx.volumeAdjuster.volume,e)}fadeOut(t,e){this.audioPlayer.fade(this.ctx.volumeAdjuster.volume,t,e)}}var f_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class m_ extends Kv{constructor(t,e,i){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0,isPicture:!0}),e,i),this.isInteractiveOutside=!1,this.cmd=new eg(this),this.media=null==t?void 0:t.media,this.container.name=t.id+"_container_[Picture]",this.renderContainer.name=t.id+"_render_container_[Picture]",this.picFill=new av(this.ctx,t.picFill,t.width,t.height,{useFilter:!0,useSlideBackgroundFill:!1})}applyCommand(t,e){var i,n,r,o;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),r=Number(e[1]||"0");null===(i=this.mediaPlayer)||void 0===i||i.controller.playMediaFromCtrl(!0),Math.abs(r)>.1&&(null===(n=this.mediaPlayer)||void 0===n||n.controller.jumpToTime(r))}else"custom-pause"===t?null===(r=this.mediaPlayer)||void 0===r||r.controller.pauseMediaFromCtrl(!0):"togglePause"===t?this.mediaPlayer&&(this.mediaPlayer.isPlaying?this.mediaPlayer.controller.pauseMediaFromCtrl(!0):this.mediaPlayer.controller.playMediaFromCtrl(!0)):"stop"===t&&(null===(o=this.mediaPlayer)||void 0===o||o.stop())}renderPic(){var t,e,i,n,r,o;return f_(this,void 0,void 0,(function*(){const{displayObject:s}=this.picFill;if(s){s.name=this.json.id+"_pic_fill_[Picture]";const a=null===(t=this.backgroundGraphics)||void 0===t?void 0:t.getClonedDisplayObject();if((null===(e=this.backgroundGraphics)||void 0===e?void 0:e.isNeedMask(s.width,s.height))&&a&&(s.mask=a,this.effectContainer.addChild(a)),s.width=this.designWidth,s.height=this.designHeight,s instanceof im&&this.ctx.slideScopeEventHub.once("slide-render",t=>{var e;this.ctx.slideIndex===t&&(null===(e=this.effectObject)||void 0===e||e.setFrameCount(s.totalFrames),s.play(),s.onFrameChange=t=>{if(this.effectObject)if(this.effectObject.hasFrame(t))this.effectObject.updateFrame(t);else{const e=this.getEffectTexture();e&&(this.effectObject.createFrame(t,e.texture),this.effectObject.setFrameOffset(e.offsetX,e.offsetY))}})}),this.effectContainer.addChild(s),this.media){let t=this.media.src;if("audio"===this.media.type&&/mp4$/.test(t)&&(t=t.replace(/mp4$/,"mp3")),this.ctx.urlInterrupter){const e=Date.now();t=yield this.ctx.urlInterrupter(t),this.ctx.logger.info("redirect media url by interrupter. time: "+(Date.now()-e),this.ctx.taskId)}this.ctx.loaderDelegate&&(t=this.ctx.loaderDelegate.redirectMedia(t),this.ctx.logger.info(`redirect media url to ${t} by delegate.`,this.ctx.taskId)),this.media.src=t}if("video"===(null===(i=this.media)||void 0===i?void 0:i.type)&&this.media.src){if(this.mediaPlayer=new c_({id:this.json.id+"-video",shapeId:this.json.id,ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,target:s,container:this.effectContainer,canvasElement:this.ctx.view}),(null===(n=this.mediaPlayer)||void 0===n?void 0:n.sprite)&&a){const t=null===(r=this.backgroundGraphics)||void 0===r?void 0:r.getClonedDisplayObject();t&&(this.mediaPlayer.sprite.mask=t,this.container.addChild(t))}}else"audio"===(null===(o=this.media)||void 0===o?void 0:o.type)&&this.media.src&&(this.mediaPlayer=new p_({id:this.json.id+"-audio",shapeId:this.json.id,ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,target:s,canvasElement:this.ctx.view,fade:this.media.fade}));this.mediaPlayer&&(this.isInteractiveOutside=!!this.container.interactive,this.container.interactive=!0,n_.isDesktop()?(this.container.on("mouseover",()=>{this.mediaPlayer.showController()}),this.container.on("mouseout",()=>{this.mediaPlayer.hideController()},!1)):this.container.on("pointerdown",()=>{this.mediaPlayer.showController()}))}}))}preRender(t){super.preRender(t)}subClassRender(){return f_(this,void 0,void 0,(function*(){yield this.renderPic()}))}clearOnSlideChange(){super.clearOnSlideChange(),this.mediaPlayer&&(this.container.interactive=!1,this.mediaPlayer.stop(),this.mediaPlayer.hideController())}initOnReuse(){super.initOnReuse(),this.mediaPlayer&&(this.container.interactive=!0)}destroy(){this.mediaPlayer&&(this.picFill.displayObject&&!this.isInteractiveOutside&&(this.container.interactive=!1),this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picFill.destroy()}}var g_=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class v_ extends hg{constructor(t,e,i,n){super(t,e,i),this.children=[],this.cacheSprite=new ep,this.cacheContainer=new Oh.b,this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i.groupFillStyle&&(this.json.fillStyle=i.groupFillStyle),this.container.name=t.id+"_container_[Container]",this.cacheContainer.name=t.id+"_cache_container_[Container]",this.ctx.timingTargets.addTarget(t.id,this),this.updateTransform(this.json),this.fillObject=new av(this.ctx,t.fillStyle,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1}),this.createChildren(n)}createChildren(t){var e,i,n,r;const o={x:null!==(i=null===(e=this.json.position)||void 0===e?void 0:e.x)&&void 0!==i?i:0,y:null!==(r=null===(n=this.json.position)||void 0===n?void 0:n.y)&&void 0!==r?r:0};for(let e=0,i=this.json.children.length;e<i;e++)t.addSubMTask(()=>g_(this,void 0,void 0,(function*(){let i=this.json.children[e],n=null;if(!(!this.ctx.featureList||!this.ctx.featureList.smartArt)&&("Shape"===(null==i?void 0:i.type)||"Picture"===(null==i?void 0:i.type))&&this.ctx.smartArtShapeList){const{id:t}=i,e=this.ctx.smartArtShapeList.find(e=>e.id===t);e&&(i=e)}const r={parentGlobalPos:o,groupFillStyle:this.json.fillStyle,groupSize:{w:this.json.width,h:this.json.height}};"Shape"===(null==i?void 0:i.type)?n=new Kv(i,this.ctx,r):"Picture"===(null==i?void 0:i.type)?n=new m_(i,this.ctx,r):"Container"===(null==i?void 0:i.type)&&(n=new v_(i,this.ctx,r,t)),n&&this.children.push(n)})),"@ContainerImpl[child.init]")}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(t){for(const e of this.children)t.addSubMTask(()=>g_(this,void 0,void 0,(function*(){e.preRender(t)})),"@ContainerImpl[child.preRender]")}getBgElement(){return null}getIterateEntry(t,e,i){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",i),null)}getTextElement(){return null}render(t){for(const e of this.children)e.render(t),t.addSubMTask(()=>g_(this,void 0,void 0,(function*(){this.cacheContainer.addChild(e.renderContainer)})),"@ContainerImpl[child.render]");t.addSubMTask(()=>g_(this,void 0,void 0,(function*(){this.container.addChild(this.cacheContainer)})),"@ContainerImpl[child.append]")}clearOnSlideChange(){this.children.forEach(t=>t.clearOnSlideChange())}initOnReuse(){this.children.forEach(t=>t.initOnReuse())}isChildrenInteractive(){for(const t of this.json.children)if("Container"===(null==t?void 0:t.type)||"Stage"===(null==t?void 0:t.type)||(null==t?void 0:t.hlinkHover)||(null==t?void 0:t.hlinkClick))return!0;return!1}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.cacheContainer.destroy({children:!0,texture:!0,baseTexture:!0})}}class __ extends Za.a{constructor(t,e,i,n){super(),this.cond={},this.timeoutIds=[],this.condHandle=(t,e={})=>{if(t)if(t.delay&&t.delay>0){const i=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger(e))},t.delay);this.timeoutIds.push(i)}else this.cond[t.event]=!0,this.detectTrigger(e);else this.detectTrigger(e)},this.id=t,this.ctx=n,this.eventHubs=i,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=(...e)=>{this.condHandle(t,e)};t.event&&(/^shape/.test(t.event)||/^time/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.global.addListener(t.event,e)):/^runtime/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):/^self/.test(t.event)?t.delay&&t.delay>0&&(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):this.cond[t.event]=!1)}isTrigger(){return Object.keys(this.cond).every(t=>!!this.cond[t])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(t=>"self"!==t).every(t=>!!this.cond[t])}detectTrigger(t){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const e=this.triggerParams;this.triggerParams=void 0,this.emit("active",e,t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class y_ extends Za.a{constructor(t){super(),this.isTimeNodeEndSync=!1,this.interactiveListeners=[],this.runtimeNodeEventHub=new Za.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=(t=!1)=>{var e,i,n,r,o,s;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.seekToStart(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToStart(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.seekToStart(),null===(s=this.commonTimeNode.children[this.currentSeqIndex])||void 0===s||s.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide",t)},this.handleNext=(t,e)=>{var i,n,r,o;if(this.isTimeNodeEndSync&&(this.isTimeNodeEndSync=!1,this.currentSeqState="idle",this.currentSeqIndex=0),!this.hasNext()&&this.isMainSeq&&e)this.globalEventHub.emit("c:next slide",t);else{if(this.isInteractiveSeq){this.globalEventHub.emit("shape slide onNext"+(this.json.ctn.id||""));const t={result:null};this.findChildInfiniteRepeat(this.commonTimeNode,t),1===this.commonTimeNode.children.length&&t.result&&(t.result.json.subTnLst||[]).length>0&&0===this.currentSeqIndex&&"running"===this.currentSeqState&&this.commonTimeNode.allChildrenEndHandle()}"idle"===this.currentSeqState?null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.startTimeNodeForce()):"end"===this.currentSeqState&&(this.incrSeqIndex(),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.startTimeNodeForce())}};const{json:e,iterateType:i,isIterate:n,isSub:r,parent:o,ctx:s,eventHub:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=n,this.json=e,this.ctx=s,this.globalEventHub=a,this.commonTimeNode=new by({json:e.ctn,isSub:r,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:i,iterateIndex:l,iterateId:h,isInInteractiveSeq:u||this.isInteractiveSeq,fromSeqId:this.isInteractiveSeq?this.json.ctn.id:""}),this.bindShapeEvent(),this.nextConds=new __("mainSeq",e.nextCondLst,{global:a,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new __("mainSeq",e.preCondLst,{global:a,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(jy.mainSeqStepStart,e)}),this.commonTimeNode.on("childTimeNodeEnd",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext(!1,!0)}),this.isMainSeq&&this.ctx.eventHub.emit(jy.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.isTimeNodeEndSync=!0,this.commonTimeNode.resetForRepeat()}),this.commonTimeNode.on("timeNodeDestroy",()=>{this.interactiveListeners.forEach(([t,e])=>{t&&e&&t.interactiveContainer.removeListener("pointerdown",e)}),this.interactiveListeners=[]}),this.nextConds.on("active",(t,e)=>{Array.isArray(e)?this.handleNext(e[0],e[1]):this.handleNext(e,!0)}),this.prevConds.on("active",(t,e)=>{Array.isArray(e)?this.handlePrev(e[0]):this.handlePrev(e)})}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit(jy.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(jy.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:t,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(t){this._currentSeqState=t,this.isMainSeq?this.ctx.eventHub.emit(jy.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(jy.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:t}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&"idle"===this.currentSeqState)}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&"end"===this.currentSeqState)}findChildInfiniteRepeat(t,e){t.isInfiniteRepeat()?e.result=t:t.children.map(t=>t.commonTimeNode).forEach(t=>this.findChildInfiniteRepeat(t,e))}bindShapeEvent(){"interactiveSeq"===this.json.ctn.nodeType&&this.json.nextCondLst.forEach(t=>{if(/^shape/.test(t.event)){const e=t.event.split(" ")[1];if(e){const t=this.ctx.timingTargets.getTargetById(e);if(t){t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer";const i=()=>{this.ctx.eventHub.emit(jy.userInput);const t=`shape ${e} onClick`,{mode:i}=this.ctx;"interactive"!==i&&"sync"!==i||this.ctx.eventHub.emit(jy.interactiveSeqAction,{action:t,seqId:this.json.ctn.id}),"sync"!==i&&"local"!==i||this.globalEventHub.emit(t)};t.interactiveContainer.on("pointerdown",i),this.interactiveListeners.push([t,i])}}}})}setCurrentStep(t,e){const{length:i}=this.commonTimeNode.children;if(t>i)return;this.isInteractiveSeq&&0===this.commonTimeNode.applyCount&&(this.commonTimeNode.applyCount=1);let n=t;if(this.commonTimeNode.seekToStart(),-1===n&&(n=i-1),0!==n||"start"!==e){if(n>=0&&n<i)for(let t=0;t<=n;t++){const i=this.commonTimeNode.children[t];t!==n?i.commonTimeNode.seekToEnd(!1,!0):"start"===e?i.commonTimeNode.seekToStart():"end"===e&&i.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=n,this.currentSeqState="start"===e?"idle":"end"}}}function x_(t,e,i){const n=e.split(".");n.reduce((r,o,s)=>{if(r)return s!==n.length-1?r[o]:void(r[o]=i);console.warn(`${t} not support ${e}`)},t)}function b_(t,e){if(!e)return null;return e.split(".").reduce((i,n)=>{if(i)return i[n];console.warn(`${t} not support ${e}`)},t)}class T_{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new Za.a,this.basicOnTimeNodeEnd=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr,e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.removeRunningTimeNode(e,this.modifyAttrKey)}},this.basicOnTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){const e=this.getTargetId(t);this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:i,json:n,ctx:r,parent:o,eventHub:s,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}=t;this.json=n,this.id=n.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=s,this.commonTimeNode=new by({json:n.cBhvr.ctn,isSub:i,eventHubs:{global:s,runtime:this.runtimeNodeEventHub},ctx:r,parent:o,isIterate:e,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}),this.timingTarget=this.ctx.timingTargets.getTarget(n.cBhvr.target,e,{type:a,index:l,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.basicOnTimeLineStart),this.commonTimeNode.on("timeNodeEnd",this.basicOnTimeNodeEnd)}getTargetId(t){let e=t.id;return"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),e}}class E_ extends T_{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=b_(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&x_(this.timingTarget,t,this.startVal)},this.onSeekToEnd=()=>{const t=this.json.cBhvr.attrList[0],e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&x_(this.timingTarget,t,e)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:t,delta:e})=>{if(e/t>=1){const t=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&x_(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}var S_=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};class w_{constructor(t,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:t=>t/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:t=>t/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=t.val.value,this.time=t.time,t.fmla&&(this.fmla=this.parseFmla(t.fmla))}parseFmla(t){let e=t.replace(/#ppt_h/g,`(${this.timingTarget.design_ppt_h})`);return e=e.replace(/#ppt_w/g,`(${this.timingTarget.design_ppt_w})`),e=e.replace(/#ppt_x/g,`(${this.timingTarget.design_ppt_x})`),e=e.replace(/#ppt_y/g,`(${this.timingTarget.design_ppt_y})`),e=e.replace(/ppt_w/g,"vars.ppt_w"),e=e.replace(/ppt_h/g,"vars.ppt_h"),e=e.replace(/ppt_x/g,"vars.ppt_x"),e=e.replace(/ppt_y/g,"vars.ppt_y"),e=e.replace(/#/g,"vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(t=>{const i=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(i,(e,i,n)=>`${i}math.${t}${n}`)}),new Function("vars","math","$","return "+e)}}class A_ extends w_{constructor(t,e,i){super(t,e),this.value=t.val.value,i&&(this.fmla=this.parseFmla(i))}resolveValue(){return this.value}interpolationFrom(t,e,i){const n=t.resolveValue(i),r=n+(this.resolveValue()-n)*e;return t.fmla?t.fmla(i,this.math,r):r}}S_([Em()],A_.prototype,"interpolationFrom",null);class M_ extends w_{constructor(t,e){var i;super(t,e),this.value=null===(i=t.val)||void 0===i?void 0:i.value}interpolationFrom(t,e,i){let n=t.resolveValue(i);return e>this.time&&(n=this.resolveValue()),n}resolveValue(){return this.value||""}}S_([Em()],M_.prototype,"interpolationFrom",null);class C_ extends w_{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,i){const n=t.resolveValue(i),r=n+(this.resolveValue(i)-n)*e;return t.fmla?t.fmla(i,this.math,r):r}}S_([Em()],C_.prototype,"interpolationFrom",null);class R_ extends w_{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return vg(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}S_([Em()],R_.prototype,"interpolationFrom",null);class I_ extends T_{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=b_(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,i,n;(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(n=this.timingTarget)||void 0===n?void 0:n.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t,n=this.keyFrames.findIndex(t=>i<=t[0]),{attrList:r}=this.json.cBhvr;if(n<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&x_(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const o=n-1,s=this.keyFrames[n],a=this.keyFrames[o]||s,l=s[0]-a[0]==0?1:(i-a[0])/(s[0]-a[0]),h=s[1].interpolationFrom(a[1],l,this.vars);this.timingTarget&&r&&r[0]&&x_(this.timingTarget,r[0],h)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&x_(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var t;const{valueType:e}=this.json;if(this.json.tavLst.length<=0)if(this.json.to){if(this.json.from||this.startVal){const t={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if("num"===e&&this.timingTarget){const e=new C_(t,this.timingTarget);this.keyFrames.push([t.time,e])}}const t={time:1,val:{type:"string",value:this.json.to},fmla:""};if("num"===e&&this.timingTarget){const e=new C_(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const i={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new C_(i,this.timingTarget);this.keyFrames.push([i.time,t])}const n={time:1,val:{type:"string",value:((null===(t=i.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new C_(n,this.timingTarget);this.keyFrames.push([n.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let i=null;"string"===t.val.type?"num"===e?i=new C_(t,this.timingTarget):"str"===e&&(i=new M_(t,this.timingTarget)):"number"===t.val.type?i=new A_(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,i=new R_(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),i&&this.keyFrames.push([t.time,i])}}}class P_ extends Vh.k{constructor(t,e,i){super(t,e,i)}set percent(t){this.uniforms.percent=t}set transition(t){this.uniforms.transition=t}}var O_=i(121),N_=i.n(O_),L_=i(122),D_=i.n(L_);var F_=i(123),B_=i.n(F_);var U_=i(124),k_=i.n(U_),G_=i(9),H_=i.n(G_);var j_=i(125),z_=i.n(j_);var V_=i(126),X_=i.n(V_);const W_="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAr5QTFRFAAAATwAAOQAAZgAAKwAAPAAAPQAA7AAA/wAA/QAAugAA5QAAsQAAwQAAsAAAfwAAawAASQAAZAAAOAAAJwAALAAALQAAqQAAiwAAmgAA5AAA7QAAtQAAhQAALwAAfAAAXwAAYQAAigAAuQAAfgAAswAAcgAArQAAqgAAZwAAaQAAMgAAGAAAiAAAjwAA1gAA6QAA+wAA7wAA2AAAbQAA2gAA3QAAuwAA3wAA2QAAxQAA0QAAzwAA0gAAXQAAYAAADAAADwAAGQAALgAAjgAAcAAAzQAAwgAA+gAA3AAAGwAAoAAAowAAcQAAVwAA1QAAIQAAWQAA5wAAsgAAuAAASwAAbwAARwAAMAAAnAAAUQAAaAAA9wAA4gAAPwAAbAAAOwAAlwAA0wAAjQAAvAAAwwAAkwAAQQAAvgAAnwAAvQAA0AAA2wAAwAAAWwAATQAACwAABwAAQgAAtgAAgwAAvwAAgQAAlgAAEAAAxgAAtwAAmAAARgAAjAAAdwAAqwAArwAAywAAYgAACAAAmwAAHwAApQAA8QAAdAAAbgAAFgAAgAAAogAAewAAXgAA6AAA9gAA/AAAzgAA3gAAkgAAngAAdQAARAAAmQAATgAAUgAAJQAAIgAAqAAARQAAPgAAxwAACQAAAgAAMQAAiQAAhwAA4AAAUAAABQAAeQAAygAA9AAAFQAAVQAAyAAANQAA4wAAKAAAWAAAZQAApwAA4QAAyQAAXAAAkQAArAAAdgAApgAAHgAA8gAA/gAA6gAA8wAAFwAAHQAAhgAArgAAnQAANAAASAAA7gAAlQAAJgAA+AAA8AAANwAAJAAAHAAANgAAkAAAKQAAoQAAzAAABgAAFAAATAAAeAAAAQAADgAAggAA6wAAEQAAfQAAVAAA9QAAIAAADQAAEgAAVgAA5gAAQAAABAAA1wAA+QAAUHExBAAAJDlJREFUeJwlevk/lPv7/2XtOrKNsWcbzGCMJSmSpSxJZtQkjPEOg5mxRWns+xpZyr5ECGmcLIOsdVK2oyJbcVI0J8fp/Bff2+d7/+BhPO6Z1+u+ruf1XF4GAEAGZOXkFRQBTiD+dgKVTiqrqKqpq5M0ZMmaWtoAOrp6+qcMDMFIzdiEYmpmbqJBpVlYWtFJitYMG1sbFTskLvvTDmcQHM+ec3ImXp13uYCubvB/l7sHkC9eAk8jcy9Eb5/LvldQzQ+v+jsw1ZAlfwYDAK5dZ98IvIlBwXRNXVYIJ9TpLJUb9j9LvBVOj4jkRVGj/Y1i8AwiH09eEwhjMU4uXtsiAWLlqInMcLh+28okKRnuhNy945lic0+Uqu7NdErDdB/5DBo7MwuE4J+dw8jIzcsvwEIUFFGEisWQm1ACpcZlxF7vl1c8YMCJyqrqGio+fFRbVw8NjU2uec0isNWhVuq2XMPzmjcRBVHhSWCtXaPR2mZoybHzL0TUfmxPabeR6yg/+6QTY83VQNOkSwkbumsgkgzwtKe8tDdHYM7ts3sW1Q/Pn3PEWaGmYjoje+B3ewx9bM4V0LNfDB5XL3/o5v1hSBi5fzvQkQESOkQOwiiwI++5YBdkDjFIrKEx3cZK4Ti8eAlZpjcnYMSHKG0ygKKVeFSLRpOZNL9p19Ku1Q9enKlp45lZiQGr7hlWS17RKWp03mv8481cQnwBUNTAXwIUeAvsJwCCTnV4FyJC9CrKYDnOT91DpRZSG8Bsn7pAw2Ihd7Hn7R0hynXezjQcvQTyMGgUjV12kiW75XaR7Z9OK9kD0/j6ckfyk/fcPHCkvkz48NG/r3p4FeRpoQa9JA74sJAOcLubirEPqXqTpZ1hNzUN5exoNVbk5RmSOQqcJix5yWvvRZZ9nyay+tqAsb6U76oAwo3wgXvJkK6sCpOYQBTIdT6cg92rSxWh16pdV2c8NnDzfQhveqvND4k6aAB0ssWnHuL2yZQ7AHLzJTgUrreyZeWewhawpw1RMDWYHLP1OcNQgKzwlKVP5JV5crB7cZ+NRJ6AB3wx/x3RsEufEkozLu+g7+zkekfLbFQo8byEubp5ld7Ot2CQKxJ7qguZxF4SB3ozQF2pCEIbcaFxg6eAr0/MbeHb1DCK+vQCA3j4YTcwjNiWyEgcq1dRlfnXsq31K3hhhvNX/CYM0JC+asxk91d+7ahTr6AAaTAn3U2lTBfjIc1pr5VEX94yw8uIZhWQVAHQj66iLErxDLqNmN0wuO9hYf6FN+boQb1FjENYJAiWKrru2ejWzoZX6M9A91p2Sw1TTRT/rdDQsyiOT1f6br4fKm6Fpeb9qocNfvYOLPAuczuA5BTbeVT2O/ghlkYEScGHX0Df3StfyMT4iYHCTEQTLj04iWePVx6aomPYGLc08OXB+drJLqoq42/wXqB5eagtaqR+ZAPsymG8utBxt1rO8zFTPHITA50gCMQ4Gw7tQBZFo0DBsWb5ExlyKoBbvRAO7jdv6U8jMYne4Y+iWXmg53gvbNYsGg+gU3elEnaeXB/ufFUKJiyZdNZemo10NviBxr65KE1k/Rijg8KTan5647eoiJQAYPIL+9fuHPb/VSMucg/bcJHzKt557SPRYF8voq1+2SIWmSgQCZo2ZjhlymMigEZdZQ3MzX6wmmMTECwNWieLpWDlKihSZ2sVVwNX9AmecOXtMHP7C/WwPzvKbZqiJIYFZ7PuZngFJmNi9YatOLLQU77vGbS6PzGdsQVn/Ad7nQyALeZVbm01GA72t5bvR/aWTWVIIEVDwDJanzjqAc8QuFl4Yr9/2WTdPVPmHCtY7ZEZ4mJoDqURsbWcaHwtmIqJWrIXshpck5ilsHlYM34YFFXTG3dGzKrDMBxB8gsDn7G3bW/TDpe51ALDmy5KQW8lUgg4guspE7TN7wCTbFWnf7gBB16vuHtYoXsWo14j1cD9/Z+oyj5GF95jqI9KG0s6YtJ0N0jtISrVAZQcIO251QuKrBIaH7k2hLK/Mw8pyNmCnott3tGm6XjT9DsZUps7H8DCHwjc731hFRtTaF2UQ572Ca4Qp/On0RVdmFD0A219YL4DcFBN/lnfBvNr12E0W2MSZatepyNLVIbbFIg7jaYfoR/4W1VUKqL6zsF4NpNiq4orZEhCEjExd7AQ2j+B6GMOPmekeA7+DsM0IAsIqj31xrtAzvWqBsjmIWC6+uBONItM9R+HA8rGHxptX9JAF/G0L6QEiy3McdFEhp4+YNA0FHNwnW0/RFFEtwHRb/hwQsbzX/heYihsB6nNVJssfHnqQe/acYKMv8LqcRe7aEF7Y6ugtWxKLILeNmlzVF277PqxIg8dSxpo5gsaMBFxfgwvdWBhOvzOHHHzx4JUHLNpyc8LUzkLcfiIv3A2jQxpeQ1iL4IKUJ1dTmigtKLpgi6QjX2d8ISbHl1B8bH0UEbnI2DMVm5h4+6Ko+kTd3VVSVPGkpp4/p+BW7/faCjBhlD7MoDqRpcOJxz6lBe8gWYtBP80qaKf86k0FP9L1ziS+Y1m8MPaWpcD8BXkG2flILIvKvoC/hr8upkS1N2pwbQD5NtZmC6iNb2JUVJTRDoZxTXibAjQDp3w/y5Bhld8zynk7OU1S3S3LPnJLvjhzcfUaKeYeJwtkmPDDbYpWt0gTaf8e/gL32vUwV1i7lHVD65CN0n+CySLiHLZfbSx/XYollUUj09xeL/Cjqg2DUp2eM7igsEZPyXlnve63tfjYjZSbBwtUf7mlAhvX0N/CzxFIKE25lol9uEzuf4B95AK6EAVtXBSn3XGA6bVuISAxQuuFKTClSg4xz/VEivy43BYA1UY4x7aSd/i1RMdwdgzi68x0JEYIfLBbEMag6Kcur0R3WGGtXvT2744+WPE4QaWz1rrbq5fEmwQTMwOLPRNs2jAJiPTPpAjXA48lyGNDo/aEnNyEv39YQtTIKcLY2gVw/SWl2eGCgmvgRKcowIU96xWM6PvyJhk/4dRHbP4A2JaG+uq0xb1J15Gaa++VgngHKhh3L3grVzTsa95kyjw3wgZLYViuASK6smRQA8Ds39GAisCnrN+wiGik1BsIZfpFhk9aVvJNr+pUWJbSmxoOAqRzseBsHsCPJ+9EvFA6HLDuymPuB3VbLuUAeRzs5AnmhdV52drj6JdA/9JE6GEWqDZIrYYlrYCDM7hLcefRsAoFiZc4P3tYx5qFsH9ttFzAL0L/lgSwvjbS4Hlik7xGLuSVfejKzFhvtnHF3039B8VGq1UCpg4+cLt0KMDi46N3M5F9YWHiD/InKc21mDdj2pCGZNgqLihu2j14oFnH9dxycOd1FsVBZ+cMEBkuu0U7wwPJEfc9SWATH9MuG0EvfyJPxuf9enmuy3ipIOtB/Tq8fRSfpzQFs03/H+7yBgpxgsOgaPD69B90NfAH5SMhqmB4xns1ARtQlmao4VcBTRTDeuo6wPwzlIp/AQcGagk6KNOsPIQxV8P+wi/EIUDDVLWFGWvjTzIZnkLRH1UoJhWpXMTjPAjt3UAX17p6WGAJwxrWKi26AC0+gNR2jzhlwfEJrgvQCombOyaY8/bLwB9fMvueMLQvWNkBKGC0lq0Ht3KzP5jCcE4StVpESb3tdp2iHeZtLDMQ26rGa6n0GpULC4tIz4jBBxadsL3wHdFQPwahEAq1xR5rwJkcKwXQrx0f6F7awZw4fPbGa1gUiXJVpYOUgng1Il6/kdwHeGfQlS+PdZEZ/WbBBOmQjvC0LG6wpXRfApSSh5UP+GjCtGd2HwGkHtuvHkJDGvpqBlcXLXap5CKR9eJRzlgZ8W4zK891g7/yQl4SpDRz5B6E6FEUxFv8K/4i/p8Hn1DOZxLx2FQHi3X/cwgM0LCK+TZnTMszAMO3JUIXyO6zOQNiThG4OXOrwJNCE8XwV95JJ175KWLydZwJE882VhaOGyWMiSKcP771g4kaYKUFB2Dmz0JUdUk75Pplh8T7VBZwUY90zTpUDwWxIJNQ4p3+oSPgHVcJUQVskdpHklpVCunu2AMvq7HI2HuekbnizilxbZeVzVwQLUBT133fJUvswkKMu+OHgCDmIJX9+b8TDTiXIyTQUrXPXFm5NsIOF7X6snH0GkbLAqxPlJ9ecWoX5Ywy8Vl/GgAlgE21JAfp4T0F8NwItrDq/BXLuXDsET46eLTOOKK5svMyhZ3Ah1ePwHOvYdijiwWbAEJnbIP5V95SOcbXM43qIJm+5G32UABbhvaNNvRffVynh4jmDDQ3V+XtC1dHWnr5PFwd9Ds2UdVaIEHmECBo9V1OAz0w9Q7ZONc7xXtF+8+ETCmmX+G7+2+flmEDTEww2Dr5eQAbJggPltoLQ9vmismCRLQYIvSsXqDWOIS85DgRSlAhWjGdOxACJXNVdyGoSxA1lu2eETiYQrdn23iL9SxSRCa5LgEX0CruBRSxHIQWrdV/mq5qOUyNgs9QUYv+xsmlhwRichkxSqZko2RwH46USV7CUofNLnT23rewuaB+3Y+8g82zzjibgmdChhbQRFk34o/zPECaRHy7wKj5wlFDE8H30Jva81PwVlVT/UNLeH5C/T9cIDrBy3capubs5y2F7ATbAwpRvThn7BsaBvwbu0BBMDxHEtAsSE3DVOdF+kWWcXsfX3AFYeWSbrZP/TS/H80MGryotBYxj1U8rWXomZeevT+aQ0crFNLeulQLpiCr0J3rB5jTS3MR+wbSYRJirC2/5eEGCMHpzOUFWEplMsWaW0SVaCL8y8rZVI4hiy4qyEC7CW0YwNHTGLxvJ2vW6GNMctZQNF8YFxN+y/di6ENOZNtphmlCkIZsU3uvDqzlidm8vQCrkUfzYk6D4AYr6tk+mccy/i8xBKFQzibM/wWTIysZ6cDt/XhySBb1niUMBJRN+ILdWbj7Z6dnUgLZELPYXWeyXNhzV48NvUbAWzWEC0lD8PwVIGTt6rveS3h3gX3XiVRg1O5poRFvgPCL17nEx324dKJT5AC5OU7RFWXuEp0U1v+MRgY7mxikdoB4lle086YyXrr61aA8eVem+VOaY1TKn/sOxOeRhIcR4AZLNrygau7faIG/T/vTPO010Kbci6K9mAYPE3+D/Q/02VDHhOfPxxTud5MF+8KsrdY8Bw4TELjh26cdDiBfCo2ptEyDRsJrRk1KZcvgta3ckuK5CRPn7AxcptUHMpozoAU68b9ElVYL1uhaVz7RTJwRJ15W+0X8HZs7gUMi9wPAEik099Y6ilYhW7j1KNLmlFXlRwAb+NvU+PbN1AfHY1t+/sN4J1JVfn7FDYLloP1Scsg9GA3s2b6XMPgHYNbve6n3ghsmK0WGyzvNrCU7t0veADh7RGOKA7vXwYQc0uuPZMJMUQMLbBdz+2kFzkStJJNFEvH/f/cT1wnXJfsflkfnn+qJe89nGfU5c6Fpsd3vp8y31fD+eHg8uZSYXdwqcoBT9DS0aTRKoaZrdSqk0KtkFZb4+BBqXAnpKdyVLXBuP5clrK5wxSYyIWrghPCaNnLhJkp/A3x8fsMgMczROQeBhpGULvpU+ZNQqKLZQMr2c5uvEvEMHOemnBn5rN1M88Y+/TkhOxUIBP/2P2jr1+oIelfW2KEQFOnrjfGzrGWUsS6YsjIBTxTDwc64bw+fGhfW5AnvnpxLYAJDBm2lJ6rvaNZZMrsfTANYByHtYSbJahyNwhmaepqjdIPb+zS9jVAgfRHPZEjU1Gd3rhA/5cI2/I7HkyV/yE2rhd7VLRC+6h3nRnBwqHqGw2HNB46i9yPFIYrAbBjbP8Xiw3DuyzbyCf9d4TVDRcSKQussrgoejwBiAjYwZi0qcQK8KuYyotDvMBHuWgDgNhVUXyHsaOlkxmK4H0+NoRd5BhMX9v+E0DX3JzZF4fOt9EZhbDdj5dngkuAUBvofWKvSxgvWN/JXhGtuib/SxfY8KRQCXuP9M9m4RKN/YNl9WjkI76xL/vI3tkUW8UwNyBJ97wf3vZkr8zgZWjt09M51pPhhhhIa5n7iOjQUKxcVfAILZl0T4jc7FxaD1109JL9Ca0sSBbrEuNCQcFBiIv+SZSJPYe/1EYItPw54SrCk2fKxMmvjDJ19ORWT937dR9t2yrEWeJCbBTuaVFvARwhlXYkVrmPmMoeHL//5uHAvRj2Y8axOXO33AUsW/qXsBWn9CxkKIYN1C7xCb9tfTfE+3+m+utf4yM6L/i+ic02U8cQ2F98GKWj7KuD2pLDXkPCLCOzaCvJfwOemmSw+9kphfUY4yI+yj5/MmQxX+dJTNMaPNhkZY4Wbc3tEQKBn08wseAkoa6qqIQUIOD3kPmDGdgoM1ToC4KklkiDUBk4Uk/Fidp8zCJcFBMgHj+etTxbRFeHvwhf80CiSt3z3DIFYl6k1lWLVvRBn0lpMVKj6PITC0tar9jbVAPhHP8k4rhblOqCcOdqrAPy67Z1WL4TfMfVx0GLrHQJyH8iQUus8lkFKuv5kcYrNvW13YfKuZ89ORAmC15BmyKxBFilYKq8dxQRWdqGLLb8Rij6WrIs7/mxVyFptbrarK6uDO1v3yxzOWQjtaz2W/01pTvN/Omyfx8D2VGPK80olW8HfnliYW8J7UjIcIlewB+DJW6whrBEqHlPOAQ8W/xs1Hn5GmuasOM+K9M5T9RYI+PMwnvMsCTG6r+dbVXfMESA2YjneGLq0D1CQv4w2JrzNXBsshiH+QHHQa2Mr/AZ4I3FCYwSF30Bqgti3TOnZKmjAfxUANcv/0JqQQ2HHnOhMOwJodHns6/25Jg743Q1lQ+KbmEPuPq51Bt83snYTH17IxKtNv2roT2epeJDTPX4a0X9SZHNHJqSie0RtRDgKb5JGNRAJr4h2aypQVI68DWseD13hXjPfFQtgcpsWw3+bHWbYNMQ5bN4cjo9d8aBirB8/oJdnePZQoxNeCAZZbotwjOCA0wROeUdcuZjnmA4UdjXjcB5b5xb9AZYmwdFSH2DdhvscW5z5QnIMnYTFRngKajbkSdjvvVyWw6LwIJWxlYhshBPGlg4xDUFZOFLf2UlA4MUe8DA8TIea+IX2smNzuP0vmleE8ArQR+UsNqTqekrljgz0+vhX5+FaB5qs3t9J5cPuwScX+MPS/UkluQXNh5WrJFM9p4CGban0P71P43YKxglb2X+cyKQ94h/diX4v9RaCpnBsnLBEiBNo/0idpiYrznuGrJbXrCBGfcS8UOZNOTvW4hnUTwJkuVcBHodNx3R8t5LtTDmf9/EmsNByWOE4XyHplSzut+ilAlOYAW6FAoMlRP17j9CYvp40MImU7d5GfS2Drx+GW3yciuygcSeJPwW0wzd8Jx7iITtZPchNXC6aPAtKQrB2xa8z53r/+NXr2nhyLPFySAhSY0IYOQBgKT6h3kSWUhtwoeuSh11H23xn6OOue1lRwSZFtnWn9cdSaaEGqWp9dYsa7+ChyZcubQzxJjXzXLk9h89vBXfZGDIlvpsP4QIbmPMjqxhqsBfefv19nkI6ATGqFQsHNSKV1bi5RDhNzYOR3Ckunra8gfjADKT/ll0bAtT+Gyj2d7NLfv1oX/s3Dxbwcs6upK916xmn4Cn9qoUPECeybc02KdxfxGRB0zT8l0Zikliu1neuQQ0TmnzytBG1jCdcA7AUAfwLbEnAjIqNRI/tr3AS3HHzaJJ1AVHLTuHM72nkWqYVDDf+j66wmI+h8Lmvxl4OGEXnX3JOrwBz08R7ELtwHigs810rOj0viiWN/+sC7Ni5oBKQ6bZk8eHN3PYLZzQgVjEb5jNex3lMrEC0EzpQ3faNx4xd523exujDDnuf5ZP5S7v7/UuKqkqW2X94NfxXy7549ho3WWi6n1Vt7ABUIeJc5cdqWkRZrf4aNACabeODzxEINKtnW6CGh5734US98i9pjARiQfrdT+ax6iuaQ68hRSbykUQcJUr4DoFBkm4wgd2hq4tBIt5iGqkmIYjIK97X2Ac+y7Al6Eas2r5VF3EkYVixIGsqzlkm0RXA05xqwaznFZjzk8V80Y+iIDhMyNdfSpEMp3IheR2cbKGSnSfWK1HK5rU73te+Y+mp46Jt6oD3xe3/MKUzoD2UBzNmu3iQW2uCJHd2ne9t/x3h7lnn4kBxCEAK//UgVlyjyz9W5JHgDWu3g3OlGHBZO/680MjgZCrLsuOfLU+5jPl2Pxck02uqzyqmPlhPA0isbdnhRis6Qh/S179zV226tq30IMf1KqJ+bHgSCHhjM64dbIL8GGt21vGOEXP+/AJcER6NjIb286TKSzTCCidNp6Zf3rpsWZnG5dNhuEqU94Fd2sYHaDOgM3A3LO9nxQazFRTOJsT7cD4eScDOsG8UfQGqlmCqM7L0/3ZpnWylRSPqBu/B+eHEfYNZO+0QTaWrYVbLURYIK4TWR8iESRGfHHQWgthnGCFSR6XhpDR2Xtq0uhr2QQvOUVv8Giw6ImYIgOdd8OPo1dxm1hQCQV84zTzso6krY75wTfRjcwV5Geb/tJ4owfFd8kC7FDPX9B9mBYVZ0zuK21vYoVpvazdgKlwKfwFKZSgPgFfDQtTRYNOvy6JNZ7OeYCWEFJq/hygT5KPD9mIbenEBsAvHdzCG/K5iPb4S4aP/YhnMDJHIP/icNM6ztIK9gkRRdA71nyoMef+2jb3neklwx0pHH2SIdKb2jwOWG3JCmYK4Iva+7eEG0a3If9Da4KaFAGMYlTTCfFBFSoyK7YMSwyuICgV8M49c7bf4VqtKi5LOaLKCJlVZ5zBpLrIr9LvsMNctO/oiM3ab/MknNJPPbnirNLPbGflQrRr2aJJYXg/QIsh8k1PXzz+z9w5gIxiXea4P0RlO2OUDqhJdvv8EBpRLy6Z9p8GR+FFKgDHcGsMkkbMnJz0q7hAhDVdF3sCfBM6hj2P4SlE5njIsBmSky6FhkNYd2UfgLt37a35+BEvupCA+Jh5kmC5dWaGeQNmz35EEQvhwZG3qxKo/RZr66hM7IJ5Won7gh78anK172Zt3buKAMKyMDjzdR9ufcCZ0zU4DOA5RKIgkAMTbytB3LQFlT5MH/An6qfRJPjj2dg5WFP3mdlZkwFePrA+3eN2Wu0A+WAFKZrztzJRibcqCweEddxU/PSGWxOnjHtOUDzfDk9lEvDDj39cFH1E9dVeQLGVI3Qgeo0M34dZ6K/3cb9BBZcZf8uS+BivagqBuLW31L60FMADuX1jiTur3n1ZrBrIgpkFO//0OmyT9qWthHcnwzLRswTdDbgUflRNCAvfaODDSX8vQLo7QBDltK42Y/OdFbS1zUYFLv6qSiV43zDiUrcAtbEqoMVBPa37+RMTuT1gmrJVH1qqYsi12cyakNWPLrTGqg9NO1KY2vPwISkCnxobu6FodJWlXUwABhb1LwveepTps6Tt0E8j+tabfLiI+MdLLWSxLqA1cJON1hz8aZkisUWXUMhNOQpLrIR062CCV3Bg0ZwlU9OhbKefT1NjDog/g2q+TAW89zQllayE0d/y9qAdSAucb3iKOXZYzSSmdealQNS1IL3qMUpowYU6uuO7LEqyPD05MgXvXy6frzzrkpBXlAx+J30gur7J4OT/ziwA3fvIcKvLAHet4sqms0BCkZk6CKbyRPu8Xqwsv5KGfYcI4thniGI9nFwFwt1bfZm9racBom20+/R8n0upa1EAueM5b9A7lN3BE9empZqOTj5NkKNeCf630MV2jeKeEP8cImJ5W9l3gYGDg1wPxxZcmBvsZ4qZXUMim6a/M2jKAsHtYvPN1A0FsH3AAbpFvCxA200RpdN9ME2nSQL2g5pg9OIw6KkYT3gKe7QmWrItoXK1c/XBbJQ6pVOca2BzfQfoOCTygsFljpEPDG+tBLrte+jUDP2DcYKLisBjhgtTZnAmgmg8/Aus/awVIZGqScBZ1xa/82qG7rzT0BDLldEs0sP5HS8oNhU3lhDue5NS0TUt0T7YTZvSGH0HEYEs97dJ7xpNO1TKokYmLWenco4PvNEsv2hQ85pcgDjlA29jwVT9IoAcXQGCnhPG8fgYyhJ64NNzBiWf5p1XdoBx+xtXoPiVbK44FcHipEqTaar9/ruKsdneZuJmevOHPOjhmtvwVVX8Nmx+/eftj7gZmxlF3ocI/n5T0byPxzPfMi24AxSQeAGjdI3Q4hc5ffAT7v7F89ZNEgj6fheuHl2hjRQlG4EMMwpiAnsm1HT499a+zKPMejH0uAfnT4JyItDTiDQ4l5DoO/sQZ0HkzGpiM8KQNwaHk0Un9WaO+yuA1ZTV9z8Jm13bqwTlfNHncIi8M/kHQMFhMF7Imo2mUw/Sox7Bh3W6UplqvEiy+g2NvVzFPCtGkHSTLuFSL2CtGzpPY+E5O0PK3HSbUnBzNBZodkNnUAlch2Zk9/9F8JuAYBirgoVpE7QyheJ33WDOysDFYMSXBdm20XfXCWcGzsGyvXE8FJN7EadsGjIDzZ+GtIUEBWuQ6o87kaDvo4eplYs4dz6P06lSSCA0yAvpXKD1djjC8dnWdYtWsLpl4Fplhje74Y6i/M7VMSQnRvD54/CC4LPzx4vghhIOzVo6bLzl7QIHPvVyM/drqBBZ3tW1lYqvXfauRfH5WHe+RcHI+xxeqDECqJ9tdXLyy9L7RqxyUaZKwmlAux+zEzdzITSRlr36YuSm0LBhTpkivodWytR6BNULFxftqF42QqKLmoog9WlYNRb4GtNm93bHuxBvV5VcOUeY6N/9xDutwbqYhaN3rIzpg1M6XfrYctTdA5Msr2v4Aydmb+Nl2/Eqw+jSXYvctmuDHYUAei0pUc6E5N1bULPEjHAr+HI3gwDjpDg0nE2fMkXneCumq9ifZR5IKUOqn0aDIfN64olrhaHfV4msozkdG/3j5HHqsf5Els8kwvDrCaK4/BXb+YzYC00mJEOu8njPsKgB9dG+FjqqeToCsJKLTvHS+iQTnqFquCJ+yCckuDaHLnP4GzroGg7BelrYZWStEFay3j+vkEuXHy3B2zG5xBqSx+/pxoEOv+OfiCfq5QMCCNq26xXC+1DZ+eQdH2jJ9FXSh9yrISZTk56jTzMIzG9+Ye+pumQffxmh2lcvPXjmNWL3PoOgRpkx4o/TZzE2y3IMtEZNxpNUlBqFlnBVXuPS0TIBkF+ZfvW3y2bGWD14zb8Cju5+wiSW1pIIRRtD0DeaxOLIvup5BZ2R2QfQVx6ryHH4H/rls/fRJy6KIdsJ/qVsWrBZaKgKOhP0GOUjA16wS+vlpcmot72SIWJWQDwyiD04TLSU6LyObtnOC2W5QA0OCGXHtlTi9Cyh95AIL8UU6AaQOaDSDfuf3DbxO4065WUdqPZ6Zj9S26jGlhDs/3mX1c4h+to5J2UwvgO3dkFtmKMBF3OuQvskMsOO8R5FnXblT4zMUpkjhs3m1ygag6zQWKfFOQCFM8jmAFtaCpCqDX77xqhE3B99uGU3UT+41SufAp9fQENvgk5lwqneywazIE9IpGT8v23sBPibAHG34mLWiivxnjk8p2S5ofshihnLQd4CU5ABpVcMX/5Hg39Jm55k+hgxugBCGIR5KmY+qz6US5/wKYimBbjTOSBlyD9OiYpWxtoLH6PcoaUdK0dW4vKR121dfMwumvgSBf8g0fsVN0w8jbplh7Df1FVC9wZuTbZStSswGJu6IngHRvBgOFag8F3hwPVNuUYjxNngNURuMvnnOvway+3l+1sK7aILbzdSzAxUCtG9/CaaHsBFIVzMWEH7upNL6Hr6P+oI4i+VqT6NyQrYUMkRXYd2P1ZjEMDaJ1rrurxTBgTfMw9cZe8SHIAz0JA7jpgDmr+InVbg0HrkFNZVhQ2uBKn75tLEZwfMp2azBhkglsAXDPx2BccwTDGmnsjRDh2jHh9ynTQY4vLqcuv/NWRlP8sFHWyxSmm38ikF1UoTywoZL0oFE4I4ujqIcvCuo+0ABPohIMdyq8EqgTcogXcYNCGdgvytDCA/fwt2eG78+OAANOgmKkOI8WdjE3FaFdqW6rx/oOBunJoqMLOwnPtv67Cw7PY8c4jFvek2G/hk1Thivu5Pf2iV8YDA8DyziBPz6MKlF9XQlRt7ZRV09nZrygwo00ME7IpFuOiEsUrd14UcCvNC/DPkbFmqB1uQIg477mFiq2niVADUYnvdjiQPNpFfMTo4yg4X+tDW3rmH2WE9E2rY0ES40wM6QRwaQL5/fepJULkj3Zc6L1ItuWmO6zXbvou399GBCPcQwB2+rRpubsw03qWL2iRyHH9Afl/YHuFYa8v7zEXDEigXJo9RAtTM4BTzElQhSgePv55AmHTo4W9v4SmkPDlLIhOpcXBK4GO2AnyzeN0MaKP7umX9bZAfc5LA84bxj3frYCxezbP9KG7QeJzevIhiAU4p/j+y2OyMV2mxNgAAAABJRU5ErkJggg==";var Y_=i(127),q_=i.n(Y_);var Z_=i(128),J_=i.n(Z_);var K_=i(129),Q_=i.n(K_);var $_=i(130),ty=i.n($_);var ey=i(131),iy=i.n(ey);var ny=i(132),ry=i.n(ny);var oy=i(133),sy=i.n(oy);var ay=i(134),ly=i.n(ay);var hy=i(135),uy=i.n(hy);const cy={wipe:class extends P_{constructor(t){super(D_.a,N_.a,{percent:0,direction:1,transition:0});let e=1;"up"===t?e=1:"down"===t?e=2:"left"===t?e=3:"right"===t&&(e=4),this.uniforms.direction=e}},fade:class extends P_{constructor(t){super(void 0,B_.a,{percent:0,transition:1});let e=1;"out"===t?e=-1:"in"===t&&(e=1),this.uniforms.transition=Math.pow(e,e)}},blinds:class extends P_{constructor(t){super(H_.a,k_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="vertical"===t?1:0}},checkerboard:class extends P_{constructor(t){super(H_.a,z_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="down"===t?1:0}},dissolve:class extends P_{constructor(t){super(H_.a,X_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.setTextTure()}setTextTure(){this.uniforms.dissolveSampler=Vh.t.from(W_)}},randombar:class extends P_{constructor(t){super(H_.a,q_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="vertical"===t?1:0,this.setTextTure()}setTextTure(){this.uniforms.dissolveSampler=Vh.t.from(W_)}},circle:class extends P_{constructor(t){super(H_.a,J_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="out"===t?1:0}},box:class extends P_{constructor(t){super(H_.a,Q_.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="out"===t?1:0}},diamond:class extends P_{constructor(t){super(H_.a,ty.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="out"===t?1:0}},plus:class extends P_{constructor(t){super(H_.a,iy.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="out"===t?1:0}},barn:class extends P_{constructor(t){super(H_.a,ry.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="inHorizontal"===t?1:"outHorizontal"===t?2:"outVertical"===t?3:0}},strips:class extends P_{constructor(t){super(H_.a,sy.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option="upLeft"===t?1:"downRight"===t?2:"upRight"===t?3:0}},wedge:class extends P_{constructor(t){super(H_.a,ly.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])})}},wheel:class extends P_{constructor(t){super(H_.a,uy.a,{percent:0,transition:1,rect:new Float32Array([0,0,0,0])}),this.uniforms.option=Number(t)||1}}};class dy extends T_{constructor(t){var e;super(t),this.filterType="",this.isConflict=!1,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{var i;const n=e/t;if(this.filter){this.filter.percent=this.commonTimeNode.applyTimeFilter(n);const t=null===(i=this.timingTarget)||void 0===i?void 0:i.container.getBounds();t&&(this.filter.uniforms.uBoundRect=new Float32Array([t.x,t.y,t.width,t.height]))}n>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{var t;if((null===(t=this.timingTarget)||void 0===t?void 0:t.container.filters)&&this.filter){this.timingTarget.removeAnimationFilterQueue(this.filter);const t=this.timingTarget.getFirstAnimationFilter();this.timingTarget.container.filters=t?[t]:[]}})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[],this.filter&&this.timingTarget.removeAnimationFilterQueue(this.filter))},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[],this.filter&&this.timingTarget.removeAnimationFilterQueue(this.filter))},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.addToAnimationFilterQueue(this.filter),this.timingTarget.container.filters&&0!==this.timingTarget.container.filters.length||(this.timingTarget.container.filters=[this.filter]))}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let i=1;"out"===t.json.transition&&(i=-1);const n=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(n){const t=n[1],e=n[3];cy[t]&&(this.filter=new cy[t](e),this.filterType=`${t}-${e}`,this.filter&&(this.filter.transition=i))}}get modifyAttrKey(){return this.filterType}}class py extends T_{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startPos=null,this.onTimeNodeStart=()=>{var t,e;this.startPos={x:(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_x)||0,y:(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_y)||0}},this.onTimeUpdate=({duration:t,delta:e})=>{var i;const n=e/t,r=null===(i=this.path)||void 0===i?void 0:i.getPoint(n);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{this.timingTarget&&this.startPos&&(this.timingTarget.ppt_x=this.startPos.x,this.timingTarget.ppt_y=this.startPos.y)},this.onSeekToEnd=()=>{var t,e,i;const n=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(i=this.path)||void 0===i?void 0:i.getPoint(n>0?1:0);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new zs,i=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(i)for(const t of i){const[i,...n]=t.trim().replace(/\s+/g," ").split(" ");if("M"===i){const[t,i]=n.map(t=>Number(t));e.moveTo(t,i)}else if("L"===i){const[t,i]=n.map(t=>Number(t));e.lineTo(t,i)}else if("C"===i){const[t,i,r,o,s,a]=n.map(t=>Number(t));e.bezierCurveTo(t,i,r,o,s,a)}else if("Z"===i)e.closePath();else if("E"===i)console.warn("not implements");else if("c"===i){const[t,i,r,o,s,a]=n.map(t=>Number(t)),l=e.currentPoint;e.bezierCurveTo(t+l.x,i+l.y,r+l.x,o+l.y,s+l.x,a+l.y)}else if("l"===i){const t=e.currentPoint,[i,r]=n.map(t=>Number(t));e.lineTo(i+t.x,r+t.y)}else if("m"===i){const t=e.currentPoint,[i,r]=n.map(t=>Number(t));e.moveTo(i+t.x,r+t.y)}}this.path=e}}class fy extends T_{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=t=>{t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{var i,n,r,o,s;const a=e/t,l={x:1,y:1};if(this.to){const t=null!==(i=this.from)&&void 0!==i?i:{x:null!==(r=null===(n=this.startVal)||void 0===n?void 0:n.x)&&void 0!==r?r:1,y:null!==(s=null===(o=this.startVal)||void 0===o?void 0:o.y)&&void 0!==s?s:1};l.x=t.x+(this.to.x-t.x)*a,l.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};l.x=1+(t.x-1)*a,l.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=l)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=t.json.from,this.to=t.json.to,this.by=t.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class my extends T_{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isTimelineStart=!1,this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{if(this.isTimelineStart)return;this.isTimelineStart=!0,t.isReverse||this.updateCurrentValue(),this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to);const e=this.json.cBhvr.attrList[0],[i]=e.split(".");x_(this.timingTarget,i+".on","true")},this.onTimeNodeEnd=()=>{const t=this.json.cBhvr.attrList[0];if("remove"===this.json.cBhvr.ctn.fill){const[e]=t.split(".");x_(this.timingTarget,e+".on","false")}this.isTimelineStart=!1},this.onSeekToStart=()=>{var t;const e=this.json.cBhvr.attrList[0];if(this.timingTarget){this.onTimeUpdate({duration:1,delta:0});const i="ppt_c.color"===e||"text.color"===e;if((null===(t=this.timingTarget.fill)||void 0===t?void 0:t.designColor.toUpperCase())===this.from.toHexString().toUpperCase()||i){const[t]=e.split(".");x_(this.timingTarget,t+".on","false")}}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=this.json.cBhvr.attrList[0],e=b_(this.timingTarget,t);e&&(this.startColorString=e)}},this.onTimeUpdate=({delta:t,duration:e})=>{const i=t/e;if(this.to.interpolationFrom(this.from,i,this.target),this.timingTarget){const t=this.json.cBhvr.attrList[0];x_(this.timingTarget,t,this.target.toHexString())}},this.onSeekToEnd=()=>{this.isTimelineStart||this.onTimelineStart({isReverse:!1,activeCount:0,id:""}),this.onTimeUpdate({duration:1,delta:1})},this.replaceAttrToRelation(),"rgb"===this.json.clrSpc?(this.from=new pg(this.json.from),this.to=new pg(this.json.to),this.by=new pg(this.json.by),this.target=new pg):(this.from=new dg(this.json.from),this.to=new dg(this.json.to),this.by=new dg(this.json.by),this.target=new dg),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}replaceAttrToRelation(){const t=this.json.cBhvr.attrList[0];"ppt_c"!==t?"style.color"===t&&(this.json.cBhvr.attrList[0]="text.color"):this.json.cBhvr.attrList[0]="ppt_c.color"}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const t=this.json.cBhvr.attrList[0],e=b_(this.timingTarget,t);e&&(this.currentColorString=e)}}}class gy extends T_{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=t=>{this.lastVal=null,t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{const i=e/t;let n=0,r=0;if(void 0!==this.from&&void 0!==this.to){n=this.from,r=this.to;const t=n+(r-n)*i;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*i-this.lastVal;this.lastVal=this.by*i,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;Vm()(null===(t=this.timingTarget)||void 0===t?void 0:t.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&null!==this.startVal&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var t;this.currentVal=null===(t=this.timingTarget)||void 0===t?void 0:t.r}}class vy extends T_{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:i,cmdType:n}=this.json;!this.isApplied&&i&&n&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(i,n))},this.onSeekToStart=()=>{var t,e;this.commonTimeNode.isInInteractiveSeq||null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("seekToStart",this.onSeekToStart),this.commonTimeNode.on("seekToEnd",this.onSeekToEnd)}get modifyAttrKey(){var t,e,i,n;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(n=null===(i=this.json)||void 0===i?void 0:i.cmdType)&&void 0!==n?n:"")}}class _y{constructor(t){this.runtimeNodeEventHub=new Za.a,this.onVolumeUpdate=t=>{this.audio.volume(t)},this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy(),this.ctx.activeMedia.delete(this.audio),this.ctx.volumeAdjuster.off("update",this.onVolumeUpdate)};const{json:e,isIterate:i,isSub:n,eventHub:r,ctx:o,parent:s,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new by({json:e.cMediaNode.ctn,isSub:n,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:i,iterateType:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c});let d=e.cMediaNode.tgtEl;o.loaderDelegate&&(d=o.loaderDelegate.redirectMedia(d),o.logger.info(`redirect media url from ${e.cMediaNode.tgtEl} to ${d} by delegate.`,o.taskId)),this.audio=new h_(d,o.runningAudio),o.activeMedia.add(this.audio),this.commonTimeNode.on("timelineStart",()=>{this.audio.volume(o.volumeAdjuster.volume),this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy),this.ctx=o,this.ctx.volumeAdjuster.on("update",this.onVolumeUpdate)}}function yy(t){return function(t){var e;return!!(null===(e=t)||void 0===e?void 0:e.cBhvr)}(t)?t.cBhvr.ctn:function(t){var e,i;return!!(null===(i=null===(e=t)||void 0===e?void 0:e.cMediaNode)||void 0===i?void 0:i.ctn)}(t)?t.cMediaNode.ctn:t.ctn}var xy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class by extends Za.a{constructor(t){var e,i;super(),this.uuid=Mm(),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.tmFilter=[],this.timeDelta=0,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.isInfiniteRepeat()?this.repeatTimeNodeEnd():this.seekToEnd(!1,!0))},this.handleActive=(t=!0)=>{if(this.isActive=!0,this.isConflictDispose=!1,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if("never"===this.json.restart)return;"whenNotActive"!==this.json.restart&&"always"!==this.json.restart||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(t))}else this.startTimeLine(t)},this.updateTimeLine=t=>{const e=t/(xd.b.TARGET_FPMS||.06);this.timeDelta+=e,this.duration-this.timeDelta<=e&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(t=!1)=>{(this.isTimeNodeEnd()||t)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:n,isIterate:r,ctx:o,eventHubs:s,parent:a,json:l,iterateType:h,iterateId:u,iterateIndex:c,isInInteractiveSeq:d,fromSeqId:p}=t;this.isSub=n,this.fromSeqId=p,this.isInInteractiveSeq=d,this.isIterate=r,this.parentTimeNode=a,this.json=l,this.ctx=o,this.iterateIndex=c,this.eventHubs=s,this.iterateType=h,this.iterateId=u,this.tmFilter=null!==(i=null===(e=l.tmFilter)||void 0===e?void 0:e.split(";").map(t=>t.split(",").map(t=>parseFloat(t.trim()))))&&void 0!==i?i:[];const f=Number(this.json.dur),m=this.json.spd||1;if(this.isNegativeSpeed=m<0,Number.isNaN(f)||(this.duration=f/Math.abs(m)),this.uuid+="--"+this.json.id,this.setPreStyle(),l.childTnLst&&this.createChildren(l.childTnLst),this.startConds=new __(this.json.id||"",l.stCondLst,s,this.ctx),this.endConds=new __(this.json.id||"",l.endCondLst,s,this.ctx),l.endSync&&(this.endSync=new __(this.json.id||"",[l.endSync],s,this.ctx),this.endSync.on("active",()=>{var t;"interactiveSeq"===this.json.nodeType&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),null===(t=this.endSync)||void 0===t||t.reset())})),this.startConds.on("active",t=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(t))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(t=>t.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&"nextClick"===this.json.masterRel){const t="shape slide onNext"+this.fromSeqId;this.startConds.addCond({event:t})}this.json.iterate&&!1===this.isIterate&&this.createIterateShadow()}createIterateShadow(){const t=Mm();let e=!0,i=0;const n=i=>{i===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",n))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",n);e;){const e=JSON.parse(JSON.stringify(this.json)),n=new by({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:i,iterateId:t,isInInteractiveSeq:this.isInInteractiveSeq,fromSeqId:this.fromSeqId});this.iterateShadows[i]=n,i+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let i=null;const n={json:t,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId,isInInteractiveSeq:this.isInInteractiveSeq,fromSeqId:this.fromSeqId};return"seq"===t.type?i=new y_(n):"par"===t.type?i=new Ty(n):"set"===t.type?i=new E_(n):"anim"===t.type?i=new I_(n):"animEffect"===t.type?i=new dy(n):"animMotion"===t.type?i=new py(n):"animScale"===t.type?i=new fy(n):"animClr"===t.type?i=new my(n):"animRot"===t.type?i=new gy(n):"cmd"===t.type?i=new vy(n):"audio"===t.type&&(i=new _y(n)),i}createSubList(t){this.subList&&this.subList.forEach(t=>t.commonTimeNode.destroy()),this.subList=[],t.forEach(t=>{const e=this.createTimeNode(t,!0);e&&this.subList.push(e)})}bindCommonTimeNodeEvent(t){t.commonTimeNode.on("timeNodeStart",t=>{this.emit("childTimeNodeStart",t)}),t.commonTimeNode.on("timeNodeEnd",t=>{this.emit("childTimeNodeEnd",t),this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return yy(t).presetOrder}function i(t){return/^slide/.test(t)?"slide":/^layout/.test(t)?"layout":/^master/.test(t)?"master":"unknow"}const n=["master","layout","slide","unknow"];if(t&&t[0]&&e(t[0])){[...t].sort((t,r)=>{var o,s,a,l;const h=yy(t).id,u=yy(r).id;if(h&&u){const a=i(h),l=i(u);if(a===l)return(null!==(o=e(t))&&void 0!==o?o:0)-(null!==(s=e(r))&&void 0!==s?s:0);return n.indexOf(a)-n.indexOf(l)}return(null!==(a=e(t))&&void 0!==a?a:0)-(null!==(l=e(r))&&void 0!==l?l:0)}).forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}else t.forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(t=>t.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.isInInteractiveSeq&&this.isInfiniteRepeat()&&this.repeatTimeNodeEnd(),this.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.isEndEventsEmitted=!1,this.timeDelta=0;const t=1e3/this.ctx.ticker.maxFPS;this.duration<=t&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(jy.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit(jy.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit(jy.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return xy(this,void 0,void 0,(function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const t of this.iterateShadows){if(this.isIterateEnd)break;t.children.forEach(t=>{t.commonTimeNode.startTimeNode()}),t.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}}))}applyTimeFilter(t){if(!this.tmFilter.every(t=>Vm()(t[0])&&Vm()(t[1])))return t;for(let e=0;e<this.tmFilter.length;e++){const i=this.tmFilter[e];if(t<i[0]){const n=this.tmFilter[e-1];return(t-n[0])/(i[0]-n[0])*(i[1]-n[1])+n[1]}}return this.tmFilter.length>0?this.tmFilter[this.tmFilter.length-1][1]:t}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}findTargets(){const t=[],e=i=>{i.forEach(i=>{var n,r,o;i.cBhvr&&i.cBhvr.target&&t.findIndex(t=>t.id===i.cBhvr.target.id)<0&&t.push(i.cBhvr.target),(null===(r=null===(n=null==i?void 0:i.cBhvr)||void 0===n?void 0:n.ctn)||void 0===r?void 0:r.childTnLst)&&i.cBhvr.ctn.childTnLst.length>0&&e(i.cBhvr.ctn.childTnLst),(null===(o=null==i?void 0:i.ctn)||void 0===o?void 0:o.childTnLst)&&i.ctn.childTnLst.length>0&&e(i.ctn.childTnLst)})};return e(this.json.childTnLst||[]),t}setPreStyle(){this.json.presetClass&&this.findTargets().forEach(t=>{if(this.json.iterate){let e=0,i=!0;for(;i;){const n=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});n&&(this.setPreStyleForTarget(n),e+=1),i=!!n}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,i;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const n=null===(i=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===i?void 0:i.filter(t=>"set"===t.type&&"visible"===t.to);(null==n?void 0:n.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===this.json.presetClass||"emph"===this.json.presetClass)&&(t.hasPreset=!0,t.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(t=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(t);const e=this.json.stCondLst.filter(t=>/^self/.test(t.event||""))[0];e&&this.startConds.condHandle(e);const i=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];i&&this.endConds.condHandle(i),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy())}seekToStart(t=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(t));if(t)for(let t=this.subList.length-1;t>=0;t--){const e=this.subList[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}if(this.children.length>1)for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}repeatTimeNodeEnd(){this.dispose(),this.children.forEach(t=>{t.commonTimeNode.isActive=!1,t.commonTimeNode.dispose()})}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(jy.animateEnd);try{this.ctx.ticker.remove(this.updateTimeLine)}catch(t){}this.startConds.reset(),this.endConds.reset()}seekToEnd(t,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const i=this.json.autoRev||t;if(i?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(i,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(i,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEndWhenDetectEndSync(){if(this.isInInteractiveSeq&&this.isInfiniteRepeat())return!0;let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEndWhenDetectEndSync())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}isTimeNodeEnd(){let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(t=>t.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(t=>t.commonTimeNode.destroy()),this.clearSubList()}}class Ty extends Za.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new Za.a;const{json:e,iterateType:i,isIterate:n,isSub:r,parent:o,ctx:s,eventHub:a,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}=t;this.id=e.ctn.id,this.json=e,this.ctx=s,this.isIterate=n,this.globalEventHub=a,this.commonTimeNode=new by({json:e.ctn,isSub:r,eventHubs:{global:a,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:i,iterateIndex:l,iterateId:h,isInInteractiveSeq:u,fromSeqId:c}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),t.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end")),"exit"===this.commonTimeNode.json.presetClass&&this.commonTimeNode.children.length>=1&&this.commonTimeNode.children[this.commonTimeNode.children.length-1]instanceof E_&&this.commonTimeNode.children.forEach(t=>{t instanceof E_||"function"!=typeof t.onSeekToStart||t.onSeekToStart()})})}}var Ey=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Sy{constructor(t,e,i){this.json=t,this.ctx=i,this.globalEventHub=e;const n=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);n&&(this.tmRoot=new Ty({json:n,isSub:!1,isIterate:!1,eventHub:e,ctx:i,parent:null,iterateType:"el",iterateIndex:0,iterateId:"",isInInteractiveSeq:!1,fromSeqId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,i,n;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(n=null===(i=t.json)||void 0===i?void 0:i.ctn)||void 0===n?void 0:n.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var i,n,r;return"seq"===(null===(i=e.json)||void 0===i?void 0:i.type)&&(null===(r=null===(n=e.json)||void 0===n?void 0:n.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return Ey(this,void 0,void 0,(function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.startTimeNode()):null===(e=this.mainSeq)||void 0===e||e.commonTimeNode.startTimeNode()}))}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var t;null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.collectStartValue()}setMainSeqStep(t,e){var i;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(i=this.mainSeq)||void 0===i||i.setCurrentStep(t,e)}destroy(){var t;this.globalEventHub.removeAllListeners(),null===(t=this.tmRoot)||void 0===t||t.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(t){const e=this.findSeq(t);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(t,e,i){const n=this.findSeq(t);n&&n.setCurrentStep(e,i)}resetAllInteractiveSeq(){var t;((null===(t=this.tmRoot)||void 0===t?void 0:t.commonTimeNode.children.filter(t=>{var e,i,n;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"interactiveSeq"===(null===(n=null===(i=t.json)||void 0===i?void 0:i.ctn)||void 0===n?void 0:n.nodeType)}))||[]).forEach(t=>{t.setCurrentStep(0,"start")})}applyInteractiveAction(t){this.globalEventHub.emit(t)}}var wy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Ay extends v_{constructor(t,e,i,n){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,{parentGlobalPos:i},n),this.isRendered=!1,this.isTimingStartValueCollected=!1,this.json=t,this.json.smartArtShapeList&&(e.smartArtShapeList=this.json.smartArtShapeList),e.hasBackgroundFillShape=this.detectUseBackgroundFill(this.json),this.container.visible=!1,this.ctx=e;const r=new Jd;r.beginFill(16777215),r.drawRect(0,0,t.width,t.height),r.endFill(),this.container.addChild(r)}detectUseBackgroundFill(t){return!!t&&("Picture"===t.type||"Shape"===t.type?t.useBgFill:!(!t.children||!Array.isArray(t.children))&&t.children.some(t=>this.detectUseBackgroundFill(t)))}initOnReuse(){super.initOnReuse(),this.ctx.timingEventHub.on("c:prev slide",t=>{this.ctx.eventHub.emit(jy.requestPrevSlide,t)}),this.ctx.timingEventHub.on("c:next slide",(t,e)=>{this.ctx.eventHub.emit(jy.requestNextSlide,t,e)})}get interactiveContainer(){return this.container}render(t){if(this.isRendered)return;this.collectAnimatedIds().forEach(t=>this.ctx.animatedIds.add(t)),this.isRendered=!0,super.render(t),t.addSubMTask(()=>wy(this,void 0,void 0,(function*(){this.ctx.eventHub.emit("StageRenderEnd")})),"@StageImpl[emit.StageRenderEnd]")}isListTimeNode(t){return["excel","seq","par"].indexOf(t.type)>=0}isAnimatedTimeNode(t){return!!t.cBhvr}collectAnimatedIdsForTimeNode(t,e){var i;this.isListTimeNode(t)?null===(i=t.ctn.childTnLst)||void 0===i||i.forEach(t=>{this.collectAnimatedIdsForTimeNode(t,e)}):this.isAnimatedTimeNode(t)&&e.push(t.cBhvr.target.id)}collectAnimatedIds(){const t=[];return this.json.timing&&this.json.timing.timeNodeList.forEach(e=>{this.collectAnimatedIdsForTimeNode(e,t)}),t}createTiming(){this.json.timing&&!this.timing&&(this.timing=new Sy(this.json.timing,this.ctx.timingEventHub,this.ctx))}startTiming(){var t;return(null===(t=this.timing)||void 0===t?void 0:t.start())||Promise.resolve()}setMainSeqApplied(){var t;null===(t=this.timing)||void 0===t||t.setMainSeqApplied()}setMainSeqStep(t,e){var i;null===(i=this.timing)||void 0===i||i.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;this.isTimingStartValueCollected||(this.isTimingStartValueCollected=!0,null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue())}hasTiming(){return!!this.timing}clearOnSlideChange(){this.ctx.eventHub.removeAllListeners(),this.ctx.timingEventHub.removeAllListeners(),super.clearOnSlideChange()}clearOnTransactionEnd(){var t,e;this.ctx.timingTargets.getTargets().forEach(t=>{t.hasPreset=!1}),null===(t=this.timing)||void 0===t||t.resetAllInteractiveSeq(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0}destroy(){var t,e;this.isTimingStartValueCollected=!1,this.isRendered=!1,this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),null===(t=this.ctx.bgTexture)||void 0===t||t.destroy(!0),this.ctx.spriteTexture.destroy(),this.ctx.timingEventHub.removeAllListeners(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0,super.destroy()}mainSeqStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqStep())&&void 0!==e?e:0}mainSeqLength(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqLength())&&void 0!==e?e:0}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(t,e){var i;this.hasTiming()&&(null===(i=this.timing)||void 0===i?void 0:i.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onNext",t,e)):this.ctx.eventHub.emit(jy.requestNextSlide,t,e)}prevStep(t=!1){var e;this.hasTiming()&&(null===(e=this.timing)||void 0===e?void 0:e.hasMainSeq())?(this.ctx.timingEventHub.emit("shape slide onStopAudio"),this.ctx.timingEventHub.emit("shape slide onPrev",t)):this.ctx.eventHub.emit(jy.requestPrevSlide,t)}applyInteractiveAction(t){var e;null===(e=this.timing)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.timing)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,i){var n;null===(n=this.timing)||void 0===n||n.setInteractiveSeqState(t,e,i)}setMediaState(t,e,i){return wy(this,void 0,void 0,(function*(){const n=this.ctx.medias[t];n&&(e?i?(yield Pm(()=>n.clippedDuration>0,5e3),i<n.clippedDuration&&(n.once("play",()=>{n.seek(i)}),yield n.play())):yield n.play():(i&&n.seek(i),yield n.pause()))}))}setMediaCurrentTime(t,e){const i=this.ctx.medias[t];i&&i.seek(e)}}class My{constructor(t){this.ticker=t,this.tasks=[],this.couldRunning=!1,this.applyNext=()=>{const t=this.tasks[0];t&&t.applyNext()},t.add(this.applyNext)}addTask(t){this.tasks.push(t),t.once("task-finish",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)}),t.once("task-error",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)})}start(){this.couldRunning=!0}stop(){this.couldRunning=!1}}var Cy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};const Ry=t=>new Promise(e=>setTimeout(e,t));class Iy extends Za.a{constructor(t,e,i){super(),this.slideIndex=t,this.taskId=e,this.logger=i,this.uuid=Mm(),this.isCancel=!1,this.tasks=[]}addMTask(t,e){this.tasks.push({fn:t,state:"wait",sub:[],name:e})}addSubMTask(t,e){let i=this.tasks.findIndex(t=>"running"===t.state);i<0&&(i=0),this.tasks[i].sub.push({fn:t,state:"wait",sub:[],name:e})}cancel(){this.tasks=[],this.isCancel=!0}applyNext(){if(this.tasks.some(t=>"running"===t.state))return;if(this.tasks.some(t=>"error"===t.state))return;if(this.tasks.every(t=>"finish"===t.state))return void(this.isCancel||this.emit("task-finish"));const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(e=>{t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",Tm.transform(e),this.slideIndex)}))}applyAll(){return Cy(this,void 0,void 0,(function*(){for(;!this.tasks.every(t=>"finish"===t.state);)if(this.tasks.some(t=>"running"===t.state))yield Ry(16);else{if(this.tasks.some(t=>"error"===t.state))return;{const t=this.tasks.find(t=>"wait"===t.state);if(t){t.state="running";try{if((yield Im(()=>t.fn.apply(null),6e4))===Cm)throw new Tm(gm.RuntimeError,`subtask ${t.name} apply timeout`);if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}catch(e){let i;i=(null==e?void 0:e.errorType)?e:new Tm(gm.RuntimeError,`subtask ${t.name} error. ${e}`),t.state="error",this.logger.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",Tm.transform(i),this.slideIndex);break}}}}!this.isCancel&&this.tasks.every(t=>"finish"===t.state)&&this.emit("task-finish")}))}}var Py=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Oy{constructor(t,e){if(this.renderer=t,this.localStorage=e,this.outputData=new Map,this.loadingSdfKeys=new Set,!Oy.worker){const t=new Blob(['\nself.onmessage = function(e) {\n var data = e.data.data;\n var key = e.data.key;\n var height = Math.ceil(e.data.height);\n var width = Math.ceil(e.data.width);\n if (!data || !key) {\n return;\n }\n var maxDis = 0;\n var d = [];\n var p = [];\n var maxInt = Number.MAX_SAFE_INTEGER || 255 * 255 * 255;\n var setD = function(x, y, v) { d[y * width + x] = v; };\n var getD = function(x, y) { return d[y * width + x]; };\n var setP = function(x, y, v) { p[y * width + x] = v; };\n var getP = function(x, y) { return p[y * width + x]; };\n var isContains = function(x, y) { return x >= 0 && x < width && y >= 0 && y < height; };\n var isInterior = function(x, y) { return data[(y * width + x) * 4 + 3] > 10; };\n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n var c = isInterior(x, y);\n var t = isContains(x, y - 1) ? isInterior(x, y - 1) : false;\n var b = isContains(x, y + 1) ? isInterior(x, y + 1) : false;\n var l = isContains(x - 1, y) ? isInterior(x - 1, y) : false;\n var r = isContains(x + 1, y) ? isInterior(x + 1, y) : false;\n if (c !== t || c !== b || c !== l || c !== r) {\n setD(x, y, 0);\n setP(x, y, [x, y]);\n } else {\n setD(x, y, maxInt);\n setP(x, y, [-1, -1]);\n }\n }\n }\n \n var f = function (x, y, dir) {\n var d1 = 1;\n var d2 = Math.sqrt(2);\n var dx;\n var dy;\n var od;\n switch (dir) {\n case "TL": dx = -1; dy = -1; od = d2; break;\n case "T": dx = 0; dy = -1; od = d1; break;\n case "TR": dx = 1; dy = -1; od = d2; break;\n case "L": dx = -1; dy = 0; od = d1; break;\n case "R": dx = 1; dy = 0; od = d1; break;\n case "BL": dx = -1; dy = 1; od = d2; break;\n case "B": dx = 0; dy = 1; od = d1; break;\n case "BR": dx = 1; dy = 1; od = d2; break;\n }\n var b = isContains(x + dx, y + dy);\n var cb = b ? getD(x + dx, y + dy) : maxInt;\n if (cb + od < getD(x, y)) {\n var p = b ? getP(x + dx, y + dy) : [-1, -1];\n var dis = Math.sqrt(Math.pow(x - p[0], 2) + Math.pow(y - p[1], 2));\n setP(x, y, p);\n setD(x, y, dis);\n if (dis > maxDis) {\n maxDis = dis;\n }\n }\n };\n \n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n var dirs = ["TL", "T", "TR", "L"];\n for (var i = 0; i < dirs.length; ++ i) {\n var dir = dirs[i];\n f(x, y, dir);\n }\n }\n }\n\n for (var y = height - 1; y >= 0; -- y) {\n for (var x = width - 1; x >= 0; -- x) {\n var dirs = ["R", "BL", "B", "BR"];\n for (var i = 0; i < dirs.length; ++ i) {\n var dir = dirs[i];\n f(x, y, dir);\n }\n }\n }\n\n var outputData = [];\n for (var y = 0; y < height; ++ y) {\n for (var x = 0; x < width; ++ x) {\n outputData.push(isInterior(x, y) ? 255: 0);\n outputData.push(0);\n outputData.push(0);\n outputData.push(Math.ceil(getD(x, y) / maxDis * 255));\n }\n }\n self.postMessage({\n key, outputData, maxDis\n });\n};\n'],{type:"text/javascript"});Oy.worker=new Worker(URL.createObjectURL(t)),Oy.worker.onmessage=t=>{this.outputData.set(t.data.key,{data:t.data.outputData,maxDis:t.data.maxDis})},this.outputData.set("111","222")}}createSdfByWorker(t,e,i,n,r,o,s,a){const l=document.createElement("canvas");l.width=r,l.height=o;const h=l.getContext("2d");if(!h||!Oy.worker)return;h.drawImage(s,t,e,i,n);const{data:u}=h.getImageData(0,0,r,o);Oy.worker.postMessage({data:u,key:a,width:r,height:o})}createSdf(t,e,i){const n=document.createElement("canvas");n.width=t,n.height=e;const r=n.getContext("2d");if(!r)return{src:"",maxDis:1};r.drawImage(i,0,0);let o=0;const{data:s}=r.getImageData(0,0,t,e),a=[],l=[],h=function(e,i,n){a[i*t+e]=n},u=function(e,i){return a[i*t+e]},c=function(e,i,n){l[i*t+e]=n},d=function(e,i){return l[i*t+e]},p=function(i,n){return i>=0&&i<t&&n>=0&&n<e},f=function(e,i){return s[4*(i*t+e)+3]>10};for(let i=0;i<e;++i)for(let e=0;e<t;++e){const t=f(e,i),n=!!p(e,i-1)&&f(e,i-1),r=!!p(e,i+1)&&f(e,i+1),o=!!p(e-1,i)&&f(e-1,i),s=!!p(e+1,i)&&f(e+1,i);t!==n||t!==r||t!==o||t!==s?(h(e,i,0),c(e,i,[e,i])):(h(e,i,Number.MAX_SAFE_INTEGER),c(e,i,[-1,-1]))}const m=function(t,e,i){const n=Math.sqrt(2);let r,s,a;switch(i){case"TL":r=-1,s=-1,a=n;break;case"T":r=0,s=-1,a=1;break;case"TR":r=1,s=-1,a=n;break;case"L":r=-1,s=0,a=1;break;case"R":r=1,s=0,a=1;break;case"BL":r=-1,s=1,a=n;break;case"B":r=0,s=1,a=1;break;case"BR":r=1,s=1,a=n}const l=p(t+r,e+s);if((l?u(t+r,e+s):Number.MAX_SAFE_INTEGER)+a<u(t,e)){const i=l?d(t+r,e+s):[-1,-1],n=Math.sqrt(Math.pow(t-i[0],2)+Math.pow(e-i[1],2));c(t,e,i),h(t,e,n),n>o&&(o=n)}};for(let i=0;i<e;++i)for(let e=0;e<t;++e){const t=["TL","T","TR","L"];for(const n of t)m(e,i,n)}for(let i=e-1;i>=0;--i)for(let e=t-1;e>=0;--e){const t=["R","BL","B","BR"];for(const n of t)m(e,i,n)}const g=[];for(let i=0;i<e;++i)for(let e=0;e<t;++e)g.push(0,0,0,Math.ceil(u(e,i)/o*255));return r.putImageData(new ImageData(Uint8ClampedArray.from(g),t,e),0,0),{src:n.toDataURL("image/png"),maxDis:o}}getSdf(t,e,i){return Py(this,void 0,void 0,(function*(){const n=Math.ceil(e.width),r=Math.ceil(e.height),o=Math.ceil(e.width-t.width)/2,s=Math.ceil(e.height-t.height)/2;let a=yield this.localStorage.getItem(`sdf-${i}-src`),l=yield this.localStorage.getItem(`sdf-${i}-maxDis`);if(!(a&&l||this.loadingSdfKeys.has(i))){this.loadingSdfKeys.add(i);const e=this.renderer.plugins.extract.image(t,"image/png");e.addEventListener("load",()=>{this.createSdfByWorker(o,s,t.width,t.height,n,r,e,i)}),e.addEventListener("error",()=>null),yield Pm(()=>!!this.outputData.has(i),2e3),this.loadingSdfKeys.delete(i);const h=this.outputData.get(i);if(h){this.outputData.delete(i);const t=document.createElement("canvas");t.width=n,t.height=r;const e=t.getContext("2d");if(!e)return null;e.putImageData(new ImageData(Uint8ClampedArray.from(h.data),n,r),0,0),a=t.toDataURL("image/png"),l=h.maxDis,this.localStorage.setItem(`sdf-${i}-src`,a).catch(()=>{}),this.localStorage.setItem(`sdf-${i}-maxDis`,l).catch(()=>{})}}if(!a||!l)return null;return document.createElement("img").src=a,Vh.t.fromURL(a).then(t=>({texture:t,maxDis:l})).catch(()=>null)}))}}Oy.worker=null;var Ny=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Ly{constructor(t,e,i,n,r,o,s,a,l,h,u,c,d,p,f,m,g){this.loader=t,this.mode=e,this.renderer=i,this.ticker=n,this.view=r,this.clock=o,this.objPoolGroup=s,this.errorChannel=a,this.localstorage=l,this.logger=h,this.loaderDelegate=u,this.urlInterrupter=c,this.isPlayerPaused=d,this.maxResolution=p,this.volumeAdjuster=f,this.forceCanvas=m,this.globalEventHub=g,this.currentStageIndex=0,this.cacheCount=n_.isDesktop()?2:1,this.stageStates=Object.create(null),this.stageJsons=Object.create(null),this.stageCtxs=Object.create(null),this.stageImpls=Object.create(null),this.taskId="",this.url="",this.runningAudio=new Map,this.activeMedia=new Set,this.microTaskManager=new My(n),this.sdfManager=new Oy(i,l)}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Ny(this,void 0,void 0,(function*(){const e=new Gm(this.loader),i=new Za.a,n={taskId:this.taskId,mode:this.mode,renderer:this.renderer,graphicsTexture:new Km(this.maxResolution),stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new $m(i),eventHub:i,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new Qm,clock:this.clock,spriteTexture:e,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new Za.a,logger:this.logger,sdfManager:this.sdfManager,loaderDelegate:this.loaderDelegate,runningAudio:this.runningAudio,activeMedia:this.activeMedia,isPlayerPaused:this.isPlayerPaused,timingEventHub:new Za.a,maxResolution:this.maxResolution,animatedIds:new Set,volumeAdjuster:this.volumeAdjuster,forceCanvas:this.forceCanvas,globalEventHub:this.globalEventHub,latestChangeFullscreenTargetId:"",isRendering:!1,urlInterrupter:this.urlInterrupter};this.stageCtxs[t]=n})),"@StagePool[createCtx]")}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Ny(this,void 0,void 0,(function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`);this.stageJsons[t]=e,this.stageCtxs[t].stageWidth=e.width,this.stageCtxs[t].stageHeight=e.height,this.stageCtxs[t].featureList=e.featureList})),"@StagePool[loadStageJson]")}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const i=this.stageJsons[t],{spriteTexture:n,stageWidth:r,stageHeight:o}=this.stageCtxs[t],{coloredSheets:s,sheets:a}=i,l=s||a;return l&&l.forEach(t=>{e.addSubMTask(()=>{let e=1;if(r>this.maxResolution.x||o>this.maxResolution.y){e=this.maxResolution.x/r;const t=e*o;t>this.maxResolution.y&&(e*=this.maxResolution.y/t)}return n.loadSpriteSheetItem(this.url,this.taskId,t,e)},"@StagePool[spriteTexture.loadSpriteSheetItem]")}),Promise.resolve()},"@StagePool[loadSpriteSheets]")}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const i=this.stageJsons[t],n=this.stageCtxs[t],r=new Ay(i,n,{x:0,y:0},e);return this.stageImpls[t]=r,Promise.resolve()},"@StagePool[createStage]")}preRenderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>(this.stageImpls[t].preRender(e),Promise.resolve()),"@StagePool[preRenderStage]")}createGraphicsTexture(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Ny(this,void 0,void 0,(function*(){const i=this.stageCtxs[t];i.graphicsTexture.pack().forEach((n,r)=>{e.addSubMTask(()=>{const{stageWidth:e,stageHeight:o}=this.stageCtxs[t];let s=1;if(e>this.maxResolution.x||o>this.maxResolution.y){s=this.maxResolution.x/e;const t=s*o;t>this.maxResolution.y&&(s*=this.maxResolution.y/t)}return i.graphicsTexture.render(n,r,this.objPoolGroup,s)},"@StagePool[graphicsTexture.render]")})})),"@StagePool[createGraphicsTexture]")}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>Ny(this,void 0,void 0,(function*(){const i=this.stageImpls[t];yield i.render(e)})),"@StagePool[renderStage]")}destroyStageByIndex(t){"load"===this.stageStates[t].state&&this.stageStates[t].task.cancel(),delete this.stageStates[t];this.stageImpls[t].destroy(),delete this.stageImpls[t],delete this.stageCtxs[t]}destroyStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);Math.abs(this.currentStageIndex-e)>this.cacheCount&&this.destroyStageByIndex(e)})}destroyAllStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);this.destroyStageByIndex(e)})}preload(t,e=!1){if(this.stageImpls[t]||this.stageStates[t])return Promise.resolve();const i=new Iy(t,this.taskId,this.logger);return i.on("task-error",(t,e)=>{delete this.stageStates[e],delete this.stageImpls[e],delete this.stageCtxs[e],this.errorChannel.emit("error",t,e)}),this.stageStates[t]={state:"load",task:i},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(i),e?i.applyAll():new Promise(e=>{i.once("task-finish",()=>{this.stageStates[t].state="finish";Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),e()})})}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return Ny(this,void 0,void 0,(function*(){this.currentStageIndex=t;const e=this.stageStates[t];return"finish"===(null==e?void 0:e.state)&&this.stageImpls[t]?this.stageImpls[t]:"load"===(null==e?void 0:e.state)?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])}))}destroy(){this.runningAudio.clear()}}var Dy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};class Fy{constructor(t){var e;this.logger=t,this.taskId="",this.isIndexDBReady=!1,this.memoryCache=new Map,null===(e=Fy.localCache)||void 0===e||e.ready(t=>{t||(this.isIndexDBReady=!0)}).catch(()=>{t.warn("local storage not ready",this.taskId)})}get couldUseIndexDBCache(){return this.isIndexDBReady&&this.taskId.length>0}attachTaskId(t){this.taskId=t}getItem(t){return Dy(this,void 0,void 0,(function*(){let e=null;if(this.couldUseIndexDBCache&&Fy.localCache)try{e=yield Im(()=>Fy.localCache.getItem(`${this.taskId}/${t}`),500)}catch(t){}return e=e===Cm?null:e,e||this.memoryCache.get(t)||null}))}setItem(t,e,i=!1){return Dy(this,void 0,void 0,(function*(){if(!this.couldUseIndexDBCache)return i&&this.memoryCache.set(t,e),Promise.resolve();if(Fy.localCache){let n=null;try{n=yield Im(()=>Fy.localCache.setItem(`${this.taskId}/${t}`,e).catch(()=>{i&&this.memoryCache.set(t,e)}),500)}catch(t){}n!==Cm&&null!==n||!i||this.memoryCache.set(t,e)}}))}dispose(){var t;this.memoryCache=new Map,this.couldUseIndexDBCache&&(null===(t=Fy.localCache)||void 0===t||t.keys().then(t=>{t.filter(t=>t.indexOf(this.taskId)>=0).forEach(t=>{var e;null===(e=Fy.localCache)||void 0===e||e.removeItem(t).catch(()=>{})})}).catch(()=>{}))}}Fy.localCache=null;try{Fy.localCache=o.createInstance({name:"slide_local_cache",driver:o.INDEXEDDB,version:1})}catch(t){}const By=new Lh.j;class Uy{constructor(t){this.localStorage=t}canvas(t,e,i,n){let r,o,s,a=!1,l=!1;t&&(t instanceof Vh.p?s=t:(s=e.generateTexture(t),l=!0)),s?(r=s.baseTexture.resolution,o=s.frame,a=!1,e.renderTexture.bind(s)):(r=e.resolution,a=!0,o=By,o.width=e.width,o.height=e.height,e.renderTexture.bind(null));const h=Math.floor(o.width*r+1e-4),u=Math.floor(o.height*r+1e-4);let c=document.createElement("canvas");c.width=h,c.height=u;const d=c.getContext("2d");if(!d)throw new Error("ctx");if(i)d.putImageData(i,0,0);else{const t=d.getImageData(0,0,h,u),i=new Uint8Array(4*h*u),{gl:s}=e;s.readPixels(o.x*r,o.y*r,h,u,s.RGBA,s.UNSIGNED_BYTE,i),Uy.arrayPostDivide(i,t.data),d.putImageData(t,0,0),n&&this.localStorage.setItem(n,t).catch(()=>{})}if(a){const t=document.createElement("canvas");t.width=h,t.height=u;const e=t.getContext("2d");e.scale(1,-1),e.drawImage(c,0,-u),c=t}return l&&(null==s||s.destroy(!0)),c}static arrayPostDivide(t,e){for(let i=0;i<t.length;i+=4){const n=e[i+3]=t[i+3];0!==n?(e[i]=Math.round(Math.min(255*t[i]/n,255)),e[i+1]=Math.round(Math.min(255*t[i+1]/n,255)),e[i+2]=Math.round(Math.min(255*t[i+2]/n,255))):(e[i]=t[i],e[i+1]=t[i+1],e[i+2]=t[i+2])}}}class ky extends Za.a{constructor(){super(...arguments),this._volume=.5}get volume(){return this._volume}set volume(t){t<0&&(t=0),t>1&&(t=1),this._volume=t,this.emit("update",this._volume)}}var Gy=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};Ph.skipHello();const Hy={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip",gallery:"Gallery",switch:"Switch",prism:"Prism",doors:"Doors"},jy={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqAction:"interactiveSeqAction",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",mediaStop:"mediaStop",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",requestOpenUrl:"requestOpenUrl",userInput:"userInput",fullscreenChange:"fullscreenChange",changeLocalFullscreenState:"changeLocalFullscreenState"};class zy extends Za.a{constructor(t,e={}){super(),this.errorChannel=new Za.a,this.transactionPlayer=null,this.isForward=!0,this.drawCall=0,this.scale=1,this._isPaused=!1,this.maxResolution=new Lh.g(0,0),this.isNVIDIA=!1,this.fps=new bm,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.globalEventHub=new Za.a,this.globalVideoBackground=new Jd,this.globalVideoSprite=new ep,this.onMousemoveTimeout=null,this.cacheFunctionMap=new Map,this.isPlayerPaused=()=>this._isPaused,this.onWebGLLost=()=>{this.errorChannel.emit("error",new Tm(gm.CanvasCrash,"webgl context lost."))},this.fullscreenOnMousemove=({index:t,targetId:e})=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:t,targetId:e,status:!0}),this.onMousemoveTimeout&&clearTimeout(this.onMousemoveTimeout),this.onMousemoveTimeout=setTimeout(()=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:t,targetId:e,status:!1})},s_.hoverHiddeDelay)},this.fullscreenOnMouseleave=({index:t,targetId:e})=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:t,targetId:e,status:!1})},this.calculateFullscreenVideoPosition=t=>{const{width:e,height:i}=t,{designWidth:n,designHeight:r}=this,o=Math.min(n/e,r/i);return{x:(n-e*o)/2,y:(r-i*o)/2,width:e*o,height:i*o}},this.onRequestFullscreenVideo=t=>{const{texture:e,index:i,targetId:n}=t;if(i!==this.currentIndex)return void e.destroy(!1);this.onRequestCancelFullscreenVideo(),this.globalVideoBackground.width=this.designWidth,this.globalVideoBackground.height=this.designHeight,this.globalVideoBackground.beginFill(0,1),this.globalVideoBackground.drawRect(0,0,this.designWidth,this.designHeight),this.globalVideoBackground.endFill(),this.globalVideoBackground.interactive=!0,this.app.stage.addChild(this.globalVideoBackground);const{x:r,y:o,width:s,height:a}=this.calculateFullscreenVideoPosition(e);this.globalVideoSprite.texture=e,this.globalVideoSprite.width=s,this.globalVideoSprite.height=a,this.globalVideoSprite.position.x=r,this.globalVideoSprite.position.y=o,this.globalVideoBackground.addChild(this.globalVideoSprite),this.globalEventHub.emit("onFullscreenChange",{status:!0,targetId:n,slideIndex:this.currentIndex}),this.clearFullscreenEventListenersWithAppView();const l={handleEvent:()=>{var t;null===(t=this.currentStage)||void 0===t||t.ctx.eventHub.emit(jy.userInput)}};if(this.app.view.addEventListener("pointerdown",l,!1),this.cacheFunctionMap.set("pointerdown",l),n_.isDesktop()){const t={handleEvent:()=>{this.fullscreenOnMouseleave({index:i,targetId:n})}};this.app.view.addEventListener("mouseout",t,!1);const e={handleEvent:()=>{this.globalEventHub.emit("controllerShowStatusChange",{slideIndex:i,targetId:n,status:!0})}};this.app.view.addEventListener("mouseover",e,!1);const r={handleEvent:()=>{this.fullscreenOnMousemove({index:i,targetId:n})}};this.app.view.addEventListener("mousemove",r,!1),this.cacheFunctionMap.set("mouseover",e),this.cacheFunctionMap.set("mousemove",r),this.cacheFunctionMap.set("mouseout",t)}else{const t={handleEvent:()=>{this.fullscreenOnMousemove({index:i,targetId:n})}};this.app.view.addEventListener("touchstart",t,!1),this.cacheFunctionMap.set("touchstart",t)}},this.onRequestCancelFullscreenVideo=(t=!1)=>{var e,i;this.globalVideoSprite.texture.destroy(!1),this.globalVideoBackground.removeChild(this.globalVideoSprite),this.app.stage.removeChild(this.globalVideoBackground),this.globalEventHub.emit("onFullscreenChange",{status:!1,slideIndex:this.currentIndex,targetId:null===(e=this.currentStage)||void 0===e?void 0:e.ctx.latestChangeFullscreenTargetId}),this.clearFullscreenEventListenersWithAppView(),t&&this.emit(jy.changeLocalFullscreenState,{status:!1,slideIndex:this.currentIndex,targetId:null===(i=this.currentStage)||void 0===i?void 0:i.ctx.latestChangeFullscreenTargetId})},this.logger=t.logger,this.mode=t.mode,this.volumeAdjuster=t.volumeAdjuster,this.localStorage=new Fy(this.logger),this.cachedExtract=new Uy(this.localStorage),this.config={minFPS:$a()(e.minFPS)?30:e.minFPS,maxFPS:$a()(e.maxFPS)?40:e.maxFPS,resolution:$a()(e.resolution)?1:e.resolution,autoFPS:!$a()(e.autoFPS)&&e.autoFPS,autoResolution:!$a()(e.autoResolution)&&e.autoResolution,transactionBgColor:$a()(e.transactionBgColor)?0:e.transactionBgColor,maxResolutionLevel:this.getMaxResolution(e.maxResolutionLevel),forceCanvas:!$a()(e.forceCanvas)&&e.forceCanvas,enableNvidiaDetect:!$a()(e.enableNvidiaDetect)&&e.enableNvidiaDetect},this.updateMaxResolutionLevel(this.config.maxResolutionLevel),this.loader=new Lm(this.localStorage,t.useLocalCache,this.logger,t.resourceTimeout,t.loadDelegate,t.urlInterrupter);const i=Ph.isWebGLSupported();this.app=new Xh({antialias:!0,autoDensity:!1,backgroundColor:16777215,forceCanvas:this.config.forceCanvas||!i}),this.updateConfig(this.config),this.app.ticker.maxFPS=60,this.app.ticker.minFPS=this.config.minFPS,this.app.ticker.maxFPS=this.config.maxFPS,this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const n=this.app.renderer;if(n.gl){const{drawElements:t}=n.gl,e=n.gl.getExtension("WEBGL_debug_renderer_info"),i=n.gl.getParameter(e.UNMASKED_RENDERER_WEBGL);/nvidia/i.test(i)&&this.config.enableNvidiaDetect&&(this.isNVIDIA=!0),n.gl.drawElements=(...e)=>{t.call(n.gl,...e),this.drawCall+=1}}this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=.7*this.scale,e=this.app.renderer.resolution,i=Math.max(t,e-.1);i>=t&&this.updateResolution(i)}}else if(t>this.config.maxFPS&&this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,i=Math.min(t,e+.1);i<=this.config.resolution&&this.updateResolution(i)}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,Dh.c.LOW),this.clock=new Fm(this.app.ticker),this.objPoolGroup=Mm(),this.stagePool=new Ly(this.loader,this.mode,this.app.renderer,this.app.ticker,this.app.view,this.clock,this.objPoolGroup,this.errorChannel,this.localStorage,this.logger,t.loadDelegate,t.urlInterrupter,this.isPlayerPaused,this.maxResolution,this.volumeAdjuster,this.config.forceCanvas,this.globalEventHub),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost);try{this.config.forceCanvas||(this.transactionPlayer=new Ih)}catch(t){/Error creating WebGL context/.test(t.message)?this.errorChannel.emit("error",new Tm(gm.CanvasCrash,"webgl context lost.")):this.errorChannel.emit("error",new Tm(gm.RuntimeWarn,t.message))}this.globalEventHub.on("requestFullscreen",this.onRequestFullscreenVideo),this.globalEventHub.on("requestCancelFullscreen",this.onRequestCancelFullscreenVideo)}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}getMaxResolution(t){return!$a()(t)&&Number.isInteger(t)?(t<1&&(t=1),t>4&&(t=4),t):zy.platform.isAndroid()||zy.platform.isIOS()?2:4}updateMaxResolutionLevel(t){t<0&&(t=0),t>4&&(t=4);const e=[640,960,1280,1920,3200][t],i=[360,540,720,1080,1800][t];this.maxResolution.set(e,i)}updateConfig(t){$a()(t.maxFPS)||$a()(t.minFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS,this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),$a()(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),$a()(t.autoFPS)||(this.config.autoFPS=t.autoFPS),$a()(t.autoResolution)||(this.config.autoResolution=t.autoResolution),$a()(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&this.logger.info("ppt player update config: "+JSON.stringify(this.config),this.taskId),$a()(t.maxResolutionLevel)||(this.config.maxResolutionLevel=t.maxResolutionLevel,this.updateMaxResolutionLevel(this.config.maxResolutionLevel))}preload(t){return Gy(this,void 0,void 0,(function*(){t<1||t>this.slideCount||(this.logger.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),this.logger.info(`preload slide ${t} end`,this.taskId))}))}setResourceData(t,e){this.logger.info("ppt player init config: "+JSON.stringify(this.config),t),this.logger.info("set resource to "+e,t),this.taskId=t,this.url=e,this.stagePool.setResourceData(t,e),this.localStorage.attachTaskId(t),this.loader.attachTaskId(t)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}translateEvent(t,e){e.forEach(e=>{t.on(e,(...t)=>{var i,n,r,o;e===jy.requestGotoSlide&&t[0]!==this.currentIndex&&(null===(n=null===(i=this.currentStage)||void 0===i?void 0:i.timing)||void 0===n||n.setMainSeqStep(0,"start"),null===(o=null===(r=this.currentStage)||void 0===r?void 0:r.timing)||void 0===o||o.destroy()),this.emit(e,...t)})})}renderSlide(t){var e,i,n;return Gy(this,void 0,void 0,(function*(){if(this._isPaused)return void this.logger.info("ppt play prevent render slide with paused state",this.taskId);const r=Date.now();this.logger.info("render slide "+t,this.taskId),this.emit(jy.renderStart,t);const o=yield this.stagePool.getStage(t),s=`snapshot-${t}-${this.isForward?"start":"end"}`,a=yield this.localStorage.getItem(s);if(!o)return;o.ctx.isRendering=!0,this.translateEvent(o.ctx.eventHub,[jy.mainSeqStepChange,jy.mainSeqStateChange,jy.hyperlinkTrigger,jy.interactiveSeqAction,jy.mainSeqStepStart,jy.mainSeqStepEnd,jy.animateStart,jy.animateEnd,jy.mediaPlay,jy.mediaPause,jy.mediaSeek,jy.mediaStop,jy.requestGotoSlide,jy.requestOpenUrl,jy.requestNextSlide,jy.requestPrevSlide,jy.interactiveSeqStateChange,jy.userInput,jy.fullscreenChange,jy.changeLocalFullscreenState]),this.currentIndex=Number(t);const{width:l,height:h,slideCount:u}=o.json;this.slideCount=u,this.designWidth=l,this.designHeight=h,null===(e=this.currentStage)||void 0===e||e.clearOnSlideChange();const c=this.currentStage;this.currentStage=o,o.initOnReuse(),o.createTiming(),o.container.visible=!0,o.collectMainSeqStartValue(),this.isForward?o.setMainSeqStep(0,"start"):o.setMainSeqStep(-1,"end"),this.onRequestCancelFullscreenVideo(!0);let d=!1;if(Ph.isWebGLSupported()&&!this.config.forceCanvas&&o.json.transition&&o.json.transition.type&&this.app.stage.children.length>0&&this.view&&c){let{transition:t}=o.json;!this.isForward&&(null==c?void 0:c.json.transition)&&(t=c.json.transition);const e=this.getTransactionTexture(c,this.view,null,null);this.initTransactionPlayer(t),null===(i=this.transactionPlayer)||void 0===i||i.setPrevTexture(e),d=!0}if(this.app.stage.addChild(o.container),this.updateResolution(this.config.resolution*this.scale),c&&(c.clearOnTransactionEnd(),this.app.stage.removeChild(c.container)),o.json.transition&&o.json.transition.type&&this.app.stage.children.length>0&&this.view&&this.transactionPlayer&&d){const t=yield this.getTransactionTexture(o,this.view,s,a);this.transactionPlayer.setNextTexture(t),yield this.transactionPlayer.play();const e=this.transactionPlayer.renderer.domElement;if(this.view.parentElement&&e)try{this.view.parentElement.removeChild(e)}catch(t){}null===(n=this.transactionPlayer)||void 0===n||n.dispose()}this.isForward?yield o.startTiming():o.setMainSeqApplied(),o.ctx.slideScopeEventHub.emit("slide-render",o.ctx.slideIndex),this.emit(jy.renderEnd,t),this.emit(jy.slideChange,t),o.ctx.isRendering=!1,this.preload(t+1).catch(e=>{this.errorChannel.emit("error",Tm.transform(e),t+1)}),this.preload(t-1).catch(e=>{this.errorChannel.emit("error",Tm.transform(e),t-1)}),this.logger.info(`render slide ${t} done, time: ${Date.now()-r}ms`,this.taskId)}))}getTransactionTexture(t,e,i,n){const r=Vh.p.create({width:t.json.width,height:t.json.height,resolution:1});this.app.renderer.render(t.container,{renderTexture:r});const o=this.cachedExtract.canvas(r,this.app.renderer,n,i);return new b(o)}renderToBase64(t,e,i){return Gy(this,void 0,void 0,(function*(){const n=yield this.stagePool.getStage(t);if(n){const{width:r,height:o}=n.json;this.designWidth=r,this.designHeight=o;const s=Vh.p.create({width:this.designWidth,height:this.designHeight,resolution:e});n.container.visible=!0,this.app.renderer.render(n.container,{renderTexture:s});const a=this.app.renderer.plugins.extract.base64(s,i);return this.stagePool.destroyStageByIndex(t),a}return"__null__"}))}renderMainSeqToBase64(t,e,i){return Gy(this,void 0,void 0,(function*(){const n=[],r=yield this.stagePool.getStage(t);if(r.createTiming(),r){const{width:t,height:o}=r.json;this.designWidth=t,this.designHeight=o;const s=Vh.p.create({width:this.designWidth,height:this.designHeight,resolution:e});r.container.visible=!0;const a=r.mainSeqLength();r.setMainSeqStep(0,"start"),this.app.renderer.render(r.container,{renderTexture:s});const l=this.app.renderer.plugins.extract.base64(s,i);n.push(l);for(let t=0;t<a;t+=1){r.setMainSeqStep(t,"end"),this.app.renderer.render(r.container,{renderTexture:s});const e=this.app.renderer.plugins.extract.base64(s,i);n.push(e)}}return n}))}snapshotWithTimingEnd(t){return Gy(this,void 0,void 0,(function*(){const e=yield this.stagePool.getStage(t);if(e){const{width:i,height:n}=e.json;this.designWidth=i,this.designHeight=n;const r=Vh.p.create({width:this.designWidth,height:this.designHeight,resolution:1});e.container.visible=!0,e.initOnReuse(),e.createTiming(),e.collectMainSeqStartValue(),e.setMainSeqStep(-1,"end"),this.app.renderer.render(e.container,{renderTexture:r});const o=this.app.renderer.plugins.extract.base64(r,"image/png");return t!==this.currentIndex&&this.stagePool.destroyStageByIndex(t),o}return null}))}getBase64(t){if(!t.container.transform)return null;const e=Vh.p.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const i=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),i}initTransactionPlayer(t){var e,i,n,r,o;const s=null===(e=this.view)||void 0===e?void 0:e.parentElement;if(this.view&&s&&Hy[t.type]&&this.transactionPlayer){const e=null===(i=this.transactionPlayer)||void 0===i?void 0:i.renderer.domElement;this.transactionPlayer.initPlayer({reverse:!this.isForward,stageWidth:this.view.width,stageHeight:this.view.height,presetType:Hy[t.type],duration:null===(r=null===(n=this.currentStage)||void 0===n?void 0:n.json.transition)||void 0===r?void 0:r.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil(null!==(o=this.config.maxFPS)&&void 0!==o?o:60),options:t.options}),e&&(e.style.position="absolute",e.style.zIndex="9",e.style.left="0",e.style.top="0",e.style.width=this.view.style.width,e.style.height=this.view.style.height),s.appendChild(e)}}scaleView(t,e,i){var n;this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px");const r=null===(n=this.transactionPlayer)||void 0===n?void 0:n.renderer.domElement;if(r&&this.view&&(r.style.width=this.view.style.width,r.style.height=this.view.style.height),e){this.scale=t;const e=this.scale*this.config.resolution;this.updateResolution(e,i)}}updateResolution(t,e){this.app.ticker.addOnce(()=>{let i=n_.isDesktop()?t:1;for(;i*this.designWidth>this.maxResolution.x||i*this.designHeight>this.maxResolution.y;)i-=.1;this.app.renderer.resolution=i,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight),Ka()(e)&&e()})}nextStep(t,e){var i;if(this._isPaused)this.logger.info("ppt play prevent next step with paused state",this.taskId);else{this.logger.info("ppt play trigger next step",this.taskId);try{this.onRequestCancelFullscreenVideo(!0),null===(i=this.currentStage)||void 0===i||i.nextStep(t,e)}catch(t){this.errorChannel.emit("error",Tm.transform(t),this.currentIndex)}}}prevStep(t=!1){var e;if(this._isPaused)this.logger.info("ppt play prevent prev step with paused state",this.taskId);else{this.logger.info("ppt play trigger prev step",this.taskId);try{this.onRequestCancelFullscreenVideo(!0),null===(e=this.currentStage)||void 0===e||e.prevStep(t)}catch(t){this.errorChannel.emit("error",Tm.transform(t),this.currentIndex)}}}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var i;null===(i=this.currentStage)||void 0===i||i.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},Dh.c.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,i){var n;null===(n=this.currentStage)||void 0===n||n.setInteractiveSeqState(t,e,i)}setMediaState(t,e,i){var n;return Gy(this,void 0,void 0,(function*(){yield null===(n=this.currentStage)||void 0===n?void 0:n.setMediaState(t,e,i)}))}setMediaCurrentTime(t,e){var i;null===(i=this.currentStage)||void 0===i||i.setMediaCurrentTime(t,e)}pause(){var t;this.app.ticker.stop(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalPause()}),this._isPaused=!0}resume(){var t;this._isPaused=!1,this.app.ticker.start(),null===(t=this.currentStage)||void 0===t||t.ctx.activeMedia.forEach(t=>{t.globalResume()})}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}clearLocalCache(){this.localStorage.dispose()}static clearLocalCache(){var t;null===(t=Fy.localCache)||void 0===t||t.clear().catch(()=>{})}clearFullscreenEventListenersWithAppView(){["mousemove","mouseout","mouseover","touchstart","pointerdown"].forEach(t=>{this.cacheFunctionMap.has(t)&&(this.app.view.removeEventListener(t,this.cacheFunctionMap.get(t),!1),this.cacheFunctionMap.delete(t))})}syncFullscreenVideoState(t){this.globalEventHub.emit("syncFullscreenVideoState",t)}destroy(){var t,e;try{this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost);try{this.app.renderer.filter.texturePool.clear(!0)}catch(t){}qm.collectObjectByGroup(this.objPoolGroup),Zm.collectObjectByGroup(this.objPoolGroup),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage(),this.stagePool.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0}),null===(e=Oy.worker)||void 0===e||e.terminate()}catch(t){}}}zy.platform=n_,zy.RtcAudioClazz=null;var Vy=new Map;var Xy,Wy=i(136),Yy=i.n(Wy),qy=i(49),Zy=i.n(qy),Jy=i(50),Ky=i.n(Jy),Qy=[],$y="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Xy||(Xy={}));var tx,ex=function(t){return Object.freeze(t)},ix=function(t,e){this.inlineSize=t,this.blockSize=e,ex(this)},nx=function(){function t(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,ex(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),rx=function(t){return t instanceof SVGElement&&"getBBox"in t},ox=function(t){if(rx(t)){var e=t.getBBox(),i=e.width,n=e.height;return!i&&!n}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},sx=function(t){var e;if(t instanceof Element)return!0;var i=null===(e=null==t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView;return!!(i&&t instanceof i.Element)},ax="undefined"!=typeof window?window:{},lx=new WeakMap,hx=/auto|scroll/,ux=/^tb|vertical/,cx=/msie|trident/i.test(ax.navigator&&ax.navigator.userAgent),dx=function(t){return parseFloat(t||"0")},px=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=!1),new ix((i?e:t)||0,(i?t:e)||0)},fx=ex({devicePixelContentBoxSize:px(),borderBoxSize:px(),contentBoxSize:px(),contentRect:new nx(0,0,0,0)}),mx=function(t,e){if(void 0===e&&(e=!1),lx.has(t)&&!e)return lx.get(t);if(ox(t))return lx.set(t,fx),fx;var i=getComputedStyle(t),n=rx(t)&&t.ownerSVGElement&&t.getBBox(),r=!cx&&"border-box"===i.boxSizing,o=ux.test(i.writingMode||""),s=!n&&hx.test(i.overflowY||""),a=!n&&hx.test(i.overflowX||""),l=n?0:dx(i.paddingTop),h=n?0:dx(i.paddingRight),u=n?0:dx(i.paddingBottom),c=n?0:dx(i.paddingLeft),d=n?0:dx(i.borderTopWidth),p=n?0:dx(i.borderRightWidth),f=n?0:dx(i.borderBottomWidth),m=c+h,g=l+u,v=(n?0:dx(i.borderLeftWidth))+p,_=d+f,y=a?t.offsetHeight-_-t.clientHeight:0,x=s?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,T=r?g+_:0,E=n?n.width:dx(i.width)-b-x,S=n?n.height:dx(i.height)-T-y,w=E+m+x+v,A=S+g+y+_,M=ex({devicePixelContentBoxSize:px(Math.round(E*devicePixelRatio),Math.round(S*devicePixelRatio),o),borderBoxSize:px(w,A,o),contentBoxSize:px(E,S,o),contentRect:new nx(c,l,E,S)});return lx.set(t,M),M},gx=function(t,e,i){var n=mx(t,i),r=n.borderBoxSize,o=n.contentBoxSize,s=n.devicePixelContentBoxSize;switch(e){case Xy.DEVICE_PIXEL_CONTENT_BOX:return s;case Xy.BORDER_BOX:return r;default:return o}},vx=function(t){var e=mx(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=ex([e.borderBoxSize]),this.contentBoxSize=ex([e.contentBoxSize]),this.devicePixelContentBoxSize=ex([e.devicePixelContentBoxSize])},_x=function(t){if(ox(t))return 1/0;for(var e=0,i=t.parentNode;i;)e+=1,i=i.parentNode;return e},yx=function(){var t=1/0,e=[];Qy.forEach((function(i){if(0!==i.activeTargets.length){var n=[];i.activeTargets.forEach((function(e){var i=new vx(e.target),r=_x(e.target);n.push(i),e.lastReportedSize=gx(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){i.callback.call(i.observer,n,i.observer)})),i.activeTargets.splice(0,i.activeTargets.length)}}));for(var i=0,n=e;i<n.length;i++){(0,n[i])()}return t},xx=function(t){Qy.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(i){i.isActive()&&(_x(i.target)>t?e.activeTargets.push(i):e.skippedTargets.push(i))}))}))},bx=function(){var t,e=0;for(xx(e);Qy.some((function(t){return t.activeTargets.length>0}));)e=yx(),xx(e);return Qy.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:$y}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=$y),window.dispatchEvent(t)),e>0},Tx=[],Ex=function(t){if(!tx){var e=0,i=document.createTextNode("");new MutationObserver((function(){return Tx.splice(0).forEach((function(t){return t()}))})).observe(i,{characterData:!0}),tx=function(){i.textContent="".concat(e?e--:e++)}}Tx.push(t),tx()},Sx=0,wx={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ax=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Mx=function(t){return void 0===t&&(t=0),Date.now()+t},Cx=!1,Rx=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!Cx){Cx=!0;var i,n=Mx(t);i=function(){var i=!1;try{i=bx()}finally{if(Cx=!1,t=n-Mx(),!Sx)return;i?e.run(1e3):t>0?e.run(t):e.start()}},Ex((function(){requestAnimationFrame(i)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,wx)};document.body?e():ax.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ax.forEach((function(e){return ax.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Ax.forEach((function(e){return ax.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),Ix=function(t){!Sx&&t>0&&Rx.start(),!(Sx+=t)&&Rx.stop()},Px=function(){function t(t,e){this.target=t,this.observedBox=e||Xy.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=gx(this.target,this.observedBox,!0);return t=this.target,rx(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),Ox=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},Nx=new WeakMap,Lx=function(t,e){for(var i=0;i<t.length;i+=1)if(t[i].target===e)return i;return-1},Dx=function(){function t(){}return t.connect=function(t,e){var i=new Ox(t,e);Nx.set(t,i)},t.observe=function(t,e,i){var n=Nx.get(t),r=0===n.observationTargets.length;Lx(n.observationTargets,e)<0&&(r&&Qy.push(n),n.observationTargets.push(new Px(e,i&&i.box)),Ix(1),Rx.schedule())},t.unobserve=function(t,e){var i=Nx.get(t),n=Lx(i.observationTargets,e),r=1===i.observationTargets.length;n>=0&&(r&&Qy.splice(Qy.indexOf(i),1),i.observationTargets.splice(n,1),Ix(-1))},t.disconnect=function(t){var e=this,i=Nx.get(t);i.observationTargets.slice().forEach((function(i){return e.unobserve(t,i.target)})),i.activeTargets.splice(0,i.activeTargets.length)},t}(),Fx=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Dx.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!sx(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Dx.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!sx(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Dx.unobserve(this,t)},t.prototype.disconnect=function(){Dx.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),Bx=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},Ux=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},kx=function(){function t(t,e,i,n,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=i,this.index=t,this.slideIndex=e,this.eventHub=n,this.id=r}return t.prototype.apply=function(){return Bx(this,void 0,void 0,(function(){var t;return Ux(this,(function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return t=e.sent(),this.eventHub.emit("task-error",{task:this,error:t}),[3,4];case 4:return[2]}}))}))},t}(),Gx=function(){function t(){var t=this;this.eventHub=new Za.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var i,n=t.tasks.findIndex((function(t){return t.index===e.index})),r=n+1;r>=0&&(null===(i=t.tasks[r])||void 0===i||i.apply()),n>=0&&(t.tasks.splice(n,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var i=e.task,n=t.tasks.findIndex((function(t){return t.index===i.index}));n>=0&&(t.tasks.splice(n,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,i=new Set,n=0,r=this.tasks.length;n<r;n++)"idle"===this.tasks[n].state&&"idle"===(null===(t=this.tasks[n+1])||void 0===t?void 0:t.state)&&i.add(n);Array.from(i).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,i){var n=new kx(this.index++,e,t,this.eventHub,i);this.tasks.push(n),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&n.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t.prototype.destroy=function(){this.eventHub.removeAllListeners()},t}();function Hx(t,e){var i=t.__state.conversionName.toString(),n=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),l=t.s.toFixed(1),h=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===i||"SIX_CHAR_HEX"===i){for(var u=t.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return"CSS_RGB"===i?"rgb("+n+","+r+","+o+")":"CSS_RGBA"===i?"rgba("+n+","+r+","+o+","+s+")":"HEX"===i?"0x"+t.hex.toString(16):"RGB_ARRAY"===i?"["+n+","+r+","+o+"]":"RGBA_ARRAY"===i?"["+n+","+r+","+o+","+s+"]":"RGB_OBJ"===i?"{r:"+n+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===i?"{r:"+n+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===i?"{h:"+a+",s:"+l+",v:"+h+"}":"HSVA_OBJ"===i?"{h:"+a+",s:"+l+",v:"+h+",a:"+s+"}":"unknown format"}var jx=Array.prototype.forEach,zx=Array.prototype.slice,Vx={BREAK:{},extend:function(t){return this.each(zx.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(e[i])||(t[i]=e[i])}.bind(this))}),this),t},defaults:function(t){return this.each(zx.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(t[i])&&(t[i]=e[i])}.bind(this))}),this),t},compose:function(){var t=zx.call(arguments);return function(){for(var e=zx.call(arguments),i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},each:function(t,e,i){if(t)if(jx&&t.forEach&&t.forEach===jx)t.forEach(e,i);else if(t.length===t.length+0){var n,r=void 0;for(r=0,n=t.length;r<n;r++)if(r in t&&e.call(i,t[r],r)===this.BREAK)return}else for(var o in t)if(e.call(i,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,i){var n=void 0;return function(){var r=this,o=arguments;function s(){n=null,i||t.apply(r,o)}var a=i||!n;clearTimeout(n),n=setTimeout(s,e),a&&t.apply(r,o)}},toArray:function(t){return t.toArray?t.toArray():zx.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},Xx=[{litmus:Vx.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:Hx},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:Hx},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:Hx},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:Hx}}},{litmus:Vx.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:Vx.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:Vx.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(Vx.isNumber(t.r)&&Vx.isNumber(t.g)&&Vx.isNumber(t.b)&&Vx.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(Vx.isNumber(t.r)&&Vx.isNumber(t.g)&&Vx.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(Vx.isNumber(t.h)&&Vx.isNumber(t.s)&&Vx.isNumber(t.v)&&Vx.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(Vx.isNumber(t.h)&&Vx.isNumber(t.s)&&Vx.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],Wx=void 0,Yx=void 0,qx=function(){Yx=!1;var t=arguments.length>1?Vx.toArray(arguments):arguments[0];return Vx.each(Xx,(function(e){if(e.litmus(t))return Vx.each(e.conversions,(function(e,i){if(Wx=e.read(t),!1===Yx&&!1!==Wx)return Yx=Wx,Wx.conversionName=i,Wx.conversion=e,Vx.BREAK})),Vx.BREAK})),Yx},Zx=void 0,Jx={hsv_to_rgb:function(t,e,i){var n=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=i*(1-e),s=i*(1-r*e),a=i*(1-(1-r)*e),l=[[i,a,o],[s,i,o],[o,i,a],[o,s,i],[a,o,i],[i,o,s]][n];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,i){var n=Math.min(t,e,i),r=Math.max(t,e,i),o=r-n,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-i)/o:e===r?2+(i-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,i){var n=this.hex_with_component(0,2,t);return n=this.hex_with_component(n,1,e),n=this.hex_with_component(n,0,i)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,i){return i<<(Zx=8*e)|t&~(255<<Zx)}},Kx="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qx=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},$x=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),tb=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0},eb=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},ib=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},nb=function(){function t(){if(Qx(this,t),this.__state=qx.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return $x(t,[{key:"toString",value:function(){return Hx(this)}},{key:"toHexString",value:function(){return Hx(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function rb(t,e,i){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||nb.recalculateRGB(this,e,i),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(nb.recalculateRGB(this,e,i),this.__state.space="RGB"),this.__state[e]=t}})}function ob(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||nb.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(nb.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}nb.recalculateRGB=function(t,e,i){if("HEX"===t.__state.space)t.__state[e]=Jx.component_from_hex(t.__state.hex,i);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");Vx.extend(t.__state,Jx.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},nb.recalculateHSV=function(t){var e=Jx.rgb_to_hsv(t.r,t.g,t.b);Vx.extend(t.__state,{s:e.s,v:e.v}),Vx.isNaN(e.h)?Vx.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},nb.COMPONENTS=["r","g","b","h","s","v","hex","a"],rb(nb.prototype,"r",2),rb(nb.prototype,"g",1),rb(nb.prototype,"b",0),ob(nb.prototype,"h"),ob(nb.prototype,"s"),ob(nb.prototype,"v"),Object.defineProperty(nb.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(nb.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=Jx.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var sb=function(){function t(e,i){Qx(this,t),this.initialValue=e[i],this.domElement=document.createElement("div"),this.object=e,this.property=i,this.__onChange=void 0,this.__onFinishChange=void 0}return $x(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),ab={};Vx.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){Vx.each(t,(function(t){ab[t]=e}))}));var lb=/(\d+(\.\d+)?)px/;function hb(t){if("0"===t||Vx.isUndefined(t))return 0;var e=t.match(lb);return Vx.isNull(e)?0:parseFloat(e[1])}var ub={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,i){var n=i,r=e;Vx.isUndefined(r)&&(r=!0),Vx.isUndefined(n)&&(n=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),n&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,i,n){var r=i||{},o=ab[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;s.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var h=s.initKeyboardEvent||s.initKeyEvent;Vx.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(e,r.bubbles||!1,r.cancelable||!0)}Vx.defaults(s,n),t.dispatchEvent(s)},bind:function(t,e,i,n){var r=n||!1;return t.addEventListener?t.addEventListener(e,i,r):t.attachEvent&&t.attachEvent("on"+e,i),ub},unbind:function(t,e,i,n){var r=n||!1;return t.removeEventListener?t.removeEventListener(e,i,r):t.detachEvent&&t.detachEvent("on"+e,i),ub},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var i=t.className.split(/ +/);-1===i.indexOf(e)&&(i.push(e),t.className=i.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return ub},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var i=t.className.split(/ +/),n=i.indexOf(e);-1!==n&&(i.splice(n,1),t.className=i.join(" "))}else t.className=void 0;return ub},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return hb(e["border-left-width"])+hb(e["border-right-width"])+hb(e["padding-left"])+hb(e["padding-right"])+hb(e.width)},getHeight:function(t){var e=getComputedStyle(t);return hb(e["border-top-width"])+hb(e["border-bottom-width"])+hb(e["padding-top"])+hb(e["padding-bottom"])+hb(e.height)},getOffset:function(t){var e=t,i={left:0,top:0};if(e.offsetParent)do{i.left+=e.offsetLeft,i.top+=e.offsetTop,e=e.offsetParent}while(e);return i},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},cb=function(t){function e(t,i){Qx(this,e);var n=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n;return n.__prev=n.getValue(),n.__checkbox=document.createElement("input"),n.__checkbox.setAttribute("type","checkbox"),ub.bind(n.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),n.domElement.appendChild(n.__checkbox),n.updateDisplay(),n}return eb(e,t),$x(e,[{key:"setValue",value:function(t){var i=tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),i}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sb),db=function(t){function e(t,i,n){Qx(this,e);var r=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=n,s=r;if(r.__select=document.createElement("select"),Vx.isArray(o)){var a={};Vx.each(o,(function(t){a[t]=t})),o=a}return Vx.each(o,(function(t,e){var i=document.createElement("option");i.innerHTML=e,i.setAttribute("value",t),s.__select.appendChild(i)})),r.updateDisplay(),ub.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),r.domElement.appendChild(r.__select),r}return eb(e,t),$x(e,[{key:"setValue",value:function(t){var i=tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),i}},{key:"updateDisplay",value:function(){return ub.isActive(this.__select)?this:(this.__select.value=this.getValue(),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(sb),pb=function(t){function e(t,i){Qx(this,e);var n=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n;function o(){r.setValue(r.__input.value)}return n.__input=document.createElement("input"),n.__input.setAttribute("type","text"),ub.bind(n.__input,"keyup",o),ub.bind(n.__input,"change",o),ub.bind(n.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),ub.bind(n.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),n.updateDisplay(),n.domElement.appendChild(n.__input),n}return eb(e,t),$x(e,[{key:"updateDisplay",value:function(){return ub.isActive(this.__input)||(this.__input.value=this.getValue()),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sb);function fb(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var mb=function(t){function e(t,i,n){Qx(this,e);var r=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=n||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,Vx.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=fb(r.__impliedStep),r}return eb(e,t),$x(e,[{key:"setValue",value:function(t){var i=t;return void 0!==this.__min&&i<this.__min?i=this.__min:void 0!==this.__max&&i>this.__max&&(i=this.__max),void 0!==this.__step&&i%this.__step!=0&&(i=Math.round(i/this.__step)*this.__step),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,i)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=fb(t),this}}]),e}(sb);var gb=function(t){function e(t,i,n){Qx(this,e);var r=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,n));r.__truncationSuspended=!1;var o=r,s=void 0;function a(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function l(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function h(){ub.unbind(window,"mousemove",l),ub.unbind(window,"mouseup",h),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),ub.bind(r.__input,"change",(function(){var t=parseFloat(o.__input.value);Vx.isNaN(t)||o.setValue(t)})),ub.bind(r.__input,"blur",(function(){a()})),ub.bind(r.__input,"mousedown",(function(t){ub.bind(window,"mousemove",l),ub.bind(window,"mouseup",h),s=t.clientY})),ub.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return eb(e,t),$x(e,[{key:"updateDisplay",value:function(){var t,i,n;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),i=this.__precision,n=Math.pow(10,i),Math.round(t*n)/n),tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(mb);function vb(t,e,i,n,r){return n+(t-e)/(i-e)*(r-n)}var _b=function(t){function e(t,i,n,r,o){Qx(this,e);var s=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,{min:n,max:r,step:o})),a=s;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(vb(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function h(){ub.unbind(window,"mousemove",l),ub.unbind(window,"mouseup",h),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function u(t){var e=t.touches[0].clientX,i=a.__background.getBoundingClientRect();a.setValue(vb(e,i.left,i.right,a.__min,a.__max))}function c(){ub.unbind(window,"touchmove",u),ub.unbind(window,"touchend",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),ub.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),ub.bind(window,"mousemove",l),ub.bind(window,"mouseup",h),l(t)})),ub.bind(s.__background,"touchstart",(function(t){if(1!==t.touches.length)return;ub.bind(window,"touchmove",u),ub.bind(window,"touchend",c),u(t)})),ub.addClass(s.__background,"slider"),ub.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return eb(e,t),$x(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",tb(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(mb),yb=function(t){function e(t,i,n){Qx(this,e);var r=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===n?"Fire":n,ub.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),ub.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return eb(e,t),$x(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(sb),xb=function(t){function e(t,i){Qx(this,e);var n=ib(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));n.__color=new nb(n.getValue()),n.__temp=new nb(0);var r=n;n.domElement=document.createElement("div"),ub.makeSelectable(n.domElement,!1),n.__selector=document.createElement("div"),n.__selector.className="selector",n.__saturation_field=document.createElement("div"),n.__saturation_field.className="saturation-field",n.__field_knob=document.createElement("div"),n.__field_knob.className="field-knob",n.__field_knob_border="2px solid ",n.__hue_knob=document.createElement("div"),n.__hue_knob.className="hue-knob",n.__hue_field=document.createElement("div"),n.__hue_field.className="hue-field",n.__input=document.createElement("input"),n.__input.type="text",n.__input_textShadow="0 1px 1px ",ub.bind(n.__input,"keydown",(function(t){13===t.keyCode&&c.call(this)})),ub.bind(n.__input,"blur",c),ub.bind(n.__selector,"mousedown",(function(){ub.addClass(this,"drag").bind(window,"mouseup",(function(){ub.removeClass(r.__selector,"drag")}))})),ub.bind(n.__selector,"touchstart",(function(){ub.addClass(this,"drag").bind(window,"touchend",(function(){ub.removeClass(r.__selector,"drag")}))}));var o,s=document.createElement("div");function a(t){p(t),ub.bind(window,"mousemove",p),ub.bind(window,"touchmove",p),ub.bind(window,"mouseup",h),ub.bind(window,"touchend",h)}function l(t){f(t),ub.bind(window,"mousemove",f),ub.bind(window,"touchmove",f),ub.bind(window,"mouseup",u),ub.bind(window,"touchend",u)}function h(){ub.unbind(window,"mousemove",p),ub.unbind(window,"touchmove",p),ub.unbind(window,"mouseup",h),ub.unbind(window,"touchend",h),d()}function u(){ub.unbind(window,"mousemove",f),ub.unbind(window,"touchmove",f),ub.unbind(window,"mouseup",u),ub.unbind(window,"touchend",u),d()}function c(){var t=qx(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),i=t.touches&&t.touches[0]||t,n=i.clientX,o=i.clientY,s=(n-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),i=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return i>1?i=1:i<0&&(i=0),r.__color.h=360*i,r.setValue(r.__color.toOriginal()),!1}return Vx.extend(n.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Vx.extend(n.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:n.__field_knob_border+(n.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Vx.extend(n.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Vx.extend(n.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Vx.extend(s.style,{width:"100%",height:"100%",background:"none"}),Tb(s,"top","rgba(0,0,0,0)","#000"),Vx.extend(n.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=n.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Vx.extend(n.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:n.__input_textShadow+"rgba(0,0,0,0.7)"}),ub.bind(n.__saturation_field,"mousedown",a),ub.bind(n.__saturation_field,"touchstart",a),ub.bind(n.__field_knob,"mousedown",a),ub.bind(n.__field_knob,"touchstart",a),ub.bind(n.__hue_field,"mousedown",l),ub.bind(n.__hue_field,"touchstart",l),n.__saturation_field.appendChild(s),n.__selector.appendChild(n.__field_knob),n.__selector.appendChild(n.__saturation_field),n.__selector.appendChild(n.__hue_field),n.__hue_field.appendChild(n.__hue_knob),n.domElement.appendChild(n.__input),n.domElement.appendChild(n.__selector),n.updateDisplay(),n}return eb(e,t),$x(e,[{key:"updateDisplay",value:function(){var t=qx(this.getValue());if(!1!==t){var e=!1;Vx.each(nb.COMPONENTS,(function(i){if(!Vx.isUndefined(t[i])&&!Vx.isUndefined(this.__color.__state[i])&&t[i]!==this.__color.__state[i])return e=!0,{}}),this),e&&Vx.extend(this.__color.__state,t)}Vx.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var i=this.__color.v<.5||this.__color.s>.5?255:0,n=255-i;Vx.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+i+","+i+","+i+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,Tb(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Vx.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+i+","+i+","+i+")",textShadow:this.__input_textShadow+"rgba("+n+","+n+","+n+",.7)"})}}]),e}(sb),bb=["-moz-","-o-","-webkit-","-ms-",""];function Tb(t,e,i,n){t.style.background="",Vx.each(bb,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+i+" 0%, "+n+" 100%); "}))}var Eb=function(t,e){var i=e||document,n=document.createElement("style");n.type="text/css",n.innerHTML=t;var r=i.getElementsByTagName("head")[0];try{r.appendChild(n)}catch(t){}},Sb='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',wb=function(t,e){var i=t[e];return Vx.isArray(arguments[2])||Vx.isObject(arguments[2])?new db(t,e,arguments[2]):Vx.isNumber(i)?Vx.isNumber(arguments[2])&&Vx.isNumber(arguments[3])?Vx.isNumber(arguments[4])?new _b(t,e,arguments[2],arguments[3],arguments[4]):new _b(t,e,arguments[2],arguments[3]):Vx.isNumber(arguments[4])?new gb(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new gb(t,e,{min:arguments[2],max:arguments[3]}):Vx.isString(i)?new pb(t,e):Vx.isFunction(i)?new yb(t,e,""):Vx.isBoolean(i)?new cb(t,e):null};var Ab=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},Mb=function(){function t(){Qx(this,t),this.backgroundElement=document.createElement("div"),Vx.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),ub.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Vx.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;ub.bind(this.backgroundElement,"click",(function(){e.hide()}))}return $x(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),Vx.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",ub.unbind(t.domElement,"webkitTransitionEnd",e),ub.unbind(t.domElement,"transitionend",e),ub.unbind(t.domElement,"oTransitionEnd",e)};ub.bind(this.domElement,"webkitTransitionEnd",e),ub.bind(this.domElement,"transitionend",e),ub.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-ub.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-ub.getHeight(this.domElement)/2+"px"}}]),t}();Eb(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var Cb=function(){try{return!!window.localStorage}catch(t){return!1}}(),Rb=void 0,Ib=!0,Pb=void 0,Ob=!1,Nb=[],Lb=function t(e){var i=this,n=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),ub.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=Vx.defaults(n,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),n=Vx.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),Vx.isUndefined(n.load)?n.load={preset:"Default"}:n.preset&&(n.load.preset=n.preset),Vx.isUndefined(n.parent)&&n.hideable&&Nb.push(this),n.resizable=Vx.isUndefined(n.parent)&&n.resizable,n.autoPlace&&Vx.isUndefined(n.scrollable)&&(n.scrollable=!0);var r,o=Cb&&"true"===localStorage.getItem(Gb(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return n.parent}},scrollable:{get:function(){return n.scrollable}},autoPlace:{get:function(){return n.autoPlace}},closeOnTop:{get:function(){return n.closeOnTop}},preset:{get:function(){return i.parent?i.getRoot().preset:n.load.preset},set:function(t){i.parent?i.getRoot().preset=t:n.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),i.revert()}},width:{get:function(){return n.width},set:function(t){n.width=t,Xb(i,t)}},name:{get:function(){return n.name},set:function(t){n.name=t,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(e){n.closed=e,n.closed?ub.addClass(i.__ul,t.CLASS_CLOSED):ub.removeClass(i.__ul,t.CLASS_CLOSED),this.onResize(),i.__closeButton&&(i.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return o},set:function(t){Cb&&(o=t,t?ub.bind(window,"unload",s):ub.unbind(window,"unload",s),localStorage.setItem(Gb(i,"isLocal"),t))}}}),Vx.isUndefined(n.parent)){if(this.closed=n.closed||!1,ub.addClass(this.domElement,t.CLASS_MAIN),ub.makeSelectable(this.domElement,!1),Cb&&o){i.useLocalStorage=!0;var l=localStorage.getItem(Gb(this,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,ub.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),n.closeOnTop?(ub.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(ub.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),ub.bind(this.__closeButton,"click",(function(){i.closed=!i.closed}))}else{void 0===n.closed&&(n.closed=!0);var h=document.createTextNode(n.name);ub.addClass(h,"controller-name"),a=Db(i,h);ub.addClass(this.__ul,t.CLASS_CLOSED),ub.addClass(a,"title"),ub.bind(a,"click",(function(t){return t.preventDefault(),i.closed=!i.closed,!1})),n.closed||(this.closed=!1)}n.autoPlace&&(Vx.isUndefined(n.parent)&&(Ib&&(Pb=document.createElement("div"),ub.addClass(Pb,"dg"),ub.addClass(Pb,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(Pb),Ib=!1),Pb.appendChild(this.domElement),ub.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||Xb(i,n.width)),this.__resizeHandler=function(){i.onResizeDebounced()},ub.bind(window,"resize",this.__resizeHandler),ub.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),ub.bind(this.__ul,"transitionend",this.__resizeHandler),ub.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&Vb(this),s=function(){Cb&&"true"===localStorage.getItem(Gb(i,"isLocal"))&&localStorage.setItem(Gb(i,"gui"),JSON.stringify(i.getSaveObject()))},this.saveToLocalStorageIfPossible=s,n.parent||((r=i.getRoot()).width+=1,Vx.defer((function(){r.width-=1})))};function Db(t,e,i){var n=document.createElement("li");return e&&n.appendChild(e),i?t.__ul.insertBefore(n,i):t.__ul.appendChild(n),t.onResize(),n}function Fb(t){ub.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&ub.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function Bb(t,e){var i=t.__preset_select[t.__preset_select.selectedIndex];i.innerHTML=e?i.value+"*":i.value}function Ub(t,e){var i=t.getRoot(),n=i.__rememberedObjects.indexOf(e.object);if(-1!==n){var r=i.__rememberedObjectIndecesToControllers[n];if(void 0===r&&(r={},i.__rememberedObjectIndecesToControllers[n]=r),r[e.property]=e,i.load&&i.load.remembered){var o=i.load.remembered,s=void 0;if(o[t.preset])s=o[t.preset];else{if(!o.Default)return;s=o.Default}if(s[n]&&void 0!==s[n][e.property]){var a=s[n][e.property];e.initialValue=a,e.setValue(a)}}}}function kb(t,e,i,n){if(void 0===e[i])throw new Error('Object "'+e+'" has no property "'+i+'"');var r=void 0;if(n.color)r=new xb(e,i);else{var o=[e,i].concat(n.factoryArgs);r=wb.apply(t,o)}n.before instanceof sb&&(n.before=n.before.__li),Ub(t,r),ub.addClass(r.domElement,"c");var s=document.createElement("span");ub.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l=Db(t,a,n.before);return ub.addClass(l,Lb.CLASS_CONTROLLER_ROW),r instanceof xb?ub.addClass(l,"color"):ub.addClass(l,Kx(r.getValue())),function(t,e,i){if(i.__li=e,i.__gui=t,Vx.extend(i,{options:function(e){if(arguments.length>1){var n=i.__li.nextElementSibling;return i.remove(),kb(t,i.object,i.property,{before:n,factoryArgs:[Vx.toArray(arguments)]})}if(Vx.isArray(e)||Vx.isObject(e)){var r=i.__li.nextElementSibling;return i.remove(),kb(t,i.object,i.property,{before:r,factoryArgs:[e]})}},name:function(t){return i.__li.firstElementChild.firstElementChild.innerHTML=t,i},listen:function(){return i.__gui.listen(i),i},remove:function(){return i.__gui.remove(i),i}}),i instanceof _b){var n=new gb(i.object,i.property,{min:i.__min,max:i.__max,step:i.__step});Vx.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=i[t],r=n[t];i[t]=n[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(n,t),e.apply(i,t)}})),ub.addClass(e,"has-slider"),i.domElement.insertBefore(n.domElement,i.domElement.firstElementChild)}else if(i instanceof gb){var r=function(e){if(Vx.isNumber(i.__min)&&Vx.isNumber(i.__max)){var n=i.__li.firstElementChild.firstElementChild.innerHTML,r=i.__gui.__listening.indexOf(i)>-1;i.remove();var o=kb(t,i.object,i.property,{before:i.__li.nextElementSibling,factoryArgs:[i.__min,i.__max,i.__step]});return o.name(n),r&&o.listen(),o}return e};i.min=Vx.compose(r,i.min),i.max=Vx.compose(r,i.max)}else i instanceof cb?(ub.bind(e,"click",(function(){ub.fakeEvent(i.__checkbox,"click")})),ub.bind(i.__checkbox,"click",(function(t){t.stopPropagation()}))):i instanceof yb?(ub.bind(e,"click",(function(){ub.fakeEvent(i.__button,"click")})),ub.bind(e,"mouseover",(function(){ub.addClass(i.__button,"hover")})),ub.bind(e,"mouseout",(function(){ub.removeClass(i.__button,"hover")}))):i instanceof xb&&(ub.addClass(e,"color"),i.updateDisplay=Vx.compose((function(t){return e.style.borderLeftColor=i.__color.toString(),t}),i.updateDisplay),i.updateDisplay());i.setValue=Vx.compose((function(e){return t.getRoot().__preset_select&&i.isModified()&&Bb(t.getRoot(),!0),e}),i.setValue)}(t,l,r),t.__controllers.push(r),r}function Gb(t,e){return document.location.href+"."+e}function Hb(t,e,i){var n=document.createElement("option");n.innerHTML=e,n.value=e,t.__preset_select.appendChild(n),i&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function jb(t,e){e.style.display=t.useLocalStorage?"block":"none"}function zb(t){var e=t.__save_row=document.createElement("li");ub.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),ub.addClass(e,"save-row");var i=document.createElement("span");i.innerHTML="&nbsp;",ub.addClass(i,"button gears");var n=document.createElement("span");n.innerHTML="Save",ub.addClass(n,"button"),ub.addClass(n,"save");var r=document.createElement("span");r.innerHTML="New",ub.addClass(r,"button"),ub.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",ub.addClass(o,"button"),ub.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?Vx.each(t.load.remembered,(function(e,i){Hb(t,i,i===t.preset)})):Hb(t,"Default",!1),ub.bind(s,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(s),e.appendChild(i),e.appendChild(n),e.appendChild(r),e.appendChild(o),Cb){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(Gb(0,"isLocal"))&&l.setAttribute("checked","checked"),jb(t,a),ub.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,jb(t,a)}))}var h=document.getElementById("dg-new-constructor");ub.bind(h,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||Rb.hide()})),ub.bind(i,"click",(function(){h.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),Rb.show(),h.focus(),h.select()})),ub.bind(n,"click",(function(){t.save()})),ub.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),ub.bind(o,"click",(function(){t.revert()}))}function Vb(t){var e=void 0;function i(i){return i.preventDefault(),t.width+=e-i.clientX,t.onResize(),e=i.clientX,!1}function n(){ub.removeClass(t.__closeButton,Lb.CLASS_DRAG),ub.unbind(window,"mousemove",i),ub.unbind(window,"mouseup",n)}function r(r){return r.preventDefault(),e=r.clientX,ub.addClass(t.__closeButton,Lb.CLASS_DRAG),ub.bind(window,"mousemove",i),ub.bind(window,"mouseup",n),!1}t.__resize_handle=document.createElement("div"),Vx.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),ub.bind(t.__resize_handle,"mousedown",r),ub.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function Xb(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function Wb(t,e){var i={};return Vx.each(t.__rememberedObjects,(function(n,r){var o={},s=t.__rememberedObjectIndecesToControllers[r];Vx.each(s,(function(t,i){o[i]=e?t.initialValue:t.getValue()})),i[r]=o})),i}Lb.toggleHide=function(){Ob=!Ob,Vx.each(Nb,(function(t){t.domElement.style.display=Ob?"none":""}))},Lb.CLASS_AUTO_PLACE="a",Lb.CLASS_AUTO_PLACE_CONTAINER="ac",Lb.CLASS_MAIN="main",Lb.CLASS_CONTROLLER_ROW="cr",Lb.CLASS_TOO_TALL="taller-than-window",Lb.CLASS_CLOSED="closed",Lb.CLASS_CLOSE_BUTTON="close-button",Lb.CLASS_CLOSE_TOP="close-top",Lb.CLASS_CLOSE_BOTTOM="close-bottom",Lb.CLASS_DRAG="drag",Lb.DEFAULT_WIDTH=245,Lb.TEXT_CLOSED="Close Controls",Lb.TEXT_OPEN="Open Controls",Lb._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||Lb.toggleHide()},ub.bind(window,"keydown",Lb._keydownHandler,!1),Vx.extend(Lb.prototype,{add:function(t,e){return kb(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return kb(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;Vx.defer((function(){e.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&Pb.removeChild(this.domElement);var t=this;Vx.each(this.__folders,(function(e){t.removeFolder(e)})),ub.unbind(window,"keydown",Lb._keydownHandler,!1),Fb(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var i=new Lb(e);this.__folders[t]=i;var n=Db(this,i.domElement);return ub.addClass(n,"folder"),i},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],Fb(t);var e=this;Vx.each(t.__folders,(function(e){t.removeFolder(e)})),Vx.defer((function(){e.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=ub.getOffset(t.__ul).top,i=0;Vx.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(i+=ub.getHeight(e))})),window.innerHeight-e-20<i?(ub.addClass(t.domElement,Lb.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(ub.removeClass(t.domElement,Lb.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&Vx.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:Vx.debounce((function(){this.onResize()}),50),remember:function(){if(Vx.isUndefined(Rb)&&((Rb=new Mb).domElement.innerHTML=Sb),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;Vx.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&zb(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&Xb(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=Wb(this)),t.folders={},Vx.each(this.__folders,(function(e,i){t.folders[i]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Wb(this),Bb(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=Wb(this,!0)),this.load.remembered[t]=Wb(this),this.preset=t,Hb(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){Vx.each(this.__controllers,(function(e){this.getRoot().load.remembered?Ub(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),Vx.each(this.__folders,(function(t){t.revert(t)})),t||Bb(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&Ab.call(window,(function(){t(e)}));Vx.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){Vx.each(this.__controllers,(function(t){t.updateDisplay()})),Vx.each(this.__folders,(function(t){t.updateDisplay()}))}});var Yb=Lb,qb=function(){function t(t){this.player=t}return Object.defineProperty(t.prototype,"frameRate",{get:function(){return this.player.fps.value},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawFrames",{get:function(){return this.player.runtime.fps},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawCall",{get:function(){return this.player.runtime.drawCall},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this.player.config.resolution},set:function(t){this.player.updateConfig({resolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var t,e;return(null===(t=this.player.view)||void 0===t?void 0:t.width)+"*"+(null===(e=this.player.view)||void 0===e?void 0:e.height)},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minFPS",{get:function(){return this.player.config.minFPS},set:function(t){this.player.updateConfig({minFPS:t,maxFPS:this.player.config.maxFPS})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxFPS",{get:function(){return this.player.config.maxFPS},set:function(t){this.player.updateConfig({maxFPS:t,minFPS:this.player.config.minFPS})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoResolution",{get:function(){return this.player.config.autoResolution},set:function(t){this.player.updateConfig({autoResolution:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoFPS",{get:function(){return this.player.config.autoFPS},set:function(t){this.player.updateConfig({autoFPS:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundColor",{get:function(){return this.player.config.transactionBgColor},set:function(t){this.player.updateConfig({transactionBgColor:t})},enumerable:!1,configurable:!0}),t}(),Zb=function(){function t(t,e){var i;this.config=new qb(t),this.anchor=e,i=this.createControllerGUI(),this.gui=i[0],this.controller=i[1],this.createStats()}return t.prototype.createStats=function(){var t=this;this.stateId=setInterval((function(){t.controller.frameRate.updateDisplay(),t.controller.size.updateDisplay(),t.controller.minFPS.updateDisplay(),t.controller.drawFrames.updateDisplay(),t.controller.maxFPS.updateDisplay(),t.controller.resolution.updateDisplay(),t.controller.autoFps.updateDisplay(),t.controller.autoResolution.updateDisplay(),t.controller.drawCall.updateDisplay()}),16)},t.prototype.createControllerGUI=function(){var t=new Yb({autoPlace:!0,closed:!0});t.domElement.style.opacity=".6",t.domElement.style.transformOrigin="100% 0",t.domElement.style.transform="scale(1)",this.anchor.appendChild(t.domElement),t.domElement.style.position="absolute",t.domElement.style.right="0",t.domElement.style.top="0",t.domElement.style.zIndex="2";var e={frameRate:t.add(this.config,"frameRate"),drawFrames:t.add(this.config,"drawFrames"),drawCall:t.add(this.config,"drawCall"),size:t.add(this.config,"size"),minFPS:t.add(this.config,"minFPS",0,60),maxFPS:t.add(this.config,"maxFPS",0,60),resolution:t.add(this.config,"resolution",.5,8,.5),autoResolution:t.add(this.config,"autoResolution"),autoFps:t.add(this.config,"autoFPS"),transactionBgColor:t.addColor(this.config,"backgroundColor")};return[t,e]},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.anchor.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),Jb=function(){function t(t){var e=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){e.isScheduling=!0;var t=e.tasks.shift();t&&!e.isDestroy&&e.fn(t).then((function(){e.tasks.length>0?window.requestAnimationFrame(e.schedule):e.isScheduling=!1}))},this.fn=t}return t.prototype.destroy=function(){this.isDestroy=!0},t.prototype.addTask=function(t){this.tasks.push(t),this.isScheduling||this.schedule()},t}(),Kb=function(){function t(t){this.autoUnlock=Object.create(null),this.locks=Object.create(null),this.available=!1,this.available=t}return t.prototype.addLock=function(t,e){var i=this;this.available&&(this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete i.locks[t]}),3e3))},t.prototype.unlock=function(t,e){this.available&&e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.available&&!!this.locks[t]},t}(),Qb=function(){function t(){var t=this;this.tasks=[],this.isDestroy=!1,this.isScheduling=!1,this.schedule=function(){t.isScheduling=!0;var e=t.tasks.shift();e&&!t.isDestroy&&(e.status="running",e.fn.apply(null).then((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})).catch((function(){t.tasks.length>0?window.requestAnimationFrame(t.schedule):t.isScheduling=!1})))}}return t.prototype.getRunningTask=function(){return this.tasks[0]&&"running"===this.tasks[0].status?this.tasks[0]:null},t.prototype.addTask=function(t,e){var i={type:t,status:"wait",fn:e},n=this.getRunningTask();n&&t===n.type||(this.tasks=this.tasks.filter((function(e){return e.type!==t})),this.tasks.push(i),this.isScheduling||this.schedule())},t.prototype.destroy=function(){this.isDestroy=!0},t}(),$b=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},tT=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eT=function(){function t(){var t=this;this.logList=[],this.checkTimer=null,this.retryTimes=0,this.enable=!1,this.uploadLoggerGlobalEvent=function(e){"@slide/_upload_log_"===e.data.type&&t.start()},this.config={checkTime:3e3,buffer:300},window.addEventListener("message",this.uploadLoggerGlobalEvent),this.start()}return t.prototype.start=function(){return $b(this,void 0,void 0,(function(){var t=this;return tT(this,(function(e){return clearInterval(this.checkTimer),this.checkTimer=setInterval((function(){return $b(t,void 0,void 0,(function(){return tT(this,(function(t){switch(t.label){case 0:return[4,this.uploadLog()];case 1:return t.sent(),[2]}}))}))}),this.config.checkTime),[2]}))}))},t.prototype.pause=function(){clearInterval(this.checkTimer)},t.prototype.addLog=function(t,e,i,n){this.logList.push({level:e,taskId:i,message:t,randomId:n})},t.prototype.destroy=function(){clearInterval(this.checkTimer),window.removeEventListener("message",this.uploadLoggerGlobalEvent)},t.prototype.uploadLog=function(t){return void 0===t&&(t=!1),$b(this,void 0,void 0,(function(){var e,i,n,r=this;return tT(this,(function(o){switch(o.label){case 0:if(!(this.logList.length>=this.config.buffer||t))return[2];e=this.logList.splice(0),i=function(){r.logList=e.concat(r.logList),r.retryTimes>3&&r.pause(),r.retryTimes+=1},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,fetch("https://netless-ppt-plugin-dev.cn-hangzhou.log.aliyuncs.com/logstores/netless-ppt-plugin-dev/track",{method:"POST",headers:{"x-log-apiversion":"0.6.0","Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify({__topic__:"netless-ppt-plugin-dev",__source__:"netless-ppt-plugin-dev",__logs__:e})})];case 2:return o.sent().ok?this.retryTimes=0:i(),[3,4];case 3:return n=o.sent(),console.warn(n),i(),[3,4];case 4:return[2]}}))}))},t.prototype.setEnable=function(t){this.enable!==t&&(t?this.start():this.pause())},t}(),iT=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},nT=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function rT(t,e,i){return iT(this,void 0,void 0,(function(){var n,r,o,s;return nT(this,(function(a){switch(a.label){case 0:return n=document.createElement("div"),(r=new vT({anchor:n,renderOptions:{minFPS:1,maxFPS:1,resolution:1},mode:"local",interactive:!1,useLocalCache:!0})).setResource(t,e),[4,r.getSlideCountAsync()];case 1:o=a.sent(),s=1,a.label=2;case 2:return s<=o?[4,r.player.stagePool.preload(s,!0)]:[3,5];case 3:a.sent(),i(Math.round(s/o*100)/100),a.label=4;case 4:return s++,[3,2];case 5:return r.destroy(),[2]}}))}))}var oT=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),sT=function(){return(sT=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},aT=function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},lT=function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))},hT=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},uT=window.ResizeObserver||Fx,cT=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function dT(t,e){return lT(this,void 0,void 0,(function(){var i;return hT(this,(function(n){switch(n.label){case 0:i=Date.now(),n.label=1;case 1:return!t()&&Date.now()-i<e?[4,cT(50)]:[3,3];case 2:return n.sent(),i=Date.now(),[3,1];case 3:return[2]}}))}))}var pT={syncDispatch:"syncDispatch",syncReceive:"syncReceive",syncEventLag:"syncEventLag",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange",slideStepEnd:"slideEnd",slideStepStart:"slideStart"},fT={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},mT="";try{mT="1.1.9-beta.3"}catch(t){mT="dev -"}var gT=null;try{(gT=o.createInstance({name:"__slide_local_log__",driver:o.INDEXEDDB,version:1})).ready((function(t){})).catch((function(t){}))}catch(t){}var vT=function(t){function e(i){var n=t.call(this)||this;return n.iosResetCache=[],n.needClearCacheImage=!1,n.version=mT,n.__slideState=Ky()(fT),n.userInputTime=0,n.isSyncingSlideState=!1,n.frozenTaskManager=new Qb,n.randomId=r(),n.resize=!1,n.isAnimating=!1,n.renderingTaskManager=new Gx,n.isLoading=!1,n.interactive=!0,n.renderingIndex=0,n.frameWidth=1,n.frameHeight=1,n.frame=document.createElement("div"),n.canvasContainer=document.createElement("div"),n.medianController=document.createElement("div"),n.frameResizeObserver=new uT((function(){return n.frameResizeHandler()})),n.timestamp=function(){return Date.now()},n.mode="local",n.enableGlobalClick=!1,n.lastEmitedState=null,n.playerController=null,n.isInitResized=!1,n.cacheImage=document.createElement("img"),n.isTouchStart=!1,n.touchStartId=void 0,n.taskId="",n.volumeAdjuster=new ky,n.designWidth=0,n.designHeight=0,n._slideCount=0,n._dispatchIncrId=0,n._receiveIncrId=0,n._updateVolumeByStaticAdjuster=function(t){n.volumeAdjuster.volume=t},n.recoverHandler=function(t){if("@slide/_recover_"===t.data.type&&t.data.slideId===n.randomId){var e=t.data,i=e.recoverBy,r=e.payload;if(!r)return;"renderOtherPage"===i&&r.slideIndex?n.doRenderSlide(r.slideIndex).catch((function(t){n.logger.error(t,n.taskId)})):"reloadCurrentPage"===i&&n.doRenderSlide(n.renderingIndex).catch((function(t){n.logger.error(t,n.taskId)}))}},n.userInputHandle=function(){n.userInputTime=Date.now()},n.handleViewClick=function(){setTimeout((function(){var t=Date.now();Math.abs(t-n.userInputTime)>500&&n.enableGlobalClick&&n.nextStep()}))},n.handleViewTouchStart=function(){window.clearTimeout(n.touchStartId),n.isTouchStart=!0,n.touchStartId=setTimeout((function(){n.isTouchStart=!1}),350)},n.handleViewTouchEnd=function(){n.isTouchStart&&(n.isTouchStart=!1,n.handleViewClick())},n.handleSlideRef=function(){console.log(n),window.__slide=n},n.receiveSyncHandler=function(t){return lT(n,void 0,void 0,(function(){var e,i,n,r,o,s=this;return hT(this,(function(a){switch(a.label){case 0:return Vm()(t.incrId)&&(t.incrId&&t.incrId-this._receiveIncrId!=1&&this.emit(pT.syncEventLag),this._receiveIncrId=t.incrId||0),this.logger.info("sync receive "+JSON.stringify(t),this.taskId),"nextStep"!==t.type?[3,1]:(this.mainSeqStep!==t.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(t.next,"start"),this.player.nextTick((function(){s.doNextStep(!0,t.clientId||"")}))):this.doNextStep(!0,t.clientId||""),[3,6]);case 1:return"prevStep"!==t.type?[3,2]:(0===this.mainSeqStep&&"idle"===this.mainSeqState||this.mainSeqStep===t.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep(!0):(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){s.doPrevStep(!0)}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.action):this.__slideState.interactiveSeqState[t.seqId]?this.__slideState.interactiveSeqState[t.seqId].step+=1:this.__slideState.interactiveSeqState[t.seqId]={step:0,state:"end"},[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return a.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(i=this.player)||void 0===i||i.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!1),this.__slideState.mediaState[t.id]=t.state):"mediaSeek"===t.type?(null===(r=this.player)||void 0===r||r.setMediaCurrentTime(t.id,t.time),this.__slideState.mediaState[t.id]=t.state):"mediaFullscreen"===t.type&&(t.targetId&&this.__slideState.mediaState[t.targetId]?this.__slideState.mediaState[t.targetId].fullscreen=t.state:this.__slideState.mediaState[t.targetId]={fullscreen:t.state,type:"pause",time:0},null===(o=this.player)||void 0===o||o.syncFullscreenVideoState({targetId:t.targetId,state:t.state,slideIndex:t.slideIndex})),a.label=6;case 6:return[2]}}))}))},n.handlePrevSlide=function(t){return void 0===t&&(t=!1),lT(n,void 0,void 0,(function(){var e,i;return hT(this,(function(n){return this.player?((e=this.player.prevSlideIndex)>=1&&((null===(i=this.config.navigatorDelegate)||void 0===i?void 0:i.gotoPage)?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!1):this.renderSlide(e,!1)),[2]):[2]}))}))},n.handleNextSlide=function(t){return void 0===t&&(t=!1),lT(n,void 0,void 0,(function(){var e,i;return hT(this,(function(n){return this.player?((e=this.player.nextSlideIndex)<=this.slideCount&&((null===(i=this.config.navigatorDelegate)||void 0===i?void 0:i.gotoPage)?this.config.navigatorDelegate.gotoPage(e):t?this.doRenderSlide(e,!0):this.renderSlide(e,!0)),[2]):[2]}))}))},n.handleGotoSlide=function(t){if(t<=n.slideCount&&t>=1){var e=n.slideState.currentSlideIndex<=t;n.renderSlide(t,e)}else-1===t&&n.renderSlide(n.slideCount,!0)},e.instances.push(n),n.config=n.initSlideConfig(i),e.trackLogger.setEnable(!!n.config.enableTracking),n.logger={info:function(t,i){var r;e.appendLogString("INFO - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n"),e.trackLogger.addLog(t,"info",i,n.randomId);var o=null===(r=n.config.logger)||void 0===r?void 0:r.info;o&&o("["+i+"] "+t)},warn:function(t,i){var r;e.appendLogString("WARN - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n"),e.trackLogger.addLog(t,"warn",i,n.randomId);var o=null===(r=n.config.logger)||void 0===r?void 0:r.warn;o&&o("["+i+"] "+t)},error:function(t,i){var r;e.appendLogString("ERROR - "+(new Date).toISOString()+" - {"+n.randomId+"}["+i+"] "+t+"\n"),e.trackLogger.addLog(t,"error",i,n.randomId);var o=null===(r=n.config.logger)||void 0===r?void 0:r.error;o&&o("["+i+"] "+t)}},n.logger.info("new slide with clientId: "+n.config.clientId+", version: "+n.version,n.taskId),n.anchor=n.config.anchor,n.syncQueue=new Jb(n.receiveSyncHandler),n.lock=new Kb("interactive"===n.mode),n.cacheImage.style.position="absolute",n.cacheImage.style.zIndex="100",n.setMedianControllerAttribute(),n.canvasContainer.style.position="relative",n.canvasContainer.style.fontSize="0",n.canvasContainer.appendChild(n.medianController),n.frame.appendChild(n.canvasContainer),n.frameResizeObserver.observe(n.frame),n.on(pT.syncReceive,(function(t){n.lock.unlock(t.type,t.uuid),n.syncQueue.addTask(t)})),n.renderingTaskManager.eventHub.on("task-error",(function(t){var e=t.error,i=t.task,r=Tm.transform(e);r.errorType===gm.RuntimeWarn?n.logger.warn(r.message,n.taskId):n.logger.error(r.message,n.taskId),n.isLoading=!1,n.reportError(r,i.slideIndex)})),window.addEventListener("__slide_ref__",n.handleSlideRef),n.resizeView=Zy()(n.resizeView.bind(n),50),n.player=n.initPlayer(n.config),n.config.controller&&n.createController(),n.player.view&&n.canvasContainer.appendChild(n.player.view),n.handleViewClick=Zy()(n.handleViewClick,300),n.player.errorChannel.on("error",(function(t,e){var i=Tm.transform(t);i.errorType===gm.RuntimeWarn?n.logger.warn(i.message,n.taskId):n.logger.error(i.message,n.taskId),n.isLoading=!1,n.reportError(t,e)})),window.addEventListener("message",n.recoverHandler),e.volumeAdjuster.on("update",n._updateVolumeByStaticAdjuster),n.volumeAdjuster.volume=e.volumeAdjuster.volume,n}var i,n;return oT(e,t),e.flushLog=function(t){return void 0===t&&(t=!1),lT(this,void 0,void 0,(function(){return hT(this,(function(i){switch(i.label){case 0:if(!(e._tempLog.length>131072||t&&e._tempLog.length>0))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null==gT?void 0:gT.setItem("run_time_log_"+e._tempLogIndex,e._tempLog)];case 2:return i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:e._tempLog="",e._tempLogIndex+=1,i.label=5;case 5:return[2]}}))}))},e.stopRemoteLog=function(){e.remoteLogAddress=null},e.startRemoteLog=function(t){return lT(this,void 0,void 0,(function(){var i,n,r,o,s;return hT(this,(function(a){switch(a.label){case 0:return e.remoteLogAddress=t,[4,e.flushLog(!0)];case 1:if(a.sent(),!gT)return[3,13];i=[],a.label=2;case 2:return a.trys.push([2,4,,5]),[4,gT.keys()];case 3:return i=(a.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),[3,5];case 4:return a.sent(),[3,5];case 5:n=0,r=i,a.label=6;case 6:if(!(n<r.length))return[3,13];o=r[n],o.replace("run_time_log_",""),s="",a.label=7;case 7:return a.trys.push([7,9,,10]),[4,gT.getItem(o)];case 8:return s=a.sent()||"",[3,10];case 9:return a.sent(),[3,10];case 10:return[4,fetch(e.remoteLogAddress+"/logs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log:s})})];case 11:a.sent(),a.label=12;case 12:return n++,[3,6];case 13:return[2]}}))}))},e.appendLogString=function(t){e._tempLog+=t,e.remoteLogAddress&&fetch(e.remoteLogAddress+"/logs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({log:t})}).catch((function(){}))},Object.defineProperty(e.prototype,"dispatchIncrId",{get:function(){return this._dispatchIncrId++},enumerable:!1,configurable:!0}),e.prototype.reportError=function(t,i){this.emit(pT.renderError,{error:t,index:i}),window.postMessage({type:"@slide/_error_",errorType:t.errorType,errorMsg:t.errorMsg,slideId:this.randomId,slideIndex:i,customMessage:"@slide/_error_"},"*"),e.trackLogger.uploadLog(!0)},e.prototype.initSlideConfig=function(t){return t.timestamp&&(this.timestamp=t.timestamp),t.rtcAudio&&(zy.RtcAudioClazz=t.rtcAudio),this.mode=t.mode,this.anchor=t.anchor,this.anchor.appendChild(this.frame),this.enableGlobalClick=!$a()(t.enableGlobalClick)&&t.enableGlobalClick,this.resize=t.resize||!1,this.interactive=t.interactive,this.frame.style.cssText=t.fixedFrameSize?"width:"+t.fixedFrameSize.width+"px;height:"+t.fixedFrameSize.height+"px;":"width:100%;height:100%",this.frame.style.cssText+="display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",t.fixedFrameSize&&(this.frameWidth=t.fixedFrameSize.width,this.frameHeight=t.fixedFrameSize.height),t},e.prototype.initPlayer=function(t){var e,i,n,r=this,o=new zy({mode:this.mode,useLocalCache:!!$a()(this.config.useLocalCache)||this.config.useLocalCache,logger:this.logger,resourceTimeout:$a()(this.config.resourceTimeout)?15e3:this.config.resourceTimeout,loadDelegate:this.config.loaderDelegate,volumeAdjuster:this.volumeAdjuster,urlInterrupter:this.config.urlInterrupter},t.renderOptions);return o.setInteractive(this.interactive),o.updateConfig(t.renderOptions||{}),o.on(jy.renderStart,(function(t){r.isLoading=!0,r.emit(pT.renderStart,t),window.postMessage({type:"@slide/_render_start_",taskId:r.taskId,index:t},"*")})),o.on(jy.renderEnd,(function(t){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(pT.renderEnd,t),window.postMessage({type:"@slide/_render_end_",taskId:r.taskId,index:t},"*")})),o.on(jy.slideChange,(function(t){r.__slideState.currentSlideIndex=t,r.emitStateChange(),r.emit(pT.slideChange,t)})),o.on(jy.mainSeqStateChange,(function(t){r.__slideState.mainSeqState=t,r.emitStateChange()})),o.on(jy.mainSeqStepChange,(function(t){r.__slideState.mainSeqStep=t,r.emitStateChange()})),o.on(jy.interactiveSeqStateChange,(function(t){var e=t.id,i=t.state;r.__slideState.interactiveSeqState[e]=i,r.emitStateChange()})),o.on(jy.animateStart,(function(){!0!==r.isAnimating&&(r.isAnimating=!0,r.emit(pT.animateStart))})),o.on(jy.animateEnd,(function(){!1!==r.isAnimating&&(r.isAnimating=!1,r.emit(pT.animateEnd))})),o.on(jy.interactiveSeqAction,(function(t){var e=t.action,i=t.seqId;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",action:e,seqId:i}),r.emitStateChange()})),o.on(jy.mainSeqStepStart,(function(t){r.emit(pT.mainSeqStepStart,t)})),o.on(jy.mainSeqStepEnd,(function(t){r.emit(pT.mainSeqStepEnd,t)})),o.on(jy.mediaPlay,(function(t){var e,i=null!==(e=r.__slideState.mediaState[t.id])&&void 0!==e?e:{};i.type="play",i.time=r.timestamp()-1e3*t.time,r.__slideState.mediaState[t.id]=i,t._stateOnly?"interactive"===r.config.mode&&r.receiveSyncHandler({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:i}).catch((function(t){r.logger.error(null==t?void 0:t.message,r.taskId)})):r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:i}),r.emitStateChange()})),o.on(jy.mediaStop,(function(t){delete r.__slideState.mediaState[t.id],r.emitStateChange()})),o.on(jy.mediaPause,(function(t){var e,i=null!==(e=r.__slideState.mediaState[t.id])&&void 0!==e?e:{};i.type="pause",i.time=t.time,r.__slideState.mediaState[t.id]=i,t._stateOnly?"interactive"===r.config.mode&&r.receiveSyncHandler({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:i}).catch((function(t){r.logger.error(null==t?void 0:t.message,r.taskId)})):r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:i}),r.emitStateChange()})),o.on(jy.mediaSeek,(function(t){var e,i=null!==(e=r.__slideState.mediaState[t.id])&&void 0!==e?e:{};t.isPlaying?(i.type="play",i.time=r.timestamp()-1e3*t.time):(i.type="pause",i.time=t.time),r.__slideState.mediaState[t.id]=i,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:i}),r.emitStateChange()})),o.on(jy.requestPrevSlide,(function(t){r.handlePrevSlide(t)})),o.on(jy.requestNextSlide,(function(t){r.handleNextSlide(t)})),o.on(jy.requestGotoSlide,(function(t){var e;(null===(e=r.config.navigatorDelegate)||void 0===e?void 0:e.gotoPage)?r.config.navigatorDelegate.gotoPage(t):r.handleGotoSlide(t)})),o.on(jy.requestOpenUrl,(function(t){var e;console.log(r.config.navigatorDelegate),(null===(e=r.config.navigatorDelegate)||void 0===e?void 0:e.openUrl)&&r.config.navigatorDelegate.openUrl(t)})),o.on(jy.fullscreenChange,(function(t){var e,i=t.targetId,n=t.state;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaFullscreen",targetId:i,state:n});var o=null!==(e=r.__slideState.mediaState[i])&&void 0!==e?e:{};o.fullscreen=n,r.__slideState.mediaState[i]=o,r.emitStateChange()})),o.on(jy.changeLocalFullscreenState,(function(t){t.slideIndex===r.__slideState.currentSlideIndex?(t.targetId&&r.__slideState.mediaState[t.targetId]&&(r.__slideState.mediaState[t.targetId].fullscreen=t.status),r.emitStateChange()):r.logger.info("event slideIndex: "+t.slideIndex+", current slideIndex: "+r.__slideState.currentSlideIndex,r.taskId)})),null===(e=o.view)||void 0===e||e.addEventListener("touchend",this.handleViewTouchEnd),null===(i=o.view)||void 0===i||i.addEventListener("touchstart",this.handleViewTouchStart),null===(n=o.view)||void 0===n||n.addEventListener("click",this.handleViewClick),o.on(jy.userInput,this.userInputHandle),o},e.prototype.createController=function(){this.player&&(this.playerController=new Zb(this.player,this.frame))},e.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2",this.medianController.style.fontSize="16px"},e.prototype.frameResizeHandler=function(){if(!this.config.fixedFrameSize){var t=this.frame.getBoundingClientRect(),e=t.width,i=t.height;this.frameWidth=e,this.frameHeight=i,this.resizeView()}},e.prototype.updateFixedFrameSize=function(t,e,i){this.config.fixedFrameSize&&(this.frameWidth=t,this.frameHeight=e,this.frame.style.width=t+"px",this.frame.style.height=e+"px",this.resizeView(i))},e.prototype.resizeView=function(t){var e,i,n=this,r=this.width,o=this.height;if(r>0&&o>0){var s=this.frameWidth/r,a=s*o;a>this.frameHeight&&(s*=this.frameHeight/a),null===(e=this.player)||void 0===e||e.scaleView(s,this.resize,t),this.cacheImage.style.transform="scale("+s+")",this.medianController.style.transform="scale("+s+")",this.medianController.setAttribute("data-scale",s.toString()),this.isInitResized||(this.isInitResized=!0,null===(i=this.player)||void 0===i||i.clock.setTimeout((function(){n.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,i,n;return lT(this,void 0,void 0,(function(){var r,o=this;return hT(this,(function(s){switch(s.label){case 0:return this.isSyncingSlideState=!0,this.logger.info("stateChange receive "+JSON.stringify(t),this.taskId),t.taskId&&t.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=t.taskId,null===(e=this.player)||void 0===e||e.setResourceData(t.taskId,this.__slideState.url)),t.url&&t.url!==this.__slideState.url&&(this.__slideState.url=t.url,null===(i=this.player)||void 0===i||i.setResourceData(this.__slideState.taskId,t.url)),Number.isInteger(t.currentSlideIndex)&&t.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=t.currentSlideIndex,[4,this.doRenderSlide(t.currentSlideIndex)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[4,null===(n=this.player)||void 0===n?void 0:n.clock.waitUntil((function(){var e,i;return(null===(e=o.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(i=o.player)||void 0===i?void 0:i.currentStage)}),3e3)];case 3:return s.sent(),r=!1,Number.isInteger(t.mainSeqStep)&&t.mainSeqStep!==this.__slideState.mainSeqStep&&(r=!0,this.__slideState.mainSeqStep=t.mainSeqStep),t.mainSeqState&&t.mainSeqState!==this.__slideState.mainSeqState&&(r=!0,this.__slideState.mainSeqState=t.mainSeqState),r&&this.setMainSeqStep(this.__slideState.mainSeqStep,"idle"===this.__slideState.mainSeqState?"start":"end"),t.interactiveSeqState&&(this.initInteractiveSeq(t),this.__slideState.interactiveSeqState=t.interactiveSeqState),[4,cT(1500)];case 4:return s.sent(),t.mediaState&&(this.initMedia(t),this.__slideState.mediaState=t.mediaState),this.isSyncingSlideState=!1,[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var i in t.interactiveSeqState){var n=t.interactiveSeqState[i];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(i,n.step,"idle"===n.state?"start":"end")}},e.prototype.initMedia=function(t){var e,i,n;for(var r in t.mediaState){var o=t.mediaState[r],s=this.__slideState.mediaState[r];if(null===(e=this.player)||void 0===e||e.syncFullscreenVideoState({targetId:r,state:!!o.fullscreen,slideIndex:this.slideState.currentSlideIndex}),!s||o.type!==s.type||o.time!==s.time)if("play"===o.type){var a=(this.timestamp()-o.time)/1e3;null===(i=this.player)||void 0===i||i.setMediaState(r,!0,a)}else null===(n=this.player)||void 0===n||n.setMediaState(r,!1,o.time)}},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),e.prototype.getSizeAsync=function(){return lT(this,void 0,void 0,(function(){var t;return hT(this,(function(e){switch(e.label){case 0:if(this.width>0&&this.height>0)return[2,[this.width,this.height]];e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,e.sent().json()];case 3:return[2,[(t=e.sent()).width,t.height]];case 4:return e.sent(),[2,[0,0]];case 5:return[2]}}))}))},e.prototype.getSlideCountAsync=function(){return lT(this,void 0,void 0,(function(){return hT(this,(function(t){switch(t.label){case 0:if(this._slideCount>0)return[2,this._slideCount];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,t.sent().json()];case 3:return[2,t.sent().slideCount];case 4:return t.sent(),[2,0];case 5:return[2]}}))}))},Object.defineProperty(e.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqLength",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqStep",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqState",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderOptions",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawCall",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"runtimeFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),e.prototype.updateRenderOption=function(t){this.player&&(this.player.updateConfig(t),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},e.prototype.setResource=function(t,e){var i;this.taskId=t,null===(i=this.player)||void 0===i||i.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e})},e.prototype._renderSlide=function(t){var e;return lT(this,void 0,void 0,(function(){var i=this;return hT(this,(function(n){switch(n.label){case 0:return this.renderingIndex=t,this.player&&t===this.player.currentIndex?[2]:((zy.platform.isIOS()||zy.platform.isAndroid())&&this.iosResetCache.indexOf(t)<0&&this.iosResetCache.push(t),[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)]);case 1:return n.sent(),this.__slideState.currentSlideIndex=t,this.resizeView(),this.__slideState.interactiveSeqState={},this.__slideState.mediaState={},this.emitStateChange(),setTimeout((function(){var t,e;if("hidden"===(null===(e=null===(t=i.player)||void 0===t?void 0:t.view)||void 0===e?void 0:e.style.visibility)&&(i.player.view.style.visibility="visible"),"hidden"===i.frame.style.visibility&&(i.frame.style.visibility="visible"),i.needClearCacheImage)try{i.frame.removeChild(i.cacheImage)}catch(t){}}),100),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){var i=Number(t);(i!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(i>this.slideCount&&this.slideCount>0||this.poseRenderSlide(i,e))}},e.prototype.needCreateNewPlayer=function(){var t=zy.platform.isLowGpuMemory()?15:30;return(zy.platform.isIOS()||zy.platform.isAndroid())&&this.iosResetCache.length>t},e.prototype.poseRenderSlide=function(t,e){"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e}):"sync"===this.mode?(this.doRenderSlide(t,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e})):this.doRenderSlide(t,e)},e.prototype.doRenderSlide=function(t,e){var i,n,r,o=this;if(void 0===e&&(e=!0),!this.player)return Promise.resolve();if(this.needCreateNewPlayer()&&(this.iosResetCache=[],this.iosNewPlayer=this.initPlayer(this.config),this.iosNewPlayer.setResourceData(this.__slideState.taskId,this.__slideState.url)),this.iosNewPlayer){var s=this.player.getSnapshot();this.cacheImage.src=s,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(i=this.playerController)||void 0===i||i.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,(null===(n=this.config)||void 0===n?void 0:n.controller)&&this.createController(),this.needClearCacheImage=!0,(null===(r=null==this?void 0:this.player)||void 0===r?void 0:r.view)&&(this.player.view.style.visibility="hidden",this.canvasContainer.appendChild(this.player.view))}var a=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return o._renderSlide(t)}),t,a),new Promise((function(t){o.renderingTaskManager.eventHub.once("task-end-"+a,t)}))},e.prototype.getSnapshot=function(){var t,e;return null!==(e=null===(t=this.player)||void 0===t?void 0:t.getSnapshot())&&void 0!==e?e:null},e.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive?(this.hasNextStep()||this.emit(pT.slideStepEnd),this.player.mainSeqHasNextStep()?"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):"sync"===this.mode?(this.doNextStep(!1,""),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep(!1,""):this.handleNextSlide()):this.logger.info("prevent nextStep. isLoading: "+this.isLoading+", player: "+!!this.player+", interactive: "+this.interactive,this.taskId)},e.prototype.doNextStep=function(t,e){if(this.player){var i=!this.config.clientId||e===this.config.clientId;this.player.nextStep(t,i);var n=this.player.mainSeqStep();this.__slideState.mainSeqStep=n,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive?(this.hasPrevStep()||this.emit(pT.slideStepStart),this.player.mainSeqHasPrevStep()?"interactive"===this.mode?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):"sync"===this.mode?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide()):this.logger.info("prevent nextStep. isLoading: "+this.isLoading+", player: "+this.player+", interactive: "+this.interactive,this.taskId)},e.prototype.doPrevStep=function(t){if(void 0===t&&(t=!1),this.player){this.player.prevStep(t);var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},e.prototype.isSlideStateReady=function(t){return t.taskId.length>0&&t.url.length>0&&t.currentSlideIndex>0},e.prototype.emitStateChange=function(){if("local"!==this.mode&&!this.isSyncingSlideState){var t=this.slideState;!Yy()(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(pT.stateChange,t),this.logger.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var e=Math.random().toString(32).substr(2);this.lock.addLock(t.type,e);var i=sT(sT({},t),{uuid:e,clientId:this.config.clientId});"sync"===this.config.mode&&(i.incrId=this.dispatchIncrId),this.emit(pT.syncDispatch,i),this.logger.info("sync dispatch "+JSON.stringify(i),this.taskId)}},e.prototype.setMainSeqStep=function(t,e){var i;null===(i=this.player)||void 0===i||i.setMainSeqStep(t,e)},e.prototype.setInteractive=function(t){var e;this.interactive=t,null===(e=this.player)||void 0===e||e.setInteractive(t)},e.prototype.pause=function(){var t;null===(t=this.player)||void 0===t||t.pause()},e.prototype.resume=function(){var t;null===(t=this.player)||void 0===t||t.resume()},e.prototype._doFrozen=function(){var t;return lT(this,void 0,void 0,(function(){var e,i,n,r=this;return hT(this,(function(o){switch(o.label){case 0:return this.logger.info("frozen with player["+!!this.player+"]",this.taskId),this.view&&this.player?[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]:[3,2];case 1:for(i in o.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)n=this.__slideState.mediaState[i],this.__slideState.mediaState[i]=sT(sT({},n),{frozenTime:this.timestamp()});o.label=2;case 2:return[2]}}))}))},e.prototype.frozen=function(){var t=this;this.frozenTaskManager.addTask("frozen",(function(){return t._doFrozen()}))},e.prototype._doRelease=function(){var t,e;return lT(this,void 0,void 0,(function(){var i,n,r,o;return hT(this,(function(s){switch(s.label){case 0:if(this.logger.info("do release slide",this.taskId),this.player)return[2];for(n in this.player=this.initPlayer(this.config),(null===(t=this.config)||void 0===t?void 0:t.controller)&&this.createController(),this.player.view&&(this.canvasContainer.appendChild(this.player.view),this.player.view.style.visibility="hidden"),i=this.__slideState,this.__slideState=Ky()(fT),i.mediaState)"play"===(r=i.mediaState[n]).type&&(o=Math.max(null!==(e=r.frozenTime)&&void 0!==e?e:0,r.time),r.time=this.timestamp()-(o-r.time),r.frozenTime=void 0);return[4,this.setSlideState(i)];case 1:return s.sent(),[4,this.player.clock.delay(333)];case 2:s.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return[2]}}))}))},e.prototype.release=function(){var t=this;this.frozenTaskManager.addTask("release",(function(){return t._doRelease()}))},e.prototype._doDestroy=function(){var t,i,n,r,o=this;this.logger.info("do destroy slide",this.taskId);var s=e.instances.findIndex((function(t){return t.randomId===o.randomId}));s>=0&&e.instances.splice(s,1),this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),null===(t=this.player)||void 0===t||t.removeAllListeners(),null===(i=this.player)||void 0===i||i.destroy(),null===(n=this.player)||void 0===n||n.removeAllListeners(),this.logger={warn:function(){return{}},info:function(){return{}},error:function(){return{}}},this.syncQueue.destroy(),this.renderingTaskManager.destroy(),this.frozenTaskManager.destroy(),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.removeEventListener("message",this.recoverHandler),this.removeAllListeners();try{(null===(r=this.player)||void 0===r?void 0:r.view)&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch(t){}e.volumeAdjuster.off("update",this._updateVolumeByStaticAdjuster)},e.prototype.waitLoadEnd=function(){return lT(this,void 0,void 0,(function(){var t;return hT(this,(function(e){switch(e.label){case 0:t=0,e.label=1;case 1:return this.isLoading&&t<10?[4,cT(100)]:[3,3];case 2:return e.sent(),t+=1,[3,1];case 3:return[2]}}))}))},e.prototype.preload=function(t){return this.player?this.player.preload(t):Promise.resolve()},e.prototype.destroy=function(){var t=this;this.logger.info("pre destroy slide",""),this.isLoading?this.waitLoadEnd().then((function(){t._doDestroy()})):this._doDestroy()},e.prototype.clearSlideCache=function(){var t;null===(t=this.player)||void 0===t||t.clearLocalCache()},e.prototype.hasNextStep=function(){if(!this.player)return!1;var t=this.player.currentIndex===this.slideCount,e=0===this.mainSeqLength||this.mainSeqStep>=this.mainSeqLength-1,i="end"===this.mainSeqState||"running"===this.mainSeqState||null==this.mainSeqState;return!(t&&e&&i)},e.prototype.hasPrevStep=function(){if(!this.player)return!1;var t=1===this.player.currentIndex,e=0===this.mainSeqLength||0===this.mainSeqStep,i="idle"===this.mainSeqState||null===this.mainSeqState;return!(t&&e&&i)},e.prototype.snapshot=function(){return lT(this,void 0,void 0,(function(){return hT(this,(function(t){return this.player?[2,this.player.getSnapshot()]:[2,null]}))}))},e.prototype.snapshotWithTimingEnd=function(t){return lT(this,void 0,void 0,(function(){return hT(this,(function(e){return this.player?[2,this.player.snapshotWithTimingEnd(t)]:[2,null]}))}))},e.prototype.updateGlobalVolume=function(t){this.volumeAdjuster.volume=t},e.prototype.getGlobalVolume=function(){return this.volumeAdjuster.volume},e.clearLocalCache=function(){zy.clearLocalCache()},e.disposeLocalCache=function(){},i=e,e.preloadResource=rT,e.instances=[],e._tempFrozenIds=[],e._tempLog="",e._tempLogIndex=1,e.remoteLogAddress=null,e.usePlugin=function(t){t.context({logger:{info:function(t){e.appendLogString("INFO - "+(new Date).toISOString()+" - "+t+"\n")},warn:function(t){e.appendLogString("WARN - "+(new Date).toISOString()+" - "+t+"\n")},error:function(t){e.appendLogString("ERROR - "+(new Date).toISOString()+" - "+t+"\n")}}}),function(t){var e=Vy.get(t.hookPoint)||[];e.push(t),Vy.set(t.hookPoint,e)}(t)},e.volumeAdjuster=new ky,e.trackLogger=new eT,e.handleFrozenAllSlide=function(){e.instances.forEach((function(t){t.player&&(e._tempFrozenIds.push(t.randomId),t.frozen())}))},e.handleReleaseAllSlide=function(){e._tempFrozenIds.forEach((function(t){var i=e.instances.find((function(e){return e.randomId===t}));i&&i.release()})),e._tempFrozenIds=[]},e.handleLogReport=function(t){return lT(void 0,void 0,void 0,(function(){var n,r,o,s,a,l;return hT(i,(function(i){switch(i.label){case 0:return[4,e.flushLog(!0)];case 1:if(i.sent(),!gT)return[3,12];n=[],i.label=2;case 2:return i.trys.push([2,4,,5]),[4,gT.keys()];case 3:return n=(i.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),[3,5];case 4:return i.sent(),[3,5];case 5:if(0===n.length)return window.postMessage({type:"@slide/_report_log_",log:"",index:1,total:1,customMessage:"@slide/_report_log_",sessionId:t},"*"),[2];r=0,o=n,i.label=6;case 6:if(!(r<o.length))return[3,12];s=o[r],a=s.replace("run_time_log_",""),l="",i.label=7;case 7:return i.trys.push([7,9,,10]),[4,gT.getItem(s)];case 8:return l=i.sent()||"",[3,10];case 9:return i.sent(),[3,10];case 10:window.postMessage({type:"@slide/_report_log_",log:l,index:parseInt(a,10),total:n.length,customMessage:"@slide/_report_log_",sessionId:t},"*"),i.label=11;case 11:return r++,[3,6];case 12:return[2]}}))}))},e.handleLogDownload=function(){return lT(void 0,void 0,void 0,(function(){var t,n,r,o,s,a,l;return hT(i,(function(i){switch(i.label){case 0:return i.trys.push([0,7,,8]),[4,e.flushLog(!0)];case 1:return i.sent(),t="",gT?[4,gT.keys()]:[3,6];case 2:n=(i.sent()||[]).sort((function(t,e){return parseInt(t.replace("run_time_log_",""))-parseInt(e.replace("run_time_log_",""))})),r=0,o=n,i.label=3;case 3:return r<o.length?(s=o[r],a=t,[4,gT.getItem(s)]):[3,6];case 4:t=a+(i.sent()||""),i.label=5;case 5:return r++,[3,3];case 6:return(l=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),l.setAttribute("download","slide_log"),l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l),[3,8];case 7:return i.sent(),[3,8];case 8:return[2]}}))}))},aT([(n="Slide.initConfig",function(t,e,i){var r=i.value;i.value=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=Vy.get(n)||[],o=t,s=0,a=i;s<a.length;s++){var l=a[s];try{o=l.before(o)}catch(t){}if(!Array.isArray(o)||o.length!==t.length)throw new Error("plugin before hook return invalid args")}for(var h=r.bind(this).apply(void 0,o),u=0,c=i.reverse();u<c.length;u++){l=c[u];try{h=l.after(h)}catch(t){}if(!h)throw new Error("plugin after hook return undefined result")}return h}})],e.prototype,"initSlideConfig",null),e}(Za.a);null==gT||gT.clear().catch((function(){})),window.addEventListener("__slide_log__",vT.handleLogDownload),window.addEventListener("message",(function(t){if("@slide/_request_log_"===t.data.type)vT.handleLogReport(t.data.sessionId).catch((function(){}));else if("@slide/_request_frozen_"===t.data.type)vT.handleFrozenAllSlide();else if("@slide/_request_release_"===t.data.type)vT.handleReleaseAllSlide();else if("@slide/_update_volume_"===t.data.type){var e=.5;try{e=parseFloat(t.data.volume.toString())}catch(t){}vT.volumeAdjuster.volume=e}else"@slide/_get_volume_"===t.data.type?window.postMessage({type:"@slide/_report_volume_",volume:vT.volumeAdjuster.volume,customMessage:"@slide/_report_volume_"},"*"):"@slide/_preload_slide_"===t.data.type&&vT.preloadResource(t.data.taskId,t.data.prefix,(function(e){window.postMessage({type:"@slide/_preload_slide_progress_",taskId:t.data.taskId,progress:e},"*")})).catch((function(e){window.postMessage({type:"@slide/_preload_slide_error_",taskId:t.data.taskId,error:e},"*")}))})),window.setInterval((function(){vT.flushLog().catch((function(){}))}),2e3)}]);