数据可视化大屏
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12544 строки
2.5MB

  1. import{a as CV,b as RV}from"./chunk-2D265ORJ.js";import{A as Nc,Aa as JM,Ba as Tl,C as Uc,Fa as Xc,Ha as qc,Ka as Zc,Oa as jc,Ra as Kc,Ta as Jc,V as Oc,W as MV,Wa as $c,X as bV,_ as Fc,_a as Qc,ab as ef,b as ZM,ba as wV,bb as TV,ca as wl,cb as El,e as Pc,eb as tf,fb as EV,gb as rf,ib as nf,jb as AV,ka as zc,oa as Bc,qa as kc,sa as Vc,ta as Gc,u as Dc,v as Ic,va as Hc,xa as Wc,y as jM,za as KM}from"./chunk-OOUNO2UZ.js";import{$ as aV,Ab as vm,Bb as co,Cb as fo,D as tV,Db as gu,Eb as Pi,Fb as Ec,Gc as gV,Ge as Ac,Ha as uV,I as rV,Ib as mV,Jb as ui,Jc as yV,Ka as Ot,Kc as _V,La as uo,Lb as vV,Le as Cc,Ma as jR,Mb as tL,Me as YM,Ne as qM,Nf as Yc,Pa as cV,Q as iV,Sb as gm,Ta as br,U as nV,Va as Rt,Wa as fV,Xa as KR,Ya as hV,a as E0,ba as ZR,cc as R0,cd as xV,db as JR,dc as bl,e as Dse,eb as $R,f as Ise,fb as QR,g as YR,gb as tr,h as Nse,hb as lr,hf as Rc,i as Use,ia as oV,ib as li,ic as L0,j as WM,jb as Sl,kb as Ml,la as xl,lb as pV,lf as Lc,m as $k,na as si,nc as XM,o as qR,oa as sV,p as Qk,pa as lV,qb as dV,ra as C0,sb as Lr,tb as Ho,tf as SV,u as A0,ub as Li,vf as ym,w as eV,xd as P0,xf as _m,yb as eL,zb as Tc}from"./chunk-VDRVUQCF.js";var $ne={};YR($ne,{AddEquation:()=>Vz,AddOperation:()=>sne,AdditiveBlending:()=>Fz,AlphaFormat:()=>yne,AlwaysDepth:()=>ene,AmbientLight:()=>aC,AnimationClip:()=>No,AnimationMixer:()=>cB,AnimationObjectGroup:()=>wz,AnimationUtils:()=>Jn,ArcCurve:()=>gC,ArrowHelper:()=>$d,Audio:()=>by,AudioAnalyser:()=>uB,AudioContext:()=>sB,AudioListener:()=>Mz,AudioLoader:()=>lB,AxisHelper:()=>vC,BackSide:()=>yh,BasicDepthPacking:()=>Dne,BasicShadowMap:()=>JEe,BinaryTextureLoader:()=>eB,BlendingMode:()=>Vie,Bone:()=>jA,BooleanKeyframeTrack:()=>cC,BoundingBoxHelper:()=>TLe,Box2:()=>PS,Box3:()=>lu,BoxBufferGeometry:()=>Ud,BoxGeometry:()=>oM,BoxHelper:()=>Iy,BufferAttribute:()=>gt,BufferGeometry:()=>Bt,BufferGeometryLoader:()=>rB,ByteType:()=>hne,Cache:()=>xz,Camera:()=>Qn,CameraHelper:()=>mM,CanvasRenderer:()=>DLe,CanvasTexture:()=>$A,CatmullRomCurve3:()=>fB,CineonToneMapping:()=>cne,CircleBufferGeometry:()=>yy,CircleGeometry:()=>aM,ClampToEdgeWrapping:()=>Uo,Clock:()=>Rz,ClosedSplineCurve3:()=>Jne,Color:()=>Gt,ColorKeyframeTrack:()=>fC,CompressedTexture:()=>ny,CompressedTextureLoader:()=>Xne,ConeBufferGeometry:()=>nM,ConeGeometry:()=>iM,CubeCamera:()=>hC,CubeGeometry:()=>oM,CubeReflectionMapping:()=>xC,CubeRefractionMapping:()=>HA,CubeTexture:()=>_h,CubeTextureLoader:()=>tB,CubeUVReflectionMapping:()=>SC,CubeUVRefractionMapping:()=>MC,CubicBezierCurve:()=>jd,CubicBezierCurve3:()=>eLe,CubicInterpolant:()=>oC,CullFaceBack:()=>wS,CullFaceFront:()=>Dz,CullFaceFrontBack:()=>jEe,CullFaceNone:()=>zie,Curve:()=>ea,CurvePath:()=>cM,CurveUtils:()=>_M,CustomBlending:()=>kz,CylinderBufferGeometry:()=>sc,CylinderGeometry:()=>Vd,Cylindrical:()=>Pz,DataTexture:()=>Nd,DataTextureLoader:()=>JRe,DefaultLoadingManager:()=>zo,DepthFormat:()=>Cd,DepthStencilFormat:()=>Jg,DepthTexture:()=>GS,DirectionalLight:()=>nC,DirectionalLightHelper:()=>Dy,DirectionalLightShadow:()=>iC,DiscreteInterpolant:()=>sC,DodecahedronBufferGeometry:()=>uy,DodecahedronGeometry:()=>qS,DoubleSide:()=>Ny,DstAlphaFactor:()=>Zie,DstColorFactor:()=>Kie,DynamicBufferAttribute:()=>mLe,EdgesGeometry:()=>gy,EdgesHelper:()=>ELe,EllipseCurve:()=>lc,EqualDepth:()=>rne,EquirectangularReflectionMapping:()=>Xz,EquirectangularRefractionMapping:()=>WA,Euler:()=>bh,EventDispatcher:()=>Ms,ExtrudeGeometry:()=>ws,Face3:()=>Fo,Face4:()=>nLe,FaceColors:()=>Oz,FaceNormalsHelper:()=>dM,FileLoader:()=>Ts,FlatShading:()=>Nz,Float32Attribute:()=>bLe,Float32BufferAttribute:()=>gr,Float64Attribute:()=>wLe,Float64BufferAttribute:()=>zS,FloatType:()=>jg,Fog:()=>ry,FogExp2:()=>ty,Font:()=>oB,FontLoader:()=>qne,FrontFaceDirectionCCW:()=>KEe,FrontFaceDirectionCW:()=>Bie,FrontSide:()=>Zg,Frustum:()=>DS,GammaEncoding:()=>Kz,Geometry:()=>or,GeometryIdCount:()=>Jz,GeometryUtils:()=>RLe,GreaterDepth:()=>nne,GreaterEqualDepth:()=>ine,GridHelper:()=>pM,Group:()=>VS,HalfFloatType:()=>YA,HemisphereLight:()=>QA,HemisphereLightHelper:()=>Py,IcosahedronBufferGeometry:()=>ly,IcosahedronGeometry:()=>YS,ImageLoader:()=>yM,ImageUtils:()=>LLe,ImmediateRenderObject:()=>fM,InstancedBufferAttribute:()=>Ey,InstancedBufferGeometry:()=>Jd,InstancedInterleavedBuffer:()=>Ty,Int16Attribute:()=>_Le,Int16BufferAttribute:()=>OS,Int32Attribute:()=>SLe,Int32BufferAttribute:()=>FS,Int8Attribute:()=>vLe,Int8BufferAttribute:()=>IS,IntType:()=>dne,InterleavedBuffer:()=>wy,InterleavedBufferAttribute:()=>Ez,Interpolant:()=>ro,InterpolateDiscrete:()=>CS,InterpolateLinear:()=>bS,InterpolateSmooth:()=>VA,JSONLoader:()=>iB,KeyframeTrack:()=>qd,LOD:()=>kS,LatheBufferGeometry:()=>dy,LatheGeometry:()=>rM,Layers:()=>qA,LensFlare:()=>_z,LessDepth:()=>tne,LessEqualDepth:()=>GA,Light:()=>Oi,LightShadow:()=>em,Line:()=>oc,Line3:()=>Rd,LineBasicMaterial:()=>Ui,LineCurve:()=>cu,LineCurve3:()=>rLe,LineDashedMaterial:()=>Yd,LinePieces:()=>oLe,LineSegments:()=>di,LineStrip:()=>aLe,LinearEncoding:()=>LS,LinearFilter:()=>to,LinearInterpolant:()=>lM,LinearMipMapLinearFilter:()=>gM,LinearMipMapNearestFilter:()=>qz,LinearToneMapping:()=>Wz,Loader:()=>Ld,LoadingManager:()=>Qz,LogLuvEncoding:()=>QEe,LoopOnce:()=>Mne,LoopPingPong:()=>wne,LoopRepeat:()=>bne,LuminanceAlphaFormat:()=>xne,LuminanceFormat:()=>_ne,MOUSE:()=>ZEe,Material:()=>mr,MaterialLoader:()=>EC,Math:()=>cr,Matrix3:()=>bs,Matrix4:()=>qt,MaxEquation:()=>sz,Mesh:()=>mn,MeshBasicMaterial:()=>io,MeshDepthMaterial:()=>Sh,MeshFaceMaterial:()=>sLe,MeshLambertMaterial:()=>Xd,MeshNormalMaterial:()=>Wd,MeshPhongMaterial:()=>ml,MeshPhysicalMaterial:()=>Gd,MeshStandardMaterial:()=>uu,MeshToonMaterial:()=>Hd,MinEquation:()=>oz,MirroredRepeatWrapping:()=>Dd,MixOperation:()=>one,MorphBlendMesh:()=>Pn,MultiMaterial:()=>sM,MultiplyBlending:()=>Bz,MultiplyOperation:()=>vM,NearestFilter:()=>Oo,NearestMipMapLinearFilter:()=>wC,NearestMipMapNearestFilter:()=>bC,NeverDepth:()=>Qie,NoBlending:()=>TS,NoColors:()=>yC,NoToneMapping:()=>kA,NormalBlending:()=>Uy,NotEqualDepth:()=>ane,NumberKeyframeTrack:()=>My,Object3D:()=>Et,ObjectLoader:()=>Yne,OctahedronBufferGeometry:()=>Bd,OctahedronGeometry:()=>XS,OneFactor:()=>Xie,OneMinusDstAlphaFactor:()=>jie,OneMinusDstColorFactor:()=>Jie,OneMinusSrcAlphaFactor:()=>Hz,OneMinusSrcColorFactor:()=>qie,OrthographicCamera:()=>ey,PCFShadowMap:()=>Iz,PCFSoftShadowMap:()=>kie,ParametricBufferGeometry:()=>oy,ParametricGeometry:()=>HS,Particle:()=>uLe,ParticleBasicMaterial:()=>hLe,ParticleSystem:()=>cLe,ParticleSystemMaterial:()=>pLe,Path:()=>xM,PerspectiveCamera:()=>Kn,Plane:()=>Io,PlaneBufferGeometry:()=>Od,PlaneGeometry:()=>tM,PointCloud:()=>lLe,PointCloudMaterial:()=>fLe,PointLight:()=>rC,PointLightHelper:()=>Ry,Points:()=>iy,PointsMaterial:()=>dl,PolarGridHelper:()=>mC,PolyhedronBufferGeometry:()=>no,PolyhedronGeometry:()=>ZS,PositionalAudio:()=>bz,Projector:()=>PLe,PropertyBinding:()=>Ri,PropertyMixer:()=>pC,QuadraticBezierCurve:()=>Kd,QuadraticBezierCurve3:()=>tLe,Quaternion:()=>on,QuaternionKeyframeTrack:()=>uM,QuaternionLinearInterpolant:()=>lC,REVISION:()=>Fie,RGBADepthPacking:()=>Ine,RGBAFormat:()=>su,RGBA_PVRTC_2BPPV1_Format:()=>gz,RGBA_PVRTC_4BPPV1_Format:()=>vz,RGBA_S3TC_DXT1_Format:()=>fz,RGBA_S3TC_DXT3_Format:()=>hz,RGBA_S3TC_DXT5_Format:()=>pz,RGBDEncoding:()=>Pne,RGBEEncoding:()=>Cne,RGBEFormat:()=>$Ee,RGBFormat:()=>Kg,RGBM16Encoding:()=>Lne,RGBM7Encoding:()=>Rne,RGB_ETC1_Format:()=>Sne,RGB_PVRTC_2BPPV1_Format:()=>mz,RGB_PVRTC_4BPPV1_Format:()=>dz,RGB_S3TC_DXT1_Format:()=>cz,RawShaderMaterial:()=>xy,Ray:()=>Mh,Raycaster:()=>Az,RectAreaLight:()=>Sz,RectAreaLightHelper:()=>Ly,ReinhardToneMapping:()=>lne,RepeatWrapping:()=>ic,ReverseSubtractEquation:()=>Hie,RingBufferGeometry:()=>py,RingGeometry:()=>eM,Scene:()=>Fd,SceneUtils:()=>iLe,ShaderChunk:()=>Xr,ShaderLib:()=>Qg,ShaderMaterial:()=>_a,ShadowMaterial:()=>_y,Shape:()=>Pd,ShapeBufferGeometry:()=>my,ShapeGeometry:()=>vy,ShapePath:()=>aB,ShapeUtils:()=>Ln,ShortType:()=>pne,Skeleton:()=>ZA,SkeletonHelper:()=>Cy,SkinnedMesh:()=>KA,SmoothShading:()=>Uz,Sphere:()=>$n,SphereBufferGeometry:()=>kd,SphereGeometry:()=>QS,Spherical:()=>Lz,SphericalReflectionMapping:()=>Yz,Spline:()=>$Re,SplineCurve:()=>Zd,SplineCurve3:()=>QRe,SpotLight:()=>tC,SpotLightHelper:()=>Ay,SpotLightShadow:()=>eC,Sprite:()=>BS,SpriteMaterial:()=>zd,SrcAlphaFactor:()=>Gz,SrcAlphaSaturateFactor:()=>$ie,SrcColorFactor:()=>Yie,StereoCamera:()=>Zne,StringKeyframeTrack:()=>uC,SubtractEquation:()=>Gie,SubtractiveBlending:()=>zz,TetrahedronBufferGeometry:()=>sy,TetrahedronGeometry:()=>WS,TextGeometry:()=>$S,Texture:()=>ni,TextureFilter:()=>uz,TextureLoader:()=>TC,TextureMapping:()=>fne,TextureWrapping:()=>lz,TorusBufferGeometry:()=>hy,TorusGeometry:()=>JS,TorusKnotBufferGeometry:()=>fy,TorusKnotGeometry:()=>KS,Triangle:()=>Ss,TriangleFanDrawMode:()=>Ene,TriangleStripDrawMode:()=>Tne,TrianglesDrawMode:()=>jz,TubeBufferGeometry:()=>cy,TubeGeometry:()=>jS,UVMapping:()=>_C,Uint16Attribute:()=>xLe,Uint16BufferAttribute:()=>nc,Uint32Attribute:()=>MLe,Uint32BufferAttribute:()=>ac,Uint8Attribute:()=>gLe,Uint8BufferAttribute:()=>NS,Uint8ClampedAttribute:()=>yLe,Uint8ClampedBufferAttribute:()=>US,Uncharted2ToneMapping:()=>une,Uniform:()=>dC,UniformsLib:()=>hr,UniformsUtils:()=>eo,UnsignedByteType:()=>XA,UnsignedInt248Type:()=>AS,UnsignedIntType:()=>Zz,UnsignedShort4444Type:()=>mne,UnsignedShort5551Type:()=>vne,UnsignedShort565Type:()=>gne,UnsignedShortType:()=>ES,Vector2:()=>St,Vector3:()=>oe,Vector4:()=>Qr,VectorKeyframeTrack:()=>Sy,Vertex:()=>dLe,VertexColors:()=>Qd,VertexNormalsHelper:()=>hM,VideoTexture:()=>JA,WebGLRenderTarget:()=>Oy,WebGLRenderTargetCube:()=>$g,WebGLRenderer:()=>$z,WireframeGeometry:()=>ay,WireframeHelper:()=>ALe,WrapAroundEnding:()=>RS,XHRLoader:()=>CLe,ZeroCurvatureEnding:()=>Id,ZeroFactor:()=>Wie,ZeroSlopeEnding:()=>Ad,sRGBEncoding:()=>Ane});function Ms(){}function St(r,e){this.x=r||0,this.y=e||0}function ni(r,e,t,i,n,a,o,s,l,u){Object.defineProperty(this,"id",{value:eAe++}),this.uuid=cr.generateUUID(),this.name="",this.image=r!==void 0?r:ni.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=e!==void 0?e:ni.DEFAULT_MAPPING,this.wrapS=t!==void 0?t:Uo,this.wrapT=i!==void 0?i:Uo,this.magFilter=n!==void 0?n:to,this.minFilter=a!==void 0?a:gM,this.anisotropy=l!==void 0?l:1,this.format=o!==void 0?o:su,this.type=s!==void 0?s:XA,this.offset=new St(0,0),this.repeat=new St(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u!==void 0?u:LS,this.version=0,this.onUpdate=null}function Qr(r,e,t,i){this.x=r||0,this.y=e||0,this.z=t||0,this.w=i!==void 0?i:1}function Oy(r,e,t){this.uuid=cr.generateUUID(),this.width=r,this.height=e,this.scissor=new Qr(0,0,r,e),this.scissorTest=!1,this.viewport=new Qr(0,0,r,e),t=t||{},t.minFilter===void 0&&(t.minFilter=to),this.texture=new ni(void 0,void 0,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.depthBuffer=t.depthBuffer!==void 0?t.depthBuffer:!0,this.stencilBuffer=t.stencilBuffer!==void 0?t.stencilBuffer:!0,this.depthTexture=t.depthTexture!==void 0?t.depthTexture:null}function $g(r,e,t){Oy.call(this,r,e,t),this.activeCubeFace=0,this.activeMipMapLevel=0}function on(r,e,t,i){this._x=r||0,this._y=e||0,this._z=t||0,this._w=i!==void 0?i:1}function oe(r,e,t){this.x=r||0,this.y=e||0,this.z=t||0}function qt(){this.elements=new Float32Array([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.")}function _h(r,e,t,i,n,a,o,s,l,u){r=r!==void 0?r:[],e=e!==void 0?e:xC,ni.call(this,r,e,t,i,n,a,o,s,l,u),this.flipY=!1}function One(){this.seq=[],this.map={}}function Fy(r,e,t){var i=r[0];if(i<=0||i>0)return r;var n=e*t,a=Lie[n];if(a===void 0&&(a=new Float32Array(n),Lie[n]=a),e!==0){i.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=t,r[o].toArray(a,s)}return a}function Fne(r,e){var t=Pie[e];t===void 0&&(t=new Int32Array(e),Pie[e]=t);for(var i=0;i!==e;++i)t[i]=r.allocTextureUnit();return t}function tAe(r,e){r.uniform1f(this.addr,e)}function rAe(r,e){r.uniform1i(this.addr,e)}function iAe(r,e){e.x===void 0?r.uniform2fv(this.addr,e):r.uniform2f(this.addr,e.x,e.y)}function nAe(r,e){e.x!==void 0?r.uniform3f(this.addr,e.x,e.y,e.z):e.r!==void 0?r.uniform3f(this.addr,e.r,e.g,e.b):r.uniform3fv(this.addr,e)}function aAe(r,e){e.x===void 0?r.uniform4fv(this.addr,e):r.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function oAe(r,e){r.uniformMatrix2fv(this.addr,!1,e.elements||e)}function sAe(r,e){r.uniformMatrix3fv(this.addr,!1,e.elements||e)}function lAe(r,e){r.uniformMatrix4fv(this.addr,!1,e.elements||e)}function uAe(r,e,t){var i=t.allocTextureUnit();r.uniform1i(this.addr,i),t.setTexture2D(e||Nne,i)}function cAe(r,e,t){var i=t.allocTextureUnit();r.uniform1i(this.addr,i),t.setTextureCube(e||Une,i)}function zne(r,e){r.uniform2iv(this.addr,e)}function Bne(r,e){r.uniform3iv(this.addr,e)}function kne(r,e){r.uniform4iv(this.addr,e)}function fAe(r){switch(r){case 5126:return tAe;case 35664:return iAe;case 35665:return nAe;case 35666:return aAe;case 35674:return oAe;case 35675:return sAe;case 35676:return lAe;case 35678:return uAe;case 35680:return cAe;case 5124:case 35670:return rAe;case 35667:case 35671:return zne;case 35668:case 35672:return Bne;case 35669:case 35673:return kne}}function hAe(r,e){r.uniform1fv(this.addr,e)}function pAe(r,e){r.uniform1iv(this.addr,e)}function dAe(r,e){r.uniform2fv(this.addr,Fy(e,this.size,2))}function mAe(r,e){r.uniform3fv(this.addr,Fy(e,this.size,3))}function vAe(r,e){r.uniform4fv(this.addr,Fy(e,this.size,4))}function gAe(r,e){r.uniformMatrix2fv(this.addr,!1,Fy(e,this.size,4))}function yAe(r,e){r.uniformMatrix3fv(this.addr,!1,Fy(e,this.size,9))}function _Ae(r,e){r.uniformMatrix4fv(this.addr,!1,Fy(e,this.size,16))}function xAe(r,e,t){var i=e.length,n=Fne(t,i);r.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)t.setTexture2D(e[a]||Nne,n[a])}function SAe(r,e,t){var i=e.length,n=Fne(t,i);r.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)t.setTextureCube(e[a]||Une,n[a])}function MAe(r){switch(r){case 5126:return hAe;case 35664:return dAe;case 35665:return mAe;case 35666:return vAe;case 35674:return gAe;case 35675:return yAe;case 35676:return _Ae;case 35678:return xAe;case 35680:return SAe;case 5124:case 35670:return pAe;case 35667:case 35671:return zne;case 35668:case 35672:return Bne;case 35669:case 35673:return kne}}function bAe(r,e,t){this.id=r,this.addr=t,this.setValue=fAe(e.type)}function wAe(r,e,t){this.id=r,this.addr=t,this.size=e.size,this.setValue=MAe(e.type)}function Vne(r){this.id=r,One.call(this)}function Die(r,e){r.seq.push(e),r.map[e.id]=e}function TAe(r,e,t){var i=r.name,n=i.length;for(nz.lastIndex=0;;){var a=nz.exec(i),o=nz.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){Die(t,u===void 0?new bAe(s,r,e):new wAe(s,r,e));break}else{var c=t.map,f=c[s];f===void 0&&(f=new Vne(s),Die(t,f)),t=f}}}function xh(r,e,t){One.call(this),this.renderer=t;for(var i=r.getProgramParameter(e,r.ACTIVE_UNIFORMS),n=0;n!==i;++n){var a=r.getActiveUniform(e,n),o=a.name,s=r.getUniformLocation(e,o);TAe(a,s,this)}}function Gt(r,e,t){return e===void 0&&t===void 0?this.set(r):this.setRGB(r,e,t)}function Nd(r,e,t,i,n,a,o,s,l,u,c,f){ni.call(this,null,a,o,s,l,u,i,n,c,f),this.image={data:r,width:e,height:t},this.magFilter=l!==void 0?l:Oo,this.minFilter=u!==void 0?u:Oo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function PS(r,e){this.min=r!==void 0?r:new St(1/0,1/0),this.max=e!==void 0?e:new St(-1/0,-1/0)}function TRe(r,e){var t=r.context,i=r.state,n,a,o,s,l,u,c,f;function h(){var d=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),g=new Uint16Array([0,1,2,0,2,3]);n=t.createBuffer(),a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,d,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.bufferData(t.ELEMENT_ARRAY_BUFFER,g,t.STATIC_DRAW),c=t.createTexture(),f=t.createTexture(),i.bindTexture(t.TEXTURE_2D,c),t.texImage2D(t.TEXTURE_2D,0,t.RGB,16,16,0,t.RGB,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),i.bindTexture(t.TEXTURE_2D,f),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,16,16,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),o={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join(`
  2. `),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join(`
  3. `)},s=p(o),l={vertex:t.getAttribLocation(s,"position"),uv:t.getAttribLocation(s,"uv")},u={renderType:t.getUniformLocation(s,"renderType"),map:t.getUniformLocation(s,"map"),occlusionMap:t.getUniformLocation(s,"occlusionMap"),opacity:t.getUniformLocation(s,"opacity"),color:t.getUniformLocation(s,"color"),scale:t.getUniformLocation(s,"scale"),rotation:t.getUniformLocation(s,"rotation"),screenPosition:t.getUniformLocation(s,"screenPosition")}}this.render=function(d,g,m){if(e.length!==0){var v=new oe,_=m.w/m.z,y=m.z*.5,x=m.w*.5,M=16/m.w,S=new St(M*_,M),w=new oe(1,1,0),T=new St(1,1),C=new PS;C.min.set(m.x,m.y),C.max.set(m.x+(m.z-16),m.y+(m.w-16)),s===void 0&&h(),t.useProgram(s),i.initAttributes(),i.enableAttribute(l.vertex),i.enableAttribute(l.uv),i.disableUnusedAttributes(),t.uniform1i(u.occlusionMap,0),t.uniform1i(u.map,1),t.bindBuffer(t.ARRAY_BUFFER,n),t.vertexAttribPointer(l.vertex,2,t.FLOAT,!1,2*8,0),t.vertexAttribPointer(l.uv,2,t.FLOAT,!1,2*8,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),i.disable(t.CULL_FACE),i.setDepthWrite(!1);for(var b=0,E=e.length;b<E;b++){M=16/m.w,S.set(M*_,M);var I=e[b];if(v.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]),v.applyMatrix4(g.matrixWorldInverse),v.applyProjection(g.projectionMatrix),w.copy(v),T.x=m.x+w.x*y+y-8,T.y=m.y+w.y*x+x-8,C.containsPoint(T)===!0){i.activeTexture(t.TEXTURE0),i.bindTexture(t.TEXTURE_2D,null),i.activeTexture(t.TEXTURE1),i.bindTexture(t.TEXTURE_2D,c),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGB,T.x,T.y,16,16,0),t.uniform1i(u.renderType,0),t.uniform2f(u.scale,S.x,S.y),t.uniform3f(u.screenPosition,w.x,w.y,w.z),i.disable(t.BLEND),i.enable(t.DEPTH_TEST),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),i.activeTexture(t.TEXTURE0),i.bindTexture(t.TEXTURE_2D,f),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,T.x,T.y,16,16,0),t.uniform1i(u.renderType,1),i.disable(t.DEPTH_TEST),i.activeTexture(t.TEXTURE1),i.bindTexture(t.TEXTURE_2D,c),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),I.positionScreen.copy(w),I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares(),t.uniform1i(u.renderType,2),i.enable(t.BLEND);for(var R=0,A=I.lensFlares.length;R<A;R++){var D=I.lensFlares[R];D.opacity>.001&&D.scale>.001&&(w.x=D.x,w.y=D.y,w.z=D.z,M=D.size*D.scale/m.w,S.x=M*_,S.y=M,t.uniform3f(u.screenPosition,w.x,w.y,w.z),t.uniform2f(u.scale,S.x,S.y),t.uniform1f(u.rotation,D.rotation),t.uniform1f(u.opacity,D.opacity),t.uniform3f(u.color,D.color.r,D.color.g,D.color.b),i.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst),r.setTexture2D(D.texture,1),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0))}}}i.enable(t.CULL_FACE),i.enable(t.DEPTH_TEST),i.setDepthWrite(!0),r.resetGLState()}};function p(d){var g=t.createProgram(),m=t.createShader(t.FRAGMENT_SHADER),v=t.createShader(t.VERTEX_SHADER),_="precision "+r.getPrecision()+` float;
  4. `;return t.shaderSource(m,_+d.fragmentShader),t.shaderSource(v,_+d.vertexShader),t.compileShader(m),t.compileShader(v),t.attachShader(g,m),t.attachShader(g,v),t.linkProgram(g),g}}function ERe(r,e){var t=r.context,i=r.state,n,a,o,s,l,u,c=new oe,f=new on,h=new oe;function p(){var m=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),v=new Uint16Array([0,1,2,0,2,3]);n=t.createBuffer(),a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,m,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.bufferData(t.ELEMENT_ARRAY_BUFFER,v,t.STATIC_DRAW),o=d(),s={position:t.getAttribLocation(o,"position"),uv:t.getAttribLocation(o,"uv")},l={uvOffset:t.getUniformLocation(o,"uvOffset"),uvScale:t.getUniformLocation(o,"uvScale"),rotation:t.getUniformLocation(o,"rotation"),scale:t.getUniformLocation(o,"scale"),color:t.getUniformLocation(o,"color"),map:t.getUniformLocation(o,"map"),opacity:t.getUniformLocation(o,"opacity"),modelViewMatrix:t.getUniformLocation(o,"modelViewMatrix"),projectionMatrix:t.getUniformLocation(o,"projectionMatrix"),fogType:t.getUniformLocation(o,"fogType"),fogDensity:t.getUniformLocation(o,"fogDensity"),fogNear:t.getUniformLocation(o,"fogNear"),fogFar:t.getUniformLocation(o,"fogFar"),fogColor:t.getUniformLocation(o,"fogColor"),alphaTest:t.getUniformLocation(o,"alphaTest")};var _=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");_.width=8,_.height=8;var y=_.getContext("2d");y.fillStyle="white",y.fillRect(0,0,8,8),u=new ni(_),u.needsUpdate=!0}this.render=function(m,v){if(e.length!==0){o===void 0&&p(),t.useProgram(o),i.initAttributes(),i.enableAttribute(s.position),i.enableAttribute(s.uv),i.disableUnusedAttributes(),i.disable(t.CULL_FACE),i.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,n),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,2*8,0),t.vertexAttribPointer(s.uv,2,t.FLOAT,!1,2*8,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.uniformMatrix4fv(l.projectionMatrix,!1,v.projectionMatrix.elements),i.activeTexture(t.TEXTURE0),t.uniform1i(l.map,0);var _=0,y=0,x=m.fog;x?(t.uniform3f(l.fogColor,x.color.r,x.color.g,x.color.b),x.isFog?(t.uniform1f(l.fogNear,x.near),t.uniform1f(l.fogFar,x.far),t.uniform1i(l.fogType,1),_=1,y=1):x.isFogExp2&&(t.uniform1f(l.fogDensity,x.density),t.uniform1i(l.fogType,2),_=2,y=2)):(t.uniform1i(l.fogType,0),_=0,y=0);for(var M=0,S=e.length;M<S;M++){var w=e[M];w.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(g);for(var T=[],M=0,S=e.length;M<S;M++){var w=e[M],C=w.material;if(C.visible!==!1){t.uniform1f(l.alphaTest,C.alphaTest),t.uniformMatrix4fv(l.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(c,f,h),T[0]=h.x,T[1]=h.y;var b=0;m.fog&&C.fog&&(b=y),_!==b&&(t.uniform1i(l.fogType,b),_=b),C.map!==null?(t.uniform2f(l.uvOffset,C.map.offset.x,C.map.offset.y),t.uniform2f(l.uvScale,C.map.repeat.x,C.map.repeat.y)):(t.uniform2f(l.uvOffset,0,0),t.uniform2f(l.uvScale,1,1)),t.uniform1f(l.opacity,C.opacity),t.uniform3f(l.color,C.color.r,C.color.g,C.color.b),t.uniform1f(l.rotation,C.rotation),t.uniform2fv(l.scale,T),i.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),i.setDepthTest(C.depthTest),i.setDepthWrite(C.depthWrite),C.map?r.setTexture2D(C.map,0):r.setTexture2D(u,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)}}i.enable(t.CULL_FACE),r.resetGLState()}};function d(){var m=t.createProgram(),v=t.createShader(t.VERTEX_SHADER),_=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(v,["precision "+r.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join(`
  5. `)),t.shaderSource(_,["precision "+r.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join(`
  6. `)),t.compileShader(v),t.compileShader(_),t.attachShader(m,v),t.attachShader(m,_),t.linkProgram(m),m}function g(m,v){return m.renderOrder!==v.renderOrder?m.renderOrder-v.renderOrder:m.z!==v.z?v.z-m.z:v.id-m.id}}function mr(){Object.defineProperty(this,"id",{value:ARe++}),this.uuid=cr.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Uy,this.side=Zg,this.shading=Uz,this.vertexColors=yC,this.opacity=1,this.transparent=!1,this.blendSrc=Gz,this.blendDst=Hz,this.blendEquation=Vz,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=GA,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function _a(r){mr.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=`void main() {
  7. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  8. }`,this.fragmentShader=`void main() {
  9. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  10. }`,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,r!==void 0&&(r.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(r))}function Sh(r){mr.call(this),this.type="MeshDepthMaterial",this.depthPacking=Dne,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(r)}function lu(r,e){this.min=r!==void 0?r:new oe(1/0,1/0,1/0),this.max=e!==void 0?e:new oe(-1/0,-1/0,-1/0)}function $n(r,e){this.center=r!==void 0?r:new oe,this.radius=e!==void 0?e:0}function bs(){this.elements=new Float32Array([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.")}function Io(r,e){this.normal=r!==void 0?r:new oe(1,0,0),this.constant=e!==void 0?e:0}function DS(r,e,t,i,n,a){this.planes=[r!==void 0?r:new Io,e!==void 0?e:new Io,t!==void 0?t:new Io,i!==void 0?i:new Io,n!==void 0?n:new Io,a!==void 0?a:new Io]}function Gne(r,e,t,i){var n=r.context,a=r.state,o=new DS,s=new qt,l=e.shadows,u=new St,c=new St(i.maxTextureSize,i.maxTextureSize),f=new oe,h=new oe,p=[],d=1,g=2,m=(d|g)+1,v=new Array(m),_=new Array(m),y={},x=[new oe(1,0,0),new oe(-1,0,0),new oe(0,0,1),new oe(0,0,-1),new oe(0,1,0),new oe(0,-1,0)],M=[new oe(0,1,0),new oe(0,1,0),new oe(0,1,0),new oe(0,1,0),new oe(0,0,1),new oe(0,0,-1)],S=[new Qr,new Qr,new Qr,new Qr,new Qr,new Qr],w=new Sh;w.depthPacking=Ine,w.clipping=!0;for(var T=Qg.distanceRGBA,C=eo.clone(T.uniforms),b=0;b!==m;++b){var E=(b&d)!==0,I=(b&g)!==0,R=w.clone();R.morphTargets=E,R.skinning=I,v[b]=R;var A=new _a({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:T.vertexShader,fragmentShader:T.fragmentShader,morphTargets:E,skinning:I,clipping:!0});_[b]=A}var D=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Iz,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(F,k){if(D.enabled!==!1&&!(D.autoUpdate===!1&&D.needsUpdate===!1)&&l.length!==0){a.buffers.color.setClear(1,1,1,1),a.disable(n.BLEND),a.setDepthTest(!0),a.setScissorTest(!1);for(var G,Y,J=0,Q=l.length;J<Q;J++){var V=l[J],K=V.shadow;if(K===void 0){console.warn("THREE.WebGLShadowMap:",V,"has no shadow.");continue}var ae=K.camera;if(u.copy(K.mapSize),u.min(c),V&&V.isPointLight){G=6,Y=!0;var ve=u.x,ue=u.y;S[0].set(ve*2,ue,ve,ue),S[1].set(0,ue,ve,ue),S[2].set(ve*3,ue,ve,ue),S[3].set(ve,ue,ve,ue),S[4].set(ve*3,0,ve,ue),S[5].set(ve,0,ve,ue),u.x*=4,u.y*=2}else G=1,Y=!1;if(K.map===null){var se={minFilter:Oo,magFilter:Oo,format:su};K.map=new Oy(u.x,u.y,se),ae.updateProjectionMatrix()}K.isSpotLightShadow&&K.update(V),K&&K.isRectAreaLightShadow&&K.update(V);var Ee=K.map,q=K.matrix;h.setFromMatrixPosition(V.matrixWorld),ae.position.copy(h),r.setRenderTarget(Ee),r.clear();for(var H=0;H<G;H++){if(Y){f.copy(ae.position),f.add(x[H]),ae.up.copy(M[H]),ae.lookAt(f);var We=S[H];a.viewport(We)}else f.setFromMatrixPosition(V.target.matrixWorld),ae.lookAt(f);ae.updateMatrixWorld(),ae.matrixWorldInverse.getInverse(ae.matrixWorld),q.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),q.multiply(ae.projectionMatrix),q.multiply(ae.matrixWorldInverse),s.multiplyMatrices(ae.projectionMatrix,ae.matrixWorldInverse),o.setFromMatrix(s),p.length=0,B(F,k,ae);for(var _e=0,xe=p.length;_e<xe;_e++){var Le=p[_e],Ue=t.update(Le),Ne=Le.material;if(Ne&&Ne.isMultiMaterial)for(var Ve=Ue.groups,ct=Ne.materials,z=0,L=Ve.length;z<L;z++){var ne=Ve[z],le=ct[ne.materialIndex];if(le.visible===!0){var me=U(Le,le,Y,h);r.renderBufferDirect(ae,null,Ue,me,Le,ne)}}else{var me=U(Le,Ne,Y,h);r.renderBufferDirect(ae,null,Ue,me,Le,null)}}}}var he=r.getClearColor(),et=r.getClearAlpha();r.setClearColor(he,et),D.needsUpdate=!1}};function U(F,k,G,Y){var J=F.geometry,Q=null,V=v,K=F.customDepthMaterial;if(G&&(V=_,K=F.customDistanceMaterial),K)Q=K;else{var ae=!1;k.morphTargets&&(J&&J.isBufferGeometry?ae=J.morphAttributes&&J.morphAttributes.position&&J.morphAttributes.position.length>0:J&&J.isGeometry&&(ae=J.morphTargets&&J.morphTargets.length>0));var ve=F.isSkinnedMesh&&k.skinning,ue=0;ae&&(ue|=d),ve&&(ue|=g),Q=V[ue]}if(r.localClippingEnabled&&k.clipShadows===!0&&k.clippingPlanes.length!==0){var se=Q.uuid,Ee=k.uuid,q=y[se];q===void 0&&(q={},y[se]=q);var H=q[Ee];H===void 0&&(H=Q.clone(),q[Ee]=H),Q=H}Q.visible=k.visible,Q.wireframe=k.wireframe;var We=k.side;return D.renderSingleSided&&We==Ny&&(We=Zg),D.renderReverseSided&&(We===Zg?We=yh:We===yh&&(We=Zg)),Q.side=We,Q.clipShadows=k.clipShadows,Q.clippingPlanes=k.clippingPlanes,Q.wireframeLinewidth=k.wireframeLinewidth,Q.linewidth=k.linewidth,G&&Q.uniforms.lightPos!==void 0&&Q.uniforms.lightPos.value.copy(Y),Q}function B(F,k,G){if(F.visible!==!1){var Y=(F.layers.mask&k.layers.mask)!==0;if(Y&&(F.isMesh||F.isLine||F.isPoints)&&F.castShadow&&(F.frustumCulled===!1||o.intersectsObject(F)===!0)){var J=F.material;J.visible===!0&&(F.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,F.matrixWorld),p.push(F))}for(var Q=F.children,V=0,K=Q.length;V<K;V++)B(Q[V],k,G)}}}function Mh(r,e){this.origin=r!==void 0?r:new oe,this.direction=e!==void 0?e:new oe}function bh(r,e,t,i){this._x=r||0,this._y=e||0,this._z=t||0,this._order=i||bh.DefaultOrder}function qA(){this.mask=1}function Et(){Object.defineProperty(this,"id",{value:CRe++}),this.uuid=cr.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Et.DefaultUp.clone();var r=new oe,e=new bh,t=new on,i=new oe(1,1,1);function n(){t.setFromEuler(e,!1)}function a(){e.setFromQuaternion(t,void 0,!1)}e.onChange(n),t.onChange(a),Object.defineProperties(this,{position:{enumerable:!0,value:r},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:t},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new qt},normalMatrix:{value:new bs}}),this.matrix=new qt,this.matrixWorld=new qt,this.matrixAutoUpdate=Et.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new qA,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function Rd(r,e){this.start=r!==void 0?r:new oe,this.end=e!==void 0?e:new oe}function Ss(r,e,t){this.a=r!==void 0?r:new oe,this.b=e!==void 0?e:new oe,this.c=t!==void 0?t:new oe}function Fo(r,e,t,i,n,a){this.a=r,this.b=e,this.c=t,this.normal=i&&i.isVector3?i:new oe,this.vertexNormals=Array.isArray(i)?i:[],this.color=n&&n.isColor?n:new Gt,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=a!==void 0?a:0}function io(r){mr.call(this),this.type="MeshBasicMaterial",this.color=new Gt(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=vM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(r)}function gt(r,e,t){if(Array.isArray(r))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=cr.generateUUID(),this.array=r,this.itemSize=e,this.count=r!==void 0?r.length/e:0,this.normalized=t===!0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function IS(r,e){gt.call(this,new Int8Array(r),e)}function NS(r,e){gt.call(this,new Uint8Array(r),e)}function US(r,e){gt.call(this,new Uint8ClampedArray(r),e)}function OS(r,e){gt.call(this,new Int16Array(r),e)}function nc(r,e){gt.call(this,new Uint16Array(r),e)}function FS(r,e){gt.call(this,new Int32Array(r),e)}function ac(r,e){gt.call(this,new Uint32Array(r),e)}function gr(r,e){gt.call(this,new Float32Array(r),e)}function zS(r,e){gt.call(this,new Float64Array(r),e)}function Hne(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function or(){Object.defineProperty(this,"id",{value:Jz()}),this.uuid=cr.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Jz(){return RRe++}function Bt(){Object.defineProperty(this,"id",{value:Jz()}),this.uuid=cr.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function mn(r,e){Et.call(this),this.type="Mesh",this.geometry=r!==void 0?r:new Bt,this.material=e!==void 0?e:new io({color:Math.random()*16777215}),this.drawMode=jz,this.updateMorphTargets()}function Ud(r,e,t,i,n,a){Bt.call(this),this.type="BoxBufferGeometry",this.parameters={width:r,height:e,depth:t,widthSegments:i,heightSegments:n,depthSegments:a};var o=this;i=Math.floor(i)||1,n=Math.floor(n)||1,a=Math.floor(a)||1;var s=_(i,n,a),l=y(i,n,a),u=new(l>65535?Uint32Array:Uint16Array)(l),c=new Float32Array(s*3),f=new Float32Array(s*3),h=new Float32Array(s*2),p=0,d=0,g=0,m=0,v=0;x("z","y","x",-1,-1,t,e,r,a,n,0),x("z","y","x",1,-1,t,e,-r,a,n,1),x("x","z","y",1,1,r,t,e,i,a,2),x("x","z","y",1,-1,r,t,-e,i,a,3),x("x","y","z",1,-1,r,e,t,i,n,4),x("x","y","z",-1,-1,r,e,-t,i,n,5),this.setIndex(new gt(u,1)),this.addAttribute("position",new gt(c,3)),this.addAttribute("normal",new gt(f,3)),this.addAttribute("uv",new gt(h,2));function _(M,S,w){var T=0;return T+=(M+1)*(S+1)*2,T+=(M+1)*(w+1)*2,T+=(w+1)*(S+1)*2,T}function y(M,S,w){var T=0;return T+=M*S*2,T+=M*w*2,T+=w*S*2,T*6}function x(M,S,w,T,C,b,E,I,R,A,D){for(var U=b/R,B=E/A,F=b/2,k=E/2,G=I/2,Y=R+1,J=A+1,Q=0,V=0,K=new oe,ae=0;ae<J;ae++)for(var ve=ae*B-k,ue=0;ue<Y;ue++){var se=ue*U-F;K[M]=se*T,K[S]=ve*C,K[w]=G,c[p]=K.x,c[p+1]=K.y,c[p+2]=K.z,K[M]=0,K[S]=0,K[w]=I>0?1:-1,f[p]=K.x,f[p+1]=K.y,f[p+2]=K.z,h[d]=ue/R,h[d+1]=1-ae/A,p+=3,d+=2,Q+=1}for(ae=0;ae<A;ae++)for(ue=0;ue<R;ue++){var Ee=m+ue+Y*ae,q=m+ue+Y*(ae+1),H=m+(ue+1)+Y*(ae+1),We=m+(ue+1)+Y*ae;u[g]=Ee,u[g+1]=q,u[g+2]=We,u[g+3]=q,u[g+4]=H,u[g+5]=We,g+=6,V+=6}o.addGroup(v,V,D),v+=V,m+=Q}}function Od(r,e,t,i){Bt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:r,height:e,widthSegments:t,heightSegments:i};for(var n=r/2,a=e/2,o=Math.floor(t)||1,s=Math.floor(i)||1,l=o+1,u=s+1,c=r/o,f=e/s,h=new Float32Array(l*u*3),p=new Float32Array(l*u*3),d=new Float32Array(l*u*2),g=0,m=0,v=0;v<u;v++)for(var _=v*f-a,y=0;y<l;y++){var x=y*c-n;h[g]=x,h[g+1]=-_,p[g+2]=1,d[m]=y/o,d[m+1]=1-v/s,g+=3,m+=2}g=0;for(var M=new(h.length/3>65535?Uint32Array:Uint16Array)(o*s*6),v=0;v<s;v++)for(var y=0;y<o;y++){var S=y+l*v,w=y+l*(v+1),T=y+1+l*(v+1),C=y+1+l*v;M[g]=S,M[g+1]=w,M[g+2]=C,M[g+3]=w,M[g+4]=T,M[g+5]=C,g+=6}this.setIndex(new gt(M,1)),this.addAttribute("position",new gt(h,3)),this.addAttribute("normal",new gt(p,3)),this.addAttribute("uv",new gt(d,2))}function Qn(){Et.call(this),this.type="Camera",this.matrixWorldInverse=new qt,this.projectionMatrix=new qt}function Kn(r,e,t,i){Qn.call(this),this.type="PerspectiveCamera",this.fov=r!==void 0?r:50,this.zoom=1,this.near=t!==void 0?t:.1,this.far=i!==void 0?i:2e3,this.focus=10,this.aspect=e!==void 0?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ey(r,e,t,i,n,a){Qn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=r,this.right=e,this.top=t,this.bottom=i,this.near=n!==void 0?n:.1,this.far=a!==void 0?a:2e3,this.updateProjectionMatrix()}function LRe(r,e,t){var i;function n(c){i=c}var a,o;function s(c){c.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(a=r.UNSIGNED_INT,o=4):c.array instanceof Uint16Array?(a=r.UNSIGNED_SHORT,o=2):(a=r.UNSIGNED_BYTE,o=1)}function l(c,f){r.drawElements(i,f,a,c*o),t.calls++,t.vertices+=f,i===r.TRIANGLES&&(t.faces+=f/3)}function u(c,f,h){var p=e.get("ANGLE_instanced_arrays");if(p===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p.drawElementsInstancedANGLE(i,h,a,f*o,c.maxInstancedCount),t.calls++,t.vertices+=h*c.maxInstancedCount,i===r.TRIANGLES&&(t.faces+=c.maxInstancedCount*h/3)}return{setMode:n,setIndex:s,render:l,renderInstances:u}}function PRe(r,e,t){var i;function n(s){i=s}function a(s,l){r.drawArrays(i,s,l),t.calls++,t.vertices+=l,i===r.TRIANGLES&&(t.faces+=l/3)}function o(s){var l=e.get("ANGLE_instanced_arrays");if(l===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}var u=s.attributes.position,c=0;u.isInterleavedBufferAttribute?(c=u.data.count,l.drawArraysInstancedANGLE(i,0,c,s.maxInstancedCount)):(c=u.count,l.drawArraysInstancedANGLE(i,0,c,s.maxInstancedCount)),t.calls++,t.vertices+=c*s.maxInstancedCount,i===r.TRIANGLES&&(t.faces+=s.maxInstancedCount*c/3)}return{setMode:n,render:a,renderInstances:o}}function DRe(){var r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];var t;switch(e.type){case"DirectionalLight":t={direction:new oe,color:new Gt,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"SpotLight":t={position:new oe,direction:new oe,color:new Gt,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"PointLight":t={position:new oe,color:new Gt,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"HemisphereLight":t={direction:new oe,skyColor:new Gt,groundColor:new Gt};break;case"RectAreaLight":t={color:new Gt,position:new oe,halfWidth:new oe,halfHeight:new oe};break}return r[e.id]=t,t}}}function IRe(r){for(var e=r.split(`
  11. `),t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
  12. `)}function Iie(r,e,t){var i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),r.getShaderParameter(i,r.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),r.getShaderInfoLog(i)!==""&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===r.VERTEX_SHADER?"vertex":"fragment",r.getShaderInfoLog(i),IRe(t)),i}function Wne(r){switch(r){case LS:return["Linear","( value )"];case Ane:return["sRGB","( value )"];case Cne:return["RGBE","( value )"];case Rne:return["RGBM","( value, 7.0 )"];case Lne:return["RGBM","( value, 16.0 )"];case Pne:return["RGBD","( value, 256.0 )"];case Kz:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+r)}}function az(r,e){var t=Wne(e);return"vec4 "+r+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function URe(r,e){var t=Wne(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function ORe(r,e){var t;switch(e){case Wz:t="Linear";break;case lne:t="Reinhard";break;case une:t="Uncharted2";break;case cne:t="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function FRe(r,e,t){r=r||{};var i=[r.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(r.fragDepth||e.logarithmicDepthBuffer)&&t.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",r.drawBuffers&&t.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(r.shaderTextureLOD||e.envMap)&&t.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return i.filter(MS).join(`
  13. `)}function zRe(r){var e=[];for(var t in r){var i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  14. `)}function BRe(r,e,t){for(var i={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES),a=0;a<n;a++){var o=r.getActiveAttrib(e,a),s=o.name;i[s]=r.getAttribLocation(e,s)}return i}function MS(r){return r!==""}function Nie(r,e){return r.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)}function yz(r){var e=/#include +<([\w\d.]+)>/g;function t(i,n){var a=Xr[n];if(a===void 0)throw new Error("Can not resolve #include <"+n+">");return yz(a)}return r.replace(e,t)}function Uie(r){var e=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function t(i,n,a,o){for(var s="",l=parseInt(n);l<parseInt(a);l++)s+=o.replace(/\[ i \]/g,"[ "+l+" ]");return s}return r.replace(e,t)}function kRe(r,e,t,i){var n=r.context,a=t.extensions,o=t.defines,s=t.__webglShader.vertexShader,l=t.__webglShader.fragmentShader,u="SHADOWMAP_TYPE_BASIC";i.shadowMapType===Iz?u="SHADOWMAP_TYPE_PCF":i.shadowMapType===kie&&(u="SHADOWMAP_TYPE_PCF_SOFT");var c="ENVMAP_TYPE_CUBE",f="ENVMAP_MODE_REFLECTION",h="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(t.envMap.mapping){case xC:case HA:c="ENVMAP_TYPE_CUBE";break;case SC:case MC:c="ENVMAP_TYPE_CUBE_UV";break;case Xz:case WA:c="ENVMAP_TYPE_EQUIREC";break;case Yz:c="ENVMAP_TYPE_SPHERE";break}switch(t.envMap.mapping){case HA:case WA:f="ENVMAP_MODE_REFRACTION";break}switch(t.combine){case vM:h="ENVMAP_BLENDING_MULTIPLY";break;case one:h="ENVMAP_BLENDING_MIX";break;case sne:h="ENVMAP_BLENDING_ADD";break}}var p=r.gammaFactor>0?r.gammaFactor:1,d=FRe(a,i,r.extensions),g=zRe(o),m=n.createProgram(),v,_;t.isRawShaderMaterial?(v=[g,`
  15. `].filter(MS).join(`
  16. `),_=[d,g,`
  17. `].filter(MS).join(`
  18. `)):(v=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+t.__webglShader.name,g,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+f:"",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.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.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&i.flatShading===!1?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&r.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  19. `].filter(MS).join(`
  20. `),_=[d,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+t.__webglShader.name,g,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+p,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+f:"",i.envMap?"#define "+h:"",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.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&r.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&r.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==kA?"#define TONE_MAPPING":"",i.toneMapping!==kA?Xr.tonemapping_pars_fragment:"",i.toneMapping!==kA?ORe("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?Xr.encodings_pars_fragment:"",i.mapEncoding?az("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?az("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?az("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?URe("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  21. `].filter(MS).join(`
  22. `)),s=yz(s,i),s=Nie(s,i),l=yz(l,i),l=Nie(l,i),t.isShaderMaterial||(s=Uie(s),l=Uie(l));var y=v+s,x=_+l,M=Iie(n,n.VERTEX_SHADER,y),S=Iie(n,n.FRAGMENT_SHADER,x);n.attachShader(m,M),n.attachShader(m,S),t.index0AttributeName!==void 0?n.bindAttribLocation(m,0,t.index0AttributeName):i.morphTargets===!0&&n.bindAttribLocation(m,0,"position"),n.linkProgram(m);var w=n.getProgramInfoLog(m),T=n.getShaderInfoLog(M),C=n.getShaderInfoLog(S),b=!0,E=!0;n.getProgramParameter(m,n.LINK_STATUS)===!1?(b=!1,console.error("THREE.WebGLProgram: shader error: ",n.getError(),"gl.VALIDATE_STATUS",n.getProgramParameter(m,n.VALIDATE_STATUS),"gl.getProgramInfoLog",w,T,C)):w!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",w):(T===""||C==="")&&(E=!1),E&&(this.diagnostics={runnable:b,material:t,programLog:w,vertexShader:{log:T,prefix:v},fragmentShader:{log:C,prefix:_}}),n.deleteShader(M),n.deleteShader(S);var I;this.getUniforms=function(){return I===void 0&&(I=new xh(n,m,r)),I};var R;return this.getAttributes=function(){return R===void 0&&(R=BRe(n,m)),R},this.destroy=function(){n.deleteProgram(m),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=NRe++,this.code=e,this.usedTimes=1,this.program=m,this.vertexShader=M,this.fragmentShader=S,this}function VRe(r,e){var t=[],i={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},n=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking"];function a(s){if(e.floatVertexTextures&&s&&s.skeleton&&s.skeleton.useVertexTexture)return 1024;var l=e.maxVertexUniforms,u=Math.floor((l-20)/4),c=u;return s!==void 0&&s&&s.isSkinnedMesh&&(c=Math.min(s.skeleton.bones.length,c),c<s.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+s.skeleton.bones.length+", this GPU supports just "+c+" (try OpenGL instead of ANGLE)")),c}function o(s,l){var u;return s?s.isTexture?u=s.encoding:s.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),u=s.texture.encoding):u=LS,u===LS&&l&&(u=Kz),u}this.getParameters=function(s,l,u,c,f,h){var p=i[s.type],d=a(h),g=r.getPrecision();s.precision!==null&&(g=e.getMaxPrecision(s.precision),g!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",g,"instead."));var m=r.getCurrentRenderTarget(),v={shaderID:p,precision:g,supportsVertexTextures:e.vertexTextures,outputEncoding:o(m?m.texture:null,r.gammaOutput),map:!!s.map,mapEncoding:o(s.map,r.gammaInput),envMap:!!s.envMap,envMapMode:s.envMap&&s.envMap.mapping,envMapEncoding:o(s.envMap,r.gammaInput),envMapCubeUV:!!s.envMap&&(s.envMap.mapping===SC||s.envMap.mapping===MC),lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,emissiveMapEncoding:o(s.emissiveMap,r.gammaInput),bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,alphaMap:!!s.alphaMap,gradientMap:!!s.gradientMap,combine:s.combine,vertexColors:s.vertexColors,fog:!!u,useFog:s.fog,fogExp:u&&u.isFogExp2,flatShading:s.shading===Nz,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:s.skinning,maxBones:d,useVertexTexture:e.floatVertexTextures&&h&&h.skeleton&&h.skeleton.useVertexTexture,morphTargets:s.morphTargets,morphNormals:s.morphNormals,maxMorphTargets:r.maxMorphTargets,maxMorphNormals:r.maxMorphNormals,numDirLights:l.directional.length,numPointLights:l.point.length,numSpotLights:l.spot.length,numRectAreaLights:l.rectArea.length,numHemiLights:l.hemi.length,numClippingPlanes:c,numClipIntersection:f,shadowMapEnabled:r.shadowMap.enabled&&h.receiveShadow&&l.shadows.length>0,shadowMapType:r.shadowMap.type,toneMapping:r.toneMapping,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,alphaTest:s.alphaTest,doubleSided:s.side===Ny,flipSided:s.side===yh,depthPacking:s.depthPacking!==void 0?s.depthPacking:!1};return v},this.getProgramCode=function(s,l){var u=[];if(l.shaderID?u.push(l.shaderID):(u.push(s.fragmentShader),u.push(s.vertexShader)),s.defines!==void 0)for(var c in s.defines)u.push(c),u.push(s.defines[c]);for(var f=0;f<n.length;f++)u.push(l[n[f]]);return u.join()},this.acquireProgram=function(s,l,u){for(var c,f=0,h=t.length;f<h;f++){var p=t[f];if(p.code===u){c=p,++c.usedTimes;break}}return c===void 0&&(c=new kRe(r,u,s,l),t.push(c)),c},this.releaseProgram=function(s){if(--s.usedTimes===0){var l=t.indexOf(s);t[l]=t[t.length-1],t.pop(),s.destroy()}},this.programs=t}function GRe(r,e,t){var i={};function n(u){var c=u.target,f=i[c.id];f.index!==null&&o(f.index),s(f.attributes),c.removeEventListener("dispose",n),delete i[c.id];var h=e.get(c);h.wireframe&&o(h.wireframe),e.delete(c);var p=e.get(f);p.wireframe&&o(p.wireframe),e.delete(f),t.memory.geometries--}function a(u){return u.isInterleavedBufferAttribute?e.get(u.data).__webglBuffer:e.get(u).__webglBuffer}function o(u){var c=a(u);c!==void 0&&(r.deleteBuffer(c),l(u))}function s(u){for(var c in u)o(u[c])}function l(u){u.isInterleavedBufferAttribute?e.delete(u.data):e.delete(u)}return{get:function(u){var c=u.geometry;if(i[c.id]!==void 0)return i[c.id];c.addEventListener("dispose",n);var f;return c.isBufferGeometry?f=c:c.isGeometry&&(c._bufferGeometry===void 0&&(c._bufferGeometry=new Bt().setFromObject(u)),f=c._bufferGeometry),i[c.id]=f,t.memory.geometries++,f}}}function HRe(r,e,t){var i=new GRe(r,e,t);function n(f){var h=i.get(f);f.geometry.isGeometry&&h.updateFromObject(f);var p=h.index,d=h.attributes;p!==null&&a(p,r.ELEMENT_ARRAY_BUFFER);for(var g in d)a(d[g],r.ARRAY_BUFFER);var m=h.morphAttributes;for(var g in m)for(var v=m[g],_=0,y=v.length;_<y;_++)a(v[_],r.ARRAY_BUFFER);return h}function a(f,h){var p=f.isInterleavedBufferAttribute?f.data:f,d=e.get(p);d.__webglBuffer===void 0?o(d,p,h):d.version!==p.version&&s(d,p,h)}function o(f,h,p){f.__webglBuffer=r.createBuffer(),r.bindBuffer(p,f.__webglBuffer);var d=h.dynamic?r.DYNAMIC_DRAW:r.STATIC_DRAW;r.bufferData(p,h.array,d);var g=r.FLOAT,m=h.array;m instanceof Float32Array?g=r.FLOAT:m instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):m instanceof Uint16Array?g=r.UNSIGNED_SHORT:m instanceof Int16Array?g=r.SHORT:m instanceof Uint32Array?g=r.UNSIGNED_INT:m instanceof Int32Array?g=r.INT:m instanceof Int8Array?g=r.BYTE:m instanceof Uint8Array&&(g=r.UNSIGNED_BYTE),f.bytesPerElement=m.BYTES_PER_ELEMENT,f.type=g,f.version=h.version,h.onUploadCallback()}function s(f,h,p){r.bindBuffer(p,f.__webglBuffer),h.dynamic===!1?r.bufferData(p,h.array,r.STATIC_DRAW):h.updateRange.count===-1?r.bufferSubData(p,0,h.array):h.updateRange.count===0?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(r.bufferSubData(p,h.updateRange.offset*h.array.BYTES_PER_ELEMENT,h.array.subarray(h.updateRange.offset,h.updateRange.offset+h.updateRange.count)),h.updateRange.count=0),f.version=h.version}function l(f){return f.isInterleavedBufferAttribute?e.get(f.data).__webglBuffer:e.get(f).__webglBuffer}function u(f){return f.isInterleavedBufferAttribute?e.get(f.data):e.get(f)}function c(f){var h=e.get(f);if(h.wireframe!==void 0)return h.wireframe;var p=[],d=f.index,g=f.attributes,m=g.position;if(d!==null)for(var v={},_=d.array,y=0,x=_.length;y<x;y+=3){var M=_[y+0],S=_[y+1],w=_[y+2];p.push(M,S,S,w,w,M)}else for(var _=g.position.array,y=0,x=_.length/3-1;y<x;y+=3){var M=y+0,S=y+1,w=y+2;p.push(M,S,S,w,w,M)}var T=m.count>65535?Uint32Array:Uint16Array,C=new gt(new T(p),1);return a(C,r.ELEMENT_ARRAY_BUFFER),h.wireframe=C,C}return{getAttributeBuffer:l,getAttributeProperties:u,getWireframeAttribute:c,update:n}}function WRe(r,e,t,i,n,a,o){var s=o.memory,l=typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext;function u(R,A){if(R.width>A||R.height>A){var D=A/Math.max(R.width,R.height),U=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");U.width=Math.floor(R.width*D),U.height=Math.floor(R.height*D);var B=U.getContext("2d");return B.drawImage(R,0,0,R.width,R.height,0,0,U.width,U.height),console.warn("THREE.WebGLRenderer: image is too big ("+R.width+"x"+R.height+"). Resized to "+U.width+"x"+U.height,R),U}return R}function c(R){return cr.isPowerOfTwo(R.width)&&cr.isPowerOfTwo(R.height)}function f(R){if(R instanceof HTMLImageElement||R instanceof HTMLCanvasElement){var A=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");A.width=cr.nearestPowerOfTwo(R.width),A.height=cr.nearestPowerOfTwo(R.height);var D=A.getContext("2d");return D.drawImage(R,0,0,A.width,A.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+R.width+"x"+R.height+"). Resized to "+A.width+"x"+A.height,R),A}return R}function h(R){return R.wrapS!==Uo||R.wrapT!==Uo||R.minFilter!==Oo&&R.minFilter!==to}function p(R){return R===Oo||R===bC||R===wC?r.NEAREST:r.LINEAR}function d(R){var A=R.target;A.removeEventListener("dispose",d),m(A),s.textures--}function g(R){var A=R.target;A.removeEventListener("dispose",g),v(A),s.textures--}function m(R){var A=i.get(R);if(R.image&&A.__image__webglTextureCube)r.deleteTexture(A.__image__webglTextureCube);else{if(A.__webglInit===void 0)return;r.deleteTexture(A.__webglTexture)}i.delete(R)}function v(R){var A=i.get(R),D=i.get(R.texture);if(R){if(D.__webglTexture!==void 0&&r.deleteTexture(D.__webglTexture),R.depthTexture&&R.depthTexture.dispose(),R.isWebGLRenderTargetCube)for(var U=0;U<6;U++)r.deleteFramebuffer(A.__webglFramebuffer[U]),A.__webglDepthbuffer&&r.deleteRenderbuffer(A.__webglDepthbuffer[U]);else r.deleteFramebuffer(A.__webglFramebuffer),A.__webglDepthbuffer&&r.deleteRenderbuffer(A.__webglDepthbuffer);i.delete(R.texture),i.delete(R)}}function _(R,A){var D=i.get(R);if(R.version>0&&D.__version!==R.version){var U=R.image;if(U===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",R);else if(U.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",R);else{S(D,R,A);return}}t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_2D,D.__webglTexture)}function y(R,A){var D=i.get(R);if(R.image.length===6)if(R.version>0&&D.__version!==R.version){D.__image__webglTextureCube||(R.addEventListener("dispose",d),D.__image__webglTextureCube=r.createTexture(),s.textures++),t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,D.__image__webglTextureCube),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,R.flipY);for(var U=R&&R.isCompressedTexture,B=R.image[0]&&R.image[0].isDataTexture,F=[],k=0;k<6;k++)!U&&!B?F[k]=u(R.image[k],n.maxCubemapSize):F[k]=B?R.image[k].image:R.image[k];var G=F[0],Y=c(G),J=a(R.format),Q=a(R.type);M(r.TEXTURE_CUBE_MAP,R,Y);for(var k=0;k<6;k++)if(!U)B?t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,J,F[k].width,F[k].height,0,J,Q,F[k].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,J,J,Q,F[k]);else for(var V,K=F[k].mipmaps,ae=0,ve=K.length;ae<ve;ae++)V=K[ae],R.format!==su&&R.format!==Kg?t.getCompressedTextureFormats().indexOf(J)>-1?t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,ae,J,V.width,V.height,0,V.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,ae,J,V.width,V.height,0,J,Q,V.data);R.generateMipmaps&&Y&&r.generateMipmap(r.TEXTURE_CUBE_MAP),D.__version=R.version,R.onUpdate&&R.onUpdate(R)}else t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,D.__image__webglTextureCube)}function x(R,A){t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,i.get(R).__webglTexture)}function M(R,A,D){var U;if(D?(r.texParameteri(R,r.TEXTURE_WRAP_S,a(A.wrapS)),r.texParameteri(R,r.TEXTURE_WRAP_T,a(A.wrapT)),r.texParameteri(R,r.TEXTURE_MAG_FILTER,a(A.magFilter)),r.texParameteri(R,r.TEXTURE_MIN_FILTER,a(A.minFilter))):(r.texParameteri(R,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(R,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(A.wrapS!==Uo||A.wrapT!==Uo)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",A),r.texParameteri(R,r.TEXTURE_MAG_FILTER,p(A.magFilter)),r.texParameteri(R,r.TEXTURE_MIN_FILTER,p(A.minFilter)),A.minFilter!==Oo&&A.minFilter!==to&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",A)),U=e.get("EXT_texture_filter_anisotropic"),U){if(A.type===jg&&e.get("OES_texture_float_linear")===null||A.type===YA&&e.get("OES_texture_half_float_linear")===null)return;(A.anisotropy>1||i.get(A).__currentAnisotropy)&&(r.texParameterf(R,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,n.getMaxAnisotropy())),i.get(A).__currentAnisotropy=A.anisotropy)}}function S(R,A,D){R.__webglInit===void 0&&(R.__webglInit=!0,A.addEventListener("dispose",d),R.__webglTexture=r.createTexture(),s.textures++),t.activeTexture(r.TEXTURE0+D),t.bindTexture(r.TEXTURE_2D,R.__webglTexture),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,A.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,A.unpackAlignment);var U=u(A.image,n.maxTextureSize);h(A)&&c(U)===!1&&(U=f(U));var B=c(U),F=a(A.format),k=a(A.type);M(r.TEXTURE_2D,A,B);var G,Y=A.mipmaps;if(A.isDepthTexture){var J=r.DEPTH_COMPONENT;if(A.type===jg){if(!l)throw new Error("Float Depth Texture only supported in WebGL2.0");J=r.DEPTH_COMPONENT32F}else l&&(J=r.DEPTH_COMPONENT16);A.format===Cd&&J===r.DEPTH_COMPONENT&&A.type!==ES&&A.type!==Zz&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),A.type=ES,k=a(A.type)),A.format===Jg&&(J=r.DEPTH_STENCIL,A.type!==AS&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),A.type=AS,k=a(A.type))),t.texImage2D(r.TEXTURE_2D,0,J,U.width,U.height,0,F,k,null)}else if(A.isDataTexture)if(Y.length>0&&B){for(var Q=0,V=Y.length;Q<V;Q++)G=Y[Q],t.texImage2D(r.TEXTURE_2D,Q,F,G.width,G.height,0,F,k,G.data);A.generateMipmaps=!1}else t.texImage2D(r.TEXTURE_2D,0,F,U.width,U.height,0,F,k,U.data);else if(A.isCompressedTexture)for(var Q=0,V=Y.length;Q<V;Q++)G=Y[Q],A.format!==su&&A.format!==Kg?t.getCompressedTextureFormats().indexOf(F)>-1?t.compressedTexImage2D(r.TEXTURE_2D,Q,F,G.width,G.height,0,G.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):t.texImage2D(r.TEXTURE_2D,Q,F,G.width,G.height,0,F,k,G.data);else if(Y.length>0&&B){for(var Q=0,V=Y.length;Q<V;Q++)G=Y[Q],t.texImage2D(r.TEXTURE_2D,Q,F,F,k,G);A.generateMipmaps=!1}else t.texImage2D(r.TEXTURE_2D,0,F,F,k,U);A.generateMipmaps&&B&&r.generateMipmap(r.TEXTURE_2D),R.__version=A.version,A.onUpdate&&A.onUpdate(A)}function w(R,A,D,U){var B=a(A.texture.format),F=a(A.texture.type);t.texImage2D(U,0,B,A.width,A.height,0,B,F,null),r.bindFramebuffer(r.FRAMEBUFFER,R),r.framebufferTexture2D(r.FRAMEBUFFER,D,U,i.get(A.texture).__webglTexture,0),r.bindFramebuffer(r.FRAMEBUFFER,null)}function T(R,A){r.bindRenderbuffer(r.RENDERBUFFER,R),A.depthBuffer&&!A.stencilBuffer?(r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,A.width,A.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,R)):A.depthBuffer&&A.stencilBuffer?(r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,A.width,A.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,R)):r.renderbufferStorage(r.RENDERBUFFER,r.RGBA4,A.width,A.height),r.bindRenderbuffer(r.RENDERBUFFER,null)}function C(R,A){var D=A&&A.isWebGLRenderTargetCube;if(D)throw new Error("Depth Texture with cube render targets is not supported!");if(r.bindFramebuffer(r.FRAMEBUFFER,R),!(A.depthTexture&&A.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(A.depthTexture).__webglTexture||A.depthTexture.image.width!==A.width||A.depthTexture.image.height!==A.height)&&(A.depthTexture.image.width=A.width,A.depthTexture.image.height=A.height,A.depthTexture.needsUpdate=!0),_(A.depthTexture,0);var U=i.get(A.depthTexture).__webglTexture;if(A.depthTexture.format===Cd)r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,U,0);else if(A.depthTexture.format===Jg)r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,U,0);else throw new Error("Unknown depthTexture format")}function b(R){var A=i.get(R),D=R.isWebGLRenderTargetCube===!0;if(R.depthTexture){if(D)throw new Error("target.depthTexture not supported in Cube render targets");C(A.__webglFramebuffer,R)}else if(D){A.__webglDepthbuffer=[];for(var U=0;U<6;U++)r.bindFramebuffer(r.FRAMEBUFFER,A.__webglFramebuffer[U]),A.__webglDepthbuffer[U]=r.createRenderbuffer(),T(A.__webglDepthbuffer[U],R)}else r.bindFramebuffer(r.FRAMEBUFFER,A.__webglFramebuffer),A.__webglDepthbuffer=r.createRenderbuffer(),T(A.__webglDepthbuffer,R);r.bindFramebuffer(r.FRAMEBUFFER,null)}function E(R){var A=i.get(R),D=i.get(R.texture);R.addEventListener("dispose",g),D.__webglTexture=r.createTexture(),s.textures++;var U=R.isWebGLRenderTargetCube===!0,B=c(R);if(U){A.__webglFramebuffer=[];for(var F=0;F<6;F++)A.__webglFramebuffer[F]=r.createFramebuffer()}else A.__webglFramebuffer=r.createFramebuffer();if(U){t.bindTexture(r.TEXTURE_CUBE_MAP,D.__webglTexture),M(r.TEXTURE_CUBE_MAP,R.texture,B);for(var F=0;F<6;F++)w(A.__webglFramebuffer[F],R,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+F);R.texture.generateMipmaps&&B&&r.generateMipmap(r.TEXTURE_CUBE_MAP),t.bindTexture(r.TEXTURE_CUBE_MAP,null)}else t.bindTexture(r.TEXTURE_2D,D.__webglTexture),M(r.TEXTURE_2D,R.texture,B),w(A.__webglFramebuffer,R,r.COLOR_ATTACHMENT0,r.TEXTURE_2D),R.texture.generateMipmaps&&B&&r.generateMipmap(r.TEXTURE_2D),t.bindTexture(r.TEXTURE_2D,null);R.depthBuffer&&b(R)}function I(R){var A=R.texture;if(A.generateMipmaps&&c(R)&&A.minFilter!==Oo&&A.minFilter!==to){var D=R&&R.isWebGLRenderTargetCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,U=i.get(A).__webglTexture;t.bindTexture(D,U),r.generateMipmap(D),t.bindTexture(D,null)}}this.setTexture2D=_,this.setTextureCube=y,this.setTextureCubeDynamic=x,this.setupRenderTarget=E,this.updateRenderTargetMipmap=I}function XRe(){var r={};return{get:function(e){var t=e.uuid,i=r[t];return i===void 0&&(i={},r[t]=i),i},delete:function(e){delete r[e.uuid]},clear:function(){r={}}}}function YRe(r,e,t){function i(){var $=!1,it=new Qr,Xe=null,ze=new Qr;return{setMask:function(we){Xe!==we&&!$&&(r.colorMask(we,we,we,we),Xe=we)},setLocked:function(we){$=we},setClear:function(we,Ie,st,Je,kt){kt===!0&&(we*=Je,Ie*=Je,st*=Je),it.set(we,Ie,st,Je),ze.equals(it)===!1&&(r.clearColor(we,Ie,st,Je),ze.copy(it))},reset:function(){$=!1,Xe=null,ze.set(0,0,0,1)}}}function n(){var $=!1,it=null,Xe=null,ze=null;return{setTest:function(we){we?ve(r.DEPTH_TEST):ue(r.DEPTH_TEST)},setMask:function(we){it!==we&&!$&&(r.depthMask(we),it=we)},setFunc:function(we){if(Xe!==we){if(we)switch(we){case Qie:r.depthFunc(r.NEVER);break;case ene:r.depthFunc(r.ALWAYS);break;case tne:r.depthFunc(r.LESS);break;case GA:r.depthFunc(r.LEQUAL);break;case rne:r.depthFunc(r.EQUAL);break;case ine:r.depthFunc(r.GEQUAL);break;case nne:r.depthFunc(r.GREATER);break;case ane:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}else r.depthFunc(r.LEQUAL);Xe=we}},setLocked:function(we){$=we},setClear:function(we){ze!==we&&(r.clearDepth(we),ze=we)},reset:function(){$=!1,it=null,Xe=null,ze=null}}}function a(){var $=!1,it=null,Xe=null,ze=null,we=null,Ie=null,st=null,Je=null,kt=null;return{setTest:function(X){X?ve(r.STENCIL_TEST):ue(r.STENCIL_TEST)},setMask:function(X){it!==X&&!$&&(r.stencilMask(X),it=X)},setFunc:function(X,Te,te){(Xe!==X||ze!==Te||we!==te)&&(r.stencilFunc(X,Te,te),Xe=X,ze=Te,we=te)},setOp:function(X,Te,te){(Ie!==X||st!==Te||Je!==te)&&(r.stencilOp(X,Te,te),Ie=X,st=Te,Je=te)},setLocked:function(X){$=X},setClear:function(X){kt!==X&&(r.clearStencil(X),kt=X)},reset:function(){$=!1,it=null,Xe=null,ze=null,we=null,Ie=null,st=null,Je=null,kt=null}}}var o=new i,s=new n,l=new a,u=r.getParameter(r.MAX_VERTEX_ATTRIBS),c=new Uint8Array(u),f=new Uint8Array(u),h=new Uint8Array(u),p={},d=null,g=null,m=null,v=null,_=null,y=null,x=null,M=null,S=!1,w=null,T=null,C=null,b=null,E=null,I=null,R=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),A=parseFloat(/^WebGL\ ([0-9])/.exec(r.getParameter(r.VERSION))[1]),D=parseFloat(A)>=1,U=null,B={},F=new Qr,k=new Qr;function G($,it,Xe){var ze=new Uint8Array(4),we=r.createTexture();r.bindTexture($,we),r.texParameteri($,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri($,r.TEXTURE_MAG_FILTER,r.NEAREST);for(var Ie=0;Ie<Xe;Ie++)r.texImage2D(it+Ie,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ze);return we}var Y={};Y[r.TEXTURE_2D]=G(r.TEXTURE_2D,r.TEXTURE_2D,1),Y[r.TEXTURE_CUBE_MAP]=G(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6);function J(){o.setClear(0,0,0,1),s.setClear(1),l.setClear(0),ve(r.DEPTH_TEST),_e(GA),Ve(!1),ct(wS),ve(r.CULL_FACE),ve(r.BLEND),Ee(Uy)}function Q(){for(var $=0,it=c.length;$<it;$++)c[$]=0}function V($){if(c[$]=1,f[$]===0&&(r.enableVertexAttribArray($),f[$]=1),h[$]!==0){var it=e.get("ANGLE_instanced_arrays");it.vertexAttribDivisorANGLE($,0),h[$]=0}}function K($,it,Xe){c[$]=1,f[$]===0&&(r.enableVertexAttribArray($),f[$]=1),h[$]!==it&&(Xe.vertexAttribDivisorANGLE($,it),h[$]=it)}function ae(){for(var $=0,it=f.length;$!==it;++$)f[$]!==c[$]&&(r.disableVertexAttribArray($),f[$]=0)}function ve($){p[$]!==!0&&(r.enable($),p[$]=!0)}function ue($){p[$]!==!1&&(r.disable($),p[$]=!1)}function se(){if(d===null&&(d=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var $=r.getParameter(r.COMPRESSED_TEXTURE_FORMATS),it=0;it<$.length;it++)d.push($[it]);return d}function Ee($,it,Xe,ze,we,Ie,st,Je){$!==TS?ve(r.BLEND):ue(r.BLEND),($!==g||Je!==S)&&($===Fz?Je?(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.ONE,r.ONE,r.ONE,r.ONE)):(r.blendEquation(r.FUNC_ADD),r.blendFunc(r.SRC_ALPHA,r.ONE)):$===zz?Je?(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.ZERO,r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ONE_MINUS_SRC_ALPHA)):(r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ZERO,r.ONE_MINUS_SRC_COLOR)):$===Bz?Je?(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA)):(r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ZERO,r.SRC_COLOR)):Je?(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)):(r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)),g=$,S=Je),$===kz?(we=we||it,Ie=Ie||Xe,st=st||ze,(it!==m||we!==y)&&(r.blendEquationSeparate(t(it),t(we)),m=it,y=we),(Xe!==v||ze!==_||Ie!==x||st!==M)&&(r.blendFuncSeparate(t(Xe),t(ze),t(Ie),t(st)),v=Xe,_=ze,x=Ie,M=st)):(m=null,v=null,_=null,y=null,x=null,M=null)}function q($){o.setMask($)}function H($){s.setTest($)}function We($){s.setMask($)}function _e($){s.setFunc($)}function xe($){l.setTest($)}function Le($){l.setMask($)}function Ue($,it,Xe){l.setFunc($,it,Xe)}function Ne($,it,Xe){l.setOp($,it,Xe)}function Ve($){w!==$&&($?r.frontFace(r.CW):r.frontFace(r.CCW),w=$)}function ct($){$!==zie?(ve(r.CULL_FACE),$!==T&&($===wS?r.cullFace(r.BACK):$===Dz?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):ue(r.CULL_FACE),T=$}function z($){$!==C&&(D&&r.lineWidth($),C=$)}function L($,it,Xe){$?(ve(r.POLYGON_OFFSET_FILL),(b!==it||E!==Xe)&&(r.polygonOffset(it,Xe),b=it,E=Xe)):ue(r.POLYGON_OFFSET_FILL)}function ne(){return I}function le($){I=$,$?ve(r.SCISSOR_TEST):ue(r.SCISSOR_TEST)}function me($){$===void 0&&($=r.TEXTURE0+R-1),U!==$&&(r.activeTexture($),U=$)}function he($,it){U===null&&me();var Xe=B[U];Xe===void 0&&(Xe={type:void 0,texture:void 0},B[U]=Xe),(Xe.type!==$||Xe.texture!==it)&&(r.bindTexture($,it||Y[$]),Xe.type=$,Xe.texture=it)}function et(){try{r.compressedTexImage2D.apply(r,arguments)}catch($){console.error($)}}function Ke(){try{r.texImage2D.apply(r,arguments)}catch($){console.error($)}}function Se($){F.equals($)===!1&&(r.scissor($.x,$.y,$.z,$.w),F.copy($))}function Ae($){k.equals($)===!1&&(r.viewport($.x,$.y,$.z,$.w),k.copy($))}function nt(){for(var $=0;$<f.length;$++)f[$]===1&&(r.disableVertexAttribArray($),f[$]=0);p={},d=null,U=null,B={},g=null,w=null,T=null,o.reset(),s.reset(),l.reset()}return{buffers:{color:o,depth:s,stencil:l},init:J,initAttributes:Q,enableAttribute:V,enableAttributeAndDivisor:K,disableUnusedAttributes:ae,enable:ve,disable:ue,getCompressedTextureFormats:se,setBlending:Ee,setColorWrite:q,setDepthTest:H,setDepthWrite:We,setDepthFunc:_e,setStencilTest:xe,setStencilWrite:Le,setStencilFunc:Ue,setStencilOp:Ne,setFlipSided:Ve,setCullFace:ct,setLineWidth:z,setPolygonOffset:L,getScissorTest:ne,setScissorTest:le,activeTexture:me,bindTexture:he,compressedTexImage2D:et,texImage2D:Ke,scissor:Se,viewport:Ae,reset:nt}}function qRe(r,e,t){var i;function n(){if(i!==void 0)return i;var x=e.get("EXT_texture_filter_anisotropic");return x!==null?i=r.getParameter(x.MAX_TEXTURE_MAX_ANISOTROPY_EXT):i=0,i}function a(x){if(x==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";x="mediump"}return x==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=t.precision!==void 0?t.precision:"highp",s=a(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=t.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),u=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),c=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_TEXTURE_SIZE),h=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),p=r.getParameter(r.MAX_VERTEX_ATTRIBS),d=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),g=r.getParameter(r.MAX_VARYING_VECTORS),m=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),v=c>0,_=!!e.get("OES_texture_float"),y=v&&_;return{getMaxAnisotropy:n,getMaxPrecision:a,precision:o,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:c,maxTextureSize:f,maxCubemapSize:h,maxAttributes:p,maxVertexUniforms:d,maxVaryings:g,maxFragmentUniforms:m,vertexTextures:v,floatFragmentTextures:_,floatVertexTextures:y}}function ZRe(r){var e={};return{get:function(t){if(e[t]!==void 0)return e[t];var i;switch(t){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=r.getExtension("WEBGL_compressed_texture_etc1");break;default:i=r.getExtension(t)}return i===null&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e[t]=i,i}}}function jRe(){var r=this,e=null,t=0,i=!1,n=!1,a=new Io,o=new bs,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(c,f,h){var p=c.length!==0||f||t!==0||i;return i=f,e=u(c,h,0),t=c.length,p},this.beginShadows=function(){n=!0,u(null)},this.endShadows=function(){n=!1,l()},this.setState=function(c,f,h,p,d,g){if(!i||c===null||c.length===0||n&&!h)n?u(null):l();else{var m=n?0:t,v=m*4,_=d.clippingState||null;s.value=_,_=u(c,p,v,g);for(var y=0;y!==v;++y)_[y]=e[y];d.clippingState=_,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=m}};function l(){s.value!==e&&(s.value=e,s.needsUpdate=t>0),r.numPlanes=t,r.numIntersection=0}function u(c,f,h,p){var d=c!==null?c.length:0,g=null;if(d!==0){if(g=s.value,p!==!0||g===null){var m=h+d*4,v=f.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length<m)&&(g=new Float32Array(m));for(var _=0,y=h;_!==d;++_,y+=4)a.copy(c[_]).applyMatrix4(v,o),a.normal.toArray(g,y),g[y+3]=a.constant}s.value=g,s.needsUpdate=!0}return r.numPlanes=d,g}}function $z(r){console.log("THREE.WebGLRenderer",Fie),r=r||{};var e=r.canvas!==void 0?r.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t=r.context!==void 0?r.context:null,i=r.alpha!==void 0?r.alpha:!1,n=r.depth!==void 0?r.depth:!0,a=r.stencil!==void 0?r.stencil:!0,o=r.antialias!==void 0?r.antialias:!1,s=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,u=[],c=[],f=-1,h=[],p=-1,d=new Float32Array(8),g=[],m=[];this.domElement=e,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Wz,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var v=this,_=null,y=null,x=null,M=-1,S="",w=null,T=new Qr,C=null,b=new Qr,E=0,I=new Gt(0),R=0,A=e.width,D=e.height,U=1,B=new Qr(0,0,A,D),F=!1,k=new Qr(0,0,A,D),G=new DS,Y=new jRe,J=!1,Q=!1,V=new $n,K=new qt,ae=new oe,ve=new qt,ue=new qt,se={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ee={calls:0,vertices:0,faces:0,points:0};this.info={render:Ee,memory:{geometries:0,textures:0},programs:null};var q;try{var H={alpha:i,depth:n,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l};if(q=t||e.getContext("webgl",H)||e.getContext("experimental-webgl",H),q===null)throw e.getContext("webgl")!==null?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";q.getShaderPrecisionFormat===void 0&&(q.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),e.addEventListener("webglcontextlost",Xe,!1)}catch(P){console.error("THREE.WebGLRenderer: "+P)}var We=new ZRe(q);We.get("WEBGL_depth_texture"),We.get("OES_texture_float"),We.get("OES_texture_float_linear"),We.get("OES_texture_half_float"),We.get("OES_texture_half_float_linear"),We.get("OES_standard_derivatives"),We.get("ANGLE_instanced_arrays"),We.get("OES_element_index_uint")&&(Bt.MaxIndex=4294967296);var _e=new qRe(q,We,r),xe=new YRe(q,We,ie),Le=new XRe,Ue=new WRe(q,We,xe,Le,_e,ie,this.info),Ne=new HRe(q,Le,this.info),Ve=new VRe(this,_e),ct=new DRe;this.info.programs=Ve.programs;var z=new PRe(q,We,Ee),L=new LRe(q,We,Ee),ne=new ey(-1,1,1,-1,0,1),le=new Kn,me=new mn(new Od(2,2),new io({depthTest:!1,depthWrite:!1,fog:!1})),he=Qg.cube,et=new mn(new Ud(5,5,5),new _a({uniforms:he.uniforms,vertexShader:he.vertexShader,fragmentShader:he.fragmentShader,side:yh,depthTest:!1,depthWrite:!1,fog:!1}));function Ke(){return y===null?U:1}function Se(){xe.init(),xe.scissor(T.copy(B).multiplyScalar(U)),xe.viewport(b.copy(k).multiplyScalar(U)),xe.buffers.color.setClear(I.r,I.g,I.b,R,s)}function Ae(){_=null,w=null,S="",M=-1,xe.reset()}Se(),this.context=q,this.capabilities=_e,this.extensions=We,this.properties=Le,this.state=xe;var nt=new Gne(this,se,Ne,_e);this.shadowMap=nt;var $=new ERe(this,g),it=new TRe(this,m);this.getContext=function(){return q},this.getContextAttributes=function(){return q.getContextAttributes()},this.forceContextLoss=function(){We.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return _e.getMaxAnisotropy()},this.getPrecision=function(){return _e.precision},this.getPixelRatio=function(){return U},this.setPixelRatio=function(P){P!==void 0&&(U=P,this.setSize(k.z,k.w,!1))},this.getSize=function(){return{width:A,height:D}},this.setSize=function(P,W,ee){A=P,D=W,e.width=P*U,e.height=W*U,ee!==!1&&(e.style.width=P+"px",e.style.height=W+"px"),this.setViewport(0,0,P,W)},this.setViewport=function(P,W,ee,ge){xe.viewport(k.set(P,W,ee,ge))},this.setScissor=function(P,W,ee,ge){xe.scissor(B.set(P,W,ee,ge))},this.setScissorTest=function(P){xe.setScissorTest(F=P)},this.getClearColor=function(){return I},this.setClearColor=function(P,W){I.set(P),R=W!==void 0?W:1,xe.buffers.color.setClear(I.r,I.g,I.b,R,s)},this.getClearAlpha=function(){return R},this.setClearAlpha=function(P){R=P,xe.buffers.color.setClear(I.r,I.g,I.b,R,s)},this.clear=function(P,W,ee){var ge=0;(P===void 0||P)&&(ge|=q.COLOR_BUFFER_BIT),(W===void 0||W)&&(ge|=q.DEPTH_BUFFER_BIT),(ee===void 0||ee)&&(ge|=q.STENCIL_BUFFER_BIT),q.clear(ge)},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.clearTarget=function(P,W,ee,ge){this.setRenderTarget(P),this.clear(W,ee,ge)},this.resetGLState=Ae,this.dispose=function(){h=[],p=-1,c=[],f=-1,e.removeEventListener("webglcontextlost",Xe,!1)};function Xe(P){P.preventDefault(),Ae(),Se(),Le.clear()}function ze(P){var W=P.target;W.removeEventListener("dispose",ze),we(W)}function we(P){Ie(P),Le.delete(P)}function Ie(P){var W=Le.get(P).program;P.program=void 0,W!==void 0&&Ve.releaseProgram(W)}this.renderBufferImmediate=function(P,W,ee){xe.initAttributes();var ge=Le.get(P);P.hasPositions&&!ge.position&&(ge.position=q.createBuffer()),P.hasNormals&&!ge.normal&&(ge.normal=q.createBuffer()),P.hasUvs&&!ge.uv&&(ge.uv=q.createBuffer()),P.hasColors&&!ge.color&&(ge.color=q.createBuffer());var ce=W.getAttributes();if(P.hasPositions&&(q.bindBuffer(q.ARRAY_BUFFER,ge.position),q.bufferData(q.ARRAY_BUFFER,P.positionArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.position),q.vertexAttribPointer(ce.position,3,q.FLOAT,!1,0,0)),P.hasNormals){if(q.bindBuffer(q.ARRAY_BUFFER,ge.normal),!ee.isMeshPhongMaterial&&!ee.isMeshStandardMaterial&&!ee.isMeshNormalMaterial&&ee.shading===Nz)for(var Oe=0,Ge=P.count*3;Oe<Ge;Oe+=9){var Re=P.normalArray,pt=(Re[Oe+0]+Re[Oe+3]+Re[Oe+6])/3,mt=(Re[Oe+1]+Re[Oe+4]+Re[Oe+7])/3,$e=(Re[Oe+2]+Re[Oe+5]+Re[Oe+8])/3;Re[Oe+0]=pt,Re[Oe+1]=mt,Re[Oe+2]=$e,Re[Oe+3]=pt,Re[Oe+4]=mt,Re[Oe+5]=$e,Re[Oe+6]=pt,Re[Oe+7]=mt,Re[Oe+8]=$e}q.bufferData(q.ARRAY_BUFFER,P.normalArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.normal),q.vertexAttribPointer(ce.normal,3,q.FLOAT,!1,0,0)}P.hasUvs&&ee.map&&(q.bindBuffer(q.ARRAY_BUFFER,ge.uv),q.bufferData(q.ARRAY_BUFFER,P.uvArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.uv),q.vertexAttribPointer(ce.uv,2,q.FLOAT,!1,0,0)),P.hasColors&&ee.vertexColors!==yC&&(q.bindBuffer(q.ARRAY_BUFFER,ge.color),q.bufferData(q.ARRAY_BUFFER,P.colorArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.color),q.vertexAttribPointer(ce.color,3,q.FLOAT,!1,0,0)),xe.disableUnusedAttributes(),q.drawArrays(q.TRIANGLES,0,P.count),P.count=0},this.renderBufferDirect=function(P,W,ee,ge,ce,Oe){Zr(ge);var Ge=Vt(P,W,ge,ce),Re=!1,pt=ee.id+"_"+Ge.id+"_"+ge.wireframe;pt!==S&&(S=pt,Re=!0);var mt=ce.morphTargetInfluences;if(mt!==void 0){for(var $e=[],at=0,wt=mt.length;at<wt;at++){var je=mt[at];$e.push([je,at])}$e.sort(Je),$e.length>8&&($e.length=8);for(var mi=ee.morphAttributes,at=0,wt=$e.length;at<wt;at++){var je=$e[at];if(d[at]=je[0],je[0]!==0){var Rr=je[1];ge.morphTargets===!0&&mi.position&&ee.addAttribute("morphTarget"+at,mi.position[Rr]),ge.morphNormals===!0&&mi.normal&&ee.addAttribute("morphNormal"+at,mi.normal[Rr])}else ge.morphTargets===!0&&ee.removeAttribute("morphTarget"+at),ge.morphNormals===!0&&ee.removeAttribute("morphNormal"+at)}for(var at=$e.length,Ut=d.length;at<Ut;at++)d[at]=0;Ge.getUniforms().setValue(q,"morphTargetInfluences",d),Re=!0}var Rr=ee.index,Wi=ee.attributes.position,Mt=1;ge.wireframe===!0&&(Rr=Ne.getWireframeAttribute(ee),Mt=2);var Mi;Rr!==null?(Mi=L,Mi.setIndex(Rr)):Mi=z,Re&&(st(ge,Ge,ee),Rr!==null&&q.bindBuffer(q.ELEMENT_ARRAY_BUFFER,Ne.getAttributeBuffer(Rr)));var sr=0;Rr!==null?sr=Rr.count:Wi!==void 0&&(sr=Wi.count);var un=ee.drawRange.start*Mt,mu=ee.drawRange.count*Mt,jr=Oe!==null?Oe.start*Mt:0,vu=Oe!==null?Oe.count*Mt:1/0,jh=Math.max(un,jr),Kh=Math.min(sr,un+mu,jr+vu)-1,WR=Math.max(0,Kh-jh+1);if(WR!==0){if(ce.isMesh)if(ge.wireframe===!0)xe.setLineWidth(ge.wireframeLinewidth*Ke()),Mi.setMode(q.LINES);else switch(ce.drawMode){case jz:Mi.setMode(q.TRIANGLES);break;case Tne:Mi.setMode(q.TRIANGLE_STRIP);break;case Ene:Mi.setMode(q.TRIANGLE_FAN);break}else if(ce.isLine){var XR=ge.linewidth;XR===void 0&&(XR=1),xe.setLineWidth(XR*Ke()),ce.isLineSegments?Mi.setMode(q.LINES):Mi.setMode(q.LINE_STRIP)}else ce.isPoints&&Mi.setMode(q.POINTS);ee&&ee.isInstancedBufferGeometry?ee.maxInstancedCount>0&&Mi.renderInstances(ee,jh,WR):Mi.render(jh,WR)}};function st(P,W,ee,ge){var ce;if(ee&&ee.isInstancedBufferGeometry&&(ce=We.get("ANGLE_instanced_arrays"),ce===null)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}ge===void 0&&(ge=0),xe.initAttributes();var Oe=ee.attributes,Ge=W.getAttributes(),Re=P.defaultAttributeValues;for(var pt in Ge){var mt=Ge[pt];if(mt>=0){var $e=Oe[pt];if($e!==void 0){var at=$e.normalized,wt=$e.itemSize,je=Ne.getAttributeProperties($e),mi=je.__webglBuffer,Ut=je.type,Rr=je.bytesPerElement;if($e.isInterleavedBufferAttribute){var Wi=$e.data,Mt=Wi.stride,Mi=$e.offset;Wi&&Wi.isInstancedInterleavedBuffer?(xe.enableAttributeAndDivisor(mt,Wi.meshPerAttribute,ce),ee.maxInstancedCount===void 0&&(ee.maxInstancedCount=Wi.meshPerAttribute*Wi.count)):xe.enableAttribute(mt),q.bindBuffer(q.ARRAY_BUFFER,mi),q.vertexAttribPointer(mt,wt,Ut,at,Mt*Rr,(ge*Mt+Mi)*Rr)}else $e.isInstancedBufferAttribute?(xe.enableAttributeAndDivisor(mt,$e.meshPerAttribute,ce),ee.maxInstancedCount===void 0&&(ee.maxInstancedCount=$e.meshPerAttribute*$e.count)):xe.enableAttribute(mt),q.bindBuffer(q.ARRAY_BUFFER,mi),q.vertexAttribPointer(mt,wt,Ut,at,0,ge*wt*Rr)}else if(Re!==void 0){var sr=Re[pt];if(sr!==void 0)switch(sr.length){case 2:q.vertexAttrib2fv(mt,sr);break;case 3:q.vertexAttrib3fv(mt,sr);break;case 4:q.vertexAttrib4fv(mt,sr);break;default:q.vertexAttrib1fv(mt,sr)}}}}xe.disableUnusedAttributes()}function Je(P,W){return Math.abs(W[0])-Math.abs(P[0])}function kt(P,W){return P.object.renderOrder!==W.object.renderOrder?P.object.renderOrder-W.object.renderOrder:P.material.program&&W.material.program&&P.material.program!==W.material.program?P.material.program.id-W.material.program.id:P.material.id!==W.material.id?P.material.id-W.material.id:P.z!==W.z?P.z-W.z:P.id-W.id}function X(P,W){return P.object.renderOrder!==W.object.renderOrder?P.object.renderOrder-W.object.renderOrder:P.z!==W.z?W.z-P.z:P.id-W.id}this.render=function(P,W,ee,ge){if(W!==void 0&&W.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}S="",M=-1,w=null,P.autoUpdate===!0&&P.updateMatrixWorld(),W.parent===null&&W.updateMatrixWorld(),W.matrixWorldInverse.getInverse(W.matrixWorld),K.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),G.setFromMatrix(K),u.length=0,f=-1,p=-1,g.length=0,m.length=0,Q=this.localClippingEnabled,J=Y.init(this.clippingPlanes,Q,W),xt(P,W),c.length=f+1,h.length=p+1,v.sortObjects===!0&&(c.sort(kt),h.sort(X)),J&&Y.beginShadows(),O(u),nt.render(P,W),j(u,W),J&&Y.endShadows(),Ee.calls=0,Ee.vertices=0,Ee.faces=0,Ee.points=0,ee===void 0&&(ee=null),this.setRenderTarget(ee);var ce=P.background;if(ce===null?xe.buffers.color.setClear(I.r,I.g,I.b,R,s):ce&&ce.isColor&&(xe.buffers.color.setClear(ce.r,ce.g,ce.b,1,s),ge=!0),(this.autoClear||ge)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),ce&&ce.isCubeTexture?(le.projectionMatrix.copy(W.projectionMatrix),le.matrixWorld.extractRotation(W.matrixWorld),le.matrixWorldInverse.getInverse(le.matrixWorld),et.material.uniforms.tCube.value=ce,et.modelViewMatrix.multiplyMatrices(le.matrixWorldInverse,et.matrixWorld),Ne.update(et),v.renderBufferDirect(le,null,et.geometry,et.material,et,null)):ce&&ce.isTexture&&(me.material.map=ce,Ne.update(me),v.renderBufferDirect(ne,null,me.geometry,me.material,me,null)),P.overrideMaterial){var Oe=P.overrideMaterial;zt(c,P,W,Oe),zt(h,P,W,Oe)}else xe.setBlending(TS),zt(c,P,W),zt(h,P,W);$.render(P,W),it.render(P,W,b),ee&&Ue.updateRenderTargetMipmap(ee),xe.setDepthTest(!0),xe.setDepthWrite(!0),xe.setColorWrite(!0)};function Te(P,W,ee,ge,ce){var Oe,Ge;ee.transparent?(Oe=h,Ge=++p):(Oe=c,Ge=++f);var Re=Oe[Ge];Re!==void 0?(Re.id=P.id,Re.object=P,Re.geometry=W,Re.material=ee,Re.z=ae.z,Re.group=ce):(Re={id:P.id,object:P,geometry:W,material:ee,z:ae.z,group:ce},Oe.push(Re))}function te(P){var W=P.geometry;return W.boundingSphere===null&&W.computeBoundingSphere(),V.copy(W.boundingSphere).applyMatrix4(P.matrixWorld),Pe(V)}function Me(P){return V.center.set(0,0,0),V.radius=.7071067811865476,V.applyMatrix4(P.matrixWorld),Pe(V)}function Pe(P){if(!G.intersectsSphere(P))return!1;var W=Y.numPlanes;if(W===0)return!0;var ee=v.clippingPlanes,ge=P.center,ce=-P.radius,Oe=0;do if(ee[Oe].distanceToPoint(ge)<ce)return!1;while(++Oe!==W);return!0}function xt(P,W){if(P.visible!==!1){var ee=(P.layers.mask&W.layers.mask)!==0;if(ee){if(P.isLight)u.push(P);else if(P.isSprite)(P.frustumCulled===!1||Me(P)===!0)&&g.push(P);else if(P.isLensFlare)m.push(P);else if(P.isImmediateRenderObject)v.sortObjects===!0&&(ae.setFromMatrixPosition(P.matrixWorld),ae.applyProjection(K)),Te(P,null,P.material,ae.z,null);else if((P.isMesh||P.isLine||P.isPoints)&&(P.isSkinnedMesh&&P.skeleton.update(),P.frustumCulled===!1||te(P)===!0)){var ge=P.material;if(ge.visible===!0){v.sortObjects===!0&&(ae.setFromMatrixPosition(P.matrixWorld),ae.applyProjection(K));var ce=Ne.update(P);if(ge.isMultiMaterial)for(var Oe=ce.groups,Ge=ge.materials,Re=0,pt=Oe.length;Re<pt;Re++){var mt=Oe[Re],$e=Ge[mt.materialIndex];$e.visible===!0&&Te(P,ce,$e,ae.z,mt)}else Te(P,ce,ge,ae.z,null)}}}for(var at=P.children,Re=0,pt=at.length;Re<pt;Re++)xt(at[Re],W)}}function zt(P,W,ee,ge){for(var ce=0,Oe=P.length;ce<Oe;ce++){var Ge=P[ce],Re=Ge.object,pt=Ge.geometry,mt=ge===void 0?Ge.material:ge,$e=Ge.group;if(Re.modelViewMatrix.multiplyMatrices(ee.matrixWorldInverse,Re.matrixWorld),Re.normalMatrix.getNormalMatrix(Re.modelViewMatrix),Re.onBeforeRender(v,W,ee,pt,mt,$e),Re.isImmediateRenderObject){Zr(mt);var at=Vt(ee,W.fog,mt,Re);S="",Re.render(function(wt){v.renderBufferImmediate(wt,at,mt)})}else v.renderBufferDirect(ee,W.fog,pt,mt,Re,$e);Re.onAfterRender(v,W,ee,pt,mt,$e)}}function Mr(P,W,ee){var ge=Le.get(P),ce=Ve.getParameters(P,se,W,Y.numPlanes,Y.numIntersection,ee),Oe=Ve.getProgramCode(P,ce),Ge=ge.program,Re=!0;if(Ge===void 0)P.addEventListener("dispose",ze);else if(Ge.code!==Oe)Ie(P);else{if(ce.shaderID!==void 0)return;Re=!1}if(Re){if(ce.shaderID){var pt=Qg[ce.shaderID];ge.__webglShader={name:P.type,uniforms:eo.clone(pt.uniforms),vertexShader:pt.vertexShader,fragmentShader:pt.fragmentShader}}else ge.__webglShader={name:P.type,uniforms:P.uniforms,vertexShader:P.vertexShader,fragmentShader:P.fragmentShader};P.__webglShader=ge.__webglShader,Ge=Ve.acquireProgram(P,ce,Oe),ge.program=Ge,P.program=Ge}var mt=Ge.getAttributes();if(P.morphTargets){P.numSupportedMorphTargets=0;for(var $e=0;$e<v.maxMorphTargets;$e++)mt["morphTarget"+$e]>=0&&P.numSupportedMorphTargets++}if(P.morphNormals){P.numSupportedMorphNormals=0;for(var $e=0;$e<v.maxMorphNormals;$e++)mt["morphNormal"+$e]>=0&&P.numSupportedMorphNormals++}var at=ge.__webglShader.uniforms;(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(ge.numClippingPlanes=Y.numPlanes,ge.numIntersection=Y.numIntersection,at.clippingPlanes=Y.uniform),ge.fog=W,ge.lightsHash=se.hash,P.lights&&(at.ambientLightColor.value=se.ambient,at.directionalLights.value=se.directional,at.spotLights.value=se.spot,at.rectAreaLights.value=se.rectArea,at.pointLights.value=se.point,at.hemisphereLights.value=se.hemi,at.directionalShadowMap.value=se.directionalShadowMap,at.directionalShadowMatrix.value=se.directionalShadowMatrix,at.spotShadowMap.value=se.spotShadowMap,at.spotShadowMatrix.value=se.spotShadowMatrix,at.pointShadowMap.value=se.pointShadowMap,at.pointShadowMatrix.value=se.pointShadowMatrix);var wt=ge.program.getUniforms(),je=xh.seqWithValue(wt.seq,at);ge.uniformsList=je}function Zr(P){P.side===Ny?xe.disable(q.CULL_FACE):xe.enable(q.CULL_FACE),xe.setFlipSided(P.side===yh),P.transparent===!0?xe.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst,P.blendEquationAlpha,P.blendSrcAlpha,P.blendDstAlpha,P.premultipliedAlpha):xe.setBlending(TS),xe.setDepthFunc(P.depthFunc),xe.setDepthTest(P.depthTest),xe.setDepthWrite(P.depthWrite),xe.setColorWrite(P.colorWrite),xe.setPolygonOffset(P.polygonOffset,P.polygonOffsetFactor,P.polygonOffsetUnits)}function Vt(P,W,ee,ge){E=0;var ce=Le.get(ee);if(J&&(Q||P!==w)){var Oe=P===w&&ee.id===M;Y.setState(ee.clippingPlanes,ee.clipIntersection,ee.clipShadows,P,ce,Oe)}ee.needsUpdate===!1&&(ce.program===void 0||ee.fog&&ce.fog!==W||ee.lights&&ce.lightsHash!==se.hash||ce.numClippingPlanes!==void 0&&(ce.numClippingPlanes!==Y.numPlanes||ce.numIntersection!==Y.numIntersection))&&(ee.needsUpdate=!0),ee.needsUpdate&&(Mr(ee,W,ge),ee.needsUpdate=!1);var Ge=!1,Re=!1,pt=!1,mt=ce.program,$e=mt.getUniforms(),at=ce.__webglShader.uniforms;if(mt.id!==_&&(q.useProgram(mt.program),_=mt.id,Ge=!0,Re=!0,pt=!0),ee.id!==M&&(M=ee.id,Re=!0),Ge||P!==w){if($e.set(q,P,"projectionMatrix"),_e.logarithmicDepthBuffer&&$e.setValue(q,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),P!==w&&(w=P,Re=!0,pt=!0),ee.isShaderMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.envMap){var wt=$e.map.cameraPosition;wt!==void 0&&wt.setValue(q,ae.setFromMatrixPosition(P.matrixWorld))}(ee.isMeshPhongMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial||ee.skinning)&&$e.setValue(q,"viewMatrix",P.matrixWorldInverse),$e.set(q,v,"toneMappingExposure"),$e.set(q,v,"toneMappingWhitePoint")}if(ee.skinning){$e.setOptional(q,ge,"bindMatrix"),$e.setOptional(q,ge,"bindMatrixInverse");var je=ge.skeleton;je&&(_e.floatVertexTextures&&je.useVertexTexture?($e.set(q,je,"boneTexture"),$e.set(q,je,"boneTextureWidth"),$e.set(q,je,"boneTextureHeight")):$e.setOptional(q,je,"boneMatrices"))}return Re&&(ee.lights&&T0(at,pt),W&&ee.fog&&Ds(at,W),(ee.isMeshBasicMaterial||ee.isMeshLambertMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.isMeshNormalMaterial||ee.isMeshDepthMaterial)&&Dr(at,ee),ee.isLineBasicMaterial?oi(at,ee):ee.isLineDashedMaterial?(oi(at,ee),Yh(at,ee)):ee.isPointsMaterial?M0(at,ee):ee.isMeshLambertMaterial?qh(at,ee):ee.isMeshToonMaterial?Zh(at,ee):ee.isMeshPhongMaterial?Go(at,ee):ee.isMeshPhysicalMaterial?b0(at,ee):ee.isMeshStandardMaterial?wc(at,ee):ee.isMeshDepthMaterial?ee.displacementMap&&(at.displacementMap.value=ee.displacementMap,at.displacementScale.value=ee.displacementScale,at.displacementBias.value=ee.displacementBias):ee.isMeshNormalMaterial&&w0(at,ee),at.ltcMat!==void 0&&(at.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),at.ltcMag!==void 0&&(at.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),xh.upload(q,ce.uniformsList,at,v)),$e.set(q,ge,"modelViewMatrix"),$e.set(q,ge,"normalMatrix"),$e.setValue(q,"modelMatrix",ge.matrixWorld),mt}function Dr(P,W){P.opacity.value=W.opacity,P.diffuse.value=W.color,W.emissive&&P.emissive.value.copy(W.emissive).multiplyScalar(W.emissiveIntensity),P.map.value=W.map,P.specularMap.value=W.specularMap,P.alphaMap.value=W.alphaMap,W.lightMap&&(P.lightMap.value=W.lightMap,P.lightMapIntensity.value=W.lightMapIntensity),W.aoMap&&(P.aoMap.value=W.aoMap,P.aoMapIntensity.value=W.aoMapIntensity);var ee;if(W.map?ee=W.map:W.specularMap?ee=W.specularMap:W.displacementMap?ee=W.displacementMap:W.normalMap?ee=W.normalMap:W.bumpMap?ee=W.bumpMap:W.roughnessMap?ee=W.roughnessMap:W.metalnessMap?ee=W.metalnessMap:W.alphaMap?ee=W.alphaMap:W.emissiveMap&&(ee=W.emissiveMap),ee!==void 0){ee.isWebGLRenderTarget&&(ee=ee.texture);var ge=ee.offset,ce=ee.repeat;P.offsetRepeat.value.set(ge.x,ge.y,ce.x,ce.y)}P.envMap.value=W.envMap,P.flipEnvMap.value=W.envMap&&W.envMap.isCubeTexture?-1:1,P.reflectivity.value=W.reflectivity,P.refractionRatio.value=W.refractionRatio}function oi(P,W){P.diffuse.value=W.color,P.opacity.value=W.opacity}function Yh(P,W){P.dashSize.value=W.dashSize,P.totalSize.value=W.dashSize+W.gapSize,P.scale.value=W.scale}function M0(P,W){if(P.diffuse.value=W.color,P.opacity.value=W.opacity,P.size.value=W.size*U,P.scale.value=D*.5,P.map.value=W.map,W.map!==null){var ee=W.map.offset,ge=W.map.repeat;P.offsetRepeat.value.set(ee.x,ee.y,ge.x,ge.y)}}function Ds(P,W){P.fogColor.value=W.color,W.isFog?(P.fogNear.value=W.near,P.fogFar.value=W.far):W.isFogExp2&&(P.fogDensity.value=W.density)}function qh(P,W){W.emissiveMap&&(P.emissiveMap.value=W.emissiveMap)}function Go(P,W){P.specular.value=W.specular,P.shininess.value=Math.max(W.shininess,1e-4),W.emissiveMap&&(P.emissiveMap.value=W.emissiveMap),W.bumpMap&&(P.bumpMap.value=W.bumpMap,P.bumpScale.value=W.bumpScale),W.normalMap&&(P.normalMap.value=W.normalMap,P.normalScale.value.copy(W.normalScale)),W.displacementMap&&(P.displacementMap.value=W.displacementMap,P.displacementScale.value=W.displacementScale,P.displacementBias.value=W.displacementBias)}function Zh(P,W){Go(P,W),W.gradientMap&&(P.gradientMap.value=W.gradientMap)}function wc(P,W){P.roughness.value=W.roughness,P.metalness.value=W.metalness,W.roughnessMap&&(P.roughnessMap.value=W.roughnessMap),W.metalnessMap&&(P.metalnessMap.value=W.metalnessMap),W.emissiveMap&&(P.emissiveMap.value=W.emissiveMap),W.bumpMap&&(P.bumpMap.value=W.bumpMap,P.bumpScale.value=W.bumpScale),W.normalMap&&(P.normalMap.value=W.normalMap,P.normalScale.value.copy(W.normalScale)),W.displacementMap&&(P.displacementMap.value=W.displacementMap,P.displacementScale.value=W.displacementScale,P.displacementBias.value=W.displacementBias),W.envMap&&(P.envMapIntensity.value=W.envMapIntensity)}function b0(P,W){P.clearCoat.value=W.clearCoat,P.clearCoatRoughness.value=W.clearCoatRoughness,wc(P,W)}function w0(P,W){W.bumpMap&&(P.bumpMap.value=W.bumpMap,P.bumpScale.value=W.bumpScale),W.normalMap&&(P.normalMap.value=W.normalMap,P.normalScale.value.copy(W.normalScale)),W.displacementMap&&(P.displacementMap.value=W.displacementMap,P.displacementScale.value=W.displacementScale,P.displacementBias.value=W.displacementBias)}function T0(P,W){P.ambientLightColor.needsUpdate=W,P.directionalLights.needsUpdate=W,P.pointLights.needsUpdate=W,P.spotLights.needsUpdate=W,P.rectAreaLights.needsUpdate=W,P.hemisphereLights.needsUpdate=W}function O(P){for(var W=0,ee=0,ge=P.length;ee<ge;ee++){var ce=P[ee];ce.castShadow&&(se.shadows[W++]=ce)}se.shadows.length=W}function j(P,W){var ee,ge,ce,Oe=0,Ge=0,Re=0,pt,mt,$e,at,wt=W.matrixWorldInverse,je=0,mi=0,Ut=0,Rr=0,Wi=0;for(ee=0,ge=P.length;ee<ge;ee++)if(ce=P[ee],pt=ce.color,mt=ce.intensity,$e=ce.distance,at=ce.shadow&&ce.shadow.map?ce.shadow.map.texture:null,ce.isAmbientLight)Oe+=pt.r*mt,Ge+=pt.g*mt,Re+=pt.b*mt;else if(ce.isDirectionalLight){var Mt=ct.get(ce);Mt.color.copy(ce.color).multiplyScalar(ce.intensity),Mt.direction.setFromMatrixPosition(ce.matrixWorld),ae.setFromMatrixPosition(ce.target.matrixWorld),Mt.direction.sub(ae),Mt.direction.transformDirection(wt),Mt.shadow=ce.castShadow,ce.castShadow&&(Mt.shadowBias=ce.shadow.bias,Mt.shadowRadius=ce.shadow.radius,Mt.shadowMapSize=ce.shadow.mapSize),se.directionalShadowMap[je]=at,se.directionalShadowMatrix[je]=ce.shadow.matrix,se.directional[je++]=Mt}else if(ce.isSpotLight){var Mt=ct.get(ce);Mt.position.setFromMatrixPosition(ce.matrixWorld),Mt.position.applyMatrix4(wt),Mt.color.copy(pt).multiplyScalar(mt),Mt.distance=$e,Mt.direction.setFromMatrixPosition(ce.matrixWorld),ae.setFromMatrixPosition(ce.target.matrixWorld),Mt.direction.sub(ae),Mt.direction.transformDirection(wt),Mt.coneCos=Math.cos(ce.angle),Mt.penumbraCos=Math.cos(ce.angle*(1-ce.penumbra)),Mt.decay=ce.distance===0?0:ce.decay,Mt.shadow=ce.castShadow,ce.castShadow&&(Mt.shadowBias=ce.shadow.bias,Mt.shadowRadius=ce.shadow.radius,Mt.shadowMapSize=ce.shadow.mapSize),se.spotShadowMap[Ut]=at,se.spotShadowMatrix[Ut]=ce.shadow.matrix,se.spot[Ut++]=Mt}else if(ce.isRectAreaLight){var Mt=ct.get(ce);Mt.color.copy(pt).multiplyScalar(mt/(ce.width*ce.height)),Mt.position.setFromMatrixPosition(ce.matrixWorld),Mt.position.applyMatrix4(wt),ue.identity(),ve.copy(ce.matrixWorld),ve.premultiply(wt),ue.extractRotation(ve),Mt.halfWidth.set(ce.width*.5,0,0),Mt.halfHeight.set(0,ce.height*.5,0),Mt.halfWidth.applyMatrix4(ue),Mt.halfHeight.applyMatrix4(ue),se.rectArea[Rr++]=Mt}else if(ce.isPointLight){var Mt=ct.get(ce);Mt.position.setFromMatrixPosition(ce.matrixWorld),Mt.position.applyMatrix4(wt),Mt.color.copy(ce.color).multiplyScalar(ce.intensity),Mt.distance=ce.distance,Mt.decay=ce.distance===0?0:ce.decay,Mt.shadow=ce.castShadow,ce.castShadow&&(Mt.shadowBias=ce.shadow.bias,Mt.shadowRadius=ce.shadow.radius,Mt.shadowMapSize=ce.shadow.mapSize),se.pointShadowMap[mi]=at,se.pointShadowMatrix[mi]===void 0&&(se.pointShadowMatrix[mi]=new qt),ae.setFromMatrixPosition(ce.matrixWorld).negate(),se.pointShadowMatrix[mi].identity().setPosition(ae),se.point[mi++]=Mt}else if(ce.isHemisphereLight){var Mt=ct.get(ce);Mt.direction.setFromMatrixPosition(ce.matrixWorld),Mt.direction.transformDirection(wt),Mt.direction.normalize(),Mt.skyColor.copy(ce.color).multiplyScalar(mt),Mt.groundColor.copy(ce.groundColor).multiplyScalar(mt),se.hemi[Wi++]=Mt}se.ambient[0]=Oe,se.ambient[1]=Ge,se.ambient[2]=Re,se.directional.length=je,se.spot.length=Ut,se.rectArea.length=Rr,se.point.length=mi,se.hemi.length=Wi,se.hash=je+","+mi+","+Ut+","+Rr+","+Wi+","+se.shadows.length}this.setFaceCulling=function(P,W){xe.setCullFace(P),xe.setFlipSided(W===Bie)};function re(){var P=E;return P>=_e.maxTextures&&console.warn("WebGLRenderer: trying to use "+P+" texture units while this GPU supports only "+_e.maxTextures),E+=1,P}this.allocTextureUnit=re,this.setTexture2D=function(){var P=!1;return function(ee,ge){ee&&ee.isWebGLRenderTarget&&(P||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),P=!0),ee=ee.texture),Ue.setTexture2D(ee,ge)}}(),this.setTexture=function(){var P=!1;return function(ee,ge){P||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),P=!0),Ue.setTexture2D(ee,ge)}}(),this.setTextureCube=function(){var P=!1;return function(ee,ge){ee&&ee.isWebGLRenderTargetCube&&(P||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),P=!0),ee=ee.texture),ee&&ee.isCubeTexture||Array.isArray(ee.image)&&ee.image.length===6?Ue.setTextureCube(ee,ge):Ue.setTextureCubeDynamic(ee,ge)}}(),this.getCurrentRenderTarget=function(){return y},this.setRenderTarget=function(P){y=P,P&&Le.get(P).__webglFramebuffer===void 0&&Ue.setupRenderTarget(P);var W=P&&P.isWebGLRenderTargetCube,ee;if(P){var ge=Le.get(P);W?ee=ge.__webglFramebuffer[P.activeCubeFace]:ee=ge.__webglFramebuffer,T.copy(P.scissor),C=P.scissorTest,b.copy(P.viewport)}else ee=null,T.copy(B).multiplyScalar(U),C=F,b.copy(k).multiplyScalar(U);if(x!==ee&&(q.bindFramebuffer(q.FRAMEBUFFER,ee),x=ee),xe.scissor(T),xe.setScissorTest(C),xe.viewport(b),W){var ce=Le.get(P.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+P.activeCubeFace,ce.__webglTexture,P.activeMipMapLevel)}},this.readRenderTargetPixels=function(P,W,ee,ge,ce,Oe){if((P&&P.isWebGLRenderTarget)===!1){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}var Ge=Le.get(P).__webglFramebuffer;if(Ge){var Re=!1;Ge!==x&&(q.bindFramebuffer(q.FRAMEBUFFER,Ge),Re=!0);try{var pt=P.texture,mt=pt.format,$e=pt.type;if(mt!==su&&ie(mt)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if($e!==XA&&ie($e)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_TYPE)&&!($e===jg&&(We.get("OES_texture_float")||We.get("WEBGL_color_buffer_float")))&&!($e===YA&&We.get("EXT_color_buffer_half_float"))){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q.checkFramebufferStatus(q.FRAMEBUFFER)===q.FRAMEBUFFER_COMPLETE?W>=0&&W<=P.width-ge&&ee>=0&&ee<=P.height-ce&&q.readPixels(W,ee,ge,ce,ie(mt),ie($e),Oe):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{Re&&q.bindFramebuffer(q.FRAMEBUFFER,x)}}};function ie(P){var W;if(P===ic)return q.REPEAT;if(P===Uo)return q.CLAMP_TO_EDGE;if(P===Dd)return q.MIRRORED_REPEAT;if(P===Oo)return q.NEAREST;if(P===bC)return q.NEAREST_MIPMAP_NEAREST;if(P===wC)return q.NEAREST_MIPMAP_LINEAR;if(P===to)return q.LINEAR;if(P===qz)return q.LINEAR_MIPMAP_NEAREST;if(P===gM)return q.LINEAR_MIPMAP_LINEAR;if(P===XA)return q.UNSIGNED_BYTE;if(P===mne)return q.UNSIGNED_SHORT_4_4_4_4;if(P===vne)return q.UNSIGNED_SHORT_5_5_5_1;if(P===gne)return q.UNSIGNED_SHORT_5_6_5;if(P===hne)return q.BYTE;if(P===pne)return q.SHORT;if(P===ES)return q.UNSIGNED_SHORT;if(P===dne)return q.INT;if(P===Zz)return q.UNSIGNED_INT;if(P===jg)return q.FLOAT;if(P===YA&&(W=We.get("OES_texture_half_float"),W!==null))return W.HALF_FLOAT_OES;if(P===yne)return q.ALPHA;if(P===Kg)return q.RGB;if(P===su)return q.RGBA;if(P===_ne)return q.LUMINANCE;if(P===xne)return q.LUMINANCE_ALPHA;if(P===Cd)return q.DEPTH_COMPONENT;if(P===Jg)return q.DEPTH_STENCIL;if(P===Vz)return q.FUNC_ADD;if(P===Gie)return q.FUNC_SUBTRACT;if(P===Hie)return q.FUNC_REVERSE_SUBTRACT;if(P===Wie)return q.ZERO;if(P===Xie)return q.ONE;if(P===Yie)return q.SRC_COLOR;if(P===qie)return q.ONE_MINUS_SRC_COLOR;if(P===Gz)return q.SRC_ALPHA;if(P===Hz)return q.ONE_MINUS_SRC_ALPHA;if(P===Zie)return q.DST_ALPHA;if(P===jie)return q.ONE_MINUS_DST_ALPHA;if(P===Kie)return q.DST_COLOR;if(P===Jie)return q.ONE_MINUS_DST_COLOR;if(P===$ie)return q.SRC_ALPHA_SATURATE;if((P===cz||P===fz||P===hz||P===pz)&&(W=We.get("WEBGL_compressed_texture_s3tc"),W!==null)){if(P===cz)return W.COMPRESSED_RGB_S3TC_DXT1_EXT;if(P===fz)return W.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(P===hz)return W.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(P===pz)return W.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((P===dz||P===mz||P===vz||P===gz)&&(W=We.get("WEBGL_compressed_texture_pvrtc"),W!==null)){if(P===dz)return W.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(P===mz)return W.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(P===vz)return W.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(P===gz)return W.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(P===Sne&&(W=We.get("WEBGL_compressed_texture_etc1"),W!==null))return W.COMPRESSED_RGB_ETC1_WEBGL;if((P===oz||P===sz)&&(W=We.get("EXT_blend_minmax"),W!==null)){if(P===oz)return W.MIN_EXT;if(P===sz)return W.MAX_EXT}return P===AS&&(W=We.get("WEBGL_depth_texture"),W!==null)?W.UNSIGNED_INT_24_8_WEBGL:0}}function ty(r,e){this.name="",this.color=new Gt(r),this.density=e!==void 0?e:25e-5}function ry(r,e,t){this.name="",this.color=new Gt(r),this.near=e!==void 0?e:1,this.far=t!==void 0?t:1e3}function Fd(){Et.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function _z(r,e,t,i,n){Et.call(this),this.lensFlares=[],this.positionScreen=new oe,this.customUpdateCallback=void 0,r!==void 0&&this.add(r,e,t,i,n)}function zd(r){mr.call(this),this.type="SpriteMaterial",this.color=new Gt(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(r)}function BS(r){Et.call(this),this.type="Sprite",this.material=r!==void 0?r:new zd}function kS(){Et.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ZA(r,e,t){if(this.useVertexTexture=t!==void 0?t:!0,this.identityMatrix=new qt,r=r||[],this.bones=r.slice(0),this.useVertexTexture){var i=Math.sqrt(this.bones.length*4);i=cr.nextPowerOfTwo(Math.ceil(i)),i=Math.max(i,4),this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Nd(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,su,jg)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(e===void 0)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var n=0,a=this.bones.length;n<a;n++)this.boneInverses.push(new qt)}}function jA(){Et.call(this),this.type="Bone"}function KA(r,e,t){mn.call(this,r,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new qt,this.bindMatrixInverse=new qt;var i=[];if(this.geometry&&this.geometry.bones!==void 0){for(var n,a,o=0,s=this.geometry.bones.length;o<s;++o)a=this.geometry.bones[o],n=new jA,i.push(n),n.name=a.name,n.position.fromArray(a.pos),n.quaternion.fromArray(a.rotq),a.scl!==void 0&&n.scale.fromArray(a.scl);for(var o=0,s=this.geometry.bones.length;o<s;++o)a=this.geometry.bones[o],a.parent!==-1&&a.parent!==null&&i[a.parent]!==void 0?i[a.parent].add(i[o]):this.add(i[o])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new ZA(i,void 0,t),this.matrixWorld)}function Ui(r){mr.call(this),this.type="LineBasicMaterial",this.color=new Gt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(r)}function oc(r,e,t){if(t===1)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new di(r,e);Et.call(this),this.type="Line",this.geometry=r!==void 0?r:new Bt,this.material=e!==void 0?e:new Ui({color:Math.random()*16777215})}function di(r,e){oc.call(this,r,e),this.type="LineSegments"}function dl(r){mr.call(this),this.type="PointsMaterial",this.color=new Gt(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(r)}function iy(r,e){Et.call(this),this.type="Points",this.geometry=r!==void 0?r:new Bt,this.material=e!==void 0?e:new dl({color:Math.random()*16777215})}function VS(){Et.call(this),this.type="Group"}function JA(r,e,t,i,n,a,o,s,l){ni.call(this,r,e,t,i,n,a,o,s,l),this.generateMipmaps=!1;var u=this;function c(){requestAnimationFrame(c),r.readyState>=r.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}c()}function ny(r,e,t,i,n,a,o,s,l,u,c,f){ni.call(this,null,a,o,s,l,u,i,n,c,f),this.image={width:e,height:t},this.mipmaps=r,this.flipY=!1,this.generateMipmaps=!1}function $A(r,e,t,i,n,a,o,s,l){ni.call(this,r,e,t,i,n,a,o,s,l),this.needsUpdate=!0}function GS(r,e,t,i,n,a,o,s,l,u){if(u=u!==void 0?u:Cd,u!==Cd&&u!==Jg)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");t===void 0&&u===Cd&&(t=ES),t===void 0&&u===Jg&&(t=AS),ni.call(this,null,i,n,a,o,s,u,t,l),this.image={width:r,height:e},this.magFilter=o!==void 0?o:Oo,this.minFilter=s!==void 0?s:Oo,this.flipY=!1,this.generateMipmaps=!1}function ay(r){Bt.call(this);var e=[0,0],t={};function i(I,R){return I-R}var n=["a","b","c"];if(r&&r.isGeometry){for(var a=r.vertices,o=r.faces,s=0,l=new Uint32Array(6*o.length),u=0,c=o.length;u<c;u++)for(var f=o[u],h=0;h<3;h++){e[0]=f[n[h]],e[1]=f[n[(h+1)%3]],e.sort(i);var p=e.toString();t[p]===void 0&&(l[2*s]=e[0],l[2*s+1]=e[1],t[p]=!0,s++)}for(var d=new Float32Array(s*2*3),u=0,c=s;u<c;u++)for(var h=0;h<2;h++){var g=a[l[2*u+h]],m=6*u+3*h;d[m+0]=g.x,d[m+1]=g.y,d[m+2]=g.z}this.addAttribute("position",new gt(d,3))}else if(r&&r.isBufferGeometry)if(r.index!==null){var v=r.index.array,a=r.attributes.position,_=r.groups,s=0;_.length===0&&r.addGroup(0,v.length);for(var l=new Uint32Array(2*v.length),y=0,x=_.length;y<x;++y)for(var M=_[y],S=M.start,w=M.count,u=S,T=S+w;u<T;u+=3)for(var h=0;h<3;h++){e[0]=v[u+h],e[1]=v[u+(h+1)%3],e.sort(i);var p=e.toString();t[p]===void 0&&(l[2*s]=e[0],l[2*s+1]=e[1],t[p]=!0,s++)}for(var d=new Float32Array(s*2*3),u=0,c=s;u<c;u++)for(var h=0;h<2;h++){var m=6*u+3*h,C=l[2*u+h];d[m+0]=a.getX(C),d[m+1]=a.getY(C),d[m+2]=a.getZ(C)}this.addAttribute("position",new gt(d,3))}else{for(var a=r.attributes.position.array,s=a.length/3,b=s/3,d=new Float32Array(s*2*3),u=0,c=b;u<c;u++)for(var h=0;h<3;h++){var m=18*u+6*h,E=9*u+3*h;d[m+0]=a[E],d[m+1]=a[E+1],d[m+2]=a[E+2];var C=9*u+3*((h+1)%3);d[m+3]=a[C],d[m+4]=a[C+1],d[m+5]=a[C+2]}this.addAttribute("position",new gt(d,3))}}function oy(r,e,t){Bt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:r,slices:e,stacks:t};var i=[],n=[],a,o,s,l,u,c=e+1;for(a=0;a<=t;a++)for(u=a/t,o=0;o<=e;o++)l=o/e,s=r(l,u),i.push(s.x,s.y,s.z),n.push(l,u);var f=[],h,p,d,g;for(a=0;a<t;a++)for(o=0;o<e;o++)h=a*c+o,p=a*c+o+1,d=(a+1)*c+o+1,g=(a+1)*c+o,f.push(h,p,g),f.push(p,d,g);this.setIndex(new(f.length>65535?ac:nc)(f,1)),this.addAttribute("position",new gr(i,3)),this.addAttribute("uv",new gr(n,2)),this.computeVertexNormals()}function HS(r,e,t){or.call(this),this.type="ParametricGeometry",this.parameters={func:r,slices:e,stacks:t},this.fromBufferGeometry(new oy(r,e,t)),this.mergeVertices()}function no(r,e,t,i){Bt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:r,indices:e,radius:t,detail:i},t=t||1,i=i||0;var n=[],a=[];o(i),l(t),u(),this.addAttribute("position",new gr(n,3)),this.addAttribute("normal",new gr(n.slice(),3)),this.addAttribute("uv",new gr(a,2)),this.normalizeNormals(),this.boundingSphere=new $n(new oe,t);function o(v){for(var _=new oe,y=new oe,x=new oe,M=0;M<e.length;M+=3)h(e[M+0],_),h(e[M+1],y),h(e[M+2],x),s(_,y,x,v)}function s(v,_,y,x){var M=Math.pow(2,x),S=[],w,T;for(w=0;w<=M;w++){S[w]=[];var C=v.clone().lerp(y,w/M),b=_.clone().lerp(y,w/M),E=M-w;for(T=0;T<=E;T++)T===0&&w===M?S[w][T]=C:S[w][T]=C.clone().lerp(b,T/E)}for(w=0;w<M;w++)for(T=0;T<2*(M-w)-1;T++){var I=Math.floor(T/2);T%2===0?(f(S[w][I+1]),f(S[w+1][I]),f(S[w][I])):(f(S[w][I+1]),f(S[w+1][I+1]),f(S[w+1][I]))}}function l(v){for(var _=new oe,y=0;y<n.length;y+=3)_.x=n[y+0],_.y=n[y+1],_.z=n[y+2],_.normalize().multiplyScalar(v),n[y+0]=_.x,n[y+1]=_.y,n[y+2]=_.z}function u(){for(var v=new oe,_=0;_<n.length;_+=3){v.x=n[_+0],v.y=n[_+1],v.z=n[_+2];var y=g(v)/2/Math.PI+.5,x=m(v)/Math.PI+.5;a.push(y,1-x)}p(),c()}function c(){for(var v=0;v<a.length;v+=6){var _=a[v+0],y=a[v+2],x=a[v+4],M=Math.max(_,y,x),S=Math.min(_,y,x);M>.9&&S<.1&&(_<.2&&(a[v+0]+=1),y<.2&&(a[v+2]+=1),x<.2&&(a[v+4]+=1))}}function f(v){n.push(v.x,v.y,v.z)}function h(v,_){var y=v*3;_.x=r[y+0],_.y=r[y+1],_.z=r[y+2]}function p(){for(var v=new oe,_=new oe,y=new oe,x=new oe,M=new St,S=new St,w=new St,T=0,C=0;T<n.length;T+=9,C+=6){v.set(n[T+0],n[T+1],n[T+2]),_.set(n[T+3],n[T+4],n[T+5]),y.set(n[T+6],n[T+7],n[T+8]),M.set(a[C+0],a[C+1]),S.set(a[C+2],a[C+3]),w.set(a[C+4],a[C+5]),x.copy(v).add(_).add(y).divideScalar(3);var b=g(x);d(M,C+0,v,b),d(S,C+2,_,b),d(w,C+4,y,b)}}function d(v,_,y,x){x<0&&v.x===1&&(a[_]=v.x-1),y.x===0&&y.z===0&&(a[_]=x/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function m(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}function sy(r,e){var t=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];no.call(this,t,i,r,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:r,detail:e}}function WS(r,e){or.call(this),this.type="TetrahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new sy(r,e)),this.mergeVertices()}function Bd(r,e){var t=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];no.call(this,t,i,r,e),this.type="OctahedronBufferGeometry",this.parameters={radius:r,detail:e}}function XS(r,e){or.call(this),this.type="OctahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new Bd(r,e)),this.mergeVertices()}function ly(r,e){var t=(1+Math.sqrt(5))/2,i=[-1,t,0,1,t,0,-1,-t,0,1,-t,0,0,-1,t,0,1,t,0,-1,-t,0,1,-t,t,0,-1,t,0,1,-t,0,-1,-t,0,1],n=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];no.call(this,i,n,r,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:r,detail:e}}function YS(r,e){or.call(this),this.type="IcosahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new ly(r,e)),this.mergeVertices()}function uy(r,e){var t=(1+Math.sqrt(5))/2,i=1/t,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-t,0,-i,t,0,i,-t,0,i,t,-i,-t,0,-i,t,0,i,-t,0,i,t,0,-t,0,-i,t,0,-i,-t,0,i,t,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];no.call(this,n,a,r,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:r,detail:e}}function qS(r,e){or.call(this),this.type="DodecahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new uy(r,e)),this.mergeVertices()}function ZS(r,e,t,i){or.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:r,indices:e,radius:t,detail:i},this.fromBufferGeometry(new no(r,e,t,i)),this.mergeVertices()}function cy(r,e,t,i,n){Bt.call(this),this.type="TubeBufferGeometry",this.parameters={path:r,tubularSegments:e,radius:t,radialSegments:i,closed:n},e=e||64,t=t||1,i=i||8,n=n||!1;var a=r.computeFrenetFrames(e,n);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new oe,s=new oe,l=new St,u,c,f=[],h=[],p=[],d=[];g(),this.setIndex(new(d.length>65535?ac:nc)(d,1)),this.addAttribute("position",new gr(f,3)),this.addAttribute("normal",new gr(h,3)),this.addAttribute("uv",new gr(p,2));function g(){for(u=0;u<e;u++)m(u);m(n===!1?e:0),_(),v()}function m(y){var x=r.getPointAt(y/e),M=a.normals[y],S=a.binormals[y];for(c=0;c<=i;c++){var w=c/i*Math.PI*2,T=Math.sin(w),C=-Math.cos(w);s.x=C*M.x+T*S.x,s.y=C*M.y+T*S.y,s.z=C*M.z+T*S.z,s.normalize(),h.push(s.x,s.y,s.z),o.x=x.x+t*s.x,o.y=x.y+t*s.y,o.z=x.z+t*s.z,f.push(o.x,o.y,o.z)}}function v(){for(c=1;c<=e;c++)for(u=1;u<=i;u++){var y=(i+1)*(c-1)+(u-1),x=(i+1)*c+(u-1),M=(i+1)*c+u,S=(i+1)*(c-1)+u;d.push(y,x,S),d.push(x,M,S)}}function _(){for(u=0;u<=e;u++)for(c=0;c<=i;c++)l.x=u/e,l.y=c/i,p.push(l.x,l.y)}}function jS(r,e,t,i,n,a){or.call(this),this.type="TubeGeometry",this.parameters={path:r,tubularSegments:e,radius:t,radialSegments:i,closed:n},a!==void 0&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new cy(r,e,t,i,n);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function fy(r,e,t,i,n,a){Bt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:r,tube:e,tubularSegments:t,radialSegments:i,p:n,q:a},r=r||100,e=e||40,t=Math.floor(t)||64,i=Math.floor(i)||8,n=n||2,a=a||3;var o=(i+1)*(t+1),s=i*t*2*3,l=new gt(new(s>65535?Uint32Array:Uint16Array)(s),1),u=new gt(new Float32Array(o*3),3),c=new gt(new Float32Array(o*3),3),f=new gt(new Float32Array(o*2),2),h,p,d=0,g=0,m=new oe,v=new oe,_=new St,y=new oe,x=new oe,M=new oe,S=new oe,w=new oe;for(h=0;h<=t;++h){var T=h/t*n*Math.PI*2;for(U(T,n,a,r,y),U(T+.01,n,a,r,x),S.subVectors(x,y),w.addVectors(x,y),M.crossVectors(S,w),w.crossVectors(M,S),M.normalize(),w.normalize(),p=0;p<=i;++p){var C=p/i*Math.PI*2,b=-e*Math.cos(C),E=e*Math.sin(C);m.x=y.x+(b*w.x+E*M.x),m.y=y.y+(b*w.y+E*M.y),m.z=y.z+(b*w.z+E*M.z),u.setXYZ(d,m.x,m.y,m.z),v.subVectors(m,y).normalize(),c.setXYZ(d,v.x,v.y,v.z),_.x=h/t,_.y=p/i,f.setXY(d,_.x,_.y),d++}}for(p=1;p<=t;p++)for(h=1;h<=i;h++){var I=(i+1)*(p-1)+(h-1),R=(i+1)*p+(h-1),A=(i+1)*p+h,D=(i+1)*(p-1)+h;l.setX(g,I),g++,l.setX(g,R),g++,l.setX(g,D),g++,l.setX(g,R),g++,l.setX(g,A),g++,l.setX(g,D),g++}this.setIndex(l),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",f);function U(B,F,k,G,Y){var J=Math.cos(B),Q=Math.sin(B),V=k/F*B,K=Math.cos(V);Y.x=G*(2+K)*.5*J,Y.y=G*(2+K)*Q*.5,Y.z=G*Math.sin(V)*.5}}function KS(r,e,t,i,n,a,o){or.call(this),this.type="TorusKnotGeometry",this.parameters={radius:r,tube:e,tubularSegments:t,radialSegments:i,p:n,q:a},o!==void 0&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new fy(r,e,t,i,n,a)),this.mergeVertices()}function hy(r,e,t,i,n){Bt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:r,tube:e,radialSegments:t,tubularSegments:i,arc:n},r=r||100,e=e||40,t=Math.floor(t)||8,i=Math.floor(i)||6,n=n||Math.PI*2;var a=(t+1)*(i+1),o=t*i*2*3,s=new(o>65535?Uint32Array:Uint16Array)(o),l=new Float32Array(a*3),u=new Float32Array(a*3),c=new Float32Array(a*2),f=0,h=0,p=0,d=new oe,g=new oe,m=new oe,v,_;for(v=0;v<=t;v++)for(_=0;_<=i;_++){var y=_/i*n,x=v/t*Math.PI*2;g.x=(r+e*Math.cos(x))*Math.cos(y),g.y=(r+e*Math.cos(x))*Math.sin(y),g.z=e*Math.sin(x),l[f]=g.x,l[f+1]=g.y,l[f+2]=g.z,d.x=r*Math.cos(y),d.y=r*Math.sin(y),m.subVectors(g,d).normalize(),u[f]=m.x,u[f+1]=m.y,u[f+2]=m.z,c[h]=_/i,c[h+1]=v/t,f+=3,h+=2}for(v=1;v<=t;v++)for(_=1;_<=i;_++){var M=(i+1)*v+_-1,S=(i+1)*(v-1)+_-1,w=(i+1)*(v-1)+_,T=(i+1)*v+_;s[p]=M,s[p+1]=S,s[p+2]=T,s[p+3]=S,s[p+4]=w,s[p+5]=T,p+=6}this.setIndex(new gt(s,1)),this.addAttribute("position",new gt(l,3)),this.addAttribute("normal",new gt(u,3)),this.addAttribute("uv",new gt(c,2))}function JS(r,e,t,i,n){or.call(this),this.type="TorusGeometry",this.parameters={radius:r,tube:e,radialSegments:t,tubularSegments:i,arc:n},this.fromBufferGeometry(new hy(r,e,t,i,n))}function ws(r,e){if(typeof r>"u"){r=[];return}or.call(this),this.type="ExtrudeGeometry",r=Array.isArray(r)?r:[r],this.addShapeList(r,e),this.computeFaceNormals()}function $S(r,e){e=e||{};var t=e.font;if((t&&t.isFont)===!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new or;var i=t.generateShapes(r,e.size,e.curveSegments);e.amount=e.height!==void 0?e.height:50,e.bevelThickness===void 0&&(e.bevelThickness=10),e.bevelSize===void 0&&(e.bevelSize=8),e.bevelEnabled===void 0&&(e.bevelEnabled=!1),ws.call(this,i,e),this.type="TextGeometry"}function kd(r,e,t,i,n,a,o){Bt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:r,widthSegments:e,heightSegments:t,phiStart:i,phiLength:n,thetaStart:a,thetaLength:o},r=r||50,e=Math.max(3,Math.floor(e)||8),t=Math.max(2,Math.floor(t)||6),i=i!==void 0?i:0,n=n!==void 0?n:Math.PI*2,a=a!==void 0?a:0,o=o!==void 0?o:Math.PI;for(var s=a+o,l=(e+1)*(t+1),u=new gt(new Float32Array(l*3),3),c=new gt(new Float32Array(l*3),3),f=new gt(new Float32Array(l*2),2),h=0,p=[],d=new oe,g=0;g<=t;g++){for(var m=[],v=g/t,_=0;_<=e;_++){var y=_/e,x=-r*Math.cos(i+y*n)*Math.sin(a+v*o),M=r*Math.cos(a+v*o),S=r*Math.sin(i+y*n)*Math.sin(a+v*o);d.set(x,M,S).normalize(),u.setXYZ(h,x,M,S),c.setXYZ(h,d.x,d.y,d.z),f.setXY(h,y,1-v),m.push(h),h++}p.push(m)}for(var w=[],g=0;g<t;g++)for(var _=0;_<e;_++){var T=p[g][_+1],C=p[g][_],b=p[g+1][_],E=p[g+1][_+1];(g!==0||a>0)&&w.push(T,C,E),(g!==t-1||s<Math.PI)&&w.push(C,b,E)}this.setIndex(new(u.count>65535?ac:nc)(w,1)),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",f),this.boundingSphere=new $n(new oe,r)}function QS(r,e,t,i,n,a,o){or.call(this),this.type="SphereGeometry",this.parameters={radius:r,widthSegments:e,heightSegments:t,phiStart:i,phiLength:n,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new kd(r,e,t,i,n,a,o))}function py(r,e,t,i,n,a){Bt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:r,outerRadius:e,thetaSegments:t,phiSegments:i,thetaStart:n,thetaLength:a},r=r||20,e=e||50,n=n!==void 0?n:0,a=a!==void 0?a:Math.PI*2,t=t!==void 0?Math.max(3,t):8,i=i!==void 0?Math.max(1,i):1;var o=(t+1)*(i+1),s=t*i*2*3,l=new gt(new(s>65535?Uint32Array:Uint16Array)(s),1),u=new gt(new Float32Array(o*3),3),c=new gt(new Float32Array(o*3),3),f=new gt(new Float32Array(o*2),2),h=0,p=0,d,g=r,m=(e-r)/i,v=new oe,_=new St,y,x;for(y=0;y<=i;y++){for(x=0;x<=t;x++)d=n+x/t*a,v.x=g*Math.cos(d),v.y=g*Math.sin(d),u.setXYZ(h,v.x,v.y,v.z),c.setXYZ(h,0,0,1),_.x=(v.x/e+1)/2,_.y=(v.y/e+1)/2,f.setXY(h,_.x,_.y),h++;g+=m}for(y=0;y<i;y++){var M=y*(t+1);for(x=0;x<t;x++){d=x+M;var S=d,w=d+t+1,T=d+t+2,C=d+1;l.setX(p,S),p++,l.setX(p,w),p++,l.setX(p,T),p++,l.setX(p,S),p++,l.setX(p,T),p++,l.setX(p,C),p++}}this.setIndex(l),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",f)}function eM(r,e,t,i,n,a){or.call(this),this.type="RingGeometry",this.parameters={innerRadius:r,outerRadius:e,thetaSegments:t,phiSegments:i,thetaStart:n,thetaLength:a},this.fromBufferGeometry(new py(r,e,t,i,n,a))}function tM(r,e,t,i){or.call(this),this.type="PlaneGeometry",this.parameters={width:r,height:e,widthSegments:t,heightSegments:i},this.fromBufferGeometry(new Od(r,e,t,i))}function dy(r,e,t,i){Bt.call(this),this.type="LatheBufferGeometry",this.parameters={points:r,segments:e,phiStart:t,phiLength:i},e=Math.floor(e)||12,t=t||0,i=i||Math.PI*2,i=cr.clamp(i,0,Math.PI*2);var n=(e+1)*r.length,a=e*r.length*2*3,o=new gt(new(a>65535?Uint32Array:Uint16Array)(a),1),s=new gt(new Float32Array(n*3),3),l=new gt(new Float32Array(n*2),2),u=0,c=0,f,h=1/e,p=new oe,d=new St,g,m;for(g=0;g<=e;g++){var v=t+g*h*i,_=Math.sin(v),y=Math.cos(v);for(m=0;m<=r.length-1;m++)p.x=r[m].x*_,p.y=r[m].y,p.z=r[m].x*y,s.setXYZ(u,p.x,p.y,p.z),d.x=g/e,d.y=m/(r.length-1),l.setXY(u,d.x,d.y),u++}for(g=0;g<e;g++)for(m=0;m<r.length-1;m++){f=m+g*r.length;var x=f,M=f+r.length,S=f+r.length+1,w=f+1;o.setX(c,x),c++,o.setX(c,M),c++,o.setX(c,w),c++,o.setX(c,M),c++,o.setX(c,S),c++,o.setX(c,w),c++}if(this.setIndex(o),this.addAttribute("position",s),this.addAttribute("uv",l),this.computeVertexNormals(),i===Math.PI*2){var T=this.attributes.normal.array,C=new oe,b=new oe,E=new oe;for(f=e*r.length*3,g=0,m=0;g<r.length;g++,m+=3)C.x=T[m+0],C.y=T[m+1],C.z=T[m+2],b.x=T[f+m+0],b.y=T[f+m+1],b.z=T[f+m+2],E.addVectors(C,b).normalize(),T[m+0]=T[f+m+0]=E.x,T[m+1]=T[f+m+1]=E.y,T[m+2]=T[f+m+2]=E.z}}function rM(r,e,t,i){or.call(this),this.type="LatheGeometry",this.parameters={points:r,segments:e,phiStart:t,phiLength:i},this.fromBufferGeometry(new dy(r,e,t,i)),this.mergeVertices()}function my(r,e){Bt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:r,curveSegments:e},e=e||12;var t=[],i=[],n=[],a=[],o=0,s=0;if(Array.isArray(r)===!1)u(r);else for(var l=0;l<r.length;l++)u(r[l]),this.addGroup(o,s,l),o+=s,s=0;this.setIndex(new(a.length>65535?ac:nc)(a,1)),this.addAttribute("position",new gr(t,3)),this.addAttribute("normal",new gr(i,3)),this.addAttribute("uv",new gr(n,2));function u(c){var f,h,p,d=t.length/3,g=c.extractPoints(e),m=g.shape,v=g.holes;if(Ln.isClockWise(m)===!1)for(m=m.reverse(),f=0,h=v.length;f<h;f++)p=v[f],Ln.isClockWise(p)===!0&&(v[f]=p.reverse());var _=Ln.triangulateShape(m,v);for(f=0,h=v.length;f<h;f++)p=v[f],m=m.concat(p);for(f=0,h=m.length;f<h;f++){var y=m[f];t.push(y.x,y.y,0),i.push(0,0,1),n.push(y.x,y.y)}for(f=0,h=_.length;f<h;f++){var x=_[f],M=x[0]+d,S=x[1]+d,w=x[2]+d;a.push(M,S,w),s+=3}}}function vy(r,e){or.call(this),this.type="ShapeGeometry",typeof e=="object"&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:r,curveSegments:e},this.fromBufferGeometry(new my(r,e)),this.mergeVertices()}function gy(r,e){Bt.call(this),e=e!==void 0?e:1;var t=Math.cos(cr.DEG2RAD*e),i=[0,0],n={};function a(_,y){return _-y}var o=["a","b","c"],s;r.isBufferGeometry?(s=new or,s.fromBufferGeometry(r)):s=r.clone(),s.mergeVertices(),s.computeFaceNormals();for(var l=s.vertices,u=s.faces,c=0,f=u.length;c<f;c++)for(var h=u[c],p=0;p<3;p++){i[0]=h[o[p]],i[1]=h[o[(p+1)%3]],i.sort(a);var d=i.toString();n[d]===void 0?n[d]={vert1:i[0],vert2:i[1],face1:c,face2:void 0}:n[d].face2=c}var g=[];for(var d in n){var m=n[d];if(m.face2===void 0||u[m.face1].normal.dot(u[m.face2].normal)<=t){var v=l[m.vert1];g.push(v.x),g.push(v.y),g.push(v.z),v=l[m.vert2],g.push(v.x),g.push(v.y),g.push(v.z)}}this.addAttribute("position",new gr(g,3))}function sc(r,e,t,i,n,a,o,s){Bt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:r,radiusBottom:e,height:t,radialSegments:i,heightSegments:n,openEnded:a,thetaStart:o,thetaLength:s};var l=this;r=r!==void 0?r:20,e=e!==void 0?e:20,t=t!==void 0?t:100,i=Math.floor(i)||8,n=Math.floor(n)||1,a=a!==void 0?a:!1,o=o!==void 0?o:0,s=s!==void 0?s:2*Math.PI;var u=0;a===!1&&(r>0&&u++,e>0&&u++);var c=M(),f=S(),h=new gt(new(f>65535?Uint32Array:Uint16Array)(f),1),p=new gt(new Float32Array(c*3),3),d=new gt(new Float32Array(c*3),3),g=new gt(new Float32Array(c*2),2),m=0,v=0,_=[],y=t/2,x=0;w(),a===!1&&(r>0&&T(!0),e>0&&T(!1)),this.setIndex(h),this.addAttribute("position",p),this.addAttribute("normal",d),this.addAttribute("uv",g);function M(){var C=(i+1)*(n+1);return a===!1&&(C+=(i+1)*u+i*u),C}function S(){var C=i*n*2*3;return a===!1&&(C+=i*u*3),C}function w(){var C,b,E=new oe,I=new oe,R=0,A=(e-r)/t;for(b=0;b<=n;b++){var D=[],U=b/n,B=U*(e-r)+r;for(C=0;C<=i;C++){var F=C/i,k=F*s+o,G=Math.sin(k),Y=Math.cos(k);I.x=B*G,I.y=-U*t+y,I.z=B*Y,p.setXYZ(m,I.x,I.y,I.z),E.set(G,A,Y).normalize(),d.setXYZ(m,E.x,E.y,E.z),g.setXY(m,F,1-U),D.push(m),m++}_.push(D)}for(C=0;C<i;C++)for(b=0;b<n;b++){var J=_[b][C],Q=_[b+1][C],V=_[b+1][C+1],K=_[b][C+1];h.setX(v,J),v++,h.setX(v,Q),v++,h.setX(v,K),v++,h.setX(v,Q),v++,h.setX(v,V),v++,h.setX(v,K),v++,R+=6}l.addGroup(x,R,0),x+=R}function T(C){var b,E,I,R=new St,A=new oe,D=0,U=C===!0?r:e,B=C===!0?1:-1;for(E=m,b=1;b<=i;b++)p.setXYZ(m,0,y*B,0),d.setXYZ(m,0,B,0),R.x=.5,R.y=.5,g.setXY(m,R.x,R.y),m++;for(I=m,b=0;b<=i;b++){var F=b/i,k=F*s+o,G=Math.cos(k),Y=Math.sin(k);A.x=U*Y,A.y=y*B,A.z=U*G,p.setXYZ(m,A.x,A.y,A.z),d.setXYZ(m,0,B,0),R.x=G*.5+.5,R.y=Y*.5*B+.5,g.setXY(m,R.x,R.y),m++}for(b=0;b<i;b++){var J=E+b,Q=I+b;C===!0?(h.setX(v,Q),v++,h.setX(v,Q+1),v++,h.setX(v,J),v++):(h.setX(v,Q+1),v++,h.setX(v,Q),v++,h.setX(v,J),v++),D+=3}l.addGroup(x,D,C===!0?1:2),x+=D}}function Vd(r,e,t,i,n,a,o,s){or.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:r,radiusBottom:e,height:t,radialSegments:i,heightSegments:n,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new sc(r,e,t,i,n,a,o,s)),this.mergeVertices()}function iM(r,e,t,i,n,a,o){Vd.call(this,0,r,e,t,i,n,a,o),this.type="ConeGeometry",this.parameters={radius:r,height:e,radialSegments:t,heightSegments:i,openEnded:n,thetaStart:a,thetaLength:o}}function nM(r,e,t,i,n,a,o){sc.call(this,0,r,e,t,i,n,a,o),this.type="ConeBufferGeometry",this.parameters={radius:r,height:e,radialSegments:t,heightSegments:i,openEnded:n,thetaStart:a,thetaLength:o}}function yy(r,e,t,i){Bt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:r,segments:e,thetaStart:t,thetaLength:i},r=r||50,e=e!==void 0?Math.max(3,e):8,t=t!==void 0?t:0,i=i!==void 0?i:Math.PI*2;var n=e+2,a=new Float32Array(n*3),o=new Float32Array(n*3),s=new Float32Array(n*2);o[2]=1,s[0]=.5,s[1]=.5;for(var l=0,u=3,c=2;l<=e;l++,u+=3,c+=2){var f=t+l/e*i;a[u]=r*Math.cos(f),a[u+1]=r*Math.sin(f),o[u+2]=1,s[c]=(a[u]/r+1)/2,s[c+1]=(a[u+1]/r+1)/2}for(var h=[],u=1;u<=e;u++)h.push(u,u+1,0);this.setIndex(new gt(new Uint16Array(h),1)),this.addAttribute("position",new gt(a,3)),this.addAttribute("normal",new gt(o,3)),this.addAttribute("uv",new gt(s,2)),this.boundingSphere=new $n(new oe,r)}function aM(r,e,t,i){or.call(this),this.type="CircleGeometry",this.parameters={radius:r,segments:e,thetaStart:t,thetaLength:i},this.fromBufferGeometry(new yy(r,e,t,i))}function oM(r,e,t,i,n,a){or.call(this),this.type="BoxGeometry",this.parameters={width:r,height:e,depth:t,widthSegments:i,heightSegments:n,depthSegments:a},this.fromBufferGeometry(new Ud(r,e,t,i,n,a)),this.mergeVertices()}function _y(){_a.call(this,{uniforms:eo.merge([hr.lights,{opacity:{value:1}}]),vertexShader:Xr.shadow_vert,fragmentShader:Xr.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(r){this.uniforms.opacity.value=r}}})}function xy(r){_a.call(this,r),this.type="RawShaderMaterial"}function sM(r){this.uuid=cr.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(r)?r:[],this.visible=!0}function uu(r){mr.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Gt(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(r)}function Gd(r){uu.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(r)}function ml(r){mr.call(this),this.type="MeshPhongMaterial",this.color=new Gt(16777215),this.specular=new Gt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=vM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(r)}function Hd(r){ml.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(r)}function Wd(r){mr.call(this,r),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(r)}function Xd(r){mr.call(this),this.type="MeshLambertMaterial",this.color=new Gt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=vM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(r)}function Yd(r){mr.call(this),this.type="LineDashedMaterial",this.color=new Gt(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(r)}function Qz(r,e,t){var i=this,n=!1,a=0,o=0;this.onStart=void 0,this.onLoad=r,this.onProgress=e,this.onError=t,this.itemStart=function(s){o++,n===!1&&i.onStart!==void 0&&i.onStart(s,a,o),n=!0},this.itemEnd=function(s){a++,i.onProgress!==void 0&&i.onProgress(s,a,o),a===o&&(n=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(s){i.onError!==void 0&&i.onError(s)}}function Ts(r){this.manager=r!==void 0?r:zo}function Xne(r){this.manager=r!==void 0?r:zo,this._parser=null}function eB(r){this.manager=r!==void 0?r:zo,this._parser=null}function yM(r){this.manager=r!==void 0?r:zo}function tB(r){this.manager=r!==void 0?r:zo}function TC(r){this.manager=r!==void 0?r:zo}function Oi(r,e){Et.call(this),this.type="Light",this.color=new Gt(r),this.intensity=e!==void 0?e:1,this.receiveShadow=void 0}function QA(r,e,t){Oi.call(this,r,t),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Et.DefaultUp),this.updateMatrix(),this.groundColor=new Gt(e)}function em(r){this.camera=r,this.bias=0,this.radius=1,this.mapSize=new St(512,512),this.map=null,this.matrix=new qt}function eC(){em.call(this,new Kn(50,1,.5,500))}function tC(r,e,t,i,n,a){Oi.call(this,r,e),this.type="SpotLight",this.position.copy(Et.DefaultUp),this.updateMatrix(),this.target=new Et,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(o){this.intensity=o/Math.PI}}),this.distance=t!==void 0?t:0,this.angle=i!==void 0?i:Math.PI/3,this.penumbra=n!==void 0?n:0,this.decay=a!==void 0?a:1,this.shadow=new eC}function rC(r,e,t,i){Oi.call(this,r,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return this.intensity*4*Math.PI},set:function(n){this.intensity=n/(4*Math.PI)}}),this.distance=t!==void 0?t:0,this.decay=i!==void 0?i:1,this.shadow=new em(new Kn(90,1,.5,500))}function iC(r){em.call(this,new ey(-5,5,5,-5,.5,500))}function nC(r,e){Oi.call(this,r,e),this.type="DirectionalLight",this.position.copy(Et.DefaultUp),this.updateMatrix(),this.target=new Et,this.shadow=new iC}function aC(r,e){Oi.call(this,r,e),this.type="AmbientLight",this.castShadow=void 0}function ro(r,e,t,i){this.parameterPositions=r,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(t),this.sampleValues=e,this.valueSize=t}function oC(r,e,t,i){ro.call(this,r,e,t,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function lM(r,e,t,i){ro.call(this,r,e,t,i)}function sC(r,e,t,i){ro.call(this,r,e,t,i)}function tm(r,e,t,i){if(r===void 0)throw new Error("track name is undefined");if(e===void 0||e.length===0)throw new Error("no keyframes in track named "+r);this.name=r,this.times=Jn.convertArray(e,this.TimeBufferType),this.values=Jn.convertArray(t,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function Sy(r,e,t,i){tm.call(this,r,e,t,i)}function lC(r,e,t,i){ro.call(this,r,e,t,i)}function uM(r,e,t,i){tm.call(this,r,e,t,i)}function My(r,e,t,i){tm.call(this,r,e,t,i)}function uC(r,e,t,i){tm.call(this,r,e,t,i)}function cC(r,e,t){tm.call(this,r,e,t)}function fC(r,e,t,i){tm.call(this,r,e,t,i)}function qd(r,e,t,i){tm.apply(this,arguments)}function No(r,e,t){this.name=r,this.tracks=t,this.duration=e!==void 0?e:-1,this.uuid=cr.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function EC(r){this.manager=r!==void 0?r:zo,this.textures={}}function rB(r){this.manager=r!==void 0?r:zo}function Ld(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function iB(r){typeof r=="boolean"&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),r=void 0),this.manager=r!==void 0?r:zo,this.withCredentials=!1}function Yne(r){this.manager=r!==void 0?r:zo,this.texturePath=""}function ea(){}function cu(r,e){this.v1=r,this.v2=e}function cM(){this.curves=[],this.autoClose=!1}function lc(r,e,t,i,n,a,o,s){this.aX=r,this.aY=e,this.xRadius=t,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function Zd(r){this.points=r===void 0?[]:r}function jd(r,e,t,i){this.v0=r,this.v1=e,this.v2=t,this.v3=i}function Kd(r,e,t){this.v0=r,this.v1=e,this.v2=t}function Pd(){xM.apply(this,arguments),this.holes=[]}function xM(r){cM.call(this),this.currentPoint=new St,r&&this.fromPoints(r)}function aB(){this.subPaths=[],this.currentPath=null}function oB(r){this.data=r}function qne(r){this.manager=r!==void 0?r:zo}function lB(r){this.manager=r!==void 0?r:zo}function Sz(r,e,t,i){Oi.call(this,r,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=t!==void 0?t:10,this.height=i!==void 0?i:10}function Zne(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function hC(r,e,t){Et.call(this),this.type="CubeCamera";var i=90,n=1,a=new Kn(i,n,r,e);a.up.set(0,-1,0),a.lookAt(new oe(1,0,0)),this.add(a);var o=new Kn(i,n,r,e);o.up.set(0,-1,0),o.lookAt(new oe(-1,0,0)),this.add(o);var s=new Kn(i,n,r,e);s.up.set(0,0,1),s.lookAt(new oe(0,1,0)),this.add(s);var l=new Kn(i,n,r,e);l.up.set(0,0,-1),l.lookAt(new oe(0,-1,0)),this.add(l);var u=new Kn(i,n,r,e);u.up.set(0,-1,0),u.lookAt(new oe(0,0,1)),this.add(u);var c=new Kn(i,n,r,e);c.up.set(0,-1,0),c.lookAt(new oe(0,0,-1)),this.add(c);var f={format:Kg,magFilter:to,minFilter:to};this.renderTarget=new $g(t,t,f),this.updateCubeMap=function(h,p){this.parent===null&&this.updateMatrixWorld();var d=this.renderTarget,g=d.texture.generateMipmaps;d.texture.generateMipmaps=!1,d.activeCubeFace=0,h.render(p,a,d),d.activeCubeFace=1,h.render(p,o,d),d.activeCubeFace=2,h.render(p,s,d),d.activeCubeFace=3,h.render(p,l,d),d.activeCubeFace=4,h.render(p,u,d),d.texture.generateMipmaps=g,d.activeCubeFace=5,h.render(p,c,d),h.setRenderTarget(null)}}function Mz(){Et.call(this),this.type="AudioListener",this.context=sB.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function by(r){Et.call(this),this.type="Audio",this.context=r.context,this.gain=this.context.createGain(),this.gain.connect(r.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function bz(r){by.call(this,r),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function uB(r,e){this.analyser=r.context.createAnalyser(),this.analyser.fftSize=e!==void 0?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),r.getOutput().connect(this.analyser)}function pC(r,e,t){this.binding=r,this.valueSize=t;var i=Float64Array,n;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":i=Array,n=this._select;break;default:n=this._lerp}this.buffer=new i(t*4),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Ri(r,e,t){this.path=e,this.parsedPath=t||Ri.parseTrackName(e),this.node=Ri.findNode(r,this.parsedPath.nodeName)||r,this.rootNode=r}function wz(r){this.uuid=cr.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,i=arguments.length;t!==i;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function Tz(r,e,t){this._mixer=r,this._clip=e,this._localRoot=t||null;for(var i=e.tracks,n=i.length,a=new Array(n),o={endingStart:Id,endingEnd:Id},s=0;s!==n;++s){var l=i[s].createInterpolant(null);a[s]=l,l.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=bne,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}function cB(r){this._root=r,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function dC(r){typeof r=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),r=arguments[1]),this.value=r}function Jd(){Bt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Ez(r,e,t,i){this.uuid=cr.generateUUID(),this.data=r,this.itemSize=e,this.offset=t,this.normalized=i===!0}function wy(r,e){this.uuid=cr.generateUUID(),this.array=r,this.stride=e,this.count=r!==void 0?r.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Ty(r,e,t){wy.call(this,r,e),this.meshPerAttribute=t||1}function Ey(r,e,t){gt.call(this,r,e),this.meshPerAttribute=t||1}function Az(r,e,t,i){this.ray=new Mh(r,e),this.near=t||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Oie(r,e){return r.distance-e.distance}function Cz(r,e,t,i){if(r.visible!==!1&&(r.raycast(e,t),i===!0))for(var n=r.children,a=0,o=n.length;a<o;a++)Cz(n[a],e,t,!0)}function Rz(r){this.autoStart=r!==void 0?r:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function $Re(r){this.points=r;var e=[],t={x:0,y:0,z:0},i,n,a,o,s,l,u,c,f;this.initFromArray=function(p){this.points=[];for(var d=0;d<p.length;d++)this.points[d]={x:p[d][0],y:p[d][1],z:p[d][2]}},this.getPoint=function(p){return i=(this.points.length-1)*p,n=Math.floor(i),a=i-n,e[0]=n===0?n:n-1,e[1]=n,e[2]=n>this.points.length-2?this.points.length-1:n+1,e[3]=n>this.points.length-3?this.points.length-1:n+2,l=this.points[e[0]],u=this.points[e[1]],c=this.points[e[2]],f=this.points[e[3]],o=a*a,s=a*o,t.x=h(l.x,u.x,c.x,f.x,a,o,s),t.y=h(l.y,u.y,c.y,f.y,a,o,s),t.z=h(l.z,u.z,c.z,f.z,a,o,s),t},this.getControlPointsArray=function(){var p,d,g=this.points.length,m=[];for(p=0;p<g;p++)d=this.points[p],m[p]=[d.x,d.y,d.z];return m},this.getLength=function(p){var d,g,m,v,_=0,y=0,x=0,M=new oe,S=new oe,w=[],T=0;for(w[0]=0,p||(p=100),m=this.points.length*p,M.copy(this.points[0]),d=1;d<m;d++)g=d/m,v=this.getPoint(g),S.copy(v),T+=S.distanceTo(M),M.copy(v),_=(this.points.length-1)*g,y=Math.floor(_),y!==x&&(w[y]=T,x=y);return w[w.length]=T,{chunks:w,total:T}},this.reparametrizeByArcLength=function(p){var d,g,m,v,_,y,x,M,S=[],w=new oe,T=this.getLength();for(S.push(w.copy(this.points[0]).clone()),d=1;d<this.points.length;d++){for(y=T.chunks[d]-T.chunks[d-1],x=Math.ceil(p*y/T.total),v=(d-1)/(this.points.length-1),_=d/(this.points.length-1),g=1;g<x-1;g++)m=v+g*(1/x)*(_-v),M=this.getPoint(m),S.push(w.copy(M).clone());S.push(w.copy(this.points[d]).clone())}this.points=S};function h(p,d,g,m,v,_,y){var x=(g-p)*.5,M=(m-d)*.5;return(2*(d-g)+x+M)*y+(-3*(d-g)-2*x-M)*_+x*v+d}}function Lz(r,e,t){return this.radius=r!==void 0?r:1,this.phi=e!==void 0?e:0,this.theta=t!==void 0?t:0,this}function Pz(r,e,t){return this.radius=r!==void 0?r:1,this.theta=e!==void 0?e:0,this.y=t!==void 0?t:0,this}function Pn(r,e){mn.call(this,r,e),this.animationsMap={},this.animationsList=[];var t=this.geometry.morphTargets.length,i="__default",n=0,a=t-1,o=t/1;this.createAnimation(i,n,a,o),this.setAnimationWeight(i,1)}function fM(r){Et.call(this),this.material=r,this.render=function(e){}}function hM(r,e,t,i){this.object=r,this.size=e!==void 0?e:1;var n=t!==void 0?t:16711680,a=i!==void 0?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length*3:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var l=new Bt,u=new gr(o*2*3,3);l.addAttribute("position",u),di.call(this,l,new Ui({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Ay(r){Et.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Bt,t=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,n=1,a=32;i<a;i++,n++){var o=i/a*Math.PI*2,s=n/a*Math.PI*2;t.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}e.addAttribute("position",new gr(t,3));var l=new Ui({fog:!1});this.cone=new di(e,l),this.add(this.cone),this.update()}function Cy(r){this.bones=this.getBoneList(r);for(var e=new Bt,t=[],i=[],n=new Gt(0,0,1),a=new Gt(0,1,0),o=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(t.push(0,0,0),t.push(0,0,0),i.push(n.r,n.g,n.b),i.push(a.r,a.g,a.b))}e.addAttribute("position",new gr(t,3)),e.addAttribute("color",new gr(i,3));var l=new Ui({vertexColors:Qd,depthTest:!1,depthWrite:!1,transparent:!0});di.call(this,e,l),this.root=r,this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Ry(r,e){this.light=r,this.light.updateMatrixWorld();var t=new kd(e,4,2),i=new io({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),mn.call(this,t,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function Ly(r){Et.call(this),this.light=r,this.light.updateMatrixWorld();var e=new io({color:r.color,fog:!1}),t=new io({color:r.color,fog:!1,wireframe:!0}),i=new Bt;i.addAttribute("position",new gt(new Float32Array(6*3),3)),this.add(new mn(i,e)),this.add(new mn(i,t)),this.update()}function Py(r,e){Et.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1;var t=new Bd(e);t.rotateY(Math.PI*.5);var i=new io({vertexColors:Qd,wireframe:!0}),n=t.getAttribute("position"),a=new Float32Array(n.count*3);t.addAttribute("color",new gt(a,3)),this.add(new mn(t,i)),this.update()}function pM(r,e,t,i){r=r||10,e=e||10,t=new Gt(t!==void 0?t:4473924),i=new Gt(i!==void 0?i:8947848);for(var n=e/2,a=r*2/e,o=[],s=[],l=0,u=0,c=-r;l<=e;l++,c+=a){o.push(-r,0,c,r,0,c),o.push(c,0,-r,c,0,r);var f=l===n?t:i;f.toArray(s,u),u+=3,f.toArray(s,u),u+=3,f.toArray(s,u),u+=3,f.toArray(s,u),u+=3}var h=new Bt;h.addAttribute("position",new gr(o,3)),h.addAttribute("color",new gr(s,3));var p=new Ui({vertexColors:Qd});di.call(this,h,p)}function mC(r,e,t,i,n,a){r=r||10,e=e||16,t=t||8,i=i||64,n=new Gt(n!==void 0?n:4473924),a=new Gt(a!==void 0?a:8947848);var o=[],s=[],l,u,c,f,h,p,d;for(f=0;f<=e;f++)c=f/e*(Math.PI*2),l=Math.sin(c)*r,u=Math.cos(c)*r,o.push(0,0,0),o.push(l,0,u),d=f&1?n:a,s.push(d.r,d.g,d.b),s.push(d.r,d.g,d.b);for(f=0;f<=t;f++)for(d=f&1?n:a,p=r-r/t*f,h=0;h<i;h++)c=h/i*(Math.PI*2),l=Math.sin(c)*p,u=Math.cos(c)*p,o.push(l,0,u),s.push(d.r,d.g,d.b),c=(h+1)/i*(Math.PI*2),l=Math.sin(c)*p,u=Math.cos(c)*p,o.push(l,0,u),s.push(d.r,d.g,d.b);var g=new Bt;g.addAttribute("position",new gr(o,3)),g.addAttribute("color",new gr(s,3));var m=new Ui({vertexColors:Qd});di.call(this,g,m)}function dM(r,e,t,i){this.object=r,this.size=e!==void 0?e:1;var n=t!==void 0?t:16776960,a=i!==void 0?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var l=new Bt,u=new gr(o*2*3,3);l.addAttribute("position",u),di.call(this,l,new Ui({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Dy(r,e){Et.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,e===void 0&&(e=1);var t=new Bt;t.addAttribute("position",new gr([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var i=new Ui({fog:!1});this.add(new oc(t,i)),t=new Bt,t.addAttribute("position",new gr([0,0,0,0,0,1],3)),this.add(new oc(t,i)),this.update()}function mM(r){var e=new Bt,t=new Ui({color:16777215,vertexColors:Oz}),i=[],n=[],a={},o=new Gt(16755200),s=new Gt(16711680),l=new Gt(43775),u=new Gt(16777215),c=new Gt(3355443);f("n1","n2",o),f("n2","n4",o),f("n4","n3",o),f("n3","n1",o),f("f1","f2",o),f("f2","f4",o),f("f4","f3",o),f("f3","f1",o),f("n1","f1",o),f("n2","f2",o),f("n3","f3",o),f("n4","f4",o),f("p","n1",s),f("p","n2",s),f("p","n3",s),f("p","n4",s),f("u1","u2",l),f("u2","u3",l),f("u3","u1",l),f("c","t",u),f("p","c",c),f("cn1","cn2",c),f("cn3","cn4",c),f("cf1","cf2",c),f("cf3","cf4",c);function f(p,d,g){h(p,g),h(d,g)}function h(p,d){i.push(0,0,0),n.push(d.r,d.g,d.b),a[p]===void 0&&(a[p]=[]),a[p].push(i.length/3-1)}e.addAttribute("position",new gr(i,3)),e.addAttribute("color",new gr(n,3)),di.call(this,e,t),this.camera=r,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Iy(r,e){e===void 0&&(e=16776960);var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),n=new Bt;n.setIndex(new gt(t,1)),n.addAttribute("position",new gt(i,3)),di.call(this,n,new Ui({color:e})),r!==void 0&&this.update(r)}function $d(r,e,t,i,n,a){Et.call(this),i===void 0&&(i=16776960),t===void 0&&(t=1),n===void 0&&(n=.2*t),a===void 0&&(a=.2*n),this.position.copy(e),this.line=new oc(jne,new Ui({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new mn(Kne,new io({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(t,n,a)}function vC(r){r=r||1;var e=[0,0,0,r,0,0,0,0,0,0,r,0,0,0,0,0,0,r],t=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Bt;i.addAttribute("position",new gr(e,3)),i.addAttribute("color",new gr(t,3));var n=new Ui({vertexColors:Qd});di.call(this,i,n)}function gC(r,e,t,i,n,a){lc.call(this,r,e,t,t,i,n,a)}function nLe(r,e,t,i,n,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Fo(r,e,t,n,a,o)}function sLe(r){return console.warn("THREE.MeshFaceMaterial has been renamed to THREE.MultiMaterial."),new sM(r)}function lLe(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new iy(r,e)}function uLe(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new BS(r)}function cLe(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new iy(r,e)}function fLe(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new dl(r)}function hLe(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new dl(r)}function pLe(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new dl(r)}function dLe(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new oe(r,e,t)}function mLe(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new gt(r,e).setDynamic(!0)}function vLe(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new IS(r,e)}function gLe(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new NS(r,e)}function yLe(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new US(r,e)}function _Le(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new OS(r,e)}function xLe(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new nc(r,e)}function SLe(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new FS(r,e)}function MLe(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new ac(r,e)}function bLe(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new gr(r,e)}function wLe(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new zS(r,e)}function Jne(r){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),fB.call(this,r),this.type="catmullrom",this.closed=!0}function TLe(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Iy(r,e)}function ELe(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new di(new gy(r.geometry),new Ui({color:e!==void 0?e:16777215}))}function ALe(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new di(new ay(r.geometry),new Ui({color:e!==void 0?e:16777215}))}function CLe(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Ts(r)}function PLe(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(r,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),r.project(e)},this.unprojectVector=function(r,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),r.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function DLe(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}var Fie,ZEe,zie,wS,Dz,jEe,Bie,KEe,JEe,Iz,kie,Zg,yh,Ny,Nz,Uz,yC,Oz,Qd,TS,Uy,Fz,zz,Bz,kz,Vie,Vz,Gie,Hie,oz,sz,Wie,Xie,Yie,qie,Gz,Hz,Zie,jie,Kie,Jie,$ie,Qie,ene,tne,GA,rne,ine,nne,ane,vM,one,sne,kA,Wz,lne,une,cne,_C,xC,HA,Xz,WA,Yz,SC,MC,fne,ic,Uo,Dd,lz,Oo,bC,wC,to,qz,gM,uz,XA,hne,pne,ES,dne,Zz,jg,YA,mne,vne,gne,AS,yne,Kg,su,_ne,xne,$Ee,Cd,Jg,cz,fz,hz,pz,dz,mz,vz,gz,Sne,Mne,bne,wne,CS,bS,VA,Id,Ad,RS,jz,Tne,Ene,LS,Ane,Kz,Cne,QEe,Rne,Lne,Pne,Dne,Ine,cr,eAe,Nne,Une,Lie,Pie,nz,eo,EAe,AAe,CAe,RAe,LAe,PAe,DAe,IAe,NAe,UAe,OAe,FAe,zAe,BAe,kAe,VAe,GAe,HAe,WAe,XAe,YAe,qAe,ZAe,jAe,KAe,JAe,$Ae,QAe,eCe,tCe,rCe,iCe,nCe,aCe,oCe,sCe,lCe,uCe,cCe,fCe,hCe,pCe,dCe,mCe,vCe,gCe,yCe,_Ce,xCe,SCe,MCe,bCe,wCe,TCe,ECe,ACe,CCe,RCe,LCe,PCe,DCe,ICe,NCe,UCe,OCe,FCe,zCe,BCe,kCe,VCe,GCe,HCe,WCe,XCe,YCe,qCe,ZCe,jCe,KCe,JCe,$Ce,QCe,eRe,tRe,rRe,iRe,nRe,aRe,oRe,sRe,lRe,uRe,cRe,fRe,hRe,pRe,dRe,mRe,vRe,gRe,yRe,_Re,xRe,SRe,MRe,bRe,Xr,wRe,hr,Qg,ARe,CRe,RRe,NRe,Ln,pl,KRe,xz,zo,JRe,Jn,uc,_M,nB,BA,sB,jne,Kne,fB,QRe,eLe,tLe,rLe,iLe,aLe,oLe,RLe,LLe,Qne=Dse(()=>{"use strict";Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52));Math.sign===void 0&&(Math.sign=function(r){return r<0?-1:r>0?1:+r});Function.prototype.name===void 0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});Object.assign===void 0&&function(){Object.assign=function(r){"use strict";if(r==null)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(r),t=1;t<arguments.length;t++){var i=arguments[t];if(i!=null)for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}}();Object.assign(Ms.prototype,{addEventListener:function(r,e){this._listeners===void 0&&(this._listeners={});var t=this._listeners;t[r]===void 0&&(t[r]=[]),t[r].indexOf(e)===-1&&t[r].push(e)},hasEventListener:function(r,e){if(this._listeners===void 0)return!1;var t=this._listeners;return t[r]!==void 0&&t[r].indexOf(e)!==-1},removeEventListener:function(r,e){if(this._listeners!==void 0){var t=this._listeners,i=t[r];if(i!==void 0){var n=i.indexOf(e);n!==-1&&i.splice(n,1)}}},dispatchEvent:function(r){if(this._listeners!==void 0){var e=this._listeners,t=e[r.type];if(t!==void 0){r.target=this;var i=[],n=0,a=t.length;for(n=0;n<a;n++)i[n]=t[n];for(n=0;n<a;n++)i[n].call(this,r)}}}});Fie="83",ZEe={LEFT:0,MIDDLE:1,RIGHT:2},zie=0,wS=1,Dz=2,jEe=3,Bie=0,KEe=1,JEe=0,Iz=1,kie=2,Zg=0,yh=1,Ny=2,Nz=1,Uz=2,yC=0,Oz=1,Qd=2,TS=0,Uy=1,Fz=2,zz=3,Bz=4,kz=5,Vie={NoBlending:TS,NormalBlending:Uy,AdditiveBlending:Fz,SubtractiveBlending:zz,MultiplyBlending:Bz,CustomBlending:kz},Vz=100,Gie=101,Hie=102,oz=103,sz=104,Wie=200,Xie=201,Yie=202,qie=203,Gz=204,Hz=205,Zie=206,jie=207,Kie=208,Jie=209,$ie=210,Qie=0,ene=1,tne=2,GA=3,rne=4,ine=5,nne=6,ane=7,vM=0,one=1,sne=2,kA=0,Wz=1,lne=2,une=3,cne=4,_C=300,xC=301,HA=302,Xz=303,WA=304,Yz=305,SC=306,MC=307,fne={UVMapping:_C,CubeReflectionMapping:xC,CubeRefractionMapping:HA,EquirectangularReflectionMapping:Xz,EquirectangularRefractionMapping:WA,SphericalReflectionMapping:Yz,CubeUVReflectionMapping:SC,CubeUVRefractionMapping:MC},ic=1e3,Uo=1001,Dd=1002,lz={RepeatWrapping:ic,ClampToEdgeWrapping:Uo,MirroredRepeatWrapping:Dd},Oo=1003,bC=1004,wC=1005,to=1006,qz=1007,gM=1008,uz={NearestFilter:Oo,NearestMipMapNearestFilter:bC,NearestMipMapLinearFilter:wC,LinearFilter:to,LinearMipMapNearestFilter:qz,LinearMipMapLinearFilter:gM},XA=1009,hne=1010,pne=1011,ES=1012,dne=1013,Zz=1014,jg=1015,YA=1016,mne=1017,vne=1018,gne=1019,AS=1020,yne=1021,Kg=1022,su=1023,_ne=1024,xne=1025,$Ee=su,Cd=1026,Jg=1027,cz=2001,fz=2002,hz=2003,pz=2004,dz=2100,mz=2101,vz=2102,gz=2103,Sne=2151,Mne=2200,bne=2201,wne=2202,CS=2300,bS=2301,VA=2302,Id=2400,Ad=2401,RS=2402,jz=0,Tne=1,Ene=2,LS=3e3,Ane=3001,Kz=3007,Cne=3002,QEe=3003,Rne=3004,Lne=3005,Pne=3006,Dne=3200,Ine=3201,cr={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),t=0,i;return function(){for(var a=0;a<36;a++)a===8||a===13||a===18||a===23?e[a]="-":a===14?e[a]="4":(t<=2&&(t=33554432+Math.random()*16777216|0),i=t&15,t=t>>4,e[a]=r[a===19?i&3|8:i]);return e.join("")}}(),clamp:function(r,e,t){return Math.max(e,Math.min(t,r))},euclideanModulo:function(r,e){return(r%e+e)%e},mapLinear:function(r,e,t,i,n){return i+(r-e)*(n-i)/(t-e)},lerp:function(r,e,t){return(1-t)*r+t*e},smoothstep:function(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))},smootherstep:function(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))},randInt:function(r,e){return r+Math.floor(Math.random()*(e-r+1))},randFloat:function(r,e){return r+Math.random()*(e-r)},randFloatSpread:function(r){return r*(.5-Math.random())},degToRad:function(r){return r*cr.DEG2RAD},radToDeg:function(r){return r*cr.RAD2DEG},isPowerOfTwo:function(r){return(r&r-1)===0&&r!==0},nearestPowerOfTwo:function(r){return Math.pow(2,Math.round(Math.log(r)/Math.LN2))},nextPowerOfTwo:function(r){return r--,r|=r>>1,r|=r>>2,r|=r>>4,r|=r>>8,r|=r>>16,r++,r}};St.prototype={constructor:St,isVector2:!0,get width(){return this.x},set width(r){this.x=r},get height(){return this.y},set height(r){this.y=r},set:function(r,e){return this.x=r,this.y=e,this},setScalar:function(r){return this.x=r,this.y=r,this},setX:function(r){return this.x=r,this},setY:function(r){return this.y=r,this},setComponent:function(r,e){switch(r){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+r)}return this},getComponent:function(r){switch(r){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+r)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(r){return this.x=r.x,this.y=r.y,this},add:function(r,e){return e!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(r,e)):(this.x+=r.x,this.y+=r.y,this)},addScalar:function(r){return this.x+=r,this.y+=r,this},addVectors:function(r,e){return this.x=r.x+e.x,this.y=r.y+e.y,this},addScaledVector:function(r,e){return this.x+=r.x*e,this.y+=r.y*e,this},sub:function(r,e){return e!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(r,e)):(this.x-=r.x,this.y-=r.y,this)},subScalar:function(r){return this.x-=r,this.y-=r,this},subVectors:function(r,e){return this.x=r.x-e.x,this.y=r.y-e.y,this},multiply:function(r){return this.x*=r.x,this.y*=r.y,this},multiplyScalar:function(r){return isFinite(r)?(this.x*=r,this.y*=r):(this.x=0,this.y=0),this},divide:function(r){return this.x/=r.x,this.y/=r.y,this},divideScalar:function(r){return this.multiplyScalar(1/r)},min:function(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this},max:function(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this},clamp:function(r,e){return this.x=Math.max(r.x,Math.min(e.x,this.x)),this.y=Math.max(r.y,Math.min(e.y,this.y)),this},clampScalar:function(){var r,e;return function(i,n){return r===void 0&&(r=new St,e=new St),r.set(i,i),e.set(n,n),this.clamp(r,e)}}(),clampLength:function(r,e){var t=this.length();return this.multiplyScalar(Math.max(r,Math.min(e,t))/t)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(r){return this.x*r.x+this.y*r.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var r=Math.atan2(this.y,this.x);return r<0&&(r+=2*Math.PI),r},distanceTo:function(r){return Math.sqrt(this.distanceToSquared(r))},distanceToSquared:function(r){var e=this.x-r.x,t=this.y-r.y;return e*e+t*t},distanceToManhattan:function(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)},setLength:function(r){return this.multiplyScalar(r/this.length())},lerp:function(r,e){return this.x+=(r.x-this.x)*e,this.y+=(r.y-this.y)*e,this},lerpVectors:function(r,e,t){return this.subVectors(e,r).multiplyScalar(t).add(r)},equals:function(r){return r.x===this.x&&r.y===this.y},fromArray:function(r,e){return e===void 0&&(e=0),this.x=r[e],this.y=r[e+1],this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this.x,r[e+1]=this.y,r},fromAttribute:function(r,e,t){return t!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromAttribute()."),this.x=r.getX(e),this.y=r.getY(e),this},rotateAround:function(r,e){var t=Math.cos(e),i=Math.sin(e),n=this.x-r.x,a=this.y-r.y;return this.x=n*t-a*i+r.x,this.y=n*i+a*t+r.y,this}};eAe=0;ni.DEFAULT_IMAGE=void 0;ni.DEFAULT_MAPPING=_C;ni.prototype={constructor:ni,isTexture:!0,set needsUpdate(r){r===!0&&this.version++},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.image=r.image,this.mipmaps=r.mipmaps.slice(0),this.mapping=r.mapping,this.wrapS=r.wrapS,this.wrapT=r.wrapT,this.magFilter=r.magFilter,this.minFilter=r.minFilter,this.anisotropy=r.anisotropy,this.format=r.format,this.type=r.type,this.offset.copy(r.offset),this.repeat.copy(r.repeat),this.generateMipmaps=r.generateMipmaps,this.premultiplyAlpha=r.premultiplyAlpha,this.flipY=r.flipY,this.unpackAlignment=r.unpackAlignment,this.encoding=r.encoding,this},toJSON:function(r){if(r.textures[this.uuid]!==void 0)return r.textures[this.uuid];function e(n){var a;return n.toDataURL!==void 0?a=n:(a=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),a.width=n.width,a.height=n.height,a.getContext("2d").drawImage(n,0,0,n.width,n.height)),a.width>2048||a.height>2048?a.toDataURL("image/jpeg",.6):a.toDataURL("image/png")}var t={metadata:{version:4.4,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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(this.image!==void 0){var i=this.image;i.uuid===void 0&&(i.uuid=cr.generateUUID()),r.images[i.uuid]===void 0&&(r.images[i.uuid]={uuid:i.uuid,url:e(i)}),t.image=i.uuid}return r.textures[this.uuid]=t,t},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(r){if(this.mapping===_C){if(r.multiply(this.repeat),r.add(this.offset),r.x<0||r.x>1)switch(this.wrapS){case ic:r.x=r.x-Math.floor(r.x);break;case Uo:r.x=r.x<0?0:1;break;case Dd:Math.abs(Math.floor(r.x)%2)===1?r.x=Math.ceil(r.x)-r.x:r.x=r.x-Math.floor(r.x);break}if(r.y<0||r.y>1)switch(this.wrapT){case ic:r.y=r.y-Math.floor(r.y);break;case Uo:r.y=r.y<0?0:1;break;case Dd:Math.abs(Math.floor(r.y)%2)===1?r.y=Math.ceil(r.y)-r.y:r.y=r.y-Math.floor(r.y);break}this.flipY&&(r.y=1-r.y)}}};Object.assign(ni.prototype,Ms.prototype);Qr.prototype={constructor:Qr,isVector4:!0,set:function(r,e,t,i){return this.x=r,this.y=e,this.z=t,this.w=i,this},setScalar:function(r){return this.x=r,this.y=r,this.z=r,this.w=r,this},setX:function(r){return this.x=r,this},setY:function(r){return this.y=r,this},setZ:function(r){return this.z=r,this},setW:function(r){return this.w=r,this},setComponent:function(r,e){switch(r){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: "+r)}return this},getComponent:function(r){switch(r){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: "+r)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this.w=r.w!==void 0?r.w:1,this},add:function(r,e){return e!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(r,e)):(this.x+=r.x,this.y+=r.y,this.z+=r.z,this.w+=r.w,this)},addScalar:function(r){return this.x+=r,this.y+=r,this.z+=r,this.w+=r,this},addVectors:function(r,e){return this.x=r.x+e.x,this.y=r.y+e.y,this.z=r.z+e.z,this.w=r.w+e.w,this},addScaledVector:function(r,e){return this.x+=r.x*e,this.y+=r.y*e,this.z+=r.z*e,this.w+=r.w*e,this},sub:function(r,e){return e!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(r,e)):(this.x-=r.x,this.y-=r.y,this.z-=r.z,this.w-=r.w,this)},subScalar:function(r){return this.x-=r,this.y-=r,this.z-=r,this.w-=r,this},subVectors:function(r,e){return this.x=r.x-e.x,this.y=r.y-e.y,this.z=r.z-e.z,this.w=r.w-e.w,this},multiplyScalar:function(r){return isFinite(r)?(this.x*=r,this.y*=r,this.z*=r,this.w*=r):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(r){var e=this.x,t=this.y,i=this.z,n=this.w,a=r.elements;return this.x=a[0]*e+a[4]*t+a[8]*i+a[12]*n,this.y=a[1]*e+a[5]*t+a[9]*i+a[13]*n,this.z=a[2]*e+a[6]*t+a[10]*i+a[14]*n,this.w=a[3]*e+a[7]*t+a[11]*i+a[15]*n,this},divideScalar:function(r){return this.multiplyScalar(1/r)},setAxisAngleFromQuaternion:function(r){this.w=2*Math.acos(r.w);var e=Math.sqrt(1-r.w*r.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=r.x/e,this.y=r.y/e,this.z=r.z/e),this},setAxisAngleFromRotationMatrix:function(r){var e,t,i,n,a=.01,o=.1,s=r.elements,l=s[0],u=s[4],c=s[8],f=s[1],h=s[5],p=s[9],d=s[2],g=s[6],m=s[10];if(Math.abs(u-f)<a&&Math.abs(c-d)<a&&Math.abs(p-g)<a){if(Math.abs(u+f)<o&&Math.abs(c+d)<o&&Math.abs(p+g)<o&&Math.abs(l+h+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var v=(l+1)/2,_=(h+1)/2,y=(m+1)/2,x=(u+f)/4,M=(c+d)/4,S=(p+g)/4;return v>_&&v>y?v<a?(t=0,i=.707106781,n=.707106781):(t=Math.sqrt(v),i=x/t,n=M/t):_>y?_<a?(t=.707106781,i=0,n=.707106781):(i=Math.sqrt(_),t=x/i,n=S/i):y<a?(t=.707106781,i=.707106781,n=0):(n=Math.sqrt(y),t=M/n,i=S/n),this.set(t,i,n,e),this}var w=Math.sqrt((g-p)*(g-p)+(c-d)*(c-d)+(f-u)*(f-u));return Math.abs(w)<.001&&(w=1),this.x=(g-p)/w,this.y=(c-d)/w,this.z=(f-u)/w,this.w=Math.acos((l+h+m-1)/2),this},min:function(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this.z=Math.min(this.z,r.z),this.w=Math.min(this.w,r.w),this},max:function(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this.z=Math.max(this.z,r.z),this.w=Math.max(this.w,r.w),this},clamp:function(r,e){return this.x=Math.max(r.x,Math.min(e.x,this.x)),this.y=Math.max(r.y,Math.min(e.y,this.y)),this.z=Math.max(r.z,Math.min(e.z,this.z)),this.w=Math.max(r.w,Math.min(e.w,this.w)),this},clampScalar:function(){var r,e;return function(i,n){return r===void 0&&(r=new Qr,e=new Qr),r.set(i,i,i,i),e.set(n,n,n,n),this.clamp(r,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(r){return this.x*r.x+this.y*r.y+this.z*r.z+this.w*r.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(r){return this.multiplyScalar(r/this.length())},lerp:function(r,e){return this.x+=(r.x-this.x)*e,this.y+=(r.y-this.y)*e,this.z+=(r.z-this.z)*e,this.w+=(r.w-this.w)*e,this},lerpVectors:function(r,e,t){return this.subVectors(e,r).multiplyScalar(t).add(r)},equals:function(r){return r.x===this.x&&r.y===this.y&&r.z===this.z&&r.w===this.w},fromArray:function(r,e){return e===void 0&&(e=0),this.x=r[e],this.y=r[e+1],this.z=r[e+2],this.w=r[e+3],this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this.x,r[e+1]=this.y,r[e+2]=this.z,r[e+3]=this.w,r},fromAttribute:function(r,e,t){return t!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromAttribute()."),this.x=r.getX(e),this.y=r.getY(e),this.z=r.getZ(e),this.w=r.getW(e),this}};Object.assign(Oy.prototype,Ms.prototype,{isWebGLRenderTarget:!0,setSize:function(r,e){(this.width!==r||this.height!==e)&&(this.width=r,this.height=e,this.dispose()),this.viewport.set(0,0,r,e),this.scissor.set(0,0,r,e)},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.width=r.width,this.height=r.height,this.viewport.copy(r.viewport),this.texture=r.texture.clone(),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.depthTexture=r.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});$g.prototype=Object.create(Oy.prototype);$g.prototype.constructor=$g;$g.prototype.isWebGLRenderTargetCube=!0;on.prototype={constructor:on,get x(){return this._x},set x(r){this._x=r,this.onChangeCallback()},get y(){return this._y},set y(r){this._y=r,this.onChangeCallback()},get z(){return this._z},set z(r){this._z=r,this.onChangeCallback()},get w(){return this._w},set w(r){this._w=r,this.onChangeCallback()},set:function(r,e,t,i){return this._x=r,this._y=e,this._z=t,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(r){return this._x=r.x,this._y=r.y,this._z=r.z,this._w=r.w,this.onChangeCallback(),this},setFromEuler:function(r,e){if((r&&r.isEuler)===!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var t=Math.cos(r._x/2),i=Math.cos(r._y/2),n=Math.cos(r._z/2),a=Math.sin(r._x/2),o=Math.sin(r._y/2),s=Math.sin(r._z/2),l=r.order;return l==="XYZ"?(this._x=a*i*n+t*o*s,this._y=t*o*n-a*i*s,this._z=t*i*s+a*o*n,this._w=t*i*n-a*o*s):l==="YXZ"?(this._x=a*i*n+t*o*s,this._y=t*o*n-a*i*s,this._z=t*i*s-a*o*n,this._w=t*i*n+a*o*s):l==="ZXY"?(this._x=a*i*n-t*o*s,this._y=t*o*n+a*i*s,this._z=t*i*s+a*o*n,this._w=t*i*n-a*o*s):l==="ZYX"?(this._x=a*i*n-t*o*s,this._y=t*o*n+a*i*s,this._z=t*i*s-a*o*n,this._w=t*i*n+a*o*s):l==="YZX"?(this._x=a*i*n+t*o*s,this._y=t*o*n+a*i*s,this._z=t*i*s-a*o*n,this._w=t*i*n-a*o*s):l==="XZY"&&(this._x=a*i*n-t*o*s,this._y=t*o*n-a*i*s,this._z=t*i*s+a*o*n,this._w=t*i*n+a*o*s),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(r,e){var t=e/2,i=Math.sin(t);return this._x=r.x*i,this._y=r.y*i,this._z=r.z*i,this._w=Math.cos(t),this.onChangeCallback(),this},setFromRotationMatrix:function(r){var e=r.elements,t=e[0],i=e[4],n=e[8],a=e[1],o=e[5],s=e[9],l=e[2],u=e[6],c=e[10],f=t+o+c,h;return f>0?(h=.5/Math.sqrt(f+1),this._w=.25/h,this._x=(u-s)*h,this._y=(n-l)*h,this._z=(a-i)*h):t>o&&t>c?(h=2*Math.sqrt(1+t-o-c),this._w=(u-s)/h,this._x=.25*h,this._y=(i+a)/h,this._z=(n+l)/h):o>c?(h=2*Math.sqrt(1+o-t-c),this._w=(n-l)/h,this._x=(i+a)/h,this._y=.25*h,this._z=(s+u)/h):(h=2*Math.sqrt(1+c-t-o),this._w=(a-i)/h,this._x=(n+l)/h,this._y=(s+u)/h,this._z=.25*h),this.onChangeCallback(),this},setFromUnitVectors:function(){var r,e,t=1e-6;return function(n,a){return r===void 0&&(r=new oe),e=n.dot(a)+1,e<t?(e=0,Math.abs(n.x)>Math.abs(n.z)?r.set(-n.y,n.x,0):r.set(0,-n.z,n.y)):r.crossVectors(n,a),this._x=r.x,this._y=r.y,this._z=r.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(r){return this._x*r._x+this._y*r._y+this._z*r._z+this._w*r._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var r=this.length();return r===0?(this._x=0,this._y=0,this._z=0,this._w=1):(r=1/r,this._x=this._x*r,this._y=this._y*r,this._z=this._z*r,this._w=this._w*r),this.onChangeCallback(),this},multiply:function(r,e){return e!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(r,e)):this.multiplyQuaternions(this,r)},premultiply:function(r){return this.multiplyQuaternions(r,this)},multiplyQuaternions:function(r,e){var t=r._x,i=r._y,n=r._z,a=r._w,o=e._x,s=e._y,l=e._z,u=e._w;return this._x=t*u+a*o+i*l-n*s,this._y=i*u+a*s+n*o-t*l,this._z=n*u+a*l+t*s-i*o,this._w=a*u-t*o-i*s-n*l,this.onChangeCallback(),this},slerp:function(r,e){if(e===0)return this;if(e===1)return this.copy(r);var t=this._x,i=this._y,n=this._z,a=this._w,o=a*r._w+t*r._x+i*r._y+n*r._z;if(o<0?(this._w=-r._w,this._x=-r._x,this._y=-r._y,this._z=-r._z,o=-o):this.copy(r),o>=1)return this._w=a,this._x=t,this._y=i,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(t+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var l=Math.atan2(s,o),u=Math.sin((1-e)*l)/s,c=Math.sin(e*l)/s;return this._w=a*u+this._w*c,this._x=t*u+this._x*c,this._y=i*u+this._y*c,this._z=n*u+this._z*c,this.onChangeCallback(),this},equals:function(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._w===this._w},fromArray:function(r,e){return e===void 0&&(e=0),this._x=r[e],this._y=r[e+1],this._z=r[e+2],this._w=r[e+3],this.onChangeCallback(),this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this._x,r[e+1]=this._y,r[e+2]=this._z,r[e+3]=this._w,r},onChange:function(r){return this.onChangeCallback=r,this},onChangeCallback:function(){}};Object.assign(on,{slerp:function(r,e,t,i){return t.copy(r).slerp(e,i)},slerpFlat:function(r,e,t,i,n,a,o){var s=t[i+0],l=t[i+1],u=t[i+2],c=t[i+3],f=n[a+0],h=n[a+1],p=n[a+2],d=n[a+3];if(c!==d||s!==f||l!==h||u!==p){var g=1-o,m=s*f+l*h+u*p+c*d,v=m>=0?1:-1,_=1-m*m;if(_>Number.EPSILON){var y=Math.sqrt(_),x=Math.atan2(y,m*v);g=Math.sin(g*x)/y,o=Math.sin(o*x)/y}var M=o*v;if(s=s*g+f*M,l=l*g+h*M,u=u*g+p*M,c=c*g+d*M,g===1-o){var S=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=S,l*=S,u*=S,c*=S}}r[e]=s,r[e+1]=l,r[e+2]=u,r[e+3]=c}});oe.prototype={constructor:oe,isVector3:!0,set:function(r,e,t){return this.x=r,this.y=e,this.z=t,this},setScalar:function(r){return this.x=r,this.y=r,this.z=r,this},setX:function(r){return this.x=r,this},setY:function(r){return this.y=r,this},setZ:function(r){return this.z=r,this},setComponent:function(r,e){switch(r){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: "+r)}return this},getComponent:function(r){switch(r){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+r)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(r){return this.x=r.x,this.y=r.y,this.z=r.z,this},add:function(r,e){return e!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(r,e)):(this.x+=r.x,this.y+=r.y,this.z+=r.z,this)},addScalar:function(r){return this.x+=r,this.y+=r,this.z+=r,this},addVectors:function(r,e){return this.x=r.x+e.x,this.y=r.y+e.y,this.z=r.z+e.z,this},addScaledVector:function(r,e){return this.x+=r.x*e,this.y+=r.y*e,this.z+=r.z*e,this},sub:function(r,e){return e!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(r,e)):(this.x-=r.x,this.y-=r.y,this.z-=r.z,this)},subScalar:function(r){return this.x-=r,this.y-=r,this.z-=r,this},subVectors:function(r,e){return this.x=r.x-e.x,this.y=r.y-e.y,this.z=r.z-e.z,this},multiply:function(r,e){return e!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(r,e)):(this.x*=r.x,this.y*=r.y,this.z*=r.z,this)},multiplyScalar:function(r){return isFinite(r)?(this.x*=r,this.y*=r,this.z*=r):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(r,e){return this.x=r.x*e.x,this.y=r.y*e.y,this.z=r.z*e.z,this},applyEuler:function(){var r;return function(t){return(t&&t.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),r===void 0&&(r=new on),this.applyQuaternion(r.setFromEuler(t))}}(),applyAxisAngle:function(){var r;return function(t,i){return r===void 0&&(r=new on),this.applyQuaternion(r.setFromAxisAngle(t,i))}}(),applyMatrix3:function(r){var e=this.x,t=this.y,i=this.z,n=r.elements;return this.x=n[0]*e+n[3]*t+n[6]*i,this.y=n[1]*e+n[4]*t+n[7]*i,this.z=n[2]*e+n[5]*t+n[8]*i,this},applyMatrix4:function(r){var e=this.x,t=this.y,i=this.z,n=r.elements;return this.x=n[0]*e+n[4]*t+n[8]*i+n[12],this.y=n[1]*e+n[5]*t+n[9]*i+n[13],this.z=n[2]*e+n[6]*t+n[10]*i+n[14],this},applyProjection:function(r){var e=this.x,t=this.y,i=this.z,n=r.elements,a=1/(n[3]*e+n[7]*t+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*t+n[8]*i+n[12])*a,this.y=(n[1]*e+n[5]*t+n[9]*i+n[13])*a,this.z=(n[2]*e+n[6]*t+n[10]*i+n[14])*a,this},applyQuaternion:function(r){var e=this.x,t=this.y,i=this.z,n=r.x,a=r.y,o=r.z,s=r.w,l=s*e+a*i-o*t,u=s*t+o*e-n*i,c=s*i+n*t-a*e,f=-n*e-a*t-o*i;return this.x=l*s+f*-n+u*-o-c*-a,this.y=u*s+f*-a+c*-n-l*-o,this.z=c*s+f*-o+l*-a-u*-n,this},project:function(){var r;return function(t){return r===void 0&&(r=new qt),r.multiplyMatrices(t.projectionMatrix,r.getInverse(t.matrixWorld)),this.applyProjection(r)}}(),unproject:function(){var r;return function(t){return r===void 0&&(r=new qt),r.multiplyMatrices(t.matrixWorld,r.getInverse(t.projectionMatrix)),this.applyProjection(r)}}(),transformDirection:function(r){var e=this.x,t=this.y,i=this.z,n=r.elements;return this.x=n[0]*e+n[4]*t+n[8]*i,this.y=n[1]*e+n[5]*t+n[9]*i,this.z=n[2]*e+n[6]*t+n[10]*i,this.normalize()},divide:function(r){return this.x/=r.x,this.y/=r.y,this.z/=r.z,this},divideScalar:function(r){return this.multiplyScalar(1/r)},min:function(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this.z=Math.min(this.z,r.z),this},max:function(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this.z=Math.max(this.z,r.z),this},clamp:function(r,e){return this.x=Math.max(r.x,Math.min(e.x,this.x)),this.y=Math.max(r.y,Math.min(e.y,this.y)),this.z=Math.max(r.z,Math.min(e.z,this.z)),this},clampScalar:function(){var r,e;return function(i,n){return r===void 0&&(r=new oe,e=new oe),r.set(i,i,i),e.set(n,n,n),this.clamp(r,e)}}(),clampLength:function(r,e){var t=this.length();return this.multiplyScalar(Math.max(r,Math.min(e,t))/t)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(r){return this.x*r.x+this.y*r.y+this.z*r.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(r){return this.multiplyScalar(r/this.length())},lerp:function(r,e){return this.x+=(r.x-this.x)*e,this.y+=(r.y-this.y)*e,this.z+=(r.z-this.z)*e,this},lerpVectors:function(r,e,t){return this.subVectors(e,r).multiplyScalar(t).add(r)},cross:function(r,e){if(e!==void 0)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(r,e);var t=this.x,i=this.y,n=this.z;return this.x=i*r.z-n*r.y,this.y=n*r.x-t*r.z,this.z=t*r.y-i*r.x,this},crossVectors:function(r,e){var t=r.x,i=r.y,n=r.z,a=e.x,o=e.y,s=e.z;return this.x=i*s-n*o,this.y=n*a-t*s,this.z=t*o-i*a,this},projectOnVector:function(r){var e=r.dot(this)/r.lengthSq();return this.copy(r).multiplyScalar(e)},projectOnPlane:function(){var r;return function(t){return r===void 0&&(r=new oe),r.copy(this).projectOnVector(t),this.sub(r)}}(),reflect:function(){var r;return function(t){return r===void 0&&(r=new oe),this.sub(r.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(r){var e=this.dot(r)/Math.sqrt(this.lengthSq()*r.lengthSq());return Math.acos(cr.clamp(e,-1,1))},distanceTo:function(r){return Math.sqrt(this.distanceToSquared(r))},distanceToSquared:function(r){var e=this.x-r.x,t=this.y-r.y,i=this.z-r.z;return e*e+t*t+i*i},distanceToManhattan:function(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)+Math.abs(this.z-r.z)},setFromSpherical:function(r){var e=Math.sin(r.phi)*r.radius;return this.x=e*Math.sin(r.theta),this.y=Math.cos(r.phi)*r.radius,this.z=e*Math.cos(r.theta),this},setFromCylindrical:function(r){return this.x=r.radius*Math.sin(r.theta),this.y=r.y,this.z=r.radius*Math.cos(r.theta),this},setFromMatrixPosition:function(r){return this.setFromMatrixColumn(r,3)},setFromMatrixScale:function(r){var e=this.setFromMatrixColumn(r,0).length(),t=this.setFromMatrixColumn(r,1).length(),i=this.setFromMatrixColumn(r,2).length();return this.x=e,this.y=t,this.z=i,this},setFromMatrixColumn:function(r,e){if(typeof r=="number"){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var t=r;r=e,e=t}return this.fromArray(r.elements,e*4)},equals:function(r){return r.x===this.x&&r.y===this.y&&r.z===this.z},fromArray:function(r,e){return e===void 0&&(e=0),this.x=r[e],this.y=r[e+1],this.z=r[e+2],this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this.x,r[e+1]=this.y,r[e+2]=this.z,r},fromAttribute:function(r,e,t){return t!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromAttribute()."),this.x=r.getX(e),this.y=r.getY(e),this.z=r.getZ(e),this}};qt.prototype={constructor:qt,isMatrix4:!0,set:function(r,e,t,i,n,a,o,s,l,u,c,f,h,p,d,g){var m=this.elements;return m[0]=r,m[4]=e,m[8]=t,m[12]=i,m[1]=n,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=f,m[3]=h,m[7]=p,m[11]=d,m[15]=g,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new qt().fromArray(this.elements)},copy:function(r){return this.elements.set(r.elements),this},copyPosition:function(r){var e=this.elements,t=r.elements;return e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(r,e,t){return r.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),t.setFromMatrixColumn(this,2),this},makeBasis:function(r,e,t){return this.set(r.x,e.x,t.x,0,r.y,e.y,t.y,0,r.z,e.z,t.z,0,0,0,0,1),this},extractRotation:function(){var r;return function(t){r===void 0&&(r=new oe);var i=this.elements,n=t.elements,a=1/r.setFromMatrixColumn(t,0).length(),o=1/r.setFromMatrixColumn(t,1).length(),s=1/r.setFromMatrixColumn(t,2).length();return i[0]=n[0]*a,i[1]=n[1]*a,i[2]=n[2]*a,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*s,i[9]=n[9]*s,i[10]=n[10]*s,this}}(),makeRotationFromEuler:function(r){(r&&r.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,t=r.x,i=r.y,n=r.z,a=Math.cos(t),o=Math.sin(t),s=Math.cos(i),l=Math.sin(i),u=Math.cos(n),c=Math.sin(n);if(r.order==="XYZ"){var f=a*u,h=a*c,p=o*u,d=o*c;e[0]=s*u,e[4]=-s*c,e[8]=l,e[1]=h+p*l,e[5]=f-d*l,e[9]=-o*s,e[2]=d-f*l,e[6]=p+h*l,e[10]=a*s}else if(r.order==="YXZ"){var g=s*u,m=s*c,v=l*u,_=l*c;e[0]=g+_*o,e[4]=v*o-m,e[8]=a*l,e[1]=a*c,e[5]=a*u,e[9]=-o,e[2]=m*o-v,e[6]=_+g*o,e[10]=a*s}else if(r.order==="ZXY"){var g=s*u,m=s*c,v=l*u,_=l*c;e[0]=g-_*o,e[4]=-a*c,e[8]=v+m*o,e[1]=m+v*o,e[5]=a*u,e[9]=_-g*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if(r.order==="ZYX"){var f=a*u,h=a*c,p=o*u,d=o*c;e[0]=s*u,e[4]=p*l-h,e[8]=f*l+d,e[1]=s*c,e[5]=d*l+f,e[9]=h*l-p,e[2]=-l,e[6]=o*s,e[10]=a*s}else if(r.order==="YZX"){var y=a*s,x=a*l,M=o*s,S=o*l;e[0]=s*u,e[4]=S-y*c,e[8]=M*c+x,e[1]=c,e[5]=a*u,e[9]=-o*u,e[2]=-l*u,e[6]=x*c+M,e[10]=y-S*c}else if(r.order==="XZY"){var y=a*s,x=a*l,M=o*s,S=o*l;e[0]=s*u,e[4]=-c,e[8]=l*u,e[1]=y*c+S,e[5]=a*u,e[9]=x*c-M,e[2]=M*c-x,e[6]=o*u,e[10]=S*c+y}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(r){var e=this.elements,t=r.x,i=r.y,n=r.z,a=r.w,o=t+t,s=i+i,l=n+n,u=t*o,c=t*s,f=t*l,h=i*s,p=i*l,d=n*l,g=a*o,m=a*s,v=a*l;return e[0]=1-(h+d),e[4]=c-v,e[8]=f+m,e[1]=c+v,e[5]=1-(u+d),e[9]=p-g,e[2]=f-m,e[6]=p+g,e[10]=1-(u+h),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var r,e,t;return function(n,a,o){r===void 0&&(r=new oe,e=new oe,t=new oe);var s=this.elements;return t.subVectors(n,a).normalize(),t.lengthSq()===0&&(t.z=1),r.crossVectors(o,t).normalize(),r.lengthSq()===0&&(t.z+=1e-4,r.crossVectors(o,t).normalize()),e.crossVectors(t,r),s[0]=r.x,s[4]=e.x,s[8]=t.x,s[1]=r.y,s[5]=e.y,s[9]=t.y,s[2]=r.z,s[6]=e.z,s[10]=t.z,this}}(),multiply:function(r,e){return e!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(r,e)):this.multiplyMatrices(this,r)},premultiply:function(r){return this.multiplyMatrices(r,this)},multiplyMatrices:function(r,e){var t=r.elements,i=e.elements,n=this.elements,a=t[0],o=t[4],s=t[8],l=t[12],u=t[1],c=t[5],f=t[9],h=t[13],p=t[2],d=t[6],g=t[10],m=t[14],v=t[3],_=t[7],y=t[11],x=t[15],M=i[0],S=i[4],w=i[8],T=i[12],C=i[1],b=i[5],E=i[9],I=i[13],R=i[2],A=i[6],D=i[10],U=i[14],B=i[3],F=i[7],k=i[11],G=i[15];return n[0]=a*M+o*C+s*R+l*B,n[4]=a*S+o*b+s*A+l*F,n[8]=a*w+o*E+s*D+l*k,n[12]=a*T+o*I+s*U+l*G,n[1]=u*M+c*C+f*R+h*B,n[5]=u*S+c*b+f*A+h*F,n[9]=u*w+c*E+f*D+h*k,n[13]=u*T+c*I+f*U+h*G,n[2]=p*M+d*C+g*R+m*B,n[6]=p*S+d*b+g*A+m*F,n[10]=p*w+d*E+g*D+m*k,n[14]=p*T+d*I+g*U+m*G,n[3]=v*M+_*C+y*R+x*B,n[7]=v*S+_*b+y*A+x*F,n[11]=v*w+_*E+y*D+x*k,n[15]=v*T+_*I+y*U+x*G,this},multiplyToArray:function(r,e,t){var i=this.elements;return this.multiplyMatrices(r,e),t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this},multiplyScalar:function(r){var e=this.elements;return e[0]*=r,e[4]*=r,e[8]*=r,e[12]*=r,e[1]*=r,e[5]*=r,e[9]*=r,e[13]*=r,e[2]*=r,e[6]*=r,e[10]*=r,e[14]*=r,e[3]*=r,e[7]*=r,e[11]*=r,e[15]*=r,this},applyToVector3Array:function(){var r;return function(t,i,n){r===void 0&&(r=new oe),i===void 0&&(i=0),n===void 0&&(n=t.length);for(var a=0,o=i;a<n;a+=3,o+=3)r.fromArray(t,o),r.applyMatrix4(this),r.toArray(t,o);return t}}(),applyToBufferAttribute:function(){var r;return function(t){r===void 0&&(r=new oe);for(var i=0,n=t.count;i<n;i++)r.x=t.getX(i),r.y=t.getY(i),r.z=t.getZ(i),r.applyMatrix4(this),t.setXYZ(i,r.x,r.y,r.z);return t}}(),determinant:function(){var r=this.elements,e=r[0],t=r[4],i=r[8],n=r[12],a=r[1],o=r[5],s=r[9],l=r[13],u=r[2],c=r[6],f=r[10],h=r[14],p=r[3],d=r[7],g=r[11],m=r[15];return p*(+n*s*c-i*l*c-n*o*f+t*l*f+i*o*h-t*s*h)+d*(+e*s*h-e*l*f+n*a*f-i*a*h+i*l*u-n*s*u)+g*(+e*l*c-e*o*h-n*a*c+t*a*h+n*o*u-t*l*u)+m*(-i*o*u-e*s*c+e*o*f+i*a*c-t*a*f+t*s*u)},transpose:function(){var r=this.elements,e;return e=r[1],r[1]=r[4],r[4]=e,e=r[2],r[2]=r[8],r[8]=e,e=r[6],r[6]=r[9],r[9]=e,e=r[3],r[3]=r[12],r[12]=e,e=r[7],r[7]=r[13],r[13]=e,e=r[11],r[11]=r[14],r[14]=e,this},setPosition:function(r){var e=this.elements;return e[12]=r.x,e[13]=r.y,e[14]=r.z,this},getInverse:function(r,e){var t=this.elements,i=r.elements,n=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=i[6],f=i[7],h=i[8],p=i[9],d=i[10],g=i[11],m=i[12],v=i[13],_=i[14],y=i[15],x=p*_*f-v*d*f+v*c*g-u*_*g-p*c*y+u*d*y,M=m*d*f-h*_*f-m*c*g+l*_*g+h*c*y-l*d*y,S=h*v*f-m*p*f+m*u*g-l*v*g-h*u*y+l*p*y,w=m*p*c-h*v*c-m*u*d+l*v*d+h*u*_-l*p*_,T=n*x+a*M+o*S+s*w;if(T===0){var C="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(C);return console.warn(C),this.identity()}var b=1/T;return t[0]=x*b,t[1]=(v*d*s-p*_*s-v*o*g+a*_*g+p*o*y-a*d*y)*b,t[2]=(u*_*s-v*c*s+v*o*f-a*_*f-u*o*y+a*c*y)*b,t[3]=(p*c*s-u*d*s-p*o*f+a*d*f+u*o*g-a*c*g)*b,t[4]=M*b,t[5]=(h*_*s-m*d*s+m*o*g-n*_*g-h*o*y+n*d*y)*b,t[6]=(m*c*s-l*_*s-m*o*f+n*_*f+l*o*y-n*c*y)*b,t[7]=(l*d*s-h*c*s+h*o*f-n*d*f-l*o*g+n*c*g)*b,t[8]=S*b,t[9]=(m*p*s-h*v*s-m*a*g+n*v*g+h*a*y-n*p*y)*b,t[10]=(l*v*s-m*u*s+m*a*f-n*v*f-l*a*y+n*u*y)*b,t[11]=(h*u*s-l*p*s-h*a*f+n*p*f+l*a*g-n*u*g)*b,t[12]=w*b,t[13]=(h*v*o-m*p*o+m*a*d-n*v*d-h*a*_+n*p*_)*b,t[14]=(m*u*o-l*v*o-m*a*c+n*v*c+l*a*_-n*u*_)*b,t[15]=(l*p*o-h*u*o+h*a*c-n*p*c-l*a*d+n*u*d)*b,this},scale:function(r){var e=this.elements,t=r.x,i=r.y,n=r.z;return e[0]*=t,e[4]*=i,e[8]*=n,e[1]*=t,e[5]*=i,e[9]*=n,e[2]*=t,e[6]*=i,e[10]*=n,e[3]*=t,e[7]*=i,e[11]*=n,this},getMaxScaleOnAxis:function(){var r=this.elements,e=r[0]*r[0]+r[1]*r[1]+r[2]*r[2],t=r[4]*r[4]+r[5]*r[5]+r[6]*r[6],i=r[8]*r[8]+r[9]*r[9]+r[10]*r[10];return Math.sqrt(Math.max(e,t,i))},makeTranslation:function(r,e,t){return this.set(1,0,0,r,0,1,0,e,0,0,1,t,0,0,0,1),this},makeRotationX:function(r){var e=Math.cos(r),t=Math.sin(r);return this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this},makeRotationY:function(r){var e=Math.cos(r),t=Math.sin(r);return this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this},makeRotationZ:function(r){var e=Math.cos(r),t=Math.sin(r);return this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(r,e){var t=Math.cos(e),i=Math.sin(e),n=1-t,a=r.x,o=r.y,s=r.z,l=n*a,u=n*o;return this.set(l*a+t,l*o-i*s,l*s+i*o,0,l*o+i*s,u*o+t,u*s-i*a,0,l*s-i*o,u*s+i*a,n*s*s+t,0,0,0,0,1),this},makeScale:function(r,e,t){return this.set(r,0,0,0,0,e,0,0,0,0,t,0,0,0,0,1),this},makeShear:function(r,e,t){return this.set(1,e,t,0,r,1,t,0,r,e,1,0,0,0,0,1),this},compose:function(r,e,t){return this.makeRotationFromQuaternion(e),this.scale(t),this.setPosition(r),this},decompose:function(){var r,e;return function(i,n,a){r===void 0&&(r=new oe,e=new qt);var o=this.elements,s=r.set(o[0],o[1],o[2]).length(),l=r.set(o[4],o[5],o[6]).length(),u=r.set(o[8],o[9],o[10]).length(),c=this.determinant();c<0&&(s=-s),i.x=o[12],i.y=o[13],i.z=o[14],e.elements.set(this.elements);var f=1/s,h=1/l,p=1/u;return e.elements[0]*=f,e.elements[1]*=f,e.elements[2]*=f,e.elements[4]*=h,e.elements[5]*=h,e.elements[6]*=h,e.elements[8]*=p,e.elements[9]*=p,e.elements[10]*=p,n.setFromRotationMatrix(e),a.x=s,a.y=l,a.z=u,this}}(),makeFrustum:function(r,e,t,i,n,a){var o=this.elements,s=2*n/(e-r),l=2*n/(i-t),u=(e+r)/(e-r),c=(i+t)/(i-t),f=-(a+n)/(a-n),h=-2*a*n/(a-n);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=f,o[14]=h,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(r,e,t,i){var n=t*Math.tan(cr.DEG2RAD*r*.5),a=-n,o=a*e,s=n*e;return this.makeFrustum(o,s,a,n,t,i)},makeOrthographic:function(r,e,t,i,n,a){var o=this.elements,s=1/(e-r),l=1/(t-i),u=1/(a-n),c=(e+r)*s,f=(t+i)*l,h=(a+n)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-f,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-h,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(r){for(var e=this.elements,t=r.elements,i=0;i<16;i++)if(e[i]!==t[i])return!1;return!0},fromArray:function(r,e){e===void 0&&(e=0);for(var t=0;t<16;t++)this.elements[t]=r[t+e];return this},toArray:function(r,e){r===void 0&&(r=[]),e===void 0&&(e=0);var t=this.elements;return r[e]=t[0],r[e+1]=t[1],r[e+2]=t[2],r[e+3]=t[3],r[e+4]=t[4],r[e+5]=t[5],r[e+6]=t[6],r[e+7]=t[7],r[e+8]=t[8],r[e+9]=t[9],r[e+10]=t[10],r[e+11]=t[11],r[e+12]=t[12],r[e+13]=t[13],r[e+14]=t[14],r[e+15]=t[15],r}};_h.prototype=Object.create(ni.prototype);_h.prototype.constructor=_h;_h.prototype.isCubeTexture=!0;Object.defineProperty(_h.prototype,"images",{get:function(){return this.image},set:function(r){this.image=r}});Nne=new ni,Une=new _h;Lie=[],Pie=[];Vne.prototype.setValue=function(r,e){for(var t=this.seq,i=0,n=t.length;i!==n;++i){var a=t[i];a.setValue(r,e[a.id])}};nz=/([\w\d_]+)(\])?(\[|\.)?/g;xh.prototype.setValue=function(r,e,t){var i=this.map[e];i!==void 0&&i.setValue(r,t,this.renderer)};xh.prototype.set=function(r,e,t){var i=this.map[t];i!==void 0&&i.setValue(r,e[t],this.renderer)};xh.prototype.setOptional=function(r,e,t){var i=e[t];i!==void 0&&this.setValue(r,t,i)};xh.upload=function(r,e,t,i){for(var n=0,a=e.length;n!==a;++n){var o=e[n],s=t[o.id];s.needsUpdate!==!1&&o.setValue(r,s.value,i)}};xh.seqWithValue=function(r,e){for(var t=[],i=0,n=r.length;i!==n;++i){var a=r[i];a.id in e&&t.push(a)}return t};eo={merge:function(r){for(var e={},t=0;t<r.length;t++){var i=this.clone(r[t]);for(var n in i)e[n]=i[n]}return e},clone:function(r){var e={};for(var t in r){e[t]={};for(var i in r[t]){var n=r[t][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture)?e[t][i]=n.clone():Array.isArray(n)?e[t][i]=n.slice():e[t][i]=n}}return e}},EAe=`#ifdef USE_ALPHAMAP
  23. diffuseColor.a *= texture2D( alphaMap, vUv ).g;
  24. #endif
  25. `,AAe=`#ifdef USE_ALPHAMAP
  26. uniform sampler2D alphaMap;
  27. #endif
  28. `,CAe=`#ifdef ALPHATEST
  29. if ( diffuseColor.a < ALPHATEST ) discard;
  30. #endif
  31. `,RAe=`#ifdef USE_AOMAP
  32. float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
  33. reflectedLight.indirectDiffuse *= ambientOcclusion;
  34. #if defined( USE_ENVMAP ) && defined( PHYSICAL )
  35. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  36. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
  37. #endif
  38. #endif
  39. `,LAe=`#ifdef USE_AOMAP
  40. uniform sampler2D aoMap;
  41. uniform float aoMapIntensity;
  42. #endif`,PAe=`
  43. vec3 transformed = vec3( position );
  44. `,DAe=`
  45. vec3 objectNormal = vec3( normal );
  46. `,IAe=`float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  47. if( decayExponent > 0.0 ) {
  48. #if defined ( PHYSICALLY_CORRECT_LIGHTS )
  49. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  50. float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  51. return distanceFalloff * maxDistanceCutoffFactor;
  52. #else
  53. return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
  54. #endif
  55. }
  56. return 1.0;
  57. }
  58. vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
  59. return RECIPROCAL_PI * diffuseColor;
  60. }
  61. vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
  62. float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
  63. return ( 1.0 - specularColor ) * fresnel + specularColor;
  64. }
  65. float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
  66. float a2 = pow2( alpha );
  67. float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  68. float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  69. return 1.0 / ( gl * gv );
  70. }
  71. float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  72. float a2 = pow2( alpha );
  73. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  74. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  75. return 0.5 / max( gv + gl, EPSILON );
  76. }
  77. float D_GGX( const in float alpha, const in float dotNH ) {
  78. float a2 = pow2( alpha );
  79. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  80. return RECIPROCAL_PI * a2 / pow2( denom );
  81. }
  82. vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
  83. float alpha = pow2( roughness );
  84. vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
  85. float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );
  86. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  87. float dotNH = saturate( dot( geometry.normal, halfDir ) );
  88. float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
  89. vec3 F = F_Schlick( specularColor, dotLH );
  90. float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  91. float D = D_GGX( alpha, dotNH );
  92. return F * ( G * D );
  93. }
  94. vec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {
  95. const float LUT_SIZE = 64.0;
  96. const float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;
  97. const float LUT_BIAS = 0.5/LUT_SIZE;
  98. vec3 N = geometry.normal;
  99. vec3 V = geometry.viewDir;
  100. vec3 P = geometry.position;
  101. float theta = acos( dot( N, V ) );
  102. vec2 uv = vec2(
  103. sqrt( saturate( roughness ) ),
  104. saturate( theta / ( 0.5 * PI ) ) );
  105. uv = uv * LUT_SCALE + LUT_BIAS;
  106. return uv;
  107. }
  108. void clipQuadToHorizon( inout vec3 L[5], out int n ) {
  109. int config = 0;
  110. if ( L[0].z > 0.0 ) config += 1;
  111. if ( L[1].z > 0.0 ) config += 2;
  112. if ( L[2].z > 0.0 ) config += 4;
  113. if ( L[3].z > 0.0 ) config += 8;
  114. n = 0;
  115. if ( config == 0 ) {
  116. } else if ( config == 1 ) {
  117. n = 3;
  118. L[1] = -L[1].z * L[0] + L[0].z * L[1];
  119. L[2] = -L[3].z * L[0] + L[0].z * L[3];
  120. } else if ( config == 2 ) {
  121. n = 3;
  122. L[0] = -L[0].z * L[1] + L[1].z * L[0];
  123. L[2] = -L[2].z * L[1] + L[1].z * L[2];
  124. } else if ( config == 3 ) {
  125. n = 4;
  126. L[2] = -L[2].z * L[1] + L[1].z * L[2];
  127. L[3] = -L[3].z * L[0] + L[0].z * L[3];
  128. } else if ( config == 4 ) {
  129. n = 3;
  130. L[0] = -L[3].z * L[2] + L[2].z * L[3];
  131. L[1] = -L[1].z * L[2] + L[2].z * L[1];
  132. } else if ( config == 5 ) {
  133. n = 0;
  134. } else if ( config == 6 ) {
  135. n = 4;
  136. L[0] = -L[0].z * L[1] + L[1].z * L[0];
  137. L[3] = -L[3].z * L[2] + L[2].z * L[3];
  138. } else if ( config == 7 ) {
  139. n = 5;
  140. L[4] = -L[3].z * L[0] + L[0].z * L[3];
  141. L[3] = -L[3].z * L[2] + L[2].z * L[3];
  142. } else if ( config == 8 ) {
  143. n = 3;
  144. L[0] = -L[0].z * L[3] + L[3].z * L[0];
  145. L[1] = -L[2].z * L[3] + L[3].z * L[2];
  146. L[2] = L[3];
  147. } else if ( config == 9 ) {
  148. n = 4;
  149. L[1] = -L[1].z * L[0] + L[0].z * L[1];
  150. L[2] = -L[2].z * L[3] + L[3].z * L[2];
  151. } else if ( config == 10 ) {
  152. n = 0;
  153. } else if ( config == 11 ) {
  154. n = 5;
  155. L[4] = L[3];
  156. L[3] = -L[2].z * L[3] + L[3].z * L[2];
  157. L[2] = -L[2].z * L[1] + L[1].z * L[2];
  158. } else if ( config == 12 ) {
  159. n = 4;
  160. L[1] = -L[1].z * L[2] + L[2].z * L[1];
  161. L[0] = -L[0].z * L[3] + L[3].z * L[0];
  162. } else if ( config == 13 ) {
  163. n = 5;
  164. L[4] = L[3];
  165. L[3] = L[2];
  166. L[2] = -L[1].z * L[2] + L[2].z * L[1];
  167. L[1] = -L[1].z * L[0] + L[0].z * L[1];
  168. } else if ( config == 14 ) {
  169. n = 5;
  170. L[4] = -L[0].z * L[3] + L[3].z * L[0];
  171. L[0] = -L[0].z * L[1] + L[1].z * L[0];
  172. } else if ( config == 15 ) {
  173. n = 4;
  174. }
  175. if ( n == 3 )
  176. L[3] = L[0];
  177. if ( n == 4 )
  178. L[4] = L[0];
  179. }
  180. float integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {
  181. float cosTheta = dot( v1, v2 );
  182. float theta = acos( cosTheta );
  183. float res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );
  184. return res;
  185. }
  186. void initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {
  187. rectPoints[0] = pos - halfWidth - halfHeight;
  188. rectPoints[1] = pos + halfWidth - halfHeight;
  189. rectPoints[2] = pos + halfWidth + halfHeight;
  190. rectPoints[3] = pos - halfWidth + halfHeight;
  191. }
  192. vec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {
  193. vec3 N = geometry.normal;
  194. vec3 V = geometry.viewDir;
  195. vec3 P = geometry.position;
  196. vec3 T1, T2;
  197. T1 = normalize(V - N * dot( V, N ));
  198. T2 = - cross( N, T1 );
  199. mat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );
  200. vec3 clippedRect[5];
  201. clippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );
  202. clippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );
  203. clippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );
  204. clippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );
  205. int n;
  206. clipQuadToHorizon(clippedRect, n);
  207. if ( n == 0 )
  208. return vec3( 0, 0, 0 );
  209. clippedRect[0] = normalize( clippedRect[0] );
  210. clippedRect[1] = normalize( clippedRect[1] );
  211. clippedRect[2] = normalize( clippedRect[2] );
  212. clippedRect[3] = normalize( clippedRect[3] );
  213. clippedRect[4] = normalize( clippedRect[4] );
  214. float sum = 0.0;
  215. sum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );
  216. sum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );
  217. sum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );
  218. if (n >= 4)
  219. sum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );
  220. if (n == 5)
  221. sum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );
  222. sum = max( 0.0, sum );
  223. vec3 Lo_i = vec3( sum, sum, sum );
  224. return Lo_i;
  225. }
  226. vec3 Rect_Area_Light_Specular_Reflectance(
  227. const in GeometricContext geometry,
  228. const in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,
  229. const in float roughness,
  230. const in sampler2D ltcMat, const in sampler2D ltcMag ) {
  231. vec3 rectPoints[4];
  232. initRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );
  233. vec2 uv = ltcTextureCoords( geometry, roughness );
  234. vec4 brdfLtcApproxParams, t;
  235. brdfLtcApproxParams = texture2D( ltcMat, uv );
  236. t = texture2D( ltcMat, uv );
  237. float brdfLtcScalar = texture2D( ltcMag, uv ).a;
  238. mat3 brdfLtcApproxMat = mat3(
  239. vec3( 1, 0, t.y ),
  240. vec3( 0, t.z, 0 ),
  241. vec3( t.w, 0, t.x )
  242. );
  243. vec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );
  244. specularReflectance *= brdfLtcScalar;
  245. return specularReflectance;
  246. }
  247. vec3 Rect_Area_Light_Diffuse_Reflectance(
  248. const in GeometricContext geometry,
  249. const in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {
  250. vec3 rectPoints[4];
  251. initRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );
  252. mat3 diffuseBrdfMat = mat3(1);
  253. vec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );
  254. return diffuseReflectance;
  255. }
  256. vec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
  257. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  258. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  259. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  260. vec4 r = roughness * c0 + c1;
  261. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  262. vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
  263. return specularColor * AB.x + AB.y;
  264. }
  265. float G_BlinnPhong_Implicit( ) {
  266. return 0.25;
  267. }
  268. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  269. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  270. }
  271. vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
  272. vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
  273. float dotNH = saturate( dot( geometry.normal, halfDir ) );
  274. float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
  275. vec3 F = F_Schlick( specularColor, dotLH );
  276. float G = G_BlinnPhong_Implicit( );
  277. float D = D_BlinnPhong( shininess, dotNH );
  278. return F * ( G * D );
  279. }
  280. float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
  281. return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
  282. }
  283. float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
  284. return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
  285. }
  286. `,NAe=`#ifdef USE_BUMPMAP
  287. uniform sampler2D bumpMap;
  288. uniform float bumpScale;
  289. vec2 dHdxy_fwd() {
  290. vec2 dSTdx = dFdx( vUv );
  291. vec2 dSTdy = dFdy( vUv );
  292. float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
  293. float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
  294. float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
  295. return vec2( dBx, dBy );
  296. }
  297. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
  298. vec3 vSigmaX = dFdx( surf_pos );
  299. vec3 vSigmaY = dFdy( surf_pos );
  300. vec3 vN = surf_norm;
  301. vec3 R1 = cross( vSigmaY, vN );
  302. vec3 R2 = cross( vN, vSigmaX );
  303. float fDet = dot( vSigmaX, R1 );
  304. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  305. return normalize( abs( fDet ) * surf_norm - vGrad );
  306. }
  307. #endif
  308. `,UAe=`#if NUM_CLIPPING_PLANES > 0
  309. for ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {
  310. vec4 plane = clippingPlanes[ i ];
  311. if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;
  312. }
  313. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  314. bool clipped = true;
  315. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {
  316. vec4 plane = clippingPlanes[ i ];
  317. clipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;
  318. }
  319. if ( clipped ) discard;
  320. #endif
  321. #endif
  322. `,OAe=`#if NUM_CLIPPING_PLANES > 0
  323. #if ! defined( PHYSICAL ) && ! defined( PHONG )
  324. varying vec3 vViewPosition;
  325. #endif
  326. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  327. #endif
  328. `,FAe=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )
  329. varying vec3 vViewPosition;
  330. #endif
  331. `,zAe=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )
  332. vViewPosition = - mvPosition.xyz;
  333. #endif
  334. `,BAe=`#ifdef USE_COLOR
  335. diffuseColor.rgb *= vColor;
  336. #endif`,kAe=`#ifdef USE_COLOR
  337. varying vec3 vColor;
  338. #endif
  339. `,VAe=`#ifdef USE_COLOR
  340. varying vec3 vColor;
  341. #endif`,GAe=`#ifdef USE_COLOR
  342. vColor.xyz = color.xyz;
  343. #endif`,HAe=`#define PI 3.14159265359
  344. #define PI2 6.28318530718
  345. #define PI_HALF 1.5707963267949
  346. #define RECIPROCAL_PI 0.31830988618
  347. #define RECIPROCAL_PI2 0.15915494
  348. #define LOG2 1.442695
  349. #define EPSILON 1e-6
  350. #define saturate(a) clamp( a, 0.0, 1.0 )
  351. #define whiteCompliment(a) ( 1.0 - saturate( a ) )
  352. float pow2( const in float x ) { return x*x; }
  353. float pow3( const in float x ) { return x*x*x; }
  354. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  355. float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
  356. highp float rand( const in vec2 uv ) {
  357. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  358. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  359. return fract(sin(sn) * c);
  360. }
  361. struct IncidentLight {
  362. vec3 color;
  363. vec3 direction;
  364. bool visible;
  365. };
  366. struct ReflectedLight {
  367. vec3 directDiffuse;
  368. vec3 directSpecular;
  369. vec3 indirectDiffuse;
  370. vec3 indirectSpecular;
  371. };
  372. struct GeometricContext {
  373. vec3 position;
  374. vec3 normal;
  375. vec3 viewDir;
  376. };
  377. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  378. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  379. }
  380. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  381. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  382. }
  383. vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
  384. float distance = dot( planeNormal, point - pointOnPlane );
  385. return - distance * planeNormal + point;
  386. }
  387. float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
  388. return sign( dot( point - pointOnPlane, planeNormal ) );
  389. }
  390. vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
  391. return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
  392. }
  393. mat3 transpose( const in mat3 v ) {
  394. mat3 tmp;
  395. tmp[0] = vec3(v[0].x, v[1].x, v[2].x);
  396. tmp[1] = vec3(v[0].y, v[1].y, v[2].y);
  397. tmp[2] = vec3(v[0].z, v[1].z, v[2].z);
  398. return tmp;
  399. }
  400. `,WAe=`#ifdef ENVMAP_TYPE_CUBE_UV
  401. #define cubeUV_textureSize (1024.0)
  402. int getFaceFromDirection(vec3 direction) {
  403. vec3 absDirection = abs(direction);
  404. int face = -1;
  405. if( absDirection.x > absDirection.z ) {
  406. if(absDirection.x > absDirection.y )
  407. face = direction.x > 0.0 ? 0 : 3;
  408. else
  409. face = direction.y > 0.0 ? 1 : 4;
  410. }
  411. else {
  412. if(absDirection.z > absDirection.y )
  413. face = direction.z > 0.0 ? 2 : 5;
  414. else
  415. face = direction.y > 0.0 ? 1 : 4;
  416. }
  417. return face;
  418. }
  419. #define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)
  420. #define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))
  421. vec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {
  422. float scale = exp2(cubeUV_maxLods1 - roughnessLevel);
  423. float dxRoughness = dFdx(roughness);
  424. float dyRoughness = dFdy(roughness);
  425. vec3 dx = dFdx( vec * scale * dxRoughness );
  426. vec3 dy = dFdy( vec * scale * dyRoughness );
  427. float d = max( dot( dx, dx ), dot( dy, dy ) );
  428. d = clamp(d, 1.0, cubeUV_rangeClamp);
  429. float mipLevel = 0.5 * log2(d);
  430. return vec2(floor(mipLevel), fract(mipLevel));
  431. }
  432. #define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)
  433. #define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)
  434. vec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {
  435. mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;
  436. float a = 16.0 * cubeUV_rcpTextureSize;
  437. vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );
  438. vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;
  439. float powScale = exp2_packed.x * exp2_packed.y;
  440. float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;
  441. float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;
  442. bool bRes = mipLevel == 0.0;
  443. scale = bRes && (scale < a) ? a : scale;
  444. vec3 r;
  445. vec2 offset;
  446. int face = getFaceFromDirection(direction);
  447. float rcpPowScale = 1.0 / powScale;
  448. if( face == 0) {
  449. r = vec3(direction.x, -direction.z, direction.y);
  450. offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);
  451. offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
  452. }
  453. else if( face == 1) {
  454. r = vec3(direction.y, direction.x, direction.z);
  455. offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);
  456. offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
  457. }
  458. else if( face == 2) {
  459. r = vec3(direction.z, direction.x, direction.y);
  460. offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);
  461. offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
  462. }
  463. else if( face == 3) {
  464. r = vec3(direction.x, direction.z, direction.y);
  465. offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);
  466. offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
  467. }
  468. else if( face == 4) {
  469. r = vec3(direction.y, direction.x, -direction.z);
  470. offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);
  471. offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
  472. }
  473. else {
  474. r = vec3(direction.z, -direction.x, direction.y);
  475. offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);
  476. offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
  477. }
  478. r = normalize(r);
  479. float texelOffset = 0.5 * cubeUV_rcpTextureSize;
  480. vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;
  481. vec2 base = offset + vec2( texelOffset );
  482. return base + s * ( scale - 2.0 * texelOffset );
  483. }
  484. #define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)
  485. vec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {
  486. float roughnessVal = roughness* cubeUV_maxLods3;
  487. float r1 = floor(roughnessVal);
  488. float r2 = r1 + 1.0;
  489. float t = fract(roughnessVal);
  490. vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);
  491. float s = mipInfo.y;
  492. float level0 = mipInfo.x;
  493. float level1 = level0 + 1.0;
  494. level1 = level1 > 5.0 ? 5.0 : level1;
  495. level0 += min( floor( s + 0.5 ), 5.0 );
  496. vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);
  497. vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));
  498. vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);
  499. vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));
  500. vec4 result = mix(color10, color20, t);
  501. return vec4(result.rgb, 1.0);
  502. }
  503. #endif
  504. `,XAe=`#ifdef FLIP_SIDED
  505. objectNormal = -objectNormal;
  506. #endif
  507. vec3 transformedNormal = normalMatrix * objectNormal;
  508. `,YAe=`#ifdef USE_DISPLACEMENTMAP
  509. uniform sampler2D displacementMap;
  510. uniform float displacementScale;
  511. uniform float displacementBias;
  512. #endif
  513. `,qAe=`#ifdef USE_DISPLACEMENTMAP
  514. transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );
  515. #endif
  516. `,ZAe=`#ifdef USE_EMISSIVEMAP
  517. vec4 emissiveColor = texture2D( emissiveMap, vUv );
  518. emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
  519. totalEmissiveRadiance *= emissiveColor.rgb;
  520. #endif
  521. `,jAe=`#ifdef USE_EMISSIVEMAP
  522. uniform sampler2D emissiveMap;
  523. #endif
  524. `,KAe=` gl_FragColor = linearToOutputTexel( gl_FragColor );
  525. `,JAe=`
  526. vec4 LinearToLinear( in vec4 value ) {
  527. return value;
  528. }
  529. vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
  530. return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );
  531. }
  532. vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
  533. return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );
  534. }
  535. vec4 sRGBToLinear( in vec4 value ) {
  536. return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );
  537. }
  538. vec4 LinearTosRGB( in vec4 value ) {
  539. return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );
  540. }
  541. vec4 RGBEToLinear( in vec4 value ) {
  542. return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
  543. }
  544. vec4 LinearToRGBE( in vec4 value ) {
  545. float maxComponent = max( max( value.r, value.g ), value.b );
  546. float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
  547. return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
  548. }
  549. vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
  550. return vec4( value.xyz * value.w * maxRange, 1.0 );
  551. }
  552. vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
  553. float maxRGB = max( value.x, max( value.g, value.b ) );
  554. float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
  555. M = ceil( M * 255.0 ) / 255.0;
  556. return vec4( value.rgb / ( M * maxRange ), M );
  557. }
  558. vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
  559. return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
  560. }
  561. vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
  562. float maxRGB = max( value.x, max( value.g, value.b ) );
  563. float D = max( maxRange / maxRGB, 1.0 );
  564. D = min( floor( D ) / 255.0, 1.0 );
  565. return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
  566. }
  567. const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
  568. vec4 LinearToLogLuv( in vec4 value ) {
  569. vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;
  570. Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));
  571. vec4 vResult;
  572. vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
  573. float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
  574. vResult.w = fract(Le);
  575. vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;
  576. return vResult;
  577. }
  578. const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
  579. vec4 LogLuvToLinear( in vec4 value ) {
  580. float Le = value.z * 255.0 + value.w;
  581. vec3 Xp_Y_XYZp;
  582. Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);
  583. Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
  584. Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
  585. vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;
  586. return vec4( max(vRGB, 0.0), 1.0 );
  587. }
  588. `,$Ae=`#ifdef USE_ENVMAP
  589. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
  590. vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );
  591. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  592. #ifdef ENVMAP_MODE_REFLECTION
  593. vec3 reflectVec = reflect( cameraToVertex, worldNormal );
  594. #else
  595. vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );
  596. #endif
  597. #else
  598. vec3 reflectVec = vReflect;
  599. #endif
  600. #ifdef ENVMAP_TYPE_CUBE
  601. vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  602. #elif defined( ENVMAP_TYPE_EQUIREC )
  603. vec2 sampleUV;
  604. sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
  605. sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
  606. vec4 envColor = texture2D( envMap, sampleUV );
  607. #elif defined( ENVMAP_TYPE_SPHERE )
  608. vec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );
  609. vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
  610. #else
  611. vec4 envColor = vec4( 0.0 );
  612. #endif
  613. envColor = envMapTexelToLinear( envColor );
  614. #ifdef ENVMAP_BLENDING_MULTIPLY
  615. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  616. #elif defined( ENVMAP_BLENDING_MIX )
  617. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  618. #elif defined( ENVMAP_BLENDING_ADD )
  619. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  620. #endif
  621. #endif
  622. `,QAe=`#if defined( USE_ENVMAP ) || defined( PHYSICAL )
  623. uniform float reflectivity;
  624. uniform float envMapIntensity;
  625. #endif
  626. #ifdef USE_ENVMAP
  627. #if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )
  628. varying vec3 vWorldPosition;
  629. #endif
  630. #ifdef ENVMAP_TYPE_CUBE
  631. uniform samplerCube envMap;
  632. #else
  633. uniform sampler2D envMap;
  634. #endif
  635. uniform float flipEnvMap;
  636. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )
  637. uniform float refractionRatio;
  638. #else
  639. varying vec3 vReflect;
  640. #endif
  641. #endif
  642. `,eCe=`#ifdef USE_ENVMAP
  643. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
  644. varying vec3 vWorldPosition;
  645. #else
  646. varying vec3 vReflect;
  647. uniform float refractionRatio;
  648. #endif
  649. #endif
  650. `,tCe=`#ifdef USE_ENVMAP
  651. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
  652. vWorldPosition = worldPosition.xyz;
  653. #else
  654. vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  655. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  656. #ifdef ENVMAP_MODE_REFLECTION
  657. vReflect = reflect( cameraToVertex, worldNormal );
  658. #else
  659. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  660. #endif
  661. #endif
  662. #endif
  663. `,rCe=`#ifdef USE_FOG
  664. #ifdef USE_LOGDEPTHBUF_EXT
  665. float depth = gl_FragDepthEXT / gl_FragCoord.w;
  666. #else
  667. float depth = gl_FragCoord.z / gl_FragCoord.w;
  668. #endif
  669. #ifdef FOG_EXP2
  670. float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );
  671. #else
  672. float fogFactor = smoothstep( fogNear, fogFar, depth );
  673. #endif
  674. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  675. #endif
  676. `,iCe=`#ifdef USE_FOG
  677. uniform vec3 fogColor;
  678. #ifdef FOG_EXP2
  679. uniform float fogDensity;
  680. #else
  681. uniform float fogNear;
  682. uniform float fogFar;
  683. #endif
  684. #endif`,nCe=`#ifdef TOON
  685. uniform sampler2D gradientMap;
  686. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  687. float dotNL = dot( normal, lightDirection );
  688. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  689. #ifdef USE_GRADIENTMAP
  690. return texture2D( gradientMap, coord ).rgb;
  691. #else
  692. return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
  693. #endif
  694. }
  695. #endif
  696. `,aCe=`#ifdef USE_LIGHTMAP
  697. reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
  698. #endif
  699. `,oCe=`#ifdef USE_LIGHTMAP
  700. uniform sampler2D lightMap;
  701. uniform float lightMapIntensity;
  702. #endif`,sCe=`vec3 diffuse = vec3( 1.0 );
  703. GeometricContext geometry;
  704. geometry.position = mvPosition.xyz;
  705. geometry.normal = normalize( transformedNormal );
  706. geometry.viewDir = normalize( -mvPosition.xyz );
  707. GeometricContext backGeometry;
  708. backGeometry.position = geometry.position;
  709. backGeometry.normal = -geometry.normal;
  710. backGeometry.viewDir = geometry.viewDir;
  711. vLightFront = vec3( 0.0 );
  712. #ifdef DOUBLE_SIDED
  713. vLightBack = vec3( 0.0 );
  714. #endif
  715. IncidentLight directLight;
  716. float dotNL;
  717. vec3 directLightColor_Diffuse;
  718. #if NUM_POINT_LIGHTS > 0
  719. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  720. getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
  721. dotNL = dot( geometry.normal, directLight.direction );
  722. directLightColor_Diffuse = PI * directLight.color;
  723. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  724. #ifdef DOUBLE_SIDED
  725. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  726. #endif
  727. }
  728. #endif
  729. #if NUM_SPOT_LIGHTS > 0
  730. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  731. getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
  732. dotNL = dot( geometry.normal, directLight.direction );
  733. directLightColor_Diffuse = PI * directLight.color;
  734. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  735. #ifdef DOUBLE_SIDED
  736. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  737. #endif
  738. }
  739. #endif
  740. #if NUM_RECT_AREA_LIGHTS > 0
  741. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  742. }
  743. #endif
  744. #if NUM_DIR_LIGHTS > 0
  745. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  746. getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
  747. dotNL = dot( geometry.normal, directLight.direction );
  748. directLightColor_Diffuse = PI * directLight.color;
  749. vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
  750. #ifdef DOUBLE_SIDED
  751. vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
  752. #endif
  753. }
  754. #endif
  755. #if NUM_HEMI_LIGHTS > 0
  756. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  757. vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
  758. #ifdef DOUBLE_SIDED
  759. vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
  760. #endif
  761. }
  762. #endif
  763. `,lCe=`uniform vec3 ambientLightColor;
  764. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  765. vec3 irradiance = ambientLightColor;
  766. #ifndef PHYSICALLY_CORRECT_LIGHTS
  767. irradiance *= PI;
  768. #endif
  769. return irradiance;
  770. }
  771. #if NUM_DIR_LIGHTS > 0
  772. struct DirectionalLight {
  773. vec3 direction;
  774. vec3 color;
  775. int shadow;
  776. float shadowBias;
  777. float shadowRadius;
  778. vec2 shadowMapSize;
  779. };
  780. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  781. void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  782. directLight.color = directionalLight.color;
  783. directLight.direction = directionalLight.direction;
  784. directLight.visible = true;
  785. }
  786. #endif
  787. #if NUM_POINT_LIGHTS > 0
  788. struct PointLight {
  789. vec3 position;
  790. vec3 color;
  791. float distance;
  792. float decay;
  793. int shadow;
  794. float shadowBias;
  795. float shadowRadius;
  796. vec2 shadowMapSize;
  797. };
  798. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  799. void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  800. vec3 lVector = pointLight.position - geometry.position;
  801. directLight.direction = normalize( lVector );
  802. float lightDistance = length( lVector );
  803. directLight.color = pointLight.color;
  804. directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
  805. directLight.visible = ( directLight.color != vec3( 0.0 ) );
  806. }
  807. #endif
  808. #if NUM_SPOT_LIGHTS > 0
  809. struct SpotLight {
  810. vec3 position;
  811. vec3 direction;
  812. vec3 color;
  813. float distance;
  814. float decay;
  815. float coneCos;
  816. float penumbraCos;
  817. int shadow;
  818. float shadowBias;
  819. float shadowRadius;
  820. vec2 shadowMapSize;
  821. };
  822. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  823. void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
  824. vec3 lVector = spotLight.position - geometry.position;
  825. directLight.direction = normalize( lVector );
  826. float lightDistance = length( lVector );
  827. float angleCos = dot( directLight.direction, spotLight.direction );
  828. if ( angleCos > spotLight.coneCos ) {
  829. float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  830. directLight.color = spotLight.color;
  831. directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
  832. directLight.visible = true;
  833. } else {
  834. directLight.color = vec3( 0.0 );
  835. directLight.visible = false;
  836. }
  837. }
  838. #endif
  839. #if NUM_RECT_AREA_LIGHTS > 0
  840. struct RectAreaLight {
  841. vec3 color;
  842. vec3 position;
  843. vec3 halfWidth;
  844. vec3 halfHeight;
  845. };
  846. uniform sampler2D ltcMat; uniform sampler2D ltcMag;
  847. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  848. #endif
  849. #if NUM_HEMI_LIGHTS > 0
  850. struct HemisphereLight {
  851. vec3 direction;
  852. vec3 skyColor;
  853. vec3 groundColor;
  854. };
  855. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  856. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
  857. float dotNL = dot( geometry.normal, hemiLight.direction );
  858. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  859. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  860. #ifndef PHYSICALLY_CORRECT_LIGHTS
  861. irradiance *= PI;
  862. #endif
  863. return irradiance;
  864. }
  865. #endif
  866. #if defined( USE_ENVMAP ) && defined( PHYSICAL )
  867. vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
  868. vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
  869. #ifdef ENVMAP_TYPE_CUBE
  870. vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
  871. #ifdef TEXTURE_LOD_EXT
  872. vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
  873. #else
  874. vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
  875. #endif
  876. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  877. #elif defined( ENVMAP_TYPE_CUBE_UV )
  878. vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
  879. vec4 envMapColor = textureCubeUV( queryVec, 1.0 );
  880. #else
  881. vec4 envMapColor = vec4( 0.0 );
  882. #endif
  883. return PI * envMapColor.rgb * envMapIntensity;
  884. }
  885. float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {
  886. float maxMIPLevelScalar = float( maxMIPLevel );
  887. float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );
  888. return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
  889. }
  890. vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {
  891. #ifdef ENVMAP_MODE_REFLECTION
  892. vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );
  893. #else
  894. vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );
  895. #endif
  896. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  897. float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );
  898. #ifdef ENVMAP_TYPE_CUBE
  899. vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
  900. #ifdef TEXTURE_LOD_EXT
  901. vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
  902. #else
  903. vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
  904. #endif
  905. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  906. #elif defined( ENVMAP_TYPE_CUBE_UV )
  907. vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
  908. vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));
  909. #elif defined( ENVMAP_TYPE_EQUIREC )
  910. vec2 sampleUV;
  911. sampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );
  912. sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
  913. #ifdef TEXTURE_LOD_EXT
  914. vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );
  915. #else
  916. vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );
  917. #endif
  918. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  919. #elif defined( ENVMAP_TYPE_SPHERE )
  920. vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );
  921. #ifdef TEXTURE_LOD_EXT
  922. vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
  923. #else
  924. vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
  925. #endif
  926. envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
  927. #endif
  928. return envMapColor.rgb * envMapIntensity;
  929. }
  930. #endif
  931. `,uCe=`BlinnPhongMaterial material;
  932. material.diffuseColor = diffuseColor.rgb;
  933. material.specularColor = specular;
  934. material.specularShininess = shininess;
  935. material.specularStrength = specularStrength;
  936. `,cCe=`varying vec3 vViewPosition;
  937. #ifndef FLAT_SHADED
  938. varying vec3 vNormal;
  939. #endif
  940. struct BlinnPhongMaterial {
  941. vec3 diffuseColor;
  942. vec3 specularColor;
  943. float specularShininess;
  944. float specularStrength;
  945. };
  946. #if NUM_RECT_AREA_LIGHTS > 0
  947. void RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  948. vec3 matDiffColor = material.diffuseColor;
  949. vec3 matSpecColor = material.specularColor;
  950. vec3 lightColor = rectAreaLight.color;
  951. float roughness = BlinnExponentToGGXRoughness( material.specularShininess );
  952. vec3 spec = Rect_Area_Light_Specular_Reflectance(
  953. geometry,
  954. rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,
  955. roughness,
  956. ltcMat, ltcMag );
  957. vec3 diff = Rect_Area_Light_Diffuse_Reflectance(
  958. geometry,
  959. rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );
  960. reflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;
  961. reflectedLight.directDiffuse += lightColor * matDiffColor * diff / PI2;
  962. }
  963. #endif
  964. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  965. #ifdef TOON
  966. vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
  967. #else
  968. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  969. vec3 irradiance = dotNL * directLight.color;
  970. #endif
  971. #ifndef PHYSICALLY_CORRECT_LIGHTS
  972. irradiance *= PI;
  973. #endif
  974. reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  975. reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
  976. }
  977. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  978. reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  979. }
  980. #define RE_Direct RE_Direct_BlinnPhong
  981. #define RE_Direct_RectArea RE_Direct_RectArea_BlinnPhong
  982. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
  983. #define Material_LightProbeLOD( material ) (0)
  984. `,fCe=`PhysicalMaterial material;
  985. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  986. material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );
  987. #ifdef STANDARD
  988. material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
  989. #else
  990. material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
  991. material.clearCoat = saturate( clearCoat ); material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );
  992. #endif
  993. `,hCe=`struct PhysicalMaterial {
  994. vec3 diffuseColor;
  995. float specularRoughness;
  996. vec3 specularColor;
  997. #ifndef STANDARD
  998. float clearCoat;
  999. float clearCoatRoughness;
  1000. #endif
  1001. };
  1002. #define MAXIMUM_SPECULAR_COEFFICIENT 0.16
  1003. #define DEFAULT_SPECULAR_COEFFICIENT 0.04
  1004. float clearCoatDHRApprox( const in float roughness, const in float dotNL ) {
  1005. return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
  1006. }
  1007. #if NUM_RECT_AREA_LIGHTS > 0
  1008. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1009. vec3 matDiffColor = material.diffuseColor;
  1010. vec3 matSpecColor = material.specularColor;
  1011. vec3 lightColor = rectAreaLight.color;
  1012. float roughness = material.specularRoughness;
  1013. vec3 spec = Rect_Area_Light_Specular_Reflectance(
  1014. geometry,
  1015. rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,
  1016. roughness,
  1017. ltcMat, ltcMag );
  1018. vec3 diff = Rect_Area_Light_Diffuse_Reflectance(
  1019. geometry,
  1020. rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );
  1021. reflectedLight.directSpecular += lightColor * matSpecColor * spec;
  1022. reflectedLight.directDiffuse += lightColor * matDiffColor * diff;
  1023. }
  1024. #endif
  1025. void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1026. float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
  1027. vec3 irradiance = dotNL * directLight.color;
  1028. #ifndef PHYSICALLY_CORRECT_LIGHTS
  1029. irradiance *= PI;
  1030. #endif
  1031. #ifndef STANDARD
  1032. float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );
  1033. #else
  1034. float clearCoatDHR = 0.0;
  1035. #endif
  1036. reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );
  1037. reflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  1038. #ifndef STANDARD
  1039. reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
  1040. #endif
  1041. }
  1042. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1043. reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
  1044. }
  1045. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1046. #ifndef STANDARD
  1047. float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
  1048. float dotNL = dotNV;
  1049. float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );
  1050. #else
  1051. float clearCoatDHR = 0.0;
  1052. #endif
  1053. reflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );
  1054. #ifndef STANDARD
  1055. reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
  1056. #endif
  1057. }
  1058. #define RE_Direct RE_Direct_Physical
  1059. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  1060. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  1061. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  1062. #define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )
  1063. #define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )
  1064. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  1065. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  1066. }
  1067. `,pCe=`
  1068. GeometricContext geometry;
  1069. geometry.position = - vViewPosition;
  1070. geometry.normal = normal;
  1071. geometry.viewDir = normalize( vViewPosition );
  1072. IncidentLight directLight;
  1073. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  1074. PointLight pointLight;
  1075. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1076. pointLight = pointLights[ i ];
  1077. getPointDirectLightIrradiance( pointLight, geometry, directLight );
  1078. #ifdef USE_SHADOWMAP
  1079. directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;
  1080. #endif
  1081. RE_Direct( directLight, geometry, material, reflectedLight );
  1082. }
  1083. #endif
  1084. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  1085. SpotLight spotLight;
  1086. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1087. spotLight = spotLights[ i ];
  1088. getSpotDirectLightIrradiance( spotLight, geometry, directLight );
  1089. #ifdef USE_SHADOWMAP
  1090. directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
  1091. #endif
  1092. RE_Direct( directLight, geometry, material, reflectedLight );
  1093. }
  1094. #endif
  1095. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  1096. DirectionalLight directionalLight;
  1097. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1098. directionalLight = directionalLights[ i ];
  1099. getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
  1100. #ifdef USE_SHADOWMAP
  1101. directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1102. #endif
  1103. RE_Direct( directLight, geometry, material, reflectedLight );
  1104. }
  1105. #endif
  1106. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  1107. RectAreaLight rectAreaLight;
  1108. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  1109. rectAreaLight = rectAreaLights[ i ];
  1110. RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
  1111. }
  1112. #endif
  1113. #if defined( RE_IndirectDiffuse )
  1114. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  1115. #ifdef USE_LIGHTMAP
  1116. vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
  1117. #ifndef PHYSICALLY_CORRECT_LIGHTS
  1118. lightMapIrradiance *= PI;
  1119. #endif
  1120. irradiance += lightMapIrradiance;
  1121. #endif
  1122. #if ( NUM_HEMI_LIGHTS > 0 )
  1123. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  1124. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
  1125. }
  1126. #endif
  1127. #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )
  1128. irradiance += getLightProbeIndirectIrradiance( geometry, 8 );
  1129. #endif
  1130. RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
  1131. #endif
  1132. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  1133. vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );
  1134. #ifndef STANDARD
  1135. vec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );
  1136. #else
  1137. vec3 clearCoatRadiance = vec3( 0.0 );
  1138. #endif
  1139. RE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );
  1140. #endif
  1141. `,dCe=`#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)
  1142. gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;
  1143. #endif`,mCe=`#ifdef USE_LOGDEPTHBUF
  1144. uniform float logDepthBufFC;
  1145. #ifdef USE_LOGDEPTHBUF_EXT
  1146. varying float vFragDepth;
  1147. #endif
  1148. #endif
  1149. `,vCe=`#ifdef USE_LOGDEPTHBUF
  1150. #ifdef USE_LOGDEPTHBUF_EXT
  1151. varying float vFragDepth;
  1152. #endif
  1153. uniform float logDepthBufFC;
  1154. #endif`,gCe=`#ifdef USE_LOGDEPTHBUF
  1155. gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
  1156. #ifdef USE_LOGDEPTHBUF_EXT
  1157. vFragDepth = 1.0 + gl_Position.w;
  1158. #else
  1159. gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;
  1160. #endif
  1161. #endif
  1162. `,yCe=`#ifdef USE_MAP
  1163. vec4 texelColor = texture2D( map, vUv );
  1164. texelColor = mapTexelToLinear( texelColor );
  1165. diffuseColor *= texelColor;
  1166. #endif
  1167. `,_Ce=`#ifdef USE_MAP
  1168. uniform sampler2D map;
  1169. #endif
  1170. `,xCe=`#ifdef USE_MAP
  1171. vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );
  1172. diffuseColor *= mapTexelToLinear( mapTexel );
  1173. #endif
  1174. `,SCe=`#ifdef USE_MAP
  1175. uniform vec4 offsetRepeat;
  1176. uniform sampler2D map;
  1177. #endif
  1178. `,MCe=`float metalnessFactor = metalness;
  1179. #ifdef USE_METALNESSMAP
  1180. vec4 texelMetalness = texture2D( metalnessMap, vUv );
  1181. metalnessFactor *= texelMetalness.r;
  1182. #endif
  1183. `,bCe=`#ifdef USE_METALNESSMAP
  1184. uniform sampler2D metalnessMap;
  1185. #endif`,wCe=`#ifdef USE_MORPHNORMALS
  1186. objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
  1187. objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
  1188. objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
  1189. objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
  1190. #endif
  1191. `,TCe=`#ifdef USE_MORPHTARGETS
  1192. #ifndef USE_MORPHNORMALS
  1193. uniform float morphTargetInfluences[ 8 ];
  1194. #else
  1195. uniform float morphTargetInfluences[ 4 ];
  1196. #endif
  1197. #endif`,ECe=`#ifdef USE_MORPHTARGETS
  1198. transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
  1199. transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
  1200. transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
  1201. transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
  1202. #ifndef USE_MORPHNORMALS
  1203. transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
  1204. transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
  1205. transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
  1206. transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
  1207. #endif
  1208. #endif
  1209. `,ACe=`#ifdef DOUBLE_SIDED
  1210. float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  1211. #else
  1212. float flipNormal = 1.0;
  1213. #endif
  1214. `,CCe=`#ifdef FLAT_SHADED
  1215. vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
  1216. vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
  1217. vec3 normal = normalize( cross( fdx, fdy ) );
  1218. #else
  1219. vec3 normal = normalize( vNormal ) * flipNormal;
  1220. #endif
  1221. #ifdef USE_NORMALMAP
  1222. normal = perturbNormal2Arb( -vViewPosition, normal );
  1223. #elif defined( USE_BUMPMAP )
  1224. normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
  1225. #endif
  1226. `,RCe=`#ifdef USE_NORMALMAP
  1227. uniform sampler2D normalMap;
  1228. uniform vec2 normalScale;
  1229. vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {
  1230. vec3 q0 = dFdx( eye_pos.xyz );
  1231. vec3 q1 = dFdy( eye_pos.xyz );
  1232. vec2 st0 = dFdx( vUv.st );
  1233. vec2 st1 = dFdy( vUv.st );
  1234. vec3 S = normalize( q0 * st1.t - q1 * st0.t );
  1235. vec3 T = normalize( -q0 * st1.s + q1 * st0.s );
  1236. vec3 N = normalize( surf_norm );
  1237. vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
  1238. mapN.xy = normalScale * mapN.xy;
  1239. mat3 tsn = mat3( S, T, N );
  1240. return normalize( tsn * mapN );
  1241. }
  1242. #endif
  1243. `,LCe=`vec3 packNormalToRGB( const in vec3 normal ) {
  1244. return normalize( normal ) * 0.5 + 0.5;
  1245. }
  1246. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  1247. return 1.0 - 2.0 * rgb.xyz;
  1248. }
  1249. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
  1250. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  1251. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  1252. const float ShiftRight8 = 1. / 256.;
  1253. vec4 packDepthToRGBA( const in float v ) {
  1254. vec4 r = vec4( fract( v * PackFactors ), v );
  1255. r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
  1256. }
  1257. float unpackRGBAToDepth( const in vec4 v ) {
  1258. return dot( v, UnpackFactors );
  1259. }
  1260. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  1261. return ( viewZ + near ) / ( near - far );
  1262. }
  1263. float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
  1264. return linearClipZ * ( near - far ) - near;
  1265. }
  1266. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  1267. return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
  1268. }
  1269. float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
  1270. return ( near * far ) / ( ( far - near ) * invClipZ - far );
  1271. }
  1272. `,PCe=`#ifdef PREMULTIPLIED_ALPHA
  1273. gl_FragColor.rgb *= gl_FragColor.a;
  1274. #endif
  1275. `,DCe=`#ifdef USE_SKINNING
  1276. vec4 mvPosition = modelViewMatrix * skinned;
  1277. #else
  1278. vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
  1279. #endif
  1280. gl_Position = projectionMatrix * mvPosition;
  1281. `,ICe=`float roughnessFactor = roughness;
  1282. #ifdef USE_ROUGHNESSMAP
  1283. vec4 texelRoughness = texture2D( roughnessMap, vUv );
  1284. roughnessFactor *= texelRoughness.r;
  1285. #endif
  1286. `,NCe=`#ifdef USE_ROUGHNESSMAP
  1287. uniform sampler2D roughnessMap;
  1288. #endif`,UCe=`#ifdef USE_SHADOWMAP
  1289. #if NUM_DIR_LIGHTS > 0
  1290. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];
  1291. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];
  1292. #endif
  1293. #if NUM_SPOT_LIGHTS > 0
  1294. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];
  1295. varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];
  1296. #endif
  1297. #if NUM_POINT_LIGHTS > 0
  1298. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];
  1299. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];
  1300. #endif
  1301. #if NUM_RECT_AREA_LIGHTS > 0
  1302. #endif
  1303. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  1304. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  1305. }
  1306. float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {
  1307. const vec2 offset = vec2( 0.0, 1.0 );
  1308. vec2 texelSize = vec2( 1.0 ) / size;
  1309. vec2 centroidUV = floor( uv * size + 0.5 ) / size;
  1310. float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );
  1311. float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );
  1312. float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );
  1313. float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );
  1314. vec2 f = fract( uv * size + 0.5 );
  1315. float a = mix( lb, lt, f.y );
  1316. float b = mix( rb, rt, f.y );
  1317. float c = mix( a, b, f.x );
  1318. return c;
  1319. }
  1320. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  1321. shadowCoord.xyz /= shadowCoord.w;
  1322. shadowCoord.z += shadowBias;
  1323. bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
  1324. bool inFrustum = all( inFrustumVec );
  1325. bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
  1326. bool frustumTest = all( frustumTestVec );
  1327. if ( frustumTest ) {
  1328. #if defined( SHADOWMAP_TYPE_PCF )
  1329. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1330. float dx0 = - texelSize.x * shadowRadius;
  1331. float dy0 = - texelSize.y * shadowRadius;
  1332. float dx1 = + texelSize.x * shadowRadius;
  1333. float dy1 = + texelSize.y * shadowRadius;
  1334. return (
  1335. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  1336. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  1337. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  1338. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  1339. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  1340. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  1341. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  1342. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  1343. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  1344. ) * ( 1.0 / 9.0 );
  1345. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  1346. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1347. float dx0 = - texelSize.x * shadowRadius;
  1348. float dy0 = - texelSize.y * shadowRadius;
  1349. float dx1 = + texelSize.x * shadowRadius;
  1350. float dy1 = + texelSize.y * shadowRadius;
  1351. return (
  1352. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  1353. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  1354. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  1355. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  1356. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +
  1357. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  1358. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  1359. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  1360. texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  1361. ) * ( 1.0 / 9.0 );
  1362. #else
  1363. return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  1364. #endif
  1365. }
  1366. return 1.0;
  1367. }
  1368. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  1369. vec3 absV = abs( v );
  1370. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  1371. absV *= scaleToCube;
  1372. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  1373. vec2 planar = v.xy;
  1374. float almostATexel = 1.5 * texelSizeY;
  1375. float almostOne = 1.0 - almostATexel;
  1376. if ( absV.z >= almostOne ) {
  1377. if ( v.z > 0.0 )
  1378. planar.x = 4.0 - v.x;
  1379. } else if ( absV.x >= almostOne ) {
  1380. float signX = sign( v.x );
  1381. planar.x = v.z * signX + 2.0 * signX;
  1382. } else if ( absV.y >= almostOne ) {
  1383. float signY = sign( v.y );
  1384. planar.x = v.x + 2.0 * signY + 2.0;
  1385. planar.y = v.z * signY - 2.0;
  1386. }
  1387. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  1388. }
  1389. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  1390. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  1391. vec3 lightToPosition = shadowCoord.xyz;
  1392. vec3 bd3D = normalize( lightToPosition );
  1393. float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;
  1394. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )
  1395. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  1396. return (
  1397. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  1398. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  1399. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  1400. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  1401. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  1402. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  1403. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  1404. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  1405. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  1406. ) * ( 1.0 / 9.0 );
  1407. #else
  1408. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  1409. #endif
  1410. }
  1411. #endif
  1412. `,OCe=`#ifdef USE_SHADOWMAP
  1413. #if NUM_DIR_LIGHTS > 0
  1414. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];
  1415. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];
  1416. #endif
  1417. #if NUM_SPOT_LIGHTS > 0
  1418. uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];
  1419. varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];
  1420. #endif
  1421. #if NUM_POINT_LIGHTS > 0
  1422. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];
  1423. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];
  1424. #endif
  1425. #if NUM_RECT_AREA_LIGHTS > 0
  1426. #endif
  1427. #endif
  1428. `,FCe=`#ifdef USE_SHADOWMAP
  1429. #if NUM_DIR_LIGHTS > 0
  1430. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1431. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;
  1432. }
  1433. #endif
  1434. #if NUM_SPOT_LIGHTS > 0
  1435. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1436. vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;
  1437. }
  1438. #endif
  1439. #if NUM_POINT_LIGHTS > 0
  1440. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1441. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;
  1442. }
  1443. #endif
  1444. #if NUM_RECT_AREA_LIGHTS > 0
  1445. #endif
  1446. #endif
  1447. `,zCe=`float getShadowMask() {
  1448. float shadow = 1.0;
  1449. #ifdef USE_SHADOWMAP
  1450. #if NUM_DIR_LIGHTS > 0
  1451. DirectionalLight directionalLight;
  1452. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1453. directionalLight = directionalLights[ i ];
  1454. shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1455. }
  1456. #endif
  1457. #if NUM_SPOT_LIGHTS > 0
  1458. SpotLight spotLight;
  1459. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1460. spotLight = spotLights[ i ];
  1461. shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
  1462. }
  1463. #endif
  1464. #if NUM_POINT_LIGHTS > 0
  1465. PointLight pointLight;
  1466. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1467. pointLight = pointLights[ i ];
  1468. shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;
  1469. }
  1470. #endif
  1471. #if NUM_RECT_AREA_LIGHTS > 0
  1472. #endif
  1473. #endif
  1474. return shadow;
  1475. }
  1476. `,BCe=`#ifdef USE_SKINNING
  1477. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  1478. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  1479. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  1480. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  1481. #endif`,kCe=`#ifdef USE_SKINNING
  1482. uniform mat4 bindMatrix;
  1483. uniform mat4 bindMatrixInverse;
  1484. #ifdef BONE_TEXTURE
  1485. uniform sampler2D boneTexture;
  1486. uniform int boneTextureWidth;
  1487. uniform int boneTextureHeight;
  1488. mat4 getBoneMatrix( const in float i ) {
  1489. float j = i * 4.0;
  1490. float x = mod( j, float( boneTextureWidth ) );
  1491. float y = floor( j / float( boneTextureWidth ) );
  1492. float dx = 1.0 / float( boneTextureWidth );
  1493. float dy = 1.0 / float( boneTextureHeight );
  1494. y = dy * ( y + 0.5 );
  1495. vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
  1496. vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
  1497. vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
  1498. vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
  1499. mat4 bone = mat4( v1, v2, v3, v4 );
  1500. return bone;
  1501. }
  1502. #else
  1503. uniform mat4 boneMatrices[ MAX_BONES ];
  1504. mat4 getBoneMatrix( const in float i ) {
  1505. mat4 bone = boneMatrices[ int(i) ];
  1506. return bone;
  1507. }
  1508. #endif
  1509. #endif
  1510. `,VCe=`#ifdef USE_SKINNING
  1511. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  1512. vec4 skinned = vec4( 0.0 );
  1513. skinned += boneMatX * skinVertex * skinWeight.x;
  1514. skinned += boneMatY * skinVertex * skinWeight.y;
  1515. skinned += boneMatZ * skinVertex * skinWeight.z;
  1516. skinned += boneMatW * skinVertex * skinWeight.w;
  1517. skinned = bindMatrixInverse * skinned;
  1518. #endif
  1519. `,GCe=`#ifdef USE_SKINNING
  1520. mat4 skinMatrix = mat4( 0.0 );
  1521. skinMatrix += skinWeight.x * boneMatX;
  1522. skinMatrix += skinWeight.y * boneMatY;
  1523. skinMatrix += skinWeight.z * boneMatZ;
  1524. skinMatrix += skinWeight.w * boneMatW;
  1525. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  1526. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  1527. #endif
  1528. `,HCe=`float specularStrength;
  1529. #ifdef USE_SPECULARMAP
  1530. vec4 texelSpecular = texture2D( specularMap, vUv );
  1531. specularStrength = texelSpecular.r;
  1532. #else
  1533. specularStrength = 1.0;
  1534. #endif`,WCe=`#ifdef USE_SPECULARMAP
  1535. uniform sampler2D specularMap;
  1536. #endif`,XCe=`#if defined( TONE_MAPPING )
  1537. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  1538. #endif
  1539. `,YCe=`#define saturate(a) clamp( a, 0.0, 1.0 )
  1540. uniform float toneMappingExposure;
  1541. uniform float toneMappingWhitePoint;
  1542. vec3 LinearToneMapping( vec3 color ) {
  1543. return toneMappingExposure * color;
  1544. }
  1545. vec3 ReinhardToneMapping( vec3 color ) {
  1546. color *= toneMappingExposure;
  1547. return saturate( color / ( vec3( 1.0 ) + color ) );
  1548. }
  1549. #define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )
  1550. vec3 Uncharted2ToneMapping( vec3 color ) {
  1551. color *= toneMappingExposure;
  1552. return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
  1553. }
  1554. vec3 OptimizedCineonToneMapping( vec3 color ) {
  1555. color *= toneMappingExposure;
  1556. color = max( vec3( 0.0 ), color - 0.004 );
  1557. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  1558. }
  1559. `,qCe=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
  1560. varying vec2 vUv;
  1561. #endif`,ZCe=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
  1562. varying vec2 vUv;
  1563. uniform vec4 offsetRepeat;
  1564. #endif
  1565. `,jCe=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
  1566. vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
  1567. #endif`,KCe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1568. varying vec2 vUv2;
  1569. #endif`,JCe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1570. attribute vec2 uv2;
  1571. varying vec2 vUv2;
  1572. #endif`,$Ce=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1573. vUv2 = uv2;
  1574. #endif`,QCe=`#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
  1575. #ifdef USE_SKINNING
  1576. vec4 worldPosition = modelMatrix * skinned;
  1577. #else
  1578. vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
  1579. #endif
  1580. #endif
  1581. `,eRe=`uniform samplerCube tCube;
  1582. uniform float tFlip;
  1583. uniform float opacity;
  1584. varying vec3 vWorldPosition;
  1585. #include <common>
  1586. void main() {
  1587. gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );
  1588. gl_FragColor.a *= opacity;
  1589. }
  1590. `,tRe=`varying vec3 vWorldPosition;
  1591. #include <common>
  1592. void main() {
  1593. vWorldPosition = transformDirection( position, modelMatrix );
  1594. #include <begin_vertex>
  1595. #include <project_vertex>
  1596. }
  1597. `,rRe=`#if DEPTH_PACKING == 3200
  1598. uniform float opacity;
  1599. #endif
  1600. #include <common>
  1601. #include <packing>
  1602. #include <uv_pars_fragment>
  1603. #include <map_pars_fragment>
  1604. #include <alphamap_pars_fragment>
  1605. #include <logdepthbuf_pars_fragment>
  1606. #include <clipping_planes_pars_fragment>
  1607. void main() {
  1608. #include <clipping_planes_fragment>
  1609. vec4 diffuseColor = vec4( 1.0 );
  1610. #if DEPTH_PACKING == 3200
  1611. diffuseColor.a = opacity;
  1612. #endif
  1613. #include <map_fragment>
  1614. #include <alphamap_fragment>
  1615. #include <alphatest_fragment>
  1616. #include <logdepthbuf_fragment>
  1617. #if DEPTH_PACKING == 3200
  1618. gl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );
  1619. #elif DEPTH_PACKING == 3201
  1620. gl_FragColor = packDepthToRGBA( gl_FragCoord.z );
  1621. #endif
  1622. }
  1623. `,iRe=`#include <common>
  1624. #include <uv_pars_vertex>
  1625. #include <displacementmap_pars_vertex>
  1626. #include <morphtarget_pars_vertex>
  1627. #include <skinning_pars_vertex>
  1628. #include <logdepthbuf_pars_vertex>
  1629. #include <clipping_planes_pars_vertex>
  1630. void main() {
  1631. #include <uv_vertex>
  1632. #include <skinbase_vertex>
  1633. #include <begin_vertex>
  1634. #include <displacementmap_vertex>
  1635. #include <morphtarget_vertex>
  1636. #include <skinning_vertex>
  1637. #include <project_vertex>
  1638. #include <logdepthbuf_vertex>
  1639. #include <clipping_planes_vertex>
  1640. }
  1641. `,nRe=`uniform vec3 lightPos;
  1642. varying vec4 vWorldPosition;
  1643. #include <common>
  1644. #include <packing>
  1645. #include <clipping_planes_pars_fragment>
  1646. void main () {
  1647. #include <clipping_planes_fragment>
  1648. gl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );
  1649. }
  1650. `,aRe=`varying vec4 vWorldPosition;
  1651. #include <common>
  1652. #include <morphtarget_pars_vertex>
  1653. #include <skinning_pars_vertex>
  1654. #include <clipping_planes_pars_vertex>
  1655. void main() {
  1656. #include <skinbase_vertex>
  1657. #include <begin_vertex>
  1658. #include <morphtarget_vertex>
  1659. #include <skinning_vertex>
  1660. #include <project_vertex>
  1661. #include <worldpos_vertex>
  1662. #include <clipping_planes_vertex>
  1663. vWorldPosition = worldPosition;
  1664. }
  1665. `,oRe=`uniform sampler2D tEquirect;
  1666. uniform float tFlip;
  1667. varying vec3 vWorldPosition;
  1668. #include <common>
  1669. void main() {
  1670. vec3 direction = normalize( vWorldPosition );
  1671. vec2 sampleUV;
  1672. sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );
  1673. sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;
  1674. gl_FragColor = texture2D( tEquirect, sampleUV );
  1675. }
  1676. `,sRe=`varying vec3 vWorldPosition;
  1677. #include <common>
  1678. void main() {
  1679. vWorldPosition = transformDirection( position, modelMatrix );
  1680. #include <begin_vertex>
  1681. #include <project_vertex>
  1682. }
  1683. `,lRe=`uniform vec3 diffuse;
  1684. uniform float opacity;
  1685. uniform float dashSize;
  1686. uniform float totalSize;
  1687. varying float vLineDistance;
  1688. #include <common>
  1689. #include <color_pars_fragment>
  1690. #include <fog_pars_fragment>
  1691. #include <logdepthbuf_pars_fragment>
  1692. #include <clipping_planes_pars_fragment>
  1693. void main() {
  1694. #include <clipping_planes_fragment>
  1695. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  1696. discard;
  1697. }
  1698. vec3 outgoingLight = vec3( 0.0 );
  1699. vec4 diffuseColor = vec4( diffuse, opacity );
  1700. #include <logdepthbuf_fragment>
  1701. #include <color_fragment>
  1702. outgoingLight = diffuseColor.rgb;
  1703. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1704. #include <premultiplied_alpha_fragment>
  1705. #include <tonemapping_fragment>
  1706. #include <encodings_fragment>
  1707. #include <fog_fragment>
  1708. }
  1709. `,uRe=`uniform float scale;
  1710. attribute float lineDistance;
  1711. varying float vLineDistance;
  1712. #include <common>
  1713. #include <color_pars_vertex>
  1714. #include <logdepthbuf_pars_vertex>
  1715. #include <clipping_planes_pars_vertex>
  1716. void main() {
  1717. #include <color_vertex>
  1718. vLineDistance = scale * lineDistance;
  1719. vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
  1720. gl_Position = projectionMatrix * mvPosition;
  1721. #include <logdepthbuf_vertex>
  1722. #include <clipping_planes_vertex>
  1723. }
  1724. `,cRe=`uniform vec3 diffuse;
  1725. uniform float opacity;
  1726. #ifndef FLAT_SHADED
  1727. varying vec3 vNormal;
  1728. #endif
  1729. #include <common>
  1730. #include <color_pars_fragment>
  1731. #include <uv_pars_fragment>
  1732. #include <uv2_pars_fragment>
  1733. #include <map_pars_fragment>
  1734. #include <alphamap_pars_fragment>
  1735. #include <aomap_pars_fragment>
  1736. #include <lightmap_pars_fragment>
  1737. #include <envmap_pars_fragment>
  1738. #include <fog_pars_fragment>
  1739. #include <specularmap_pars_fragment>
  1740. #include <logdepthbuf_pars_fragment>
  1741. #include <clipping_planes_pars_fragment>
  1742. void main() {
  1743. #include <clipping_planes_fragment>
  1744. vec4 diffuseColor = vec4( diffuse, opacity );
  1745. #include <logdepthbuf_fragment>
  1746. #include <map_fragment>
  1747. #include <color_fragment>
  1748. #include <alphamap_fragment>
  1749. #include <alphatest_fragment>
  1750. #include <specularmap_fragment>
  1751. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  1752. #ifdef USE_LIGHTMAP
  1753. reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
  1754. #else
  1755. reflectedLight.indirectDiffuse += vec3( 1.0 );
  1756. #endif
  1757. #include <aomap_fragment>
  1758. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  1759. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  1760. #include <normal_flip>
  1761. #include <envmap_fragment>
  1762. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1763. #include <premultiplied_alpha_fragment>
  1764. #include <tonemapping_fragment>
  1765. #include <encodings_fragment>
  1766. #include <fog_fragment>
  1767. }
  1768. `,fRe=`#include <common>
  1769. #include <uv_pars_vertex>
  1770. #include <uv2_pars_vertex>
  1771. #include <envmap_pars_vertex>
  1772. #include <color_pars_vertex>
  1773. #include <morphtarget_pars_vertex>
  1774. #include <skinning_pars_vertex>
  1775. #include <logdepthbuf_pars_vertex>
  1776. #include <clipping_planes_pars_vertex>
  1777. void main() {
  1778. #include <uv_vertex>
  1779. #include <uv2_vertex>
  1780. #include <color_vertex>
  1781. #include <skinbase_vertex>
  1782. #ifdef USE_ENVMAP
  1783. #include <beginnormal_vertex>
  1784. #include <morphnormal_vertex>
  1785. #include <skinnormal_vertex>
  1786. #include <defaultnormal_vertex>
  1787. #endif
  1788. #include <begin_vertex>
  1789. #include <morphtarget_vertex>
  1790. #include <skinning_vertex>
  1791. #include <project_vertex>
  1792. #include <logdepthbuf_vertex>
  1793. #include <worldpos_vertex>
  1794. #include <clipping_planes_vertex>
  1795. #include <envmap_vertex>
  1796. }
  1797. `,hRe=`uniform vec3 diffuse;
  1798. uniform vec3 emissive;
  1799. uniform float opacity;
  1800. varying vec3 vLightFront;
  1801. #ifdef DOUBLE_SIDED
  1802. varying vec3 vLightBack;
  1803. #endif
  1804. #include <common>
  1805. #include <packing>
  1806. #include <color_pars_fragment>
  1807. #include <uv_pars_fragment>
  1808. #include <uv2_pars_fragment>
  1809. #include <map_pars_fragment>
  1810. #include <alphamap_pars_fragment>
  1811. #include <aomap_pars_fragment>
  1812. #include <lightmap_pars_fragment>
  1813. #include <emissivemap_pars_fragment>
  1814. #include <envmap_pars_fragment>
  1815. #include <bsdfs>
  1816. #include <lights_pars>
  1817. #include <fog_pars_fragment>
  1818. #include <shadowmap_pars_fragment>
  1819. #include <shadowmask_pars_fragment>
  1820. #include <specularmap_pars_fragment>
  1821. #include <logdepthbuf_pars_fragment>
  1822. #include <clipping_planes_pars_fragment>
  1823. void main() {
  1824. #include <clipping_planes_fragment>
  1825. vec4 diffuseColor = vec4( diffuse, opacity );
  1826. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  1827. vec3 totalEmissiveRadiance = emissive;
  1828. #include <logdepthbuf_fragment>
  1829. #include <map_fragment>
  1830. #include <color_fragment>
  1831. #include <alphamap_fragment>
  1832. #include <alphatest_fragment>
  1833. #include <specularmap_fragment>
  1834. #include <emissivemap_fragment>
  1835. reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );
  1836. #include <lightmap_fragment>
  1837. reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
  1838. #ifdef DOUBLE_SIDED
  1839. reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
  1840. #else
  1841. reflectedLight.directDiffuse = vLightFront;
  1842. #endif
  1843. reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
  1844. #include <aomap_fragment>
  1845. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  1846. #include <normal_flip>
  1847. #include <envmap_fragment>
  1848. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1849. #include <premultiplied_alpha_fragment>
  1850. #include <tonemapping_fragment>
  1851. #include <encodings_fragment>
  1852. #include <fog_fragment>
  1853. }
  1854. `,pRe=`#define LAMBERT
  1855. varying vec3 vLightFront;
  1856. #ifdef DOUBLE_SIDED
  1857. varying vec3 vLightBack;
  1858. #endif
  1859. #include <common>
  1860. #include <uv_pars_vertex>
  1861. #include <uv2_pars_vertex>
  1862. #include <envmap_pars_vertex>
  1863. #include <bsdfs>
  1864. #include <lights_pars>
  1865. #include <color_pars_vertex>
  1866. #include <morphtarget_pars_vertex>
  1867. #include <skinning_pars_vertex>
  1868. #include <shadowmap_pars_vertex>
  1869. #include <logdepthbuf_pars_vertex>
  1870. #include <clipping_planes_pars_vertex>
  1871. void main() {
  1872. #include <uv_vertex>
  1873. #include <uv2_vertex>
  1874. #include <color_vertex>
  1875. #include <beginnormal_vertex>
  1876. #include <morphnormal_vertex>
  1877. #include <skinbase_vertex>
  1878. #include <skinnormal_vertex>
  1879. #include <defaultnormal_vertex>
  1880. #include <begin_vertex>
  1881. #include <morphtarget_vertex>
  1882. #include <skinning_vertex>
  1883. #include <project_vertex>
  1884. #include <logdepthbuf_vertex>
  1885. #include <clipping_planes_vertex>
  1886. #include <worldpos_vertex>
  1887. #include <envmap_vertex>
  1888. #include <lights_lambert_vertex>
  1889. #include <shadowmap_vertex>
  1890. }
  1891. `,dRe=`#define PHONG
  1892. uniform vec3 diffuse;
  1893. uniform vec3 emissive;
  1894. uniform vec3 specular;
  1895. uniform float shininess;
  1896. uniform float opacity;
  1897. #include <common>
  1898. #include <packing>
  1899. #include <color_pars_fragment>
  1900. #include <uv_pars_fragment>
  1901. #include <uv2_pars_fragment>
  1902. #include <map_pars_fragment>
  1903. #include <alphamap_pars_fragment>
  1904. #include <aomap_pars_fragment>
  1905. #include <lightmap_pars_fragment>
  1906. #include <emissivemap_pars_fragment>
  1907. #include <envmap_pars_fragment>
  1908. #include <gradientmap_pars_fragment>
  1909. #include <fog_pars_fragment>
  1910. #include <bsdfs>
  1911. #include <lights_pars>
  1912. #include <lights_phong_pars_fragment>
  1913. #include <shadowmap_pars_fragment>
  1914. #include <bumpmap_pars_fragment>
  1915. #include <normalmap_pars_fragment>
  1916. #include <specularmap_pars_fragment>
  1917. #include <logdepthbuf_pars_fragment>
  1918. #include <clipping_planes_pars_fragment>
  1919. void main() {
  1920. #include <clipping_planes_fragment>
  1921. vec4 diffuseColor = vec4( diffuse, opacity );
  1922. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  1923. vec3 totalEmissiveRadiance = emissive;
  1924. #include <logdepthbuf_fragment>
  1925. #include <map_fragment>
  1926. #include <color_fragment>
  1927. #include <alphamap_fragment>
  1928. #include <alphatest_fragment>
  1929. #include <specularmap_fragment>
  1930. #include <normal_flip>
  1931. #include <normal_fragment>
  1932. #include <emissivemap_fragment>
  1933. #include <lights_phong_fragment>
  1934. #include <lights_template>
  1935. #include <aomap_fragment>
  1936. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  1937. #include <envmap_fragment>
  1938. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  1939. #include <premultiplied_alpha_fragment>
  1940. #include <tonemapping_fragment>
  1941. #include <encodings_fragment>
  1942. #include <fog_fragment>
  1943. }
  1944. `,mRe=`#define PHONG
  1945. varying vec3 vViewPosition;
  1946. #ifndef FLAT_SHADED
  1947. varying vec3 vNormal;
  1948. #endif
  1949. #include <common>
  1950. #include <uv_pars_vertex>
  1951. #include <uv2_pars_vertex>
  1952. #include <displacementmap_pars_vertex>
  1953. #include <envmap_pars_vertex>
  1954. #include <color_pars_vertex>
  1955. #include <morphtarget_pars_vertex>
  1956. #include <skinning_pars_vertex>
  1957. #include <shadowmap_pars_vertex>
  1958. #include <logdepthbuf_pars_vertex>
  1959. #include <clipping_planes_pars_vertex>
  1960. void main() {
  1961. #include <uv_vertex>
  1962. #include <uv2_vertex>
  1963. #include <color_vertex>
  1964. #include <beginnormal_vertex>
  1965. #include <morphnormal_vertex>
  1966. #include <skinbase_vertex>
  1967. #include <skinnormal_vertex>
  1968. #include <defaultnormal_vertex>
  1969. #ifndef FLAT_SHADED
  1970. vNormal = normalize( transformedNormal );
  1971. #endif
  1972. #include <begin_vertex>
  1973. #include <displacementmap_vertex>
  1974. #include <morphtarget_vertex>
  1975. #include <skinning_vertex>
  1976. #include <project_vertex>
  1977. #include <logdepthbuf_vertex>
  1978. #include <clipping_planes_vertex>
  1979. vViewPosition = - mvPosition.xyz;
  1980. #include <worldpos_vertex>
  1981. #include <envmap_vertex>
  1982. #include <shadowmap_vertex>
  1983. }
  1984. `,vRe=`#define PHYSICAL
  1985. uniform vec3 diffuse;
  1986. uniform vec3 emissive;
  1987. uniform float roughness;
  1988. uniform float metalness;
  1989. uniform float opacity;
  1990. #ifndef STANDARD
  1991. uniform float clearCoat;
  1992. uniform float clearCoatRoughness;
  1993. #endif
  1994. varying vec3 vViewPosition;
  1995. #ifndef FLAT_SHADED
  1996. varying vec3 vNormal;
  1997. #endif
  1998. #include <common>
  1999. #include <packing>
  2000. #include <color_pars_fragment>
  2001. #include <uv_pars_fragment>
  2002. #include <uv2_pars_fragment>
  2003. #include <map_pars_fragment>
  2004. #include <alphamap_pars_fragment>
  2005. #include <aomap_pars_fragment>
  2006. #include <lightmap_pars_fragment>
  2007. #include <emissivemap_pars_fragment>
  2008. #include <envmap_pars_fragment>
  2009. #include <fog_pars_fragment>
  2010. #include <bsdfs>
  2011. #include <cube_uv_reflection_fragment>
  2012. #include <lights_pars>
  2013. #include <lights_physical_pars_fragment>
  2014. #include <shadowmap_pars_fragment>
  2015. #include <bumpmap_pars_fragment>
  2016. #include <normalmap_pars_fragment>
  2017. #include <roughnessmap_pars_fragment>
  2018. #include <metalnessmap_pars_fragment>
  2019. #include <logdepthbuf_pars_fragment>
  2020. #include <clipping_planes_pars_fragment>
  2021. void main() {
  2022. #include <clipping_planes_fragment>
  2023. vec4 diffuseColor = vec4( diffuse, opacity );
  2024. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2025. vec3 totalEmissiveRadiance = emissive;
  2026. #include <logdepthbuf_fragment>
  2027. #include <map_fragment>
  2028. #include <color_fragment>
  2029. #include <alphamap_fragment>
  2030. #include <alphatest_fragment>
  2031. #include <specularmap_fragment>
  2032. #include <roughnessmap_fragment>
  2033. #include <metalnessmap_fragment>
  2034. #include <normal_flip>
  2035. #include <normal_fragment>
  2036. #include <emissivemap_fragment>
  2037. #include <lights_physical_fragment>
  2038. #include <lights_template>
  2039. #include <aomap_fragment>
  2040. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  2041. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2042. #include <premultiplied_alpha_fragment>
  2043. #include <tonemapping_fragment>
  2044. #include <encodings_fragment>
  2045. #include <fog_fragment>
  2046. }
  2047. `,gRe=`#define PHYSICAL
  2048. varying vec3 vViewPosition;
  2049. #ifndef FLAT_SHADED
  2050. varying vec3 vNormal;
  2051. #endif
  2052. #include <common>
  2053. #include <uv_pars_vertex>
  2054. #include <uv2_pars_vertex>
  2055. #include <displacementmap_pars_vertex>
  2056. #include <color_pars_vertex>
  2057. #include <morphtarget_pars_vertex>
  2058. #include <skinning_pars_vertex>
  2059. #include <shadowmap_pars_vertex>
  2060. #include <specularmap_pars_fragment>
  2061. #include <logdepthbuf_pars_vertex>
  2062. #include <clipping_planes_pars_vertex>
  2063. void main() {
  2064. #include <uv_vertex>
  2065. #include <uv2_vertex>
  2066. #include <color_vertex>
  2067. #include <beginnormal_vertex>
  2068. #include <morphnormal_vertex>
  2069. #include <skinbase_vertex>
  2070. #include <skinnormal_vertex>
  2071. #include <defaultnormal_vertex>
  2072. #ifndef FLAT_SHADED
  2073. vNormal = normalize( transformedNormal );
  2074. #endif
  2075. #include <begin_vertex>
  2076. #include <displacementmap_vertex>
  2077. #include <morphtarget_vertex>
  2078. #include <skinning_vertex>
  2079. #include <project_vertex>
  2080. #include <logdepthbuf_vertex>
  2081. #include <clipping_planes_vertex>
  2082. vViewPosition = - mvPosition.xyz;
  2083. #include <worldpos_vertex>
  2084. #include <shadowmap_vertex>
  2085. }
  2086. `,yRe=`#define NORMAL
  2087. uniform float opacity;
  2088. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )
  2089. varying vec3 vViewPosition;
  2090. #endif
  2091. #ifndef FLAT_SHADED
  2092. varying vec3 vNormal;
  2093. #endif
  2094. #include <packing>
  2095. #include <uv_pars_fragment>
  2096. #include <bumpmap_pars_fragment>
  2097. #include <normalmap_pars_fragment>
  2098. #include <logdepthbuf_pars_fragment>
  2099. void main() {
  2100. #include <logdepthbuf_fragment>
  2101. #include <normal_flip>
  2102. #include <normal_fragment>
  2103. gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
  2104. #include <premultiplied_alpha_fragment>
  2105. #include <encodings_fragment>
  2106. }
  2107. `,_Re=`#define NORMAL
  2108. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )
  2109. varying vec3 vViewPosition;
  2110. #endif
  2111. #ifndef FLAT_SHADED
  2112. varying vec3 vNormal;
  2113. #endif
  2114. #include <uv_pars_vertex>
  2115. #include <displacementmap_pars_vertex>
  2116. #include <morphtarget_pars_vertex>
  2117. #include <skinning_pars_vertex>
  2118. #include <logdepthbuf_pars_vertex>
  2119. void main() {
  2120. #include <uv_vertex>
  2121. #include <beginnormal_vertex>
  2122. #include <morphnormal_vertex>
  2123. #include <skinbase_vertex>
  2124. #include <skinnormal_vertex>
  2125. #include <defaultnormal_vertex>
  2126. #ifndef FLAT_SHADED
  2127. vNormal = normalize( transformedNormal );
  2128. #endif
  2129. #include <begin_vertex>
  2130. #include <displacementmap_vertex>
  2131. #include <morphtarget_vertex>
  2132. #include <skinning_vertex>
  2133. #include <project_vertex>
  2134. #include <logdepthbuf_vertex>
  2135. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )
  2136. vViewPosition = - mvPosition.xyz;
  2137. #endif
  2138. }
  2139. `,xRe=`uniform vec3 diffuse;
  2140. uniform float opacity;
  2141. #include <common>
  2142. #include <packing>
  2143. #include <color_pars_fragment>
  2144. #include <map_particle_pars_fragment>
  2145. #include <fog_pars_fragment>
  2146. #include <shadowmap_pars_fragment>
  2147. #include <logdepthbuf_pars_fragment>
  2148. #include <clipping_planes_pars_fragment>
  2149. void main() {
  2150. #include <clipping_planes_fragment>
  2151. vec3 outgoingLight = vec3( 0.0 );
  2152. vec4 diffuseColor = vec4( diffuse, opacity );
  2153. #include <logdepthbuf_fragment>
  2154. #include <map_particle_fragment>
  2155. #include <color_fragment>
  2156. #include <alphatest_fragment>
  2157. outgoingLight = diffuseColor.rgb;
  2158. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  2159. #include <premultiplied_alpha_fragment>
  2160. #include <tonemapping_fragment>
  2161. #include <encodings_fragment>
  2162. #include <fog_fragment>
  2163. }
  2164. `,SRe=`uniform float size;
  2165. uniform float scale;
  2166. #include <common>
  2167. #include <color_pars_vertex>
  2168. #include <shadowmap_pars_vertex>
  2169. #include <logdepthbuf_pars_vertex>
  2170. #include <clipping_planes_pars_vertex>
  2171. void main() {
  2172. #include <color_vertex>
  2173. #include <begin_vertex>
  2174. #include <project_vertex>
  2175. #ifdef USE_SIZEATTENUATION
  2176. gl_PointSize = size * ( scale / - mvPosition.z );
  2177. #else
  2178. gl_PointSize = size;
  2179. #endif
  2180. #include <logdepthbuf_vertex>
  2181. #include <clipping_planes_vertex>
  2182. #include <worldpos_vertex>
  2183. #include <shadowmap_vertex>
  2184. }
  2185. `,MRe=`uniform float opacity;
  2186. #include <common>
  2187. #include <packing>
  2188. #include <bsdfs>
  2189. #include <lights_pars>
  2190. #include <shadowmap_pars_fragment>
  2191. #include <shadowmask_pars_fragment>
  2192. void main() {
  2193. gl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );
  2194. }
  2195. `,bRe=`#include <shadowmap_pars_vertex>
  2196. void main() {
  2197. #include <begin_vertex>
  2198. #include <project_vertex>
  2199. #include <worldpos_vertex>
  2200. #include <shadowmap_vertex>
  2201. }
  2202. `,Xr={alphamap_fragment:EAe,alphamap_pars_fragment:AAe,alphatest_fragment:CAe,aomap_fragment:RAe,aomap_pars_fragment:LAe,begin_vertex:PAe,beginnormal_vertex:DAe,bsdfs:IAe,bumpmap_pars_fragment:NAe,clipping_planes_fragment:UAe,clipping_planes_pars_fragment:OAe,clipping_planes_pars_vertex:FAe,clipping_planes_vertex:zAe,color_fragment:BAe,color_pars_fragment:kAe,color_pars_vertex:VAe,color_vertex:GAe,common:HAe,cube_uv_reflection_fragment:WAe,defaultnormal_vertex:XAe,displacementmap_pars_vertex:YAe,displacementmap_vertex:qAe,emissivemap_fragment:ZAe,emissivemap_pars_fragment:jAe,encodings_fragment:KAe,encodings_pars_fragment:JAe,envmap_fragment:$Ae,envmap_pars_fragment:QAe,envmap_pars_vertex:eCe,envmap_vertex:tCe,fog_fragment:rCe,fog_pars_fragment:iCe,gradientmap_pars_fragment:nCe,lightmap_fragment:aCe,lightmap_pars_fragment:oCe,lights_lambert_vertex:sCe,lights_pars:lCe,lights_phong_fragment:uCe,lights_phong_pars_fragment:cCe,lights_physical_fragment:fCe,lights_physical_pars_fragment:hCe,lights_template:pCe,logdepthbuf_fragment:dCe,logdepthbuf_pars_fragment:mCe,logdepthbuf_pars_vertex:vCe,logdepthbuf_vertex:gCe,map_fragment:yCe,map_pars_fragment:_Ce,map_particle_fragment:xCe,map_particle_pars_fragment:SCe,metalnessmap_fragment:MCe,metalnessmap_pars_fragment:bCe,morphnormal_vertex:wCe,morphtarget_pars_vertex:TCe,morphtarget_vertex:ECe,normal_flip:ACe,normal_fragment:CCe,normalmap_pars_fragment:RCe,packing:LCe,premultiplied_alpha_fragment:PCe,project_vertex:DCe,roughnessmap_fragment:ICe,roughnessmap_pars_fragment:NCe,shadowmap_pars_fragment:UCe,shadowmap_pars_vertex:OCe,shadowmap_vertex:FCe,shadowmask_pars_fragment:zCe,skinbase_vertex:BCe,skinning_pars_vertex:kCe,skinning_vertex:VCe,skinnormal_vertex:GCe,specularmap_fragment:HCe,specularmap_pars_fragment:WCe,tonemapping_fragment:XCe,tonemapping_pars_fragment:YCe,uv_pars_fragment:qCe,uv_pars_vertex:ZCe,uv_vertex:jCe,uv2_pars_fragment:KCe,uv2_pars_vertex:JCe,uv2_vertex:$Ce,worldpos_vertex:QCe,cube_frag:eRe,cube_vert:tRe,depth_frag:rRe,depth_vert:iRe,distanceRGBA_frag:nRe,distanceRGBA_vert:aRe,equirect_frag:oRe,equirect_vert:sRe,linedashed_frag:lRe,linedashed_vert:uRe,meshbasic_frag:cRe,meshbasic_vert:fRe,meshlambert_frag:hRe,meshlambert_vert:pRe,meshphong_frag:dRe,meshphong_vert:mRe,meshphysical_frag:vRe,meshphysical_vert:gRe,normal_frag:yRe,normal_vert:_Re,points_frag:xRe,points_vert:SRe,shadow_frag:MRe,shadow_vert:bRe};Gt.prototype={constructor:Gt,isColor:!0,r:1,g:1,b:1,set:function(r){return r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r),this},setScalar:function(r){return this.r=r,this.g=r,this.b=r,this},setHex:function(r){return r=Math.floor(r),this.r=(r>>16&255)/255,this.g=(r>>8&255)/255,this.b=(r&255)/255,this},setRGB:function(r,e,t){return this.r=r,this.g=e,this.b=t,this},setHSL:function(){function r(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*6*(2/3-i):e}return function(t,i,n){if(t=cr.euclideanModulo(t,1),i=cr.clamp(i,0,1),n=cr.clamp(n,0,1),i===0)this.r=this.g=this.b=n;else{var a=n<=.5?n*(1+i):n+i-n*i,o=2*n-a;this.r=r(o,a,t+1/3),this.g=r(o,a,t),this.b=r(o,a,t-1/3)}return this}}(),setStyle:function(r){function e(f){f!==void 0&&parseFloat(f)<1&&console.warn("THREE.Color: Alpha component of "+r+" will be ignored.")}var t;if(t=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(r)){var i,n=t[1],a=t[2];switch(n){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(o,s,l)}break}}else if(t=/^\#([A-Fa-f0-9]+)$/.exec(r)){var u=t[1],c=u.length;if(c===3)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(c===6)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(r&&r.length>0){var u=wRe[r];u!==void 0?this.setHex(u):console.warn("THREE.Color: Unknown color "+r)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(r){return this.r=r.r,this.g=r.g,this.b=r.b,this},copyGammaToLinear:function(r,e){return e===void 0&&(e=2),this.r=Math.pow(r.r,e),this.g=Math.pow(r.g,e),this.b=Math.pow(r.b,e),this},copyLinearToGamma:function(r,e){e===void 0&&(e=2);var t=e>0?1/e:1;return this.r=Math.pow(r.r,t),this.g=Math.pow(r.g,t),this.b=Math.pow(r.b,t),this},convertGammaToLinear:function(){var r=this.r,e=this.g,t=this.b;return this.r=r*r,this.g=e*e,this.b=t*t,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(r){var e=r||{h:0,s:0,l:0},t=this.r,i=this.g,n=this.b,a=Math.max(t,i,n),o=Math.min(t,i,n),s,l,u=(o+a)/2;if(o===a)s=0,l=0;else{var c=a-o;switch(l=u<=.5?c/(a+o):c/(2-a-o),a){case t:s=(i-n)/c+(i<n?6:0);break;case i:s=(n-t)/c+2;break;case n:s=(t-i)/c+4;break}s/=6}return e.h=s,e.s=l,e.l=u,e},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(r,e,t){var i=this.getHSL();return i.h+=r,i.s+=e,i.l+=t,this.setHSL(i.h,i.s,i.l),this},add:function(r){return this.r+=r.r,this.g+=r.g,this.b+=r.b,this},addColors:function(r,e){return this.r=r.r+e.r,this.g=r.g+e.g,this.b=r.b+e.b,this},addScalar:function(r){return this.r+=r,this.g+=r,this.b+=r,this},sub:function(r){return this.r=Math.max(0,this.r-r.r),this.g=Math.max(0,this.g-r.g),this.b=Math.max(0,this.b-r.b),this},multiply:function(r){return this.r*=r.r,this.g*=r.g,this.b*=r.b,this},multiplyScalar:function(r){return this.r*=r,this.g*=r,this.b*=r,this},lerp:function(r,e){return this.r+=(r.r-this.r)*e,this.g+=(r.g-this.g)*e,this.b+=(r.b-this.b)*e,this},equals:function(r){return r.r===this.r&&r.g===this.g&&r.b===this.b},fromArray:function(r,e){return e===void 0&&(e=0),this.r=r[e],this.g=r[e+1],this.b=r[e+2],this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this.r,r[e+1]=this.g,r[e+2]=this.b,r},toJSON:function(){return this.getHex()}};wRe={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,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};Nd.prototype=Object.create(ni.prototype);Nd.prototype.constructor=Nd;Nd.prototype.isDataTexture=!0;hr={common:{diffuse:{value:new Gt(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new Qr(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new St(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 Gt(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Gt(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new Qr(0,0,1,1)}}},Qg={basic:{uniforms:eo.merge([hr.common,hr.aomap,hr.lightmap,hr.fog]),vertexShader:Xr.meshbasic_vert,fragmentShader:Xr.meshbasic_frag},lambert:{uniforms:eo.merge([hr.common,hr.aomap,hr.lightmap,hr.emissivemap,hr.fog,hr.lights,{emissive:{value:new Gt(0)}}]),vertexShader:Xr.meshlambert_vert,fragmentShader:Xr.meshlambert_frag},phong:{uniforms:eo.merge([hr.common,hr.aomap,hr.lightmap,hr.emissivemap,hr.bumpmap,hr.normalmap,hr.displacementmap,hr.gradientmap,hr.fog,hr.lights,{emissive:{value:new Gt(0)},specular:{value:new Gt(1118481)},shininess:{value:30}}]),vertexShader:Xr.meshphong_vert,fragmentShader:Xr.meshphong_frag},standard:{uniforms:eo.merge([hr.common,hr.aomap,hr.lightmap,hr.emissivemap,hr.bumpmap,hr.normalmap,hr.displacementmap,hr.roughnessmap,hr.metalnessmap,hr.fog,hr.lights,{emissive:{value:new Gt(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Xr.meshphysical_vert,fragmentShader:Xr.meshphysical_frag},points:{uniforms:eo.merge([hr.points,hr.fog]),vertexShader:Xr.points_vert,fragmentShader:Xr.points_frag},dashed:{uniforms:eo.merge([hr.common,hr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Xr.linedashed_vert,fragmentShader:Xr.linedashed_frag},depth:{uniforms:eo.merge([hr.common,hr.displacementmap]),vertexShader:Xr.depth_vert,fragmentShader:Xr.depth_frag},normal:{uniforms:eo.merge([hr.common,hr.bumpmap,hr.normalmap,hr.displacementmap,{opacity:{value:1}}]),vertexShader:Xr.normal_vert,fragmentShader:Xr.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Xr.cube_vert,fragmentShader:Xr.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Xr.equirect_vert,fragmentShader:Xr.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new oe}},vertexShader:Xr.distanceRGBA_vert,fragmentShader:Xr.distanceRGBA_frag}};Qg.physical={uniforms:eo.merge([Qg.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Xr.meshphysical_vert,fragmentShader:Xr.meshphysical_frag};PS.prototype={constructor:PS,set:function(r,e){return this.min.copy(r),this.max.copy(e),this},setFromPoints:function(r){this.makeEmpty();for(var e=0,t=r.length;e<t;e++)this.expandByPoint(r[e]);return this},setFromCenterAndSize:function(){var r=new St;return function(t,i){var n=r.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.min.copy(r.min),this.max.copy(r.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(r){var e=r||new St;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(r){var e=r||new St;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(r){return this.min.min(r),this.max.max(r),this},expandByVector:function(r){return this.min.sub(r),this.max.add(r),this},expandByScalar:function(r){return this.min.addScalar(-r),this.max.addScalar(r),this},containsPoint:function(r){return!(r.x<this.min.x||r.x>this.max.x||r.y<this.min.y||r.y>this.max.y)},containsBox:function(r){return this.min.x<=r.min.x&&r.max.x<=this.max.x&&this.min.y<=r.min.y&&r.max.y<=this.max.y},getParameter:function(r,e){var t=e||new St;return t.set((r.x-this.min.x)/(this.max.x-this.min.x),(r.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(r){return!(r.max.x<this.min.x||r.min.x>this.max.x||r.max.y<this.min.y||r.min.y>this.max.y)},clampPoint:function(r,e){var t=e||new St;return t.copy(r).clamp(this.min,this.max)},distanceToPoint:function(){var r=new St;return function(t){var i=r.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),intersect:function(r){return this.min.max(r.min),this.max.min(r.max),this},union:function(r){return this.min.min(r.min),this.max.max(r.max),this},translate:function(r){return this.min.add(r),this.max.add(r),this},equals:function(r){return r.min.equals(this.min)&&r.max.equals(this.max)}};ARe=0;mr.prototype={constructor:mr,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(r){r===!0&&this.update(),this._needsUpdate=r},setValues:function(r){if(r!==void 0)for(var e in r){var t=r[e];if(t===void 0){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}var i=this[e];if(i===void 0){console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.");continue}i&&i.isColor?i.set(t):i&&i.isVector3&&t&&t.isVector3?i.copy(t):e==="overdraw"?this[e]=Number(t):this[e]=t}},toJSON:function(r){var e=r===void 0;e&&(r={textures:{},images:{}});var t={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.color&&this.color.isColor&&(t.color=this.color.getHex()),this.roughness!==void 0&&(t.roughness=this.roughness),this.metalness!==void 0&&(t.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(t.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(t.specular=this.specular.getHex()),this.shininess!==void 0&&(t.shininess=this.shininess),this.clearCoat!==void 0&&(t.clearCoat=this.clearCoat),this.clearCoatRoughness!==void 0&&(t.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(t.map=this.map.toJSON(r).uuid),this.alphaMap&&this.alphaMap.isTexture&&(t.alphaMap=this.alphaMap.toJSON(r).uuid),this.lightMap&&this.lightMap.isTexture&&(t.lightMap=this.lightMap.toJSON(r).uuid),this.bumpMap&&this.bumpMap.isTexture&&(t.bumpMap=this.bumpMap.toJSON(r).uuid,t.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(t.normalMap=this.normalMap.toJSON(r).uuid,t.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(t.displacementMap=this.displacementMap.toJSON(r).uuid,t.displacementScale=this.displacementScale,t.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(t.roughnessMap=this.roughnessMap.toJSON(r).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(t.metalnessMap=this.metalnessMap.toJSON(r).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(t.emissiveMap=this.emissiveMap.toJSON(r).uuid),this.specularMap&&this.specularMap.isTexture&&(t.specularMap=this.specularMap.toJSON(r).uuid),this.envMap&&this.envMap.isTexture&&(t.envMap=this.envMap.toJSON(r).uuid,t.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(t.gradientMap=this.gradientMap.toJSON(r).uuid),this.size!==void 0&&(t.size=this.size),this.sizeAttenuation!==void 0&&(t.sizeAttenuation=this.sizeAttenuation),this.blending!==Uy&&(t.blending=this.blending),this.shading!==Uz&&(t.shading=this.shading),this.side!==Zg&&(t.side=this.side),this.vertexColors!==yC&&(t.vertexColors=this.vertexColors),this.opacity<1&&(t.opacity=this.opacity),this.transparent===!0&&(t.transparent=this.transparent),t.depthFunc=this.depthFunc,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite,this.alphaTest>0&&(t.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(t.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(t.wireframe=this.wireframe),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(t.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(t.wireframeLinejoin=this.wireframeLinejoin),t.skinning=this.skinning,t.morphTargets=this.morphTargets;function i(o){var s=[];for(var l in o){var u=o[l];delete u.metadata,s.push(u)}return s}if(e){var n=i(r.textures),a=i(r.images);n.length>0&&(t.textures=n),a.length>0&&(t.images=a)}return t},clone:function(){return new this.constructor().copy(this)},copy:function(r){this.name=r.name,this.fog=r.fog,this.lights=r.lights,this.blending=r.blending,this.side=r.side,this.shading=r.shading,this.vertexColors=r.vertexColors,this.opacity=r.opacity,this.transparent=r.transparent,this.blendSrc=r.blendSrc,this.blendDst=r.blendDst,this.blendEquation=r.blendEquation,this.blendSrcAlpha=r.blendSrcAlpha,this.blendDstAlpha=r.blendDstAlpha,this.blendEquationAlpha=r.blendEquationAlpha,this.depthFunc=r.depthFunc,this.depthTest=r.depthTest,this.depthWrite=r.depthWrite,this.colorWrite=r.colorWrite,this.precision=r.precision,this.polygonOffset=r.polygonOffset,this.polygonOffsetFactor=r.polygonOffsetFactor,this.polygonOffsetUnits=r.polygonOffsetUnits,this.alphaTest=r.alphaTest,this.premultipliedAlpha=r.premultipliedAlpha,this.overdraw=r.overdraw,this.visible=r.visible,this.clipShadows=r.clipShadows,this.clipIntersection=r.clipIntersection;var e=r.clippingPlanes,t=null;if(e!==null){var i=e.length;t=new Array(i);for(var n=0;n!==i;++n)t[n]=e[n].clone()}return this.clippingPlanes=t,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};Object.assign(mr.prototype,Ms.prototype);_a.prototype=Object.create(mr.prototype);_a.prototype.constructor=_a;_a.prototype.isShaderMaterial=!0;_a.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.fragmentShader=r.fragmentShader,this.vertexShader=r.vertexShader,this.uniforms=eo.clone(r.uniforms),this.defines=r.defines,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.lights=r.lights,this.clipping=r.clipping,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this.extensions=r.extensions,this};_a.prototype.toJSON=function(r){var e=mr.prototype.toJSON.call(this,r);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e};Sh.prototype=Object.create(mr.prototype);Sh.prototype.constructor=Sh;Sh.prototype.isMeshDepthMaterial=!0;Sh.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.depthPacking=r.depthPacking,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.map=r.map,this.alphaMap=r.alphaMap,this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this};lu.prototype={constructor:lu,isBox3:!0,set:function(r,e){return this.min.copy(r),this.max.copy(e),this},setFromArray:function(r){for(var e=1/0,t=1/0,i=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,l=r.length;s<l;s+=3){var u=r[s],c=r[s+1],f=r[s+2];u<e&&(e=u),c<t&&(t=c),f<i&&(i=f),u>n&&(n=u),c>a&&(a=c),f>o&&(o=f)}this.min.set(e,t,i),this.max.set(n,a,o)},setFromBufferAttribute:function(r){for(var e=1/0,t=1/0,i=1/0,n=-1/0,a=-1/0,o=-1/0,s=0,l=r.count;s<l;s++){var u=r.getX(s),c=r.getY(s),f=r.getZ(s);u<e&&(e=u),c<t&&(t=c),f<i&&(i=f),u>n&&(n=u),c>a&&(a=c),f>o&&(o=f)}this.min.set(e,t,i),this.max.set(n,a,o)},setFromPoints:function(r){this.makeEmpty();for(var e=0,t=r.length;e<t;e++)this.expandByPoint(r[e]);return this},setFromCenterAndSize:function(){var r=new oe;return function(t,i){var n=r.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),setFromObject:function(){var r=new oe;return function(t){var i=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(n){var a,o,s=n.geometry;if(s!==void 0){if(s.isGeometry){var l=s.vertices;for(a=0,o=l.length;a<o;a++)r.copy(l[a]),r.applyMatrix4(n.matrixWorld),i.expandByPoint(r)}else if(s.isBufferGeometry){var u=s.attributes.position;if(u!==void 0)for(a=0,o=u.count;a<o;a++)r.fromAttribute(u,a).applyMatrix4(n.matrixWorld),i.expandByPoint(r)}}}),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.min.copy(r.min),this.max.copy(r.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(r){var e=r||new oe;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(r){var e=r||new oe;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(r){return this.min.min(r),this.max.max(r),this},expandByVector:function(r){return this.min.sub(r),this.max.add(r),this},expandByScalar:function(r){return this.min.addScalar(-r),this.max.addScalar(r),this},containsPoint:function(r){return!(r.x<this.min.x||r.x>this.max.x||r.y<this.min.y||r.y>this.max.y||r.z<this.min.z||r.z>this.max.z)},containsBox:function(r){return this.min.x<=r.min.x&&r.max.x<=this.max.x&&this.min.y<=r.min.y&&r.max.y<=this.max.y&&this.min.z<=r.min.z&&r.max.z<=this.max.z},getParameter:function(r,e){var t=e||new oe;return t.set((r.x-this.min.x)/(this.max.x-this.min.x),(r.y-this.min.y)/(this.max.y-this.min.y),(r.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(r){return!(r.max.x<this.min.x||r.min.x>this.max.x||r.max.y<this.min.y||r.min.y>this.max.y||r.max.z<this.min.z||r.min.z>this.max.z)},intersectsSphere:function(){var r;return function(t){return r===void 0&&(r=new oe),this.clampPoint(t.center,r),r.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(r){var e,t;return r.normal.x>0?(e=r.normal.x*this.min.x,t=r.normal.x*this.max.x):(e=r.normal.x*this.max.x,t=r.normal.x*this.min.x),r.normal.y>0?(e+=r.normal.y*this.min.y,t+=r.normal.y*this.max.y):(e+=r.normal.y*this.max.y,t+=r.normal.y*this.min.y),r.normal.z>0?(e+=r.normal.z*this.min.z,t+=r.normal.z*this.max.z):(e+=r.normal.z*this.max.z,t+=r.normal.z*this.min.z),e<=r.constant&&t>=r.constant},clampPoint:function(r,e){var t=e||new oe;return t.copy(r).clamp(this.min,this.max)},distanceToPoint:function(){var r=new oe;return function(t){var i=r.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),getBoundingSphere:function(){var r=new oe;return function(t){var i=t||new $n;return this.getCenter(i.center),i.radius=this.getSize(r).length()*.5,i}}(),intersect:function(r){return this.min.max(r.min),this.max.min(r.max),this.isEmpty()&&this.makeEmpty(),this},union:function(r){return this.min.min(r.min),this.max.max(r.max),this},applyMatrix4:function(){var r=[new oe,new oe,new oe,new oe,new oe,new oe,new oe,new oe];return function(t){return this.isEmpty()?this:(r[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),r[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),r[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),r[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),r[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),r[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),r[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),r[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(r),this)}}(),translate:function(r){return this.min.add(r),this.max.add(r),this},equals:function(r){return r.min.equals(this.min)&&r.max.equals(this.max)}};$n.prototype={constructor:$n,set:function(r,e){return this.center.copy(r),this.radius=e,this},setFromPoints:function(){var r=new lu;return function(t,i){var n=this.center;i!==void 0?n.copy(i):r.setFromPoints(t).getCenter(n);for(var a=0,o=0,s=t.length;o<s;o++)a=Math.max(a,n.distanceToSquared(t[o]));return this.radius=Math.sqrt(a),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.center.copy(r.center),this.radius=r.radius,this},empty:function(){return this.radius<=0},containsPoint:function(r){return r.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(r){return r.distanceTo(this.center)-this.radius},intersectsSphere:function(r){var e=this.radius+r.radius;return r.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(r){return r.intersectsSphere(this)},intersectsPlane:function(r){return Math.abs(this.center.dot(r.normal)-r.constant)<=this.radius},clampPoint:function(r,e){var t=this.center.distanceToSquared(r),i=e||new oe;return i.copy(r),t>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(r){var e=r||new lu;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(r){return this.center.applyMatrix4(r),this.radius=this.radius*r.getMaxScaleOnAxis(),this},translate:function(r){return this.center.add(r),this},equals:function(r){return r.center.equals(this.center)&&r.radius===this.radius}};bs.prototype={constructor:bs,isMatrix3:!0,set:function(r,e,t,i,n,a,o,s,l){var u=this.elements;return u[0]=r,u[1]=i,u[2]=o,u[3]=e,u[4]=n,u[5]=s,u[6]=t,u[7]=a,u[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(r){var e=r.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(r){var e=r.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var r;return function(t,i,n){r===void 0&&(r=new oe),i===void 0&&(i=0),n===void 0&&(n=t.length);for(var a=0,o=i;a<n;a+=3,o+=3)r.fromArray(t,o),r.applyMatrix3(this),r.toArray(t,o);return t}}(),applyToBufferAttribute:function(){var r;return function(t){r===void 0&&(r=new oe);for(var i=0,n=t.count;i<n;i++)r.x=t.getX(i),r.y=t.getY(i),r.z=t.getZ(i),r.applyMatrix3(this),t.setXYZ(i,r.x,r.y,r.z);return t}}(),multiplyScalar:function(r){var e=this.elements;return e[0]*=r,e[3]*=r,e[6]*=r,e[1]*=r,e[4]*=r,e[7]*=r,e[2]*=r,e[5]*=r,e[8]*=r,this},determinant:function(){var r=this.elements,e=r[0],t=r[1],i=r[2],n=r[3],a=r[4],o=r[5],s=r[6],l=r[7],u=r[8];return e*a*u-e*o*l-t*n*u+t*o*s+i*n*l-i*a*s},getInverse:function(r,e){r&&r.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var t=r.elements,i=this.elements,n=t[0],a=t[1],o=t[2],s=t[3],l=t[4],u=t[5],c=t[6],f=t[7],h=t[8],p=h*l-u*f,d=u*c-h*s,g=f*s-l*c,m=n*p+a*d+o*g;if(m===0){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(v);return console.warn(v),this.identity()}var _=1/m;return i[0]=p*_,i[1]=(o*f-h*a)*_,i[2]=(u*a-o*l)*_,i[3]=d*_,i[4]=(h*n-o*c)*_,i[5]=(o*s-u*n)*_,i[6]=g*_,i[7]=(a*c-f*n)*_,i[8]=(l*n-a*s)*_,this},transpose:function(){var r,e=this.elements;return r=e[1],e[1]=e[3],e[3]=r,r=e[2],e[2]=e[6],e[6]=r,r=e[5],e[5]=e[7],e[7]=r,this},getNormalMatrix:function(r){return this.setFromMatrix4(r).getInverse(this).transpose()},transposeIntoArray:function(r){var e=this.elements;return r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8],this},fromArray:function(r,e){e===void 0&&(e=0);for(var t=0;t<9;t++)this.elements[t]=r[t+e];return this},toArray:function(r,e){r===void 0&&(r=[]),e===void 0&&(e=0);var t=this.elements;return r[e]=t[0],r[e+1]=t[1],r[e+2]=t[2],r[e+3]=t[3],r[e+4]=t[4],r[e+5]=t[5],r[e+6]=t[6],r[e+7]=t[7],r[e+8]=t[8],r}};Io.prototype={constructor:Io,set:function(r,e){return this.normal.copy(r),this.constant=e,this},setComponents:function(r,e,t,i){return this.normal.set(r,e,t),this.constant=i,this},setFromNormalAndCoplanarPoint:function(r,e){return this.normal.copy(r),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var r=new oe,e=new oe;return function(i,n,a){var o=r.subVectors(a,n).cross(e.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(o,i),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.normal.copy(r.normal),this.constant=r.constant,this},normalize:function(){var r=1/this.normal.length();return this.normal.multiplyScalar(r),this.constant*=r,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(r){return this.normal.dot(r)+this.constant},distanceToSphere:function(r){return this.distanceToPoint(r.center)-r.radius},projectPoint:function(r,e){return this.orthoPoint(r,e).sub(r).negate()},orthoPoint:function(r,e){var t=this.distanceToPoint(r),i=e||new oe;return i.copy(this.normal).multiplyScalar(t)},intersectLine:function(){var r=new oe;return function(t,i){var n=i||new oe,a=t.delta(r),o=this.normal.dot(a);if(o===0)return this.distanceToPoint(t.start)===0?n.copy(t.start):void 0;var s=-(t.start.dot(this.normal)+this.constant)/o;if(!(s<0||s>1))return n.copy(a).multiplyScalar(s).add(t.start)}}(),intersectsLine:function(r){var e=this.distanceToPoint(r.start),t=this.distanceToPoint(r.end);return e<0&&t>0||t<0&&e>0},intersectsBox:function(r){return r.intersectsPlane(this)},intersectsSphere:function(r){return r.intersectsPlane(this)},coplanarPoint:function(r){var e=r||new oe;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var r=new oe,e=new bs;return function(i,n){var a=this.coplanarPoint(r).applyMatrix4(i),o=n||e.getNormalMatrix(i),s=this.normal.applyMatrix3(o).normalize();return this.constant=-a.dot(s),this}}(),translate:function(r){return this.constant=this.constant-r.dot(this.normal),this},equals:function(r){return r.normal.equals(this.normal)&&r.constant===this.constant}};DS.prototype={constructor:DS,set:function(r,e,t,i,n,a){var o=this.planes;return o[0].copy(r),o[1].copy(e),o[2].copy(t),o[3].copy(i),o[4].copy(n),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(r){for(var e=this.planes,t=0;t<6;t++)e[t].copy(r.planes[t]);return this},setFromMatrix:function(r){var e=this.planes,t=r.elements,i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],f=t[8],h=t[9],p=t[10],d=t[11],g=t[12],m=t[13],v=t[14],_=t[15];return e[0].setComponents(o-i,c-s,d-f,_-g).normalize(),e[1].setComponents(o+i,c+s,d+f,_+g).normalize(),e[2].setComponents(o+n,c+l,d+h,_+m).normalize(),e[3].setComponents(o-n,c-l,d-h,_-m).normalize(),e[4].setComponents(o-a,c-u,d-p,_-v).normalize(),e[5].setComponents(o+a,c+u,d+p,_+v).normalize(),this},intersectsObject:function(){var r=new $n;return function(t){var i=t.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),r.copy(i.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(r)}}(),intersectsSprite:function(){var r=new $n;return function(t){return r.center.set(0,0,0),r.radius=.7071067811865476,r.applyMatrix4(t.matrixWorld),this.intersectsSphere(r)}}(),intersectsSphere:function(r){for(var e=this.planes,t=r.center,i=-r.radius,n=0;n<6;n++){var a=e[n].distanceToPoint(t);if(a<i)return!1}return!0},intersectsBox:function(){var r=new oe,e=new oe;return function(i){for(var n=this.planes,a=0;a<6;a++){var o=n[a];r.x=o.normal.x>0?i.min.x:i.max.x,e.x=o.normal.x>0?i.max.x:i.min.x,r.y=o.normal.y>0?i.min.y:i.max.y,e.y=o.normal.y>0?i.max.y:i.min.y,r.z=o.normal.z>0?i.min.z:i.max.z,e.z=o.normal.z>0?i.max.z:i.min.z;var s=o.distanceToPoint(r),l=o.distanceToPoint(e);if(s<0&&l<0)return!1}return!0}}(),containsPoint:function(r){for(var e=this.planes,t=0;t<6;t++)if(e[t].distanceToPoint(r)<0)return!1;return!0}};Mh.prototype={constructor:Mh,set:function(r,e){return this.origin.copy(r),this.direction.copy(e),this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.origin.copy(r.origin),this.direction.copy(r.direction),this},at:function(r,e){var t=e||new oe;return t.copy(this.direction).multiplyScalar(r).add(this.origin)},lookAt:function(r){return this.direction.copy(r).sub(this.origin).normalize(),this},recast:function(){var r=new oe;return function(t){return this.origin.copy(this.at(t,r)),this}}(),closestPointToPoint:function(r,e){var t=e||new oe;t.subVectors(r,this.origin);var i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(r){return Math.sqrt(this.distanceSqToPoint(r))},distanceSqToPoint:function(){var r=new oe;return function(t){var i=r.subVectors(t,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(t):(r.copy(this.direction).multiplyScalar(i).add(this.origin),r.distanceToSquared(t))}}(),distanceSqToSegment:function(){var r=new oe,e=new oe,t=new oe;return function(n,a,o,s){r.copy(n).add(a).multiplyScalar(.5),e.copy(a).sub(n).normalize(),t.copy(this.origin).sub(r);var l=n.distanceTo(a)*.5,u=-this.direction.dot(e),c=t.dot(this.direction),f=-t.dot(e),h=t.lengthSq(),p=Math.abs(1-u*u),d,g,m,v;if(p>0)if(d=u*f-c,g=u*c-f,v=l*p,d>=0)if(g>=-v)if(g<=v){var _=1/p;d*=_,g*=_,m=d*(d+u*g+2*c)+g*(u*d+g+2*f)+h}else g=l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*f)+h;else g=-l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*f)+h;else g<=-v?(d=Math.max(0,-(-u*l+c)),g=d>0?-l:Math.min(Math.max(-l,-f),l),m=-d*d+g*(g+2*f)+h):g<=v?(d=0,g=Math.min(Math.max(-l,-f),l),m=g*(g+2*f)+h):(d=Math.max(0,-(u*l+c)),g=d>0?l:Math.min(Math.max(-l,-f),l),m=-d*d+g*(g+2*f)+h);else g=u>0?-l:l,d=Math.max(0,-(u*g+c)),m=-d*d+g*(g+2*f)+h;return o&&o.copy(this.direction).multiplyScalar(d).add(this.origin),s&&s.copy(e).multiplyScalar(g).add(r),m}}(),intersectSphere:function(){var r=new oe;return function(t,i){r.subVectors(t.center,this.origin);var n=r.dot(this.direction),a=r.dot(r)-n*n,o=t.radius*t.radius;if(a>o)return null;var s=Math.sqrt(o-a),l=n-s,u=n+s;return l<0&&u<0?null:l<0?this.at(u,i):this.at(l,i)}}(),intersectsSphere:function(r){return this.distanceToPoint(r.center)<=r.radius},distanceToPlane:function(r){var e=r.normal.dot(this.direction);if(e===0)return r.distanceToPoint(this.origin)===0?0:null;var t=-(this.origin.dot(r.normal)+r.constant)/e;return t>=0?t:null},intersectPlane:function(r,e){var t=this.distanceToPlane(r);return t===null?null:this.at(t,e)},intersectsPlane:function(r){var e=r.distanceToPoint(this.origin);if(e===0)return!0;var t=r.normal.dot(this.direction);return t*e<0},intersectBox:function(r,e){var t,i,n,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,f=this.origin;return l>=0?(t=(r.min.x-f.x)*l,i=(r.max.x-f.x)*l):(t=(r.max.x-f.x)*l,i=(r.min.x-f.x)*l),u>=0?(n=(r.min.y-f.y)*u,a=(r.max.y-f.y)*u):(n=(r.max.y-f.y)*u,a=(r.min.y-f.y)*u),t>a||n>i||((n>t||t!==t)&&(t=n),(a<i||i!==i)&&(i=a),c>=0?(o=(r.min.z-f.z)*c,s=(r.max.z-f.z)*c):(o=(r.max.z-f.z)*c,s=(r.min.z-f.z)*c),t>s||o>i)||((o>t||t!==t)&&(t=o),(s<i||i!==i)&&(i=s),i<0)?null:this.at(t>=0?t:i,e)},intersectsBox:function(){var r=new oe;return function(t){return this.intersectBox(t,r)!==null}}(),intersectTriangle:function(){var r=new oe,e=new oe,t=new oe,i=new oe;return function(a,o,s,l,u){e.subVectors(o,a),t.subVectors(s,a),i.crossVectors(e,t);var c=this.direction.dot(i),f;if(c>0){if(l)return null;f=1}else if(c<0)f=-1,c=-c;else return null;r.subVectors(this.origin,a);var h=f*this.direction.dot(t.crossVectors(r,t));if(h<0)return null;var p=f*this.direction.dot(e.cross(r));if(p<0||h+p>c)return null;var d=-f*r.dot(i);return d<0?null:this.at(d/c,u)}}(),applyMatrix4:function(r){return this.direction.add(this.origin).applyMatrix4(r),this.origin.applyMatrix4(r),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(r){return r.origin.equals(this.origin)&&r.direction.equals(this.direction)}};bh.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];bh.DefaultOrder="XYZ";bh.prototype={constructor:bh,isEuler:!0,get x(){return this._x},set x(r){this._x=r,this.onChangeCallback()},get y(){return this._y},set y(r){this._y=r,this.onChangeCallback()},get z(){return this._z},set z(r){this._z=r,this.onChangeCallback()},get order(){return this._order},set order(r){this._order=r,this.onChangeCallback()},set:function(r,e,t,i){return this._x=r,this._y=e,this._z=t,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(r){return this._x=r._x,this._y=r._y,this._z=r._z,this._order=r._order,this.onChangeCallback(),this},setFromRotationMatrix:function(r,e,t){var i=cr.clamp,n=r.elements,a=n[0],o=n[4],s=n[8],l=n[1],u=n[5],c=n[9],f=n[2],h=n[6],p=n[10];return e=e||this._order,e==="XYZ"?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(h,u),this._z=0)):e==="YXZ"?(this._x=Math.asin(-i(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-f,a),this._z=0)):e==="ZXY"?(this._x=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,a))):e==="ZYX"?(this._y=Math.asin(-i(f,-1,1)),Math.abs(f)<.99999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,u))):e==="YZX"?(this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-f,a)):(this._x=0,this._y=Math.atan2(s,p))):e==="XZY"?(this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(h,u),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-c,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,t!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeRotationFromQuaternion(t),this.setFromRotationMatrix(r,i,n)}}(),setFromVector3:function(r,e){return this.set(r.x,r.y,r.z,e||this._order)},reorder:function(){var r=new on;return function(t){return r.setFromEuler(this),this.setFromQuaternion(r,t)}}(),equals:function(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._order===this._order},fromArray:function(r){return this._x=r[0],this._y=r[1],this._z=r[2],r[3]!==void 0&&(this._order=r[3]),this.onChangeCallback(),this},toArray:function(r,e){return r===void 0&&(r=[]),e===void 0&&(e=0),r[e]=this._x,r[e+1]=this._y,r[e+2]=this._z,r[e+3]=this._order,r},toVector3:function(r){return r?r.set(this._x,this._y,this._z):new oe(this._x,this._y,this._z)},onChange:function(r){return this.onChangeCallback=r,this},onChangeCallback:function(){}};qA.prototype={constructor:qA,set:function(r){this.mask=1<<r},enable:function(r){this.mask|=1<<r},toggle:function(r){this.mask^=1<<r},disable:function(r){this.mask&=~(1<<r)},test:function(r){return(this.mask&r.mask)!==0}};CRe=0;Et.DefaultUp=new oe(0,1,0);Et.DefaultMatrixAutoUpdate=!0;Object.assign(Et.prototype,Ms.prototype,{isObject3D:!0,applyMatrix:function(r){this.matrix.multiplyMatrices(r,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(r,e){this.quaternion.setFromAxisAngle(r,e)},setRotationFromEuler:function(r){this.quaternion.setFromEuler(r,!0)},setRotationFromMatrix:function(r){this.quaternion.setFromRotationMatrix(r)},setRotationFromQuaternion:function(r){this.quaternion.copy(r)},rotateOnAxis:function(){var r=new on;return function(t,i){return r.setFromAxisAngle(t,i),this.quaternion.multiply(r),this}}(),rotateX:function(){var r=new oe(1,0,0);return function(t){return this.rotateOnAxis(r,t)}}(),rotateY:function(){var r=new oe(0,1,0);return function(t){return this.rotateOnAxis(r,t)}}(),rotateZ:function(){var r=new oe(0,0,1);return function(t){return this.rotateOnAxis(r,t)}}(),translateOnAxis:function(){var r=new oe;return function(t,i){return r.copy(t).applyQuaternion(this.quaternion),this.position.add(r.multiplyScalar(i)),this}}(),translateX:function(){var r=new oe(1,0,0);return function(t){return this.translateOnAxis(r,t)}}(),translateY:function(){var r=new oe(0,1,0);return function(t){return this.translateOnAxis(r,t)}}(),translateZ:function(){var r=new oe(0,0,1);return function(t){return this.translateOnAxis(r,t)}}(),localToWorld:function(r){return r.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var r=new qt;return function(t){return t.applyMatrix4(r.getInverse(this.matrixWorld))}}(),lookAt:function(){var r=new qt;return function(t){r.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(r)}}(),add:function(r){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return r===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",r),this):(r&&r.isObject3D?(r.parent!==null&&r.parent.remove(r),r.parent=this,r.dispatchEvent({type:"added"}),this.children.push(r)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",r),this)},remove:function(r){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var t=this.children.indexOf(r);t!==-1&&(r.parent=null,r.dispatchEvent({type:"removed"}),this.children.splice(t,1))},getObjectById:function(r){return this.getObjectByProperty("id",r)},getObjectByName:function(r){return this.getObjectByProperty("name",r)},getObjectByProperty:function(r,e){if(this[r]===e)return this;for(var t=0,i=this.children.length;t<i;t++){var n=this.children[t],a=n.getObjectByProperty(r,e);if(a!==void 0)return a}},getWorldPosition:function(r){var e=r||new oe;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var r=new oe,e=new oe;return function(i){var n=i||new on;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,n,e),n}}(),getWorldRotation:function(){var r=new on;return function(t){var i=t||new bh;return this.getWorldQuaternion(r),i.setFromQuaternion(r,this.rotation.order,!1)}}(),getWorldScale:function(){var r=new oe,e=new on;return function(i){var n=i||new oe;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,e,n),n}}(),getWorldDirection:function(){var r=new on;return function(t){var i=t||new oe;return this.getWorldQuaternion(r),i.set(0,0,1).applyQuaternion(r)}}(),raycast:function(){},traverse:function(r){r(this);for(var e=this.children,t=0,i=e.length;t<i;t++)e[t].traverse(r)},traverseVisible:function(r){if(this.visible!==!1){r(this);for(var e=this.children,t=0,i=e.length;t<i;t++)e[t].traverseVisible(r)}},traverseAncestors:function(r){var e=this.parent;e!==null&&(r(e),e.traverseAncestors(r))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(r){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||r===!0)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,r=!0);for(var e=this.children,t=0,i=e.length;t<i;t++)e[t].updateMatrixWorld(r)},toJSON:function(r){var e=r===void 0||r==="",t={};e&&(r={geometries:{},materials:{},textures:{},images:{}},t.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),i.matrix=this.matrix.toArray(),this.geometry!==void 0&&(r.geometries[this.geometry.uuid]===void 0&&(r.geometries[this.geometry.uuid]=this.geometry.toJSON(r)),i.geometry=this.geometry.uuid),this.material!==void 0&&(r.materials[this.material.uuid]===void 0&&(r.materials[this.material.uuid]=this.material.toJSON(r)),i.material=this.material.uuid),this.children.length>0){i.children=[];for(var n=0;n<this.children.length;n++)i.children.push(this.children[n].toJSON(r).object)}if(e){var a=u(r.geometries),o=u(r.materials),s=u(r.textures),l=u(r.images);a.length>0&&(t.geometries=a),o.length>0&&(t.materials=o),s.length>0&&(t.textures=s),l.length>0&&(t.images=l)}return t.object=i,t;function u(c){var f=[];for(var h in c){var p=c[h];delete p.metadata,f.push(p)}return f}},clone:function(r){return new this.constructor().copy(this,r)},copy:function(r,e){if(e===void 0&&(e=!0),this.name=r.name,this.up.copy(r.up),this.position.copy(r.position),this.quaternion.copy(r.quaternion),this.scale.copy(r.scale),this.matrix.copy(r.matrix),this.matrixWorld.copy(r.matrixWorld),this.matrixAutoUpdate=r.matrixAutoUpdate,this.matrixWorldNeedsUpdate=r.matrixWorldNeedsUpdate,this.layers.mask=r.layers.mask,this.visible=r.visible,this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.frustumCulled=r.frustumCulled,this.renderOrder=r.renderOrder,this.userData=JSON.parse(JSON.stringify(r.userData)),e===!0)for(var t=0;t<r.children.length;t++){var i=r.children[t];this.add(i.clone())}return this}});Rd.prototype={constructor:Rd,set:function(r,e){return this.start.copy(r),this.end.copy(e),this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.start.copy(r.start),this.end.copy(r.end),this},getCenter:function(r){var e=r||new oe;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(r){var e=r||new oe;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(r,e){var t=e||new oe;return this.delta(t).multiplyScalar(r).add(this.start)},closestPointToPointParameter:function(){var r=new oe,e=new oe;return function(i,n){r.subVectors(i,this.start),e.subVectors(this.end,this.start);var a=e.dot(e),o=e.dot(r),s=o/a;return n&&(s=cr.clamp(s,0,1)),s}}(),closestPointToPoint:function(r,e,t){var i=this.closestPointToPointParameter(r,e),n=t||new oe;return this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(r){return this.start.applyMatrix4(r),this.end.applyMatrix4(r),this},equals:function(r){return r.start.equals(this.start)&&r.end.equals(this.end)}};Ss.normal=function(){var r=new oe;return function(t,i,n,a){var o=a||new oe;o.subVectors(n,i),r.subVectors(t,i),o.cross(r);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}();Ss.barycoordFromPoint=function(){var r=new oe,e=new oe,t=new oe;return function(n,a,o,s,l){r.subVectors(s,a),e.subVectors(o,a),t.subVectors(n,a);var u=r.dot(r),c=r.dot(e),f=r.dot(t),h=e.dot(e),p=e.dot(t),d=u*h-c*c,g=l||new oe;if(d===0)return g.set(-2,-1,-1);var m=1/d,v=(h*f-c*p)*m,_=(u*p-c*f)*m;return g.set(1-v-_,_,v)}}();Ss.containsPoint=function(){var r=new oe;return function(t,i,n,a){var o=Ss.barycoordFromPoint(t,i,n,a,r);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}();Ss.prototype={constructor:Ss,set:function(r,e,t){return this.a.copy(r),this.b.copy(e),this.c.copy(t),this},setFromPointsAndIndices:function(r,e,t,i){return this.a.copy(r[e]),this.b.copy(r[t]),this.c.copy(r[i]),this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.a.copy(r.a),this.b.copy(r.b),this.c.copy(r.c),this},area:function(){var r=new oe,e=new oe;return function(){return r.subVectors(this.c,this.b),e.subVectors(this.a,this.b),r.cross(e).length()*.5}}(),midpoint:function(r){var e=r||new oe;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(r){return Ss.normal(this.a,this.b,this.c,r)},plane:function(r){var e=r||new Io;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(r,e){return Ss.barycoordFromPoint(r,this.a,this.b,this.c,e)},containsPoint:function(r){return Ss.containsPoint(r,this.a,this.b,this.c)},closestPointToPoint:function(){var r,e,t,i;return function(a,o){r===void 0&&(r=new Io,e=[new Rd,new Rd,new Rd],t=new oe,i=new oe);var s=o||new oe,l=1/0;if(r.setFromCoplanarPoints(this.a,this.b,this.c),r.projectPoint(a,t),this.containsPoint(t)===!0)s.copy(t);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var u=0;u<e.length;u++){e[u].closestPointToPoint(t,!0,i);var c=t.distanceToSquared(i);c<l&&(l=c,s.copy(i))}}return s}}(),equals:function(r){return r.a.equals(this.a)&&r.b.equals(this.b)&&r.c.equals(this.c)}};Fo.prototype={constructor:Fo,clone:function(){return new this.constructor().copy(this)},copy:function(r){this.a=r.a,this.b=r.b,this.c=r.c,this.normal.copy(r.normal),this.color.copy(r.color),this.materialIndex=r.materialIndex;for(var e=0,t=r.vertexNormals.length;e<t;e++)this.vertexNormals[e]=r.vertexNormals[e].clone();for(var e=0,t=r.vertexColors.length;e<t;e++)this.vertexColors[e]=r.vertexColors[e].clone();return this}};io.prototype=Object.create(mr.prototype);io.prototype.constructor=io;io.prototype.isMeshBasicMaterial=!0;io.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this};gt.prototype={constructor:gt,isBufferAttribute:!0,set needsUpdate(r){r===!0&&this.version++},setArray:function(r){if(Array.isArray(r))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=r!==void 0?r.length/this.itemSize:0,this.array=r},setDynamic:function(r){return this.dynamic=r,this},copy:function(r){return this.array=new r.array.constructor(r.array),this.itemSize=r.itemSize,this.count=r.count,this.normalized=r.normalized,this.dynamic=r.dynamic,this},copyAt:function(r,e,t){r*=this.itemSize,t*=e.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[r+i]=e.array[t+i];return this},copyArray:function(r){return this.array.set(r),this},copyColorsArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new Gt),e[t++]=a.r,e[t++]=a.g,e[t++]=a.b}return this},copyIndicesArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];e[t++]=a.a,e[t++]=a.b,e[t++]=a.c}return this},copyVector2sArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new St),e[t++]=a.x,e[t++]=a.y}return this},copyVector3sArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new oe),e[t++]=a.x,e[t++]=a.y,e[t++]=a.z}return this},copyVector4sArray:function(r){for(var e=this.array,t=0,i=0,n=r.length;i<n;i++){var a=r[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new Qr),e[t++]=a.x,e[t++]=a.y,e[t++]=a.z,e[t++]=a.w}return this},set:function(r,e){return e===void 0&&(e=0),this.array.set(r,e),this},getX:function(r){return this.array[r*this.itemSize]},setX:function(r,e){return this.array[r*this.itemSize]=e,this},getY:function(r){return this.array[r*this.itemSize+1]},setY:function(r,e){return this.array[r*this.itemSize+1]=e,this},getZ:function(r){return this.array[r*this.itemSize+2]},setZ:function(r,e){return this.array[r*this.itemSize+2]=e,this},getW:function(r){return this.array[r*this.itemSize+3]},setW:function(r,e){return this.array[r*this.itemSize+3]=e,this},setXY:function(r,e,t){return r*=this.itemSize,this.array[r+0]=e,this.array[r+1]=t,this},setXYZ:function(r,e,t,i){return r*=this.itemSize,this.array[r+0]=e,this.array[r+1]=t,this.array[r+2]=i,this},setXYZW:function(r,e,t,i,n){return r*=this.itemSize,this.array[r+0]=e,this.array[r+1]=t,this.array[r+2]=i,this.array[r+3]=n,this},onUpload:function(r){return this.onUploadCallback=r,this},clone:function(){return new this.constructor().copy(this)}};IS.prototype=Object.create(gt.prototype);IS.prototype.constructor=IS;NS.prototype=Object.create(gt.prototype);NS.prototype.constructor=NS;US.prototype=Object.create(gt.prototype);US.prototype.constructor=US;OS.prototype=Object.create(gt.prototype);OS.prototype.constructor=OS;nc.prototype=Object.create(gt.prototype);nc.prototype.constructor=nc;FS.prototype=Object.create(gt.prototype);FS.prototype.constructor=FS;ac.prototype=Object.create(gt.prototype);ac.prototype.constructor=ac;gr.prototype=Object.create(gt.prototype);gr.prototype.constructor=gr;zS.prototype=Object.create(gt.prototype);zS.prototype.constructor=zS;Object.assign(Hne.prototype,{computeGroups:function(r){for(var e,t=[],i=void 0,n=r.faces,a=0;a<n.length;a++){var o=n[a];o.materialIndex!==i&&(i=o.materialIndex,e!==void 0&&(e.count=a*3-e.start,t.push(e)),e={start:a*3,materialIndex:i})}e!==void 0&&(e.count=a*3-e.start,t.push(e)),this.groups=t},fromGeometry:function(r){var e=r.faces,t=r.vertices,i=r.faceVertexUvs,n=i[0]&&i[0].length>0,a=i[1]&&i[1].length>0,o=r.morphTargets,s=o.length,l;if(s>0){l=[];for(var u=0;u<s;u++)l[u]=[];this.morphTargets.position=l}var c=r.morphNormals,f=c.length,h;if(f>0){h=[];for(var u=0;u<f;u++)h[u]=[];this.morphTargets.normal=h}for(var p=r.skinIndices,d=r.skinWeights,g=p.length===t.length,m=d.length===t.length,u=0;u<e.length;u++){var v=e[u];this.vertices.push(t[v.a],t[v.b],t[v.c]);var _=v.vertexNormals;if(_.length===3)this.normals.push(_[0],_[1],_[2]);else{var y=v.normal;this.normals.push(y,y,y)}var x=v.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{var M=v.color;this.colors.push(M,M,M)}if(n===!0){var S=i[0][u];S!==void 0?this.uvs.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",u),this.uvs.push(new St,new St,new St))}if(a===!0){var S=i[1][u];S!==void 0?this.uvs2.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",u),this.uvs2.push(new St,new St,new St))}for(var w=0;w<s;w++){var T=o[w].vertices;l[w].push(T[v.a],T[v.b],T[v.c])}for(var w=0;w<f;w++){var C=c[w].vertexNormals[u];h[w].push(C.a,C.b,C.c)}g&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),m&&this.skinWeights.push(d[v.a],d[v.b],d[v.c])}return this.computeGroups(r),this.verticesNeedUpdate=r.verticesNeedUpdate,this.normalsNeedUpdate=r.normalsNeedUpdate,this.colorsNeedUpdate=r.colorsNeedUpdate,this.uvsNeedUpdate=r.uvsNeedUpdate,this.groupsNeedUpdate=r.groupsNeedUpdate,this}});Object.assign(or.prototype,Ms.prototype,{isGeometry:!0,applyMatrix:function(r){for(var e=new bs().getNormalMatrix(r),t=0,i=this.vertices.length;t<i;t++){var n=this.vertices[t];n.applyMatrix4(r)}for(var t=0,i=this.faces.length;t<i;t++){var a=this.faces[t];a.normal.applyMatrix3(e).normalize();for(var o=0,s=a.vertexNormals.length;o<s;o++)a.vertexNormals[o].applyMatrix3(e).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationX(t),this.applyMatrix(r),this}}(),rotateY:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationY(t),this.applyMatrix(r),this}}(),rotateZ:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationZ(t),this.applyMatrix(r),this}}(),translate:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeTranslation(t,i,n),this.applyMatrix(r),this}}(),scale:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeScale(t,i,n),this.applyMatrix(r),this}}(),lookAt:function(){var r;return function(t){r===void 0&&(r=new Et),r.lookAt(t),r.updateMatrix(),this.applyMatrix(r.matrix)}}(),fromBufferGeometry:function(r){var e=this,t=r.index!==null?r.index.array:void 0,i=r.attributes,n=i.position.array,a=i.normal!==void 0?i.normal.array:void 0,o=i.color!==void 0?i.color.array:void 0,s=i.uv!==void 0?i.uv.array:void 0,l=i.uv2!==void 0?i.uv2.array:void 0;l!==void 0&&(this.faceVertexUvs[1]=[]);for(var u=[],c=[],f=[],h=0,p=0;h<n.length;h+=3,p+=2)e.vertices.push(new oe(n[h],n[h+1],n[h+2])),a!==void 0&&u.push(new oe(a[h],a[h+1],a[h+2])),o!==void 0&&e.colors.push(new Gt(o[h],o[h+1],o[h+2])),s!==void 0&&c.push(new St(s[p],s[p+1])),l!==void 0&&f.push(new St(l[p],l[p+1]));function d(x,M,S,w){var T=a!==void 0?[u[x].clone(),u[M].clone(),u[S].clone()]:[],C=o!==void 0?[e.colors[x].clone(),e.colors[M].clone(),e.colors[S].clone()]:[],b=new Fo(x,M,S,T,C,w);e.faces.push(b),s!==void 0&&e.faceVertexUvs[0].push([c[x].clone(),c[M].clone(),c[S].clone()]),l!==void 0&&e.faceVertexUvs[1].push([f[x].clone(),f[M].clone(),f[S].clone()])}if(t!==void 0){var g=r.groups;if(g.length>0)for(var h=0;h<g.length;h++)for(var m=g[h],v=m.start,_=m.count,p=v,y=v+_;p<y;p+=3)d(t[p],t[p+1],t[p+2],m.materialIndex);else for(var h=0;h<t.length;h+=3)d(t[h],t[h+1],t[h+2])}else for(var h=0;h<n.length/3;h+=3)d(h,h+1,h+2);return this.computeFaceNormals(),r.boundingBox!==null&&(this.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(this.boundingSphere=r.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var r=this.boundingBox.getCenter().negate();return this.translate(r.x,r.y,r.z),r},normalize:function(){this.computeBoundingSphere();var r=this.boundingSphere.center,e=this.boundingSphere.radius,t=e===0?1:1/e,i=new qt;return i.set(t,0,0,-t*r.x,0,t,0,-t*r.y,0,0,t,-t*r.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var r=new oe,e=new oe,t=0,i=this.faces.length;t<i;t++){var n=this.faces[t],a=this.vertices[n.a],o=this.vertices[n.b],s=this.vertices[n.c];r.subVectors(s,o),e.subVectors(a,o),r.cross(e),r.normalize(),n.normal.copy(r)}},computeVertexNormals:function(r){r===void 0&&(r=!0);var e,t,i,n,a,o;for(o=new Array(this.vertices.length),e=0,t=this.vertices.length;e<t;e++)o[e]=new oe;if(r){var s,l,u,c=new oe,f=new oe;for(i=0,n=this.faces.length;i<n;i++)a=this.faces[i],s=this.vertices[a.a],l=this.vertices[a.b],u=this.vertices[a.c],c.subVectors(u,l),f.subVectors(s,l),c.cross(f),o[a.a].add(c),o[a.b].add(c),o[a.c].add(c)}else for(this.computeFaceNormals(),i=0,n=this.faces.length;i<n;i++)a=this.faces[i],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,t=this.vertices.length;e<t;e++)o[e].normalize();for(i=0,n=this.faces.length;i<n;i++){a=this.faces[i];var h=a.vertexNormals;h.length===3?(h[0].copy(o[a.a]),h[1].copy(o[a.b]),h[2].copy(o[a.c])):(h[0]=o[a.a].clone(),h[1]=o[a.b].clone(),h[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var r,e,t;for(this.computeFaceNormals(),r=0,e=this.faces.length;r<e;r++){t=this.faces[r];var i=t.vertexNormals;i.length===3?(i[0].copy(t.normal),i[1].copy(t.normal),i[2].copy(t.normal)):(i[0]=t.normal.clone(),i[1]=t.normal.clone(),i[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var r,e,t,i,n;for(t=0,i=this.faces.length;t<i;t++)for(n=this.faces[t],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),r=0,e=n.vertexNormals.length;r<e;r++)n.__originalVertexNormals[r]?n.__originalVertexNormals[r].copy(n.vertexNormals[r]):n.__originalVertexNormals[r]=n.vertexNormals[r].clone();var a=new or;for(a.faces=this.faces,r=0,e=this.morphTargets.length;r<e;r++){if(!this.morphNormals[r]){this.morphNormals[r]={},this.morphNormals[r].faceNormals=[],this.morphNormals[r].vertexNormals=[];var o=this.morphNormals[r].faceNormals,s=this.morphNormals[r].vertexNormals,u,c;for(t=0,i=this.faces.length;t<i;t++)u=new oe,c={a:new oe,b:new oe,c:new oe},o.push(u),s.push(c)}var l=this.morphNormals[r];a.vertices=this.morphTargets[r].vertices,a.computeFaceNormals(),a.computeVertexNormals();var u,c;for(t=0,i=this.faces.length;t<i;t++)n=this.faces[t],u=l.faceNormals[t],c=l.vertexNormals[t],u.copy(n.normal),c.a.copy(n.vertexNormals[0]),c.b.copy(n.vertexNormals[1]),c.c.copy(n.vertexNormals[2])}for(t=0,i=this.faces.length;t<i;t++)n=this.faces[t],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeLineDistances:function(){for(var r=0,e=this.vertices,t=0,i=e.length;t<i;t++)t>0&&(r+=e[t].distanceTo(e[t-1])),this.lineDistances[t]=r},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new lu),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new $n),this.boundingSphere.setFromPoints(this.vertices)},merge:function(r,e,t){if((r&&r.isGeometry)===!1){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",r);return}var i,n=this.vertices.length,a=this.vertices,o=r.vertices,s=this.faces,l=r.faces,u=this.faceVertexUvs[0],c=r.faceVertexUvs[0],f=this.colors,h=r.colors;t===void 0&&(t=0),e!==void 0&&(i=new bs().getNormalMatrix(e));for(var p=0,d=o.length;p<d;p++){var g=o[p],m=g.clone();e!==void 0&&m.applyMatrix4(e),a.push(m)}for(var p=0,d=h.length;p<d;p++)f.push(h[p].clone());for(p=0,d=l.length;p<d;p++){var v=l[p],_,y,x,M=v.vertexNormals,S=v.vertexColors;_=new Fo(v.a+n,v.b+n,v.c+n),_.normal.copy(v.normal),i!==void 0&&_.normal.applyMatrix3(i).normalize();for(var w=0,T=M.length;w<T;w++)y=M[w].clone(),i!==void 0&&y.applyMatrix3(i).normalize(),_.vertexNormals.push(y);_.color.copy(v.color);for(var w=0,T=S.length;w<T;w++)x=S[w],_.vertexColors.push(x.clone());_.materialIndex=v.materialIndex+t,s.push(_)}for(p=0,d=c.length;p<d;p++){var C=c[p],b=[];if(C!==void 0){for(var w=0,T=C.length;w<T;w++)b.push(C[w].clone());u.push(b)}}},mergeMesh:function(r){if((r&&r.isMesh)===!1){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",r);return}r.matrixAutoUpdate&&r.updateMatrix(),this.merge(r.geometry,r.matrix)},mergeVertices:function(){var r={},e=[],t=[],i,n,a=4,o=Math.pow(10,a),s,l,u,c,f,h;for(s=0,l=this.vertices.length;s<l;s++)i=this.vertices[s],n=Math.round(i.x*o)+"_"+Math.round(i.y*o)+"_"+Math.round(i.z*o),r[n]===void 0?(r[n]=s,e.push(this.vertices[s]),t[s]=e.length-1):t[s]=t[r[n]];var p=[];for(s=0,l=this.faces.length;s<l;s++){u=this.faces[s],u.a=t[u.a],u.b=t[u.b],u.c=t[u.c],c=[u.a,u.b,u.c];for(var d=-1,g=0;g<3;g++)if(c[g]===c[(g+1)%3]){d=g,p.push(s);break}}for(s=p.length-1;s>=0;s--){var m=p[s];for(this.faces.splice(m,1),f=0,h=this.faceVertexUvs.length;f<h;f++)this.faceVertexUvs[f].splice(m,1)}var v=this.vertices.length-e.length;return this.vertices=e,v},sortFacesByMaterialIndex:function(){for(var r=this.faces,e=r.length,t=0;t<e;t++)r[t]._id=t;function i(u,c){return u.materialIndex-c.materialIndex}r.sort(i);var n=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;n&&n.length===e&&(o=[]),a&&a.length===e&&(s=[]);for(var t=0;t<e;t++){var l=r[t]._id;o&&o.push(n[l]),s&&s.push(a[l])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var r={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.parameters!==void 0){var e=this.parameters;for(var t in e)e[t]!==void 0&&(r[t]=e[t]);return r}for(var i=[],n=0;n<this.vertices.length;n++){var a=this.vertices[n];i.push(a.x,a.y,a.z)}for(var o=[],s=[],l={},u=[],c={},f=[],h={},n=0;n<this.faces.length;n++){var p=this.faces[n],d=!0,g=!1,m=this.faceVertexUvs[0][n]!==void 0,v=p.normal.length()>0,_=p.vertexNormals.length>0,y=p.color.r!==1||p.color.g!==1||p.color.b!==1,x=p.vertexColors.length>0,M=0;if(M=C(M,0,0),M=C(M,1,d),M=C(M,2,g),M=C(M,3,m),M=C(M,4,v),M=C(M,5,_),M=C(M,6,y),M=C(M,7,x),o.push(M),o.push(p.a,p.b,p.c),o.push(p.materialIndex),m){var S=this.faceVertexUvs[0][n];o.push(I(S[0]),I(S[1]),I(S[2]))}if(v&&o.push(b(p.normal)),_){var w=p.vertexNormals;o.push(b(w[0]),b(w[1]),b(w[2]))}if(y&&o.push(E(p.color)),x){var T=p.vertexColors;o.push(E(T[0]),E(T[1]),E(T[2]))}}function C(R,A,D){return D?R|1<<A:R&~(1<<A)}function b(R){var A=R.x.toString()+R.y.toString()+R.z.toString();return l[A]!==void 0||(l[A]=s.length/3,s.push(R.x,R.y,R.z)),l[A]}function E(R){var A=R.r.toString()+R.g.toString()+R.b.toString();return c[A]!==void 0||(c[A]=u.length,u.push(R.getHex())),c[A]}function I(R){var A=R.x.toString()+R.y.toString();return h[A]!==void 0||(h[A]=f.length/2,f.push(R.x,R.y)),h[A]}return r.data={},r.data.vertices=i,r.data.normals=s,u.length>0&&(r.data.colors=u),f.length>0&&(r.data.uvs=[f]),r.data.faces=o,r},clone:function(){return new or().copy(this)},copy:function(r){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var e=r.vertices,t=0,i=e.length;t<i;t++)this.vertices.push(e[t].clone());for(var n=r.colors,t=0,i=n.length;t<i;t++)this.colors.push(n[t].clone());for(var a=r.faces,t=0,i=a.length;t<i;t++)this.faces.push(a[t].clone());for(var t=0,i=r.faceVertexUvs.length;t<i;t++){var o=r.faceVertexUvs[t];this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]);for(var s=0,l=o.length;s<l;s++){for(var u=o[s],c=[],f=0,h=u.length;f<h;f++){var p=u[f];c.push(p.clone())}this.faceVertexUvs[t].push(c)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});RRe=0;Object.assign(Bt.prototype,Ms.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(r){this.index=r},addAttribute:function(r,e){if((e&&e.isBufferAttribute)===!1&&(e&&e.isInterleavedBufferAttribute)===!1){console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(r,new gt(arguments[1],arguments[2]));return}if(r==="index"){console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e);return}return this.attributes[r]=e,this},getAttribute:function(r){return this.attributes[r]},removeAttribute:function(r){return delete this.attributes[r],this},addGroup:function(r,e,t){this.groups.push({start:r,count:e,materialIndex:t!==void 0?t:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(r,e){this.drawRange.start=r,this.drawRange.count=e},applyMatrix:function(r){var e=this.attributes.position;e!==void 0&&(r.applyToVector3Array(e.array),e.needsUpdate=!0);var t=this.attributes.normal;if(t!==void 0){var i=new bs().getNormalMatrix(r);i.applyToVector3Array(t.array),t.needsUpdate=!0}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationX(t),this.applyMatrix(r),this}}(),rotateY:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationY(t),this.applyMatrix(r),this}}(),rotateZ:function(){var r;return function(t){return r===void 0&&(r=new qt),r.makeRotationZ(t),this.applyMatrix(r),this}}(),translate:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeTranslation(t,i,n),this.applyMatrix(r),this}}(),scale:function(){var r;return function(t,i,n){return r===void 0&&(r=new qt),r.makeScale(t,i,n),this.applyMatrix(r),this}}(),lookAt:function(){var r;return function(t){r===void 0&&(r=new Et),r.lookAt(t),r.updateMatrix(),this.applyMatrix(r.matrix)}}(),center:function(){this.computeBoundingBox();var r=this.boundingBox.getCenter().negate();return this.translate(r.x,r.y,r.z),r},setFromObject:function(r){var e=r.geometry;if(r.isPoints||r.isLine){var t=new gr(e.vertices.length*3,3),i=new gr(e.colors.length*3,3);if(this.addAttribute("position",t.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var n=new gr(e.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(e.lineDistances))}e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone())}else r.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(r){var e=r.geometry;if(r.isMesh){var t=e.__directGeometry;if(e.elementsNeedUpdate===!0&&(t=void 0,e.elementsNeedUpdate=!1),t===void 0)return this.fromGeometry(e);t.verticesNeedUpdate=e.verticesNeedUpdate,t.normalsNeedUpdate=e.normalsNeedUpdate,t.colorsNeedUpdate=e.colorsNeedUpdate,t.uvsNeedUpdate=e.uvsNeedUpdate,t.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=t}var i;return e.verticesNeedUpdate===!0&&(i=this.attributes.position,i!==void 0&&(i.copyVector3sArray(e.vertices),i.needsUpdate=!0),e.verticesNeedUpdate=!1),e.normalsNeedUpdate===!0&&(i=this.attributes.normal,i!==void 0&&(i.copyVector3sArray(e.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1),e.colorsNeedUpdate===!0&&(i=this.attributes.color,i!==void 0&&(i.copyColorsArray(e.colors),i.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(i=this.attributes.uv,i!==void 0&&(i.copyVector2sArray(e.uvs),i.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(i=this.attributes.lineDistance,i!==void 0&&(i.copyArray(e.lineDistances),i.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(r.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(r){return r.__directGeometry=new Hne().fromGeometry(r),this.fromDirectGeometry(r.__directGeometry)},fromDirectGeometry:function(r){var e=new Float32Array(r.vertices.length*3);if(this.addAttribute("position",new gt(e,3).copyVector3sArray(r.vertices)),r.normals.length>0){var t=new Float32Array(r.normals.length*3);this.addAttribute("normal",new gt(t,3).copyVector3sArray(r.normals))}if(r.colors.length>0){var i=new Float32Array(r.colors.length*3);this.addAttribute("color",new gt(i,3).copyColorsArray(r.colors))}if(r.uvs.length>0){var n=new Float32Array(r.uvs.length*2);this.addAttribute("uv",new gt(n,2).copyVector2sArray(r.uvs))}if(r.uvs2.length>0){var a=new Float32Array(r.uvs2.length*2);this.addAttribute("uv2",new gt(a,2).copyVector2sArray(r.uvs2))}if(r.indices.length>0){var o=r.vertices.length>65535?Uint32Array:Uint16Array,s=new o(r.indices.length*3);this.setIndex(new gt(s,1).copyIndicesArray(r.indices))}this.groups=r.groups;for(var l in r.morphTargets){for(var u=[],c=r.morphTargets[l],f=0,h=c.length;f<h;f++){var p=c[f],d=new gr(p.length*3,3);u.push(d.copyVector3sArray(p))}this.morphAttributes[l]=u}if(r.skinIndices.length>0){var g=new gr(r.skinIndices.length*4,4);this.addAttribute("skinIndex",g.copyVector4sArray(r.skinIndices))}if(r.skinWeights.length>0){var m=new gr(r.skinWeights.length*4,4);this.addAttribute("skinWeight",m.copyVector4sArray(r.skinWeights))}return r.boundingSphere!==null&&(this.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(this.boundingBox=r.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new lu);var r=this.attributes.position;r!==void 0?this.boundingBox.setFromBufferAttribute(r):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:function(){var r=new lu,e=new oe;return function(){this.boundingSphere===null&&(this.boundingSphere=new $n);var i=this.attributes.position;if(i){var n=this.boundingSphere.center;r.setFromBufferAttribute(i),r.getCenter(n);for(var a=0,o=0,s=i.count;o<s;o++)e.x=i.getX(o),e.y=i.getY(o),e.z=i.getZ(o),a=Math.max(a,n.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var r=this.index,e=this.attributes,t=this.groups;if(e.position){var i=e.position.array;if(e.normal===void 0)this.addAttribute("normal",new gt(new Float32Array(i.length),3));else for(var n=e.normal.array,a=0,o=n.length;a<o;a++)n[a]=0;var s=e.normal.array,l,u,c,f=new oe,h=new oe,p=new oe,d=new oe,g=new oe;if(r){var m=r.array;t.length===0&&this.addGroup(0,m.length);for(var v=0,_=t.length;v<_;++v)for(var y=t[v],x=y.start,M=y.count,a=x,o=x+M;a<o;a+=3)l=m[a+0]*3,u=m[a+1]*3,c=m[a+2]*3,f.fromArray(i,l),h.fromArray(i,u),p.fromArray(i,c),d.subVectors(p,h),g.subVectors(f,h),d.cross(g),s[l]+=d.x,s[l+1]+=d.y,s[l+2]+=d.z,s[u]+=d.x,s[u+1]+=d.y,s[u+2]+=d.z,s[c]+=d.x,s[c+1]+=d.y,s[c+2]+=d.z}else for(var a=0,o=i.length;a<o;a+=9)f.fromArray(i,a),h.fromArray(i,a+3),p.fromArray(i,a+6),d.subVectors(p,h),g.subVectors(f,h),d.cross(g),s[a]=d.x,s[a+1]=d.y,s[a+2]=d.z,s[a+3]=d.x,s[a+4]=d.y,s[a+5]=d.z,s[a+6]=d.x,s[a+7]=d.y,s[a+8]=d.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(r,e){if((r&&r.isBufferGeometry)===!1){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",r);return}e===void 0&&(e=0);var t=this.attributes;for(var i in t)if(r.attributes[i]!==void 0)for(var n=t[i],a=n.array,o=r.attributes[i],s=o.array,l=o.itemSize,u=0,c=l*e;u<s.length;u++,c++)a[c]=s[u];return this},normalizeNormals:function(){for(var r=this.attributes.normal.array,e,t,i,n,a=0,o=r.length;a<o;a+=3)e=r[a],t=r[a+1],i=r[a+2],n=1/Math.sqrt(e*e+t*t+i*i),r[a]*=n,r[a+1]*=n,r[a+2]*=n},toNonIndexed:function(){if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var r=new Bt,e=this.index.array,t=this.attributes;for(var i in t){for(var n=t[i],a=n.array,o=n.itemSize,s=new a.constructor(e.length*o),l=0,u=0,c=0,f=e.length;c<f;c++){l=e[c]*o;for(var h=0;h<o;h++)s[u++]=a[l++]}r.addAttribute(i,new gt(s,o))}return r},toJSON:function(){var r={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.parameters!==void 0){var e=this.parameters;for(var t in e)e[t]!==void 0&&(r[t]=e[t]);return r}r.data={attributes:{}};var i=this.index;if(i!==null){var n=Array.prototype.slice.call(i.array);r.data.index={type:i.array.constructor.name,array:n}}var a=this.attributes;for(var t in a){var o=a[t],n=Array.prototype.slice.call(o.array);r.data.attributes[t]={itemSize:o.itemSize,type:o.array.constructor.name,array:n,normalized:o.normalized}}var s=this.groups;s.length>0&&(r.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return l!==null&&(r.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),r},clone:function(){return new Bt().copy(this)},copy:function(r){var e=r.index;e!==null&&this.setIndex(e.clone());var t=r.attributes;for(var i in t){var n=t[i];this.addAttribute(i,n.clone())}for(var a=r.groups,o=0,s=a.length;o<s;o++){var l=a[o];this.addGroup(l.start,l.count,l.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Bt.MaxIndex=65535;mn.prototype=Object.assign(Object.create(Et.prototype),{constructor:mn,isMesh:!0,setDrawMode:function(r){this.drawMode=r},copy:function(r){return Et.prototype.copy.call(this,r),this.drawMode=r.drawMode,this},updateMorphTargets:function(){var r=this.geometry.morphTargets;if(r!==void 0&&r.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=r.length;e<t;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[r[e].name]=e}},raycast:function(){var r=new qt,e=new Mh,t=new $n,i=new oe,n=new oe,a=new oe,o=new oe,s=new oe,l=new oe,u=new St,c=new St,f=new St,h=new oe,p=new oe,d=new oe;function g(_,y,x,M,S,w,T){return Ss.barycoordFromPoint(_,y,x,M,h),S.multiplyScalar(h.x),w.multiplyScalar(h.y),T.multiplyScalar(h.z),S.add(w).add(T),S.clone()}function m(_,y,x,M,S,w,T){var C,b=_.material;if(b.side===yh?C=x.intersectTriangle(w,S,M,!0,T):C=x.intersectTriangle(M,S,w,b.side!==Ny,T),C===null)return null;d.copy(T),d.applyMatrix4(_.matrixWorld);var E=y.ray.origin.distanceTo(d);return E<y.near||E>y.far?null:{distance:E,point:d.clone(),object:_}}function v(_,y,x,M,S,w,T,C){i.fromArray(M,w*3),n.fromArray(M,T*3),a.fromArray(M,C*3);var b=m(_,y,x,i,n,a,p);return b&&(S&&(u.fromArray(S,w*2),c.fromArray(S,T*2),f.fromArray(S,C*2),b.uv=g(p,i,n,a,u,c,f)),b.face=new Fo(w,T,C,Ss.normal(i,n,a)),b.faceIndex=w),b}return function(y,x){var M=this.geometry,S=this.material,w=this.matrixWorld;if(S!==void 0&&(M.boundingSphere===null&&M.computeBoundingSphere(),t.copy(M.boundingSphere),t.applyMatrix4(w),y.ray.intersectsSphere(t)!==!1&&(r.getInverse(w),e.copy(y.ray).applyMatrix4(r),!(M.boundingBox!==null&&e.intersectsBox(M.boundingBox)===!1)))){var T,C;if(M.isBufferGeometry){var b,E,I,R=M.index,A=M.attributes,D=A.position.array;if(A.uv!==void 0&&(T=A.uv.array),R!==null)for(var U=R.array,B=0,F=U.length;B<F;B+=3)b=U[B],E=U[B+1],I=U[B+2],C=v(this,y,e,D,T,b,E,I),C&&(C.faceIndex=Math.floor(B/3),x.push(C));else for(var B=0,F=D.length;B<F;B+=9)b=B/3,E=b+1,I=b+2,C=v(this,y,e,D,T,b,E,I),C&&(C.index=b,x.push(C))}else if(M.isGeometry){var k,G,Y,J=S&&S.isMultiMaterial,Q=J===!0?S.materials:null,V=M.vertices,K=M.faces,ae=M.faceVertexUvs[0];ae.length>0&&(T=ae);for(var ve=0,ue=K.length;ve<ue;ve++){var se=K[ve],Ee=J===!0?Q[se.materialIndex]:S;if(Ee!==void 0){if(k=V[se.a],G=V[se.b],Y=V[se.c],Ee.morphTargets===!0){var q=M.morphTargets,H=this.morphTargetInfluences;i.set(0,0,0),n.set(0,0,0),a.set(0,0,0);for(var We=0,_e=q.length;We<_e;We++){var xe=H[We];if(xe!==0){var Le=q[We].vertices;i.addScaledVector(o.subVectors(Le[se.a],k),xe),n.addScaledVector(s.subVectors(Le[se.b],G),xe),a.addScaledVector(l.subVectors(Le[se.c],Y),xe)}}i.add(k),n.add(G),a.add(Y),k=i,G=n,Y=a}if(C=m(this,y,e,k,G,Y,p),C){if(T){var Ue=T[ve];u.copy(Ue[0]),c.copy(Ue[1]),f.copy(Ue[2]),C.uv=g(p,k,G,Y,u,c,f)}C.face=se,C.faceIndex=ve,x.push(C)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});Ud.prototype=Object.create(Bt.prototype);Ud.prototype.constructor=Ud;Od.prototype=Object.create(Bt.prototype);Od.prototype.constructor=Od;Qn.prototype=Object.create(Et.prototype);Qn.prototype.constructor=Qn;Qn.prototype.isCamera=!0;Qn.prototype.getWorldDirection=function(){var r=new on;return function(t){var i=t||new oe;return this.getWorldQuaternion(r),i.set(0,0,-1).applyQuaternion(r)}}();Qn.prototype.lookAt=function(){var r=new qt;return function(t){r.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(r)}}();Qn.prototype.clone=function(){return new this.constructor().copy(this)};Qn.prototype.copy=function(r){return Et.prototype.copy.call(this,r),this.matrixWorldInverse.copy(r.matrixWorldInverse),this.projectionMatrix.copy(r.projectionMatrix),this};Kn.prototype=Object.assign(Object.create(Qn.prototype),{constructor:Kn,isPerspectiveCamera:!0,copy:function(r){return Qn.prototype.copy.call(this,r),this.fov=r.fov,this.zoom=r.zoom,this.near=r.near,this.far=r.far,this.focus=r.focus,this.aspect=r.aspect,this.view=r.view===null?null:Object.assign({},r.view),this.filmGauge=r.filmGauge,this.filmOffset=r.filmOffset,this},setFocalLength:function(r){var e=.5*this.getFilmHeight()/r;this.fov=cr.RAD2DEG*2*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var r=Math.tan(cr.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/r},getEffectiveFOV:function(){return cr.RAD2DEG*2*Math.atan(Math.tan(cr.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(r,e,t,i,n,a){this.aspect=r/e,this.view={fullWidth:r,fullHeight:e,offsetX:t,offsetY:i,width:n,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var r=this.near,e=r*Math.tan(cr.DEG2RAD*.5*this.fov)/this.zoom,t=2*e,i=this.aspect*t,n=-.5*i,a=this.view;if(a!==null){var o=a.fullWidth,s=a.fullHeight;n+=a.offsetX*i/o,e-=a.offsetY*t/s,i*=a.width/o,t*=a.height/s}var l=this.filmOffset;l!==0&&(n+=r*l/this.getFilmWidth()),this.projectionMatrix.makeFrustum(n,n+i,e-t,e,r,this.far)},toJSON:function(r){var e=Et.prototype.toJSON.call(this,r);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,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});ey.prototype=Object.assign(Object.create(Qn.prototype),{constructor:ey,isOrthographicCamera:!0,copy:function(r){return Qn.prototype.copy.call(this,r),this.left=r.left,this.right=r.right,this.top=r.top,this.bottom=r.bottom,this.near=r.near,this.far=r.far,this.zoom=r.zoom,this.view=r.view===null?null:Object.assign({},r.view),this},setViewOffset:function(r,e,t,i,n,a){this.view={fullWidth:r,fullHeight:e,offsetX:t,offsetY:i,width:n,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var r=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),t=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=t-r,a=t+r,o=i+e,s=i-e;if(this.view!==null){var l=this.zoom/(this.view.width/this.view.fullWidth),u=this.zoom/(this.view.height/this.view.fullHeight),c=(this.right-this.left)/this.view.width,f=(this.top-this.bottom)/this.view.height;n+=c*(this.view.offsetX/l),a=n+c*(this.view.width/l),o-=f*(this.view.offsetY/u),s=o-f*(this.view.height/u)}this.projectionMatrix.makeOrthographic(n,a,o,s,this.near,this.far)},toJSON:function(r){var e=Et.prototype.toJSON.call(this,r);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,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}});NRe=0;ty.prototype.isFogExp2=!0;ty.prototype.clone=function(){return new ty(this.color.getHex(),this.density)};ty.prototype.toJSON=function(r){return{type:"FogExp2",color:this.color.getHex(),density:this.density}};ry.prototype.isFog=!0;ry.prototype.clone=function(){return new ry(this.color.getHex(),this.near,this.far)};ry.prototype.toJSON=function(r){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}};Fd.prototype=Object.create(Et.prototype);Fd.prototype.constructor=Fd;Fd.prototype.copy=function(r,e){return Et.prototype.copy.call(this,r,e),r.background!==null&&(this.background=r.background.clone()),r.fog!==null&&(this.fog=r.fog.clone()),r.overrideMaterial!==null&&(this.overrideMaterial=r.overrideMaterial.clone()),this.autoUpdate=r.autoUpdate,this.matrixAutoUpdate=r.matrixAutoUpdate,this};Fd.prototype.toJSON=function(r){var e=Et.prototype.toJSON.call(this,r);return this.background!==null&&(e.object.background=this.background.toJSON(r)),this.fog!==null&&(e.object.fog=this.fog.toJSON()),e};_z.prototype=Object.assign(Object.create(Et.prototype),{constructor:_z,isLensFlare:!0,copy:function(r){Et.prototype.copy.call(this,r),this.positionScreen.copy(r.positionScreen),this.customUpdateCallback=r.customUpdateCallback;for(var e=0,t=r.lensFlares.length;e<t;e++)this.lensFlares.push(r.lensFlares[e]);return this},add:function(r,e,t,i,n,a){e===void 0&&(e=-1),t===void 0&&(t=0),a===void 0&&(a=1),n===void 0&&(n=new Gt(16777215)),i===void 0&&(i=Uy),t=Math.min(t,Math.max(0,t)),this.lensFlares.push({texture:r,size:e,distance:t,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:n,blending:i})},updateLensFlares:function(){var r,e=this.lensFlares.length,t,i=-this.positionScreen.x*2,n=-this.positionScreen.y*2;for(r=0;r<e;r++)t=this.lensFlares[r],t.x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=(t.wantedRotation-t.rotation)*.25}});zd.prototype=Object.create(mr.prototype);zd.prototype.constructor=zd;zd.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.rotation=r.rotation,this};BS.prototype=Object.assign(Object.create(Et.prototype),{constructor:BS,isSprite:!0,raycast:function(){var r=new oe;return function(t,i){r.setFromMatrixPosition(this.matrixWorld);var n=t.ray.distanceSqToPoint(r),a=this.scale.x*this.scale.y/4;n>a||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}});kS.prototype=Object.assign(Object.create(Et.prototype),{constructor:kS,copy:function(r){Et.prototype.copy.call(this,r,!1);for(var e=r.levels,t=0,i=e.length;t<i;t++){var n=e[t];this.addLevel(n.object.clone(),n.distance)}return this},addLevel:function(r,e){e===void 0&&(e=0),e=Math.abs(e);for(var t=this.levels,i=0;i<t.length&&!(e<t[i].distance);i++);t.splice(i,0,{distance:e,object:r}),this.add(r)},getObjectForDistance:function(r){for(var e=this.levels,t=1,i=e.length;t<i&&!(r<e[t].distance);t++);return e[t-1].object},raycast:function(){var r=new oe;return function(t,i){r.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(r);this.getObjectForDistance(n).raycast(t,i)}}(),update:function(){var r=new oe,e=new oe;return function(i){var n=this.levels;if(n.length>1){r.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var a=r.distanceTo(e);n[0].object.visible=!0;for(var o=1,s=n.length;o<s&&a>=n[o].distance;o++)n[o-1].object.visible=!1,n[o].object.visible=!0;for(;o<s;o++)n[o].object.visible=!1}}}(),toJSON:function(r){var e=Et.prototype.toJSON.call(this,r);e.object.levels=[];for(var t=this.levels,i=0,n=t.length;i<n;i++){var a=t[i];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}});Object.assign(ZA.prototype,{calculateInverses:function(){this.boneInverses=[];for(var r=0,e=this.bones.length;r<e;r++){var t=new qt;this.bones[r]&&t.getInverse(this.bones[r].matrixWorld),this.boneInverses.push(t)}},pose:function(){for(var r,e=0,t=this.bones.length;e<t;e++)r=this.bones[e],r&&r.matrixWorld.getInverse(this.boneInverses[e]);for(var e=0,t=this.bones.length;e<t;e++)r=this.bones[e],r&&(r.parent&&r.parent.isBone?(r.matrix.getInverse(r.parent.matrixWorld),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))},update:function(){var r=new qt;return function(){for(var t=0,i=this.bones.length;t<i;t++){var n=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;r.multiplyMatrices(n,this.boneInverses[t]),r.toArray(this.boneMatrices,t*16)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new ZA(this.bones,this.boneInverses,this.useVertexTexture)}});jA.prototype=Object.assign(Object.create(Et.prototype),{constructor:jA,isBone:!0});KA.prototype=Object.assign(Object.create(mn.prototype),{constructor:KA,isSkinnedMesh:!0,bind:function(r,e){this.skeleton=r,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var r=0;r<this.geometry.skinWeights.length;r++){var e=this.geometry.skinWeights[r],t=1/e.lengthManhattan();t!==1/0?e.multiplyScalar(t):e.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var i=new Qr,n=this.geometry.attributes.skinWeight,r=0;r<n.count;r++){i.x=n.getX(r),i.y=n.getY(r),i.z=n.getZ(r),i.w=n.getW(r);var t=1/i.lengthManhattan();t!==1/0?i.multiplyScalar(t):i.set(1,0,0,0),n.setXYZW(r,i.x,i.y,i.z,i.w)}},updateMatrixWorld:function(r){mn.prototype.updateMatrixWorld.call(this,!0),this.bindMode==="attached"?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode==="detached"?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material,this.skeleton.useVertexTexture).copy(this)}});Ui.prototype=Object.create(mr.prototype);Ui.prototype.constructor=Ui;Ui.prototype.isLineBasicMaterial=!0;Ui.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.linewidth=r.linewidth,this.linecap=r.linecap,this.linejoin=r.linejoin,this};oc.prototype=Object.assign(Object.create(Et.prototype),{constructor:oc,isLine:!0,raycast:function(){var r=new qt,e=new Mh,t=new $n;return function(n,a){var o=n.linePrecision,s=o*o,l=this.geometry,u=this.matrixWorld;if(l.boundingSphere===null&&l.computeBoundingSphere(),t.copy(l.boundingSphere),t.applyMatrix4(u),n.ray.intersectsSphere(t)!==!1){r.getInverse(u),e.copy(n.ray).applyMatrix4(r);var c=new oe,f=new oe,h=new oe,p=new oe,d=this&&this.isLineSegments?2:1;if(l.isBufferGeometry){var g=l.index,m=l.attributes,v=m.position.array;if(g!==null)for(var _=g.array,y=0,x=_.length-1;y<x;y+=d){var M=_[y],S=_[y+1];c.fromArray(v,M*3),f.fromArray(v,S*3);var w=e.distanceSqToSegment(c,f,p,h);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);T<n.near||T>n.far||a.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,x=v.length/3-1;y<x;y+=d){c.fromArray(v,3*y),f.fromArray(v,3*y+3);var w=e.distanceSqToSegment(c,f,p,h);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);T<n.near||T>n.far||a.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(l.isGeometry)for(var C=l.vertices,b=C.length,y=0;y<b-1;y+=d){var w=e.distanceSqToSegment(C[y],C[y+1],p,h);if(!(w>s)){p.applyMatrix4(this.matrixWorld);var T=n.ray.origin.distanceTo(p);T<n.near||T>n.far||a.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});di.prototype=Object.assign(Object.create(oc.prototype),{constructor:di,isLineSegments:!0});dl.prototype=Object.create(mr.prototype);dl.prototype.constructor=dl;dl.prototype.isPointsMaterial=!0;dl.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.size=r.size,this.sizeAttenuation=r.sizeAttenuation,this};iy.prototype=Object.assign(Object.create(Et.prototype),{constructor:iy,isPoints:!0,raycast:function(){var r=new qt,e=new Mh,t=new $n;return function(n,a){var o=this,s=this.geometry,l=this.matrixWorld,u=n.params.Points.threshold;if(s.boundingSphere===null&&s.computeBoundingSphere(),t.copy(s.boundingSphere),t.applyMatrix4(l),n.ray.intersectsSphere(t)===!1)return;r.getInverse(l),e.copy(n.ray).applyMatrix4(r);var c=u/((this.scale.x+this.scale.y+this.scale.z)/3),f=c*c,h=new oe;function p(w,T){var C=e.distanceSqToPoint(w);if(C<f){var b=e.closestPointToPoint(w);b.applyMatrix4(l);var E=n.ray.origin.distanceTo(b);if(E<n.near||E>n.far)return;a.push({distance:E,distanceToRay:Math.sqrt(C),point:b.clone(),index:T,face:null,object:o})}}if(s.isBufferGeometry){var d=s.index,g=s.attributes,m=g.position.array;if(d!==null)for(var v=d.array,_=0,y=v.length;_<y;_++){var x=v[_];h.fromArray(m,x*3),p(h,x)}else for(var _=0,M=m.length/3;_<M;_++)h.fromArray(m,_*3),p(h,_)}else for(var S=s.vertices,_=0,M=S.length;_<M;_++)p(S[_],_)}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});VS.prototype=Object.assign(Object.create(Et.prototype),{constructor:VS});JA.prototype=Object.create(ni.prototype);JA.prototype.constructor=JA;ny.prototype=Object.create(ni.prototype);ny.prototype.constructor=ny;ny.prototype.isCompressedTexture=!0;$A.prototype=Object.create(ni.prototype);$A.prototype.constructor=$A;GS.prototype=Object.create(ni.prototype);GS.prototype.constructor=GS;GS.prototype.isDepthTexture=!0;ay.prototype=Object.create(Bt.prototype);ay.prototype.constructor=ay;oy.prototype=Object.create(Bt.prototype);oy.prototype.constructor=oy;HS.prototype=Object.create(or.prototype);HS.prototype.constructor=HS;no.prototype=Object.create(Bt.prototype);no.prototype.constructor=no;sy.prototype=Object.create(no.prototype);sy.prototype.constructor=sy;WS.prototype=Object.create(or.prototype);WS.prototype.constructor=WS;Bd.prototype=Object.create(no.prototype);Bd.prototype.constructor=Bd;XS.prototype=Object.create(or.prototype);XS.prototype.constructor=XS;ly.prototype=Object.create(no.prototype);ly.prototype.constructor=ly;YS.prototype=Object.create(or.prototype);YS.prototype.constructor=YS;uy.prototype=Object.create(no.prototype);uy.prototype.constructor=uy;qS.prototype=Object.create(or.prototype);qS.prototype.constructor=qS;ZS.prototype=Object.create(or.prototype);ZS.prototype.constructor=ZS;cy.prototype=Object.create(Bt.prototype);cy.prototype.constructor=cy;jS.prototype=Object.create(or.prototype);jS.prototype.constructor=jS;fy.prototype=Object.create(Bt.prototype);fy.prototype.constructor=fy;KS.prototype=Object.create(or.prototype);KS.prototype.constructor=KS;hy.prototype=Object.create(Bt.prototype);hy.prototype.constructor=hy;JS.prototype=Object.create(or.prototype);JS.prototype.constructor=JS;Ln={area:function(r){for(var e=r.length,t=0,i=e-1,n=0;n<e;i=n++)t+=r[i].x*r[n].y-r[n].x*r[i].y;return t*.5},triangulate:function(){function r(e,t,i,n,a,o){var s,l,u,c,f,h,p,d,g;if(l=e[o[t]].x,u=e[o[t]].y,c=e[o[i]].x,f=e[o[i]].y,h=e[o[n]].x,p=e[o[n]].y,(c-l)*(p-u)-(f-u)*(h-l)<=0)return!1;var m,v,_,y,x,M,S,w,T,C,b,E,I,R,A;for(m=h-c,v=p-f,_=l-h,y=u-p,x=c-l,M=f-u,s=0;s<a;s++)if(d=e[o[s]].x,g=e[o[s]].y,!(d===l&&g===u||d===c&&g===f||d===h&&g===p)&&(S=d-l,w=g-u,T=d-c,C=g-f,b=d-h,E=g-p,A=m*C-v*T,I=x*w-M*S,R=_*E-y*b,A>=-Number.EPSILON&&R>=-Number.EPSILON&&I>=-Number.EPSILON))return!1;return!0}return function(t,i){var n=t.length;if(n<3)return null;var a=[],o=[],s=[],l,u,c;if(Ln.area(t)>0)for(u=0;u<n;u++)o[u]=u;else for(u=0;u<n;u++)o[u]=n-1-u;var f=n,h=2*f;for(u=f-1;f>2;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?s:a;if(l=u,f<=l&&(l=0),u=l+1,f<=u&&(u=0),c=u+1,f<=c&&(c=0),r(t,l,u,c,f,o)){var p,d,g,m,v;for(p=o[l],d=o[u],g=o[c],a.push([t[p],t[d],t[g]]),s.push([o[l],o[u],o[c]]),m=u,v=u+1;v<f;m++,v++)o[m]=o[v];f--,h=2*f}}return i?s:a}}(),triangulateShape:function(r,e){function t(y){var x=y.length;x>2&&y[x-1].equals(y[0])&&y.pop()}t(r),e.forEach(t);function i(y,x,M){return y.x!==x.x?y.x<x.x?y.x<=M.x&&M.x<=x.x:x.x<=M.x&&M.x<=y.x:y.y<x.y?y.y<=M.y&&M.y<=x.y:x.y<=M.y&&M.y<=y.y}function n(y,x,M,S,w){var T=x.x-y.x,C=x.y-y.y,b=S.x-M.x,E=S.y-M.y,I=y.x-M.x,R=y.y-M.y,A=C*b-T*E,D=C*I-T*R;if(Math.abs(A)>Number.EPSILON){var U;if(A>0){if(D<0||D>A)return[];if(U=E*I-b*R,U<0||U>A)return[]}else{if(D>0||D<A)return[];if(U=E*I-b*R,U>0||U<A)return[]}if(U===0)return w&&(D===0||D===A)?[]:[y];if(U===A)return w&&(D===0||D===A)?[]:[x];if(D===0)return[M];if(D===A)return[S];var B=U/A;return[{x:y.x+B*T,y:y.y+B*C}]}else{if(D!==0||E*I!==b*R)return[];var F=T===0&&C===0,k=b===0&&E===0;if(F&&k)return y.x!==M.x||y.y!==M.y?[]:[y];if(F)return i(M,S,y)?[y]:[];if(k)return i(y,x,M)?[M]:[];var G,Y,J,Q,V,K,ae,ve;return T!==0?(y.x<x.x?(G=y,J=y.x,Y=x,Q=x.x):(G=x,J=x.x,Y=y,Q=y.x),M.x<S.x?(V=M,ae=M.x,K=S,ve=S.x):(V=S,ae=S.x,K=M,ve=M.x)):(y.y<x.y?(G=y,J=y.y,Y=x,Q=x.y):(G=x,J=x.y,Y=y,Q=y.y),M.y<S.y?(V=M,ae=M.y,K=S,ve=S.y):(V=S,ae=S.y,K=M,ve=M.y)),J<=ae?Q<ae?[]:Q===ae?w?[]:[V]:Q<=ve?[V,Y]:[V,K]:J>ve?[]:J===ve?w?[]:[G]:Q<=ve?[G,Y]:[G,K]}}function a(y,x,M,S){var w=x.x-y.x,T=x.y-y.y,C=M.x-y.x,b=M.y-y.y,E=S.x-y.x,I=S.y-y.y,R=w*b-T*C,A=w*I-T*E;if(Math.abs(R)>Number.EPSILON){var D=E*b-I*C;return R>0?A>=0&&D>=0:A>=0||D>=0}else return A>0}function o(y,x){var M=y.concat(),S;function w(ve,ue){var se=M.length-1,Ee=ve-1;Ee<0&&(Ee=se);var q=ve+1;q>se&&(q=0);var H=a(M[ve],M[Ee],M[q],S[ue]);if(!H)return!1;var We=S.length-1,_e=ue-1;_e<0&&(_e=We);var xe=ue+1;return xe>We&&(xe=0),H=a(S[ue],S[_e],S[xe],M[ve]),!!H}function T(ve,ue){var se,Ee,q;for(se=0;se<M.length;se++)if(Ee=se+1,Ee%=M.length,q=n(ve,ue,M[se],M[Ee],!0),q.length>0)return!0;return!1}var C=[];function b(ve,ue){var se,Ee,q,H,We;for(se=0;se<C.length;se++)for(Ee=x[C[se]],q=0;q<Ee.length;q++)if(H=q+1,H%=Ee.length,We=n(ve,ue,Ee[q],Ee[H],!0),We.length>0)return!0;return!1}for(var E,I,R,A,D,U,B=[],F,k,G,Y,J=0,Q=x.length;J<Q;J++)C.push(J);for(var V=0,K=C.length*2;C.length>0;){if(K--,K<0){console.log("Infinite Loop! Holes left:"+C.length+", Probably Hole outside Shape!");break}for(I=V;I<M.length;I++){R=M[I],E=-1;for(var J=0;J<C.length;J++)if(D=C[J],U=R.x+":"+R.y+":"+D,B[U]===void 0){S=x[D];for(var ae=0;ae<S.length;ae++)if(A=S[ae],!!w(I,ae)&&!T(R,A)&&!b(R,A)){E=ae,C.splice(J,1),F=M.slice(0,I+1),k=M.slice(I),G=S.slice(E),Y=S.slice(0,E+1),M=F.concat(G).concat(Y).concat(k),V=I;break}if(E>=0)break;B[U]=!0}if(E>=0)break}}return M}for(var s,l,u,c,f,h,p={},d=r.concat(),g=0,m=e.length;g<m;g++)Array.prototype.push.apply(d,e[g]);for(s=0,l=d.length;s<l;s++)f=d[s].x+":"+d[s].y,p[f]!==void 0&&console.warn("THREE.ShapeUtils: Duplicate point",f,s),p[f]=s;var v=o(r,e),_=Ln.triangulate(v,!1);for(s=0,l=_.length;s<l;s++)for(c=_[s],u=0;u<3;u++)f=c[u].x+":"+c[u].y,h=p[f],h!==void 0&&(c[u]=h);return _.concat()},isClockWise:function(r){return Ln.area(r)<0},b2:function(){function r(i,n){var a=1-i;return a*a*n}function e(i,n){return 2*(1-i)*i*n}function t(i,n){return i*i*n}return function(n,a,o,s){return r(n,a)+e(n,o)+t(n,s)}}(),b3:function(){function r(n,a){var o=1-n;return o*o*o*a}function e(n,a){var o=1-n;return 3*o*o*n*a}function t(n,a){var o=1-n;return 3*o*n*n*a}function i(n,a){return n*n*n*a}return function(a,o,s,l,u){return r(a,o)+e(a,s)+t(a,l)+i(a,u)}}()};ws.prototype=Object.create(or.prototype);ws.prototype.constructor=ws;ws.prototype.addShapeList=function(r,e){for(var t=r.length,i=0;i<t;i++){var n=r[i];this.addShape(n,e)}};ws.prototype.addShape=function(r,e){var t=e.amount!==void 0?e.amount:100,i=e.bevelThickness!==void 0?e.bevelThickness:6,n=e.bevelSize!==void 0?e.bevelSize:i-2,a=e.bevelSegments!==void 0?e.bevelSegments:3,o=e.bevelEnabled!==void 0?e.bevelEnabled:!0,s=e.curveSegments!==void 0?e.curveSegments:12,l=e.steps!==void 0?e.steps:1,u=e.extrudePath,c,f=!1,h=e.UVGenerator!==void 0?e.UVGenerator:ws.WorldUVGenerator,p,d,g,m;u&&(c=u.getSpacedPoints(l),f=!0,o=!1,p=e.frames!==void 0?e.frames:u.computeFrenetFrames(l,!1),d=new oe,g=new oe,m=new oe),o||(a=0,i=0,n=0);var v,_,y,x=this,M=this.vertices.length,S=r.extractPoints(s),w=S.shape,T=S.holes,C=!Ln.isClockWise(w);if(C){for(w=w.reverse(),_=0,y=T.length;_<y;_++)v=T[_],Ln.isClockWise(v)&&(T[_]=v.reverse());C=!1}var b=Ln.triangulateShape(w,T),E=w;for(_=0,y=T.length;_<y;_++)v=T[_],w=w.concat(v);function I(Ue,Ne,Ve){return Ne||console.error("THREE.ExtrudeGeometry: vec does not exist"),Ne.clone().multiplyScalar(Ve).add(Ue)}var R,A,D,U,B,F=w.length,k,G=b.length;function Y(Ue,Ne,Ve){var ct,z,L=1,ne=Ue.x-Ne.x,le=Ue.y-Ne.y,me=Ve.x-Ue.x,he=Ve.y-Ue.y,et=ne*ne+le*le,Ke=ne*he-le*me;if(Math.abs(Ke)>Number.EPSILON){var Se=Math.sqrt(et),Ae=Math.sqrt(me*me+he*he),nt=Ne.x-le/Se,$=Ne.y+ne/Se,it=Ve.x-he/Ae,Xe=Ve.y+me/Ae,ze=((it-nt)*he-(Xe-$)*me)/(ne*he-le*me);ct=nt+ne*ze-Ue.x,z=$+le*ze-Ue.y;var we=ct*ct+z*z;if(we<=2)return new St(ct,z);L=Math.sqrt(we/2)}else{var Ie=!1;ne>Number.EPSILON?me>Number.EPSILON&&(Ie=!0):ne<-Number.EPSILON?me<-Number.EPSILON&&(Ie=!0):Math.sign(le)===Math.sign(he)&&(Ie=!0),Ie?(ct=-le,z=ne,L=Math.sqrt(et)):(ct=ne,z=le,L=Math.sqrt(et/2))}return new St(ct/L,z/L)}for(var J=[],Q=0,V=E.length,K=V-1,ae=Q+1;Q<V;Q++,K++,ae++)K===V&&(K=0),ae===V&&(ae=0),J[Q]=Y(E[Q],E[K],E[ae]);var ve=[],ue,se=J.concat();for(_=0,y=T.length;_<y;_++){for(v=T[_],ue=[],Q=0,V=v.length,K=V-1,ae=Q+1;Q<V;Q++,K++,ae++)K===V&&(K=0),ae===V&&(ae=0),ue[Q]=Y(v[Q],v[K],v[ae]);ve.push(ue),se=se.concat(ue)}for(R=0;R<a;R++){for(D=R/a,U=i*Math.cos(D*Math.PI/2),A=n*Math.sin(D*Math.PI/2),Q=0,V=E.length;Q<V;Q++)B=I(E[Q],J[Q],A),_e(B.x,B.y,-U);for(_=0,y=T.length;_<y;_++)for(v=T[_],ue=ve[_],Q=0,V=v.length;Q<V;Q++)B=I(v[Q],ue[Q],A),_e(B.x,B.y,-U)}for(A=n,Q=0;Q<F;Q++)B=o?I(w[Q],se[Q],A):w[Q],f?(g.copy(p.normals[0]).multiplyScalar(B.x),d.copy(p.binormals[0]).multiplyScalar(B.y),m.copy(c[0]).add(g).add(d),_e(m.x,m.y,m.z)):_e(B.x,B.y,0);var Ee;for(Ee=1;Ee<=l;Ee++)for(Q=0;Q<F;Q++)B=o?I(w[Q],se[Q],A):w[Q],f?(g.copy(p.normals[Ee]).multiplyScalar(B.x),d.copy(p.binormals[Ee]).multiplyScalar(B.y),m.copy(c[Ee]).add(g).add(d),_e(m.x,m.y,m.z)):_e(B.x,B.y,t/l*Ee);for(R=a-1;R>=0;R--){for(D=R/a,U=i*Math.cos(D*Math.PI/2),A=n*Math.sin(D*Math.PI/2),Q=0,V=E.length;Q<V;Q++)B=I(E[Q],J[Q],A),_e(B.x,B.y,t+U);for(_=0,y=T.length;_<y;_++)for(v=T[_],ue=ve[_],Q=0,V=v.length;Q<V;Q++)B=I(v[Q],ue[Q],A),f?_e(B.x,B.y+c[l-1].y,c[l-1].x+U):_e(B.x,B.y,t+U)}q(),H();function q(){if(o){var Ue=0,Ne=F*Ue;for(Q=0;Q<G;Q++)k=b[Q],xe(k[2]+Ne,k[1]+Ne,k[0]+Ne);for(Ue=l+a*2,Ne=F*Ue,Q=0;Q<G;Q++)k=b[Q],xe(k[0]+Ne,k[1]+Ne,k[2]+Ne)}else{for(Q=0;Q<G;Q++)k=b[Q],xe(k[2],k[1],k[0]);for(Q=0;Q<G;Q++)k=b[Q],xe(k[0]+F*l,k[1]+F*l,k[2]+F*l)}}function H(){var Ue=0;for(We(E,Ue),Ue+=E.length,_=0,y=T.length;_<y;_++)v=T[_],We(v,Ue),Ue+=v.length}function We(Ue,Ne){var Ve,ct;for(Q=Ue.length;--Q>=0;){Ve=Q,ct=Q-1,ct<0&&(ct=Ue.length-1);var z=0,L=l+a*2;for(z=0;z<L;z++){var ne=F*z,le=F*(z+1),me=Ne+Ve+ne,he=Ne+ct+ne,et=Ne+ct+le,Ke=Ne+Ve+le;Le(me,he,et,Ke,Ue,z,L,Ve,ct)}}}function _e(Ue,Ne,Ve){x.vertices.push(new oe(Ue,Ne,Ve))}function xe(Ue,Ne,Ve){Ue+=M,Ne+=M,Ve+=M,x.faces.push(new Fo(Ue,Ne,Ve,null,null,0));var ct=h.generateTopUV(x,Ue,Ne,Ve);x.faceVertexUvs[0].push(ct)}function Le(Ue,Ne,Ve,ct,z,L,ne,le,me){Ue+=M,Ne+=M,Ve+=M,ct+=M,x.faces.push(new Fo(Ue,Ne,ct,null,null,1)),x.faces.push(new Fo(Ne,Ve,ct,null,null,1));var he=h.generateSideWallUV(x,Ue,Ne,Ve,ct);x.faceVertexUvs[0].push([he[0],he[1],he[3]]),x.faceVertexUvs[0].push([he[1],he[2],he[3]])}};ws.WorldUVGenerator={generateTopUV:function(r,e,t,i){var n=r.vertices,a=n[e],o=n[t],s=n[i];return[new St(a.x,a.y),new St(o.x,o.y),new St(s.x,s.y)]},generateSideWallUV:function(r,e,t,i,n){var a=r.vertices,o=a[e],s=a[t],l=a[i],u=a[n];return Math.abs(o.y-s.y)<.01?[new St(o.x,1-o.z),new St(s.x,1-s.z),new St(l.x,1-l.z),new St(u.x,1-u.z)]:[new St(o.y,1-o.z),new St(s.y,1-s.z),new St(l.y,1-l.z),new St(u.y,1-u.z)]}};$S.prototype=Object.create(ws.prototype);$S.prototype.constructor=$S;kd.prototype=Object.create(Bt.prototype);kd.prototype.constructor=kd;QS.prototype=Object.create(or.prototype);QS.prototype.constructor=QS;py.prototype=Object.create(Bt.prototype);py.prototype.constructor=py;eM.prototype=Object.create(or.prototype);eM.prototype.constructor=eM;tM.prototype=Object.create(or.prototype);tM.prototype.constructor=tM;dy.prototype=Object.create(Bt.prototype);dy.prototype.constructor=dy;rM.prototype=Object.create(or.prototype);rM.prototype.constructor=rM;my.prototype=Object.create(Bt.prototype);my.prototype.constructor=my;vy.prototype=Object.create(or.prototype);vy.prototype.constructor=vy;gy.prototype=Object.create(Bt.prototype);gy.prototype.constructor=gy;sc.prototype=Object.create(Bt.prototype);sc.prototype.constructor=sc;Vd.prototype=Object.create(or.prototype);Vd.prototype.constructor=Vd;iM.prototype=Object.create(Vd.prototype);iM.prototype.constructor=iM;nM.prototype=Object.create(sc.prototype);nM.prototype.constructor=nM;yy.prototype=Object.create(Bt.prototype);yy.prototype.constructor=yy;aM.prototype=Object.create(or.prototype);aM.prototype.constructor=aM;oM.prototype=Object.create(or.prototype);oM.prototype.constructor=oM;pl=Object.freeze({WireframeGeometry:ay,ParametricGeometry:HS,ParametricBufferGeometry:oy,TetrahedronGeometry:WS,TetrahedronBufferGeometry:sy,OctahedronGeometry:XS,OctahedronBufferGeometry:Bd,IcosahedronGeometry:YS,IcosahedronBufferGeometry:ly,DodecahedronGeometry:qS,DodecahedronBufferGeometry:uy,PolyhedronGeometry:ZS,PolyhedronBufferGeometry:no,TubeGeometry:jS,TubeBufferGeometry:cy,TorusKnotGeometry:KS,TorusKnotBufferGeometry:fy,TorusGeometry:JS,TorusBufferGeometry:hy,TextGeometry:$S,SphereBufferGeometry:kd,SphereGeometry:QS,RingGeometry:eM,RingBufferGeometry:py,PlaneBufferGeometry:Od,PlaneGeometry:tM,LatheGeometry:rM,LatheBufferGeometry:dy,ShapeGeometry:vy,ShapeBufferGeometry:my,ExtrudeGeometry:ws,EdgesGeometry:gy,ConeGeometry:iM,ConeBufferGeometry:nM,CylinderGeometry:Vd,CylinderBufferGeometry:sc,CircleBufferGeometry:yy,CircleGeometry:aM,BoxBufferGeometry:Ud,BoxGeometry:oM});_y.prototype=Object.create(_a.prototype);_y.prototype.constructor=_y;_y.prototype.isShadowMaterial=!0;xy.prototype=Object.create(_a.prototype);xy.prototype.constructor=xy;xy.prototype.isRawShaderMaterial=!0;sM.prototype={constructor:sM,isMultiMaterial:!0,toJSON:function(r){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},t=this.materials,i=0,n=t.length;i<n;i++){var a=t[i].toJSON(r);delete a.metadata,e.materials.push(a)}return e.visible=this.visible,e},clone:function(){for(var r=new this.constructor,e=0;e<this.materials.length;e++)r.materials.push(this.materials[e].clone());return r.visible=this.visible,r}};uu.prototype=Object.create(mr.prototype);uu.prototype.constructor=uu;uu.prototype.isMeshStandardMaterial=!0;uu.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.defines={STANDARD:""},this.color.copy(r.color),this.roughness=r.roughness,this.metalness=r.metalness,this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.roughnessMap=r.roughnessMap,this.metalnessMap=r.metalnessMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.envMapIntensity=r.envMapIntensity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this};Gd.prototype=Object.create(uu.prototype);Gd.prototype.constructor=Gd;Gd.prototype.isMeshPhysicalMaterial=!0;Gd.prototype.copy=function(r){return uu.prototype.copy.call(this,r),this.defines={PHYSICAL:""},this.reflectivity=r.reflectivity,this.clearCoat=r.clearCoat,this.clearCoatRoughness=r.clearCoatRoughness,this};ml.prototype=Object.create(mr.prototype);ml.prototype.constructor=ml;ml.prototype.isMeshPhongMaterial=!0;ml.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.specular.copy(r.specular),this.shininess=r.shininess,this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this};Hd.prototype=Object.create(ml.prototype);Hd.prototype.constructor=Hd;Hd.prototype.isMeshToonMaterial=!0;Hd.prototype.copy=function(r){return ml.prototype.copy.call(this,r),this.gradientMap=r.gradientMap,this};Wd.prototype=Object.create(mr.prototype);Wd.prototype.constructor=Wd;Wd.prototype.isMeshNormalMaterial=!0;Wd.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.bumpMap=r.bumpMap,this.bumpScale=r.bumpScale,this.normalMap=r.normalMap,this.normalScale.copy(r.normalScale),this.displacementMap=r.displacementMap,this.displacementScale=r.displacementScale,this.displacementBias=r.displacementBias,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this};Xd.prototype=Object.create(mr.prototype);Xd.prototype.constructor=Xd;Xd.prototype.isMeshLambertMaterial=!0;Xd.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.lightMap=r.lightMap,this.lightMapIntensity=r.lightMapIntensity,this.aoMap=r.aoMap,this.aoMapIntensity=r.aoMapIntensity,this.emissive.copy(r.emissive),this.emissiveMap=r.emissiveMap,this.emissiveIntensity=r.emissiveIntensity,this.specularMap=r.specularMap,this.alphaMap=r.alphaMap,this.envMap=r.envMap,this.combine=r.combine,this.reflectivity=r.reflectivity,this.refractionRatio=r.refractionRatio,this.wireframe=r.wireframe,this.wireframeLinewidth=r.wireframeLinewidth,this.wireframeLinecap=r.wireframeLinecap,this.wireframeLinejoin=r.wireframeLinejoin,this.skinning=r.skinning,this.morphTargets=r.morphTargets,this.morphNormals=r.morphNormals,this};Yd.prototype=Object.create(mr.prototype);Yd.prototype.constructor=Yd;Yd.prototype.isLineDashedMaterial=!0;Yd.prototype.copy=function(r){return mr.prototype.copy.call(this,r),this.color.copy(r.color),this.linewidth=r.linewidth,this.scale=r.scale,this.dashSize=r.dashSize,this.gapSize=r.gapSize,this};KRe=Object.freeze({ShadowMaterial:_y,SpriteMaterial:zd,RawShaderMaterial:xy,ShaderMaterial:_a,PointsMaterial:dl,MultiMaterial:sM,MeshPhysicalMaterial:Gd,MeshStandardMaterial:uu,MeshPhongMaterial:ml,MeshToonMaterial:Hd,MeshNormalMaterial:Wd,MeshLambertMaterial:Xd,MeshDepthMaterial:Sh,MeshBasicMaterial:io,LineDashedMaterial:Yd,LineBasicMaterial:Ui,Material:mr}),xz={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};zo=new Qz;Object.assign(Ts.prototype,{load:function(r,e,t,i){r===void 0&&(r=""),this.path!==void 0&&(r=this.path+r);var n=this,a=xz.get(r);if(a!==void 0)return n.manager.itemStart(r),setTimeout(function(){e&&e(a),n.manager.itemEnd(r)},0),a;var o=/^data:(.*?)(;base64)?,(.*)$/,s=r.match(o);if(s){var l=s[1],u=!!s[2],c=s[3];c=window.decodeURIComponent(c),u&&(c=window.atob(c));try{var f,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":f=new ArrayBuffer(c.length);for(var p=new Uint8Array(f),d=0;d<c.length;d++)p[d]=c.charCodeAt(d);h==="blob"&&(f=new Blob([f],{type:l}));break;case"document":var g=new DOMParser;f=g.parseFromString(c,l);break;case"json":f=JSON.parse(c);break;default:f=c;break}window.setTimeout(function(){e&&e(f),n.manager.itemEnd(r)},0)}catch(v){window.setTimeout(function(){i&&i(v),n.manager.itemError(r)},0)}}else{var m=new XMLHttpRequest;m.open("GET",r,!0),m.addEventListener("load",function(v){var _=v.target.response;xz.add(r,_),this.status===200?(e&&e(_),n.manager.itemEnd(r)):this.status===0?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(_),n.manager.itemEnd(r)):(i&&i(v),n.manager.itemError(r))},!1),t!==void 0&&m.addEventListener("progress",function(v){t(v)},!1),m.addEventListener("error",function(v){i&&i(v),n.manager.itemError(r)},!1),this.responseType!==void 0&&(m.responseType=this.responseType),this.withCredentials!==void 0&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain"),m.send(null)}return n.manager.itemStart(r),m},setPath:function(r){return this.path=r,this},setResponseType:function(r){return this.responseType=r,this},setWithCredentials:function(r){return this.withCredentials=r,this},setMimeType:function(r){return this.mimeType=r,this}});Object.assign(Xne.prototype,{load:function(r,e,t,i){var n=this,a=[],o=new ny;o.image=a;var s=new Ts(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer");function l(h){s.load(r[h],function(p){var d=n._parser(p,!0);a[h]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},u+=1,u===6&&(d.mipmapCount===1&&(o.minFilter=to),o.format=d.format,o.needsUpdate=!0,e&&e(o))},t,i)}if(Array.isArray(r))for(var u=0,c=0,f=r.length;c<f;++c)l(c);else s.load(r,function(h){var p=n._parser(h,!0);if(p.isCubemap)for(var d=p.mipmaps.length/p.mipmapCount,g=0;g<d;g++){a[g]={mipmaps:[]};for(var m=0;m<p.mipmapCount;m++)a[g].mipmaps.push(p.mipmaps[g*p.mipmapCount+m]),a[g].format=p.format,a[g].width=p.width,a[g].height=p.height}else o.image.width=p.width,o.image.height=p.height,o.mipmaps=p.mipmaps;p.mipmapCount===1&&(o.minFilter=to),o.format=p.format,o.needsUpdate=!0,e&&e(o)},t,i);return o},setPath:function(r){return this.path=r,this}});JRe=eB;Object.assign(eB.prototype,{load:function(r,e,t,i){var n=this,a=new Nd,o=new Ts(this.manager);return o.setResponseType("arraybuffer"),o.load(r,function(s){var l=n._parser(s);l&&(l.image!==void 0?a.image=l.image:l.data!==void 0&&(a.image.width=l.width,a.image.height=l.height,a.image.data=l.data),a.wrapS=l.wrapS!==void 0?l.wrapS:Uo,a.wrapT=l.wrapT!==void 0?l.wrapT:Uo,a.magFilter=l.magFilter!==void 0?l.magFilter:to,a.minFilter=l.minFilter!==void 0?l.minFilter:gM,a.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.format!==void 0&&(a.format=l.format),l.type!==void 0&&(a.type=l.type),l.mipmaps!==void 0&&(a.mipmaps=l.mipmaps),l.mipmapCount===1&&(a.minFilter=to),a.needsUpdate=!0,e&&e(a,l))},t,i),a}});Object.assign(yM.prototype,{load:function(r,e,t,i){var n=this,a=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(a.onload=function(){a.onload=null,URL.revokeObjectURL(a.src),e&&e(a),n.manager.itemEnd(r)},a.onerror=i,r.indexOf("data:")===0)a.src=r;else if(this.crossOrigin!==void 0)a.crossOrigin=this.crossOrigin,a.src=r;else{var o=new Ts;o.setPath(this.path),o.setResponseType("blob"),o.setWithCredentials(this.withCredentials),o.load(r,function(s){a.src=URL.createObjectURL(s)},t,i)}return n.manager.itemStart(r),a},setCrossOrigin:function(r){return this.crossOrigin=r,this},setWithCredentials:function(r){return this.withCredentials=r,this},setPath:function(r){return this.path=r,this}});Object.assign(tB.prototype,{load:function(r,e,t,i){var n=new _h,a=new yM(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(u){a.load(r[u],function(c){n.images[u]=c,o++,o===6&&(n.needsUpdate=!0,e&&e(n))},void 0,i)}for(var l=0;l<r.length;++l)s(l);return n},setCrossOrigin:function(r){return this.crossOrigin=r,this},setPath:function(r){return this.path=r,this}});Object.assign(TC.prototype,{load:function(r,e,t,i){var n=new ni,a=new yM(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setWithCredentials(this.withCredentials),a.setPath(this.path),a.load(r,function(o){var s=r.search(/\.(jpg|jpeg)$/)>0||r.search(/^data\:image\/jpeg/)===0;n.format=s?Kg:su,n.image=o,n.needsUpdate=!0,e!==void 0&&e(n)},t,i),n},setCrossOrigin:function(r){return this.crossOrigin=r,this},setWithCredentials:function(r){return this.withCredentials=r,this},setPath:function(r){return this.path=r,this}});Oi.prototype=Object.assign(Object.create(Et.prototype),{constructor:Oi,isLight:!0,copy:function(r){return Et.prototype.copy.call(this,r),this.color.copy(r.color),this.intensity=r.intensity,this},toJSON:function(r){var e=Et.prototype.toJSON.call(this,r);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),e}});QA.prototype=Object.assign(Object.create(Oi.prototype),{constructor:QA,isHemisphereLight:!0,copy:function(r){return Oi.prototype.copy.call(this,r),this.groundColor.copy(r.groundColor),this}});Object.assign(em.prototype,{copy:function(r){return this.camera=r.camera.clone(),this.bias=r.bias,this.radius=r.radius,this.mapSize.copy(r.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var r={};return this.bias!==0&&(r.bias=this.bias),this.radius!==1&&(r.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(r.mapSize=this.mapSize.toArray()),r.camera=this.camera.toJSON(!1).object,delete r.camera.matrix,r}});eC.prototype=Object.assign(Object.create(em.prototype),{constructor:eC,isSpotLightShadow:!0,update:function(r){var e=cr.RAD2DEG*2*r.angle,t=this.mapSize.width/this.mapSize.height,i=r.distance||500,n=this.camera;(e!==n.fov||t!==n.aspect||i!==n.far)&&(n.fov=e,n.aspect=t,n.far=i,n.updateProjectionMatrix())}});tC.prototype=Object.assign(Object.create(Oi.prototype),{constructor:tC,isSpotLight:!0,copy:function(r){return Oi.prototype.copy.call(this,r),this.distance=r.distance,this.angle=r.angle,this.penumbra=r.penumbra,this.decay=r.decay,this.target=r.target.clone(),this.shadow=r.shadow.clone(),this}});rC.prototype=Object.assign(Object.create(Oi.prototype),{constructor:rC,isPointLight:!0,copy:function(r){return Oi.prototype.copy.call(this,r),this.distance=r.distance,this.decay=r.decay,this.shadow=r.shadow.clone(),this}});iC.prototype=Object.assign(Object.create(em.prototype),{constructor:iC});nC.prototype=Object.assign(Object.create(Oi.prototype),{constructor:nC,isDirectionalLight:!0,copy:function(r){return Oi.prototype.copy.call(this,r),this.target=r.target.clone(),this.shadow=r.shadow.clone(),this}});aC.prototype=Object.assign(Object.create(Oi.prototype),{constructor:aC,isAmbientLight:!0});Jn={arraySlice:function(r,e,t){return Jn.isTypedArray(r)?new r.constructor(r.subarray(e,t)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(a,o){return r[a]-r[o]}for(var t=r.length,i=new Array(t),n=0;n!==t;++n)i[n]=n;return i.sort(e),i},sortedArray:function(r,e,t){for(var i=r.length,n=new r.constructor(i),a=0,o=0;o!==i;++a)for(var s=t[a]*e,l=0;l!==e;++l)n[o++]=r[s+l];return n},flattenJSON:function(r,e,t,i){for(var n=1,a=r[0];a!==void 0&&a[i]===void 0;)a=r[n++];if(a!==void 0){var o=a[i];if(o!==void 0)if(Array.isArray(o))do o=a[i],o!==void 0&&(e.push(a.time),t.push.apply(t,o)),a=r[n++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[i],o!==void 0&&(e.push(a.time),o.toArray(t,t.length)),a=r[n++];while(a!==void 0);else do o=a[i],o!==void 0&&(e.push(a.time),t.push(o)),a=r[n++];while(a!==void 0)}}};ro.prototype={constructor:ro,evaluate:function(r){var e=this.parameterPositions,t=this._cachedIndex,i=e[t],n=e[t-1];e:{t:{var a;r:{i:if(!(r<i)){for(var o=t+2;;){if(i===void 0){if(r<n)break i;return t=e.length,this._cachedIndex=t,this.afterEnd_(t-1,r,n)}if(t===o)break;if(n=i,i=e[++t],r<i)break t}a=e.length;break r}if(!(r>=n)){var s=e[1];r<s&&(t=2,n=s);for(var o=t-2;;){if(n===void 0)return this._cachedIndex=0,this.beforeStart_(0,r,i);if(t===o)break;if(i=n,n=e[--t-1],r>=n)break t}a=t,t=0;break r}break e}for(;t<a;){var l=t+a>>>1;r<e[l]?a=l:t=l+1}if(i=e[t],n=e[t-1],n===void 0)return this._cachedIndex=0,this.beforeStart_(0,r,i);if(i===void 0)return t=e.length,this._cachedIndex=t,this.afterEnd_(t-1,n,r)}this._cachedIndex=t,this.intervalChanged_(t,n,i)}return this.interpolate_(t,n,r,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(r){for(var e=this.resultBuffer,t=this.sampleValues,i=this.valueSize,n=r*i,a=0;a!==i;++a)e[a]=t[n+a];return e},interpolate_:function(r,e,t,i){throw new Error("call to abstract method")},intervalChanged_:function(r,e,t){}};Object.assign(ro.prototype,{beforeStart_:ro.prototype.copySampleValue_,afterEnd_:ro.prototype.copySampleValue_});oC.prototype=Object.assign(Object.create(ro.prototype),{constructor:oC,DefaultSettings_:{endingStart:Id,endingEnd:Id},intervalChanged_:function(r,e,t){var i=this.parameterPositions,n=r-2,a=r+1,o=i[n],s=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ad:n=r,o=2*e-t;break;case RS:n=i.length-2,o=e+i[n]-i[n+1];break;default:n=r,o=t}if(s===void 0)switch(this.getSettings_().endingEnd){case Ad:a=r,s=2*t-e;break;case RS:a=1,s=t+i[1]-i[0];break;default:a=r-1,s=e}var l=(t-e)*.5,u=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(s-t),this._offsetPrev=n*u,this._offsetNext=a*u},interpolate_:function(r,e,t,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=r*o,l=s-o,u=this._offsetPrev,c=this._offsetNext,f=this._weightPrev,h=this._weightNext,p=(t-e)/(i-e),d=p*p,g=d*p,m=-f*g+2*f*d-f*p,v=(1+f)*g+(-1.5-2*f)*d+(-.5+f)*p+1,_=(-1-h)*g+(1.5+h)*d+.5*p,y=h*g-h*d,x=0;x!==o;++x)n[x]=m*a[u+x]+v*a[l+x]+_*a[s+x]+y*a[c+x];return n}});lM.prototype=Object.assign(Object.create(ro.prototype),{constructor:lM,interpolate_:function(r,e,t,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=r*o,l=s-o,u=(t-e)/(i-e),c=1-u,f=0;f!==o;++f)n[f]=a[l+f]*c+a[s+f]*u;return n}});sC.prototype=Object.assign(Object.create(ro.prototype),{constructor:sC,interpolate_:function(r,e,t,i){return this.copySampleValue_(r-1)}});uc={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:bS,InterpolantFactoryMethodDiscrete:function(r){return new sC(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodLinear:function(r){return new lM(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodSmooth:function(r){return new oC(this.times,this.values,this.getValueSize(),r)},setInterpolation:function(r){var e;switch(r){case CS:e=this.InterpolantFactoryMethodDiscrete;break;case bS:e=this.InterpolantFactoryMethodLinear;break;case VA:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){var t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(r!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(t);console.warn(t);return}this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return CS;case this.InterpolantFactoryMethodLinear:return bS;case this.InterpolantFactoryMethodSmooth:return VA}},getValueSize:function(){return this.values.length/this.times.length},shift:function(r){if(r!==0)for(var e=this.times,t=0,i=e.length;t!==i;++t)e[t]+=r;return this},scale:function(r){if(r!==1)for(var e=this.times,t=0,i=e.length;t!==i;++t)e[t]*=r;return this},trim:function(r,e){for(var t=this.times,i=t.length,n=0,a=i-1;n!==i&&t[n]<r;)++n;for(;a!==-1&&t[a]>e;)--a;if(++a,n!==0||a!==i){n>=a&&(a=Math.max(a,1),n=a-1);var o=this.getValueSize();this.times=Jn.arraySlice(t,n,a),this.values=Jn.arraySlice(this.values,n*o,a*o)}return this},validate:function(){var r=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),r=!1);var t=this.times,i=this.values,n=t.length;n===0&&(console.error("track is empty",this),r=!1);for(var a=null,o=0;o!==n;o++){var s=t[o];if(typeof s=="number"&&isNaN(s)){console.error("time is not a valid number",this,o,s),r=!1;break}if(a!==null&&a>s){console.error("out of order keys",this,o,s,a),r=!1;break}a=s}if(i!==void 0&&Jn.isTypedArray(i))for(var o=0,l=i.length;o!==l;++o){var u=i[o];if(isNaN(u)){console.error("value is not a valid number",this,o,u),r=!1;break}}return r},optimize:function(){for(var r=this.times,e=this.values,t=this.getValueSize(),i=this.getInterpolation()===VA,n=1,a=r.length-1,o=1;o<a;++o){var s=!1,l=r[o],u=r[o+1];if(l!==u&&(o!==1||l!==l[0]))if(i)s=!0;else for(var c=o*t,f=c-t,h=c+t,p=0;p!==t;++p){var d=e[c+p];if(d!==e[f+p]||d!==e[h+p]){s=!0;break}}if(s){if(o!==n){r[n]=r[o];for(var g=o*t,m=n*t,p=0;p!==t;++p)e[m+p]=e[g+p]}++n}}if(a>0){r[n]=r[a];for(var g=a*t,m=n*t,p=0;p!==t;++p)e[m+p]=e[g+p];++n}return n!==r.length&&(this.times=Jn.arraySlice(r,0,n),this.values=Jn.arraySlice(e,0,n*t)),this}};Sy.prototype=Object.assign(Object.create(uc),{constructor:Sy,ValueTypeName:"vector"});lC.prototype=Object.assign(Object.create(ro.prototype),{constructor:lC,interpolate_:function(r,e,t,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=r*o,l=(t-e)/(i-e),u=s+o;s!==u;s+=4)on.slerpFlat(n,0,a,s-o,a,s,l);return n}});uM.prototype=Object.assign(Object.create(uc),{constructor:uM,ValueTypeName:"quaternion",DefaultInterpolation:bS,InterpolantFactoryMethodLinear:function(r){return new lC(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodSmooth:void 0});My.prototype=Object.assign(Object.create(uc),{constructor:My,ValueTypeName:"number"});uC.prototype=Object.assign(Object.create(uc),{constructor:uC,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:CS,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});cC.prototype=Object.assign(Object.create(uc),{constructor:cC,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:CS,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});fC.prototype=Object.assign(Object.create(uc),{constructor:fC,ValueTypeName:"color"});qd.prototype=uc;uc.constructor=qd;Object.assign(qd,{parse:function(r){if(r.type===void 0)throw new Error("track type undefined, can not parse");var e=qd._getTrackTypeForValueTypeName(r.type);if(r.times===void 0){var t=[],i=[];Jn.flattenJSON(r.keys,t,i,"value"),r.times=t,r.values=i}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)},toJSON:function(r){var e=r.constructor,t;if(e.toJSON!==void 0)t=e.toJSON(r);else{t={name:r.name,times:Jn.convertArray(r.times,Array),values:Jn.convertArray(r.values,Array)};var i=r.getInterpolation();i!==r.DefaultInterpolation&&(t.interpolation=i)}return t.type=r.ValueTypeName,t},_getTrackTypeForValueTypeName:function(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return My;case"vector":case"vector2":case"vector3":case"vector4":return Sy;case"color":return fC;case"quaternion":return uM;case"bool":case"boolean":return cC;case"string":return uC}throw new Error("Unsupported typeName: "+r)}});No.prototype={constructor:No,resetDuration:function(){for(var r=this.tracks,e=0,t=0,i=r.length;t!==i;++t){var n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}this.duration=e},trim:function(){for(var r=0;r<this.tracks.length;r++)this.tracks[r].trim(0,this.duration);return this},optimize:function(){for(var r=0;r<this.tracks.length;r++)this.tracks[r].optimize();return this}};Object.assign(No,{parse:function(r){for(var e=[],t=r.tracks,i=1/(r.fps||1),n=0,a=t.length;n!==a;++n)e.push(qd.parse(t[n]).scale(i));return new No(r.name,r.duration,e)},toJSON:function(r){for(var e=[],t=r.tracks,i={name:r.name,duration:r.duration,tracks:e},n=0,a=t.length;n!==a;++n)e.push(qd.toJSON(t[n]));return i},CreateFromMorphTargetSequence:function(r,e,t,i){for(var n=e.length,a=[],o=0;o<n;o++){var s=[],l=[];s.push((o+n-1)%n,o,(o+1)%n),l.push(0,1,0);var u=Jn.getKeyframeOrder(s);s=Jn.sortedArray(s,1,u),l=Jn.sortedArray(l,1,u),!i&&s[0]===0&&(s.push(n),l.push(l[0])),a.push(new My(".morphTargetInfluences["+e[o].name+"]",s,l).scale(1/t))}return new No(r,-1,a)},findByName:function(r,e){var t=r;if(!Array.isArray(r)){var i=r;t=i.geometry&&i.geometry.animations||i.animations}for(var n=0;n<t.length;n++)if(t[n].name===e)return t[n];return null},CreateClipsFromMorphTargetSequences:function(r,e,t){for(var i={},n=/^([\w-]*?)([\d]+)$/,a=0,o=r.length;a<o;a++){var s=r[a],l=s.name.match(n);if(l&&l.length>1){var u=l[1],c=i[u];c||(i[u]=c=[]),c.push(s)}}var f=[];for(var u in i)f.push(No.CreateFromMorphTargetSequence(u,i[u],e,t));return f},parseAnimation:function(r,e){if(!r)return console.error(" no animation in JSONLoader data"),null;for(var t=function(y,x,M,S,w){if(M.length!==0){var T=[],C=[];Jn.flattenJSON(M,T,C,S),T.length!==0&&w.push(new y(x,T,C))}},i=[],n=r.name||"default",a=r.length||-1,o=r.fps||30,s=r.hierarchy||[],l=0;l<s.length;l++){var u=s[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){for(var c={},f=0;f<u.length;f++)if(u[f].morphTargets)for(var h=0;h<u[f].morphTargets.length;h++)c[u[f].morphTargets[h]]=-1;for(var p in c){for(var d=[],g=[],h=0;h!==u[f].morphTargets.length;++h){var m=u[f];d.push(m.time),g.push(m.morphTarget===p?1:0)}i.push(new My(".morphTargetInfluence["+p+"]",d,g))}a=c.length*(o||1)}else{var v=".bones["+e[l].name+"]";t(Sy,v+".position",u,"pos",i),t(uM,v+".quaternion",u,"rot",i),t(Sy,v+".scale",u,"scl",i)}}if(i.length===0)return null;var _=new No(n,a,i);return _}});Object.assign(EC.prototype,{load:function(r,e,t,i){var n=this,a=new Ts(n.manager);a.load(r,function(o){e(n.parse(JSON.parse(o)))},t,i)},setTextures:function(r){this.textures=r},parse:function(r){var e=this.textures;function t(s){return e[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),e[s]}var i=new KRe[r.type];if(r.uuid!==void 0&&(i.uuid=r.uuid),r.name!==void 0&&(i.name=r.name),r.color!==void 0&&i.color.setHex(r.color),r.roughness!==void 0&&(i.roughness=r.roughness),r.metalness!==void 0&&(i.metalness=r.metalness),r.emissive!==void 0&&i.emissive.setHex(r.emissive),r.specular!==void 0&&i.specular.setHex(r.specular),r.shininess!==void 0&&(i.shininess=r.shininess),r.clearCoat!==void 0&&(i.clearCoat=r.clearCoat),r.clearCoatRoughness!==void 0&&(i.clearCoatRoughness=r.clearCoatRoughness),r.uniforms!==void 0&&(i.uniforms=r.uniforms),r.vertexShader!==void 0&&(i.vertexShader=r.vertexShader),r.fragmentShader!==void 0&&(i.fragmentShader=r.fragmentShader),r.vertexColors!==void 0&&(i.vertexColors=r.vertexColors),r.fog!==void 0&&(i.fog=r.fog),r.shading!==void 0&&(i.shading=r.shading),r.blending!==void 0&&(i.blending=r.blending),r.side!==void 0&&(i.side=r.side),r.opacity!==void 0&&(i.opacity=r.opacity),r.transparent!==void 0&&(i.transparent=r.transparent),r.alphaTest!==void 0&&(i.alphaTest=r.alphaTest),r.depthTest!==void 0&&(i.depthTest=r.depthTest),r.depthWrite!==void 0&&(i.depthWrite=r.depthWrite),r.colorWrite!==void 0&&(i.colorWrite=r.colorWrite),r.wireframe!==void 0&&(i.wireframe=r.wireframe),r.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=r.wireframeLinewidth),r.wireframeLinecap!==void 0&&(i.wireframeLinecap=r.wireframeLinecap),r.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=r.wireframeLinejoin),r.skinning!==void 0&&(i.skinning=r.skinning),r.morphTargets!==void 0&&(i.morphTargets=r.morphTargets),r.size!==void 0&&(i.size=r.size),r.sizeAttenuation!==void 0&&(i.sizeAttenuation=r.sizeAttenuation),r.map!==void 0&&(i.map=t(r.map)),r.alphaMap!==void 0&&(i.alphaMap=t(r.alphaMap),i.transparent=!0),r.bumpMap!==void 0&&(i.bumpMap=t(r.bumpMap)),r.bumpScale!==void 0&&(i.bumpScale=r.bumpScale),r.normalMap!==void 0&&(i.normalMap=t(r.normalMap)),r.normalScale!==void 0){var n=r.normalScale;Array.isArray(n)===!1&&(n=[n,n]),i.normalScale=new St().fromArray(n)}if(r.displacementMap!==void 0&&(i.displacementMap=t(r.displacementMap)),r.displacementScale!==void 0&&(i.displacementScale=r.displacementScale),r.displacementBias!==void 0&&(i.displacementBias=r.displacementBias),r.roughnessMap!==void 0&&(i.roughnessMap=t(r.roughnessMap)),r.metalnessMap!==void 0&&(i.metalnessMap=t(r.metalnessMap)),r.emissiveMap!==void 0&&(i.emissiveMap=t(r.emissiveMap)),r.emissiveIntensity!==void 0&&(i.emissiveIntensity=r.emissiveIntensity),r.specularMap!==void 0&&(i.specularMap=t(r.specularMap)),r.envMap!==void 0&&(i.envMap=t(r.envMap)),r.reflectivity!==void 0&&(i.reflectivity=r.reflectivity),r.lightMap!==void 0&&(i.lightMap=t(r.lightMap)),r.lightMapIntensity!==void 0&&(i.lightMapIntensity=r.lightMapIntensity),r.aoMap!==void 0&&(i.aoMap=t(r.aoMap)),r.aoMapIntensity!==void 0&&(i.aoMapIntensity=r.aoMapIntensity),r.gradientMap!==void 0&&(i.gradientMap=t(r.gradientMap)),r.materials!==void 0)for(var a=0,o=r.materials.length;a<o;a++)i.materials.push(this.parse(r.materials[a]));return i}});Object.assign(rB.prototype,{load:function(r,e,t,i){var n=this,a=new Ts(n.manager);a.load(r,function(o){e(n.parse(JSON.parse(o)))},t,i)},parse:function(r){var e=new Bt,t=r.data.index,i={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};if(t!==void 0){var n=new i[t.type](t.array);e.setIndex(new gt(n,1))}var a=r.data.attributes;for(var o in a){var s=a[o],n=new i[s.type](s.array);e.addAttribute(o,new gt(n,s.itemSize,s.normalized))}var l=r.data.groups||r.data.drawcalls||r.data.offsets;if(l!==void 0)for(var u=0,c=l.length;u!==c;++u){var f=l[u];e.addGroup(f.start,f.count,f.materialIndex)}var h=r.data.boundingSphere;if(h!==void 0){var p=new oe;h.center!==void 0&&p.fromArray(h.center),e.boundingSphere=new $n(p,h.radius)}return e}});Ld.prototype={constructor:Ld,crossOrigin:void 0,extractUrlBase:function(r){var e=r.split("/");return e.length===1?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(r,e,t){for(var i=[],n=0;n<r.length;++n)i[n]=this.createMaterial(r[n],e,t);return i},createMaterial:function(){var r,e,t;return function(n,a,o){r===void 0&&(r=new Gt),e===void 0&&(e=new TC),t===void 0&&(t=new EC);var s={};function l(h,p,d,g,m){var v=a+h,_=Ld.Handlers.get(v),y;_!==null?y=_.load(v):(e.setCrossOrigin(o),y=e.load(v)),p!==void 0&&(y.repeat.fromArray(p),p[0]!==1&&(y.wrapS=ic),p[1]!==1&&(y.wrapT=ic)),d!==void 0&&y.offset.fromArray(d),g!==void 0&&(g[0]==="repeat"&&(y.wrapS=ic),g[0]==="mirror"&&(y.wrapS=Dd),g[1]==="repeat"&&(y.wrapT=ic),g[1]==="mirror"&&(y.wrapT=Dd)),m!==void 0&&(y.anisotropy=m);var x=cr.generateUUID();return s[x]=y,x}var u={uuid:cr.generateUUID(),type:"MeshLambertMaterial"};for(var c in n){var f=n[c];switch(c){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":u.name=f;break;case"blending":u.blending=Vie[f];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",c,"is no longer supported.");break;case"colorDiffuse":u.color=r.fromArray(f).getHex();break;case"colorSpecular":u.specular=r.fromArray(f).getHex();break;case"colorEmissive":u.emissive=r.fromArray(f).getHex();break;case"specularCoef":u.shininess=f;break;case"shading":f.toLowerCase()==="basic"&&(u.type="MeshBasicMaterial"),f.toLowerCase()==="phong"&&(u.type="MeshPhongMaterial"),f.toLowerCase()==="standard"&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=l(f,n.mapDiffuseRepeat,n.mapDiffuseOffset,n.mapDiffuseWrap,n.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":u.emissiveMap=l(f,n.mapEmissiveRepeat,n.mapEmissiveOffset,n.mapEmissiveWrap,n.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":u.lightMap=l(f,n.mapLightRepeat,n.mapLightOffset,n.mapLightWrap,n.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":u.aoMap=l(f,n.mapAORepeat,n.mapAOOffset,n.mapAOWrap,n.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":u.bumpMap=l(f,n.mapBumpRepeat,n.mapBumpOffset,n.mapBumpWrap,n.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=f;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":u.normalMap=l(f,n.mapNormalRepeat,n.mapNormalOffset,n.mapNormalWrap,n.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=[f,f];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":u.specularMap=l(f,n.mapSpecularRepeat,n.mapSpecularOffset,n.mapSpecularWrap,n.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":u.metalnessMap=l(f,n.mapMetalnessRepeat,n.mapMetalnessOffset,n.mapMetalnessWrap,n.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":u.roughnessMap=l(f,n.mapRoughnessRepeat,n.mapRoughnessOffset,n.mapRoughnessWrap,n.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":u.alphaMap=l(f,n.mapAlphaRepeat,n.mapAlphaOffset,n.mapAlphaWrap,n.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":u.side=yh;break;case"doubleSided":u.side=Ny;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=f;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[c]=f;break;case"vertexColors":f===!0&&(u.vertexColors=Qd),f==="face"&&(u.vertexColors=Oz);break;default:console.error("THREE.Loader.createMaterial: Unsupported",c,f);break}}return u.type==="MeshBasicMaterial"&&delete u.emissive,u.type!=="MeshPhongMaterial"&&delete u.specular,u.opacity<1&&(u.transparent=!0),t.setTextures(s),t.parse(u)}}()};Ld.Handlers={handlers:[],add:function(r,e){this.handlers.push(r,e)},get:function(r){for(var e=this.handlers,t=0,i=e.length;t<i;t+=2){var n=e[t],a=e[t+1];if(n.test(r))return a}return null}};Object.assign(iB.prototype,{load:function(r,e,t,i){var n=this,a=this.texturePath&&typeof this.texturePath=="string"?this.texturePath:Ld.prototype.extractUrlBase(r),o=new Ts(this.manager);o.setWithCredentials(this.withCredentials),o.load(r,function(s){var l=JSON.parse(s),u=l.metadata;if(u!==void 0){var c=u.type;if(c!==void 0){if(c.toLowerCase()==="object"){console.error("THREE.JSONLoader: "+r+" should be loaded with THREE.ObjectLoader instead.");return}if(c.toLowerCase()==="scene"){console.error("THREE.JSONLoader: "+r+" should be loaded with THREE.SceneLoader instead.");return}}}var f=n.parse(l,a);e(f.geometry,f.materials)},t,i)},setTexturePath:function(r){this.texturePath=r},parse:function(r,e){var t=new or,i=r.scale!==void 0?1/r.scale:1;n(i),a(),o(i),s(),t.computeFaceNormals(),t.computeBoundingSphere();function n(u){function c(ve,ue){return ve&1<<ue}var f,h,p,d,g,m,v,_,y,x,M,S,w,T,C,b,E,I,R,A,D,U,B,F,k,G,Y,J=r.faces,Q=r.vertices,V=r.normals,K=r.colors,ae=0;if(r.uvs!==void 0){for(f=0;f<r.uvs.length;f++)r.uvs[f].length&&ae++;for(f=0;f<ae;f++)t.faceVertexUvs[f]=[]}for(d=0,g=Q.length;d<g;)I=new oe,I.x=Q[d++]*u,I.y=Q[d++]*u,I.z=Q[d++]*u,t.vertices.push(I);for(d=0,g=J.length;d<g;)if(x=J[d++],M=c(x,0),S=c(x,1),w=c(x,3),T=c(x,4),C=c(x,5),b=c(x,6),E=c(x,7),M){if(A=new Fo,A.a=J[d],A.b=J[d+1],A.c=J[d+3],D=new Fo,D.a=J[d+1],D.b=J[d+2],D.c=J[d+3],d+=4,S&&(y=J[d++],A.materialIndex=y,D.materialIndex=y),p=t.faces.length,w)for(f=0;f<ae;f++)for(F=r.uvs[f],t.faceVertexUvs[f][p]=[],t.faceVertexUvs[f][p+1]=[],h=0;h<4;h++)_=J[d++],G=F[_*2],Y=F[_*2+1],k=new St(G,Y),h!==2&&t.faceVertexUvs[f][p].push(k),h!==0&&t.faceVertexUvs[f][p+1].push(k);if(T&&(v=J[d++]*3,A.normal.set(V[v++],V[v++],V[v]),D.normal.copy(A.normal)),C)for(f=0;f<4;f++)v=J[d++]*3,B=new oe(V[v++],V[v++],V[v]),f!==2&&A.vertexNormals.push(B),f!==0&&D.vertexNormals.push(B);if(b&&(m=J[d++],U=K[m],A.color.setHex(U),D.color.setHex(U)),E)for(f=0;f<4;f++)m=J[d++],U=K[m],f!==2&&A.vertexColors.push(new Gt(U)),f!==0&&D.vertexColors.push(new Gt(U));t.faces.push(A),t.faces.push(D)}else{if(R=new Fo,R.a=J[d++],R.b=J[d++],R.c=J[d++],S&&(y=J[d++],R.materialIndex=y),p=t.faces.length,w)for(f=0;f<ae;f++)for(F=r.uvs[f],t.faceVertexUvs[f][p]=[],h=0;h<3;h++)_=J[d++],G=F[_*2],Y=F[_*2+1],k=new St(G,Y),t.faceVertexUvs[f][p].push(k);if(T&&(v=J[d++]*3,R.normal.set(V[v++],V[v++],V[v])),C)for(f=0;f<3;f++)v=J[d++]*3,B=new oe(V[v++],V[v++],V[v]),R.vertexNormals.push(B);if(b&&(m=J[d++],R.color.setHex(K[m])),E)for(f=0;f<3;f++)m=J[d++],R.vertexColors.push(new Gt(K[m]));t.faces.push(R)}}function a(){var u=r.influencesPerVertex!==void 0?r.influencesPerVertex:2;if(r.skinWeights)for(var c=0,f=r.skinWeights.length;c<f;c+=u){var h=r.skinWeights[c],p=u>1?r.skinWeights[c+1]:0,d=u>2?r.skinWeights[c+2]:0,g=u>3?r.skinWeights[c+3]:0;t.skinWeights.push(new Qr(h,p,d,g))}if(r.skinIndices)for(var c=0,f=r.skinIndices.length;c<f;c+=u){var m=r.skinIndices[c],v=u>1?r.skinIndices[c+1]:0,_=u>2?r.skinIndices[c+2]:0,y=u>3?r.skinIndices[c+3]:0;t.skinIndices.push(new Qr(m,v,_,y))}t.bones=r.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}function o(u){if(r.morphTargets!==void 0)for(var c=0,f=r.morphTargets.length;c<f;c++){t.morphTargets[c]={},t.morphTargets[c].name=r.morphTargets[c].name,t.morphTargets[c].vertices=[];for(var h=t.morphTargets[c].vertices,p=r.morphTargets[c].vertices,d=0,g=p.length;d<g;d+=3){var m=new oe;m.x=p[d]*u,m.y=p[d+1]*u,m.z=p[d+2]*u,h.push(m)}}if(r.morphColors!==void 0&&r.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var v=t.faces,_=r.morphColors[0].colors,c=0,f=v.length;c<f;c++)v[c].color.fromArray(_,c*3)}}function s(){var u=[],c=[];r.animation!==void 0&&c.push(r.animation),r.animations!==void 0&&(r.animations.length?c=c.concat(r.animations):c.push(r.animations));for(var f=0;f<c.length;f++){var h=No.parseAnimation(c[f],t.bones);h&&u.push(h)}if(t.morphTargets){var p=No.CreateClipsFromMorphTargetSequences(t.morphTargets,10);u=u.concat(p)}u.length>0&&(t.animations=u)}if(r.materials===void 0||r.materials.length===0)return{geometry:t};var l=Ld.prototype.initMaterials(r.materials,e,this.crossOrigin);return{geometry:t,materials:l}}});Object.assign(Yne.prototype,{load:function(r,e,t,i){this.texturePath===""&&(this.texturePath=r.substring(0,r.lastIndexOf("/")+1));var n=this,a=new Ts(n.manager);a.load(r,function(o){var s=null;try{s=JSON.parse(o)}catch(u){console.error("THREE:ObjectLoader: Can't parse "+r+".",u.message);return}var l=s.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+r+". Use THREE.JSONLoader instead.");return}n.parse(s,e)},t,i)},setTexturePath:function(r){this.texturePath=r},setCrossOrigin:function(r){this.crossOrigin=r},parse:function(r,e){var t=this.parseGeometries(r.geometries),i=this.parseImages(r.images,function(){e!==void 0&&e(o)}),n=this.parseTextures(r.textures,i),a=this.parseMaterials(r.materials,n),o=this.parseObject(r.object,t,a);return r.animations&&(o.animations=this.parseAnimations(r.animations)),(r.images===void 0||r.images.length===0)&&e!==void 0&&e(o),o},parseGeometries:function(r){var e={};if(r!==void 0)for(var t=new iB,i=new rB,n=0,a=r.length;n<a;n++){var o,s=r[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new pl[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new pl[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new pl[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new pl[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new pl[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new pl[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":o=new pl[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new pl[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new pl[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new pl[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new pl[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=i.parse(s);break;case"Geometry":o=t.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),e[s.uuid]=o}return e},parseMaterials:function(r,e){var t={};if(r!==void 0){var i=new EC;i.setTextures(e);for(var n=0,a=r.length;n<a;n++){var o=i.parse(r[n]);t[o.uuid]=o}}return t},parseAnimations:function(r){for(var e=[],t=0;t<r.length;t++){var i=No.parse(r[t]);e.push(i)}return e},parseImages:function(r,e){var t=this,i={};function n(f){return t.manager.itemStart(f),o.load(f,function(){t.manager.itemEnd(f)},void 0,function(){t.manager.itemError(f)})}if(r!==void 0&&r.length>0){var a=new Qz(e),o=new yM(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,l=r.length;s<l;s++){var u=r[s],c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(u.url)?u.url:t.texturePath+u.url;i[u.uuid]=n(c)}}return i},parseTextures:function(r,e){function t(l,u){return typeof l=="number"?l:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",l),u[l])}var i={};if(r!==void 0)for(var n=0,a=r.length;n<a;n++){var o=r[n];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),e[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=new ni(e[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=t(o.mapping,fne)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.wrap!==void 0&&(s.wrapS=t(o.wrap[0],lz),s.wrapT=t(o.wrap[1],lz)),o.minFilter!==void 0&&(s.minFilter=t(o.minFilter,uz)),o.magFilter!==void 0&&(s.magFilter=t(o.magFilter,uz)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),i[o.uuid]=s}return i},parseObject:function(){var r=new qt;return function(t,i,n){var a;function o(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),i[d]}function s(d){if(d!==void 0)return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}switch(t.type){case"Scene":a=new Fd,t.background!==void 0&&Number.isInteger(t.background)&&(a.background=new Gt(t.background)),t.fog!==void 0&&(t.fog.type==="Fog"?a.fog=new ry(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(a.fog=new ty(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":a=new Kn(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(a.focus=t.focus),t.zoom!==void 0&&(a.zoom=t.zoom),t.filmGauge!==void 0&&(a.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(a.filmOffset=t.filmOffset),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new ey(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":a=new aC(t.color,t.intensity);break;case"DirectionalLight":a=new nC(t.color,t.intensity);break;case"PointLight":a=new rC(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":a=new tC(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":a=new QA(t.color,t.groundColor,t.intensity);break;case"Mesh":var l=o(t.geometry),u=s(t.material);l.bones&&l.bones.length>0?a=new KA(l,u):a=new mn(l,u);break;case"LOD":a=new kS;break;case"Line":a=new oc(o(t.geometry),s(t.material),t.mode);break;case"LineSegments":a=new di(o(t.geometry),s(t.material));break;case"PointCloud":case"Points":a=new iy(o(t.geometry),s(t.material));break;case"Sprite":a=new BS(s(t.material));break;case"Group":a=new VS;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new Et}if(a.uuid=t.uuid,t.name!==void 0&&(a.name=t.name),t.matrix!==void 0?(r.fromArray(t.matrix),r.decompose(a.position,a.quaternion,a.scale)):(t.position!==void 0&&a.position.fromArray(t.position),t.rotation!==void 0&&a.rotation.fromArray(t.rotation),t.quaternion!==void 0&&a.quaternion.fromArray(t.quaternion),t.scale!==void 0&&a.scale.fromArray(t.scale)),t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(a.shadow.bias=t.shadow.bias),t.shadow.radius!==void 0&&(a.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(a.visible=t.visible),t.userData!==void 0&&(a.userData=t.userData),t.children!==void 0)for(var c in t.children)a.add(this.parseObject(t.children[c],i,n));if(t.type==="LOD")for(var f=t.levels,h=0;h<f.length;h++){var p=f[h],c=a.getObjectByProperty("uuid",p.object);c!==void 0&&a.addLevel(c,p.distance)}return a}}()});ea.prototype={constructor:ea,getPoint:function(r){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(r){var e=this.getUtoTmapping(r);return this.getPoint(e)},getPoints:function(r){r||(r=5);for(var e=[],t=0;t<=r;t++)e.push(this.getPoint(t/r));return e},getSpacedPoints:function(r){r||(r=5);for(var e=[],t=0;t<=r;t++)e.push(this.getPointAt(t/r));return e},getLength:function(){var r=this.getLengths();return r[r.length-1]},getLengths:function(r){if(r||(r=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===r+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e=[],t,i=this.getPoint(0),n,a=0;for(e.push(0),n=1;n<=r;n++)t=this.getPoint(n/r),a+=t.distanceTo(i),e.push(a),i=t;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(r,e){var t=this.getLengths(),i=0,n=t.length,a;e?a=e:a=r*t[n-1];for(var o=0,s=n-1,l;o<=s;)if(i=Math.floor(o+(s-o)/2),l=t[i]-a,l<0)o=i+1;else if(l>0)s=i-1;else{s=i;break}if(i=s,t[i]===a){var p=i/(n-1);return p}var u=t[i],c=t[i+1],f=c-u,h=(a-u)/f,p=(i+h)/(n-1);return p},getTangent:function(r){var e=1e-4,t=r-e,i=r+e;t<0&&(t=0),i>1&&(i=1);var n=this.getPoint(t),a=this.getPoint(i),o=a.clone().sub(n);return o.normalize()},getTangentAt:function(r){var e=this.getUtoTmapping(r);return this.getTangent(e)},computeFrenetFrames:function(r,e){var t=new oe,i=[],n=[],a=[],o=new oe,s=new qt,l,u,c;for(l=0;l<=r;l++)u=l/r,i[l]=this.getTangentAt(u),i[l].normalize();n[0]=new oe,a[0]=new oe;var f=Number.MAX_VALUE,h=Math.abs(i[0].x),p=Math.abs(i[0].y),d=Math.abs(i[0].z);for(h<=f&&(f=h,t.set(1,0,0)),p<=f&&(f=p,t.set(0,1,0)),d<=f&&t.set(0,0,1),o.crossVectors(i[0],t).normalize(),n[0].crossVectors(i[0],o),a[0].crossVectors(i[0],n[0]),l=1;l<=r;l++)n[l]=n[l-1].clone(),a[l]=a[l-1].clone(),o.crossVectors(i[l-1],i[l]),o.length()>Number.EPSILON&&(o.normalize(),c=Math.acos(cr.clamp(i[l-1].dot(i[l]),-1,1)),n[l].applyMatrix4(s.makeRotationAxis(o,c))),a[l].crossVectors(i[l],n[l]);if(e===!0)for(c=Math.acos(cr.clamp(n[0].dot(n[r]),-1,1)),c/=r,i[0].dot(o.crossVectors(n[0],n[r]))>0&&(c=-c),l=1;l<=r;l++)n[l].applyMatrix4(s.makeRotationAxis(i[l],c*l)),a[l].crossVectors(i[l],n[l]);return{tangents:i,normals:n,binormals:a}}};ea.create=function(r,e){return r.prototype=Object.create(ea.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};cu.prototype=Object.create(ea.prototype);cu.prototype.constructor=cu;cu.prototype.isLineCurve=!0;cu.prototype.getPoint=function(r){if(r===1)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(r).add(this.v1),e};cu.prototype.getPointAt=function(r){return this.getPoint(r)};cu.prototype.getTangent=function(r){var e=this.v2.clone().sub(this.v1);return e.normalize()};cM.prototype=Object.assign(Object.create(ea.prototype),{constructor:cM,add:function(r){this.curves.push(r)},closePath:function(){var r=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);r.equals(e)||this.curves.push(new cu(e,r))},getPoint:function(r){for(var e=r*this.getLength(),t=this.getCurveLengths(),i=0;i<t.length;){if(t[i]>=e){var n=t[i]-e,a=this.curves[i],o=a.getLength(),s=o===0?0:1-n/o;return a.getPointAt(s)}i++}return null},getLength:function(){var r=this.getCurveLengths();return r[r.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var r=[],e=0,t=0,i=this.curves.length;t<i;t++)e+=this.curves[t].getLength(),r.push(e);return this.cacheLengths=r,r},getSpacedPoints:function(r){r||(r=40);for(var e=[],t=0;t<=r;t++)e.push(this.getPoint(t/r));return this.autoClose&&e.push(e[0]),e},getPoints:function(r){r=r||12;for(var e=[],t,i=0,n=this.curves;i<n.length;i++)for(var a=n[i],o=a&&a.isEllipseCurve?r*2:a&&a.isLineCurve?1:a&&a.isSplineCurve?r*a.points.length:r,s=a.getPoints(o),l=0;l<s.length;l++){var u=s[l];t&&t.equals(u)||(e.push(u),t=u)}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},createPointsGeometry:function(r){var e=this.getPoints(r);return this.createGeometry(e)},createSpacedPointsGeometry:function(r){var e=this.getSpacedPoints(r);return this.createGeometry(e)},createGeometry:function(r){for(var e=new or,t=0,i=r.length;t<i;t++){var n=r[t];e.vertices.push(new oe(n.x,n.y,n.z||0))}return e}});lc.prototype=Object.create(ea.prototype);lc.prototype.constructor=lc;lc.prototype.isEllipseCurve=!0;lc.prototype.getPoint=function(r){for(var e=Math.PI*2,t=this.aEndAngle-this.aStartAngle,i=Math.abs(t)<Number.EPSILON;t<0;)t+=e;for(;t>e;)t-=e;t<Number.EPSILON&&(i?t=0:t=e),this.aClockwise===!0&&!i&&(t===e?t=-e:t=t-e);var n=this.aStartAngle+r*t,a=this.aX+this.xRadius*Math.cos(n),o=this.aY+this.yRadius*Math.sin(n);if(this.aRotation!==0){var s=Math.cos(this.aRotation),l=Math.sin(this.aRotation),u=a-this.aX,c=o-this.aY;a=u*s-c*l+this.aX,o=u*l+c*s+this.aY}return new St(a,o)};_M={tangentQuadraticBezier:function(r,e,t,i){return 2*(1-r)*(t-e)+2*r*(i-t)},tangentCubicBezier:function(r,e,t,i,n){return-3*e*(1-r)*(1-r)+3*t*(1-r)*(1-r)-6*r*t*(1-r)+6*r*i*(1-r)-3*r*r*i+3*r*r*n},tangentSpline:function(r,e,t,i,n){var a=6*r*r-6*r,o=3*r*r-4*r+1,s=-6*r*r+6*r,l=3*r*r-2*r;return a+o+s+l},interpolate:function(r,e,t,i,n){var a=(t-r)*.5,o=(i-e)*.5,s=n*n,l=n*s;return(2*e-2*t+a+o)*l+(-3*e+3*t-2*a-o)*s+a*n+e}};Zd.prototype=Object.create(ea.prototype);Zd.prototype.constructor=Zd;Zd.prototype.isSplineCurve=!0;Zd.prototype.getPoint=function(r){var e=this.points,t=(e.length-1)*r,i=Math.floor(t),n=t-i,a=e[i===0?i:i-1],o=e[i],s=e[i>e.length-2?e.length-1:i+1],l=e[i>e.length-3?e.length-1:i+2],u=_M.interpolate;return new St(u(a.x,o.x,s.x,l.x,n),u(a.y,o.y,s.y,l.y,n))};jd.prototype=Object.create(ea.prototype);jd.prototype.constructor=jd;jd.prototype.getPoint=function(r){var e=Ln.b3;return new St(e(r,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(r,this.v0.y,this.v1.y,this.v2.y,this.v3.y))};jd.prototype.getTangent=function(r){var e=_M.tangentCubicBezier;return new St(e(r,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(r,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()};Kd.prototype=Object.create(ea.prototype);Kd.prototype.constructor=Kd;Kd.prototype.getPoint=function(r){var e=Ln.b2;return new St(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y))};Kd.prototype.getTangent=function(r){var e=_M.tangentQuadraticBezier;return new St(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y)).normalize()};nB=Object.assign(Object.create(cM.prototype),{fromPoints:function(r){this.moveTo(r[0].x,r[0].y);for(var e=1,t=r.length;e<t;e++)this.lineTo(r[e].x,r[e].y)},moveTo:function(r,e){this.currentPoint.set(r,e)},lineTo:function(r,e){var t=new cu(this.currentPoint.clone(),new St(r,e));this.curves.push(t),this.currentPoint.set(r,e)},quadraticCurveTo:function(r,e,t,i){var n=new Kd(this.currentPoint.clone(),new St(r,e),new St(t,i));this.curves.push(n),this.currentPoint.set(t,i)},bezierCurveTo:function(r,e,t,i,n,a){var o=new jd(this.currentPoint.clone(),new St(r,e),new St(t,i),new St(n,a));this.curves.push(o),this.currentPoint.set(n,a)},splineThru:function(r){var e=[this.currentPoint.clone()].concat(r),t=new Zd(e);this.curves.push(t),this.currentPoint.copy(r[r.length-1])},arc:function(r,e,t,i,n,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(r+o,e+s,t,i,n,a)},absarc:function(r,e,t,i,n,a){this.absellipse(r,e,t,t,i,n,a)},ellipse:function(r,e,t,i,n,a,o,s){var l=this.currentPoint.x,u=this.currentPoint.y;this.absellipse(r+l,e+u,t,i,n,a,o,s)},absellipse:function(r,e,t,i,n,a,o,s){var l=new lc(r,e,t,i,n,a,o,s);if(this.curves.length>0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);this.currentPoint.copy(c)}});Pd.prototype=Object.assign(Object.create(nB),{constructor:Pd,getPointsHoles:function(r){for(var e=[],t=0,i=this.holes.length;t<i;t++)e[t]=this.holes[t].getPoints(r);return e},extractAllPoints:function(r){return{shape:this.getPoints(r),holes:this.getPointsHoles(r)}},extractPoints:function(r){return this.extractAllPoints(r)}});xM.prototype=nB;nB.constructor=xM;aB.prototype={moveTo:function(r,e){this.currentPath=new xM,this.subPaths.push(this.currentPath),this.currentPath.moveTo(r,e)},lineTo:function(r,e){this.currentPath.lineTo(r,e)},quadraticCurveTo:function(r,e,t,i){this.currentPath.quadraticCurveTo(r,e,t,i)},bezierCurveTo:function(r,e,t,i,n,a){this.currentPath.bezierCurveTo(r,e,t,i,n,a)},splineThru:function(r){this.currentPath.splineThru(r)},toShapes:function(r,e){function t(D){for(var U=[],B=0,F=D.length;B<F;B++){var k=D[B],G=new Pd;G.curves=k.curves,U.push(G)}return U}function i(D,U){for(var B=U.length,F=!1,k=B-1,G=0;G<B;k=G++){var Y=U[k],J=U[G],Q=J.x-Y.x,V=J.y-Y.y;if(Math.abs(V)>Number.EPSILON){if(V<0&&(Y=U[G],Q=-Q,J=U[k],V=-V),D.y<Y.y||D.y>J.y)continue;if(D.y===Y.y){if(D.x===Y.x)return!0}else{var K=V*(D.x-Y.x)-Q*(D.y-Y.y);if(K===0)return!0;if(K<0)continue;F=!F}}else{if(D.y!==Y.y)continue;if(J.x<=D.x&&D.x<=Y.x||Y.x<=D.x&&D.x<=J.x)return!0}}return F}var n=Ln.isClockWise,a=this.subPaths;if(a.length===0)return[];if(e===!0)return t(a);var o,s,l,u=[];if(a.length===1)return s=a[0],l=new Pd,l.curves=s.curves,u.push(l),u;var c=!n(a[0].getPoints());c=r?!c:c;var f=[],h=[],p=[],d=0,g;h[d]=void 0,p[d]=[];for(var m=0,v=a.length;m<v;m++)s=a[m],g=s.getPoints(),o=n(g),o=r?!o:o,o?(!c&&h[d]&&d++,h[d]={s:new Pd,p:g},h[d].s.curves=s.curves,c&&d++,p[d]=[]):p[d].push({h:s,p:g[0]});if(!h[0])return t(a);if(h.length>1){for(var _=!1,y=[],x=0,M=h.length;x<M;x++)f[x]=[];for(var x=0,M=h.length;x<M;x++)for(var S=p[x],w=0;w<S.length;w++){for(var T=S[w],C=!0,b=0;b<h.length;b++)i(T.p,h[b].p)&&(x!==b&&y.push({froms:x,tos:b,hole:w}),C?(C=!1,f[b].push(T)):_=!0);C&&f[x].push(T)}y.length>0&&(_||(p=f))}for(var E,m=0,I=h.length;m<I;m++){l=h[m].s,u.push(l),E=p[m];for(var R=0,A=E.length;R<A;R++)l.holes.push(E[R].h)}return u}};Object.assign(oB.prototype,{isFont:!0,generateShapes:function(r,e,t){function i(c){for(var f=String(c).split(""),h=e/a.resolution,p=0,d=[],g=0;g<f.length;g++){var m=n(f[g],h,p);p+=m.offset,d.push(m.path)}return d}function n(c,f,h){var p=a.glyphs[c]||a.glyphs["?"];if(p){var d=new aB,g=[],m=Ln.b2,v=Ln.b3,_,y,x,M,S,w,T,C,b,E,I;if(p.o)for(var R=p._cachedOutline||(p._cachedOutline=p.o.split(" ")),A=0,D=R.length;A<D;){var U=R[A++];switch(U){case"m":_=R[A++]*f+h,y=R[A++]*f,d.moveTo(_,y);break;case"l":_=R[A++]*f+h,y=R[A++]*f,d.lineTo(_,y);break;case"q":if(x=R[A++]*f+h,M=R[A++]*f,T=R[A++]*f+h,C=R[A++]*f,d.quadraticCurveTo(T,C,x,M),I=g[g.length-1],I){S=I.x,w=I.y;for(var B=1;B<=t;B++){var F=B/t;m(F,S,T,x),m(F,w,C,M)}}break;case"b":if(x=R[A++]*f+h,M=R[A++]*f,T=R[A++]*f+h,C=R[A++]*f,b=R[A++]*f+h,E=R[A++]*f,d.bezierCurveTo(T,C,b,E,x,M),I=g[g.length-1],I){S=I.x,w=I.y;for(var B=1;B<=t;B++){var F=B/t;v(F,S,T,b,x),v(F,w,C,E,M)}}break}}return{offset:p.ha*f,path:d}}}e===void 0&&(e=100),t===void 0&&(t=4);for(var a=this.data,o=i(r),s=[],l=0,u=o.length;l<u;l++)Array.prototype.push.apply(s,o[l].toShapes());return s}});Object.assign(qne.prototype,{load:function(r,e,t,i){var n=this,a=new Ts(this.manager);a.load(r,function(o){var s;try{s=JSON.parse(o)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),s=JSON.parse(o.substring(65,o.length-2))}var l=n.parse(s);e&&e(l)},t,i)},parse:function(r){return new oB(r)}});sB={getContext:function(){return BA===void 0&&(BA=new(window.AudioContext||window.webkitAudioContext)),BA},setContext:function(r){BA=r}};Object.assign(lB.prototype,{load:function(r,e,t,i){var n=new Ts(this.manager);n.setResponseType("arraybuffer"),n.load(r,function(a){var o=sB.getContext();o.decodeAudioData(a,function(s){e(s)})},t,i)}});Sz.prototype=Object.assign(Object.create(Oi.prototype),{constructor:Sz,isRectAreaLight:!0,copy:function(r){return Oi.prototype.copy.call(this,r),this.width=r.width,this.height=r.height,this}});Object.assign(Zne.prototype,{update:function(){var r,e,t,i,n,a,o,s=new qt,l=new qt;return function(c){var f=r!==this||e!==c.focus||t!==c.fov||i!==c.aspect*this.aspect||n!==c.near||a!==c.far||o!==c.zoom;if(f){r=this,e=c.focus,t=c.fov,i=c.aspect*this.aspect,n=c.near,a=c.far,o=c.zoom;var h=c.projectionMatrix.clone(),p=this.eyeSep/2,d=p*n/e,g=n*Math.tan(cr.DEG2RAD*t*.5)/o,m,v;l.elements[12]=-p,s.elements[12]=p,m=-g*i+d,v=g*i+d,h.elements[0]=2*n/(v-m),h.elements[8]=(v+m)/(v-m),this.cameraL.projectionMatrix.copy(h),m=-g*i-d,v=g*i-d,h.elements[0]=2*n/(v-m),h.elements[8]=(v+m)/(v-m),this.cameraR.projectionMatrix.copy(h)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(l),this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(s)}}()});hC.prototype=Object.create(Et.prototype);hC.prototype.constructor=hC;Mz.prototype=Object.assign(Object.create(Et.prototype),{constructor:Mz,getInput:function(){return this.gain},removeFilter:function(){this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(r){this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=r,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(r){this.gain.gain.value=r},updateMatrixWorld:function(){var r=new oe,e=new on,t=new oe,i=new oe;return function(a){Et.prototype.updateMatrixWorld.call(this,a);var o=this.context.listener,s=this.up;this.matrixWorld.decompose(r,e,t),i.set(0,0,-1).applyQuaternion(e),o.positionX?(o.positionX.setValueAtTime(r.x,this.context.currentTime),o.positionY.setValueAtTime(r.y,this.context.currentTime),o.positionZ.setValueAtTime(r.z,this.context.currentTime),o.forwardX.setValueAtTime(i.x,this.context.currentTime),o.forwardY.setValueAtTime(i.y,this.context.currentTime),o.forwardZ.setValueAtTime(i.z,this.context.currentTime),o.upX.setValueAtTime(s.x,this.context.currentTime),o.upY.setValueAtTime(s.y,this.context.currentTime),o.upZ.setValueAtTime(s.z,this.context.currentTime)):(o.setPosition(r.x,r.y,r.z),o.setOrientation(i.x,i.y,i.z,s.x,s.y,s.z))}}()});by.prototype=Object.assign(Object.create(Et.prototype),{constructor:by,getOutput:function(){return this.gain},setNodeSource:function(r){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=r,this.connect(),this},setBuffer:function(r){return this.buffer=r,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}var r=this.context.createBufferSource();return r.buffer=this.buffer,r.loop=this.loop,r.onended=this.onEnded.bind(this),r.playbackRate.setValueAtTime(this.playbackRate,this.startTime),r.start(0,this.startTime),this.isPlaying=!0,this.source=r,this.connect()},pause:function(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this},stop:function(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.source.stop(),this.startTime=0,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var r=1,e=this.filters.length;r<e;r++)this.filters[r-1].connect(this.filters[r]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var r=1,e=this.filters.length;r<e;r++)this.filters[r-1].disconnect(this.filters[r]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(r){return r||(r=[]),this.isPlaying===!0?(this.disconnect(),this.filters=r,this.connect()):this.filters=r,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(r){return this.setFilters(r?[r]:[])},setPlaybackRate:function(r){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=r,this.isPlaying===!0&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(r){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=r,this.isPlaying===!0&&(this.source.loop=this.loop),this},getVolume:function(){return this.gain.gain.value},setVolume:function(r){return this.gain.gain.value=r,this}});bz.prototype=Object.assign(Object.create(by.prototype),{constructor:bz,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(r){this.panner.refDistance=r},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(r){this.panner.rolloffFactor=r},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(r){this.panner.distanceModel=r},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(r){this.panner.maxDistance=r},updateMatrixWorld:function(){var r=new oe;return function(t){Et.prototype.updateMatrixWorld.call(this,t),r.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(r.x,r.y,r.z)}}()});Object.assign(uB.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var r=0,e=this.getFrequencyData(),t=0;t<e.length;t++)r+=e[t];return r/e.length}});pC.prototype={constructor:pC,accumulate:function(r,e){var t=this.buffer,i=this.valueSize,n=r*i+i,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==i;++o)t[n+o]=t[o];a=e}else{a+=e;var s=e/a;this._mixBufferRegion(t,n,0,s,i)}this.cumulativeWeight=a},apply:function(r){var e=this.valueSize,t=this.buffer,i=r*e+e,n=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,n<1){var o=e*3;this._mixBufferRegion(t,i,o,1-n,e)}for(var s=e,l=e+e;s!==l;++s)if(t[s]!==t[s+e]){a.setValue(t,i);break}},saveOriginalState:function(){var r=this.binding,e=this.buffer,t=this.valueSize,i=t*3;r.getValue(e,i);for(var n=t,a=i;n!==a;++n)e[n]=e[i+n%t];this.cumulativeWeight=0},restoreOriginalState:function(){var r=this.valueSize*3;this.binding.setValue(this.buffer,r)},_select:function(r,e,t,i,n){if(i>=.5)for(var a=0;a!==n;++a)r[e+a]=r[t+a]},_slerp:function(r,e,t,i,n){on.slerpFlat(r,e,r,e,r,t,i)},_lerp:function(r,e,t,i,n){for(var a=1-i,o=0;o!==n;++o){var s=e+o;r[s]=r[s]*a+r[t+o]*i}}};Ri.prototype={constructor:Ri,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var r=this.node,e=this.parsedPath,t=e.objectName,i=e.propertyName,n=e.propertyIndex;if(r||(r=Ri.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=r),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!r){console.error(" trying to update node for track: "+this.path+" but it wasn't found.");return}if(t){var a=e.objectIndex;switch(t){case"materials":if(!r.material){console.error(" can not bind to material as node does not have a material",this);return}if(!r.material.materials){console.error(" can not bind to material.materials as node.material does not have a materials array",this);return}r=r.material.materials;break;case"bones":if(!r.skeleton){console.error(" can not bind to bones as node does not have a skeleton",this);return}r=r.skeleton.bones;for(var o=0;o<r.length;o++)if(r[o].name===a){a=o;break}break;default:if(r[t]===void 0){console.error(" can not bind to objectName of node, undefined",this);return}r=r[t]}if(a!==void 0){if(r[a]===void 0){console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,r);return}r=r[a]}}var s=r[i];if(s===void 0){var l=e.nodeName;console.error(" trying to update property for track: "+l+"."+i+" but it wasn't found.",r);return}var u=this.Versioning.None;r.needsUpdate!==void 0?(u=this.Versioning.NeedsUpdate,this.targetObject=r):r.matrixWorldNeedsUpdate!==void 0&&(u=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=r);var c=this.BindingType.Direct;if(n!==void 0){if(i==="morphTargetInfluences"){if(!r.geometry){console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);return}if(!r.geometry.morphTargets){console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);return}for(var o=0;o<this.node.geometry.morphTargets.length;o++)if(r.geometry.morphTargets[o].name===n){n=o;break}}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=n}else s.fromArray!==void 0&&s.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):s.length!==void 0?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Object.assign(Ri.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:Ri.prototype.getValue,_setValue_unbound:Ri.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var i=this.resolvedProperty,n=0,a=i.length;n!==a;++n)e[t++]=i[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var i=this.resolvedProperty,n=0,a=i.length;n!==a;++n)i[n]=e[t++]},function(e,t){for(var i=this.resolvedProperty,n=0,a=i.length;n!==a;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var i=this.resolvedProperty,n=0,a=i.length;n!==a;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]});Ri.Composite=function(r,e,t){var i=t||Ri.parseTrackName(e);this._targetGroup=r,this._bindings=r.subscribe_(e,i)};Ri.Composite.prototype={constructor:Ri.Composite,getValue:function(r,e){this.bind();var t=this._targetGroup.nCachedObjects_,i=this._bindings[t];i!==void 0&&i.getValue(r,e)},setValue:function(r,e){for(var t=this._bindings,i=this._targetGroup.nCachedObjects_,n=t.length;i!==n;++i)t[i].setValue(r,e)},bind:function(){for(var r=this._bindings,e=this._targetGroup.nCachedObjects_,t=r.length;e!==t;++e)r[e].bind()},unbind:function(){for(var r=this._bindings,e=this._targetGroup.nCachedObjects_,t=r.length;e!==t;++e)r[e].unbind()}};Ri.create=function(r,e,t){return r&&r.isAnimationObjectGroup?new Ri.Composite(r,e,t):new Ri(r,e,t)};Ri.parseTrackName=function(r){var e=/^((?:[\w-]+[\/:])*)([\w-]+)?(?:\.([\w-]+)(?:\[(.+)\])?)?\.([\w-]+)(?:\[(.+)\])?$/,t=e.exec(r);if(!t)throw new Error("cannot parse trackName at all: "+r);var i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]};if(i.propertyName===null||i.propertyName.length===0)throw new Error("can not parse propertyName from trackName: "+r);return i};Ri.findNode=function(r,e){if(!e||e===""||e==="root"||e==="."||e===-1||e===r.name||e===r.uuid)return r;if(r.skeleton){var t=function(o){for(var s=0;s<o.bones.length;s++){var l=o.bones[s];if(l.name===e)return l}return null},i=t(r.skeleton);if(i)return i}if(r.children){var n=function(o){for(var s=0;s<o.length;s++){var l=o[s];if(l.name===e||l.uuid===e)return l;var u=n(l.children);if(u)return u}return null},a=n(r.children);if(a)return a}return null};wz.prototype={constructor:wz,isAnimationObjectGroup:!0,add:function(r){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,l=s.length,u=0,c=arguments.length;u!==c;++u){var f=arguments[u],h=f.uuid,p=n[h],d=void 0;if(p===void 0){p=t++,n[h]=p,e.push(f);for(var g=0,m=l;g!==m;++g)s[g].push(new Ri(f,a[g],o[g]))}else if(p<i){d=e[p];var v=--i,_=e[v];n[_.uuid]=p,e[p]=_,n[h]=v,e[v]=f;for(var g=0,m=l;g!==m;++g){var y=s[g],x=y[v],M=y[p];y[p]=x,M===void 0&&(M=new Ri(f,a[g],o[g])),y[v]=M}}else e[p]!==d&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(r){for(var e=this._objects,t=this.nCachedObjects_,i=this._indicesByUUID,n=this._bindings,a=n.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],u=l.uuid,c=i[u];if(c!==void 0&&c>=t){var f=t++,h=e[f];i[h.uuid]=c,e[c]=h,i[u]=f,e[f]=l;for(var p=0,d=a;p!==d;++p){var g=n[p],m=g[f],v=g[c];g[c]=m,g[f]=v}}}this.nCachedObjects_=t},uncache:function(r){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,n=this._indicesByUUID,a=this._bindings,o=a.length,s=0,l=arguments.length;s!==l;++s){var u=arguments[s],c=u.uuid,f=n[c];if(f!==void 0)if(delete n[c],f<i){var h=--i,p=e[h],d=--t,g=e[d];n[p.uuid]=f,e[f]=p,n[g.uuid]=h,e[h]=g,e.pop();for(var m=0,v=o;m!==v;++m){var _=a[m],y=_[h],x=_[d];_[f]=y,_[h]=x,_.pop()}}else{var d=--t,g=e[d];n[g.uuid]=f,e[f]=g,e.pop();for(var m=0,v=o;m!==v;++m){var _=a[m];_[f]=_[d],_.pop()}}}this.nCachedObjects_=i},subscribe_:function(r,e){var t=this._bindingsIndicesByPath,i=t[r],n=this._bindings;if(i!==void 0)return n[i];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,u=this.nCachedObjects_,c=new Array(l);i=n.length,t[r]=i,a.push(r),o.push(e),n.push(c);for(var f=u,h=s.length;f!==h;++f){var p=s[f];c[f]=new Ri(p,r,e)}return c},unsubscribe_:function(r){var e=this._bindingsIndicesByPath,t=e[r];if(t!==void 0){var i=this._paths,n=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],l=r[o];e[l]=t,a[t]=s,a.pop(),n[t]=n[o],n.pop(),i[t]=i[o],i.pop()}}};Tz.prototype={constructor:Tz,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(r){return this._startTime=r,this},setLoop:function(r,e){return this.loop=r,this.repetitions=e,this},setEffectiveWeight:function(r){return this.weight=r,this._effectiveWeight=this.enabled?r:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(r){return this._scheduleFading(r,0,1)},fadeOut:function(r){return this._scheduleFading(r,1,0)},crossFadeFrom:function(r,e,t){if(r.fadeOut(e),this.fadeIn(e),t){var i=this._clip.duration,n=r._clip.duration,a=n/i,o=i/n;r.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(r,e,t){return r.crossFadeFrom(this,e,t)},stopFading:function(){var r=this._weightInterpolant;return r!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(r)),this},setEffectiveTimeScale:function(r){return this.timeScale=r,this._effectiveTimeScale=this.paused?0:r,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(r){return this.timeScale=this._clip.duration/r,this.stopWarping()},syncWith:function(r){return this.time=r.time,this.timeScale=r.timeScale,this.stopWarping()},halt:function(r){return this.warp(this._effectiveTimeScale,0,r)},warp:function(r,e,t){var i=this._mixer,n=i.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=n,s[1]=n+t,l[0]=r/o,l[1]=e/o,this},stopWarping:function(){var r=this._timeScaleInterpolant;return r!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(r)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(r,e,t,i){var n=this._startTime;if(n!==null){var a=(r-n)*t;if(a<0||t===0)return;this._startTime=null,e=t*a}e*=this._updateTimeScale(r);var o=this._updateTime(e),s=this._updateWeight(r);if(s>0)for(var l=this._interpolants,u=this._propertyBindings,c=0,f=l.length;c!==f;++c)l[c].evaluate(o),u[c].accumulate(i,s)},_updateWeight:function(r){var e=0;if(this.enabled){e=this.weight;var t=this._weightInterpolant;if(t!==null){var i=t.evaluate(r)[0];e*=i,r>t.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(r){var e=0;if(!this.paused){e=this.timeScale;var t=this._timeScaleInterpolant;if(t!==null){var i=t.evaluate(r)[0];e*=i,r>t.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(r){var e=this.time+r;if(r===0)return e;var t=this._clip.duration,i=this.loop,n=this._loopCount;if(i===Mne){n===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(e>=t)e=t;else if(e<0)e=0;else break e;this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:r<0?-1:1})}}else{var a=i===wne;if(n===-1&&(r>=0?(n=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),e>=t||e<0){var o=Math.floor(e/t);e-=t*o,n+=Math.abs(o);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=r>0?t:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:r>0?1:-1});else{if(s===0){var l=r<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&(n&1)===1)return this.time=e,t-e}return this.time=e,e},_setEndings:function(r,e,t){var i=this._interpolantSettings;t?(i.endingStart=Ad,i.endingEnd=Ad):(r?i.endingStart=this.zeroSlopeAtStart?Ad:Id:i.endingStart=RS,e?i.endingEnd=this.zeroSlopeAtEnd?Ad:Id:i.endingEnd=RS)},_scheduleFading:function(r,e,t){var i=this._mixer,n=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=n,s[0]=e,o[1]=n+r,s[1]=t,this}};Object.assign(cB.prototype,Ms.prototype,{clipAction:function(r,e){var t=e||this._root,i=t.uuid,n=typeof r=="string"?No.findByName(t,r):r,a=n!==null?n.uuid:r,o=this._actionsByClip[a],s=null;if(o!==void 0){var l=o.actionByRoot[i];if(l!==void 0)return l;s=o.knownActions[0],n===null&&(n=s._clip)}if(n===null)return null;var u=new Tz(this,n,e);return this._bindAction(u,s),this._addInactiveAction(u,a,i),u},existingAction:function(r,e){var t=e||this._root,i=t.uuid,n=typeof r=="string"?No.findByName(t,r):r,a=n?n.uuid:r,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null},stopAllAction:function(){var r=this._actions,e=this._nActiveActions,t=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var n=0;n!==e;++n)r[n].reset();for(var n=0;n!==i;++n)t[n].useCount=0;return this},update:function(r){r*=this.timeScale;for(var e=this._actions,t=this._nActiveActions,i=this.time+=r,n=Math.sign(r),a=this._accuIndex^=1,o=0;o!==t;++o){var s=e[o];s.enabled&&s._update(i,r,n,a)}for(var l=this._bindings,u=this._nActiveBindings,o=0;o!==u;++o)l[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(r){var e=this._actions,t=r.uuid,i=this._actionsByClip,n=i[t];if(n!==void 0){for(var a=n.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var u=l._cacheIndex,c=e[e.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,e[u]=c,e.pop(),this._removeInactiveBindingsForAction(l)}delete i[t]}},uncacheRoot:function(r){var e=r.uuid,t=this._actionsByClip;for(var i in t){var n=t[i].actionByRoot,a=n[e];a!==void 0&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[e];if(s!==void 0)for(var l in s){var u=s[l];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(r,e){var t=this.existingAction(r,e);t!==null&&(this._deactivateAction(t),this._removeInactiveAction(t))}});Object.assign(cB.prototype,{_bindAction:function(r,e){var t=r._localRoot||this._root,i=r._clip.tracks,n=i.length,a=r._propertyBindings,o=r._interpolants,s=t.uuid,l=this._bindingsByRootAndName,u=l[s];u===void 0&&(u={},l[s]=u);for(var c=0;c!==n;++c){var f=i[c],h=f.name,p=u[h];if(p!==void 0)a[c]=p;else{if(p=a[c],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,s,h));continue}var d=e&&e._propertyBindings[c].binding.parsedPath;p=new pC(Ri.create(t,h,d),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,h),a[c]=p}o[c].resultBuffer=p.buffer}},_activateAction:function(r){if(!this._isActiveAction(r)){if(r._cacheIndex===null){var e=(r._localRoot||this._root).uuid,t=r._clip.uuid,i=this._actionsByClip[t];this._bindAction(r,i&&i.knownActions[0]),this._addInactiveAction(r,t,e)}for(var n=r._propertyBindings,a=0,o=n.length;a!==o;++a){var s=n[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(r)}},_deactivateAction:function(r){if(this._isActiveAction(r)){for(var e=r._propertyBindings,t=0,i=e.length;t!==i;++t){var n=e[t];--n.useCount===0&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(r)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var r=this;this.stats={actions:{get total(){return r._actions.length},get inUse(){return r._nActiveActions}},bindings:{get total(){return r._bindings.length},get inUse(){return r._nActiveBindings}},controlInterpolants:{get total(){return r._controlInterpolants.length},get inUse(){return r._nActiveControlInterpolants}}}},_isActiveAction:function(r){var e=r._cacheIndex;return e!==null&&e<this._nActiveActions},_addInactiveAction:function(r,e,t){var i=this._actions,n=this._actionsByClip,a=n[e];if(a===void 0)a={knownActions:[r],actionByRoot:{}},r._byClipCacheIndex=0,n[e]=a;else{var o=a.knownActions;r._byClipCacheIndex=o.length,o.push(r)}r._cacheIndex=i.length,i.push(r),a.actionByRoot[t]=r},_removeInactiveAction:function(r){var e=this._actions,t=e[e.length-1],i=r._cacheIndex;t._cacheIndex=i,e[i]=t,e.pop(),r._cacheIndex=null;var n=r._clip.uuid,a=this._actionsByClip,o=a[n],s=o.knownActions,l=s[s.length-1],u=r._byClipCacheIndex;l._byClipCacheIndex=u,s[u]=l,s.pop(),r._byClipCacheIndex=null;var c=o.actionByRoot,f=(e._localRoot||this._root).uuid;delete c[f],s.length===0&&delete a[n],this._removeInactiveBindingsForAction(r)},_removeInactiveBindingsForAction:function(r){for(var e=r._propertyBindings,t=0,i=e.length;t!==i;++t){var n=e[t];--n.referenceCount===0&&this._removeInactiveBinding(n)}},_lendAction:function(r){var e=this._actions,t=r._cacheIndex,i=this._nActiveActions++,n=e[i];r._cacheIndex=i,e[i]=r,n._cacheIndex=t,e[t]=n},_takeBackAction:function(r){var e=this._actions,t=r._cacheIndex,i=--this._nActiveActions,n=e[i];r._cacheIndex=i,e[i]=r,n._cacheIndex=t,e[t]=n},_addInactiveBinding:function(r,e,t){var i=this._bindingsByRootAndName,n=i[e],a=this._bindings;n===void 0&&(n={},i[e]=n),n[t]=r,r._cacheIndex=a.length,a.push(r)},_removeInactiveBinding:function(r){var e=this._bindings,t=r.binding,i=t.rootNode.uuid,n=t.path,a=this._bindingsByRootAndName,o=a[i],s=e[e.length-1],l=r._cacheIndex;s._cacheIndex=l,e[l]=s,e.pop(),delete o[n];e:{for(var u in o)break e;delete a[i]}},_lendBinding:function(r){var e=this._bindings,t=r._cacheIndex,i=this._nActiveBindings++,n=e[i];r._cacheIndex=i,e[i]=r,n._cacheIndex=t,e[t]=n},_takeBackBinding:function(r){var e=this._bindings,t=r._cacheIndex,i=--this._nActiveBindings,n=e[i];r._cacheIndex=i,e[i]=r,n._cacheIndex=t,e[t]=n},_lendControlInterpolant:function(){var r=this._controlInterpolants,e=this._nActiveControlInterpolants++,t=r[e];return t===void 0&&(t=new lM(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),t.__cacheIndex=e,r[e]=t),t},_takeBackControlInterpolant:function(r){var e=this._controlInterpolants,t=r.__cacheIndex,i=--this._nActiveControlInterpolants,n=e[i];r.__cacheIndex=i,e[i]=r,n.__cacheIndex=t,e[t]=n},_controlInterpolantsResultBuffer:new Float32Array(1)});dC.prototype.clone=function(){return new dC(this.value.clone===void 0?this.value:this.value.clone())};Jd.prototype=Object.create(Bt.prototype);Jd.prototype.constructor=Jd;Jd.prototype.isInstancedBufferGeometry=!0;Jd.prototype.addGroup=function(r,e,t){this.groups.push({start:r,count:e,materialIndex:t})};Jd.prototype.copy=function(r){var e=r.index;e!==null&&this.setIndex(e.clone());var t=r.attributes;for(var i in t){var n=t[i];this.addAttribute(i,n.clone())}for(var a=r.groups,o=0,s=a.length;o<s;o++){var l=a[o];this.addGroup(l.start,l.count,l.materialIndex)}return this};Ez.prototype={constructor:Ez,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(r,e){return this.data.array[r*this.data.stride+this.offset]=e,this},setY:function(r,e){return this.data.array[r*this.data.stride+this.offset+1]=e,this},setZ:function(r,e){return this.data.array[r*this.data.stride+this.offset+2]=e,this},setW:function(r,e){return this.data.array[r*this.data.stride+this.offset+3]=e,this},getX:function(r){return this.data.array[r*this.data.stride+this.offset]},getY:function(r){return this.data.array[r*this.data.stride+this.offset+1]},getZ:function(r){return this.data.array[r*this.data.stride+this.offset+2]},getW:function(r){return this.data.array[r*this.data.stride+this.offset+3]},setXY:function(r,e,t){return r=r*this.data.stride+this.offset,this.data.array[r+0]=e,this.data.array[r+1]=t,this},setXYZ:function(r,e,t,i){return r=r*this.data.stride+this.offset,this.data.array[r+0]=e,this.data.array[r+1]=t,this.data.array[r+2]=i,this},setXYZW:function(r,e,t,i,n){return r=r*this.data.stride+this.offset,this.data.array[r+0]=e,this.data.array[r+1]=t,this.data.array[r+2]=i,this.data.array[r+3]=n,this}};wy.prototype={constructor:wy,isInterleavedBuffer:!0,set needsUpdate(r){r===!0&&this.version++},setArray:function(r){if(Array.isArray(r))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=r!==void 0?r.length/this.stride:0,this.array=r},setDynamic:function(r){return this.dynamic=r,this},copy:function(r){return this.array=new r.array.constructor(r.array),this.count=r.count,this.stride=r.stride,this.dynamic=r.dynamic,this},copyAt:function(r,e,t){r*=this.stride,t*=e.stride;for(var i=0,n=this.stride;i<n;i++)this.array[r+i]=e.array[t+i];return this},set:function(r,e){return e===void 0&&(e=0),this.array.set(r,e),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(r){return this.onUploadCallback=r,this}};Ty.prototype=Object.create(wy.prototype);Ty.prototype.constructor=Ty;Ty.prototype.isInstancedInterleavedBuffer=!0;Ty.prototype.copy=function(r){return wy.prototype.copy.call(this,r),this.meshPerAttribute=r.meshPerAttribute,this};Ey.prototype=Object.create(gt.prototype);Ey.prototype.constructor=Ey;Ey.prototype.isInstancedBufferAttribute=!0;Ey.prototype.copy=function(r){return gt.prototype.copy.call(this,r),this.meshPerAttribute=r.meshPerAttribute,this};Az.prototype={constructor:Az,linePrecision:1,set:function(r,e){this.ray.set(r,e)},setFromCamera:function(r,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(r.x,r.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(r.x,r.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(r,e){var t=[];return Cz(r,this,t,e),t.sort(Oie),t},intersectObjects:function(r,e){var t=[];if(Array.isArray(r)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),t;for(var i=0,n=r.length;i<n;i++)Cz(r[i],this,t,e);return t.sort(Oie),t}};Rz.prototype={constructor:Rz,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var r=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=(performance||Date).now();r=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=r}return r}};Lz.prototype={constructor:Lz,set:function(r,e,t){return this.radius=r,this.phi=e,this.theta=t,this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.radius=r.radius,this.phi=r.phi,this.theta=r.theta,this},makeSafe:function(){var r=1e-6;return this.phi=Math.max(r,Math.min(Math.PI-r,this.phi)),this},setFromVector3:function(r){return this.radius=r.length(),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(r.x,r.z),this.phi=Math.acos(cr.clamp(r.y/this.radius,-1,1))),this}};Pz.prototype={constructor:Pz,set:function(r,e,t){return this.radius=r,this.theta=e,this.y=t,this},clone:function(){return new this.constructor().copy(this)},copy:function(r){return this.radius=r.radius,this.theta=r.theta,this.y=r.y,this},setFromVector3:function(r){return this.radius=Math.sqrt(r.x*r.x+r.z*r.z),this.theta=Math.atan2(r.x,r.z),this.y=r.y,this}};Pn.prototype=Object.create(mn.prototype);Pn.prototype.constructor=Pn;Pn.prototype.createAnimation=function(r,e,t,i){var n={start:e,end:t,length:t-e+1,fps:i,duration:(t-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[r]=n,this.animationsList.push(n)};Pn.prototype.autoCreateAnimations=function(r){for(var e=/([a-z]+)_?(\d+)/i,t,i={},n=this.geometry,a=0,o=n.morphTargets.length;a<o;a++){var s=n.morphTargets[a],l=s.name.match(e);if(l&&l.length>1){var u=l[1];i[u]||(i[u]={start:1/0,end:-1/0});var c=i[u];a<c.start&&(c.start=a),a>c.end&&(c.end=a),t||(t=u)}}for(var u in i){var c=i[u];this.createAnimation(u,c.start,c.end,r)}this.firstAnimation=t};Pn.prototype.setAnimationDirectionForward=function(r){var e=this.animationsMap[r];e&&(e.direction=1,e.directionBackwards=!1)};Pn.prototype.setAnimationDirectionBackward=function(r){var e=this.animationsMap[r];e&&(e.direction=-1,e.directionBackwards=!0)};Pn.prototype.setAnimationFPS=function(r,e){var t=this.animationsMap[r];t&&(t.fps=e,t.duration=(t.end-t.start)/t.fps)};Pn.prototype.setAnimationDuration=function(r,e){var t=this.animationsMap[r];t&&(t.duration=e,t.fps=(t.end-t.start)/t.duration)};Pn.prototype.setAnimationWeight=function(r,e){var t=this.animationsMap[r];t&&(t.weight=e)};Pn.prototype.setAnimationTime=function(r,e){var t=this.animationsMap[r];t&&(t.time=e)};Pn.prototype.getAnimationTime=function(r){var e=0,t=this.animationsMap[r];return t&&(e=t.time),e};Pn.prototype.getAnimationDuration=function(r){var e=-1,t=this.animationsMap[r];return t&&(e=t.duration),e};Pn.prototype.playAnimation=function(r){var e=this.animationsMap[r];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+r+"] undefined in .playAnimation()")};Pn.prototype.stopAnimation=function(r){var e=this.animationsMap[r];e&&(e.active=!1)};Pn.prototype.update=function(r){for(var e=0,t=this.animationsList.length;e<t;e++){var i=this.animationsList[e];if(i.active){var n=i.duration/i.length;i.time+=i.direction*r,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var a=i.start+cr.clamp(Math.floor(i.time/n),0,i.length-1),o=i.weight;a!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*o,this.morphTargetInfluences[a]=0,i.lastFrame=i.currentFrame,i.currentFrame=a);var s=i.time%n/n;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*o,this.morphTargetInfluences[i.lastFrame]=(1-s)*o):this.morphTargetInfluences[i.currentFrame]=o}}};fM.prototype=Object.create(Et.prototype);fM.prototype.constructor=fM;fM.prototype.isImmediateRenderObject=!0;hM.prototype=Object.create(di.prototype);hM.prototype.constructor=hM;hM.prototype.update=function(){var r=new oe,e=new oe,t=new bs;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),t.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,o=this.geometry.attributes.position,s=this.object.geometry;if(s&&s.isGeometry)for(var l=s.vertices,u=s.faces,c=0,f=0,h=u.length;f<h;f++)for(var p=u[f],d=0,g=p.vertexNormals.length;d<g;d++){var m=l[p[n[d]]],v=p.vertexNormals[d];r.copy(m).applyMatrix4(a),e.copy(v).applyMatrix3(t).normalize().multiplyScalar(this.size).add(r),o.setXYZ(c,r.x,r.y,r.z),c=c+1,o.setXYZ(c,e.x,e.y,e.z),c=c+1}else if(s&&s.isBufferGeometry)for(var _=s.attributes.position,y=s.attributes.normal,c=0,d=0,g=_.count;d<g;d++)r.set(_.getX(d),_.getY(d),_.getZ(d)).applyMatrix4(a),e.set(y.getX(d),y.getY(d),y.getZ(d)),e.applyMatrix3(t).normalize().multiplyScalar(this.size).add(r),o.setXYZ(c,r.x,r.y,r.z),c=c+1,o.setXYZ(c,e.x,e.y,e.z),c=c+1;return o.needsUpdate=!0,this}}();Ay.prototype=Object.create(Et.prototype);Ay.prototype.constructor=Ay;Ay.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()};Ay.prototype.update=function(){var r=new oe,e=new oe;return function(){var i=this.light.distance?this.light.distance:1e3,n=i*Math.tan(this.light.angle);this.cone.scale.set(n,n,i),r.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(r)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}();Cy.prototype=Object.create(di.prototype);Cy.prototype.constructor=Cy;Cy.prototype.getBoneList=function(r){var e=[];r&&r.isBone&&e.push(r);for(var t=0;t<r.children.length;t++)e.push.apply(e,this.getBoneList(r.children[t]));return e};Cy.prototype.update=function(){var r=new oe,e=new qt,t=new qt;return function(){var n=this.geometry,a=n.getAttribute("position");t.getInverse(this.root.matrixWorld);for(var o=0,s=0;o<this.bones.length;o++){var l=this.bones[o];l.parent&&l.parent.isBone&&(e.multiplyMatrices(t,l.matrixWorld),r.setFromMatrixPosition(e),a.setXYZ(s,r.x,r.y,r.z),e.multiplyMatrices(t,l.parent.matrixWorld),r.setFromMatrixPosition(e),a.setXYZ(s+1,r.x,r.y,r.z),s+=2)}n.getAttribute("position").needsUpdate=!0}}();Ry.prototype=Object.create(mn.prototype);Ry.prototype.constructor=Ry;Ry.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()};Ry.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};Ly.prototype=Object.create(Et.prototype);Ly.prototype.constructor=Ly;Ly.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose(),this.children[1].geometry.dispose(),this.children[1].material.dispose()};Ly.prototype.update=function(){var r=new oe,e=new oe;return function(){var i=this.children[0],n=this.children[1];if(this.light.target){r.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld);var a=e.clone().sub(r);i.lookAt(a),n.lookAt(a)}i.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var o=this.light.width*.5,s=this.light.height*.5,l=i.geometry.getAttribute("position"),u=l.array;u[0]=o,u[1]=-s,u[2]=0,u[3]=o,u[4]=s,u[5]=0,u[6]=-o,u[7]=s,u[8]=0,u[9]=-o,u[10]=s,u[11]=0,u[12]=-o,u[13]=-s,u[14]=0,u[15]=o,u[16]=-s,u[17]=0,l.needsUpdate=!0}}();Py.prototype=Object.create(Et.prototype);Py.prototype.constructor=Py;Py.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()};Py.prototype.update=function(){var r=new oe,e=new Gt,t=new Gt;return function(){var n=this.children[0],a=n.geometry.getAttribute("color");e.copy(this.light.color).multiplyScalar(this.light.intensity),t.copy(this.light.groundColor).multiplyScalar(this.light.intensity);for(var o=0,s=a.count;o<s;o++){var l=o<s/2?e:t;a.setXYZ(o,l.r,l.g,l.b)}n.lookAt(r.setFromMatrixPosition(this.light.matrixWorld).negate()),a.needsUpdate=!0}}();pM.prototype=Object.create(di.prototype);pM.prototype.constructor=pM;mC.prototype=Object.create(di.prototype);mC.prototype.constructor=mC;dM.prototype=Object.create(di.prototype);dM.prototype.constructor=dM;dM.prototype.update=function(){var r=new oe,e=new oe,t=new bs;return function(){this.object.updateMatrixWorld(!0),t.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry,s=o.vertices,l=o.faces,u=0,c=0,f=l.length;c<f;c++){var h=l[c],p=h.normal;r.copy(s[h.a]).add(s[h.b]).add(s[h.c]).divideScalar(3).applyMatrix4(n),e.copy(p).applyMatrix3(t).normalize().multiplyScalar(this.size).add(r),a.setXYZ(u,r.x,r.y,r.z),u=u+1,a.setXYZ(u,e.x,e.y,e.z),u=u+1}return a.needsUpdate=!0,this}}();Dy.prototype=Object.create(Et.prototype);Dy.prototype.constructor=Dy;Dy.prototype.dispose=function(){var r=this.children[0],e=this.children[1];r.geometry.dispose(),r.material.dispose(),e.geometry.dispose(),e.material.dispose()};Dy.prototype.update=function(){var r=new oe,e=new oe,t=new oe;return function(){r.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),t.subVectors(e,r);var n=this.children[0],a=this.children[1];n.lookAt(t),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),a.lookAt(t),a.scale.z=t.length()}}();mM.prototype=Object.create(di.prototype);mM.prototype.constructor=mM;mM.prototype.update=function(){var r,e,t=new oe,i=new Qn;function n(a,o,s,l){t.set(o,s,l).unproject(i);var u=e[a];if(u!==void 0)for(var c=r.getAttribute("position"),f=0,h=u.length;f<h;f++)c.setXYZ(u[f],t.x,t.y,t.z)}return function(){r=this.geometry,e=this.pointMap;var o=1,s=1;i.projectionMatrix.copy(this.camera.projectionMatrix),n("c",0,0,-1),n("t",0,0,1),n("n1",-o,-s,-1),n("n2",o,-s,-1),n("n3",-o,s,-1),n("n4",o,s,-1),n("f1",-o,-s,1),n("f2",o,-s,1),n("f3",-o,s,1),n("f4",o,s,1),n("u1",o*.7,s*1.1,-1),n("u2",-o*.7,s*1.1,-1),n("u3",0,s*2,-1),n("cf1",-o,0,1),n("cf2",o,0,1),n("cf3",0,-s,1),n("cf4",0,s,1),n("cn1",-o,0,-1),n("cn2",o,0,-1),n("cn3",0,-s,-1),n("cn4",0,s,-1),r.getAttribute("position").needsUpdate=!0}}();Iy.prototype=Object.create(di.prototype);Iy.prototype.constructor=Iy;Iy.prototype.update=function(){var r=new lu;return function(t){if(t&&t.isBox3?r.copy(t):r.setFromObject(t),!r.isEmpty()){var i=r.min,n=r.max,a=this.geometry.attributes.position,o=a.array;o[0]=n.x,o[1]=n.y,o[2]=n.z,o[3]=i.x,o[4]=n.y,o[5]=n.z,o[6]=i.x,o[7]=i.y,o[8]=n.z,o[9]=n.x,o[10]=i.y,o[11]=n.z,o[12]=n.x,o[13]=n.y,o[14]=i.z,o[15]=i.x,o[16]=n.y,o[17]=i.z,o[18]=i.x,o[19]=i.y,o[20]=i.z,o[21]=n.x,o[22]=i.y,o[23]=i.z,a.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}();jne=new Bt;jne.addAttribute("position",new gr([0,0,0,0,1,0],3));Kne=new sc(0,.5,1,5,1);Kne.translate(0,-.5,0);$d.prototype=Object.create(Et.prototype);$d.prototype.constructor=$d;$d.prototype.setDirection=function(){var r=new oe,e;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(r.set(i.z,0,-i.x).normalize(),e=Math.acos(i.y),this.quaternion.setFromAxisAngle(r,e))}}();$d.prototype.setLength=function(r,e,t){e===void 0&&(e=.2*r),t===void 0&&(t=.2*e),this.line.scale.set(1,Math.max(0,r-e),1),this.line.updateMatrix(),this.cone.scale.set(t,e,t),this.cone.position.y=r,this.cone.updateMatrix()};$d.prototype.setColor=function(r){this.line.material.color.copy(r),this.cone.material.color.copy(r)};vC.prototype=Object.create(di.prototype);vC.prototype.constructor=vC;fB=function(){var r=new oe,e=new n,t=new n,i=new n;function n(){}return n.prototype.init=function(a,o,s,l){this.c0=a,this.c1=s,this.c2=-3*a+3*o-2*s-l,this.c3=2*a-2*o+s+l},n.prototype.initNonuniformCatmullRom=function(a,o,s,l,u,c,f){var h=(o-a)/u-(s-a)/(u+c)+(s-o)/c,p=(s-o)/c-(l-o)/(c+f)+(l-s)/f;h*=c,p*=c,this.init(o,s,h,p)},n.prototype.initCatmullRom=function(a,o,s,l,u){this.init(o,s,u*(s-a),u*(l-o))},n.prototype.calc=function(a){var o=a*a,s=o*a;return this.c0+this.c1*a+this.c2*o+this.c3*s},ea.create(function(a){this.points=a||[],this.closed=!1},function(a){var o=this.points,s,l,u,c;c=o.length,c<2&&console.log("duh, you need at least 2 points"),s=(c-(this.closed?0:1))*a,l=Math.floor(s),u=s-l,this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o.length)+1)*o.length:u===0&&l===c-1&&(l=c-2,u=1);var f,h,p,d;if(this.closed||l>0?f=o[(l-1)%c]:(r.subVectors(o[0],o[1]).add(o[0]),f=r),h=o[l%c],p=o[(l+1)%c],this.closed||l+2<c?d=o[(l+2)%c]:(r.subVectors(o[c-1],o[c-2]).add(o[c-1]),d=r),this.type===void 0||this.type==="centripetal"||this.type==="chordal"){var g=this.type==="chordal"?.5:.25,m=Math.pow(f.distanceToSquared(h),g),v=Math.pow(h.distanceToSquared(p),g),_=Math.pow(p.distanceToSquared(d),g);v<1e-4&&(v=1),m<1e-4&&(m=v),_<1e-4&&(_=v),e.initNonuniformCatmullRom(f.x,h.x,p.x,d.x,m,v,_),t.initNonuniformCatmullRom(f.y,h.y,p.y,d.y,m,v,_),i.initNonuniformCatmullRom(f.z,h.z,p.z,d.z,m,v,_)}else if(this.type==="catmullrom"){var y=this.tension!==void 0?this.tension:.5;e.initCatmullRom(f.x,h.x,p.x,d.x,y),t.initCatmullRom(f.y,h.y,p.y,d.y,y),i.initCatmullRom(f.z,h.z,p.z,d.z,y)}var x=new oe(e.calc(u),t.calc(u),i.calc(u));return x})}(),QRe=ea.create(function(r){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=r===void 0?[]:r},function(r){var e=this.points,t=(e.length-1)*r,i=Math.floor(t),n=t-i,a=e[i==0?i:i-1],o=e[i],s=e[i>e.length-2?e.length-1:i+1],l=e[i>e.length-3?e.length-1:i+2],u=_M.interpolate;return new oe(u(a.x,o.x,s.x,l.x,n),u(a.y,o.y,s.y,l.y,n),u(a.z,o.z,s.z,l.z,n))}),eLe=ea.create(function(r,e,t,i){this.v0=r,this.v1=e,this.v2=t,this.v3=i},function(r){var e=Ln.b3;return new oe(e(r,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(r,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(r,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),tLe=ea.create(function(r,e,t){this.v0=r,this.v1=e,this.v2=t},function(r){var e=Ln.b2;return new oe(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y),e(r,this.v0.z,this.v1.z,this.v2.z))}),rLe=ea.create(function(r,e){this.v1=r,this.v2=e},function(r){if(r===1)return this.v2.clone();var e=new oe;return e.subVectors(this.v2,this.v1),e.multiplyScalar(r),e.add(this.v1),e});gC.prototype=Object.create(lc.prototype);gC.prototype.constructor=gC;iLe={createMultiMaterialObject:function(r,e){for(var t=new VS,i=0,n=e.length;i<n;i++)t.add(new mn(r,e[i]));return t},detach:function(r,e,t){r.applyMatrix(e.matrixWorld),e.remove(r),t.add(r)},attach:function(r,e,t){var i=new qt;i.getInverse(t.matrixWorld),r.applyMatrix(i),e.remove(r),t.add(r)}};aLe=0,oLe=1;Jne.prototype=Object.create(fB.prototype);pM.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Object.assign(PS.prototype,{center:function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},size:function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)}});Object.assign(lu.prototype,{center:function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},isIntersectionSphere:function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)},size:function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)}});Rd.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)};cr.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()};Object.assign(bs.prototype,{flattenToArrayOffset:function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},multiplyVector3:function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)},multiplyVector3Array:function(r){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(r)},applyToBuffer:function(r,e,t){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(r)}});Object.assign(qt.prototype,{extractPosition:function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)},flattenToArrayOffset:function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)},getPosition:function(){var r;return function(){return r===void 0&&(r=new oe),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),r.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)},multiplyVector3:function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),r.applyProjection(this)},multiplyVector4:function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},multiplyVector3Array:function(r){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(r)},rotateAxis:function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)},crossVector:function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(r,e,t){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(r)}});Io.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)};on.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)};Object.assign(Mh.prototype,{isIntersectionBox:function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)},isIntersectionPlane:function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)},isIntersectionSphere:function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)}});Object.assign(Pd.prototype,{extrude:function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ws(this,r)},makeGeometry:function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new vy(this,r)}});Object.assign(oe.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)},getScaleFromMatrix:function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)},getColumnFromMatrix:function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)}});or.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")};Object.assign(Et.prototype,{getChildByName:function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)}});Object.defineProperties(Et.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},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.")}}});Object.defineProperties(kS.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}});Kn.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)};Object.defineProperties(Oi.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}});Object.defineProperties(gt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}});Object.assign(Bt.prototype,{addIndex:function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)},addDrawCall:function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}});Object.defineProperties(Bt.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}}});Object.defineProperties(dC.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}});Object.defineProperties(mr.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new Gt}}});Object.defineProperties(ml.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(_a.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}});Ms.prototype=Object.assign(Object.create({constructor:Ms,apply:function(r){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(r,this)}}),Ms.prototype);Object.assign($z.prototype,{supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}});Object.defineProperties($z.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=r}}});Object.defineProperties(Gne.prototype,{cullFace:{get:function(){return this.renderReverseSided?Dz:wS},set:function(r){var e=r!==wS;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}});Object.defineProperties(Oy.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}});by.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this,t=new lB;return t.load(r,function(i){e.setBuffer(i)}),this};uB.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};RLe={merge:function(r,e,t){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),r.merge(e,i,t)},center:function(r){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),r.center()}},LLe={crossOrigin:void 0,loadTexture:function(r,e,t,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new TC;n.setCrossOrigin(this.crossOrigin);var a=n.load(r,t,void 0,i);return e&&(a.mapping=e),a},loadTextureCube:function(r,e,t,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new tB;n.setCrossOrigin(this.crossOrigin);var a=n.load(r,t,void 0,i);return e&&(a.mapping=e),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}}});var rae=Ise(AC=>{"use strict";var ILe=AC&&AC.__extends||function(r,e){for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);function i(){this.constructor=r}r.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)},Fr=(Qne(),Use($ne)),xi={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},eae={type:"change"},hB={type:"start"},pB={type:"end"},tae=1e-6,NLe=function(r){ILe(e,r);function e(t,i,n){var a=r.call(this)||this;return a.object=t,a.domElement=i!==void 0?i:document,a.window=n!==void 0?n:window,a.enabled=!0,a.target=new Fr.Vector3,a.minDistance=0,a.maxDistance=1/0,a.minZoom=0,a.maxZoom=1/0,a.minPolarAngle=0,a.maxPolarAngle=Math.PI,a.minAzimuthAngle=-1/0,a.maxAzimuthAngle=1/0,a.enableDamping=!1,a.dampingFactor=.25,a.enableZoom=!0,a.zoomSpeed=1,a.enableRotate=!0,a.rotateSpeed=1,a.enablePan=!0,a.keyPanSpeed=7,a.autoRotate=!1,a.autoRotateSpeed=2,a.enableKeys=!0,a.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},a.mouseButtons={ORBIT:Fr.MOUSE.LEFT,ZOOM:Fr.MOUSE.MIDDLE,PAN:Fr.MOUSE.RIGHT},a.target0=a.target.clone(),a.position0=a.object.position.clone(),a.zoom0=a.object.zoom,a.updateOffset=new Fr.Vector3,a.updateQuat=new Fr.Quaternion().setFromUnitVectors(t.up,new Fr.Vector3(0,1,0)),a.updateQuatInverse=a.updateQuat.clone().inverse(),a.updateLastPosition=new Fr.Vector3,a.updateLastQuaternion=new Fr.Quaternion,a.state=xi.NONE,a.scale=1,a.spherical=new Fr.Spherical,a.sphericalDelta=new Fr.Spherical,a.panOffset=new Fr.Vector3,a.zoomChanged=!1,a.rotateStart=new Fr.Vector2,a.rotateEnd=new Fr.Vector2,a.rotateDelta=new Fr.Vector2,a.panStart=new Fr.Vector2,a.panEnd=new Fr.Vector2,a.panDelta=new Fr.Vector2,a.dollyStart=new Fr.Vector2,a.dollyEnd=new Fr.Vector2,a.dollyDelta=new Fr.Vector2,a.panLeftV=new Fr.Vector3,a.panUpV=new Fr.Vector3,a.panInternalOffset=new Fr.Vector3,a.onMouseDown=function(o){if(a.enabled!==!1){if(o.preventDefault(),o.button===a.mouseButtons.ORBIT){if(a.enableRotate===!1)return;a.rotateStart.set(o.clientX,o.clientY),a.state=xi.ROTATE}else if(o.button===a.mouseButtons.ZOOM){if(a.enableZoom===!1)return;a.dollyStart.set(o.clientX,o.clientY),a.state=xi.DOLLY}else if(o.button===a.mouseButtons.PAN){if(a.enablePan===!1)return;a.panStart.set(o.clientX,o.clientY),a.state=xi.PAN}a.state!==xi.NONE&&(document.addEventListener("mousemove",a.onMouseMove,!1),document.addEventListener("mouseup",a.onMouseUp,!1),a.dispatchEvent(hB))}},a.onMouseMove=function(o){if(a.enabled!==!1){if(o.preventDefault(),a.state===xi.ROTATE){if(a.enableRotate===!1)return;a.rotateEnd.set(o.clientX,o.clientY),a.rotateDelta.subVectors(a.rotateEnd,a.rotateStart);var s=a.domElement===document?a.domElement.body:a.domElement;a.rotateLeft(2*Math.PI*a.rotateDelta.x/s.clientWidth*a.rotateSpeed),a.rotateUp(2*Math.PI*a.rotateDelta.y/s.clientHeight*a.rotateSpeed),a.rotateStart.copy(a.rotateEnd),a.update()}else if(a.state===xi.DOLLY){if(a.enableZoom===!1)return;a.dollyEnd.set(o.clientX,o.clientY),a.dollyDelta.subVectors(a.dollyEnd,a.dollyStart),a.dollyDelta.y>0?a.dollyIn(a.getZoomScale()):a.dollyDelta.y<0&&a.dollyOut(a.getZoomScale()),a.dollyStart.copy(a.dollyEnd),a.update()}else if(a.state===xi.PAN){if(a.enablePan===!1)return;a.panEnd.set(o.clientX,o.clientY),a.panDelta.subVectors(a.panEnd,a.panStart),a.pan(a.panDelta.x,a.panDelta.y),a.panStart.copy(a.panEnd),a.update()}}},a.onMouseUp=function(o){a.enabled!==!1&&(document.removeEventListener("mousemove",a.onMouseMove,!1),document.removeEventListener("mouseup",a.onMouseUp,!1),a.dispatchEvent(pB),a.state=xi.NONE)},a.onMouseWheel=function(o){a.enabled===!1||a.enableZoom===!1||a.state!==xi.NONE&&a.state!==xi.ROTATE||(o.preventDefault(),o.stopPropagation(),o.deltaY<0?a.dollyOut(a.getZoomScale()):o.deltaY>0&&a.dollyIn(a.getZoomScale()),a.update(),a.dispatchEvent(hB),a.dispatchEvent(pB))},a.onKeyDown=function(o){if(!(a.enabled===!1||a.enableKeys===!1||a.enablePan===!1))switch(o.keyCode){case a.keys.UP:a.pan(0,a.keyPanSpeed),a.update();break;case a.keys.BOTTOM:a.pan(0,-a.keyPanSpeed),a.update();break;case a.keys.LEFT:a.pan(a.keyPanSpeed,0),a.update();break;case a.keys.RIGHT:a.pan(-a.keyPanSpeed,0),a.update();break}},a.onTouchStart=function(o){if(a.enabled!==!1){switch(o.touches.length){case 1:{if(a.enableRotate===!1)return;a.rotateStart.set(o.touches[0].pageX,o.touches[0].pageY),a.state=xi.TOUCH_ROTATE}break;case 2:{if(a.enableZoom===!1)return;var s=o.touches[0].pageX-o.touches[1].pageX,l=o.touches[0].pageY-o.touches[1].pageY,u=Math.sqrt(s*s+l*l);a.dollyStart.set(0,u),a.state=xi.TOUCH_DOLLY}break;case 3:{if(a.enablePan===!1)return;a.panStart.set(o.touches[0].pageX,o.touches[0].pageY),a.state=xi.TOUCH_PAN}break;default:a.state=xi.NONE}a.state!==xi.NONE&&a.dispatchEvent(hB)}},a.onTouchMove=function(o){if(a.enabled!==!1)switch(o.preventDefault(),o.stopPropagation(),o.touches.length){case 1:{if(a.enableRotate===!1||a.state!==xi.TOUCH_ROTATE)return;a.rotateEnd.set(o.touches[0].pageX,o.touches[0].pageY),a.rotateDelta.subVectors(a.rotateEnd,a.rotateStart);var s=a.domElement===document?a.domElement.body:a.domElement;a.rotateLeft(2*Math.PI*a.rotateDelta.x/s.clientWidth*a.rotateSpeed),a.rotateUp(2*Math.PI*a.rotateDelta.y/s.clientHeight*a.rotateSpeed),a.rotateStart.copy(a.rotateEnd),a.update()}break;case 2:{if(a.enableZoom===!1||a.state!==xi.TOUCH_DOLLY)return;var l=o.touches[0].pageX-o.touches[1].pageX,u=o.touches[0].pageY-o.touches[1].pageY,c=Math.sqrt(l*l+u*u);a.dollyEnd.set(0,c),a.dollyDelta.subVectors(a.dollyEnd,a.dollyStart),a.dollyDelta.y>0?a.dollyOut(a.getZoomScale()):a.dollyDelta.y<0&&a.dollyIn(a.getZoomScale()),a.dollyStart.copy(a.dollyEnd),a.update()}break;case 3:{if(a.enablePan===!1||a.state!==xi.TOUCH_PAN)return;a.panEnd.set(o.touches[0].pageX,o.touches[0].pageY),a.panDelta.subVectors(a.panEnd,a.panStart),a.pan(a.panDelta.x,a.panDelta.y),a.panStart.copy(a.panEnd),a.update()}break;default:a.state=xi.NONE}},a.onTouchEnd=function(o){a.enabled!==!1&&(a.dispatchEvent(pB),a.state=xi.NONE)},a.onContextMenu=function(o){o.preventDefault()},a.domElement.addEventListener("contextmenu",a.onContextMenu,!1),a.domElement.addEventListener("mousedown",a.onMouseDown,!1),a.domElement.addEventListener("wheel",a.onMouseWheel,!1),a.domElement.addEventListener("touchstart",a.onTouchStart,!1),a.domElement.addEventListener("touchend",a.onTouchEnd,!1),a.domElement.addEventListener("touchmove",a.onTouchMove,!1),a.window.addEventListener("keydown",a.onKeyDown,!1),a.update(),a}return e.prototype.update=function(){var t=this.object.position;return this.updateOffset.copy(t).sub(this.target),this.updateOffset.applyQuaternion(this.updateQuat),this.spherical.setFromVector3(this.updateOffset),this.autoRotate&&this.state===xi.NONE&&this.rotateLeft(this.getAutoRotationAngle()),this.spherical.theta+=this.sphericalDelta.theta,this.spherical.phi+=this.sphericalDelta.phi,this.spherical.theta=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this.spherical.theta)),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),this.spherical.radius*=this.scale,this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius)),this.target.add(this.panOffset),this.updateOffset.setFromSpherical(this.spherical),this.updateOffset.applyQuaternion(this.updateQuatInverse),t.copy(this.target).add(this.updateOffset),this.object.lookAt(this.target),this.enableDamping===!0?(this.sphericalDelta.theta*=1-this.dampingFactor,this.sphericalDelta.phi*=1-this.dampingFactor):this.sphericalDelta.set(0,0,0),this.scale=1,this.panOffset.set(0,0,0),this.zoomChanged||this.updateLastPosition.distanceToSquared(this.object.position)>tae||8*(1-this.updateLastQuaternion.dot(this.object.quaternion))>tae?(this.dispatchEvent(eae),this.updateLastPosition.copy(this.object.position),this.updateLastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):!1},e.prototype.panLeft=function(t,i){this.panLeftV.setFromMatrixColumn(i,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)},e.prototype.panUp=function(t,i){this.panUpV.setFromMatrixColumn(i,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)},e.prototype.pan=function(t,i){var n=this.domElement===document?this.domElement.body:this.domElement;if(this.object instanceof Fr.PerspectiveCamera){var a=this.object.position;this.panInternalOffset.copy(a).sub(this.target);var o=this.panInternalOffset.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/n.clientHeight,this.object.matrix),this.panUp(2*i*o/n.clientHeight,this.object.matrix)}else this.object instanceof Fr.OrthographicCamera?(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(i*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)},e.prototype.dollyIn=function(t){this.object instanceof Fr.PerspectiveCamera?this.scale/=t:this.object instanceof Fr.OrthographicCamera?(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*t)),this.object.updateProjectionMatrix(),this.zoomChanged=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)},e.prototype.dollyOut=function(t){this.object instanceof Fr.PerspectiveCamera?this.scale*=t:this.object instanceof Fr.OrthographicCamera?(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/t)),this.object.updateProjectionMatrix(),this.zoomChanged=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)},e.prototype.getAutoRotationAngle=function(){return 2*Math.PI/60/60*this.autoRotateSpeed},e.prototype.getZoomScale=function(){return Math.pow(.95,this.zoomSpeed)},e.prototype.rotateLeft=function(t){this.sphericalDelta.theta-=t},e.prototype.rotateUp=function(t){this.sphericalDelta.phi-=t},e.prototype.getPolarAngle=function(){return this.spherical.phi},e.prototype.getAzimuthalAngle=function(){return this.spherical.theta},e.prototype.dispose=function(){this.domElement.removeEventListener("contextmenu",this.onContextMenu,!1),this.domElement.removeEventListener("mousedown",this.onMouseDown,!1),this.domElement.removeEventListener("wheel",this.onMouseWheel,!1),this.domElement.removeEventListener("touchstart",this.onTouchStart,!1),this.domElement.removeEventListener("touchend",this.onTouchEnd,!1),this.domElement.removeEventListener("touchmove",this.onTouchMove,!1),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),this.window.removeEventListener("keydown",this.onKeyDown,!1)},e.prototype.reset=function(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(eae),this.update(),this.state=xi.NONE},Object.defineProperty(e.prototype,"center",{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"noZoom",{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(t){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!t},enumerable:!0,configurable:!0}),e}(Fr.EventDispatcher);AC.OrbitControls=NLe});var rL=function(r,e){return rL=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},rL(r,e)};function Z(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");rL(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ose=function(){function r(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return r}(),Fse=function(){function r(){this.browser=new Ose,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow=typeof window<"u"}return r}(),Jh=new Fse;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(Jh.wxa=!0,Jh.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?Jh.worker=!0:typeof navigator>"u"||navigator.userAgent.indexOf("Node.js")===0?(Jh.node=!0,Jh.svgSupported=!0):zse(navigator.userAgent,Jh);function zse(r,e){var t=e.browser,i=r.match(/Firefox\/([\d.]+)/),n=r.match(/MSIE\s([\d.]+)/)||r.match(/Trident\/.+?rv:(([\d.]+))/),a=r.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(r);i&&(t.firefox=!0,t.version=i[1]),n&&(t.ie=!0,t.version=n[1]),a&&(t.edge=!0,t.version=a[1],t.newEdge=+a[1].split(".")[0]>18),o&&(t.weChat=!0),e.svgSupported=typeof SVGRect<"u",e.touchEventsSupported="ontouchstart"in window&&!t.ie&&!t.edge,e.pointerEventsSupported="onpointerdown"in window&&(t.edge||t.ie&&+t.version>=11),e.domSupported=typeof document<"u";var s=document.documentElement.style;e.transform3dSupported=(t.ie&&"transition"in s||t.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||t.ie&&+t.version>=9}var Ft=Jh;var $M=12,iL="sans-serif",ho=$M+"px "+iL,Bse=20,kse=100,Vse="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function Gse(r){var e={};if(typeof JSON>"u")return e;for(var t=0;t<r.length;t++){var i=String.fromCharCode(t+32),n=(r.charCodeAt(t)-Bse)/kse;e[i]=n}return e}var Hse=Gse(Vse),zn={createCanvas:function(){return typeof document<"u"&&document.createElement("canvas")},measureText:function(){var r,e;return function(t,i){if(!r){var n=zn.createCanvas();r=n&&n.getContext("2d")}if(r)return e!==i&&(e=r.font=i||ho),r.measureText(t);t=t||"",i=i||ho;var a=/(\d+)px/.exec(i),o=a&&+a[1]||$M,s=0;if(i.indexOf("mono")>=0)s=o*t.length;else for(var l=0;l<t.length;l++){var u=Hse[t[l]];s+=u==null?o:u*o}return{width:s}}}(),loadImage:function(r,e,t){var i=new Image;return i.onload=e,i.onerror=t,i.src=r,i}};var DV=gn(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(r,e){return r["[object "+e+"]"]=!0,r},{}),IV=gn(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(r,e){return r["[object "+e+"Array]"]=!0,r},{}),xm=Object.prototype.toString,eb=Array.prototype,Wse=eb.forEach,Xse=eb.filter,nL=eb.slice,Yse=eb.map,LV=(function(){}).constructor,QM=LV?LV.prototype:null,aL="__proto__",qse=2311;function tb(){return qse++}function $h(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];typeof console<"u"&&console.error.apply(console,r)}function Qe(r){if(r==null||typeof r!="object")return r;var e=r,t=xm.call(r);if(t==="[object Array]"){if(!D0(r)){e=[];for(var i=0,n=r.length;i<n;i++)e[i]=Qe(r[i])}}else if(IV[t]){if(!D0(r)){var a=r.constructor;if(a.from)e=a.from(r);else{e=new a(r.length);for(var i=0,n=r.length;i<n;i++)e[i]=r[i]}}}else if(!DV[t]&&!D0(r)&&!af(r)){e={};for(var o in r)r.hasOwnProperty(o)&&o!==aL&&(e[o]=Qe(r[o]))}return e}function _t(r,e,t){if(!qe(e)||!qe(r))return t?Qe(e):r;for(var i in e)if(e.hasOwnProperty(i)&&i!==aL){var n=r[i],a=e[i];qe(a)&&qe(n)&&!pe(a)&&!pe(n)&&!af(a)&&!af(n)&&!PV(a)&&!PV(n)&&!D0(a)&&!D0(n)?_t(n,a,t):(t||!(i in r))&&(r[i]=Qe(e[i]))}return r}function Sm(r,e){for(var t=r[0],i=1,n=r.length;i<n;i++)t=_t(t,r[i],e);return t}function fe(r,e){if(Object.assign)Object.assign(r,e);else for(var t in e)e.hasOwnProperty(t)&&t!==aL&&(r[t]=e[t]);return r}function Ye(r,e,t){for(var i=bt(e),n=0;n<i.length;n++){var a=i[n];(t?e[a]!=null:r[a]==null)&&(r[a]=e[a])}return r}var n3e=zn.createCanvas;function dt(r,e){if(r){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t}return-1}function NV(r,e){var t=r.prototype;function i(){}i.prototype=e.prototype,r.prototype=new i;for(var n in t)t.hasOwnProperty(n)&&(r.prototype[n]=t[n]);r.prototype.constructor=r,r.superClass=e}function wr(r,e,t){if(r="prototype"in r?r.prototype:r,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var i=Object.getOwnPropertyNames(e),n=0;n<i.length;n++){var a=i[n];a!=="constructor"&&(t?e[a]!=null:r[a]==null)&&(r[a]=e[a])}else Ye(r,e,t)}function ci(r){return!r||typeof r=="string"?!1:typeof r.length=="number"}function N(r,e,t){if(r&&e)if(r.forEach&&r.forEach===Wse)r.forEach(e,t);else if(r.length===+r.length)for(var i=0,n=r.length;i<n;i++)e.call(t,r[i],i,r);else for(var a in r)r.hasOwnProperty(a)&&e.call(t,r[a],a,r)}function de(r,e,t){if(!r)return[];if(!e)return rb(r);if(r.map&&r.map===Yse)return r.map(e,t);for(var i=[],n=0,a=r.length;n<a;n++)i.push(e.call(t,r[n],n,r));return i}function gn(r,e,t,i){if(r&&e){for(var n=0,a=r.length;n<a;n++)t=e.call(i,t,r[n],n,r);return t}}function Wt(r,e,t){if(!r)return[];if(!e)return rb(r);if(r.filter&&r.filter===Xse)return r.filter(e,t);for(var i=[],n=0,a=r.length;n<a;n++)e.call(t,r[n],n,r)&&i.push(r[n]);return i}function UV(r,e,t){if(r&&e){for(var i=0,n=r.length;i<n;i++)if(e.call(t,r[i],i,r))return r[i]}}function bt(r){if(!r)return[];if(Object.keys)return Object.keys(r);var e=[];for(var t in r)r.hasOwnProperty(t)&&e.push(t);return e}function Zse(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];return function(){return r.apply(e,t.concat(nL.call(arguments)))}}var Be=QM&&He(QM.bind)?QM.call.bind(QM.bind):Zse;function ot(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return function(){return r.apply(this,e.concat(nL.call(arguments)))}}function pe(r){return Array.isArray?Array.isArray(r):xm.call(r)==="[object Array]"}function He(r){return typeof r=="function"}function Ce(r){return typeof r=="string"}function I0(r){return xm.call(r)==="[object String]"}function At(r){return typeof r=="number"}function qe(r){var e=typeof r;return e==="function"||!!r&&e==="object"}function PV(r){return!!DV[xm.call(r)]}function bi(r){return!!IV[xm.call(r)]}function af(r){return typeof r=="object"&&typeof r.nodeType=="number"&&typeof r.ownerDocument=="object"}function of(r){return r.colorStops!=null}function OV(r){return r.image!=null}function FV(r){return xm.call(r)==="[object RegExp]"}function sf(r){return r!==r}function Br(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var t=0,i=r.length;t<i;t++)if(r[t]!=null)return r[t]}function ft(r,e){return r??e}function Xi(r,e,t){return r??e??t}function rb(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return nL.apply(r,e)}function Mm(r){if(typeof r=="number")return[r,r,r,r];var e=r.length;return e===2?[r[0],r[1],r[0],r[1]]:e===3?[r[0],r[1],r[2],r[1]]:r}function kr(r,e){if(!r)throw new Error(e)}function Yi(r){return r==null?null:typeof r.trim=="function"?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}var zV="__ec_primitive__";function Qh(r){r[zV]=!0}function D0(r){return r[zV]}var jse=function(){function r(){this.data={}}return r.prototype.delete=function(e){var t=this.has(e);return t&&delete this.data[e],t},r.prototype.has=function(e){return this.data.hasOwnProperty(e)},r.prototype.get=function(e){return this.data[e]},r.prototype.set=function(e,t){return this.data[e]=t,this},r.prototype.keys=function(){return bt(this.data)},r.prototype.forEach=function(e){var t=this.data;for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},r}(),BV=typeof Map=="function";function Kse(){return BV?new Map:new jse}var Jse=function(){function r(e){var t=pe(e);this.data=Kse();var i=this;e instanceof r?e.each(n):e&&N(e,n);function n(a,o){t?i.set(a,o):i.set(o,a)}}return r.prototype.hasKey=function(e){return this.data.has(e)},r.prototype.get=function(e){return this.data.get(e)},r.prototype.set=function(e,t){return this.data.set(e,t),t},r.prototype.each=function(e,t){this.data.forEach(function(i,n){e.call(t,i,n)})},r.prototype.keys=function(){var e=this.data.keys();return BV?Array.from(e):e},r.prototype.removeKey=function(e){this.data.delete(e)},r}();function ke(r){return new Jse(r)}function ep(r,e){for(var t=new r.constructor(r.length+e.length),i=0;i<r.length;i++)t[i]=r[i];for(var n=r.length,i=0;i<e.length;i++)t[i+n]=e[i];return t}function lf(r,e){var t;if(Object.create)t=Object.create(r);else{var i=function(){};i.prototype=r,t=new i}return e&&fe(t,e),t}function ib(r){var e=r.style;e.webkitUserSelect="none",e.userSelect="none",e.webkitTapHighlightColor="rgba(0,0,0,0)",e["-webkit-touch-callout"]="none"}function tt(r,e){return r.hasOwnProperty(e)}function Ir(){}var bm=180/Math.PI;var oL=function(r,e){return oL=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},oL(r,e)};function Xt(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");oL(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Al(r,e){return r==null&&(r=0),e==null&&(e=0),[r,e]}function qi(r,e){return r[0]=e[0],r[1]=e[1],r}function wa(r){return[r[0],r[1]]}function kV(r,e,t){return r[0]=e,r[1]=t,r}function sL(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function N0(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r}function Is(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function nb(r){return Math.sqrt($se(r))}function $se(r){return r[0]*r[0]+r[1]*r[1]}function wm(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function Wo(r,e){var t=nb(e);return t===0?(r[0]=0,r[1]=0):(r[0]=e[0]/t,r[1]=e[1]/t),r}function ab(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}var Xo=ab;function Qse(r,e){return(r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1])}var yu=Qse;function Tm(r,e,t,i){return r[0]=e[0]+i*(t[0]-e[0]),r[1]=e[1]+i*(t[1]-e[1]),r}function fi(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[2]*n+t[4],r[1]=t[1]*i+t[3]*n+t[5],r}function po(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function mo(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}var Em=function(){function r(e,t){this.target=e,this.topTarget=t&&t.topTarget}return r}(),ele=function(){function r(e){this.handler=e,e.on("mousedown",this._dragStart,this),e.on("mousemove",this._drag,this),e.on("mouseup",this._dragEnd,this)}return r.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new Em(t,e),"dragstart",e.event))},r.prototype._drag=function(e){var t=this._draggingTarget;if(t){var i=e.offsetX,n=e.offsetY,a=i-this._x,o=n-this._y;this._x=i,this._y=n,t.drift(a,o,e),this.handler.dispatchToElement(new Em(t,e),"drag",e.event);var s=this.handler.findHover(i,n,t).target,l=this._dropTarget;this._dropTarget=s,t!==s&&(l&&s!==l&&this.handler.dispatchToElement(new Em(l,e),"dragleave",e.event),s&&s!==l&&this.handler.dispatchToElement(new Em(s,e),"dragenter",e.event))}},r.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new Em(t,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new Em(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},r}(),VV=ele;var tle=function(){function r(e){e&&(this._$eventProcessor=e)}return r.prototype.on=function(e,t,i,n){this._$handlers||(this._$handlers={});var a=this._$handlers;if(typeof t=="function"&&(n=i,i=t,t=null),!i||!e)return this;var o=this._$eventProcessor;t!=null&&o&&o.normalizeQuery&&(t=o.normalizeQuery(t)),a[e]||(a[e]=[]);for(var s=0;s<a[e].length;s++)if(a[e][s].h===i)return this;var l={h:i,query:t,ctx:n||this,callAtLast:i.zrEventfulCallAtLast},u=a[e].length-1,c=a[e][u];return c&&c.callAtLast?a[e].splice(u,0,l):a[e].push(l),this},r.prototype.isSilent=function(e){var t=this._$handlers;return!t||!t[e]||!t[e].length},r.prototype.off=function(e,t){var i=this._$handlers;if(!i)return this;if(!e)return this._$handlers={},this;if(t){if(i[e]){for(var n=[],a=0,o=i[e].length;a<o;a++)i[e][a].h!==t&&n.push(i[e][a]);i[e]=n}i[e]&&i[e].length===0&&delete i[e]}else delete i[e];return this},r.prototype.trigger=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(!this._$handlers)return this;var n=this._$handlers[e],a=this._$eventProcessor;if(n)for(var o=t.length,s=n.length,l=0;l<s;l++){var u=n[l];if(!(a&&a.filter&&u.query!=null&&!a.filter(e,u.query)))switch(o){case 0:u.h.call(u.ctx);break;case 1:u.h.call(u.ctx,t[0]);break;case 2:u.h.call(u.ctx,t[0],t[1]);break;default:u.h.apply(u.ctx,t);break}}return a&&a.afterTrigger&&a.afterTrigger(e),this},r.prototype.triggerWithContext=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(!this._$handlers)return this;var n=this._$handlers[e],a=this._$eventProcessor;if(n)for(var o=t.length,s=t[o-1],l=n.length,u=0;u<l;u++){var c=n[u];if(!(a&&a.filter&&c.query!=null&&!a.filter(e,c.query)))switch(o){case 0:c.h.call(s);break;case 1:c.h.call(s,t[0]);break;case 2:c.h.call(s,t[0],t[1]);break;default:c.h.apply(s,t.slice(1,o-1));break}}return a&&a.afterTrigger&&a.afterTrigger(e),this},r}(),Di=tle;var rle=Math.log(2);function lL(r,e,t,i,n,a){var o=i+"-"+n,s=r.length;if(a.hasOwnProperty(o))return a[o];if(e===1){var l=Math.round(Math.log((1<<s)-1&~n)/rle);return r[t][l]}for(var u=i|1<<t,c=t+1;i&1<<c;)c++;for(var f=0,h=0,p=0;h<s;h++){var d=1<<h;d&n||(f+=(p%2?-1:1)*r[t][h]*lL(r,e-1,c,u,n|d,a),p++)}return a[o]=f,f}function uL(r,e){var t=[[r[0],r[1],1,0,0,0,-e[0]*r[0],-e[0]*r[1]],[0,0,0,r[0],r[1],1,-e[1]*r[0],-e[1]*r[1]],[r[2],r[3],1,0,0,0,-e[2]*r[2],-e[2]*r[3]],[0,0,0,r[2],r[3],1,-e[3]*r[2],-e[3]*r[3]],[r[4],r[5],1,0,0,0,-e[4]*r[4],-e[4]*r[5]],[0,0,0,r[4],r[5],1,-e[5]*r[4],-e[5]*r[5]],[r[6],r[7],1,0,0,0,-e[6]*r[6],-e[6]*r[7]],[0,0,0,r[6],r[7],1,-e[7]*r[6],-e[7]*r[7]]],i={},n=lL(t,8,0,0,0,i);if(n!==0){for(var a=[],o=0;o<8;o++)for(var s=0;s<8;s++)a[s]==null&&(a[s]=0),a[s]+=((o+s)%2?-1:1)*lL(t,7,o===0?1:0,1<<o,1<<s,i)/n*e[o];return function(l,u,c){var f=u*a[6]+c*a[7]+1;l[0]=(u*a[0]+c*a[1]+a[2])/f,l[1]=(u*a[3]+c*a[4]+a[5])/f}}}var GV="___zrEVENTSAVED",cL=[];function HV(r,e,t,i,n){return ob(cL,e,i,n,!0)&&ob(r,t,cL[0],cL[1])}function ob(r,e,t,i,n){if(e.getBoundingClientRect&&Ft.domSupported&&!fL(e)){var a=e[GV]||(e[GV]={}),o=ile(e,a),s=nle(o,a,n);if(s)return s(r,t,i),!0}return!1}function ile(r,e){var t=e.markers;if(t)return t;t=e.markers=[];for(var i=["left","right"],n=["top","bottom"],a=0;a<4;a++){var o=document.createElement("div"),s=o.style,l=a%2,u=(a>>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[l]+":0",n[u]+":0",i[1-l]+":auto",n[1-u]+":auto",""].join("!important;"),r.appendChild(o),t.push(o)}return t}function nle(r,e,t){for(var i=t?"invTrans":"trans",n=e[i],a=e.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var c=r[u].getBoundingClientRect(),f=2*u,h=c.left,p=c.top;o.push(h,p),l=l&&a&&h===a[f]&&p===a[f+1],s.push(r[u].offsetLeft,r[u].offsetTop)}return l&&n?n:(e.srcCoords=o,e[i]=t?uL(s,o):uL(o,s))}function fL(r){return r.nodeName.toUpperCase()==="CANVAS"}var ale=/([&<>"'])/g,ole={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function yn(r){return r==null?"":(r+"").replace(ale,function(e,t){return ole[t]})}var sle=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,hL=[],lle=Ft.browser.firefox&&+Ft.browser.version.split(".")[0]<39;function sb(r,e,t,i){return t=t||{},i?WV(r,e,t):lle&&e.layerX!=null&&e.layerX!==e.offsetX?(t.zrX=e.layerX,t.zrY=e.layerY):e.offsetX!=null?(t.zrX=e.offsetX,t.zrY=e.offsetY):WV(r,e,t),t}function WV(r,e,t){if(Ft.domSupported&&r.getBoundingClientRect){var i=e.clientX,n=e.clientY;if(fL(r)){var a=r.getBoundingClientRect();t.zrX=i-a.left,t.zrY=n-a.top;return}else if(ob(hL,r,i,n)){t.zrX=hL[0],t.zrY=hL[1];return}}t.zrX=t.zrY=0}function lb(r){return r||window.event}function Ta(r,e,t){if(e=lb(e),e.zrX!=null)return e;var i=e.type,n=i&&i.indexOf("touch")>=0;if(n){var o=i!=="touchend"?e.targetTouches[0]:e.changedTouches[0];o&&sb(r,o,e,t)}else{sb(r,e,e,t);var a=ule(e);e.zrDelta=a?a/120:-(e.detail||0)/3}var s=e.button;return e.which==null&&s!==void 0&&sle.test(e.type)&&(e.which=s&1?1:s&2?3:s&4?2:0),e}function ule(r){var e=r.wheelDelta;if(e)return e;var t=r.deltaX,i=r.deltaY;if(t==null||i==null)return e;var n=Math.abs(i!==0?i:t),a=i>0?-1:i<0?1:t>0?-1:1;return 3*n*a}function U0(r,e,t,i){r.addEventListener(e,t,i)}function XV(r,e,t,i){r.removeEventListener(e,t,i)}var Ea=function(r){r.preventDefault(),r.stopPropagation(),r.cancelBubble=!0};function pL(r){return r.which===2||r.which===3}var qV=function(){function r(){this._track=[]}return r.prototype.recognize=function(e,t,i){return this._doTrack(e,t,i),this._recognize(e)},r.prototype.clear=function(){return this._track.length=0,this},r.prototype._doTrack=function(e,t,i){var n=e.touches;if(n){for(var a={points:[],touches:[],target:t,event:e},o=0,s=n.length;o<s;o++){var l=n[o],u=sb(i,l,{});a.points.push([u.zrX,u.zrY]),a.touches.push(l)}this._track.push(a)}},r.prototype._recognize=function(e){for(var t in dL)if(dL.hasOwnProperty(t)){var i=dL[t](this._track,e);if(i)return i}},r}();function YV(r){var e=r[1][0]-r[0][0],t=r[1][1]-r[0][1];return Math.sqrt(e*e+t*t)}function cle(r){return[(r[0][0]+r[1][0])/2,(r[0][1]+r[1][1])/2]}var dL={pinch:function(r,e){var t=r.length;if(t){var i=(r[t-1]||{}).points,n=(r[t-2]||{}).points||i;if(n&&n.length>1&&i&&i.length>1){var a=YV(i)/YV(n);!isFinite(a)&&(a=1),e.pinchScale=a;var o=cle(i);return e.pinchX=o[0],e.pinchY=o[1],{type:"pinch",target:r[0].target,event:e}}}}};function wi(){return[1,0,0,1,0,0]}function uf(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function O0(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r}function Aa(r,e,t){var i=e[0]*t[0]+e[2]*t[1],n=e[1]*t[0]+e[3]*t[1],a=e[0]*t[2]+e[2]*t[3],o=e[1]*t[2]+e[3]*t[3],s=e[0]*t[4]+e[2]*t[5]+e[4],l=e[1]*t[4]+e[3]*t[5]+e[5];return r[0]=i,r[1]=n,r[2]=a,r[3]=o,r[4]=s,r[5]=l,r}function _n(r,e,t){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4]+t[0],r[5]=e[5]+t[1],r}function Ca(r,e,t,i){i===void 0&&(i=[0,0]);var n=e[0],a=e[2],o=e[4],s=e[1],l=e[3],u=e[5],c=Math.sin(t),f=Math.cos(t);return r[0]=n*f+s*c,r[1]=-n*c+s*f,r[2]=a*f+l*c,r[3]=-a*c+f*l,r[4]=f*(o-i[0])+c*(u-i[1])+i[0],r[5]=f*(u-i[1])-c*(o-i[0])+i[1],r}function Cm(r,e,t){var i=t[0],n=t[1];return r[0]=e[0]*i,r[1]=e[1]*n,r[2]=e[2]*i,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*n,r}function Yo(r,e){var t=e[0],i=e[2],n=e[4],a=e[1],o=e[3],s=e[5],l=t*o-a*i;return l?(l=1/l,r[0]=o*l,r[1]=-a*l,r[2]=-i*l,r[3]=t*l,r[4]=(i*s-o*n)*l,r[5]=(a*n-t*s)*l,r):null}function ZV(r){var e=wi();return O0(e,r),e}var fle=function(){function r(e,t){this.x=e||0,this.y=t||0}return r.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.set=function(e,t){return this.x=e,this.y=t,this},r.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},r.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},r.prototype.scale=function(e){this.x*=e,this.y*=e},r.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},r.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},r.prototype.dot=function(e){return this.x*e.x+this.y*e.y},r.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},r.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},r.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},r.prototype.distance=function(e){var t=this.x-e.x,i=this.y-e.y;return Math.sqrt(t*t+i*i)},r.prototype.distanceSquare=function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},r.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},r.prototype.transform=function(e){if(e){var t=this.x,i=this.y;return this.x=e[0]*t+e[2]*i+e[4],this.y=e[1]*t+e[3]*i+e[5],this}},r.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},r.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},r.set=function(e,t,i){e.x=t,e.y=i},r.copy=function(e,t){e.x=t.x,e.y=t.y},r.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},r.lenSquare=function(e){return e.x*e.x+e.y*e.y},r.dot=function(e,t){return e.x*t.x+e.y*t.y},r.add=function(e,t,i){e.x=t.x+i.x,e.y=t.y+i.y},r.sub=function(e,t,i){e.x=t.x-i.x,e.y=t.y-i.y},r.scale=function(e,t,i){e.x=t.x*i,e.y=t.y*i},r.scaleAndAdd=function(e,t,i,n){e.x=t.x+i.x*n,e.y=t.y+i.y*n},r.lerp=function(e,t,i,n){var a=1-n;e.x=a*t.x+n*i.x,e.y=a*t.y+n*i.y},r}(),Nt=fle;var ub=Math.min,cb=Math.max,tp=new Nt,rp=new Nt,ip=new Nt,np=new Nt,F0=new Nt,z0=new Nt,hle=function(){function r(e,t,i,n){i<0&&(e=e+i,i=-i),n<0&&(t=t+n,n=-n),this.x=e,this.y=t,this.width=i,this.height=n}return r.prototype.union=function(e){var t=ub(e.x,this.x),i=ub(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=cb(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=cb(e.y+e.height,this.y+this.height)-i:this.height=e.height,this.x=t,this.y=i},r.prototype.applyTransform=function(e){r.applyTransform(this,this,e)},r.prototype.calculateTransform=function(e){var t=this,i=e.width/t.width,n=e.height/t.height,a=wi();return _n(a,a,[-t.x,-t.y]),Cm(a,a,[i,n]),_n(a,a,[e.x,e.y]),a},r.prototype.intersect=function(e,t){if(!e)return!1;e instanceof r||(e=r.create(e));var i=this,n=i.x,a=i.x+i.width,o=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,c=e.y,f=e.y+e.height,h=!(a<l||u<n||s<c||f<o);if(t){var p=1/0,d=0,g=Math.abs(a-l),m=Math.abs(u-n),v=Math.abs(s-c),_=Math.abs(f-o),y=Math.min(g,m),x=Math.min(v,_);a<l||u<n?y>d&&(d=y,g<m?Nt.set(z0,-g,0):Nt.set(z0,m,0)):y<p&&(p=y,g<m?Nt.set(F0,g,0):Nt.set(F0,-m,0)),s<c||f<o?x>d&&(d=x,v<_?Nt.set(z0,0,-v):Nt.set(z0,0,_)):y<p&&(p=y,v<_?Nt.set(F0,0,v):Nt.set(F0,0,-_))}return t&&Nt.copy(t,h?F0:z0),h},r.prototype.contain=function(e,t){var i=this;return e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height},r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copy=function(e){r.copy(this,e)},r.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},r.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},r.prototype.isZero=function(){return this.width===0||this.height===0},r.create=function(e){return new r(e.x,e.y,e.width,e.height)},r.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},r.applyTransform=function(e,t,i){if(!i){e!==t&&r.copy(e,t);return}if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var n=i[0],a=i[3],o=i[4],s=i[5];e.x=t.x*n+o,e.y=t.y*a+s,e.width=t.width*n,e.height=t.height*a,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}tp.x=ip.x=t.x,tp.y=np.y=t.y,rp.x=np.x=t.x+t.width,rp.y=ip.y=t.y+t.height,tp.transform(i),np.transform(i),rp.transform(i),ip.transform(i),e.x=ub(tp.x,rp.x,ip.x,np.x),e.y=ub(tp.y,rp.y,ip.y,np.y);var l=cb(tp.x,rp.x,ip.x,np.x),u=cb(tp.y,rp.y,ip.y,np.y);e.width=l-e.x,e.height=u-e.y},r}(),lt=hle;var KV="silent";function ple(r,e,t){return{type:r,event:t,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:t.zrX,offsetY:t.zrY,gestureEvent:t.gestureEvent,pinchX:t.pinchX,pinchY:t.pinchY,pinchScale:t.pinchScale,wheelDelta:t.zrDelta,zrByTouch:t.zrByTouch,which:t.which,stop:dle}}function dle(){Ea(this.event)}var mle=function(r){Xt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.handler=null,t}return e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(Di),B0=function(){function r(e,t){this.x=e,this.y=t}return r}(),vle=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],mL=new lt(0,0,0,0),JV=function(r){Xt(e,r);function e(t,i,n,a,o){var s=r.call(this)||this;return s._hovered=new B0(0,0),s.storage=t,s.painter=i,s.painterRoot=a,s._pointerSize=o,n=n||new mle,s.proxy=null,s.setHandlerProxy(n),s._draggingMgr=new VV(s),s}return e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(N(vle,function(i){t.on&&t.on(i,this[i],this)},this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var i=t.zrX,n=t.zrY,a=$V(this,i,n),o=this._hovered,s=o.target;s&&!s.__zr&&(o=this.findHover(o.x,o.y),s=o.target);var l=this._hovered=a?new B0(i,n):this.findHover(i,n),u=l.target,c=this.proxy;c.setCursor&&c.setCursor(u?u.cursor:"default"),s&&u!==s&&this.dispatchToElement(o,"mouseout",t),this.dispatchToElement(l,"mousemove",t),u&&u!==s&&this.dispatchToElement(l,"mouseover",t)},e.prototype.mouseout=function(t){var i=t.zrEventControl;i!=="only_globalout"&&this.dispatchToElement(this._hovered,"mouseout",t),i!=="no_globalout"&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new B0(0,0)},e.prototype.dispatch=function(t,i){var n=this[t];n&&n.call(this,i)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var i=this.proxy;i.setCursor&&i.setCursor(t)},e.prototype.dispatchToElement=function(t,i,n){t=t||{};var a=t.target;if(!(a&&a.silent)){for(var o="on"+i,s=ple(i,t,n);a&&(a[o]&&(s.cancelBubble=!!a[o].call(a,s)),a.trigger(i,s),a=a.__hostTarget?a.__hostTarget:a.parent,!s.cancelBubble););s.cancelBubble||(this.trigger(i,s),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(l){typeof l[o]=="function"&&l[o].call(l,s),l.trigger&&l.trigger(i,s)}))}},e.prototype.findHover=function(t,i,n){var a=this.storage.getDisplayList(),o=new B0(t,i);if(jV(a,o,t,i,n),this._pointerSize&&!o.target){for(var s=[],l=this._pointerSize,u=l/2,c=new lt(t-u,i-u,l,l),f=a.length-1;f>=0;f--){var h=a[f];h!==n&&!h.ignore&&!h.ignoreCoarsePointer&&(!h.parent||!h.parent.ignoreCoarsePointer)&&(mL.copy(h.getBoundingRect()),h.transform&&mL.applyTransform(h.transform),mL.intersect(c)&&s.push(h))}if(s.length)for(var p=4,d=Math.PI/12,g=Math.PI*2,m=0;m<u;m+=p)for(var v=0;v<g;v+=d){var _=t+m*Math.cos(v),y=i+m*Math.sin(v);if(jV(s,o,_,y,n),o.target)return o}}return o},e.prototype.processGesture=function(t,i){this._gestureMgr||(this._gestureMgr=new qV);var n=this._gestureMgr;i==="start"&&n.clear();var a=n.recognize(t,this.findHover(t.zrX,t.zrY,null).target,this.proxy.dom);if(i==="end"&&n.clear(),a){var o=a.type;t.gestureEvent=o;var s=new B0;s.target=a.target,this.dispatchToElement(s,o,a.event)}},e}(Di);N(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(r){JV.prototype[r]=function(e){var t=e.zrX,i=e.zrY,n=$V(this,t,i),a,o;if((r!=="mouseup"||!n)&&(a=this.findHover(t,i),o=a.target),r==="mousedown")this._downEl=o,this._downPoint=[e.zrX,e.zrY],this._upEl=o;else if(r==="mouseup")this._upEl=o;else if(r==="click"){if(this._downEl!==this._upEl||!this._downPoint||Xo(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(a,r,e)}});function gle(r,e,t){if(r[r.rectHover?"rectContain":"contain"](e,t)){for(var i=r,n=void 0,a=!1;i;){if(i.ignoreClip&&(a=!0),!a){var o=i.getClipPath();if(o&&!o.contain(e,t))return!1}i.silent&&(n=!0);var s=i.__hostTarget;i=s||i.parent}return n?KV:!0}return!1}function jV(r,e,t,i,n){for(var a=r.length-1;a>=0;a--){var o=r[a],s=void 0;if(o!==n&&!o.ignore&&(s=gle(o,t,i))&&(!e.topTarget&&(e.topTarget=o),s!==KV)){e.target=o;break}}}function $V(r,e,t){var i=r.painter;return e<0||e>i.getWidth()||t<0||t>i.getHeight()}var QV=JV;var rG=32,k0=7;function yle(r){for(var e=0;r>=rG;)e|=r&1,r>>=1;return r+e}function eG(r,e,t,i){var n=e+1;if(n===t)return 1;if(i(r[n++],r[e])<0){for(;n<t&&i(r[n],r[n-1])<0;)n++;_le(r,e,n)}else for(;n<t&&i(r[n],r[n-1])>=0;)n++;return n-e}function _le(r,e,t){for(t--;e<t;){var i=r[e];r[e++]=r[t],r[t--]=i}}function tG(r,e,t,i,n){for(i===e&&i++;i<t;i++){for(var a=r[i],o=e,s=i,l;o<s;)l=o+s>>>1,n(a,r[l])<0?s=l:o=l+1;var u=i-o;switch(u){case 3:r[o+3]=r[o+2];case 2:r[o+2]=r[o+1];case 1:r[o+1]=r[o];break;default:for(;u>0;)r[o+u]=r[o+u-1],u--}r[o]=a}}function vL(r,e,t,i,n,a){var o=0,s=0,l=1;if(a(r,e[t+n])>0){for(s=i-n;l<s&&a(r,e[t+n+l])>0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}else{for(s=n+1;l<s&&a(r,e[t+n-l])<=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s);var u=o;o=n-l,l=n-u}for(o++;o<l;){var c=o+(l-o>>>1);a(r,e[t+c])>0?o=c+1:l=c}return l}function gL(r,e,t,i,n,a){var o=0,s=0,l=1;if(a(r,e[t+n])<0){for(s=n+1;l<s&&a(r,e[t+n-l])<0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s);var u=o;o=n-l,l=n-u}else{for(s=i-n;l<s&&a(r,e[t+n+l])>=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}for(o++;o<l;){var c=o+(l-o>>>1);a(r,e[t+c])<0?l=c:o=c+1}return l}function xle(r,e){var t=k0,i,n,a=0,o=[];i=[],n=[];function s(p,d){i[a]=p,n[a]=d,a+=1}function l(){for(;a>1;){var p=a-2;if(p>=1&&n[p-1]<=n[p]+n[p+1]||p>=2&&n[p-2]<=n[p]+n[p-1])n[p-1]<n[p+1]&&p--;else if(n[p]>n[p+1])break;c(p)}}function u(){for(;a>1;){var p=a-2;p>0&&n[p-1]<n[p+1]&&p--,c(p)}}function c(p){var d=i[p],g=n[p],m=i[p+1],v=n[p+1];n[p]=g+v,p===a-3&&(i[p+1]=i[p+2],n[p+1]=n[p+2]),a--;var _=gL(r[m],r,d,g,0,e);d+=_,g-=_,g!==0&&(v=vL(r[d+g-1],r,m,v,v-1,e),v!==0&&(g<=v?f(d,g,m,v):h(d,g,m,v)))}function f(p,d,g,m){var v=0;for(v=0;v<d;v++)o[v]=r[p+v];var _=0,y=g,x=p;if(r[x++]=r[y++],--m===0){for(v=0;v<d;v++)r[x+v]=o[_+v];return}if(d===1){for(v=0;v<m;v++)r[x+v]=r[y+v];r[x+m]=o[_];return}for(var M=t,S,w,T;;){S=0,w=0,T=!1;do if(e(r[y],o[_])<0){if(r[x++]=r[y++],w++,S=0,--m===0){T=!0;break}}else if(r[x++]=o[_++],S++,w=0,--d===1){T=!0;break}while((S|w)<M);if(T)break;do{if(S=gL(r[y],o,_,d,0,e),S!==0){for(v=0;v<S;v++)r[x+v]=o[_+v];if(x+=S,_+=S,d-=S,d<=1){T=!0;break}}if(r[x++]=r[y++],--m===0){T=!0;break}if(w=vL(o[_],r,y,m,0,e),w!==0){for(v=0;v<w;v++)r[x+v]=r[y+v];if(x+=w,y+=w,m-=w,m===0){T=!0;break}}if(r[x++]=o[_++],--d===1){T=!0;break}M--}while(S>=k0||w>=k0);if(T)break;M<0&&(M=0),M+=2}if(t=M,t<1&&(t=1),d===1){for(v=0;v<m;v++)r[x+v]=r[y+v];r[x+m]=o[_]}else{if(d===0)throw new Error;for(v=0;v<d;v++)r[x+v]=o[_+v]}}function h(p,d,g,m){var v=0;for(v=0;v<m;v++)o[v]=r[g+v];var _=p+d-1,y=m-1,x=g+m-1,M=0,S=0;if(r[x--]=r[_--],--d===0){for(M=x-(m-1),v=0;v<m;v++)r[M+v]=o[v];return}if(m===1){for(x-=d,_-=d,S=x+1,M=_+1,v=d-1;v>=0;v--)r[S+v]=r[M+v];r[x]=o[y];return}for(var w=t;;){var T=0,C=0,b=!1;do if(e(o[y],r[_])<0){if(r[x--]=r[_--],T++,C=0,--d===0){b=!0;break}}else if(r[x--]=o[y--],C++,T=0,--m===1){b=!0;break}while((T|C)<w);if(b)break;do{if(T=d-gL(o[y],r,p,d,d-1,e),T!==0){for(x-=T,_-=T,d-=T,S=x+1,M=_+1,v=T-1;v>=0;v--)r[S+v]=r[M+v];if(d===0){b=!0;break}}if(r[x--]=o[y--],--m===1){b=!0;break}if(C=m-vL(r[_],o,0,m,m-1,e),C!==0){for(x-=C,y-=C,m-=C,S=x+1,M=y+1,v=0;v<C;v++)r[S+v]=o[M+v];if(m<=1){b=!0;break}}if(r[x--]=r[_--],--d===0){b=!0;break}w--}while(T>=k0||C>=k0);if(b)break;w<0&&(w=0),w+=2}if(t=w,t<1&&(t=1),m===1){for(x-=d,_-=d,S=x+1,M=_+1,v=d-1;v>=0;v--)r[S+v]=r[M+v];r[x]=o[y]}else{if(m===0)throw new Error;for(M=x-(m-1),v=0;v<m;v++)r[M+v]=o[v]}}return{mergeRuns:l,forceMergeRuns:u,pushRun:s}}function ap(r,e,t,i){t||(t=0),i||(i=r.length);var n=i-t;if(!(n<2)){var a=0;if(n<rG){a=eG(r,t,i,e),tG(r,t,i,t+a,e);return}var o=xle(r,e),s=yle(n);do{if(a=eG(r,t,i,e),a<s){var l=n;l>s&&(l=s),tG(r,t,t+l,t+a,e),a=l}o.pushRun(t,a),o.mergeRuns(),n-=a,t+=a}while(n!==0);o.forceMergeRuns()}}var zi=1,op=2,cf=4;var iG=!1;function yL(){iG||(iG=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function nG(r,e){return r.zlevel===e.zlevel?r.z===e.z?r.z2-e.z2:r.z-e.z:r.zlevel-e.zlevel}var Sle=function(){function r(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=nG}return r.prototype.traverse=function(e,t){for(var i=0;i<this._roots.length;i++)this._roots[i].traverse(e,t)},r.prototype.getDisplayList=function(e,t){t=t||!1;var i=this._displayList;return(e||!i.length)&&this.updateDisplayList(t),i},r.prototype.updateDisplayList=function(e){this._displayListLen=0;for(var t=this._roots,i=this._displayList,n=0,a=t.length;n<a;n++)this._updateAndAddDisplayable(t[n],null,e);i.length=this._displayListLen,ap(i,nG)},r.prototype._updateAndAddDisplayable=function(e,t,i){if(!(e.ignore&&!i)){e.beforeUpdate(),e.update(),e.afterUpdate();var n=e.getClipPath();if(e.ignoreClip)t=null;else if(n){t?t=t.slice():t=[];for(var a=n,o=e;a;)a.parent=o,a.updateTransform(),t.push(a),o=a,a=a.getClipPath()}if(e.childrenRef){for(var s=e.childrenRef(),l=0;l<s.length;l++){var u=s[l];e.__dirty&&(u.__dirty|=zi),this._updateAndAddDisplayable(u,t,i)}e.__dirty=0}else{var c=e;t&&t.length?c.__clipPaths=t:c.__clipPaths&&c.__clipPaths.length>0&&(c.__clipPaths=[]),isNaN(c.z)&&(yL(),c.z=0),isNaN(c.z2)&&(yL(),c.z2=0),isNaN(c.zlevel)&&(yL(),c.zlevel=0),this._displayList[this._displayListLen++]=c}var f=e.getDecalElement&&e.getDecalElement();f&&this._updateAndAddDisplayable(f,t,i);var h=e.getTextGuideLine();h&&this._updateAndAddDisplayable(h,t,i);var p=e.getTextContent();p&&this._updateAndAddDisplayable(p,t,i)}},r.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},r.prototype.delRoot=function(e){if(e instanceof Array){for(var t=0,i=e.length;t<i;t++)this.delRoot(e[t]);return}var n=dt(this._roots,e);n>=0&&this._roots.splice(n,1)},r.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},r.prototype.getRoots=function(){return this._roots},r.prototype.dispose=function(){this._displayList=null,this._roots=null},r}(),aG=Sle;var oG;oG=Ft.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(r){return setTimeout(r,16)};var V0=oG;var fb={linear:function(r){return r},quadraticIn:function(r){return r*r},quadraticOut:function(r){return r*(2-r)},quadraticInOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)},cubicIn:function(r){return r*r*r},cubicOut:function(r){return--r*r*r+1},cubicInOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)},quarticIn:function(r){return r*r*r*r},quarticOut:function(r){return 1- --r*r*r*r},quarticInOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)},quinticIn:function(r){return r*r*r*r*r},quinticOut:function(r){return--r*r*r*r*r+1},quinticInOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)},sinusoidalIn:function(r){return 1-Math.cos(r*Math.PI/2)},sinusoidalOut:function(r){return Math.sin(r*Math.PI/2)},sinusoidalInOut:function(r){return .5*(1-Math.cos(Math.PI*r))},exponentialIn:function(r){return r===0?0:Math.pow(1024,r-1)},exponentialOut:function(r){return r===1?1:1-Math.pow(2,-10*r)},exponentialInOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)},circularIn:function(r){return 1-Math.sqrt(1-r*r)},circularOut:function(r){return Math.sqrt(1- --r*r)},circularInOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)},elasticIn:function(r){var e,t=.1,i=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=i/4):e=i*Math.asin(1/t)/(2*Math.PI),-(t*Math.pow(2,10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/i)))},elasticOut:function(r){var e,t=.1,i=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=i/4):e=i*Math.asin(1/t)/(2*Math.PI),t*Math.pow(2,-10*r)*Math.sin((r-e)*(2*Math.PI)/i)+1)},elasticInOut:function(r){var e,t=.1,i=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=i/4):e=i*Math.asin(1/t)/(2*Math.PI),(r*=2)<1?-.5*(t*Math.pow(2,10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/i)):t*Math.pow(2,-10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/i)*.5+1)},backIn:function(r){var e=1.70158;return r*r*((e+1)*r-e)},backOut:function(r){var e=1.70158;return--r*r*((e+1)*r+e)+1},backInOut:function(r){var e=2.5949095;return(r*=2)<1?.5*(r*r*((e+1)*r-e)):.5*((r-=2)*r*((e+1)*r+e)+2)},bounceIn:function(r){return 1-fb.bounceOut(1-r)},bounceOut:function(r){return r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375},bounceInOut:function(r){return r<.5?fb.bounceIn(r*2)*.5:fb.bounceOut(r*2-1)*.5+.5}},hb=fb;var pb=Math.pow,hf=Math.sqrt,mb=1e-8,lG=1e-4,sG=hf(3),db=1/3,Cl=Al(),qo=Al(),Rm=Al();function ff(r){return r>-mb&&r<mb}function uG(r){return r>mb||r<-mb}function hi(r,e,t,i,n){var a=1-n;return a*a*(a*r+3*n*e)+n*n*(n*i+3*a*t)}function _L(r,e,t,i,n){var a=1-n;return 3*(((e-r)*a+2*(t-e)*n)*a+(i-t)*n*n)}function sp(r,e,t,i,n,a){var o=i+3*(e-t)-r,s=3*(t-e*2+r),l=3*(e-r),u=r-n,c=s*s-3*o*l,f=s*l-9*o*u,h=l*l-3*s*u,p=0;if(ff(c)&&ff(f))if(ff(s))a[0]=0;else{var d=-l/s;d>=0&&d<=1&&(a[p++]=d)}else{var g=f*f-4*c*h;if(ff(g)){var m=f/c,d=-s/o+m,v=-m/2;d>=0&&d<=1&&(a[p++]=d),v>=0&&v<=1&&(a[p++]=v)}else if(g>0){var _=hf(g),y=c*s+1.5*o*(-f+_),x=c*s+1.5*o*(-f-_);y<0?y=-pb(-y,db):y=pb(y,db),x<0?x=-pb(-x,db):x=pb(x,db);var d=(-s-(y+x))/(3*o);d>=0&&d<=1&&(a[p++]=d)}else{var M=(2*c*s-3*o*f)/(2*hf(c*c*c)),S=Math.acos(M)/3,w=hf(c),T=Math.cos(S),d=(-s-2*w*T)/(3*o),v=(-s+w*(T+sG*Math.sin(S)))/(3*o),C=(-s+w*(T-sG*Math.sin(S)))/(3*o);d>=0&&d<=1&&(a[p++]=d),v>=0&&v<=1&&(a[p++]=v),C>=0&&C<=1&&(a[p++]=C)}}return p}function vb(r,e,t,i,n){var a=6*t-12*e+6*r,o=9*e+3*i-3*r-9*t,s=3*e-3*r,l=0;if(ff(o)){if(uG(a)){var u=-s/a;u>=0&&u<=1&&(n[l++]=u)}}else{var c=a*a-4*o*s;if(ff(c))n[0]=-a/(2*o);else if(c>0){var f=hf(c),u=(-a+f)/(2*o),h=(-a-f)/(2*o);u>=0&&u<=1&&(n[l++]=u),h>=0&&h<=1&&(n[l++]=h)}}return l}function Zo(r,e,t,i,n,a){var o=(e-r)*n+r,s=(t-e)*n+e,l=(i-t)*n+t,u=(s-o)*n+o,c=(l-s)*n+s,f=(c-u)*n+u;a[0]=r,a[1]=o,a[2]=u,a[3]=f,a[4]=f,a[5]=c,a[6]=l,a[7]=i}function gb(r,e,t,i,n,a,o,s,l,u,c){var f,h=.005,p=1/0,d,g,m,v;Cl[0]=l,Cl[1]=u;for(var _=0;_<1;_+=.05)qo[0]=hi(r,t,n,o,_),qo[1]=hi(e,i,a,s,_),m=yu(Cl,qo),m<p&&(f=_,p=m);p=1/0;for(var y=0;y<32&&!(h<lG);y++)d=f-h,g=f+h,qo[0]=hi(r,t,n,o,d),qo[1]=hi(e,i,a,s,d),m=yu(qo,Cl),d>=0&&m<p?(f=d,p=m):(Rm[0]=hi(r,t,n,o,g),Rm[1]=hi(e,i,a,s,g),v=yu(Rm,Cl),g<=1&&v<p?(f=g,p=v):h*=.5);return c&&(c[0]=hi(r,t,n,o,f),c[1]=hi(e,i,a,s,f)),hf(p)}function cG(r,e,t,i,n,a,o,s,l){for(var u=r,c=e,f=0,h=1/l,p=1;p<=l;p++){var d=p*h,g=hi(r,t,n,o,d),m=hi(e,i,a,s,d),v=g-u,_=m-c;f+=Math.sqrt(v*v+_*_),u=g,c=m}return f}function vi(r,e,t,i){var n=1-i;return n*(n*r+2*i*e)+i*i*t}function G0(r,e,t,i){return 2*((1-i)*(e-r)+i*(t-e))}function fG(r,e,t,i,n){var a=r-2*e+t,o=2*(e-r),s=r-i,l=0;if(ff(a)){if(uG(o)){var u=-s/o;u>=0&&u<=1&&(n[l++]=u)}}else{var c=o*o-4*a*s;if(ff(c)){var u=-o/(2*a);u>=0&&u<=1&&(n[l++]=u)}else if(c>0){var f=hf(c),u=(-o+f)/(2*a),h=(-o-f)/(2*a);u>=0&&u<=1&&(n[l++]=u),h>=0&&h<=1&&(n[l++]=h)}}return l}function yb(r,e,t){var i=r+t-2*e;return i===0?.5:(r-e)/i}function pf(r,e,t,i,n){var a=(e-r)*i+r,o=(t-e)*i+e,s=(o-a)*i+a;n[0]=r,n[1]=a,n[2]=s,n[3]=s,n[4]=o,n[5]=t}function _b(r,e,t,i,n,a,o,s,l){var u,c=.005,f=1/0;Cl[0]=o,Cl[1]=s;for(var h=0;h<1;h+=.05){qo[0]=vi(r,t,n,h),qo[1]=vi(e,i,a,h);var p=yu(Cl,qo);p<f&&(u=h,f=p)}f=1/0;for(var d=0;d<32&&!(c<lG);d++){var g=u-c,m=u+c;qo[0]=vi(r,t,n,g),qo[1]=vi(e,i,a,g);var p=yu(qo,Cl);if(g>=0&&p<f)u=g,f=p;else{Rm[0]=vi(r,t,n,m),Rm[1]=vi(e,i,a,m);var v=yu(Rm,Cl);m<=1&&v<f?(u=m,f=v):c*=.5}}return l&&(l[0]=vi(r,t,n,u),l[1]=vi(e,i,a,u)),hf(f)}function hG(r,e,t,i,n,a,o){for(var s=r,l=e,u=0,c=1/o,f=1;f<=o;f++){var h=f*c,p=vi(r,t,n,h),d=vi(e,i,a,h),g=p-s,m=d-l;u+=Math.sqrt(g*g+m*m),s=p,l=d}return u}var Mle=/cubic-bezier\(([0-9,\.e ]+)\)/;function Lm(r){var e=r&&Mle.exec(r);if(e){var t=e[1].split(","),i=+Yi(t[0]),n=+Yi(t[1]),a=+Yi(t[2]),o=+Yi(t[3]);if(isNaN(i+n+a+o))return;var s=[];return function(l){return l<=0?0:l>=1?1:sp(0,i,a,1,l,s)&&hi(0,n,o,1,s[0])}}}var ble=function(){function r(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Ir,this.ondestroy=e.ondestroy||Ir,this.onrestart=e.onrestart||Ir,e.easing&&this.setEasing(e.easing)}return r.prototype.step=function(e,t){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),this._paused){this._pausedTime+=t;return}var i=this._life,n=e-this._startTime-this._pausedTime,a=n/i;a<0&&(a=0),a=Math.min(a,1);var o=this.easingFunc,s=o?o(a):a;if(this.onframe(s),a===1)if(this.loop){var l=n%i;this._startTime=e-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){this._paused=!1},r.prototype.setEasing=function(e){this.easing=e,this.easingFunc=He(e)?e:hb[e]||Lm(e)},r}(),pG=ble;var dG=function(){function r(e){this.value=e}return r}();var wle=function(){function r(){this._len=0}return r.prototype.insert=function(e){var t=new dG(e);return this.insertEntry(t),t},r.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},r.prototype.remove=function(e){var t=e.prev,i=e.next;t?t.next=i:this.head=i,i?i.prev=t:this.tail=t,e.next=e.prev=null,this._len--},r.prototype.len=function(){return this._len},r.prototype.clear=function(){this.head=this.tail=null,this._len=0},r}();var Tle=function(){function r(e){this._list=new wle,this._maxSize=10,this._map={},this._maxSize=e}return r.prototype.put=function(e,t){var i=this._list,n=this._map,a=null;if(n[e]==null){var o=i.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=i.head;i.remove(l),delete n[l.key],a=l.value,this._lastRemovedEntry=l}s?s.value=t:s=new dG(t),s.key=e,i.insertEntry(s),n[e]=s}return a},r.prototype.get=function(e){var t=this._map[e],i=this._list;if(t!=null)return t!==i.tail&&(i.remove(t),i.insertEntry(t)),t.value},r.prototype.clear=function(){this._list.clear(),this._map={}},r.prototype.len=function(){return this._list.len()},r}(),_u=Tle;var mG={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ns(r){return r=Math.round(r),r<0?0:r>255?255:r}function Ele(r){return r=Math.round(r),r<0?0:r>360?360:r}function W0(r){return r<0?0:r>1?1:r}function xL(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?Ns(parseFloat(e)/100*255):Ns(parseInt(e,10))}function lp(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?W0(parseFloat(e)/100):W0(parseFloat(e))}function SL(r,e,t){return t<0?t+=1:t>1&&(t-=1),t*6<1?r+(e-r)*t*6:t*2<1?e:t*3<2?r+(e-r)*(2/3-t)*6:r}function df(r,e,t){return r+(e-r)*t}function jo(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function ML(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}var gG=new _u(20),xb=null;function Pm(r,e){xb&&ML(xb,e),xb=gG.put(r,xb||e.slice())}function cn(r,e){if(r){e=e||[];var t=gG.get(r);if(t)return ML(e,t);r=r+"";var i=r.replace(/ /g,"").toLowerCase();if(i in mG)return ML(e,mG[i]),Pm(r,e),e;var n=i.length;if(i.charAt(0)==="#"){if(n===4||n===5){var a=parseInt(i.slice(1,4),16);if(!(a>=0&&a<=4095)){jo(e,0,0,0,1);return}return jo(e,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,n===5?parseInt(i.slice(4),16)/15:1),Pm(r,e),e}else if(n===7||n===9){var a=parseInt(i.slice(1,7),16);if(!(a>=0&&a<=16777215)){jo(e,0,0,0,1);return}return jo(e,(a&16711680)>>16,(a&65280)>>8,a&255,n===9?parseInt(i.slice(7),16)/255:1),Pm(r,e),e}return}var o=i.indexOf("("),s=i.indexOf(")");if(o!==-1&&s+1===n){var l=i.substr(0,o),u=i.substr(o+1,s-(o+1)).split(","),c=1;switch(l){case"rgba":if(u.length!==4)return u.length===3?jo(e,+u[0],+u[1],+u[2],1):jo(e,0,0,0,1);c=lp(u.pop());case"rgb":if(u.length>=3)return jo(e,xL(u[0]),xL(u[1]),xL(u[2]),u.length===3?c:lp(u[3])),Pm(r,e),e;jo(e,0,0,0,1);return;case"hsla":if(u.length!==4){jo(e,0,0,0,1);return}return u[3]=lp(u[3]),bL(u,e),Pm(r,e),e;case"hsl":if(u.length!==3){jo(e,0,0,0,1);return}return bL(u,e),Pm(r,e),e;default:return}}jo(e,0,0,0,1)}}function bL(r,e){var t=(parseFloat(r[0])%360+360)%360/360,i=lp(r[1]),n=lp(r[2]),a=n<=.5?n*(i+1):n+i-n*i,o=n*2-a;return e=e||[],jo(e,Ns(SL(o,a,t+1/3)*255),Ns(SL(o,a,t)*255),Ns(SL(o,a,t-1/3)*255),1),r.length===4&&(e[3]=r[3]),e}function Ale(r){if(r){var e=r[0]/255,t=r[1]/255,i=r[2]/255,n=Math.min(e,t,i),a=Math.max(e,t,i),o=a-n,s=(a+n)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(a+n):u=o/(2-a-n);var c=((a-e)/6+o/2)/o,f=((a-t)/6+o/2)/o,h=((a-i)/6+o/2)/o;e===a?l=h-f:t===a?l=1/3+c-h:i===a&&(l=2/3+f-c),l<0&&(l+=1),l>1&&(l-=1)}var p=[l*360,u,s];return r[3]!=null&&p.push(r[3]),p}}function Sb(r,e){var t=cn(r);if(t){for(var i=0;i<3;i++)e<0?t[i]=t[i]*(1-e)|0:t[i]=(255-t[i])*e+t[i]|0,t[i]>255?t[i]=255:t[i]<0&&(t[i]=0);return Ko(t,t.length===4?"rgba":"rgb")}}function Mb(r,e,t){if(!(!(e&&e.length)||!(r>=0&&r<=1))){t=t||[];var i=r*(e.length-1),n=Math.floor(i),a=Math.ceil(i),o=e[n],s=e[a],l=i-n;return t[0]=Ns(df(o[0],s[0],l)),t[1]=Ns(df(o[1],s[1],l)),t[2]=Ns(df(o[2],s[2],l)),t[3]=W0(df(o[3],s[3],l)),t}}function yG(r,e,t){if(!(!(e&&e.length)||!(r>=0&&r<=1))){var i=r*(e.length-1),n=Math.floor(i),a=Math.ceil(i),o=cn(e[n]),s=cn(e[a]),l=i-n,u=Ko([Ns(df(o[0],s[0],l)),Ns(df(o[1],s[1],l)),Ns(df(o[2],s[2],l)),W0(df(o[3],s[3],l))],"rgba");return t?{color:u,leftIndex:n,rightIndex:a,value:i}:u}}function up(r,e,t,i){var n=cn(r);if(r)return n=Ale(n),e!=null&&(n[0]=Ele(e)),t!=null&&(n[1]=lp(t)),i!=null&&(n[2]=lp(i)),Ko(bL(n),"rgba")}function cp(r,e){var t=cn(r);if(t&&e!=null)return t[3]=W0(e),Ko(t,"rgba")}function Ko(r,e){if(!(!r||!r.length)){var t=r[0]+","+r[1]+","+r[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(t+=","+r[3]),e+"("+t+")"}}function Dm(r,e){var t=cn(r);return t?(.299*t[0]+.587*t[1]+.114*t[2])*t[3]/255+(1-t[3])*e:0}var vG=new _u(100);function X0(r){if(Ce(r)){var e=vG.get(r);return e||(e=Sb(r,-.1),vG.put(r,e)),e}else if(of(r)){var t=fe({},r);return t.colorStops=de(r.colorStops,function(i){return{offset:i.offset,color:Sb(i.color,-.1)}}),t}return r}var wb=Math.round;function mf(r){var e;if(!r||r==="transparent")r="none";else if(typeof r=="string"&&r.indexOf("rgba")>-1){var t=cn(r);t&&(r="rgb("+t[0]+","+t[1]+","+t[2]+")",e=t[3])}return{color:r,opacity:e??1}}var _G=1e-4;function Rl(r){return r<_G&&r>-_G}function bb(r){return wb(r*1e3)/1e3}function Tb(r){return wb(r*1e4)/1e4}function xG(r){return"matrix("+bb(r[0])+","+bb(r[1])+","+bb(r[2])+","+bb(r[3])+","+Tb(r[4])+","+Tb(r[5])+")"}var SG={left:"start",right:"end",center:"middle",middle:"middle"};function MG(r,e,t){return t==="top"?r+=e/2:t==="bottom"&&(r-=e/2),r}function bG(r){return r&&(r.shadowBlur||r.shadowOffsetX||r.shadowOffsetY)}function wG(r){var e=r.style,t=r.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),t[0],t[1]].join(",")}function TL(r){return r&&!!r.image}function Cle(r){return r&&!!r.svgElement}function Y0(r){return TL(r)||Cle(r)}function Eb(r){return r.type==="linear"}function Ab(r){return r.type==="radial"}function Cb(r){return r&&(r.type==="linear"||r.type==="radial")}function q0(r){return"url(#"+r+")"}function Rb(r){var e=r.getGlobalScale(),t=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(t)/Math.log(10)),1)}function Lb(r){var e=r.x||0,t=r.y||0,i=(r.rotation||0)*bm,n=ft(r.scaleX,1),a=ft(r.scaleY,1),o=r.skewX||0,s=r.skewY||0,l=[];return(e||t)&&l.push("translate("+e+"px,"+t+"px)"),i&&l.push("rotate("+i+")"),(n!==1||a!==1)&&l.push("scale("+n+","+a+")"),(o||s)&&l.push("skew("+wb(o*bm)+"deg, "+wb(s*bm)+"deg)"),l.join(" ")}var TG=function(){return Ft.hasGlobalWindow&&He(window.btoa)?function(r){return window.btoa(unescape(encodeURIComponent(r)))}:typeof Buffer<"u"?function(r){return Buffer.from(r).toString("base64")}:function(r){return null}}();var AL=Array.prototype.slice;function xu(r,e,t){return(e-r)*t+r}function EL(r,e,t,i){for(var n=e.length,a=0;a<n;a++)r[a]=xu(e[a],t[a],i);return r}function Rle(r,e,t,i){for(var n=e.length,a=n&&e[0].length,o=0;o<n;o++){r[o]||(r[o]=[]);for(var s=0;s<a;s++)r[o][s]=xu(e[o][s],t[o][s],i)}return r}function Pb(r,e,t,i){for(var n=e.length,a=0;a<n;a++)r[a]=e[a]+t[a]*i;return r}function EG(r,e,t,i){for(var n=e.length,a=n&&e[0].length,o=0;o<n;o++){r[o]||(r[o]=[]);for(var s=0;s<a;s++)r[o][s]=e[o][s]+t[o][s]*i}return r}function Lle(r,e){for(var t=r.length,i=e.length,n=t>i?e:r,a=Math.min(t,i),o=n[a-1]||{color:[0,0,0,0],offset:0},s=a;s<Math.max(t,i);s++)n.push({offset:o.offset,color:o.color.slice()})}function Ple(r,e,t){var i=r,n=e;if(!(!i.push||!n.push)){var a=i.length,o=n.length;if(a!==o){var s=a>o;if(s)i.length=o;else for(var l=a;l<o;l++)i.push(t===1?n[l]:AL.call(n[l]))}for(var u=i[0]&&i[0].length,l=0;l<i.length;l++)if(t===1)isNaN(i[l])&&(i[l]=n[l]);else for(var c=0;c<u;c++)isNaN(i[l][c])&&(i[l][c]=n[l][c])}}function fp(r){if(ci(r)){var e=r.length;if(ci(r[0])){for(var t=[],i=0;i<e;i++)t.push(AL.call(r[i]));return t}return AL.call(r)}return r}function Nb(r){return r[0]=Math.floor(r[0])||0,r[1]=Math.floor(r[1])||0,r[2]=Math.floor(r[2])||0,r[3]=r[3]==null?1:r[3],"rgba("+r.join(",")+")"}function Dle(r){return ci(r&&r[0])?2:1}var Db=0,Ub=1,RG=2,j0=3,CL=4,RL=5,AG=6;function CG(r){return r===CL||r===RL}function Ib(r){return r===Ub||r===RG}var Z0=[0,0,0,0],Ile=function(){function r(e){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=e}return r.prototype.isFinished=function(){return this._finished},r.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},r.prototype.needsAnimate=function(){return this.keyframes.length>=1},r.prototype.getAdditiveTrack=function(){return this._additiveTrack},r.prototype.addKeyframe=function(e,t,i){this._needsSort=!0;var n=this.keyframes,a=n.length,o=!1,s=AG,l=t;if(ci(t)){var u=Dle(t);s=u,(u===1&&!At(t[0])||u===2&&!At(t[0][0]))&&(o=!0)}else if(At(t)&&!sf(t))s=Db;else if(Ce(t))if(!isNaN(+t))s=Db;else{var c=cn(t);c&&(l=c,s=j0)}else if(of(t)){var f=fe({},l);f.colorStops=de(t.colorStops,function(p){return{offset:p.offset,color:cn(p.color)}}),Eb(t)?s=CL:Ab(t)&&(s=RL),l=f}a===0?this.valType=s:(s!==this.valType||s===AG)&&(o=!0),this.discrete=this.discrete||o;var h={time:e,value:l,rawValue:t,percent:0};return i&&(h.easing=i,h.easingFunc=He(i)?i:hb[i]||Lm(i)),n.push(h),h},r.prototype.prepare=function(e,t){var i=this.keyframes;this._needsSort&&i.sort(function(g,m){return g.time-m.time});for(var n=this.valType,a=i.length,o=i[a-1],s=this.discrete,l=Ib(n),u=CG(n),c=0;c<a;c++){var f=i[c],h=f.value,p=o.value;f.percent=f.time/e,s||(l&&c!==a-1?Ple(h,p,n):u&&Lle(h.colorStops,p.colorStops))}if(!s&&n!==RL&&t&&this.needsAnimate()&&t.needsAnimate()&&n===t.valType&&!t._finished){this._additiveTrack=t;for(var d=i[0].value,c=0;c<a;c++)n===Db?i[c].additiveValue=i[c].value-d:n===j0?i[c].additiveValue=Pb([],i[c].value,d,-1):Ib(n)&&(i[c].additiveValue=n===Ub?Pb([],i[c].value,d,-1):EG([],i[c].value,d,-1))}},r.prototype.step=function(e,t){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var i=this._additiveTrack!=null,n=i?"additiveValue":"value",a=this.valType,o=this.keyframes,s=o.length,l=this.propName,u=a===j0,c,f=this._lastFr,h=Math.min,p,d;if(s===1)p=d=o[0];else{if(t<0)c=0;else if(t<this._lastFrP){var g=h(f+1,s-1);for(c=g;c>=0&&!(o[c].percent<=t);c--);c=h(c,s-2)}else{for(c=f;c<s&&!(o[c].percent>t);c++);c=h(c-1,s-2)}d=o[c+1],p=o[c]}if(p&&d){this._lastFr=c,this._lastFrP=t;var m=d.percent-p.percent,v=m===0?1:h((t-p.percent)/m,1);d.easingFunc&&(v=d.easingFunc(v));var _=i?this._additiveValue:u?Z0:e[l];if((Ib(a)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)e[l]=v<1?p.rawValue:d.rawValue;else if(Ib(a))a===Ub?EL(_,p[n],d[n],v):Rle(_,p[n],d[n],v);else if(CG(a)){var y=p[n],x=d[n],M=a===CL;e[l]={type:M?"linear":"radial",x:xu(y.x,x.x,v),y:xu(y.y,x.y,v),colorStops:de(y.colorStops,function(w,T){var C=x.colorStops[T];return{offset:xu(w.offset,C.offset,v),color:Nb(EL([],w.color,C.color,v))}}),global:x.global},M?(e[l].x2=xu(y.x2,x.x2,v),e[l].y2=xu(y.y2,x.y2,v)):e[l].r=xu(y.r,x.r,v)}else if(u)EL(_,p[n],d[n],v),i||(e[l]=Nb(_));else{var S=xu(p[n],d[n],v);i?this._additiveValue=S:e[l]=S}i&&this._addToTarget(e)}}},r.prototype._addToTarget=function(e){var t=this.valType,i=this.propName,n=this._additiveValue;t===Db?e[i]=e[i]+n:t===j0?(cn(e[i],Z0),Pb(Z0,Z0,n,1),e[i]=Nb(Z0)):t===Ub?Pb(e[i],e[i],n,1):t===RG&&EG(e[i],e[i],n,1)},r}(),Nle=function(){function r(e,t,i,n){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&n){$h("Can' use additive animation on looped animation.");return}this._additiveAnimators=n,this._allowDiscrete=i}return r.prototype.getMaxTime=function(){return this._maxTime},r.prototype.getDelay=function(){return this._delay},r.prototype.getLoop=function(){return this._loop},r.prototype.getTarget=function(){return this._target},r.prototype.changeTarget=function(e){this._target=e},r.prototype.when=function(e,t,i){return this.whenWithKeys(e,t,bt(t),i)},r.prototype.whenWithKeys=function(e,t,i,n){for(var a=this._tracks,o=0;o<i.length;o++){var s=i[o],l=a[s];if(!l){l=a[s]=new Ile(s);var u=void 0,c=this._getAdditiveTrack(s);if(c){var f=c.keyframes,h=f[f.length-1];u=h&&h.value,c.valType===j0&&u&&(u=Nb(u))}else u=this._target[s];if(u==null)continue;e>0&&l.addKeyframe(0,fp(u),n),this._trackKeys.push(s)}l.addKeyframe(e,fp(t[s]),n)}return this._maxTime=Math.max(this._maxTime,e),this},r.prototype.pause=function(){this._clip.pause(),this._paused=!0},r.prototype.resume=function(){this._clip.resume(),this._paused=!1},r.prototype.isPaused=function(){return!!this._paused},r.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},r.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,i=0;i<t;i++)e[i].call(this)},r.prototype._abortedCallback=function(){this._setTracksFinished();var e=this.animation,t=this._abortedCbs;if(e&&e.removeClip(this._clip),this._clip=null,t)for(var i=0;i<t.length;i++)t[i].call(this)},r.prototype._setTracksFinished=function(){for(var e=this._tracks,t=this._trackKeys,i=0;i<t.length;i++)e[t[i]].setFinished()},r.prototype._getAdditiveTrack=function(e){var t,i=this._additiveAnimators;if(i)for(var n=0;n<i.length;n++){var a=i[n].getTrack(e);a&&(t=a)}return t},r.prototype.start=function(e){if(!(this._started>0)){this._started=1;for(var t=this,i=[],n=this._maxTime||0,a=0;a<this._trackKeys.length;a++){var o=this._trackKeys[a],s=this._tracks[o],l=this._getAdditiveTrack(o),u=s.keyframes,c=u.length;if(s.prepare(n,l),s.needsAnimate())if(!this._allowDiscrete&&s.discrete){var f=u[c-1];f&&(t._target[s.propName]=f.rawValue),s.setFinished()}else i.push(s)}if(i.length||this._force){var h=new pG({life:n,loop:this._loop,delay:this._delay||0,onframe:function(p){t._started=2;var d=t._additiveAnimators;if(d){for(var g=!1,m=0;m<d.length;m++)if(d[m]._clip){g=!0;break}g||(t._additiveAnimators=null)}for(var m=0;m<i.length;m++)i[m].step(t._target,p);var v=t._onframeCbs;if(v)for(var m=0;m<v.length;m++)v[m](t._target,p)},ondestroy:function(){t._doneCallback()}});this._clip=h,this.animation&&this.animation.addClip(h),e&&h.setEasing(e)}else this._doneCallback();return this}},r.prototype.stop=function(e){if(this._clip){var t=this._clip;e&&t.onframe(1),this._abortedCallback()}},r.prototype.delay=function(e){return this._delay=e,this},r.prototype.during=function(e){return e&&(this._onframeCbs||(this._onframeCbs=[]),this._onframeCbs.push(e)),this},r.prototype.done=function(e){return e&&(this._doneCbs||(this._doneCbs=[]),this._doneCbs.push(e)),this},r.prototype.aborted=function(e){return e&&(this._abortedCbs||(this._abortedCbs=[]),this._abortedCbs.push(e)),this},r.prototype.getClip=function(){return this._clip},r.prototype.getTrack=function(e){return this._tracks[e]},r.prototype.getTracks=function(){var e=this;return de(this._trackKeys,function(t){return e._tracks[t]})},r.prototype.stopTracks=function(e,t){if(!e.length||!this._clip)return!0;for(var i=this._tracks,n=this._trackKeys,a=0;a<e.length;a++){var o=i[e[a]];o&&!o.isFinished()&&(t?o.step(this._target,1):this._started===1&&o.step(this._target,0),o.setFinished())}for(var s=!0,a=0;a<n.length;a++)if(!i[n[a]].isFinished()){s=!1;break}return s&&this._abortedCallback(),s},r.prototype.saveTo=function(e,t,i){if(e){t=t||this._trackKeys;for(var n=0;n<t.length;n++){var a=t[n],o=this._tracks[a];if(!(!o||o.isFinished())){var s=o.keyframes,l=s[i?0:s.length-1];l&&(e[a]=fp(l.rawValue))}}}},r.prototype.__changeFinalValue=function(e,t){t=t||bt(e);for(var i=0;i<t.length;i++){var n=t[i],a=this._tracks[n];if(a){var o=a.keyframes;if(o.length>1){var s=o.pop();a.addKeyframe(s.time,e[n]),a.prepare(this._maxTime,a.getAdditiveTrack())}}}},r}(),K0=Nle;function hp(){return new Date().getTime()}var Ule=function(r){Xt(e,r);function e(t){var i=r.call(this)||this;return i._running=!1,i._time=0,i._pausedTime=0,i._pauseStart=0,i._paused=!1,t=t||{},i.stage=t.stage||{},i}return e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var i=t.getClip();i&&this.addClip(i)},e.prototype.removeClip=function(t){if(t.animation){var i=t.prev,n=t.next;i?i.next=n:this._head=n,n?n.prev=i:this._tail=i,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var i=t.getClip();i&&this.removeClip(i),t.animation=null},e.prototype.update=function(t){for(var i=hp()-this._pausedTime,n=i-this._time,a=this._head;a;){var o=a.next,s=a.step(i,n);s&&(a.ondestroy(),this.removeClip(a)),a=o}this._time=i,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0;function i(){t._running&&(V0(i),!t._paused&&t.update())}V0(i)},e.prototype.start=function(){this._running||(this._time=hp(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=hp(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=hp()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var i=t.next;t.prev=t.next=t.animation=null,t=i}this._head=this._tail=null},e.prototype.isFinished=function(){return this._head==null},e.prototype.animate=function(t,i){i=i||{},this.start();var n=new K0(t,i.loop);return this.addAnimator(n),n},e}(Di),LG=Ule;var Ole=300,LL=Ft.domSupported,PL=function(){var r=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],t={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},i=de(r,function(n){var a=n.replace("mouse","pointer");return t.hasOwnProperty(a)?a:n});return{mouse:r,touch:e,pointer:i}}(),PG={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},DG=!1;function NL(r){var e=r.pointerType;return e==="pen"||e==="touch"}function Fle(r){r.touching=!0,r.touchTimer!=null&&(clearTimeout(r.touchTimer),r.touchTimer=null),r.touchTimer=setTimeout(function(){r.touching=!1,r.touchTimer=null},700)}function DL(r){r&&(r.zrByTouch=!0)}function zle(r,e){return Ta(r.dom,new Ble(r,e),!0)}function NG(r,e){for(var t=e,i=!1;t&&t.nodeType!==9&&!(i=t.domBelongToZr||t!==e&&t===r.painterRoot);)t=t.parentNode;return i}var Ble=function(){function r(e,t){this.stopPropagation=Ir,this.stopImmediatePropagation=Ir,this.preventDefault=Ir,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return r}(),Us={mousedown:function(r){r=Ta(this.dom,r),this.__mayPointerCapture=[r.zrX,r.zrY],this.trigger("mousedown",r)},mousemove:function(r){r=Ta(this.dom,r);var e=this.__mayPointerCapture;e&&(r.zrX!==e[0]||r.zrY!==e[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",r)},mouseup:function(r){r=Ta(this.dom,r),this.__togglePointerCapture(!1),this.trigger("mouseup",r)},mouseout:function(r){r=Ta(this.dom,r);var e=r.toElement||r.relatedTarget;NG(this,e)||(this.__pointerCapturing&&(r.zrEventControl="no_globalout"),this.trigger("mouseout",r))},wheel:function(r){DG=!0,r=Ta(this.dom,r),this.trigger("mousewheel",r)},mousewheel:function(r){DG||(r=Ta(this.dom,r),this.trigger("mousewheel",r))},touchstart:function(r){r=Ta(this.dom,r),DL(r),this.__lastTouchMoment=new Date,this.handler.processGesture(r,"start"),Us.mousemove.call(this,r),Us.mousedown.call(this,r)},touchmove:function(r){r=Ta(this.dom,r),DL(r),this.handler.processGesture(r,"change"),Us.mousemove.call(this,r)},touchend:function(r){r=Ta(this.dom,r),DL(r),this.handler.processGesture(r,"end"),Us.mouseup.call(this,r),+new Date-+this.__lastTouchMoment<Ole&&Us.click.call(this,r)},pointerdown:function(r){Us.mousedown.call(this,r)},pointermove:function(r){NL(r)||Us.mousemove.call(this,r)},pointerup:function(r){Us.mouseup.call(this,r)},pointerout:function(r){NL(r)||Us.mouseout.call(this,r)}};N(["click","dblclick","contextmenu"],function(r){Us[r]=function(e){e=Ta(this.dom,e),this.trigger(r,e)}});var UL={pointermove:function(r){NL(r)||UL.mousemove.call(this,r)},pointerup:function(r){UL.mouseup.call(this,r)},mousemove:function(r){this.trigger("mousemove",r)},mouseup:function(r){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",r),e&&(r.zrEventControl="only_globalout",this.trigger("mouseout",r))}};function kle(r,e){var t=e.domHandlers;Ft.pointerEventsSupported?N(PL.pointer,function(i){Ob(e,i,function(n){t[i].call(r,n)})}):(Ft.touchEventsSupported&&N(PL.touch,function(i){Ob(e,i,function(n){t[i].call(r,n),Fle(e)})}),N(PL.mouse,function(i){Ob(e,i,function(n){n=lb(n),e.touching||t[i].call(r,n)})}))}function Vle(r,e){Ft.pointerEventsSupported?N(PG.pointer,t):Ft.touchEventsSupported||N(PG.mouse,t);function t(i){function n(a){a=lb(a),NG(r,a.target)||(a=zle(r,a),e.domHandlers[i].call(r,a))}Ob(e,i,n,{capture:!0})}}function Ob(r,e,t,i){r.mounted[e]=t,r.listenerOpts[e]=i,U0(r.domTarget,e,t,i)}function IL(r){var e=r.mounted;for(var t in e)e.hasOwnProperty(t)&&XV(r.domTarget,t,e[t],r.listenerOpts[t]);r.mounted={}}var IG=function(){function r(e,t){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=t}return r}(),Gle=function(r){Xt(e,r);function e(t,i){var n=r.call(this)||this;return n.__pointerCapturing=!1,n.dom=t,n.painterRoot=i,n._localHandlerScope=new IG(t,Us),LL&&(n._globalHandlerScope=new IG(document,UL)),kle(n,n._localHandlerScope),n}return e.prototype.dispose=function(){IL(this._localHandlerScope),LL&&IL(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,LL&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var i=this._globalHandlerScope;t?Vle(this,i):IL(i)}},e}(Di),UG=Gle;var OG=1;Ft.hasGlobalWindow&&(OG=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var pp=OG,J0=.4,$0="#333",Q0="#ccc",FG="#eee";var zG=uf,BG=5e-5;function dp(r){return r>BG||r<-BG}var mp=[],Im=[],OL=wi(),FL=Math.abs,Hle=function(){function r(){}return r.prototype.getLocalTransform=function(e){return r.getLocalTransform(this,e)},r.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},r.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},r.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},r.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},r.prototype.needLocalTransform=function(){return dp(this.rotation)||dp(this.x)||dp(this.y)||dp(this.scaleX-1)||dp(this.scaleY-1)||dp(this.skewX)||dp(this.skewY)},r.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),i=this.transform;if(!(t||e)){i&&(zG(i),this.invTransform=null);return}i=i||wi(),t?this.getLocalTransform(i):zG(i),e&&(t?Aa(i,e,i):O0(i,e)),this.transform=i,this._resolveGlobalScaleRatio(i)},r.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(mp);var i=mp[0]<0?-1:1,n=mp[1]<0?-1:1,a=((mp[0]-i)*t+i)/mp[0]||0,o=((mp[1]-n)*t+n)/mp[1]||0;e[0]*=a,e[1]*=a,e[2]*=o,e[3]*=o}this.invTransform=this.invTransform||wi(),Yo(this.invTransform,e)},r.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},r.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],i=e[2]*e[2]+e[3]*e[3],n=Math.atan2(e[1],e[0]),a=Math.PI/2+n-Math.atan2(e[3],e[2]);i=Math.sqrt(i)*Math.cos(a),t=Math.sqrt(t),this.skewX=a,this.skewY=0,this.rotation=-n,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=i,this.originX=0,this.originY=0}},r.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||wi(),Aa(Im,e.invTransform,t),t=Im);var i=this.originX,n=this.originY;(i||n)&&(OL[4]=i,OL[5]=n,Aa(Im,t,OL),Im[4]-=i,Im[5]-=n,t=Im),this.setLocalTransform(t)}},r.prototype.getGlobalScale=function(e){var t=this.transform;return e=e||[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},r.prototype.transformCoordToLocal=function(e,t){var i=[e,t],n=this.invTransform;return n&&fi(i,i,n),i},r.prototype.transformCoordToGlobal=function(e,t){var i=[e,t],n=this.transform;return n&&fi(i,i,n),i},r.prototype.getLineScale=function(){var e=this.transform;return e&&FL(e[0]-1)>1e-10&&FL(e[3]-1)>1e-10?Math.sqrt(FL(e[0]*e[3]-e[2]*e[1])):1},r.prototype.copyTransform=function(e){zL(this,e)},r.getLocalTransform=function(e,t){t=t||[];var i=e.originX||0,n=e.originY||0,a=e.scaleX,o=e.scaleY,s=e.anchorX,l=e.anchorY,u=e.rotation||0,c=e.x,f=e.y,h=e.skewX?Math.tan(e.skewX):0,p=e.skewY?Math.tan(-e.skewY):0;if(i||n||s||l){var d=i+s,g=n+l;t[4]=-d*a-h*g*o,t[5]=-g*o-p*d*a}else t[4]=t[5]=0;return t[0]=a,t[3]=o,t[1]=p*a,t[2]=h*o,u&&Ca(t,t,u),t[4]+=i+c,t[5]+=n+f,t},r.initDefaultProps=function(){var e=r.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),r}(),go=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function zL(r,e){for(var t=0;t<go.length;t++){var i=go[t];r[i]=e[i]}}var Ra=Hle;var kG={};function La(r,e){e=e||ho;var t=kG[e];t||(t=kG[e]=new _u(500));var i=t.get(r);return i==null&&(i=zn.measureText(r,e).width,t.put(r,i)),i}function VG(r,e,t,i){var n=La(r,e),a=Um(e),o=Nm(0,n,t),s=vp(0,a,i),l=new lt(o,s,n,a);return l}function Ll(r,e,t,i){var n=((r||"")+"").split(`
  2203. `),a=n.length;if(a===1)return VG(n[0],e,t,i);for(var o=new lt(0,0,0,0),s=0;s<n.length;s++){var l=VG(n[s],e,t,i);s===0?o.copy(l):o.union(l)}return o}function Nm(r,e,t){return t==="right"?r-=e:t==="center"&&(r-=e/2),r}function vp(r,e,t){return t==="middle"?r-=e/2:t==="bottom"&&(r-=e),r}function Um(r){return La("\u56FD",r)}function xn(r,e){return typeof r=="string"?r.lastIndexOf("%")>=0?parseFloat(r)/100*e:parseFloat(r):r}function gp(r,e,t){var i=e.position||"inside",n=e.distance!=null?e.distance:5,a=t.height,o=t.width,s=a/2,l=t.x,u=t.y,c="left",f="top";if(i instanceof Array)l+=xn(i[0],t.width),u+=xn(i[1],t.height),c=null,f=null;else switch(i){case"left":l-=n,u+=s,c="right",f="middle";break;case"right":l+=n+o,u+=s,f="middle";break;case"top":l+=o/2,u-=n,c="center",f="bottom";break;case"bottom":l+=o/2,u+=a+n,c="center";break;case"inside":l+=o/2,u+=s,c="center",f="middle";break;case"insideLeft":l+=n,u+=s,f="middle";break;case"insideRight":l+=o-n,u+=s,c="right",f="middle";break;case"insideTop":l+=o/2,u+=n,c="center";break;case"insideBottom":l+=o/2,u+=a-n,c="center",f="bottom";break;case"insideTopLeft":l+=n,u+=n;break;case"insideTopRight":l+=o-n,u+=n,c="right";break;case"insideBottomLeft":l+=n,u+=a-n,f="bottom";break;case"insideBottomRight":l+=o-n,u+=a-n,c="right",f="bottom";break}return r=r||{},r.x=l,r.y=u,r.align=c,r.verticalAlign=f,r}var BL="__zr_normal__",kL=go.concat(["ignore"]),Wle=gn(go,function(r,e){return r[e]=!0,r},{ignore:!1}),Om={},Xle=new lt(0,0,0,0),HL=function(){function r(e){this.id=tb(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return r.prototype._init=function(e){this.attr(e)},r.prototype.drift=function(e,t,i){switch(this.draggable){case"horizontal":t=0;break;case"vertical":e=0;break}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=e,n[5]+=t,this.decomposeTransform(),this.markRedraw()},r.prototype.beforeUpdate=function(){},r.prototype.afterUpdate=function(){},r.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},r.prototype.updateInnerText=function(e){var t=this._textContent;if(t&&(!t.ignore||e)){this.textConfig||(this.textConfig={});var i=this.textConfig,n=i.local,a=t.innerTransformable,o=void 0,s=void 0,l=!1;a.parent=n?this:null;var u=!1;if(a.copyTransform(t),i.position!=null){var c=Xle;i.layoutRect?c.copy(i.layoutRect):c.copy(this.getBoundingRect()),n||c.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Om,i,c):gp(Om,i,c),a.x=Om.x,a.y=Om.y,o=Om.align,s=Om.verticalAlign;var f=i.origin;if(f&&i.rotation!=null){var h=void 0,p=void 0;f==="center"?(h=c.width*.5,p=c.height*.5):(h=xn(f[0],c.width),p=xn(f[1],c.height)),u=!0,a.originX=-a.x+h+(n?0:c.x),a.originY=-a.y+p+(n?0:c.y)}}i.rotation!=null&&(a.rotation=i.rotation);var d=i.offset;d&&(a.x+=d[0],a.y+=d[1],u||(a.originX=-d[0],a.originY=-d[1]));var g=i.inside==null?typeof i.position=="string"&&i.position.indexOf("inside")>=0:i.inside,m=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),v=void 0,_=void 0,y=void 0;g&&this.canBeInsideText()?(v=i.insideFill,_=i.insideStroke,(v==null||v==="auto")&&(v=this.getInsideTextFill()),(_==null||_==="auto")&&(_=this.getInsideTextStroke(v),y=!0)):(v=i.outsideFill,_=i.outsideStroke,(v==null||v==="auto")&&(v=this.getOutsideFill()),(_==null||_==="auto")&&(_=this.getOutsideStroke(v),y=!0)),v=v||"#000",(v!==m.fill||_!==m.stroke||y!==m.autoStroke||o!==m.align||s!==m.verticalAlign)&&(l=!0,m.fill=v,m.stroke=_,m.autoStroke=y,m.align=o,m.verticalAlign=s,t.setDefaultTextStyle(m)),t.__dirty|=zi,l&&t.dirtyStyle(!0)}},r.prototype.canBeInsideText=function(){return!0},r.prototype.getInsideTextFill=function(){return"#fff"},r.prototype.getInsideTextStroke=function(e){return"#000"},r.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?Q0:$0},r.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),i=typeof t=="string"&&cn(t);i||(i=[255,255,255,1]);for(var n=i[3],a=this.__zr.isDarkMode(),o=0;o<3;o++)i[o]=i[o]*n+(a?0:255)*(1-n);return i[3]=1,Ko(i,"rgba")},r.prototype.traverse=function(e,t){},r.prototype.attrKV=function(e,t){e==="textConfig"?this.setTextConfig(t):e==="textContent"?this.setTextContent(t):e==="clipPath"?this.setClipPath(t):e==="extra"?(this.extra=this.extra||{},fe(this.extra,t)):this[e]=t},r.prototype.hide=function(){this.ignore=!0,this.markRedraw()},r.prototype.show=function(){this.ignore=!1,this.markRedraw()},r.prototype.attr=function(e,t){if(typeof e=="string")this.attrKV(e,t);else if(qe(e))for(var i=e,n=bt(i),a=0;a<n.length;a++){var o=n[a];this.attrKV(o,e[o])}return this.markRedraw(),this},r.prototype.saveCurrentToNormalState=function(e){this._innerSaveToNormal(e);for(var t=this._normalState,i=0;i<this.animators.length;i++){var n=this.animators[i],a=n.__fromStateTransition;if(!(n.getLoop()||a&&a!==BL)){var o=n.targetName,s=o?t[o]:t;n.saveTo(s)}}},r.prototype._innerSaveToNormal=function(e){var t=this._normalState;t||(t=this._normalState={}),e.textConfig&&!t.textConfig&&(t.textConfig=this.textConfig),this._savePrimaryToNormal(e,t,kL)},r.prototype._savePrimaryToNormal=function(e,t,i){for(var n=0;n<i.length;n++){var a=i[n];e[a]!=null&&!(a in t)&&(t[a]=this[a])}},r.prototype.hasState=function(){return this.currentStates.length>0},r.prototype.getState=function(e){return this.states[e]},r.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},r.prototype.clearStates=function(e){this.useState(BL,!1,e)},r.prototype.useState=function(e,t,i,n){var a=e===BL,o=this.hasState();if(!(!o&&a)){var s=this.currentStates,l=this.stateTransition;if(!(dt(s,e)>=0&&(t||s.length===1))){var u;if(this.stateProxy&&!a&&(u=this.stateProxy(e)),u||(u=this.states&&this.states[e]),!u&&!a){$h("State "+e+" not exists.");return}a||this.saveCurrentToNormalState(u);var c=!!(u&&u.hoverLayer||n);c&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,u,this._normalState,t,!i&&!this.__inHover&&l&&l.duration>0,l);var f=this._textContent,h=this._textGuide;return f&&f.useState(e,t,i,c),h&&h.useState(e,t,i,c),a?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~zi),u}}},r.prototype.useStates=function(e,t,i){if(!e.length)this.clearStates();else{var n=[],a=this.currentStates,o=e.length,s=o===a.length;if(s){for(var l=0;l<o;l++)if(e[l]!==a[l]){s=!1;break}}if(s)return;for(var l=0;l<o;l++){var u=e[l],c=void 0;this.stateProxy&&(c=this.stateProxy(u,e)),c||(c=this.states[u]),c&&n.push(c)}var f=n[o-1],h=!!(f&&f.hoverLayer||i);h&&this._toggleHoverLayerFlag(!0);var p=this._mergeStates(n),d=this.stateTransition;this.saveCurrentToNormalState(p),this._applyStateObj(e.join(","),p,this._normalState,!1,!t&&!this.__inHover&&d&&d.duration>0,d);var g=this._textContent,m=this._textGuide;g&&g.useStates(e,t,h),m&&m.useStates(e,t,h),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~zi)}},r.prototype.isSilent=function(){for(var e=this.silent,t=this.parent;!e&&t;){if(t.silent){e=!0;break}t=t.parent}return e},r.prototype._updateAnimationTargets=function(){for(var e=0;e<this.animators.length;e++){var t=this.animators[e];t.targetName&&t.changeTarget(this[t.targetName])}},r.prototype.removeState=function(e){var t=dt(this.currentStates,e);if(t>=0){var i=this.currentStates.slice();i.splice(t,1),this.useStates(i)}},r.prototype.replaceState=function(e,t,i){var n=this.currentStates.slice(),a=dt(n,e),o=dt(n,t)>=0;a>=0?o?n.splice(a,1):n[a]=t:i&&!o&&n.push(t),this.useStates(n)},r.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},r.prototype._mergeStates=function(e){for(var t={},i,n=0;n<e.length;n++){var a=e[n];fe(t,a),a.textConfig&&(i=i||{},fe(i,a.textConfig))}return i&&(t.textConfig=i),t},r.prototype._applyStateObj=function(e,t,i,n,a,o){var s=!(t&&n);t&&t.textConfig?(this.textConfig=fe({},n?this.textConfig:i.textConfig),fe(this.textConfig,t.textConfig)):s&&i.textConfig&&(this.textConfig=i.textConfig);for(var l={},u=!1,c=0;c<kL.length;c++){var f=kL[c],h=a&&Wle[f];t&&t[f]!=null?h?(u=!0,l[f]=t[f]):this[f]=t[f]:s&&i[f]!=null&&(h?(u=!0,l[f]=i[f]):this[f]=i[f])}if(!a)for(var c=0;c<this.animators.length;c++){var p=this.animators[c],d=p.targetName;p.getLoop()||p.__changeFinalValue(d?(t||i)[d]:t||i)}u&&this._transitionState(e,l,o)},r.prototype._attachComponent=function(e){if(!(e.__zr&&!e.__hostTarget)&&e!==this){var t=this.__zr;t&&e.addSelfToZr(t),e.__zr=t,e.__hostTarget=this}},r.prototype._detachComponent=function(e){e.__zr&&e.removeSelfFromZr(e.__zr),e.__zr=null,e.__hostTarget=null},r.prototype.getClipPath=function(){return this._clipPath},r.prototype.setClipPath=function(e){this._clipPath&&this._clipPath!==e&&this.removeClipPath(),this._attachComponent(e),this._clipPath=e,this.markRedraw()},r.prototype.removeClipPath=function(){var e=this._clipPath;e&&(this._detachComponent(e),this._clipPath=null,this.markRedraw())},r.prototype.getTextContent=function(){return this._textContent},r.prototype.setTextContent=function(e){var t=this._textContent;t!==e&&(t&&t!==e&&this.removeTextContent(),e.innerTransformable=new Ra,this._attachComponent(e),this._textContent=e,this.markRedraw())},r.prototype.setTextConfig=function(e){this.textConfig||(this.textConfig={}),fe(this.textConfig,e),this.markRedraw()},r.prototype.removeTextConfig=function(){this.textConfig=null,this.markRedraw()},r.prototype.removeTextContent=function(){var e=this._textContent;e&&(e.innerTransformable=null,this._detachComponent(e),this._textContent=null,this._innerTextDefaultStyle=null,this.markRedraw())},r.prototype.getTextGuideLine=function(){return this._textGuide},r.prototype.setTextGuideLine=function(e){this._textGuide&&this._textGuide!==e&&this.removeTextGuideLine(),this._attachComponent(e),this._textGuide=e,this.markRedraw()},r.prototype.removeTextGuideLine=function(){var e=this._textGuide;e&&(this._detachComponent(e),this._textGuide=null,this.markRedraw())},r.prototype.markRedraw=function(){this.__dirty|=zi;var e=this.__zr;e&&(this.__inHover?e.refreshHover():e.refresh()),this.__hostTarget&&this.__hostTarget.markRedraw()},r.prototype.dirty=function(){this.markRedraw()},r.prototype._toggleHoverLayerFlag=function(e){this.__inHover=e;var t=this._textContent,i=this._textGuide;t&&(t.__inHover=e),i&&(i.__inHover=e)},r.prototype.addSelfToZr=function(e){if(this.__zr!==e){this.__zr=e;var t=this.animators;if(t)for(var i=0;i<t.length;i++)e.animation.addAnimator(t[i]);this._clipPath&&this._clipPath.addSelfToZr(e),this._textContent&&this._textContent.addSelfToZr(e),this._textGuide&&this._textGuide.addSelfToZr(e)}},r.prototype.removeSelfFromZr=function(e){if(this.__zr){this.__zr=null;var t=this.animators;if(t)for(var i=0;i<t.length;i++)e.animation.removeAnimator(t[i]);this._clipPath&&this._clipPath.removeSelfFromZr(e),this._textContent&&this._textContent.removeSelfFromZr(e),this._textGuide&&this._textGuide.removeSelfFromZr(e)}},r.prototype.animate=function(e,t,i){var n=e?this[e]:this,a=new K0(n,t,i);return e&&(a.targetName=e),this.addAnimator(a,e),a},r.prototype.addAnimator=function(e,t){var i=this.__zr,n=this;e.during(function(){n.updateDuringAnimation(t)}).done(function(){var a=n.animators,o=dt(a,e);o>=0&&a.splice(o,1)}),this.animators.push(e),i&&i.animation.addAnimator(e),i&&i.wakeUp()},r.prototype.updateDuringAnimation=function(e){this.markRedraw()},r.prototype.stopAnimation=function(e,t){for(var i=this.animators,n=i.length,a=[],o=0;o<n;o++){var s=i[o];!e||e===s.scope?s.stop(t):a.push(s)}return this.animators=a,this},r.prototype.animateTo=function(e,t,i){VL(this,e,t,i)},r.prototype.animateFrom=function(e,t,i){VL(this,e,t,i,!0)},r.prototype._transitionState=function(e,t,i,n){for(var a=VL(this,t,i,n),o=0;o<a.length;o++)a[o].__fromStateTransition=e},r.prototype.getBoundingRect=function(){return null},r.prototype.getPaintRect=function(){return null},r.initDefaultProps=function(){var e=r.prototype;e.type="element",e.name="",e.ignore=e.silent=e.isGroup=e.draggable=e.dragging=e.ignoreClip=e.__inHover=!1,e.__dirty=zi;var t={};function i(a,o,s){t[a+o+s]||(console.warn("DEPRECATED: '"+a+"' has been deprecated. use '"+o+"', '"+s+"' instead"),t[a+o+s]=!0)}function n(a,o,s,l){Object.defineProperty(e,a,{get:function(){if(!this[o]){var c=this[o]=[];u(this,c)}return this[o]},set:function(c){this[s]=c[0],this[l]=c[1],this[o]=c,u(this,c)}});function u(c,f){Object.defineProperty(f,0,{get:function(){return c[s]},set:function(h){c[s]=h}}),Object.defineProperty(f,1,{get:function(){return c[l]},set:function(h){c[l]=h}})}}Object.defineProperty&&(n("position","_legacyPos","x","y"),n("scale","_legacyScale","scaleX","scaleY"),n("origin","_legacyOrigin","originX","originY"))}(),r}();wr(HL,Di);wr(HL,Ra);function VL(r,e,t,i,n){t=t||{};var a=[];GG(r,"",r,e,t,i,a,n);var o=a.length,s=!1,l=t.done,u=t.aborted,c=function(){s=!0,o--,o<=0&&(s?l&&l():u&&u())},f=function(){o--,o<=0&&(s?l&&l():u&&u())};o||l&&l(),a.length>0&&t.during&&a[0].during(function(d,g){t.during(g)});for(var h=0;h<a.length;h++){var p=a[h];c&&p.done(c),f&&p.aborted(f),t.force&&p.duration(t.duration),p.start(t.easing)}return a}function GL(r,e,t){for(var i=0;i<t;i++)r[i]=e[i]}function Yle(r){return ci(r[0])}function qle(r,e,t){if(ci(e[t]))if(ci(r[t])||(r[t]=[]),bi(e[t])){var i=e[t].length;r[t].length!==i&&(r[t]=new e[t].constructor(i),GL(r[t],e[t],i))}else{var n=e[t],a=r[t],o=n.length;if(Yle(n))for(var s=n[0].length,l=0;l<o;l++)a[l]?GL(a[l],n[l],s):a[l]=Array.prototype.slice.call(n[l]);else GL(a,n,o);a.length=n.length}else r[t]=e[t]}function Zle(r,e){return r===e||ci(r)&&ci(e)&&jle(r,e)}function jle(r,e){var t=r.length;if(t!==e.length)return!1;for(var i=0;i<t;i++)if(r[i]!==e[i])return!1;return!0}function GG(r,e,t,i,n,a,o,s){for(var l=bt(i),u=n.duration,c=n.delay,f=n.additive,h=n.setToFinal,p=!qe(a),d=r.animators,g=[],m=0;m<l.length;m++){var v=l[m],_=i[v];if(_!=null&&t[v]!=null&&(p||a[v]))if(qe(_)&&!ci(_)&&!of(_)){if(e){s||(t[v]=_,r.updateDuringAnimation(e));continue}GG(r,v,t[v],_,n,a&&a[v],o,s)}else g.push(v);else s||(t[v]=_,r.updateDuringAnimation(e),g.push(v))}var y=g.length;if(!f&&y)for(var x=0;x<d.length;x++){var M=d[x];if(M.targetName===e){var S=M.stopTracks(g);if(S){var w=dt(d,M);d.splice(w,1)}}}if(n.force||(g=Wt(g,function(E){return!Zle(i[E],t[E])}),y=g.length),y>0||n.force&&!o.length){var T=void 0,C=void 0,b=void 0;if(s){C={},h&&(T={});for(var x=0;x<y;x++){var v=g[x];C[v]=t[v],h?T[v]=i[v]:t[v]=i[v]}}else if(h){b={};for(var x=0;x<y;x++){var v=g[x];b[v]=fp(t[v]),qle(t,i,v)}}var M=new K0(t,!1,!1,f?Wt(d,function(I){return I.targetName===e}):null);M.targetName=e,n.scope&&(M.scope=n.scope),h&&T&&M.whenWithKeys(0,T,g),b&&M.whenWithKeys(0,b,g),M.whenWithKeys(u??500,s?C:i,g).delay(c||0),r.addAnimator(M,e),o.push(M)}}var zb=HL;var HG=function(r){Xt(e,r);function e(t){var i=r.call(this)||this;return i.isGroup=!0,i._children=[],i.attr(t),i}return e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(t){return this._children[t]},e.prototype.childOfName=function(t){for(var i=this._children,n=0;n<i.length;n++)if(i[n].name===t)return i[n]},e.prototype.childCount=function(){return this._children.length},e.prototype.add=function(t){return t&&t!==this&&t.parent!==this&&(this._children.push(t),this._doAdd(t)),this},e.prototype.addBefore=function(t,i){if(t&&t!==this&&t.parent!==this&&i&&i.parent===this){var n=this._children,a=n.indexOf(i);a>=0&&(n.splice(a,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,i){var n=dt(this._children,t);return n>=0&&this.replaceAt(i,n),this},e.prototype.replaceAt=function(t,i){var n=this._children,a=n[i];if(t&&t!==this&&t.parent!==this&&t!==a){n[i]=t,a.parent=null;var o=this.__zr;o&&a.removeSelfFromZr(o),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var i=this.__zr;i&&i!==t.__zr&&t.addSelfToZr(i),i&&i.refresh()},e.prototype.remove=function(t){var i=this.__zr,n=this._children,a=dt(n,t);return a<0?this:(n.splice(a,1),t.parent=null,i&&t.removeSelfFromZr(i),i&&i.refresh(),this)},e.prototype.removeAll=function(){for(var t=this._children,i=this.__zr,n=0;n<t.length;n++){var a=t[n];i&&a.removeSelfFromZr(i),a.parent=null}return t.length=0,this},e.prototype.eachChild=function(t,i){for(var n=this._children,a=0;a<n.length;a++){var o=n[a];t.call(i,o,a)}return this},e.prototype.traverse=function(t,i){for(var n=0;n<this._children.length;n++){var a=this._children[n],o=t.call(i,a);a.isGroup&&!o&&a.traverse(t,i)}return this},e.prototype.addSelfToZr=function(t){r.prototype.addSelfToZr.call(this,t);for(var i=0;i<this._children.length;i++){var n=this._children[i];n.addSelfToZr(t)}},e.prototype.removeSelfFromZr=function(t){r.prototype.removeSelfFromZr.call(this,t);for(var i=0;i<this._children.length;i++){var n=this._children[i];n.removeSelfFromZr(t)}},e.prototype.getBoundingRect=function(t){for(var i=new lt(0,0,0,0),n=t||this._children,a=[],o=null,s=0;s<n.length;s++){var l=n[s];if(!(l.ignore||l.invisible)){var u=l.getBoundingRect(),c=l.getLocalTransform(a);c?(lt.applyTransform(i,u,c),o=o||i.clone(),o.union(i)):(o=o||u.clone(),o.union(u))}}return o||i},e}(zb);HG.prototype.type="group";var Ze=HG;var Bb={},WG={};function Kle(r){delete WG[r]}function Jle(r){if(!r)return!1;if(typeof r=="string")return Dm(r,1)<J0;if(r.colorStops){for(var e=r.colorStops,t=0,i=e.length,n=0;n<i;n++)t+=Dm(e[n].color,1);return t/=i,t<J0}return!1}var $le=function(){function r(e,t,i){var n=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,i=i||{},this.dom=t,this.id=e;var a=new aG,o=i.renderer||"canvas";Bb[o]||(o=bt(Bb)[0]),i.useDirtyRect=i.useDirtyRect==null?!1:i.useDirtyRect;var s=new Bb[o](t,a,i,e),l=i.ssr||s.ssrOnly;this.storage=a,this.painter=s;var u=!Ft.node&&!Ft.worker&&!l?new UG(s.getViewportRoot(),s.root):null,c=i.useCoarsePointer,f=c==null||c==="auto"?Ft.touchEventsSupported:!!c,h=44,p;f&&(p=ft(i.pointerSize,h)),this.handler=new QV(a,s,u,s.root,p),this.animation=new LG({stage:{update:l?null:function(){return n._flush(!0)}}}),l||this.animation.start()}return r.prototype.add=function(e){this._disposed||!e||(this.storage.addRoot(e),e.addSelfToZr(this),this.refresh())},r.prototype.remove=function(e){this._disposed||!e||(this.storage.delRoot(e),e.removeSelfFromZr(this),this.refresh())},r.prototype.configLayer=function(e,t){this._disposed||(this.painter.configLayer&&this.painter.configLayer(e,t),this.refresh())},r.prototype.setBackgroundColor=function(e){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(e),this.refresh(),this._backgroundColor=e,this._darkMode=Jle(e))},r.prototype.getBackgroundColor=function(){return this._backgroundColor},r.prototype.setDarkMode=function(e){this._darkMode=e},r.prototype.isDarkMode=function(){return this._darkMode},r.prototype.refreshImmediately=function(e){this._disposed||(e||this.animation.update(!0),this._needsRefresh=!1,this.painter.refresh(),this._needsRefresh=!1)},r.prototype.refresh=function(){this._disposed||(this._needsRefresh=!0,this.animation.start())},r.prototype.flush=function(){this._disposed||this._flush(!1)},r.prototype._flush=function(e){var t,i=hp();this._needsRefresh&&(t=!0,this.refreshImmediately(e)),this._needsRefreshHover&&(t=!0,this.refreshHoverImmediately());var n=hp();t?(this._stillFrameAccum=0,this.trigger("rendered",{elapsedTime:n-i})):this._sleepAfterStill>0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},r.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},r.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},r.prototype.refreshHover=function(){this._needsRefreshHover=!0},r.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&this.painter.getType()==="canvas"&&this.painter.refreshHover())},r.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},r.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},r.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},r.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},r.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},r.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},r.prototype.on=function(e,t,i){return this._disposed||this.handler.on(e,t,i),this},r.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},r.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},r.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t<e.length;t++)e[t]instanceof Ze&&e[t].removeSelfFromZr(this);this.storage.delAllRoots(),this.painter.clear()}},r.prototype.dispose=function(){this._disposed||(this.animation.stop(),this.clear(),this.storage.dispose(),this.painter.dispose(),this.handler.dispose(),this.animation=this.storage=this.painter=this.handler=null,this._disposed=!0,Kle(this.id))},r}();function XL(r,e){var t=new $le(tb(),r,e);return WG[t.id]=t,t}function XG(r,e){Bb[r]=e}var WL;function YG(r){if(typeof WL=="function")return WL(r)}function qG(r){WL=r}var ZG=1e-4,jG=20;function eue(r){return r.replace(/^\s+|\s+$/g,"")}function rr(r,e,t,i){var n=e[0],a=e[1],o=t[0],s=t[1],l=a-n,u=s-o;if(l===0)return u===0?o:(o+s)/2;if(i)if(l>0){if(r<=n)return o;if(r>=a)return s}else{if(r>=n)return o;if(r<=a)return s}else{if(r===n)return o;if(r===a)return s}return(r-n)/l*u+o}function Fe(r,e){switch(r){case"center":case"middle":r="50%";break;case"left":case"top":r="0%";break;case"right":case"bottom":r="100%";break}return Ce(r)?eue(r).match(/%$/)?parseFloat(r)/100*e:parseFloat(r):r==null?NaN:+r}function Ar(r,e,t){return e==null&&(e=10),e=Math.min(Math.max(0,e),jG),r=(+r).toFixed(e),t?r:+r}function Ti(r){return r.sort(function(e,t){return e-t}),r}function Sn(r){if(r=+r,isNaN(r))return 0;if(r>1e-14){for(var e=1,t=0;t<15;t++,e*=10)if(Math.round(r*e)/e===r)return t}return YL(r)}function YL(r){var e=r.toString().toLowerCase(),t=e.indexOf("e"),i=t>0?+e.slice(t+1):0,n=t>0?t:e.length,a=e.indexOf("."),o=a<0?0:n-1-a;return Math.max(0,o-i)}function Fm(r,e){var t=Math.log,i=Math.LN10,n=Math.floor(t(r[1]-r[0])/i),a=Math.round(t(Math.abs(e[1]-e[0]))/i),o=Math.min(Math.max(-n+a,0),20);return isFinite(o)?o:20}function KG(r,e,t){if(!r[e])return 0;var i=qL(r,t);return i[e]||0}function qL(r,e){var t=gn(r,function(p,d){return p+(isNaN(d)?0:d)},0);if(t===0)return[];for(var i=Math.pow(10,e),n=de(r,function(p){return(isNaN(p)?0:p)/t*i*100}),a=i*100,o=de(n,function(p){return Math.floor(p)}),s=gn(o,function(p,d){return p+d},0),l=de(n,function(p,d){return p-o[d]});s<a;){for(var u=Number.NEGATIVE_INFINITY,c=null,f=0,h=l.length;f<h;++f)l[f]>u&&(u=l[f],c=f);++o[c],l[c]=0,++s}return de(o,function(p){return p/i})}function JG(r,e){var t=Math.max(Sn(r),Sn(e)),i=r+e;return t>jG?i:Ar(i,t)}var e_=9007199254740991;function t_(r){var e=Math.PI*2;return(r%e+e)%e}function Su(r){return r>-ZG&&r<ZG}var tue=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function Mn(r){if(r instanceof Date)return r;if(Ce(r)){var e=tue.exec(r);if(!e)return new Date(NaN);if(e[8]){var t=+e[4]||0;return e[8].toUpperCase()!=="Z"&&(t-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,t,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}else return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0)}else if(r==null)return new Date(NaN);return new Date(Math.round(r))}function kb(r){return Math.pow(10,zm(r))}function zm(r){if(r===0)return 0;var e=Math.floor(Math.log(r)/Math.LN10);return r/Math.pow(10,e)>=10&&e++,e}function Bm(r,e){var t=zm(r),i=Math.pow(10,t),n=r/i,a;return e?n<1.5?a=1:n<2.5?a=2:n<4?a=3:n<7?a=5:a=10:n<1?a=1:n<2?a=2:n<3?a=3:n<5?a=5:a=10,r=a*i,t>=-20?+r.toFixed(t<0?-t:0):r}function km(r,e){var t=(r.length-1)*e+1,i=Math.floor(t),n=+r[i-1],a=t-i;return a?n+a*(r[i]-n):n}function r_(r){r.sort(function(l,u){return s(l,u,0)?-1:1});for(var e=-1/0,t=1,i=0;i<r.length;){for(var n=r[i].interval,a=r[i].close,o=0;o<2;o++)n[o]<=e&&(n[o]=e,a[o]=o?1:1-t),e=n[o],t=a[o];n[0]===n[1]&&a[0]*a[1]!==1?r.splice(i,1):i++}return r;function s(l,u,c){return l.interval[c]<u.interval[c]||l.interval[c]===u.interval[c]&&(l.close[c]-u.close[c]===(c?-1:1)||!c&&s(l,u,1))}}function Pa(r){var e=parseFloat(r);return e==r&&(e!==0||!Ce(r)||r.indexOf("x")<=0)?e:NaN}function yp(r){return!isNaN(Pa(r))}function Vb(){return Math.round(Math.random()*9)}function $G(r,e){return e===0?r:$G(e,r%e)}function ZL(r,e){return r==null?e:e==null?r:r*e/$G(r,e)}var rue="[ECharts] ",QG={},iue=typeof console<"u"&&console.warn&&console.log;function nue(r,e,t){if(iue){if(t){if(QG[e])return;QG[e]=!0}console[r](rue+e)}}function eH(r,e){nue("warn",r,e)}function ur(r){throw new Error(r)}function tH(r,e,t){return(e-r)*t+r}var rH="series\0",iH="\0_ec_\0";function Jt(r){return r instanceof Array?r:r==null?[]:[r]}function yo(r,e,t){if(r){r[e]=r[e]||{},r.emphasis=r.emphasis||{},r.emphasis[e]=r.emphasis[e]||{};for(var i=0,n=t.length;i<n;i++){var a=t[i];!r.emphasis[e].hasOwnProperty(a)&&r[e].hasOwnProperty(a)&&(r.emphasis[e][a]=r[e][a])}}}var jL=["fontStyle","fontWeight","fontSize","fontFamily","rich","tag","color","textBorderColor","textBorderWidth","width","height","lineHeight","align","verticalAlign","baseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY","backgroundColor","borderColor","borderWidth","borderRadius","padding"];function Os(r){return qe(r)&&!pe(r)&&!(r instanceof Date)?r.value:r}function nH(r){return qe(r)&&!(r instanceof Array)}function Gb(r,e,t){var i=t==="normalMerge",n=t==="replaceMerge",a=t==="replaceAll";r=r||[],e=(e||[]).slice();var o=ke();N(e,function(l,u){if(!qe(l)){e[u]=null;return}});var s=aue(r,o,t);return(i||n)&&oue(s,r,o,e),i&&sue(s,e),i||n?lue(s,e,n):a&&uue(s,e),cue(s),s}function aue(r,e,t){var i=[];if(t==="replaceAll")return i;for(var n=0;n<r.length;n++){var a=r[n];a&&a.id!=null&&e.set(a.id,n),i.push({existing:t==="replaceMerge"||Vm(a)?null:a,newOption:null,keyInfo:null,brandNew:null})}return i}function oue(r,e,t,i){N(i,function(n,a){if(!(!n||n.id==null)){var o=i_(n.id),s=t.get(o);if(s!=null){var l=r[s];kr(!l.newOption,'Duplicated option on id "'+o+'".'),l.newOption=n,l.existing=e[s],i[a]=null}}})}function sue(r,e){N(e,function(t,i){if(!(!t||t.name==null))for(var n=0;n<r.length;n++){var a=r[n].existing;if(!r[n].newOption&&a&&(a.id==null||t.id==null)&&!Vm(t)&&!Vm(a)&&aH("name",a,t)){r[n].newOption=t,e[i]=null;return}}})}function lue(r,e,t){N(e,function(i){if(i){for(var n,a=0;(n=r[a])&&(n.newOption||Vm(n.existing)||n.existing&&i.id!=null&&!aH("id",i,n.existing));)a++;n?(n.newOption=i,n.brandNew=t):r.push({newOption:i,brandNew:t,existing:null,keyInfo:null}),a++}})}function uue(r,e){N(e,function(t){r.push({newOption:t,brandNew:!0,existing:null,keyInfo:null})})}function cue(r){var e=ke();N(r,function(t){var i=t.existing;i&&e.set(i.id,t)}),N(r,function(t){var i=t.newOption;kr(!i||i.id==null||!e.get(i.id)||e.get(i.id)===t,"id duplicates: "+(i&&i.id)),i&&i.id!=null&&e.set(i.id,t),!t.keyInfo&&(t.keyInfo={})}),N(r,function(t,i){var n=t.existing,a=t.newOption,o=t.keyInfo;if(qe(a)){if(o.name=a.name!=null?i_(a.name):n?n.name:rH+i,n)o.id=i_(n.id);else if(a.id!=null)o.id=i_(a.id);else{var s=0;do o.id="\0"+o.name+"\0"+s++;while(e.get(o.id))}e.set(o.id,t)}})}function aH(r,e,t){var i=Yr(e[r],null),n=Yr(t[r],null);return i!=null&&n!=null&&i===n}function i_(r){return Yr(r,"")}function Yr(r,e){return r==null?e:Ce(r)?r:At(r)||I0(r)?r+"":e}function Gm(r){var e=r.name;return!!(e&&e.indexOf(rH))}function Vm(r){return r&&r.id!=null&&i_(r.id).indexOf(iH)===0}function oH(r){return iH+r}function sH(r,e,t){N(r,function(i){var n=i.newOption;qe(n)&&(i.keyInfo.mainType=e,i.keyInfo.subType=fue(e,n,i.existing,t))})}function fue(r,e,t,i){var n=e.type?e.type:t?t.subType:i.determineSubType(r,e);return n}function lH(r,e){var t={},i={};return n(r||[],t),n(e||[],i,t),[a(t),a(i)];function n(o,s,l){for(var u=0,c=o.length;u<c;u++){var f=Yr(o[u].seriesId,null);if(f==null)return;for(var h=Jt(o[u].dataIndex),p=l&&l[f],d=0,g=h.length;d<g;d++){var m=h[d];p&&p[m]?p[m]=null:(s[f]||(s[f]={}))[m]=1}}}function a(o,s){var l=[];for(var u in o)if(o.hasOwnProperty(u)&&o[u]!=null)if(s)l.push(+u);else{var c=a(o[u],!0);c.length&&l.push({seriesId:u,dataIndex:c})}return l}}function Jo(r,e){if(e.dataIndexInside!=null)return e.dataIndexInside;if(e.dataIndex!=null)return pe(e.dataIndex)?de(e.dataIndex,function(t){return r.indexOfRawIndex(t)}):r.indexOfRawIndex(e.dataIndex);if(e.name!=null)return pe(e.name)?de(e.name,function(t){return r.indexOfName(t)}):r.indexOfName(e.name)}function vt(){var r="__ec_inner_"+hue++;return function(e){return e[r]||(e[r]={})}}var hue=Vb();function vf(r,e,t){var i=n_(e,t),n=i.mainTypeSpecified,a=i.queryOptionMap,o=i.others,s=o,l=t?t.defaultMainType:null;return!n&&l&&a.set(l,{}),a.each(function(u,c){var f=gf(r,c,u,{useDefault:l===c,enableAll:t&&t.enableAll!=null?t.enableAll:!0,enableNone:t&&t.enableNone!=null?t.enableNone:!0});s[c+"Models"]=f.models,s[c+"Model"]=f.models[0]}),s}function n_(r,e){var t;if(Ce(r)){var i={};i[r+"Index"]=0,t=i}else t=r;var n=ke(),a={},o=!1;return N(t,function(s,l){if(l==="dataIndex"||l==="dataIndexInside"){a[l]=s;return}var u=l.match(/^(\w+)(Index|Id|Name)$/)||[],c=u[1],f=(u[2]||"").toLowerCase();if(!(!c||!f||e&&e.includeMainTypes&&dt(e.includeMainTypes,c)<0)){o=o||!!c;var h=n.get(c)||n.set(c,{});h[f]=s}}),{mainTypeSpecified:o,queryOptionMap:n,others:a}}var Cr={useDefault:!0,enableAll:!1,enableNone:!1},uH={useDefault:!1,enableAll:!0,enableNone:!0};function gf(r,e,t,i){i=i||Cr;var n=t.index,a=t.id,o=t.name,s={models:null,specified:n!=null||a!=null||o!=null};if(!s.specified){var l=void 0;return s.models=i.useDefault&&(l=r.getComponent(e))?[l]:[],s}return n==="none"||n===!1?(kr(i.enableNone,'`"none"` or `false` is not a valid value on index option.'),s.models=[],s):(n==="all"&&(kr(i.enableAll,'`"all"` is not a valid value on index option.'),n=a=o=null),s.models=r.queryComponents({mainType:e,index:n,id:a,name:o}),s)}function KL(r,e,t){r.setAttribute?r.setAttribute(e,t):r[e]=t}function cH(r,e){return r.getAttribute?r.getAttribute(e):r[e]}function fH(r){return r==="auto"?Ft.domSupported?"html":"richText":r||"html"}function a_(r,e){var t=ke(),i=[];return N(r,function(n){var a=e(n);(t.get(a)||(i.push(a),t.set(a,[]))).push(n)}),{keys:i,buckets:t}}function Hb(r,e,t,i,n){var a=e==null||e==="auto";if(i==null)return i;if(At(i)){var o=tH(t||0,i,n);return Ar(o,a?Math.max(Sn(t||0),Sn(i)):e)}else{if(Ce(i))return n<1?t:i;for(var s=[],l=t,u=i,c=Math.max(l?l.length:0,u.length),f=0;f<c;++f){var h=r.getDimensionInfo(f);if(h&&h.type==="ordinal")s[f]=(n<1&&l?l:u)[f];else{var p=l&&l[f]?l[f]:0,d=u[f],o=tH(p,d,n);s[f]=Ar(o,a?Math.max(Sn(p),Sn(d)):e)}}return s}}var pue=".",_p="___EC__COMPONENT__CONTAINER___",hH="___EC__EXTENDED_CLASS___";function Ia(r){var e={main:"",sub:""};if(r){var t=r.split(pue);e.main=t[0]||"",e.sub=t[1]||""}return e}function due(r){kr(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(r),'componentType "'+r+'" illegal')}function pH(r){return!!(r&&r[hH])}function Hm(r,e){r.$constructor=r,r.extend=function(t){var i=this,n;return mue(i)?n=function(a){Z(o,a);function o(){return a.apply(this,arguments)||this}return o}(i):(n=function(){(t.$constructor||i).apply(this,arguments)},NV(n,this)),fe(n.prototype,t),n[hH]=!0,n.extend=this.extend,n.superCall=gue,n.superApply=yue,n.superClass=i,n}}function mue(r){return He(r)&&/^class\s/.test(Function.prototype.toString.call(r))}function Wb(r,e){r.extend=e.extend}var vue=Math.round(Math.random()*10);function dH(r){var e=["__\0is_clz",vue++].join("_");r.prototype[e]=!0,r.isInstance=function(t){return!!(t&&t[e])}}function gue(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];return this.superClass.prototype[e].apply(r,t)}function yue(r,e,t){return this.superClass.prototype[e].apply(r,t)}function yf(r){var e={};r.registerClass=function(i){var n=i.type||i.prototype.type;if(n){due(n),i.prototype.type=n;var a=Ia(n);if(!a.sub)e[a.main]=i;else if(a.sub!==_p){var o=t(a);o[a.sub]=i}}return i},r.getClass=function(i,n,a){var o=e[i];if(o&&o[_p]&&(o=n?o[n]:null),a&&!o)throw new Error(n?"Component "+i+"."+(n||"")+" is used but not imported.":i+".type should be specified.");return o},r.getClassesByMainType=function(i){var n=Ia(i),a=[],o=e[n.main];return o&&o[_p]?N(o,function(s,l){l!==_p&&a.push(s)}):a.push(o),a},r.hasClass=function(i){var n=Ia(i);return!!e[n.main]},r.getAllClassMainTypes=function(){var i=[];return N(e,function(n,a){i.push(a)}),i},r.hasSubTypes=function(i){var n=Ia(i),a=e[n.main];return a&&a[_p]};function t(i){var n=e[i.main];return(!n||!n[_p])&&(n=e[i.main]={},n[_p]=!0),n}}function Na(r,e){for(var t=0;t<r.length;t++)r[t][1]||(r[t][1]=r[t][0]);return e=e||!1,function(i,n,a){for(var o={},s=0;s<r.length;s++){var l=r[s][1];if(!(n&&dt(n,l)>=0||a&&dt(a,l)<0)){var u=i.getShallow(l,e);u!=null&&(o[r[s][0]]=u)}}return o}}var _ue=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],xue=Na(_ue),mH=function(){function r(){}return r.prototype.getAreaStyle=function(e,t){return xue(this,e,t)},r}();var $L=new _u(50);function gH(r){if(typeof r=="string"){var e=$L.get(r);return e&&e.image}else return r}function o_(r,e,t,i,n){if(r)if(typeof r=="string"){if(e&&e.__zrImageSrc===r||!t)return e;var a=$L.get(r),o={hostEl:t,cb:i,cbPayload:n};return a?(e=a.image,!Wm(e)&&a.pending.push(o)):(e=zn.loadImage(r,vH,vH),e.__zrImageSrc=r,$L.put(r,e.__cachedImgObj={image:e,pending:[o]})),e}else return r;else return e}function vH(){var r=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e<r.pending.length;e++){var t=r.pending[e],i=t.cb;i&&i(this,t.cbPayload),t.hostEl.dirty()}r.pending.length=0}function Wm(r){return r&&r.width&&r.height}var QL=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function Mue(r,e,t,i,n){if(!e)return"";var a=(r+"").split(`
  2204. `);n=_H(e,t,i,n);for(var o=0,s=a.length;o<s;o++)a[o]=xH(a[o],n);return a.join(`
  2205. `)}function _H(r,e,t,i){i=i||{};var n=fe({},i);n.font=e,t=ft(t,"..."),n.maxIterations=ft(i.maxIterations,2);var a=n.minChar=ft(i.minChar,0);n.cnCharWidth=La("\u56FD",e);var o=n.ascCharWidth=La("a",e);n.placeholder=ft(i.placeholder,"");for(var s=r=Math.max(0,r-1),l=0;l<a&&s>=o;l++)s-=o;var u=La(t,e);return u>s&&(t="",u=0),s=r-u,n.ellipsis=t,n.ellipsisWidth=u,n.contentWidth=s,n.containerWidth=r,n}function xH(r,e){var t=e.containerWidth,i=e.font,n=e.contentWidth;if(!t)return"";var a=La(r,i);if(a<=t)return r;for(var o=0;;o++){if(a<=n||o>=e.maxIterations){r+=e.ellipsis;break}var s=o===0?bue(r,n,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(r.length*n/a):0;r=r.substr(0,s),a=La(r,i)}return r===""&&(r=e.placeholder),r}function bue(r,e,t,i){for(var n=0,a=0,o=r.length;a<o&&n<e;a++){var s=r.charCodeAt(a);n+=0<=s&&s<=127?t:i}return a}function SH(r,e){r!=null&&(r+="");var t=e.overflow,i=e.padding,n=e.font,a=t==="truncate",o=Um(n),s=ft(e.lineHeight,o),l=!!e.backgroundColor,u=e.lineOverflow==="truncate",c=e.width,f;c!=null&&(t==="break"||t==="breakAll")?f=r?bH(r,e.font,c,t==="breakAll",0).lines:[]:f=r?r.split(`
  2206. `):[];var h=f.length*s,p=ft(e.height,h);if(h>p&&u){var d=Math.floor(p/s);f=f.slice(0,d)}if(r&&a&&c!=null)for(var g=_H(c,n,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),m=0;m<f.length;m++)f[m]=xH(f[m],g);for(var v=p,_=0,m=0;m<f.length;m++)_=Math.max(La(f[m],n),_);c==null&&(c=_);var y=_;return i&&(v+=i[0]+i[2],y+=i[1]+i[3],c+=i[1]+i[3]),l&&(y=c),{lines:f,height:p,outerWidth:y,outerHeight:v,lineHeight:s,calculatedLineHeight:o,contentWidth:_,contentHeight:h,width:c}}var wue=function(){function r(){}return r}(),yH=function(){function r(e){this.tokens=[],e&&(this.tokens=e)}return r}(),Tue=function(){function r(){this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.outerWidth=0,this.outerHeight=0,this.lines=[]}return r}();function MH(r,e){var t=new Tue;if(r!=null&&(r+=""),!r)return t;for(var i=e.width,n=e.height,a=e.overflow,o=(a==="break"||a==="breakAll")&&i!=null?{width:i,accumWidth:0,breakAll:a==="breakAll"}:null,s=QL.lastIndex=0,l;(l=QL.exec(r))!=null;){var u=l.index;u>s&&eP(t,r.substring(s,u),e,o),eP(t,l[2],e,o,l[1]),s=QL.lastIndex}s<r.length&&eP(t,r.substring(s,r.length),e,o);var c=[],f=0,h=0,p=e.padding,d=a==="truncate",g=e.lineOverflow==="truncate";function m(F,k,G){F.width=k,F.lineHeight=G,f+=G,h=Math.max(h,k)}e:for(var v=0;v<t.lines.length;v++){for(var _=t.lines[v],y=0,x=0,M=0;M<_.tokens.length;M++){var S=_.tokens[M],w=S.styleName&&e.rich[S.styleName]||{},T=S.textPadding=w.padding,C=T?T[1]+T[3]:0,b=S.font=w.font||e.font;S.contentHeight=Um(b);var E=ft(w.height,S.contentHeight);if(S.innerHeight=E,T&&(E+=T[0]+T[2]),S.height=E,S.lineHeight=Xi(w.lineHeight,e.lineHeight,E),S.align=w&&w.align||e.align,S.verticalAlign=w&&w.verticalAlign||"middle",g&&n!=null&&f+S.lineHeight>n){M>0?(_.tokens=_.tokens.slice(0,M),m(_,x,y),t.lines=t.lines.slice(0,v+1)):t.lines=t.lines.slice(0,v);break e}var I=w.width,R=I==null||I==="auto";if(typeof I=="string"&&I.charAt(I.length-1)==="%")S.percentWidth=I,c.push(S),S.contentWidth=La(S.text,b);else{if(R){var A=w.backgroundColor,D=A&&A.image;D&&(D=gH(D),Wm(D)&&(S.width=Math.max(S.width,D.width*E/D.height)))}var U=d&&i!=null?i-x:null;U!=null&&U<S.width?!R||U<C?(S.text="",S.width=S.contentWidth=0):(S.text=Mue(S.text,U-C,b,e.ellipsis,{minChar:e.truncateMinChar}),S.width=S.contentWidth=La(S.text,b)):S.contentWidth=La(S.text,b)}S.width+=C,x+=S.width,w&&(y=Math.max(y,S.lineHeight))}m(_,x,y)}t.outerWidth=t.width=ft(i,h),t.outerHeight=t.height=ft(n,f),t.contentHeight=f,t.contentWidth=h,p&&(t.outerWidth+=p[1]+p[3],t.outerHeight+=p[0]+p[2]);for(var v=0;v<c.length;v++){var S=c[v],B=S.percentWidth;S.width=parseInt(B,10)/100*t.width}return t}function eP(r,e,t,i,n){var a=e==="",o=n&&t.rich[n]||{},s=r.lines,l=o.font||t.font,u=!1,c,f;if(i){var h=o.padding,p=h?h[1]+h[3]:0;if(o.width!=null&&o.width!=="auto"){var d=xn(o.width,i.width)+p;s.length>0&&d+i.accumWidth>i.width&&(c=e.split(`
  2207. `),u=!0),i.accumWidth=d}else{var g=bH(e,l,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+p,f=g.linesWidths,c=g.lines}}else c=e.split(`
  2208. `);for(var m=0;m<c.length;m++){var v=c[m],_=new wue;if(_.styleName=n,_.text=v,_.isLineHolder=!v&&!a,typeof o.width=="number"?_.width=o.width:_.width=f?f[m]:La(v,l),!m&&!u){var y=(s[s.length-1]||(s[0]=new yH)).tokens,x=y.length;x===1&&y[0].isLineHolder?y[0]=_:(v||!x||a)&&y.push(_)}else s.push(new yH([_]))}}function Eue(r){var e=r.charCodeAt(0);return e>=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}var Aue=gn(",&?/;] ".split(""),function(r,e){return r[e]=!0,r},{});function Cue(r){return Eue(r)?!!Aue[r]:!0}function bH(r,e,t,i,n){for(var a=[],o=[],s="",l="",u=0,c=0,f=0;f<r.length;f++){var h=r.charAt(f);if(h===`
  2209. `){l&&(s+=l,c+=u),a.push(s),o.push(c),s="",l="",u=0,c=0;continue}var p=La(h,e),d=i?!1:!Cue(h);if(a.length?c+p>t:n+c+p>t){c?(s||l)&&(d?(s||(s=l,l="",u=0,c=u),a.push(s),o.push(c-u),l+=h,u+=p,s="",c=u):(l&&(s+=l,l="",u=0),a.push(s),o.push(c),s=h,c=p)):d?(a.push(l),o.push(u),l=h,u=p):(a.push(h),o.push(p));continue}c+=p,d?(l+=h,u+=p):(l&&(s+=l,l="",u=0),s+=h)}return!a.length&&!s&&(s=r,l="",u=0),l&&(s+=l),s&&(a.push(s),o.push(c)),a.length===1&&(c+=n),{accumWidth:c,lines:a,linesWidths:o}}var iP="__zr_style_"+Math.round(Math.random()*10),Pl={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},xp={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Pl[iP]=!0;var wH=["z","z2","invisible"],Rue=["invisible"],Lue=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype._init=function(t){for(var i=bt(t),n=0;n<i.length;n++){var a=i[n];a==="style"?this.useStyle(t[a]):r.prototype.attrKV.call(this,a,t[a])}this.style||this.useStyle({})},e.prototype.beforeBrush=function(){},e.prototype.afterBrush=function(){},e.prototype.innerBeforeBrush=function(){},e.prototype.innerAfterBrush=function(){},e.prototype.shouldBePainted=function(t,i,n,a){var o=this.transform;if(this.ignore||this.invisible||this.style.opacity===0||this.culling&&Pue(this,t,i)||o&&!o[0]&&!o[3])return!1;if(n&&this.__clipPaths){for(var s=0;s<this.__clipPaths.length;++s)if(this.__clipPaths[s].isZeroArea())return!1}if(a&&this.parent)for(var l=this.parent;l;){if(l.ignore)return!1;l=l.parent}return!0},e.prototype.contain=function(t,i){return this.rectContain(t,i)},e.prototype.traverse=function(t,i){t.call(i,this)},e.prototype.rectContain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect();return a.contain(n[0],n[1])},e.prototype.getPaintRect=function(){var t=this._paintRect;if(!this._paintRect||this.__dirty){var i=this.transform,n=this.getBoundingRect(),a=this.style,o=a.shadowBlur||0,s=a.shadowOffsetX||0,l=a.shadowOffsetY||0;t=this._paintRect||(this._paintRect=new lt(0,0,0,0)),i?lt.applyTransform(t,n,i):t.copy(n),(o||s||l)&&(t.width+=o*2+Math.abs(s),t.height+=o*2+Math.abs(l),t.x=Math.min(t.x,t.x+s-o),t.y=Math.min(t.y,t.y+l-o));var u=this.dirtyRectTolerance;t.isZero()||(t.x=Math.floor(t.x-u),t.y=Math.floor(t.y-u),t.width=Math.ceil(t.width+1+u*2),t.height=Math.ceil(t.height+1+u*2))}return t},e.prototype.setPrevPaintRect=function(t){t?(this._prevPaintRect=this._prevPaintRect||new lt(0,0,0,0),this._prevPaintRect.copy(t)):this._prevPaintRect=null},e.prototype.getPrevPaintRect=function(){return this._prevPaintRect},e.prototype.animateStyle=function(t){return this.animate("style",t)},e.prototype.updateDuringAnimation=function(t){t==="style"?this.dirtyStyle():this.markRedraw()},e.prototype.attrKV=function(t,i){t!=="style"?r.prototype.attrKV.call(this,t,i):this.style?this.setStyle(i):this.useStyle(i)},e.prototype.setStyle=function(t,i){return typeof t=="string"?this.style[t]=i:fe(this.style,t),this.dirtyStyle(),this},e.prototype.dirtyStyle=function(t){t||this.markRedraw(),this.__dirty|=op,this._rect&&(this._rect=null)},e.prototype.dirty=function(){this.dirtyStyle()},e.prototype.styleChanged=function(){return!!(this.__dirty&op)},e.prototype.styleUpdated=function(){this.__dirty&=~op},e.prototype.createStyle=function(t){return lf(Pl,t)},e.prototype.useStyle=function(t){t[iP]||(t=this.createStyle(t)),this.__inHover?this.__hoverStyle=t:this.style=t,this.dirtyStyle()},e.prototype.isStyleObject=function(t){return t[iP]},e.prototype._innerSaveToNormal=function(t){r.prototype._innerSaveToNormal.call(this,t);var i=this._normalState;t.style&&!i.style&&(i.style=this._mergeStyle(this.createStyle(),this.style)),this._savePrimaryToNormal(t,i,wH)},e.prototype._applyStateObj=function(t,i,n,a,o,s){r.prototype._applyStateObj.call(this,t,i,n,a,o,s);var l=!(i&&a),u;if(i&&i.style?o?a?u=i.style:(u=this._mergeStyle(this.createStyle(),n.style),this._mergeStyle(u,i.style)):(u=this._mergeStyle(this.createStyle(),a?this.style:n.style),this._mergeStyle(u,i.style)):l&&(u=n.style),u)if(o){var c=this.style;if(this.style=this.createStyle(l?{}:c),l)for(var f=bt(c),h=0;h<f.length;h++){var p=f[h];p in u&&(u[p]=u[p],this.style[p]=c[p])}for(var d=bt(u),h=0;h<d.length;h++){var p=d[h];this.style[p]=this.style[p]}this._transitionState(t,{style:u},s,this.getAnimationStyleProps())}else this.useStyle(u);for(var g=this.__inHover?Rue:wH,h=0;h<g.length;h++){var p=g[h];i&&i[p]!=null?this[p]=i[p]:l&&n[p]!=null&&(this[p]=n[p])}},e.prototype._mergeStates=function(t){for(var i=r.prototype._mergeStates.call(this,t),n,a=0;a<t.length;a++){var o=t[a];o.style&&(n=n||{},this._mergeStyle(n,o.style))}return n&&(i.style=n),i},e.prototype._mergeStyle=function(t,i){return fe(t,i),t},e.prototype.getAnimationStyleProps=function(){return xp},e.initDefaultProps=function(){var t=e.prototype;t.type="displayable",t.invisible=!1,t.z=0,t.z2=0,t.zlevel=0,t.culling=!1,t.cursor="pointer",t.rectHover=!1,t.incremental=!1,t._rect=null,t.dirtyRectTolerance=0,t.__dirty=zi|op}(),e}(zb),tP=new lt(0,0,0,0),rP=new lt(0,0,0,0);function Pue(r,e,t){return tP.copy(r.getBoundingRect()),r.transform&&tP.applyTransform(r.transform),rP.width=e,rP.height=t,!tP.intersect(rP)}var gi=Lue;var Ua=Math.min,Oa=Math.max,nP=Math.sin,aP=Math.cos,Sp=Math.PI*2,Xb=Al(),Yb=Al(),qb=Al();function Mp(r,e,t){if(r.length!==0){for(var i=r[0],n=i[0],a=i[0],o=i[1],s=i[1],l=1;l<r.length;l++)i=r[l],n=Ua(n,i[0]),a=Oa(a,i[0]),o=Ua(o,i[1]),s=Oa(s,i[1]);e[0]=n,e[1]=o,t[0]=a,t[1]=s}}function oP(r,e,t,i,n,a){n[0]=Ua(r,t),n[1]=Ua(e,i),a[0]=Oa(r,t),a[1]=Oa(e,i)}var TH=[],EH=[];function AH(r,e,t,i,n,a,o,s,l,u){var c=vb,f=hi,h=c(r,t,n,o,TH);l[0]=1/0,l[1]=1/0,u[0]=-1/0,u[1]=-1/0;for(var p=0;p<h;p++){var d=f(r,t,n,o,TH[p]);l[0]=Ua(d,l[0]),u[0]=Oa(d,u[0])}h=c(e,i,a,s,EH);for(var p=0;p<h;p++){var g=f(e,i,a,s,EH[p]);l[1]=Ua(g,l[1]),u[1]=Oa(g,u[1])}l[0]=Ua(r,l[0]),u[0]=Oa(r,u[0]),l[0]=Ua(o,l[0]),u[0]=Oa(o,u[0]),l[1]=Ua(e,l[1]),u[1]=Oa(e,u[1]),l[1]=Ua(s,l[1]),u[1]=Oa(s,u[1])}function CH(r,e,t,i,n,a,o,s){var l=yb,u=vi,c=Oa(Ua(l(r,t,n),1),0),f=Oa(Ua(l(e,i,a),1),0),h=u(r,t,n,c),p=u(e,i,a,f);o[0]=Ua(r,n,h),o[1]=Ua(e,a,p),s[0]=Oa(r,n,h),s[1]=Oa(e,a,p)}function RH(r,e,t,i,n,a,o,s,l){var u=po,c=mo,f=Math.abs(n-a);if(f%Sp<1e-4&&f>1e-4){s[0]=r-t,s[1]=e-i,l[0]=r+t,l[1]=e+i;return}if(Xb[0]=aP(n)*t+r,Xb[1]=nP(n)*i+e,Yb[0]=aP(a)*t+r,Yb[1]=nP(a)*i+e,u(s,Xb,Yb),c(l,Xb,Yb),n=n%Sp,n<0&&(n=n+Sp),a=a%Sp,a<0&&(a=a+Sp),n>a&&!o?a+=Sp:n<a&&o&&(n+=Sp),o){var h=a;a=n,n=h}for(var p=0;p<a;p+=Math.PI/2)p>n&&(qb[0]=aP(p)*t+r,qb[1]=nP(p)*i+e,u(s,qb,s),c(l,qb,l))}var Vr={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},bp=[],wp=[],Dl=[],_f=[],Il=[],Nl=[],sP=Math.min,lP=Math.max,Tp=Math.cos,Ep=Math.sin,Mu=Math.abs,fP=Math.PI,xf=fP*2,uP=typeof Float32Array<"u",s_=[];function cP(r){var e=Math.round(r/fP*1e8)/1e8;return e%2*fP}function l_(r,e){var t=cP(r[0]);t<0&&(t+=xf);var i=t-r[0],n=r[1];n+=i,!e&&n-t>=xf?n=t+xf:e&&t-n>=xf?n=t-xf:!e&&t>n?n=t+(xf-cP(t-n)):e&&t<n&&(n=t-(xf-cP(n-t))),r[0]=t,r[1]=n}var Due=function(){function r(e){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,e&&(this._saveData=!1),this._saveData&&(this.data=[])}return r.prototype.increaseVersion=function(){this._version++},r.prototype.getVersion=function(){return this._version},r.prototype.setScale=function(e,t,i){i=i||0,i>0&&(this._ux=Mu(i/pp/e)||0,this._uy=Mu(i/pp/t)||0)},r.prototype.setDPR=function(e){this.dpr=e},r.prototype.setContext=function(e){this._ctx=e},r.prototype.getContext=function(){return this._ctx},r.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},r.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},r.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(Vr.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},r.prototype.lineTo=function(e,t){var i=Mu(e-this._xi),n=Mu(t-this._yi),a=i>this._ux||n>this._uy;if(this.addData(Vr.L,e,t),this._ctx&&a&&this._ctx.lineTo(e,t),a)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var o=i*i+n*n;o>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=o)}return this},r.prototype.bezierCurveTo=function(e,t,i,n,a,o){return this._drawPendingPt(),this.addData(Vr.C,e,t,i,n,a,o),this._ctx&&this._ctx.bezierCurveTo(e,t,i,n,a,o),this._xi=a,this._yi=o,this},r.prototype.quadraticCurveTo=function(e,t,i,n){return this._drawPendingPt(),this.addData(Vr.Q,e,t,i,n),this._ctx&&this._ctx.quadraticCurveTo(e,t,i,n),this._xi=i,this._yi=n,this},r.prototype.arc=function(e,t,i,n,a,o){this._drawPendingPt(),s_[0]=n,s_[1]=a,l_(s_,o),n=s_[0],a=s_[1];var s=a-n;return this.addData(Vr.A,e,t,i,i,n,s,0,o?0:1),this._ctx&&this._ctx.arc(e,t,i,n,a,o),this._xi=Tp(a)*i+e,this._yi=Ep(a)*i+t,this},r.prototype.arcTo=function(e,t,i,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,i,n,a),this},r.prototype.rect=function(e,t,i,n){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,i,n),this.addData(Vr.R,e,t,i,n),this},r.prototype.closePath=function(){this._drawPendingPt(),this.addData(Vr.Z);var e=this._ctx,t=this._x0,i=this._y0;return e&&e.closePath(),this._xi=t,this._yi=i,this},r.prototype.fill=function(e){e&&e.fill(),this.toStatic()},r.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},r.prototype.len=function(){return this._len},r.prototype.setData=function(e){var t=e.length;!(this.data&&this.data.length===t)&&uP&&(this.data=new Float32Array(t));for(var i=0;i<t;i++)this.data[i]=e[i];this._len=t},r.prototype.appendPath=function(e){e instanceof Array||(e=[e]);for(var t=e.length,i=0,n=this._len,a=0;a<t;a++)i+=e[a].len();uP&&this.data instanceof Float32Array&&(this.data=new Float32Array(n+i));for(var a=0;a<t;a++)for(var o=e[a].data,s=0;s<o.length;s++)this.data[n++]=o[s];this._len=n},r.prototype.addData=function(e,t,i,n,a,o,s,l,u){if(this._saveData){var c=this.data;this._len+arguments.length>c.length&&(this._expandData(),c=this.data);for(var f=0;f<arguments.length;f++)c[this._len++]=arguments[f]}},r.prototype._drawPendingPt=function(){this._pendingPtDist>0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},r.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t<this._len;t++)e[t]=this.data[t];this.data=e}},r.prototype.toStatic=function(){if(this._saveData){this._drawPendingPt();var e=this.data;e instanceof Array&&(e.length=this._len,uP&&this._len>11&&(this.data=new Float32Array(e)))}},r.prototype.getBoundingRect=function(){Dl[0]=Dl[1]=Il[0]=Il[1]=Number.MAX_VALUE,_f[0]=_f[1]=Nl[0]=Nl[1]=-Number.MAX_VALUE;var e=this.data,t=0,i=0,n=0,a=0,o;for(o=0;o<this._len;){var s=e[o++],l=o===1;switch(l&&(t=e[o],i=e[o+1],n=t,a=i),s){case Vr.M:t=n=e[o++],i=a=e[o++],Il[0]=n,Il[1]=a,Nl[0]=n,Nl[1]=a;break;case Vr.L:oP(t,i,e[o],e[o+1],Il,Nl),t=e[o++],i=e[o++];break;case Vr.C:AH(t,i,e[o++],e[o++],e[o++],e[o++],e[o],e[o+1],Il,Nl),t=e[o++],i=e[o++];break;case Vr.Q:CH(t,i,e[o++],e[o++],e[o],e[o+1],Il,Nl),t=e[o++],i=e[o++];break;case Vr.A:var u=e[o++],c=e[o++],f=e[o++],h=e[o++],p=e[o++],d=e[o++]+p;o+=1;var g=!e[o++];l&&(n=Tp(p)*f+u,a=Ep(p)*h+c),RH(u,c,f,h,p,d,g,Il,Nl),t=Tp(d)*f+u,i=Ep(d)*h+c;break;case Vr.R:n=t=e[o++],a=i=e[o++];var m=e[o++],v=e[o++];oP(n,a,n+m,a+v,Il,Nl);break;case Vr.Z:t=n,i=a;break}po(Dl,Dl,Il),mo(_f,_f,Nl)}return o===0&&(Dl[0]=Dl[1]=_f[0]=_f[1]=0),new lt(Dl[0],Dl[1],_f[0]-Dl[0],_f[1]-Dl[1])},r.prototype._calculateLength=function(){var e=this.data,t=this._len,i=this._ux,n=this._uy,a=0,o=0,s=0,l=0;this._pathSegLen||(this._pathSegLen=[]);for(var u=this._pathSegLen,c=0,f=0,h=0;h<t;){var p=e[h++],d=h===1;d&&(a=e[h],o=e[h+1],s=a,l=o);var g=-1;switch(p){case Vr.M:a=s=e[h++],o=l=e[h++];break;case Vr.L:{var m=e[h++],v=e[h++],_=m-a,y=v-o;(Mu(_)>i||Mu(y)>n||h===t-1)&&(g=Math.sqrt(_*_+y*y),a=m,o=v);break}case Vr.C:{var x=e[h++],M=e[h++],m=e[h++],v=e[h++],S=e[h++],w=e[h++];g=cG(a,o,x,M,m,v,S,w,10),a=S,o=w;break}case Vr.Q:{var x=e[h++],M=e[h++],m=e[h++],v=e[h++];g=hG(a,o,x,M,m,v,10),a=m,o=v;break}case Vr.A:var T=e[h++],C=e[h++],b=e[h++],E=e[h++],I=e[h++],R=e[h++],A=R+I;h+=1,d&&(s=Tp(I)*b+T,l=Ep(I)*E+C),g=lP(b,E)*sP(xf,Math.abs(R)),a=Tp(A)*b+T,o=Ep(A)*E+C;break;case Vr.R:{s=a=e[h++],l=o=e[h++];var D=e[h++],U=e[h++];g=D*2+U*2;break}case Vr.Z:{var _=s-a,y=l-o;g=Math.sqrt(_*_+y*y),a=s,o=l;break}}g>=0&&(u[f++]=g,c+=g)}return this._pathLen=c,c},r.prototype.rebuildPath=function(e,t){var i=this.data,n=this._ux,a=this._uy,o=this._len,s,l,u,c,f,h,p=t<1,d,g,m=0,v=0,_,y=0,x,M;if(!(p&&(this._pathSegLen||this._calculateLength(),d=this._pathSegLen,g=this._pathLen,_=t*g,!_)))e:for(var S=0;S<o;){var w=i[S++],T=S===1;switch(T&&(u=i[S],c=i[S+1],s=u,l=c),w!==Vr.L&&y>0&&(e.lineTo(x,M),y=0),w){case Vr.M:s=u=i[S++],l=c=i[S++],e.moveTo(u,c);break;case Vr.L:{f=i[S++],h=i[S++];var C=Mu(f-u),b=Mu(h-c);if(C>n||b>a){if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;e.lineTo(u*(1-I)+f*I,c*(1-I)+h*I);break e}m+=E}e.lineTo(f,h),u=f,c=h,y=0}else{var R=C*C+b*b;R>y&&(x=f,M=h,y=R)}break}case Vr.C:{var A=i[S++],D=i[S++],U=i[S++],B=i[S++],F=i[S++],k=i[S++];if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;Zo(u,A,U,F,I,bp),Zo(c,D,B,k,I,wp),e.bezierCurveTo(bp[1],wp[1],bp[2],wp[2],bp[3],wp[3]);break e}m+=E}e.bezierCurveTo(A,D,U,B,F,k),u=F,c=k;break}case Vr.Q:{var A=i[S++],D=i[S++],U=i[S++],B=i[S++];if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;pf(u,A,U,I,bp),pf(c,D,B,I,wp),e.quadraticCurveTo(bp[1],wp[1],bp[2],wp[2]);break e}m+=E}e.quadraticCurveTo(A,D,U,B),u=U,c=B;break}case Vr.A:var G=i[S++],Y=i[S++],J=i[S++],Q=i[S++],V=i[S++],K=i[S++],ae=i[S++],ve=!i[S++],ue=J>Q?J:Q,se=Mu(J-Q)>.001,Ee=V+K,q=!1;if(p){var E=d[v++];m+E>_&&(Ee=V+K*(_-m)/E,q=!0),m+=E}if(se&&e.ellipse?e.ellipse(G,Y,J,Q,ae,V,Ee,ve):e.arc(G,Y,ue,V,Ee,ve),q)break e;T&&(s=Tp(V)*J+G,l=Ep(V)*Q+Y),u=Tp(Ee)*J+G,c=Ep(Ee)*Q+Y;break;case Vr.R:s=u=i[S],l=c=i[S+1],f=i[S++],h=i[S++];var H=i[S++],We=i[S++];if(p){var E=d[v++];if(m+E>_){var _e=_-m;e.moveTo(f,h),e.lineTo(f+sP(_e,H),h),_e-=H,_e>0&&e.lineTo(f+H,h+sP(_e,We)),_e-=We,_e>0&&e.lineTo(f+lP(H-_e,0),h+We),_e-=H,_e>0&&e.lineTo(f,h+lP(We-_e,0));break e}m+=E}e.rect(f,h,H,We);break;case Vr.Z:if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;e.lineTo(u*(1-I)+s*I,c*(1-I)+l*I);break e}m+=E}e.closePath(),u=s,c=l}}},r.prototype.clone=function(){var e=new r,t=this.data;return e.data=t.slice?t.slice():Array.prototype.slice.call(t),e._len=this._len,e},r.CMD=Vr,r.initDefaultProps=function(){var e=r.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),r}(),Ki=Due;function Ul(r,e,t,i,n,a,o){if(n===0)return!1;var s=n,l=0,u=r;if(o>e+s&&o>i+s||o<e-s&&o<i-s||a>r+s&&a>t+s||a<r-s&&a<t-s)return!1;if(r!==t)l=(e-i)/(r-t),u=(r*i-t*e)/(r-t);else return Math.abs(a-r)<=s/2;var c=l*a-o+u,f=c*c/(l*l+1);return f<=s/2*s/2}function DH(r,e,t,i,n,a,o,s,l,u,c){if(l===0)return!1;var f=l;if(c>e+f&&c>i+f&&c>a+f&&c>s+f||c<e-f&&c<i-f&&c<a-f&&c<s-f||u>r+f&&u>t+f&&u>n+f&&u>o+f||u<r-f&&u<t-f&&u<n-f&&u<o-f)return!1;var h=gb(r,e,t,i,n,a,o,s,u,c,null);return h<=f/2}function Zb(r,e,t,i,n,a,o,s,l){if(o===0)return!1;var u=o;if(l>e+u&&l>i+u&&l>a+u||l<e-u&&l<i-u&&l<a-u||s>r+u&&s>t+u&&s>n+u||s<r-u&&s<t-u&&s<n-u)return!1;var c=_b(r,e,t,i,n,a,s,l,null);return c<=u/2}var NH=Math.PI*2;function bn(r){return r%=NH,r<0&&(r+=NH),r}var u_=Math.PI*2;function UH(r,e,t,i,n,a,o,s,l){if(o===0)return!1;var u=o;s-=r,l-=e;var c=Math.sqrt(s*s+l*l);if(c-u>t||c+u<t)return!1;if(Math.abs(i-n)%u_<1e-4)return!0;if(a){var f=i;i=bn(n),n=bn(f)}else i=bn(i),n=bn(n);i>n&&(n+=u_);var h=Math.atan2(l,s);return h<0&&(h+=u_),h>=i&&h<=n||h+u_>=i&&h+u_<=n}function $o(r,e,t,i,n,a){if(a>e&&a>i||a<e&&a<i||i===e)return 0;var o=(a-e)/(i-e),s=i<e?1:-1;(o===1||o===0)&&(s=i<e?.5:-.5);var l=o*(t-r)+r;return l===n?1/0:l>n?s:0}var Sf=Ki.CMD,Ap=Math.PI*2,Uue=1e-4;function Oue(r,e){return Math.abs(r-e)<Uue}var aa=[-1,-1,-1],Qo=[-1,-1];function Fue(){var r=Qo[0];Qo[0]=Qo[1],Qo[1]=r}function zue(r,e,t,i,n,a,o,s,l,u){if(u>e&&u>i&&u>a&&u>s||u<e&&u<i&&u<a&&u<s)return 0;var c=sp(e,i,a,s,u,aa);if(c===0)return 0;for(var f=0,h=-1,p=void 0,d=void 0,g=0;g<c;g++){var m=aa[g],v=m===0||m===1?.5:1,_=hi(r,t,n,o,m);_<l||(h<0&&(h=vb(e,i,a,s,Qo),Qo[1]<Qo[0]&&h>1&&Fue(),p=hi(e,i,a,s,Qo[0]),h>1&&(d=hi(e,i,a,s,Qo[1]))),h===2?m<Qo[0]?f+=p<e?v:-v:m<Qo[1]?f+=d<p?v:-v:f+=s<d?v:-v:m<Qo[0]?f+=p<e?v:-v:f+=s<p?v:-v)}return f}function Bue(r,e,t,i,n,a,o,s){if(s>e&&s>i&&s>a||s<e&&s<i&&s<a)return 0;var l=fG(e,i,a,s,aa);if(l===0)return 0;var u=yb(e,i,a);if(u>=0&&u<=1){for(var c=0,f=vi(e,i,a,u),h=0;h<l;h++){var p=aa[h]===0||aa[h]===1?.5:1,d=vi(r,t,n,aa[h]);d<o||(aa[h]<u?c+=f<e?p:-p:c+=a<f?p:-p)}return c}else{var p=aa[0]===0||aa[0]===1?.5:1,d=vi(r,t,n,aa[0]);return d<o?0:a<e?p:-p}}function kue(r,e,t,i,n,a,o,s){if(s-=e,s>t||s<-t)return 0;var l=Math.sqrt(t*t-s*s);aa[0]=-l,aa[1]=l;var u=Math.abs(i-n);if(u<1e-4)return 0;if(u>=Ap-1e-4){i=0,n=Ap;var c=a?1:-1;return o>=aa[0]+r&&o<=aa[1]+r?c:0}if(i>n){var f=i;i=n,n=f}i<0&&(i+=Ap,n+=Ap);for(var h=0,p=0;p<2;p++){var d=aa[p];if(d+r>o){var g=Math.atan2(s,d),c=a?1:-1;g<0&&(g=Ap+g),(g>=i&&g<=n||g+Ap>=i&&g+Ap<=n)&&(g>Math.PI/2&&g<Math.PI*1.5&&(c=-c),h+=c)}}return h}function OH(r,e,t,i,n){for(var a=r.data,o=r.len(),s=0,l=0,u=0,c=0,f=0,h,p,d=0;d<o;){var g=a[d++],m=d===1;switch(g===Sf.M&&d>1&&(t||(s+=$o(l,u,c,f,i,n))),m&&(l=a[d],u=a[d+1],c=l,f=u),g){case Sf.M:c=a[d++],f=a[d++],l=c,u=f;break;case Sf.L:if(t){if(Ul(l,u,a[d],a[d+1],e,i,n))return!0}else s+=$o(l,u,a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Sf.C:if(t){if(DH(l,u,a[d++],a[d++],a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=zue(l,u,a[d++],a[d++],a[d++],a[d++],a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Sf.Q:if(t){if(Zb(l,u,a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=Bue(l,u,a[d++],a[d++],a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Sf.A:var v=a[d++],_=a[d++],y=a[d++],x=a[d++],M=a[d++],S=a[d++];d+=1;var w=!!(1-a[d++]);h=Math.cos(M)*y+v,p=Math.sin(M)*x+_,m?(c=h,f=p):s+=$o(l,u,h,p,i,n);var T=(i-v)*x/y+v;if(t){if(UH(v,_,x,M,M+S,w,e,T,n))return!0}else s+=kue(v,_,x,M,M+S,w,T,n);l=Math.cos(M+S)*y+v,u=Math.sin(M+S)*x+_;break;case Sf.R:c=l=a[d++],f=u=a[d++];var C=a[d++],b=a[d++];if(h=c+C,p=f+b,t){if(Ul(c,f,h,f,e,i,n)||Ul(h,f,h,p,e,i,n)||Ul(h,p,c,p,e,i,n)||Ul(c,p,c,f,e,i,n))return!0}else s+=$o(h,f,h,p,i,n),s+=$o(c,p,c,f,i,n);break;case Sf.Z:if(t){if(Ul(l,u,c,f,e,i,n))return!0}else s+=$o(l,u,c,f,i,n);l=c,u=f;break}}return!t&&!Oue(u,f)&&(s+=$o(l,u,c,f,i,n)||0),s!==0}function FH(r,e,t){return OH(r,0,!1,e,t)}function zH(r,e,t,i){return OH(r,e,!0,t,i)}var Xm=Ye({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Pl),Gue={style:Ye({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},xp.style)},hP=go.concat(["invisible","culling","z","z2","zlevel","parent"]),Hue=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.update=function(){var t=this;r.prototype.update.call(this);var i=this.style;if(i.decal){var n=this._decalEl=this._decalEl||new e;n.buildPath===e.prototype.buildPath&&(n.buildPath=function(l){t.buildPath(l,t.shape)}),n.silent=!0;var a=n.style;for(var o in i)a[o]!==i[o]&&(a[o]=i[o]);a.fill=i.fill?i.decal:null,a.decal=null,a.shadowColor=null,i.strokeFirst&&(a.stroke=null);for(var s=0;s<hP.length;++s)n[hP[s]]=this[hP[s]];n.__dirty|=zi}else this._decalEl&&(this._decalEl=null)},e.prototype.getDecalElement=function(){return this._decalEl},e.prototype._init=function(t){var i=bt(t);this.shape=this.getDefaultShape();var n=this.getDefaultStyle();n&&this.useStyle(n);for(var a=0;a<i.length;a++){var o=i[a],s=t[o];o==="style"?this.style?fe(this.style,s):this.useStyle(s):o==="shape"?fe(this.shape,s):r.prototype.attrKV.call(this,o,s)}this.style||this.useStyle({})},e.prototype.getDefaultStyle=function(){return null},e.prototype.getDefaultShape=function(){return{}},e.prototype.canBeInsideText=function(){return this.hasFill()},e.prototype.getInsideTextFill=function(){var t=this.style.fill;if(t!=="none"){if(Ce(t)){var i=Dm(t,0);return i>.5?$0:i>.2?FG:Q0}else if(t)return Q0}return $0},e.prototype.getInsideTextStroke=function(t){var i=this.style.fill;if(Ce(i)){var n=this.__zr,a=!!(n&&n.isDarkMode()),o=Dm(t,0)<J0;if(a===o)return i}},e.prototype.buildPath=function(t,i,n){},e.prototype.pathUpdated=function(){this.__dirty&=~cf},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new Ki(!1)},e.prototype.hasStroke=function(){var t=this.style,i=t.stroke;return!(i==null||i==="none"||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style,i=t.fill;return i!=null&&i!=="none"},e.prototype.getBoundingRect=function(){var t=this._rect,i=this.style,n=!t;if(n){var a=!1;this.path||(a=!0,this.createPathProxy());var o=this.path;(a||this.__dirty&cf)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),t=o.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){s.copy(t);var l=i.strokeNoScale?this.getLineScale():1,u=i.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;u=Math.max(u,c??4)}l>1e-10&&(s.width+=u/l,s.height+=u/l,s.x-=u/l/2,s.y-=u/l/2)}return s}return t},e.prototype.contain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect(),o=this.style;if(t=n[0],i=n[1],a.contain(t,i)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,u=o.strokeNoScale?this.getLineScale():1;if(u>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),zH(s,l/u,t,i)))return!0}if(this.hasFill())return FH(s,t,i)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=cf,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){t==="style"?this.dirtyStyle():t==="shape"?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(t,i){t==="shape"?this.setShape(i):r.prototype.attrKV.call(this,t,i)},e.prototype.setShape=function(t,i){var n=this.shape;return n||(n=this.shape={}),typeof t=="string"?n[t]=i:fe(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&cf)},e.prototype.createStyle=function(t){return lf(Xm,t)},e.prototype._innerSaveToNormal=function(t){r.prototype._innerSaveToNormal.call(this,t);var i=this._normalState;t.shape&&!i.shape&&(i.shape=fe({},this.shape))},e.prototype._applyStateObj=function(t,i,n,a,o,s){r.prototype._applyStateObj.call(this,t,i,n,a,o,s);var l=!(i&&a),u;if(i&&i.shape?o?a?u=i.shape:(u=fe({},n.shape),fe(u,i.shape)):(u=fe({},a?this.shape:n.shape),fe(u,i.shape)):l&&(u=n.shape),u)if(o){this.shape=fe({},this.shape);for(var c={},f=bt(u),h=0;h<f.length;h++){var p=f[h];typeof u[p]=="object"?this.shape[p]=u[p]:c[p]=u[p]}this._transitionState(t,{shape:c},s)}else this.shape=u,this.dirtyShape()},e.prototype._mergeStates=function(t){for(var i=r.prototype._mergeStates.call(this,t),n,a=0;a<t.length;a++){var o=t[a];o.shape&&(n=n||{},this._mergeStyle(n,o.shape))}return n&&(i.shape=n),i},e.prototype.getAnimationStyleProps=function(){return Gue},e.prototype.isZeroArea=function(){return!1},e.extend=function(t){var i=function(a){Xt(o,a);function o(s){var l=a.call(this,s)||this;return t.init&&t.init.call(l,s),l}return o.prototype.getDefaultStyle=function(){return Qe(t.style)},o.prototype.getDefaultShape=function(){return Qe(t.shape)},o}(e);for(var n in t)typeof t[n]=="function"&&(i.prototype[n]=t[n]);return i},e.initDefaultProps=function(){var t=e.prototype;t.type="path",t.strokeContainThreshold=5,t.segmentIgnoreThreshold=0,t.subPixelOptimize=!1,t.autoBatch=!1,t.__dirty=zi|op|cf}(),e}(gi),ut=Hue;var Wue=Ye({strokeFirst:!0,font:ho,x:0,y:0,textAlign:"left",textBaseline:"top",miterLimit:2},Xm),BH=function(r){Xt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.hasStroke=function(){var t=this.style,i=t.stroke;return i!=null&&i!=="none"&&t.lineWidth>0},e.prototype.hasFill=function(){var t=this.style,i=t.fill;return i!=null&&i!=="none"},e.prototype.createStyle=function(t){return lf(Wue,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var i=t.text;i!=null?i+="":i="";var n=Ll(i,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var a=t.lineWidth;n.x-=a/2,n.y-=a/2,n.width+=a,n.height+=a}this._rect=n}return this._rect},e.initDefaultProps=function(){var t=e.prototype;t.dirtyRectTolerance=10}(),e}(gi);BH.prototype.type="tspan";var bu=BH;var Xue=Ye({x:0,y:0},Pl),Yue={style:Ye({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},xp.style)};function que(r){return!!(r&&typeof r!="string"&&r.width&&r.height)}var kH=function(r){Xt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.createStyle=function(t){return lf(Xue,t)},e.prototype._getSize=function(t){var i=this.style,n=i[t];if(n!=null)return n;var a=que(i.image)?i.image:this.__image;if(!a)return 0;var o=t==="width"?"height":"width",s=i[o];return s==null?a[t]:a[t]/a[o]*s},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return Yue},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new lt(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(gi);kH.prototype.type="image";var Ur=kH;function VH(r,e){var t=e.x,i=e.y,n=e.width,a=e.height,o=e.r,s,l,u,c;n<0&&(t=t+n,n=-n),a<0&&(i=i+a,a=-a),typeof o=="number"?s=l=u=c=o:o instanceof Array?o.length===1?s=l=u=c=o[0]:o.length===2?(s=u=o[0],l=c=o[1]):o.length===3?(s=o[0],l=c=o[1],u=o[2]):(s=o[0],l=o[1],u=o[2],c=o[3]):s=l=u=c=0;var f;s+l>n&&(f=s+l,s*=n/f,l*=n/f),u+c>n&&(f=u+c,u*=n/f,c*=n/f),l+u>a&&(f=l+u,l*=a/f,u*=a/f),s+c>a&&(f=s+c,s*=a/f,c*=a/f),r.moveTo(t+s,i),r.lineTo(t+n-l,i),l!==0&&r.arc(t+n-l,i+l,l,-Math.PI/2,0),r.lineTo(t+n,i+a-u),u!==0&&r.arc(t+n-u,i+a-u,u,0,Math.PI/2),r.lineTo(t+c,i+a),c!==0&&r.arc(t+c,i+a-c,c,Math.PI/2,Math.PI),r.lineTo(t,i+s),s!==0&&r.arc(t+s,i+s,s,Math.PI,Math.PI*1.5)}var Ym=Math.round;function jb(r,e,t){if(e){var i=e.x1,n=e.x2,a=e.y1,o=e.y2;r.x1=i,r.x2=n,r.y1=a,r.y2=o;var s=t&&t.lineWidth;return s&&(Ym(i*2)===Ym(n*2)&&(r.x1=r.x2=Mf(i,s,!0)),Ym(a*2)===Ym(o*2)&&(r.y1=r.y2=Mf(a,s,!0))),r}}function Kb(r,e,t){if(e){var i=e.x,n=e.y,a=e.width,o=e.height;r.x=i,r.y=n,r.width=a,r.height=o;var s=t&&t.lineWidth;return s&&(r.x=Mf(i,s,!0),r.y=Mf(n,s,!0),r.width=Math.max(Mf(i+a,s,!1)-r.x,a===0?0:1),r.height=Math.max(Mf(n+o,s,!1)-r.y,o===0?0:1)),r}}function Mf(r,e,t){if(!e)return r;var i=Ym(r*2);return(i+Ym(e))%2===0?i/2:(i+(t?1:-1))/2}var Kue=function(){function r(){this.x=0,this.y=0,this.width=0,this.height=0}return r}();var Jue={},GH=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Kue},e.prototype.buildPath=function(t,i){var n,a,o,s;if(this.subPixelOptimize){var l=Kb(Jue,i,this.style);n=l.x,a=l.y,o=l.width,s=l.height,l.r=i.r,i=l}else n=i.x,a=i.y,o=i.width,s=i.height;i.r?VH(t,i):t.rect(n,a,o,s)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(ut);GH.prototype.type="rect";var Tt=GH;var HH={fill:"#000"},WH=2,$ue={style:Ye({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},xp.style)},$H=function(r){Xt(e,r);function e(t){var i=r.call(this)||this;return i.type="text",i._children=[],i._defaultStyle=HH,i.attr(t),i}return e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){r.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;t<this._children.length;t++){var i=this._children[t];i.zlevel=this.zlevel,i.z=this.z,i.z2=this.z2,i.culling=this.culling,i.cursor=this.cursor,i.invisible=this.invisible}},e.prototype.updateTransform=function(){var t=this.innerTransformable;t?(t.updateTransform(),t.transform&&(this.transform=t.transform)):r.prototype.updateTransform.call(this)},e.prototype.getLocalTransform=function(t){var i=this.innerTransformable;return i?i.getLocalTransform(t):r.prototype.getLocalTransform.call(this,t)},e.prototype.getComputedTransform=function(){return this.__hostTarget&&(this.__hostTarget.getComputedTransform(),this.__hostTarget.updateInnerText(!0)),r.prototype.getComputedTransform.call(this)},e.prototype._updateSubTexts=function(){this._childCursor=0,tce(this.style),this.style.rich?this._updateRichTexts():this._updatePlainTexts(),this._children.length=this._childCursor,this.styleUpdated()},e.prototype.addSelfToZr=function(t){r.prototype.addSelfToZr.call(this,t);for(var i=0;i<this._children.length;i++)this._children[i].__zr=t},e.prototype.removeSelfFromZr=function(t){r.prototype.removeSelfFromZr.call(this,t);for(var i=0;i<this._children.length;i++)this._children[i].__zr=null},e.prototype.getBoundingRect=function(){if(this.styleChanged()&&this._updateSubTexts(),!this._rect){for(var t=new lt(0,0,0,0),i=this._children,n=[],a=null,o=0;o<i.length;o++){var s=i[o],l=s.getBoundingRect(),u=s.getLocalTransform(n);u?(t.copy(l),t.applyTransform(u),a=a||t.clone(),a.union(t)):(a=a||l.clone(),a.union(l))}this._rect=a||t}return this._rect},e.prototype.setDefaultTextStyle=function(t){this._defaultStyle=t||HH},e.prototype.setTextContent=function(t){},e.prototype._mergeStyle=function(t,i){if(!i)return t;var n=i.rich,a=t.rich||n&&{};return fe(t,i),n&&a?(this._mergeRich(a,n),t.rich=a):a&&(t.rich=a),t},e.prototype._mergeRich=function(t,i){for(var n=bt(i),a=0;a<n.length;a++){var o=n[a];t[o]=t[o]||{},fe(t[o],i[o])}},e.prototype.getAnimationStyleProps=function(){return $ue},e.prototype._getOrCreateChild=function(t){var i=this._children[this._childCursor];return(!i||!(i instanceof t))&&(i=new t),this._children[this._childCursor++]=i,i.__zr=this.__zr,i.parent=this,i},e.prototype._updatePlainTexts=function(){var t=this.style,i=t.font||ho,n=t.padding,a=JH(t),o=SH(a,t),s=pP(t),l=!!t.backgroundColor,u=o.outerHeight,c=o.outerWidth,f=o.contentWidth,h=o.lines,p=o.lineHeight,d=this._defaultStyle,g=t.x||0,m=t.y||0,v=t.align||d.align||"left",_=t.verticalAlign||d.verticalAlign||"top",y=g,x=vp(m,o.contentHeight,_);if(s||n){var M=Nm(g,c,v),S=vp(m,u,_);s&&this._renderBackground(t,t,M,S,c,u)}x+=p/2,n&&(y=KH(g,v,n),_==="top"?x+=n[0]:_==="bottom"&&(x-=n[2]));for(var w=0,T=!1,C=jH("fill"in t?t.fill:(T=!0,d.fill)),b=ZH("stroke"in t?t.stroke:!l&&(!d.autoStroke||T)?(w=WH,d.stroke):null),E=t.textShadowBlur>0,I=t.width!=null&&(t.overflow==="truncate"||t.overflow==="break"||t.overflow==="breakAll"),R=o.calculatedLineHeight,A=0;A<h.length;A++){var D=this._getOrCreateChild(bu),U=D.createStyle();D.useStyle(U),U.text=h[A],U.x=y,U.y=x,v&&(U.textAlign=v),U.textBaseline="middle",U.opacity=t.opacity,U.strokeFirst=!0,E&&(U.shadowBlur=t.textShadowBlur||0,U.shadowColor=t.textShadowColor||"transparent",U.shadowOffsetX=t.textShadowOffsetX||0,U.shadowOffsetY=t.textShadowOffsetY||0),U.stroke=b,U.fill=C,b&&(U.lineWidth=t.lineWidth||w,U.lineDash=t.lineDash,U.lineDashOffset=t.lineDashOffset||0),U.font=i,YH(U,t),x+=p,I&&D.setBoundingRect(new lt(Nm(U.x,t.width,U.textAlign),vp(U.y,R,U.textBaseline),f,R))}},e.prototype._updateRichTexts=function(){var t=this.style,i=JH(t),n=MH(i,t),a=n.width,o=n.outerWidth,s=n.outerHeight,l=t.padding,u=t.x||0,c=t.y||0,f=this._defaultStyle,h=t.align||f.align,p=t.verticalAlign||f.verticalAlign,d=Nm(u,o,h),g=vp(c,s,p),m=d,v=g;l&&(m+=l[3],v+=l[0]);var _=m+a;pP(t)&&this._renderBackground(t,t,d,g,o,s);for(var y=!!t.backgroundColor,x=0;x<n.lines.length;x++){for(var M=n.lines[x],S=M.tokens,w=S.length,T=M.lineHeight,C=M.width,b=0,E=m,I=_,R=w-1,A=void 0;b<w&&(A=S[b],!A.align||A.align==="left");)this._placeToken(A,t,T,v,E,"left",y),C-=A.width,E+=A.width,b++;for(;R>=0&&(A=S[R],A.align==="right");)this._placeToken(A,t,T,v,I,"right",y),C-=A.width,I-=A.width,R--;for(E+=(a-(E-m)-(_-I)-C)/2;b<=R;)A=S[b],this._placeToken(A,t,T,v,E+A.width/2,"center",y),E+=A.width,b++;v+=T}},e.prototype._placeToken=function(t,i,n,a,o,s,l){var u=i.rich[t.styleName]||{};u.text=t.text;var c=t.verticalAlign,f=a+n/2;c==="top"?f=a+t.height/2:c==="bottom"&&(f=a+n-t.height/2);var h=!t.isLineHolder&&pP(u);h&&this._renderBackground(u,i,s==="right"?o-t.width:s==="center"?o-t.width/2:o,f-t.height/2,t.width,t.height);var p=!!u.backgroundColor,d=t.textPadding;d&&(o=KH(o,s,d),f-=t.height/2-d[0]-t.innerHeight/2);var g=this._getOrCreateChild(bu),m=g.createStyle();g.useStyle(m);var v=this._defaultStyle,_=!1,y=0,x=jH("fill"in u?u.fill:"fill"in i?i.fill:(_=!0,v.fill)),M=ZH("stroke"in u?u.stroke:"stroke"in i?i.stroke:!p&&!l&&(!v.autoStroke||_)?(y=WH,v.stroke):null),S=u.textShadowBlur>0||i.textShadowBlur>0;m.text=t.text,m.x=o,m.y=f,S&&(m.shadowBlur=u.textShadowBlur||i.textShadowBlur||0,m.shadowColor=u.textShadowColor||i.textShadowColor||"transparent",m.shadowOffsetX=u.textShadowOffsetX||i.textShadowOffsetX||0,m.shadowOffsetY=u.textShadowOffsetY||i.textShadowOffsetY||0),m.textAlign=s,m.textBaseline="middle",m.font=t.font||ho,m.opacity=Xi(u.opacity,i.opacity,1),YH(m,u),M&&(m.lineWidth=Xi(u.lineWidth,i.lineWidth,y),m.lineDash=ft(u.lineDash,i.lineDash),m.lineDashOffset=i.lineDashOffset||0,m.stroke=M),x&&(m.fill=x);var w=t.contentWidth,T=t.contentHeight;g.setBoundingRect(new lt(Nm(m.x,w,m.textAlign),vp(m.y,T,m.textBaseline),w,T))},e.prototype._renderBackground=function(t,i,n,a,o,s){var l=t.backgroundColor,u=t.borderWidth,c=t.borderColor,f=l&&l.image,h=l&&!f,p=t.borderRadius,d=this,g,m;if(h||t.lineHeight||u&&c){g=this._getOrCreateChild(Tt),g.useStyle(g.createStyle()),g.style.fill=null;var v=g.shape;v.x=n,v.y=a,v.width=o,v.height=s,v.r=p,g.dirtyShape()}if(h){var _=g.style;_.fill=l||null,_.fillOpacity=ft(t.fillOpacity,1)}else if(f){m=this._getOrCreateChild(Ur),m.onload=function(){d.dirtyStyle()};var y=m.style;y.image=l.image,y.x=n,y.y=a,y.width=o,y.height=s}if(u&&c){var _=g.style;_.lineWidth=u,_.stroke=c,_.strokeOpacity=ft(t.strokeOpacity,1),_.lineDash=t.borderDash,_.lineDashOffset=t.borderDashOffset||0,g.strokeContainThreshold=0,g.hasFill()&&g.hasStroke()&&(_.strokeFirst=!0,_.lineWidth*=2)}var x=(g||m).style;x.shadowBlur=t.shadowBlur||0,x.shadowColor=t.shadowColor||"transparent",x.shadowOffsetX=t.shadowOffsetX||0,x.shadowOffsetY=t.shadowOffsetY||0,x.opacity=Xi(t.opacity,i.opacity,1)},e.makeFont=function(t){var i="";return mP(t)&&(i=[t.fontStyle,t.fontWeight,dP(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),i&&Yi(i)||t.textFont||t.font},e}(gi),Que={left:!0,right:1,center:1},ece={top:1,bottom:1,middle:1},XH=["fontStyle","fontWeight","fontSize","fontFamily"];function dP(r){return typeof r=="string"&&(r.indexOf("px")!==-1||r.indexOf("rem")!==-1||r.indexOf("em")!==-1)?r:isNaN(+r)?$M+"px":r+"px"}function YH(r,e){for(var t=0;t<XH.length;t++){var i=XH[t],n=e[i];n!=null&&(r[i]=n)}}function mP(r){return r.fontSize!=null||r.fontFamily||r.fontWeight}function tce(r){return qH(r),N(r.rich,qH),r}function qH(r){if(r){r.font=$H.makeFont(r);var e=r.align;e==="middle"&&(e="center"),r.align=e==null||Que[e]?e:"left";var t=r.verticalAlign;t==="center"&&(t="middle"),r.verticalAlign=t==null||ece[t]?t:"top";var i=r.padding;i&&(r.padding=Mm(r.padding))}}function ZH(r,e){return r==null||e<=0||r==="transparent"||r==="none"?null:r.image||r.colorStops?"#000":r}function jH(r){return r==null||r==="none"?null:r.image||r.colorStops?"#000":r}function KH(r,e,t){return e==="right"?r-t[1]:e==="center"?r+t[3]/2-t[1]/2:r+t[3]}function JH(r){var e=r.text;return e!=null&&(e+=""),e}function pP(r){return!!(r.backgroundColor||r.lineHeight||r.borderWidth&&r.borderColor)}var Lt=$H;var rt=vt(),c_=function(r,e,t,i){if(i){var n=rt(i);n.dataIndex=t,n.dataType=e,n.seriesIndex=r,n.ssrType="chart",i.type==="group"&&i.traverse(function(a){var o=rt(a);o.seriesIndex=r,o.dataIndex=t,o.dataType=e,o.ssrType="chart"})}};var QH=1,e4={},a4=vt(),yP=vt(),_P=0,Cp=1,f_=2,Bi=["emphasis","blur","select"],bf=["normal","emphasis","blur","select"],wu=10,rce=9,wf="highlight",h_="downplay",Zm="select",p_="unselect",jm="toggleSelect";function qm(r){return r!=null&&r!=="none"}function $b(r,e,t){r.onHoverStateChange&&(r.hoverState||0)!==t&&r.onHoverStateChange(e),r.hoverState=t}function o4(r){$b(r,"emphasis",f_)}function s4(r){r.hoverState===f_&&$b(r,"normal",_P)}function xP(r){$b(r,"blur",Cp)}function l4(r){r.hoverState===Cp&&$b(r,"normal",_P)}function ice(r){r.selected=!0}function nce(r){r.selected=!1}function t4(r,e,t){e(r,t)}function Tu(r,e,t){t4(r,e,t),r.isGroup&&r.traverse(function(i){t4(i,e,t)})}function Rp(r,e){switch(e){case"emphasis":r.hoverState=f_;break;case"normal":r.hoverState=_P;break;case"blur":r.hoverState=Cp;break;case"select":r.selected=!0}}function ace(r,e,t,i){for(var n=r.style,a={},o=0;o<e.length;o++){var s=e[o],l=n[s];a[s]=l??(i&&i[s])}for(var o=0;o<r.animators.length;o++){var u=r.animators[o];u.__fromStateTransition&&u.__fromStateTransition.indexOf(t)<0&&u.targetName==="style"&&u.saveTo(a,e)}return a}function oce(r,e,t,i){var n=t&&dt(t,"select")>=0,a=!1;if(r instanceof ut){var o=a4(r),s=n&&o.selectFill||o.normalFill,l=n&&o.selectStroke||o.normalStroke;if(qm(s)||qm(l)){i=i||{};var u=i.style||{};u.fill==="inherit"?(a=!0,i=fe({},i),u=fe({},u),u.fill=s):!qm(u.fill)&&qm(s)?(a=!0,i=fe({},i),u=fe({},u),u.fill=X0(s)):!qm(u.stroke)&&qm(l)&&(a||(i=fe({},i),u=fe({},u)),u.stroke=X0(l)),i.style=u}}if(i&&i.z2==null){a||(i=fe({},i));var c=r.z2EmphasisLift;i.z2=r.z2+(c??wu)}return i}function sce(r,e,t){if(t&&t.z2==null){t=fe({},t);var i=r.z2SelectLift;t.z2=r.z2+(i??rce)}return t}function lce(r,e,t){var i=dt(r.currentStates,e)>=0,n=r.style.opacity,a=i?null:ace(r,["opacity"],e,{opacity:1});t=t||{};var o=t.style||{};return o.opacity==null&&(t=fe({},t),o=fe({opacity:i?n:a.opacity*.1},o),t.style=o),t}function vP(r,e){var t=this.states[r];if(this.style){if(r==="emphasis")return oce(this,r,e,t);if(r==="blur")return lce(this,r,t);if(r==="select")return sce(this,r,t)}return t}function Fs(r){r.stateProxy=vP;var e=r.getTextContent(),t=r.getTextGuideLine();e&&(e.stateProxy=vP),t&&(t.stateProxy=vP)}function r4(r,e){!u4(r,e)&&!r.__highByOuter&&Tu(r,o4)}function i4(r,e){!u4(r,e)&&!r.__highByOuter&&Tu(r,s4)}function Bn(r,e){r.__highByOuter|=1<<(e||0),Tu(r,o4)}function kn(r,e){!(r.__highByOuter&=~(1<<(e||0)))&&Tu(r,s4)}function Qb(r){Tu(r,xP)}function d_(r){Tu(r,l4)}function SP(r){Tu(r,ice)}function MP(r){Tu(r,nce)}function u4(r,e){return r.__highDownSilentOnTouch&&e.zrByTouch}function bP(r){var e=r.getModel(),t=[],i=[];e.eachComponent(function(n,a){var o=yP(a),s=n==="series",l=s?r.getViewOfSeriesModel(a):r.getViewOfComponentModel(a);!s&&i.push(l),o.isBlured&&(l.group.traverse(function(u){l4(u)}),s&&t.push(a)),o.isBlured=!1}),N(i,function(n){n&&n.toggleBlurSeries&&n.toggleBlurSeries(t,!1,e)})}function gP(r,e,t,i){var n=i.getModel();t=t||"coordinateSystem";function a(u,c){for(var f=0;f<c.length;f++){var h=u.getItemGraphicEl(c[f]);h&&d_(h)}}if(r!=null&&!(!e||e==="none")){var o=n.getSeriesByIndex(r),s=o.coordinateSystem;s&&s.master&&(s=s.master);var l=[];n.eachSeries(function(u){var c=o===u,f=u.coordinateSystem;f&&f.master&&(f=f.master);var h=f&&s?f===s:c;if(!(t==="series"&&!c||t==="coordinateSystem"&&!h||e==="series"&&c)){var p=i.getViewOfSeriesModel(u);if(p.group.traverse(function(m){m.__highByOuter&&c&&e==="self"||xP(m)}),ci(e))a(u.getData(),e);else if(qe(e))for(var d=bt(e),g=0;g<d.length;g++)a(u.getData(d[g]),e[d[g]]);l.push(u),yP(u).isBlured=!0}}),n.eachComponent(function(u,c){if(u!=="series"){var f=i.getViewOfComponentModel(c);f&&f.toggleBlurSeries&&f.toggleBlurSeries(l,!0,n)}})}}function Jb(r,e,t){if(!(r==null||e==null)){var i=t.getModel().getComponent(r,e);if(i){yP(i).isBlured=!0;var n=t.getViewOfComponentModel(i);!n||!n.focusBlurEnabled||n.group.traverse(function(a){xP(a)})}}}function c4(r,e,t){var i=r.seriesIndex,n=r.getData(e.dataType);if(n){var a=Jo(n,e);a=(pe(a)?a[0]:a)||0;var o=n.getItemGraphicEl(a);if(!o)for(var s=n.count(),l=0;!o&&l<s;)o=n.getItemGraphicEl(l++);if(o){var u=rt(o);gP(i,u.focus,u.blurScope,t)}else{var c=r.get(["emphasis","focus"]),f=r.get(["emphasis","blurScope"]);c!=null&&gP(i,c,f,t)}}}function ew(r,e,t,i){var n={focusSelf:!1,dispatchers:null};if(r==null||r==="series"||e==null||t==null)return n;var a=i.getModel().getComponent(r,e);if(!a)return n;var o=i.getViewOfComponentModel(a);if(!o||!o.findHighDownDispatchers)return n;for(var s=o.findHighDownDispatchers(t),l,u=0;u<s.length;u++)if(rt(s[u]).focus==="self"){l=!0;break}return{focusSelf:l,dispatchers:s}}function f4(r,e,t){var i=rt(r),n=ew(i.componentMainType,i.componentIndex,i.componentHighDownName,t),a=n.dispatchers,o=n.focusSelf;a?(o&&Jb(i.componentMainType,i.componentIndex,t),N(a,function(s){return r4(s,e)})):(gP(i.seriesIndex,i.focus,i.blurScope,t),i.focus==="self"&&Jb(i.componentMainType,i.componentIndex,t),r4(r,e))}function h4(r,e,t){bP(t);var i=rt(r),n=ew(i.componentMainType,i.componentIndex,i.componentHighDownName,t).dispatchers;n?N(n,function(a){return i4(a,e)}):i4(r,e)}function p4(r,e,t){if(rw(e)){var i=e.dataType,n=r.getData(i),a=Jo(n,e);pe(a)||(a=[a]),r[e.type===jm?"toggleSelect":e.type===Zm?"select":"unselect"](a,i)}}function wP(r){var e=r.getAllData();N(e,function(t){var i=t.data,n=t.type;i.eachItemGraphicEl(function(a,o){r.isSelected(o,n)?SP(a):MP(a)})})}function d4(r){var e=[];return r.eachSeries(function(t){var i=t.getAllData();N(i,function(n){var a=n.data,o=n.type,s=t.getSelectedDataIndices();if(s.length>0){var l={dataIndex:s,seriesIndex:t.seriesIndex};o!=null&&(l.dataType=o),e.push(l)}})}),e}function Ol(r,e,t){Eu(r,!0),Tu(r,Fs),tw(r,e,t)}function uce(r){Eu(r,!1)}function nr(r,e,t,i){i?uce(r):Ol(r,e,t)}function tw(r,e,t){var i=rt(r);e!=null?(i.focus=e,i.blurScope=t):i.focus&&(i.focus=null)}var n4=["emphasis","blur","select"],cce={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Gr(r,e,t,i){t=t||"itemStyle";for(var n=0;n<n4.length;n++){var a=n4[n],o=e.getModel([a,t]),s=r.ensureState(a);s.style=i?i(o):o[cce[t]]()}}function Eu(r,e){var t=e===!1,i=r;r.highDownSilentOnTouch&&(i.__highDownSilentOnTouch=r.highDownSilentOnTouch),(!t||i.__highDownDispatcher)&&(i.__highByOuter=i.__highByOuter||0,i.__highDownDispatcher=!t)}function Tf(r){return!!(r&&r.__highDownDispatcher)}function m4(r,e,t){var i=rt(r);i.componentMainType=e.mainType,i.componentIndex=e.componentIndex,i.componentHighDownName=t}function v4(r){var e=e4[r];return e==null&&QH<=32&&(e=e4[r]=QH++),e}function rw(r){var e=r.type;return e===Zm||e===p_||e===jm}function TP(r){var e=r.type;return e===wf||e===h_}function g4(r){var e=a4(r);e.normalFill=r.style.fill,e.normalStroke=r.style.stroke;var t=r.states.select||{};e.selectFill=t.style&&t.style.fill||null,e.selectStroke=t.style&&t.style.stroke||null}var Ct={};YR(Ct,{Arc:()=>__,BezierCurve:()=>Dp,BoundingRect:()=>lt,Circle:()=>oa,CompoundPath:()=>Qm,Ellipse:()=>v_,Group:()=>Ze,Image:()=>Ur,IncrementalDisplayable:()=>V4,Line:()=>Kr,LinearGradient:()=>zl,OrientedBoundingRect:()=>ev,Path:()=>ut,Point:()=>Nt,Polygon:()=>ei,Polyline:()=>$r,RadialGradient:()=>cw,Rect:()=>Tt,Ring:()=>Pp,Sector:()=>yi,Text:()=>Lt,applyTransform:()=>wn,clipPointsByRect:()=>NP,clipRectByRect:()=>Hce,createIcon:()=>Pu,extendPath:()=>kce,extendShape:()=>zce,getShapeClass:()=>x_,getTransform:()=>ks,groupTransition:()=>Lu,initProps:()=>ar,isElementRemoved:()=>Au,lineLineIntersect:()=>j4,linePolygonIntersect:()=>rv,makeImage:()=>IP,makePath:()=>tv,mergePath:()=>Gn,registerShape:()=>Bs,removeElement:()=>es,removeElementWithFadeOut:()=>Cu,resizePath:()=>Z4,setTooltipConfig:()=>Vs,subPixelOptimize:()=>S_,subPixelOptimizeLine:()=>Ru,subPixelOptimizeRect:()=>Vce,transformDirection:()=>Up,traverseElements:()=>sa,updateProps:()=>Dt});var Km=Ki.CMD,fce=[[],[],[]],y4=Math.sqrt,hce=Math.atan2;function iw(r,e){if(e){var t=r.data,i=r.len(),n,a,o,s,l,u,c=Km.M,f=Km.C,h=Km.L,p=Km.R,d=Km.A,g=Km.Q;for(o=0,s=0;o<i;){switch(n=t[o++],s=o,a=0,n){case c:a=1;break;case h:a=1;break;case f:a=3;break;case g:a=2;break;case d:var m=e[4],v=e[5],_=y4(e[0]*e[0]+e[1]*e[1]),y=y4(e[2]*e[2]+e[3]*e[3]),x=hce(-e[1]/y,e[0]/_);t[o]*=_,t[o++]+=m,t[o]*=y,t[o++]+=v,t[o++]*=_,t[o++]*=y,t[o++]+=x,t[o++]+=x,o+=2,s=o;break;case p:u[0]=t[o++],u[1]=t[o++],fi(u,u,e),t[s++]=u[0],t[s++]=u[1],u[0]+=t[o++],u[1]+=t[o++],fi(u,u,e),t[s++]=u[0],t[s++]=u[1]}for(l=0;l<a;l++){var M=fce[l];M[0]=t[o++],M[1]=t[o++],fi(M,M,e),t[s++]=M[0],t[s++]=M[1]}}r.increaseVersion()}}var EP=Math.sqrt,nw=Math.sin,aw=Math.cos,m_=Math.PI;function _4(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function AP(r,e){return(r[0]*e[0]+r[1]*e[1])/(_4(r)*_4(e))}function x4(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(AP(r,e))}function S4(r,e,t,i,n,a,o,s,l,u,c){var f=l*(m_/180),h=aw(f)*(r-t)/2+nw(f)*(e-i)/2,p=-1*nw(f)*(r-t)/2+aw(f)*(e-i)/2,d=h*h/(o*o)+p*p/(s*s);d>1&&(o*=EP(d),s*=EP(d));var g=(n===a?-1:1)*EP((o*o*(s*s)-o*o*(p*p)-s*s*(h*h))/(o*o*(p*p)+s*s*(h*h)))||0,m=g*o*p/s,v=g*-s*h/o,_=(r+t)/2+aw(f)*m-nw(f)*v,y=(e+i)/2+nw(f)*m+aw(f)*v,x=x4([1,0],[(h-m)/o,(p-v)/s]),M=[(h-m)/o,(p-v)/s],S=[(-1*h-m)/o,(-1*p-v)/s],w=x4(M,S);if(AP(M,S)<=-1&&(w=m_),AP(M,S)>=1&&(w=0),w<0){var T=Math.round(w/m_*1e6)/1e6;w=m_*2+T%2*m_}c.addData(u,_,y,o,s,x,w,f,a)}var pce=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,dce=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function mce(r){var e=new Ki;if(!r)return e;var t=0,i=0,n=t,a=i,o,s=Ki.CMD,l=r.match(pce);if(!l)return e;for(var u=0;u<l.length;u++){for(var c=l[u],f=c.charAt(0),h=void 0,p=c.match(dce)||[],d=p.length,g=0;g<d;g++)p[g]=parseFloat(p[g]);for(var m=0;m<d;){var v=void 0,_=void 0,y=void 0,x=void 0,M=void 0,S=void 0,w=void 0,T=t,C=i,b=void 0,E=void 0;switch(f){case"l":t+=p[m++],i+=p[m++],h=s.L,e.addData(h,t,i);break;case"L":t=p[m++],i=p[m++],h=s.L,e.addData(h,t,i);break;case"m":t+=p[m++],i+=p[m++],h=s.M,e.addData(h,t,i),n=t,a=i,f="l";break;case"M":t=p[m++],i=p[m++],h=s.M,e.addData(h,t,i),n=t,a=i,f="L";break;case"h":t+=p[m++],h=s.L,e.addData(h,t,i);break;case"H":t=p[m++],h=s.L,e.addData(h,t,i);break;case"v":i+=p[m++],h=s.L,e.addData(h,t,i);break;case"V":i=p[m++],h=s.L,e.addData(h,t,i);break;case"C":h=s.C,e.addData(h,p[m++],p[m++],p[m++],p[m++],p[m++],p[m++]),t=p[m-2],i=p[m-1];break;case"c":h=s.C,e.addData(h,p[m++]+t,p[m++]+i,p[m++]+t,p[m++]+i,p[m++]+t,p[m++]+i),t+=p[m-2],i+=p[m-1];break;case"S":v=t,_=i,b=e.len(),E=e.data,o===s.C&&(v+=t-E[b-4],_+=i-E[b-3]),h=s.C,T=p[m++],C=p[m++],t=p[m++],i=p[m++],e.addData(h,v,_,T,C,t,i);break;case"s":v=t,_=i,b=e.len(),E=e.data,o===s.C&&(v+=t-E[b-4],_+=i-E[b-3]),h=s.C,T=t+p[m++],C=i+p[m++],t+=p[m++],i+=p[m++],e.addData(h,v,_,T,C,t,i);break;case"Q":T=p[m++],C=p[m++],t=p[m++],i=p[m++],h=s.Q,e.addData(h,T,C,t,i);break;case"q":T=p[m++]+t,C=p[m++]+i,t+=p[m++],i+=p[m++],h=s.Q,e.addData(h,T,C,t,i);break;case"T":v=t,_=i,b=e.len(),E=e.data,o===s.Q&&(v+=t-E[b-4],_+=i-E[b-3]),t=p[m++],i=p[m++],h=s.Q,e.addData(h,v,_,t,i);break;case"t":v=t,_=i,b=e.len(),E=e.data,o===s.Q&&(v+=t-E[b-4],_+=i-E[b-3]),t+=p[m++],i+=p[m++],h=s.Q,e.addData(h,v,_,t,i);break;case"A":y=p[m++],x=p[m++],M=p[m++],S=p[m++],w=p[m++],T=t,C=i,t=p[m++],i=p[m++],h=s.A,S4(T,C,t,i,S,w,y,x,M,h,e);break;case"a":y=p[m++],x=p[m++],M=p[m++],S=p[m++],w=p[m++],T=t,C=i,t+=p[m++],i+=p[m++],h=s.A,S4(T,C,t,i,S,w,y,x,M,h,e);break}}(f==="z"||f==="Z")&&(h=s.Z,e.addData(h),t=n,i=a),o=h}return e.toStatic(),e}var M4=function(r){Xt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.applyTransform=function(t){},e}(ut);function b4(r){return r.setData!=null}function w4(r,e){var t=mce(r),i=fe({},e);return i.buildPath=function(n){if(b4(n)){n.setData(t.data);var a=n.getContext();a&&n.rebuildPath(a,1)}else{var a=n;t.rebuildPath(a,1)}},i.applyTransform=function(n){iw(t,n),this.dirtyShape()},i}function ow(r,e){return new M4(w4(r,e))}function T4(r,e){var t=w4(r,e),i=function(n){Xt(a,n);function a(o){var s=n.call(this,o)||this;return s.applyTransform=t.applyTransform,s.buildPath=t.buildPath,s}return a}(M4);return i}function E4(r,e){for(var t=[],i=r.length,n=0;n<i;n++){var a=r[n];t.push(a.getUpdatedPathProxy(!0))}var o=new ut(e);return o.createPathProxy(),o.buildPath=function(s){if(b4(s)){s.appendPath(t);var l=s.getContext();l&&s.rebuildPath(l,1)}},o}function Jm(r,e){e=e||{};var t=new ut;return r.shape&&t.setShape(r.shape),t.setStyle(r.style),e.bakeTransform?iw(t.path,r.getComputedTransform()):e.toLocal?t.setLocalTransform(r.getComputedTransform()):t.copyTransform(r),t.buildPath=r.buildPath,t.applyTransform=t.applyTransform,t.z=r.z,t.z2=r.z2,t.zlevel=r.zlevel,t}var gce=function(){function r(){this.cx=0,this.cy=0,this.r=0}return r}();var A4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new gce},e.prototype.buildPath=function(t,i){t.moveTo(i.cx+i.r,i.cy),t.arc(i.cx,i.cy,i.r,0,Math.PI*2)},e}(ut);A4.prototype.type="circle";var oa=A4;var yce=function(){function r(){this.cx=0,this.cy=0,this.rx=0,this.ry=0}return r}();var C4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new yce},e.prototype.buildPath=function(t,i){var n=.5522848,a=i.cx,o=i.cy,s=i.rx,l=i.ry,u=s*n,c=l*n;t.moveTo(a-s,o),t.bezierCurveTo(a-s,o-c,a-u,o-l,a,o-l),t.bezierCurveTo(a+u,o-l,a+s,o-c,a+s,o),t.bezierCurveTo(a+s,o+c,a+u,o+l,a,o+l),t.bezierCurveTo(a-u,o+l,a-s,o+c,a-s,o),t.closePath()},e}(ut);C4.prototype.type="ellipse";var v_=C4;var L4=Math.PI,CP=L4*2,Lp=Math.sin,$m=Math.cos,_ce=Math.acos,Vn=Math.atan2,R4=Math.abs,y_=Math.sqrt,g_=Math.max,Fl=Math.min,zs=1e-4;function xce(r,e,t,i,n,a,o,s){var l=t-r,u=i-e,c=o-n,f=s-a,h=f*l-c*u;if(!(h*h<zs))return h=(c*(e-a)-f*(r-n))/h,[r+h*l,e+h*u]}function sw(r,e,t,i,n,a,o){var s=r-t,l=e-i,u=(o?a:-a)/y_(s*s+l*l),c=u*l,f=-u*s,h=r+c,p=e+f,d=t+c,g=i+f,m=(h+d)/2,v=(p+g)/2,_=d-h,y=g-p,x=_*_+y*y,M=n-a,S=h*g-d*p,w=(y<0?-1:1)*y_(g_(0,M*M*x-S*S)),T=(S*y-_*w)/x,C=(-S*_-y*w)/x,b=(S*y+_*w)/x,E=(-S*_+y*w)/x,I=T-m,R=C-v,A=b-m,D=E-v;return I*I+R*R>A*A+D*D&&(T=b,C=E),{cx:T,cy:C,x0:-c,y0:-f,x1:T*(n/M-1),y1:C*(n/M-1)}}function Sce(r){var e;if(pe(r)){var t=r.length;if(!t)return r;t===1?e=[r[0],r[0],0,0]:t===2?e=[r[0],r[0],r[1],r[1]]:t===3?e=r.concat(r[2]):e=r}else e=[r,r,r,r];return e}function P4(r,e){var t,i=g_(e.r,0),n=g_(e.r0||0,0),a=i>0,o=n>0;if(!(!a&&!o)){if(a||(i=n,n=0),n>i){var s=i;i=n,n=s}var l=e.startAngle,u=e.endAngle;if(!(isNaN(l)||isNaN(u))){var c=e.cx,f=e.cy,h=!!e.clockwise,p=R4(u-l),d=p>CP&&p%CP;if(d>zs&&(p=d),!(i>zs))r.moveTo(c,f);else if(p>CP-zs)r.moveTo(c+i*$m(l),f+i*Lp(l)),r.arc(c,f,i,l,u,!h),n>zs&&(r.moveTo(c+n*$m(u),f+n*Lp(u)),r.arc(c,f,n,u,l,h));else{var g=void 0,m=void 0,v=void 0,_=void 0,y=void 0,x=void 0,M=void 0,S=void 0,w=void 0,T=void 0,C=void 0,b=void 0,E=void 0,I=void 0,R=void 0,A=void 0,D=i*$m(l),U=i*Lp(l),B=n*$m(u),F=n*Lp(u),k=p>zs;if(k){var G=e.cornerRadius;G&&(t=Sce(G),g=t[0],m=t[1],v=t[2],_=t[3]);var Y=R4(i-n)/2;if(y=Fl(Y,v),x=Fl(Y,_),M=Fl(Y,g),S=Fl(Y,m),C=w=g_(y,x),b=T=g_(M,S),(w>zs||T>zs)&&(E=i*$m(u),I=i*Lp(u),R=n*$m(l),A=n*Lp(l),p<L4)){var J=xce(D,U,R,A,E,I,B,F);if(J){var Q=D-J[0],V=U-J[1],K=E-J[0],ae=I-J[1],ve=1/Lp(_ce((Q*K+V*ae)/(y_(Q*Q+V*V)*y_(K*K+ae*ae)))/2),ue=y_(J[0]*J[0]+J[1]*J[1]);C=Fl(w,(i-ue)/(ve+1)),b=Fl(T,(n-ue)/(ve-1))}}}if(!k)r.moveTo(c+D,f+U);else if(C>zs){var se=Fl(v,C),Ee=Fl(_,C),q=sw(R,A,D,U,i,se,h),H=sw(E,I,B,F,i,Ee,h);r.moveTo(c+q.cx+q.x0,f+q.cy+q.y0),C<w&&se===Ee?r.arc(c+q.cx,f+q.cy,C,Vn(q.y0,q.x0),Vn(H.y0,H.x0),!h):(se>0&&r.arc(c+q.cx,f+q.cy,se,Vn(q.y0,q.x0),Vn(q.y1,q.x1),!h),r.arc(c,f,i,Vn(q.cy+q.y1,q.cx+q.x1),Vn(H.cy+H.y1,H.cx+H.x1),!h),Ee>0&&r.arc(c+H.cx,f+H.cy,Ee,Vn(H.y1,H.x1),Vn(H.y0,H.x0),!h))}else r.moveTo(c+D,f+U),r.arc(c,f,i,l,u,!h);if(!(n>zs)||!k)r.lineTo(c+B,f+F);else if(b>zs){var se=Fl(g,b),Ee=Fl(m,b),q=sw(B,F,E,I,n,-Ee,h),H=sw(D,U,R,A,n,-se,h);r.lineTo(c+q.cx+q.x0,f+q.cy+q.y0),b<T&&se===Ee?r.arc(c+q.cx,f+q.cy,b,Vn(q.y0,q.x0),Vn(H.y0,H.x0),!h):(Ee>0&&r.arc(c+q.cx,f+q.cy,Ee,Vn(q.y0,q.x0),Vn(q.y1,q.x1),!h),r.arc(c,f,n,Vn(q.cy+q.y1,q.cx+q.x1),Vn(H.cy+H.y1,H.cx+H.x1),h),se>0&&r.arc(c+H.cx,f+H.cy,se,Vn(H.y1,H.x1),Vn(H.y0,H.x0),!h))}else r.lineTo(c+B,f+F),r.arc(c,f,n,u,l,h)}r.closePath()}}}var bce=function(){function r(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return r}();var D4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new bce},e.prototype.buildPath=function(t,i){P4(t,i)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(ut);D4.prototype.type="sector";var yi=D4;var wce=function(){function r(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return r}();var I4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new wce},e.prototype.buildPath=function(t,i){var n=i.cx,a=i.cy,o=Math.PI*2;t.moveTo(n+i.r,a),t.arc(n,a,i.r,0,o,!1),t.moveTo(n+i.r0,a),t.arc(n,a,i.r0,0,o,!0)},e}(ut);I4.prototype.type="ring";var Pp=I4;function RP(r,e,t,i){var n=[],a=[],o=[],s=[],l,u,c,f;if(i){c=[1/0,1/0],f=[-1/0,-1/0];for(var h=0,p=r.length;h<p;h++)po(c,c,r[h]),mo(f,f,r[h]);po(c,c,i[0]),mo(f,f,i[1])}for(var h=0,p=r.length;h<p;h++){var d=r[h];if(t)l=r[h?h-1:p-1],u=r[(h+1)%p];else if(h===0||h===p-1){n.push(wa(r[h]));continue}else l=r[h-1],u=r[h+1];Is(a,u,l),wm(a,a,e);var g=ab(d,l),m=ab(d,u),v=g+m;v!==0&&(g/=v,m/=v),wm(o,a,-g),wm(s,a,m);var _=sL([],d,o),y=sL([],d,s);i&&(mo(_,_,c),po(_,_,f),mo(y,y,c),po(y,y,f)),n.push(_),n.push(y)}return t&&n.push(n.shift()),n}function lw(r,e,t){var i=e.smooth,n=e.points;if(n&&n.length>=2){if(i){var a=RP(n,i,t,e.smoothConstraint);r.moveTo(n[0][0],n[0][1]);for(var o=n.length,s=0;s<(t?o:o-1);s++){var l=a[s*2],u=a[s*2+1],c=n[(s+1)%o];r.bezierCurveTo(l[0],l[1],u[0],u[1],c[0],c[1])}}else{r.moveTo(n[0][0],n[0][1]);for(var s=1,f=n.length;s<f;s++)r.lineTo(n[s][0],n[s][1])}t&&r.closePath()}}var Tce=function(){function r(){this.points=null,this.smooth=0,this.smoothConstraint=null}return r}();var U4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Tce},e.prototype.buildPath=function(t,i){lw(t,i,!0)},e}(ut);U4.prototype.type="polygon";var ei=U4;var Ece=function(){function r(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null}return r}();var O4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Ece},e.prototype.buildPath=function(t,i){lw(t,i,!1)},e}(ut);O4.prototype.type="polyline";var $r=O4;var Ace={},Cce=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return r}();var F4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Cce},e.prototype.buildPath=function(t,i){var n,a,o,s;if(this.subPixelOptimize){var l=jb(Ace,i,this.style);n=l.x1,a=l.y1,o=l.x2,s=l.y2}else n=i.x1,a=i.y1,o=i.x2,s=i.y2;var u=i.percent;u!==0&&(t.moveTo(n,a),u<1&&(o=n*(1-u)+o*u,s=a*(1-u)+s*u),t.lineTo(o,s))},e.prototype.pointAt=function(t){var i=this.shape;return[i.x1*(1-t)+i.x2*t,i.y1*(1-t)+i.y2*t]},e}(ut);F4.prototype.type="line";var Kr=F4;var Fa=[],Rce=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1}return r}();function z4(r,e,t){var i=r.cpx2,n=r.cpy2;return i!=null||n!=null?[(t?_L:hi)(r.x1,r.cpx1,r.cpx2,r.x2,e),(t?_L:hi)(r.y1,r.cpy1,r.cpy2,r.y2,e)]:[(t?G0:vi)(r.x1,r.cpx1,r.x2,e),(t?G0:vi)(r.y1,r.cpy1,r.y2,e)]}var B4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Rce},e.prototype.buildPath=function(t,i){var n=i.x1,a=i.y1,o=i.x2,s=i.y2,l=i.cpx1,u=i.cpy1,c=i.cpx2,f=i.cpy2,h=i.percent;h!==0&&(t.moveTo(n,a),c==null||f==null?(h<1&&(pf(n,l,o,h,Fa),l=Fa[1],o=Fa[2],pf(a,u,s,h,Fa),u=Fa[1],s=Fa[2]),t.quadraticCurveTo(l,u,o,s)):(h<1&&(Zo(n,l,c,o,h,Fa),l=Fa[1],c=Fa[2],o=Fa[3],Zo(a,u,f,s,h,Fa),u=Fa[1],f=Fa[2],s=Fa[3]),t.bezierCurveTo(l,u,c,f,o,s)))},e.prototype.pointAt=function(t){return z4(this.shape,t,!1)},e.prototype.tangentAt=function(t){var i=z4(this.shape,t,!0);return Wo(i,i)},e}(ut);B4.prototype.type="bezier-curve";var Dp=B4;var Lce=function(){function r(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return r}();var k4=function(r){Xt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Lce},e.prototype.buildPath=function(t,i){var n=i.cx,a=i.cy,o=Math.max(i.r,0),s=i.startAngle,l=i.endAngle,u=i.clockwise,c=Math.cos(s),f=Math.sin(s);t.moveTo(c*o+n,f*o+a),t.arc(n,a,o,s,l,!u)},e}(ut);k4.prototype.type="arc";var __=k4;var Pce=function(r){Xt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="compound",t}return e.prototype._updatePathDirty=function(){for(var t=this.shape.paths,i=this.shapeChanged(),n=0;n<t.length;n++)i=i||t[n].shapeChanged();i&&this.dirtyShape()},e.prototype.beforeBrush=function(){this._updatePathDirty();for(var t=this.shape.paths||[],i=this.getGlobalScale(),n=0;n<t.length;n++)t[n].path||t[n].createPathProxy(),t[n].path.setScale(i[0],i[1],t[n].segmentIgnoreThreshold)},e.prototype.buildPath=function(t,i){for(var n=i.paths||[],a=0;a<n.length;a++)n[a].buildPath(t,n[a].shape,!0)},e.prototype.afterBrush=function(){for(var t=this.shape.paths||[],i=0;i<t.length;i++)t[i].pathUpdated()},e.prototype.getBoundingRect=function(){return this._updatePathDirty.call(this),ut.prototype.getBoundingRect.call(this)},e}(ut),Qm=Pce;var Dce=function(){function r(e){this.colorStops=e||[]}return r.prototype.addColorStop=function(e,t){this.colorStops.push({offset:e,color:t})},r}(),uw=Dce;var Ice=function(r){Xt(e,r);function e(t,i,n,a,o,s){var l=r.call(this,o)||this;return l.x=t??0,l.y=i??0,l.x2=n??1,l.y2=a??0,l.type="linear",l.global=s||!1,l}return e}(uw),zl=Ice;var Nce=function(r){Xt(e,r);function e(t,i,n,a,o){var s=r.call(this,a)||this;return s.x=t??.5,s.y=i??.5,s.r=n??.5,s.type="radial",s.global=o||!1,s}return e}(uw),cw=Nce;var Ip=[0,0],Np=[0,0],fw=new Nt,hw=new Nt,Uce=function(){function r(e,t){this._corners=[],this._axes=[],this._origin=[0,0];for(var i=0;i<4;i++)this._corners[i]=new Nt;for(var i=0;i<2;i++)this._axes[i]=new Nt;e&&this.fromBoundingRect(e,t)}return r.prototype.fromBoundingRect=function(e,t){var i=this._corners,n=this._axes,a=e.x,o=e.y,s=a+e.width,l=o+e.height;if(i[0].set(a,o),i[1].set(s,o),i[2].set(s,l),i[3].set(a,l),t)for(var u=0;u<4;u++)i[u].transform(t);Nt.sub(n[0],i[1],i[0]),Nt.sub(n[1],i[3],i[0]),n[0].normalize(),n[1].normalize();for(var u=0;u<2;u++)this._origin[u]=n[u].dot(i[0])},r.prototype.intersect=function(e,t){var i=!0,n=!t;return fw.set(1/0,1/0),hw.set(0,0),!this._intersectCheckOneSide(this,e,fw,hw,n,1)&&(i=!1,n)||!this._intersectCheckOneSide(e,this,fw,hw,n,-1)&&(i=!1,n)||n||Nt.copy(t,i?fw:hw),i},r.prototype._intersectCheckOneSide=function(e,t,i,n,a,o){for(var s=!0,l=0;l<2;l++){var u=this._axes[l];if(this._getProjMinMaxOnAxis(l,e._corners,Ip),this._getProjMinMaxOnAxis(l,t._corners,Np),Ip[1]<Np[0]||Ip[0]>Np[1]){if(s=!1,a)return s;var c=Math.abs(Np[0]-Ip[1]),f=Math.abs(Ip[0]-Np[1]);Math.min(c,f)>n.len()&&(c<f?Nt.scale(n,u,-c*o):Nt.scale(n,u,f*o))}else if(i){var c=Math.abs(Np[0]-Ip[1]),f=Math.abs(Ip[0]-Np[1]);Math.min(c,f)<i.len()&&(c<f?Nt.scale(i,u,c*o):Nt.scale(i,u,-f*o))}}return s},r.prototype._getProjMinMaxOnAxis=function(e,t,i){for(var n=this._axes[e],a=this._origin,o=t[0].dot(n)+a[e],s=o,l=o,u=1;u<t.length;u++){var c=t[u].dot(n)+a[e];s=Math.min(c,s),l=Math.max(c,l)}i[0]=s,i[1]=l},r}(),ev=Uce;var Oce=[],Fce=function(r){Xt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.notClear=!0,t.incremental=!0,t._displayables=[],t._temporaryDisplayables=[],t._cursor=0,t}return e.prototype.traverse=function(t,i){t.call(i,this)},e.prototype.useStyle=function(){this.style={}},e.prototype.getCursor=function(){return this._cursor},e.prototype.innerAfterBrush=function(){this._cursor=this._displayables.length},e.prototype.clearDisplaybles=function(){this._displayables=[],this._temporaryDisplayables=[],this._cursor=0,this.markRedraw(),this.notClear=!1},e.prototype.clearTemporalDisplayables=function(){this._temporaryDisplayables=[]},e.prototype.addDisplayable=function(t,i){i?this._temporaryDisplayables.push(t):this._displayables.push(t),this.markRedraw()},e.prototype.addDisplayables=function(t,i){i=i||!1;for(var n=0;n<t.length;n++)this.addDisplayable(t[n],i)},e.prototype.getDisplayables=function(){return this._displayables},e.prototype.getTemporalDisplayables=function(){return this._temporaryDisplayables},e.prototype.eachPendingDisplayable=function(t){for(var i=this._cursor;i<this._displayables.length;i++)t&&t(this._displayables[i]);for(var i=0;i<this._temporaryDisplayables.length;i++)t&&t(this._temporaryDisplayables[i])},e.prototype.update=function(){this.updateTransform();for(var t=this._cursor;t<this._displayables.length;t++){var i=this._displayables[t];i.parent=this,i.update(),i.parent=null}for(var t=0;t<this._temporaryDisplayables.length;t++){var i=this._temporaryDisplayables[t];i.parent=this,i.update(),i.parent=null}},e.prototype.getBoundingRect=function(){if(!this._rect){for(var t=new lt(1/0,1/0,-1/0,-1/0),i=0;i<this._displayables.length;i++){var n=this._displayables[i],a=n.getBoundingRect().clone();n.needLocalTransform()&&a.applyTransform(n.getLocalTransform(Oce)),t.union(a)}this._rect=t}return this._rect},e.prototype.contain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect();if(a.contain(n[0],n[1]))for(var o=0;o<this._displayables.length;o++){var s=this._displayables[o];if(s.contain(t,i))return!0}return!1},e}(gi),V4=Fce;var H4=vt();function Bl(r,e,t,i,n){var a;if(e&&e.ecModel){var o=e.ecModel.getUpdatePayload();a=o&&o.animation}var s=e&&e.isAnimationEnabled(),l=r==="update";if(s){var u=void 0,c=void 0,f=void 0;i?(u=ft(i.duration,200),c=ft(i.easing,"cubicOut"),f=0):(u=e.getShallow(l?"animationDurationUpdate":"animationDuration"),c=e.getShallow(l?"animationEasingUpdate":"animationEasing"),f=e.getShallow(l?"animationDelayUpdate":"animationDelay")),a&&(a.duration!=null&&(u=a.duration),a.easing!=null&&(c=a.easing),a.delay!=null&&(f=a.delay)),He(f)&&(f=f(t,n)),He(u)&&(u=u(t));var h={duration:u||0,delay:f,easing:c};return h}else return null}function LP(r,e,t,i,n,a,o){var s=!1,l;He(n)?(o=a,a=n,n=null):qe(n)&&(a=n.cb,o=n.during,s=n.isFrom,l=n.removeOpt,n=n.dataIndex);var u=r==="leave";u||e.stopAnimation("leave");var c=Bl(r,i,n,u?l||{}:null,i&&i.getAnimationDelayParams?i.getAnimationDelayParams(e,n):null);if(c&&c.duration>0){var f=c.duration,h=c.delay,p=c.easing,d={duration:f,delay:h||0,easing:p,done:a,force:!!a||!!o,setToFinal:!u,scope:r,during:o};s?e.animateFrom(t,d):e.animateTo(t,d)}else e.stopAnimation(),!s&&e.attr(t),o&&o(1),a&&a()}function Dt(r,e,t,i,n,a){LP("update",r,e,t,i,n,a)}function ar(r,e,t,i,n,a){LP("enter",r,e,t,i,n,a)}function Au(r){if(!r.__zr)return!0;for(var e=0;e<r.animators.length;e++){var t=r.animators[e];if(t.scope==="leave")return!0}return!1}function es(r,e,t,i,n,a){Au(r)||LP("leave",r,e,t,i,n,a)}function G4(r,e,t,i){r.removeTextContent(),r.removeTextGuideLine(),es(r,{style:{opacity:0}},e,t,i)}function Cu(r,e,t){function i(){r.parent&&r.parent.remove(r)}r.isGroup?r.traverse(function(n){n.isGroup||G4(n,e,t,i)}):G4(r,e,t,i)}function Ii(r){H4(r).oldStyle=r.style}function W4(r){return H4(r).oldStyle}var pw=Math.max,dw=Math.min,DP={};function zce(r){return ut.extend(r)}var Bce=T4;function kce(r,e){return Bce(r,e)}function Bs(r,e){DP[r]=e}function x_(r){if(DP.hasOwnProperty(r))return DP[r]}function tv(r,e,t,i){var n=ow(r,e);return t&&(i==="center"&&(t=q4(t,n.getBoundingRect())),Z4(n,t)),n}function IP(r,e,t){var i=new Ur({style:{image:r,x:e.x,y:e.y,width:e.width,height:e.height},onload:function(n){if(t==="center"){var a={width:n.width,height:n.height};i.setStyle(q4(e,a))}}});return i}function q4(r,e){var t=e.width/e.height,i=r.height*t,n;i<=r.width?n=r.height:(i=r.width,n=i/t);var a=r.x+r.width/2,o=r.y+r.height/2;return{x:a-i/2,y:o-n/2,width:i,height:n}}var Gn=E4;function Z4(r,e){if(r.applyTransform){var t=r.getBoundingRect(),i=t.calculateTransform(e);r.applyTransform(i)}}function Ru(r,e){return jb(r,r,{lineWidth:e}),r}function Vce(r){return Kb(r.shape,r.shape,r.style),r}var S_=Mf;function ks(r,e){for(var t=uf([]);r&&r!==e;)Aa(t,r.getLocalTransform(),t),r=r.parent;return t}function wn(r,e,t){return e&&!ci(e)&&(e=Ra.getLocalTransform(e)),t&&(e=Yo([],e)),fi([],r,e)}function Up(r,e,t){var i=e[4]===0||e[5]===0||e[0]===0?1:Math.abs(2*e[4]/e[0]),n=e[4]===0||e[5]===0||e[2]===0?1:Math.abs(2*e[4]/e[2]),a=[r==="left"?-i:r==="right"?i:0,r==="top"?-n:r==="bottom"?n:0];return a=wn(a,e,t),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function X4(r){return!r.isGroup}function Gce(r){return r.shape!=null}function Lu(r,e,t){if(!r||!e)return;function i(o){var s={};return o.traverse(function(l){X4(l)&&l.anid&&(s[l.anid]=l)}),s}function n(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Gce(o)&&(s.shape=fe({},o.shape)),s}var a=i(r);e.traverse(function(o){if(X4(o)&&o.anid){var s=a[o.anid];if(s){var l=n(o);o.attr(n(s)),Dt(o,l,t,rt(o).dataIndex)}}})}function NP(r,e){return de(r,function(t){var i=t[0];i=pw(i,e.x),i=dw(i,e.x+e.width);var n=t[1];return n=pw(n,e.y),n=dw(n,e.y+e.height),[i,n]})}function Hce(r,e){var t=pw(r.x,e.x),i=dw(r.x+r.width,e.x+e.width),n=pw(r.y,e.y),a=dw(r.y+r.height,e.y+e.height);if(i>=t&&a>=n)return{x:t,y:n,width:i-t,height:a-n}}function Pu(r,e,t){var i=fe({rectHover:!0},e),n=i.style={strokeNoScale:!0};if(t=t||{x:-1,y:-1,width:2,height:2},r)return r.indexOf("image://")===0?(n.image=r.slice(8),Ye(n,t),new Ur(i)):tv(r.replace("path://",""),i,t,"center")}function rv(r,e,t,i,n){for(var a=0,o=n[n.length-1];a<n.length;a++){var s=n[a];if(j4(r,e,t,i,s[0],s[1],o[0],o[1]))return!0;o=s}}function j4(r,e,t,i,n,a,o,s){var l=t-r,u=i-e,c=o-n,f=s-a,h=PP(c,f,l,u);if(Wce(h))return!1;var p=r-n,d=e-a,g=PP(p,d,l,u)/h;if(g<0||g>1)return!1;var m=PP(p,d,c,f)/h;return!(m<0||m>1)}function PP(r,e,t,i){return r*i-t*e}function Wce(r){return r<=1e-6&&r>=-1e-6}function Vs(r){var e=r.itemTooltipOption,t=r.componentModel,i=r.itemName,n=Ce(e)?{formatter:e}:e,a=t.mainType,o=t.componentIndex,s={componentType:a,name:i,$vars:["name"]};s[a+"Index"]=o;var l=r.formatterParamsExtra;l&&N(bt(l),function(c){tt(s,c)||(s[c]=l[c],s.$vars.push(c))});var u=rt(r.el);u.componentMainType=a,u.componentIndex=o,u.tooltipConfig={name:i,option:Ye({content:i,formatterParams:s},n)}}function Y4(r,e){var t;r.isGroup&&(t=e(r)),t||r.traverse(e)}function sa(r,e){if(r)if(pe(r))for(var t=0;t<r.length;t++)Y4(r[t],e);else Y4(r,e)}Bs("circle",oa);Bs("ellipse",v_);Bs("sector",yi);Bs("ring",Pp);Bs("polygon",ei);Bs("polyline",$r);Bs("rect",Tt);Bs("line",Kr);Bs("bezierCurve",Dp);Bs("arc",__);var mw={};function e5(r,e){for(var t=0;t<Bi.length;t++){var i=Bi[t],n=e[i],a=r.ensureState(i);a.style=a.style||{},a.style.text=n}var o=r.currentStates.slice();r.clearStates(!0),r.setStyle({text:e.normal}),r.useStates(o,!0)}function UP(r,e,t){var i=r.labelFetcher,n=r.labelDataIndex,a=r.labelDimIndex,o=e.normal,s;i&&(s=i.getFormattedLabel(n,"normal",null,a,o&&o.get("formatter"),t!=null?{interpolatedValue:t}:null)),s==null&&(s=He(r.defaultText)?r.defaultText(n,r,t):r.defaultText);for(var l={normal:s},u=0;u<Bi.length;u++){var c=Bi[u],f=e[c];l[c]=ft(i?i.getFormattedLabel(n,c,null,a,f&&f.get("formatter")):null,s)}return l}function Nr(r,e,t,i){t=t||mw;for(var n=r instanceof Lt,a=!1,o=0;o<bf.length;o++){var s=e[bf[o]];if(s&&s.getShallow("show")){a=!0;break}}var l=n?r:r.getTextContent();if(a){n||(l||(l=new Lt,r.setTextContent(l)),r.stateProxy&&(l.stateProxy=r.stateProxy));var u=UP(t,e),c=e.normal,f=!!c.getShallow("show"),h=fr(c,i&&i.normal,t,!1,!n);h.text=u.normal,n||r.setTextConfig(M_(c,t,!1));for(var o=0;o<Bi.length;o++){var p=Bi[o],s=e[p];if(s){var d=l.ensureState(p),g=!!ft(s.getShallow("show"),f);if(g!==f&&(d.ignore=!g),d.style=fr(s,i&&i[p],t,!0,!n),d.style.text=u[p],!n){var m=r.ensureState(p);m.textConfig=M_(s,t,!0)}}}l.silent=!!c.getShallow("silent"),l.style.x!=null&&(h.x=l.style.x),l.style.y!=null&&(h.y=l.style.y),l.ignore=!f,l.useStyle(h),l.dirty(),t.enableTextSetter&&(Du(l).setLabelText=function(v){var _=UP(t,e,v);e5(l,_)})}else l&&(l.ignore=!0);r.dirty()}function Tr(r,e){e=e||"label";for(var t={normal:r.getModel(e)},i=0;i<Bi.length;i++){var n=Bi[i];t[n]=r.getModel([n,e])}return t}function fr(r,e,t,i,n){var a={};return Xce(a,r,t,i,n),e&&fe(a,e),a}function M_(r,e,t){e=e||{};var i={},n,a=r.getShallow("rotate"),o=ft(r.getShallow("distance"),t?null:5),s=r.getShallow("offset");return n=r.getShallow("position")||(t?null:"inside"),n==="outside"&&(n=e.defaultOutsidePosition||"top"),n!=null&&(i.position=n),s!=null&&(i.offset=s),a!=null&&(a*=Math.PI/180,i.rotation=a),o!=null&&(i.distance=o),i.outsideFill=r.get("color")==="inherit"?e.inheritColor||null:"auto",i}function Xce(r,e,t,i,n){t=t||mw;var a=e.ecModel,o=a&&a.option.textStyle,s=Yce(e),l;if(s){l={};for(var u in s)if(s.hasOwnProperty(u)){var c=e.getModel(["rich",u]);Q4(l[u]={},c,o,t,i,n,!1,!0)}}l&&(r.rich=l);var f=e.get("overflow");f&&(r.overflow=f);var h=e.get("minMargin");h!=null&&(r.margin=h),Q4(r,e,o,t,i,n,!0,!1)}function Yce(r){for(var e;r&&r!==r.ecModel;){var t=(r.option||mw).rich;if(t){e=e||{};for(var i=bt(t),n=0;n<i.length;n++){var a=i[n];e[a]=1}}r=r.parentModel}return e}var K4=["fontStyle","fontWeight","fontSize","fontFamily","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY"],J4=["align","lineHeight","width","height","tag","verticalAlign","ellipsis"],$4=["padding","borderWidth","borderRadius","borderDashOffset","backgroundColor","borderColor","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];function Q4(r,e,t,i,n,a,o,s){t=!n&&t||mw;var l=i&&i.inheritColor,u=e.getShallow("color"),c=e.getShallow("textBorderColor"),f=ft(e.getShallow("opacity"),t.opacity);(u==="inherit"||u==="auto")&&(l?u=l:u=null),(c==="inherit"||c==="auto")&&(l?c=l:c=null),a||(u=u||t.color,c=c||t.textBorderColor),u!=null&&(r.fill=u),c!=null&&(r.stroke=c);var h=ft(e.getShallow("textBorderWidth"),t.textBorderWidth);h!=null&&(r.lineWidth=h);var p=ft(e.getShallow("textBorderType"),t.textBorderType);p!=null&&(r.lineDash=p);var d=ft(e.getShallow("textBorderDashOffset"),t.textBorderDashOffset);d!=null&&(r.lineDashOffset=d),!n&&f==null&&!s&&(f=i&&i.defaultOpacity),f!=null&&(r.opacity=f),!n&&!a&&r.fill==null&&i.inheritColor&&(r.fill=i.inheritColor);for(var g=0;g<K4.length;g++){var m=K4[g],v=ft(e.getShallow(m),t[m]);v!=null&&(r[m]=v)}for(var g=0;g<J4.length;g++){var m=J4[g],v=e.getShallow(m);v!=null&&(r[m]=v)}if(r.verticalAlign==null){var _=e.getShallow("baseline");_!=null&&(r.verticalAlign=_)}if(!o||!i.disableBox){for(var g=0;g<$4.length;g++){var m=$4[g],v=e.getShallow(m);v!=null&&(r[m]=v)}var y=e.getShallow("borderType");y!=null&&(r.borderDash=y),(r.backgroundColor==="auto"||r.backgroundColor==="inherit")&&l&&(r.backgroundColor=l),(r.borderColor==="auto"||r.borderColor==="inherit")&&l&&(r.borderColor=l)}}function iv(r,e){var t=e&&e.getModel("textStyle");return Yi([r.fontStyle||t&&t.getShallow("fontStyle")||"",r.fontWeight||t&&t.getShallow("fontWeight")||"",(r.fontSize||t&&t.getShallow("fontSize")||12)+"px",r.fontFamily||t&&t.getShallow("fontFamily")||"sans-serif"].join(" "))}var Du=vt();function vw(r,e,t,i){if(r){var n=Du(r);n.prevValue=n.value,n.value=t;var a=e.normal;n.valueAnimation=a.get("valueAnimation"),n.valueAnimation&&(n.precision=a.get("precision"),n.defaultInterpolatedText=i,n.statesModels=e)}}function gw(r,e,t,i,n){var a=Du(r);if(!a.valueAnimation||a.prevValue===a.value)return;var o=a.defaultInterpolatedText,s=ft(a.interpolatedValue,a.prevValue),l=a.value;function u(c){var f=Hb(t,a.precision,s,l,c);a.interpolatedValue=c===1?null:f;var h=UP({labelDataIndex:e,labelFetcher:n,defaultText:o?o(f):f+""},a.statesModels,f);e5(r,h)}r.percent=0,(a.prevValue==null?ar:Dt)(r,{percent:1},i,e,null,u)}var Zce=["textStyle","color"],OP=["fontStyle","fontWeight","fontSize","fontFamily","padding","lineHeight","rich","width","height","overflow"],FP=new Lt,jce=function(){function r(){}return r.prototype.getTextColor=function(e){var t=this.ecModel;return this.getShallow("color")||(!e&&t?t.get(Zce):null)},r.prototype.getFont=function(){return iv({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},r.prototype.getTextRect=function(e){for(var t={text:e,verticalAlign:this.getShallow("verticalAlign")||this.getShallow("baseline")},i=0;i<OP.length;i++)t[OP[i]]=this.getShallow(OP[i]);return FP.useStyle(t),FP.update(),FP.getBoundingRect()},r}(),t5=jce;var zP=[["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","type"],["lineDashOffset","dashOffset"],["lineCap","cap"],["lineJoin","join"],["miterLimit"]],Kce=Na(zP),r5=function(){function r(){}return r.prototype.getLineStyle=function(e){return Kce(this,e)},r}();var BP=[["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","borderType"],["lineDashOffset","borderDashOffset"],["lineCap","borderCap"],["lineJoin","borderJoin"],["miterLimit","borderMiterLimit"]],Jce=Na(BP),i5=function(){function r(){}return r.prototype.getItemStyle=function(e,t){return Jce(this,e,t)},r}();var Op=function(){function r(e,t,i){this.parentModel=t,this.ecModel=i,this.option=e}return r.prototype.init=function(e,t,i){for(var n=[],a=3;a<arguments.length;a++)n[a-3]=arguments[a]},r.prototype.mergeOption=function(e,t){_t(this.option,e,!0)},r.prototype.get=function(e,t){return e==null?this.option:this._doGet(this.parsePath(e),!t&&this.parentModel)},r.prototype.getShallow=function(e,t){var i=this.option,n=i==null?i:i[e];if(n==null&&!t){var a=this.parentModel;a&&(n=a.getShallow(e))}return n},r.prototype.getModel=function(e,t){var i=e!=null,n=i?this.parsePath(e):null,a=i?this._doGet(n):this.option;return t=t||this.parentModel&&this.parentModel.getModel(this.resolveParentPath(n)),new r(a,t,this.ecModel)},r.prototype.isEmpty=function(){return this.option==null},r.prototype.restoreData=function(){},r.prototype.clone=function(){var e=this.constructor;return new e(Qe(this.option))},r.prototype.parsePath=function(e){return typeof e=="string"?e.split("."):e},r.prototype.resolveParentPath=function(e){return e},r.prototype.isAnimationEnabled=function(){if(!Ft.node&&this.option){if(this.option.animation!=null)return!!this.option.animation;if(this.parentModel)return this.parentModel.isAnimationEnabled()}},r.prototype._doGet=function(e,t){var i=this.option;if(!e)return i;for(var n=0;n<e.length&&!(e[n]&&(i=i&&typeof i=="object"?i[e[n]]:null,i==null));n++);return i==null&&t&&(i=t._doGet(this.resolveParentPath(e),t.parentModel)),i},r}();Hm(Op);dH(Op);wr(Op,r5);wr(Op,i5);wr(Op,mH);wr(Op,t5);var Zt=Op;var $ce=Math.round(Math.random()*10);function ts(r){return[r||"",$ce++].join("_")}function n5(r){var e={};r.registerSubTypeDefaulter=function(t,i){var n=Ia(t);e[n.main]=i},r.determineSubType=function(t,i){var n=i.type;if(!n){var a=Ia(t).main;r.hasSubTypes(t)&&e[a]&&(n=e[a](i))}return n}}function a5(r,e){r.topologicalTravel=function(a,o,s,l){if(!a.length)return;var u=t(o),c=u.graph,f=u.noEntryList,h={};for(N(a,function(_){h[_]=!0});f.length;){var p=f.pop(),d=c[p],g=!!h[p];g&&(s.call(l,p,d.originalDeps.slice()),delete h[p]),N(d.successor,g?v:m)}N(h,function(){var _="";throw new Error(_)});function m(_){c[_].entryCount--,c[_].entryCount===0&&f.push(_)}function v(_){h[_]=!0,m(_)}};function t(a){var o={},s=[];return N(a,function(l){var u=i(o,l),c=u.originalDeps=e(l),f=n(c,a);u.entryCount=f.length,u.entryCount===0&&s.push(l),N(f,function(h){dt(u.predecessor,h)<0&&u.predecessor.push(h);var p=i(o,h);dt(p.successor,h)<0&&p.successor.push(l)})}),{graph:o,noEntryList:s}}function i(a,o){return a[o]||(a[o]={predecessor:[],successor:[]}),a[o]}function n(a,o){var s=[];return N(a,function(l){dt(o,l)>=0&&s.push(l)}),s}}function Hn(r,e){return _t(_t({},r,!0),e,!0)}var o5={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}};var s5={time:{month:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],monthAbbr:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],dayOfWeek:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],dayOfWeekAbbr:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"]},legend:{selector:{all:"\u5168\u9009",inverse:"\u53CD\u9009"}},toolbox:{brush:{title:{rect:"\u77E9\u5F62\u9009\u62E9",polygon:"\u5708\u9009",lineX:"\u6A2A\u5411\u9009\u62E9",lineY:"\u7EB5\u5411\u9009\u62E9",keep:"\u4FDD\u6301\u9009\u62E9",clear:"\u6E05\u9664\u9009\u62E9"}},dataView:{title:"\u6570\u636E\u89C6\u56FE",lang:["\u6570\u636E\u89C6\u56FE","\u5173\u95ED","\u5237\u65B0"]},dataZoom:{title:{zoom:"\u533A\u57DF\u7F29\u653E",back:"\u533A\u57DF\u7F29\u653E\u8FD8\u539F"}},magicType:{title:{line:"\u5207\u6362\u4E3A\u6298\u7EBF\u56FE",bar:"\u5207\u6362\u4E3A\u67F1\u72B6\u56FE",stack:"\u5207\u6362\u4E3A\u5806\u53E0",tiled:"\u5207\u6362\u4E3A\u5E73\u94FA"}},restore:{title:"\u8FD8\u539F"},saveAsImage:{title:"\u4FDD\u5B58\u4E3A\u56FE\u7247",lang:["\u53F3\u952E\u53E6\u5B58\u4E3A\u56FE\u7247"]}},series:{typeNames:{pie:"\u997C\u56FE",bar:"\u67F1\u72B6\u56FE",line:"\u6298\u7EBF\u56FE",scatter:"\u6563\u70B9\u56FE",effectScatter:"\u6D9F\u6F2A\u6563\u70B9\u56FE",radar:"\u96F7\u8FBE\u56FE",tree:"\u6811\u56FE",treemap:"\u77E9\u5F62\u6811\u56FE",boxplot:"\u7BB1\u578B\u56FE",candlestick:"K\u7EBF\u56FE",k:"K\u7EBF\u56FE",heatmap:"\u70ED\u529B\u56FE",map:"\u5730\u56FE",parallel:"\u5E73\u884C\u5750\u6807\u56FE",lines:"\u7EBF\u56FE",graph:"\u5173\u7CFB\u56FE",sankey:"\u6851\u57FA\u56FE",funnel:"\u6F0F\u6597\u56FE",gauge:"\u4EEA\u8868\u76D8\u56FE",pictorialBar:"\u8C61\u5F62\u67F1\u56FE",themeRiver:"\u4E3B\u9898\u6CB3\u6D41\u56FE",sunburst:"\u65ED\u65E5\u56FE",custom:"\u81EA\u5B9A\u4E49\u56FE\u8868",chart:"\u56FE\u8868"}},aria:{general:{withTitle:"\u8FD9\u662F\u4E00\u4E2A\u5173\u4E8E\u201C{title}\u201D\u7684\u56FE\u8868\u3002",withoutTitle:"\u8FD9\u662F\u4E00\u4E2A\u56FE\u8868\uFF0C"},series:{single:{prefix:"",withName:"\u56FE\u8868\u7C7B\u578B\u662F{seriesType}\uFF0C\u8868\u793A{seriesName}\u3002",withoutName:"\u56FE\u8868\u7C7B\u578B\u662F{seriesType}\u3002"},multiple:{prefix:"\u5B83\u7531{seriesCount}\u4E2A\u56FE\u8868\u7CFB\u5217\u7EC4\u6210\u3002",withName:"\u7B2C{seriesId}\u4E2A\u7CFB\u5217\u662F\u4E00\u4E2A\u8868\u793A{seriesName}\u7684{seriesType}\uFF0C",withoutName:"\u7B2C{seriesId}\u4E2A\u7CFB\u5217\u662F\u4E00\u4E2A{seriesType}\uFF0C",separator:{middle:"\uFF1B",end:"\u3002"}}},data:{allData:"\u5176\u6570\u636E\u662F\u2014\u2014",partialData:"\u5176\u4E2D\uFF0C\u524D{displayCnt}\u9879\u662F\u2014\u2014",withName:"{name}\u7684\u6570\u636E\u662F{value}",withoutName:"{value}",separator:{middle:"\uFF0C",end:""}}}};var _w="ZH",VP="EN",nv=VP,yw={},GP={},xw=Ft.domSupported?function(){var r=(document.documentElement.lang||navigator.language||navigator.browserLanguage||nv).toUpperCase();return r.indexOf(_w)>-1?_w:nv}():nv;function l5(r,e){r=r.toUpperCase(),GP[r]=new Zt(e),yw[r]=e}function u5(r){if(Ce(r)){var e=yw[r.toUpperCase()]||{};return r===_w||r===VP?Qe(e):_t(Qe(e),Qe(yw[nv]),!1)}else return _t(Qe(r),Qe(yw[nv]),!1)}function b_(r){return GP[r]}function c5(){return GP[nv]}l5(VP,o5);l5(_w,s5);var Mw=1e3,bw=Mw*60,ov=bw*60,_o=ov*24,WP=_o*365,w_={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},Sw="{yyyy}-{MM}-{dd}",XP={year:"{yyyy}",month:"{yyyy}-{MM}",day:Sw,hour:Sw+" "+w_.hour,minute:Sw+" "+w_.minute,second:Sw+" "+w_.second,millisecond:w_.none},HP=["year","month","day","hour","minute","second","millisecond"],YP=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Iu(r,e){return r+="","0000".substr(0,e-r.length)+r}function zp(r){switch(r){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return r}}function f5(r){return r===zp(r)}function h5(r){switch(r){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Bp(r,e,t,i){var n=Mn(r),a=n[ww(t)](),o=n[Fp(t)]()+1,s=Math.floor((o-1)/3)+1,l=n[T_(t)](),u=n["get"+(t?"UTC":"")+"Day"](),c=n[av(t)](),f=(c-1)%12+1,h=n[E_(t)](),p=n[A_(t)](),d=n[C_(t)](),g=i instanceof Zt?i:b_(i||xw)||c5(),m=g.getModel("time"),v=m.get("month"),_=m.get("monthAbbr"),y=m.get("dayOfWeek"),x=m.get("dayOfWeekAbbr");return(e||"").replace(/{yyyy}/g,a+"").replace(/{yy}/g,Iu(a%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,v[o-1]).replace(/{MMM}/g,_[o-1]).replace(/{MM}/g,Iu(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Iu(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,y[u]).replace(/{ee}/g,x[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Iu(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,Iu(f+"",2)).replace(/{h}/g,f+"").replace(/{mm}/g,Iu(h,2)).replace(/{m}/g,h+"").replace(/{ss}/g,Iu(p,2)).replace(/{s}/g,p+"").replace(/{SSS}/g,Iu(d,3)).replace(/{S}/g,d+"")}function p5(r,e,t,i,n){var a=null;if(Ce(t))a=t;else if(He(t))a=t(r.value,e,{level:r.level});else{var o=fe({},w_);if(r.level>0)for(var s=0;s<HP.length;++s)o[HP[s]]="{primary|"+o[HP[s]]+"}";var l=t?t.inherit===!1?t:Ye(t,o):o,u=d5(r.value,n);if(l[u])a=l[u];else if(l.inherit){for(var c=YP.indexOf(u),s=c-1;s>=0;--s)if(l[u]){a=l[u];break}a=a||o.none}if(pe(a)){var f=r.level==null?0:r.level>=0?r.level:a.length+r.level;f=Math.min(f,a.length-1),a=a[f]}}return Bp(new Date(r.value),a,n,i)}function d5(r,e){var t=Mn(r),i=t[Fp(e)]()+1,n=t[T_(e)](),a=t[av(e)](),o=t[E_(e)](),s=t[A_(e)](),l=t[C_(e)](),u=l===0,c=u&&s===0,f=c&&o===0,h=f&&a===0,p=h&&n===1,d=p&&i===1;return d?"year":p?"month":h?"day":f?"hour":c?"minute":u?"second":"millisecond"}function qP(r,e,t){var i=At(r)?Mn(r):r;switch(e=e||d5(r,t),e){case"year":return i[ww(t)]();case"half-year":return i[Fp(t)]()>=6?1:0;case"quarter":return Math.floor((i[Fp(t)]()+1)/4);case"month":return i[Fp(t)]();case"day":return i[T_(t)]();case"half-day":return i[av(t)]()/24;case"hour":return i[av(t)]();case"minute":return i[E_(t)]();case"second":return i[A_(t)]();case"millisecond":return i[C_(t)]()}}function ww(r){return r?"getUTCFullYear":"getFullYear"}function Fp(r){return r?"getUTCMonth":"getMonth"}function T_(r){return r?"getUTCDate":"getDate"}function av(r){return r?"getUTCHours":"getHours"}function E_(r){return r?"getUTCMinutes":"getMinutes"}function A_(r){return r?"getUTCSeconds":"getSeconds"}function C_(r){return r?"getUTCMilliseconds":"getMilliseconds"}function m5(r){return r?"setUTCFullYear":"setFullYear"}function ZP(r){return r?"setUTCMonth":"setMonth"}function jP(r){return r?"setUTCDate":"setDate"}function KP(r){return r?"setUTCHours":"setHours"}function JP(r){return r?"setUTCMinutes":"setMinutes"}function $P(r){return r?"setUTCSeconds":"setSeconds"}function QP(r){return r?"setUTCMilliseconds":"setMilliseconds"}function tD(r){if(!yp(r))return Ce(r)?r:"-";var e=(r+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function Tw(r,e){return r=(r||"").toLowerCase().replace(/-(.)/g,function(t,i){return i.toUpperCase()}),e&&r&&(r=r.charAt(0).toUpperCase()+r.slice(1)),r}var Gs=Mm;function Ew(r,e,t){var i="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function n(c){return c&&Yi(c)?c:"-"}function a(c){return!!(c!=null&&!isNaN(c)&&isFinite(c))}var o=e==="time",s=r instanceof Date;if(o||s){var l=o?Mn(r):r;if(isNaN(+l)){if(s)return"-"}else return Bp(l,i,t)}if(e==="ordinal")return I0(r)?n(r):At(r)&&a(r)?r+"":"-";var u=Pa(r);return a(u)?tD(u):I0(r)?n(r):typeof r=="boolean"?r+"":"-"}var v5=["a","b","c","d","e","f","g"],eD=function(r,e){return"{"+r+(e??"")+"}"};function Aw(r,e,t){pe(e)||(e=[e]);var i=e.length;if(!i)return"";for(var n=e[0].$vars||[],a=0;a<n.length;a++){var o=v5[a];r=r.replace(eD(o),eD(o,0))}for(var s=0;s<i;s++)for(var l=0;l<n.length;l++){var u=e[s][n[l]];r=r.replace(eD(v5[l],s),t?yn(u):u)}return r}function g5(r,e,t){return N(e,function(i,n){r=r.replace("{"+n+"}",t?yn(i):i)}),r}function y5(r,e){var t=Ce(r)?{color:r,extraCssText:e}:r||{},i=t.color,n=t.type;e=t.extraCssText;var a=t.renderMode||"html";if(!i)return"";if(a==="html")return n==="subItem"?'<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;border-radius:4px;width:4px;height:4px;background-color:'+yn(i)+";"+(e||"")+'"></span>':'<span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:'+yn(i)+";"+(e||"")+'"></span>';var o=t.markerId||"markerX";return{renderMode:a,content:"{"+o+"|} ",style:n==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}}function Hs(r,e){return e=e||"transparent",Ce(r)?r:qe(r)&&r.colorStops&&(r.colorStops[0]||{}).color||e}function kp(r,e){if(e==="_blank"||e==="blank"){var t=window.open();t.opener=null,t.location.href=r}else window.open(r,e)}var Cw=N,rD=["left","right","top","bottom","width","height"],Vp=[["width","left","right"],["height","top","bottom"]];function iD(r,e,t,i,n){var a=0,o=0;i==null&&(i=1/0),n==null&&(n=1/0);var s=0;e.eachChild(function(l,u){var c=l.getBoundingRect(),f=e.childAt(u+1),h=f&&f.getBoundingRect(),p,d;if(r==="horizontal"){var g=c.width+(h?-h.x+c.x:0);p=a+g,p>i||l.newline?(a=0,p=g,o+=s+t,s=c.height):s=Math.max(s,c.height)}else{var m=c.height+(h?-h.y+c.y:0);d=o+m,d>n||l.newline?(a+=s+t,o=0,d=m,s=c.width):s=Math.max(s,c.width)}l.newline||(l.x=a,l.y=o,l.markRedraw(),r==="horizontal"?a=p+t:o=d+t)})}var Ws=iD,yVe=ot(iD,"vertical"),_Ve=ot(iD,"horizontal");function _5(r,e,t){var i=e.width,n=e.height,a=Fe(r.left,i),o=Fe(r.top,n),s=Fe(r.right,i),l=Fe(r.bottom,n);return(isNaN(a)||isNaN(parseFloat(r.left)))&&(a=0),(isNaN(s)||isNaN(parseFloat(r.right)))&&(s=i),(isNaN(o)||isNaN(parseFloat(r.top)))&&(o=0),(isNaN(l)||isNaN(parseFloat(r.bottom)))&&(l=n),t=Gs(t||0),{width:Math.max(s-a-t[1]-t[3],0),height:Math.max(l-o-t[0]-t[2],0)}}function xr(r,e,t){t=Gs(t||0);var i=e.width,n=e.height,a=Fe(r.left,i),o=Fe(r.top,n),s=Fe(r.right,i),l=Fe(r.bottom,n),u=Fe(r.width,i),c=Fe(r.height,n),f=t[2]+t[0],h=t[1]+t[3],p=r.aspect;switch(isNaN(u)&&(u=i-s-h-a),isNaN(c)&&(c=n-l-f-o),p!=null&&(isNaN(u)&&isNaN(c)&&(p>i/n?u=i*.8:c=n*.8),isNaN(u)&&(u=p*c),isNaN(c)&&(c=u/p)),isNaN(a)&&(a=i-s-u-h),isNaN(o)&&(o=n-l-c-f),r.left||r.right){case"center":a=i/2-u/2-t[3];break;case"right":a=i-u-h;break}switch(r.top||r.bottom){case"middle":case"center":o=n/2-c/2-t[0];break;case"bottom":o=n-c-f;break}a=a||0,o=o||0,isNaN(u)&&(u=i-h-a-(s||0)),isNaN(c)&&(c=n-f-o-(l||0));var d=new lt(a+t[3],o+t[0],u,c);return d.margin=t,d}function Ef(r,e,t,i,n,a){var o=!n||!n.hv||n.hv[0],s=!n||!n.hv||n.hv[1],l=n&&n.boundingMode||"all";if(a=a||r,a.x=r.x,a.y=r.y,!o&&!s)return!1;var u;if(l==="raw")u=r.type==="group"?new lt(0,0,+e.width||0,+e.height||0):r.getBoundingRect();else if(u=r.getBoundingRect(),r.needLocalTransform()){var c=r.getLocalTransform();u=u.clone(),u.applyTransform(c)}var f=xr(Ye({width:u.width,height:u.height},e),t,i),h=o?f.x-u.x:0,p=s?f.y-u.y:0;return l==="raw"?(a.x=h,a.y=p):(a.x+=h,a.y+=p),a===r&&r.markRedraw(),!0}function x5(r,e){return r[Vp[e][0]]!=null||r[Vp[e][1]]!=null&&r[Vp[e][2]]!=null}function Af(r){var e=r.layoutMode||r.constructor.layoutMode;return qe(e)?e:e?{type:e}:null}function za(r,e,t){var i=t&&t.ignoreSize;!pe(i)&&(i=[i,i]);var n=o(Vp[0],0),a=o(Vp[1],1);u(Vp[0],r,n),u(Vp[1],r,a);function o(c,f){var h={},p=0,d={},g=0,m=2;if(Cw(c,function(y){d[y]=r[y]}),Cw(c,function(y){s(e,y)&&(h[y]=d[y]=e[y]),l(h,y)&&p++,l(d,y)&&g++}),i[f])return l(e,c[1])?d[c[2]]=null:l(e,c[2])&&(d[c[1]]=null),d;if(g===m||!p)return d;if(p>=m)return h;for(var v=0;v<c.length;v++){var _=c[v];if(!s(h,_)&&s(r,_)){h[_]=r[_];break}}return h}function s(c,f){return c.hasOwnProperty(f)}function l(c,f){return c[f]!=null&&c[f]!=="auto"}function u(c,f,h){Cw(c,function(p){f[p]=h[p]})}}function rs(r){return nD({},r)}function nD(r,e){return e&&r&&Cw(rD,function(t){e.hasOwnProperty(t)&&(r[t]=e[t])}),r}var Qce=vt(),sv=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t,i,n)||this;return a.uid=ts("ec_cpt_model"),a}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n)},e.prototype.mergeDefaultAndTheme=function(t,i){var n=Af(this),a=n?rs(t):{},o=i.getTheme();_t(t,o.get(this.mainType)),_t(t,this.getDefaultOption()),n&&za(t,a,n)},e.prototype.mergeOption=function(t,i){_t(this.option,t,!0);var n=Af(this);n&&za(this.option,t,n)},e.prototype.optionUpdated=function(t,i){},e.prototype.getDefaultOption=function(){var t=this.constructor;if(!pH(t))return t.defaultOption;var i=Qce(this);if(!i.defaultOption){for(var n=[],a=t;a;){var o=a.prototype.defaultOption;o&&n.push(o),a=a.superClass}for(var s={},l=n.length-1;l>=0;l--)s=_t(s,n[l],!0);i.defaultOption=s}return i.defaultOption},e.prototype.getReferringComponents=function(t,i){var n=t+"Index",a=t+"Id";return gf(this.ecModel,t,{index:this.get(n,!0),id:this.get(a,!0)},i)},e.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=function(){var t=e.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),e}(Zt);Wb(sv,Zt);yf(sv);n5(sv);a5(sv,efe);function efe(r){var e=[];return N(sv.getClassesByMainType(r),function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])}),e=de(e,function(t){return Ia(t).main}),r!=="dataset"&&dt(e,"dataset")<=0&&e.unshift("dataset"),e}var Pt=sv;var S5="";typeof navigator<"u"&&(S5=navigator.platform||"");var lv="rgba(0, 0, 0, 0.2)",M5={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:lv,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:lv,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:lv,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:lv,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:lv,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:lv,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:S5.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var Rw=ke(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),fn="original",Ei="arrayRows",En="objectRows",xo="keyedColumns",So="typedArray",aD="unknown",Ba="column",Nu="row";var Ji={Must:1,Might:2,Not:3},b5=vt();function w5(r){b5(r).datasetMap=ke()}function Lw(r,e,t){var i={},n=Pw(e);if(!n||!r)return i;var a=[],o=[],s=e.ecModel,l=b5(s).datasetMap,u=n.uid+"_"+t.seriesLayoutBy,c,f;r=r.slice(),N(r,function(g,m){var v=qe(g)?g:r[m]={name:g};v.type==="ordinal"&&c==null&&(c=m,f=d(v)),i[v.name]=[]});var h=l.get(u)||l.set(u,{categoryWayDim:f,valueWayDim:0});N(r,function(g,m){var v=g.name,_=d(g);if(c==null){var y=h.valueWayDim;p(i[v],y,_),p(o,y,_),h.valueWayDim+=_}else if(c===m)p(i[v],0,_),p(a,0,_);else{var y=h.categoryWayDim;p(i[v],y,_),p(o,y,_),h.categoryWayDim+=_}});function p(g,m,v){for(var _=0;_<v;_++)g.push(m+_)}function d(g){var m=g.dimsDef;return m?m.length:1}return a.length&&(i.itemName=a),o.length&&(i.seriesName=o),i}function uv(r,e,t){var i={},n=Pw(r);if(!n)return i;var a=e.sourceFormat,o=e.dimensionsDefine,s;(a===En||a===xo)&&N(o,function(c,f){(qe(c)?c.name:c)==="name"&&(s=f)});var l=function(){for(var c={},f={},h=[],p=0,d=Math.min(5,t);p<d;p++){var g=E5(e.data,a,e.seriesLayoutBy,o,e.startIndex,p);h.push(g);var m=g===Ji.Not;if(m&&c.v==null&&p!==s&&(c.v=p),(c.n==null||c.n===c.v||!m&&h[c.n]===Ji.Not)&&(c.n=p),v(c)&&h[c.n]!==Ji.Not)return c;m||(g===Ji.Might&&f.v==null&&p!==s&&(f.v=p),(f.n==null||f.n===f.v)&&(f.n=p))}function v(_){return _.v!=null&&_.n!=null}return v(c)?c:v(f)?f:null}();if(l){i.value=[l.v];var u=s??l.n;i.itemName=[u],i.seriesName=[u]}return i}function Pw(r){var e=r.get("data",!0);if(!e)return gf(r.ecModel,"dataset",{index:r.get("datasetIndex",!0),id:r.get("datasetId",!0)},Cr).models[0]}function T5(r){return!r.get("transform",!0)&&!r.get("fromTransformResult",!0)?[]:gf(r.ecModel,"dataset",{index:r.get("fromDatasetIndex",!0),id:r.get("fromDatasetId",!0)},Cr).models}function Dw(r,e){return E5(r.data,r.sourceFormat,r.seriesLayoutBy,r.dimensionsDefine,r.startIndex,e)}function E5(r,e,t,i,n,a){var o,s=5;if(bi(r))return Ji.Not;var l,u;if(i){var c=i[a];qe(c)?(l=c.name,u=c.type):Ce(c)&&(l=c)}if(u!=null)return u==="ordinal"?Ji.Must:Ji.Not;if(e===Ei){var f=r;if(t===Nu){for(var h=f[a],p=0;p<(h||[]).length&&p<s;p++)if((o=x(h[n+p]))!=null)return o}else for(var p=0;p<f.length&&p<s;p++){var d=f[n+p];if(d&&(o=x(d[a]))!=null)return o}}else if(e===En){var g=r;if(!l)return Ji.Not;for(var p=0;p<g.length&&p<s;p++){var m=g[p];if(m&&(o=x(m[l]))!=null)return o}}else if(e===xo){var v=r;if(!l)return Ji.Not;var h=v[l];if(!h||bi(h))return Ji.Not;for(var p=0;p<h.length&&p<s;p++)if((o=x(h[p]))!=null)return o}else if(e===fn)for(var _=r,p=0;p<_.length&&p<s;p++){var m=_[p],y=Os(m);if(!pe(y))return Ji.Not;if((o=x(y[a]))!=null)return o}function x(M){var S=Ce(M);if(M!=null&&isFinite(M)&&M!=="")return S?Ji.Might:Ji.Not;if(S&&M!=="-")return Ji.Must}return Ji.Not}var oD=ke();function A5(r,e){kr(oD.get(r)==null&&e),oD.set(r,e)}function C5(r,e,t){var i=oD.get(e);if(!i)return t;var n=i(r);if(!n)return t;if(0)for(var a;a<n.length;a++);return t.concat(n)}var R5=vt(),tfe=vt(),L_=function(){function r(){}return r.prototype.getColorFromPalette=function(e,t,i){var n=Jt(this.get("color",!0)),a=this.get("colorLayer",!0);return L5(this,R5,n,a,e,t,i)},r.prototype.clearColorPalette=function(){ife(this,R5)},r}();function P_(r,e,t,i){var n=Jt(r.get(["aria","decal","decals"]));return L5(r,tfe,n,null,e,t,i)}function rfe(r,e){for(var t=r.length,i=0;i<t;i++)if(r[i].length>e)return r[i];return r[t-1]}function L5(r,e,t,i,n,a,o){a=a||r;var s=e(a),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(n))return u[n];var c=o==null||!i?t:rfe(i,o);if(c=c||t,!(!c||!c.length)){var f=c[l];return n&&(u[n]=f),s.paletteIdx=(l+1)%c.length,f}}function ife(r,e){e(r).paletteIdx=0,e(r).paletteNameMap={}}var Iw,D_,P5,D5="\0_ec_inner",nfe=1;var O5=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.init=function(t,i,n,a,o,s){a=a||{},this.option=null,this._theme=new Zt(a),this._locale=new Zt(o),this._optionManager=s},e.prototype.setOption=function(t,i,n){var a=U5(i);this._optionManager.setOption(t,n,a),this._resetOption(null,a)},e.prototype.resetOption=function(t,i){return this._resetOption(t,U5(i))},e.prototype._resetOption=function(t,i){var n=!1,a=this._optionManager;if(!t||t==="recreate"){var o=a.mountOption(t==="recreate");!this.option||t==="recreate"?P5(this,o):(this.restoreData(),this._mergeOption(o,i)),n=!0}if((t==="timeline"||t==="media")&&this.restoreData(),!t||t==="recreate"||t==="timeline"){var s=a.getTimelineOption(this);s&&(n=!0,this._mergeOption(s,i))}if(!t||t==="recreate"||t==="media"){var l=a.getMediaOption(this);l.length&&N(l,function(u){n=!0,this._mergeOption(u,i)},this)}return n},e.prototype.mergeOption=function(t){this._mergeOption(t,null)},e.prototype._mergeOption=function(t,i){var n=this.option,a=this._componentsMap,o=this._componentsCount,s=[],l=ke(),u=i&&i.replaceMergeMainTypeMap;w5(this),N(t,function(f,h){f!=null&&(Pt.hasClass(h)?h&&(s.push(h),l.set(h,!0)):n[h]=n[h]==null?Qe(f):_t(n[h],f,!0))}),u&&u.each(function(f,h){Pt.hasClass(h)&&!l.get(h)&&(s.push(h),l.set(h,!0))}),Pt.topologicalTravel(s,Pt.getAllClassMainTypes(),c,this);function c(f){var h=C5(this,f,Jt(t[f])),p=a.get(f),d=p?u&&u.get(f)?"replaceMerge":"normalMerge":"replaceAll",g=Gb(p,h,d);sH(g,f,Pt),n[f]=null,a.set(f,null),o.set(f,0);var m=[],v=[],_=0,y,x;N(g,function(M,S){var w=M.existing,T=M.newOption;if(!T)w&&(w.mergeOption({},this),w.optionUpdated({},!1));else{var C=f==="series",b=Pt.getClass(f,M.keyInfo.subType,!C);if(!b){if(0)var E,I;return}if(f==="tooltip"){if(y)return;y=!0}if(w&&w.constructor===b)w.name=M.keyInfo.name,w.mergeOption(T,this),w.optionUpdated(T,!1);else{var R=fe({componentIndex:S},M.keyInfo);w=new b(T,this,this,R),fe(w,R),M.brandNew&&(w.__requireNewView=!0),w.init(T,this,this),w.optionUpdated(null,!0)}}w?(m.push(w.option),v.push(w),_++):(m.push(void 0),v.push(void 0))},this),n[f]=m,a.set(f,v),o.set(f,_),f==="series"&&Iw(this)}this._seriesIndices||Iw(this)},e.prototype.getOption=function(){var t=Qe(this.option);return N(t,function(i,n){if(Pt.hasClass(n)){for(var a=Jt(i),o=a.length,s=!1,l=o-1;l>=0;l--)a[l]&&!Vm(a[l])?s=!0:(a[l]=null,!s&&o--);a.length=o,t[n]=a}}),delete t[D5],t},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(t){this._payload=t},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(t,i){var n=this._componentsMap.get(t);if(n){var a=n[i||0];if(a)return a;if(i==null){for(var o=0;o<n.length;o++)if(n[o])return n[o]}}},e.prototype.queryComponents=function(t){var i=t.mainType;if(!i)return[];var n=t.index,a=t.id,o=t.name,s=this._componentsMap.get(i);if(!s||!s.length)return[];var l;return n!=null?(l=[],N(Jt(n),function(u){s[u]&&l.push(s[u])})):a!=null?l=I5("id",a,s):o!=null?l=I5("name",o,s):l=Wt(s,function(u){return!!u}),N5(l,t)},e.prototype.findComponents=function(t){var i=t.query,n=t.mainType,a=s(i),o=a?this.queryComponents(a):Wt(this._componentsMap.get(n),function(u){return!!u});return l(N5(o,t));function s(u){var c=n+"Index",f=n+"Id",h=n+"Name";return u&&(u[c]!=null||u[f]!=null||u[h]!=null)?{mainType:n,index:u[c],id:u[f],name:u[h]}:null}function l(u){return t.filter?Wt(u,t.filter):u}},e.prototype.eachComponent=function(t,i,n){var a=this._componentsMap;if(He(t)){var o=i,s=t;a.each(function(f,h){for(var p=0;f&&p<f.length;p++){var d=f[p];d&&s.call(o,h,d,d.componentIndex)}})}else for(var l=Ce(t)?a.get(t):qe(t)?this.findComponents(t):null,u=0;l&&u<l.length;u++){var c=l[u];c&&i.call(n,c,c.componentIndex)}},e.prototype.getSeriesByName=function(t){var i=Yr(t,null);return Wt(this._componentsMap.get("series"),function(n){return!!n&&i!=null&&n.name===i})},e.prototype.getSeriesByIndex=function(t){return this._componentsMap.get("series")[t]},e.prototype.getSeriesByType=function(t){return Wt(this._componentsMap.get("series"),function(i){return!!i&&i.subType===t})},e.prototype.getSeries=function(){return Wt(this._componentsMap.get("series"),function(t){return!!t})},e.prototype.getSeriesCount=function(){return this._componentsCount.get("series")},e.prototype.eachSeries=function(t,i){D_(this),N(this._seriesIndices,function(n){var a=this._componentsMap.get("series")[n];t.call(i,a,n)},this)},e.prototype.eachRawSeries=function(t,i){N(this._componentsMap.get("series"),function(n){n&&t.call(i,n,n.componentIndex)})},e.prototype.eachSeriesByType=function(t,i,n){D_(this),N(this._seriesIndices,function(a){var o=this._componentsMap.get("series")[a];o.subType===t&&i.call(n,o,a)},this)},e.prototype.eachRawSeriesByType=function(t,i,n){return N(this.getSeriesByType(t),i,n)},e.prototype.isSeriesFiltered=function(t){return D_(this),this._seriesIndicesMap.get(t.componentIndex)==null},e.prototype.getCurrentSeriesIndices=function(){return(this._seriesIndices||[]).slice()},e.prototype.filterSeries=function(t,i){D_(this);var n=[];N(this._seriesIndices,function(a){var o=this._componentsMap.get("series")[a];t.call(i,o,a)&&n.push(a)},this),this._seriesIndices=n,this._seriesIndicesMap=ke(n)},e.prototype.restoreData=function(t){Iw(this);var i=this._componentsMap,n=[];i.each(function(a,o){Pt.hasClass(o)&&n.push(o)}),Pt.topologicalTravel(n,Pt.getAllClassMainTypes(),function(a){N(i.get(a),function(o){o&&(a!=="series"||!afe(o,t))&&o.restoreData()})})},e.internalField=function(){Iw=function(t){var i=t._seriesIndices=[];N(t._componentsMap.get("series"),function(n){n&&i.push(n.componentIndex)}),t._seriesIndicesMap=ke(i)},D_=function(t){},P5=function(t,i){t.option={},t.option[D5]=nfe,t._componentsMap=ke({series:[]}),t._componentsCount=ke();var n=i.aria;qe(n)&&n.enabled==null&&(n.enabled=!0),ofe(i,t._theme.option),_t(i,M5,!1),t._mergeOption(i,null)}}(),e}(Zt);function afe(r,e){if(e){var t=e.seriesIndex,i=e.seriesId,n=e.seriesName;return t!=null&&r.componentIndex!==t||i!=null&&r.id!==i||n!=null&&r.name!==n}}function ofe(r,e){var t=r.color&&!r.colorLayer;N(e,function(i,n){n==="colorLayer"&&t||Pt.hasClass(n)||(typeof i=="object"?r[n]=r[n]?_t(r[n],i,!1):Qe(i):r[n]==null&&(r[n]=i))})}function I5(r,e,t){if(pe(e)){var i=ke();return N(e,function(a){if(a!=null){var o=Yr(a,null);o!=null&&i.set(a,!0)}}),Wt(t,function(a){return a&&i.get(a[r])})}else{var n=Yr(e,null);return Wt(t,function(a){return a&&n!=null&&a[r]===n})}}function N5(r,e){return e.hasOwnProperty("subType")?Wt(r,function(t){return t&&t.subType===e.subType}):r}function U5(r){var e=ke();return r&&N(Jt(r.replaceMerge),function(t){e.set(t,!0)}),{replaceMergeMainTypeMap:e}}wr(O5,L_);var Nw=O5;var sfe=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isSSR","isDisposed","on","off","getDataURL","getConnectedDataURL","getOption","getId","updateLabelLayout"],lfe=function(){function r(e){N(sfe,function(t){this[t]=Be(e[t],e)},this)}return r}(),Uw=lfe;var sD={},ufe=function(){function r(){this._coordinateSystems=[]}return r.prototype.create=function(e,t){var i=[];N(sD,function(n,a){var o=n.create(e,t);i=i.concat(o||[])}),this._coordinateSystems=i},r.prototype.update=function(e,t){N(this._coordinateSystems,function(i){i.update&&i.update(e,t)})},r.prototype.getCoordinateSystems=function(){return this._coordinateSystems.slice()},r.register=function(e,t){sD[e]=t},r.get=function(e){return sD[e]},r}(),Uu=ufe;var cfe=/^(min|max)?(.+)$/,ffe=function(){function r(e){this._timelineOptions=[],this._mediaList=[],this._currentMediaIndices=[],this._api=e}return r.prototype.setOption=function(e,t,i){e&&(N(Jt(e.series),function(o){o&&o.data&&bi(o.data)&&Qh(o.data)}),N(Jt(e.dataset),function(o){o&&o.source&&bi(o.source)&&Qh(o.source)})),e=Qe(e);var n=this._optionBackup,a=hfe(e,t,!n);this._newBaseOption=a.baseOption,n?(a.timelineOptions.length&&(n.timelineOptions=a.timelineOptions),a.mediaList.length&&(n.mediaList=a.mediaList),a.mediaDefault&&(n.mediaDefault=a.mediaDefault)):this._optionBackup=a},r.prototype.mountOption=function(e){var t=this._optionBackup;return this._timelineOptions=t.timelineOptions,this._mediaList=t.mediaList,this._mediaDefault=t.mediaDefault,this._currentMediaIndices=[],Qe(e?t.baseOption:this._newBaseOption)},r.prototype.getTimelineOption=function(e){var t,i=this._timelineOptions;if(i.length){var n=e.getComponent("timeline");n&&(t=Qe(i[n.getCurrentIndex()]))}return t},r.prototype.getMediaOption=function(e){var t=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,a=this._mediaDefault,o=[],s=[];if(!n.length&&!a)return s;for(var l=0,u=n.length;l<u;l++)pfe(n[l].query,t,i)&&o.push(l);return!o.length&&a&&(o=[-1]),o.length&&!mfe(o,this._currentMediaIndices)&&(s=de(o,function(c){return Qe(c===-1?a.option:n[c].option)})),this._currentMediaIndices=o,s},r}();function hfe(r,e,t){var i=[],n,a,o=r.baseOption,s=r.timeline,l=r.options,u=r.media,c=!!r.media,f=!!(l||s||o&&o.timeline);o?(a=o,a.timeline||(a.timeline=s)):((f||c)&&(r.options=r.media=null),a=r),c&&pe(u)&&N(u,function(p){p&&p.option&&(p.query?i.push(p):n||(n=p))}),h(a),N(l,function(p){return h(p)}),N(i,function(p){return h(p.option)});function h(p){N(e,function(d){d(p,t)})}return{baseOption:a,timelineOptions:l||[],mediaDefault:n,mediaList:i}}function pfe(r,e,t){var i={width:e,height:t,aspectratio:e/t},n=!0;return N(r,function(a,o){var s=o.match(cfe);if(!(!s||!s[1]||!s[2])){var l=s[1],u=s[2].toLowerCase();dfe(i[u],a,l)||(n=!1)}}),n}function dfe(r,e,t){return t==="min"?r>=e:t==="max"?r<=e:r===e}function mfe(r,e){return r.join(",")===e.join(",")}var F5=ffe;var Xs=N,N_=qe,z5=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function lD(r){var e=r&&r.itemStyle;if(e)for(var t=0,i=z5.length;t<i;t++){var n=z5[t],a=e.normal,o=e.emphasis;a&&a[n]&&(r[n]=r[n]||{},r[n].normal?_t(r[n].normal,a[n]):r[n].normal=a[n],a[n]=null),o&&o[n]&&(r[n]=r[n]||{},r[n].emphasis?_t(r[n].emphasis,o[n]):r[n].emphasis=o[n],o[n]=null)}}function Wn(r,e,t){if(r&&r[e]&&(r[e].normal||r[e].emphasis)){var i=r[e].normal,n=r[e].emphasis;i&&(t?(r[e].normal=r[e].emphasis=null,Ye(r[e],i)):r[e]=i),n&&(r.emphasis=r.emphasis||{},r.emphasis[e]=n,n.focus&&(r.emphasis.focus=n.focus),n.blurScope&&(r.emphasis.blurScope=n.blurScope))}}function I_(r){Wn(r,"itemStyle"),Wn(r,"lineStyle"),Wn(r,"areaStyle"),Wn(r,"label"),Wn(r,"labelLine"),Wn(r,"upperLabel"),Wn(r,"edgeLabel")}function Ni(r,e){var t=N_(r)&&r[e],i=N_(t)&&t.textStyle;if(i)for(var n=0,a=jL.length;n<a;n++){var o=jL[n];i.hasOwnProperty(o)&&(t[o]=i[o])}}function is(r){r&&(I_(r),Ni(r,"label"),r.emphasis&&Ni(r.emphasis,"label"))}function vfe(r){if(N_(r)){lD(r),I_(r),Ni(r,"label"),Ni(r,"upperLabel"),Ni(r,"edgeLabel"),r.emphasis&&(Ni(r.emphasis,"label"),Ni(r.emphasis,"upperLabel"),Ni(r.emphasis,"edgeLabel"));var e=r.markPoint;e&&(lD(e),is(e));var t=r.markLine;t&&(lD(t),is(t));var i=r.markArea;i&&is(i);var n=r.data;if(r.type==="graph"){n=n||r.nodes;var a=r.links||r.edges;if(a&&!bi(a))for(var o=0;o<a.length;o++)is(a[o]);N(r.categories,function(u){I_(u)})}if(n&&!bi(n))for(var o=0;o<n.length;o++)is(n[o]);if(e=r.markPoint,e&&e.data)for(var s=e.data,o=0;o<s.length;o++)is(s[o]);if(t=r.markLine,t&&t.data)for(var l=t.data,o=0;o<l.length;o++)pe(l[o])?(is(l[o][0]),is(l[o][1])):is(l[o]);r.type==="gauge"?(Ni(r,"axisLabel"),Ni(r,"title"),Ni(r,"detail")):r.type==="treemap"?(Wn(r.breadcrumb,"itemStyle"),N(r.levels,function(u){I_(u)})):r.type==="tree"&&I_(r.leaves)}}function Ou(r){return pe(r)?r:r?[r]:[]}function B5(r){return(pe(r)?r[0]:r)||{}}function uD(r,e){Xs(Ou(r.series),function(i){N_(i)&&vfe(i)});var t=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","parallelAxis","radar"];e&&t.push("valueAxis","categoryAxis","logAxis","timeAxis"),Xs(t,function(i){Xs(Ou(r[i]),function(n){n&&(Ni(n,"axisLabel"),Ni(n.axisPointer,"label"))})}),Xs(Ou(r.parallel),function(i){var n=i&&i.parallelAxisDefault;Ni(n,"axisLabel"),Ni(n&&n.axisPointer,"label")}),Xs(Ou(r.calendar),function(i){Wn(i,"itemStyle"),Ni(i,"dayLabel"),Ni(i,"monthLabel"),Ni(i,"yearLabel")}),Xs(Ou(r.radar),function(i){Ni(i,"name"),i.name&&i.axisName==null&&(i.axisName=i.name,delete i.name),i.nameGap!=null&&i.axisNameGap==null&&(i.axisNameGap=i.nameGap,delete i.nameGap)}),Xs(Ou(r.geo),function(i){N_(i)&&(is(i),Xs(Ou(i.regions),function(n){is(n)}))}),Xs(Ou(r.timeline),function(i){is(i),Wn(i,"label"),Wn(i,"itemStyle"),Wn(i,"controlStyle",!0);var n=i.data;pe(n)&&N(n,function(a){qe(a)&&(Wn(a,"label"),Wn(a,"itemStyle"))})}),Xs(Ou(r.toolbox),function(i){Wn(i,"iconStyle"),Xs(i.feature,function(n){Wn(n,"iconStyle")})}),Ni(B5(r.axisPointer),"label"),Ni(B5(r.tooltip).axisPointer,"label")}function gfe(r,e){for(var t=e.split(","),i=r,n=0;n<t.length&&(i=i&&i[t[n]],i!=null);n++);return i}function yfe(r,e,t,i){for(var n=e.split(","),a=r,o,s=0;s<n.length-1;s++)o=n[s],a[o]==null&&(a[o]={}),a=a[o];(i||a[n[s]]==null)&&(a[n[s]]=t)}function k5(r){r&&N(_fe,function(e){e[0]in r&&!(e[1]in r)&&(r[e[1]]=r[e[0]])})}var _fe=[["x","left"],["y","top"],["x2","right"],["y2","bottom"]],xfe=["grid","geo","parallel","legend","toolbox","title","visualMap","dataZoom","timeline"],cD=[["borderRadius","barBorderRadius"],["borderColor","barBorderColor"],["borderWidth","barBorderWidth"]];function U_(r){var e=r&&r.itemStyle;if(e)for(var t=0;t<cD.length;t++){var i=cD[t][1],n=cD[t][0];e[i]!=null&&(e[n]=e[i])}}function V5(r){r&&r.alignTo==="edge"&&r.margin!=null&&r.edgeDistance==null&&(r.edgeDistance=r.margin)}function G5(r){r&&r.downplay&&!r.blur&&(r.blur=r.downplay)}function Sfe(r){r&&r.focusNodeAdjacency!=null&&(r.emphasis=r.emphasis||{},r.emphasis.focus==null&&(r.emphasis.focus="adjacency"))}function H5(r,e){if(r)for(var t=0;t<r.length;t++)e(r[t]),r[t]&&H5(r[t].children,e)}function Ow(r,e){uD(r,e),r.series=Jt(r.series),N(r.series,function(t){if(qe(t)){var i=t.type;if(i==="line")t.clipOverflow!=null&&(t.clip=t.clipOverflow);else if(i==="pie"||i==="gauge"){t.clockWise!=null&&(t.clockwise=t.clockWise),V5(t.label);var n=t.data;if(n&&!bi(n))for(var a=0;a<n.length;a++)V5(n[a]);t.hoverOffset!=null&&(t.emphasis=t.emphasis||{},(t.emphasis.scaleSize=null)&&(t.emphasis.scaleSize=t.hoverOffset))}else if(i==="gauge"){var o=gfe(t,"pointer.color");o!=null&&yfe(t,"itemStyle.color",o)}else if(i==="bar"){U_(t),U_(t.backgroundStyle),U_(t.emphasis);var n=t.data;if(n&&!bi(n))for(var a=0;a<n.length;a++)typeof n[a]=="object"&&(U_(n[a]),U_(n[a]&&n[a].emphasis))}else if(i==="sunburst"){var s=t.highlightPolicy;s&&(t.emphasis=t.emphasis||{},t.emphasis.focus||(t.emphasis.focus=s)),G5(t),H5(t.data,G5)}else i==="graph"||i==="sankey"?Sfe(t):i==="map"&&(t.mapType&&!t.map&&(t.map=t.mapType),t.mapLocation&&Ye(t,t.mapLocation));t.hoverAnimation!=null&&(t.emphasis=t.emphasis||{},t.emphasis&&t.emphasis.scale==null&&(t.emphasis.scale=t.hoverAnimation)),k5(t)}}),r.dataRange&&(r.visualMap=r.dataRange),N(xfe,function(t){var i=r[t];i&&(pe(i)||(i=[i]),N(i,function(n){k5(n)}))})}function fD(r){var e=ke();r.eachSeries(function(t){var i=t.get("stack");if(i){var n=e.get(i)||e.set(i,[]),a=t.getData(),o={stackResultDimension:a.getCalculationInfo("stackResultDimension"),stackedOverDimension:a.getCalculationInfo("stackedOverDimension"),stackedDimension:a.getCalculationInfo("stackedDimension"),stackedByDimension:a.getCalculationInfo("stackedByDimension"),isStackedByIndex:a.getCalculationInfo("isStackedByIndex"),data:a,seriesModel:t};if(!o.stackedDimension||!(o.isStackedByIndex||o.stackedByDimension))return;n.length&&a.setCalculationInfo("stackedOnSeries",n[n.length-1].seriesModel),n.push(o)}}),e.each(Mfe)}function Mfe(r){N(r,function(e,t){var i=[],n=[NaN,NaN],a=[e.stackResultDimension,e.stackedOverDimension],o=e.data,s=e.isStackedByIndex,l=e.seriesModel.get("stackStrategy")||"samesign";o.modify(a,function(u,c,f){var h=o.get(e.stackedDimension,f);if(isNaN(h))return n;var p,d;s?d=o.getRawIndex(f):p=o.get(e.stackedByDimension,f);for(var g=NaN,m=t-1;m>=0;m--){var v=r[m];if(s||(d=v.data.rawIndexOf(v.stackedByDimension,p)),d>=0){var _=v.data.getByRawIndex(v.stackResultDimension,d);if(l==="all"||l==="positive"&&_>0||l==="negative"&&_<0||l==="samesign"&&h>=0&&_>0||l==="samesign"&&h<=0&&_<0){h=JG(h,_),g=_;break}}}return i[0]=h,i[1]=g,i})})}var Fw=function(){function r(e){this.data=e.data||(e.sourceFormat===xo?{}:[]),this.sourceFormat=e.sourceFormat||aD,this.seriesLayoutBy=e.seriesLayoutBy||Ba,this.startIndex=e.startIndex||0,this.dimensionsDetectedCount=e.dimensionsDetectedCount,this.metaRawOption=e.metaRawOption;var t=this.dimensionsDefine=e.dimensionsDefine;if(t)for(var i=0;i<t.length;i++){var n=t[i];n.type==null&&Dw(this,i)===Ji.Must&&(n.type="ordinal")}}return r}();function cv(r){return r instanceof Fw}function O_(r,e,t){t=t||hD(r);var i=e.seriesLayoutBy,n=bfe(r,t,i,e.sourceHeader,e.dimensions),a=new Fw({data:r,sourceFormat:t,seriesLayoutBy:i,dimensionsDefine:n.dimensionsDefine,startIndex:n.startIndex,dimensionsDetectedCount:n.dimensionsDetectedCount,metaRawOption:Qe(e)});return a}function fv(r){return new Fw({data:r,sourceFormat:bi(r)?So:fn})}function Y5(r){return new Fw({data:r.data,sourceFormat:r.sourceFormat,seriesLayoutBy:r.seriesLayoutBy,dimensionsDefine:Qe(r.dimensionsDefine),startIndex:r.startIndex,dimensionsDetectedCount:r.dimensionsDetectedCount})}function hD(r){var e=aD;if(bi(r))e=So;else if(pe(r)){r.length===0&&(e=Ei);for(var t=0,i=r.length;t<i;t++){var n=r[t];if(n!=null){if(pe(n)||bi(n)){e=Ei;break}else if(qe(n)){e=En;break}}}}else if(qe(r)){for(var a in r)if(tt(r,a)&&ci(r[a])){e=xo;break}}return e}function bfe(r,e,t,i,n){var a,o;if(!r)return{dimensionsDefine:W5(n),startIndex:o,dimensionsDetectedCount:a};if(e===Ei){var s=r;i==="auto"||i==null?X5(function(u){u!=null&&u!=="-"&&(Ce(u)?o==null&&(o=1):o=0)},t,s,10):o=At(i)?i:i?1:0,!n&&o===1&&(n=[],X5(function(u,c){n[c]=u!=null?u+"":""},t,s,1/0)),a=n?n.length:t===Nu?s.length:s[0]?s[0].length:null}else if(e===En)n||(n=wfe(r));else if(e===xo)n||(n=[],N(r,function(u,c){n.push(c)}));else if(e===fn){var l=Os(r[0]);a=pe(l)&&l.length||1}return{startIndex:o,dimensionsDefine:W5(n),dimensionsDetectedCount:a}}function wfe(r){for(var e=0,t;e<r.length&&!(t=r[e++]););if(t)return bt(t)}function W5(r){if(r){var e=ke();return de(r,function(t,i){t=qe(t)?t:{name:t};var n={name:t.name,displayName:t.displayName,type:t.type};if(n.name==null)return n;n.name+="",n.displayName==null&&(n.displayName=n.name);var a=e.get(n.name);return a?n.name+="-"+a.count++:e.set(n.name,{count:1}),n})}}function X5(r,e,t,i){if(e===Nu)for(var n=0;n<t.length&&n<i;n++)r(t[n]?t[n][0]:null,n);else for(var a=t[0]||[],n=0;n<a.length&&n<i;n++)r(a[n],n)}function zw(r){var e=r.sourceFormat;return e===En||e===xo}var Gp,Hp,Wp,q5,Z5,Bw=function(){function r(e,t){var i=cv(e)?e:fv(e);this._source=i;var n=this._data=i.data;i.sourceFormat===So&&(this._offset=0,this._dimSize=t,this._data=n),Z5(this,n,i)}return r.prototype.getSource=function(){return this._source},r.prototype.count=function(){return 0},r.prototype.getItem=function(e,t){},r.prototype.appendData=function(e){},r.prototype.clean=function(){},r.protoInitialize=function(){var e=r.prototype;e.pure=!1,e.persistent=!0}(),r.internalField=function(){var e;Z5=function(o,s,l){var u=l.sourceFormat,c=l.seriesLayoutBy,f=l.startIndex,h=l.dimensionsDefine,p=q5[gD(u,c)];if(fe(o,p),u===So)o.getItem=t,o.count=n,o.fillStorage=i;else{var d=dD(u,c);o.getItem=Be(d,null,s,f,h);var g=mD(u,c);o.count=Be(g,null,s,f,h)}};var t=function(o,s){o=o-this._offset,s=s||[];for(var l=this._data,u=this._dimSize,c=u*o,f=0;f<u;f++)s[f]=l[c+f];return s},i=function(o,s,l,u){for(var c=this._data,f=this._dimSize,h=0;h<f;h++){for(var p=u[h],d=p[0]==null?1/0:p[0],g=p[1]==null?-1/0:p[1],m=s-o,v=l[h],_=0;_<m;_++){var y=c[_*f+h];v[o+_]=y,y<d&&(d=y),y>g&&(g=y)}p[0]=d,p[1]=g}},n=function(){return this._data?this._data.length/this._dimSize:0};q5=(e={},e[Ei+"_"+Ba]={pure:!0,appendData:a},e[Ei+"_"+Nu]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[En]={pure:!0,appendData:a},e[xo]={pure:!0,appendData:function(o){var s=this._data;N(o,function(l,u){for(var c=s[u]||(s[u]=[]),f=0;f<(l||[]).length;f++)c.push(l[f])})}},e[fn]={appendData:a},e[So]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},e);function a(o){for(var s=0;s<o.length;s++)this._data.push(o[s])}}(),r}();var j5=function(r,e,t,i){return r[i]},Tfe=(Gp={},Gp[Ei+"_"+Ba]=function(r,e,t,i){return r[i+e]},Gp[Ei+"_"+Nu]=function(r,e,t,i,n){i+=e;for(var a=n||[],o=r,s=0;s<o.length;s++){var l=o[s];a[s]=l?l[i]:null}return a},Gp[En]=j5,Gp[xo]=function(r,e,t,i,n){for(var a=n||[],o=0;o<t.length;o++){var s=t[o].name,l=r[s];a[o]=l?l[i]:null}return a},Gp[fn]=j5,Gp);function dD(r,e){var t=Tfe[gD(r,e)];return t}var K5=function(r,e,t){return r.length},Efe=(Hp={},Hp[Ei+"_"+Ba]=function(r,e,t){return Math.max(0,r.length-e)},Hp[Ei+"_"+Nu]=function(r,e,t){var i=r[0];return i?Math.max(0,i.length-e):0},Hp[En]=K5,Hp[xo]=function(r,e,t){var i=t[0].name,n=r[i];return n?n.length:0},Hp[fn]=K5,Hp);function mD(r,e){var t=Efe[gD(r,e)];return t}var pD=function(r,e,t){return r[e]},Afe=(Wp={},Wp[Ei]=pD,Wp[En]=function(r,e,t){return r[t]},Wp[xo]=pD,Wp[fn]=function(r,e,t){var i=Os(r);return i instanceof Array?i[e]:i},Wp[So]=pD,Wp);function vD(r){var e=Afe[r];return e}function gD(r,e){return r===Ei?r+"_"+e:r}function Fu(r,e,t){if(r){var i=r.getRawDataItem(e);if(i!=null){var n=r.getStore(),a=n.getSource().sourceFormat;if(t!=null){var o=r.getDimensionIndex(t),s=n.getDimensionProperty(o);return vD(a)(i,o,s)}else{var l=i;return a===fn&&(l=Os(i)),l}}}}var Cfe=/\{@(.+?)\}/g,hv=function(){function r(){}return r.prototype.getDataParams=function(e,t){var i=this.getData(t),n=this.getRawValue(e,t),a=i.getRawIndex(e),o=i.getName(e),s=i.getRawDataItem(e),l=i.getItemVisual(e,"style"),u=l&&l[i.getItemVisual(e,"drawType")||"fill"],c=l&&l.stroke,f=this.mainType,h=f==="series",p=i.userOutput&&i.userOutput.get();return{componentType:f,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:h?this.subType:null,seriesIndex:this.seriesIndex,seriesId:h?this.id:null,seriesName:h?this.name:null,name:o,dataIndex:a,data:s,dataType:t,value:n,color:u,borderColor:c,dimensionNames:p?p.fullDimensions:null,encode:p?p.encode:null,$vars:["seriesName","name","value"]}},r.prototype.getFormattedLabel=function(e,t,i,n,a,o){t=t||"normal";var s=this.getData(i),l=this.getDataParams(e,i);if(o&&(l.value=o.interpolatedValue),n!=null&&pe(l.value)&&(l.value=l.value[n]),!a){var u=s.getItemModel(e);a=u.get(t==="normal"?["label","formatter"]:[t,"label","formatter"])}if(He(a))return l.status=t,l.dimensionIndex=n,a(l);if(Ce(a)){var c=Aw(a,l);return c.replace(Cfe,function(f,h){var p=h.length,d=h;d.charAt(0)==="["&&d.charAt(p-1)==="]"&&(d=+d.slice(1,p-1));var g=Fu(s,e,d);if(o&&pe(o.interpolatedValue)){var m=s.getDimensionIndex(d);m>=0&&(g=o.interpolatedValue[m])}return g!=null?g+"":""})}},r.prototype.getRawValue=function(e,t){return Fu(this.getData(t),e)},r.prototype.formatTooltip=function(e,t,i){},r}();function yD(r){var e,t;return qe(r)?r.type&&(t=r):e=r,{text:e,frag:t}}function Cf(r){return new Rfe(r)}var Rfe=function(){function r(e){e=e||{},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return r.prototype.perform=function(e){var t=this._upstream,i=e&&e.skip;if(this._dirty&&t){var n=this.context;n.data=n.outputData=t.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var a;this._plan&&!i&&(a=this._plan(this.context));var o=c(this._modBy),s=this._modDataCount||0,l=c(e&&e.modBy),u=e&&e.modDataCount||0;(o!==l||s!==u)&&(a="reset");function c(_){return!(_>=1)&&(_=1),_}var f;(this._dirty||a==="reset")&&(this._dirty=!1,f=this._doReset(i)),this._modBy=l,this._modDataCount=u;var h=e&&e.step;if(t?this._dueEnd=t._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var p=this._dueIndex,d=Math.min(h!=null?this._dueIndex+h:1/0,this._dueEnd);if(!i&&(f||p<d)){var g=this._progress;if(pe(g))for(var m=0;m<g.length;m++)this._doProgress(g[m],p,d,l,u);else this._doProgress(g,p,d,l,u)}this._dueIndex=d;var v=this._settedOutputEnd!=null?this._settedOutputEnd:d;this._outputDueEnd=v}else this._dueIndex=this._outputDueEnd=this._settedOutputEnd!=null?this._settedOutputEnd:this._dueEnd;return this.unfinished()},r.prototype.dirty=function(){this._dirty=!0,this._onDirty&&this._onDirty(this.context)},r.prototype._doProgress=function(e,t,i,n,a){J5.reset(t,i,n,a),this._callingProgress=e,this._callingProgress({start:t,end:i,count:i-t,next:J5.next},this.context)},r.prototype._doReset=function(e){this._dueIndex=this._outputDueEnd=this._dueEnd=0,this._settedOutputEnd=null;var t,i;!e&&this._reset&&(t=this._reset(this.context),t&&t.progress&&(i=t.forceFirstProgress,t=t.progress),pe(t)&&!t.length&&(t=null)),this._progress=t,this._modBy=this._modDataCount=null;var n=this._downstream;return n&&n.dirty(),i},r.prototype.unfinished=function(){return this._progress&&this._dueIndex<this._dueEnd},r.prototype.pipe=function(e){(this._downstream!==e||this._dirty)&&(this._downstream=e,e._upstream=this,e.dirty())},r.prototype.dispose=function(){this._disposed||(this._upstream&&(this._upstream._downstream=null),this._downstream&&(this._downstream._upstream=null),this._dirty=!1,this._disposed=!0)},r.prototype.getUpstream=function(){return this._upstream},r.prototype.getDownstream=function(){return this._downstream},r.prototype.setOutputEnd=function(e){this._outputDueEnd=this._settedOutputEnd=e},r}();var J5=function(){var r,e,t,i,n,a={reset:function(l,u,c,f){e=l,r=u,t=c,i=f,n=Math.ceil(i/t),a.next=t>1&&i>0?s:o}};return a;function o(){return e<r?e++:null}function s(){var l=e%n*t+Math.ceil(e/n),u=e>=r?null:l<i?l:e;return e++,u}}();function ns(r,e){var t=e&&e.type;return t==="ordinal"?r:(t==="time"&&!At(r)&&r!=null&&r!=="-"&&(r=+Mn(r)),r==null||r===""?NaN:+r)}var Lfe=ke({number:function(r){return parseFloat(r)},time:function(r){return+Mn(r)},trim:function(r){return Ce(r)?Yi(r):r}});function kw(r){return Lfe.get(r)}var $5={lt:function(r,e){return r<e},lte:function(r,e){return r<=e},gt:function(r,e){return r>e},gte:function(r,e){return r>=e}},Pfe=function(){function r(e,t){if(!At(t)){var i="";ur(i)}this._opFn=$5[e],this._rvalFloat=Pa(t)}return r.prototype.evaluate=function(e){return At(e)?this._opFn(e,this._rvalFloat):this._opFn(Pa(e),this._rvalFloat)},r}(),Vw=function(){function r(e,t){var i=e==="desc";this._resultLT=i?1:-1,t==null&&(t=i?"min":"max"),this._incomparable=t==="min"?-1/0:1/0}return r.prototype.evaluate=function(e,t){var i=At(e)?e:Pa(e),n=At(t)?t:Pa(t),a=isNaN(i),o=isNaN(n);if(a&&(i=this._incomparable),o&&(n=this._incomparable),a&&o){var s=Ce(e),l=Ce(t);s&&(i=l?e:0),l&&(n=s?t:0)}return i<n?this._resultLT:i>n?-this._resultLT:0},r}();var Dfe=function(){function r(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=Pa(t)}return r.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var i=typeof e;i!==this._rvalTypeof&&(i==="number"||this._rvalTypeof==="number")&&(t=Pa(e)===this._rvalFloat)}return this._isEQ?t:!t},r}();function Q5(r,e){return r==="eq"||r==="ne"?new Dfe(r==="eq",e):tt($5,r)?new Pfe(r,e):null}var Ife=function(){function r(){}return r.prototype.getRawData=function(){throw new Error("not supported")},r.prototype.getRawDataItem=function(e){throw new Error("not supported")},r.prototype.cloneRawData=function(){},r.prototype.getDimensionInfo=function(e){},r.prototype.cloneAllDimensionInfo=function(){},r.prototype.count=function(){},r.prototype.retrieveValue=function(e,t){},r.prototype.retrieveValueFromItem=function(e,t){},r.prototype.convertValue=function(e,t){return ns(e,t)},r}();function Nfe(r,e){var t=new Ife,i=r.data,n=t.sourceFormat=r.sourceFormat,a=r.startIndex,o="";r.seriesLayoutBy!==Ba&&ur(o);var s=[],l={},u=r.dimensionsDefine;if(u)N(u,function(g,m){var v=g.name,_={index:m,name:v,displayName:g.displayName};if(s.push(_),v!=null){var y="";tt(l,v)&&ur(y),l[v]=_}});else for(var c=0;c<r.dimensionsDetectedCount;c++)s.push({index:c});var f=dD(n,Ba);e.__isBuiltIn&&(t.getRawDataItem=function(g){return f(i,a,s,g)},t.getRawData=Be(Ufe,null,r)),t.cloneRawData=Be(Ofe,null,r);var h=mD(n,Ba);t.count=Be(h,null,i,a,s);var p=vD(n);t.retrieveValue=function(g,m){var v=f(i,a,s,g);return d(v,m)};var d=t.retrieveValueFromItem=function(g,m){if(g!=null){var v=s[m];if(v)return p(g,m,v.name)}};return t.getDimensionInfo=Be(Ffe,null,s,l),t.cloneAllDimensionInfo=Be(zfe,null,s),t}function Ufe(r){var e=r.sourceFormat;if(!_D(e)){var t="";ur(t)}return r.data}function Ofe(r){var e=r.sourceFormat,t=r.data;if(!_D(e)){var i="";ur(i)}if(e===Ei){for(var n=[],a=0,o=t.length;a<o;a++)n.push(t[a].slice());return n}else if(e===En){for(var n=[],a=0,o=t.length;a<o;a++)n.push(fe({},t[a]));return n}}function Ffe(r,e,t){if(t!=null){if(At(t)||!isNaN(t)&&!tt(e,t))return r[t];if(tt(e,t))return e[t]}}function zfe(r){return Qe(r)}var eW=ke();function tW(r){r=Qe(r);var e=r.type,t="";e||ur(t);var i=e.split(":");i.length!==2&&ur(t);var n=!1;i[0]==="echarts"&&(e=i[1],n=!0),r.__isBuiltIn=n,eW.set(e,r)}function rW(r,e,t){var i=Jt(r),n=i.length,a="";n||ur(a);for(var o=0,s=n;o<s;o++){var l=i[o];e=Bfe(l,e,t,n===1?null:o),o!==s-1&&(e.length=Math.max(e.length,1))}return e}function Bfe(r,e,t,i){var n="";e.length||ur(n),qe(r)||ur(n);var a=r.type,o=eW.get(a);o||ur(n);var s=de(e,function(c){return Nfe(c,o)}),l=Jt(o.transform({upstream:s[0],upstreamList:s,config:Qe(r.config)}));if(0&&r.print)var u;return de(l,function(c,f){var h="";qe(c)||ur(h),c.data||ur(h);var p=hD(c.data);_D(p)||ur(h);var d,g=e[0];if(g&&f===0&&!c.dimensions){var m=g.startIndex;m&&(c.data=g.data.slice(0,m).concat(c.data)),d={seriesLayoutBy:Ba,sourceHeader:m,dimensions:g.metaRawOption.dimensions}}else d={seriesLayoutBy:Ba,sourceHeader:0,dimensions:c.dimensions};return O_(c.data,d,null)})}function _D(r){return r===Ei||r===En}var Gw="undefined",kfe=typeof Uint32Array===Gw?Array:Uint32Array,Vfe=typeof Uint16Array===Gw?Array:Uint16Array,SD=typeof Int32Array===Gw?Array:Int32Array,iW=typeof Float64Array===Gw?Array:Float64Array,aW={float:iW,int:SD,ordinal:Array,number:Array,time:iW},xD;function F_(r){return r>65535?kfe:Vfe}function pv(){return[1/0,-1/0]}function Gfe(r){var e=r.constructor;return e===Array?r.slice():new e(r)}function nW(r,e,t,i,n){var a=aW[t||"float"];if(n){var o=r[e],s=o&&o.length;if(s!==i){for(var l=new a(i),u=0;u<s;u++)l[u]=o[u];r[e]=l}}else r[e]=new a(i)}var Hfe=function(){function r(){this._chunks=[],this._rawExtent=[],this._extent=[],this._count=0,this._rawCount=0,this._calcDimNameToIdx=ke()}return r.prototype.initData=function(e,t,i){this._provider=e,this._chunks=[],this._indices=null,this.getRawIndex=this._getRawIdxIdentity;var n=e.getSource(),a=this.defaultDimValueGetter=xD[n.sourceFormat];this._dimValueGetter=i||a,this._rawExtent=[];var o=zw(n);this._dimensions=de(t,function(s){return{type:s.type,property:s.property}}),this._initDataFromProvider(0,e.count())},r.prototype.getProvider=function(){return this._provider},r.prototype.getSource=function(){return this._provider.getSource()},r.prototype.ensureCalculationDimension=function(e,t){var i=this._calcDimNameToIdx,n=this._dimensions,a=i.get(e);if(a!=null){if(n[a].type===t)return a}else a=n.length;return n[a]={type:t},i.set(e,a),this._chunks[a]=new aW[t||"float"](this._rawCount),this._rawExtent[a]=pv(),a},r.prototype.collectOrdinalMeta=function(e,t){var i=this._chunks[e],n=this._dimensions[e],a=this._rawExtent,o=n.ordinalOffset||0,s=i.length;o===0&&(a[e]=pv());for(var l=a[e],u=o;u<s;u++){var c=i[u]=t.parseAndCollect(i[u]);isNaN(c)||(l[0]=Math.min(c,l[0]),l[1]=Math.max(c,l[1]))}n.ordinalMeta=t,n.ordinalOffset=s,n.type="ordinal"},r.prototype.getOrdinalMeta=function(e){var t=this._dimensions[e],i=t.ordinalMeta;return i},r.prototype.getDimensionProperty=function(e){var t=this._dimensions[e];return t&&t.property},r.prototype.appendData=function(e){var t=this._provider,i=this.count();t.appendData(e);var n=t.count();return t.persistent||(n+=i),i<n&&this._initDataFromProvider(i,n,!0),[i,n]},r.prototype.appendValues=function(e,t){for(var i=this._chunks,n=this._dimensions,a=n.length,o=this._rawExtent,s=this.count(),l=s+Math.max(e.length,t||0),u=0;u<a;u++){var c=n[u];nW(i,u,c.type,l,!0)}for(var f=[],h=s;h<l;h++)for(var p=h-s,d=0;d<a;d++){var c=n[d],g=xD.arrayRows.call(this,e[p]||f,c.property,p,d);i[d][h]=g;var m=o[d];g<m[0]&&(m[0]=g),g>m[1]&&(m[1]=g)}return this._rawCount=this._count=l,{start:s,end:l}},r.prototype._initDataFromProvider=function(e,t,i){for(var n=this._provider,a=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=de(o,function(_){return _.property}),c=0;c<s;c++){var f=o[c];l[c]||(l[c]=pv()),nW(a,c,f.type,t,i)}if(n.fillStorage)n.fillStorage(e,t,a,l);else for(var h=[],p=e;p<t;p++){h=n.getItem(p,h);for(var d=0;d<s;d++){var g=a[d],m=this._dimValueGetter(h,u[d],p,d);g[p]=m;var v=l[d];m<v[0]&&(v[0]=m),m>v[1]&&(v[1]=m)}}!n.persistent&&n.clean&&n.clean(),this._rawCount=this._count=t,this._extent=[]},r.prototype.count=function(){return this._count},r.prototype.get=function(e,t){if(!(t>=0&&t<this._count))return NaN;var i=this._chunks[e];return i?i[this.getRawIndex(t)]:NaN},r.prototype.getValues=function(e,t){var i=[],n=[];if(t==null){t=e,e=[];for(var a=0;a<this._dimensions.length;a++)n.push(a)}else n=e;for(var a=0,o=n.length;a<o;a++)i.push(this.get(n[a],t));return i},r.prototype.getByRawIndex=function(e,t){if(!(t>=0&&t<this._rawCount))return NaN;var i=this._chunks[e];return i?i[t]:NaN},r.prototype.getSum=function(e){var t=this._chunks[e],i=0;if(t)for(var n=0,a=this.count();n<a;n++){var o=this.get(e,n);isNaN(o)||(i+=o)}return i},r.prototype.getMedian=function(e){var t=[];this.each([e],function(a){isNaN(a)||t.push(a)});var i=t.sort(function(a,o){return a-o}),n=this.count();return n===0?0:n%2===1?i[(n-1)/2]:(i[n/2]+i[n/2-1])/2},r.prototype.indexOfRawIndex=function(e){if(e>=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,i=t[e];if(i!=null&&i<this._count&&i===e)return e;for(var n=0,a=this._count-1;n<=a;){var o=(n+a)/2|0;if(t[o]<e)n=o+1;else if(t[o]>e)a=o-1;else return o}return-1},r.prototype.indicesOfNearest=function(e,t,i){var n=this._chunks,a=n[e],o=[];if(!a)return o;i==null&&(i=1/0);for(var s=1/0,l=-1,u=0,c=0,f=this.count();c<f;c++){var h=this.getRawIndex(c),p=t-a[h],d=Math.abs(p);d<=i&&((d<s||d===s&&p>=0&&l<0)&&(s=d,l=p,u=0),p===l&&(o[u++]=c))}return o.length=u,o},r.prototype.getIndices=function(){var e,t=this._indices;if(t){var i=t.constructor,n=this._count;if(i===Array){e=new i(n);for(var a=0;a<n;a++)e[a]=t[a]}else e=new i(t.buffer,0,n)}else{var i=F_(this._rawCount);e=new i(this.count());for(var a=0;a<e.length;a++)e[a]=a}return e},r.prototype.filter=function(e,t){if(!this._count)return this;for(var i=this.clone(),n=i.count(),a=F_(i._rawCount),o=new a(n),s=[],l=e.length,u=0,c=e[0],f=i._chunks,h=0;h<n;h++){var p=void 0,d=i.getRawIndex(h);if(l===0)p=t(h);else if(l===1){var g=f[c][d];p=t(g,h)}else{for(var m=0;m<l;m++)s[m]=f[e[m]][d];s[m]=h,p=t.apply(null,s)}p&&(o[u++]=d)}return u<n&&(i._indices=o),i._count=u,i._extent=[],i._updateGetRawIdx(),i},r.prototype.selectRange=function(e){var t=this.clone(),i=t._count;if(!i)return this;var n=bt(e),a=n.length;if(!a)return this;var o=t.count(),s=F_(t._rawCount),l=new s(o),u=0,c=n[0],f=e[c][0],h=e[c][1],p=t._chunks,d=!1;if(!t._indices){var g=0;if(a===1){for(var m=p[n[0]],v=0;v<i;v++){var _=m[v];(_>=f&&_<=h||isNaN(_))&&(l[u++]=g),g++}d=!0}else if(a===2){for(var m=p[n[0]],y=p[n[1]],x=e[n[1]][0],M=e[n[1]][1],v=0;v<i;v++){var _=m[v],S=y[v];(_>=f&&_<=h||isNaN(_))&&(S>=x&&S<=M||isNaN(S))&&(l[u++]=g),g++}d=!0}}if(!d)if(a===1)for(var v=0;v<o;v++){var w=t.getRawIndex(v),_=p[n[0]][w];(_>=f&&_<=h||isNaN(_))&&(l[u++]=w)}else for(var v=0;v<o;v++){for(var T=!0,w=t.getRawIndex(v),C=0;C<a;C++){var b=n[C],_=p[b][w];(_<e[b][0]||_>e[b][1])&&(T=!1)}T&&(l[u++]=t.getRawIndex(v))}return u<o&&(t._indices=l),t._count=u,t._extent=[],t._updateGetRawIdx(),t},r.prototype.map=function(e,t){var i=this.clone(e);return this._updateDims(i,e,t),i},r.prototype.modify=function(e,t){this._updateDims(this,e,t)},r.prototype._updateDims=function(e,t,i){for(var n=e._chunks,a=[],o=t.length,s=e.count(),l=[],u=e._rawExtent,c=0;c<t.length;c++)u[t[c]]=pv();for(var f=0;f<s;f++){for(var h=e.getRawIndex(f),p=0;p<o;p++)l[p]=n[t[p]][h];l[o]=f;var d=i&&i.apply(null,l);if(d!=null){typeof d!="object"&&(a[0]=d,d=a);for(var c=0;c<d.length;c++){var g=t[c],m=d[c],v=u[g],_=n[g];_&&(_[h]=m),m<v[0]&&(v[0]=m),m>v[1]&&(v[1]=m)}}}},r.prototype.lttbDownSample=function(e,t){var i=this.clone([e],!0),n=i._chunks,a=n[e],o=this.count(),s=0,l=Math.floor(1/t),u=this.getRawIndex(0),c,f,h,p=new(F_(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));p[s++]=u;for(var d=1;d<o-1;d+=l){for(var g=Math.min(d+l,o-1),m=Math.min(d+l*2,o),v=(m+g)/2,_=0,y=g;y<m;y++){var x=this.getRawIndex(y),M=a[x];isNaN(M)||(_+=M)}_/=m-g;var S=d,w=Math.min(d+l,o),T=d-1,C=a[u];c=-1,h=S;for(var b=-1,E=0,y=S;y<w;y++){var x=this.getRawIndex(y),M=a[x];if(isNaN(M)){E++,b<0&&(b=x);continue}f=Math.abs((T-v)*(M-C)-(T-y)*(_-C)),f>c&&(c=f,h=x)}E>0&&E<w-S&&(p[s++]=Math.min(b,h),h=Math.max(b,h)),p[s++]=h,u=h}return p[s++]=this.getRawIndex(o-1),i._count=s,i._indices=p,i.getRawIndex=this._getRawIdx,i},r.prototype.downSample=function(e,t,i,n){for(var a=this.clone([e],!0),o=a._chunks,s=[],l=Math.floor(1/t),u=o[e],c=this.count(),f=a._rawExtent[e]=pv(),h=new(F_(this._rawCount))(Math.ceil(c/l)),p=0,d=0;d<c;d+=l){l>c-d&&(l=c-d,s.length=l);for(var g=0;g<l;g++){var m=this.getRawIndex(d+g);s[g]=u[m]}var v=i(s),_=this.getRawIndex(Math.min(d+n(s,v)||0,c-1));u[_]=v,v<f[0]&&(f[0]=v),v>f[1]&&(f[1]=v),h[p++]=_}return a._count=p,a._indices=h,a._updateGetRawIdx(),a},r.prototype.each=function(e,t){if(this._count)for(var i=e.length,n=this._chunks,a=0,o=this.count();a<o;a++){var s=this.getRawIndex(a);switch(i){case 0:t(a);break;case 1:t(n[e[0]][s],a);break;case 2:t(n[e[0]][s],n[e[1]][s],a);break;default:for(var l=0,u=[];l<i;l++)u[l]=n[e[l]][s];u[l]=a,t.apply(null,u)}}},r.prototype.getDataExtent=function(e){var t=this._chunks[e],i=pv();if(!t)return i;var n=this.count(),a=!this._indices,o;if(a)return this._rawExtent[e].slice();if(o=this._extent[e],o)return o.slice();o=i;for(var s=o[0],l=o[1],u=0;u<n;u++){var c=this.getRawIndex(u),f=t[c];f<s&&(s=f),f>l&&(l=f)}return o=[s,l],this._extent[e]=o,o},r.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var i=[],n=this._chunks,a=0;a<n.length;a++)i.push(n[a][t]);return i},r.prototype.clone=function(e,t){var i=new r,n=this._chunks,a=e&&gn(e,function(s,l){return s[l]=!0,s},{});if(a)for(var o=0;o<n.length;o++)i._chunks[o]=a[o]?Gfe(n[o]):n[o];else i._chunks=n;return this._copyCommonProps(i),t||(i._indices=this._cloneIndices()),i._updateGetRawIdx(),i},r.prototype._copyCommonProps=function(e){e._count=this._count,e._rawCount=this._rawCount,e._provider=this._provider,e._dimensions=this._dimensions,e._extent=Qe(this._extent),e._rawExtent=Qe(this._rawExtent)},r.prototype._cloneIndices=function(){if(this._indices){var e=this._indices.constructor,t=void 0;if(e===Array){var i=this._indices.length;t=new e(i);for(var n=0;n<i;n++)t[n]=this._indices[n]}else t=new e(this._indices);return t}return null},r.prototype._getRawIdxIdentity=function(e){return e},r.prototype._getRawIdx=function(e){return e<this._count&&e>=0?this._indices[e]:-1},r.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},r.internalField=function(){function e(t,i,n,a){return ns(t[a],this._dimensions[a])}xD={arrayRows:e,objectRows:function(t,i,n,a){return ns(t[i],this._dimensions[a])},keyedColumns:e,original:function(t,i,n,a){var o=t&&(t.value==null?t:t.value);return ns(o instanceof Array?o[a]:o,this._dimensions[a])},typedArray:function(t,i,n,a){return t[a]}}}(),r}(),z_=Hfe;var Ww=function(){function r(e){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=e}return r.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},r.prototype._setLocalSource=function(e,t){this._sourceList=e,this._upstreamSignList=t,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},r.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},r.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},r.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,t=this._getUpstreamSourceManagers(),i=!!t.length,n,a;if(Hw(e)){var o=e,s=void 0,l=void 0,u=void 0;if(i){var c=t[0];c.prepareSource(),u=c.getSource(),s=u.data,l=u.sourceFormat,a=[c._getVersionSign()]}else s=o.get("data",!0),l=bi(s)?So:fn,a=[];var f=this._getSourceMetaRawOption()||{},h=u&&u.metaRawOption||{},p=ft(f.seriesLayoutBy,h.seriesLayoutBy)||null,d=ft(f.sourceHeader,h.sourceHeader),g=ft(f.dimensions,h.dimensions),m=p!==h.seriesLayoutBy||!!d!=!!h.sourceHeader||g;n=m?[O_(s,{seriesLayoutBy:p,sourceHeader:d,dimensions:g},l)]:[]}else{var v=e;if(i){var _=this._applyTransform(t);n=_.sourceList,a=_.upstreamSignList}else{var y=v.get("source",!0);n=[O_(y,this._getSourceMetaRawOption(),null)],a=[]}}this._setLocalSource(n,a)},r.prototype._applyTransform=function(e){var t=this._sourceHost,i=t.get("transform",!0),n=t.get("fromTransformResult",!0);if(n!=null){var a="";e.length!==1&&oW(a)}var o,s=[],l=[];return N(e,function(u){u.prepareSource();var c=u.getSource(n||0),f="";n!=null&&!c&&oW(f),s.push(c),l.push(u._getVersionSign())}),i?o=rW(i,s,{datasetIndex:t.componentIndex}):n!=null&&(o=[Y5(s[0])]),{sourceList:o,upstreamSignList:l}},r.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),t=0;t<e.length;t++){var i=e[t];if(i._isDirty()||this._upstreamSignList[t]!==i._getVersionSign())return!0}},r.prototype.getSource=function(e){e=e||0;var t=this._sourceList[e];if(!t){var i=this._getUpstreamSourceManagers();return i[0]&&i[0].getSource(e)}return t},r.prototype.getSharedDataStore=function(e){var t=e.makeStoreSchema();return this._innerGetDataStore(t.dimensions,e.source,t.hash)},r.prototype._innerGetDataStore=function(e,t,i){var n=0,a=this._storeList,o=a[n];o||(o=a[n]={});var s=o[i];if(!s){var l=this._getUpstreamSourceManagers()[0];Hw(this._sourceHost)&&l?s=l._innerGetDataStore(e,t,i):(s=new z_,s.initData(new Bw(t,e.length),e)),o[i]=s}return s},r.prototype._getUpstreamSourceManagers=function(){var e=this._sourceHost;if(Hw(e)){var t=Pw(e);return t?[t.getSourceManager()]:[]}else return de(T5(e),function(i){return i.getSourceManager()})},r.prototype._getSourceMetaRawOption=function(){var e=this._sourceHost,t,i,n;if(Hw(e))t=e.get("seriesLayoutBy",!0),i=e.get("sourceHeader",!0),n=e.get("dimensions",!0);else if(!this._getUpstreamSourceManagers().length){var a=e;t=a.get("seriesLayoutBy",!0),i=a.get("sourceHeader",!0),n=a.get("dimensions",!0)}return{seriesLayoutBy:t,sourceHeader:i,dimensions:n}},r}();function MD(r){var e=r.option.transform;e&&Qh(r.option.transform)}function Hw(r){return r.mainType==="series"}function oW(r){throw new Error(r)}var sW="line-height:1";function lW(r,e){var t=r.color||"#6e7079",i=r.fontSize||12,n=r.fontWeight||"400",a=r.color||"#464646",o=r.fontSize||14,s=r.fontWeight||"900";return e==="html"?{nameStyle:"font-size:"+yn(i+"")+"px;color:"+yn(t)+";font-weight:"+yn(n+""),valueStyle:"font-size:"+yn(o+"")+"px;color:"+yn(a)+";font-weight:"+yn(s+"")}:{nameStyle:{fontSize:i,fill:t,fontWeight:n},valueStyle:{fontSize:o,fill:a,fontWeight:s}}}var Wfe=[0,10,20,30],Xfe=["",`
  2210. `,`
  2211. `,`
  2212. `];function Or(r,e){return e.type=r,e}function bD(r){return r.type==="section"}function uW(r){return bD(r)?Yfe:qfe}function cW(r){if(bD(r)){var e=0,t=r.blocks.length,i=t>1||t>0&&!r.noHeader;return N(r.blocks,function(n){var a=cW(n);a>=e&&(e=a+ +(i&&(!a||bD(n)&&!n.noHeader)))}),e}return 0}function Yfe(r,e,t,i){var n=e.noHeader,a=Zfe(cW(e)),o=[],s=e.blocks||[];kr(!s||pe(s)),s=s||[];var l=r.orderMode;if(e.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(tt(u,l)){var c=new Vw(u[l],null);s.sort(function(d,g){return c.evaluate(d.sortParam,g.sortParam)})}else l==="seriesDesc"&&s.reverse()}N(s,function(d,g){var m=e.valueFormatter,v=uW(d)(m?fe(fe({},r),{valueFormatter:m}):r,d,g>0?a.html:0,i);v!=null&&o.push(v)});var f=r.renderMode==="richText"?o.join(a.richText):wD(o.join(""),n?t:a.html);if(n)return f;var h=Ew(e.header,"ordinal",r.useUTC),p=lW(i,r.renderMode).nameStyle;return r.renderMode==="richText"?fW(r,h,p)+a.richText+f:wD('<div style="'+p+";"+sW+';">'+yn(h)+"</div>"+f,t)}function qfe(r,e,t,i){var n=r.renderMode,a=e.noName,o=e.noValue,s=!e.markerType,l=e.name,u=r.useUTC,c=e.valueFormatter||r.valueFormatter||function(x){return x=pe(x)?x:[x],de(x,function(M,S){return Ew(M,pe(p)?p[S]:p,u)})};if(!(a&&o)){var f=s?"":r.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",n),h=a?"":Ew(l,"ordinal",u),p=e.valueType,d=o?[]:c(e.value,e.dataIndex),g=!s||!a,m=!s&&a,v=lW(i,n),_=v.nameStyle,y=v.valueStyle;return n==="richText"?(s?"":f)+(a?"":fW(r,h,_))+(o?"":Jfe(r,d,g,m,y)):wD((s?"":f)+(a?"":jfe(h,!s,_))+(o?"":Kfe(d,g,m,y)),t)}}function TD(r,e,t,i,n,a){if(r){var o=uW(r),s={useUTC:n,renderMode:t,orderMode:i,markupStyleCreator:e,valueFormatter:r.valueFormatter};return o(s,r,0,a)}}function Zfe(r){return{html:Wfe[r],richText:Xfe[r]}}function wD(r,e){var t='<div style="clear:both"></div>',i="margin: "+e+"px 0 0";return'<div style="'+i+";"+sW+';">'+r+t+"</div>"}function jfe(r,e,t){var i=e?"margin-left:2px":"";return'<span style="'+t+";"+i+'">'+yn(r)+"</span>"}function Kfe(r,e,t,i){var n=t?"10px":"20px",a=e?"float:right;margin-left:"+n:"";return r=pe(r)?r:[r],'<span style="'+a+";"+i+'">'+de(r,function(o){return yn(o)}).join("&nbsp;&nbsp;")+"</span>"}function fW(r,e,t){return r.markupStyleCreator.wrapRichTextStyle(e,t)}function Jfe(r,e,t,i,n){var a=[n],o=i?10:20;return t&&a.push({padding:[0,0,0,o],align:"right"}),r.markupStyleCreator.wrapRichTextStyle(pe(e)?e.join(" "):e,a)}function Xw(r,e){var t=r.getData().getItemVisual(e,"style"),i=t[r.visualDrawType];return Hs(i)}function Yw(r,e){var t=r.get("padding");return t??(e==="richText"?[8,10]:10)}var qw=function(){function r(){this.richTextStyles={},this._nextStyleNameId=Vb()}return r.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},r.prototype.makeTooltipMarker=function(e,t,i){var n=i==="richText"?this._generateStyleName():null,a=y5({color:t,type:e,renderMode:i,markerId:n});return Ce(a)?a:(this.richTextStyles[n]=a.style,a.content)},r.prototype.wrapRichTextStyle=function(e,t){var i={};pe(t)?N(t,function(a){return fe(i,a)}):fe(i,t);var n=this._generateStyleName();return this.richTextStyles[n]=i,"{"+n+"|"+e+"}"},r}();function Zw(r){var e=r.series,t=r.dataIndex,i=r.multipleSeries,n=e.getData(),a=n.mapDimensionsAll("defaultedTooltip"),o=a.length,s=e.getRawValue(t),l=pe(s),u=Xw(e,t),c,f,h,p;if(o>1||l&&!o){var d=$fe(s,e,t,a,u);c=d.inlineValues,f=d.inlineValueTypes,h=d.blocks,p=d.inlineValues[0]}else if(o){var g=n.getDimensionInfo(a[0]);p=c=Fu(n,t,a[0]),f=g.type}else p=c=l?s[0]:s;var m=Gm(e),v=m&&e.name||"",_=n.getName(t),y=i?v:_;return Or("section",{header:v,noHeader:i||!m,sortParam:p,blocks:[Or("nameValue",{markerType:"item",markerColor:u,name:y,noName:!Yi(y),value:c,valueType:f,dataIndex:t})].concat(h||[])})}function $fe(r,e,t,i,n){var a=e.getData(),o=gn(r,function(f,h,p){var d=a.getDimensionInfo(p);return f=f||d&&d.tooltip!==!1&&d.displayName!=null},!1),s=[],l=[],u=[];i.length?N(i,function(f){c(Fu(a,t,f),f)}):N(r,c);function c(f,h){var p=a.getDimensionInfo(h);!p||p.otherDims.tooltip===!1||(o?u.push(Or("nameValue",{markerType:"subItem",markerColor:n,name:p.displayName,value:f,valueType:p.type})):(s.push(f),l.push(p.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var Rf=vt();function jw(r,e){return r.getName(e)||r.getId(e)}var B_="__universalTransitionEnabled",Kw=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return e.prototype.init=function(t,i,n){this.seriesIndex=this.componentIndex,this.dataTask=Cf({count:ehe,reset:the}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n);var a=Rf(this).sourceManager=new Ww(this);a.prepareSource();var o=this.getInitialData(t,n);pW(o,this),this.dataTask.context.data=o,Rf(this).dataBeforeProcessed=o,hW(this),this._initSelectedMapFromData(o)},e.prototype.mergeDefaultAndTheme=function(t,i){var n=Af(this),a=n?rs(t):{},o=this.subType;Pt.hasClass(o)&&(o+="Series"),_t(t,i.getTheme().get(this.subType)),_t(t,this.getDefaultOption()),yo(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&za(t,a,n)},e.prototype.mergeOption=function(t,i){t=_t(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Af(this);n&&za(this.option,t,n);var a=Rf(this).sourceManager;a.dirty(),a.prepareSource();var o=this.getInitialData(t,i);pW(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,Rf(this).dataBeforeProcessed=o,hW(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(t){if(t&&!bi(t))for(var i=["show"],n=0;n<t.length;n++)t[n]&&t[n].label&&yo(t[n],"label",i)},e.prototype.getInitialData=function(t,i){},e.prototype.appendData=function(t){var i=this.getRawData();i.appendData(t.data)},e.prototype.getData=function(t){var i=ED(this);if(i){var n=i.context.data;return t==null?n:n.getLinkedData(t)}else return Rf(this).data},e.prototype.getAllData=function(){var t=this.getData();return t&&t.getLinkedDataAll?t.getLinkedDataAll():[{data:t}]},e.prototype.setData=function(t){var i=ED(this);if(i){var n=i.context;n.outputData=t,i!==this.dataTask&&(n.data=t)}Rf(this).data=t},e.prototype.getEncode=function(){var t=this.get("encode",!0);if(t)return ke(t)},e.prototype.getSourceManager=function(){return Rf(this).sourceManager},e.prototype.getSource=function(){return this.getSourceManager().getSource()},e.prototype.getRawData=function(){return Rf(this).dataBeforeProcessed},e.prototype.getColorBy=function(){var t=this.get("colorBy");return t||"series"},e.prototype.isColorBySeries=function(){return this.getColorBy()==="series"},e.prototype.getBaseAxis=function(){var t=this.coordinateSystem;return t&&t.getBaseAxis&&t.getBaseAxis()},e.prototype.formatTooltip=function(t,i,n){return Zw({series:this,dataIndex:t,multipleSeries:i})},e.prototype.isAnimationEnabled=function(){var t=this.ecModel;if(Ft.node&&!(t&&t.ssr))return!1;var i=this.getShallow("animation");return i&&this.getData().count()>this.getShallow("animationThreshold")&&(i=!1),!!i},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,i,n){var a=this.ecModel,o=L_.prototype.getColorFromPalette.call(this,t,i,n);return o||(o=a.getColorFromPalette(t,i,n)),o},e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(t,i){this._innerSelect(this.getData(i),t)},e.prototype.unselect=function(t,i){var n=this.option.selectedMap;if(n){var a=this.option.selectedMode,o=this.getData(i);if(a==="series"||n==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s<t.length;s++){var l=t[s],u=jw(o,l);n[u]=!1,this._selectedDataIndicesMap[u]=-1}}},e.prototype.toggleSelect=function(t,i){for(var n=[],a=0;a<t.length;a++)n[0]=t[a],this.isSelected(t[a],i)?this.unselect(n,i):this.select(n,i)},e.prototype.getSelectedDataIndices=function(){if(this.option.selectedMap==="all")return[].slice.call(this.getData().getIndices());for(var t=this._selectedDataIndicesMap,i=bt(t),n=[],a=0;a<i.length;a++){var o=t[i[a]];o>=0&&n.push(o)}return n},e.prototype.isSelected=function(t,i){var n=this.option.selectedMap;if(!n)return!1;var a=this.getData(i);return(n==="all"||n[jw(a,t)])&&!a.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[B_])return!0;var t=this.option.universalTransition;return t?t===!0?!0:t&&t.enabled:!1},e.prototype._innerSelect=function(t,i){var n,a,o=this.option,s=o.selectedMode,l=i.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){qe(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,c=0;c<l;c++){var f=i[c],h=jw(t,f);u[h]=!0,this._selectedDataIndicesMap[h]=t.getRawIndex(f)}}else if(s==="single"||s===!0){var p=i[l-1],h=jw(t,p);o.selectedMap=(n={},n[h]=!0,n),this._selectedDataIndicesMap=(a={},a[h]=t.getRawIndex(p),a)}}},e.prototype._initSelectedMapFromData=function(t){if(!this.option.selectedMap){var i=[];t.hasItemOption&&t.each(function(n){var a=t.getRawDataItem(n);a&&a.selected&&i.push(n)}),i.length>0&&this._innerSelect(t,i)}},e.registerClass=function(t){return Pt.registerClass(t)},e.protoInitialize=function(){var t=e.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),e}(Pt);wr(Kw,hv);wr(Kw,L_);Wb(Kw,Pt);function hW(r){var e=r.name;Gm(r)||(r.name=Qfe(r)||e)}function Qfe(r){var e=r.getRawData(),t=e.mapDimensionsAll("seriesName"),i=[];return N(t,function(n){var a=e.getDimensionInfo(n);a.displayName&&i.push(a.displayName)}),i.join(" ")}function ehe(r){return r.model.getRawData().count()}function the(r){var e=r.model;return e.setData(e.getRawData().cloneShallow()),rhe}function rhe(r,e){e.outputData&&r.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function pW(r,e){N(ep(r.CHANGABLE_METHODS,r.DOWNSAMPLE_METHODS),function(t){r.wrapMethod(t,ot(ihe,e))})}function ihe(r,e){var t=ED(r);return t&&t.setOutputEnd((e||this).count()),e}function ED(r){var e=(r.ecModel||{}).scheduler,t=e&&e.getPipeline(r.uid);if(t){var i=t.currentTask;if(i){var n=i.agentStubMap;n&&(i=n.get(r.uid))}return i}}var jt=Kw;var AD=function(){function r(){this.group=new Ze,this.uid=ts("viewComponent")}return r.prototype.init=function(e,t){},r.prototype.render=function(e,t,i,n){},r.prototype.dispose=function(e,t){},r.prototype.updateView=function(e,t,i,n){},r.prototype.updateLayout=function(e,t,i,n){},r.prototype.updateVisual=function(e,t,i,n){},r.prototype.toggleBlurSeries=function(e,t,i){},r.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},r}();Hm(AD);yf(AD);var Qt=AD;function Mo(){var r=vt();return function(e){var t=r(e),i=e.pipelineContext,n=!!t.large,a=!!t.progressiveRender,o=t.large=!!(i&&i.large),s=t.progressiveRender=!!(i&&i.progressiveRender);return(n!==o||a!==s)&&"reset"}}var vW=vt(),nhe=Mo(),CD=function(){function r(){this.group=new Ze,this.uid=ts("viewChart"),this.renderTask=Cf({plan:ahe,reset:ohe}),this.renderTask.context={view:this}}return r.prototype.init=function(e,t){},r.prototype.render=function(e,t,i,n){},r.prototype.highlight=function(e,t,i,n){var a=e.getData(n&&n.dataType);a&&mW(a,n,"emphasis")},r.prototype.downplay=function(e,t,i,n){var a=e.getData(n&&n.dataType);a&&mW(a,n,"normal")},r.prototype.remove=function(e,t){this.group.removeAll()},r.prototype.dispose=function(e,t){},r.prototype.updateView=function(e,t,i,n){this.render(e,t,i,n)},r.prototype.updateLayout=function(e,t,i,n){this.render(e,t,i,n)},r.prototype.updateVisual=function(e,t,i,n){this.render(e,t,i,n)},r.prototype.eachRendered=function(e){sa(this.group,e)},r.markUpdateMethod=function(e,t){vW(e).updateMethod=t},r.protoInitialize=function(){var e=r.prototype;e.type="chart"}(),r}();function dW(r,e,t){r&&Tf(r)&&(e==="emphasis"?Bn:kn)(r,t)}function mW(r,e,t){var i=Jo(r,e),n=e&&e.highlightKey!=null?v4(e.highlightKey):null;i!=null?N(Jt(i),function(a){dW(r.getItemGraphicEl(a),t,n)}):r.eachItemGraphicEl(function(a){dW(a,t,n)})}Hm(CD,["dispose"]);yf(CD);function ahe(r){return nhe(r.model)}function ohe(r){var e=r.model,t=r.ecModel,i=r.api,n=r.payload,a=e.pipelineContext.progressiveRender,o=r.view,s=n&&vW(n).updateMethod,l=a?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](e,t,i,n),she[l]}var she={incrementalPrepareRender:{progress:function(r,e){e.view.incrementalRender(r,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(r,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}},Yt=CD;var Jw="\0__throttleOriginMethod",gW="\0__throttleRate",yW="\0__throttleType";function k_(r,e,t){var i,n=0,a=0,o=null,s,l,u,c;e=e||0;function f(){a=new Date().getTime(),o=null,r.apply(l,u||[])}var h=function(){for(var p=[],d=0;d<arguments.length;d++)p[d]=arguments[d];i=new Date().getTime(),l=this,u=p;var g=c||e,m=c||t;c=null,s=i-(m?n:a)-g,clearTimeout(o),m?o=setTimeout(f,g):s>=0?f():o=setTimeout(f,-s),n=i};return h.clear=function(){o&&(clearTimeout(o),o=null)},h.debounceNextCall=function(p){c=p},h}function as(r,e,t,i){var n=r[e];if(n){var a=n[Jw]||n,o=n[yW],s=n[gW];if(s!==t||o!==i){if(t==null||!i)return r[e]=a;n=r[e]=k_(a,t,i==="debounce"),n[Jw]=a,n[yW]=i,n[gW]=t}return n}}function zu(r,e){var t=r[e];t&&t[Jw]&&(t.clear&&t.clear(),r[e]=t[Jw])}var _W=vt(),xW={itemStyle:Na(BP,!0),lineStyle:Na(zP,!0)},lhe={lineStyle:"stroke",itemStyle:"fill"};function SW(r,e){var t=r.visualStyleMapper||xW[e];return t||(console.warn("Unknown style type '"+e+"'."),xW.itemStyle)}function MW(r,e){var t=r.visualDrawType||lhe[e];return t||(console.warn("Unknown style type '"+e+"'."),"fill")}var bW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){var t=r.getData(),i=r.visualStyleAccessPath||"itemStyle",n=r.getModel(i),a=SW(r,i),o=a(n),s=n.getShallow("decal");s&&(t.setVisual("decal",s),s.dirty=!0);var l=MW(r,i),u=o[l],c=He(u)?u:null,f=o.fill==="auto"||o.stroke==="auto";if(!o[l]||c||f){var h=r.getColorFromPalette(r.name,null,e.getSeriesCount());o[l]||(o[l]=h,t.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||He(o.fill)?h:o.fill,o.stroke=o.stroke==="auto"||He(o.stroke)?h:o.stroke}if(t.setVisual("style",o),t.setVisual("drawType",l),!e.isSeriesFiltered(r)&&c)return t.setVisual("colorFromPalette",!1),{dataEach:function(p,d){var g=r.getDataParams(d),m=fe({},o);m[l]=c(g),p.setItemVisual(d,"style",m)}}}},V_=new Zt,wW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){if(!(r.ignoreStyleOnData||e.isSeriesFiltered(r))){var t=r.getData(),i=r.visualStyleAccessPath||"itemStyle",n=SW(r,i),a=t.getVisual("drawType");return{dataEach:t.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[i]){V_.option=l[i];var u=n(V_),c=o.ensureUniqueItemVisual(s,"style");fe(c,u),V_.option.decal&&(o.setItemVisual(s,"decal",V_.option.decal),V_.option.decal.dirty=!0),a in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},TW={performRawSeries:!0,overallReset:function(r){var e=ke();r.eachSeries(function(t){var i=t.getColorBy();if(!t.isColorBySeries()){var n=t.type+"-"+i,a=e.get(n);a||(a={},e.set(n,a)),_W(t).scope=a}}),r.eachSeries(function(t){if(!(t.isColorBySeries()||r.isSeriesFiltered(t))){var i=t.getRawData(),n={},a=t.getData(),o=_W(t).scope,s=t.visualStyleAccessPath||"itemStyle",l=MW(t,s);a.each(function(u){var c=a.getRawIndex(u);n[c]=u}),i.each(function(u){var c=n[u],f=a.getItemVisual(c,"colorFromPalette");if(f){var h=a.ensureUniqueItemVisual(c,"style"),p=i.getName(u)||u+"",d=i.count();h[l]=t.getColorFromPalette(p,o,d)}})}})}};var Qw=Math.PI;function RD(r,e){e=e||{},Ye(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var t=new Ze,i=new Tt({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});t.add(i);var n=new Lt({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),a=new Tt({style:{fill:"none"},textContent:n,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});t.add(a);var o;return e.showSpinner&&(o=new __({shape:{startAngle:-Qw/2,endAngle:-Qw/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:Qw*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:Qw*3/2}).delay(300).start("circularInOut"),t.add(o)),t.resize=function(){var s=n.getBoundingRect().width,l=e.showSpinner?e.spinnerRadius:0,u=(r.getWidth()-l*2-(e.showSpinner&&s?10:0)-s)/2-(e.showSpinner&&s?0:5+s/2)+(e.showSpinner?0:s/2)+(s?0:l),c=r.getHeight()/2;e.showSpinner&&o.setShape({cx:u,cy:c}),a.setShape({x:u-l,y:c-l,width:l*2,height:l*2}),i.setShape({x:0,y:0,width:r.getWidth(),height:r.getHeight()})},t.resize(),t}var uhe=function(){function r(e,t,i,n){this._stageTaskMap=ke(),this.ecInstance=e,this.api=t,i=this._dataProcessorHandlers=i.slice(),n=this._visualHandlers=n.slice(),this._allHandlers=i.concat(n)}return r.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(i){var n=i.overallTask;n&&n.dirty()})},r.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var i=this._pipelineMap.get(e.__pipeline.id),n=i.context,a=!t&&i.progressiveEnabled&&(!n||n.progressiveRender)&&e.__idxInPipeline>i.blockIndex,o=a?i.step:null,s=n&&n.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},r.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},r.prototype.updateStreamModes=function(e,t){var i=this._pipelineMap.get(e.uid),n=e.getData(),a=n.count(),o=i.progressiveEnabled&&t.incrementalPrepareRender&&a>=i.threshold,s=e.get("large")&&a>=e.get("largeThreshold"),l=e.get("progressiveChunkMode")==="mod"?a:null;e.pipelineContext=i.context={progressiveRender:o,modDataCount:l,large:s}},r.prototype.restorePipelines=function(e){var t=this,i=t._pipelineMap=ke();e.eachSeries(function(n){var a=n.getProgressive(),o=n.uid;i.set(o,{id:o,head:null,tail:null,threshold:n.getProgressiveThreshold(),progressiveEnabled:a&&!(n.preventIncremental&&n.preventIncremental()),blockIndex:-1,step:Math.round(a||700),count:0}),t._pipe(n,n.dataTask)})},r.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),i=this.api;N(this._allHandlers,function(n){var a=e.get(n.uid)||e.set(n.uid,{}),o="";kr(!(n.reset&&n.overallReset),o),n.reset&&this._createSeriesStageTask(n,a,t,i),n.overallReset&&this._createOverallStageTask(n,a,t,i)},this)},r.prototype.prepareView=function(e,t,i,n){var a=e.renderTask,o=a.context;o.model=t,o.ecModel=i,o.api=n,a.__block=!e.incrementalPrepareRender,this._pipe(t,a)},r.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},r.prototype.performVisualTasks=function(e,t,i){this._performStageTasks(this._visualHandlers,e,t,i)},r.prototype._performStageTasks=function(e,t,i,n){n=n||{};var a=!1,o=this;N(e,function(l,u){if(!(n.visualType&&n.visualType!==l.visualType)){var c=o._stageTaskMap.get(l.uid),f=c.seriesTaskMap,h=c.overallTask;if(h){var p,d=h.agentStubMap;d.each(function(m){s(n,m)&&(m.dirty(),p=!0)}),p&&h.dirty(),o.updatePayload(h,i);var g=o.getPerformArgs(h,n.block);d.each(function(m){m.perform(g)}),h.perform(g)&&(a=!0)}else f&&f.each(function(m,v){s(n,m)&&m.dirty();var _=o.getPerformArgs(m,n.block);_.skip=!l.performRawSeries&&t.isSeriesFiltered(m.context.model),o.updatePayload(m,i),m.perform(_)&&(a=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=a||this.unfinished},r.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(i){t=i.dataTask.perform()||t}),this.unfinished=t||this.unfinished},r.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},r.prototype.updatePayload=function(e,t){t!=="remain"&&(e.context.payload=t)},r.prototype._createSeriesStageTask=function(e,t,i,n){var a=this,o=t.seriesTaskMap,s=t.seriesTaskMap=ke(),l=e.seriesType,u=e.getTargetSeries;e.createOnAllSeries?i.eachRawSeries(c):l?i.eachRawSeriesByType(l,c):u&&u(i,n).each(c);function c(f){var h=f.uid,p=s.set(h,o&&o.get(h)||Cf({plan:dhe,reset:mhe,count:ghe}));p.context={model:f,ecModel:i,api:n,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:a},a._pipe(f,p)}},r.prototype._createOverallStageTask=function(e,t,i,n){var a=this,o=t.overallTask=t.overallTask||Cf({reset:che});o.context={ecModel:i,api:n,overallReset:e.overallReset,scheduler:a};var s=o.agentStubMap,l=o.agentStubMap=ke(),u=e.seriesType,c=e.getTargetSeries,f=!0,h=!1,p="";kr(!e.createOnAllSeries,p),u?i.eachRawSeriesByType(u,d):c?c(i,n).each(d):(f=!1,N(i.getSeries(),d));function d(g){var m=g.uid,v=l.set(m,s&&s.get(m)||(h=!0,Cf({reset:fhe,onDirty:phe})));v.context={model:g,overallProgress:f},v.agent=o,v.__block=f,a._pipe(g,v)}h&&o.dirty()},r.prototype._pipe=function(e,t){var i=e.uid,n=this._pipelineMap.get(i);!n.head&&(n.head=t),n.tail&&n.tail.pipe(t),n.tail=t,t.__idxInPipeline=n.count++,t.__pipeline=n},r.wrapStageHandler=function(e,t){return He(e)&&(e={overallReset:e,seriesType:yhe(e)}),e.uid=ts("stageHandler"),t&&(e.visualType=t),e},r}();function che(r){r.overallReset(r.ecModel,r.api,r.payload)}function fhe(r){return r.overallProgress&&hhe}function hhe(){this.agent.dirty(),this.getDownstream().dirty()}function phe(){this.agent&&this.agent.dirty()}function dhe(r){return r.plan?r.plan(r.model,r.ecModel,r.api,r.payload):null}function mhe(r){r.useClearVisual&&r.data.clearAllVisual();var e=r.resetDefines=Jt(r.reset(r.model,r.ecModel,r.api,r.payload));return e.length>1?de(e,function(t,i){return EW(i)}):vhe}var vhe=EW(0);function EW(r){return function(e,t){var i=t.data,n=t.resetDefines[r];if(n&&n.dataEach)for(var a=e.start;a<e.end;a++)n.dataEach(i,a);else n&&n.progress&&n.progress(e,i)}}function ghe(r){return r.data.count()}function yhe(r){e1=null;try{r(G_,AW)}catch{}return e1}var G_={},AW={},e1;CW(G_,Nw);CW(AW,Uw);G_.eachSeriesByType=G_.eachRawSeriesByType=function(r){e1=r};G_.eachComponent=function(r){r.mainType==="series"&&r.subType&&(e1=r.subType)};function CW(r,e){for(var t in e.prototype)r[t]=Ir}var LD=uhe;var RW=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"],LW={color:RW,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],RW]};var la="#B9B8CE",PW="#100C2A",t1=function(){return{axisLine:{lineStyle:{color:la}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},DW=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],IW={darkMode:!0,color:DW,backgroundColor:PW,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:la}},textStyle:{color:la},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:la}},dataZoom:{borderColor:"#71708A",textStyle:{color:la},brushStyle:{color:"rgba(135,163,206,0.3)"},handleStyle:{color:"#353450",borderColor:"#C5CBE3"},moveHandleStyle:{color:"#B0B6C3",opacity:.3},fillerColor:"rgba(135,163,206,0.2)",emphasis:{handleStyle:{borderColor:"#91B7F2",color:"#4D587D"},moveHandleStyle:{color:"#636D9A",opacity:.7}},dataBackground:{lineStyle:{color:"#71708A",width:1},areaStyle:{color:"#71708A"}},selectedDataBackground:{lineStyle:{color:"#87A3CE"},areaStyle:{color:"#87A3CE"}}},visualMap:{textStyle:{color:la}},timeline:{lineStyle:{color:la},label:{color:la},controlStyle:{color:la,borderColor:la}},calendar:{itemStyle:{color:PW},dayLabel:{color:la},monthLabel:{color:la},yearLabel:{color:la}},timeAxis:t1(),logAxis:t1(),valueAxis:t1(),categoryAxis:t1(),line:{symbol:"circle"},graph:{color:DW},gauge:{title:{color:la},axisLine:{lineStyle:{color:[[1,"rgba(207,212,219,0.2)"]]}},axisLabel:{color:la},detail:{color:"#EEF1FA"}},candlestick:{itemStyle:{color:"#f64e56",color0:"#54ea92",borderColor:"#f64e56",borderColor0:"#54ea92"}}};IW.categoryAxis.splitLine.show=!1;var NW=IW;var UW=function(){function r(){}return r.prototype.normalizeQuery=function(e){var t={},i={},n={};if(Ce(e)){var a=Ia(e);t.mainType=a.main||null,t.subType=a.sub||null}else{var o=["Index","Name","Id"],s={name:1,dataIndex:1,dataType:1};N(e,function(l,u){for(var c=!1,f=0;f<o.length;f++){var h=o[f],p=u.lastIndexOf(h);if(p>0&&p===u.length-h.length){var d=u.slice(0,p);d!=="data"&&(t.mainType=d,t[h.toLowerCase()]=l,c=!0)}}s.hasOwnProperty(u)&&(i[u]=l,c=!0),c||(n[u]=l)})}return{cptQuery:t,dataQuery:i,otherQuery:n}},r.prototype.filter=function(e,t){var i=this.eventInfo;if(!i)return!0;var n=i.targetEl,a=i.packedEvent,o=i.model,s=i.view;if(!o||!s)return!0;var l=t.cptQuery,u=t.dataQuery;return c(l,o,"mainType")&&c(l,o,"subType")&&c(l,o,"index","componentIndex")&&c(l,o,"name")&&c(l,o,"id")&&c(u,a,"name")&&c(u,a,"dataIndex")&&c(u,a,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(e,t.otherQuery,n,a));function c(f,h,p,d){return f[p]==null||h[d||p]===f[p]}},r.prototype.afterTrigger=function(){this.eventInfo=null},r}();var PD=["symbol","symbolSize","symbolRotate","symbolOffset"],OW=PD.concat(["symbolKeepAspect"]),FW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){var t=r.getData();if(r.legendIcon&&t.setVisual("legendIcon",r.legendIcon),!r.hasSymbolVisual)return;for(var i={},n={},a=!1,o=0;o<PD.length;o++){var s=PD[o],l=r.get(s);He(l)?(a=!0,n[s]=l):i[s]=l}if(i.symbol=i.symbol||r.defaultSymbol,t.setVisual(fe({legendIcon:r.legendIcon||i.symbol,symbolKeepAspect:r.get("symbolKeepAspect")},i)),e.isSeriesFiltered(r))return;var u=bt(n);function c(f,h){for(var p=r.getRawValue(h),d=r.getDataParams(h),g=0;g<u.length;g++){var m=u[g];f.setItemVisual(h,m,n[m](p,d))}}return{dataEach:a?c:null}}},zW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){if(!r.hasSymbolVisual||e.isSeriesFiltered(r))return;var t=r.getData();function i(n,a){for(var o=n.getItemModel(a),s=0;s<OW.length;s++){var l=OW[s],u=o.getShallow(l,!0);u!=null&&n.setItemVisual(a,l,u)}}return{dataEach:t.hasItemOption?i:null}}};function H_(r,e,t){switch(t){case"color":var i=r.getItemVisual(e,"style");return i[r.getVisual("drawType")];case"opacity":return r.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return r.getItemVisual(e,t);default:}}function kl(r,e){switch(e){case"color":var t=r.getVisual("style");return t[r.getVisual("drawType")];case"opacity":return r.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return r.getVisual(e);default:}}function DD(r,e,t,i){switch(t){case"color":var n=r.ensureUniqueItemVisual(e,"style");n[r.getVisual("drawType")]=i,r.setItemVisual(e,"colorFromPalette",!1);break;case"opacity":r.ensureUniqueItemVisual(e,"style").opacity=i;break;case"symbol":case"symbolSize":case"liftZ":r.setItemVisual(e,t,i);break;default:}}function r1(r,e){function t(i,n){var a=[];return i.eachComponent({mainType:"series",subType:r,query:n},function(o){a.push(o.seriesIndex)}),a}N([[r+"ToggleSelect","toggleSelect"],[r+"Select","select"],[r+"UnSelect","unselect"]],function(i){e(i[0],function(n,a,o){n=fe({},n),o.dispatchAction(fe(n,{type:i[1],seriesIndex:t(a,n)}))})})}function dv(r,e,t,i,n){var a=r+e;t.isSilent(a)||i.eachComponent({mainType:"series",subType:"pie"},function(o){for(var s=o.seriesIndex,l=o.option.selectedMap,u=n.selected,c=0;c<u.length;c++)if(u[c].seriesIndex===s){var f=o.getData(),h=Jo(f,n.fromActionPayload);t.trigger(a,{type:a,seriesId:o.id,name:pe(h)?f.getName(h[0]):f.getName(h),selected:Ce(l)?l:fe({},l)})}})}function BW(r,e,t){r.on("selectchanged",function(i){var n=t.getModel();i.isFromClick?(dv("map","selectchanged",e,n,i),dv("pie","selectchanged",e,n,i)):i.fromAction==="select"?(dv("map","selected",e,n,i),dv("pie","selected",e,n,i)):i.fromAction==="unselect"&&(dv("map","unselected",e,n,i),dv("pie","unselected",e,n,i))})}function Ys(r,e,t){for(var i;r&&!(e(r)&&(i=r,t));)r=r.__hostTarget||r.parent;return i}var _he=Math.round(Math.random()*9),xhe=typeof Object.defineProperty=="function",She=function(){function r(){this._id="__ec_inner_"+_he++}return r.prototype.get=function(e){return this._guard(e)[this._id]},r.prototype.set=function(e,t){var i=this._guard(e);return xhe?Object.defineProperty(i,this._id,{value:t,enumerable:!1,configurable:!0}):i[this._id]=t,this},r.prototype.delete=function(e){return this.has(e)?(delete this._guard(e)[this._id],!0):!1},r.prototype.has=function(e){return!!this._guard(e)[this._id]},r.prototype._guard=function(e){if(e!==Object(e))throw TypeError("Value of WeakMap is not a non-null object.");return e},r}(),kW=She;var Mhe=ut.extend({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(r,e){var t=e.cx,i=e.cy,n=e.width/2,a=e.height/2;r.moveTo(t,i-a),r.lineTo(t+n,i+a),r.lineTo(t-n,i+a),r.closePath()}}),bhe=ut.extend({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(r,e){var t=e.cx,i=e.cy,n=e.width/2,a=e.height/2;r.moveTo(t,i-a),r.lineTo(t+n,i),r.lineTo(t,i+a),r.lineTo(t-n,i),r.closePath()}}),whe=ut.extend({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(r,e){var t=e.x,i=e.y,n=e.width/5*3,a=Math.max(n,e.height),o=n/2,s=o*o/(a-o),l=i-a+o+s,u=Math.asin(s/o),c=Math.cos(u)*o,f=Math.sin(u),h=Math.cos(u),p=o*.6,d=o*.7;r.moveTo(t-c,l+s),r.arc(t,l,o,Math.PI-u,Math.PI*2+u),r.bezierCurveTo(t+c-f*p,l+s+h*p,t,i-d,t,i),r.bezierCurveTo(t,i-d,t-c+f*p,l+s+h*p,t-c,l+s),r.closePath()}}),The=ut.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(r,e){var t=e.height,i=e.width,n=e.x,a=e.y,o=i/3*2;r.moveTo(n,a),r.lineTo(n+o,a+t),r.lineTo(n,a+t/4*3),r.lineTo(n-o,a+t),r.lineTo(n,a),r.closePath()}}),Ehe={line:Kr,rect:Tt,roundRect:Tt,square:Tt,circle:oa,diamond:bhe,pin:whe,arrow:The,triangle:Mhe},Ahe={line:function(r,e,t,i,n){n.x1=r,n.y1=e+i/2,n.x2=r+t,n.y2=e+i/2},rect:function(r,e,t,i,n){n.x=r,n.y=e,n.width=t,n.height=i},roundRect:function(r,e,t,i,n){n.x=r,n.y=e,n.width=t,n.height=i,n.r=Math.min(t,i)/4},square:function(r,e,t,i,n){var a=Math.min(t,i);n.x=r,n.y=e,n.width=a,n.height=a},circle:function(r,e,t,i,n){n.cx=r+t/2,n.cy=e+i/2,n.r=Math.min(t,i)/2},diamond:function(r,e,t,i,n){n.cx=r+t/2,n.cy=e+i/2,n.width=t,n.height=i},pin:function(r,e,t,i,n){n.x=r+t/2,n.y=e+i/2,n.width=t,n.height=i},arrow:function(r,e,t,i,n){n.x=r+t/2,n.y=e+i/2,n.width=t,n.height=i},triangle:function(r,e,t,i,n){n.cx=r+t/2,n.cy=e+i/2,n.width=t,n.height=i}},W_={};N(Ehe,function(r,e){W_[e]=new r});var Che=ut.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(r,e,t){var i=gp(r,e,t),n=this.shape;return n&&n.symbolType==="pin"&&e.position==="inside"&&(i.y=t.y+t.height*.4),i},buildPath:function(r,e,t){var i=e.symbolType;if(i!=="none"){var n=W_[i];n||(i="rect",n=W_[i]),Ahe[i](e.x,e.y,e.width,e.height,n.shape),n.buildPath(r,n.shape,t)}}});function Rhe(r,e){if(this.type!=="image"){var t=this.style;this.__isEmptyBrush?(t.stroke=r,t.fill=e||"#fff",t.lineWidth=2):this.shape.symbolType==="line"?t.stroke=r:t.fill=r,this.markRedraw()}}function Sr(r,e,t,i,n,a,o){var s=r.indexOf("empty")===0;s&&(r=r.substr(5,1).toLowerCase()+r.substr(6));var l;return r.indexOf("image://")===0?l=IP(r.slice(8),new lt(e,t,i,n),o?"center":"cover"):r.indexOf("path://")===0?l=tv(r.slice(7),{},new lt(e,t,i,n),o?"center":"cover"):l=new Che({shape:{symbolType:r,x:e,y:t,width:i,height:n}}),l.__isEmptyBrush=s,l.setColor=Rhe,a&&l.setColor(a),l}function qs(r){return pe(r)||(r=[+r,+r]),[r[0]||0,r[1]||0]}function bo(r,e){if(r!=null)return pe(r)||(r=[r,r]),[Fe(r[0],e[0])||0,Fe(ft(r[1],r[0]),e[1])||0]}function Xp(r){return isFinite(r)}function Lhe(r,e,t){var i=e.x==null?0:e.x,n=e.x2==null?1:e.x2,a=e.y==null?0:e.y,o=e.y2==null?0:e.y2;e.global||(i=i*t.width+t.x,n=n*t.width+t.x,a=a*t.height+t.y,o=o*t.height+t.y),i=Xp(i)?i:0,n=Xp(n)?n:1,a=Xp(a)?a:0,o=Xp(o)?o:0;var s=r.createLinearGradient(i,a,n,o);return s}function Phe(r,e,t){var i=t.width,n=t.height,a=Math.min(i,n),o=e.x==null?.5:e.x,s=e.y==null?.5:e.y,l=e.r==null?.5:e.r;e.global||(o=o*i+t.x,s=s*n+t.y,l=l*a),o=Xp(o)?o:.5,s=Xp(s)?s:.5,l=l>=0&&Xp(l)?l:.5;var u=r.createRadialGradient(o,s,0,o,s,l);return u}function X_(r,e,t){for(var i=e.type==="radial"?Phe(r,e,t):Lhe(r,e,t),n=e.colorStops,a=0;a<n.length;a++)i.addColorStop(n[a].offset,n[a].color);return i}function GW(r,e){if(r===e||!r&&!e)return!1;if(!r||!e||r.length!==e.length)return!0;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!0;return!1}function i1(r){return parseInt(r,10)}function Lf(r,e,t){var i=["width","height"][e],n=["clientWidth","clientHeight"][e],a=["paddingLeft","paddingTop"][e],o=["paddingRight","paddingBottom"][e];if(t[i]!=null&&t[i]!=="auto")return parseFloat(t[i]);var s=document.defaultView.getComputedStyle(r);return(r[n]||i1(s[i])||i1(r.style[i]))-(i1(s[a])||0)-(i1(s[o])||0)|0}function Dhe(r,e){return!r||r==="solid"||!(e>0)?null:r==="dashed"?[4*e,2*e]:r==="dotted"?[e]:At(r)?[r]:pe(r)?r:null}function Y_(r){var e=r.style,t=e.lineDash&&e.lineWidth>0&&Dhe(e.lineDash,e.lineWidth),i=e.lineDashOffset;if(t){var n=e.strokeNoScale&&r.getLineScale?r.getLineScale():1;n&&n!==1&&(t=de(t,function(a){return a/n}),i/=n)}return[t,i]}var Ihe=new Ki(!0);function n1(r){var e=r.stroke;return!(e==null||e==="none"||!(r.lineWidth>0))}function HW(r){return typeof r=="string"&&r!=="none"}function a1(r){var e=r.fill;return e!=null&&e!=="none"}function WW(r,e){if(e.fillOpacity!=null&&e.fillOpacity!==1){var t=r.globalAlpha;r.globalAlpha=e.fillOpacity*e.opacity,r.fill(),r.globalAlpha=t}else r.fill()}function XW(r,e){if(e.strokeOpacity!=null&&e.strokeOpacity!==1){var t=r.globalAlpha;r.globalAlpha=e.strokeOpacity*e.opacity,r.stroke(),r.globalAlpha=t}else r.stroke()}function o1(r,e,t){var i=o_(e.image,e.__image,t);if(Wm(i)){var n=r.createPattern(i,e.repeat||"repeat");if(typeof DOMMatrix=="function"&&n&&n.setTransform){var a=new DOMMatrix;a.translateSelf(e.x||0,e.y||0),a.rotateSelf(0,0,(e.rotation||0)*bm),a.scaleSelf(e.scaleX||1,e.scaleY||1),n.setTransform(a)}return n}}function Nhe(r,e,t,i){var n,a=n1(t),o=a1(t),s=t.strokePercent,l=s<1,u=!e.path;(!e.silent||l)&&u&&e.createPathProxy();var c=e.path||Ihe,f=e.__dirty;if(!i){var h=t.fill,p=t.stroke,d=o&&!!h.colorStops,g=a&&!!p.colorStops,m=o&&!!h.image,v=a&&!!p.image,_=void 0,y=void 0,x=void 0,M=void 0,S=void 0;(d||g)&&(S=e.getBoundingRect()),d&&(_=f?X_(r,h,S):e.__canvasFillGradient,e.__canvasFillGradient=_),g&&(y=f?X_(r,p,S):e.__canvasStrokeGradient,e.__canvasStrokeGradient=y),m&&(x=f||!e.__canvasFillPattern?o1(r,h,e):e.__canvasFillPattern,e.__canvasFillPattern=x),v&&(M=f||!e.__canvasStrokePattern?o1(r,p,e):e.__canvasStrokePattern,e.__canvasStrokePattern=x),d?r.fillStyle=_:m&&(x?r.fillStyle=x:o=!1),g?r.strokeStyle=y:v&&(M?r.strokeStyle=M:a=!1)}var w=e.getGlobalScale();c.setScale(w[0],w[1],e.segmentIgnoreThreshold);var T,C;r.setLineDash&&t.lineDash&&(n=Y_(e),T=n[0],C=n[1]);var b=!0;(u||f&cf)&&(c.setDPR(r.dpr),l?c.setContext(null):(c.setContext(r),b=!1),c.reset(),e.buildPath(c,e.shape,i),c.toStatic(),e.pathUpdated()),b&&c.rebuildPath(r,l?s:1),T&&(r.setLineDash(T),r.lineDashOffset=C),i||(t.strokeFirst?(a&&XW(r,t),o&&WW(r,t)):(o&&WW(r,t),a&&XW(r,t))),T&&r.setLineDash([])}function Uhe(r,e,t){var i=e.__image=o_(t.image,e.__image,e,e.onload);if(!(!i||!Wm(i))){var n=t.x||0,a=t.y||0,o=e.getWidth(),s=e.getHeight(),l=i.width/i.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=i.width,s=i.height),t.sWidth&&t.sHeight){var u=t.sx||0,c=t.sy||0;r.drawImage(i,u,c,t.sWidth,t.sHeight,n,a,o,s)}else if(t.sx&&t.sy){var u=t.sx,c=t.sy,f=o-u,h=s-c;r.drawImage(i,u,c,f,h,n,a,o,s)}else r.drawImage(i,n,a,o,s)}}function Ohe(r,e,t){var i,n=t.text;if(n!=null&&(n+=""),n){r.font=t.font||ho,r.textAlign=t.textAlign,r.textBaseline=t.textBaseline;var a=void 0,o=void 0;r.setLineDash&&t.lineDash&&(i=Y_(e),a=i[0],o=i[1]),a&&(r.setLineDash(a),r.lineDashOffset=o),t.strokeFirst?(n1(t)&&r.strokeText(n,t.x,t.y),a1(t)&&r.fillText(n,t.x,t.y)):(a1(t)&&r.fillText(n,t.x,t.y),n1(t)&&r.strokeText(n,t.x,t.y)),a&&r.setLineDash([])}}var YW=["shadowBlur","shadowOffsetX","shadowOffsetY"],qW=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function QW(r,e,t,i,n){var a=!1;if(!i&&(t=t||{},e===t))return!1;if(i||e.opacity!==t.opacity){ka(r,n),a=!0;var o=Math.max(Math.min(e.opacity,1),0);r.globalAlpha=isNaN(o)?Pl.opacity:o}(i||e.blend!==t.blend)&&(a||(ka(r,n),a=!0),r.globalCompositeOperation=e.blend||Pl.blend);for(var s=0;s<YW.length;s++){var l=YW[s];(i||e[l]!==t[l])&&(a||(ka(r,n),a=!0),r[l]=r.dpr*(e[l]||0))}return(i||e.shadowColor!==t.shadowColor)&&(a||(ka(r,n),a=!0),r.shadowColor=e.shadowColor||Pl.shadowColor),a}function ZW(r,e,t,i,n){var a=q_(e,n.inHover),o=i?null:t&&q_(t,n.inHover)||{};if(a===o)return!1;var s=QW(r,a,o,i,n);if((i||a.fill!==o.fill)&&(s||(ka(r,n),s=!0),HW(a.fill)&&(r.fillStyle=a.fill)),(i||a.stroke!==o.stroke)&&(s||(ka(r,n),s=!0),HW(a.stroke)&&(r.strokeStyle=a.stroke)),(i||a.opacity!==o.opacity)&&(s||(ka(r,n),s=!0),r.globalAlpha=a.opacity==null?1:a.opacity),e.hasStroke()){var l=a.lineWidth,u=l/(a.strokeNoScale&&e.getLineScale?e.getLineScale():1);r.lineWidth!==u&&(s||(ka(r,n),s=!0),r.lineWidth=u)}for(var c=0;c<qW.length;c++){var f=qW[c],h=f[0];(i||a[h]!==o[h])&&(s||(ka(r,n),s=!0),r[h]=a[h]||f[1])}return s}function Fhe(r,e,t,i,n){return QW(r,q_(e,n.inHover),t&&q_(t,n.inHover),i,n)}function e6(r,e){var t=e.transform,i=r.dpr||1;t?r.setTransform(i*t[0],i*t[1],i*t[2],i*t[3],i*t[4],i*t[5]):r.setTransform(i,0,0,i,0,0)}function zhe(r,e,t){for(var i=!1,n=0;n<r.length;n++){var a=r[n];i=i||a.isZeroArea(),e6(e,a),e.beginPath(),a.buildPath(e,a.shape),e.clip()}t.allClipped=i}function Bhe(r,e){return r&&e?r[0]!==e[0]||r[1]!==e[1]||r[2]!==e[2]||r[3]!==e[3]||r[4]!==e[4]||r[5]!==e[5]:!(!r&&!e)}var jW=1,KW=2,JW=3,$W=4;function khe(r){var e=a1(r),t=n1(r);return!(r.lineDash||!(+e^+t)||e&&typeof r.fill!="string"||t&&typeof r.stroke!="string"||r.strokePercent<1||r.strokeOpacity<1||r.fillOpacity<1)}function ka(r,e){e.batchFill&&r.fill(),e.batchStroke&&r.stroke(),e.batchFill="",e.batchStroke=""}function q_(r,e){return e&&r.__hoverStyle||r.style}function s1(r,e){Pf(r,e,{inHover:!1,viewWidth:0,viewHeight:0},!0)}function Pf(r,e,t,i){var n=e.transform;if(!e.shouldBePainted(t.viewWidth,t.viewHeight,!1,!1)){e.__dirty&=~zi,e.__isRendered=!1;return}var a=e.__clipPaths,o=t.prevElClipPaths,s=!1,l=!1;if((!o||GW(a,o))&&(o&&o.length&&(ka(r,t),r.restore(),l=s=!0,t.prevElClipPaths=null,t.allClipped=!1,t.prevEl=null),a&&a.length&&(ka(r,t),r.save(),zhe(a,r,t),s=!0),t.prevElClipPaths=a),t.allClipped){e.__isRendered=!1;return}e.beforeBrush&&e.beforeBrush(),e.innerBeforeBrush();var u=t.prevEl;u||(l=s=!0);var c=e instanceof ut&&e.autoBatch&&khe(e.style);s||Bhe(n,u.transform)?(ka(r,t),e6(r,e)):c||ka(r,t);var f=q_(e,t.inHover);e instanceof ut?(t.lastDrawType!==jW&&(l=!0,t.lastDrawType=jW),ZW(r,e,u,l,t),(!c||!t.batchFill&&!t.batchStroke)&&r.beginPath(),Nhe(r,e,f,c),c&&(t.batchFill=f.fill||"",t.batchStroke=f.stroke||"")):e instanceof bu?(t.lastDrawType!==JW&&(l=!0,t.lastDrawType=JW),ZW(r,e,u,l,t),Ohe(r,e,f)):e instanceof Ur?(t.lastDrawType!==KW&&(l=!0,t.lastDrawType=KW),Fhe(r,e,u,l,t),Uhe(r,e,f)):e.getTemporalDisplayables&&(t.lastDrawType!==$W&&(l=!0,t.lastDrawType=$W),Vhe(r,e,t)),c&&i&&ka(r,t),e.innerAfterBrush(),e.afterBrush&&e.afterBrush(),t.prevEl=e,e.__dirty=0,e.__isRendered=!0}function Vhe(r,e,t){var i=e.getDisplayables(),n=e.getTemporalDisplayables();r.save();var a={prevElClipPaths:null,prevEl:null,allClipped:!1,viewWidth:t.viewWidth,viewHeight:t.viewHeight,inHover:t.inHover},o,s;for(o=e.getCursor(),s=i.length;o<s;o++){var l=i[o];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),Pf(r,l,a,o===s-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),a.prevEl=l}for(var u=0,c=n.length;u<c;u++){var l=n[u];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),Pf(r,l,a,u===c-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),a.prevEl=l}e.clearTemporalDisplayables(),e.notClear=!0,r.restore()}var ID=new kW,t6=new _u(100),r6=["symbol","symbolSize","symbolKeepAspect","color","backgroundColor","dashArrayX","dashArrayY","maxTileWidth","maxTileHeight"];function Zs(r,e){if(r==="none")return null;var t=e.getDevicePixelRatio(),i=e.getZr(),n=i.painter.type==="svg";r.dirty&&ID.delete(r);var a=ID.get(r);if(a)return a;var o=Ye(r,{symbol:"rect",symbolSize:1,symbolKeepAspect:!0,color:"rgba(0, 0, 0, 0.2)",backgroundColor:null,dashArrayX:5,dashArrayY:5,rotation:0,maxTileWidth:512,maxTileHeight:512});o.backgroundColor==="none"&&(o.backgroundColor=null);var s={repeat:"repeat"};return l(s),s.rotation=o.rotation,s.scaleX=s.scaleY=n?1:1/t,ID.set(r,s),r.dirty=!1,s;function l(u){for(var c=[t],f=!0,h=0;h<r6.length;++h){var p=o[r6[h]];if(p!=null&&!pe(p)&&!Ce(p)&&!At(p)&&typeof p!="boolean"){f=!1;break}c.push(p)}var d;if(f){d=c.join(",")+(n?"-svg":"");var g=t6.get(d);g&&(n?u.svgElement=g:u.image=g)}var m=n6(o.dashArrayX),v=Ghe(o.dashArrayY),_=i6(o.symbol),y=Hhe(m),x=a6(v),M=!n&&zn.createCanvas(),S=n&&{tag:"g",attrs:{},key:"dcl",children:[]},w=C(),T;M&&(M.width=w.width*t,M.height=w.height*t,T=M.getContext("2d")),b(),f&&t6.put(d,M||S),u.image=M,u.svgElement=S,u.svgWidth=w.width,u.svgHeight=w.height;function C(){for(var E=1,I=0,R=y.length;I<R;++I)E=ZL(E,y[I]);for(var A=1,I=0,R=_.length;I<R;++I)A=ZL(A,_[I].length);E*=A;var D=x*y.length*_.length;if(0)var U;return{width:Math.max(1,Math.min(E,o.maxTileWidth)),height:Math.max(1,Math.min(D,o.maxTileHeight))}}function b(){T&&(T.clearRect(0,0,M.width,M.height),o.backgroundColor&&(T.fillStyle=o.backgroundColor,T.fillRect(0,0,M.width,M.height)));for(var E=0,I=0;I<v.length;++I)E+=v[I];if(E<=0)return;for(var R=-x,A=0,D=0,U=0;R<w.height;){if(A%2===0){for(var B=D/2%_.length,F=0,k=0,G=0;F<w.width*2;){for(var Y=0,I=0;I<m[U].length;++I)Y+=m[U][I];if(Y<=0)break;if(k%2===0){var J=(1-o.symbolSize)*.5,Q=F+m[U][k]*J,V=R+v[A]*J,K=m[U][k]*o.symbolSize,ae=v[A]*o.symbolSize,ve=G/2%_[B].length;ue(Q,V,K,ae,_[B][ve])}F+=m[U][k],++G,++k,k===m[U].length&&(k=0)}++U,U===m.length&&(U=0)}R+=v[A],++D,++A,A===v.length&&(A=0)}function ue(se,Ee,q,H,We){var _e=n?1:t,xe=Sr(We,se*_e,Ee*_e,q*_e,H*_e,o.color,o.symbolKeepAspect);if(n){var Le=i.painter.renderOneToVNode(xe);Le&&S.children.push(Le)}else s1(T,xe)}}}}function i6(r){if(!r||r.length===0)return[["rect"]];if(Ce(r))return[[r]];for(var e=!0,t=0;t<r.length;++t)if(!Ce(r[t])){e=!1;break}if(e)return i6([r]);for(var i=[],t=0;t<r.length;++t)Ce(r[t])?i.push([r[t]]):i.push(r[t]);return i}function n6(r){if(!r||r.length===0)return[[0,0]];if(At(r)){var e=Math.ceil(r);return[[e,e]]}for(var t=!0,i=0;i<r.length;++i)if(!At(r[i])){t=!1;break}if(t)return n6([r]);for(var n=[],i=0;i<r.length;++i)if(At(r[i])){var e=Math.ceil(r[i]);n.push([e,e])}else{var e=de(r[i],function(s){return Math.ceil(s)});e.length%2===1?n.push(e.concat(e)):n.push(e)}return n}function Ghe(r){if(!r||typeof r=="object"&&r.length===0)return[0,0];if(At(r)){var e=Math.ceil(r);return[e,e]}var t=de(r,function(i){return Math.ceil(i)});return r.length%2?t.concat(t):t}function Hhe(r){return de(r,function(e){return a6(e)})}function a6(r){for(var e=0,t=0;t<r.length;++t)e+=r[t];return r.length%2===1?e*2:e}function ND(r,e){r.eachRawSeries(function(t){if(!r.isSeriesFiltered(t)){var i=t.getData();i.hasItemVisual()&&i.each(function(o){var s=i.getItemVisual(o,"decal");if(s){var l=i.ensureUniqueItemVisual(o,"style");l.decal=Zs(s,e)}});var n=i.getVisual("decal");if(n){var a=i.getVisual("style");a.decal=Zs(n,e)}}})}var Whe=new Di,os=Whe;var o6={};function s6(r,e){o6[r]=e}function l6(r){return o6[r]}var Xhe=1,Yhe=800,qhe=900,Zhe=1e3,jhe=2e3,Khe=5e3,y6=1e3,Jhe=1100,XD=2e3,_6=3e3,$he=4e3,h1=4500,Qhe=4600,epe=5e3,tpe=6e3,x6=7e3,S6={PROCESSOR:{FILTER:Zhe,SERIES_FILTER:Yhe,STATISTIC:Khe},VISUAL:{LAYOUT:y6,PROGRESSIVE_LAYOUT:Jhe,GLOBAL:XD,CHART:_6,POST_CHART_LAYOUT:Qhe,COMPONENT:$he,BRUSH:epe,CHART_ITEM:h1,ARIA:tpe,DECAL:x6}},Xn="__flagInMainProcess",Va="__pendingUpdate",UD="__needsUpdateStatus",u6=/^[a-zA-Z0-9_]+$/,OD="__connectUpdateStatus",c6=0,rpe=1,ipe=2;function M6(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.isDisposed()){this.id;return}return w6(this,r,e)}}function b6(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return w6(this,r,e)}}function w6(r,e,t){return t[0]=t[0]&&t[0].toLowerCase(),Di.prototype[e].apply(r,t)}var T6=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Di),E6=T6.prototype;E6.on=b6("on");E6.off=b6("off");var mv,FD,l1,Df,zD,BD,kD,Z_,j_,f6,h6,VD,p6,u1,d6,A6,ss,m6,C6=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,new UW)||this;a._chartsViews=[],a._chartsMap={},a._componentsViews=[],a._componentsMap={},a._pendingActions=[],n=n||{},Ce(i)&&(i=R6[i]),a._dom=t;var o="canvas",s="auto",l=!1;if(0)var u;n.ssr&&qG(function(p){var d=rt(p),g=d.dataIndex;if(g!=null){var m=ke();return m.set("series_index",d.seriesIndex),m.set("data_index",g),d.ssrType&&m.set("ssr_type",d.ssrType),m}});var c=a._zr=XL(t,{renderer:n.renderer||o,devicePixelRatio:n.devicePixelRatio,width:n.width,height:n.height,ssr:n.ssr,useDirtyRect:ft(n.useDirtyRect,l),useCoarsePointer:ft(n.useCoarsePointer,s),pointerSize:n.pointerSize});a._ssr=n.ssr,a._throttledZrFlush=k_(Be(c.flush,c),17),i=Qe(i),i&&Ow(i,!0),a._theme=i,a._locale=u5(n.locale||xw),a._coordSysMgr=new Uu;var f=a._api=d6(a);function h(p,d){return p.__prio-d.__prio}return ap(f1,h),ap(GD,h),a._scheduler=new LD(a,f,GD,f1),a._messageCenter=new T6,a._initEvents(),a.resize=Be(a.resize,a),c.animation.on("frame",a._onframe,a),f6(c,a),h6(c,a),Qh(a),a}return e.prototype._onframe=function(){if(!this._disposed){m6(this);var t=this._scheduler;if(this[Va]){var i=this[Va].silent;this[Xn]=!0;try{mv(this),Df.update.call(this,null,this[Va].updateParams)}catch(l){throw this[Xn]=!1,this[Va]=null,l}this._zr.flush(),this[Xn]=!1,this[Va]=null,Z_.call(this,i),j_.call(this,i)}else if(t.unfinished){var n=Xhe,a=this._model,o=this._api;t.unfinished=!1;do{var s=+new Date;t.performSeriesTasks(a),t.performDataProcessorTasks(a),BD(this,a),t.performVisualTasks(a),u1(this,this._model,o,"remain",{}),n-=+new Date-s}while(n>0&&t.unfinished);t.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(t,i,n){if(!this[Xn]){if(this._disposed){this.id;return}var a,o,s;if(qe(i)&&(n=i.lazyUpdate,a=i.silent,o=i.replaceMerge,s=i.transition,i=i.notMerge),this[Xn]=!0,!this._model||i){var l=new F5(this._api),u=this._theme,c=this._model=new Nw;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(t,{replaceMerge:o},HD);var f={seriesTransition:s,optionChanged:!0};if(n)this[Va]={silent:a,updateParams:f},this[Xn]=!1,this.getZr().wakeUp();else{try{mv(this),Df.update.call(this,null,f)}catch(h){throw this[Va]=null,this[Xn]=!1,h}this._ssr||this._zr.flush(),this[Va]=null,this[Xn]=!1,Z_.call(this,a),j_.call(this,a)}}},e.prototype.setTheme=function(){},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||Ft.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},e.prototype.renderToCanvas=function(t){t=t||{};var i=this._zr.painter;return i.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(t){t=t||{};var i=this._zr.painter;return i.renderToString({useViewBox:t.useViewBox})},e.prototype.getSvgDataURL=function(){if(Ft.svgSupported){var t=this._zr,i=t.storage.getDisplayList();return N(i,function(n){n.stopAnimation(null,!0)}),t.painter.toDataURL()}},e.prototype.getDataURL=function(t){if(this._disposed){this.id;return}t=t||{};var i=t.excludeComponents,n=this._model,a=[],o=this;N(i,function(l){n.eachComponent({mainType:l},function(u){var c=o._componentsMap[u.__viewId];c.group.ignore||(a.push(c),c.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return N(a,function(l){l.group.ignore=!1}),s},e.prototype.getConnectedDataURL=function(t){if(this._disposed){this.id;return}var i=t.type==="svg",n=this.group,a=Math.min,o=Math.max,s=1/0;if(v6[n]){var l=s,u=s,c=-s,f=-s,h=[],p=t&&t.pixelRatio||this.getDevicePixelRatio();N(J_,function(y,x){if(y.group===n){var M=i?y.getZr().painter.getSvgDom().innerHTML:y.renderToCanvas(Qe(t)),S=y.getDom().getBoundingClientRect();l=a(S.left,l),u=a(S.top,u),c=o(S.right,c),f=o(S.bottom,f),h.push({dom:M,left:S.left,top:S.top})}}),l*=p,u*=p,c*=p,f*=p;var d=c-l,g=f-u,m=zn.createCanvas(),v=XL(m,{renderer:i?"svg":"canvas"});if(v.resize({width:d,height:g}),i){var _="";return N(h,function(y){var x=y.left-l,M=y.top-u;_+='<g transform="translate('+x+","+M+')">'+y.dom+"</g>"}),v.painter.getSvgRoot().innerHTML=_,t.connectedBackgroundColor&&v.painter.setBackgroundColor(t.connectedBackgroundColor),v.refreshImmediately(),v.painter.toDataURL()}else return t.connectedBackgroundColor&&v.add(new Tt({shape:{x:0,y:0,width:d,height:g},style:{fill:t.connectedBackgroundColor}})),N(h,function(y){var x=new Ur({style:{x:y.left*p-l,y:y.top*p-u,image:y.dom}});v.add(x)}),v.refreshImmediately(),m.toDataURL("image/"+(t&&t.type||"png"))}else return this.getDataURL(t)},e.prototype.convertToPixel=function(t,i){return zD(this,"convertToPixel",t,i)},e.prototype.convertFromPixel=function(t,i){return zD(this,"convertFromPixel",t,i)},e.prototype.containPixel=function(t,i){if(this._disposed){this.id;return}var n=this._model,a,o=vf(n,t);return N(o,function(s,l){l.indexOf("Models")>=0&&N(s,function(u){var c=u.coordinateSystem;if(c&&c.containPoint)a=a||!!c.containPoint(i);else if(l==="seriesModels"){var f=this._chartsMap[u.__viewId];f&&f.containPoint&&(a=a||f.containPoint(i,u))}},this)},this),!!a},e.prototype.getVisual=function(t,i){var n=this._model,a=vf(n,t,{defaultMainType:"series"}),o=a.seriesModel,s=o.getData(),l=a.hasOwnProperty("dataIndexInside")?a.dataIndexInside:a.hasOwnProperty("dataIndex")?s.indexOfRawIndex(a.dataIndex):null;return l!=null?H_(s,l,i):kl(s,i)},e.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},e.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},e.prototype._initEvents=function(){var t=this;N(npe,function(i){var n=function(a){var o=t.getModel(),s=a.target,l,u=i==="globalout";if(u?l={}:s&&Ys(s,function(d){var g=rt(d);if(g&&g.dataIndex!=null){var m=g.dataModel||o.getSeriesByIndex(g.seriesIndex);return l=m&&m.getDataParams(g.dataIndex,g.dataType,s)||{},!0}else if(g.eventData)return l=fe({},g.eventData),!0},!0),l){var c=l.componentType,f=l.componentIndex;(c==="markLine"||c==="markPoint"||c==="markArea")&&(c="series",f=l.seriesIndex);var h=c&&f!=null&&o.getComponent(c,f),p=h&&t[h.mainType==="series"?"_chartsMap":"_componentsMap"][h.__viewId];l.event=a,l.type=i,t._$eventProcessor.eventInfo={targetEl:s,packedEvent:l,model:h,view:p},t.trigger(i,l)}};n.zrEventfulCallAtLast=!0,t._zr.on(i,n,t)}),N(K_,function(i,n){t._messageCenter.on(n,function(a){this.trigger(n,a)},t)}),N(["selectchanged"],function(i){t._messageCenter.on(i,function(n){this.trigger(i,n)},t)}),BW(this._messageCenter,this,this._api)},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var t=this.getDom();t&&KL(this.getDom(),qD,"");var i=this,n=i._api,a=i._model;N(i._componentsViews,function(o){o.dispose(a,n)}),N(i._chartsViews,function(o){o.dispose(a,n)}),i._zr.dispose(),i._dom=i._model=i._chartsMap=i._componentsMap=i._chartsViews=i._componentsViews=i._scheduler=i._api=i._zr=i._throttledZrFlush=i._theme=i._coordSysMgr=i._messageCenter=null,delete J_[i.id]},e.prototype.resize=function(t){if(!this[Xn]){if(this._disposed){this.id;return}this._zr.resize(t);var i=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!i){var n=i.resetOption("media"),a=t&&t.silent;this[Va]&&(a==null&&(a=this[Va].silent),n=!0,this[Va]=null),this[Xn]=!0;try{n&&mv(this),Df.update.call(this,{type:"resize",animation:fe({duration:0},t&&t.animation)})}catch(o){throw this[Xn]=!1,o}this[Xn]=!1,Z_.call(this,a),j_.call(this,a)}}},e.prototype.showLoading=function(t,i){if(this._disposed){this.id;return}if(qe(t)&&(i=t,t=""),t=t||"default",this.hideLoading(),!!WD[t]){var n=WD[t](this._api,i),a=this._zr;this._loadingFX=n,a.add(n)}},e.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},e.prototype.makeActionFromEvent=function(t){var i=fe({},t);return i.type=K_[t.type],i},e.prototype.dispatchAction=function(t,i){if(this._disposed){this.id;return}if(qe(i)||(i={silent:!!i}),!!c1[t.type]&&this._model){if(this[Xn]){this._pendingActions.push(t);return}var n=i.silent;kD.call(this,t,n);var a=i.flush;a?this._zr.flush():a!==!1&&Ft.browser.weChat&&this._throttledZrFlush(),Z_.call(this,n),j_.call(this,n)}},e.prototype.updateLabelLayout=function(){os.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(t){if(this._disposed){this.id;return}var i=t.seriesIndex,n=this.getModel(),a=n.getSeriesByIndex(i);a.appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()},e.internalField=function(){mv=function(f){var h=f._scheduler;h.restorePipelines(f._model),h.prepareStageTasks(),FD(f,!0),FD(f,!1),h.plan()},FD=function(f,h){for(var p=f._model,d=f._scheduler,g=h?f._componentsViews:f._chartsViews,m=h?f._componentsMap:f._chartsMap,v=f._zr,_=f._api,y=0;y<g.length;y++)g[y].__alive=!1;h?p.eachComponent(function(S,w){S!=="series"&&x(w)}):p.eachSeries(x);function x(S){var w=S.__requireNewView;S.__requireNewView=!1;var T="_ec_"+S.id+"_"+S.type,C=!w&&m[T];if(!C){var b=Ia(S.type),E=h?Qt.getClass(b.main,b.sub):Yt.getClass(b.sub);C=new E,C.init(p,_),m[T]=C,g.push(C),v.add(C.group)}S.__viewId=C.__id=T,C.__alive=!0,C.__model=S,C.group.__ecComponentInfo={mainType:S.mainType,index:S.componentIndex},!h&&d.prepareView(C,S,p,_)}for(var y=0;y<g.length;){var M=g[y];M.__alive?y++:(!h&&M.renderTask.dispose(),v.remove(M.group),M.dispose(p,_),g.splice(y,1),m[M.__id]===M&&delete m[M.__id],M.__id=M.group.__ecComponentInfo=null)}},l1=function(f,h,p,d,g){var m=f._model;if(m.setUpdatePayload(p),!d){N([].concat(f._componentsViews).concat(f._chartsViews),M);return}var v={};v[d+"Id"]=p[d+"Id"],v[d+"Index"]=p[d+"Index"],v[d+"Name"]=p[d+"Name"];var _={mainType:d,query:v};g&&(_.subType=g);var y=p.excludeSeriesId,x;y!=null&&(x=ke(),N(Jt(y),function(S){var w=Yr(S,null);w!=null&&x.set(w,!0)})),m&&m.eachComponent(_,function(S){var w=x&&x.get(S.id)!=null;if(!w)if(TP(p))if(S instanceof jt)p.type===wf&&!p.notBlur&&!S.get(["emphasis","disabled"])&&c4(S,p,f._api);else{var T=ew(S.mainType,S.componentIndex,p.name,f._api),C=T.focusSelf,b=T.dispatchers;p.type===wf&&C&&!p.notBlur&&Jb(S.mainType,S.componentIndex,f._api),b&&N(b,function(E){p.type===wf?Bn(E):kn(E)})}else rw(p)&&S instanceof jt&&(p4(S,p,f._api),wP(S),ss(f))},f),m&&m.eachComponent(_,function(S){var w=x&&x.get(S.id)!=null;w||M(f[d==="series"?"_chartsMap":"_componentsMap"][S.__viewId])},f);function M(S){S&&S.__alive&&S[h]&&S[h](S.__model,m,f._api,p)}},Df={prepareAndUpdate:function(f){mv(this),Df.update.call(this,f,{optionChanged:f.newOption!=null})},update:function(f,h){var p=this._model,d=this._api,g=this._zr,m=this._coordSysMgr,v=this._scheduler;if(p){p.setUpdatePayload(f),v.restoreData(p,f),v.performSeriesTasks(p),m.create(p,d),v.performDataProcessorTasks(p,f),BD(this,p),m.update(p,d),t(p),v.performVisualTasks(p,f),VD(this,p,d,f,h);var _=p.get("backgroundColor")||"transparent",y=p.get("darkMode");g.setBackgroundColor(_),y!=null&&y!=="auto"&&g.setDarkMode(y),os.trigger("afterupdate",p,d)}},updateTransform:function(f){var h=this,p=this._model,d=this._api;if(p){p.setUpdatePayload(f);var g=[];p.eachComponent(function(v,_){if(v!=="series"){var y=h.getViewOfComponentModel(_);if(y&&y.__alive)if(y.updateTransform){var x=y.updateTransform(_,p,d,f);x&&x.update&&g.push(y)}else g.push(y)}});var m=ke();p.eachSeries(function(v){var _=h._chartsMap[v.__viewId];if(_.updateTransform){var y=_.updateTransform(v,p,d,f);y&&y.update&&m.set(v.uid,1)}else m.set(v.uid,1)}),t(p),this._scheduler.performVisualTasks(p,f,{setDirty:!0,dirtyMap:m}),u1(this,p,d,f,{},m),os.trigger("afterupdate",p,d)}},updateView:function(f){var h=this._model;h&&(h.setUpdatePayload(f),Yt.markUpdateMethod(f,"updateView"),t(h),this._scheduler.performVisualTasks(h,f,{setDirty:!0}),VD(this,h,this._api,f,{}),os.trigger("afterupdate",h,this._api))},updateVisual:function(f){var h=this,p=this._model;p&&(p.setUpdatePayload(f),p.eachSeries(function(d){d.getData().clearAllVisual()}),Yt.markUpdateMethod(f,"updateVisual"),t(p),this._scheduler.performVisualTasks(p,f,{visualType:"visual",setDirty:!0}),p.eachComponent(function(d,g){if(d!=="series"){var m=h.getViewOfComponentModel(g);m&&m.__alive&&m.updateVisual(g,p,h._api,f)}}),p.eachSeries(function(d){var g=h._chartsMap[d.__viewId];g.updateVisual(d,p,h._api,f)}),os.trigger("afterupdate",p,this._api))},updateLayout:function(f){Df.update.call(this,f)}},zD=function(f,h,p,d){if(f._disposed){f.id;return}for(var g=f._model,m=f._coordSysMgr.getCoordinateSystems(),v,_=vf(g,p),y=0;y<m.length;y++){var x=m[y];if(x[h]&&(v=x[h](g,_,d))!=null)return v}},BD=function(f,h){var p=f._chartsMap,d=f._scheduler;h.eachSeries(function(g){d.updateStreamModes(g,p[g.__viewId])})},kD=function(f,h){var p=this,d=this.getModel(),g=f.type,m=f.escapeConnect,v=c1[g],_=v.actionInfo,y=(_.update||"update").split(":"),x=y.pop(),M=y[0]!=null&&Ia(y[0]);this[Xn]=!0;var S=[f],w=!1;f.batch&&(w=!0,S=de(f.batch,function(A){return A=Ye(fe({},A),f),A.batch=null,A}));var T=[],C,b=rw(f),E=TP(f);if(E&&bP(this._api),N(S,function(A){if(C=v.action(A,p._model,p._api),C=C||fe({},A),C.type=_.event||C.type,T.push(C),E){var D=n_(f),U=D.queryOptionMap,B=D.mainTypeSpecified,F=B?U.keys()[0]:"series";l1(p,x,A,F),ss(p)}else b?(l1(p,x,A,"series"),ss(p)):M&&l1(p,x,A,M.main,M.sub)}),x!=="none"&&!E&&!b&&!M)try{this[Va]?(mv(this),Df.update.call(this,f),this[Va]=null):Df[x].call(this,f)}catch(A){throw this[Xn]=!1,A}if(w?C={type:_.event||g,escapeConnect:m,batch:T}:C=T[0],this[Xn]=!1,!h){var I=this._messageCenter;if(I.trigger(C.type,C),b){var R={type:"selectchanged",escapeConnect:m,selected:d4(d),isFromClick:f.isFromClick||!1,fromAction:f.type,fromActionPayload:f};I.trigger(R.type,R)}}},Z_=function(f){for(var h=this._pendingActions;h.length;){var p=h.shift();kD.call(this,p,f)}},j_=function(f){!f&&this.trigger("updated")},f6=function(f,h){f.on("rendered",function(p){h.trigger("rendered",p),f.animation.isFinished()&&!h[Va]&&!h._scheduler.unfinished&&!h._pendingActions.length&&h.trigger("finished")})},h6=function(f,h){f.on("mouseover",function(p){var d=p.target,g=Ys(d,Tf);g&&(f4(g,p,h._api),ss(h))}).on("mouseout",function(p){var d=p.target,g=Ys(d,Tf);g&&(h4(g,p,h._api),ss(h))}).on("click",function(p){var d=p.target,g=Ys(d,function(_){return rt(_).dataIndex!=null},!0);if(g){var m=g.selected?"unselect":"select",v=rt(g);h._api.dispatchAction({type:m,dataType:v.dataType,dataIndexInside:v.dataIndex,seriesIndex:v.seriesIndex,isFromClick:!0})}})};function t(f){f.clearColorPalette(),f.eachSeries(function(h){h.clearColorPalette()})}function i(f){var h=[],p=[],d=!1;if(f.eachComponent(function(_,y){var x=y.get("zlevel")||0,M=y.get("z")||0,S=y.getZLevelKey();d=d||!!S,(_==="series"?p:h).push({zlevel:x,z:M,idx:y.componentIndex,type:_,key:S})}),d){var g=h.concat(p),m,v;ap(g,function(_,y){return _.zlevel===y.zlevel?_.z-y.z:_.zlevel-y.zlevel}),N(g,function(_){var y=f.getComponent(_.type,_.idx),x=_.zlevel,M=_.key;m!=null&&(x=Math.max(m,x)),M?(x===m&&M!==v&&x++,v=M):v&&(x===m&&x++,v=""),m=x,y.setZLevel(x)})}}VD=function(f,h,p,d,g){i(h),p6(f,h,p,d,g),N(f._chartsViews,function(m){m.__alive=!1}),u1(f,h,p,d,g),N(f._chartsViews,function(m){m.__alive||m.remove(h,p)})},p6=function(f,h,p,d,g,m){N(m||f._componentsViews,function(v){var _=v.__model;u(_,v),v.render(_,h,p,d),s(_,v),c(_,v)})},u1=function(f,h,p,d,g,m){var v=f._scheduler;g=fe(g||{},{updatedSeries:h.getSeries()}),os.trigger("series:beforeupdate",h,p,g);var _=!1;h.eachSeries(function(y){var x=f._chartsMap[y.__viewId];x.__alive=!0;var M=x.renderTask;v.updatePayload(M,d),u(y,x),m&&m.get(y.uid)&&M.dirty(),M.perform(v.getPerformArgs(M))&&(_=!0),x.group.silent=!!y.get("silent"),o(y,x),wP(y)}),v.unfinished=_||v.unfinished,os.trigger("series:layoutlabels",h,p,g),os.trigger("series:transition",h,p,g),h.eachSeries(function(y){var x=f._chartsMap[y.__viewId];s(y,x),c(y,x)}),a(f,h),os.trigger("series:afterupdate",h,p,g)},ss=function(f){f[UD]=!0,f.getZr().wakeUp()},m6=function(f){f[UD]&&(f.getZr().storage.traverse(function(h){Au(h)||n(h)}),f[UD]=!1)};function n(f){for(var h=[],p=f.currentStates,d=0;d<p.length;d++){var g=p[d];g==="emphasis"||g==="blur"||g==="select"||h.push(g)}f.selected&&f.states.select&&h.push("select"),f.hoverState===f_&&f.states.emphasis?h.push("emphasis"):f.hoverState===Cp&&f.states.blur&&h.push("blur"),f.useStates(h)}function a(f,h){var p=f._zr,d=p.storage,g=0;d.traverse(function(m){m.isGroup||g++}),g>h.get("hoverLayerThreshold")&&!Ft.node&&!Ft.worker&&h.eachSeries(function(m){if(!m.preventUsingHoverLayer){var v=f._chartsMap[m.__viewId];v.__alive&&v.eachRendered(function(_){_.states.emphasis&&(_.states.emphasis.hoverLayer=!0)})}})}function o(f,h){var p=f.get("blendMode")||null;h.eachRendered(function(d){d.isGroup||(d.style.blend=p)})}function s(f,h){if(!f.preventAutoZ){var p=f.get("z")||0,d=f.get("zlevel")||0;h.eachRendered(function(g){return l(g,p,d,-1/0),!0})}}function l(f,h,p,d){var g=f.getTextContent(),m=f.getTextGuideLine(),v=f.isGroup;if(v)for(var _=f.childrenRef(),y=0;y<_.length;y++)d=Math.max(l(_[y],h,p,d),d);else f.z=h,f.zlevel=p,d=Math.max(f.z2,d);if(g&&(g.z=h,g.zlevel=p,isFinite(d)&&(g.z2=d+2)),m){var x=f.textGuideLineConfig;m.z=h,m.zlevel=p,isFinite(d)&&(m.z2=d+(x&&x.showAbove?1:-1))}return d}function u(f,h){h.eachRendered(function(p){if(!Au(p)){var d=p.getTextContent(),g=p.getTextGuideLine();p.stateTransition&&(p.stateTransition=null),d&&d.stateTransition&&(d.stateTransition=null),g&&g.stateTransition&&(g.stateTransition=null),p.hasState()?(p.prevStates=p.currentStates,p.clearStates()):p.prevStates&&(p.prevStates=null)}})}function c(f,h){var p=f.getModel("stateAnimation"),d=f.isAnimationEnabled(),g=p.get("duration"),m=g>0?{duration:g,delay:p.get("delay"),easing:p.get("easing")}:null;h.eachRendered(function(v){if(v.states&&v.states.emphasis){if(Au(v))return;if(v instanceof ut&&g4(v),v.__dirty){var _=v.prevStates;_&&v.useStates(_)}if(d){v.stateTransition=m;var y=v.getTextContent(),x=v.getTextGuideLine();y&&(y.stateTransition=m),x&&(x.stateTransition=m)}v.__dirty&&n(v)}})}d6=function(f){return new(function(h){Z(p,h);function p(){return h!==null&&h.apply(this,arguments)||this}return p.prototype.getCoordinateSystems=function(){return f._coordSysMgr.getCoordinateSystems()},p.prototype.getComponentByElement=function(d){for(;d;){var g=d.__ecComponentInfo;if(g!=null)return f._model.getComponent(g.mainType,g.index);d=d.parent}},p.prototype.enterEmphasis=function(d,g){Bn(d,g),ss(f)},p.prototype.leaveEmphasis=function(d,g){kn(d,g),ss(f)},p.prototype.enterBlur=function(d){Qb(d),ss(f)},p.prototype.leaveBlur=function(d){d_(d),ss(f)},p.prototype.enterSelect=function(d){SP(d),ss(f)},p.prototype.leaveSelect=function(d){MP(d),ss(f)},p.prototype.getModel=function(){return f.getModel()},p.prototype.getViewOfComponentModel=function(d){return f.getViewOfComponentModel(d)},p.prototype.getViewOfSeriesModel=function(d){return f.getViewOfSeriesModel(d)},p}(Uw))(f)},A6=function(f){function h(p,d){for(var g=0;g<p.length;g++){var m=p[g];m[OD]=d}}N(K_,function(p,d){f._messageCenter.on(d,function(g){if(v6[f.group]&&f[OD]!==c6){if(g&&g.escapeConnect)return;var m=f.makeActionFromEvent(g),v=[];N(J_,function(_){_!==f&&_.group===f.group&&v.push(_)}),h(v,c6),N(v,function(_){_[OD]!==rpe&&_.dispatchAction(m)}),h(v,ipe)}})})}}(),e}(Di),YD=C6.prototype;YD.on=M6("on");YD.off=M6("off");YD.one=function(r,e,t){var i=this;function n(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];e&&e.apply&&e.apply(this,a),i.off(r,n)}this.on.call(this,r,n,t)};var npe=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];var c1={},K_={},GD=[],HD=[],f1=[],R6={},WD={},J_={},v6={},ape=+new Date-0,_5e=+new Date-0,qD="_echarts_instance_";function ZD(r,e,t){var i=!(t&&t.ssr);if(i){var n=ope(r);if(n)return n}var a=new C6(r,e,t);return a.id="ec_"+ape++,J_[a.id]=a,i&&KL(r,qD,a.id),A6(a),os.trigger("afterinit",a),a}function ope(r){return J_[cH(r,qD)]}function L6(r,e){R6[r]=e}function jD(r){dt(HD,r)<0&&HD.push(r)}function KD(r,e){JD(GD,r,e,jhe)}function P6(r){p1("afterinit",r)}function D6(r){p1("afterupdate",r)}function p1(r,e){os.on(r,e)}function ua(r,e,t){He(e)&&(t=e,e="");var i=qe(r)?r.type:[r,r={event:e}][0];r.event=(r.event||i).toLowerCase(),e=r.event,!K_[e]&&(kr(u6.test(i)&&u6.test(e)),c1[i]||(c1[i]={action:t,actionInfo:r}),K_[e]=i)}function I6(r,e){Uu.register(r,e)}function N6(r,e){JD(f1,r,e,y6,"layout")}function If(r,e){JD(f1,r,e,_6,"visual")}var g6=[];function JD(r,e,t,i,n){if((He(e)||qe(e))&&(t=e,e=i),!(dt(g6,t)>=0)){g6.push(t);var a=LD.wrapStageHandler(t,n);a.__prio=e,a.__raw=t,r.push(a)}}function $D(r,e){WD[r]=e}function U6(r,e,t){var i=l6("registerMap");i&&i(r,e,t)}var O6=tW;If(XD,bW);If(h1,wW);If(h1,TW);If(XD,FW);If(h1,zW);If(x6,ND);jD(Ow);KD(qhe,fD);$D("default",RD);ua({type:wf,event:wf,update:wf},Ir);ua({type:h_,event:h_,update:h_},Ir);ua({type:Zm,event:Zm,update:Zm},Ir);ua({type:p_,event:p_,update:p_},Ir);ua({type:jm,event:jm,update:jm},Ir);L6("light",LW);L6("dark",NW);var F6=[],spe={registerPreprocessor:jD,registerProcessor:KD,registerPostInit:P6,registerPostUpdate:D6,registerUpdateLifecycle:p1,registerAction:ua,registerCoordinateSystem:I6,registerLayout:N6,registerVisual:If,registerTransform:O6,registerLoading:$D,registerMap:U6,registerImpl:s6,PRIORITY:S6,ComponentModel:Pt,ComponentView:Qt,SeriesModel:jt,ChartView:Yt,registerComponentModel:function(r){Pt.registerClass(r)},registerComponentView:function(r){Qt.registerClass(r)},registerSeriesModel:function(r){jt.registerClass(r)},registerChartView:function(r){Yt.registerClass(r)},registerSubTypeDefaulter:function(r,e){Pt.registerSubTypeDefaulter(r,e)},registerPainter:function(r,e){XG(r,e)}};function It(r){if(pe(r)){N(r,function(e){It(e)});return}dt(F6,r)>=0||(F6.push(r),He(r)&&(r={install:r}),r.install(spe))}function $_(r){return r==null?0:r.length||1}function z6(r){return r}var lpe=function(){function r(e,t,i,n,a,o){this._old=e,this._new=t,this._oldKeyGetter=i||z6,this._newKeyGetter=n||z6,this.context=a,this._diffModeMultiple=o==="multiple"}return r.prototype.add=function(e){return this._add=e,this},r.prototype.update=function(e){return this._update=e,this},r.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},r.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},r.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},r.prototype.remove=function(e){return this._remove=e,this},r.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},r.prototype._executeOneToOne=function(){var e=this._old,t=this._new,i={},n=new Array(e.length),a=new Array(t.length);this._initIndexMap(e,null,n,"_oldKeyGetter"),this._initIndexMap(t,i,a,"_newKeyGetter");for(var o=0;o<e.length;o++){var s=n[o],l=i[s],u=$_(l);if(u>1){var c=l.shift();l.length===1&&(i[s]=l[0]),this._update&&this._update(c,o)}else u===1?(i[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(a,i)},r.prototype._executeMultiple=function(){var e=this._old,t=this._new,i={},n={},a=[],o=[];this._initIndexMap(e,i,a,"_oldKeyGetter"),this._initIndexMap(t,n,o,"_newKeyGetter");for(var s=0;s<a.length;s++){var l=a[s],u=i[l],c=n[l],f=$_(u),h=$_(c);if(f>1&&h===1)this._updateManyToOne&&this._updateManyToOne(c,u),n[l]=null;else if(f===1&&h>1)this._updateOneToMany&&this._updateOneToMany(c,u),n[l]=null;else if(f===1&&h===1)this._update&&this._update(c,u),n[l]=null;else if(f>1&&h>1)this._updateManyToMany&&this._updateManyToMany(c,u),n[l]=null;else if(f>1)for(var p=0;p<f;p++)this._remove&&this._remove(u[p]);else this._remove&&this._remove(u)}this._performRestAdd(o,n)},r.prototype._performRestAdd=function(e,t){for(var i=0;i<e.length;i++){var n=e[i],a=t[n],o=$_(a);if(o>1)for(var s=0;s<o;s++)this._add&&this._add(a[s]);else o===1&&this._add&&this._add(a);t[n]=null}},r.prototype._initIndexMap=function(e,t,i,n){for(var a=this._diffModeMultiple,o=0;o<e.length;o++){var s="_ec_"+this[n](e[o],o);if(a||(i[o]=s),!!t){var l=t[s],u=$_(l);u===0?(t[s]=o,a&&i.push(s)):u===1?t[s]=[l,o]:l.push(o)}}},r}(),An=lpe;var upe=function(){function r(e,t){this._encode=e,this._schema=t}return r.prototype.get=function(){return{fullDimensions:this._getFullDimensionNames(),encode:this._encode}},r.prototype._getFullDimensionNames=function(){return this._cachedDimNames||(this._cachedDimNames=this._schema?this._schema.makeOutputDimensionNames():[]),this._cachedDimNames},r}();function B6(r,e){var t={},i=t.encode={},n=ke(),a=[],o=[],s={};N(r.dimensions,function(h){var p=r.getDimensionInfo(h),d=p.coordDim;if(d){var g=p.coordDimIndex;QD(i,d)[g]=h,p.isExtraCoord||(n.set(d,1),cpe(p.type)&&(a[0]=h),QD(s,d)[g]=r.getDimensionIndex(p.name)),p.defaultTooltip&&o.push(h)}Rw.each(function(m,v){var _=QD(i,v),y=p.otherDims[v];y!=null&&y!==!1&&(_[y]=p.name)})});var l=[],u={};n.each(function(h,p){var d=i[p];u[p]=d[0],l=l.concat(d)}),t.dataDimsOnCoord=l,t.dataDimIndicesOnCoord=de(l,function(h){return r.getDimensionInfo(h).storeDimIndex}),t.encodeFirstDimNotExtra=u;var c=i.label;c&&c.length&&(a=c.slice());var f=i.tooltip;return f&&f.length?o=f.slice():o.length||(o=a.slice()),i.defaultedLabel=a,i.defaultedTooltip=o,t.userOutput=new upe(s,e),t}function QD(r,e){return r.hasOwnProperty(e)||(r[e]=[]),r[e]}function Yp(r){return r==="category"?"ordinal":r==="time"?"time":"float"}function cpe(r){return!(r==="ordinal"||r==="time")}var fpe=function(){function r(e){this.otherDims={},e!=null&&fe(this,e)}return r}(),vv=fpe;var hpe=vt(),ppe={float:"f",int:"i",ordinal:"o",number:"n",time:"t"},e2=function(){function r(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return r.prototype.isDimensionOmitted=function(){return this._dimOmitted},r.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||(this._dimNameMap=r2(this.source)))},r.prototype.getSourceDimensionIndex=function(e){return ft(this._dimNameMap.get(e),-1)},r.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},r.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=zw(this.source),i=!i2(e),n="",a=[],o=0,s=0;o<e;o++){var l=void 0,u=void 0,c=void 0,f=this.dimensions[s];if(f&&f.storeDimIndex===o)l=t?f.name:null,u=f.type,c=f.ordinalMeta,s++;else{var h=this.getSourceDimension(o);h&&(l=t?h.name:null,u=h.type)}a.push({property:l,type:u,ordinalMeta:c}),t&&l!=null&&(!f||!f.isCalculationCoord)&&(n+=i?l.replace(/\`/g,"`1").replace(/\$/g,"`2"):l),n+="$",n+=ppe[u]||"f",c&&(n+=c.uid),n+="$"}var p=this.source,d=[p.seriesLayoutBy,p.startIndex,n].join("$$");return{dimensions:a,hash:d}},r.prototype.makeOutputDimensionNames=function(){for(var e=[],t=0,i=0;t<this._fullDimCount;t++){var n=void 0,a=this.dimensions[i];if(a&&a.storeDimIndex===t)a.isCalculationCoord||(n=a.name),i++;else{var o=this.getSourceDimension(t);o&&(n=o.name)}e.push(n)}return e},r.prototype.appendCalculationDimension=function(e){this.dimensions.push(e),e.isCalculationCoord=!0,this._fullDimCount++,this._updateDimOmitted(!0)},r}();function m1(r){return r instanceof e2}function t2(r){for(var e=ke(),t=0;t<(r||[]).length;t++){var i=r[t],n=qe(i)?i.name:i;n!=null&&e.get(n)==null&&e.set(n,t)}return e}function r2(r){var e=hpe(r);return e.dimNameMap||(e.dimNameMap=t2(r.dimensionsDefine))}function i2(r){return r>30}var Q_=qe,Nf=de,dpe=typeof Int32Array>"u"?Array:Int32Array,mpe="e\0\0",k6=-1,vpe=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],gpe=["_approximateExtent"],V6,v1,ex,tx,n2,g1,a2,ype=function(){function r(e,t){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","lttbDownSample"];var i,n=!1;m1(e)?(i=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(n=!0,i=e),i=i||["x","y"];for(var a={},o=[],s={},l=!1,u={},c=0;c<i.length;c++){var f=i[c],h=Ce(f)?new vv({name:f}):f instanceof vv?f:new vv(f),p=h.name;h.type=h.type||"float",h.coordDim||(h.coordDim=p,h.coordDimIndex=0);var d=h.otherDims=h.otherDims||{};o.push(p),a[p]=h,u[p]!=null&&(l=!0),h.createInvertedIndices&&(s[p]=[]),d.itemName===0&&(this._nameDimIdx=c),d.itemId===0&&(this._idDimIdx=c),n&&(h.storeDimIndex=c)}if(this.dimensions=o,this._dimInfos=a,this._initGetDimensionInfo(l),this.hostModel=t,this._invertedIndicesMap=s,this._dimOmitted){var g=this._dimIdxToName=ke();N(o,function(m){g.set(a[m].storeDimIndex,m)})}}return r.prototype.getDimension=function(e){var t=this._recognizeDimIndex(e);if(t==null)return e;if(t=e,!this._dimOmitted)return this.dimensions[t];var i=this._dimIdxToName.get(t);if(i!=null)return i;var n=this._schema.getSourceDimension(t);if(n)return n.name},r.prototype.getDimensionIndex=function(e){var t=this._recognizeDimIndex(e);if(t!=null)return t;if(e==null)return-1;var i=this._getDimInfo(e);return i?i.storeDimIndex:this._dimOmitted?this._schema.getSourceDimensionIndex(e):-1},r.prototype._recognizeDimIndex=function(e){if(At(e)||e!=null&&!isNaN(e)&&!this._getDimInfo(e)&&(!this._dimOmitted||this._schema.getSourceDimensionIndex(e)<0))return+e},r.prototype._getStoreDimIndex=function(e){var t=this.getDimensionIndex(e);return t},r.prototype.getDimensionInfo=function(e){return this._getDimInfo(this.getDimension(e))},r.prototype._initGetDimensionInfo=function(e){var t=this._dimInfos;this._getDimInfo=e?function(i){return t.hasOwnProperty(i)?t[i]:void 0}:function(i){return t[i]}},r.prototype.getDimensionsOnCoord=function(){return this._dimSummary.dataDimsOnCoord.slice()},r.prototype.mapDimension=function(e,t){var i=this._dimSummary;if(t==null)return i.encodeFirstDimNotExtra[e];var n=i.encode[e];return n?n[t]:null},r.prototype.mapDimensionsAll=function(e){var t=this._dimSummary,i=t.encode[e];return(i||[]).slice()},r.prototype.getStore=function(){return this._store},r.prototype.initData=function(e,t,i){var n=this,a;if(e instanceof z_&&(a=e),!a){var o=this.dimensions,s=cv(e)||ci(e)?new Bw(e,o.length):e;a=new z_;var l=Nf(o,function(u){return{type:n._dimInfos[u].type,property:u}});a.initData(s,l,i)}this._store=a,this._nameList=(t||[]).slice(),this._idList=[],this._nameRepeatCount={},this._doInit(0,a.count()),this._dimSummary=B6(this,this._schema),this.userOutput=this._dimSummary.userOutput},r.prototype.appendData=function(e){var t=this._store.appendData(e);this._doInit(t[0],t[1])},r.prototype.appendValues=function(e,t){var i=this._store.appendValues(e,t.length),n=i.start,a=i.end,o=this._shouldMakeIdFromName();if(this._updateOrdinalMeta(),t)for(var s=n;s<a;s++){var l=s-n;this._nameList[s]=t[l],o&&a2(this,s)}},r.prototype._updateOrdinalMeta=function(){for(var e=this._store,t=this.dimensions,i=0;i<t.length;i++){var n=this._dimInfos[t[i]];n.ordinalMeta&&e.collectOrdinalMeta(n.storeDimIndex,n.ordinalMeta)}},r.prototype._shouldMakeIdFromName=function(){var e=this._store.getProvider();return this._idDimIdx==null&&e.getSource().sourceFormat!==So&&!e.fillStorage},r.prototype._doInit=function(e,t){if(!(e>=t)){var i=this._store,n=i.getProvider();this._updateOrdinalMeta();var a=this._nameList,o=this._idList,s=n.getSource().sourceFormat,l=s===fn;if(l&&!n.pure)for(var u=[],c=e;c<t;c++){var f=n.getItem(c,u);if(!this.hasItemOption&&nH(f)&&(this.hasItemOption=!0),f){var h=f.name;a[c]==null&&h!=null&&(a[c]=Yr(h,null));var p=f.id;o[c]==null&&p!=null&&(o[c]=Yr(p,null))}}if(this._shouldMakeIdFromName())for(var c=e;c<t;c++)a2(this,c);V6(this)}},r.prototype.getApproximateExtent=function(e){return this._approximateExtent[e]||this._store.getDataExtent(this._getStoreDimIndex(e))},r.prototype.setApproximateExtent=function(e,t){t=this.getDimension(t),this._approximateExtent[t]=e.slice()},r.prototype.getCalculationInfo=function(e){return this._calculationInfo[e]},r.prototype.setCalculationInfo=function(e,t){Q_(e)?fe(this._calculationInfo,e):this._calculationInfo[e]=t},r.prototype.getName=function(e){var t=this.getRawIndex(e),i=this._nameList[t];return i==null&&this._nameDimIdx!=null&&(i=ex(this,this._nameDimIdx,t)),i==null&&(i=""),i},r.prototype._getCategory=function(e,t){var i=this._store.get(e,t),n=this._store.getOrdinalMeta(e);return n?n.categories[i]:i},r.prototype.getId=function(e){return v1(this,this.getRawIndex(e))},r.prototype.count=function(){return this._store.count()},r.prototype.get=function(e,t){var i=this._store,n=this._dimInfos[e];if(n)return i.get(n.storeDimIndex,t)},r.prototype.getByRawIndex=function(e,t){var i=this._store,n=this._dimInfos[e];if(n)return i.getByRawIndex(n.storeDimIndex,t)},r.prototype.getIndices=function(){return this._store.getIndices()},r.prototype.getDataExtent=function(e){return this._store.getDataExtent(this._getStoreDimIndex(e))},r.prototype.getSum=function(e){return this._store.getSum(this._getStoreDimIndex(e))},r.prototype.getMedian=function(e){return this._store.getMedian(this._getStoreDimIndex(e))},r.prototype.getValues=function(e,t){var i=this,n=this._store;return pe(e)?n.getValues(Nf(e,function(a){return i._getStoreDimIndex(a)}),t):n.getValues(e)},r.prototype.hasValue=function(e){for(var t=this._dimSummary.dataDimIndicesOnCoord,i=0,n=t.length;i<n;i++)if(isNaN(this._store.get(t[i],e)))return!1;return!0},r.prototype.indexOfName=function(e){for(var t=0,i=this._store.count();t<i;t++)if(this.getName(t)===e)return t;return-1},r.prototype.getRawIndex=function(e){return this._store.getRawIndex(e)},r.prototype.indexOfRawIndex=function(e){return this._store.indexOfRawIndex(e)},r.prototype.rawIndexOf=function(e,t){var i=e&&this._invertedIndicesMap[e],n=i[t];return n==null||isNaN(n)?k6:n},r.prototype.indicesOfNearest=function(e,t,i){return this._store.indicesOfNearest(this._getStoreDimIndex(e),t,i)},r.prototype.each=function(e,t,i){"use strict";He(e)&&(i=t,t=e,e=[]);var n=i||this,a=Nf(tx(e),this._getStoreDimIndex,this);this._store.each(a,n?Be(t,n):t)},r.prototype.filterSelf=function(e,t,i){"use strict";He(e)&&(i=t,t=e,e=[]);var n=i||this,a=Nf(tx(e),this._getStoreDimIndex,this);return this._store=this._store.filter(a,n?Be(t,n):t),this},r.prototype.selectRange=function(e){"use strict";var t=this,i={},n=bt(e),a=[];return N(n,function(o){var s=t._getStoreDimIndex(o);i[s]=e[o],a.push(s)}),this._store=this._store.selectRange(i),this},r.prototype.mapArray=function(e,t,i){"use strict";He(e)&&(i=t,t=e,e=[]),i=i||this;var n=[];return this.each(e,function(){n.push(t&&t.apply(this,arguments))},i),n},r.prototype.map=function(e,t,i,n){"use strict";var a=i||n||this,o=Nf(tx(e),this._getStoreDimIndex,this),s=g1(this);return s._store=this._store.map(o,a?Be(t,a):t),s},r.prototype.modify=function(e,t,i,n){var a=this,o=i||n||this,s=Nf(tx(e),this._getStoreDimIndex,this);this._store.modify(s,o?Be(t,o):t)},r.prototype.downSample=function(e,t,i,n){var a=g1(this);return a._store=this._store.downSample(this._getStoreDimIndex(e),t,i,n),a},r.prototype.lttbDownSample=function(e,t){var i=g1(this);return i._store=this._store.lttbDownSample(this._getStoreDimIndex(e),t),i},r.prototype.getRawDataItem=function(e){return this._store.getRawDataItem(e)},r.prototype.getItemModel=function(e){var t=this.hostModel,i=this.getRawDataItem(e);return new Zt(i,t,t&&t.ecModel)},r.prototype.diff=function(e){var t=this;return new An(e?e.getStore().getIndices():[],this.getStore().getIndices(),function(i){return v1(e,i)},function(i){return v1(t,i)})},r.prototype.getVisual=function(e){var t=this._visual;return t&&t[e]},r.prototype.setVisual=function(e,t){this._visual=this._visual||{},Q_(e)?fe(this._visual,e):this._visual[e]=t},r.prototype.getItemVisual=function(e,t){var i=this._itemVisuals[e],n=i&&i[t];return n??this.getVisual(t)},r.prototype.hasItemVisual=function(){return this._itemVisuals.length>0},r.prototype.ensureUniqueItemVisual=function(e,t){var i=this._itemVisuals,n=i[e];n||(n=i[e]={});var a=n[t];return a==null&&(a=this.getVisual(t),pe(a)?a=a.slice():Q_(a)&&(a=fe({},a)),n[t]=a),a},r.prototype.setItemVisual=function(e,t,i){var n=this._itemVisuals[e]||{};this._itemVisuals[e]=n,Q_(t)?fe(n,t):n[t]=i},r.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},r.prototype.setLayout=function(e,t){Q_(e)?fe(this._layout,e):this._layout[e]=t},r.prototype.getLayout=function(e){return this._layout[e]},r.prototype.getItemLayout=function(e){return this._itemLayouts[e]},r.prototype.setItemLayout=function(e,t,i){this._itemLayouts[e]=i?fe(this._itemLayouts[e]||{},t):t},r.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},r.prototype.setItemGraphicEl=function(e,t){var i=this.hostModel&&this.hostModel.seriesIndex;c_(i,this.dataType,e,t),this._graphicEls[e]=t},r.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},r.prototype.eachItemGraphicEl=function(e,t){N(this._graphicEls,function(i,n){i&&e&&e.call(t,i,n)})},r.prototype.cloneShallow=function(e){return e||(e=new r(this._schema?this._schema:Nf(this.dimensions,this._getDimInfo,this),this.hostModel)),n2(e,this),e._store=this._store,e},r.prototype.wrapMethod=function(e,t){var i=this[e];He(i)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var n=i.apply(this,arguments);return t.apply(this,[n].concat(rb(arguments)))})},r.internalField=function(){V6=function(e){var t=e._invertedIndicesMap;N(t,function(i,n){var a=e._dimInfos[n],o=a.ordinalMeta,s=e._store;if(o){i=t[n]=new dpe(o.categories.length);for(var l=0;l<i.length;l++)i[l]=k6;for(var l=0;l<s.count();l++)i[s.get(a.storeDimIndex,l)]=l}})},ex=function(e,t,i){return Yr(e._getCategory(t,i),null)},v1=function(e,t){var i=e._idList[t];return i==null&&e._idDimIdx!=null&&(i=ex(e,e._idDimIdx,t)),i==null&&(i=mpe+t),i},tx=function(e){return pe(e)||(e=e!=null?[e]:[]),e},g1=function(e){var t=new r(e._schema?e._schema:Nf(e.dimensions,e._getDimInfo,e),e.hostModel);return n2(t,e),t},n2=function(e,t){N(vpe.concat(t.__wrappedMethods||[]),function(i){t.hasOwnProperty(i)&&(e[i]=t[i])}),e.__wrappedMethods=t.__wrappedMethods,N(gpe,function(i){e[i]=Qe(t[i])}),e._calculationInfo=fe({},t._calculationInfo)},a2=function(e,t){var i=e._nameList,n=e._idList,a=e._nameDimIdx,o=e._idDimIdx,s=i[t],l=n[t];if(s==null&&a!=null&&(i[t]=s=ex(e,a,t)),l==null&&o!=null&&(n[t]=l=ex(e,o,t)),l==null&&s!=null){var u=e._nameRepeatCount,c=u[s]=(u[s]||0)+1;l=s,c>1&&(l+="__ec__"+c),n[t]=l}}}(),r}(),ti=ype;function js(r,e){cv(r)||(r=fv(r)),e=e||{};var t=e.coordDimensions||[],i=e.dimensionsDefine||r.dimensionsDefine||[],n=ke(),a=[],o=xpe(r,t,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&i2(o),l=i===r.dimensionsDefine,u=l?r2(r):t2(i),c=e.encodeDefine;!c&&e.encodeDefaulter&&(c=e.encodeDefaulter(r,o));for(var f=ke(c),h=new SD(o),p=0;p<h.length;p++)h[p]=-1;function d(C){var b=h[C];if(b<0){var E=i[C],I=qe(E)?E:{name:E},R=new vv,A=I.name;A!=null&&u.get(A)!=null&&(R.name=R.displayName=A),I.type!=null&&(R.type=I.type),I.displayName!=null&&(R.displayName=I.displayName);var D=a.length;return h[C]=D,R.storeDimIndex=C,a.push(R),R}return a[b]}if(!s)for(var p=0;p<o;p++)d(p);f.each(function(C,b){var E=Jt(C).slice();if(E.length===1&&!Ce(E[0])&&E[0]<0){f.set(b,!1);return}var I=f.set(b,[]);N(E,function(R,A){var D=Ce(R)?u.get(R):R;D!=null&&D<o&&(I[A]=D,m(d(D),b,A))})});var g=0;N(t,function(C){var b,E,I,R;if(Ce(C))b=C,R={};else{R=C,b=R.name;var A=R.ordinalMeta;R.ordinalMeta=null,R=fe({},R),R.ordinalMeta=A,E=R.dimsDef,I=R.otherDims,R.name=R.coordDim=R.coordDimIndex=R.dimsDef=R.otherDims=null}var D=f.get(b);if(D!==!1){if(D=Jt(D),!D.length)for(var U=0;U<(E&&E.length||1);U++){for(;g<o&&d(g).coordDim!=null;)g++;g<o&&D.push(g++)}N(D,function(B,F){var k=d(B);if(l&&R.type!=null&&(k.type=R.type),m(Ye(k,R),b,F),k.name==null&&E){var G=E[F];!qe(G)&&(G={name:G}),k.name=k.displayName=G.name,k.defaultTooltip=G.defaultTooltip}I&&Ye(k.otherDims,I)})}});function m(C,b,E){Rw.get(b)!=null?C.otherDims[b]=E:(C.coordDim=b,C.coordDimIndex=E,n.set(b,!0))}var v=e.generateCoord,_=e.generateCoordCount,y=_!=null;_=v?_||1:0;var x=v||"value";function M(C){C.name==null&&(C.name=C.coordDim)}if(s)N(a,function(C){M(C)}),a.sort(function(C,b){return C.storeDimIndex-b.storeDimIndex});else for(var S=0;S<o;S++){var w=d(S),T=w.coordDim;T==null&&(w.coordDim=Spe(x,n,y),w.coordDimIndex=0,(!v||_<=0)&&(w.isExtraCoord=!0),_--),M(w),w.type==null&&(Dw(r,S)===Ji.Must||w.isExtraCoord&&(w.otherDims.itemName!=null||w.otherDims.seriesName!=null))&&(w.type="ordinal")}return _pe(a),new e2({source:r,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function _pe(r){for(var e=ke(),t=0;t<r.length;t++){var i=r[t],n=i.name,a=e.get(n)||0;a>0&&(i.name=n+(a-1)),a++,e.set(n,a)}}function xpe(r,e,t,i){var n=Math.max(r.dimensionsDetectedCount||1,e.length,t.length,i||0);return N(e,function(a){var o;qe(a)&&(o=a.dimsDef)&&(n=Math.max(n,o.length))}),n}function Spe(r,e,t){if(t||e.hasKey(r)){for(var i=0;e.hasKey(r+i);)i++;r+=i}return e.set(r,!0),r}var Mpe=function(){function r(e){this.coordSysDims=[],this.axisMap=ke(),this.categoryAxisMap=ke(),this.coordSysName=e}return r}();function G6(r){var e=r.get("coordinateSystem"),t=new Mpe(e),i=bpe[e];if(i)return i(r,t,t.axisMap,t.categoryAxisMap),t}var bpe={cartesian2d:function(r,e,t,i){var n=r.getReferringComponents("xAxis",Cr).models[0],a=r.getReferringComponents("yAxis",Cr).models[0];e.coordSysDims=["x","y"],t.set("x",n),t.set("y",a),gv(n)&&(i.set("x",n),e.firstCategoryDimIndex=0),gv(a)&&(i.set("y",a),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},singleAxis:function(r,e,t,i){var n=r.getReferringComponents("singleAxis",Cr).models[0];e.coordSysDims=["single"],t.set("single",n),gv(n)&&(i.set("single",n),e.firstCategoryDimIndex=0)},polar:function(r,e,t,i){var n=r.getReferringComponents("polar",Cr).models[0],a=n.findAxisModel("radiusAxis"),o=n.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],t.set("radius",a),t.set("angle",o),gv(a)&&(i.set("radius",a),e.firstCategoryDimIndex=0),gv(o)&&(i.set("angle",o),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},geo:function(r,e,t,i){e.coordSysDims=["lng","lat"]},parallel:function(r,e,t,i){var n=r.ecModel,a=n.getComponent("parallel",r.get("parallelIndex")),o=e.coordSysDims=a.dimensions.slice();N(a.parallelAxisIndex,function(s,l){var u=n.getComponent("parallelAxis",s),c=o[l];t.set(c,u),gv(u)&&(i.set(c,u),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=l))})}};function gv(r){return r.get("type")==="category"}function H6(r,e,t){t=t||{};var i=t.byIndex,n=t.stackedCoordDimension,a,o,s;wpe(e)?a=e:(o=e.schema,a=o.dimensions,s=e.store);var l=!!(r&&r.get("stack")),u,c,f,h;if(N(a,function(_,y){Ce(_)&&(a[y]=_={name:_}),l&&!_.isExtraCoord&&(!i&&!u&&_.ordinalMeta&&(u=_),!c&&_.type!=="ordinal"&&_.type!=="time"&&(!n||n===_.coordDim)&&(c=_))}),c&&!i&&!u&&(i=!0),c){f="__\0ecstackresult_"+r.id,h="__\0ecstackedover_"+r.id,u&&(u.createInvertedIndices=!0);var p=c.coordDim,d=c.type,g=0;N(a,function(_){_.coordDim===p&&g++});var m={name:f,coordDim:p,coordDimIndex:g,type:d,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},v={name:h,coordDim:h,coordDimIndex:g+1,type:d,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(m.storeDimIndex=s.ensureCalculationDimension(h,d),v.storeDimIndex=s.ensureCalculationDimension(f,d)),o.appendCalculationDimension(m),o.appendCalculationDimension(v)):(a.push(m),a.push(v))}return{stackedDimension:c&&c.name,stackedByDimension:u&&u.name,isStackedByIndex:i,stackedOverDimension:h,stackResultDimension:f}}function wpe(r){return!m1(r.schema)}function wo(r,e){return!!e&&e===r.getCalculationInfo("stackedDimension")}function y1(r,e){return wo(r,e)?r.getCalculationInfo("stackResultDimension"):e}function Tpe(r,e){var t=r.get("coordinateSystem"),i=Uu.get(t),n;return e&&e.coordSysDims&&(n=de(e.coordSysDims,function(a){var o={name:a},s=e.axisMap.get(a);if(s){var l=s.get("type");o.type=Yp(l)}return o})),n||(n=i&&(i.getDimensionsInfo?i.getDimensionsInfo():i.dimensions.slice())||["x","y"]),n}function Epe(r,e,t){var i,n;return t&&N(r,function(a,o){var s=a.coordDim,l=t.categoryAxisMap.get(s);l&&(i==null&&(i=o),a.ordinalMeta=l.getOrdinalMeta(),e&&(a.createInvertedIndices=!0)),a.otherDims.itemName!=null&&(n=!0)}),!n&&i!=null&&(r[i].otherDims.itemName=0),i}function Ape(r,e,t){t=t||{};var i=e.getSourceManager(),n,a=!1;r?(a=!0,n=fv(r)):(n=i.getSource(),a=n.sourceFormat===fn);var o=G6(e),s=Tpe(e,o),l=t.useEncodeDefaulter,u=He(l)?l:l?ot(Lw,s,e):null,c={coordDimensions:s,generateCoord:t.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!a},f=js(n,c),h=Epe(f.dimensions,t.createInvertedIndices,o),p=a?null:i.getSharedDataStore(f),d=H6(e,{schema:f,store:p}),g=new ti(f,e);g.setCalculationInfo(d);var m=h!=null&&Cpe(n)?function(v,_,y,x){return x===h?y:this.defaultDimValueGetter(v,_,y,x)}:null;return g.hasItemOption=!1,g.initData(a?n:p,null,m),g}function Cpe(r){if(r.sourceFormat===fn){var e=Rpe(r.data||[]);return!pe(Os(e))}}function Rpe(r){for(var e=0;e<r.length&&r[e]==null;)e++;return r[e]}var hn=Ape;var W6=function(){function r(e){this._setting=e||{},this._extent=[1/0,-1/0]}return r.prototype.getSetting=function(e){return this._setting[e]},r.prototype.unionExtent=function(e){var t=this._extent;e[0]<t[0]&&(t[0]=e[0]),e[1]>t[1]&&(t[1]=e[1])},r.prototype.unionExtentFromData=function(e,t){this.unionExtent(e.getApproximateExtent(t))},r.prototype.getExtent=function(){return this._extent.slice()},r.prototype.setExtent=function(e,t){var i=this._extent;isNaN(e)||(i[0]=e),isNaN(t)||(i[1]=t)},r.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},r.prototype.isBlank=function(){return this._isBlank},r.prototype.setBlank=function(e){this._isBlank=e},r}();yf(W6);var Ga=W6;var Lpe=0,Ppe=function(){function r(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++Lpe}return r.createByAxisModel=function(e){var t=e.option,i=t.data,n=i&&de(i,Dpe);return new r({categories:n,needCollect:!n,deduplication:t.dedplication!==!1})},r.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},r.prototype.parseAndCollect=function(e){var t,i=this._needCollect;if(!Ce(e)&&!i)return e;if(i&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,t;var n=this._getOrCreateMap();return t=n.get(e),t==null&&(i?(t=this.categories.length,this.categories[t]=e,n.set(e,t)):t=NaN),t},r.prototype._getOrCreateMap=function(){return this._map||(this._map=ke(this.categories))},r}();function Dpe(r){return qe(r)&&r.value!=null?r.value:r+""}var rx=Ppe;function ix(r){return r.type==="interval"||r.type==="log"}function Y6(r,e,t,i){var n={},a=r[1]-r[0],o=n.interval=Bm(a/e,!0);t!=null&&o<t&&(o=n.interval=t),i!=null&&o>i&&(o=n.interval=i);var s=n.intervalPrecision=o2(o),l=n.niceTickExtent=[Ar(Math.ceil(r[0]/o)*o,s),Ar(Math.floor(r[1]/o)*o,s)];return Ipe(l,r),n}function _1(r){var e=Math.pow(10,zm(r)),t=r/e;return t?t===2?t=3:t===3?t=5:t*=2:t=1,Ar(t*e)}function o2(r){return Sn(r)+2}function X6(r,e,t){r[e]=Math.max(Math.min(r[e],t[1]),t[0])}function Ipe(r,e){!isFinite(r[0])&&(r[0]=e[0]),!isFinite(r[1])&&(r[1]=e[1]),X6(r,0,e),X6(r,1,e),r[0]>r[1]&&(r[0]=r[1])}function Uf(r,e){return r>=e[0]&&r<=e[1]}function Of(r,e){return e[1]===e[0]?.5:(r-e[0])/(e[1]-e[0])}function Ff(r,e){return r*(e[1]-e[0])+e[0]}var q6=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;i.type="ordinal";var n=i.getSetting("ordinalMeta");return n||(n=new rx({})),pe(n)&&(n=new rx({categories:de(n,function(a){return qe(a)?a.value:a})})),i._ordinalMeta=n,i._extent=i.getSetting("extent")||[0,n.categories.length-1],i}return e.prototype.parse=function(t){return t==null?NaN:Ce(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},e.prototype.contain=function(t){return t=this.parse(t),Uf(t,this._extent)&&this._ordinalMeta.categories[t]!=null},e.prototype.normalize=function(t){return t=this._getTickNumber(this.parse(t)),Of(t,this._extent)},e.prototype.scale=function(t){return t=Math.round(Ff(t,this._extent)),this.getRawOrdinalNumber(t)},e.prototype.getTicks=function(){for(var t=[],i=this._extent,n=i[0];n<=i[1];)t.push({value:n}),n++;return t},e.prototype.getMinorTicks=function(t){},e.prototype.setSortInfo=function(t){if(t==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var i=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],a=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Math.min(s,i.length);o<l;++o){var u=i[o];n[o]=u,a[u]=o}for(var c=0;o<s;++o){for(;a[c]!=null;)c++;n.push(c),a[c]=o}},e.prototype._getTickNumber=function(t){var i=this._ticksByOrdinalNumber;return i&&t>=0&&t<i.length?i[t]:t},e.prototype.getRawOrdinalNumber=function(t){var i=this._ordinalNumbersByTick;return i&&t>=0&&t<i.length?i[t]:t},e.prototype.getLabel=function(t){if(!this.isBlank()){var i=this.getRawOrdinalNumber(t.value),n=this._ordinalMeta.categories[i];return n==null?"":n+""}},e.prototype.count=function(){return this._extent[1]-this._extent[0]+1},e.prototype.unionExtentFromData=function(t,i){this.unionExtent(t.getApproximateExtent(i))},e.prototype.isInExtentRange=function(t){return t=this._getTickNumber(t),this._extent[0]<=t&&this._extent[1]>=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(Ga);Ga.registerClass(q6);var nx=q6;var qp=Ar,Z6=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="interval",t._interval=0,t._intervalPrecision=2,t}return e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return Uf(t,this._extent)},e.prototype.normalize=function(t){return Of(t,this._extent)},e.prototype.scale=function(t){return Ff(t,this._extent)},e.prototype.setExtent=function(t,i){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(i)||(n[1]=parseFloat(i))},e.prototype.unionExtent=function(t){var i=this._extent;t[0]<i[0]&&(i[0]=t[0]),t[1]>i[1]&&(i[1]=t[1]),this.setExtent(i[0],i[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=o2(t)},e.prototype.getTicks=function(t){var i=this._interval,n=this._extent,a=this._niceExtent,o=this._intervalPrecision,s=[];if(!i)return s;var l=1e4;n[0]<a[0]&&(t?s.push({value:qp(a[0]-i,o)}):s.push({value:n[0]}));for(var u=a[0];u<=a[1]&&(s.push({value:u}),u=qp(u+i,o),u!==s[s.length-1].value);)if(s.length>l)return[];var c=s.length?s[s.length-1].value:a[1];return n[1]>c&&(t?s.push({value:qp(c+i,o)}):s.push({value:n[1]})),s},e.prototype.getMinorTicks=function(t){for(var i=this.getTicks(!0),n=[],a=this.getExtent(),o=1;o<i.length;o++){for(var s=i[o],l=i[o-1],u=0,c=[],f=s.value-l.value,h=f/t;u<t-1;){var p=qp(l.value+(u+1)*h);p>a[0]&&p<a[1]&&c.push(p),u++}n.push(c)}return n},e.prototype.getLabel=function(t,i){if(t==null)return"";var n=i&&i.precision;n==null?n=Sn(t.value)||0:n==="auto"&&(n=this._intervalPrecision);var a=qp(t.value,n,!0);return tD(a)},e.prototype.calcNiceTicks=function(t,i,n){t=t||5;var a=this._extent,o=a[1]-a[0];if(isFinite(o)){o<0&&(o=-o,a.reverse());var s=Y6(a,t,i,n);this._intervalPrecision=s.intervalPrecision,this._interval=s.interval,this._niceExtent=s.niceTickExtent}},e.prototype.calcNiceExtent=function(t){var i=this._extent;if(i[0]===i[1])if(i[0]!==0){var n=Math.abs(i[0]);t.fixMax||(i[1]+=n/2),i[0]-=n/2}else i[1]=1;var a=i[1]-i[0];isFinite(a)||(i[0]=0,i[1]=1),this.calcNiceTicks(t.splitNumber,t.minInterval,t.maxInterval);var o=this._interval;t.fixMin||(i[0]=qp(Math.floor(i[0]/o)*o)),t.fixMax||(i[1]=qp(Math.ceil(i[1]/o)*o))},e.prototype.setNiceExtent=function(t,i){this._niceExtent=[t,i]},e.type="interval",e}(Ga);Ga.registerClass(Z6);var Ha=Z6;var j6=typeof Float32Array<"u",Npe=j6?Float32Array:Array;function ca(r){return pe(r)?j6?new Float32Array(r):r:new Npe(r)}var s2="__ec_stack_";function l2(r){return r.get("stack")||s2+r.seriesIndex}function u2(r){return r.dim+r.index}function K6(r){var e=[],t=r.axis,i="axis0";if(t.type==="category"){for(var n=t.getBandWidth(),a=0;a<r.count;a++)e.push(Ye({bandWidth:n,axisKey:i,stackId:s2+a},r));for(var o=J6(e),s=[],a=0;a<r.count;a++){var l=o[i][s2+a];l.offsetCenter=l.offset+l.width/2,s.push(l)}return s}}function c2(r,e){var t=[];return e.eachSeriesByType(r,function(i){Q6(i)&&t.push(i)}),t}function Upe(r){var e={};N(r,function(l){var u=l.coordinateSystem,c=u.getBaseAxis();if(!(c.type!=="time"&&c.type!=="value"))for(var f=l.getData(),h=c.dim+"_"+c.index,p=f.getDimensionIndex(f.mapDimension(c.dim)),d=f.getStore(),g=0,m=d.count();g<m;++g){var v=d.get(p,g);e[h]?e[h].push(v):e[h]=[v]}});var t={};for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(n){n.sort(function(l,u){return l-u});for(var a=null,o=1;o<n.length;++o){var s=n[o]-n[o-1];s>0&&(a=a===null?s:Math.min(a,s))}t[i]=a}}return t}function f2(r){var e=Upe(r),t=[];return N(r,function(i){var n=i.coordinateSystem,a=n.getBaseAxis(),o=a.getExtent(),s;if(a.type==="category")s=a.getBandWidth();else if(a.type==="value"||a.type==="time"){var l=a.dim+"_"+a.index,u=e[l],c=Math.abs(o[1]-o[0]),f=a.scale.getExtent(),h=Math.abs(f[1]-f[0]);s=u?c/h*u:c}else{var p=i.getData();s=Math.abs(o[1]-o[0])/p.count()}var d=Fe(i.get("barWidth"),s),g=Fe(i.get("barMaxWidth"),s),m=Fe(i.get("barMinWidth")||(e8(i)?.5:1),s),v=i.get("barGap"),_=i.get("barCategoryGap");t.push({bandWidth:s,barWidth:d,barMaxWidth:g,barMinWidth:m,barGap:v,barCategoryGap:_,axisKey:u2(a),stackId:l2(i)})}),J6(t)}function J6(r){var e={};N(r,function(i,n){var a=i.axisKey,o=i.bandWidth,s=e[a]||{bandWidth:o,remainedWidth:o,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},l=s.stacks;e[a]=s;var u=i.stackId;l[u]||s.autoWidthCount++,l[u]=l[u]||{width:0,maxWidth:0};var c=i.barWidth;c&&!l[u].width&&(l[u].width=c,c=Math.min(s.remainedWidth,c),s.remainedWidth-=c);var f=i.barMaxWidth;f&&(l[u].maxWidth=f);var h=i.barMinWidth;h&&(l[u].minWidth=h);var p=i.barGap;p!=null&&(s.gap=p);var d=i.barCategoryGap;d!=null&&(s.categoryGap=d)});var t={};return N(e,function(i,n){t[n]={};var a=i.stacks,o=i.bandWidth,s=i.categoryGap;if(s==null){var l=bt(a).length;s=Math.max(35-l*4,15)+"%"}var u=Fe(s,o),c=Fe(i.gap,1),f=i.remainedWidth,h=i.autoWidthCount,p=(f-u)/(h+(h-1)*c);p=Math.max(p,0),N(a,function(v){var _=v.maxWidth,y=v.minWidth;if(v.width){var x=v.width;_&&(x=Math.min(x,_)),y&&(x=Math.max(x,y)),v.width=x,f-=x+c*x,h--}else{var x=p;_&&_<x&&(x=Math.min(_,f)),y&&y>x&&(x=y),x!==p&&(v.width=x,f-=x+c*x,h--)}}),p=(f-u)/(h+(h-1)*c),p=Math.max(p,0);var d=0,g;N(a,function(v,_){v.width||(v.width=p),g=v,d+=v.width*(1+c)}),g&&(d-=g.width*c);var m=-d/2;N(a,function(v,_){t[n][_]=t[n][_]||{bandWidth:o,offset:m,width:v.width},m+=v.width*(1+c)})}),t}function $6(r,e,t){if(r&&e){var i=r[u2(e)];return i!=null&&t!=null?i[l2(t)]:i}}function S1(r,e){var t=c2(r,e),i=f2(t);N(t,function(n){var a=n.getData(),o=n.coordinateSystem,s=o.getBaseAxis(),l=l2(n),u=i[u2(s)][l],c=u.offset,f=u.width;a.setLayout({bandWidth:u.bandWidth,offset:c,size:f})})}function M1(r){return{seriesType:r,plan:Mo(),reset:function(e){if(Q6(e)){var t=e.getData(),i=e.coordinateSystem,n=i.getBaseAxis(),a=i.getOtherAxis(n),o=t.getDimensionIndex(t.mapDimension(a.dim)),s=t.getDimensionIndex(t.mapDimension(n.dim)),l=e.get("showBackground",!0),u=t.mapDimension(a.dim),c=t.getCalculationInfo("stackResultDimension"),f=wo(t,u)&&!!t.getCalculationInfo("stackedOnSeries"),h=a.isHorizontal(),p=Ope(n,a),d=e8(e),g=e.get("barMinHeight")||0,m=c&&t.getDimensionIndex(c),v=t.getLayout("size"),_=t.getLayout("offset");return{progress:function(y,x){for(var M=y.count,S=d&&ca(M*3),w=d&&l&&ca(M*3),T=d&&ca(M),C=i.master.getRect(),b=h?C.width:C.height,E,I=x.getStore(),R=0;(E=y.next())!=null;){var A=I.get(f?m:o,E),D=I.get(s,E),U=p,B=void 0;f&&(B=+A-I.get(o,E));var F=void 0,k=void 0,G=void 0,Y=void 0;if(h){var J=i.dataToPoint([A,D]);if(f){var Q=i.dataToPoint([B,D]);U=Q[0]}F=U,k=J[1]+_,G=J[0]-U,Y=v,Math.abs(G)<g&&(G=(G<0?-1:1)*g)}else{var J=i.dataToPoint([D,A]);if(f){var Q=i.dataToPoint([D,B]);U=Q[1]}F=J[0]+_,k=U,G=v,Y=J[1]-U,Math.abs(Y)<g&&(Y=(Y<=0?-1:1)*g)}d?(S[R]=F,S[R+1]=k,S[R+2]=h?G:Y,w&&(w[R]=h?C.x:F,w[R+1]=h?k:C.y,w[R+2]=b),T[E]=E):x.setItemLayout(E,{x:F,y:k,width:G,height:Y}),R+=3}d&&x.setLayout({largePoints:S,largeDataIndices:T,largeBackgroundPoints:w,valueAxisHorizontal:h})}}}}}}function Q6(r){return r.coordinateSystem&&r.coordinateSystem.type==="cartesian2d"}function e8(r){return r.pipelineContext&&r.pipelineContext.large}function Ope(r,e){return e.toGlobalCoord(e.dataToCoord(e.type==="log"?1:0))}var Fpe=function(r,e,t,i){for(;t<i;){var n=t+i>>>1;r[n][1]<e?t=n+1:i=n}return t},r8=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="time",i}return e.prototype.getLabel=function(t){var i=this.getSetting("useUTC");return Bp(t.value,XP[h5(zp(this._minLevelUnit))]||XP.second,i,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(t,i,n){var a=this.getSetting("useUTC"),o=this.getSetting("locale");return p5(t,i,n,o,a)},e.prototype.getTicks=function(){var t=this._interval,i=this._extent,n=[];if(!t)return n;n.push({value:i[0],level:0});var a=this.getSetting("useUTC"),o=Wpe(this._minLevelUnit,this._approxInterval,a,i);return n=n.concat(o),n.push({value:i[1],level:0}),n},e.prototype.calcNiceExtent=function(t){var i=this._extent;if(i[0]===i[1]&&(i[0]-=_o,i[1]+=_o),i[1]===-1/0&&i[0]===1/0){var n=new Date;i[1]=+new Date(n.getFullYear(),n.getMonth(),n.getDate()),i[0]=i[1]-_o}this.calcNiceTicks(t.splitNumber,t.minInterval,t.maxInterval)},e.prototype.calcNiceTicks=function(t,i,n){t=t||10;var a=this._extent,o=a[1]-a[0];this._approxInterval=o/t,i!=null&&this._approxInterval<i&&(this._approxInterval=i),n!=null&&this._approxInterval>n&&(this._approxInterval=n);var s=b1.length,l=Math.min(Fpe(b1,this._approxInterval,0,s),s-1);this._interval=b1[l][1],this._minLevelUnit=b1[Math.max(l-1,0)][0]},e.prototype.parse=function(t){return At(t)?t:+Mn(t)},e.prototype.contain=function(t){return Uf(this.parse(t),this._extent)},e.prototype.normalize=function(t){return Of(this.parse(t),this._extent)},e.prototype.scale=function(t){return Ff(t,this._extent)},e.type="time",e}(Ha),b1=[["second",Mw],["minute",bw],["hour",ov],["quarter-day",ov*6],["half-day",ov*12],["day",_o*1.2],["half-week",_o*3.5],["week",_o*7],["month",_o*31],["quarter",_o*95],["half-year",WP/2],["year",WP]];function zpe(r,e,t,i){var n=Mn(e),a=Mn(t),o=function(d){return qP(n,d,i)===qP(a,d,i)},s=function(){return o("year")},l=function(){return s()&&o("month")},u=function(){return l()&&o("day")},c=function(){return u()&&o("hour")},f=function(){return c()&&o("minute")},h=function(){return f()&&o("second")},p=function(){return h()&&o("millisecond")};switch(r){case"year":return s();case"month":return l();case"day":return u();case"hour":return c();case"minute":return f();case"second":return h();case"millisecond":return p()}}function Bpe(r,e){return r/=_o,r>16?16:r>7.5?7:r>3.5?4:r>1.5?2:1}function kpe(r){var e=30*_o;return r/=e,r>6?6:r>3?3:r>2?2:1}function Vpe(r){return r/=ov,r>12?12:r>6?6:r>3.5?4:r>2?2:1}function t8(r,e){return r/=e?bw:Mw,r>30?30:r>20?20:r>15?15:r>10?10:r>5?5:r>2?2:1}function Gpe(r){return Bm(r,!0)}function Hpe(r,e,t){var i=new Date(r);switch(zp(e)){case"year":case"month":i[ZP(t)](0);case"day":i[jP(t)](1);case"hour":i[KP(t)](0);case"minute":i[JP(t)](0);case"second":i[$P(t)](0),i[QP(t)](0)}return i.getTime()}function Wpe(r,e,t,i){var n=1e4,a=YP,o=0;function s(b,E,I,R,A,D,U){for(var B=new Date(E),F=E,k=B[R]();F<I&&F<=i[1];)U.push({value:F}),k+=b,B[A](k),F=B.getTime();U.push({value:F,notAdd:!0})}function l(b,E,I){var R=[],A=!E.length;if(!zpe(zp(b),i[0],i[1],t)){A&&(E=[{value:Hpe(new Date(i[0]),b,t)},{value:i[1]}]);for(var D=0;D<E.length-1;D++){var U=E[D].value,B=E[D+1].value;if(U!==B){var F=void 0,k=void 0,G=void 0,Y=!1;switch(b){case"year":F=Math.max(1,Math.round(e/_o/365)),k=ww(t),G=m5(t);break;case"half-year":case"quarter":case"month":F=kpe(e),k=Fp(t),G=ZP(t);break;case"week":case"half-week":case"day":F=Bpe(e,31),k=T_(t),G=jP(t),Y=!0;break;case"half-day":case"quarter-day":case"hour":F=Vpe(e),k=av(t),G=KP(t);break;case"minute":F=t8(e,!0),k=E_(t),G=JP(t);break;case"second":F=t8(e,!1),k=A_(t),G=$P(t);break;case"millisecond":F=Gpe(e),k=C_(t),G=QP(t);break}s(F,U,B,k,G,Y,R),b==="year"&&I.length>1&&D===0&&I.unshift({value:I[0].value-F})}}for(var D=0;D<R.length;D++)I.push(R[D]);return R}}for(var u=[],c=[],f=0,h=0,p=0;p<a.length&&o++<n;++p){var d=zp(a[p]);if(f5(a[p])){l(a[p],u[u.length-1]||[],c);var g=a[p+1]?zp(a[p+1]):null;if(d!==g){if(c.length){h=f,c.sort(function(b,E){return b.value-E.value});for(var m=[],v=0;v<c.length;++v){var _=c[v].value;(v===0||c[v-1].value!==_)&&(m.push(c[v]),_>=i[0]&&_<=i[1]&&f++)}var y=(i[1]-i[0])/e;if(f>y*1.5&&h>y/1.5||(u.push(m),f>y||r===a[p]))break}c=[]}}}for(var x=Wt(de(u,function(b){return Wt(b,function(E){return E.value>=i[0]&&E.value<=i[1]&&!E.notAdd})}),function(b){return b.length>0}),M=[],S=x.length-1,p=0;p<x.length;++p)for(var w=x[p],T=0;T<w.length;++T)M.push({value:w[T].value,level:S-p});M.sort(function(b,E){return b.value-E.value});for(var C=[],p=0;p<M.length;++p)(p===0||M[p].value!==M[p-1].value)&&C.push(M[p]);return C}Ga.registerClass(r8);var w1=r8;var i8=Ga.prototype,ax=Ha.prototype,Xpe=Ar,Ype=Math.floor,qpe=Math.ceil,T1=Math.pow,Ks=Math.log,h2=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="log",t.base=10,t._originalScale=new Ha,t._interval=0,t}return e.prototype.getTicks=function(t){var i=this._originalScale,n=this._extent,a=i.getExtent(),o=ax.getTicks.call(this,t);return de(o,function(s){var l=s.value,u=Ar(T1(this.base,l));return u=l===n[0]&&this._fixMin?E1(u,a[0]):u,u=l===n[1]&&this._fixMax?E1(u,a[1]):u,{value:u}},this)},e.prototype.setExtent=function(t,i){var n=Ks(this.base);t=Ks(Math.max(0,t))/n,i=Ks(Math.max(0,i))/n,ax.setExtent.call(this,t,i)},e.prototype.getExtent=function(){var t=this.base,i=i8.getExtent.call(this);i[0]=T1(t,i[0]),i[1]=T1(t,i[1]);var n=this._originalScale,a=n.getExtent();return this._fixMin&&(i[0]=E1(i[0],a[0])),this._fixMax&&(i[1]=E1(i[1],a[1])),i},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var i=this.base;t[0]=Ks(t[0])/Ks(i),t[1]=Ks(t[1])/Ks(i),i8.unionExtent.call(this,t)},e.prototype.unionExtentFromData=function(t,i){this.unionExtent(t.getApproximateExtent(i))},e.prototype.calcNiceTicks=function(t){t=t||10;var i=this._extent,n=i[1]-i[0];if(!(n===1/0||n<=0)){var a=kb(n),o=t/n*a;for(o<=.5&&(a*=10);!isNaN(a)&&Math.abs(a)<1&&Math.abs(a)>0;)a*=10;var s=[Ar(qpe(i[0]/a)*a),Ar(Ype(i[1]/a)*a)];this._interval=a,this._niceExtent=s}},e.prototype.calcNiceExtent=function(t){ax.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return t=Ks(t)/Ks(this.base),Uf(t,this._extent)},e.prototype.normalize=function(t){return t=Ks(t)/Ks(this.base),Of(t,this._extent)},e.prototype.scale=function(t){return t=Ff(t,this._extent),T1(this.base,t)},e.type="log",e}(Ga),n8=h2.prototype;n8.getMinorTicks=ax.getMinorTicks;n8.getLabel=ax.getLabel;function E1(r,e){return Xpe(r,Sn(e))}Ga.registerClass(h2);var a8=h2;var Zpe=function(){function r(e,t,i){this._prepareParams(e,t,i)}return r.prototype._prepareParams=function(e,t,i){i[1]<i[0]&&(i=[NaN,NaN]),this._dataMin=i[0],this._dataMax=i[1];var n=this._isOrdinal=e.type==="ordinal";this._needCrossZero=e.type==="interval"&&t.getNeedCrossZero&&t.getNeedCrossZero();var a=this._modelMinRaw=t.get("min",!0);He(a)?this._modelMinNum=A1(e,a({min:i[0],max:i[1]})):a!=="dataMin"&&(this._modelMinNum=A1(e,a));var o=this._modelMaxRaw=t.get("max",!0);if(He(o)?this._modelMaxNum=A1(e,o({min:i[0],max:i[1]})):o!=="dataMax"&&(this._modelMaxNum=A1(e,o)),n)this._axisDataLen=t.getCategories().length;else{var s=t.get("boundaryGap"),l=pe(s)?s:[s||0,s||0];typeof l[0]=="boolean"||typeof l[1]=="boolean"?this._boundaryGapInner=[0,0]:this._boundaryGapInner=[xn(l[0],1),xn(l[1],1)]}},r.prototype.calculate=function(){var e=this._isOrdinal,t=this._dataMin,i=this._dataMax,n=this._axisDataLen,a=this._boundaryGapInner,o=e?null:i-t||Math.abs(t),s=this._modelMinRaw==="dataMin"?t:this._modelMinNum,l=this._modelMaxRaw==="dataMax"?i:this._modelMaxNum,u=s!=null,c=l!=null;s==null&&(s=e?n?0:NaN:t-a[0]*o),l==null&&(l=e?n?n-1:NaN:i+a[1]*o),(s==null||!isFinite(s))&&(s=NaN),(l==null||!isFinite(l))&&(l=NaN);var f=sf(s)||sf(l)||e&&!n;this._needCrossZero&&(s>0&&l>0&&!u&&(s=0),s<0&&l<0&&!c&&(l=0));var h=this._determinedMin,p=this._determinedMax;return h!=null&&(s=h,u=!0),p!=null&&(l=p,c=!0),{min:s,max:l,minFixed:u,maxFixed:c,isBlank:f}},r.prototype.modifyDataMinMax=function(e,t){this[Kpe[e]]=t},r.prototype.setDeterminedMinMax=function(e,t){var i=jpe[e];this[i]=t},r.prototype.freeze=function(){this.frozen=!0},r}();var jpe={min:"_determinedMin",max:"_determinedMax"},Kpe={min:"_dataMin",max:"_dataMax"};function C1(r,e,t){var i=r.rawExtentInfo;return i||(i=new Zpe(r,e,t),r.rawExtentInfo=i,i)}function A1(r,e){return e==null?null:sf(e)?NaN:r.parse(e)}function p2(r,e){var t=r.type,i=C1(r,e,r.getExtent()).calculate();r.setBlank(i.isBlank);var n=i.min,a=i.max,o=e.ecModel;if(o&&t==="time"){var s=c2("bar",o),l=!1;if(N(s,function(f){l=l||f.getBaseAxis()===e.axis}),l){var u=f2(s),c=Jpe(n,a,e,u);n=c.min,a=c.max}}return{extent:[n,a],fixMin:i.minFixed,fixMax:i.maxFixed}}function Jpe(r,e,t,i){var n=t.axis.getExtent(),a=n[1]-n[0],o=$6(i,t.axis);if(o===void 0)return{min:r,max:e};var s=1/0;N(o,function(p){s=Math.min(p.offset,s)});var l=-1/0;N(o,function(p){l=Math.max(p.offset+p.width,l)}),s=Math.abs(s),l=Math.abs(l);var u=s+l,c=e-r,f=1-(s+l)/a,h=c/f-c;return e+=h*(l/u),r-=h*(s/u),{min:r,max:e}}function Vl(r,e){var t=e,i=p2(r,t),n=i.extent,a=t.get("splitNumber");r instanceof a8&&(r.base=t.get("logBase"));var o=r.type,s=t.get("interval"),l=o==="interval"||o==="time";r.setExtent(n[0],n[1]),r.calcNiceExtent({splitNumber:a,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?t.get("minInterval"):null,maxInterval:l?t.get("maxInterval"):null}),s!=null&&r.setInterval&&r.setInterval(s)}function zf(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new nx({ordinalMeta:r.getOrdinalMeta?r.getOrdinalMeta():r.getCategories(),extent:[1/0,-1/0]});case"time":return new w1({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new(Ga.getClass(e)||Ha)}}function o8(r){var e=r.scale.getExtent(),t=e[0],i=e[1];return!(t>0&&i>0||t<0&&i<0)}function yv(r){var e=r.getLabelModel().get("formatter"),t=r.type==="category"?r.scale.getExtent()[0]:null;return r.scale.type==="time"?function(i){return function(n,a){return r.scale.getFormattedLabel(n,a,i)}}(e):Ce(e)?function(i){return function(n){var a=r.scale.getLabel(n),o=i.replace("{value}",a??"");return o}}(e):He(e)?function(i){return function(n,a){return t!=null&&(a=n.value-t),i(ox(r,n),a,n.level!=null?{level:n.level}:null)}}(e):function(i){return r.scale.getLabel(i)}}function ox(r,e){return r.type==="category"?r.scale.getLabel(e):e.value}function s8(r){var e=r.model,t=r.scale;if(!(!e.get(["axisLabel","show"])||t.isBlank())){var i,n,a=t.getExtent();t instanceof nx?n=t.count():(i=t.getTicks(),n=i.length);var o=r.getLabelModel(),s=yv(r),l,u=1;n>40&&(u=Math.ceil(n/40));for(var c=0;c<n;c+=u){var f=i?i[c]:{value:a[0]+c},h=s(f,c),p=o.getTextRect(h),d=$pe(p,o.get("rotate")||0);l?l.union(d):l=d}return l}}function $pe(r,e){var t=e*Math.PI/180,i=r.width,n=r.height,a=i*Math.abs(Math.cos(t))+Math.abs(n*Math.sin(t)),o=i*Math.abs(Math.sin(t))+Math.abs(n*Math.cos(t)),s=new lt(r.x,r.y,a,o);return s}function R1(r){var e=r.get("interval");return e??"auto"}function L1(r){return r.type==="category"&&R1(r.getLabelModel())===0}function _v(r,e){var t={};return N(r.mapDimensionsAll(e),function(i){t[y1(r,i)]=!0}),bt(t)}function l8(r,e,t){e&&N(_v(e,t),function(i){var n=e.getApproximateExtent(i);n[0]<r[0]&&(r[0]=n[0]),n[1]>r[1]&&(r[1]=n[1])})}var Gl=function(){function r(){}return r.prototype.getNeedCrossZero=function(){var e=this.option;return!e.scale},r.prototype.getCoordSysModel=function(){},r}();var Qpe=1e-8;function u8(r,e){return Math.abs(r-e)<Qpe}function Bu(r,e,t){var i=0,n=r[0];if(!n)return!1;for(var a=1;a<r.length;a++){var o=r[a];i+=$o(n[0],n[1],o[0],o[1],e,t),n=o}var s=r[0];return(!u8(n[0],s[0])||!u8(n[1],s[1]))&&(i+=$o(n[0],n[1],s[0],s[1],e,t)),i!==0}var ede=[];function d2(r,e){for(var t=0;t<r.length;t++)fi(r[t],r[t],e)}function f8(r,e,t,i){for(var n=0;n<r.length;n++){var a=r[n];i&&(a=i.project(a)),a&&isFinite(a[0])&&isFinite(a[1])&&(po(e,e,a),mo(t,t,a))}}function tde(r){for(var e=0,t=0,i=0,n=r.length,a=r[n-1][0],o=r[n-1][1],s=0;s<n;s++){var l=r[s][0],u=r[s][1],c=a*u-l*o;e+=c,t+=(a+l)*c,i+=(o+u)*c,a=l,o=u}return e?[t/e/3,i/e/3,e]:[r[0][0]||0,r[0][1]||0]}var h8=function(){function r(e){this.name=e}return r.prototype.setCenter=function(e){this._center=e},r.prototype.getCenter=function(){var e=this._center;return e||(e=this._center=this.calcCenter()),e},r}();var m2=function(){function r(e,t){this.type="polygon",this.exterior=e,this.interiors=t}return r}();var v2=function(){function r(e){this.type="linestring",this.points=e}return r}();var D1=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t)||this;return a.type="geoJSON",a.geometries=i,a._center=n&&[n[0],n[1]],a}return e.prototype.calcCenter=function(){for(var t=this.geometries,i,n=0,a=0;a<t.length;a++){var o=t[a],s=o.exterior,l=s&&s.length;l>n&&(i=o,n=l)}if(i)return tde(i.exterior);var u=this.getBoundingRect();return[u.x+u.width/2,u.y+u.height/2]},e.prototype.getBoundingRect=function(t){var i=this._rect;if(i&&!t)return i;var n=[1/0,1/0],a=[-1/0,-1/0],o=this.geometries;return N(o,function(s){s.type==="polygon"?f8(s.exterior,n,a,t):N(s.points,function(l){f8(l,n,a,t)})}),isFinite(n[0])&&isFinite(n[1])&&isFinite(a[0])&&isFinite(a[1])||(n[0]=n[1]=a[0]=a[1]=0),i=new lt(n[0],n[1],a[0]-n[0],a[1]-n[1]),t||(this._rect=i),i},e.prototype.contain=function(t){var i=this.getBoundingRect(),n=this.geometries;if(!i.contain(t[0],t[1]))return!1;e:for(var a=0,o=n.length;a<o;a++){var s=n[a];if(s.type==="polygon"){var l=s.exterior,u=s.interiors;if(Bu(l,t[0],t[1])){for(var c=0;c<(u?u.length:0);c++)if(Bu(u[c],t[0],t[1]))continue e;return!0}}}return!1},e.prototype.transformTo=function(t,i,n,a){var o=this.getBoundingRect(),s=o.width/o.height;n?a||(a=n/s):n=s*a;for(var l=new lt(t,i,n,a),u=o.calculateTransform(l),c=this.geometries,f=0;f<c.length;f++){var h=c[f];h.type==="polygon"?(d2(h.exterior,u),N(h.interiors,function(p){d2(p,u)})):N(h.points,function(p){d2(p,u)})}o=this._rect,o.copy(l),this._center=[o.x+o.width/2,o.y+o.height/2]},e.prototype.cloneShallow=function(t){t==null&&(t=this.name);var i=new e(t,this.geometries,this._center);return i._rect=this._rect,i.transformTo=null,i},e}(h8);var p8=function(r){Z(e,r);function e(t,i){var n=r.call(this,t)||this;return n.type="geoSVG",n._elOnlyForCalculate=i,n}return e.prototype.calcCenter=function(){for(var t=this._elOnlyForCalculate,i=t.getBoundingRect(),n=[i.x+i.width/2,i.y+i.height/2],a=uf(ede),o=t;o&&!o.isGeoSVGGraphicRoot;)Aa(a,o.getLocalTransform(),a),o=o.parent;return Yo(a,a),fi(n,n,a),n},e}(h8);function rde(r){if(!r.UTF8Encoding)return r;var e=r,t=e.UTF8Scale;t==null&&(t=1024);var i=e.features;return N(i,function(n){var a=n.geometry,o=a.encodeOffsets,s=a.coordinates;if(o)switch(a.type){case"LineString":a.coordinates=d8(s,o,t);break;case"Polygon":g2(s,o,t);break;case"MultiLineString":g2(s,o,t);break;case"MultiPolygon":N(s,function(l,u){return g2(l,o[u],t)})}}),e.UTF8Encoding=!1,e}function g2(r,e,t){for(var i=0;i<r.length;i++)r[i]=d8(r[i],e[i],t)}function d8(r,e,t){for(var i=[],n=e[0],a=e[1],o=0;o<r.length;o+=2){var s=r.charCodeAt(o)-64,l=r.charCodeAt(o+1)-64;s=s>>1^-(s&1),l=l>>1^-(l&1),s+=n,l+=a,n=s,a=l,i.push([s/t,l/t])}return i}function y2(r,e){return r=rde(r),de(Wt(r.features,function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0}),function(t){var i=t.properties,n=t.geometry,a=[];switch(n.type){case"Polygon":var o=n.coordinates;a.push(new m2(o[0],o.slice(1)));break;case"MultiPolygon":N(n.coordinates,function(l){l[0]&&a.push(new m2(l[0],l.slice(1)))});break;case"LineString":a.push(new v2([n.coordinates]));break;case"MultiLineString":a.push(new v2(n.coordinates))}var s=new D1(i[e||"name"],a,i.cp);return s.properties=i,s})}var xv={};YR(xv,{MAX_SAFE_INTEGER:()=>e_,asc:()=>Ti,getPercentWithPrecision:()=>KG,getPixelPrecision:()=>Fm,getPrecision:()=>Sn,getPrecisionSafe:()=>YL,isNumeric:()=>yp,isRadianAroundZero:()=>Su,linearMap:()=>rr,nice:()=>Bm,numericToNumber:()=>Pa,parseDate:()=>Mn,quantile:()=>km,quantity:()=>kb,quantityExponent:()=>zm,reformIntervals:()=>r_,remRadian:()=>t_,round:()=>Ar});var sx=vt();function m8(r){return r.type==="category"?ide(r):ade(r)}function v8(r,e){return r.type==="category"?nde(r,e):{ticks:de(r.scale.getTicks(),function(t){return t.value})}}function ide(r){var e=r.getLabelModel(),t=g8(r,e);return!e.get("show")||r.scale.isBlank()?{labels:[],labelCategoryInterval:t.labelCategoryInterval}:t}function g8(r,e){var t=y8(r,"labels"),i=R1(e),n=_8(t,i);if(n)return n;var a,o;return He(i)?a=b8(r,i):(o=i==="auto"?ode(r):i,a=M8(r,o)),x8(t,i,{labels:a,labelCategoryInterval:o})}function nde(r,e){var t=y8(r,"ticks"),i=R1(e),n=_8(t,i);if(n)return n;var a,o;if((!e.get("show")||r.scale.isBlank())&&(a=[]),He(i))a=b8(r,i,!0);else if(i==="auto"){var s=g8(r,r.getLabelModel());o=s.labelCategoryInterval,a=de(s.labels,function(l){return l.tickValue})}else o=i,a=M8(r,o,!0);return x8(t,i,{ticks:a,tickCategoryInterval:o})}function ade(r){var e=r.scale.getTicks(),t=yv(r);return{labels:de(e,function(i,n){return{level:i.level,formattedLabel:t(i,n),rawLabel:r.scale.getLabel(i),tickValue:i.value}})}}function y8(r,e){return sx(r)[e]||(sx(r)[e]=[])}function _8(r,e){for(var t=0;t<r.length;t++)if(r[t].key===e)return r[t].value}function x8(r,e,t){return r.push({key:e,value:t}),t}function ode(r){var e=sx(r).autoInterval;return e??(sx(r).autoInterval=r.calculateCategoryInterval())}function S8(r){var e=sde(r),t=yv(r),i=(e.axisRotate-e.labelRotate)/180*Math.PI,n=r.scale,a=n.getExtent(),o=n.count();if(a[1]-a[0]<1)return 0;var s=1;o>40&&(s=Math.max(1,Math.floor(o/40)));for(var l=a[0],u=r.dataToCoord(l+1)-r.dataToCoord(l),c=Math.abs(u*Math.cos(i)),f=Math.abs(u*Math.sin(i)),h=0,p=0;l<=a[1];l+=s){var d=0,g=0,m=Ll(t({value:l}),e.font,"center","top");d=m.width*1.3,g=m.height*1.3,h=Math.max(h,d,7),p=Math.max(p,g,7)}var v=h/c,_=p/f;isNaN(v)&&(v=1/0),isNaN(_)&&(_=1/0);var y=Math.max(0,Math.floor(Math.min(v,_))),x=sx(r.model),M=r.getExtent(),S=x.lastAutoInterval,w=x.lastTickCount;return S!=null&&w!=null&&Math.abs(S-y)<=1&&Math.abs(w-o)<=1&&S>y&&x.axisExtent0===M[0]&&x.axisExtent1===M[1]?y=S:(x.lastTickCount=o,x.lastAutoInterval=y,x.axisExtent0=M[0],x.axisExtent1=M[1]),y}function sde(r){var e=r.getLabelModel();return{axisRotate:r.getRotate?r.getRotate():r.isHorizontal&&!r.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function M8(r,e,t){var i=yv(r),n=r.scale,a=n.getExtent(),o=r.getLabelModel(),s=[],l=Math.max((e||0)+1,1),u=a[0],c=n.count();u!==0&&l>1&&c/l>2&&(u=Math.round(Math.ceil(u/l)*l));var f=L1(r),h=o.get("showMinLabel")||f,p=o.get("showMaxLabel")||f;h&&u!==a[0]&&g(a[0]);for(var d=u;d<=a[1];d+=l)g(d);p&&d-l!==a[1]&&g(a[1]);function g(m){var v={value:m};s.push(t?m:{formattedLabel:i(v),rawLabel:n.getLabel(v),tickValue:m})}return s}function b8(r,e,t){var i=r.scale,n=yv(r),a=[];return N(i.getTicks(),function(o){var s=i.getLabel(o),l=o.value;e(o.value,s)&&a.push(t?l:{formattedLabel:n(o),rawLabel:s,tickValue:l})}),a}var w8=[0,1],lde=function(){function r(e,t,i){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=i||[0,0]}return r.prototype.contain=function(e){var t=this._extent,i=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]);return e>=i&&e<=n},r.prototype.containData=function(e){return this.scale.contain(e)},r.prototype.getExtent=function(){return this._extent.slice()},r.prototype.getPixelPrecision=function(e){return Fm(e||this.scale.getExtent(),this._extent)},r.prototype.setExtent=function(e,t){var i=this._extent;i[0]=e,i[1]=t},r.prototype.dataToCoord=function(e,t){var i=this._extent,n=this.scale;return e=n.normalize(e),this.onBand&&n.type==="ordinal"&&(i=i.slice(),T8(i,n.count())),rr(e,w8,i,t)},r.prototype.coordToData=function(e,t){var i=this._extent,n=this.scale;this.onBand&&n.type==="ordinal"&&(i=i.slice(),T8(i,n.count()));var a=rr(e,i,w8,t);return this.scale.scale(a)},r.prototype.pointToData=function(e,t){},r.prototype.getTicksCoords=function(e){e=e||{};var t=e.tickModel||this.getTickModel(),i=v8(this,t),n=i.ticks,a=de(n,function(s){return{coord:this.dataToCoord(this.scale.type==="ordinal"?this.scale.getRawOrdinalNumber(s):s),tickValue:s}},this),o=t.get("alignWithLabel");return ude(this,a,o,e.clamp),a},r.prototype.getMinorTicksCoords=function(){if(this.scale.type==="ordinal")return[];var e=this.model.getModel("minorTick"),t=e.get("splitNumber");t>0&&t<100||(t=5);var i=this.scale.getMinorTicks(t),n=de(i,function(a){return de(a,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return n},r.prototype.getViewLabels=function(){return m8(this).labels},r.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},r.prototype.getTickModel=function(){return this.model.getModel("axisTick")},r.prototype.getBandWidth=function(){var e=this._extent,t=this.scale.getExtent(),i=t[1]-t[0]+(this.onBand?1:0);i===0&&(i=1);var n=Math.abs(e[1]-e[0]);return Math.abs(n)/i},r.prototype.calculateCategoryInterval=function(){return S8(this)},r}();function T8(r,e){var t=r[1]-r[0],i=e,n=t/i/2;r[0]+=n,r[1]-=n}function ude(r,e,t,i){var n=e.length;if(!r.onBand||t||!n)return;var a=r.getExtent(),o,s;if(n===1)e[0].coord=a[0],o=e[1]={coord:a[1]};else{var l=e[n-1].tickValue-e[0].tickValue,u=(e[n-1].coord-e[0].coord)/l;N(e,function(p){p.coord-=u/2});var c=r.scale.getExtent();s=1+c[1]-e[n-1].tickValue,o={coord:e[n-1].coord+u*s},e.push(o)}var f=a[0]>a[1];h(e[0].coord,a[0])&&(i?e[0].coord=a[0]:e.shift()),i&&h(a[0],e[0].coord)&&e.unshift({coord:a[0]}),h(a[1],o.coord)&&(i?o.coord=a[1]:e.pop()),i&&h(o.coord,a[1])&&e.push({coord:a[1]});function h(p,d){return p=Ar(p),d=Ar(d),f?p>d:p<d}}var pn=lde;var lx=Math.PI*2,Zp=Ki.CMD,cde=["top","right","bottom","left"];function fde(r,e,t,i,n){var a=t.width,o=t.height;switch(r){case"top":i.set(t.x+a/2,t.y-e),n.set(0,-1);break;case"bottom":i.set(t.x+a/2,t.y+o+e),n.set(0,1);break;case"left":i.set(t.x-e,t.y+o/2),n.set(-1,0);break;case"right":i.set(t.x+a+e,t.y+o/2),n.set(1,0);break}}function hde(r,e,t,i,n,a,o,s,l){o-=r,s-=e;var u=Math.sqrt(o*o+s*s);o/=u,s/=u;var c=o*t+r,f=s*t+e;if(Math.abs(i-n)%lx<1e-4)return l[0]=c,l[1]=f,u-t;if(a){var h=i;i=bn(n),n=bn(h)}else i=bn(i),n=bn(n);i>n&&(n+=lx);var p=Math.atan2(s,o);if(p<0&&(p+=lx),p>=i&&p<=n||p+lx>=i&&p+lx<=n)return l[0]=c,l[1]=f,u-t;var d=t*Math.cos(i)+r,g=t*Math.sin(i)+e,m=t*Math.cos(n)+r,v=t*Math.sin(n)+e,_=(d-o)*(d-o)+(g-s)*(g-s),y=(m-o)*(m-o)+(v-s)*(v-s);return _<y?(l[0]=d,l[1]=g,Math.sqrt(_)):(l[0]=m,l[1]=v,Math.sqrt(y))}function I1(r,e,t,i,n,a,o,s){var l=n-r,u=a-e,c=t-r,f=i-e,h=Math.sqrt(c*c+f*f);c/=h,f/=h;var p=l*c+u*f,d=p/h;s&&(d=Math.min(Math.max(d,0),1)),d*=h;var g=o[0]=r+d*c,m=o[1]=e+d*f;return Math.sqrt((g-n)*(g-n)+(m-a)*(m-a))}function E8(r,e,t,i,n,a,o){t<0&&(r=r+t,t=-t),i<0&&(e=e+i,i=-i);var s=r+t,l=e+i,u=o[0]=Math.min(Math.max(n,r),s),c=o[1]=Math.min(Math.max(a,e),l);return Math.sqrt((u-n)*(u-n)+(c-a)*(c-a))}var Js=[];function pde(r,e,t){var i=E8(e.x,e.y,e.width,e.height,r.x,r.y,Js);return t.set(Js[0],Js[1]),i}function dde(r,e,t){for(var i=0,n=0,a=0,o=0,s,l,u=1/0,c=e.data,f=r.x,h=r.y,p=0;p<c.length;){var d=c[p++];p===1&&(i=c[p],n=c[p+1],a=i,o=n);var g=u;switch(d){case Zp.M:a=c[p++],o=c[p++],i=a,n=o;break;case Zp.L:g=I1(i,n,c[p],c[p+1],f,h,Js,!0),i=c[p++],n=c[p++];break;case Zp.C:g=gb(i,n,c[p++],c[p++],c[p++],c[p++],c[p],c[p+1],f,h,Js),i=c[p++],n=c[p++];break;case Zp.Q:g=_b(i,n,c[p++],c[p++],c[p],c[p+1],f,h,Js),i=c[p++],n=c[p++];break;case Zp.A:var m=c[p++],v=c[p++],_=c[p++],y=c[p++],x=c[p++],M=c[p++];p+=1;var S=!!(1-c[p++]);s=Math.cos(x)*_+m,l=Math.sin(x)*y+v,p<=1&&(a=s,o=l);var w=(f-m)*y/_+m;g=hde(m,v,y,x,x+M,S,w,h,Js),i=Math.cos(x+M)*_+m,n=Math.sin(x+M)*y+v;break;case Zp.R:a=i=c[p++],o=n=c[p++];var T=c[p++],C=c[p++];g=E8(a,o,T,C,f,h,Js);break;case Zp.Z:g=I1(i,n,a,o,f,h,Js,!0),i=a,n=o;break}g<u&&(u=g,t.set(Js[0],Js[1]))}return u}var $s=new Nt,qr=new Nt,Ai=new Nt,Wl=new Nt,Hl=new Nt;function x2(r,e){if(r){var t=r.getTextGuideLine(),i=r.getTextContent();if(i&&t){var n=r.textGuideLineConfig||{},a=[[0,0],[0,0],[0,0]],o=n.candidates||cde,s=i.getBoundingRect().clone();s.applyTransform(i.getComputedTransform());var l=1/0,u=n.anchor,c=r.getComputedTransform(),f=c&&Yo([],c),h=e.get("length2")||0;u&&Ai.copy(u);for(var p=0;p<o.length;p++){var d=o[p];fde(d,0,s,$s,Wl),Nt.scaleAndAdd(qr,$s,Wl,h),qr.transform(f);var g=r.getBoundingRect(),m=u?u.distance(qr):r instanceof ut?dde(qr,r.path,Ai):pde(qr,g,Ai);m<l&&(l=m,qr.transform(c),Ai.transform(c),Ai.toArray(a[0]),qr.toArray(a[1]),$s.toArray(a[2]))}S2(a,e.get("minTurnAngle")),t.setShape({points:a})}}}var N1=[],fa=new Nt;function S2(r,e){if(e<=180&&e>0){e=e/180*Math.PI,$s.fromArray(r[0]),qr.fromArray(r[1]),Ai.fromArray(r[2]),Nt.sub(Wl,$s,qr),Nt.sub(Hl,Ai,qr);var t=Wl.len(),i=Hl.len();if(!(t<.001||i<.001)){Wl.scale(1/t),Hl.scale(1/i);var n=Wl.dot(Hl),a=Math.cos(e);if(a<n){var o=I1(qr.x,qr.y,Ai.x,Ai.y,$s.x,$s.y,N1,!1);fa.fromArray(N1),fa.scaleAndAdd(Hl,o/Math.tan(Math.PI-e));var s=Ai.x!==qr.x?(fa.x-qr.x)/(Ai.x-qr.x):(fa.y-qr.y)/(Ai.y-qr.y);if(isNaN(s))return;s<0?Nt.copy(fa,qr):s>1&&Nt.copy(fa,Ai),fa.toArray(r[1])}}}}function A8(r,e,t){if(t<=180&&t>0){t=t/180*Math.PI,$s.fromArray(r[0]),qr.fromArray(r[1]),Ai.fromArray(r[2]),Nt.sub(Wl,qr,$s),Nt.sub(Hl,Ai,qr);var i=Wl.len(),n=Hl.len();if(!(i<.001||n<.001)){Wl.scale(1/i),Hl.scale(1/n);var a=Wl.dot(e),o=Math.cos(t);if(a<o){var s=I1(qr.x,qr.y,Ai.x,Ai.y,$s.x,$s.y,N1,!1);fa.fromArray(N1);var l=Math.PI/2,u=Math.acos(Hl.dot(e)),c=l+u-t;if(c>=l)Nt.copy(fa,Ai);else{fa.scaleAndAdd(Hl,s/Math.tan(Math.PI/2-c));var f=Ai.x!==qr.x?(fa.x-qr.x)/(Ai.x-qr.x):(fa.y-qr.y)/(Ai.y-qr.y);if(isNaN(f))return;f<0?Nt.copy(fa,qr):f>1&&Nt.copy(fa,Ai)}fa.toArray(r[1])}}}}function _2(r,e,t,i){var n=t==="normal",a=n?r:r.ensureState(t);a.ignore=e;var o=i.get("smooth");o&&o===!0&&(o=.3),a.shape=a.shape||{},o>0&&(a.shape.smooth=o);var s=i.getModel("lineStyle").getLineStyle();n?r.useStyle(s):a.style=s}function mde(r,e){var t=e.smooth,i=e.points;if(i)if(r.moveTo(i[0][0],i[0][1]),t>0&&i.length>=3){var n=Xo(i[0],i[1]),a=Xo(i[1],i[2]);if(!n||!a){r.lineTo(i[1][0],i[1][1]),r.lineTo(i[2][0],i[2][1]);return}var o=Math.min(n,a)*t,s=Tm([],i[1],i[0],o/n),l=Tm([],i[1],i[2],o/a),u=Tm([],s,l,.5);r.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),r.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var c=1;c<i.length;c++)r.lineTo(i[c][0],i[c][1])}function Sv(r,e,t){var i=r.getTextGuideLine(),n=r.getTextContent();if(!n){i&&r.removeTextGuideLine();return}for(var a=e.normal,o=a.get("show"),s=n.ignore,l=0;l<bf.length;l++){var u=bf[l],c=e[u],f=u==="normal";if(c){var h=c.get("show"),p=f?s:ft(n.states[u]&&n.states[u].ignore,s);if(p||!ft(h,o)){var d=f?i:i&&i.states[u];d&&(d.ignore=!0),i&&_2(i,!0,u,c);continue}i||(i=new $r,r.setTextGuideLine(i),!f&&(s||!o)&&_2(i,!0,"normal",e.normal),r.stateProxy&&(i.stateProxy=r.stateProxy)),_2(i,!1,u,c)}}if(i){Ye(i.style,t),i.style.fill=null;var g=a.get("showAbove"),m=r.textGuideLineConfig=r.textGuideLineConfig||{};m.showAbove=g||!1,i.buildPath=mde}}function Mv(r,e){e=e||"labelLine";for(var t={normal:r.getModel(e)},i=0;i<Bi.length;i++){var n=Bi[i];t[n]=r.getModel([n,e])}return t}function U1(r){for(var e=[],t=0;t<r.length;t++){var i=r[t];if(!i.defaultAttr.ignore){var n=i.label,a=n.getComputedTransform(),o=n.getBoundingRect(),s=!a||a[1]<1e-5&&a[2]<1e-5,l=n.style.margin||0,u=o.clone();u.applyTransform(a),u.x-=l/2,u.y-=l/2,u.width+=l,u.height+=l;var c=s?new ev(o,a):null;e.push({label:n,labelLine:i.labelLine,rect:u,localRect:o,obb:c,priority:i.priority,defaultAttr:i.defaultAttr,layoutOption:i.computedLayoutOption,axisAligned:s,transform:a})}}return e}function C8(r,e,t,i,n,a){var o=r.length;if(o<2)return;r.sort(function(C,b){return C.rect[e]-b.rect[e]});for(var s=0,l,u=!1,c=[],f=0,h=0;h<o;h++){var p=r[h],d=p.rect;l=d[e]-s,l<0&&(d[e]-=l,p.label[e]-=l,u=!0);var g=Math.max(-l,0);c.push(g),f+=g,s=d[e]+d[t]}f>0&&a&&S(-f/o,0,o);var m=r[0],v=r[o-1],_,y;x(),_<0&&w(-_,.8),y<0&&w(y,.8),x(),M(_,y,1),M(y,_,-1),x(),_<0&&T(-_),y<0&&T(y);function x(){_=m.rect[e]-i,y=n-v.rect[e]-v.rect[t]}function M(C,b,E){if(C<0){var I=Math.min(b,-C);if(I>0){S(I*E,0,o);var R=I+C;R<0&&w(-R*E,1)}else w(-C*E,1)}}function S(C,b,E){C!==0&&(u=!0);for(var I=b;I<E;I++){var R=r[I],A=R.rect;A[e]+=C,R.label[e]+=C}}function w(C,b){for(var E=[],I=0,R=1;R<o;R++){var A=r[R-1].rect,D=Math.max(r[R].rect[e]-A[e]-A[t],0);E.push(D),I+=D}if(I){var U=Math.min(Math.abs(C)/I,b);if(C>0)for(var R=0;R<o-1;R++){var B=E[R]*U;S(B,0,R+1)}else for(var R=o-1;R>0;R--){var B=E[R-1]*U;S(-B,R,o)}}}function T(C){var b=C<0?-1:1;C=Math.abs(C);for(var E=Math.ceil(C/(o-1)),I=0;I<o-1;I++)if(b>0?S(E,0,I+1):S(-E,o-I-1,o),C-=E,C<=0)return}return u}function R8(r,e,t,i){return C8(r,"x","width",e,t,i)}function O1(r,e,t,i){return C8(r,"y","height",e,t,i)}function F1(r){var e=[];r.sort(function(g,m){return m.priority-g.priority});var t=new lt(0,0,0,0);function i(g){if(!g.ignore){var m=g.ensureState("emphasis");m.ignore==null&&(m.ignore=!1)}g.ignore=!0}for(var n=0;n<r.length;n++){var a=r[n],o=a.axisAligned,s=a.localRect,l=a.transform,u=a.label,c=a.labelLine;t.copy(a.rect),t.width-=.1,t.height-=.1,t.x+=.05,t.y+=.05;for(var f=a.obb,h=!1,p=0;p<e.length;p++){var d=e[p];if(t.intersect(d.rect)){if(o&&d.axisAligned){h=!0;break}if(d.obb||(d.obb=new ev(d.localRect,d.transform)),f||(f=new ev(s,l)),f.intersect(d.obb)){h=!0;break}}}h?(i(u),c&&i(c)):(u.attr("ignore",a.defaultAttr.ignore),c&&c.attr("ignore",a.defaultAttr.labelGuideIgnore),e.push(a))}}function vde(r){if(r){for(var e=[],t=0;t<r.length;t++)e.push(r[t].slice());return e}}function gde(r,e){var t=r.label,i=e&&e.getTextGuideLine();return{dataIndex:r.dataIndex,dataType:r.dataType,seriesIndex:r.seriesModel.seriesIndex,text:r.label.style.text,rect:r.hostRect,labelRect:r.rect,align:t.style.align,verticalAlign:t.style.verticalAlign,labelLinePoints:vde(i&&i.shape.points)}}var L8=["align","verticalAlign","width","height","fontSize"],ha=new Ra,M2=vt(),yde=vt();function z1(r,e,t){for(var i=0;i<t.length;i++){var n=t[i];e[n]!=null&&(r[n]=e[n])}}var B1=["x","y","rotation"],_de=function(){function r(){this._labelList=[],this._chartViewList=[]}return r.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},r.prototype._addLabel=function(e,t,i,n,a){var o=n.style,s=n.__hostTarget,l=s.textConfig||{},u=n.getComputedTransform(),c=n.getBoundingRect().plain();lt.applyTransform(c,c,u),u?ha.setLocalTransform(u):(ha.x=ha.y=ha.rotation=ha.originX=ha.originY=0,ha.scaleX=ha.scaleY=1),ha.rotation=bn(ha.rotation);var f=n.__hostTarget,h;if(f){h=f.getBoundingRect().plain();var p=f.getComputedTransform();lt.applyTransform(h,h,p)}var d=h&&f.getTextGuideLine();this._labelList.push({label:n,labelLine:d,seriesModel:i,dataIndex:e,dataType:t,layoutOption:a,computedLayoutOption:null,rect:c,hostRect:h,priority:h?h.width*h.height:0,defaultAttr:{ignore:n.ignore,labelGuideIgnore:d&&d.ignore,x:ha.x,y:ha.y,scaleX:ha.scaleX,scaleY:ha.scaleY,rotation:ha.rotation,style:{x:o.x,y:o.y,align:o.align,verticalAlign:o.verticalAlign,width:o.width,height:o.height,fontSize:o.fontSize},cursor:n.cursor,attachedPos:l.position,attachedRot:l.rotation}})},r.prototype.addLabelsOfSeries=function(e){var t=this;this._chartViewList.push(e);var i=e.__model,n=i.get("labelLayout");(He(n)||bt(n).length)&&e.group.traverse(function(a){if(a.ignore)return!0;var o=a.getTextContent(),s=rt(a);o&&!o.disableLabelLayout&&t._addLabel(s.dataIndex,s.dataType,i,o,n)})},r.prototype.updateLayoutConfig=function(e){var t=e.getWidth(),i=e.getHeight();function n(y,x){return function(){x2(y,x)}}for(var a=0;a<this._labelList.length;a++){var o=this._labelList[a],s=o.label,l=s.__hostTarget,u=o.defaultAttr,c=void 0;He(o.layoutOption)?c=o.layoutOption(gde(o,l)):c=o.layoutOption,c=c||{},o.computedLayoutOption=c;var f=Math.PI/180;l&&l.setTextConfig({local:!1,position:c.x!=null||c.y!=null?null:u.attachedPos,rotation:c.rotate!=null?c.rotate*f:u.attachedRot,offset:[c.dx||0,c.dy||0]});var h=!1;if(c.x!=null?(s.x=Fe(c.x,t),s.setStyle("x",0),h=!0):(s.x=u.x,s.setStyle("x",u.style.x)),c.y!=null?(s.y=Fe(c.y,i),s.setStyle("y",0),h=!0):(s.y=u.y,s.setStyle("y",u.style.y)),c.labelLinePoints){var p=l.getTextGuideLine();p&&(p.setShape({points:c.labelLinePoints}),h=!1)}var d=M2(s);d.needsUpdateLabelLine=h,s.rotation=c.rotate!=null?c.rotate*f:u.rotation,s.scaleX=u.scaleX,s.scaleY=u.scaleY;for(var g=0;g<L8.length;g++){var m=L8[g];s.setStyle(m,c[m]!=null?c[m]:u.style[m])}if(c.draggable){if(s.draggable=!0,s.cursor="move",l){var v=o.seriesModel;if(o.dataIndex!=null){var _=o.seriesModel.getData(o.dataType);v=_.getItemModel(o.dataIndex)}s.on("drag",n(l,v.getModel("labelLine")))}}else s.off("drag"),s.cursor=u.cursor}},r.prototype.layout=function(e){var t=e.getWidth(),i=e.getHeight(),n=U1(this._labelList),a=Wt(n,function(l){return l.layoutOption.moveOverlap==="shiftX"}),o=Wt(n,function(l){return l.layoutOption.moveOverlap==="shiftY"});R8(a,0,t),O1(o,0,i);var s=Wt(n,function(l){return l.layoutOption.hideOverlap});F1(s)},r.prototype.processLabelsOverall=function(){var e=this;N(this._chartViewList,function(t){var i=t.__model,n=t.ignoreLabelLineUpdate,a=i.isAnimationEnabled();t.group.traverse(function(o){if(o.ignore&&!o.forceLabelAnimation)return!0;var s=!n,l=o.getTextContent();!s&&l&&(s=M2(l).needsUpdateLabelLine),s&&e._updateLabelLine(o,i),a&&e._animateLabels(o,i)})})},r.prototype._updateLabelLine=function(e,t){var i=e.getTextContent(),n=rt(e),a=n.dataIndex;if(i&&a!=null){var o=t.getData(n.dataType),s=o.getItemModel(a),l={},u=o.getItemVisual(a,"style");if(u){var c=o.getVisual("drawType");l.stroke=u[c]}var f=s.getModel("labelLine");Sv(e,Mv(s),l),x2(e,f)}},r.prototype._animateLabels=function(e,t){var i=e.getTextContent(),n=e.getTextGuideLine();if(i&&(e.forceLabelAnimation||!i.ignore&&!i.invisible&&!e.disableLabelAnimation&&!Au(e))){var a=M2(i),o=a.oldLayout,s=rt(e),l=s.dataIndex,u={x:i.x,y:i.y,rotation:i.rotation},c=t.getData(s.dataType);if(o){i.attr(o);var h=e.prevStates;h&&(dt(h,"select")>=0&&i.attr(a.oldLayoutSelect),dt(h,"emphasis")>=0&&i.attr(a.oldLayoutEmphasis)),Dt(i,u,t,l)}else if(i.attr(u),!Du(i).valueAnimation){var f=ft(i.style.opacity,1);i.style.opacity=0,ar(i,{style:{opacity:f}},t,l)}if(a.oldLayout=u,i.states.select){var p=a.oldLayoutSelect={};z1(p,u,B1),z1(p,i.states.select,B1)}if(i.states.emphasis){var d=a.oldLayoutEmphasis={};z1(d,u,B1),z1(d,i.states.emphasis,B1)}gw(i,l,c,t,t)}if(n&&!n.ignore&&!n.invisible){var a=yde(n),o=a.oldLayout,g={points:n.shape.points};o?(n.attr({shape:o}),Dt(n,{shape:g},t)):(n.setShape(g),n.style.strokePercent=0,ar(n,{style:{strokePercent:1}},t)),a.oldLayout=g}},r}(),P8=_de;var b2=vt();function w2(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){var n=b2(t).labelManager;n||(n=b2(t).labelManager=new P8),n.clearLabels()}),r.registerUpdateLifecycle("series:layoutlabels",function(e,t,i){var n=b2(t).labelManager;i.updatedSeries.forEach(function(a){n.addLabelsOfSeries(t.getViewOfSeriesModel(a))}),n.updateLayoutConfig(t),n.layout(t),n.processLabelsOverall()})}var T2=Math.sin,E2=Math.cos,D8=Math.PI,jp=Math.PI*2,xde=180/D8,Sde=function(){function r(){}return r.prototype.reset=function(e){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,e||4)},r.prototype.moveTo=function(e,t){this._add("M",e,t)},r.prototype.lineTo=function(e,t){this._add("L",e,t)},r.prototype.bezierCurveTo=function(e,t,i,n,a,o){this._add("C",e,t,i,n,a,o)},r.prototype.quadraticCurveTo=function(e,t,i,n){this._add("Q",e,t,i,n)},r.prototype.arc=function(e,t,i,n,a,o){this.ellipse(e,t,i,i,0,n,a,o)},r.prototype.ellipse=function(e,t,i,n,a,o,s,l){var u=s-o,c=!l,f=Math.abs(u),h=Rl(f-jp)||(c?u>=jp:-u>=jp),p=u>0?u%jp:u%jp+jp,d=!1;h?d=!0:Rl(f)?d=!1:d=p>=D8==!!c;var g=e+i*E2(o),m=t+n*T2(o);this._start&&this._add("M",g,m);var v=Math.round(a*xde);if(h){var _=1/this._p,y=(c?1:-1)*(jp-_);this._add("A",i,n,v,1,+c,e+i*E2(o+y),t+n*T2(o+y)),_>.01&&this._add("A",i,n,v,0,+c,g,m)}else{var x=e+i*E2(s),M=t+n*T2(s);this._add("A",i,n,v,+d,+c,x,M)}},r.prototype.rect=function(e,t,i,n){this._add("M",e,t),this._add("l",i,0),this._add("l",0,n),this._add("l",-i,0),this._add("Z")},r.prototype.closePath=function(){this._d.length>0&&this._add("Z")},r.prototype._add=function(e,t,i,n,a,o,s,l,u){for(var c=[],f=this._p,h=1;h<arguments.length;h++){var p=arguments[h];if(isNaN(p)){this._invalid=!0;return}c.push(Math.round(p*f)/f)}this._d.push(e+c.join(" ")),this._start=e==="Z"},r.prototype.generateStr=function(){this._str=this._invalid?"":this._d.join(""),this._d=[]},r.prototype.getStr=function(){return this._str},r}(),k1=Sde;var ux="none",Mde=Math.round;function bde(r){var e=r.fill;return e!=null&&e!==ux}function wde(r){var e=r.stroke;return e!=null&&e!==ux}var A2=["lineCap","miterLimit","lineJoin"],Tde=de(A2,function(r){return"stroke-"+r.toLowerCase()});function C2(r,e,t,i){var n=e.opacity==null?1:e.opacity;if(t instanceof Ur){r("opacity",n);return}if(bde(e)){var a=mf(e.fill);r("fill",a.color);var o=e.fillOpacity!=null?e.fillOpacity*a.opacity*n:a.opacity*n;(i||o<1)&&r("fill-opacity",o)}else r("fill",ux);if(wde(e)){var s=mf(e.stroke);r("stroke",s.color);var l=e.strokeNoScale?t.getLineScale():1,u=l?(e.lineWidth||0)/l:0,c=e.strokeOpacity!=null?e.strokeOpacity*s.opacity*n:s.opacity*n,f=e.strokeFirst;if((i||u!==1)&&r("stroke-width",u),(i||f)&&r("paint-order",f?"stroke":"fill"),(i||c<1)&&r("stroke-opacity",c),e.lineDash){var h=Y_(t),p=h[0],d=h[1];p&&(d=Mde(d||0),r("stroke-dasharray",p.join(",")),(d||i)&&r("stroke-dashoffset",d))}else i&&r("stroke-dasharray",ux);for(var g=0;g<A2.length;g++){var m=A2[g];if(i||e[m]!==Xm[m]){var v=e[m]||Xm[m];v&&r(Tde[g],v)}}}else i&&r("stroke",ux)}var I8="http://www.w3.org/2000/svg",R2="http://www.w3.org/1999/xlink",N8="http://www.w3.org/2000/xmlns/",U8="http://www.w3.org/XML/1998/namespace",L2="ecmeta_";function V1(r){return document.createElementNS(I8,r)}function Ci(r,e,t,i,n){return{tag:r,attrs:t||{},children:i,text:n,key:e}}function Ede(r,e){var t=[];if(e)for(var i in e){var n=e[i],a=i;n!==!1&&(n!==!0&&n!=null&&(a+='="'+n+'"'),t.push(a))}return"<"+r+" "+t.join(" ")+">"}function Ade(r){return"</"+r+">"}function cx(r,e){e=e||{};var t=e.newline?`
  2213. `:"";function i(n){var a=n.children,o=n.tag,s=n.attrs,l=n.text;return Ede(o,s)+(o!=="style"?yn(l):l||"")+(a?""+t+de(a,function(u){return i(u)}).join(t)+t:"")+Ade(o)}return i(r)}function O8(r,e,t){t=t||{};var i=t.newline?`
  2214. `:"",n=" {"+i,a=i+"}",o=de(bt(r),function(l){return l+n+de(bt(r[l]),function(u){return u+":"+r[l][u]+";"}).join(i)+a}).join(i),s=de(bt(e),function(l){return"@keyframes "+l+n+de(bt(e[l]),function(u){return u+n+de(bt(e[l][u]),function(c){var f=e[l][u][c];return c==="d"&&(f='path("'+f+'")'),c+":"+f+";"}).join(i)+a}).join(i)+a}).join(i);return!o&&!s?"":["<![CDATA[",o,s,"]]>"].join(i)}function fx(r){return{zrId:r,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function P2(r,e,t,i){return Ci("svg","root",{width:r,height:e,xmlns:I8,"xmlns:xlink":R2,version:"1.1",baseProfile:"full",viewBox:i?"0 0 "+r+" "+e:!1},t)}var Cde=0;function G1(){return Cde++}var F8={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},Kp="transform-origin";function Rde(r,e,t){var i=fe({},r.shape);fe(i,e),r.buildPath(t,i);var n=new k1;return n.reset(Rb(r)),t.rebuildPath(n,1),n.generateStr(),n.getStr()}function Lde(r,e){var t=e.originX,i=e.originY;(t||i)&&(r[Kp]=t+"px "+i+"px")}var Pde={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function B8(r,e){var t=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[t]=r,t}function Dde(r,e,t){var i=r.shape.paths,n={},a,o;if(N(i,function(l){var u=fx(t.zrId);u.animation=!0,hx(l,{},u,!0);var c=u.cssAnims,f=u.cssNodes,h=bt(c),p=h.length;if(p){o=h[p-1];var d=c[o];for(var g in d){var m=d[g];n[g]=n[g]||{d:""},n[g].d+=m.d||""}for(var v in f){var _=f[v].animation;_.indexOf(o)>=0&&(a=_)}}}),!!a){e.d=!1;var s=B8(n,t);return a.replace(o,s)}}function z8(r){return Ce(r)?F8[r]?"cubic-bezier("+F8[r]+")":Lm(r)?r:"":""}function hx(r,e,t,i){var n=r.animators,a=n.length,o=[];if(r instanceof Qm){var s=Dde(r,e,t);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var l={},u=0;u<a;u++){var c=n[u],f=[c.getMaxTime()/1e3+"s"],h=z8(c.getClip().easing),p=c.getDelay();h?f.push(h):f.push("linear"),p&&f.push(p/1e3+"s"),c.getLoop()&&f.push("infinite");var d=f.join(" ");l[d]=l[d]||[d,[]],l[d][1].push(c)}function g(_){var y=_[1],x=y.length,M={},S={},w={},T="animation-timing-function";function C(ue,se,Ee){for(var q=ue.getTracks(),H=ue.getMaxTime(),We=0;We<q.length;We++){var _e=q[We];if(_e.needsAnimate()){var xe=_e.keyframes,Le=_e.propName;if(Ee&&(Le=Ee(Le)),Le)for(var Ue=0;Ue<xe.length;Ue++){var Ne=xe[Ue],Ve=Math.round(Ne.time/H*100)+"%",ct=z8(Ne.easing),z=Ne.rawValue;(Ce(z)||At(z))&&(se[Ve]=se[Ve]||{},se[Ve][Le]=Ne.rawValue,ct&&(se[Ve][T]=ct))}}}}for(var b=0;b<x;b++){var E=y[b],I=E.targetName;I?I==="shape"&&C(E,S):!i&&C(E,M)}for(var R in M){var A={};zL(A,r),fe(A,M[R]);var D=Lb(A),U=M[R][T];w[R]=D?{transform:D}:{},Lde(w[R],A),U&&(w[R][T]=U)}var B,F=!0;for(var R in S){w[R]=w[R]||{};var k=!B,U=S[R][T];k&&(B=new Ki);var G=B.len();B.reset(),w[R].d=Rde(r,S[R],B);var Y=B.len();if(!k&&G!==Y){F=!1;break}U&&(w[R][T]=U)}if(!F)for(var R in w)delete w[R].d;if(!i)for(var b=0;b<x;b++){var E=y[b],I=E.targetName;I==="style"&&C(E,w,function(q){return Pde[q]})}for(var J=bt(w),Q=!0,V,b=1;b<J.length;b++){var K=J[b-1],ae=J[b];if(w[K][Kp]!==w[ae][Kp]){Q=!1;break}V=w[K][Kp]}if(Q&&V){for(var R in w)w[R][Kp]&&delete w[R][Kp];e[Kp]=V}if(Wt(J,function(ue){return bt(w[ue]).length>0}).length){var ve=B8(w,t);return ve+" "+_[0]+" both"}}for(var m in l){var s=g(l[m]);s&&o.push(s)}if(o.length){var v=t.zrId+"-cls-"+G1();t.cssNodes["."+v]={animation:o.join(",")},e.class=v}}function V8(r,e,t){if(!r.ignore)if(r.isSilent()){var i={"pointer-events":"none"};k8(i,e,t,!0)}else{var n=r.states.emphasis&&r.states.emphasis.style?r.states.emphasis.style:{},a=n.fill;if(!a){var o=r.style&&r.style.fill,s=r.states.select&&r.states.select.style&&r.states.select.style.fill,l=r.currentStates.indexOf("select")>=0&&s||o;l&&(a=X0(l))}var u=n.lineWidth;if(u){var c=!n.strokeNoScale&&r.transform?r.transform[0]:1;u=u/c}var i={cursor:"pointer"};a&&(i.fill=a),n.stroke&&(i.stroke=n.stroke),u&&(i["stroke-width"]=u),k8(i,e,t,!0)}}function k8(r,e,t,i){var n=JSON.stringify(r),a=t.cssStyleCache[n];a||(a=t.zrId+"-cls-"+G1(),t.cssStyleCache[n]=a,t.cssNodes["."+a+(i?":hover":"")]=r),e.class=e.class?e.class+" "+a:a}var px=Math.round;function X8(r){return r&&Ce(r.src)}function Y8(r){return r&&He(r.toDataURL)}function D2(r,e,t,i){C2(function(n,a){var o=n==="fill"||n==="stroke";o&&Cb(a)?O2(e,r,n,i):o&&Y0(a)?F2(t,r,n,i):o&&a==="none"?r[n]="transparent":r[n]=a},e,t,!1),Bde(t,r,i)}function I2(r,e){var t=YG(e);t&&(t.each(function(i,n){i!=null&&(r[(L2+n).toLowerCase()]=i+"")}),e.isSilent()&&(r[L2+"silent"]="true"))}function G8(r){return Rl(r[0]-1)&&Rl(r[1])&&Rl(r[2])&&Rl(r[3]-1)}function Ide(r){return Rl(r[4])&&Rl(r[5])}function N2(r,e,t){if(e&&!(Ide(e)&&G8(e))){var i=t?10:1e4;r.transform=G8(e)?"translate("+px(e[4]*i)/i+" "+px(e[5]*i)/i+")":xG(e)}}function H8(r,e,t){for(var i=r.points,n=[],a=0;a<i.length;a++)n.push(px(i[a][0]*t)/t),n.push(px(i[a][1]*t)/t);e.points=n.join(" ")}function W8(r){return!r.smooth}function Nde(r){var e=de(r,function(t){return typeof t=="string"?[t,t]:t});return function(t,i,n){for(var a=0;a<e.length;a++){var o=e[a],s=t[o[0]];s!=null&&(i[o[1]]=px(s*n)/n)}}}var Ude={circle:[Nde(["cx","cy","r"])],polyline:[H8,W8],polygon:[H8,W8]};function Ode(r){for(var e=r.animators,t=0;t<e.length;t++)if(e[t].targetName==="shape")return!0;return!1}function q8(r,e){var t=r.style,i=r.shape,n=Ude[r.type],a={},o=e.animation,s="path",l=r.style.strokePercent,u=e.compress&&Rb(r)||4;if(n&&!e.willUpdate&&!(n[1]&&!n[1](i))&&!(o&&Ode(r))&&!(l<1)){s=r.type;var c=Math.pow(10,u);n[0](i,a,c)}else{var f=!r.path||r.shapeChanged();r.path||r.createPathProxy();var h=r.path;f&&(h.beginPath(),r.buildPath(h,r.shape),r.pathUpdated());var p=h.getVersion(),d=r,g=d.__svgPathBuilder;(d.__svgPathVersion!==p||!g||l!==d.__svgPathStrokePercent)&&(g||(g=d.__svgPathBuilder=new k1),g.reset(u),h.rebuildPath(g,l),g.generateStr(),d.__svgPathVersion=p,d.__svgPathStrokePercent=l),a.d=g.getStr()}return N2(a,r.transform),D2(a,t,r,e),I2(a,r),e.animation&&hx(r,a,e),e.emphasis&&V8(r,a,e),Ci(s,r.id+"",a)}function Fde(r,e){var t=r.style,i=t.image;if(i&&!Ce(i)&&(X8(i)?i=i.src:Y8(i)&&(i=i.toDataURL())),!!i){var n=t.x||0,a=t.y||0,o=t.width,s=t.height,l={href:i,width:o,height:s};return n&&(l.x=n),a&&(l.y=a),N2(l,r.transform),D2(l,t,r,e),I2(l,r),e.animation&&hx(r,l,e),Ci("image",r.id+"",l)}}function zde(r,e){var t=r.style,i=t.text;if(i!=null&&(i+=""),!(!i||isNaN(t.x)||isNaN(t.y))){var n=t.font||ho,a=t.x||0,o=MG(t.y||0,Um(n),t.textBaseline),s=SG[t.textAlign]||t.textAlign,l={"dominant-baseline":"central","text-anchor":s};if(mP(t)){var u="",c=t.fontStyle,f=dP(t.fontSize);if(!parseFloat(f))return;var h=t.fontFamily||iL,p=t.fontWeight;u+="font-size:"+f+";font-family:"+h+";",c&&c!=="normal"&&(u+="font-style:"+c+";"),p&&p!=="normal"&&(u+="font-weight:"+p+";"),l.style=u}else l.style="font: "+n;return i.match(/\s/)&&(l["xml:space"]="preserve"),a&&(l.x=a),o&&(l.y=o),N2(l,r.transform),D2(l,t,r,e),I2(l,r),e.animation&&hx(r,l,e),Ci("text",r.id+"",l,void 0,i)}}function U2(r,e){if(r instanceof ut)return q8(r,e);if(r instanceof Ur)return Fde(r,e);if(r instanceof bu)return zde(r,e)}function Bde(r,e,t){var i=r.style;if(bG(i)){var n=wG(r),a=t.shadowCache,o=a[n];if(!o){var s=r.getGlobalScale(),l=s[0],u=s[1];if(!l||!u)return;var c=i.shadowOffsetX||0,f=i.shadowOffsetY||0,h=i.shadowBlur,p=mf(i.shadowColor),d=p.opacity,g=p.color,m=h/2/l,v=h/2/u,_=m+" "+v;o=t.zrId+"-s"+t.shadowIdx++,t.defs[o]=Ci("filter",o,{id:o,x:"-100%",y:"-100%",width:"300%",height:"300%"},[Ci("feDropShadow","",{dx:c/l,dy:f/u,stdDeviation:_,"flood-color":g,"flood-opacity":d})]),a[n]=o}e.filter=q0(o)}}function O2(r,e,t,i){var n=r[t],a,o={gradientUnits:n.global?"userSpaceOnUse":"objectBoundingBox"};if(Eb(n))a="linearGradient",o.x1=n.x,o.y1=n.y,o.x2=n.x2,o.y2=n.y2;else if(Ab(n))a="radialGradient",o.cx=ft(n.x,.5),o.cy=ft(n.y,.5),o.r=ft(n.r,.5);else return;for(var s=n.colorStops,l=[],u=0,c=s.length;u<c;++u){var f=Tb(s[u].offset)*100+"%",h=s[u].color,p=mf(h),d=p.color,g=p.opacity,m={offset:f};m["stop-color"]=d,g<1&&(m["stop-opacity"]=g),l.push(Ci("stop",u+"",m))}var v=Ci(a,"",o,l),_=cx(v),y=i.gradientCache,x=y[_];x||(x=i.zrId+"-g"+i.gradientIdx++,y[_]=x,o.id=x,i.defs[x]=Ci(a,x,o,l)),e[t]=q0(x)}function F2(r,e,t,i){var n=r.style[t],a=r.getBoundingRect(),o={},s=n.repeat,l=s==="no-repeat",u=s==="repeat-x",c=s==="repeat-y",f;if(TL(n)){var h=n.imageWidth,p=n.imageHeight,d=void 0,g=n.image;if(Ce(g)?d=g:X8(g)?d=g.src:Y8(g)&&(d=g.toDataURL()),typeof Image>"u"){var m="Image width/height must been given explictly in svg-ssr renderer.";kr(h,m),kr(p,m)}else if(h==null||p==null){var v=function(b,E){if(b){var I=b.elm,R=h||E.width,A=p||E.height;b.tag==="pattern"&&(u?(A=1,R/=a.width):c&&(R=1,A/=a.height)),b.attrs.width=R,b.attrs.height=A,I&&(I.setAttribute("width",R),I.setAttribute("height",A))}},_=o_(d,null,r,function(b){l||v(S,b),v(f,b)});_&&_.width&&_.height&&(h=h||_.width,p=p||_.height)}f=Ci("image","img",{href:d,width:h,height:p}),o.width=h,o.height=p}else n.svgElement&&(f=Qe(n.svgElement),o.width=n.svgWidth,o.height=n.svgHeight);if(f){var y,x;l?y=x=1:u?(x=1,y=o.width/a.width):c?(y=1,x=o.height/a.height):o.patternUnits="userSpaceOnUse",y!=null&&!isNaN(y)&&(o.width=y),x!=null&&!isNaN(x)&&(o.height=x);var M=Lb(n);M&&(o.patternTransform=M);var S=Ci("pattern","",o,[f]),w=cx(S),T=i.patternCache,C=T[w];C||(C=i.zrId+"-p"+i.patternIdx++,T[w]=C,o.id=C,S=i.defs[C]=Ci("pattern",C,o,[f])),e[t]=q0(C)}}function Z8(r,e,t){var i=t.clipPathCache,n=t.defs,a=i[r.id];if(!a){a=t.zrId+"-c"+t.clipPathIdx++;var o={id:a};i[r.id]=a,n[a]=Ci("clipPath",a,o,[q8(r,t)])}e["clip-path"]=q0(a)}function z2(r){return document.createTextNode(r)}function Bf(r,e,t){r.insertBefore(e,t)}function B2(r,e){r.removeChild(e)}function k2(r,e){r.appendChild(e)}function V2(r){return r.parentNode}function G2(r){return r.nextSibling}function H1(r,e){r.textContent=e}var j8=58,Vde=120,Gde=Ci("","");function H2(r){return r===void 0}function Xl(r){return r!==void 0}function Hde(r,e,t){for(var i={},n=e;n<=t;++n){var a=r[n].key;a!==void 0&&(i[a]=n)}return i}function dx(r,e){var t=r.key===e.key,i=r.tag===e.tag;return i&&t}function mx(r){var e,t=r.children,i=r.tag;if(Xl(i)){var n=r.elm=V1(i);if(X1(Gde,r),pe(t))for(e=0;e<t.length;++e){var a=t[e];a!=null&&k2(n,mx(a))}else Xl(r.text)&&!qe(r.text)&&k2(n,z2(r.text))}else r.elm=z2(r.text);return r.elm}function K8(r,e,t,i,n){for(;i<=n;++i){var a=t[i];a!=null&&Bf(r,mx(a),e)}}function W1(r,e,t,i){for(;t<=i;++t){var n=e[t];if(n!=null)if(Xl(n.tag)){var a=V2(n.elm);B2(a,n.elm)}else B2(r,n.elm)}}function X1(r,e){var t,i=e.elm,n=r&&r.attrs||{},a=e.attrs||{};if(n!==a){for(t in a){var o=a[t],s=n[t];s!==o&&(o===!0?i.setAttribute(t,""):o===!1?i.removeAttribute(t):t==="style"?i.style.cssText=o:t.charCodeAt(0)!==Vde?i.setAttribute(t,o):t==="xmlns:xlink"||t==="xmlns"?i.setAttributeNS(N8,t,o):t.charCodeAt(3)===j8?i.setAttributeNS(U8,t,o):t.charCodeAt(5)===j8?i.setAttributeNS(R2,t,o):i.setAttribute(t,o))}for(t in n)t in a||i.removeAttribute(t)}}function Wde(r,e,t){for(var i=0,n=0,a=e.length-1,o=e[0],s=e[a],l=t.length-1,u=t[0],c=t[l],f,h,p,d;i<=a&&n<=l;)o==null?o=e[++i]:s==null?s=e[--a]:u==null?u=t[++n]:c==null?c=t[--l]:dx(o,u)?(bv(o,u),o=e[++i],u=t[++n]):dx(s,c)?(bv(s,c),s=e[--a],c=t[--l]):dx(o,c)?(bv(o,c),Bf(r,o.elm,G2(s.elm)),o=e[++i],c=t[--l]):dx(s,u)?(bv(s,u),Bf(r,s.elm,o.elm),s=e[--a],u=t[++n]):(H2(f)&&(f=Hde(e,i,a)),h=f[u.key],H2(h)?Bf(r,mx(u),o.elm):(p=e[h],p.tag!==u.tag?Bf(r,mx(u),o.elm):(bv(p,u),e[h]=void 0,Bf(r,p.elm,o.elm))),u=t[++n]);(i<=a||n<=l)&&(i>a?(d=t[l+1]==null?null:t[l+1].elm,K8(r,d,t,n,l)):W1(r,e,i,a))}function bv(r,e){var t=e.elm=r.elm,i=r.children,n=e.children;r!==e&&(X1(r,e),H2(e.text)?Xl(i)&&Xl(n)?i!==n&&Wde(t,i,n):Xl(n)?(Xl(r.text)&&H1(t,""),K8(t,null,n,0,n.length-1)):Xl(i)?W1(t,i,0,i.length-1):Xl(r.text)&&H1(t,""):r.text!==e.text&&(Xl(i)&&W1(t,i,0,i.length-1),H1(t,e.text)))}function W2(r,e){if(dx(r,e))bv(r,e);else{var t=r.elm,i=V2(t);mx(e),i!==null&&(Bf(i,e.elm,G2(t)),W1(i,[r],0,0))}return e}var Xde=0,Yde=function(){function r(e,t,i){if(this.type="svg",this.refreshHover=J8("refreshHover"),this.configLayer=J8("configLayer"),this.storage=t,this._opts=i=fe({},i),this.root=e,this._id="zr"+Xde++,this._oldVNode=P2(i.width,i.height),e&&!i.ssr){var n=this._viewport=document.createElement("div");n.style.cssText="position:relative;overflow:hidden";var a=this._svgDom=this._oldVNode.elm=V1("svg");X1(null,this._oldVNode),n.appendChild(a),e.appendChild(n)}this.resize(i.width,i.height)}return r.prototype.getType=function(){return this.type},r.prototype.getViewportRoot=function(){return this._viewport},r.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},r.prototype.getSvgDom=function(){return this._svgDom},r.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style="position:absolute;left:0;top:0;user-select:none",W2(this._oldVNode,e),this._oldVNode=e}},r.prototype.renderOneToVNode=function(e){return U2(e,fx(this._id))},r.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),i=this._width,n=this._height,a=fx(this._id);a.animation=e.animation,a.willUpdate=e.willUpdate,a.compress=e.compress,a.emphasis=e.emphasis;var o=[],s=this._bgVNode=qde(i,n,this._backgroundColor,a);s&&o.push(s);var l=e.compress?null:this._mainVNode=Ci("g","main",{},[]);this._paintList(t,a,l?l.children:o),l&&o.push(l);var u=de(bt(a.defs),function(h){return a.defs[h]});if(u.length&&o.push(Ci("defs","defs",{},u)),e.animation){var c=O8(a.cssNodes,a.cssAnims,{newline:!0});if(c){var f=Ci("style","stl",{},[],c);o.push(f)}}return P2(i,n,o,e.useViewBox)},r.prototype.renderToString=function(e){return e=e||{},cx(this.renderToVNode({animation:ft(e.cssAnimation,!0),emphasis:ft(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:ft(e.useViewBox,!0)}),{newline:!0})},r.prototype.setBackgroundColor=function(e){this._backgroundColor=e},r.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},r.prototype._paintList=function(e,t,i){for(var n=e.length,a=[],o=0,s,l,u=0,c=0;c<n;c++){var f=e[c];if(!f.invisible){var h=f.__clipPaths,p=h&&h.length||0,d=l&&l.length||0,g=void 0;for(g=Math.max(p-1,d-1);g>=0&&!(h&&l&&h[g]===l[g]);g--);for(var m=d-1;m>g;m--)o--,s=a[o-1];for(var v=g+1;v<p;v++){var _={};Z8(h[v],_,t);var y=Ci("g","clip-g-"+u++,_,[]);(s?s.children:i).push(y),a[o++]=y,s=y}l=h;var x=U2(f,t);x&&(s?s.children:i).push(x)}}},r.prototype.resize=function(e,t){var i=this._opts,n=this.root,a=this._viewport;if(e!=null&&(i.width=e),t!=null&&(i.height=t),n&&a&&(a.style.display="none",e=Lf(n,0,i),t=Lf(n,1,i),a.style.display=""),this._width!==e||this._height!==t){if(this._width=e,this._height=t,a){var o=a.style;o.width=e+"px",o.height=t+"px"}if(Y0(this._backgroundColor))this.refresh();else{var s=this._svgDom;s&&(s.setAttribute("width",e),s.setAttribute("height",t));var l=this._bgVNode&&this._bgVNode.elm;l&&(l.setAttribute("width",e),l.setAttribute("height",t))}}},r.prototype.getWidth=function(){return this._width},r.prototype.getHeight=function(){return this._height},r.prototype.dispose=function(){this.root&&(this.root.innerHTML=""),this._svgDom=this._viewport=this.storage=this._oldVNode=this._bgVNode=this._mainVNode=null},r.prototype.clear=function(){this._svgDom&&(this._svgDom.innerHTML=null),this._oldVNode=null},r.prototype.toDataURL=function(e){var t=this.renderToString(),i="data:image/svg+xml;";return e?(t=TG(t),t&&i+"base64,"+t):i+"charset=UTF-8,"+encodeURIComponent(t)},r}();function J8(r){return function(){}}function qde(r,e,t,i){var n;if(t&&t!=="none")if(n=Ci("rect","bg",{width:r,height:e,x:"0",y:"0"}),Cb(t))O2({fill:t},n.attrs,"fill",i);else if(Y0(t))F2({style:{fill:t},dirty:Ir,getBoundingRect:function(){return{width:r,height:e}}},n.attrs,"fill",i);else{var a=mf(t),o=a.color,s=a.opacity;n.attrs.fill=o,s<1&&(n.attrs["fill-opacity"]=s)}return n}var $8=Yde;function X2(r){r.registerPainter("svg",$8)}function Q8(r,e,t){var i=zn.createCanvas(),n=e.getWidth(),a=e.getHeight(),o=i.style;return o&&(o.position="absolute",o.left="0",o.top="0",o.width=n+"px",o.height=a+"px",i.setAttribute("data-zr-dom-id",r)),i.width=n*t,i.height=a*t,i}var Zde=function(r){Xt(e,r);function e(t,i,n){var a=r.call(this)||this;a.motionBlur=!1,a.lastFrameAlpha=.7,a.dpr=1,a.virtual=!1,a.config={},a.incremental=!1,a.zlevel=0,a.maxRepaintRectCount=5,a.__dirty=!0,a.__firstTimePaint=!0,a.__used=!1,a.__drawIndex=0,a.__startIndex=0,a.__endIndex=0,a.__prevStartIndex=null,a.__prevEndIndex=null;var o;n=n||pp,typeof t=="string"?o=Q8(t,i,n):qe(t)&&(o=t,t=o.id),a.id=t,a.dom=o;var s=o.style;return s&&(ib(o),o.onselectstart=function(){return!1},s.padding="0",s.margin="0",s.borderWidth="0"),a.painter=i,a.dpr=n,a}return e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var t=this.dpr;this.domBack=Q8("back-"+this.id,this.painter,t),this.ctxBack=this.domBack.getContext("2d"),t!==1&&this.ctxBack.scale(t,t)},e.prototype.createRepaintRects=function(t,i,n,a){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var o=[],s=this.maxRepaintRectCount,l=!1,u=new lt(0,0,0,0);function c(_){if(!(!_.isFinite()||_.isZero()))if(o.length===0){var y=new lt(0,0,0,0);y.copy(_),o.push(y)}else{for(var x=!1,M=1/0,S=0,w=0;w<o.length;++w){var T=o[w];if(T.intersect(_)){var C=new lt(0,0,0,0);C.copy(T),C.union(_),o[w]=C,x=!0;break}else if(l){u.copy(_),u.union(T);var b=_.width*_.height,E=T.width*T.height,I=u.width*u.height,R=I-b-E;R<M&&(M=R,S=w)}}if(l&&(o[S].union(_),x=!0),!x){var y=new lt(0,0,0,0);y.copy(_),o.push(y)}l||(l=o.length>=s)}}for(var f=this.__startIndex;f<this.__endIndex;++f){var h=t[f];if(h){var p=h.shouldBePainted(n,a,!0,!0),d=h.__isRendered&&(h.__dirty&zi||!p)?h.getPrevPaintRect():null;d&&c(d);var g=p&&(h.__dirty&zi||!h.__isRendered)?h.getPaintRect():null;g&&c(g)}}for(var f=this.__prevStartIndex;f<this.__prevEndIndex;++f){var h=i[f],p=h&&h.shouldBePainted(n,a,!0,!0);if(h&&(!p||!h.__zr)&&h.__isRendered){var d=h.getPrevPaintRect();d&&c(d)}}var m;do{m=!1;for(var f=0;f<o.length;){if(o[f].isZero()){o.splice(f,1);continue}for(var v=f+1;v<o.length;)o[f].intersect(o[v])?(m=!0,o[f].union(o[v]),o.splice(v,1)):v++;f++}}while(m);return this._paintRects=o,o},e.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},e.prototype.resize=function(t,i){var n=this.dpr,a=this.dom,o=a.style,s=this.domBack;o&&(o.width=t+"px",o.height=i+"px"),a.width=t*n,a.height=i*n,s&&(s.width=t*n,s.height=i*n,n!==1&&this.ctxBack.scale(n,n))},e.prototype.clear=function(t,i,n){var a=this.dom,o=this.ctx,s=a.width,l=a.height;i=i||this.clearColor;var u=this.motionBlur&&!t,c=this.lastFrameAlpha,f=this.dpr,h=this;u&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(a,0,0,s/f,l/f));var p=this.domBack;function d(g,m,v,_){if(o.clearRect(g,m,v,_),i&&i!=="transparent"){var y=void 0;if(of(i)){var x=i.global||i.__width===v&&i.__height===_;y=x&&i.__canvasGradient||X_(o,i,{x:0,y:0,width:v,height:_}),i.__canvasGradient=y,i.__width=v,i.__height=_}else OV(i)&&(i.scaleX=i.scaleX||f,i.scaleY=i.scaleY||f,y=o1(o,i,{dirty:function(){h.setUnpainted(),h.painter.refresh()}}));o.save(),o.fillStyle=y||i,o.fillRect(g,m,v,_),o.restore()}u&&(o.save(),o.globalAlpha=c,o.drawImage(p,g,m,v,_),o.restore())}!n||u?d(0,0,s,l):n.length&&N(n,function(g){d(g.x*f,g.y*f,g.width*f,g.height*f)})},e}(Di),Y1=Zde;var eX=1e5,Jp=314159,q1=.01,jde=.001;function Kde(r){return r?r.__builtin__?!0:!(typeof r.resize!="function"||typeof r.refresh!="function"):!1}function Jde(r,e){var t=document.createElement("div");return t.style.cssText=["position:relative","width:"+r+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",t}var $de=function(){function r(e,t,i,n){this.type="canvas",this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type="canvas";var a=!e.nodeName||e.nodeName.toUpperCase()==="CANVAS";this._opts=i=fe({},i||{}),this.dpr=i.devicePixelRatio||pp,this._singleCanvas=a,this.root=e;var o=e.style;o&&(ib(e),e.innerHTML=""),this.storage=t;var s=this._zlevelList;this._prevDisplayList=[];var l=this._layers;if(a){var c=e,f=c.width,h=c.height;i.width!=null&&(f=i.width),i.height!=null&&(h=i.height),this.dpr=i.devicePixelRatio||1,c.width=f*this.dpr,c.height=h*this.dpr,this._width=f,this._height=h;var p=new Y1(c,this,this.dpr);p.__builtin__=!0,p.initContext(),l[Jp]=p,p.zlevel=Jp,s.push(Jp),this._domRoot=e}else{this._width=Lf(e,0,i),this._height=Lf(e,1,i);var u=this._domRoot=Jde(this._width,this._height);e.appendChild(u)}}return r.prototype.getType=function(){return"canvas"},r.prototype.isSingleCanvas=function(){return this._singleCanvas},r.prototype.getViewportRoot=function(){return this._domRoot},r.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},r.prototype.refresh=function(e){var t=this.storage.getDisplayList(!0),i=this._prevDisplayList,n=this._zlevelList;this._redrawId=Math.random(),this._paintList(t,i,e,this._redrawId);for(var a=0;a<n.length;a++){var o=n[a],s=this._layers[o];if(!s.__builtin__&&s.refresh){var l=a===0?this._backgroundColor:null;s.refresh(l)}}return this._opts.useDirtyRect&&(this._prevDisplayList=t.slice()),this},r.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},r.prototype._paintHoverList=function(e){var t=e.length,i=this._hoverlayer;if(i&&i.clear(),!!t){for(var n={inHover:!0,viewWidth:this._width,viewHeight:this._height},a,o=0;o<t;o++){var s=e[o];s.__inHover&&(i||(i=this._hoverlayer=this.getLayer(eX)),a||(a=i.ctx,a.save()),Pf(a,s,n,o===t-1))}a&&a.restore()}},r.prototype.getHoverLayer=function(){return this.getLayer(eX)},r.prototype.paintOne=function(e,t){s1(e,t)},r.prototype._paintList=function(e,t,i,n){if(this._redrawId===n){i=i||!1,this._updateLayerStatus(e);var a=this._doPaintList(e,t,i),o=a.finished,s=a.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),s&&this._paintHoverList(e),o)this.eachLayer(function(u){u.afterBrush&&u.afterBrush()});else{var l=this;V0(function(){l._paintList(e,t,i,n)})}}},r.prototype._compositeManually=function(){var e=this.getLayer(Jp).ctx,t=this._domRoot.width,i=this._domRoot.height;e.clearRect(0,0,t,i),this.eachBuiltinLayer(function(n){n.virtual&&e.drawImage(n.dom,0,0,t,i)})},r.prototype._doPaintList=function(e,t,i){for(var n=this,a=[],o=this._opts.useDirtyRect,s=0;s<this._zlevelList.length;s++){var l=this._zlevelList[s],u=this._layers[l];u.__builtin__&&u!==this._hoverlayer&&(u.__dirty||i)&&a.push(u)}for(var c=!0,f=!1,h=function(g){var m=a[g],v=m.ctx,_=o&&m.createRepaintRects(e,t,p._width,p._height),y=i?m.__startIndex:m.__drawIndex,x=!i&&m.incremental&&Date.now,M=x&&Date.now(),S=m.zlevel===p._zlevelList[0]?p._backgroundColor:null;if(m.__startIndex===m.__endIndex)m.clear(!1,S,_);else if(y===m.__startIndex){var w=e[y];(!w.incremental||!w.notClear||i)&&m.clear(!1,S,_)}y===-1&&(console.error("For some unknown reason. drawIndex is -1"),y=m.__startIndex);var T,C=function(R){var A={inHover:!1,allClipped:!1,prevEl:null,viewWidth:n._width,viewHeight:n._height};for(T=y;T<m.__endIndex;T++){var D=e[T];if(D.__inHover&&(f=!0),n._doPaintEl(D,m,o,R,A,T===m.__endIndex-1),x){var U=Date.now()-M;if(U>15)break}}A.prevElClipPaths&&v.restore()};if(_)if(_.length===0)T=m.__endIndex;else for(var b=p.dpr,E=0;E<_.length;++E){var I=_[E];v.save(),v.beginPath(),v.rect(I.x*b,I.y*b,I.width*b,I.height*b),v.clip(),C(I),v.restore()}else v.save(),C(),v.restore();m.__drawIndex=T,m.__drawIndex<m.__endIndex&&(c=!1)},p=this,d=0;d<a.length;d++)h(d);return Ft.wxa&&N(this._layers,function(g){g&&g.ctx&&g.ctx.draw&&g.ctx.draw()}),{finished:c,needsRefreshHover:f}},r.prototype._doPaintEl=function(e,t,i,n,a,o){var s=t.ctx;if(i){var l=e.getPaintRect();(!n||l&&l.intersect(n))&&(Pf(s,e,a,o),e.setPrevPaintRect(l))}else Pf(s,e,a,o)},r.prototype.getLayer=function(e,t){this._singleCanvas&&!this._needsManuallyCompositing&&(e=Jp);var i=this._layers[e];return i||(i=new Y1("zr_"+e,this,this.dpr),i.zlevel=e,i.__builtin__=!0,this._layerConfig[e]?_t(i,this._layerConfig[e],!0):this._layerConfig[e-q1]&&_t(i,this._layerConfig[e-q1],!0),t&&(i.virtual=t),this.insertLayer(e,i),i.initContext()),i},r.prototype.insertLayer=function(e,t){var i=this._layers,n=this._zlevelList,a=n.length,o=this._domRoot,s=null,l=-1;if(!i[e]&&Kde(t)){if(a>0&&e>n[0]){for(l=0;l<a-1&&!(n[l]<e&&n[l+1]>e);l++);s=i[n[l]]}if(n.splice(l+1,0,e),i[e]=t,!t.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(t.dom,u.nextSibling):o.appendChild(t.dom)}else o.firstChild?o.insertBefore(t.dom,o.firstChild):o.appendChild(t.dom);t.painter||(t.painter=this)}},r.prototype.eachLayer=function(e,t){for(var i=this._zlevelList,n=0;n<i.length;n++){var a=i[n];e.call(t,this._layers[a],a)}},r.prototype.eachBuiltinLayer=function(e,t){for(var i=this._zlevelList,n=0;n<i.length;n++){var a=i[n],o=this._layers[a];o.__builtin__&&e.call(t,o,a)}},r.prototype.eachOtherLayer=function(e,t){for(var i=this._zlevelList,n=0;n<i.length;n++){var a=i[n],o=this._layers[a];o.__builtin__||e.call(t,o,a)}},r.prototype.getLayers=function(){return this._layers},r.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(f,h){f.__dirty=f.__used=!1});function t(f){a&&(a.__endIndex!==f&&(a.__dirty=!0),a.__endIndex=f)}if(this._singleCanvas)for(var i=1;i<e.length;i++){var n=e[i];if(n.zlevel!==e[i-1].zlevel||n.incremental){this._needsManuallyCompositing=!0;break}}var a=null,o=0,s,l;for(l=0;l<e.length;l++){var n=e[l],u=n.zlevel,c=void 0;s!==u&&(s=u,o=0),n.incremental?(c=this.getLayer(u+jde,this._needsManuallyCompositing),c.incremental=!0,o=1):c=this.getLayer(u+(o>0?q1:0),this._needsManuallyCompositing),c.__builtin__||$h("ZLevel "+u+" has been used by unkown layer "+c.id),c!==a&&(c.__used=!0,c.__startIndex!==l&&(c.__dirty=!0),c.__startIndex=l,c.incremental?c.__drawIndex=-1:c.__drawIndex=l,t(l),a=c),n.__dirty&zi&&!n.__inHover&&(c.__dirty=!0,c.incremental&&c.__drawIndex<0&&(c.__drawIndex=l))}t(l),this.eachBuiltinLayer(function(f,h){!f.__used&&f.getElementCount()>0&&(f.__dirty=!0,f.__startIndex=f.__endIndex=f.__drawIndex=0),f.__dirty&&f.__drawIndex<0&&(f.__drawIndex=f.__startIndex)})},r.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},r.prototype._clearLayer=function(e){e.clear()},r.prototype.setBackgroundColor=function(e){this._backgroundColor=e,N(this._layers,function(t){t.setUnpainted()})},r.prototype.configLayer=function(e,t){if(t){var i=this._layerConfig;i[e]?_t(i[e],t,!0):i[e]=t;for(var n=0;n<this._zlevelList.length;n++){var a=this._zlevelList[n];if(a===e||a===e+q1){var o=this._layers[a];_t(o,i[e],!0)}}}},r.prototype.delLayer=function(e){var t=this._layers,i=this._zlevelList,n=t[e];n&&(n.dom.parentNode.removeChild(n.dom),delete t[e],i.splice(dt(i,e),1))},r.prototype.resize=function(e,t){if(this._domRoot.style){var i=this._domRoot;i.style.display="none";var n=this._opts,a=this.root;if(e!=null&&(n.width=e),t!=null&&(n.height=t),e=Lf(a,0,n),t=Lf(a,1,n),i.style.display="",this._width!==e||t!==this._height){i.style.width=e+"px",i.style.height=t+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(e,t);this.refresh(!0)}this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this.getLayer(Jp).resize(e,t)}return this},r.prototype.clearLayer=function(e){var t=this._layers[e];t&&t.clear()},r.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},r.prototype.getRenderedCanvas=function(e){if(e=e||{},this._singleCanvas&&!this._compositeManually)return this._layers[Jp].dom;var t=new Y1("image",this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var i=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var n=t.dom.width,a=t.dom.height;this.eachLayer(function(f){f.__builtin__?i.drawImage(f.dom,0,0,n,a):f.renderToCanvas&&(i.save(),f.renderToCanvas(i),i.restore())})}else for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height},s=this.storage.getDisplayList(!0),l=0,u=s.length;l<u;l++){var c=s[l];Pf(i,c,o,l===u-1)}return t.dom},r.prototype.getWidth=function(){return this._width},r.prototype.getHeight=function(){return this._height},r}(),tX=$de;function Y2(r){r.registerPainter("canvas",tX)}var Qde=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.getInitialData=function(t){if(0)var i;return hn(null,this,{useEncodeDefaulter:!0})},e.prototype.getLegendIcon=function(t){var i=new Ze,n=Sr("line",0,t.itemHeight/2,t.itemWidth,0,t.lineStyle.stroke,!1);i.add(n),n.setStyle(t.lineStyle);var a=this.getData().getVisual("symbol"),o=this.getData().getVisual("symbolRotate"),s=a==="none"?"circle":a,l=t.itemHeight*.8,u=Sr(s,(t.itemWidth-l)/2,(t.itemHeight-l)/2,l,l,t.itemStyle.fill);i.add(u),u.setStyle(t.itemStyle);var c=t.iconRotate==="inherit"?o:t.iconRotate||0;return u.rotation=c*Math.PI/180,u.setOrigin([t.itemWidth/2,t.itemHeight/2]),s.indexOf("empty")>-1&&(u.style.stroke=u.style.fill,u.style.fill="#fff",u.style.lineWidth=2),i},e.type="series.line",e.dependencies=["grid","polar"],e.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},e}(jt),rX=Qde;function Qs(r,e){var t=r.mapDimensionsAll("defaultedLabel"),i=t.length;if(i===1){var n=Fu(r,e,t[0]);return n!=null?n+"":null}else if(i){for(var a=[],o=0;o<t.length;o++)a.push(Fu(r,e,t[o]));return a.join(" ")}}function Z1(r,e){var t=r.mapDimensionsAll("defaultedLabel");if(!pe(e))return e+"";for(var i=[],n=0;n<t.length;n++){var a=r.getDimensionIndex(t[n]);a>=0&&i.push(e[a])}return i.join(" ")}var eme=function(r){Z(e,r);function e(t,i,n,a){var o=r.call(this)||this;return o.updateData(t,i,n,a),o}return e.prototype._createSymbol=function(t,i,n,a,o){this.removeAll();var s=Sr(t,-1,-1,2,2,null,o);s.attr({z2:100,culling:!0,scaleX:a[0]/2,scaleY:a[1]/2}),s.drift=tme,this._symbolType=t,this.add(s)},e.prototype.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(null,t)},e.prototype.getSymbolType=function(){return this._symbolType},e.prototype.getSymbolPath=function(){return this.childAt(0)},e.prototype.highlight=function(){Bn(this.childAt(0))},e.prototype.downplay=function(){kn(this.childAt(0))},e.prototype.setZ=function(t,i){var n=this.childAt(0);n.zlevel=t,n.z=i},e.prototype.setDraggable=function(t,i){var n=this.childAt(0);n.draggable=t,n.cursor=!i&&t?"move":n.cursor},e.prototype.updateData=function(t,i,n,a){this.silent=!1;var o=t.getItemVisual(i,"symbol")||"circle",s=t.hostModel,l=e.getSymbolSize(t,i),u=o!==this._symbolType,c=a&&a.disableAnimation;if(u){var f=t.getItemVisual(i,"symbolKeepAspect");this._createSymbol(o,t,i,l,f)}else{var h=this.childAt(0);h.silent=!1;var p={scaleX:l[0]/2,scaleY:l[1]/2};c?h.attr(p):Dt(h,p,s,i),Ii(h)}if(this._updateCommon(t,i,l,n,a),u){var h=this.childAt(0);if(!c){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:h.style.opacity}};h.scaleX=h.scaleY=0,h.style.opacity=0,ar(h,p,s,i)}}c&&this.childAt(0).stopAnimation("leave")},e.prototype._updateCommon=function(t,i,n,a,o){var s=this.childAt(0),l=t.hostModel,u,c,f,h,p,d,g,m,v;if(a&&(u=a.emphasisItemStyle,c=a.blurItemStyle,f=a.selectItemStyle,h=a.focus,p=a.blurScope,g=a.labelStatesModels,m=a.hoverScale,v=a.cursorStyle,d=a.emphasisDisabled),!a||t.hasItemOption){var _=a&&a.itemModel?a.itemModel:t.getItemModel(i),y=_.getModel("emphasis");u=y.getModel("itemStyle").getItemStyle(),f=_.getModel(["select","itemStyle"]).getItemStyle(),c=_.getModel(["blur","itemStyle"]).getItemStyle(),h=y.get("focus"),p=y.get("blurScope"),d=y.get("disabled"),g=Tr(_),m=y.getShallow("scale"),v=_.getShallow("cursor")}var x=t.getItemVisual(i,"symbolRotate");s.attr("rotation",(x||0)*Math.PI/180||0);var M=bo(t.getItemVisual(i,"symbolOffset"),n);M&&(s.x=M[0],s.y=M[1]),v&&s.attr("cursor",v);var S=t.getItemVisual(i,"style"),w=S.fill;if(s instanceof Ur){var T=s.style;s.useStyle(fe({image:T.image,x:T.x,y:T.y,width:T.width,height:T.height},S))}else s.__isEmptyBrush?s.useStyle(fe({},S)):s.useStyle(S),s.style.decal=null,s.setColor(w,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var C=t.getItemVisual(i,"liftZ"),b=this._z2;C!=null?b==null&&(this._z2=s.z2,s.z2+=C):b!=null&&(s.z2=b,this._z2=null);var E=o&&o.useNameLabel;Nr(s,g,{labelFetcher:l,labelDataIndex:i,defaultText:I,inheritColor:w,defaultOpacity:S.opacity});function I(D){return E?t.getName(D):Qs(t,D)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var R=s.ensureState("emphasis");R.style=u,s.ensureState("select").style=f,s.ensureState("blur").style=c;var A=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;R.scaleX=this._sizeX*A,R.scaleY=this._sizeY*A,this.setSymbolScale(1),nr(this,h,p,d)},e.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},e.prototype.fadeOut=function(t,i,n){var a=this.childAt(0),o=rt(this).dataIndex,s=n&&n.animation;if(this.silent=a.silent=!0,n&&n.fadeLabel){var l=a.getTextContent();l&&es(l,{style:{opacity:0}},i,{dataIndex:o,removeOpt:s,cb:function(){a.removeTextContent()}})}else a.removeTextContent();es(a,{style:{opacity:0},scaleX:0,scaleY:0},i,{dataIndex:o,cb:t,removeOpt:s})},e.getSymbolSize=function(t,i){return qs(t.getItemVisual(i,"symbolSize"))},e}(Ze);function tme(r,e){this.parent.drift(r,e)}var ku=eme;function q2(r,e,t,i){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(i.isIgnore&&i.isIgnore(t))&&!(i.clipShape&&!i.clipShape.contain(e[0],e[1]))&&r.getItemVisual(t,"symbol")!=="none"}function iX(r){return r!=null&&!qe(r)&&(r={isIgnore:r}),r||{}}function nX(r){var e=r.hostModel,t=e.getModel("emphasis");return{emphasisItemStyle:t.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:t.get("focus"),blurScope:t.get("blurScope"),emphasisDisabled:t.get("disabled"),hoverScale:t.get("scale"),labelStatesModels:Tr(e),cursorStyle:e.get("cursor")}}var rme=function(){function r(e){this.group=new Ze,this._SymbolCtor=e||ku}return r.prototype.updateData=function(e,t){this._progressiveEls=null,t=iX(t);var i=this.group,n=e.hostModel,a=this._data,o=this._SymbolCtor,s=t.disableAnimation,l=nX(e),u={disableAnimation:s},c=t.getSymbolPoint||function(f){return e.getItemLayout(f)};a||i.removeAll(),e.diff(a).add(function(f){var h=c(f);if(q2(e,h,f,t)){var p=new o(e,f,l,u);p.setPosition(h),e.setItemGraphicEl(f,p),i.add(p)}}).update(function(f,h){var p=a.getItemGraphicEl(h),d=c(f);if(!q2(e,d,f,t)){i.remove(p);return}var g=e.getItemVisual(f,"symbol")||"circle",m=p&&p.getSymbolType&&p.getSymbolType();if(!p||m&&m!==g)i.remove(p),p=new o(e,f,l,u),p.setPosition(d);else{p.updateData(e,f,l,u);var v={x:d[0],y:d[1]};s?p.attr(v):Dt(p,v,n)}i.add(p),e.setItemGraphicEl(f,p)}).remove(function(f){var h=a.getItemGraphicEl(f);h&&h.fadeOut(function(){i.remove(h)},n)}).execute(),this._getSymbolPoint=c,this._data=e},r.prototype.updateLayout=function(){var e=this,t=this._data;t&&t.eachItemGraphicEl(function(i,n){var a=e._getSymbolPoint(n);i.setPosition(a),i.markRedraw()})},r.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=nX(e),this._data=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t,i){this._progressiveEls=[],i=iX(i);function n(l){l.isGroup||(l.incremental=!0,l.ensureState("emphasis").hoverLayer=!0)}for(var a=e.start;a<e.end;a++){var o=t.getItemLayout(a);if(q2(t,o,a,i)){var s=new this._SymbolCtor(t,a,this._seriesScope);s.traverse(n),s.setPosition(o),this.group.add(s),t.setItemGraphicEl(a,s),this._progressiveEls.push(s)}}},r.prototype.eachRendered=function(e){sa(this._progressiveEls||this.group,e)},r.prototype.remove=function(e){var t=this.group,i=this._data;i&&e?i.eachItemGraphicEl(function(n){n.fadeOut(function(){t.remove(n)},i.hostModel)}):t.removeAll()},r}(),Yl=rme;function j1(r,e,t){var i=r.getBaseAxis(),n=r.getOtherAxis(i),a=ime(n,t),o=i.dim,s=n.dim,l=e.mapDimension(s),u=e.mapDimension(o),c=s==="x"||s==="radius"?1:0,f=de(r.dimensions,function(d){return e.mapDimension(d)}),h=!1,p=e.getCalculationInfo("stackResultDimension");return wo(e,f[0])&&(h=!0,f[0]=p),wo(e,f[1])&&(h=!0,f[1]=p),{dataDimsForPoint:f,valueStart:a,valueAxisDim:s,baseAxisDim:o,stacked:!!h,valueDim:l,baseDim:u,baseDataOffset:c,stackedOverDimension:e.getCalculationInfo("stackedOverDimension")}}function ime(r,e){var t=0,i=r.scale.getExtent();return e==="start"?t=i[0]:e==="end"?t=i[1]:At(e)&&!isNaN(e)?t=e:i[0]>0?t=i[0]:i[1]<0&&(t=i[1]),t}function K1(r,e,t,i){var n=NaN;r.stacked&&(n=t.get(t.getCalculationInfo("stackedOverDimension"),i)),isNaN(n)&&(n=r.valueStart);var a=r.baseDataOffset,o=[];return o[a]=t.get(r.baseDim,i),o[1-a]=n,e.dataToPoint(o)}function nme(r,e){var t=[];return e.diff(r).add(function(i){t.push({cmd:"+",idx:i})}).update(function(i,n){t.push({cmd:"=",idx:n,idx1:i})}).remove(function(i){t.push({cmd:"-",idx:i})}).execute(),t}function Z2(r,e,t,i,n,a,o,s){for(var l=nme(r,e),u=[],c=[],f=[],h=[],p=[],d=[],g=[],m=j1(n,e,o),v=r.getLayout("points")||[],_=e.getLayout("points")||[],y=0;y<l.length;y++){var x=l[y],M=!0,S=void 0,w=void 0;switch(x.cmd){case"=":S=x.idx*2,w=x.idx1*2;var T=v[S],C=v[S+1],b=_[w],E=_[w+1];(isNaN(T)||isNaN(C))&&(T=b,C=E),u.push(T,C),c.push(b,E),f.push(t[S],t[S+1]),h.push(i[w],i[w+1]),g.push(e.getRawIndex(x.idx1));break;case"+":var I=x.idx,R=m.dataDimsForPoint,A=n.dataToPoint([e.get(R[0],I),e.get(R[1],I)]);w=I*2,u.push(A[0],A[1]),c.push(_[w],_[w+1]);var D=K1(m,n,e,I);f.push(D[0],D[1]),h.push(i[w],i[w+1]),g.push(e.getRawIndex(I));break;case"-":M=!1}M&&(p.push(x),d.push(d.length))}d.sort(function(K,ae){return g[K]-g[ae]});for(var U=u.length,B=ca(U),F=ca(U),k=ca(U),G=ca(U),Y=[],y=0;y<d.length;y++){var J=d[y],Q=y*2,V=J*2;B[Q]=u[V],B[Q+1]=u[V+1],F[Q]=c[V],F[Q+1]=c[V+1],k[Q]=f[V],k[Q+1]=f[V+1],G[Q]=h[V],G[Q+1]=h[V+1],Y[y]=p[J]}return{current:B,next:F,stackedOnCurrent:k,stackedOnNext:G,status:Y}}var kf=Math.min,Vf=Math.max;function $p(r,e){return isNaN(r)||isNaN(e)}function j2(r,e,t,i,n,a,o,s,l){for(var u,c,f,h,p,d,g=t,m=0;m<i;m++){var v=e[g*2],_=e[g*2+1];if(g>=n||g<0)break;if($p(v,_)){if(l){g+=a;continue}break}if(g===t)r[a>0?"moveTo":"lineTo"](v,_),f=v,h=_;else{var y=v-u,x=_-c;if(y*y+x*x<.5){g+=a;continue}if(o>0){for(var M=g+a,S=e[M*2],w=e[M*2+1];S===v&&w===_&&m<i;)m++,M+=a,g+=a,S=e[M*2],w=e[M*2+1],v=e[g*2],_=e[g*2+1],y=v-u,x=_-c;var T=m+1;if(l)for(;$p(S,w)&&T<i;)T++,M+=a,S=e[M*2],w=e[M*2+1];var C=.5,b=0,E=0,I=void 0,R=void 0;if(T>=i||$p(S,w))p=v,d=_;else{b=S-u,E=w-c;var A=v-u,D=S-v,U=_-c,B=w-_,F=void 0,k=void 0;if(s==="x"){F=Math.abs(A),k=Math.abs(D);var G=b>0?1:-1;p=v-G*F*o,d=_,I=v+G*k*o,R=_}else if(s==="y"){F=Math.abs(U),k=Math.abs(B);var Y=E>0?1:-1;p=v,d=_-Y*F*o,I=v,R=_+Y*k*o}else F=Math.sqrt(A*A+U*U),k=Math.sqrt(D*D+B*B),C=k/(k+F),p=v-b*o*(1-C),d=_-E*o*(1-C),I=v+b*o*C,R=_+E*o*C,I=kf(I,Vf(S,v)),R=kf(R,Vf(w,_)),I=Vf(I,kf(S,v)),R=Vf(R,kf(w,_)),b=I-v,E=R-_,p=v-b*F/k,d=_-E*F/k,p=kf(p,Vf(u,v)),d=kf(d,Vf(c,_)),p=Vf(p,kf(u,v)),d=Vf(d,kf(c,_)),b=v-p,E=_-d,I=v+b*k/F,R=_+E*k/F}r.bezierCurveTo(f,h,p,d,v,_),f=I,h=R}else r.lineTo(v,_)}u=v,c=_,g+=a}return m}var aX=function(){function r(){this.smooth=0,this.smoothConstraint=!0}return r}(),oX=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="ec-polyline",i}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new aX},e.prototype.buildPath=function(t,i){var n=i.points,a=0,o=n.length/2;if(i.connectNulls){for(;o>0&&$p(n[o*2-2],n[o*2-1]);o--);for(;a<o&&$p(n[a*2],n[a*2+1]);a++);}for(;a<o;)a+=j2(t,n,a,o,o,1,i.smooth,i.smoothMonotone,i.connectNulls)+1},e.prototype.getPointOn=function(t,i){this.path||(this.createPathProxy(),this.buildPath(this.path,this.shape));for(var n=this.path,a=n.data,o=Ki.CMD,s,l,u=i==="x",c=[],f=0;f<a.length;){var h=a[f++],p=void 0,d=void 0,g=void 0,m=void 0,v=void 0,_=void 0,y=void 0;switch(h){case o.M:s=a[f++],l=a[f++];break;case o.L:if(p=a[f++],d=a[f++],y=u?(t-s)/(p-s):(t-l)/(d-l),y<=1&&y>=0){var x=u?(d-l)*y+l:(p-s)*y+s;return u?[t,x]:[x,t]}s=p,l=d;break;case o.C:p=a[f++],d=a[f++],g=a[f++],m=a[f++],v=a[f++],_=a[f++];var M=u?sp(s,p,g,v,t,c):sp(l,d,m,_,t,c);if(M>0)for(var S=0;S<M;S++){var w=c[S];if(w<=1&&w>=0){var x=u?hi(l,d,m,_,w):hi(s,p,g,v,w);return u?[t,x]:[x,t]}}s=v,l=_;break}}},e}(ut);var ame=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(aX),J1=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="ec-polygon",i}return e.prototype.getDefaultShape=function(){return new ame},e.prototype.buildPath=function(t,i){var n=i.points,a=i.stackedOnPoints,o=0,s=n.length/2,l=i.smoothMonotone;if(i.connectNulls){for(;s>0&&$p(n[s*2-2],n[s*2-1]);s--);for(;o<s&&$p(n[o*2],n[o*2+1]);o++);}for(;o<s;){var u=j2(t,n,o,s,s,1,i.smooth,l,i.connectNulls);j2(t,a,o+u-1,u,s,-1,i.stackedOnSmooth,l,i.connectNulls),o+=u+1,t.closePath()}},e}(ut);function K2(r,e,t,i,n){var a=r.getArea(),o=a.x,s=a.y,l=a.width,u=a.height,c=t.get(["lineStyle","width"])||2;o-=c/2,s-=c/2,l+=c,u+=c,l=Math.ceil(l),o!==Math.floor(o)&&(o=Math.floor(o),l++);var f=new Tt({shape:{x:o,y:s,width:l,height:u}});if(e){var h=r.getBaseAxis(),p=h.isHorizontal(),d=h.inverse;p?(d&&(f.shape.x+=l),f.shape.width=0):(d||(f.shape.y+=u),f.shape.height=0);var g=He(n)?function(m){n(m,f)}:null;ar(f,{shape:{width:l,height:u,x:o,y:s}},t,null,i,g)}return f}function J2(r,e,t){var i=r.getArea(),n=Ar(i.r0,1),a=Ar(i.r,1),o=new yi({shape:{cx:Ar(r.cx,1),cy:Ar(r.cy,1),r0:n,r:a,startAngle:i.startAngle,endAngle:i.endAngle,clockwise:i.clockwise}});if(e){var s=r.getBaseAxis().dim==="angle";s?o.shape.endAngle=i.startAngle:o.shape.r=n,ar(o,{shape:{endAngle:i.endAngle,r:a}},t)}return o}function ql(r,e,t,i,n){if(r){if(r.type==="polar")return J2(r,e,t);if(r.type==="cartesian2d")return K2(r,e,t,i,n)}else return null;return null}function ls(r,e){return r.type===e}function sX(r,e){if(r.length===e.length){for(var t=0;t<r.length;t++)if(r[t]!==e[t])return;return!0}}function lX(r){for(var e=1/0,t=1/0,i=-1/0,n=-1/0,a=0;a<r.length;){var o=r[a++],s=r[a++];isNaN(o)||(e=Math.min(o,e),i=Math.max(o,i)),isNaN(s)||(t=Math.min(s,t),n=Math.max(s,n))}return[[e,t],[i,n]]}function uX(r,e){var t=lX(r),i=t[0],n=t[1],a=lX(e),o=a[0],s=a[1];return Math.max(Math.abs(i[0]-o[0]),Math.abs(i[1]-o[1]),Math.abs(n[0]-s[0]),Math.abs(n[1]-s[1]))}function cX(r){return At(r)?r:r?.5:0}function ome(r,e,t){if(!t.valueDim)return[];for(var i=e.count(),n=ca(i*2),a=0;a<i;a++){var o=K1(t,r,e,a);n[a*2]=o[0],n[a*2+1]=o[1]}return n}function Gf(r,e,t,i){var n=e.getBaseAxis(),a=n.dim==="x"||n.dim==="radius"?0:1,o=[],s=0,l=[],u=[],c=[],f=[];if(i){for(s=0;s<r.length;s+=2)!isNaN(r[s])&&!isNaN(r[s+1])&&f.push(r[s],r[s+1]);r=f}for(s=0;s<r.length-2;s+=2)switch(c[0]=r[s+2],c[1]=r[s+3],u[0]=r[s],u[1]=r[s+1],o.push(u[0],u[1]),t){case"end":l[a]=c[a],l[1-a]=u[1-a],o.push(l[0],l[1]);break;case"middle":var h=(u[a]+c[a])/2,p=[];l[a]=p[a]=h,l[1-a]=u[1-a],p[1-a]=c[1-a],o.push(l[0],l[1]),o.push(p[0],p[1]);break;default:l[a]=u[a],l[1-a]=c[1-a],o.push(l[0],l[1])}return o.push(r[s++],r[s++]),o}function sme(r,e){var t=[],i=r.length,n,a;function o(c,f,h){var p=c.coord,d=(h-p)/(f.coord-p),g=yG(d,[c.color,f.color]);return{coord:h,color:g}}for(var s=0;s<i;s++){var l=r[s],u=l.coord;if(u<0)n=l;else if(u>e){a?t.push(o(a,l,e)):n&&t.push(o(n,l,0),o(n,l,e));break}else n&&(t.push(o(n,l,0)),n=null),t.push(l),a=l}return t}function lme(r,e,t){var i=r.getVisual("visualMeta");if(!(!i||!i.length||!r.count())&&e.type==="cartesian2d"){for(var n,a,o=i.length-1;o>=0;o--){var s=r.getDimensionInfo(i[o].dimension);if(n=s&&s.coordDim,n==="x"||n==="y"){a=i[o];break}}if(a){var l=e.getAxis(n),u=de(a.stops,function(y){return{coord:l.toGlobalCoord(l.dataToCoord(y.value)),color:y.color}}),c=u.length,f=a.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),f.reverse());var h=sme(u,n==="x"?t.getWidth():t.getHeight()),p=h.length;if(!p&&c)return u[0].coord<0?f[1]?f[1]:u[c-1].color:f[0]?f[0]:u[0].color;var d=10,g=h[0].coord-d,m=h[p-1].coord+d,v=m-g;if(v<.001)return"transparent";N(h,function(y){y.offset=(y.coord-g)/v}),h.push({offset:p?h[p-1].offset:.5,color:f[1]||"transparent"}),h.unshift({offset:p?h[0].offset:.5,color:f[0]||"transparent"});var _=new zl(0,0,0,0,h,!0);return _[n]=g,_[n+"2"]=m,_}}}function ume(r,e,t){var i=r.get("showAllSymbol"),n=i==="auto";if(!(i&&!n)){var a=t.getAxesByScale("ordinal")[0];if(a&&!(n&&cme(a,e))){var o=e.mapDimension(a.dim),s={};return N(a.getViewLabels(),function(l){var u=a.scale.getRawOrdinalNumber(l.tickValue);s[u]=1}),function(l){return!s.hasOwnProperty(e.get(o,l))}}}}function cme(r,e){var t=r.getExtent(),i=Math.abs(t[1]-t[0])/r.scale.count();isNaN(i)&&(i=0);for(var n=e.count(),a=Math.max(1,Math.round(n/5)),o=0;o<n;o+=a)if(ku.getSymbolSize(e,o)[r.isHorizontal()?1:0]*1.5>i)return!1;return!0}function fme(r,e){return isNaN(r)||isNaN(e)}function hme(r){for(var e=r.length/2;e>0&&fme(r[e*2-2],r[e*2-1]);e--);return e-1}function fX(r,e){return[r[e*2],r[e*2+1]]}function pme(r,e,t){for(var i=r.length/2,n=t==="x"?0:1,a,o,s=0,l=-1,u=0;u<i;u++)if(o=r[u*2+n],!(isNaN(o)||isNaN(r[u*2+1-n]))){if(u===0){a=o;continue}if(a<=e&&o>=e||a>=e&&o<=e){l=u;break}s=u,a=o}return{range:[s,l],t:(e-a)/(o-a)}}function hX(r){if(r.get(["endLabel","show"]))return!0;for(var e=0;e<Bi.length;e++)if(r.get([Bi[e],"endLabel","show"]))return!0;return!1}function $2(r,e,t,i){if(ls(e,"cartesian2d")){var n=i.getModel("endLabel"),a=n.get("valueAnimation"),o=i.getData(),s={lastFrameIndex:0},l=hX(i)?function(p,d){r._endLabelOnDuring(p,d,o,s,a,n,e)}:null,u=e.getBaseAxis().isHorizontal(),c=K2(e,t,i,function(){var p=r._endLabel;p&&t&&s.originalX!=null&&p.attr({x:s.originalX,y:s.originalY})},l);if(!i.get("clip",!0)){var f=c.shape,h=Math.max(f.width,f.height);u?(f.y-=h,f.height+=h*2):(f.x-=h,f.width+=h*2)}return l&&l(1,c),c}else return J2(e,t,i)}function dme(r,e){var t=e.getBaseAxis(),i=t.isHorizontal(),n=t.inverse,a=i?n?"right":"left":"center",o=i?"middle":n?"top":"bottom";return{normal:{align:r.get("align")||a,verticalAlign:r.get("verticalAlign")||o}}}var mme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.init=function(){var t=new Ze,i=new Yl;this.group.add(i.group),this._symbolDraw=i,this._lineGroup=t},e.prototype.render=function(t,i,n){var a=this,o=t.coordinateSystem,s=this.group,l=t.getData(),u=t.getModel("lineStyle"),c=t.getModel("areaStyle"),f=l.getLayout("points")||[],h=o.type==="polar",p=this._coordSys,d=this._symbolDraw,g=this._polyline,m=this._polygon,v=this._lineGroup,_=!i.ssr&&t.get("animation"),y=!c.isEmpty(),x=c.get("origin"),M=j1(o,l,x),S=y&&ome(o,l,M),w=t.get("showSymbol"),T=t.get("connectNulls"),C=w&&!h&&ume(t,l,o),b=this._data;b&&b.eachItemGraphicEl(function(ae,ve){ae.__temp&&(s.remove(ae),b.setItemGraphicEl(ve,null))}),w||d.remove(),s.add(v);var E=h?!1:t.get("step"),I;o&&o.getArea&&t.get("clip",!0)&&(I=o.getArea(),I.width!=null?(I.x-=.1,I.y-=.1,I.width+=.2,I.height+=.2):I.r0&&(I.r0-=.5,I.r+=.5)),this._clipShapeForSymbol=I;var R=lme(l,o,n)||l.getVisual("style")[l.getVisual("drawType")];if(!(g&&p.type===o.type&&E===this._step))w&&d.updateData(l,{isIgnore:C,clipShape:I,disableAnimation:!0,getSymbolPoint:function(ae){return[f[ae*2],f[ae*2+1]]}}),_&&this._initSymbolLabelAnimation(l,o,I),E&&(f=Gf(f,o,E,T),S&&(S=Gf(S,o,E,T))),g=this._newPolyline(f),y?m=this._newPolygon(f,S):m&&(v.remove(m),m=this._polygon=null),h||this._initOrUpdateEndLabel(t,o,Hs(R)),v.setClipPath($2(this,o,!0,t));else{y&&!m?m=this._newPolygon(f,S):m&&!y&&(v.remove(m),m=this._polygon=null),h||this._initOrUpdateEndLabel(t,o,Hs(R));var A=v.getClipPath();if(A){var D=$2(this,o,!1,t);ar(A,{shape:D.shape},t)}else v.setClipPath($2(this,o,!0,t));w&&d.updateData(l,{isIgnore:C,clipShape:I,disableAnimation:!0,getSymbolPoint:function(ae){return[f[ae*2],f[ae*2+1]]}}),(!sX(this._stackedOnPoints,S)||!sX(this._points,f))&&(_?this._doUpdateAnimation(l,S,o,n,E,x,T):(E&&(f=Gf(f,o,E,T),S&&(S=Gf(S,o,E,T))),g.setShape({points:f}),m&&m.setShape({points:f,stackedOnPoints:S})))}var U=t.getModel("emphasis"),B=U.get("focus"),F=U.get("blurScope"),k=U.get("disabled");if(g.useStyle(Ye(u.getLineStyle(),{fill:"none",stroke:R,lineJoin:"bevel"})),Gr(g,t,"lineStyle"),g.style.lineWidth>0&&t.get(["emphasis","lineStyle","width"])==="bolder"){var G=g.getState("emphasis").style;G.lineWidth=+g.style.lineWidth+1}rt(g).seriesIndex=t.seriesIndex,nr(g,B,F,k);var Y=cX(t.get("smooth")),J=t.get("smoothMonotone");if(g.setShape({smooth:Y,smoothMonotone:J,connectNulls:T}),m){var Q=l.getCalculationInfo("stackedOnSeries"),V=0;m.useStyle(Ye(c.getAreaStyle(),{fill:R,opacity:.7,lineJoin:"bevel",decal:l.getVisual("style").decal})),Q&&(V=cX(Q.get("smooth"))),m.setShape({smooth:Y,stackedOnSmooth:V,smoothMonotone:J,connectNulls:T}),Gr(m,t,"areaStyle"),rt(m).seriesIndex=t.seriesIndex,nr(m,B,F,k)}var K=function(ae){a._changePolyState(ae)};l.eachItemGraphicEl(function(ae){ae&&(ae.onHoverStateChange=K)}),this._polyline.onHoverStateChange=K,this._data=l,this._coordSys=o,this._stackedOnPoints=S,this._points=f,this._step=E,this._valueOrigin=x,t.get("triggerLineEvent")&&(this.packEventData(t,g),m&&this.packEventData(t,m))},e.prototype.packEventData=function(t,i){rt(i).eventData={componentType:"series",componentSubType:"line",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"line"}},e.prototype.highlight=function(t,i,n,a){var o=t.getData(),s=Jo(o,a);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),u=o.getItemGraphicEl(s);if(!u){var c=l[s*2],f=l[s*2+1];if(isNaN(c)||isNaN(f)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,f))return;var h=t.get("zlevel")||0,p=t.get("z")||0;u=new ku(o,s),u.x=c,u.y=f,u.setZ(h,p);var d=u.getSymbolPath().getTextContent();d&&(d.zlevel=h,d.z=p,d.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else Yt.prototype.highlight.call(this,t,i,n,a)},e.prototype.downplay=function(t,i,n,a){var o=t.getData(),s=Jo(o,a);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else Yt.prototype.downplay.call(this,t,i,n,a)},e.prototype._changePolyState=function(t){var i=this._polygon;Rp(this._polyline,t),i&&Rp(i,t)},e.prototype._newPolyline=function(t){var i=this._polyline;return i&&this._lineGroup.remove(i),i=new oX({shape:{points:t},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(i),this._polyline=i,i},e.prototype._newPolygon=function(t,i){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new J1({shape:{points:t,stackedOnPoints:i},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},e.prototype._initSymbolLabelAnimation=function(t,i,n){var a,o,s=i.getBaseAxis(),l=s.inverse;i.type==="cartesian2d"?(a=s.isHorizontal(),o=!1):i.type==="polar"&&(a=s.dim==="angle",o=!0);var u=t.hostModel,c=u.get("animationDuration");He(c)&&(c=c(null));var f=u.get("animationDelay")||0,h=He(f)?f(null):f;t.eachItemGraphicEl(function(p,d){var g=p;if(g){var m=[p.x,p.y],v=void 0,_=void 0,y=void 0;if(n)if(o){var x=n,M=i.pointToCoord(m);a?(v=x.startAngle,_=x.endAngle,y=-M[1]/180*Math.PI):(v=x.r0,_=x.r,y=M[0])}else{var S=n;a?(v=S.x,_=S.x+S.width,y=p.x):(v=S.y+S.height,_=S.y,y=p.y)}var w=_===v?0:(y-v)/(_-v);l&&(w=1-w);var T=He(f)?f(d):c*w+h,C=g.getSymbolPath(),b=C.getTextContent();g.attr({scaleX:0,scaleY:0}),g.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:T}),b&&b.animateFrom({style:{opacity:0}},{duration:300,delay:T}),C.disableLabelAnimation=!0}})},e.prototype._initOrUpdateEndLabel=function(t,i,n){var a=t.getModel("endLabel");if(hX(t)){var o=t.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var u=this._endLabel;u||(u=this._endLabel=new Lt({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=hme(l);c>=0&&(Nr(s,Tr(t,"endLabel"),{inheritColor:n,labelFetcher:t,labelDataIndex:c,defaultText:function(f,h,p){return p!=null?Z1(o,p):Qs(o,f)},enableTextSetter:!0},dme(a,i)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},e.prototype._endLabelOnDuring=function(t,i,n,a,o,s,l){var u=this._endLabel,c=this._polyline;if(u){t<1&&a.originalX==null&&(a.originalX=u.x,a.originalY=u.y);var f=n.getLayout("points"),h=n.hostModel,p=h.get("connectNulls"),d=s.get("precision"),g=s.get("distance")||0,m=l.getBaseAxis(),v=m.isHorizontal(),_=m.inverse,y=i.shape,x=_?v?y.x:y.y+y.height:v?y.x+y.width:y.y,M=(v?g:0)*(_?-1:1),S=(v?0:-g)*(_?-1:1),w=v?"x":"y",T=pme(f,x,w),C=T.range,b=C[1]-C[0],E=void 0;if(b>=1){if(b>1&&!p){var I=fX(f,C[0]);u.attr({x:I[0]+M,y:I[1]+S}),o&&(E=h.getRawValue(C[0]))}else{var I=c.getPointOn(x,w);I&&u.attr({x:I[0]+M,y:I[1]+S});var R=h.getRawValue(C[0]),A=h.getRawValue(C[1]);o&&(E=Hb(n,d,R,A,T.t))}a.lastFrameIndex=C[0]}else{var D=t===1||a.lastFrameIndex>0?C[0]:0,I=fX(f,D);o&&(E=h.getRawValue(D)),u.attr({x:I[0]+M,y:I[1]+S})}if(o){var U=Du(u);typeof U.setLabelText=="function"&&U.setLabelText(E)}}},e.prototype._doUpdateAnimation=function(t,i,n,a,o,s,l){var u=this._polyline,c=this._polygon,f=t.hostModel,h=Z2(this._data,t,this._stackedOnPoints,i,this._coordSys,n,this._valueOrigin,s),p=h.current,d=h.stackedOnCurrent,g=h.next,m=h.stackedOnNext;if(o&&(p=Gf(h.current,n,o,l),d=Gf(h.stackedOnCurrent,n,o,l),g=Gf(h.next,n,o,l),m=Gf(h.stackedOnNext,n,o,l)),uX(p,g)>3e3||c&&uX(d,m)>3e3){u.stopAnimation(),u.setShape({points:g}),c&&(c.stopAnimation(),c.setShape({points:g,stackedOnPoints:m}));return}u.shape.__points=h.current,u.shape.points=p;var v={shape:{points:g}};h.current!==p&&(v.shape.__points=h.next),u.stopAnimation(),Dt(u,v,f),c&&(c.setShape({points:p,stackedOnPoints:d}),c.stopAnimation(),Dt(c,{shape:{stackedOnPoints:m}},f),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var _=[],y=h.status,x=0;x<y.length;x++){var M=y[x].cmd;if(M==="="){var S=t.getItemGraphicEl(y[x].idx1);S&&_.push({el:S,ptIdx:x})}}u.animators&&u.animators.length&&u.animators[0].during(function(){c&&c.dirtyShape();for(var w=u.shape.__points,T=0;T<_.length;T++){var C=_[T].el,b=_[T].ptIdx*2;C.x=w[b],C.y=w[b+1],C.markRedraw()}})},e.prototype.remove=function(t){var i=this.group,n=this._data;this._lineGroup.removeAll(),this._symbolDraw.remove(!0),n&&n.eachItemGraphicEl(function(a,o){a.__temp&&(i.remove(a),n.setItemGraphicEl(o,null))}),this._polyline=this._polygon=this._coordSys=this._points=this._stackedOnPoints=this._endLabel=this._data=null},e.type="line",e}(Yt),pX=mme;function el(r,e){return{seriesType:r,plan:Mo(),reset:function(t){var i=t.getData(),n=t.coordinateSystem,a=t.pipelineContext,o=e||a.large;if(n){var s=de(n.dimensions,function(p){return i.mapDimension(p)}).slice(0,2),l=s.length,u=i.getCalculationInfo("stackResultDimension");wo(i,s[0])&&(s[0]=u),wo(i,s[1])&&(s[1]=u);var c=i.getStore(),f=i.getDimensionIndex(s[0]),h=i.getDimensionIndex(s[1]);return l&&{progress:function(p,d){for(var g=p.end-p.start,m=o&&ca(g*l),v=[],_=[],y=p.start,x=0;y<p.end;y++){var M=void 0;if(l===1){var S=c.get(f,y);M=n.dataToPoint(S,null,_)}else v[0]=c.get(f,y),v[1]=c.get(h,y),M=n.dataToPoint(v,null,_);o?(m[x++]=M[0],m[x++]=M[1]):d.setItemLayout(y,M.slice())}o&&d.setLayout("points",m)}}}}}}var vme={average:function(r){for(var e=0,t=0,i=0;i<r.length;i++)isNaN(r[i])||(e+=r[i],t++);return t===0?NaN:e/t},sum:function(r){for(var e=0,t=0;t<r.length;t++)e+=r[t]||0;return e},max:function(r){for(var e=-1/0,t=0;t<r.length;t++)r[t]>e&&(e=r[t]);return isFinite(e)?e:NaN},min:function(r){for(var e=1/0,t=0;t<r.length;t++)r[t]<e&&(e=r[t]);return isFinite(e)?e:NaN},minmax:function(r){for(var e=-1/0,t=-1/0,i=0;i<r.length;i++){var n=r[i],a=Math.abs(n);a>e&&(e=a,t=n)}return isFinite(t)?t:NaN},nearest:function(r){return r[0]}},gme=function(r){return Math.round(r.length/2)};function vx(r){return{seriesType:r,reset:function(e,t,i){var n=e.getData(),a=e.get("sampling"),o=e.coordinateSystem,s=n.count();if(s>10&&o.type==="cartesian2d"&&a){var l=o.getBaseAxis(),u=o.getOtherAxis(l),c=l.getExtent(),f=i.getDevicePixelRatio(),h=Math.abs(c[1]-c[0])*(f||1),p=Math.round(s/h);if(isFinite(p)&&p>1){a==="lttb"&&e.setData(n.lttbDownSample(n.mapDimension(u.dim),1/p));var d=void 0;Ce(a)?d=vme[a]:He(a)&&(d=a),d&&e.setData(n.downSample(n.mapDimension(u.dim),1/p,d,gme))}}}}}function Q2(r){r.registerChartView(pX),r.registerSeriesModel(rX),r.registerLayout(el("line",!0)),r.registerVisual({seriesType:"line",reset:function(e){var t=e.getData(),i=e.getModel("lineStyle").getLineStyle();i&&!i.stroke&&(i.stroke=t.getVisual("style").fill),t.setVisual("legendLineStyle",i)}}),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,vx("line"))}var dX=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{useEncodeDefaulter:!0})},e.prototype.getMarkerPosition=function(t,i,n){var a=this.coordinateSystem;if(a&&a.clampData){var o=a.clampData(t),s=a.dataToPoint(o);if(n)N(a.getAxes(),function(h,p){if(h.type==="category"&&i!=null){var d=h.getTicksCoords(),g=h.getTickModel().get("alignWithLabel"),m=o[p],v=i[p]==="x1"||i[p]==="y1";if(v&&!g&&(m+=1),d.length<2)return;if(d.length===2){s[p]=h.toGlobalCoord(h.getExtent()[v?1:0]);return}for(var _=void 0,y=void 0,x=1,M=0;M<d.length;M++){var S=d[M].coord,w=M===d.length-1?d[M-1].tickValue+x:d[M].tickValue;if(w===m){y=S;break}else if(w<m)_=S;else if(_!=null&&w>m){y=(S+_)/2;break}M===1&&(x=w-d[0].tickValue)}y==null&&(_?_&&(y=d[d.length-1].coord):y=d[0].coord),s[p]=h.toGlobalCoord(y)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),f=a.getBaseAxis().isHorizontal()?0:1;s[f]+=u+c/2}return s}return[NaN,NaN]},e.type="series.__base_bar__",e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod"},e}(jt);jt.registerClass(dX);var wv=dX;var yme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(){return hn(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},e.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},e.prototype.getProgressiveThreshold=function(){var t=this.get("progressiveThreshold"),i=this.get("largeThreshold");return i>t&&(t=i),t},e.prototype.brushSelector=function(t,i,n){return n.rect(i.getItemLayout(t))},e.type="series.bar",e.dependencies=["grid","polar"],e.defaultOption=Hn(wv.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:"#212121"}},realtimeSort:!1}),e}(wv),mX=yme;var _me=function(){function r(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return r}(),xme=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="sausage",i}return e.prototype.getDefaultShape=function(){return new _me},e.prototype.buildPath=function(t,i){var n=i.cx,a=i.cy,o=Math.max(i.r0||0,0),s=Math.max(i.r,0),l=(s-o)*.5,u=o+l,c=i.startAngle,f=i.endAngle,h=i.clockwise,p=Math.PI*2,d=h?f-c<p:c-f<p;d||(c=f-(h?p:-p));var g=Math.cos(c),m=Math.sin(c),v=Math.cos(f),_=Math.sin(f);d?(t.moveTo(g*o+n,m*o+a),t.arc(g*u+n,m*u+a,l,-Math.PI+c,c,!h)):t.moveTo(g*s+n,m*s+a),t.arc(n,a,s,c,f,!h),t.arc(v*u+n,_*u+a,l,f-Math.PI*2,f-Math.PI,!h),o!==0&&t.arc(n,a,o,f,c,h)},e}(ut),Tv=xme;function vX(r,e){e=e||{};var t=e.isRoundCap;return function(i,n,a){var o=n.position;if(!o||o instanceof Array)return gp(i,n,a);var s=r(o),l=n.distance!=null?n.distance:5,u=this.shape,c=u.cx,f=u.cy,h=u.r,p=u.r0,d=(h+p)/2,g=u.startAngle,m=u.endAngle,v=(g+m)/2,_=t?Math.abs(h-p)/2:0,y=Math.cos,x=Math.sin,M=c+h*y(g),S=f+h*x(g),w="left",T="top";switch(s){case"startArc":M=c+(p-l)*y(v),S=f+(p-l)*x(v),w="center",T="top";break;case"insideStartArc":M=c+(p+l)*y(v),S=f+(p+l)*x(v),w="center",T="bottom";break;case"startAngle":M=c+d*y(g)+$1(g,l+_,!1),S=f+d*x(g)+Q1(g,l+_,!1),w="right",T="middle";break;case"insideStartAngle":M=c+d*y(g)+$1(g,-l+_,!1),S=f+d*x(g)+Q1(g,-l+_,!1),w="left",T="middle";break;case"middle":M=c+d*y(v),S=f+d*x(v),w="center",T="middle";break;case"endArc":M=c+(h+l)*y(v),S=f+(h+l)*x(v),w="center",T="bottom";break;case"insideEndArc":M=c+(h-l)*y(v),S=f+(h-l)*x(v),w="center",T="top";break;case"endAngle":M=c+d*y(m)+$1(m,l+_,!0),S=f+d*x(m)+Q1(m,l+_,!0),w="left",T="middle";break;case"insideEndAngle":M=c+d*y(m)+$1(m,-l+_,!0),S=f+d*x(m)+Q1(m,-l+_,!0),w="right",T="middle";break;default:return gp(i,n,a)}return i=i||{},i.x=M,i.y=S,i.align=w,i.verticalAlign=T,i}}function gX(r,e,t,i){if(At(i)){r.setTextConfig({rotation:i});return}else if(pe(e)){r.setTextConfig({rotation:0});return}var n=r.shape,a=n.clockwise?n.startAngle:n.endAngle,o=n.clockwise?n.endAngle:n.startAngle,s=(a+o)/2,l,u=t(e);switch(u){case"startArc":case"insideStartArc":case"middle":case"insideEndArc":case"endArc":l=s;break;case"startAngle":case"insideStartAngle":l=a;break;case"endAngle":case"insideEndAngle":l=o;break;default:r.setTextConfig({rotation:0});return}var c=Math.PI*1.5-l;u==="middle"&&c>Math.PI/2&&c<Math.PI*1.5&&(c-=Math.PI),r.setTextConfig({rotation:c})}function $1(r,e,t){return e*Math.sin(r)*(t?-1:1)}function Q1(r,e,t){return e*Math.cos(r)*(t?1:-1)}function Zl(r,e,t){var i=r.get("borderRadius");if(i==null)return t?{cornerRadius:0}:null;pe(i)||(i=[i,i,i,i]);var n=Math.abs(e.r||0-e.r0||0);return{cornerRadius:de(i,function(a){return xn(a,n)})}}var eI=Math.max,tI=Math.min;function Sme(r,e){var t=r.getArea&&r.getArea();if(ls(r,"cartesian2d")){var i=r.getBaseAxis();if(i.type!=="category"||!i.onBand){var n=e.getLayout("bandWidth");i.isHorizontal()?(t.x-=n,t.width+=n*2):(t.y-=n,t.height+=n*2)}}return t}var Mme=function(r){Z(e,r);function e(){var t=r.call(this)||this;return t.type=e.type,t._isFirstFrame=!0,t}return e.prototype.render=function(t,i,n,a){this._model=t,this._removeOnRenderedListener(n),this._updateDrawMode(t);var o=t.get("coordinateSystem");(o==="cartesian2d"||o==="polar")&&(this._progressiveEls=null,this._isLargeDraw?this._renderLarge(t,i,n):this._renderNormal(t,i,n,a))},e.prototype.incrementalPrepareRender=function(t){this._clear(),this._updateDrawMode(t),this._updateLargeClip(t)},e.prototype.incrementalRender=function(t,i){this._progressiveEls=[],this._incrementalRenderLarge(t,i)},e.prototype.eachRendered=function(t){sa(this._progressiveEls||this.group,t)},e.prototype._updateDrawMode=function(t){var i=t.pipelineContext.large;(this._isLargeDraw==null||i!==this._isLargeDraw)&&(this._isLargeDraw=i,this._clear())},e.prototype._renderNormal=function(t,i,n,a){var o=this.group,s=t.getData(),l=this._data,u=t.coordinateSystem,c=u.getBaseAxis(),f;u.type==="cartesian2d"?f=c.isHorizontal():u.type==="polar"&&(f=c.dim==="angle");var h=t.isAnimationEnabled()?t:null,p=bme(t,u);p&&this._enableRealtimeSort(p,s,n);var d=t.get("clip",!0)||p,g=Sme(u,s);o.removeClipPath();var m=t.get("roundCap",!0),v=t.get("showBackground",!0),_=t.getModel("backgroundStyle"),y=_.get("borderRadius")||0,x=[],M=this._backgroundEls,S=a&&a.isInitSort,w=a&&a.type==="changeAxisOrder";function T(E){var I=eT[u.type](s,E),R=Lme(u,f,I);return R.useStyle(_.getItemStyle()),u.type==="cartesian2d"?R.setShape("r",y):R.setShape("cornerRadius",y),x[E]=R,R}s.diff(l).add(function(E){var I=s.getItemModel(E),R=eT[u.type](s,E,I);if(v&&T(E),!(!s.hasValue(E)||!MX[u.type](R))){var A=!1;d&&(A=yX[u.type](g,R));var D=_X[u.type](t,s,E,R,f,h,c.model,!1,m);p&&(D.forceLabelAnimation=!0),bX(D,s,E,I,R,t,f,u.type==="polar"),S?D.attr({shape:R}):p?xX(p,h,D,R,E,f,!1,!1):ar(D,{shape:R},t,E),s.setItemGraphicEl(E,D),o.add(D),D.ignore=A}}).update(function(E,I){var R=s.getItemModel(E),A=eT[u.type](s,E,R);if(v){var D=void 0;M.length===0?D=T(I):(D=M[I],D.useStyle(_.getItemStyle()),u.type==="cartesian2d"?D.setShape("r",y):D.setShape("cornerRadius",y),x[E]=D);var U=eT[u.type](s,E),B=CX(f,U,u);Dt(D,{shape:B},h,E)}var F=l.getItemGraphicEl(I);if(!s.hasValue(E)||!MX[u.type](A)){o.remove(F);return}var k=!1;if(d&&(k=yX[u.type](g,A),k&&o.remove(F)),F?Ii(F):F=_X[u.type](t,s,E,A,f,h,c.model,!!F,m),p&&(F.forceLabelAnimation=!0),w){var G=F.getTextContent();if(G){var Y=Du(G);Y.prevValue!=null&&(Y.prevValue=Y.value)}}else bX(F,s,E,R,A,t,f,u.type==="polar");S?F.attr({shape:A}):p?xX(p,h,F,A,E,f,!0,w):Dt(F,{shape:A},t,E,null),s.setItemGraphicEl(E,F),F.ignore=k,o.add(F)}).remove(function(E){var I=l.getItemGraphicEl(E);I&&Cu(I,t,E)}).execute();var C=this._backgroundGroup||(this._backgroundGroup=new Ze);C.removeAll();for(var b=0;b<x.length;++b)C.add(x[b]);o.add(C),this._backgroundEls=x,this._data=s},e.prototype._renderLarge=function(t,i,n){this._clear(),TX(t,this.group),this._updateLargeClip(t)},e.prototype._incrementalRenderLarge=function(t,i){this._removeBackground(),TX(i,this.group,this._progressiveEls,!0)},e.prototype._updateLargeClip=function(t){var i=t.get("clip",!0)&&ql(t.coordinateSystem,!1,t),n=this.group;i?n.setClipPath(i):n.removeClipPath()},e.prototype._enableRealtimeSort=function(t,i,n){var a=this;if(i.count()){var o=t.baseAxis;if(this._isFirstFrame)this._dispatchInitSort(i,t,n),this._isFirstFrame=!1;else{var s=function(l){var u=i.getItemGraphicEl(l),c=u&&u.shape;return c&&Math.abs(o.isHorizontal()?c.height:c.width)||0};this._onRendered=function(){a._updateSortWithinSameData(i,s,o,n)},n.getZr().on("rendered",this._onRendered)}}},e.prototype._dataSort=function(t,i,n){var a=[];return t.each(t.mapDimension(i.dim),function(o,s){var l=n(s);l=l??NaN,a.push({dataIndex:s,mappedValue:l,ordinalNumber:o})}),a.sort(function(o,s){return s.mappedValue-o.mappedValue}),{ordinalNumbers:de(a,function(o){return o.ordinalNumber})}},e.prototype._isOrderChangedWithinSameData=function(t,i,n){for(var a=n.scale,o=t.mapDimension(n.dim),s=Number.MAX_VALUE,l=0,u=a.getOrdinalMeta().categories.length;l<u;++l){var c=t.rawIndexOf(o,a.getRawOrdinalNumber(l)),f=c<0?Number.MIN_VALUE:i(t.indexOfRawIndex(c));if(f>s)return!0;s=f}return!1},e.prototype._isOrderDifferentInView=function(t,i){for(var n=i.scale,a=n.getExtent(),o=Math.max(0,a[0]),s=Math.min(a[1],n.getOrdinalMeta().categories.length-1);o<=s;++o)if(t.ordinalNumbers[o]!==n.getRawOrdinalNumber(o))return!0},e.prototype._updateSortWithinSameData=function(t,i,n,a){if(this._isOrderChangedWithinSameData(t,i,n)){var o=this._dataSort(t,n,i);this._isOrderDifferentInView(o,n)&&(this._removeOnRenderedListener(a),a.dispatchAction({type:"changeAxisOrder",componentType:n.dim+"Axis",axisId:n.index,sortInfo:o}))}},e.prototype._dispatchInitSort=function(t,i,n){var a=i.baseAxis,o=this._dataSort(t,a,function(s){return t.get(t.mapDimension(i.otherAxis.dim),s)});n.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",isInitSort:!0,axisId:a.index,sortInfo:o})},e.prototype.remove=function(t,i){this._clear(this._model),this._removeOnRenderedListener(i)},e.prototype.dispose=function(t,i){this._removeOnRenderedListener(i)},e.prototype._removeOnRenderedListener=function(t){this._onRendered&&(t.getZr().off("rendered",this._onRendered),this._onRendered=null)},e.prototype._clear=function(t){var i=this.group,n=this._data;t&&t.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(a){Cu(a,t,rt(a).dataIndex)})):i.removeAll(),this._data=null,this._isFirstFrame=!0},e.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},e.type="bar",e}(Yt),yX={cartesian2d:function(r,e){var t=e.width<0?-1:1,i=e.height<0?-1:1;t<0&&(e.x+=e.width,e.width=-e.width),i<0&&(e.y+=e.height,e.height=-e.height);var n=r.x+r.width,a=r.y+r.height,o=eI(e.x,r.x),s=tI(e.x+e.width,n),l=eI(e.y,r.y),u=tI(e.y+e.height,a),c=s<o,f=u<l;return e.x=c&&o>n?s:o,e.y=f&&l>a?u:l,e.width=c?0:s-o,e.height=f?0:u-l,t<0&&(e.x+=e.width,e.width=-e.width),i<0&&(e.y+=e.height,e.height=-e.height),c||f},polar:function(r,e){var t=e.r0<=e.r?1:-1;if(t<0){var i=e.r;e.r=e.r0,e.r0=i}var n=tI(e.r,r.r),a=eI(e.r0,r.r0);e.r=n,e.r0=a;var o=n-a<0;if(t<0){var i=e.r;e.r=e.r0,e.r0=i}return o}},_X={cartesian2d:function(r,e,t,i,n,a,o,s,l){var u=new Tt({shape:fe({},i),z2:1});if(u.__dataIndex=t,u.name="item",a){var c=u.shape,f=n?"height":"width";c[f]=0}return u},polar:function(r,e,t,i,n,a,o,s,l){var u=!n&&l?Tv:yi,c=new u({shape:i,z2:1});c.name="item";var f=AX(n);if(c.calculateTextPosition=vX(f,{isRoundCap:u===Tv}),a){var h=c.shape,p=n?"r":"endAngle",d={};h[p]=n?i.r0:i.startAngle,d[p]=i[p],(s?Dt:ar)(c,{shape:d},a)}return c}};function bme(r,e){var t=r.get("realtimeSort",!0),i=e.getBaseAxis();if(t&&i.type==="category"&&e.type==="cartesian2d")return{baseAxis:i,otherAxis:e.getOtherAxis(i)}}function xX(r,e,t,i,n,a,o,s){var l,u;a?(u={x:i.x,width:i.width},l={y:i.y,height:i.height}):(u={y:i.y,height:i.height},l={x:i.x,width:i.width}),s||(o?Dt:ar)(t,{shape:l},e,n,null);var c=e?r.baseAxis.model:null;(o?Dt:ar)(t,{shape:u},c,n)}function SX(r,e){for(var t=0;t<e.length;t++)if(!isFinite(r[e[t]]))return!0;return!1}var wme=["x","y","width","height"],Tme=["cx","cy","r","startAngle","endAngle"],MX={cartesian2d:function(r){return!SX(r,wme)},polar:function(r){return!SX(r,Tme)}},eT={cartesian2d:function(r,e,t){var i=r.getItemLayout(e),n=t?Ame(t,i):0,a=i.width>0?1:-1,o=i.height>0?1:-1;return{x:i.x+a*n/2,y:i.y+o*n/2,width:i.width-a*n,height:i.height-o*n}},polar:function(r,e,t){var i=r.getItemLayout(e);return{cx:i.cx,cy:i.cy,r0:i.r0,r:i.r,startAngle:i.startAngle,endAngle:i.endAngle,clockwise:i.clockwise}}};function Eme(r){return r.startAngle!=null&&r.endAngle!=null&&r.startAngle===r.endAngle}function AX(r){return function(e){var t=e?"Arc":"Angle";return function(i){switch(i){case"start":case"insideStart":case"end":case"insideEnd":return i+t;default:return i}}}(r)}function bX(r,e,t,i,n,a,o,s){var l=e.getItemVisual(t,"style");if(s){if(!a.get("roundCap")){var c=r.shape,f=Zl(i.getModel("itemStyle"),c,!0);fe(c,f),r.setShape(c)}}else{var u=i.get(["itemStyle","borderRadius"])||0;r.setShape("r",u)}r.useStyle(l);var h=i.getShallow("cursor");h&&r.attr("cursor",h);var p=s?o?n.r>=n.r0?"endArc":"startArc":n.endAngle>=n.startAngle?"endAngle":"startAngle":o?n.height>=0?"bottom":"top":n.width>=0?"right":"left",d=Tr(i);Nr(r,d,{labelFetcher:a,labelDataIndex:t,defaultText:Qs(a.getData(),t),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:p});var g=r.getTextContent();if(s&&g){var m=i.get(["label","position"]);r.textConfig.inside=m==="middle"?!0:null,gX(r,m==="outside"?p:m,AX(o),i.get(["label","rotate"]))}vw(g,d,a.getRawValue(t),function(_){return Z1(e,_)});var v=i.getModel(["emphasis"]);nr(r,v.get("focus"),v.get("blurScope"),v.get("disabled")),Gr(r,i),Eme(n)&&(r.style.fill="none",r.style.stroke="none",N(r.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function Ame(r,e){var t=r.get(["itemStyle","borderColor"]);if(!t||t==="none")return 0;var i=r.get(["itemStyle","borderWidth"])||0,n=isNaN(e.width)?Number.MAX_VALUE:Math.abs(e.width),a=isNaN(e.height)?Number.MAX_VALUE:Math.abs(e.height);return Math.min(i,n,a)}var Cme=function(){function r(){}return r}(),wX=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="largeBar",i}return e.prototype.getDefaultShape=function(){return new Cme},e.prototype.buildPath=function(t,i){for(var n=i.points,a=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,c=0;c<n.length;c+=3)l[a]=u,l[o]=n[c+2],s[a]=n[c+a],s[o]=n[c+o],t.rect(s[0],s[1],l[0],l[1])},e}(ut);function TX(r,e,t,i){var n=r.getData(),a=n.getLayout("valueAxisHorizontal")?1:0,o=n.getLayout("largeDataIndices"),s=n.getLayout("size"),l=r.getModel("backgroundStyle"),u=n.getLayout("largeBackgroundPoints");if(u){var c=new wX({shape:{points:u},incremental:!!i,silent:!0,z2:0});c.baseDimIdx=a,c.largeDataIndices=o,c.barWidth=s,c.useStyle(l.getItemStyle()),e.add(c),t&&t.push(c)}var f=new wX({shape:{points:n.getLayout("largePoints")},incremental:!!i,ignoreCoarsePointer:!0,z2:1});f.baseDimIdx=a,f.largeDataIndices=o,f.barWidth=s,e.add(f),f.useStyle(n.getVisual("style")),rt(f).seriesIndex=r.seriesIndex,r.get("silent")||(f.on("mousedown",EX),f.on("mousemove",EX)),t&&t.push(f)}var EX=k_(function(r){var e=this,t=Rme(e,r.offsetX,r.offsetY);rt(e).dataIndex=t>=0?t:null},30,!1);function Rme(r,e,t){for(var i=r.baseDimIdx,n=1-i,a=r.shape.points,o=r.largeDataIndices,s=[],l=[],u=r.barWidth,c=0,f=a.length/3;c<f;c++){var h=c*3;if(l[i]=u,l[n]=a[h+2],s[i]=a[h+i],s[n]=a[h+n],l[n]<0&&(s[n]+=l[n],l[n]=-l[n]),e>=s[0]&&e<=s[0]+l[0]&&t>=s[1]&&t<=s[1]+l[1])return o[c]}return-1}function CX(r,e,t){if(ls(t,"cartesian2d")){var i=e,n=t.getArea();return{x:r?i.x:n.x,y:r?n.y:i.y,width:r?i.width:n.width,height:r?n.height:i.height}}else{var n=t.getArea(),a=e;return{cx:n.cx,cy:n.cy,r0:r?n.r0:a.r0,r:r?n.r:a.r,startAngle:r?a.startAngle:0,endAngle:r?a.endAngle:Math.PI*2}}}function Lme(r,e,t){var i=r.type==="polar"?yi:Tt;return new i({shape:CX(e,t,r),silent:!0,z2:0})}var RX=Mme;function rI(r){r.registerChartView(RX),r.registerSeriesModel(mX),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,ot(S1,"bar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,M1("bar")),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,vx("bar")),r.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(e,t){var i=e.componentType||"series";t.eachComponent({mainType:i,query:e},function(n){e.sortInfo&&n.axis.setCategorySortInfo(e.sortInfo)})})}var LX=Math.PI*2,tT=Math.PI/180;function PX(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function iI(r,e){var t=PX(r,e),i=r.get("center"),n=r.get("radius");pe(n)||(n=[0,n]);var a=Fe(t.width,e.getWidth()),o=Fe(t.height,e.getHeight()),s=Math.min(a,o),l=Fe(n[0],s/2),u=Fe(n[1],s/2),c,f,h=r.coordinateSystem;if(h){var p=h.dataToPoint(i);c=p[0]||0,f=p[1]||0}else pe(i)||(i=[i,i]),c=Fe(i[0],a)+t.x,f=Fe(i[1],o)+t.y;return{cx:c,cy:f,r0:l,r:u}}function nI(r,e,t){e.eachSeriesByType(r,function(i){var n=i.getData(),a=n.mapDimension("value"),o=PX(i,t),s=iI(i,t),l=s.cx,u=s.cy,c=s.r,f=s.r0,h=-i.get("startAngle")*tT,p=i.get("endAngle"),d=i.get("padAngle")*tT;p=p==="auto"?h-LX:-p*tT;var g=i.get("minAngle")*tT,m=g+d,v=0;n.each(a,function(U){!isNaN(U)&&v++});var _=n.getSum(a),y=Math.PI/(_||v)*2,x=i.get("clockwise"),M=i.get("roseType"),S=i.get("stillShowZeroSum"),w=n.getDataExtent(a);w[0]=0;var T=x?1:-1,C=[h,p],b=T*d/2;l_(C,!x),h=C[0],p=C[1];var E=Math.abs(p-h),I=E,R=0,A=h;if(n.setLayout({viewRect:o,r:c}),n.each(a,function(U,B){var F;if(isNaN(U)){n.setItemLayout(B,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:x,cx:l,cy:u,r0:f,r:M?NaN:c});return}M!=="area"?F=_===0&&S?y:U*y:F=E/v,F<m?(F=m,I-=m):R+=U;var k=A+T*F,G=0,Y=0;d>F?(G=A+T*F/2,Y=G):(G=A+b,Y=k-b),n.setItemLayout(B,{angle:F,startAngle:G,endAngle:Y,clockwise:x,cx:l,cy:u,r0:f,r:M?rr(U,w,[f,c]):c}),A=k}),I<LX&&v)if(I<=.001){var D=E/v;n.each(a,function(U,B){if(!isNaN(U)){var F=n.getItemLayout(B);F.angle=D;var k=0,G=0;D<d?(k=h+T*(B+1/2)*D,G=k):(k=h+T*B*D+b,G=h+T*(B+1)*D-b),F.startAngle=k,F.endAngle=G}})}else y=I/R,A=h,n.each(a,function(U,B){if(!isNaN(U)){var F=n.getItemLayout(B),k=F.angle===m?m:U*y,G=0,Y=0;k<d?(G=A+T*k/2,Y=G):(G=A+b,Y=A+T*k-b),F.startAngle=G,F.endAngle=Y,A+=T*k}})})}function tl(r){return{seriesType:r,reset:function(e,t){var i=t.findComponents({mainType:"legend"});if(!(!i||!i.length)){var n=e.getData();n.filterSelf(function(a){for(var o=n.getName(a),s=0;s<i.length;s++)if(!i[s].isSelected(o))return!1;return!0})}}}}var Pme=Math.PI/180;function DX(r,e,t,i,n,a,o,s,l,u){if(r.length<2)return;function c(g){for(var m=g.rB,v=m*m,_=0;_<g.list.length;_++){var y=g.list[_],x=Math.abs(y.label.y-t),M=i+y.len,S=M*M,w=Math.sqrt((1-Math.abs(x*x/v))*S),T=e+(w+y.len2)*n,C=T-y.label.x,b=y.targetTextWidth-C*n;IX(y,b,!0),y.label.x=T}}function f(g){for(var m={list:[],maxY:0},v={list:[],maxY:0},_=0;_<g.length;_++)if(g[_].labelAlignTo==="none"){var y=g[_],x=y.label.y>t?v:m,M=Math.abs(y.label.y-t);if(M>=x.maxY){var S=y.label.x-e-y.len2*n,w=i+y.len,T=Math.abs(S)<w?Math.sqrt(M*M/(1-S*S/w/w)):w;x.rB=T,x.maxY=M}x.list.push(y)}c(m),c(v)}for(var h=r.length,p=0;p<h;p++)if(r[p].position==="outer"&&r[p].labelAlignTo==="labelLine"){var d=r[p].label.x-u;r[p].linePoints[1][0]+=d,r[p].label.x=u}O1(r,l,l+o)&&f(r)}function Dme(r,e,t,i,n,a,o,s){for(var l=[],u=[],c=Number.MAX_VALUE,f=-Number.MAX_VALUE,h=0;h<r.length;h++){var p=r[h].label;aI(r[h])||(p.x<e?(c=Math.min(c,p.x),l.push(r[h])):(f=Math.max(f,p.x),u.push(r[h])))}for(var h=0;h<r.length;h++){var d=r[h];if(!aI(d)&&d.linePoints){if(d.labelStyleWidth!=null)continue;var p=d.label,g=d.linePoints,m=void 0;d.labelAlignTo==="edge"?p.x<e?m=g[2][0]-d.labelDistance-o-d.edgeDistance:m=o+n-d.edgeDistance-g[2][0]-d.labelDistance:d.labelAlignTo==="labelLine"?p.x<e?m=c-o-d.bleedMargin:m=o+n-f-d.bleedMargin:p.x<e?m=p.x-o-d.bleedMargin:m=o+n-p.x-d.bleedMargin,d.targetTextWidth=m,IX(d,m)}}DX(u,e,t,i,1,n,a,o,s,f),DX(l,e,t,i,-1,n,a,o,s,c);for(var h=0;h<r.length;h++){var d=r[h];if(!aI(d)&&d.linePoints){var p=d.label,g=d.linePoints,v=d.labelAlignTo==="edge",_=p.style.padding,y=_?_[1]+_[3]:0,x=p.style.backgroundColor?0:y,M=d.rect.width+x,S=g[1][0]-g[2][0];v?p.x<e?g[2][0]=o+d.edgeDistance+M+d.labelDistance:g[2][0]=o+n-d.edgeDistance-M-d.labelDistance:(p.x<e?g[2][0]=p.x+d.labelDistance:g[2][0]=p.x-d.labelDistance,g[1][0]=g[2][0]+S),g[1][1]=g[2][1]=p.y}}}function IX(r,e,t){if(t===void 0&&(t=!1),r.labelStyleWidth==null){var i=r.label,n=i.style,a=r.rect,o=n.backgroundColor,s=n.padding,l=s?s[1]+s[3]:0,u=n.overflow,c=a.width+(o?0:l);if(e<c||t){var f=a.height;if(u&&u.match("break")){i.setStyle("backgroundColor",null),i.setStyle("width",e-l);var h=i.getBoundingRect();i.setStyle("width",Math.ceil(h.width)),i.setStyle("backgroundColor",o)}else{var p=e-l,d=e<c?p:t?p>r.unconstrainedWidth?null:p:null;i.setStyle("width",d)}var g=i.getBoundingRect();a.width=g.width;var m=(i.style.margin||0)+2.1;a.height=g.height+m,a.y-=(a.height-f)/2}}}function aI(r){return r.position==="center"}function oI(r){var e=r.getData(),t=[],i,n,a=!1,o=(r.get("minShowLabelAngle")||0)*Pme,s=e.getLayout("viewRect"),l=e.getLayout("r"),u=s.width,c=s.x,f=s.y,h=s.height;function p(S){S.ignore=!0}function d(S){if(!S.ignore)return!0;for(var w in S.states)if(S.states[w].ignore===!1)return!0;return!1}e.each(function(S){var w=e.getItemGraphicEl(S),T=w.shape,C=w.getTextContent(),b=w.getTextGuideLine(),E=e.getItemModel(S),I=E.getModel("label"),R=I.get("position")||E.get(["emphasis","label","position"]),A=I.get("distanceToLabelLine"),D=I.get("alignTo"),U=Fe(I.get("edgeDistance"),u),B=I.get("bleedMargin"),F=E.getModel("labelLine"),k=F.get("length");k=Fe(k,u);var G=F.get("length2");if(G=Fe(G,u),Math.abs(T.endAngle-T.startAngle)<o){N(C.states,p),C.ignore=!0,b&&(N(b.states,p),b.ignore=!0);return}if(d(C)){var Y=(T.startAngle+T.endAngle)/2,J=Math.cos(Y),Q=Math.sin(Y),V,K,ae,ve;i=T.cx,n=T.cy;var ue=R==="inside"||R==="inner";if(R==="center")V=T.cx,K=T.cy,ve="center";else{var se=(ue?(T.r+T.r0)/2*J:T.r*J)+i,Ee=(ue?(T.r+T.r0)/2*Q:T.r*Q)+n;if(V=se+J*3,K=Ee+Q*3,!ue){var q=se+J*(k+l-T.r),H=Ee+Q*(k+l-T.r),We=q+(J<0?-1:1)*G,_e=H;D==="edge"?V=J<0?c+U:c+u-U:V=We+(J<0?-A:A),K=_e,ae=[[se,Ee],[q,H],[We,_e]]}ve=ue?"center":D==="edge"?J>0?"right":"left":J>0?"left":"right"}var xe=Math.PI,Le=0,Ue=I.get("rotate");if(At(Ue))Le=Ue*(xe/180);else if(R==="center")Le=0;else if(Ue==="radial"||Ue===!0){var Ne=J<0?-Y+xe:-Y;Le=Ne}else if(Ue==="tangential"&&R!=="outside"&&R!=="outer"){var Ve=Math.atan2(J,Q);Ve<0&&(Ve=xe*2+Ve);var ct=Q>0;ct&&(Ve=xe+Ve),Le=Ve-xe}if(a=!!Le,C.x=V,C.y=K,C.rotation=Le,C.setStyle({verticalAlign:"middle"}),ue){C.setStyle({align:ve});var ne=C.states.select;ne&&(ne.x+=C.x,ne.y+=C.y)}else{var z=C.getBoundingRect().clone();z.applyTransform(C.getComputedTransform());var L=(C.style.margin||0)+2.1;z.y-=L/2,z.height+=L,t.push({label:C,labelLine:b,position:R,len:k,len2:G,minTurnAngle:F.get("minTurnAngle"),maxSurfaceAngle:F.get("maxSurfaceAngle"),surfaceNormal:new Nt(J,Q),linePoints:ae,textAlign:ve,labelDistance:A,labelAlignTo:D,edgeDistance:U,bleedMargin:B,rect:z,unconstrainedWidth:z.width,labelStyleWidth:C.style.width})}w.setTextConfig({inside:ue})}}),!a&&r.get("avoidLabelOverlap")&&Dme(t,i,n,l,u,h,c,f);for(var g=0;g<t.length;g++){var m=t[g],v=m.label,_=m.labelLine,y=isNaN(v.x)||isNaN(v.y);if(v){v.setStyle({align:m.textAlign}),y&&(N(v.states,p),v.ignore=!0);var x=v.states.select;x&&(x.x+=v.x,x.y+=v.y)}if(_){var M=m.linePoints;y||!M?(N(_.states,p),_.ignore=!0):(S2(M,m.minTurnAngle),A8(M,m.surfaceNormal,m.maxSurfaceAngle),_.setShape({points:M}),v.__hostTarget.textGuideLineConfig={anchor:new Nt(M[0][0],M[0][1])})}}}var Ime=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;a.z2=2;var o=new Lt;return a.setTextContent(o),a.updateData(t,i,n,!0),a}return e.prototype.updateData=function(t,i,n,a){var o=this,s=t.hostModel,l=t.getItemModel(i),u=l.getModel("emphasis"),c=t.getItemLayout(i),f=fe(Zl(l.getModel("itemStyle"),c,!0),c);if(isNaN(f.startAngle)){o.setShape(f);return}if(a){o.setShape(f);var h=s.getShallow("animationType");s.ecModel.ssr?(ar(o,{scaleX:0,scaleY:0},s,{dataIndex:i,isFrom:!0}),o.originX=f.cx,o.originY=f.cy):h==="scale"?(o.shape.r=c.r0,ar(o,{shape:{r:c.r}},s,i)):n!=null?(o.setShape({startAngle:n,endAngle:n}),ar(o,{shape:{startAngle:c.startAngle,endAngle:c.endAngle}},s,i)):(o.shape.endAngle=c.startAngle,Dt(o,{shape:{endAngle:c.endAngle}},s,i))}else Ii(o),Dt(o,{shape:f},s,i);o.useStyle(t.getItemVisual(i,"style")),Gr(o,l);var p=(c.startAngle+c.endAngle)/2,d=s.get("selectedOffset"),g=Math.cos(p)*d,m=Math.sin(p)*d,v=l.getShallow("cursor");v&&o.attr("cursor",v),this._updateLabel(s,t,i),o.ensureState("emphasis").shape=fe({r:c.r+(u.get("scale")&&u.get("scaleSize")||0)},Zl(u.getModel("itemStyle"),c)),fe(o.ensureState("select"),{x:g,y:m,shape:Zl(l.getModel(["select","itemStyle"]),c)}),fe(o.ensureState("blur"),{shape:Zl(l.getModel(["blur","itemStyle"]),c)});var _=o.getTextGuideLine(),y=o.getTextContent();_&&fe(_.ensureState("select"),{x:g,y:m}),fe(y.ensureState("select"),{x:g,y:m}),nr(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},e.prototype._updateLabel=function(t,i,n){var a=this,o=i.getItemModel(n),s=o.getModel("labelLine"),l=i.getItemVisual(n,"style"),u=l&&l.fill,c=l&&l.opacity;Nr(a,Tr(o),{labelFetcher:i.hostModel,labelDataIndex:n,inheritColor:u,defaultOpacity:c,defaultText:t.getFormattedLabel(n,"normal")||i.getName(n)});var f=a.getTextContent();a.setTextConfig({position:null,rotation:null}),f.attr({z2:10});var h=t.get(["label","position"]);if(h!=="outside"&&h!=="outer")a.removeTextGuideLine();else{var p=this.getTextGuideLine();p||(p=new $r,this.setTextGuideLine(p)),Sv(this,Mv(o),{stroke:u,opacity:Xi(s.get(["lineStyle","opacity"]),c,1)})}},e}(yi),Nme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.ignoreLabelLineUpdate=!0,t}return e.prototype.render=function(t,i,n,a){var o=t.getData(),s=this._data,l=this.group,u;if(!s&&o.count()>0){for(var c=o.getItemLayout(0),f=1;isNaN(c&&c.startAngle)&&f<o.count();++f)c=o.getItemLayout(f);c&&(u=c.startAngle)}if(this._emptyCircleSector&&l.remove(this._emptyCircleSector),o.count()===0&&t.get("showEmptyCircle")){var h=new yi({shape:iI(t,n)});h.useStyle(t.getModel("emptyCircleStyle").getItemStyle()),this._emptyCircleSector=h,l.add(h)}o.diff(s).add(function(p){var d=new Ime(o,p,u);o.setItemGraphicEl(p,d),l.add(d)}).update(function(p,d){var g=s.getItemGraphicEl(d);g.updateData(o,p,u),g.off("click"),l.add(g),o.setItemGraphicEl(p,g)}).remove(function(p){var d=s.getItemGraphicEl(p);Cu(d,t,p)}).execute(),oI(t),t.get("animationTypeUpdate")!=="expansion"&&(this._data=o)},e.prototype.dispose=function(){},e.prototype.containPoint=function(t,i){var n=i.getData(),a=n.getItemLayout(0);if(a){var o=t[0]-a.cx,s=t[1]-a.cy,l=Math.sqrt(o*o+s*s);return l<=a.r&&l>=a.r0}},e.type="pie",e}(Yt),NX=Nme;function To(r,e,t){e=pe(e)&&{coordDimensions:e}||fe({encodeDefine:r.getEncode()},e);var i=r.getSource(),n=js(i,e).dimensions,a=new ti(n,r);return a.initData(i,t),a}var Ume=function(){function r(e,t){this._getDataWithEncodedVisual=e,this._getRawData=t}return r.prototype.getAllNames=function(){var e=this._getRawData();return e.mapArray(e.getName)},r.prototype.containName=function(e){var t=this._getRawData();return t.indexOfName(e)>=0},r.prototype.indexOfName=function(e){var t=this._getDataWithEncodedVisual();return t.indexOfName(e)},r.prototype.getItemVisual=function(e,t){var i=this._getDataWithEncodedVisual();return i.getItemVisual(e,t)},r}(),jl=Ume;var Ome=vt(),Fme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new jl(Be(this.getData,this),Be(this.getRawData,this)),this._defaultLabelLine(t)},e.prototype.mergeOption=function(){r.prototype.mergeOption.apply(this,arguments)},e.prototype.getInitialData=function(){return To(this,{coordDimensions:["value"],encodeDefaulter:ot(uv,this)})},e.prototype.getDataParams=function(t){var i=this.getData(),n=Ome(i),a=n.seats;if(!a){var o=[];i.each(i.mapDimension("value"),function(l){o.push(l)}),a=n.seats=qL(o,i.hostModel.get("percentPrecision"))}var s=r.prototype.getDataParams.call(this,t);return s.percent=a[t]||0,s.$vars.push("percent"),s},e.prototype._defaultLabelLine=function(t){yo(t,"labelLine",["show"]);var i=t.labelLine,n=t.emphasis.labelLine;i.show=i.show&&t.label.show,n.show=n.show&&t.emphasis.label.show},e.type="series.pie",e.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",bleedMargin:10,distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:15,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},e}(jt),UX=Fme;function sI(r){return{seriesType:r,reset:function(e,t){var i=e.getData();i.filterSelf(function(n){var a=i.mapDimension("value"),o=i.get(a,n);return!(At(o)&&!isNaN(o)&&o<0)})}}}function lI(r){r.registerChartView(NX),r.registerSeriesModel(UX),r1("pie",r.registerAction),r.registerLayout(ot(nI,"pie")),r.registerProcessor(tl("pie")),r.registerProcessor(sI("pie"))}var zme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return t??(this.option.large?5e3:this.get("progressive"))},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return t??(this.option.large?1e4:this.get("progressiveThreshold"))},e.prototype.brushSelector=function(t,i,n){return n.point(i.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(jt),OX=zme;var FX=4,Bme=function(){function r(){}return r}(),kme=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i._off=0,i.hoverDataIdx=-1,i}return e.prototype.getDefaultShape=function(){return new Bme},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,i){var n=i.points,a=i.size,o=this.symbolProxy,s=o.shape,l=t.getContext?t.getContext():t,u=l&&a[0]<FX,c=this.softClipShape,f;if(u){this._ctx=l;return}for(this._ctx=null,f=this._off;f<n.length;){var h=n[f++],p=n[f++];isNaN(h)||isNaN(p)||c&&!c.contain(h,p)||(s.x=h-a[0]/2,s.y=p-a[1]/2,s.width=a[0],s.height=a[1],o.buildPath(t,s,!0))}this.incremental&&(this._off=f,this.notClear=!0)},e.prototype.afterBrush=function(){var t=this.shape,i=t.points,n=t.size,a=this._ctx,o=this.softClipShape,s;if(a){for(s=this._off;s<i.length;){var l=i[s++],u=i[s++];isNaN(l)||isNaN(u)||o&&!o.contain(l,u)||a.fillRect(l-n[0]/2,u-n[1]/2,n[0],n[1])}this.incremental&&(this._off=s,this.notClear=!0)}},e.prototype.findDataIndex=function(t,i){for(var n=this.shape,a=n.points,o=n.size,s=Math.max(o[0],4),l=Math.max(o[1],4),u=a.length/2-1;u>=0;u--){var c=u*2,f=a[c]-s/2,h=a[c+1]-l/2;if(t>=f&&i>=h&&t<=f+s&&i<=h+l)return u}return-1},e.prototype.contain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect();if(t=n[0],i=n[1],a.contain(t,i)){var o=this.hoverDataIdx=this.findDataIndex(t,i);return o>=0}return this.hoverDataIdx=-1,!1},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var i=this.shape,n=i.points,a=i.size,o=a[0],s=a[1],l=1/0,u=1/0,c=-1/0,f=-1/0,h=0;h<n.length;){var p=n[h++],d=n[h++];l=Math.min(p,l),c=Math.max(p,c),u=Math.min(d,u),f=Math.max(d,f)}t=this._rect=new lt(l-o/2,u-s/2,c-l+o,f-u+s)}return t},e}(ut),Vme=function(){function r(){this.group=new Ze}return r.prototype.updateData=function(e,t){this._clear();var i=this._create();i.setShape({points:e.getLayout("points")}),this._setCommon(i,e,t)},r.prototype.updateLayout=function(e){var t=e.getLayout("points");this.group.eachChild(function(i){if(i.startIndex!=null){var n=(i.endIndex-i.startIndex)*2,a=i.startIndex*4*2;t=new Float32Array(t.buffer,a,n)}i.setShape("points",t),i.reset()})},r.prototype.incrementalPrepareUpdate=function(e){this._clear()},r.prototype.incrementalUpdate=function(e,t,i){var n=this._newAdded[0],a=t.getLayout("points"),o=n&&n.shape.points;if(o&&o.length<2e4){var s=o.length,l=new Float32Array(s+a.length);l.set(o),l.set(a,s),n.endIndex=e.end,n.setShape({points:l})}else{this._newAdded=[];var u=this._create();u.startIndex=e.start,u.endIndex=e.end,u.incremental=!0,u.setShape({points:a}),this._setCommon(u,t,i)}},r.prototype.eachRendered=function(e){this._newAdded[0]&&e(this._newAdded[0])},r.prototype._create=function(){var e=new kme({cursor:"default"});return e.ignoreCoarsePointer=!0,this.group.add(e),this._newAdded.push(e),e},r.prototype._setCommon=function(e,t,i){var n=t.hostModel;i=i||{};var a=t.getVisual("symbolSize");e.setShape("size",a instanceof Array?a:[a,a]),e.softClipShape=i.clipShape||null,e.symbolProxy=Sr(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor;var o=e.shape.size[0]<FX;e.useStyle(n.getModel("itemStyle").getItemStyle(o?["color","shadowBlur","shadowColor"]:["color"]));var s=t.getVisual("style"),l=s&&s.fill;l&&e.setColor(l);var u=rt(e);u.seriesIndex=n.seriesIndex,e.on("mousemove",function(c){u.dataIndex=null;var f=e.hoverDataIdx;f>=0&&(u.dataIndex=f+(e.startIndex||0))})},r.prototype.remove=function(){this._clear()},r.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},r}(),zX=Vme;var Gme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this._updateSymbolDraw(a,t);o.updateData(a,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,i,n){var a=t.getData(),o=this._updateSymbolDraw(a,t);o.incrementalPrepareUpdate(a),this._finished=!1},e.prototype.incrementalRender=function(t,i,n){this._symbolDraw.incrementalUpdate(t,i.getData(),{clipShape:this._getClipShape(i)}),this._finished=t.end===i.getData().count()},e.prototype.updateTransform=function(t,i,n){var a=t.getData();if(this.group.dirty(),!this._finished||a.count()>1e4)return{update:!0};var o=el("").reset(t,i,n);o.progress&&o.progress({start:0,end:a.count(),count:a.count()},a),this._symbolDraw.updateLayout(a)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){if(t.get("clip",!0)){var i=t.coordinateSystem;return i&&i.getArea&&i.getArea(.1)}},e.prototype._updateSymbolDraw=function(t,i){var n=this._symbolDraw,a=i.pipelineContext,o=a.large;return(!n||o!==this._isLargeDraw)&&(n&&n.remove(),n=this._symbolDraw=o?new zX:new Yl,this._isLargeDraw=o,this.group.removeAll()),this.group.add(n.group),n},e.prototype.remove=function(t,i){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}(Yt),BX=Gme;var Hme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(Pt),kX=Hme;var rT=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Cr).models[0]},e.type="cartesian2dAxis",e}(Pt);wr(rT,Gl);var VX={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},Wme=_t({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},VX),uI=_t({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},VX),Xme=_t({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},uI),Yme=Ye({logBase:10},uI),iT={category:Wme,value:uI,time:Xme,log:Yme};var GX={value:1,category:1,time:1,log:1};function rl(r,e,t,i){N(GX,function(n,a){var o=_t(_t({},iT[a],!0),i,!0),s=function(l){Z(u,l);function u(){var c=l!==null&&l.apply(this,arguments)||this;return c.type=e+"Axis."+a,c}return u.prototype.mergeDefaultAndTheme=function(c,f){var h=Af(this),p=h?rs(c):{},d=f.getTheme();_t(c,d.get(a+"Axis")),_t(c,this.getDefaultOption()),c.type=HX(c),h&&za(c,p,h)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=rx.createByAxisModel(this))},u.prototype.getCategories=function(c){var f=this.option;if(f.type==="category")return c?f.data:this.__ordinalMeta.categories},u.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},u.type=e+"Axis."+a,u.defaultOption=o,u}(t);r.registerComponentModel(s)}),r.registerSubTypeDefaulter(e+"Axis",HX)}function HX(r){return r.type||(r.data?"category":"value")}var qme=function(){function r(e){this.type="cartesian",this._dimList=[],this._axes={},this.name=e||""}return r.prototype.getAxis=function(e){return this._axes[e]},r.prototype.getAxes=function(){return de(this._dimList,function(e){return this._axes[e]},this)},r.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Wt(this.getAxes(),function(t){return t.scale.type===e})},r.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},r}(),WX=qme;var nT=["x","y"];function XX(r){return r.type==="interval"||r.type==="time"}var Zme=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=nT,t}return e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,i=this.getAxis("y").scale;if(!(!XX(t)||!XX(i))){var n=t.getExtent(),a=i.getExtent(),o=this.dataToPoint([n[0],a[0]]),s=this.dataToPoint([n[1],a[1]]),l=n[1]-n[0],u=a[1]-a[0];if(!(!l||!u)){var c=(s[0]-o[0])/l,f=(s[1]-o[1])/u,h=o[0]-n[0]*c,p=o[1]-a[0]*f,d=this._transform=[c,0,0,f,h,p];this._invTransform=Yo([],d)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(t){var i=this.getAxis("x"),n=this.getAxis("y");return i.contain(i.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},e.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},e.prototype.containZone=function(t,i){var n=this.dataToPoint(t),a=this.dataToPoint(i),o=this.getArea(),s=new lt(n[0],n[1],a[0]-n[0],a[1]-n[1]);return o.intersect(s)},e.prototype.dataToPoint=function(t,i,n){n=n||[];var a=t[0],o=t[1];if(this._transform&&a!=null&&isFinite(a)&&o!=null&&isFinite(o))return fi(n,t,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return n[0]=s.toGlobalCoord(s.dataToCoord(a,i)),n[1]=l.toGlobalCoord(l.dataToCoord(o,i)),n},e.prototype.clampData=function(t,i){var n=this.getAxis("x").scale,a=this.getAxis("y").scale,o=n.getExtent(),s=a.getExtent(),l=n.parse(t[0]),u=a.parse(t[1]);return i=i||[],i[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),i[1]=Math.min(Math.max(Math.min(s[0],s[1]),u),Math.max(s[0],s[1])),i},e.prototype.pointToData=function(t,i){var n=[];if(this._invTransform)return fi(n,t,this._invTransform);var a=this.getAxis("x"),o=this.getAxis("y");return n[0]=a.coordToData(a.toLocalCoord(t[0]),i),n[1]=o.coordToData(o.toLocalCoord(t[1]),i),n},e.prototype.getOtherAxis=function(t){return this.getAxis(t.dim==="x"?"y":"x")},e.prototype.getArea=function(t){t=t||0;var i=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),a=Math.min(i[0],i[1])-t,o=Math.min(n[0],n[1])-t,s=Math.max(i[0],i[1])-a+t,l=Math.max(n[0],n[1])-o+t;return new lt(a,o,s,l)},e}(WX),YX=Zme;var jme=function(r){Z(e,r);function e(t,i,n,a,o){var s=r.call(this,t,i,n)||this;return s.index=0,s.type=a||"value",s.position=o||"bottom",s}return e.prototype.isHorizontal=function(){var t=this.position;return t==="top"||t==="bottom"},e.prototype.getGlobalExtent=function(t){var i=this.getExtent();return i[0]=this.toGlobalCoord(i[0]),i[1]=this.toGlobalCoord(i[1]),t&&i[0]>i[1]&&i.reverse(),i},e.prototype.pointToData=function(t,i){return this.coordToData(this.toLocalCoord(t[this.dim==="x"?0:1]),i)},e.prototype.setCategorySortInfo=function(t){if(this.type!=="category")return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},e}(pn),qX=jme;function gx(r,e,t){t=t||{};var i=r.coordinateSystem,n=e.axis,a={},o=n.getAxesOnZeroOf()[0],s=n.position,l=o?"onZero":s,u=n.dim,c=i.getRect(),f=[c.x,c.x+c.width,c.y,c.y+c.height],h={left:0,right:1,top:0,bottom:1,onZero:2},p=e.get("offset")||0,d=u==="x"?[f[2]-p,f[3]+p]:[f[0]-p,f[1]+p];if(o){var g=o.toGlobalCoord(o.dataToCoord(0));d[h.onZero]=Math.max(Math.min(g,d[1]),d[0])}a.position=[u==="y"?d[h[l]]:f[0],u==="x"?d[h[l]]:f[3]],a.rotation=Math.PI/2*(u==="x"?0:1);var m={top:-1,bottom:1,left:-1,right:1};a.labelDirection=a.tickDirection=a.nameDirection=m[s],a.labelOffset=o?d[h[s]]-d[h.onZero]:0,e.get(["axisTick","inside"])&&(a.tickDirection=-a.tickDirection),Br(t.labelInside,e.get(["axisLabel","inside"]))&&(a.labelDirection=-a.labelDirection);var v=e.get(["axisLabel","rotate"]);return a.labelRotate=l==="top"?-v:v,a.z2=1,a}function cI(r){return r.get("coordinateSystem")==="cartesian2d"}function fI(r){var e={xAxisModel:null,yAxisModel:null};return N(e,function(t,i){var n=i.replace(/Model$/,""),a=r.getReferringComponents(n,Cr).models[0];e[i]=a}),e}var hI=Math.log;function aT(r,e,t){var i=Ha.prototype,n=i.getTicks.call(t),a=i.getTicks.call(t,!0),o=n.length-1,s=i.getInterval.call(t),l=p2(r,e),u=l.extent,c=l.fixMin,f=l.fixMax;if(r.type==="log"){var h=hI(r.base);u=[hI(u[0])/h,hI(u[1])/h]}r.setExtent(u[0],u[1]),r.calcNiceExtent({splitNumber:o,fixMin:c,fixMax:f});var p=i.getExtent.call(r);c&&(u[0]=p[0]),f&&(u[1]=p[1]);var d=i.getInterval.call(r),g=u[0],m=u[1];if(c&&f)d=(m-g)/o;else if(c)for(m=u[0]+d*o;m<u[1]&&isFinite(m)&&isFinite(u[1]);)d=_1(d),m=u[0]+d*o;else if(f)for(g=u[1]-d*o;g>u[0]&&isFinite(g)&&isFinite(u[0]);)d=_1(d),g=u[1]-d*o;else{var v=r.getTicks().length-1;v>o&&(d=_1(d));var _=d*o;m=Math.ceil(u[1]/d)*d,g=Ar(m-_),g<0&&u[0]>=0?(g=0,m=Ar(_)):m>0&&u[1]<=0&&(m=0,g=-Ar(_))}var y=(n[0].value-a[0].value)/s,x=(n[o].value-a[o].value)/s;if(i.setExtent.call(r,g+d*y,m+d*x),i.setInterval.call(r,d),(y||x)&&i.setNiceExtent.call(r,g+d,m-d),0)var M}var Kme=function(){function r(e,t,i){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=nT,this._initCartesian(e,t,i),this.model=e}return r.prototype.getRect=function(){return this._rect},r.prototype.update=function(e,t){var i=this._axesMap;this._updateScale(e,this.model);function n(o){var s,l=bt(o),u=l.length;if(u){for(var c=[],f=u-1;f>=0;f--){var h=+l[f],p=o[h],d=p.model,g=p.scale;ix(g)&&d.get("alignTicks")&&d.get("interval")==null?c.push(p):(Vl(g,d),ix(g)&&(s=p))}c.length&&(s||(s=c.pop(),Vl(s.scale,s.model)),N(c,function(m){aT(m.scale,m.model,s.scale)}))}}n(i.x),n(i.y);var a={};N(i.x,function(o){jX(i,"y",o,a)}),N(i.y,function(o){jX(i,"x",o,a)}),this.resize(this.model,t)},r.prototype.resize=function(e,t,i){var n=e.getBoxLayoutParams(),a=!i&&e.get("containLabel"),o=xr(n,{width:t.getWidth(),height:t.getHeight()});this._rect=o;var s=this._axesList;l(),a&&(N(s,function(u){if(!u.model.get(["axisLabel","inside"])){var c=s8(u);if(c){var f=u.isHorizontal()?"height":"width",h=u.model.get(["axisLabel","margin"]);o[f]-=c[f]+h,u.position==="top"?o.y+=c.height+h:u.position==="left"&&(o.x+=c.width+h)}}}),l()),N(this._coordsList,function(u){u.calcAffineTransform()});function l(){N(s,function(u){var c=u.isHorizontal(),f=c?[0,o.width]:[0,o.height],h=u.inverse?1:0;u.setExtent(f[h],f[1-h]),Jme(u,c?o.x:o.y)})}},r.prototype.getAxis=function(e,t){var i=this._axesMap[e];if(i!=null)return i[t||0]},r.prototype.getAxes=function(){return this._axesList.slice()},r.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var i="x"+e+"y"+t;return this._coordsMap[i]}qe(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var n=0,a=this._coordsList;n<a.length;n++)if(a[n].getAxis("x").index===e||a[n].getAxis("y").index===t)return a[n]},r.prototype.getCartesians=function(){return this._coordsList.slice()},r.prototype.convertToPixel=function(e,t,i){var n=this._findConvertTarget(t);return n.cartesian?n.cartesian.dataToPoint(i):n.axis?n.axis.toGlobalCoord(n.axis.dataToCoord(i)):null},r.prototype.convertFromPixel=function(e,t,i){var n=this._findConvertTarget(t);return n.cartesian?n.cartesian.pointToData(i):n.axis?n.axis.coordToData(n.axis.toLocalCoord(i)):null},r.prototype._findConvertTarget=function(e){var t=e.seriesModel,i=e.xAxisModel||t&&t.getReferringComponents("xAxis",Cr).models[0],n=e.yAxisModel||t&&t.getReferringComponents("yAxis",Cr).models[0],a=e.gridModel,o=this._coordsList,s,l;if(t)s=t.coordinateSystem,dt(o,s)<0&&(s=null);else if(i&&n)s=this.getCartesian(i.componentIndex,n.componentIndex);else if(i)l=this.getAxis("x",i.componentIndex);else if(n)l=this.getAxis("y",n.componentIndex);else if(a){var u=a.coordinateSystem;u===this&&(s=this._coordsList[0])}return{cartesian:s,axis:l}},r.prototype.containPoint=function(e){var t=this._coordsList[0];if(t)return t.containPoint(e)},r.prototype._initCartesian=function(e,t,i){var n=this,a=this,o={left:!1,right:!1,top:!1,bottom:!1},s={x:{},y:{}},l={x:0,y:0};if(t.eachComponent("xAxis",u("x"),this),t.eachComponent("yAxis",u("y"),this),!l.x||!l.y){this._axesMap={},this._axesList=[];return}this._axesMap=s,N(s.x,function(c,f){N(s.y,function(h,p){var d="x"+f+"y"+p,g=new YX(d);g.master=n,g.model=e,n._coordsMap[d]=g,n._coordsList.push(g),g.addAxis(c),g.addAxis(h)})});function u(c){return function(f,h){if(pI(f,e)){var p=f.get("position");c==="x"?p!=="top"&&p!=="bottom"&&(p=o.bottom?"top":"bottom"):p!=="left"&&p!=="right"&&(p=o.left?"right":"left"),o[p]=!0;var d=new qX(c,zf(f),[0,0],f.get("type"),p),g=d.type==="category";d.onBand=g&&f.get("boundaryGap"),d.inverse=f.get("inverse"),f.axis=d,d.model=f,d.grid=a,d.index=h,a._axesList.push(d),s[c][h]=d,l[c]++}}}},r.prototype._updateScale=function(e,t){N(this._axesList,function(n){if(n.scale.setExtent(1/0,-1/0),n.type==="category"){var a=n.model.get("categorySortInfo");n.scale.setSortInfo(a)}}),e.eachSeries(function(n){if(cI(n)){var a=fI(n),o=a.xAxisModel,s=a.yAxisModel;if(!pI(o,t)||!pI(s,t))return;var l=this.getCartesian(o.componentIndex,s.componentIndex),u=n.getData(),c=l.getAxis("x"),f=l.getAxis("y");i(u,c),i(u,f)}},this);function i(n,a){N(_v(n,a.dim),function(o){a.scale.unionExtentFromData(n,o)})}},r.prototype.getTooltipAxes=function(e){var t=[],i=[];return N(this.getCartesians(),function(n){var a=e!=null&&e!=="auto"?n.getAxis(e):n.getBaseAxis(),o=n.getOtherAxis(a);dt(t,a)<0&&t.push(a),dt(i,o)<0&&i.push(o)}),{baseAxes:t,otherAxes:i}},r.create=function(e,t){var i=[];return e.eachComponent("grid",function(n,a){var o=new r(n,e,t);o.name="grid_"+a,o.resize(n,t,!0),n.coordinateSystem=o,i.push(o)}),e.eachSeries(function(n){if(cI(n)){var a=fI(n),o=a.xAxisModel,s=a.yAxisModel,l=o.getCoordSysModel(),u=l.coordinateSystem;n.coordinateSystem=u.getCartesian(o.componentIndex,s.componentIndex)}}),i},r.dimensions=nT,r}();function pI(r,e){return r.getCoordSysModel()===e}function jX(r,e,t,i){t.getAxesOnZeroOf=function(){return a?[a]:[]};var n=r[e],a,o=t.model,s=o.get(["axisLine","onZero"]),l=o.get(["axisLine","onZeroAxisIndex"]);if(!s)return;if(l!=null)KX(n[l])&&(a=n[l]);else for(var u in n)if(n.hasOwnProperty(u)&&KX(n[u])&&!i[c(n[u])]){a=n[u];break}a&&(i[c(a)]=!0);function c(f){return f.dim+"_"+f.index}}function KX(r){return r&&r.type!=="category"&&r.type!=="time"&&o8(r)}function Jme(r,e){var t=r.getExtent(),i=t[0]+t[1];r.toGlobalCoord=r.dim==="x"?function(n){return n+e}:function(n){return i-n+e},r.toLocalCoord=r.dim==="x"?function(n){return n-e}:function(n){return i-n+e}}var JX=Kme;var Hf=Math.PI,Qp=function(){function r(e,t){this.group=new Ze,this.opt=t,this.axisModel=e,Ye(t,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var i=new Ze({x:t.position[0],y:t.position[1],rotation:t.rotation});i.updateTransform(),this._transformGroup=i}return r.prototype.hasBuilder=function(e){return!!$X[e]},r.prototype.add=function(e){$X[e](this.opt,this.axisModel,this.group,this._transformGroup)},r.prototype.getGroup=function(){return this.group},r.innerTextLayout=function(e,t,i){var n=t_(t-e),a,o;return Su(n)?(o=i>0?"top":"bottom",a="center"):Su(n-Hf)?(o=i>0?"bottom":"top",a="center"):(o="middle",n>0&&n<Hf?a=i>0?"right":"left":a=i>0?"left":"right"),{rotation:n,textAlign:a,textVerticalAlign:o}},r.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+"Index"]=e.componentIndex,t},r.isLabelSilent=function(e){var t=e.get("tooltip");return e.get("silent")||!(e.get("triggerEvent")||t&&t.show)},r}(),$X={axisLine:function(r,e,t,i){var n=e.get(["axisLine","show"]);if(n==="auto"&&r.handleAutoShown&&(n=r.handleAutoShown("axisLine")),!!n){var a=e.axis.getExtent(),o=i.transform,s=[a[0],0],l=[a[1],0],u=s[0]>l[0];o&&(fi(s,s,o),fi(l,l,o));var c=fe({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),f=new Kr({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:r.strokeContainThreshold||5,silent:!0,z2:1});Ru(f.shape,f.style.lineWidth),f.anid="line",t.add(f);var h=e.get(["axisLine","symbol"]);if(h!=null){var p=e.get(["axisLine","symbolSize"]);Ce(h)&&(h=[h,h]),(Ce(p)||At(p))&&(p=[p,p]);var d=bo(e.get(["axisLine","symbolOffset"])||0,p),g=p[0],m=p[1];N([{rotate:r.rotation+Math.PI/2,offset:d[0],r:0},{rotate:r.rotation-Math.PI/2,offset:d[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(v,_){if(h[_]!=="none"&&h[_]!=null){var y=Sr(h[_],-g/2,-m/2,g,m,c.stroke,!0),x=v.r+v.offset,M=u?l:s;y.attr({rotation:v.rotate,x:M[0]+x*Math.cos(r.rotation),y:M[1]-x*Math.sin(r.rotation),silent:!0,z2:11}),t.add(y)}})}}},axisTickLabel:function(r,e,t,i){var n=eve(t,i,e,r),a=rve(t,i,e,r);if(Qme(e,a,n),tve(t,i,e,r.tickDirection),e.get(["axisLabel","hideOverlap"])){var o=U1(de(a,function(s){return{label:s,priority:s.z2,defaultAttr:{ignore:s.ignore}}}));F1(o)}},axisName:function(r,e,t,i){var n=Br(r.axisName,e.get("name"));if(n){var a=e.get("nameLocation"),o=r.nameDirection,s=e.getModel("nameTextStyle"),l=e.get("nameGap")||0,u=e.axis.getExtent(),c=u[0]>u[1]?-1:1,f=[a==="start"?u[0]-c*l:a==="end"?u[1]+c*l:(u[0]+u[1])/2,e9(a)?r.labelOffset+o*l:0],h,p=e.get("nameRotate");p!=null&&(p=p*Hf/180);var d;e9(a)?h=Qp.innerTextLayout(r.rotation,p??r.rotation,o):(h=$me(r.rotation,a,p||0,u),d=r.axisNameAvailableWidth,d!=null&&(d=Math.abs(d/Math.sin(h.rotation)),!isFinite(d)&&(d=null)));var g=s.getFont(),m=e.get("nameTruncate",!0)||{},v=m.ellipsis,_=Br(r.nameTruncateMaxWidth,m.maxWidth,d),y=new Lt({x:f[0],y:f[1],rotation:h.rotation,silent:Qp.isLabelSilent(e),style:fr(s,{text:n,font:g,overflow:"truncate",width:_,ellipsis:v,fill:s.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:s.get("align")||h.textAlign,verticalAlign:s.get("verticalAlign")||h.textVerticalAlign}),z2:1});if(Vs({el:y,componentModel:e,itemName:n}),y.__fullText=n,y.anid="name",e.get("triggerEvent")){var x=Qp.makeAxisEventDataBase(e);x.targetType="axisName",x.name=n,rt(y).eventData=x}i.add(y),y.updateTransform(),t.add(y),y.decomposeTransform()}}};function $me(r,e,t,i){var n=t_(t-r),a,o,s=i[0]>i[1],l=e==="start"&&!s||e!=="start"&&s;return Su(n-Hf/2)?(o=l?"bottom":"top",a="center"):Su(n-Hf*1.5)?(o=l?"top":"bottom",a="center"):(o="middle",n<Hf*1.5&&n>Hf/2?a=l?"left":"right":a=l?"right":"left"),{rotation:n,textAlign:a,textVerticalAlign:o}}function Qme(r,e,t){if(!L1(r.axis)){var i=r.get(["axisLabel","showMinLabel"]),n=r.get(["axisLabel","showMaxLabel"]);e=e||[],t=t||[];var a=e[0],o=e[1],s=e[e.length-1],l=e[e.length-2],u=t[0],c=t[1],f=t[t.length-1],h=t[t.length-2];i===!1?(us(a),us(u)):QX(a,o)&&(i?(us(o),us(c)):(us(a),us(u))),n===!1?(us(s),us(f)):QX(l,s)&&(n?(us(l),us(h)):(us(s),us(f)))}}function us(r){r&&(r.ignore=!0)}function QX(r,e){var t=r&&r.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(!(!t||!i)){var n=uf([]);return Ca(n,n,-r.rotation),t.applyTransform(Aa([],n,r.getLocalTransform())),i.applyTransform(Aa([],n,e.getLocalTransform())),t.intersect(i)}}function e9(r){return r==="middle"||r==="center"}function t9(r,e,t,i,n){for(var a=[],o=[],s=[],l=0;l<r.length;l++){var u=r[l].coord;o[0]=u,o[1]=0,s[0]=u,s[1]=t,e&&(fi(o,o,e),fi(s,s,e));var c=new Kr({shape:{x1:o[0],y1:o[1],x2:s[0],y2:s[1]},style:i,z2:2,autoBatch:!0,silent:!0});Ru(c.shape,c.style.lineWidth),c.anid=n+"_"+r[l].tickValue,a.push(c)}return a}function eve(r,e,t,i){var n=t.axis,a=t.getModel("axisTick"),o=a.get("show");if(o==="auto"&&i.handleAutoShown&&(o=i.handleAutoShown("axisTick")),!(!o||n.scale.isBlank())){for(var s=a.getModel("lineStyle"),l=i.tickDirection*a.get("length"),u=n.getTicksCoords(),c=t9(u,e.transform,l,Ye(s.getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])}),"ticks"),f=0;f<c.length;f++)r.add(c[f]);return c}}function tve(r,e,t,i){var n=t.axis,a=t.getModel("minorTick");if(!(!a.get("show")||n.scale.isBlank())){var o=n.getMinorTicksCoords();if(o.length)for(var s=a.getModel("lineStyle"),l=i*a.get("length"),u=Ye(s.getLineStyle(),Ye(t.getModel("axisTick").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})),c=0;c<o.length;c++)for(var f=t9(o[c],e.transform,l,u,"minorticks_"+c),h=0;h<f.length;h++)r.add(f[h])}}function rve(r,e,t,i){var n=t.axis,a=Br(i.axisLabelShow,t.get(["axisLabel","show"]));if(!(!a||n.scale.isBlank())){var o=t.getModel("axisLabel"),s=o.get("margin"),l=n.getViewLabels(),u=(Br(i.labelRotate,o.get("rotate"))||0)*Hf/180,c=Qp.innerTextLayout(i.rotation,u,i.labelDirection),f=t.getCategories&&t.getCategories(!0),h=[],p=Qp.isLabelSilent(t),d=t.get("triggerEvent");return N(l,function(g,m){var v=n.scale.type==="ordinal"?n.scale.getRawOrdinalNumber(g.tickValue):g.tickValue,_=g.formattedLabel,y=g.rawLabel,x=o;if(f&&f[v]){var M=f[v];qe(M)&&M.textStyle&&(x=new Zt(M.textStyle,o,t.ecModel))}var S=x.getTextColor()||t.get(["axisLine","lineStyle","color"]),w=n.dataToCoord(v),T=x.getShallow("align",!0)||c.textAlign,C=ft(x.getShallow("alignMinLabel",!0),T),b=ft(x.getShallow("alignMaxLabel",!0),T),E=x.getShallow("verticalAlign",!0)||x.getShallow("baseline",!0)||c.textVerticalAlign,I=ft(x.getShallow("verticalAlignMinLabel",!0),E),R=ft(x.getShallow("verticalAlignMaxLabel",!0),E),A=new Lt({x:w,y:i.labelOffset+i.labelDirection*s,rotation:c.rotation,silent:p,z2:10+(g.level||0),style:fr(x,{text:_,align:m===0?C:m===l.length-1?b:T,verticalAlign:m===0?I:m===l.length-1?R:E,fill:He(S)?S(n.type==="category"?y:n.type==="value"?v+"":v,m):S})});if(A.anid="label_"+v,d){var D=Qp.makeAxisEventDataBase(t);D.targetType="axisLabel",D.value=y,D.tickIndex=m,n.type==="category"&&(D.dataIndex=v),rt(A).eventData=D}e.add(A),A.updateTransform(),h.push(A),r.add(A),A.decomposeTransform()}),h}}var Cn=Qp;function r9(r,e){var t={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return ive(t,r,e),t.seriesInvolved&&ave(t,r),t}function ive(r,e,t){var i=e.getComponent("tooltip"),n=e.getComponent("axisPointer"),a=n.get("link",!0)||[],o=[];N(t.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=Ev(s.model),u=r.coordSysAxesInfo[l]={};r.coordSysMap[l]=s;var c=s.model,f=c.getModel("tooltip",i);if(N(s.getAxes(),ot(g,!1,null)),s.getTooltipAxes&&i&&f.get("show")){var h=f.get("trigger")==="axis",p=f.get(["axisPointer","type"])==="cross",d=s.getTooltipAxes(f.get(["axisPointer","axis"]));(h||p)&&N(d.baseAxes,ot(g,p?"cross":!0,h)),p&&N(d.otherAxes,ot(g,"cross",!1))}function g(m,v,_){var y=_.model.getModel("axisPointer",n),x=y.get("show");if(!(!x||x==="auto"&&!m&&!mI(y))){v==null&&(v=y.get("triggerTooltip")),y=m?nve(_,f,n,e,m,v):y;var M=y.get("snap"),S=y.get("triggerEmphasis"),w=Ev(_.model),T=v||M||_.type==="category",C=r.axesInfo[w]={key:w,axis:_,coordSys:s,axisPointerModel:y,triggerTooltip:v,triggerEmphasis:S,involveSeries:T,snap:M,useHandle:mI(y),seriesModels:[],linkGroup:null};u[w]=C,r.seriesInvolved=r.seriesInvolved||T;var b=ove(a,_);if(b!=null){var E=o[b]||(o[b]={axesInfo:{}});E.axesInfo[w]=C,E.mapper=a[b].mapper,C.linkGroup=E}}}})}function nve(r,e,t,i,n,a){var o=e.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};N(s,function(h){l[h]=Qe(o.get(h))}),l.snap=r.type!=="category"&&!!a,o.get("type")==="cross"&&(l.type="line");var u=l.label||(l.label={});if(u.show==null&&(u.show=!1),n==="cross"){var c=o.get(["label","show"]);if(u.show=c??!0,!a){var f=l.lineStyle=o.get("crossStyle");f&&Ye(u,f.textStyle)}}return r.model.getModel("axisPointer",new Zt(l,t,i))}function ave(r,e){e.eachSeries(function(t){var i=t.coordinateSystem,n=t.get(["tooltip","trigger"],!0),a=t.get(["tooltip","show"],!0);!i||n==="none"||n===!1||n==="item"||a===!1||t.get(["axisPointer","show"],!0)===!1||N(r.coordSysAxesInfo[Ev(i.model)],function(o){var s=o.axis;i.getAxis(s.dim)===s&&(o.seriesModels.push(t),o.seriesDataCount==null&&(o.seriesDataCount=0),o.seriesDataCount+=t.getData().count())})})}function ove(r,e){for(var t=e.model,i=e.dim,n=0;n<r.length;n++){var a=r[n]||{};if(dI(a[i+"AxisId"],t.id)||dI(a[i+"AxisIndex"],t.componentIndex)||dI(a[i+"AxisName"],t.name))return n}}function dI(r,e){return r==="all"||pe(r)&&dt(r,e)>=0||r===e}function i9(r){var e=oT(r);if(e){var t=e.axisPointerModel,i=e.axis.scale,n=t.option,a=t.get("status"),o=t.get("value");o!=null&&(o=i.parse(o));var s=mI(t);a==null&&(n.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(o==null||o>l[1])&&(o=l[1]),o<l[0]&&(o=l[0]),n.value=o,s&&(n.status=e.axis.scale.isBlank()?"hide":"show")}}function oT(r){var e=(r.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[Ev(r)]}function n9(r){var e=oT(r);return e&&e.axisPointerModel}function mI(r){return!!r.get(["handle","show"])}function Ev(r){return r.type+"||"+r.id}var a9={},sve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){this.axisPointerClass&&i9(t),r.prototype.render.apply(this,arguments),this._doUpdateAxisPointerClass(t,n,!0)},e.prototype.updateAxisPointer=function(t,i,n,a){this._doUpdateAxisPointerClass(t,n,!1)},e.prototype.remove=function(t,i){var n=this._axisPointer;n&&n.remove(i)},e.prototype.dispose=function(t,i){this._disposeAxisPointer(i),r.prototype.dispose.apply(this,arguments)},e.prototype._doUpdateAxisPointerClass=function(t,i,n){var a=e.getAxisPointerClass(this.axisPointerClass);if(a){var o=n9(t);o?(this._axisPointer||(this._axisPointer=new a)).render(t,o,i,n):this._disposeAxisPointer(i)}},e.prototype._disposeAxisPointer=function(t){this._axisPointer&&this._axisPointer.dispose(t),this._axisPointer=null},e.registerAxisPointerClass=function(t,i){a9[t]=i},e.getAxisPointerClass=function(t){return t&&a9[t]},e.type="axis",e}(Qt),Wa=sve;var gI=vt();function sT(r,e,t,i){var n=t.axis;if(!n.scale.isBlank()){var a=t.getModel("splitArea"),o=a.getModel("areaStyle"),s=o.get("color"),l=i.coordinateSystem.getRect(),u=n.getTicksCoords({tickModel:a,clamp:!0});if(u.length){var c=s.length,f=gI(r).splitAreaColors,h=ke(),p=0;if(f)for(var d=0;d<u.length;d++){var g=f.get(u[d].tickValue);if(g!=null){p=(g+(c-1)*d)%c;break}}var m=n.toGlobalCoord(u[0].coord),v=o.getAreaStyle();s=pe(s)?s:[s];for(var d=1;d<u.length;d++){var _=n.toGlobalCoord(u[d].coord),y=void 0,x=void 0,M=void 0,S=void 0;n.isHorizontal()?(y=m,x=l.y,M=_-y,S=l.height,m=y+M):(y=l.x,x=m,M=l.width,S=_-x,m=x+S);var w=u[d-1].tickValue;w!=null&&h.set(w,p),e.add(new Tt({anid:w!=null?"area_"+w:null,shape:{x:y,y:x,width:M,height:S},style:Ye({fill:s[p]},v),autoBatch:!0,silent:!0})),p=(p+1)%c}gI(r).splitAreaColors=h}}}function lT(r){gI(r).splitAreaColors=null}var lve=["axisLine","axisTickLabel","axisName"],uve=["splitArea","splitLine","minorSplitLine"],o9=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="CartesianAxisPointer",t}return e.prototype.render=function(t,i,n,a){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Ze,this.group.add(this._axisGroup),!!t.get("show")){var s=t.getCoordSysModel(),l=gx(s,t),u=new Cn(t,fe({handleAutoShown:function(f){for(var h=s.coordinateSystem.getCartesians(),p=0;p<h.length;p++)if(ix(h[p].getOtherAxis(t.axis).scale))return!0;return!1}},l));N(lve,u.add,u),this._axisGroup.add(u.getGroup()),N(uve,function(f){t.get([f,"show"])&&cve[f](this,this._axisGroup,t,s)},this);var c=a&&a.type==="changeAxisOrder"&&a.isInitSort;c||Lu(o,this._axisGroup,t),r.prototype.render.call(this,t,i,n,a)}},e.prototype.remove=function(){lT(this)},e.type="cartesianAxis",e}(Wa),cve={splitLine:function(r,e,t,i){var n=t.axis;if(!n.scale.isBlank()){var a=t.getModel("splitLine"),o=a.getModel("lineStyle"),s=o.get("color");s=pe(s)?s:[s];for(var l=i.coordinateSystem.getRect(),u=n.isHorizontal(),c=0,f=n.getTicksCoords({tickModel:a}),h=[],p=[],d=o.getLineStyle(),g=0;g<f.length;g++){var m=n.toGlobalCoord(f[g].coord);u?(h[0]=m,h[1]=l.y,p[0]=m,p[1]=l.y+l.height):(h[0]=l.x,h[1]=m,p[0]=l.x+l.width,p[1]=m);var v=c++%s.length,_=f[g].tickValue,y=new Kr({anid:_!=null?"line_"+f[g].tickValue:null,autoBatch:!0,shape:{x1:h[0],y1:h[1],x2:p[0],y2:p[1]},style:Ye({stroke:s[v]},d),silent:!0});Ru(y.shape,d.lineWidth),e.add(y)}}},minorSplitLine:function(r,e,t,i){var n=t.axis,a=t.getModel("minorSplitLine"),o=a.getModel("lineStyle"),s=i.coordinateSystem.getRect(),l=n.isHorizontal(),u=n.getMinorTicksCoords();if(u.length)for(var c=[],f=[],h=o.getLineStyle(),p=0;p<u.length;p++)for(var d=0;d<u[p].length;d++){var g=n.toGlobalCoord(u[p][d].coord);l?(c[0]=g,c[1]=s.y,f[0]=g,f[1]=s.y+s.height):(c[0]=s.x,c[1]=g,f[0]=s.x+s.width,f[1]=g);var m=new Kr({anid:"minor_line_"+u[p][d].tickValue,autoBatch:!0,shape:{x1:c[0],y1:c[1],x2:f[0],y2:f[1]},style:h,silent:!0});Ru(m.shape,h.lineWidth),e.add(m)}},splitArea:function(r,e,t,i){sT(r,e,t,i)}},yI=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="xAxis",e}(o9);var s9=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=yI.type,t}return e.type="yAxis",e}(o9);var fve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="grid",t}return e.prototype.render=function(t,i){this.group.removeAll(),t.get("show")&&this.group.add(new Tt({shape:t.coordinateSystem.getRect(),style:Ye({fill:t.get("backgroundColor")},t.getItemStyle()),silent:!0,z2:-1}))},e.type="grid",e}(Qt),l9={offset:0};function uT(r){r.registerComponentView(fve),r.registerComponentModel(kX),r.registerCoordinateSystem("cartesian2d",JX),rl(r,"x",rT,l9),rl(r,"y",rT,l9),r.registerComponentView(yI),r.registerComponentView(s9),r.registerPreprocessor(function(e){e.xAxis&&e.yAxis&&!e.grid&&(e.grid={})})}function _I(r){It(uT),r.registerSeriesModel(OX),r.registerChartView(BX),r.registerLayout(el("scatter"))}function xI(r){r.eachSeriesByType("radar",function(e){var t=e.getData(),i=[],n=e.coordinateSystem;if(n){var a=n.getIndicatorAxes();N(a,function(o,s){t.each(t.mapDimension(a[s].dim),function(l,u){i[u]=i[u]||[];var c=n.dataToPoint(l,s);i[u][s]=u9(c)?c:c9(n)})}),t.each(function(o){var s=UV(i[o],function(l){return u9(l)})||c9(n);i[o].push(s.slice()),t.setItemLayout(o,i[o])})}})}function u9(r){return!isNaN(r[0])&&!isNaN(r[1])}function c9(r){return[r.cx,r.cy]}function SI(r){var e=r.polar;if(e){pe(e)||(e=[e]);var t=[];N(e,function(i,n){i.indicator?(i.type&&!i.shape&&(i.shape=i.type),r.radar=r.radar||[],pe(r.radar)||(r.radar=[r.radar]),r.radar.push(i)):t.push(i)}),r.polar=t}N(r.series,function(i){i&&i.type==="radar"&&i.polarIndex&&(i.radarIndex=i.polarIndex)})}var hve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=t.coordinateSystem,o=this.group,s=t.getData(),l=this._data;function u(h,p){var d=h.getItemVisual(p,"symbol")||"circle";if(d!=="none"){var g=qs(h.getItemVisual(p,"symbolSize")),m=Sr(d,-1,-1,2,2),v=h.getItemVisual(p,"symbolRotate")||0;return m.attr({style:{strokeNoScale:!0},z2:100,scaleX:g[0]/2,scaleY:g[1]/2,rotation:v*Math.PI/180||0}),m}}function c(h,p,d,g,m,v){d.removeAll();for(var _=0;_<p.length-1;_++){var y=u(g,m);y&&(y.__dimIdx=_,h[_]?(y.setPosition(h[_]),Ct[v?"initProps":"updateProps"](y,{x:p[_][0],y:p[_][1]},t,m)):y.setPosition(p[_]),d.add(y))}}function f(h){return de(h,function(p){return[a.cx,a.cy]})}s.diff(l).add(function(h){var p=s.getItemLayout(h);if(p){var d=new ei,g=new $r,m={shape:{points:p}};d.shape.points=f(p),g.shape.points=f(p),ar(d,m,t,h),ar(g,m,t,h);var v=new Ze,_=new Ze;v.add(g),v.add(d),v.add(_),c(g.shape.points,p,_,s,h,!0),s.setItemGraphicEl(h,v)}}).update(function(h,p){var d=l.getItemGraphicEl(p),g=d.childAt(0),m=d.childAt(1),v=d.childAt(2),_={shape:{points:s.getItemLayout(h)}};_.shape.points&&(c(g.shape.points,_.shape.points,v,s,h,!1),Ii(m),Ii(g),Dt(g,_,t),Dt(m,_,t),s.setItemGraphicEl(h,d))}).remove(function(h){o.remove(l.getItemGraphicEl(h))}).execute(),s.eachItemGraphicEl(function(h,p){var d=s.getItemModel(p),g=h.childAt(0),m=h.childAt(1),v=h.childAt(2),_=s.getItemVisual(p,"style"),y=_.fill;o.add(h),g.useStyle(Ye(d.getModel("lineStyle").getLineStyle(),{fill:"none",stroke:y})),Gr(g,d,"lineStyle"),Gr(m,d,"areaStyle");var x=d.getModel("areaStyle"),M=x.isEmpty()&&x.parentModel.isEmpty();m.ignore=M,N(["emphasis","select","blur"],function(T){var C=d.getModel([T,"areaStyle"]),b=C.isEmpty()&&C.parentModel.isEmpty();m.ensureState(T).ignore=b&&M}),m.useStyle(Ye(x.getAreaStyle(),{fill:y,opacity:.7,decal:_.decal}));var S=d.getModel("emphasis"),w=S.getModel("itemStyle").getItemStyle();v.eachChild(function(T){if(T instanceof Ur){var C=T.style;T.useStyle(fe({image:C.image,x:C.x,y:C.y,width:C.width,height:C.height},_))}else T.useStyle(_),T.setColor(y),T.style.strokeNoScale=!0;var b=T.ensureState("emphasis");b.style=Qe(w);var E=s.getStore().get(s.getDimensionIndex(T.__dimIdx),p);(E==null||isNaN(E))&&(E=""),Nr(T,Tr(d),{labelFetcher:s.hostModel,labelDataIndex:p,labelDimIndex:T.__dimIdx,defaultText:E,inheritColor:y,defaultOpacity:_.opacity})}),nr(h,S.get("focus"),S.get("blurScope"),S.get("disabled"))}),this._data=s},e.prototype.remove=function(){this.group.removeAll(),this._data=null},e.type="radar",e}(Yt),f9=hve;var pve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new jl(Be(this.getData,this),Be(this.getRawData,this))},e.prototype.getInitialData=function(t,i){return To(this,{generateCoord:"indicator_",generateCoordCount:1/0})},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=this.coordinateSystem,s=o.getIndicatorAxes(),l=this.getData().getName(t),u=l===""?this.name:l,c=Xw(this,t);return Or("section",{header:u,sortBlocks:!0,blocks:de(s,function(f){var h=a.get(a.mapDimension(f.dim),t);return Or("nameValue",{markerType:"subItem",markerColor:c,name:f.name,value:h,sortParam:h})})})},e.prototype.getTooltipPosition=function(t){if(t!=null){for(var i=this.getData(),n=this.coordinateSystem,a=i.getValues(de(n.dimensions,function(u){return i.mapDimension(u)}),t),o=0,s=a.length;o<s;o++)if(!isNaN(a[o])){var l=n.getIndicatorAxes();return n.coordToPoint(l[o].dataToCoord(a[o]),o)}}},e.type="series.radar",e.dependencies=["radar"],e.defaultOption={z:2,colorBy:"data",coordinateSystem:"radar",legendHoverLink:!0,radarIndex:0,lineStyle:{width:2,type:"solid",join:"round"},label:{position:"top"},symbolSize:8},e}(jt),h9=pve;var yx=iT.value;function cT(r,e){return Ye({show:e},r)}var dve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(){var t=this.get("boundaryGap"),i=this.get("splitNumber"),n=this.get("scale"),a=this.get("axisLine"),o=this.get("axisTick"),s=this.get("axisLabel"),l=this.get("axisName"),u=this.get(["axisName","show"]),c=this.get(["axisName","formatter"]),f=this.get("axisNameGap"),h=this.get("triggerEvent"),p=de(this.get("indicator")||[],function(d){d.max!=null&&d.max>0&&!d.min?d.min=0:d.min!=null&&d.min<0&&!d.max&&(d.max=0);var g=l;d.color!=null&&(g=Ye({color:d.color},l));var m=_t(Qe(d),{boundaryGap:t,splitNumber:i,scale:n,axisLine:a,axisTick:o,axisLabel:s,name:d.text,showName:u,nameLocation:"end",nameGap:f,nameTextStyle:g,triggerEvent:h},!1);if(Ce(c)){var v=m.name;m.name=c.replace("{value}",v??"")}else He(c)&&(m.name=c(m.name,m));var _=new Zt(m,null,this.ecModel);return wr(_,Gl.prototype),_.mainType="radar",_.componentIndex=this.componentIndex,_},this);this._indicatorModels=p},e.prototype.getIndicatorModels=function(){return this._indicatorModels},e.type="radar",e.defaultOption={z:0,center:["50%","50%"],radius:"75%",startAngle:90,axisName:{show:!0},boundaryGap:[0,0],splitNumber:5,axisNameGap:15,scale:!1,shape:"polygon",axisLine:_t({lineStyle:{color:"#bbb"}},yx.axisLine),axisLabel:cT(yx.axisLabel,!1),axisTick:cT(yx.axisTick,!1),splitLine:cT(yx.splitLine,!0),splitArea:cT(yx.splitArea,!0),indicator:[]},e}(Pt),p9=dve;var mve=["axisLine","axisTickLabel","axisName"],vve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=this.group;a.removeAll(),this._buildAxes(t),this._buildSplitLineAndArea(t)},e.prototype._buildAxes=function(t){var i=t.coordinateSystem,n=i.getIndicatorAxes(),a=de(n,function(o){var s=o.model.get("showName")?o.name:"",l=new Cn(o.model,{axisName:s,position:[i.cx,i.cy],rotation:o.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return l});N(a,function(o){N(mve,o.add,o),this.group.add(o.getGroup())},this)},e.prototype._buildSplitLineAndArea=function(t){var i=t.coordinateSystem,n=i.getIndicatorAxes();if(!n.length)return;var a=t.get("shape"),o=t.getModel("splitLine"),s=t.getModel("splitArea"),l=o.getModel("lineStyle"),u=s.getModel("areaStyle"),c=o.get("show"),f=s.get("show"),h=l.get("color"),p=u.get("color"),d=pe(h)?h:[h],g=pe(p)?p:[p],m=[],v=[];function _(D,U,B){var F=B%U.length;return D[F]=D[F]||[],F}if(a==="circle")for(var y=n[0].getTicksCoords(),x=i.cx,M=i.cy,S=0;S<y.length;S++){if(c){var w=_(m,d,S);m[w].push(new oa({shape:{cx:x,cy:M,r:y[S].coord}}))}if(f&&S<y.length-1){var w=_(v,g,S);v[w].push(new Pp({shape:{cx:x,cy:M,r0:y[S].coord,r:y[S+1].coord}}))}}else for(var T,C=de(n,function(D,U){var B=D.getTicksCoords();return T=T==null?B.length-1:Math.min(B.length-1,T),de(B,function(F){return i.coordToPoint(F.coord,U)})}),b=[],S=0;S<=T;S++){for(var E=[],I=0;I<n.length;I++)E.push(C[I][S]);if(E[0]&&E.push(E[0].slice()),c){var w=_(m,d,S);m[w].push(new $r({shape:{points:E}}))}if(f&&b){var w=_(v,g,S-1);v[w].push(new ei({shape:{points:E.concat(b)}}))}b=E.slice().reverse()}var R=l.getLineStyle(),A=u.getAreaStyle();N(v,function(D,U){this.group.add(Gn(D,{style:Ye({stroke:"none",fill:g[U%g.length]},A),silent:!0}))},this),N(m,function(D,U){this.group.add(Gn(D,{style:Ye({fill:"none",stroke:d[U%d.length]},R),silent:!0}))},this)},e.type="radar",e}(Qt),d9=vve;var gve=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t,i,n)||this;return a.type="value",a.angle=0,a.name="",a}return e}(pn),m9=gve;var yve=function(){function r(e,t,i){this.dimensions=[],this._model=e,this._indicatorAxes=de(e.getIndicatorModels(),function(n,a){var o="indicator_"+a,s=new m9(o,new Ha);return s.name=n.get("name"),s.model=n,n.axis=s,this.dimensions.push(o),s},this),this.resize(e,i)}return r.prototype.getIndicatorAxes=function(){return this._indicatorAxes},r.prototype.dataToPoint=function(e,t){var i=this._indicatorAxes[t];return this.coordToPoint(i.dataToCoord(e),t)},r.prototype.coordToPoint=function(e,t){var i=this._indicatorAxes[t],n=i.angle,a=this.cx+e*Math.cos(n),o=this.cy-e*Math.sin(n);return[a,o]},r.prototype.pointToData=function(e){var t=e[0]-this.cx,i=e[1]-this.cy,n=Math.sqrt(t*t+i*i);t/=n,i/=n;for(var a=Math.atan2(-i,t),o=1/0,s,l=-1,u=0;u<this._indicatorAxes.length;u++){var c=this._indicatorAxes[u],f=Math.abs(a-c.angle);f<o&&(s=c,l=u,o=f)}return[l,+(s&&s.coordToData(n))]},r.prototype.resize=function(e,t){var i=e.get("center"),n=t.getWidth(),a=t.getHeight(),o=Math.min(n,a)/2;this.cx=Fe(i[0],n),this.cy=Fe(i[1],a),this.startAngle=e.get("startAngle")*Math.PI/180;var s=e.get("radius");(Ce(s)||At(s))&&(s=[0,s]),this.r0=Fe(s[0],o),this.r=Fe(s[1],o),N(this._indicatorAxes,function(l,u){l.setExtent(this.r0,this.r);var c=this.startAngle+u*Math.PI*2/this._indicatorAxes.length;c=Math.atan2(Math.sin(c),Math.cos(c)),l.angle=c},this)},r.prototype.update=function(e,t){var i=this._indicatorAxes,n=this._model;N(i,function(s){s.scale.setExtent(1/0,-1/0)}),e.eachSeriesByType("radar",function(s,l){if(!(s.get("coordinateSystem")!=="radar"||e.getComponent("radar",s.get("radarIndex"))!==n)){var u=s.getData();N(i,function(c){c.scale.unionExtentFromData(u,u.mapDimension(c.dim))})}},this);var a=n.get("splitNumber"),o=new Ha;o.setExtent(0,a),o.setInterval(1),N(i,function(s,l){aT(s.scale,s.model,o)})},r.prototype.convertToPixel=function(e,t,i){return console.warn("Not implemented."),null},r.prototype.convertFromPixel=function(e,t,i){return console.warn("Not implemented."),null},r.prototype.containPoint=function(e){return console.warn("Not implemented."),!1},r.create=function(e,t){var i=[];return e.eachComponent("radar",function(n){var a=new r(n,e,t);i.push(a),n.coordinateSystem=a}),e.eachSeriesByType("radar",function(n){n.get("coordinateSystem")==="radar"&&(n.coordinateSystem=i[n.get("radarIndex")||0])}),i},r.dimensions=[],r}(),v9=yve;function g9(r){r.registerCoordinateSystem("radar",v9),r.registerComponentModel(p9),r.registerComponentView(d9),r.registerVisual({seriesType:"radar",reset:function(e){var t=e.getData();t.each(function(i){t.setItemVisual(i,"legendIcon","roundRect")}),t.setVisual("legendIcon","roundRect")}})}function MI(r){It(g9),r.registerChartView(f9),r.registerSeriesModel(h9),r.registerLayout(xI),r.registerProcessor(tl("radar")),r.registerPreprocessor(SI)}var y9="\0_ec_interaction_mutex";function _9(r,e,t){var i=wI(r);i[e]=t}function x9(r,e,t){var i=wI(r),n=i[e];n===t&&(i[e]=null)}function bI(r,e){return!!wI(r)[e]}function wI(r){return r[y9]||(r[y9]={})}ua({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},Ir);var _ve=function(r){Z(e,r);function e(t){var i=r.call(this)||this;i._zr=t;var n=Be(i._mousedownHandler,i),a=Be(i._mousemoveHandler,i),o=Be(i._mouseupHandler,i),s=Be(i._mousewheelHandler,i),l=Be(i._pinchHandler,i);return i.enable=function(u,c){this.disable(),this._opt=Ye(Qe(c)||{},{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),u==null&&(u=!0),(u===!0||u==="move"||u==="pan")&&(t.on("mousedown",n),t.on("mousemove",a),t.on("mouseup",o)),(u===!0||u==="scale"||u==="zoom")&&(t.on("mousewheel",s),t.on("pinch",l))},i.disable=function(){t.off("mousedown",n),t.off("mousemove",a),t.off("mouseup",o),t.off("mousewheel",s),t.off("pinch",l)},i}return e.prototype.isDragging=function(){return this._dragging},e.prototype.isPinching=function(){return this._pinching},e.prototype.setPointerChecker=function(t){this.pointerChecker=t},e.prototype.dispose=function(){this.disable()},e.prototype._mousedownHandler=function(t){if(!pL(t)){for(var i=t.target;i;){if(i.draggable)return;i=i.__hostTarget||i.parent}var n=t.offsetX,a=t.offsetY;this.pointerChecker&&this.pointerChecker(t,n,a)&&(this._x=n,this._y=a,this._dragging=!0)}},e.prototype._mousemoveHandler=function(t){if(!(!this._dragging||!fT("moveOnMouseMove",t,this._opt)||t.gestureEvent==="pinch"||bI(this._zr,"globalPan"))){var i=t.offsetX,n=t.offsetY,a=this._x,o=this._y,s=i-a,l=n-o;this._x=i,this._y=n,this._opt.preventDefaultMouseMove&&Ea(t.event),M9(this,"pan","moveOnMouseMove",t,{dx:s,dy:l,oldX:a,oldY:o,newX:i,newY:n,isAvailableBehavior:null})}},e.prototype._mouseupHandler=function(t){pL(t)||(this._dragging=!1)},e.prototype._mousewheelHandler=function(t){var i=fT("zoomOnMouseWheel",t,this._opt),n=fT("moveOnMouseWheel",t,this._opt),a=t.wheelDelta,o=Math.abs(a),s=t.offsetX,l=t.offsetY;if(!(a===0||!i&&!n)){if(i){var u=o>3?1.4:o>1?1.2:1.1,c=a>0?u:1/u;TI(this,"zoom","zoomOnMouseWheel",t,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(n){var f=Math.abs(a),h=(a>0?1:-1)*(f>3?.4:f>1?.15:.05);TI(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:h,originX:s,originY:l,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){if(!bI(this._zr,"globalPan")){var i=t.pinchScale>1?1.1:1/1.1;TI(this,"zoom",null,t,{scale:i,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})}},e}(Di);function TI(r,e,t,i,n){r.pointerChecker&&r.pointerChecker(i,n.originX,n.originY)&&(Ea(i.event),M9(r,e,t,i,n))}function M9(r,e,t,i,n){n.isAvailableBehavior=Be(fT,null,t,i),r.trigger(e,n)}function fT(r,e,t){var i=t[r];return!r||i&&(!Ce(i)||e.event[i+"Key"])}var Kl=_ve;function Av(r,e,t){var i=r.target;i.x+=e,i.y+=t,i.dirty()}function Cv(r,e,t,i){var n=r.target,a=r.zoomLimit,o=r.zoom=r.zoom||1;if(o*=e,a){var s=a.min||0,l=a.max||1/0;o=Math.max(Math.min(l,o),s)}var u=o/r.zoom;r.zoom=o,n.x-=(t-n.x)*(u-1),n.y-=(i-n.y)*(u-1),n.scaleX*=u,n.scaleY*=u,n.dirty()}var xve={axisPointer:1,tooltip:1,brush:1};function Wf(r,e,t){var i=e.getComponentByElement(r.topTarget),n=i&&i.coordinateSystem;return i&&i!==t&&!xve.hasOwnProperty(i.mainType)&&n&&n.model!==t}function hT(r){if(Ce(r)){var e=new DOMParser;r=e.parseFromString(r,"text/xml")}var t=r;for(t.nodeType===9&&(t=t.firstChild);t.nodeName.toLowerCase()!=="svg"||t.nodeType!==1;)t=t.nextSibling;return t}var AI,pT={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-anchor":"textAlign",visibility:"visibility",display:"display"},b9=bt(pT),dT={"alignment-baseline":"textBaseline","stop-color":"stopColor"},w9=bt(dT),Sve=function(){function r(){this._defs={},this._root=null}return r.prototype.parse=function(e,t){t=t||{};var i=hT(e);this._defsUsePending=[];var n=new Ze;this._root=n;var a=[],o=i.getAttribute("viewBox")||"",s=parseFloat(i.getAttribute("width")||t.width),l=parseFloat(i.getAttribute("height")||t.height);isNaN(s)&&(s=null),isNaN(l)&&(l=null),Eo(i,n,null,!0,!1);for(var u=i.firstChild;u;)this._parseNode(u,n,a,null,!1,!1),u=u.nextSibling;wve(this._defs,this._defsUsePending),this._defsUsePending=[];var c,f;if(o){var h=mT(o);h.length>=4&&(c={x:parseFloat(h[0]||0),y:parseFloat(h[1]||0),width:parseFloat(h[2]),height:parseFloat(h[3])})}if(c&&s!=null&&l!=null&&(f=RI(c,{x:0,y:0,width:s,height:l}),!t.ignoreViewBox)){var p=n;n=new Ze,n.add(p),p.scaleX=p.scaleY=f.scale,p.x=f.x,p.y=f.y}return!t.ignoreRootClip&&s!=null&&l!=null&&n.setClipPath(new Tt({shape:{x:0,y:0,width:s,height:l}})),{root:n,width:s,height:l,viewBoxRect:c,viewBoxTransform:f,named:a}},r.prototype._parseNode=function(e,t,i,n,a,o){var s=e.nodeName.toLowerCase(),l,u=n;if(s==="defs"&&(a=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=t;else{if(!a){var c=AI[s];if(c&&tt(AI,s)){l=c.call(this,e,t);var f=e.getAttribute("name");if(f){var h={name:f,namedFrom:null,svgNodeTagLower:s,el:l};i.push(h),s==="g"&&(u=h)}else n&&i.push({name:n.name,namedFrom:n,svgNodeTagLower:s,el:l});t.add(l)}}var p=T9[s];if(p&&tt(T9,s)){var d=p.call(this,e),g=e.getAttribute("id");g&&(this._defs[g]=d)}}if(l&&l.isGroup)for(var m=e.firstChild;m;)m.nodeType===1?this._parseNode(m,l,i,u,a,o):m.nodeType===3&&o&&this._parseText(m,l),m=m.nextSibling},r.prototype._parseText=function(e,t){var i=new bu({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});cs(t,i),Eo(e,i,this._defsUsePending,!1,!1),Mve(i,t);var n=i.style,a=n.fontSize;a&&a<9&&(n.fontSize=9,i.scaleX*=a/9,i.scaleY*=a/9);var o=(n.fontSize||n.fontFamily)&&[n.fontStyle,n.fontWeight,(n.fontSize||12)+"px",n.fontFamily||"sans-serif"].join(" ");n.font=o;var s=i.getBoundingRect();return this._textX+=s.width,t.add(i),i},r.internalField=function(){AI={g:function(e,t){var i=new Ze;return cs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i},rect:function(e,t){var i=new Tt;return cs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setShape({x:parseFloat(e.getAttribute("x")||"0"),y:parseFloat(e.getAttribute("y")||"0"),width:parseFloat(e.getAttribute("width")||"0"),height:parseFloat(e.getAttribute("height")||"0")}),i.silent=!0,i},circle:function(e,t){var i=new oa;return cs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),r:parseFloat(e.getAttribute("r")||"0")}),i.silent=!0,i},line:function(e,t){var i=new Kr;return cs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setShape({x1:parseFloat(e.getAttribute("x1")||"0"),y1:parseFloat(e.getAttribute("y1")||"0"),x2:parseFloat(e.getAttribute("x2")||"0"),y2:parseFloat(e.getAttribute("y2")||"0")}),i.silent=!0,i},ellipse:function(e,t){var i=new v_;return cs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),rx:parseFloat(e.getAttribute("rx")||"0"),ry:parseFloat(e.getAttribute("ry")||"0")}),i.silent=!0,i},polygon:function(e,t){var i=e.getAttribute("points"),n;i&&(n=C9(i));var a=new ei({shape:{points:n||[]},silent:!0});return cs(t,a),Eo(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var i=e.getAttribute("points"),n;i&&(n=C9(i));var a=new $r({shape:{points:n||[]},silent:!0});return cs(t,a),Eo(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var i=new Ur;return cs(t,i),Eo(e,i,this._defsUsePending,!1,!1),i.setStyle({image:e.getAttribute("xlink:href")||e.getAttribute("href"),x:+e.getAttribute("x"),y:+e.getAttribute("y"),width:+e.getAttribute("width"),height:+e.getAttribute("height")}),i.silent=!0,i},text:function(e,t){var i=e.getAttribute("x")||"0",n=e.getAttribute("y")||"0",a=e.getAttribute("dx")||"0",o=e.getAttribute("dy")||"0";this._textX=parseFloat(i)+parseFloat(a),this._textY=parseFloat(n)+parseFloat(o);var s=new Ze;return cs(t,s),Eo(e,s,this._defsUsePending,!1,!0),s},tspan:function(e,t){var i=e.getAttribute("x"),n=e.getAttribute("y");i!=null&&(this._textX=parseFloat(i)),n!=null&&(this._textY=parseFloat(n));var a=e.getAttribute("dx")||"0",o=e.getAttribute("dy")||"0",s=new Ze;return cs(t,s),Eo(e,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(o),s},path:function(e,t){var i=e.getAttribute("d")||"",n=ow(i);return cs(t,n),Eo(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}}(),r}(),T9={lineargradient:function(r){var e=parseInt(r.getAttribute("x1")||"0",10),t=parseInt(r.getAttribute("y1")||"0",10),i=parseInt(r.getAttribute("x2")||"10",10),n=parseInt(r.getAttribute("y2")||"0",10),a=new zl(e,t,i,n);return E9(r,a),A9(r,a),a},radialgradient:function(r){var e=parseInt(r.getAttribute("cx")||"0",10),t=parseInt(r.getAttribute("cy")||"0",10),i=parseInt(r.getAttribute("r")||"0",10),n=new cw(e,t,i);return E9(r,n),A9(r,n),n}};function E9(r,e){var t=r.getAttribute("gradientUnits");t==="userSpaceOnUse"&&(e.global=!0)}function A9(r,e){for(var t=r.firstChild;t;){if(t.nodeType===1&&t.nodeName.toLocaleLowerCase()==="stop"){var i=t.getAttribute("offset"),n=void 0;i&&i.indexOf("%")>0?n=parseInt(i,10)/100:i?n=parseFloat(i):n=0;var a={};P9(t,a,a);var o=a.stopColor||t.getAttribute("stop-color")||"#000000";e.colorStops.push({offset:n,color:o})}t=t.nextSibling}}function cs(r,e){r&&r.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),Ye(e.__inheritedStyle,r.__inheritedStyle))}function C9(r){for(var e=mT(r),t=[],i=0;i<e.length;i+=2){var n=parseFloat(e[i]),a=parseFloat(e[i+1]);t.push([n,a])}return t}function Eo(r,e,t,i,n){var a=e,o=a.__inheritedStyle=a.__inheritedStyle||{},s={};r.nodeType===1&&(Ave(r,e),P9(r,o,s),i||Cve(r,o,s)),a.style=a.style||{},o.fill!=null&&(a.style.fill=R9(a,"fill",o.fill,t)),o.stroke!=null&&(a.style.stroke=R9(a,"stroke",o.stroke,t)),N(["lineWidth","opacity","fillOpacity","strokeOpacity","miterLimit","fontSize"],function(l){o[l]!=null&&(a.style[l]=parseFloat(o[l]))}),N(["lineDashOffset","lineCap","lineJoin","fontWeight","fontFamily","fontStyle","textAlign"],function(l){o[l]!=null&&(a.style[l]=o[l])}),n&&(a.__selfStyle=s),o.lineDash&&(a.style.lineDash=de(mT(o.lineDash),function(l){return parseFloat(l)})),(o.visibility==="hidden"||o.visibility==="collapse")&&(a.invisible=!0),o.display==="none"&&(a.ignore=!0)}function Mve(r,e){var t=e.__selfStyle;if(t){var i=t.textBaseline,n=i;!i||i==="auto"||i==="baseline"?n="alphabetic":i==="before-edge"||i==="text-before-edge"?n="top":i==="after-edge"||i==="text-after-edge"?n="bottom":(i==="central"||i==="mathematical")&&(n="middle"),r.style.textBaseline=n}var a=e.__inheritedStyle;if(a){var o=a.textAlign,s=o;o&&(o==="middle"&&(s="center"),r.style.textAlign=s)}}var bve=/^url\(\s*#(.*?)\)/;function R9(r,e,t,i){var n=t&&t.match(bve);if(n){var a=Yi(n[1]);i.push([r,e,a]);return}return t==="none"&&(t=null),t}function wve(r,e){for(var t=0;t<e.length;t++){var i=e[t];i[0].style[i[1]]=r[i[2]]}}var Tve=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function mT(r){return r.match(Tve)||[]}var Eve=/(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.eE,]*)\)/g,CI=Math.PI/180;function Ave(r,e){var t=r.getAttribute("transform");if(t){t=t.replace(/,/g," ");var i=[],n=null;t.replace(Eve,function(f,h,p){return i.push(h,p),""});for(var a=i.length-1;a>0;a-=2){var o=i[a],s=i[a-1],l=mT(o);switch(n=n||wi(),s){case"translate":_n(n,n,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Cm(n,n,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Ca(n,n,-parseFloat(l[0])*CI,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*CI);Aa(n,[1,0,u,1,0,0],n);break;case"skewY":var c=Math.tan(parseFloat(l[0])*CI);Aa(n,[1,c,0,1,0,0],n);break;case"matrix":n[0]=parseFloat(l[0]),n[1]=parseFloat(l[1]),n[2]=parseFloat(l[2]),n[3]=parseFloat(l[3]),n[4]=parseFloat(l[4]),n[5]=parseFloat(l[5]);break}}e.setLocalTransform(n)}}var L9=/([^\s:;]+)\s*:\s*([^:;]+)/g;function P9(r,e,t){var i=r.getAttribute("style");if(i){L9.lastIndex=0;for(var n;(n=L9.exec(i))!=null;){var a=n[1],o=tt(pT,a)?pT[a]:null;o&&(e[o]=n[2]);var s=tt(dT,a)?dT[a]:null;s&&(t[s]=n[2])}}}function Cve(r,e,t){for(var i=0;i<b9.length;i++){var n=b9[i],a=r.getAttribute(n);a!=null&&(e[pT[n]]=a)}for(var i=0;i<w9.length;i++){var n=w9[i],a=r.getAttribute(n);a!=null&&(t[dT[n]]=a)}}function RI(r,e){var t=e.width/r.width,i=e.height/r.height,n=Math.min(t,i);return{scale:n,x:-(r.x+r.width/2)*n+(e.x+e.width/2),y:-(r.y+r.height/2)*n+(e.y+e.height/2)}}function D9(r,e){var t=new Sve;return t.parse(r,e)}var Rve=ke(["rect","circle","line","ellipse","polygon","polyline","path","text","tspan","g"]),I9=function(){function r(e,t){this.type="geoSVG",this._usedGraphicMap=ke(),this._freedGraphics=[],this._mapName=e,this._parsedXML=hT(t)}return r.prototype.load=function(){var e=this._firstGraphic;if(!e){e=this._firstGraphic=this._buildGraphic(this._parsedXML),this._freedGraphics.push(e),this._boundingRect=this._firstGraphic.boundingRect.clone();var t=Pve(e.named),i=t.regions,n=t.regionsMap;this._regions=i,this._regionsMap=n}return{boundingRect:this._boundingRect,regions:this._regions,regionsMap:this._regionsMap}},r.prototype._buildGraphic=function(e){var t,i;try{t=e&&D9(e,{ignoreViewBox:!0,ignoreRootClip:!0})||{},i=t.root,kr(i!=null)}catch(m){throw new Error(`Invalid svg format
  2215. `+m.message)}var n=new Ze;n.add(i),n.isGeoSVGGraphicRoot=!0;var a=t.width,o=t.height,s=t.viewBoxRect,l=this._boundingRect;if(!l){var u=void 0,c=void 0,f=void 0,h=void 0;if(a!=null?(u=0,f=a):s&&(u=s.x,f=s.width),o!=null?(c=0,h=o):s&&(c=s.y,h=s.height),u==null||c==null){var p=i.getBoundingRect();u==null&&(u=p.x,f=p.width),c==null&&(c=p.y,h=p.height)}l=this._boundingRect=new lt(u,c,f,h)}if(s){var d=RI(s,l);i.scaleX=i.scaleY=d.scale,i.x=d.x,i.y=d.y}n.setClipPath(new Tt({shape:l.plain()}));var g=[];return N(t.named,function(m){Rve.get(m.svgNodeTagLower)!=null&&(g.push(m),Lve(m.el))}),{root:n,boundingRect:l,named:g}},r.prototype.useGraphic=function(e){var t=this._usedGraphicMap,i=t.get(e);return i||(i=this._freedGraphics.pop()||this._buildGraphic(this._parsedXML),t.set(e,i),i)},r.prototype.freeGraphic=function(e){var t=this._usedGraphicMap,i=t.get(e);i&&(t.removeKey(e),this._freedGraphics.push(i))},r}();function Lve(r){r.silent=!1,r.isGroup&&r.traverse(function(e){e.silent=!1})}function Pve(r){var e=[],t=ke();return N(r,function(i){if(i.namedFrom==null){var n=new p8(i.name,i.el);e.push(n),t.set(i.name,n)}}),{regions:e,regionsMap:t}}var LI=[126,25],N9="\u5357\u6D77\u8BF8\u5C9B",td=[[[0,3.5],[7,11.2],[15,11.9],[30,7],[42,.7],[52,.7],[56,7.7],[59,.7],[64,.7],[64,0],[5,0],[0,3.5]],[[13,16.1],[19,14.7],[16,21.7],[11,23.1],[13,16.1]],[[12,32.2],[14,38.5],[15,38.5],[13,32.2],[12,32.2]],[[16,47.6],[12,53.2],[13,53.2],[18,47.6],[16,47.6]],[[6,64.4],[8,70],[9,70],[8,64.4],[6,64.4]],[[23,82.6],[29,79.8],[30,79.8],[25,82.6],[23,82.6]],[[37,70.7],[43,62.3],[44,62.3],[39,70.7],[37,70.7]],[[48,51.1],[51,45.5],[53,45.5],[50,51.1],[48,51.1]],[[51,35],[51,28.7],[53,28.7],[53,35],[51,35]],[[52,22.4],[55,17.5],[56,17.5],[53,22.4],[52,22.4]],[[58,12.6],[62,7],[63,7],[60,12.6],[58,12.6]],[[0,3.5],[0,93.1],[64,93.1],[64,0],[63,0],[63,92.4],[1,92.4],[1,3.5],[0,3.5]]];for(Xf=0;Xf<td.length;Xf++)for(ed=0;ed<td[Xf].length;ed++)td[Xf][ed][0]/=10.5,td[Xf][ed][1]/=-10.5/.75,td[Xf][ed][0]+=LI[0],td[Xf][ed][1]+=LI[1];var ed,Xf;function PI(r,e){if(r==="china"){for(var t=0;t<e.length;t++)if(e[t].name===N9)return;e.push(new D1(N9,de(td,function(i){return{type:"polygon",exterior:i}}),LI))}}var Dve={\u5357\u6D77\u8BF8\u5C9B:[32,80],\u5E7F\u4E1C:[0,-10],\u9999\u6E2F:[10,5],\u6FB3\u95E8:[-10,10],\u5929\u6D25:[5,5]};function DI(r,e){if(r==="china"){var t=Dve[e.name];if(t){var i=e.getCenter();i[0]+=t[0]/10.5,i[1]+=-t[1]/(10.5/.75),e.setCenter(i)}}}var Ive=[[[123.45165252685547,25.73527164402261],[123.49731445312499,25.73527164402261],[123.49731445312499,25.750734064600884],[123.45165252685547,25.750734064600884],[123.45165252685547,25.73527164402261]]];function II(r,e){r==="china"&&e.name==="\u53F0\u6E7E"&&e.geometries.push({type:"polygon",exterior:Ive[0]})}var Nve="name",U9=function(){function r(e,t,i){this.type="geoJSON",this._parsedMap=ke(),this._mapName=e,this._specialAreas=i,this._geoJSON=Ove(t)}return r.prototype.load=function(e,t){t=t||Nve;var i=this._parsedMap.get(t);if(!i){var n=this._parseToRegions(t);i=this._parsedMap.set(t,{regions:n,boundingRect:Uve(n)})}var a=ke(),o=[];return N(i.regions,function(s){var l=s.name;e&&tt(e,l)&&(s=s.cloneShallow(l=e[l])),o.push(s),a.set(l,s)}),{regions:o,boundingRect:i.boundingRect||new lt(0,0,0,0),regionsMap:a}},r.prototype._parseToRegions=function(e){var t=this._mapName,i=this._geoJSON,n;try{n=i?y2(i,e):[]}catch(a){throw new Error(`Invalid geoJson format
  2216. `+a.message)}return PI(t,n),N(n,function(a){var o=a.name;DI(t,a),II(t,a);var s=this._specialAreas&&this._specialAreas[o];s&&a.transformTo(s.left,s.top,s.width,s.height)},this),n},r.prototype.getMapForUser=function(){return{geoJson:this._geoJSON,geoJSON:this._geoJSON,specialAreas:this._specialAreas}},r}();function Uve(r){for(var e,t=0;t<r.length;t++){var i=r[t].getBoundingRect();e=e||i.clone(),e.union(i)}return e}function Ove(r){return Ce(r)?typeof JSON<"u"&&JSON.parse?JSON.parse(r):new Function("return ("+r+");")():r}var _x=ke(),pa={registerMap:function(r,e,t){if(e.svg){var i=new I9(r,e.svg);_x.set(r,i)}else{var n=e.geoJson||e.geoJSON;n&&!e.features?t=e.specialAreas:n=e;var i=new U9(r,n,t);_x.set(r,i)}},getGeoResource:function(r){return _x.get(r)},getMapForUser:function(r){var e=_x.get(r);return e&&e.type==="geoJSON"&&e.getMapForUser()},load:function(r,e,t){var i=_x.get(r);if(i)return i.load(e,t)}};var NI=["rect","circle","line","ellipse","polygon","polyline","path"],Fve=ke(NI),zve=ke(NI.concat(["g"])),Bve=ke(NI.concat(["g"])),H9=vt();function vT(r){var e=r.getItemStyle(),t=r.get("areaColor");return t!=null&&(e.fill=t),e}function O9(r){var e=r.style;e&&(e.stroke=e.stroke||e.fill,e.fill=null)}var kve=function(){function r(e){var t=new Ze;this.uid=ts("ec_map_draw"),this._controller=new Kl(e.getZr()),this._controllerHost={target:t},this.group=t,t.add(this._regionsGroup=new Ze),t.add(this._svgGroup=new Ze)}return r.prototype.draw=function(e,t,i,n,a){var o=e.mainType==="geo",s=e.getData&&e.getData();o&&t.eachComponent({mainType:"series",subType:"map"},function(v){!s&&v.getHostGeoModel()===e&&(s=v.getData())});var l=e.coordinateSystem,u=this._regionsGroup,c=this.group,f=l.getTransformInfo(),h=f.raw,p=f.roam,d=!u.childAt(0)||a;d?(c.x=p.x,c.y=p.y,c.scaleX=p.scaleX,c.scaleY=p.scaleY,c.dirty()):Dt(c,p,e);var g=s&&s.getVisual("visualMeta")&&s.getVisual("visualMeta").length>0,m={api:i,geo:l,mapOrGeoModel:e,data:s,isVisualEncodedByVisualMap:g,isGeo:o,transformInfoRaw:h};l.resourceType==="geoJSON"?this._buildGeoJSON(m):l.resourceType==="geoSVG"&&this._buildSVG(m),this._updateController(e,t,i),this._updateMapSelectHandler(e,u,i,n)},r.prototype._buildGeoJSON=function(e){var t=this._regionsGroupByName=ke(),i=ke(),n=this._regionsGroup,a=e.transformInfoRaw,o=e.mapOrGeoModel,s=e.data,l=e.geo.projection,u=l&&l.stream;function c(p,d){return d&&(p=d(p)),p&&[p[0]*a.scaleX+a.x,p[1]*a.scaleY+a.y]}function f(p){for(var d=[],g=!u&&l&&l.project,m=0;m<p.length;++m){var v=c(p[m],g);v&&d.push(v)}return d}function h(p){return{shape:{points:f(p)}}}n.removeAll(),N(e.geo.regions,function(p){var d=p.name,g=t.get(d),m=i.get(d)||{},v=m.dataIdx,_=m.regionModel;g||(g=t.set(d,new Ze),n.add(g),v=s?s.indexOfName(d):null,_=e.isGeo?o.getRegionModel(d):s?s.getItemModel(v):null,i.set(d,{dataIdx:v,regionModel:_}));var y=[],x=[];N(p.geometries,function(w){if(w.type==="polygon"){var T=[w.exterior].concat(w.interiors||[]);u&&(T=G9(T,u)),N(T,function(b){y.push(new ei(h(b)))})}else{var C=w.points;u&&(C=G9(C,u,!0)),N(C,function(b){x.push(new $r(h(b)))})}});var M=c(p.getCenter(),l&&l.project);function S(w,T){if(w.length){var C=new Qm({culling:!0,segmentIgnoreThreshold:1,shape:{paths:w}});g.add(C),F9(e,C,v,_),z9(e,C,d,_,o,v,M),T&&(O9(C),N(C.states,O9))}}S(y),S(x,!0)}),t.each(function(p,d){var g=i.get(d),m=g.dataIdx,v=g.regionModel;B9(e,p,d,v,o,m),k9(e,p,d,v,o),V9(e,p,d,v,o)},this)},r.prototype._buildSVG=function(e){var t=e.geo.map,i=e.transformInfoRaw;this._svgGroup.x=i.x,this._svgGroup.y=i.y,this._svgGroup.scaleX=i.scaleX,this._svgGroup.scaleY=i.scaleY,this._svgResourceChanged(t)&&(this._freeSVG(),this._useSVG(t));var n=this._svgDispatcherMap=ke(),a=!1;N(this._svgGraphicRecord.named,function(o){var s=o.name,l=e.mapOrGeoModel,u=e.data,c=o.svgNodeTagLower,f=o.el,h=u?u.indexOfName(s):null,p=l.getRegionModel(s);if(Fve.get(c)!=null&&f instanceof gi&&F9(e,f,h,p),f instanceof gi&&(f.culling=!0),f.z2EmphasisLift=0,!o.namedFrom&&(Bve.get(c)!=null&&z9(e,f,s,p,l,h,null),B9(e,f,s,p,l,h),k9(e,f,s,p,l),zve.get(c)!=null)){var d=V9(e,f,s,p,l);d==="self"&&(a=!0);var g=n.get(s)||n.set(s,[]);g.push(f)}},this),this._enableBlurEntireSVG(a,e)},r.prototype._enableBlurEntireSVG=function(e,t){if(e&&t.isGeo){var i=t.mapOrGeoModel.getModel(["blur","itemStyle"]).getItemStyle(),n=i.opacity;this._svgGraphicRecord.root.traverse(function(a){if(!a.isGroup){Fs(a);var o=a.ensureState("blur").style||{};o.opacity==null&&n!=null&&(o.opacity=n),a.ensureState("emphasis")}})}},r.prototype.remove=function(){this._regionsGroup.removeAll(),this._regionsGroupByName=null,this._svgGroup.removeAll(),this._freeSVG(),this._controller.dispose(),this._controllerHost=null},r.prototype.findHighDownDispatchers=function(e,t){if(e==null)return[];var i=t.coordinateSystem;if(i.resourceType==="geoJSON"){var n=this._regionsGroupByName;if(n){var a=n.get(e);return a?[a]:[]}}else if(i.resourceType==="geoSVG")return this._svgDispatcherMap&&this._svgDispatcherMap.get(e)||[]},r.prototype._svgResourceChanged=function(e){return this._svgMapName!==e},r.prototype._useSVG=function(e){var t=pa.getGeoResource(e);if(t&&t.type==="geoSVG"){var i=t.useGraphic(this.uid);this._svgGroup.add(i.root),this._svgGraphicRecord=i,this._svgMapName=e}},r.prototype._freeSVG=function(){var e=this._svgMapName;if(e!=null){var t=pa.getGeoResource(e);t&&t.type==="geoSVG"&&t.freeGraphic(this.uid),this._svgGraphicRecord=null,this._svgDispatcherMap=null,this._svgGroup.removeAll(),this._svgMapName=null}},r.prototype._updateController=function(e,t,i){var n=e.coordinateSystem,a=this._controller,o=this._controllerHost;o.zoomLimit=e.get("scaleLimit"),o.zoom=n.getZoom(),a.enable(e.get("roam")||!1);var s=e.mainType;function l(){var u={type:"geoRoam",componentType:s};return u[s+"Id"]=e.id,u}a.off("pan").on("pan",function(u){this._mouseDownFlag=!1,Av(o,u.dx,u.dy),i.dispatchAction(fe(l(),{dx:u.dx,dy:u.dy,animation:{duration:0}}))},this),a.off("zoom").on("zoom",function(u){this._mouseDownFlag=!1,Cv(o,u.scale,u.originX,u.originY),i.dispatchAction(fe(l(),{zoom:u.scale,originX:u.originX,originY:u.originY,animation:{duration:0}}))},this),a.setPointerChecker(function(u,c,f){return n.containPoint([c,f])&&!Wf(u,i,e)})},r.prototype.resetForLabelLayout=function(){this.group.traverse(function(e){var t=e.getTextContent();t&&(t.ignore=H9(t).ignore)})},r.prototype._updateMapSelectHandler=function(e,t,i,n){var a=this;t.off("mousedown"),t.off("click"),e.get("selectedMode")&&(t.on("mousedown",function(){a._mouseDownFlag=!0}),t.on("click",function(o){a._mouseDownFlag&&(a._mouseDownFlag=!1)}))},r}();function F9(r,e,t,i){var n=i.getModel("itemStyle"),a=i.getModel(["emphasis","itemStyle"]),o=i.getModel(["blur","itemStyle"]),s=i.getModel(["select","itemStyle"]),l=vT(n),u=vT(a),c=vT(s),f=vT(o),h=r.data;if(h){var p=h.getItemVisual(t,"style"),d=h.getItemVisual(t,"decal");r.isVisualEncodedByVisualMap&&p.fill&&(l.fill=p.fill),d&&(l.decal=Zs(d,r.api))}e.setStyle(l),e.style.strokeNoScale=!0,e.ensureState("emphasis").style=u,e.ensureState("select").style=c,e.ensureState("blur").style=f,Fs(e)}function z9(r,e,t,i,n,a,o){var s=r.data,l=r.isGeo,u=s&&isNaN(s.get(s.mapDimension("value"),a)),c=s&&s.getItemLayout(a);if(l||u||c&&c.showLabel){var f=l?t:a,h=void 0;(!s||a>=0)&&(h=n);var p=o?{normal:{align:"center",verticalAlign:"middle"}}:null;Nr(e,Tr(i),{labelFetcher:h,labelDataIndex:f,defaultText:t},p);var d=e.getTextContent();if(d&&(H9(d).ignore=d.ignore,e.textConfig&&o)){var g=e.getBoundingRect().clone();e.textConfig.layoutRect=g,e.textConfig.position=[(o[0]-g.x)/g.width*100+"%",(o[1]-g.y)/g.height*100+"%"]}e.disableLabelAnimation=!0}else e.removeTextContent(),e.removeTextConfig(),e.disableLabelAnimation=null}function B9(r,e,t,i,n,a){r.data?r.data.setItemGraphicEl(a,e):rt(e).eventData={componentType:"geo",componentIndex:n.componentIndex,geoIndex:n.componentIndex,name:t,region:i&&i.option||{}}}function k9(r,e,t,i,n){r.data||Vs({el:e,componentModel:n,itemName:t,itemTooltipOption:i.get("tooltip")})}function V9(r,e,t,i,n){e.highDownSilentOnTouch=!!n.get("selectedMode");var a=i.getModel("emphasis"),o=a.get("focus");return nr(e,o,a.get("blurScope"),a.get("disabled")),r.isGeo&&m4(e,n,t),o}function G9(r,e,t){var i=[],n;function a(){n=[]}function o(){n.length&&(i.push(n),n=[])}var s=e({polygonStart:a,polygonEnd:o,lineStart:a,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&n.push([l,u])},sphere:function(){}});return!t&&s.polygonStart(),N(r,function(l){s.lineStart();for(var u=0;u<l.length;u++)s.point(l[u][0],l[u][1]);s.lineEnd()}),!t&&s.polygonEnd(),i}var gT=kve;var Vve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){if(!(a&&a.type==="mapToggleSelect"&&a.from===this.uid)){var o=this.group;if(o.removeAll(),!t.getHostGeoModel()){if(this._mapDraw&&a&&a.type==="geoRoam"&&this._mapDraw.resetForLabelLayout(),a&&a.type==="geoRoam"&&a.componentType==="series"&&a.seriesId===t.id){var s=this._mapDraw;s&&o.add(s.group)}else if(t.needsDrawMap){var s=this._mapDraw||new gT(n);o.add(s.group),s.draw(t,i,n,this,a),this._mapDraw=s}else this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;t.get("showLegendSymbol")&&i.getComponent("legend")&&this._renderSymbols(t,i,n)}}},e.prototype.remove=function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null,this.group.removeAll()},e.prototype.dispose=function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},e.prototype._renderSymbols=function(t,i,n){var a=t.originalData,o=this.group;a.each(a.mapDimension("value"),function(s,l){if(!isNaN(s)){var u=a.getItemLayout(l);if(!(!u||!u.point)){var c=u.point,f=u.offset,h=new oa({style:{fill:t.getData().getVisual("style").fill},shape:{cx:c[0]+f*9,cy:c[1],r:3},silent:!0,z2:8+(f?0:wu+1)});if(!f){var p=t.mainSeries.getData(),d=a.getName(l),g=p.indexOfName(d),m=a.getItemModel(l),v=m.getModel("label"),_=p.getItemGraphicEl(g);Nr(h,Tr(m),{labelFetcher:{getFormattedLabel:function(y,x){return t.getFormattedLabel(g,x)}},defaultText:d}),h.disableLabelAnimation=!0,v.get("position")||h.setTextConfig({position:"bottom"}),_.onHoverStateChange=function(y){Rp(h,y)}}o.add(h)}}})},e.type="map",e}(Yt),W9=Vve;var Gve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.needsDrawMap=!1,t.seriesGroup=[],t.getTooltipPosition=function(i){if(i!=null){var n=this.getData().getName(i),a=this.coordinateSystem,o=a.getRegion(n);return o&&a.dataToPoint(o.getCenter())}},t}return e.prototype.getInitialData=function(t){for(var i=To(this,{coordDimensions:["value"],encodeDefaulter:ot(uv,this)}),n=ke(),a=[],o=0,s=i.count();o<s;o++){var l=i.getName(o);n.set(l,!0)}var u=pa.load(this.getMapType(),this.option.nameMap,this.option.nameProperty);return N(u.regions,function(c){var f=c.name;n.get(f)||a.push(f)}),i.appendValues([],a),i},e.prototype.getHostGeoModel=function(){var t=this.option.geoIndex;return t!=null?this.ecModel.getComponent("geo",t):null},e.prototype.getMapType=function(){return(this.getHostGeoModel()||this).option.map},e.prototype.getRawValue=function(t){var i=this.getData();return i.get(i.mapDimension("value"),t)},e.prototype.getRegionModel=function(t){var i=this.getData();return i.getItemModel(i.indexOfName(t))},e.prototype.formatTooltip=function(t,i,n){for(var a=this.getData(),o=this.getRawValue(t),s=a.getName(t),l=this.seriesGroup,u=[],c=0;c<l.length;c++){var f=l[c].originalData.indexOfName(s),h=a.mapDimension("value");isNaN(l[c].originalData.get(h,f))||u.push(l[c].name)}return Or("section",{header:u.join(", "),noHeader:!u.length,blocks:[Or("nameValue",{name:s,value:o})]})},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.getLegendIcon=function(t){var i=t.icon||"roundRect",n=Sr(i,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill);return n.setStyle(t.itemStyle),n.style.stroke="none",i.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n},e.type="series.map",e.dependencies=["geo"],e.layoutMode="box",e.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{areaColor:"rgba(255,215,0,0.8)"}},select:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},nameProperty:"name"},e}(jt),X9=Gve;function Hve(r,e){var t={};return N(r,function(i){i.each(i.mapDimension("value"),function(n,a){var o="ec-"+i.getName(a);t[o]=t[o]||[],isNaN(n)||t[o].push(n)})}),r[0].map(r[0].mapDimension("value"),function(i,n){for(var a="ec-"+r[0].getName(n),o=0,s=1/0,l=-1/0,u=t[a].length,c=0;c<u;c++)s=Math.min(s,t[a][c]),l=Math.max(l,t[a][c]),o+=t[a][c];var f;return e==="min"?f=s:e==="max"?f=l:e==="average"?f=o/u:f=o,u===0?NaN:f})}function UI(r){var e={};r.eachSeriesByType("map",function(t){var i=t.getHostGeoModel(),n=i?"o"+i.id:"i"+t.getMapType();(e[n]=e[n]||[]).push(t)}),N(e,function(t,i){for(var n=Hve(de(t,function(o){return o.getData()}),t[0].get("mapValueCalculation")),a=0;a<t.length;a++)t[a].originalData=t[a].getData();for(var a=0;a<t.length;a++)t[a].seriesGroup=t,t[a].needsDrawMap=a===0&&!t[a].getHostGeoModel(),t[a].setData(n.cloneShallow()),t[a].mainSeries=t[0]})}function OI(r){var e={};r.eachSeriesByType("map",function(t){var i=t.getMapType();if(!(t.getHostGeoModel()||e[i])){var n={};N(t.seriesGroup,function(o){var s=o.coordinateSystem,l=o.originalData;o.get("showLegendSymbol")&&r.getComponent("legend")&&l.each(l.mapDimension("value"),function(u,c){var f=l.getName(c),h=s.getRegion(f);if(!(!h||isNaN(u))){var p=n[f]||0,d=s.dataToPoint(h.getCenter());n[f]=p+1,l.setItemLayout(c,{point:d,offset:p})}})});var a=t.getData();a.each(function(o){var s=a.getName(o),l=a.getItemLayout(o)||{};l.showLabel=!n[s],a.setItemLayout(o,l)}),e[i]=!0}})}var Y9=fi,Wve=function(r){Z(e,r);function e(t){var i=r.call(this)||this;return i.type="view",i.dimensions=["x","y"],i._roamTransformable=new Ra,i._rawTransformable=new Ra,i.name=t,i}return e.prototype.setBoundingRect=function(t,i,n,a){return this._rect=new lt(t,i,n,a),this._rect},e.prototype.getBoundingRect=function(){return this._rect},e.prototype.setViewRect=function(t,i,n,a){this._transformTo(t,i,n,a),this._viewRect=new lt(t,i,n,a)},e.prototype._transformTo=function(t,i,n,a){var o=this.getBoundingRect(),s=this._rawTransformable;s.transform=o.calculateTransform(new lt(t,i,n,a));var l=s.parent;s.parent=null,s.decomposeTransform(),s.parent=l,this._updateTransform()},e.prototype.setCenter=function(t,i){t&&(this._center=[Fe(t[0],i.getWidth()),Fe(t[1],i.getHeight())],this._updateCenterAndZoom())},e.prototype.setZoom=function(t){t=t||1;var i=this.zoomLimit;i&&(i.max!=null&&(t=Math.min(i.max,t)),i.min!=null&&(t=Math.max(i.min,t))),this._zoom=t,this._updateCenterAndZoom()},e.prototype.getDefaultCenter=function(){var t=this.getBoundingRect(),i=t.x+t.width/2,n=t.y+t.height/2;return[i,n]},e.prototype.getCenter=function(){return this._center||this.getDefaultCenter()},e.prototype.getZoom=function(){return this._zoom||1},e.prototype.getRoamTransform=function(){return this._roamTransformable.getLocalTransform()},e.prototype._updateCenterAndZoom=function(){var t=this._rawTransformable.getLocalTransform(),i=this._roamTransformable,n=this.getDefaultCenter(),a=this.getCenter(),o=this.getZoom();a=fi([],a,t),n=fi([],n,t),i.originX=a[0],i.originY=a[1],i.x=n[0]-a[0],i.y=n[1]-a[1],i.scaleX=i.scaleY=o,this._updateTransform()},e.prototype._updateTransform=function(){var t=this._roamTransformable,i=this._rawTransformable;i.parent=t,t.updateTransform(),i.updateTransform(),O0(this.transform||(this.transform=[]),i.transform||wi()),this._rawTransform=i.getLocalTransform(),this.invTransform=this.invTransform||[],Yo(this.invTransform,this.transform),this.decomposeTransform()},e.prototype.getTransformInfo=function(){var t=this._rawTransformable,i=this._roamTransformable,n=new Ra;return n.transform=i.transform,n.decomposeTransform(),{roam:{x:n.x,y:n.y,scaleX:n.scaleX,scaleY:n.scaleY},raw:{x:t.x,y:t.y,scaleX:t.scaleX,scaleY:t.scaleY}}},e.prototype.getViewRect=function(){return this._viewRect},e.prototype.getViewRectAfterRoam=function(){var t=this.getBoundingRect().clone();return t.applyTransform(this.transform),t},e.prototype.dataToPoint=function(t,i,n){var a=i?this._rawTransform:this.transform;return n=n||[],a?Y9(n,t,a):qi(n,t)},e.prototype.pointToData=function(t){var i=this.invTransform;return i?Y9([],t,i):[t[0],t[1]]},e.prototype.convertToPixel=function(t,i,n){var a=q9(i);return a===this?a.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,i,n){var a=q9(i);return a===this?a.pointToData(n):null},e.prototype.containPoint=function(t){return this.getViewRectAfterRoam().contain(t[0],t[1])},e.dimensions=["x","y"],e}(Ra);function q9(r){var e=r.seriesModel;return e?e.coordinateSystem:null}var Vu=Wve;var Xve={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},FI=["lng","lat"],j9=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t)||this;a.dimensions=FI,a.type="geo",a._nameCoordMap=ke(),a.map=i;var o=n.projection,s=pa.load(i,n.nameMap,n.nameProperty),l=pa.getGeoResource(i),u=a.resourceType=l?l.type:null,c=a.regions=s.regions,f=Xve[l.type];a._regionsMap=s.regionsMap,a.regions=s.regions,a.projection=o;var h;if(o)for(var p=0;p<c.length;p++){var d=c[p].getBoundingRect(o);h=h||d.clone(),h.union(d)}else h=s.boundingRect;return a.setBoundingRect(h.x,h.y,h.width,h.height),a.aspectScale=o?1:ft(n.aspectScale,f.aspectScale),a._invertLongitute=o?!1:f.invertLongitute,a}return e.prototype._transformTo=function(t,i,n,a){var o=this.getBoundingRect(),s=this._invertLongitute;o=o.clone(),s&&(o.y=-o.y-o.height);var l=this._rawTransformable;l.transform=o.calculateTransform(new lt(t,i,n,a));var u=l.parent;l.parent=null,l.decomposeTransform(),l.parent=u,s&&(l.scaleY=-l.scaleY),this._updateTransform()},e.prototype.getRegion=function(t){return this._regionsMap.get(t)},e.prototype.getRegionByCoord=function(t){for(var i=this.regions,n=0;n<i.length;n++){var a=i[n];if(a.type==="geoJSON"&&a.contain(t))return i[n]}},e.prototype.addGeoCoord=function(t,i){this._nameCoordMap.set(t,i)},e.prototype.getGeoCoord=function(t){var i=this._regionsMap.get(t);return this._nameCoordMap.get(t)||i&&i.getCenter()},e.prototype.dataToPoint=function(t,i,n){if(Ce(t)&&(t=this.getGeoCoord(t)),t){var a=this.projection;return a&&(t=a.project(t)),t&&this.projectedToPoint(t,i,n)}},e.prototype.pointToData=function(t){var i=this.projection;return i&&(t=i.unproject(t)),t&&this.pointToProjected(t)},e.prototype.pointToProjected=function(t){return r.prototype.pointToData.call(this,t)},e.prototype.projectedToPoint=function(t,i,n){return r.prototype.dataToPoint.call(this,t,i,n)},e.prototype.convertToPixel=function(t,i,n){var a=Z9(i);return a===this?a.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,i,n){var a=Z9(i);return a===this?a.pointToData(n):null},e}(Vu);wr(j9,Vu);function Z9(r){var e=r.geoModel,t=r.seriesModel;return e?e.coordinateSystem:t?t.coordinateSystem||(t.getReferringComponents("geo",Cr).models[0]||{}).coordinateSystem:null}var zI=j9;function K9(r,e){var t=r.get("boundingCoords");if(t!=null){var i=t[0],n=t[1];if(isFinite(i[0])&&isFinite(i[1])&&isFinite(n[0])&&isFinite(n[1])){var a=this.projection;if(a){var o=i[0],s=i[1],l=n[0],u=n[1];i=[1/0,1/0],n=[-1/0,-1/0];var c=function(S,w,T,C){for(var b=T-S,E=C-w,I=0;I<=100;I++){var R=I/100,A=a.project([S+b*R,w+E*R]);po(i,i,A),mo(n,n,A)}};c(o,s,l,s),c(l,s,l,u),c(l,u,o,u),c(o,u,l,s)}this.setBoundingRect(i[0],i[1],n[0]-i[0],n[1]-i[1])}}var f=this.getBoundingRect(),h=r.get("layoutCenter"),p=r.get("layoutSize"),d=e.getWidth(),g=e.getHeight(),m=f.width/f.height*this.aspectScale,v=!1,_,y;h&&p&&(_=[Fe(h[0],d),Fe(h[1],g)],y=Fe(p,Math.min(d,g)),!isNaN(_[0])&&!isNaN(_[1])&&!isNaN(y)&&(v=!0));var x;if(v)x={},m>1?(x.width=y,x.height=y/m):(x.height=y,x.width=y*m),x.y=_[1]-x.height/2,x.x=_[0]-x.width/2;else{var M=r.getBoxLayoutParams();M.aspect=m,x=xr(M,{width:d,height:g})}this.setViewRect(x.x,x.y,x.width,x.height),this.setCenter(r.get("center"),e),this.setZoom(r.get("zoom"))}function Yve(r,e){N(e.get("geoCoord"),function(t,i){r.addGeoCoord(i,t)})}var qve=function(){function r(){this.dimensions=FI}return r.prototype.create=function(e,t){var i=[];function n(o){return{nameProperty:o.get("nameProperty"),aspectScale:o.get("aspectScale"),projection:o.get("projection")}}e.eachComponent("geo",function(o,s){var l=o.get("map"),u=new zI(l+s,l,fe({nameMap:o.get("nameMap")},n(o)));u.zoomLimit=o.get("scaleLimit"),i.push(u),o.coordinateSystem=u,u.model=o,u.resize=K9,u.resize(o,t)}),e.eachSeries(function(o){var s=o.get("coordinateSystem");if(s==="geo"){var l=o.get("geoIndex")||0;o.coordinateSystem=i[l]}});var a={};return e.eachSeriesByType("map",function(o){if(!o.getHostGeoModel()){var s=o.getMapType();a[s]=a[s]||[],a[s].push(o)}}),N(a,function(o,s){var l=de(o,function(c){return c.get("nameMap")}),u=new zI(s,s,fe({nameMap:Sm(l)},n(o[0])));u.zoomLimit=Br.apply(null,de(o,function(c){return c.get("scaleLimit")})),i.push(u),u.resize=K9,u.resize(o[0],t),N(o,function(c){c.coordinateSystem=u,Yve(u,c)})}),i},r.prototype.getFilledRegions=function(e,t,i,n){for(var a=(e||[]).slice(),o=ke(),s=0;s<a.length;s++)o.set(a[s].name,a[s]);var l=pa.load(t,i,n);return N(l.regions,function(u){var c=u.name;!o.get(c)&&a.push({name:c})}),a},r}(),Zve=new qve,yT=Zve;var jve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i,n){var a=pa.getGeoResource(t.map);if(a&&a.type==="geoJSON"){var o=t.itemStyle=t.itemStyle||{};"color"in o||(o.color="#eee")}this.mergeDefaultAndTheme(t,n),yo(t,"label",["show"])},e.prototype.optionUpdated=function(){var t=this,i=this.option;i.regions=yT.getFilledRegions(i.regions,i.map,i.nameMap,i.nameProperty);var n={};this._optionModelMap=gn(i.regions||[],function(a,o){var s=o.name;return s&&(a.set(s,new Zt(o,t,t.ecModel)),o.selected&&(n[s]=!0)),a},ke()),i.selectedMap||(i.selectedMap=n)},e.prototype.getRegionModel=function(t){return this._optionModelMap.get(t)||new Zt(null,this,this.ecModel)},e.prototype.getFormattedLabel=function(t,i){var n=this.getRegionModel(t),a=i==="normal"?n.get(["label","formatter"]):n.get(["emphasis","label","formatter"]),o={name:t};if(He(a))return o.status=i,a(o);if(Ce(a))return a.replace("{a}",t??"")},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.select=function(t){var i=this.option,n=i.selectedMode;if(n){n!=="multiple"&&(i.selectedMap=null);var a=i.selectedMap||(i.selectedMap={});a[t]=!0}},e.prototype.unSelect=function(t){var i=this.option.selectedMap;i&&(i[t]=!1)},e.prototype.toggleSelected=function(t){this[this.isSelected(t)?"unSelect":"select"](t)},e.prototype.isSelected=function(t){var i=this.option.selectedMap;return!!(i&&i[t])},e.type="geo",e.layoutMode="box",e.defaultOption={z:0,show:!0,left:"center",top:"center",aspectScale:null,silent:!1,map:"",boundingCoords:null,center:null,zoom:1,scaleLimit:null,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},select:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},regions:[]},e}(Pt),J9=jve;function $9(r,e){return r.pointToProjected?r.pointToProjected(e):r.pointToData(e)}function Rv(r,e,t,i){var n=r.getZoom(),a=r.getCenter(),o=e.zoom,s=r.projectedToPoint?r.projectedToPoint(a):r.dataToPoint(a);if(e.dx!=null&&e.dy!=null&&(s[0]-=e.dx,s[1]-=e.dy,r.setCenter($9(r,s),i)),o!=null){if(t){var l=t.min||0,u=t.max||1/0;o=Math.max(Math.min(n*o,u),l)/n}r.scaleX*=o,r.scaleY*=o;var c=(e.originX-r.x)*(o-1),f=(e.originY-r.y)*(o-1);r.x-=c,r.y-=f,r.updateTransform(),r.setCenter($9(r,s),i),r.setZoom(o*n)}return{center:r.getCenter(),zoom:r.getZoom()}}var Kve=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.focusBlurEnabled=!0,t}return e.prototype.init=function(t,i){this._api=i},e.prototype.render=function(t,i,n,a){if(this._model=t,!t.get("show")){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;return}this._mapDraw||(this._mapDraw=new gT(n));var o=this._mapDraw;o.draw(t,i,n,this,a),o.group.on("click",this._handleRegionClick,this),o.group.silent=t.get("silent"),this.group.add(o.group),this.updateSelectStatus(t,i,n)},e.prototype._handleRegionClick=function(t){var i;Ys(t.target,function(n){return(i=rt(n).eventData)!=null},!0),i&&this._api.dispatchAction({type:"geoToggleSelect",geoId:this._model.id,name:i.name})},e.prototype.updateSelectStatus=function(t,i,n){var a=this;this._mapDraw.group.traverse(function(o){var s=rt(o).eventData;if(s)return a._model.isSelected(s.name)?n.enterSelect(o):n.leaveSelect(o),!0})},e.prototype.findHighDownDispatchers=function(t){return this._mapDraw&&this._mapDraw.findHighDownDispatchers(t,this._model)},e.prototype.dispose=function(){this._mapDraw&&this._mapDraw.remove()},e.type="geo",e}(Qt),Q9=Kve;function Jve(r,e,t){pa.registerMap(r,e,t)}function xx(r){r.registerCoordinateSystem("geo",yT),r.registerComponentModel(J9),r.registerComponentView(Q9),r.registerImpl("registerMap",Jve),r.registerImpl("getMap",function(t){return pa.getMapForUser(t)});function e(t,i){i.update="geo:updateSelectStatus",r.registerAction(i,function(n,a){var o={},s=[];return a.eachComponent({mainType:"geo",query:n},function(l){l[t](n.name);var u=l.coordinateSystem;N(u.regions,function(f){o[f.name]=l.isSelected(f.name)||!1});var c=[];N(o,function(f,h){o[h]&&c.push(h)}),s.push({geoIndex:l.componentIndex,name:c})}),{selected:o,allSelected:s,name:n.name}})}e("toggleSelected",{type:"geoToggleSelect",event:"geoselectchanged"}),e("select",{type:"geoSelect",event:"geoselected"}),e("unSelect",{type:"geoUnSelect",event:"geounselected"}),r.registerAction({type:"geoRoam",event:"geoRoam",update:"updateTransform"},function(t,i,n){var a=t.componentType||"series";i.eachComponent({mainType:a,query:t},function(o){var s=o.coordinateSystem;if(s.type==="geo"){var l=Rv(s,t,o.get("scaleLimit"),n);o.setCenter&&o.setCenter(l.center),o.setZoom&&o.setZoom(l.zoom),a==="series"&&N(o.seriesGroup,function(u){u.setCenter(l.center),u.setZoom(l.zoom)})}})})}function BI(r){It(xx),r.registerChartView(W9),r.registerSeriesModel(X9),r.registerLayout(OI),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,UI),r1("map",r.registerAction)}function e7(r){var e=r;e.hierNode={defaultAncestor:null,ancestor:e,prelim:0,modifier:0,change:0,shift:0,i:0,thread:null};for(var t=[e],i,n;i=t.pop();)if(n=i.children,i.isExpand&&n.length)for(var a=n.length,o=a-1;o>=0;o--){var s=n[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},t.push(s)}}function t7(r,e){var t=r.isExpand?r.children:[],i=r.parentNode.children,n=r.hierNode.i?i[r.hierNode.i-1]:null;if(t.length){$ve(r);var a=(t[0].hierNode.prelim+t[t.length-1].hierNode.prelim)/2;n?(r.hierNode.prelim=n.hierNode.prelim+e(r,n),r.hierNode.modifier=r.hierNode.prelim-a):r.hierNode.prelim=a}else n&&(r.hierNode.prelim=n.hierNode.prelim+e(r,n));r.parentNode.hierNode.defaultAncestor=Qve(r,n,r.parentNode.hierNode.defaultAncestor||i[0],e)}function r7(r){var e=r.hierNode.prelim+r.parentNode.hierNode.modifier;r.setLayout({x:e},!0),r.hierNode.modifier+=r.parentNode.hierNode.modifier}function GI(r){return arguments.length?r:rge}function rd(r,e){return r-=Math.PI/2,{x:e*Math.cos(r),y:e*Math.sin(r)}}function i7(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function $ve(r){for(var e=r.children,t=e.length,i=0,n=0;--t>=0;){var a=e[t];a.hierNode.prelim+=i,a.hierNode.modifier+=i,n+=a.hierNode.change,i+=a.hierNode.shift+n}}function Qve(r,e,t,i){if(e){for(var n=r,a=r,o=a.parentNode.children[0],s=e,l=n.hierNode.modifier,u=a.hierNode.modifier,c=o.hierNode.modifier,f=s.hierNode.modifier;s=kI(s),a=VI(a),s&&a;){n=kI(n),o=VI(o),n.hierNode.ancestor=r;var h=s.hierNode.prelim+f-a.hierNode.prelim-u+i(s,a);h>0&&(tge(ege(s,r,t),r,h),u+=h,l+=h),f+=s.hierNode.modifier,u+=a.hierNode.modifier,l+=n.hierNode.modifier,c+=o.hierNode.modifier}s&&!kI(n)&&(n.hierNode.thread=s,n.hierNode.modifier+=f-l),a&&!VI(o)&&(o.hierNode.thread=a,o.hierNode.modifier+=u-c,t=r)}return t}function kI(r){var e=r.children;return e.length&&r.isExpand?e[e.length-1]:r.hierNode.thread}function VI(r){var e=r.children;return e.length&&r.isExpand?e[0]:r.hierNode.thread}function ege(r,e,t){return r.hierNode.ancestor.parentNode===e.parentNode?r.hierNode.ancestor:t}function tge(r,e,t){var i=t/(e.hierNode.i-r.hierNode.i);e.hierNode.change-=i,e.hierNode.shift+=t,e.hierNode.modifier+=t,e.hierNode.prelim+=t,r.hierNode.change+=i}function rge(r,e){return r.parentNode===e.parentNode?1:2}var ige=function(){function r(){this.parentPoint=[],this.childPoints=[]}return r}(),nge=function(r){Z(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new ige},e.prototype.buildPath=function(t,i){var n=i.childPoints,a=n.length,o=i.parentPoint,s=n[0],l=n[a-1];if(a===1){t.moveTo(o[0],o[1]),t.lineTo(s[0],s[1]);return}var u=i.orient,c=u==="TB"||u==="BT"?0:1,f=1-c,h=Fe(i.forkPosition,1),p=[];p[c]=o[c],p[f]=o[f]+(l[f]-o[f])*h,t.moveTo(o[0],o[1]),t.lineTo(p[0],p[1]),t.moveTo(s[0],s[1]),p[c]=s[c],t.lineTo(p[0],p[1]),p[c]=l[c],t.lineTo(p[0],p[1]),t.lineTo(l[0],l[1]);for(var d=1;d<a-1;d++){var g=n[d];t.moveTo(g[0],g[1]),p[c]=g[c],t.lineTo(p[0],p[1])}},e}(ut),age=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._mainGroup=new Ze,t}return e.prototype.init=function(t,i){this._controller=new Kl(i.getZr()),this._controllerHost={target:this.group},this.group.add(this._mainGroup)},e.prototype.render=function(t,i,n){var a=t.getData(),o=t.layoutInfo,s=this._mainGroup,l=t.get("layout");l==="radial"?(s.x=o.x+o.width/2,s.y=o.y+o.height/2):(s.x=o.x,s.y=o.y),this._updateViewCoordSys(t,n),this._updateController(t,i,n);var u=this._data;a.diff(u).add(function(c){n7(a,c)&&a7(a,c,null,s,t)}).update(function(c,f){var h=u.getItemGraphicEl(f);if(!n7(a,c)){h&&s7(u,f,h,s,t);return}a7(a,c,h,s,t)}).remove(function(c){var f=u.getItemGraphicEl(c);f&&s7(u,c,f,s,t)}).execute(),this._nodeScaleRatio=t.get("nodeScaleRatio"),this._updateNodeAndLinkScale(t),t.get("expandAndCollapse")===!0&&a.eachItemGraphicEl(function(c,f){c.off("click").on("click",function(){n.dispatchAction({type:"treeExpandAndCollapse",seriesId:t.id,dataIndex:f})})}),this._data=a},e.prototype._updateViewCoordSys=function(t,i){var n=t.getData(),a=[];n.each(function(f){var h=n.getItemLayout(f);h&&!isNaN(h.x)&&!isNaN(h.y)&&a.push([+h.x,+h.y])});var o=[],s=[];Mp(a,o,s);var l=this._min,u=this._max;s[0]-o[0]===0&&(o[0]=l?l[0]:o[0]-1,s[0]=u?u[0]:s[0]+1),s[1]-o[1]===0&&(o[1]=l?l[1]:o[1]-1,s[1]=u?u[1]:s[1]+1);var c=t.coordinateSystem=new Vu;c.zoomLimit=t.get("scaleLimit"),c.setBoundingRect(o[0],o[1],s[0]-o[0],s[1]-o[1]),c.setCenter(t.get("center"),i),c.setZoom(t.get("zoom")),this.group.attr({x:c.x,y:c.y,scaleX:c.scaleX,scaleY:c.scaleY}),this._min=o,this._max=s},e.prototype._updateController=function(t,i,n){var a=this,o=this._controller,s=this._controllerHost,l=this.group;o.setPointerChecker(function(u,c,f){var h=l.getBoundingRect();return h.applyTransform(l.transform),h.contain(c,f)&&!Wf(u,n,t)}),o.enable(t.get("roam")),s.zoomLimit=t.get("scaleLimit"),s.zoom=t.coordinateSystem.getZoom(),o.off("pan").off("zoom").on("pan",function(u){Av(s,u.dx,u.dy),n.dispatchAction({seriesId:t.id,type:"treeRoam",dx:u.dx,dy:u.dy})}).on("zoom",function(u){Cv(s,u.scale,u.originX,u.originY),n.dispatchAction({seriesId:t.id,type:"treeRoam",zoom:u.scale,originX:u.originX,originY:u.originY}),a._updateNodeAndLinkScale(t),n.updateLabelLayout()})},e.prototype._updateNodeAndLinkScale=function(t){var i=t.getData(),n=this._getNodeGlobalScale(t);i.eachItemGraphicEl(function(a,o){a.setSymbolScale(n)})},e.prototype._getNodeGlobalScale=function(t){var i=t.coordinateSystem;if(i.type!=="view")return 1;var n=this._nodeScaleRatio,a=i.scaleX||1,o=i.getZoom(),s=(o-1)*n+1;return s/a},e.prototype.dispose=function(){this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype.remove=function(){this._mainGroup.removeAll(),this._data=null},e.type="tree",e}(Yt);function n7(r,e){var t=r.getItemLayout(e);return t&&!isNaN(t.x)&&!isNaN(t.y)}function a7(r,e,t,i,n){var a=!t,o=r.tree.getNodeByDataIndex(e),s=o.getModel(),l=o.getVisual("style").fill,u=o.isExpand===!1&&o.children.length!==0?l:"#fff",c=r.tree.root,f=o.parentNode===c?o:o.parentNode||o,h=r.getItemGraphicEl(f.dataIndex),p=f.getLayout(),d=h?{x:h.__oldX,y:h.__oldY,rawX:h.__radialOldRawX,rawY:h.__radialOldRawY}:p,g=o.getLayout();a?(t=new ku(r,e,null,{symbolInnerColor:u,useNameLabel:!0}),t.x=d.x,t.y=d.y):t.updateData(r,e,null,{symbolInnerColor:u,useNameLabel:!0}),t.__radialOldRawX=t.__radialRawX,t.__radialOldRawY=t.__radialRawY,t.__radialRawX=g.rawX,t.__radialRawY=g.rawY,i.add(t),r.setItemGraphicEl(e,t),t.__oldX=t.x,t.__oldY=t.y,Dt(t,{x:g.x,y:g.y},n);var m=t.getSymbolPath();if(n.get("layout")==="radial"){var v=c.children[0],_=v.getLayout(),y=v.children.length,x=void 0,M=void 0;if(g.x===_.x&&o.isExpand===!0&&v.children.length){var S={x:(v.children[0].getLayout().x+v.children[y-1].getLayout().x)/2,y:(v.children[0].getLayout().y+v.children[y-1].getLayout().y)/2};x=Math.atan2(S.y-_.y,S.x-_.x),x<0&&(x=Math.PI*2+x),M=S.x<_.x,M&&(x=x-Math.PI)}else x=Math.atan2(g.y-_.y,g.x-_.x),x<0&&(x=Math.PI*2+x),o.children.length===0||o.children.length!==0&&o.isExpand===!1?(M=g.x<_.x,M&&(x=x-Math.PI)):(M=g.x>_.x,M||(x=x-Math.PI));var w=M?"left":"right",T=s.getModel("label"),C=T.get("rotate"),b=C*(Math.PI/180),E=m.getTextContent();E&&(m.setTextConfig({position:T.get("position")||w,rotation:C==null?-x:b,origin:"center"}),E.setStyle("verticalAlign","middle"))}var I=s.get(["emphasis","focus"]),R=I==="relative"?ep(o.getAncestorsIndices(),o.getDescendantIndices()):I==="ancestor"?o.getAncestorsIndices():I==="descendant"?o.getDescendantIndices():null;R&&(rt(t).focus=R),oge(n,o,c,t,d,p,g,i),t.__edge&&(t.onHoverStateChange=function(A){if(A!=="blur"){var D=o.parentNode&&r.getItemGraphicEl(o.parentNode.dataIndex);D&&D.hoverState===Cp||Rp(t.__edge,A)}})}function oge(r,e,t,i,n,a,o,s){var l=e.getModel(),u=r.get("edgeShape"),c=r.get("layout"),f=r.getOrient(),h=r.get(["lineStyle","curveness"]),p=r.get("edgeForkPosition"),d=l.getModel("lineStyle").getLineStyle(),g=i.__edge;if(u==="curve")e.parentNode&&e.parentNode!==t&&(g||(g=i.__edge=new Dp({shape:HI(c,f,h,n,n)})),Dt(g,{shape:HI(c,f,h,a,o)},r));else if(u==="polyline"&&c==="orthogonal"&&e!==t&&e.children&&e.children.length!==0&&e.isExpand===!0){for(var m=e.children,v=[],_=0;_<m.length;_++){var y=m[_].getLayout();v.push([y.x,y.y])}g||(g=i.__edge=new nge({shape:{parentPoint:[o.x,o.y],childPoints:[[o.x,o.y]],orient:f,forkPosition:p}})),Dt(g,{shape:{parentPoint:[o.x,o.y],childPoints:v}},r)}g&&!(u==="polyline"&&!e.isExpand)&&(g.useStyle(Ye({strokeNoScale:!0,fill:null},d)),Gr(g,l,"lineStyle"),Fs(g),s.add(g))}function o7(r,e,t,i,n){var a=e.tree.root,o=l7(a,r),s=o.source,l=o.sourceLayout,u=e.getItemGraphicEl(r.dataIndex);if(u){var c=e.getItemGraphicEl(s.dataIndex),f=c.__edge,h=u.__edge||(s.isExpand===!1||s.children.length===1?f:void 0),p=i.get("edgeShape"),d=i.get("layout"),g=i.get("orient"),m=i.get(["lineStyle","curveness"]);h&&(p==="curve"?es(h,{shape:HI(d,g,m,l,l),style:{opacity:0}},i,{cb:function(){t.remove(h)},removeOpt:n}):p==="polyline"&&i.get("layout")==="orthogonal"&&es(h,{shape:{parentPoint:[l.x,l.y],childPoints:[[l.x,l.y]]},style:{opacity:0}},i,{cb:function(){t.remove(h)},removeOpt:n}))}}function l7(r,e){for(var t=e.parentNode===r?e:e.parentNode||e,i;i=t.getLayout(),i==null;)t=t.parentNode===r?t:t.parentNode||t;return{source:t,sourceLayout:i}}function s7(r,e,t,i,n){var a=r.tree.getNodeByDataIndex(e),o=r.tree.root,s=l7(o,a).sourceLayout,l={duration:n.get("animationDurationUpdate"),easing:n.get("animationEasingUpdate")};es(t,{x:s.x+1,y:s.y+1},n,{cb:function(){i.remove(t),r.setItemGraphicEl(e,null)},removeOpt:l}),t.fadeOut(null,r.hostModel,{fadeLabel:!0,animation:l}),a.children.forEach(function(u){o7(u,r,i,n,l)}),o7(a,r,i,n,l)}function HI(r,e,t,i,n){var a,o,s,l,u,c,f,h;if(r==="radial"){u=i.rawX,f=i.rawY,c=n.rawX,h=n.rawY;var p=rd(u,f),d=rd(u,f+(h-f)*t),g=rd(c,h+(f-h)*t),m=rd(c,h);return{x1:p.x||0,y1:p.y||0,x2:m.x||0,y2:m.y||0,cpx1:d.x||0,cpy1:d.y||0,cpx2:g.x||0,cpy2:g.y||0}}else u=i.x,f=i.y,c=n.x,h=n.y,(e==="LR"||e==="RL")&&(a=u+(c-u)*t,o=f,s=c+(u-c)*t,l=h),(e==="TB"||e==="BT")&&(a=u,o=f+(h-f)*t,s=c,l=h+(f-h)*t);return{x1:u,y1:f,x2:c,y2:h,cpx1:a,cpy1:o,cpx2:s,cpy2:l}}var u7=age;var fs=vt();function sge(r){var e=r.mainData,t=r.datas;t||(t={main:e},r.datasAttr={main:"data"}),r.datas=r.mainData=null,c7(e,t,r),N(t,function(i){N(e.TRANSFERABLE_METHODS,function(n){i.wrapMethod(n,ot(lge,r))})}),e.wrapMethod("cloneShallow",ot(cge,r)),N(e.CHANGABLE_METHODS,function(i){e.wrapMethod(i,ot(uge,r))}),kr(t[e.dataType]===e)}function lge(r,e){if(pge(this)){var t=fe({},fs(this).datas);t[this.dataType]=e,c7(e,t,r)}else WI(e,this.dataType,fs(this).mainData,r);return e}function uge(r,e){return r.struct&&r.struct.update(),e}function cge(r,e){return N(fs(e).datas,function(t,i){t!==e&&WI(t.cloneShallow(),i,e,r)}),e}function fge(r){var e=fs(this).mainData;return r==null||e==null?e:fs(e).datas[r]}function hge(){var r=fs(this).mainData;return r==null?[{data:r}]:de(bt(fs(r).datas),function(e){return{type:e,data:fs(r).datas[e]}})}function pge(r){return fs(r).mainData===r}function c7(r,e,t){fs(r).datas={},N(e,function(i,n){WI(i,n,r,t)})}function WI(r,e,t,i){fs(t).datas[e]=r,fs(r).mainData=t,r.dataType=e,i.struct&&(r[i.structAttr]=i.struct,i.struct[i.datasAttr[e]]=r),r.getLinkedData=fge,r.getLinkedDataAll=hge}var _T=sge;var dge=function(){function r(e,t){this.depth=0,this.height=0,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.isExpand=!1,this.name=e||"",this.hostTree=t}return r.prototype.isRemoved=function(){return this.dataIndex<0},r.prototype.eachNode=function(e,t,i){He(e)&&(i=t,t=e,e=null),e=e||{},Ce(e)&&(e={order:e});var n=e.order||"preorder",a=this[e.attr||"children"],o;n==="preorder"&&(o=t.call(i,this));for(var s=0;!o&&s<a.length;s++)a[s].eachNode(e,t,i);n==="postorder"&&t.call(i,this)},r.prototype.updateDepthAndHeight=function(e){var t=0;this.depth=e;for(var i=0;i<this.children.length;i++){var n=this.children[i];n.updateDepthAndHeight(e+1),n.height>t&&(t=n.height)}this.height=t+1},r.prototype.getNodeById=function(e){if(this.getId()===e)return this;for(var t=0,i=this.children,n=i.length;t<n;t++){var a=i[t].getNodeById(e);if(a)return a}},r.prototype.contains=function(e){if(e===this)return!0;for(var t=0,i=this.children,n=i.length;t<n;t++){var a=i[t].contains(e);if(a)return a}},r.prototype.getAncestors=function(e){for(var t=[],i=e?this:this.parentNode;i;)t.push(i),i=i.parentNode;return t.reverse(),t},r.prototype.getAncestorsIndices=function(){for(var e=[],t=this;t;)e.push(t.dataIndex),t=t.parentNode;return e.reverse(),e},r.prototype.getDescendantIndices=function(){var e=[];return this.eachNode(function(t){e.push(t.dataIndex)}),e},r.prototype.getValue=function(e){var t=this.hostTree.data;return t.getStore().get(t.getDimensionIndex(e||"value"),this.dataIndex)},r.prototype.setLayout=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemLayout(this.dataIndex,e,t)},r.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},r.prototype.getModel=function(e){if(!(this.dataIndex<0)){var t=this.hostTree,i=t.data.getItemModel(this.dataIndex);return i.getModel(e)}},r.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},r.prototype.setVisual=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,e,t)},r.prototype.getVisual=function(e){return this.hostTree.data.getItemVisual(this.dataIndex,e)},r.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},r.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},r.prototype.getChildIndex=function(){if(this.parentNode){for(var e=this.parentNode.children,t=0;t<e.length;++t)if(e[t]===this)return t;return-1}return-1},r.prototype.isAncestorOf=function(e){for(var t=e.parentNode;t;){if(t===this)return!0;t=t.parentNode}return!1},r.prototype.isDescendantOf=function(e){return e!==this&&e.isAncestorOf(this)},r}();var mge=function(){function r(e){this.type="tree",this._nodes=[],this.hostModel=e}return r.prototype.eachNode=function(e,t,i){this.root.eachNode(e,t,i)},r.prototype.getNodeByDataIndex=function(e){var t=this.data.getRawIndex(e);return this._nodes[t]},r.prototype.getNodeById=function(e){return this.root.getNodeById(e)},r.prototype.update=function(){for(var e=this.data,t=this._nodes,i=0,n=t.length;i<n;i++)t[i].dataIndex=-1;for(var i=0,n=e.count();i<n;i++)t[e.getRawIndex(i)].dataIndex=i},r.prototype.clearLayouts=function(){this.data.clearItemLayouts()},r.createTree=function(e,t,i){var n=new r(t),a=[],o=1;s(e);function s(c,f){var h=c.value;o=Math.max(o,pe(h)?h.length:1),a.push(c);var p=new dge(Yr(c.name,""),n);f?vge(p,f):n.root=p,n._nodes.push(p);var d=c.children;if(d)for(var g=0;g<d.length;g++)s(d[g],p)}n.root.updateDepthAndHeight(0);var l=js(a,{coordDimensions:["value"],dimensionsCount:o}).dimensions,u=new ti(l,t);return u.initData(a),i&&i(u),_T({mainData:u,struct:n,structAttr:"tree"}),n.update(),n},r}();function vge(r,e){var t=e.children;r.parentNode!==e&&(t.push(r),r.parentNode=e)}var Lv=mge;function Gu(r,e,t){if(r&&dt(e,r.type)>=0){var i=t.getData().tree.root,n=r.targetNode;if(Ce(n)&&(n=i.getNodeById(n)),n&&i.contains(n))return{node:n};var a=r.targetNodeId;if(a!=null&&(n=i.getNodeById(a)))return{node:n}}}function XI(r){for(var e=[];r;)r=r.parentNode,r&&e.push(r);return e.reverse()}function Pv(r,e){var t=XI(r);return dt(t,e)>=0}function Yf(r,e){for(var t=[];r;){var i=r.dataIndex;t.push({name:r.name,dataIndex:i,value:e.getRawValue(i)}),r=r.parentNode}return t.reverse(),t}var gge=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.hasSymbolVisual=!0,t.ignoreStyleOnData=!0,t}return e.prototype.getInitialData=function(t){var i={name:t.name,children:t.data},n=t.leaves||{},a=new Zt(n,this,this.ecModel),o=Lv.createTree(i,this,s);function s(f){f.wrapMethod("getItemModel",function(h,p){var d=o.getNodeByDataIndex(p);return d&&d.children.length&&d.isExpand||(h.parentModel=a),h})}var l=0;o.eachNode("preorder",function(f){f.depth>l&&(l=f.depth)});var u=t.expandAndCollapse,c=u&&t.initialTreeDepth>=0?t.initialTreeDepth:l;return o.root.eachNode("preorder",function(f){var h=f.hostTree.data.getRawDataItem(f.dataIndex);f.isExpand=h&&h.collapsed!=null?!h.collapsed:f.depth<=c}),o.data},e.prototype.getOrient=function(){var t=this.get("orient");return t==="horizontal"?t="LR":t==="vertical"&&(t="TB"),t},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.formatTooltip=function(t,i,n){for(var a=this.getData().tree,o=a.root.children[0],s=a.getNodeByDataIndex(t),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return Or("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},e.prototype.getDataParams=function(t){var i=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return i.treeAncestors=Yf(n,this),i.collapsed=!n.isExpand,i},e.type="series.tree",e.layoutMode="box",e.defaultOption={z:2,coordinateSystem:"view",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:"#ccc",width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},e}(jt),f7=gge;function h7(r,e,t){for(var i=[r],n=[],a;a=i.pop();)if(n.push(a),a.isExpand){var o=a.children;if(o.length)for(var s=0;s<o.length;s++)i.push(o[s])}for(;a=n.pop();)e(a,t)}function Dv(r,e){for(var t=[r],i;i=t.pop();)if(e(i),i.isExpand){var n=i.children;if(n.length)for(var a=n.length-1;a>=0;a--)t.push(n[a])}}function qI(r,e){r.eachSeriesByType("tree",function(t){yge(t,e)})}function yge(r,e){var t=i7(r,e);r.layoutInfo=t;var i=r.get("layout"),n=0,a=0,o=null;i==="radial"?(n=2*Math.PI,a=Math.min(t.height,t.width)/2,o=GI(function(y,x){return(y.parentNode===x.parentNode?1:2)/y.depth})):(n=t.width,a=t.height,o=GI());var s=r.getData().tree.root,l=s.children[0];if(l){e7(s),h7(l,t7,o),s.hierNode.modifier=-l.hierNode.prelim,Dv(l,r7);var u=l,c=l,f=l;Dv(l,function(y){var x=y.getLayout().x;x<u.getLayout().x&&(u=y),x>c.getLayout().x&&(c=y),y.depth>f.depth&&(f=y)});var h=u===c?1:o(u,c)/2,p=h-u.getLayout().x,d=0,g=0,m=0,v=0;if(i==="radial")d=n/(c.getLayout().x+h+p),g=a/(f.depth-1||1),Dv(l,function(y){m=(y.getLayout().x+p)*d,v=(y.depth-1)*g;var x=rd(m,v);y.setLayout({x:x.x,y:x.y,rawX:m,rawY:v},!0)});else{var _=r.getOrient();_==="RL"||_==="LR"?(g=a/(c.getLayout().x+h+p),d=n/(f.depth-1||1),Dv(l,function(y){v=(y.getLayout().x+p)*g,m=_==="LR"?(y.depth-1)*d:n-(y.depth-1)*d,y.setLayout({x:m,y:v},!0)})):(_==="TB"||_==="BT")&&(d=n/(c.getLayout().x+h+p),g=a/(f.depth-1||1),Dv(l,function(y){m=(y.getLayout().x+p)*d,v=_==="TB"?(y.depth-1)*g:a-(y.depth-1)*g,y.setLayout({x:m,y:v},!0)}))}}}function ZI(r){r.eachSeriesByType("tree",function(e){var t=e.getData(),i=t.tree;i.eachNode(function(n){var a=n.getModel(),o=a.getModel("itemStyle").getItemStyle(),s=t.ensureUniqueItemVisual(n.dataIndex,"style");fe(s,o)})})}function p7(r){r.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(e,t){t.eachComponent({mainType:"series",subType:"tree",query:e},function(i){var n=e.dataIndex,a=i.getData().tree,o=a.getNodeByDataIndex(n);o.isExpand=!o.isExpand})}),r.registerAction({type:"treeRoam",event:"treeRoam",update:"none"},function(e,t,i){t.eachComponent({mainType:"series",subType:"tree",query:e},function(n){var a=n.coordinateSystem,o=Rv(a,e,void 0,i);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}function jI(r){r.registerChartView(u7),r.registerSeriesModel(f7),r.registerLayout(qI),r.registerVisual(ZI),p7(r)}var d7=["treemapZoomToNode","treemapRender","treemapMove"];function m7(r){for(var e=0;e<d7.length;e++)r.registerAction({type:d7[e],update:"updateView"},Ir);r.registerAction({type:"treemapRootToNode",update:"updateView"},function(t,i){i.eachComponent({mainType:"series",subType:"treemap",query:t},n);function n(a,o){var s=["treemapZoomToNode","treemapRootToNode"],l=Gu(t,s,a);if(l){var u=a.getViewRoot();u&&(t.direction=Pv(u,l.node)?"rollUp":"drillDown"),a.resetViewRoot(l.node)}}})}function Sx(r){var e=r.getData(),t=e.tree,i={};t.eachNode(function(n){for(var a=n;a&&a.depth>1;)a=a.parentNode;var o=P_(r.ecModel,a.name||a.dataIndex+"",i);n.setVisual("decal",o)})}var _ge=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.preventUsingHoverLayer=!0,t}return e.prototype.getInitialData=function(t,i){var n={name:t.name,children:t.data};v7(n);var a=t.levels||[],o=this.designatedVisualItemStyle={},s=new Zt({itemStyle:o},this,i);a=t.levels=xge(a,i);var l=de(a||[],function(f){return new Zt(f,s,i)},this),u=Lv.createTree(n,this,c);function c(f){f.wrapMethod("getItemModel",function(h,p){var d=u.getNodeByDataIndex(p),g=d?l[d.depth]:null;return h.parentModel=g||s,h})}return u.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=this.getRawValue(t),s=a.getName(t);return Or("nameValue",{name:s,value:o})},e.prototype.getDataParams=function(t){var i=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return i.treeAncestors=Yf(n,this),i.treePathInfo=i.treeAncestors,i},e.prototype.setLayoutInfo=function(t){this.layoutInfo=this.layoutInfo||{},fe(this.layoutInfo,t)},e.prototype.mapIdToIndex=function(t){var i=this._idIndexMap;i||(i=this._idIndexMap=ke(),this._idIndexMapCount=0);var n=i.get(t);return n==null&&i.set(t,n=this._idIndexMapCount++),n},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var i=this.getRawData().tree.root;(!t||t!==i&&!i.contains(t))&&(this._viewRoot=i)},e.prototype.enableAriaDecal=function(){Sx(this)},e.type="series.treemap",e.layoutMode="box",e.defaultOption={progressive:0,left:"center",top:"middle",width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"\u25B6",zoomToNodeRatio:.32*.32,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{color:"rgba(0,0,0,0.7)",textStyle:{color:"#fff"}},emphasis:{itemStyle:{color:"rgba(0,0,0,0.9)"}}},label:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},e}(jt);function v7(r){var e=0;N(r.children,function(i){v7(i);var n=i.value;pe(n)&&(n=n[0]),e+=n});var t=r.value;pe(t)&&(t=t[0]),(t==null||isNaN(t))&&(t=e),t<0&&(t=0),pe(r.value)?r.value[0]=t:r.value=t}function xge(r,e){var t=Jt(e.get("color")),i=Jt(e.get(["aria","decal","decals"]));if(t){r=r||[];var n,a;N(r,function(s){var l=new Zt(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(n=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(a=!0)});var o=r[0]||(r[0]={});return n||(o.color=t.slice()),!a&&i&&(o.decal=i.slice()),r}}var g7=_ge;var Sge=8,y7=8,KI=5,Mge=function(){function r(e){this.group=new Ze,e.add(this.group)}return r.prototype.render=function(e,t,i,n){var a=e.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!a.get("show")||!i)){var s=a.getModel("itemStyle"),l=a.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),f={pos:{left:a.get("left"),right:a.get("right"),top:a.get("top"),bottom:a.get("bottom")},box:{width:t.getWidth(),height:t.getHeight()},emptyItemWidth:a.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(i,f,u),this._renderContent(e,f,s,l,u,c,n),Ef(o,f.pos,f.box)}},r.prototype._prepare=function(e,t,i){for(var n=e;n;n=n.parentNode){var a=Yr(n.getModel().get("name"),""),o=i.getTextRect(a),s=Math.max(o.width+Sge*2,t.emptyItemWidth);t.totalWidth+=s+y7,t.renderList.push({node:n,text:a,width:s})}},r.prototype._renderContent=function(e,t,i,n,a,o,s){for(var l=0,u=t.emptyItemWidth,c=e.get(["breadcrumb","height"]),f=_5(t.pos,t.box),h=t.totalWidth,p=t.renderList,d=n.getModel("itemStyle").getItemStyle(),g=p.length-1;g>=0;g--){var m=p[g],v=m.node,_=m.width,y=m.text;h>f.width&&(h-=_-u,_=u,y=null);var x=new ei({shape:{points:bge(l,0,_,c,g===p.length-1,g===0)},style:Ye(i.getItemStyle(),{lineJoin:"bevel"}),textContent:new Lt({style:fr(a,{text:y})}),textConfig:{position:"inside"},z2:wu*1e4,onclick:ot(s,v)});x.disableLabelAnimation=!0,x.getTextContent().ensureState("emphasis").style=fr(o,{text:y}),x.ensureState("emphasis").style=d,nr(x,n.get("focus"),n.get("blurScope"),n.get("disabled")),this.group.add(x),wge(x,e,v),l+=_+y7}},r.prototype.remove=function(){this.group.removeAll()},r}();function bge(r,e,t,i,n,a){var o=[[n?r:r-KI,e],[r+t,e],[r+t,e+i],[n?r:r-KI,e+i]];return!a&&o.splice(2,0,[r+t+KI,e+i/2]),!n&&o.push([r,e+i/2]),o}function wge(r,e,t){rt(r).eventData={componentType:"series",componentSubType:"treemap",componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:t&&t.dataIndex,name:t&&t.name},treePathInfo:t&&Yf(t,e)}}var _7=Mge;var Tge=function(){function r(){this._storage=[],this._elExistsMap={}}return r.prototype.add=function(e,t,i,n,a){return this._elExistsMap[e.id]?!1:(this._elExistsMap[e.id]=!0,this._storage.push({el:e,target:t,duration:i,delay:n,easing:a}),!0)},r.prototype.finished=function(e){return this._finishedCallback=e,this},r.prototype.start=function(){for(var e=this,t=this._storage.length,i=function(){t--,t<=0&&(e._storage.length=0,e._elExistsMap={},e._finishedCallback&&e._finishedCallback())},n=0,a=this._storage.length;n<a;n++){var o=this._storage[n];o.el.animateTo(o.target,{duration:o.duration,delay:o.delay,easing:o.easing,setToFinal:!0,done:i,aborted:i})}return this},r}();function x7(){return new Tge}var JI=Ze,S7=Tt,M7=3,b7="label",w7="upperLabel",Age=wu*10,Cge=wu*2,Rge=wu*3,id=Na([["fill","color"],["stroke","strokeColor"],["lineWidth","strokeWidth"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),T7=function(r){var e=id(r);return e.stroke=e.fill=e.lineWidth=null,e},xT=vt(),Lge=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._state="ready",t._storage=Mx(),t}return e.prototype.render=function(t,i,n,a){var o=i.findComponents({mainType:"series",subType:"treemap",query:a});if(!(dt(o,t)<0)){this.seriesModel=t,this.api=n,this.ecModel=i;var s=["treemapZoomToNode","treemapRootToNode"],l=Gu(a,s,t),u=a&&a.type,c=t.layoutInfo,f=!this._oldTree,h=this._storage,p=u==="treemapRootToNode"&&l&&h?{rootNodeGroup:h.nodeGroup[l.node.getRawIndex()],direction:a.direction}:null,d=this._giveContainerGroup(c),g=t.get("animation"),m=this._doRender(d,t,p);g&&!f&&(!u||u==="treemapZoomToNode"||u==="treemapRootToNode")?this._doAnimation(d,m,t,p):m.renderFinally(),this._resetController(n),this._renderBreadcrumb(t,n,l)}},e.prototype._giveContainerGroup=function(t){var i=this._containerGroup;return i||(i=this._containerGroup=new JI,this._initEvents(i),this.group.add(i)),i.x=t.x,i.y=t.y,i},e.prototype._doRender=function(t,i,n){var a=i.getData().tree,o=this._oldTree,s=Mx(),l=Mx(),u=this._storage,c=[];function f(m,v,_,y){return Pge(i,l,u,n,s,c,m,v,_,y)}p(a.root?[a.root]:[],o&&o.root?[o.root]:[],t,a===o||!o,0);var h=d(u);return this._oldTree=a,this._storage=l,{lastsForAnimation:s,willDeleteEls:h,renderFinally:g};function p(m,v,_,y,x){y?(v=m,N(m,function(w,T){!w.isRemoved()&&S(T,T)})):new An(v,m,M,M).add(S).update(S).remove(ot(S,null)).execute();function M(w){return w.getId()}function S(w,T){var C=w!=null?m[w]:null,b=T!=null?v[T]:null,E=f(C,b,_,x);E&&p(C&&C.viewChildren||[],b&&b.viewChildren||[],E,y,x+1)}}function d(m){var v=Mx();return m&&N(m,function(_,y){var x=v[y];N(_,function(M){M&&(x.push(M),xT(M).willDelete=!0)})}),v}function g(){N(h,function(m){N(m,function(v){v.parent&&v.parent.remove(v)})}),N(c,function(m){m.invisible=!0,m.dirty()})}},e.prototype._doAnimation=function(t,i,n,a){var o=n.get("animationDurationUpdate"),s=n.get("animationEasing"),l=(He(o)?0:o)||0,u=(He(s)?null:s)||"cubicOut",c=x7();N(i.willDeleteEls,function(f,h){N(f,function(p,d){if(!p.invisible){var g=p.parent,m,v=xT(g);if(a&&a.direction==="drillDown")m=g===a.rootNodeGroup?{shape:{x:0,y:0,width:v.nodeWidth,height:v.nodeHeight},style:{opacity:0}}:{style:{opacity:0}};else{var _=0,y=0;v.willDelete||(_=v.nodeWidth/2,y=v.nodeHeight/2),m=h==="nodeGroup"?{x:_,y,style:{opacity:0}}:{shape:{x:_,y,width:0,height:0},style:{opacity:0}}}m&&c.add(p,m,l,0,u)}})}),N(this._storage,function(f,h){N(f,function(p,d){var g=i.lastsForAnimation[h][d],m={};g&&(p instanceof Ze?g.oldX!=null&&(m.x=p.x,m.y=p.y,p.x=g.oldX,p.y=g.oldY):(g.oldShape&&(m.shape=fe({},p.shape),p.setShape(g.oldShape)),g.fadein?(p.setStyle("opacity",0),m.style={opacity:1}):p.style.opacity!==1&&(m.style={opacity:1})),c.add(p,m,l,0,u))})},this),this._state="animating",c.finished(Be(function(){this._state="ready",i.renderFinally()},this)).start()},e.prototype._resetController=function(t){var i=this._controller;i||(i=this._controller=new Kl(t.getZr()),i.enable(this.seriesModel.get("roam")),i.on("pan",Be(this._onPan,this)),i.on("zoom",Be(this._onZoom,this)));var n=new lt(0,0,t.getWidth(),t.getHeight());i.setPointerChecker(function(a,o,s){return n.contain(o,s)})},e.prototype._clearController=function(){var t=this._controller;t&&(t.dispose(),t=null)},e.prototype._onPan=function(t){if(this._state!=="animating"&&(Math.abs(t.dx)>M7||Math.abs(t.dy)>M7)){var i=this.seriesModel.getData().tree.root;if(!i)return;var n=i.getLayout();if(!n)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+t.dx,y:n.y+t.dy,width:n.width,height:n.height}})}},e.prototype._onZoom=function(t){var i=t.originX,n=t.originY;if(this._state!=="animating"){var a=this.seriesModel.getData().tree.root;if(!a)return;var o=a.getLayout();if(!o)return;var s=new lt(o.x,o.y,o.width,o.height),l=this.seriesModel.layoutInfo;i-=l.x,n-=l.y;var u=wi();_n(u,u,[-i,-n]),Cm(u,u,[t.scale,t.scale]),_n(u,u,[i,n]),s.applyTransform(u),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:s.x,y:s.y,width:s.width,height:s.height}})}},e.prototype._initEvents=function(t){var i=this;t.on("click",function(n){if(i._state==="ready"){var a=i.seriesModel.get("nodeClick",!0);if(a){var o=i.findTarget(n.offsetX,n.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)i._rootToNode(o);else if(a==="zoomToNode")i._zoomToNode(o);else if(a==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&kp(u,c)}}}}},this)},e.prototype._renderBreadcrumb=function(t,i,n){var a=this;n||(n=t.get("leafDepth",!0)!=null?{node:t.getViewRoot()}:this.findTarget(i.getWidth()/2,i.getHeight()/2),n||(n={node:t.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new _7(this.group))).render(t,i,n.node,function(o){a._state!=="animating"&&(Pv(t.getViewRoot(),o)?a._rootToNode({node:o}):a._zoomToNode({node:o}))})},e.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=Mx(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},e.prototype.dispose=function(){this._clearController()},e.prototype._zoomToNode=function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},e.prototype._rootToNode=function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},e.prototype.findTarget=function(t,i){var n,a=this.seriesModel.getViewRoot();return a.eachNode({attr:"viewChildren",order:"preorder"},function(o){var s=this._storage.background[o.getRawIndex()];if(s){var l=s.transformCoordToLocal(t,i),u=s.shape;if(u.x<=l[0]&&l[0]<=u.x+u.width&&u.y<=l[1]&&l[1]<=u.y+u.height)n={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),n},e.type="treemap",e}(Yt);function Mx(){return{nodeGroup:[],background:[],content:[]}}function Pge(r,e,t,i,n,a,o,s,l,u){if(!o)return;var c=o.getLayout(),f=r.getData(),h=o.getModel();if(f.setItemGraphicEl(o.dataIndex,null),!c||!c.isInView)return;var p=c.width,d=c.height,g=c.borderWidth,m=c.invisible,v=o.getRawIndex(),_=s&&s.getRawIndex(),y=o.viewChildren,x=c.upperHeight,M=y&&y.length,S=h.getModel("itemStyle"),w=h.getModel(["emphasis","itemStyle"]),T=h.getModel(["blur","itemStyle"]),C=h.getModel(["select","itemStyle"]),b=S.get("borderRadius")||0,E=V("nodeGroup",JI);if(!E)return;if(l.add(E),E.x=c.x||0,E.y=c.y||0,E.markRedraw(),xT(E).nodeWidth=p,xT(E).nodeHeight=d,c.isAboveViewRoot)return E;var I=V("background",S7,u,Cge);I&&k(E,I,M&&c.upperLabelHeight);var R=h.getModel("emphasis"),A=R.get("focus"),D=R.get("blurScope"),U=R.get("disabled"),B=A==="ancestor"?o.getAncestorsIndices():A==="descendant"?o.getDescendantIndices():A;if(M)Tf(E)&&Eu(E,!1),I&&(Eu(I,!U),f.setItemGraphicEl(o.dataIndex,I),tw(I,B,D));else{var F=V("content",S7,u,Rge);F&&G(E,F),I.disableMorphing=!0,I&&Tf(I)&&Eu(I,!1),Eu(E,!U),f.setItemGraphicEl(o.dataIndex,E),tw(E,B,D)}return E;function k(ve,ue,se){var Ee=rt(ue);if(Ee.dataIndex=o.dataIndex,Ee.seriesIndex=r.seriesIndex,ue.setShape({x:0,y:0,width:p,height:d,r:b}),m)Y(ue);else{ue.invisible=!1;var q=o.getVisual("style"),H=q.stroke,We=T7(S);We.fill=H;var _e=id(w);_e.fill=w.get("borderColor");var xe=id(T);xe.fill=T.get("borderColor");var Le=id(C);if(Le.fill=C.get("borderColor"),se){var Ue=p-2*g;J(ue,H,q.opacity,{x:g,y:0,width:Ue,height:x})}else ue.removeTextContent();ue.setStyle(We),ue.ensureState("emphasis").style=_e,ue.ensureState("blur").style=xe,ue.ensureState("select").style=Le,Fs(ue)}ve.add(ue)}function G(ve,ue){var se=rt(ue);se.dataIndex=o.dataIndex,se.seriesIndex=r.seriesIndex;var Ee=Math.max(p-2*g,0),q=Math.max(d-2*g,0);if(ue.culling=!0,ue.setShape({x:g,y:g,width:Ee,height:q,r:b}),m)Y(ue);else{ue.invisible=!1;var H=o.getVisual("style"),We=H.fill,_e=T7(S);_e.fill=We,_e.decal=H.decal;var xe=id(w),Le=id(T),Ue=id(C);J(ue,We,H.opacity,null),ue.setStyle(_e),ue.ensureState("emphasis").style=xe,ue.ensureState("blur").style=Le,ue.ensureState("select").style=Ue,Fs(ue)}ve.add(ue)}function Y(ve){!ve.invisible&&a.push(ve)}function J(ve,ue,se,Ee){var q=h.getModel(Ee?w7:b7),H=Yr(h.get("name"),null),We=q.getShallow("show");Nr(ve,Tr(h,Ee?w7:b7),{defaultText:We?H:null,inheritColor:ue,defaultOpacity:se,labelFetcher:r,labelDataIndex:o.dataIndex});var _e=ve.getTextContent();if(_e){var xe=_e.style,Le=Mm(xe.padding||0);Ee&&(ve.setTextConfig({layoutRect:Ee}),_e.disableLabelLayout=!0),_e.beforeUpdate=function(){var Ne=Math.max((Ee?Ee.width:ve.shape.width)-Le[1]-Le[3],0),Ve=Math.max((Ee?Ee.height:ve.shape.height)-Le[0]-Le[2],0);(xe.width!==Ne||xe.height!==Ve)&&_e.setStyle({width:Ne,height:Ve})},xe.truncateMinChar=2,xe.lineOverflow="truncate",Q(xe,Ee,c);var Ue=_e.getState("emphasis");Q(Ue?Ue.style:null,Ee,c)}}function Q(ve,ue,se){var Ee=ve?ve.text:null;if(!ue&&se.isLeafRoot&&Ee!=null){var q=r.get("drillDownIcon",!0);ve.text=q?q+" "+Ee:Ee}}function V(ve,ue,se,Ee){var q=_!=null&&t[ve][_],H=n[ve];return q?(t[ve][_]=null,K(H,q)):m||(q=new ue,q instanceof gi&&(q.z2=Dge(se,Ee)),ae(H,q)),e[ve][v]=q}function K(ve,ue){var se=ve[v]={};ue instanceof JI?(se.oldX=ue.x,se.oldY=ue.y):se.oldShape=fe({},ue.shape)}function ae(ve,ue){var se=ve[v]={},Ee=o.parentNode,q=ue instanceof Ze;if(Ee&&(!i||i.direction==="drillDown")){var H=0,We=0,_e=n.background[Ee.getRawIndex()];!i&&_e&&_e.oldShape&&(H=_e.oldShape.width,We=_e.oldShape.height),q?(se.oldX=0,se.oldY=We):se.oldShape={x:H,y:We,width:0,height:0}}se.fadein=!q}}function Dge(r,e){return r*Age+e}var E7=Lge;var Ex=N,Ige=qe,bT=-1,tN=function(){function r(e){var t=e.mappingMethod,i=e.type,n=this.option=Qe(e);this.type=i,this.mappingMethod=t,this._normalizeData=Oge[t];var a=r.visualHandlers[i];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[t],t==="piecewise"?($I(n),Nge(n)):t==="category"?n.categories?Uge(n):$I(n,!0):(kr(t!=="linear"||n.dataExtent),$I(n))}return r.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},r.prototype.getNormalizer=function(){return Be(this._normalizeData,this)},r.listVisualTypes=function(){return bt(r.visualHandlers)},r.isValidType=function(e){return r.visualHandlers.hasOwnProperty(e)},r.eachVisual=function(e,t,i){qe(e)?N(e,t,i):t.call(i,e)},r.mapVisual=function(e,t,i){var n,a=pe(e)?[]:qe(e)?{}:(n=!0,null);return r.eachVisual(e,function(o,s){var l=t.call(i,o,s);n?a=l:a[s]=l}),a},r.retrieveVisuals=function(e){var t={},i;return e&&Ex(r.visualHandlers,function(n,a){e.hasOwnProperty(a)&&(t[a]=e[a],i=!0)}),i?t:null},r.prepareVisualTypes=function(e){if(pe(e))e=e.slice();else if(Ige(e)){var t=[];Ex(e,function(i,n){t.push(n)}),e=t}else return[];return e.sort(function(i,n){return n==="color"&&i!=="color"&&i.indexOf("color")===0?1:-1}),e},r.dependsOn=function(e,t){return t==="color"?!!(e&&e.indexOf(t)===0):e===t},r.findPieceIndex=function(e,t,i){for(var n,a=1/0,o=0,s=t.length;o<s;o++){var l=t[o].value;if(l!=null){if(l===e||Ce(l)&&l===e+"")return o;i&&h(l,o)}}for(var o=0,s=t.length;o<s;o++){var u=t[o],c=u.interval,f=u.close;if(c){if(c[0]===-1/0){if(MT(f[1],e,c[1]))return o}else if(c[1]===1/0){if(MT(f[0],c[0],e))return o}else if(MT(f[0],c[0],e)&&MT(f[1],e,c[1]))return o;i&&h(c[0],o),i&&h(c[1],o)}}if(i)return e===1/0?t.length-1:e===-1/0?0:n;function h(p,d){var g=Math.abs(p-e);g<a&&(a=g,n=d)}},r.visualHandlers={color:{applyVisual:bx("color"),getColorMapper:function(){var e=this.option;return Be(e.mappingMethod==="category"?function(t,i){return!i&&(t=this._normalizeData(t)),Tx.call(this,t)}:function(t,i,n){var a=!!n;return!i&&(t=this._normalizeData(t)),n=Mb(t,e.parsedVisual,n),a?n:Ko(n,"rgba")},this)},_normalizedToVisual:{linear:function(e){return Ko(Mb(e,this.option.parsedVisual),"rgba")},category:Tx,piecewise:function(e,t){var i=eN.call(this,t);return i==null&&(i=Ko(Mb(e,this.option.parsedVisual),"rgba")),i},fixed:nd}},colorHue:ST(function(e,t){return up(e,t)}),colorSaturation:ST(function(e,t){return up(e,null,t)}),colorLightness:ST(function(e,t){return up(e,null,null,t)}),colorAlpha:ST(function(e,t){return cp(e,t)}),decal:{applyVisual:bx("decal"),_normalizedToVisual:{linear:null,category:Tx,piecewise:null,fixed:null}},opacity:{applyVisual:bx("opacity"),_normalizedToVisual:QI([0,1])},liftZ:{applyVisual:bx("liftZ"),_normalizedToVisual:{linear:nd,category:nd,piecewise:nd,fixed:nd}},symbol:{applyVisual:function(e,t,i){var n=this.mapValueToVisual(e);i("symbol",n)},_normalizedToVisual:{linear:A7,category:Tx,piecewise:function(e,t){var i=eN.call(this,t);return i==null&&(i=A7.call(this,e)),i},fixed:nd}},symbolSize:{applyVisual:bx("symbolSize"),_normalizedToVisual:QI([0,1])}},r}();function Nge(r){var e=r.pieceList;r.hasSpecialVisual=!1,N(e,function(t,i){t.originIndex=i,t.visual!=null&&(r.hasSpecialVisual=!0)})}function Uge(r){var e=r.categories,t=r.categoryMap={},i=r.visual;if(Ex(e,function(o,s){t[o]=s}),!pe(i)){var n=[];qe(i)?Ex(i,function(o,s){var l=t[s];n[l??bT]=o}):n[bT]=i,i=C7(r,n)}for(var a=e.length-1;a>=0;a--)i[a]==null&&(delete t[e[a]],e.pop())}function $I(r,e){var t=r.visual,i=[];qe(t)?Ex(t,function(a){i.push(a)}):t!=null&&i.push(t);var n={color:1,symbol:1};!e&&i.length===1&&!n.hasOwnProperty(r.type)&&(i[1]=i[0]),C7(r,i)}function ST(r){return{applyVisual:function(e,t,i){var n=this.mapValueToVisual(e);i("color",r(t("color"),n))},_normalizedToVisual:QI([0,1])}}function A7(r){var e=this.option.visual;return e[Math.round(rr(r,[0,1],[0,e.length-1],!0))]||{}}function bx(r){return function(e,t,i){i(r,this.mapValueToVisual(e))}}function Tx(r){var e=this.option.visual;return e[this.option.loop&&r!==bT?r%e.length:r]}function nd(){return this.option.visual[0]}function QI(r){return{linear:function(e){return rr(e,r,this.option.visual,!0)},category:Tx,piecewise:function(e,t){var i=eN.call(this,t);return i==null&&(i=rr(e,r,this.option.visual,!0)),i},fixed:nd}}function eN(r){var e=this.option,t=e.pieceList;if(e.hasSpecialVisual){var i=tN.findPieceIndex(r,t),n=t[i];if(n&&n.visual)return n.visual[this.type]}}function C7(r,e){return r.visual=e,r.type==="color"&&(r.parsedVisual=de(e,function(t){var i=cn(t);return i||[0,0,0,1]})),e}var Oge={linear:function(r){return rr(r,this.option.dataExtent,[0,1],!0)},piecewise:function(r){var e=this.option.pieceList,t=tN.findPieceIndex(r,e,!0);if(t!=null)return rr(t,[0,e.length-1],[0,1],!0)},category:function(r){var e=this.option.categories?this.option.categoryMap[r]:r;return e??bT},fixed:Ir};function MT(r,e,t){return r?e<=t:e<t}var pi=tN;var Fge="itemStyle",L7=vt(),P7={seriesType:"treemap",reset:function(r){var e=r.getData().tree,t=e.root;t.isRemoved()||D7(t,{},r.getViewRoot().getAncestors(),r)}};function D7(r,e,t,i){var n=r.getModel(),a=r.getLayout(),o=r.hostTree.data;if(!(!a||a.invisible||!a.isInView)){var s=n.getModel(Fge),l=zge(s,e,i),u=o.ensureUniqueItemVisual(r.dataIndex,"style"),c=s.get("borderColor"),f=s.get("borderColorSaturation"),h;f!=null&&(h=R7(l),c=Bge(f,h)),u.stroke=c;var p=r.viewChildren;if(!p||!p.length)h=R7(l),u.fill=h;else{var d=kge(r,n,a,s,l,p);N(p,function(g,m){if(g.depth>=t.length||g===t[g.depth]){var v=Vge(n,l,g,m,d,i);D7(g,v,t,i)}})}}}function zge(r,e,t){var i=fe({},e),n=t.designatedVisualItemStyle;return N(["color","colorAlpha","colorSaturation"],function(a){n[a]=e[a];var o=r.get(a);n[a]=null,o!=null&&(i[a]=o)}),i}function R7(r){var e=rN(r,"color");if(e){var t=rN(r,"colorAlpha"),i=rN(r,"colorSaturation");return i&&(e=up(e,null,null,i)),t&&(e=cp(e,t)),e}}function Bge(r,e){return e!=null?up(e,null,null,r):null}function rN(r,e){var t=r[e];if(t!=null&&t!=="none")return t}function kge(r,e,t,i,n,a){if(!(!a||!a.length)){var o=iN(e,"color")||n.color!=null&&n.color!=="none"&&(iN(e,"colorAlpha")||iN(e,"colorSaturation"));if(o){var s=e.get("visualMin"),l=e.get("visualMax"),u=t.dataExtent.slice();s!=null&&s<u[0]&&(u[0]=s),l!=null&&l>u[1]&&(u[1]=l);var c=e.get("colorMappingBy"),f={type:o.name,dataExtent:u,visual:o.range};f.type==="color"&&(c==="index"||c==="id")?(f.mappingMethod="category",f.loop=!0):f.mappingMethod="linear";var h=new pi(f);return L7(h).drColorMappingBy=c,h}}}function iN(r,e){var t=r.get(e);return pe(t)&&t.length?{name:e,range:t}:null}function Vge(r,e,t,i,n,a){var o=fe({},e);if(n){var s=n.type,l=s==="color"&&L7(n).drColorMappingBy,u=l==="index"?i:l==="id"?a.mapIdToIndex(t.getId()):t.getValue(r.get("visualDimension"));o[s]=n.mapValueToVisual(u)}return o}var Ax=Math.max,wT=Math.min,I7=Br,nN=N,U7=["itemStyle","borderWidth"],Gge=["itemStyle","gapWidth"],Hge=["upperLabel","show"],Wge=["upperLabel","height"],O7={seriesType:"treemap",reset:function(r,e,t,i){var n=t.getWidth(),a=t.getHeight(),o=r.option,s=xr(r.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),l=o.size||[],u=Fe(I7(s.width,l[0]),n),c=Fe(I7(s.height,l[1]),a),f=i&&i.type,h=["treemapZoomToNode","treemapRootToNode"],p=Gu(i,h,r),d=f==="treemapRender"||f==="treemapMove"?i.rootRect:null,g=r.getViewRoot(),m=XI(g);if(f!=="treemapMove"){var v=f==="treemapZoomToNode"?Kge(r,p,g,u,c):d?[d.width,d.height]:[u,c],_=o.sort;_&&_!=="asc"&&_!=="desc"&&(_="desc");var y={squareRatio:o.squareRatio,sort:_,leafDepth:o.leafDepth};g.hostTree.clearLayouts();var x={x:0,y:0,width:v[0],height:v[1],area:v[0]*v[1]};g.setLayout(x),F7(g,y,!1,0),x=g.getLayout(),nN(m,function(S,w){var T=(m[w+1]||g).getValue();S.setLayout(fe({dataExtent:[T,T],borderWidth:0,upperHeight:0},x))})}var M=r.getData().tree.root;M.setLayout(Jge(s,d,p),!0),r.setLayoutInfo(s),z7(M,new lt(-s.x,-s.y,n,a),m,g,0)}};function F7(r,e,t,i){var n,a;if(!r.isRemoved()){var o=r.getLayout();n=o.width,a=o.height;var s=r.getModel(),l=s.get(U7),u=s.get(Gge)/2,c=B7(s),f=Math.max(l,c),h=l-u,p=f-u;r.setLayout({borderWidth:l,upperHeight:f,upperLabelHeight:c},!0),n=Ax(n-2*h,0),a=Ax(a-h-p,0);var d=n*a,g=Xge(r,s,d,e,t,i);if(g.length){var m={x:h,y:p,width:n,height:a},v=wT(n,a),_=1/0,y=[];y.area=0;for(var x=0,M=g.length;x<M;){var S=g[x];y.push(S),y.area+=S.getLayout().area;var w=jge(y,v,e.squareRatio);w<=_?(x++,_=w):(y.area-=y.pop().getLayout().area,N7(y,v,m,u,!1),v=wT(m.width,m.height),y.length=y.area=0,_=1/0)}if(y.length&&N7(y,v,m,u,!0),!t){var T=s.get("childrenVisibleMin");T!=null&&d<T&&(t=!0)}for(var x=0,M=g.length;x<M;x++)F7(g[x],e,t,i+1)}}}function Xge(r,e,t,i,n,a){var o=r.children||[],s=i.sort;s!=="asc"&&s!=="desc"&&(s=null);var l=i.leafDepth!=null&&i.leafDepth<=a;if(n&&!l)return r.viewChildren=[];o=Wt(o,function(p){return!p.isRemoved()}),qge(o,s);var u=Zge(e,o,s);if(u.sum===0)return r.viewChildren=[];if(u.sum=Yge(e,t,u.sum,s,o),u.sum===0)return r.viewChildren=[];for(var c=0,f=o.length;c<f;c++){var h=o[c].getValue()/u.sum*t;o[c].setLayout({area:h})}return l&&(o.length&&r.setLayout({isLeafRoot:!0},!0),o.length=0),r.viewChildren=o,r.setLayout({dataExtent:u.dataExtent},!0),o}function Yge(r,e,t,i,n){if(!i)return t;for(var a=r.get("visibleMin"),o=n.length,s=o,l=o-1;l>=0;l--){var u=n[i==="asc"?o-l-1:l].getValue();u/t*e<a&&(s=l,t-=u)}return i==="asc"?n.splice(0,o-s):n.splice(s,o-s),t}function qge(r,e){return e&&r.sort(function(t,i){var n=e==="asc"?t.getValue()-i.getValue():i.getValue()-t.getValue();return n===0?e==="asc"?t.dataIndex-i.dataIndex:i.dataIndex-t.dataIndex:n}),r}function Zge(r,e,t){for(var i=0,n=0,a=e.length;n<a;n++)i+=e[n].getValue();var o=r.get("visualDimension"),s;return!e||!e.length?s=[NaN,NaN]:o==="value"&&t?(s=[e[e.length-1].getValue(),e[0].getValue()],t==="asc"&&s.reverse()):(s=[1/0,-1/0],nN(e,function(l){var u=l.getValue(o);u<s[0]&&(s[0]=u),u>s[1]&&(s[1]=u)})),{sum:i,dataExtent:s}}function jge(r,e,t){for(var i=0,n=1/0,a=0,o=void 0,s=r.length;a<s;a++)o=r[a].getLayout().area,o&&(o<n&&(n=o),o>i&&(i=o));var l=r.area*r.area,u=e*e*t;return l?Ax(u*i/l,l/(u*n)):1/0}function N7(r,e,t,i,n){var a=e===t.width?0:1,o=1-a,s=["x","y"],l=["width","height"],u=t[s[a]],c=e?r.area/e:0;(n||c>t[l[o]])&&(c=t[l[o]]);for(var f=0,h=r.length;f<h;f++){var p=r[f],d={},g=c?p.getLayout().area/c:0,m=d[l[o]]=Ax(c-2*i,0),v=t[s[a]]+t[l[a]]-u,_=f===h-1||v<g?v:g,y=d[l[a]]=Ax(_-2*i,0);d[s[o]]=t[s[o]]+wT(i,m/2),d[s[a]]=u+wT(i,y/2),u+=_,p.setLayout(d,!0)}t[s[o]]+=c,t[l[o]]-=c}function Kge(r,e,t,i,n){var a=(e||{}).node,o=[i,n];if(!a||a===t)return o;for(var s,l=i*n,u=l*r.option.zoomToNodeRatio;s=a.parentNode;){for(var c=0,f=s.children,h=0,p=f.length;h<p;h++)c+=f[h].getValue();var d=a.getValue();if(d===0)return o;u*=c/d;var g=s.getModel(),m=g.get(U7),v=Math.max(m,B7(g));u+=4*m*m+(3*m+v)*Math.pow(u,.5),u>e_&&(u=e_),a=s}u<l&&(u=l);var _=Math.pow(u/l,.5);return[i*_,n*_]}function Jge(r,e,t){if(e)return{x:e.x,y:e.y};var i={x:0,y:0};if(!t)return i;var n=t.node,a=n.getLayout();if(!a)return i;for(var o=[a.width/2,a.height/2],s=n;s;){var l=s.getLayout();o[0]+=l.x,o[1]+=l.y,s=s.parentNode}return{x:r.width/2-o[0],y:r.height/2-o[1]}}function z7(r,e,t,i,n){var a=r.getLayout(),o=t[n],s=o&&o===r;if(!(o&&!s||n===t.length&&r!==i)){r.setLayout({isInView:!0,invisible:!s&&!e.intersect(a),isAboveViewRoot:s},!0);var l=new lt(e.x-a.x,e.y-a.y,e.width,e.height);nN(r.viewChildren||[],function(u){z7(u,l,t,i,n+1)})}}function B7(r){return r.get(Hge)?r.get(Wge):0}function aN(r){r.registerSeriesModel(g7),r.registerChartView(E7),r.registerVisual(P7),r.registerLayout(O7),m7(r)}function oN(r){var e=r.findComponents({mainType:"legend"});!e||!e.length||r.eachSeriesByType("graph",function(t){var i=t.getCategoriesData(),n=t.getGraph(),a=n.data,o=i.mapArray(i.getName);a.filterSelf(function(s){var l=a.getItemModel(s),u=l.getShallow("category");if(u!=null){At(u)&&(u=o[u]);for(var c=0;c<e.length;c++)if(!e[c].isSelected(u))return!1}return!0})})}function sN(r){var e={};r.eachSeriesByType("graph",function(t){var i=t.getCategoriesData(),n=t.getData(),a={};i.each(function(o){var s=i.getName(o);a["ec-"+s]=o;var l=i.getItemModel(o),u=l.getModel("itemStyle").getItemStyle();u.fill||(u.fill=t.getColorFromPalette(s,e)),i.setItemVisual(o,"style",u);for(var c=["symbol","symbolSize","symbolKeepAspect"],f=0;f<c.length;f++){var h=l.getShallow(c[f],!0);h!=null&&i.setItemVisual(o,c[f],h)}}),i.count()&&n.each(function(o){var s=n.getItemModel(o),l=s.getShallow("category");if(l!=null){Ce(l)&&(l=a["ec-"+l]);var u=i.getItemVisual(l,"style"),c=n.ensureUniqueItemVisual(o,"style");fe(c,u);for(var f=["symbol","symbolSize","symbolKeepAspect"],h=0;h<f.length;h++)n.setItemVisual(o,f[h],i.getItemVisual(l,f[h]))}})})}function TT(r){return r instanceof Array||(r=[r,r]),r}function lN(r){r.eachSeriesByType("graph",function(e){var t=e.getGraph(),i=e.getEdgeData(),n=TT(e.get("edgeSymbol")),a=TT(e.get("edgeSymbolSize"));i.setVisual("fromSymbol",n&&n[0]),i.setVisual("toSymbol",n&&n[1]),i.setVisual("fromSymbolSize",a&&a[0]),i.setVisual("toSymbolSize",a&&a[1]),i.setVisual("style",e.getModel("lineStyle").getLineStyle()),i.each(function(o){var s=i.getItemModel(o),l=t.getEdgeByIndex(o),u=TT(s.getShallow("symbol",!0)),c=TT(s.getShallow("symbolSize",!0)),f=s.getModel("lineStyle").getLineStyle(),h=i.ensureUniqueItemVisual(o,"style");switch(fe(h,f),h.stroke){case"source":{var p=l.node1.getVisual("style");h.stroke=p&&p.fill;break}case"target":{var p=l.node2.getVisual("style");h.stroke=p&&p.fill;break}}u[0]&&l.setVisual("fromSymbol",u[0]),u[1]&&l.setVisual("toSymbol",u[1]),c[0]&&l.setVisual("fromSymbolSize",c[0]),c[1]&&l.setVisual("toSymbolSize",c[1])})})}var uN="-->",ET=function(r){return r.get("autoCurveness")||null},k7=function(r,e){var t=ET(r),i=20,n=[];if(At(t))i=t;else if(pe(t)){r.__curvenessList=t;return}e>i&&(i=e);var a=i%2?i+2:i+3;n=[];for(var o=0;o<a;o++)n.push((o%2?o+1:o)/10*(o%2?-1:1));r.__curvenessList=n},Cx=function(r,e,t){var i=[r.id,r.dataIndex].join("."),n=[e.id,e.dataIndex].join(".");return[t.uid,i,n].join(uN)},V7=function(r){var e=r.split(uN);return[e[0],e[2],e[1]].join(uN)},$ge=function(r,e){var t=Cx(r.node1,r.node2,e);return e.__edgeMap[t]},Qge=function(r,e){var t=cN(Cx(r.node1,r.node2,e),e),i=cN(Cx(r.node2,r.node1,e),e);return t+i},cN=function(r,e){var t=e.__edgeMap;return t[r]?t[r].length:0};function G7(r){ET(r)&&(r.__curvenessList=[],r.__edgeMap={},k7(r))}function H7(r,e,t,i){if(ET(t)){var n=Cx(r,e,t),a=t.__edgeMap,o=a[V7(n)];a[n]&&!o?a[n].isForward=!0:o&&a[n]&&(o.isForward=!0,a[n].isForward=!1),a[n]=a[n]||[],a[n].push(i)}}function Iv(r,e,t,i){var n=ET(e),a=pe(n);if(!n)return null;var o=$ge(r,e);if(!o)return null;for(var s=-1,l=0;l<o.length;l++)if(o[l]===t){s=l;break}var u=Qge(r,e);k7(e,u),r.lineStyle=r.lineStyle||{};var c=Cx(r.node1,r.node2,e),f=e.__curvenessList,h=a||u%2?0:1;if(o.isForward)return f[h+s];var p=V7(c),d=cN(p,e),g=f[s+d+h];return i?a?n&&n[0]===0?(d+h)%2?g:-g:((d%2?0:1)+h)%2?g:-g:(d+h)%2?g:-g:f[s+d+h]}function AT(r){var e=r.coordinateSystem;if(!(e&&e.type!=="view")){var t=r.getGraph();t.eachNode(function(i){var n=i.getModel();i.setLayout([+n.get("x"),+n.get("y")])}),Rx(t,r)}}function Rx(r,e){r.eachEdge(function(t,i){var n=Xi(t.getModel().get(["lineStyle","curveness"]),-Iv(t,e,i,!0),0),a=wa(t.node1.getLayout()),o=wa(t.node2.getLayout()),s=[a,o];+n&&s.push([(a[0]+o[0])/2-(a[1]-o[1])*n,(a[1]+o[1])/2-(o[0]-a[0])*n]),t.setLayout(s)})}function fN(r,e){r.eachSeriesByType("graph",function(t){var i=t.get("layout"),n=t.coordinateSystem;if(n&&n.type!=="view"){var a=t.getData(),o=[];N(n.dimensions,function(h){o=o.concat(a.mapDimensionsAll(h))});for(var s=0;s<a.count();s++){for(var l=[],u=!1,c=0;c<o.length;c++){var f=a.get(o[c],s);isNaN(f)||(u=!0),l.push(f)}u?a.setItemLayout(s,n.dataToPoint(l)):a.setItemLayout(s,[NaN,NaN])}Rx(a.graph,t)}else(!i||i==="none")&&AT(t)})}function ad(r){var e=r.coordinateSystem;if(e.type!=="view")return 1;var t=r.option.nodeScaleRatio,i=e.scaleX,n=e.getZoom(),a=(n-1)*t+1;return a/i}function od(r){var e=r.getVisual("symbolSize");return e instanceof Array&&(e=(e[0]+e[1])/2),+e}var W7=Math.PI,hN=[];function Nv(r,e,t,i){var n=r.coordinateSystem;if(!(n&&n.type!=="view")){var a=n.getBoundingRect(),o=r.getData(),s=o.graph,l=a.width/2+a.x,u=a.height/2+a.y,c=Math.min(a.width,a.height)/2,f=o.count();if(o.setLayout({cx:l,cy:u}),!!f){if(t){var h=n.pointToData(i),p=h[0],d=h[1],g=[p-l,d-u];Wo(g,g),wm(g,g,c),t.setLayout([l+g[0],u+g[1]],!0);var m=r.get(["circular","rotateLabel"]);pN(t,m,l,u)}eye[e](r,s,o,c,l,u,f),s.eachEdge(function(v,_){var y=Xi(v.getModel().get(["lineStyle","curveness"]),Iv(v,r,_),0),x=wa(v.node1.getLayout()),M=wa(v.node2.getLayout()),S,w=(x[0]+M[0])/2,T=(x[1]+M[1])/2;+y&&(y*=3,S=[l*y+w*(1-y),u*y+T*(1-y)]),v.setLayout([x,M,S])})}}}var eye={value:function(r,e,t,i,n,a,o){var s=0,l=t.getSum("value"),u=Math.PI*2/(l||o);e.eachNode(function(c){var f=c.getValue("value"),h=u*(l?f:1)/2;s+=h,c.setLayout([i*Math.cos(s)+n,i*Math.sin(s)+a]),s+=h})},symbolSize:function(r,e,t,i,n,a,o){var s=0;hN.length=o;var l=ad(r);e.eachNode(function(f){var h=od(f);isNaN(h)&&(h=2),h<0&&(h=0),h*=l;var p=Math.asin(h/2/i);isNaN(p)&&(p=W7/2),hN[f.dataIndex]=p,s+=p*2});var u=(2*W7-s)/o/2,c=0;e.eachNode(function(f){var h=u+hN[f.dataIndex];c+=h,(!f.getLayout()||!f.getLayout().fixed)&&f.setLayout([i*Math.cos(c)+n,i*Math.sin(c)+a]),c+=h})}};function pN(r,e,t,i){var n=r.getGraphicEl();if(n){var a=r.getModel(),o=a.get(["label","rotate"])||0,s=n.getSymbolPath();if(e){var l=r.getLayout(),u=Math.atan2(l[1]-i,l[0]-t);u<0&&(u=Math.PI*2+u);var c=l[0]<t;c&&(u=u-Math.PI);var f=c?"left":"right";s.setTextConfig({rotation:-u,position:f,origin:"center"});var h=s.ensureState("emphasis");fe(h.textConfig||(h.textConfig={}),{position:f})}else s.setTextConfig({rotation:o*=Math.PI/180})}}function dN(r){r.eachSeriesByType("graph",function(e){e.get("layout")==="circular"&&Nv(e,"symbolSize")})}var Uv=N0;function X7(r,e,t){for(var i=r,n=e,a=t.rect,o=a.width,s=a.height,l=[a.x+o/2,a.y+s/2],u=t.gravity==null?.1:t.gravity,c=0;c<i.length;c++){var f=i[c];f.p||(f.p=Al(o*(Math.random()-.5)+l[0],s*(Math.random()-.5)+l[1])),f.pp=wa(f.p),f.edges=null}var h=t.friction==null?.6:t.friction,p=h,d,g;return{warmUp:function(){p=h*.8},setFixed:function(m){i[m].fixed=!0},setUnfixed:function(m){i[m].fixed=!1},beforeStep:function(m){d=m},afterStep:function(m){g=m},step:function(m){d&&d(i,n);for(var v=[],_=i.length,y=0;y<n.length;y++){var x=n[y];if(!x.ignoreForceLayout){var M=x.n1,S=x.n2;Is(v,S.p,M.p);var w=nb(v)-x.d,T=S.w/(M.w+S.w);isNaN(T)&&(T=0),Wo(v,v),!M.fixed&&Uv(M.p,M.p,v,T*w*p),!S.fixed&&Uv(S.p,S.p,v,-(1-T)*w*p)}}for(var y=0;y<_;y++){var C=i[y];C.fixed||(Is(v,l,C.p),Uv(C.p,C.p,v,u*p))}for(var y=0;y<_;y++)for(var M=i[y],b=y+1;b<_;b++){var S=i[b];Is(v,S.p,M.p);var w=nb(v);w===0&&(kV(v,Math.random()-.5,Math.random()-.5),w=1);var E=(M.rep+S.rep)/w/w;!M.fixed&&Uv(M.pp,M.pp,v,E),!S.fixed&&Uv(S.pp,S.pp,v,-E)}for(var I=[],y=0;y<_;y++){var C=i[y];C.fixed||(Is(I,C.p,C.pp),Uv(C.p,C.p,I,p),qi(C.pp,C.p))}p=p*.992;var R=p<.01;g&&g(i,n,R),m&&m(R)}}}function mN(r){r.eachSeriesByType("graph",function(e){var t=e.coordinateSystem;if(!(t&&t.type!=="view"))if(e.get("layout")==="force"){var i=e.preservedPoints||{},n=e.getGraph(),a=n.data,o=n.edgeData,s=e.getModel("force"),l=s.get("initLayout");e.preservedPoints?a.each(function(y){var x=a.getId(y);a.setItemLayout(y,i[x]||[NaN,NaN])}):!l||l==="none"?AT(e):l==="circular"&&Nv(e,"value");var u=a.getDataExtent("value"),c=o.getDataExtent("value"),f=s.get("repulsion"),h=s.get("edgeLength"),p=pe(f)?f:[f,f],d=pe(h)?h:[h,h];d=[d[1],d[0]];var g=a.mapArray("value",function(y,x){var M=a.getItemLayout(x),S=rr(y,u,p);return isNaN(S)&&(S=(p[0]+p[1])/2),{w:S,rep:S,fixed:a.getItemModel(x).get("fixed"),p:!M||isNaN(M[0])||isNaN(M[1])?null:M}}),m=o.mapArray("value",function(y,x){var M=n.getEdgeByIndex(x),S=rr(y,c,d);isNaN(S)&&(S=(d[0]+d[1])/2);var w=M.getModel(),T=Xi(M.getModel().get(["lineStyle","curveness"]),-Iv(M,e,x,!0),0);return{n1:g[M.node1.dataIndex],n2:g[M.node2.dataIndex],d:S,curveness:T,ignoreForceLayout:w.get("ignoreForceLayout")}}),v=t.getBoundingRect(),_=X7(g,m,{rect:v,gravity:s.get("gravity"),friction:s.get("friction")});_.beforeStep(function(y,x){for(var M=0,S=y.length;M<S;M++)y[M].fixed&&qi(y[M].p,n.getNodeByIndex(M).getLayout())}),_.afterStep(function(y,x,M){for(var S=0,w=y.length;S<w;S++)y[S].fixed||n.getNodeByIndex(S).setLayout(y[S].p),i[a.getId(S)]=y[S].p;for(var S=0,w=x.length;S<w;S++){var T=x[S],C=n.getEdgeByIndex(S),b=T.n1.p,E=T.n2.p,I=C.getLayout();I=I?I.slice():[],I[0]=I[0]||[],I[1]=I[1]||[],qi(I[0],b),qi(I[1],E),+T.curveness&&(I[2]=[(b[0]+E[0])/2-(b[1]-E[1])*T.curveness,(b[1]+E[1])/2-(E[0]-b[0])*T.curveness]),C.setLayout(I)}}),e.forceLayout=_,e.preservedPoints=i,_.step()}else e.forceLayout=null})}function tye(r,e,t){var i=fe(r.getBoxLayoutParams(),{aspect:t});return xr(i,{width:e.getWidth(),height:e.getHeight()})}function vN(r,e){var t=[];return r.eachSeriesByType("graph",function(i){var n=i.get("coordinateSystem");if(!n||n==="view"){var a=i.getData(),o=a.mapArray(function(m){var v=a.getItemModel(m);return[+v.get("x"),+v.get("y")]}),s=[],l=[];Mp(o,s,l),l[0]-s[0]===0&&(l[0]+=1,s[0]-=1),l[1]-s[1]===0&&(l[1]+=1,s[1]-=1);var u=(l[0]-s[0])/(l[1]-s[1]),c=tye(i,e,u);isNaN(u)&&(s=[c.x,c.y],l=[c.x+c.width,c.y+c.height]);var f=l[0]-s[0],h=l[1]-s[1],p=c.width,d=c.height,g=i.coordinateSystem=new Vu;g.zoomLimit=i.get("scaleLimit"),g.setBoundingRect(s[0],s[1],f,h),g.setViewRect(c.x,c.y,p,d),g.setCenter(i.get("center"),e),g.setZoom(i.get("zoom")),t.push(g)}}),t}var Y7=Kr.prototype,gN=Dp.prototype,q7=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return r}(),gQe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(q7);function yN(r){return isNaN(+r.cpx1)||isNaN(+r.cpy1)}var rye=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="ec-line",i}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new q7},e.prototype.buildPath=function(t,i){yN(i)?Y7.buildPath.call(this,t,i):gN.buildPath.call(this,t,i)},e.prototype.pointAt=function(t){return yN(this.shape)?Y7.pointAt.call(this,t):gN.pointAt.call(this,t)},e.prototype.tangentAt=function(t){var i=this.shape,n=yN(i)?[i.x2-i.x1,i.y2-i.y1]:gN.tangentAt.call(this,t);return Wo(n,n)},e}(ut),Z7=rye;var _N=["fromSymbol","toSymbol"];function j7(r){return"_"+r+"Type"}function K7(r,e,t){var i=e.getItemVisual(t,r);if(!i||i==="none")return i;var n=e.getItemVisual(t,r+"Size"),a=e.getItemVisual(t,r+"Rotate"),o=e.getItemVisual(t,r+"Offset"),s=e.getItemVisual(t,r+"KeepAspect"),l=qs(n),u=bo(o||0,l);return i+l+u+(a||"")+(s||"")}function J7(r,e,t){var i=e.getItemVisual(t,r);if(!(!i||i==="none")){var n=e.getItemVisual(t,r+"Size"),a=e.getItemVisual(t,r+"Rotate"),o=e.getItemVisual(t,r+"Offset"),s=e.getItemVisual(t,r+"KeepAspect"),l=qs(n),u=bo(o||0,l),c=Sr(i,-l[0]/2+u[0],-l[1]/2+u[1],l[0],l[1],null,s);return c.__specifiedRotation=a==null||isNaN(a)?void 0:+a*Math.PI/180||0,c.name=r,c}}function iye(r){var e=new Z7({name:"line",subPixelOptimize:!0});return xN(e.shape,r),e}function xN(r,e){r.x1=e[0][0],r.y1=e[0][1],r.x2=e[1][0],r.y2=e[1][1],r.percent=1;var t=e[2];t?(r.cpx1=t[0],r.cpy1=t[1]):(r.cpx1=NaN,r.cpy1=NaN)}var nye=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;return a._createLine(t,i,n),a}return e.prototype._createLine=function(t,i,n){var a=t.hostModel,o=t.getItemLayout(i),s=iye(o);s.shape.percent=0,ar(s,{shape:{percent:1}},a,i),this.add(s),N(_N,function(l){var u=J7(l,t,i);this.add(u),this[j7(l)]=K7(l,t,i)},this),this._updateCommonStl(t,i,n)},e.prototype.updateData=function(t,i,n){var a=t.hostModel,o=this.childOfName("line"),s=t.getItemLayout(i),l={shape:{}};xN(l.shape,s),Dt(o,l,a,i),N(_N,function(u){var c=K7(u,t,i),f=j7(u);if(this[f]!==c){this.remove(this.childOfName(u));var h=J7(u,t,i);this.add(h)}this[f]=c},this),this._updateCommonStl(t,i,n)},e.prototype.getLinePath=function(){return this.childAt(0)},e.prototype._updateCommonStl=function(t,i,n){var a=t.hostModel,o=this.childOfName("line"),s=n&&n.emphasisLineStyle,l=n&&n.blurLineStyle,u=n&&n.selectLineStyle,c=n&&n.labelStatesModels,f=n&&n.emphasisDisabled,h=n&&n.focus,p=n&&n.blurScope;if(!n||t.hasItemOption){var d=t.getItemModel(i),g=d.getModel("emphasis");s=g.getModel("lineStyle").getLineStyle(),l=d.getModel(["blur","lineStyle"]).getLineStyle(),u=d.getModel(["select","lineStyle"]).getLineStyle(),f=g.get("disabled"),h=g.get("focus"),p=g.get("blurScope"),c=Tr(d)}var m=t.getItemVisual(i,"style"),v=m.stroke;o.useStyle(m),o.style.fill=null,o.style.strokeNoScale=!0,o.ensureState("emphasis").style=s,o.ensureState("blur").style=l,o.ensureState("select").style=u,N(_N,function(S){var w=this.childOfName(S);if(w){w.setColor(v),w.style.opacity=m.opacity;for(var T=0;T<Bi.length;T++){var C=Bi[T],b=o.getState(C);if(b){var E=b.style||{},I=w.ensureState(C),R=I.style||(I.style={});E.stroke!=null&&(R[w.__isEmptyBrush?"stroke":"fill"]=E.stroke),E.opacity!=null&&(R.opacity=E.opacity)}}w.markRedraw()}},this);var _=a.getRawValue(i);Nr(this,c,{labelDataIndex:i,labelFetcher:{getFormattedLabel:function(S,w){return a.getFormattedLabel(S,w,t.dataType)}},inheritColor:v||"#000",defaultOpacity:m.opacity,defaultText:(_==null?t.getName(i):isFinite(_)?Ar(_):_)+""});var y=this.getTextContent();if(y){var x=c.normal;y.__align=y.style.align,y.__verticalAlign=y.style.verticalAlign,y.__position=x.get("position")||"middle";var M=x.get("distance");pe(M)||(M=[M,M]),y.__labelDistance=M}this.setTextConfig({position:null,local:!0,inside:!1}),nr(this,h,p,f)},e.prototype.highlight=function(){Bn(this)},e.prototype.downplay=function(){kn(this)},e.prototype.updateLayout=function(t,i){this.setLinePoints(t.getItemLayout(i))},e.prototype.setLinePoints=function(t){var i=this.childOfName("line");xN(i.shape,t),i.dirty()},e.prototype.beforeUpdate=function(){var t=this,i=t.childOfName("fromSymbol"),n=t.childOfName("toSymbol"),a=t.getTextContent();if(!i&&!n&&(!a||a.ignore))return;for(var o=1,s=this.parent;s;)s.scaleX&&(o/=s.scaleX),s=s.parent;var l=t.childOfName("line");if(!this.__dirty&&!l.__dirty)return;var u=l.shape.percent,c=l.pointAt(0),f=l.pointAt(u),h=Is([],f,c);Wo(h,h);function p(b,E){var I=b.__specifiedRotation;if(I==null){var R=l.tangentAt(E);b.attr("rotation",(E===1?-1:1)*Math.PI/2-Math.atan2(R[1],R[0]))}else b.attr("rotation",I)}if(i&&(i.setPosition(c),p(i,0),i.scaleX=i.scaleY=o*u,i.markRedraw()),n&&(n.setPosition(f),p(n,1),n.scaleX=n.scaleY=o*u,n.markRedraw()),a&&!a.ignore){a.x=a.y=0,a.originX=a.originY=0;var d=void 0,g=void 0,m=a.__labelDistance,v=m[0]*o,_=m[1]*o,y=u/2,x=l.tangentAt(y),M=[x[1],-x[0]],S=l.pointAt(y);M[1]>0&&(M[0]=-M[0],M[1]=-M[1]);var w=x[0]<0?-1:1;if(a.__position!=="start"&&a.__position!=="end"){var T=-Math.atan2(x[1],x[0]);f[0]<c[0]&&(T=Math.PI+T),a.rotation=T}var C=void 0;switch(a.__position){case"insideStartTop":case"insideMiddleTop":case"insideEndTop":case"middle":C=-_,g="bottom";break;case"insideStartBottom":case"insideMiddleBottom":case"insideEndBottom":C=_,g="top";break;default:C=0,g="middle"}switch(a.__position){case"end":a.x=h[0]*v+f[0],a.y=h[1]*_+f[1],d=h[0]>.8?"left":h[0]<-.8?"right":"center",g=h[1]>.8?"top":h[1]<-.8?"bottom":"middle";break;case"start":a.x=-h[0]*v+c[0],a.y=-h[1]*_+c[1],d=h[0]>.8?"right":h[0]<-.8?"left":"center",g=h[1]>.8?"bottom":h[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":a.x=v*w+c[0],a.y=c[1]+C,d=x[0]<0?"right":"left",a.originX=-v*w,a.originY=-C;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":a.x=S[0],a.y=S[1]+C,d="center",a.originY=-C;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":a.x=-v*w+f[0],a.y=f[1]+C,d=x[0]>=0?"right":"left",a.originX=v*w,a.originY=-C;break}a.scaleX=a.scaleY=o,a.setStyle({verticalAlign:a.__verticalAlign||g,align:a.__align||d})}},e}(Ze),Ov=nye;var aye=function(){function r(e){this.group=new Ze,this._LineCtor=e||Ov}return r.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var i=this,n=i.group,a=i._lineData;i._lineData=e,a||n.removeAll();var o=$7(e);e.diff(a).add(function(s){t._doAdd(e,s,o)}).update(function(s,l){t._doUpdate(a,e,l,s,o)}).remove(function(s){n.remove(a.getItemGraphicEl(s))}).execute()},r.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,i){t.updateLayout(e,i)},this)},r.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=$7(e),this._lineData=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t){this._progressiveEls=[];function i(s){!s.isGroup&&!oye(s)&&(s.incremental=!0,s.ensureState("emphasis").hoverLayer=!0)}for(var n=e.start;n<e.end;n++){var a=t.getItemLayout(n);if(SN(a)){var o=new this._LineCtor(t,n,this._seriesScope);o.traverse(i),this.group.add(o),t.setItemGraphicEl(n,o),this._progressiveEls.push(o)}}},r.prototype.remove=function(){this.group.removeAll()},r.prototype.eachRendered=function(e){sa(this._progressiveEls||this.group,e)},r.prototype._doAdd=function(e,t,i){var n=e.getItemLayout(t);if(SN(n)){var a=new this._LineCtor(e,t,i);e.setItemGraphicEl(t,a),this.group.add(a)}},r.prototype._doUpdate=function(e,t,i,n,a){var o=e.getItemGraphicEl(i);if(!SN(t.getItemLayout(n))){this.group.remove(o);return}o?o.updateData(t,n,a):o=new this._LineCtor(t,n,a),t.setItemGraphicEl(n,o),this.group.add(o)},r}();function oye(r){return r.animators&&r.animators.length>0}function $7(r){var e=r.hostModel,t=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:t.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:t.get("disabled"),blurScope:t.get("blurScope"),focus:t.get("focus"),labelStatesModels:Tr(e)}}function Q7(r){return isNaN(r[0])||isNaN(r[1])}function SN(r){return r&&!Q7(r[0])&&!Q7(r[1])}var Fv=aye;var MN=[],bN=[],wN=[],zv=vi,TN=yu,eY=Math.abs;function tY(r,e,t){for(var i=r[0],n=r[1],a=r[2],o=1/0,s,l=t*t,u=.1,c=.1;c<=.9;c+=.1){MN[0]=zv(i[0],n[0],a[0],c),MN[1]=zv(i[1],n[1],a[1],c);var f=eY(TN(MN,e)-l);f<o&&(o=f,s=c)}for(var h=0;h<32;h++){var p=s+u;bN[0]=zv(i[0],n[0],a[0],s),bN[1]=zv(i[1],n[1],a[1],s),wN[0]=zv(i[0],n[0],a[0],p),wN[1]=zv(i[1],n[1],a[1],p);var f=TN(bN,e)-l;if(eY(f)<.01)break;var d=TN(wN,e)-l;u/=2,f<0?d>=0?s=s+u:s=s-u:d>=0?s=s-u:s=s+u}return s}function Lx(r,e){var t=[],i=pf,n=[[],[],[]],a=[[],[]],o=[];e/=2,r.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),f=s.getVisual("toSymbol");u.__original||(u.__original=[wa(u[0]),wa(u[1])],u[2]&&u.__original.push(wa(u[2])));var h=u.__original;if(u[2]!=null){if(qi(n[0],h[0]),qi(n[1],h[2]),qi(n[2],h[1]),c&&c!=="none"){var p=od(s.node1),d=tY(n,h[0],p*e);i(n[0][0],n[1][0],n[2][0],d,t),n[0][0]=t[3],n[1][0]=t[4],i(n[0][1],n[1][1],n[2][1],d,t),n[0][1]=t[3],n[1][1]=t[4]}if(f&&f!=="none"){var p=od(s.node2),d=tY(n,h[1],p*e);i(n[0][0],n[1][0],n[2][0],d,t),n[1][0]=t[1],n[2][0]=t[2],i(n[0][1],n[1][1],n[2][1],d,t),n[1][1]=t[1],n[2][1]=t[2]}qi(u[0],n[0]),qi(u[1],n[2]),qi(u[2],n[1])}else{if(qi(a[0],h[0]),qi(a[1],h[1]),Is(o,a[1],a[0]),Wo(o,o),c&&c!=="none"){var p=od(s.node1);N0(a[0],a[0],o,p*e)}if(f&&f!=="none"){var p=od(s.node2);N0(a[1],a[1],o,-p*e)}qi(u[0],a[0]),qi(u[1],a[1])}})}function rY(r){return r.type==="view"}var sye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){var n=new Yl,a=new Fv,o=this.group;this._controller=new Kl(i.getZr()),this._controllerHost={target:o},o.add(n.group),o.add(a.group),this._symbolDraw=n,this._lineDraw=a,this._firstRender=!0},e.prototype.render=function(t,i,n){var a=this,o=t.coordinateSystem;this._model=t;var s=this._symbolDraw,l=this._lineDraw,u=this.group;if(rY(o)){var c={x:o.x,y:o.y,scaleX:o.scaleX,scaleY:o.scaleY};this._firstRender?u.attr(c):Dt(u,c,t)}Lx(t.getGraph(),ad(t));var f=t.getData();s.updateData(f);var h=t.getEdgeData();l.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,i,n),clearTimeout(this._layoutTimeout);var p=t.forceLayout,d=t.get(["force","layoutAnimation"]);p&&this._startForceLayoutIteration(p,d);var g=t.get("layout");f.graph.eachNode(function(y){var x=y.dataIndex,M=y.getGraphicEl(),S=y.getModel();if(M){M.off("drag").off("dragend");var w=S.get("draggable");w&&M.on("drag",function(C){switch(g){case"force":p.warmUp(),!a._layouting&&a._startForceLayoutIteration(p,d),p.setFixed(x),f.setItemLayout(x,[M.x,M.y]);break;case"circular":f.setItemLayout(x,[M.x,M.y]),y.setLayout({fixed:!0},!0),Nv(t,"symbolSize",y,[C.offsetX,C.offsetY]),a.updateLayout(t);break;case"none":default:f.setItemLayout(x,[M.x,M.y]),Rx(t.getGraph(),t),a.updateLayout(t);break}}).on("dragend",function(){p&&p.setUnfixed(x)}),M.setDraggable(w,!!S.get("cursor"));var T=S.get(["emphasis","focus"]);T==="adjacency"&&(rt(M).focus=y.getAdjacentDataIndices())}}),f.graph.eachEdge(function(y){var x=y.getGraphicEl(),M=y.getModel().get(["emphasis","focus"]);x&&M==="adjacency"&&(rt(x).focus={edge:[y.dataIndex],node:[y.node1.dataIndex,y.node2.dataIndex]})});var m=t.get("layout")==="circular"&&t.get(["circular","rotateLabel"]),v=f.getLayout("cx"),_=f.getLayout("cy");f.graph.eachNode(function(y){pN(y,m,v,_)}),this._firstRender=!1},e.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype._startForceLayoutIteration=function(t,i){var n=this;(function a(){t.step(function(o){n.updateLayout(n._model),(n._layouting=!o)&&(i?n._layoutTimeout=setTimeout(a,16):a())})})()},e.prototype._updateController=function(t,i,n){var a=this,o=this._controller,s=this._controllerHost,l=this.group;if(o.setPointerChecker(function(u,c,f){var h=l.getBoundingRect();return h.applyTransform(l.transform),h.contain(c,f)&&!Wf(u,n,t)}),!rY(t.coordinateSystem)){o.disable();return}o.enable(t.get("roam")),s.zoomLimit=t.get("scaleLimit"),s.zoom=t.coordinateSystem.getZoom(),o.off("pan").off("zoom").on("pan",function(u){Av(s,u.dx,u.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:u.dx,dy:u.dy})}).on("zoom",function(u){Cv(s,u.scale,u.originX,u.originY),n.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:u.scale,originX:u.originX,originY:u.originY}),a._updateNodeAndLinkScale(),Lx(t.getGraph(),ad(t)),a._lineDraw.updateLayout(),n.updateLabelLayout()})},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,i=t.getData(),n=ad(t);i.eachItemGraphicEl(function(a,o){a&&a.setSymbolScale(n)})},e.prototype.updateLayout=function(t){Lx(t.getGraph(),ad(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},e.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},e.type="graph",e}(Yt),iY=sye;function Bv(r){return"_EC_"+r}var lye=function(){function r(e){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=e||!1}return r.prototype.isDirected=function(){return this._directed},r.prototype.addNode=function(e,t){e=e==null?""+t:""+e;var i=this._nodesMap;if(!i[Bv(e)]){var n=new sd(e,t);return n.hostGraph=this,this.nodes.push(n),i[Bv(e)]=n,n}},r.prototype.getNodeByIndex=function(e){var t=this.data.getRawIndex(e);return this.nodes[t]},r.prototype.getNodeById=function(e){return this._nodesMap[Bv(e)]},r.prototype.addEdge=function(e,t,i){var n=this._nodesMap,a=this._edgesMap;if(At(e)&&(e=this.nodes[e]),At(t)&&(t=this.nodes[t]),e instanceof sd||(e=n[Bv(e)]),t instanceof sd||(t=n[Bv(t)]),!(!e||!t)){var o=e.id+"-"+t.id,s=new nY(e,t,i);return s.hostGraph=this,this._directed&&(e.outEdges.push(s),t.inEdges.push(s)),e.edges.push(s),e!==t&&t.edges.push(s),this.edges.push(s),a[o]=s,s}},r.prototype.getEdgeByIndex=function(e){var t=this.edgeData.getRawIndex(e);return this.edges[t]},r.prototype.getEdge=function(e,t){e instanceof sd&&(e=e.id),t instanceof sd&&(t=t.id);var i=this._edgesMap;return this._directed?i[e+"-"+t]:i[e+"-"+t]||i[t+"-"+e]},r.prototype.eachNode=function(e,t){for(var i=this.nodes,n=i.length,a=0;a<n;a++)i[a].dataIndex>=0&&e.call(t,i[a],a)},r.prototype.eachEdge=function(e,t){for(var i=this.edges,n=i.length,a=0;a<n;a++)i[a].dataIndex>=0&&i[a].node1.dataIndex>=0&&i[a].node2.dataIndex>=0&&e.call(t,i[a],a)},r.prototype.breadthFirstTraverse=function(e,t,i,n){if(t instanceof sd||(t=this._nodesMap[Bv(t)]),!!t){for(var a=i==="out"?"outEdges":i==="in"?"inEdges":"edges",o=0;o<this.nodes.length;o++)this.nodes[o].__visited=!1;if(!e.call(n,t,null))for(var s=[t];s.length;)for(var l=s.shift(),u=l[a],o=0;o<u.length;o++){var c=u[o],f=c.node1===l?c.node2:c.node1;if(!f.__visited){if(e.call(n,f,l))return;s.push(f),f.__visited=!0}}}},r.prototype.update=function(){for(var e=this.data,t=this.edgeData,i=this.nodes,n=this.edges,a=0,o=i.length;a<o;a++)i[a].dataIndex=-1;for(var a=0,o=e.count();a<o;a++)i[e.getRawIndex(a)].dataIndex=a;t.filterSelf(function(s){var l=n[t.getRawIndex(s)];return l.node1.dataIndex>=0&&l.node2.dataIndex>=0});for(var a=0,o=n.length;a<o;a++)n[a].dataIndex=-1;for(var a=0,o=t.count();a<o;a++)n[t.getRawIndex(a)].dataIndex=a},r.prototype.clone=function(){for(var e=new r(this._directed),t=this.nodes,i=this.edges,n=0;n<t.length;n++)e.addNode(t[n].id,t[n].dataIndex);for(var n=0;n<i.length;n++){var a=i[n];e.addEdge(a.node1.id,a.node2.id,a.dataIndex)}return e},r}(),sd=function(){function r(e,t){this.inEdges=[],this.outEdges=[],this.edges=[],this.dataIndex=-1,this.id=e??"",this.dataIndex=t??-1}return r.prototype.degree=function(){return this.edges.length},r.prototype.inDegree=function(){return this.inEdges.length},r.prototype.outDegree=function(){return this.outEdges.length},r.prototype.getModel=function(e){if(!(this.dataIndex<0)){var t=this.hostGraph,i=t.data.getItemModel(this.dataIndex);return i.getModel(e)}},r.prototype.getAdjacentDataIndices=function(){for(var e={edge:[],node:[]},t=0;t<this.edges.length;t++){var i=this.edges[t];i.dataIndex<0||(e.edge.push(i.dataIndex),e.node.push(i.node1.dataIndex,i.node2.dataIndex))}return e},r.prototype.getTrajectoryDataIndices=function(){for(var e=ke(),t=ke(),i=0;i<this.edges.length;i++){var n=this.edges[i];if(!(n.dataIndex<0)){e.set(n.dataIndex,!0);for(var a=[n.node1],o=[n.node2],s=0;s<a.length;){var l=a[s];s++,t.set(l.dataIndex,!0);for(var u=0;u<l.inEdges.length;u++)e.set(l.inEdges[u].dataIndex,!0),a.push(l.inEdges[u].node1)}for(s=0;s<o.length;){var c=o[s];s++,t.set(c.dataIndex,!0);for(var u=0;u<c.outEdges.length;u++)e.set(c.outEdges[u].dataIndex,!0),o.push(c.outEdges[u].node2)}}}return{edge:e.keys(),node:t.keys()}},r}(),nY=function(){function r(e,t,i){this.dataIndex=-1,this.node1=e,this.node2=t,this.dataIndex=i??-1}return r.prototype.getModel=function(e){if(!(this.dataIndex<0)){var t=this.hostGraph,i=t.edgeData.getItemModel(this.dataIndex);return i.getModel(e)}},r.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},r.prototype.getTrajectoryDataIndices=function(){var e=ke(),t=ke();e.set(this.dataIndex,!0);for(var i=[this.node1],n=[this.node2],a=0;a<i.length;){var o=i[a];a++,t.set(o.dataIndex,!0);for(var s=0;s<o.inEdges.length;s++)e.set(o.inEdges[s].dataIndex,!0),i.push(o.inEdges[s].node1)}for(a=0;a<n.length;){var l=n[a];a++,t.set(l.dataIndex,!0);for(var s=0;s<l.outEdges.length;s++)e.set(l.outEdges[s].dataIndex,!0),n.push(l.outEdges[s].node2)}return{edge:e.keys(),node:t.keys()}},r}();function aY(r,e){return{getValue:function(t){var i=this[r][e];return i.getStore().get(i.getDimensionIndex(t||"value"),this.dataIndex)},setVisual:function(t,i){this.dataIndex>=0&&this[r][e].setItemVisual(this.dataIndex,t,i)},getVisual:function(t){return this[r][e].getItemVisual(this.dataIndex,t)},setLayout:function(t,i){this.dataIndex>=0&&this[r][e].setItemLayout(this.dataIndex,t,i)},getLayout:function(){return this[r][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[r][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[r][e].getRawIndex(this.dataIndex)}}}wr(sd,aY("hostGraph","data"));wr(nY,aY("hostGraph","edgeData"));var oY=lye;function Px(r,e,t,i,n){for(var a=new oY(i),o=0;o<r.length;o++)a.addNode(Br(r[o].id,r[o].name,o),o);for(var s=[],l=[],u=0,o=0;o<e.length;o++){var c=e[o],f=c.source,h=c.target;a.addEdge(f,h,u)&&(l.push(c),s.push(Br(Yr(c.id,null),f+" > "+h)),u++)}var p=t.get("coordinateSystem"),d;if(p==="cartesian2d"||p==="polar")d=hn(r,t);else{var g=Uu.get(p),m=g?g.dimensions||[]:[];dt(m,"value")<0&&m.concat(["value"]);var v=js(r,{coordDimensions:m,encodeDefine:t.getEncode()}).dimensions;d=new ti(v,t),d.initData(r)}var _=new ti(["value"],t);return _.initData(l,s),n&&n(d,_),_T({mainData:d,struct:a,structAttr:"graph",datas:{node:d,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a}var uye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments);var i=this;function n(){return i._categoriesData}this.legendVisualProvider=new jl(n,n),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},e.prototype.mergeDefaultAndTheme=function(t){r.prototype.mergeDefaultAndTheme.apply(this,arguments),yo(t,"edgeLabel",["show"])},e.prototype.getInitialData=function(t,i){var n=t.edges||t.links||[],a=t.data||t.nodes||[],o=this;if(a&&n){G7(this);var s=Px(a,n,this,!0,l);return N(s.edges,function(u){H7(u.node1,u.node2,this,u.dataIndex)},this),s.data}function l(u,c){u.wrapMethod("getItemModel",function(d){var g=o._categoriesModels,m=d.getShallow("category"),v=g[m];return v&&(v.parentModel=d.parentModel,d.parentModel=v),d});var f=Zt.prototype.getModel;function h(d,g){var m=f.call(this,d,g);return m.resolveParentPath=p,m}c.wrapMethod("getItemModel",function(d){return d.resolveParentPath=p,d.getModel=h,d});function p(d){if(d&&(d[0]==="label"||d[1]==="label")){var g=d.slice();return d[0]==="label"?g[0]="edgeLabel":d[1]==="label"&&(g[1]="edgeLabel"),g}return d}}},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.getCategoriesData=function(){return this._categoriesData},e.prototype.formatTooltip=function(t,i,n){if(n==="edge"){var a=this.getData(),o=this.getDataParams(t,n),s=a.graph.getEdgeByIndex(t),l=a.getName(s.node1.dataIndex),u=a.getName(s.node2.dataIndex),c=[];return l!=null&&c.push(l),u!=null&&c.push(u),Or("nameValue",{name:c.join(" > "),value:o.value,noValue:o.value==null})}var f=Zw({series:this,dataIndex:t,multipleSeries:i});return f},e.prototype._updateCategoriesData=function(){var t=de(this.option.categories||[],function(n){return n.value!=null?n:fe({value:0},n)}),i=new ti(["value"],this);i.initData(t),this._categoriesData=i,this._categoriesModels=i.mapArray(function(n){return i.getItemModel(n)})},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.isAnimationEnabled=function(){return r.prototype.isAnimationEnabled.call(this)&&!(this.get("layout")==="force"&&this.get(["force","layoutAnimation"]))},e.type="series.graph",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(jt),sY=uye;var cye={type:"graphRoam",event:"graphRoam",update:"none"};function EN(r){r.registerChartView(iY),r.registerSeriesModel(sY),r.registerProcessor(oN),r.registerVisual(sN),r.registerVisual(lN),r.registerLayout(fN),r.registerLayout(r.PRIORITY.VISUAL.POST_CHART_LAYOUT,dN),r.registerLayout(mN),r.registerCoordinateSystem("graphView",{dimensions:Vu.dimensions,create:vN}),r.registerAction({type:"focusNodeAdjacency",event:"focusNodeAdjacency",update:"series:focusNodeAdjacency"},Ir),r.registerAction({type:"unfocusNodeAdjacency",event:"unfocusNodeAdjacency",update:"series:unfocusNodeAdjacency"},Ir),r.registerAction(cye,function(e,t,i){t.eachComponent({mainType:"series",query:e},function(n){var a=n.coordinateSystem,o=Rv(a,e,void 0,i);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}var fye=function(){function r(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return r}(),hye=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="pointer",i}return e.prototype.getDefaultShape=function(){return new fye},e.prototype.buildPath=function(t,i){var n=Math.cos,a=Math.sin,o=i.r,s=i.width,l=i.angle,u=i.x-n(l)*s*(s>=o/3?1:2),c=i.y-a(l)*s*(s>=o/3?1:2);l=i.angle-Math.PI/2,t.moveTo(u,c),t.lineTo(i.x+n(l)*s,i.y+a(l)*s),t.lineTo(i.x+n(i.angle)*o,i.y+a(i.angle)*o),t.lineTo(i.x-n(l)*s,i.y-a(l)*s),t.lineTo(u,c)},e}(ut),lY=hye;function pye(r,e){var t=r.get("center"),i=e.getWidth(),n=e.getHeight(),a=Math.min(i,n),o=Fe(t[0],e.getWidth()),s=Fe(t[1],e.getHeight()),l=Fe(r.get("radius"),a/2);return{cx:o,cy:s,r:l}}function CT(r,e){var t=r==null?"":r+"";return e&&(Ce(e)?t=e.replace("{value}",t):He(e)&&(t=e(r))),t}var dye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){this.group.removeAll();var a=t.get(["axisLine","lineStyle","color"]),o=pye(t,n);this._renderMain(t,i,n,a,o),this._data=t.getData()},e.prototype.dispose=function(){},e.prototype._renderMain=function(t,i,n,a,o){var s=this.group,l=t.get("clockwise"),u=-t.get("startAngle")/180*Math.PI,c=-t.get("endAngle")/180*Math.PI,f=t.getModel("axisLine"),h=f.get("roundCap"),p=h?Tv:yi,d=f.get("show"),g=f.getModel("lineStyle"),m=g.get("width"),v=[u,c];l_(v,!l),u=v[0],c=v[1];for(var _=c-u,y=u,x=[],M=0;d&&M<a.length;M++){var S=Math.min(Math.max(a[M][0],0),1);c=u+_*S;var w=new p({shape:{startAngle:y,endAngle:c,cx:o.cx,cy:o.cy,clockwise:l,r0:o.r-m,r:o.r},silent:!0});w.setStyle({fill:a[M][1]}),w.setStyle(g.getLineStyle(["color","width"])),x.push(w),y=c}x.reverse(),N(x,function(C){return s.add(C)});var T=function(C){if(C<=0)return a[0][1];var b;for(b=0;b<a.length;b++)if(a[b][0]>=C&&(b===0?0:a[b-1][0])<C)return a[b][1];return a[b-1][1]};this._renderTicks(t,i,n,T,o,u,c,l,m),this._renderTitleAndDetail(t,i,n,T,o),this._renderAnchor(t,o),this._renderPointer(t,i,n,T,o,u,c,l,m)},e.prototype._renderTicks=function(t,i,n,a,o,s,l,u,c){for(var f=this.group,h=o.cx,p=o.cy,d=o.r,g=+t.get("min"),m=+t.get("max"),v=t.getModel("splitLine"),_=t.getModel("axisTick"),y=t.getModel("axisLabel"),x=t.get("splitNumber"),M=_.get("splitNumber"),S=Fe(v.get("length"),d),w=Fe(_.get("length"),d),T=s,C=(l-s)/x,b=C/M,E=v.getModel("lineStyle").getLineStyle(),I=_.getModel("lineStyle").getLineStyle(),R=v.get("distance"),A,D,U=0;U<=x;U++){if(A=Math.cos(T),D=Math.sin(T),v.get("show")){var B=R?R+c:c,F=new Kr({shape:{x1:A*(d-B)+h,y1:D*(d-B)+p,x2:A*(d-S-B)+h,y2:D*(d-S-B)+p},style:E,silent:!0});E.stroke==="auto"&&F.setStyle({stroke:a(U/x)}),f.add(F)}if(y.get("show")){var B=y.get("distance")+R,k=CT(Ar(U/x*(m-g)+g),y.get("formatter")),G=a(U/x),Y=A*(d-S-B)+h,J=D*(d-S-B)+p,Q=y.get("rotate"),V=0;Q==="radial"?(V=-T+2*Math.PI,V>Math.PI/2&&(V+=Math.PI)):Q==="tangential"?V=-T-Math.PI/2:At(Q)&&(V=Q*Math.PI/180),V===0?f.add(new Lt({style:fr(y,{text:k,x:Y,y:J,verticalAlign:D<-.8?"top":D>.8?"bottom":"middle",align:A<-.4?"left":A>.4?"right":"center"},{inheritColor:G}),silent:!0})):f.add(new Lt({style:fr(y,{text:k,x:Y,y:J,verticalAlign:"middle",align:"center"},{inheritColor:G}),silent:!0,originX:Y,originY:J,rotation:V}))}if(_.get("show")&&U!==x){var B=_.get("distance");B=B?B+c:c;for(var K=0;K<=M;K++){A=Math.cos(T),D=Math.sin(T);var ae=new Kr({shape:{x1:A*(d-B)+h,y1:D*(d-B)+p,x2:A*(d-w-B)+h,y2:D*(d-w-B)+p},silent:!0,style:I});I.stroke==="auto"&&ae.setStyle({stroke:a((U+K/M)/x)}),f.add(ae),T+=b}T-=b}else T+=C}},e.prototype._renderPointer=function(t,i,n,a,o,s,l,u,c){var f=this.group,h=this._data,p=this._progressEls,d=[],g=t.get(["pointer","show"]),m=t.getModel("progress"),v=m.get("show"),_=t.getData(),y=_.mapDimension("value"),x=+t.get("min"),M=+t.get("max"),S=[x,M],w=[s,l];function T(b,E){var I=_.getItemModel(b),R=I.getModel("pointer"),A=Fe(R.get("width"),o.r),D=Fe(R.get("length"),o.r),U=t.get(["pointer","icon"]),B=R.get("offsetCenter"),F=Fe(B[0],o.r),k=Fe(B[1],o.r),G=R.get("keepAspect"),Y;return U?Y=Sr(U,F-A/2,k-D,A,D,null,G):Y=new lY({shape:{angle:-Math.PI/2,width:A,r:D,x:F,y:k}}),Y.rotation=-(E+Math.PI/2),Y.x=o.cx,Y.y=o.cy,Y}function C(b,E){var I=m.get("roundCap"),R=I?Tv:yi,A=m.get("overlap"),D=A?m.get("width"):c/_.count(),U=A?o.r-D:o.r-(b+1)*D,B=A?o.r:o.r-b*D,F=new R({shape:{startAngle:s,endAngle:E,cx:o.cx,cy:o.cy,clockwise:u,r0:U,r:B}});return A&&(F.z2=M-_.get(y,b)%M),F}(v||g)&&(_.diff(h).add(function(b){var E=_.get(y,b);if(g){var I=T(b,s);ar(I,{rotation:-((isNaN(+E)?w[0]:rr(E,S,w,!0))+Math.PI/2)},t),f.add(I),_.setItemGraphicEl(b,I)}if(v){var R=C(b,s),A=m.get("clip");ar(R,{shape:{endAngle:rr(E,S,w,A)}},t),f.add(R),c_(t.seriesIndex,_.dataType,b,R),d[b]=R}}).update(function(b,E){var I=_.get(y,b);if(g){var R=h.getItemGraphicEl(E),A=R?R.rotation:s,D=T(b,A);D.rotation=A,Dt(D,{rotation:-((isNaN(+I)?w[0]:rr(I,S,w,!0))+Math.PI/2)},t),f.add(D),_.setItemGraphicEl(b,D)}if(v){var U=p[E],B=U?U.shape.endAngle:s,F=C(b,B),k=m.get("clip");Dt(F,{shape:{endAngle:rr(I,S,w,k)}},t),f.add(F),c_(t.seriesIndex,_.dataType,b,F),d[b]=F}}).execute(),_.each(function(b){var E=_.getItemModel(b),I=E.getModel("emphasis"),R=I.get("focus"),A=I.get("blurScope"),D=I.get("disabled");if(g){var U=_.getItemGraphicEl(b),B=_.getItemVisual(b,"style"),F=B.fill;if(U instanceof Ur){var k=U.style;U.useStyle(fe({image:k.image,x:k.x,y:k.y,width:k.width,height:k.height},B))}else U.useStyle(B),U.type!=="pointer"&&U.setColor(F);U.setStyle(E.getModel(["pointer","itemStyle"]).getItemStyle()),U.style.fill==="auto"&&U.setStyle("fill",a(rr(_.get(y,b),S,[0,1],!0))),U.z2EmphasisLift=0,Gr(U,E),nr(U,R,A,D)}if(v){var G=d[b];G.useStyle(_.getItemVisual(b,"style")),G.setStyle(E.getModel(["progress","itemStyle"]).getItemStyle()),G.z2EmphasisLift=0,Gr(G,E),nr(G,R,A,D)}}),this._progressEls=d)},e.prototype._renderAnchor=function(t,i){var n=t.getModel("anchor"),a=n.get("show");if(a){var o=n.get("size"),s=n.get("icon"),l=n.get("offsetCenter"),u=n.get("keepAspect"),c=Sr(s,i.cx-o/2+Fe(l[0],i.r),i.cy-o/2+Fe(l[1],i.r),o,o,null,u);c.z2=n.get("showAbove")?1:0,c.setStyle(n.getModel("itemStyle").getItemStyle()),this.group.add(c)}},e.prototype._renderTitleAndDetail=function(t,i,n,a,o){var s=this,l=t.getData(),u=l.mapDimension("value"),c=+t.get("min"),f=+t.get("max"),h=new Ze,p=[],d=[],g=t.isAnimationEnabled(),m=t.get(["pointer","showAbove"]);l.diff(this._data).add(function(v){p[v]=new Lt({silent:!0}),d[v]=new Lt({silent:!0})}).update(function(v,_){p[v]=s._titleEls[_],d[v]=s._detailEls[_]}).execute(),l.each(function(v){var _=l.getItemModel(v),y=l.get(u,v),x=new Ze,M=a(rr(y,[c,f],[0,1],!0)),S=_.getModel("title");if(S.get("show")){var w=S.get("offsetCenter"),T=o.cx+Fe(w[0],o.r),C=o.cy+Fe(w[1],o.r),b=p[v];b.attr({z2:m?0:2,style:fr(S,{x:T,y:C,text:l.getName(v),align:"center",verticalAlign:"middle"},{inheritColor:M})}),x.add(b)}var E=_.getModel("detail");if(E.get("show")){var I=E.get("offsetCenter"),R=o.cx+Fe(I[0],o.r),A=o.cy+Fe(I[1],o.r),D=Fe(E.get("width"),o.r),U=Fe(E.get("height"),o.r),B=t.get(["progress","show"])?l.getItemVisual(v,"style").fill:M,b=d[v],F=E.get("formatter");b.attr({z2:m?0:2,style:fr(E,{x:R,y:A,text:CT(y,F),width:isNaN(D)?null:D,height:isNaN(U)?null:U,align:"center",verticalAlign:"middle"},{inheritColor:B})}),vw(b,{normal:E},y,function(G){return CT(G,F)}),g&&gw(b,v,l,t,{getFormattedLabel:function(G,Y,J,Q,V,K){return CT(K?K.interpolatedValue:y,F)}}),x.add(b)}h.add(x)}),this.group.add(h),this._titleEls=p,this._detailEls=d},e.type="gauge",e}(Yt),uY=dye;var mye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.visualStyleAccessPath="itemStyle",t}return e.prototype.getInitialData=function(t,i){return To(this,["value"])},e.type="series.gauge",e.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,"#E6EBF8"]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:"#63677A",width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:"#63677A",width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:"#464646",fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:"#fff",borderWidth:0,borderColor:"#5470c6"}},title:{show:!0,offsetCenter:[0,"20%"],color:"#464646",fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:"rgba(0,0,0,0)",borderWidth:0,borderColor:"#ccc",width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:"#464646",fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},e}(jt),cY=mye;function AN(r){r.registerChartView(uY),r.registerSeriesModel(cY)}var vye=["itemStyle","opacity"],gye=function(r){Z(e,r);function e(t,i){var n=r.call(this)||this,a=n,o=new $r,s=new Lt;return a.setTextContent(s),n.setTextGuideLine(o),n.updateData(t,i,!0),n}return e.prototype.updateData=function(t,i,n){var a=this,o=t.hostModel,s=t.getItemModel(i),l=t.getItemLayout(i),u=s.getModel("emphasis"),c=s.get(vye);c=c??1,n||Ii(a),a.useStyle(t.getItemVisual(i,"style")),a.style.lineJoin="round",n?(a.setShape({points:l.points}),a.style.opacity=0,ar(a,{style:{opacity:c}},o,i)):Dt(a,{style:{opacity:c},shape:{points:l.points}},o,i),Gr(a,s),this._updateLabel(t,i),nr(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},e.prototype._updateLabel=function(t,i){var n=this,a=this.getTextGuideLine(),o=n.getTextContent(),s=t.hostModel,l=t.getItemModel(i),u=t.getItemLayout(i),c=u.label,f=t.getItemVisual(i,"style"),h=f.fill;Nr(o,Tr(l),{labelFetcher:t.hostModel,labelDataIndex:i,defaultOpacity:f.opacity,defaultText:t.getName(i)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}}),n.setTextConfig({local:!0,inside:!!c.inside,insideStroke:h,outsideFill:h});var p=c.linePoints;a.setShape({points:p}),n.textGuideLineConfig={anchor:p?new Nt(p[0][0],p[0][1]):null},Dt(o,{style:{x:c.x,y:c.y}},s,i),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),Sv(n,Mv(l),{stroke:h})},e}(ei),yye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.ignoreLabelLineUpdate=!0,t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this._data,s=this.group;a.diff(o).add(function(l){var u=new gye(a,l);a.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,l),s.add(c),a.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);Cu(u,t,l)}).execute(),this._data=a},e.prototype.remove=function(){this.group.removeAll(),this._data=null},e.prototype.dispose=function(){},e.type="funnel",e}(Yt),fY=yye;var _ye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new jl(Be(this.getData,this),Be(this.getRawData,this)),this._defaultLabelLine(t)},e.prototype.getInitialData=function(t,i){return To(this,{coordDimensions:["value"],encodeDefaulter:ot(uv,this)})},e.prototype._defaultLabelLine=function(t){yo(t,"labelLine",["show"]);var i=t.labelLine,n=t.emphasis.labelLine;i.show=i.show&&t.label.show,n.show=n.show&&t.emphasis.label.show},e.prototype.getDataParams=function(t){var i=this.getData(),n=r.prototype.getDataParams.call(this,t),a=i.mapDimension("value"),o=i.getSum(a);return n.percent=o?+(i.get(a,t)/o*100).toFixed(2):0,n.$vars.push("percent"),n},e.type="series.funnel",e.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(jt),hY=_ye;function xye(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function Sye(r,e){for(var t=r.mapDimension("value"),i=r.mapArray(t,function(l){return l}),n=[],a=e==="ascending",o=0,s=r.count();o<s;o++)n[o]=o;return He(e)?n.sort(e):e!=="none"&&n.sort(function(l,u){return a?i[l]-i[u]:i[u]-i[l]}),n}function Mye(r){var e=r.hostModel,t=e.get("orient");r.each(function(i){var n=r.getItemModel(i),a=n.getModel("label"),o=a.get("position"),s=n.getModel("labelLine"),l=r.getItemLayout(i),u=l.points,c=o==="inner"||o==="inside"||o==="center"||o==="insideLeft"||o==="insideRight",f,h,p,d;if(c)o==="insideLeft"?(h=(u[0][0]+u[3][0])/2+5,p=(u[0][1]+u[3][1])/2,f="left"):o==="insideRight"?(h=(u[1][0]+u[2][0])/2-5,p=(u[1][1]+u[2][1])/2,f="right"):(h=(u[0][0]+u[1][0]+u[2][0]+u[3][0])/4,p=(u[0][1]+u[1][1]+u[2][1]+u[3][1])/4,f="center"),d=[[h,p],[h,p]];else{var g=void 0,m=void 0,v=void 0,_=void 0,y=s.get("length");o==="left"?(g=(u[3][0]+u[0][0])/2,m=(u[3][1]+u[0][1])/2,v=g-y,h=v-5,f="right"):o==="right"?(g=(u[1][0]+u[2][0])/2,m=(u[1][1]+u[2][1])/2,v=g+y,h=v+5,f="left"):o==="top"?(g=(u[3][0]+u[0][0])/2,m=(u[3][1]+u[0][1])/2,_=m-y,p=_-5,f="center"):o==="bottom"?(g=(u[1][0]+u[2][0])/2,m=(u[1][1]+u[2][1])/2,_=m+y,p=_+5,f="center"):o==="rightTop"?(g=t==="horizontal"?u[3][0]:u[1][0],m=t==="horizontal"?u[3][1]:u[1][1],t==="horizontal"?(_=m-y,p=_-5,f="center"):(v=g+y,h=v+5,f="top")):o==="rightBottom"?(g=u[2][0],m=u[2][1],t==="horizontal"?(_=m+y,p=_+5,f="center"):(v=g+y,h=v+5,f="bottom")):o==="leftTop"?(g=u[0][0],m=t==="horizontal"?u[0][1]:u[1][1],t==="horizontal"?(_=m-y,p=_-5,f="center"):(v=g-y,h=v-5,f="right")):o==="leftBottom"?(g=t==="horizontal"?u[1][0]:u[3][0],m=t==="horizontal"?u[1][1]:u[2][1],t==="horizontal"?(_=m+y,p=_+5,f="center"):(v=g-y,h=v-5,f="right")):(g=(u[1][0]+u[2][0])/2,m=(u[1][1]+u[2][1])/2,t==="horizontal"?(_=m+y,p=_+5,f="center"):(v=g+y,h=v+5,f="left")),t==="horizontal"?(v=g,h=v):(_=m,p=_),d=[[g,m],[v,_]]}l.label={linePoints:d,x:h,y:p,verticalAlign:"middle",textAlign:f,inside:c}})}function CN(r,e){r.eachSeriesByType("funnel",function(t){var i=t.getData(),n=i.mapDimension("value"),a=t.get("sort"),o=xye(t,e),s=t.get("orient"),l=o.width,u=o.height,c=Sye(i,a),f=o.x,h=o.y,p=s==="horizontal"?[Fe(t.get("minSize"),u),Fe(t.get("maxSize"),u)]:[Fe(t.get("minSize"),l),Fe(t.get("maxSize"),l)],d=i.getDataExtent(n),g=t.get("min"),m=t.get("max");g==null&&(g=Math.min(d[0],0)),m==null&&(m=d[1]);var v=t.get("funnelAlign"),_=t.get("gap"),y=s==="horizontal"?l:u,x=(y-_*(i.count()-1))/i.count(),M=function(A,D){if(s==="horizontal"){var U=i.get(n,A)||0,B=rr(U,[g,m],p,!0),F=void 0;switch(v){case"top":F=h;break;case"center":F=h+(u-B)/2;break;case"bottom":F=h+(u-B);break}return[[D,F],[D,F+B]]}var k=i.get(n,A)||0,G=rr(k,[g,m],p,!0),Y;switch(v){case"left":Y=f;break;case"center":Y=f+(l-G)/2;break;case"right":Y=f+l-G;break}return[[Y,D],[Y+G,D]]};a==="ascending"&&(x=-x,_=-_,s==="horizontal"?f+=l:h+=u,c=c.reverse());for(var S=0;S<c.length;S++){var w=c[S],T=c[S+1],C=i.getItemModel(w);if(s==="horizontal"){var b=C.get(["itemStyle","width"]);b==null?b=x:(b=Fe(b,l),a==="ascending"&&(b=-b));var E=M(w,f),I=M(T,f+b);f+=b+_,i.setItemLayout(w,{points:E.concat(I.slice().reverse())})}else{var R=C.get(["itemStyle","height"]);R==null?R=x:(R=Fe(R,u),a==="ascending"&&(R=-R));var E=M(w,h),I=M(T,h+R);h+=R+_,i.setItemLayout(w,{points:E.concat(I.slice().reverse())})}}Mye(i)})}function RN(r){r.registerChartView(fY),r.registerSeriesModel(hY),r.registerLayout(CN),r.registerProcessor(tl("funnel"))}var bye=.3,wye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._dataGroup=new Ze,t._initialized=!1,t}return e.prototype.init=function(){this.group.add(this._dataGroup)},e.prototype.render=function(t,i,n,a){this._progressiveEls=null;var o=this._dataGroup,s=t.getData(),l=this._data,u=t.coordinateSystem,c=u.dimensions,f=dY(t);s.diff(l).add(h).update(p).remove(d).execute();function h(m){var v=pY(s,o,m,c,u);LN(v,s,m,f)}function p(m,v){var _=l.getItemGraphicEl(v),y=mY(s,m,c,u);s.setItemGraphicEl(m,_),Dt(_,{shape:{points:y}},t,m),Ii(_),LN(_,s,m,f)}function d(m){var v=l.getItemGraphicEl(m);o.remove(v)}if(!this._initialized){this._initialized=!0;var g=Tye(u,t,function(){setTimeout(function(){o.removeClipPath()})});o.setClipPath(g)}this._data=s},e.prototype.incrementalPrepareRender=function(t,i,n){this._initialized=!0,this._data=null,this._dataGroup.removeAll()},e.prototype.incrementalRender=function(t,i,n){for(var a=i.getData(),o=i.coordinateSystem,s=o.dimensions,l=dY(i),u=this._progressiveEls=[],c=t.start;c<t.end;c++){var f=pY(a,this._dataGroup,c,s,o);f.incremental=!0,LN(f,a,c,l),u.push(f)}},e.prototype.remove=function(){this._dataGroup&&this._dataGroup.removeAll(),this._data=null},e.type="parallel",e}(Yt);function Tye(r,e,t){var i=r.model,n=r.getRect(),a=new Tt({shape:{x:n.x,y:n.y,width:n.width,height:n.height}}),o=i.get("layout")==="horizontal"?"width":"height";return a.setShape(o,0),ar(a,{shape:{width:n.width,height:n.height}},e,t),a}function mY(r,e,t,i){for(var n=[],a=0;a<t.length;a++){var o=t[a],s=r.get(r.mapDimension(o),e);Eye(s,i.getAxis(o).type)||n.push(i.dataToPoint(s,o))}return n}function pY(r,e,t,i,n){var a=mY(r,t,i,n),o=new $r({shape:{points:a},z2:10});return e.add(o),r.setItemGraphicEl(t,o),o}function dY(r){var e=r.get("smooth",!0);return e===!0&&(e=bye),e=Pa(e),sf(e)&&(e=0),{smooth:e}}function LN(r,e,t,i){r.useStyle(e.getItemVisual(t,"style")),r.style.fill=null,r.setShape("smooth",i.smooth);var n=e.getItemModel(t),a=n.getModel("emphasis");Gr(r,n,"lineStyle"),nr(r,a.get("focus"),a.get("blurScope"),a.get("disabled"))}function Eye(r,e){return e==="category"?r==null:r==null||isNaN(r)}var vY=wye;var Aye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.visualStyleAccessPath="lineStyle",t.visualDrawType="stroke",t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{useEncodeDefaulter:Be(Cye,null,this)})},e.prototype.getRawIndicesByActiveState=function(t){var i=this.coordinateSystem,n=this.getData(),a=[];return i.eachActiveState(n,function(o,s){t===o&&a.push(n.getRawIndex(s))}),a},e.type="series.parallel",e.dependencies=["parallel"],e.defaultOption={z:2,coordinateSystem:"parallel",parallelIndex:0,label:{show:!1},inactiveOpacity:.05,activeOpacity:1,lineStyle:{width:1,opacity:.45,type:"solid"},emphasis:{label:{show:!1}},progressive:500,smooth:!1,animationEasing:"linear"},e}(jt);function Cye(r){var e=r.ecModel.getComponent("parallel",r.get("parallelIndex"));if(e){var t={};return N(e.dimensions,function(i){var n=Rye(i);t[i]=n}),t}}function Rye(r){return+r.replace("dim","")}var gY=Aye;var Lye=["lineStyle","opacity"],Pye={seriesType:"parallel",reset:function(r,e){var t=r.coordinateSystem,i={normal:r.get(["lineStyle","opacity"]),active:r.get("activeOpacity"),inactive:r.get("inactiveOpacity")};return{progress:function(n,a){t.eachActiveState(a,function(o,s){var l=i[o];if(o==="normal"&&a.hasItemOption){var u=a.getItemModel(s).get(Lye,!0);u!=null&&(l=u)}var c=a.ensureUniqueItemVisual(s,"style");c.opacity=l},n.start,n.end)}}}},yY=Pye;function PN(r){Dye(r),Iye(r)}function Dye(r){if(!r.parallel){var e=!1;N(r.series,function(t){t&&t.type==="parallel"&&(e=!0)}),e&&(r.parallel=[{}])}}function Iye(r){var e=Jt(r.parallelAxis);N(e,function(t){if(qe(t)){var i=t.parallelIndex||0,n=Jt(r.parallel)[i];n&&n.parallelAxisDefault&&_t(t,n.parallelAxisDefault,!1)}})}var Nye=5,Uye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){this._model=t,this._api=n,this._handlers||(this._handlers={},N(Oye,function(a,o){n.getZr().on(o,this._handlers[o]=Be(a,this))},this)),as(this,"_throttledDispatchExpand",t.get("axisExpandRate"),"fixRate")},e.prototype.dispose=function(t,i){zu(this,"_throttledDispatchExpand"),N(this._handlers,function(n,a){i.getZr().off(a,n)}),this._handlers=null},e.prototype._throttledDispatchExpand=function(t){this._dispatchExpand(t)},e.prototype._dispatchExpand=function(t){t&&this._api.dispatchAction(fe({type:"parallelAxisExpand"},t))},e.type="parallel",e}(Qt),Oye={mousedown:function(r){DN(this,"click")&&(this._mouseDownPoint=[r.offsetX,r.offsetY])},mouseup:function(r){var e=this._mouseDownPoint;if(DN(this,"click")&&e){var t=[r.offsetX,r.offsetY],i=Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2);if(i>Nye)return;var n=this._model.coordinateSystem.getSlidedAxisExpandWindow([r.offsetX,r.offsetY]);n.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:n.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(r){if(!(this._mouseDownPoint||!DN(this,"mousemove"))){var e=this._model,t=e.coordinateSystem.getSlidedAxisExpandWindow([r.offsetX,r.offsetY]),i=t.behavior;i==="jump"&&this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")),this._throttledDispatchExpand(i==="none"?null:{axisExpandWindow:t.axisExpandWindow,animation:i==="jump"?null:{duration:0}})}}};function DN(r,e){var t=r._model;return t.get("axisExpandable")&&t.get("axisExpandTriggerOn")===e}var _Y=Uye;var Fye=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){r.prototype.init.apply(this,arguments),this.mergeOption({})},e.prototype.mergeOption=function(t){var i=this.option;t&&_t(i,t,!0),this._initDimensions()},e.prototype.contains=function(t,i){var n=t.get("parallelIndex");return n!=null&&i.getComponent("parallel",n)===this},e.prototype.setAxisExpand=function(t){N(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(i){t.hasOwnProperty(i)&&(this.option[i]=t[i])},this)},e.prototype._initDimensions=function(){var t=this.dimensions=[],i=this.parallelAxisIndex=[],n=Wt(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(a){return(a.get("parallelIndex")||0)===this.componentIndex},this);N(n,function(a){t.push("dim"+a.get("dim")),i.push(a.componentIndex)})},e.type="parallel",e.dependencies=["parallelAxis"],e.layoutMode="box",e.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},e}(Pt),xY=Fye;var zye=function(r){Z(e,r);function e(t,i,n,a,o){var s=r.call(this,t,i,n)||this;return s.type=a||"value",s.axisIndex=o,s}return e.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},e}(pn),SY=zye;function Xa(r,e,t,i,n,a){r=r||0;var o=t[1]-t[0];if(n!=null&&(n=kv(n,[0,o])),a!=null&&(a=Math.max(a,n??0)),i==="all"){var s=Math.abs(e[1]-e[0]);s=kv(s,[0,o]),n=a=kv(s,[n,a]),i=0}e[0]=kv(e[0],t),e[1]=kv(e[1],t);var l=IN(e,i);e[i]+=r;var u=n||0,c=t.slice();l.sign<0?c[0]+=u:c[1]-=u,e[i]=kv(e[i],c);var f;return f=IN(e,i),n!=null&&(f.sign!==l.sign||f.span<n)&&(e[1-i]=e[i]+l.sign*n),f=IN(e,i),a!=null&&f.span>a&&(e[1-i]=e[i]+f.sign*a),e}function IN(r,e){var t=r[e]-r[1-e];return{span:Math.abs(t),sign:t>0?-1:t<0?1:e?-1:1}}function kv(r,e){return Math.min(e[1]!=null?e[1]:1/0,Math.max(e[0]!=null?e[0]:-1/0,r))}var NN=N,wY=Math.min,TY=Math.max,MY=Math.floor,Bye=Math.ceil,bY=Ar,kye=Math.PI,Vye=function(){function r(e,t,i){this.type="parallel",this._axesMap=ke(),this._axesLayout={},this.dimensions=e.dimensions,this._model=e,this._init(e,t,i)}return r.prototype._init=function(e,t,i){var n=e.dimensions,a=e.parallelAxisIndex;NN(n,function(o,s){var l=a[s],u=t.getComponent("parallelAxis",l),c=this._axesMap.set(o,new SY(o,zf(u),[0,0],u.get("type"),l)),f=c.type==="category";c.onBand=f&&u.get("boundaryGap"),c.inverse=u.get("inverse"),u.axis=c,c.model=u,c.coordinateSystem=u.coordinateSystem=this},this)},r.prototype.update=function(e,t){this._updateAxesFromSeries(this._model,e)},r.prototype.containPoint=function(e){var t=this._makeLayoutInfo(),i=t.axisBase,n=t.layoutBase,a=t.pixelDimIndex,o=e[1-a],s=e[a];return o>=i&&o<=i+t.axisLength&&s>=n&&s<=n+t.layoutLength},r.prototype.getModel=function(){return this._model},r.prototype._updateAxesFromSeries=function(e,t){t.eachSeries(function(i){if(e.contains(i,t)){var n=i.getData();NN(this.dimensions,function(a){var o=this._axesMap.get(a);o.scale.unionExtentFromData(n,n.mapDimension(a)),Vl(o.scale,o.model)},this)}},this)},r.prototype.resize=function(e,t){this._rect=xr(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),this._layoutAxes()},r.prototype.getRect=function(){return this._rect},r.prototype._makeLayoutInfo=function(){var e=this._model,t=this._rect,i=["x","y"],n=["width","height"],a=e.get("layout"),o=a==="horizontal"?0:1,s=t[n[o]],l=[0,s],u=this.dimensions.length,c=RT(e.get("axisExpandWidth"),l),f=RT(e.get("axisExpandCount")||0,[0,u]),h=e.get("axisExpandable")&&u>3&&u>f&&f>1&&c>0&&s>0,p=e.get("axisExpandWindow"),d;if(p)d=RT(p[1]-p[0],l),p[1]=p[0]+d;else{d=RT(c*(f-1),l);var g=e.get("axisExpandCenter")||MY(u/2);p=[c*g-d/2],p[1]=p[0]+d}var m=(s-d)/(u-f);m<3&&(m=0);var v=[MY(bY(p[0]/c,1))+1,Bye(bY(p[1]/c,1))-1],_=m/c*p[0];return{layout:a,pixelDimIndex:o,layoutBase:t[i[o]],layoutLength:s,axisBase:t[i[1-o]],axisLength:t[n[1-o]],axisExpandable:h,axisExpandWidth:c,axisCollapseWidth:m,axisExpandWindow:p,axisCount:u,winInnerIndices:v,axisExpandWindow0Pos:_}},r.prototype._layoutAxes=function(){var e=this._rect,t=this._axesMap,i=this.dimensions,n=this._makeLayoutInfo(),a=n.layout;t.each(function(o){var s=[0,n.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),NN(i,function(o,s){var l=(n.axisExpandable?Hye:Gye)(s,n),u={horizontal:{x:l.position,y:n.axisLength},vertical:{x:0,y:l.position}},c={horizontal:kye/2,vertical:0},f=[u[a].x+e.x,u[a].y+e.y],h=c[a],p=wi();Ca(p,p,h),_n(p,p,f),this._axesLayout[o]={position:f,rotation:h,transform:p,axisNameAvailableWidth:l.axisNameAvailableWidth,axisLabelShow:l.axisLabelShow,nameTruncateMaxWidth:l.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},r.prototype.getAxis=function(e){return this._axesMap.get(e)},r.prototype.dataToPoint=function(e,t){return this.axisCoordToPoint(this._axesMap.get(t).dataToCoord(e),t)},r.prototype.eachActiveState=function(e,t,i,n){i==null&&(i=0),n==null&&(n=e.count());var a=this._axesMap,o=this.dimensions,s=[],l=[];N(o,function(m){s.push(e.mapDimension(m)),l.push(a.get(m).model)});for(var u=this.hasAxisBrushed(),c=i;c<n;c++){var f=void 0;if(!u)f="normal";else{f="active";for(var h=e.getValues(s,c),p=0,d=o.length;p<d;p++){var g=l[p].getActiveState(h[p]);if(g==="inactive"){f="inactive";break}}}t(f,c)}},r.prototype.hasAxisBrushed=function(){for(var e=this.dimensions,t=this._axesMap,i=!1,n=0,a=e.length;n<a;n++)t.get(e[n]).model.getActiveState()!=="normal"&&(i=!0);return i},r.prototype.axisCoordToPoint=function(e,t){var i=this._axesLayout[t];return wn([e,0],i.transform)},r.prototype.getAxisLayout=function(e){return Qe(this._axesLayout[e])},r.prototype.getSlidedAxisExpandWindow=function(e){var t=this._makeLayoutInfo(),i=t.pixelDimIndex,n=t.axisExpandWindow.slice(),a=n[1]-n[0],o=[0,t.axisExpandWidth*(t.axisCount-1)];if(!this.containPoint(e))return{behavior:"none",axisExpandWindow:n};var s=e[i]-t.layoutBase-t.axisExpandWindow0Pos,l,u="slide",c=t.axisCollapseWidth,f=this._model.get("axisExpandSlideTriggerArea"),h=f[0]!=null;if(c)h&&c&&s<a*f[0]?(u="jump",l=s-a*f[2]):h&&c&&s>a*(1-f[0])?(u="jump",l=s-a*(1-f[2])):(l=s-a*f[1])>=0&&(l=s-a*(1-f[1]))<=0&&(l=0),l*=t.axisExpandWidth/c,l?Xa(l,n,o,"all"):u="none";else{var p=n[1]-n[0],d=o[1]*s/p;n=[TY(0,d-p/2)],n[1]=wY(o[1],n[0]+p),n[0]=n[1]-p}return{axisExpandWindow:n,behavior:u}},r}();function RT(r,e){return wY(TY(r,e[0]),e[1])}function Gye(r,e){var t=e.layoutLength/(e.axisCount-1);return{position:t*r,axisNameAvailableWidth:t,axisLabelShow:!0}}function Hye(r,e){var t=e.layoutLength,i=e.axisExpandWidth,n=e.axisCount,a=e.axisCollapseWidth,o=e.winInnerIndices,s,l=a,u=!1,c;return r<o[0]?(s=r*a,c=a):r<=o[1]?(s=e.axisExpandWindow0Pos+r*i-e.axisExpandWindow[0],l=i,u=!0):(s=t-(n-1-r)*a,c=a),{position:s,axisNameAvailableWidth:l,axisLabelShow:u,nameTruncateMaxWidth:c}}var EY=Vye;function Wye(r,e){var t=[];return r.eachComponent("parallel",function(i,n){var a=new EY(i,r,e);a.name="parallel_"+n,a.resize(i,e),i.coordinateSystem=a,a.model=i,t.push(a)}),r.eachSeries(function(i){if(i.get("coordinateSystem")==="parallel"){var n=i.getReferringComponents("parallel",Cr).models[0];i.coordinateSystem=n.coordinateSystem}}),t}var Xye={create:Wye},AY=Xye;var CY=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.activeIntervals=[],t}return e.prototype.getAreaSelectStyle=function(){return Na([["fill","color"],["lineWidth","borderWidth"],["stroke","borderColor"],["width","width"],["opacity","opacity"]])(this.getModel("areaSelectStyle"))},e.prototype.setActiveIntervals=function(t){var i=this.activeIntervals=Qe(t);if(i)for(var n=i.length-1;n>=0;n--)Ti(i[n])},e.prototype.getActiveState=function(t){var i=this.activeIntervals;if(!i.length)return"normal";if(t==null||isNaN(+t))return"inactive";if(i.length===1){var n=i[0];if(n[0]<=t&&t<=n[1])return"active"}else for(var a=0,o=i.length;a<o;a++)if(i[a][0]<=t&&t<=i[a][1])return"active";return"inactive"},e}(Pt);wr(CY,Gl);var UN=CY;var ld=!0,Dx=Math.min,Vv=Math.max,Yye=Math.pow,qye=1e4,Zye=6,jye=6,RY="globalPan",Kye={w:[0,0],e:[0,1],n:[1,0],s:[1,1]},Jye={w:"ew",e:"ew",n:"ns",s:"ns",ne:"nesw",sw:"nesw",nw:"nwse",se:"nwse"},LY={brushStyle:{lineWidth:2,stroke:"rgba(210,219,238,0.3)",fill:"#D2DBEE"},transformable:!0,brushMode:"single",removeOnClick:!1},$ye=0,Qye=function(r){Z(e,r);function e(t){var i=r.call(this)||this;return i._track=[],i._covers=[],i._handlers={},i._zr=t,i.group=new Ze,i._uid="brushController_"+$ye++,N(o0e,function(n,a){this._handlers[a]=Be(n,this)},i),i}return e.prototype.enableBrush=function(t){return this._brushType&&this._doDisableBrush(),t.brushType&&this._doEnableBrush(t),this},e.prototype._doEnableBrush=function(t){var i=this._zr;this._enableGlobalPan||_9(i,RY,this._uid),N(this._handlers,function(n,a){i.on(a,n)}),this._brushType=t.brushType,this._brushOption=_t(Qe(LY),t,!0)},e.prototype._doDisableBrush=function(){var t=this._zr;x9(t,RY,this._uid),N(this._handlers,function(i,n){t.off(n,i)}),this._brushType=this._brushOption=null},e.prototype.setPanels=function(t){if(t&&t.length){var i=this._panels={};N(t,function(n){i[n.panelId]=Qe(n)})}else this._panels=null;return this},e.prototype.mount=function(t){t=t||{},this._enableGlobalPan=t.enableGlobalPan;var i=this.group;return this._zr.add(i),i.attr({x:t.x||0,y:t.y||0,rotation:t.rotation||0,scaleX:t.scaleX||1,scaleY:t.scaleY||1}),this._transform=i.getLocalTransform(),this},e.prototype.updateCovers=function(t){t=de(t,function(h){return _t(Qe(LY),h,!0)});var i="\0-brush-index-",n=this._covers,a=this._covers=[],o=this,s=this._creatingCover;return new An(n,t,u,l).add(c).update(c).remove(f).execute(),this;function l(h,p){return(h.id!=null?h.id:i+p)+"-"+h.brushType}function u(h,p){return l(h.__brushOption,p)}function c(h,p){var d=t[h];if(p!=null&&n[p]===s)a[h]=n[p];else{var g=a[h]=p!=null?(n[p].__brushOption=d,n[p]):OY(o,UY(o,d));VN(o,g)}}function f(h){n[h]!==s&&o.group.remove(n[h])}},e.prototype.unmount=function(){return this.enableBrush(!1),ON(this),this._zr.remove(this.group),this},e.prototype.dispose=function(){this.unmount(),this.off()},e}(Di);function UY(r,e){var t=LT[e.brushType].createCover(r,e);return t.__brushOption=e,zY(t,e),r.group.add(t),t}function OY(r,e){var t=GN(e);return t.endCreating&&(t.endCreating(r,e),zY(e,e.__brushOption)),e}function FY(r,e){var t=e.__brushOption;GN(e).updateCoverShape(r,e,t.range,t)}function zY(r,e){var t=e.z;t==null&&(t=qye),r.traverse(function(i){i.z=t,i.z2=t})}function VN(r,e){GN(e).updateCommon(r,e),FY(r,e)}function GN(r){return LT[r.__brushOption.brushType]}function HN(r,e,t){var i=r._panels;if(!i)return ld;var n,a=r._transform;return N(i,function(o){o.isTargetByCursor(e,t,a)&&(n=o)}),n}function BY(r,e){var t=r._panels;if(!t)return ld;var i=e.__brushOption.panelId;return i!=null?t[i]:ld}function ON(r){var e=r._covers,t=e.length;return N(e,function(i){r.group.remove(i)},r),e.length=0,!!t}function ud(r,e){var t=de(r._covers,function(i){var n=i.__brushOption,a=Qe(n.range);return{brushType:n.brushType,panelId:n.panelId,range:a}});r.trigger("brush",{areas:t,isEnd:!!e.isEnd,removeOnClick:!!e.removeOnClick})}function e0e(r){var e=r._track;if(!e.length)return!1;var t=e[e.length-1],i=e[0],n=t[0]-i[0],a=t[1]-i[1],o=Yye(n*n+a*a,.5);return o>Zye}function kY(r){var e=r.length-1;return e<0&&(e=0),[r[0],r[e]]}function VY(r,e,t,i){var n=new Ze;return n.add(new Tt({name:"main",style:WN(t),silent:!0,draggable:!0,cursor:"move",drift:ot(PY,r,e,n,["n","s","w","e"]),ondragend:ot(ud,e,{isEnd:!0})})),N(i,function(a){n.add(new Tt({name:a.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:ot(PY,r,e,n,a),ondragend:ot(ud,e,{isEnd:!0})}))}),n}function GY(r,e,t,i){var n=i.brushStyle.lineWidth||0,a=Vv(n,jye),o=t[0][0],s=t[1][0],l=o-n/2,u=s-n/2,c=t[0][1],f=t[1][1],h=c-a+n/2,p=f-a+n/2,d=c-o,g=f-s,m=d+n,v=g+n;Hu(r,e,"main",o,s,d,g),i.transformable&&(Hu(r,e,"w",l,u,a,v),Hu(r,e,"e",h,u,a,v),Hu(r,e,"n",l,u,m,a),Hu(r,e,"s",l,p,m,a),Hu(r,e,"nw",l,u,a,a),Hu(r,e,"ne",h,u,a,a),Hu(r,e,"sw",l,p,a,a),Hu(r,e,"se",h,p,a,a))}function FN(r,e){var t=e.__brushOption,i=t.transformable,n=e.childAt(0);n.useStyle(WN(t)),n.attr({silent:!i,cursor:i?"move":"default"}),N([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(a){var o=e.childOfName(a.join("")),s=a.length===1?zN(r,a[0]):r0e(r,a);o&&o.attr({silent:!i,invisible:!i,cursor:i?Jye[s]+"-resize":null})})}function Hu(r,e,t,i,n,a,o){var s=e.childOfName(t);s&&s.setShape(n0e(XN(r,e,[[i,n],[i+a,n+o]])))}function WN(r){return Ye({strokeNoScale:!0},r.brushStyle)}function HY(r,e,t,i){var n=[Dx(r,t),Dx(e,i)],a=[Vv(r,t),Vv(e,i)];return[[n[0],a[0]],[n[1],a[1]]]}function t0e(r){return ks(r.group)}function zN(r,e){var t={w:"left",e:"right",n:"top",s:"bottom"},i={left:"w",right:"e",top:"n",bottom:"s"},n=Up(t[e],t0e(r));return i[n]}function r0e(r,e){var t=[zN(r,e[0]),zN(r,e[1])];return(t[0]==="e"||t[0]==="w")&&t.reverse(),t.join("")}function PY(r,e,t,i,n,a){var o=t.__brushOption,s=r.toRectRange(o.range),l=WY(e,n,a);N(i,function(u){var c=Kye[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=r.fromRectRange(HY(s[0][0],s[1][0],s[0][1],s[1][1])),VN(e,t),ud(e,{isEnd:!1})}function i0e(r,e,t,i){var n=e.__brushOption.range,a=WY(r,t,i);N(n,function(o){o[0]+=a[0],o[1]+=a[1]}),VN(r,e),ud(r,{isEnd:!1})}function WY(r,e,t){var i=r.group,n=i.transformCoordToLocal(e,t),a=i.transformCoordToLocal(0,0);return[n[0]-a[0],n[1]-a[1]]}function XN(r,e,t){var i=BY(r,e);return i&&i!==ld?i.clipPath(t,r._transform):Qe(t)}function n0e(r){var e=Dx(r[0][0],r[1][0]),t=Dx(r[0][1],r[1][1]),i=Vv(r[0][0],r[1][0]),n=Vv(r[0][1],r[1][1]);return{x:e,y:t,width:i-e,height:n-t}}function a0e(r,e,t){if(!(!r._brushType||s0e(r,e.offsetX,e.offsetY))){var i=r._zr,n=r._covers,a=HN(r,e,t);if(!r._dragging)for(var o=0;o<n.length;o++){var s=n[o].__brushOption;if(a&&(a===ld||s.panelId===a.panelId)&&LT[s.brushType].contain(n[o],t[0],t[1]))return}a&&i.setCursorStyle("crosshair")}}function BN(r){var e=r.event;e.preventDefault&&e.preventDefault()}function kN(r,e,t){return r.childOfName("main").contain(e,t)}function XY(r,e,t,i){var n=r._creatingCover,a=r._creatingPanel,o=r._brushOption,s;if(r._track.push(t.slice()),e0e(r)||n){if(a&&!n){o.brushMode==="single"&&ON(r);var l=Qe(o);l.brushType=DY(l.brushType,a),l.panelId=a===ld?null:a.panelId,n=r._creatingCover=UY(r,l),r._covers.push(n)}if(n){var u=LT[DY(r._brushType,a)],c=n.__brushOption;c.range=u.getCreatingRange(XN(r,n,r._track)),i&&(OY(r,n),u.updateCommon(r,n)),FY(r,n),s={isEnd:i}}}else i&&o.brushMode==="single"&&o.removeOnClick&&HN(r,e,t)&&ON(r)&&(s={isEnd:i,removeOnClick:!0});return s}function DY(r,e){return r==="auto"?e.defaultBrushType:r}var o0e={mousedown:function(r){if(this._dragging)IY(this,r);else if(!r.target||!r.target.draggable){BN(r);var e=this.group.transformCoordToLocal(r.offsetX,r.offsetY);this._creatingCover=null;var t=this._creatingPanel=HN(this,r,e);t&&(this._dragging=!0,this._track=[e.slice()])}},mousemove:function(r){var e=r.offsetX,t=r.offsetY,i=this.group.transformCoordToLocal(e,t);if(a0e(this,r,i),this._dragging){BN(r);var n=XY(this,r,i,!1);n&&ud(this,n)}},mouseup:function(r){IY(this,r)}};function IY(r,e){if(r._dragging){BN(e);var t=e.offsetX,i=e.offsetY,n=r.group.transformCoordToLocal(t,i),a=XY(r,e,n,!0);r._dragging=!1,r._track=[],r._creatingCover=null,a&&ud(r,a)}}function s0e(r,e,t){var i=r._zr;return e<0||e>i.getWidth()||t<0||t>i.getHeight()}var LT={lineX:NY(0),lineY:NY(1),rect:{createCover:function(r,e){function t(i){return i}return VY({toRectRange:t,fromRectRange:t},r,e,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(r){var e=kY(r);return HY(e[1][0],e[1][1],e[0][0],e[0][1])},updateCoverShape:function(r,e,t,i){GY(r,e,t,i)},updateCommon:FN,contain:kN},polygon:{createCover:function(r,e){var t=new Ze;return t.add(new $r({name:"main",style:WN(e),silent:!0})),t},getCreatingRange:function(r){return r},endCreating:function(r,e){e.remove(e.childAt(0)),e.add(new ei({name:"main",draggable:!0,drift:ot(i0e,r,e),ondragend:ot(ud,r,{isEnd:!0})}))},updateCoverShape:function(r,e,t,i){e.childAt(0).setShape({points:XN(r,e,t)})},updateCommon:FN,contain:kN}};function NY(r){return{createCover:function(e,t){return VY({toRectRange:function(i){var n=[i,[0,100]];return r&&n.reverse(),n},fromRectRange:function(i){return i[r]}},e,t,[[["w"],["e"]],[["n"],["s"]]][r])},getCreatingRange:function(e){var t=kY(e),i=Dx(t[0][r],t[1][r]),n=Vv(t[0][r],t[1][r]);return[i,n]},updateCoverShape:function(e,t,i,n){var a,o=BY(e,t);if(o!==ld&&o.getLinearBrushOtherExtent)a=o.getLinearBrushOtherExtent(r);else{var s=e._zr;a=[0,[s.getWidth(),s.getHeight()][1-r]]}var l=[i,a];r&&l.reverse(),GY(e,t,l,n)},updateCommon:FN,contain:kN}}var Gv=Qye;function PT(r){return r=YN(r),function(e){return NP(e,r)}}function DT(r,e){return r=YN(r),function(t){var i=e??t,n=i?r.width:r.height,a=i?r.x:r.y;return[a,a+(n||0)]}}function IT(r,e,t){var i=YN(r);return function(n,a){return i.contain(a[0],a[1])&&!Wf(n,e,t)}}function YN(r){return lt.create(r)}var l0e=["axisLine","axisTickLabel","axisName"],u0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){r.prototype.init.apply(this,arguments),(this._brushController=new Gv(i.getZr())).on("brush",Be(this._onBrush,this))},e.prototype.render=function(t,i,n,a){if(!c0e(t,i,a)){this.axisModel=t,this.api=n,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Ze,this.group.add(this._axisGroup),!!t.get("show")){var s=h0e(t,i),l=s.coordinateSystem,u=t.getAreaSelectStyle(),c=u.width,f=t.axis.dim,h=l.getAxisLayout(f),p=fe({strokeContainThreshold:c},h),d=new Cn(t,p);N(l0e,d.add,d),this._axisGroup.add(d.getGroup()),this._refreshBrushController(p,u,t,s,c,n),Lu(o,this._axisGroup,t)}}},e.prototype._refreshBrushController=function(t,i,n,a,o,s){var l=n.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),f=lt.create({x:l[0],y:-o/2,width:u,height:o});f.x-=c,f.width+=2*c,this._brushController.mount({enableGlobalPan:!0,rotation:t.rotation,x:t.position[0],y:t.position[1]}).setPanels([{panelId:"pl",clipPath:PT(f),isTargetByCursor:IT(f,s,a),getLinearBrushOtherExtent:DT(f,0)}]).enableBrush({brushType:"lineX",brushStyle:i,removeOnClick:!0}).updateCovers(f0e(n))},e.prototype._onBrush=function(t){var i=t.areas,n=this.axisModel,a=n.axis,o=de(i,function(s){return[a.coordToData(s.range[0],!0),a.coordToData(s.range[1],!0)]});(!n.option.realtime===t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:n.id,intervals:o})},e.prototype.dispose=function(){this._brushController.dispose()},e.type="parallelAxis",e}(Qt);function c0e(r,e,t){return t&&t.type==="axisAreaSelect"&&e.findComponents({mainType:"parallelAxis",query:t})[0]===r}function f0e(r){var e=r.axis;return de(r.activeIntervals,function(t){return{brushType:"lineX",panelId:"pl",range:[e.dataToCoord(t[0],!0),e.dataToCoord(t[1],!0)]}})}function h0e(r,e){return e.getComponent("parallel",r.get("parallelIndex"))}var qY=u0e;var p0e={type:"axisAreaSelect",event:"axisAreaSelected"};function ZY(r){r.registerAction(p0e,function(e,t){t.eachComponent({mainType:"parallelAxis",query:e},function(i){i.axis.model.setActiveIntervals(e.intervals)})}),r.registerAction("parallelAxisExpand",function(e,t){t.eachComponent({mainType:"parallel",query:e},function(i){i.setAxisExpand(e)})})}var d0e={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function Ix(r){r.registerComponentView(_Y),r.registerComponentModel(xY),r.registerCoordinateSystem("parallel",AY),r.registerPreprocessor(PN),r.registerComponentModel(UN),r.registerComponentView(qY),rl(r,"parallel",UN,d0e),ZY(r)}function qN(r){It(Ix),r.registerChartView(vY),r.registerSeriesModel(gY),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,yY)}var m0e=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return r}(),v0e=function(r){Z(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new m0e},e.prototype.buildPath=function(t,i){var n=i.extent;t.moveTo(i.x1,i.y1),t.bezierCurveTo(i.cpx1,i.cpy1,i.cpx2,i.cpy2,i.x2,i.y2),i.orient==="vertical"?(t.lineTo(i.x2+n,i.y2),t.bezierCurveTo(i.cpx2+n,i.cpy2,i.cpx1+n,i.cpy1,i.x1+n,i.y1)):(t.lineTo(i.x2,i.y2+n),t.bezierCurveTo(i.cpx2,i.cpy2+n,i.cpx1,i.cpy1+n,i.x1,i.y1+n)),t.closePath()},e.prototype.highlight=function(){Bn(this)},e.prototype.downplay=function(){kn(this)},e}(ut),g0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._focusAdjacencyDisabled=!1,t}return e.prototype.render=function(t,i,n){var a=this,o=t.getGraph(),s=this.group,l=t.layoutInfo,u=l.width,c=l.height,f=t.getData(),h=t.getData("edge"),p=t.get("orient");this._model=t,s.removeAll(),s.x=l.x,s.y=l.y,o.eachEdge(function(d){var g=new v0e,m=rt(g);m.dataIndex=d.dataIndex,m.seriesIndex=t.seriesIndex,m.dataType="edge";var v=d.getModel(),_=v.getModel("lineStyle"),y=_.get("curveness"),x=d.node1.getLayout(),M=d.node1.getModel(),S=M.get("localX"),w=M.get("localY"),T=d.node2.getLayout(),C=d.node2.getModel(),b=C.get("localX"),E=C.get("localY"),I=d.getLayout(),R,A,D,U,B,F,k,G;g.shape.extent=Math.max(1,I.dy),g.shape.orient=p,p==="vertical"?(R=(S!=null?S*u:x.x)+I.sy,A=(w!=null?w*c:x.y)+x.dy,D=(b!=null?b*u:T.x)+I.ty,U=E!=null?E*c:T.y,B=R,F=A*(1-y)+U*y,k=D,G=A*y+U*(1-y)):(R=(S!=null?S*u:x.x)+x.dx,A=(w!=null?w*c:x.y)+I.sy,D=b!=null?b*u:T.x,U=(E!=null?E*c:T.y)+I.ty,B=R*(1-y)+D*y,F=A,k=R*y+D*(1-y),G=U),g.setShape({x1:R,y1:A,x2:D,y2:U,cpx1:B,cpy1:F,cpx2:k,cpy2:G}),g.useStyle(_.getItemStyle()),jY(g.style,p,d);var Y=""+v.get("value"),J=Tr(v,"edgeLabel");Nr(g,J,{labelFetcher:{getFormattedLabel:function(K,ae,ve,ue,se,Ee){return t.getFormattedLabel(K,ae,"edge",ue,Xi(se,J.normal&&J.normal.get("formatter"),Y),Ee)}},labelDataIndex:d.dataIndex,defaultText:Y}),g.setTextConfig({position:"inside"});var Q=v.getModel("emphasis");Gr(g,v,"lineStyle",function(K){var ae=K.getItemStyle();return jY(ae,p,d),ae}),s.add(g),h.setItemGraphicEl(d.dataIndex,g);var V=Q.get("focus");nr(g,V==="adjacency"?d.getAdjacentDataIndices():V==="trajectory"?d.getTrajectoryDataIndices():V,Q.get("blurScope"),Q.get("disabled"))}),o.eachNode(function(d){var g=d.getLayout(),m=d.getModel(),v=m.get("localX"),_=m.get("localY"),y=m.getModel("emphasis"),x=new Tt({shape:{x:v!=null?v*u:g.x,y:_!=null?_*c:g.y,width:g.dx,height:g.dy},style:m.getModel("itemStyle").getItemStyle(),z2:10});Nr(x,Tr(m),{labelFetcher:{getFormattedLabel:function(S,w){return t.getFormattedLabel(S,w,"node")}},labelDataIndex:d.dataIndex,defaultText:d.id}),x.disableLabelAnimation=!0,x.setStyle("fill",d.getVisual("color")),x.setStyle("decal",d.getVisual("style").decal),Gr(x,m),s.add(x),f.setItemGraphicEl(d.dataIndex,x),rt(x).dataType="node";var M=y.get("focus");nr(x,M==="adjacency"?d.getAdjacentDataIndices():M==="trajectory"?d.getTrajectoryDataIndices():M,y.get("blurScope"),y.get("disabled"))}),f.eachItemGraphicEl(function(d,g){var m=f.getItemModel(g);m.get("draggable")&&(d.drift=function(v,_){a._focusAdjacencyDisabled=!0,this.shape.x+=v,this.shape.y+=_,this.dirty(),n.dispatchAction({type:"dragNode",seriesId:t.id,dataIndex:f.getRawIndex(g),localX:this.shape.x/u,localY:this.shape.y/c})},d.ondragend=function(){a._focusAdjacencyDisabled=!1},d.draggable=!0,d.cursor="move")}),!this._data&&t.isAnimationEnabled()&&s.setClipPath(y0e(s.getBoundingRect(),t,function(){s.removeClipPath()})),this._data=t.getData()},e.prototype.dispose=function(){},e.type="sankey",e}(Yt);function jY(r,e,t){switch(r.fill){case"source":r.fill=t.node1.getVisual("color"),r.decal=t.node1.getVisual("style").decal;break;case"target":r.fill=t.node2.getVisual("color"),r.decal=t.node2.getVisual("style").decal;break;case"gradient":var i=t.node1.getVisual("color"),n=t.node2.getVisual("color");Ce(i)&&Ce(n)&&(r.fill=new zl(0,0,+(e==="horizontal"),+(e==="vertical"),[{color:i,offset:0},{color:n,offset:1}]))}}function y0e(r,e,t){var i=new Tt({shape:{x:r.x-10,y:r.y-10,width:0,height:r.height+20}});return ar(i,{shape:{width:r.width+20}},e,t),i}var KY=g0e;var _0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,i){var n=t.edges||t.links,a=t.data||t.nodes,o=t.levels;this.levelModels=[];for(var s=this.levelModels,l=0;l<o.length;l++)o[l].depth!=null&&o[l].depth>=0&&(s[o[l].depth]=new Zt(o[l],this,i));if(a&&n){var u=Px(a,n,this,!0,c);return u.data}function c(f,h){f.wrapMethod("getItemModel",function(p,d){var g=p.parentModel,m=g.getData().getItemLayout(d);if(m){var v=m.depth,_=g.levelModels[v];_&&(p.parentModel=_)}return p}),h.wrapMethod("getItemModel",function(p,d){var g=p.parentModel,m=g.getGraph().getEdgeByIndex(d),v=m.node1.getLayout();if(v){var _=v.depth,y=g.levelModels[_];y&&(p.parentModel=y)}return p})}},e.prototype.setNodePosition=function(t,i){var n=this.option.data||this.option.nodes,a=n[t];a.localX=i[0],a.localY=i[1]},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.formatTooltip=function(t,i,n){function a(p){return isNaN(p)||p==null}if(n==="edge"){var o=this.getDataParams(t,n),s=o.data,l=o.value,u=s.source+" -- "+s.target;return Or("nameValue",{name:u,value:l,noValue:a(l)})}else{var c=this.getGraph().getNodeByIndex(t),f=c.getLayout().value,h=this.getDataParams(t,n).data.name;return Or("nameValue",{name:h!=null?h+"":null,value:f,noValue:a(f)})}},e.prototype.optionUpdated=function(){},e.prototype.getDataParams=function(t,i){var n=r.prototype.getDataParams.call(this,t,i);if(n.value==null&&i==="node"){var a=this.getGraph().getNodeByIndex(t),o=a.getLayout().value;n.value=o}return n},e.type="series.sankey",e.defaultOption={z:2,coordinateSystem:"view",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:"#314656",opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:"#212121"}},animationEasing:"linear",animationDuration:1e3},e}(jt),JY=_0e;function jN(r,e){r.eachSeriesByType("sankey",function(t){var i=t.get("nodeWidth"),n=t.get("nodeGap"),a=x0e(t,e);t.layoutInfo=a;var o=a.width,s=a.height,l=t.getGraph(),u=l.nodes,c=l.edges;M0e(u);var f=Wt(u,function(g){return g.getLayout().value===0}),h=f.length!==0?0:t.get("layoutIterations"),p=t.get("orient"),d=t.get("nodeAlign");S0e(u,c,i,n,o,s,h,p,d)})}function x0e(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function S0e(r,e,t,i,n,a,o,s,l){b0e(r,e,t,n,a,s,l),A0e(r,e,a,n,i,o,s),O0e(r,s)}function M0e(r){N(r,function(e){var t=qf(e.outEdges,NT),i=qf(e.inEdges,NT),n=e.getValue()||0,a=Math.max(t,i,n);e.setLayout({value:a},!0)})}function b0e(r,e,t,i,n,a,o){for(var s=[],l=[],u=[],c=[],f=0,h=0;h<e.length;h++)s[h]=1;for(var h=0;h<r.length;h++)l[h]=r[h].inEdges.length,l[h]===0&&u.push(r[h]);for(var p=-1;u.length;){for(var d=0;d<u.length;d++){var g=u[d],m=g.hostGraph.data.getRawDataItem(g.dataIndex),v=m.depth!=null&&m.depth>=0;v&&m.depth>p&&(p=m.depth),g.setLayout({depth:v?m.depth:f},!0),a==="vertical"?g.setLayout({dy:t},!0):g.setLayout({dx:t},!0);for(var _=0;_<g.outEdges.length;_++){var y=g.outEdges[_],x=e.indexOf(y);s[x]=0;var M=y.node2,S=r.indexOf(M);--l[S]===0&&c.indexOf(M)<0&&c.push(M)}}++f,u=c,c=[]}for(var h=0;h<s.length;h++)if(s[h]===1)throw new Error("Sankey is a DAG, the original data has cycle!");var w=p>f-1?p:f-1;o&&o!=="left"&&w0e(r,o,a,w);var T=a==="vertical"?(n-t)/w:(i-t)/w;E0e(r,T,a)}function $Y(r){var e=r.hostGraph.data.getRawDataItem(r.dataIndex);return e.depth!=null&&e.depth>=0}function w0e(r,e,t,i){if(e==="right"){for(var n=[],a=r,o=0;a.length;){for(var s=0;s<a.length;s++){var l=a[s];l.setLayout({skNodeHeight:o},!0);for(var u=0;u<l.inEdges.length;u++){var c=l.inEdges[u];n.indexOf(c.node1)<0&&n.push(c.node1)}}a=n,n=[],++o}N(r,function(f){$Y(f)||f.setLayout({depth:Math.max(0,i-f.getLayout().skNodeHeight)},!0)})}else e==="justify"&&T0e(r,i)}function T0e(r,e){N(r,function(t){!$Y(t)&&!t.outEdges.length&&t.setLayout({depth:e},!0)})}function E0e(r,e,t){N(r,function(i){var n=i.getLayout().depth*e;t==="vertical"?i.setLayout({y:n},!0):i.setLayout({x:n},!0)})}function A0e(r,e,t,i,n,a,o){var s=C0e(r,o);R0e(s,e,t,i,n,o),ZN(s,n,t,i,o);for(var l=1;a>0;a--)l*=.99,L0e(s,l,o),ZN(s,n,t,i,o),U0e(s,l,o),ZN(s,n,t,i,o)}function C0e(r,e){var t=[],i=e==="vertical"?"y":"x",n=a_(r,function(a){return a.getLayout()[i]});return n.keys.sort(function(a,o){return a-o}),N(n.keys,function(a){t.push(n.buckets.get(a))}),t}function R0e(r,e,t,i,n,a){var o=1/0;N(r,function(s){var l=s.length,u=0;N(s,function(f){u+=f.getLayout().value});var c=a==="vertical"?(i-(l-1)*n)/u:(t-(l-1)*n)/u;c<o&&(o=c)}),N(r,function(s){N(s,function(l,u){var c=l.getLayout().value*o;a==="vertical"?(l.setLayout({x:u},!0),l.setLayout({dx:c},!0)):(l.setLayout({y:u},!0),l.setLayout({dy:c},!0))})}),N(e,function(s){var l=+s.getValue()*o;s.setLayout({dy:l},!0)})}function ZN(r,e,t,i,n){var a=n==="vertical"?"x":"y";N(r,function(o){o.sort(function(g,m){return g.getLayout()[a]-m.getLayout()[a]});for(var s,l,u,c=0,f=o.length,h=n==="vertical"?"dx":"dy",p=0;p<f;p++)l=o[p],u=c-l.getLayout()[a],u>0&&(s=l.getLayout()[a]+u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]+l.getLayout()[h]+e;var d=n==="vertical"?i:t;if(u=c-e-d,u>0){s=l.getLayout()[a]-u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var p=f-2;p>=0;--p)l=o[p],u=l.getLayout()[a]+l.getLayout()[h]+e-c,u>0&&(s=l.getLayout()[a]-u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]}})}function L0e(r,e,t){N(r.slice().reverse(),function(i){N(i,function(n){if(n.outEdges.length){var a=qf(n.outEdges,P0e,t)/qf(n.outEdges,NT);if(isNaN(a)){var o=n.outEdges.length;a=o?qf(n.outEdges,D0e,t)/o:0}if(t==="vertical"){var s=n.getLayout().x+(a-Zf(n,t))*e;n.setLayout({x:s},!0)}else{var l=n.getLayout().y+(a-Zf(n,t))*e;n.setLayout({y:l},!0)}}})})}function P0e(r,e){return Zf(r.node2,e)*r.getValue()}function D0e(r,e){return Zf(r.node2,e)}function I0e(r,e){return Zf(r.node1,e)*r.getValue()}function N0e(r,e){return Zf(r.node1,e)}function Zf(r,e){return e==="vertical"?r.getLayout().x+r.getLayout().dx/2:r.getLayout().y+r.getLayout().dy/2}function NT(r){return r.getValue()}function qf(r,e,t){for(var i=0,n=r.length,a=-1;++a<n;){var o=+e(r[a],t);isNaN(o)||(i+=o)}return i}function U0e(r,e,t){N(r,function(i){N(i,function(n){if(n.inEdges.length){var a=qf(n.inEdges,I0e,t)/qf(n.inEdges,NT);if(isNaN(a)){var o=n.inEdges.length;a=o?qf(n.inEdges,N0e,t)/o:0}if(t==="vertical"){var s=n.getLayout().x+(a-Zf(n,t))*e;n.setLayout({x:s},!0)}else{var l=n.getLayout().y+(a-Zf(n,t))*e;n.setLayout({y:l},!0)}}})})}function O0e(r,e){var t=e==="vertical"?"x":"y";N(r,function(i){i.outEdges.sort(function(n,a){return n.node2.getLayout()[t]-a.node2.getLayout()[t]}),i.inEdges.sort(function(n,a){return n.node1.getLayout()[t]-a.node1.getLayout()[t]})}),N(r,function(i){var n=0,a=0;N(i.outEdges,function(o){o.setLayout({sy:n},!0),n+=o.getLayout().dy}),N(i.inEdges,function(o){o.setLayout({ty:a},!0),a+=o.getLayout().dy})})}function KN(r){r.eachSeriesByType("sankey",function(e){var t=e.getGraph(),i=t.nodes,n=t.edges;if(i.length){var a=1/0,o=-1/0;N(i,function(s){var l=s.getLayout().value;l<a&&(a=l),l>o&&(o=l)}),N(i,function(s){var l=new pi({type:"color",mappingMethod:"linear",dataExtent:[a,o],visual:e.get("color")}),u=l.mapValueToVisual(s.getLayout().value),c=s.getModel().get(["itemStyle","color"]);c!=null?(s.setVisual("color",c),s.setVisual("style",{fill:c})):(s.setVisual("color",u),s.setVisual("style",{fill:u}))})}n.length&&N(n,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function JN(r){r.registerChartView(KY),r.registerSeriesModel(JY),r.registerLayout(jN),r.registerVisual(KN),r.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(e,t){t.eachComponent({mainType:"series",subType:"sankey",query:e},function(i){i.setNodePosition(e.dataIndex,[e.localX,e.localY])})})}var UT=function(){function r(){}return r.prototype.getInitialData=function(e,t){var i,n=t.getComponent("xAxis",this.get("xAxisIndex")),a=t.getComponent("yAxis",this.get("yAxisIndex")),o=n.get("type"),s=a.get("type"),l;o==="category"?(e.layout="horizontal",i=n.getOrdinalMeta(),l=!0):s==="category"?(e.layout="vertical",i=a.getOrdinalMeta(),l=!0):e.layout=e.layout||"horizontal";var u=["x","y"],c=e.layout==="horizontal"?0:1,f=this._baseAxisDim=u[c],h=u[1-c],p=[n,a],d=p[c].get("type"),g=p[1-c].get("type"),m=e.data;if(m&&l){var v=[];N(m,function(x,M){var S;pe(x)?(S=x.slice(),x.unshift(M)):pe(x.value)?(S=fe({},x),S.value=S.value.slice(),x.value.unshift(M)):S=x,v.push(S)}),e.data=v}var _=this.defaultValueDimensions,y=[{name:f,type:Yp(d),ordinalMeta:i,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:h,type:Yp(g),dimsDef:_.slice()}];return To(this,{coordDimensions:y,dimensionsCount:_.length+1,encodeDefaulter:ot(Lw,y,this)})},r.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},r}();var QY=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.defaultValueDimensions=[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],t.visualDrawType="stroke",t}return e.type="series.boxplot",e.dependencies=["xAxis","yAxis","grid"],e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,boxWidth:[7,50],itemStyle:{color:"#fff",borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}},animationDuration:800},e}(jt);wr(QY,UT,!0);var eq=QY;var F0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this.group,s=this._data;this._data||o.removeAll();var l=t.get("layout")==="horizontal"?1:0;a.diff(s).add(function(u){if(a.hasValue(u)){var c=a.getItemLayout(u),f=tq(c,a,u,l,!0);a.setItemGraphicEl(u,f),o.add(f)}}).update(function(u,c){var f=s.getItemGraphicEl(c);if(!a.hasValue(u)){o.remove(f);return}var h=a.getItemLayout(u);f?(Ii(f),rq(h,f,a,u)):f=tq(h,a,u,l),o.add(f),a.setItemGraphicEl(u,f)}).remove(function(u){var c=s.getItemGraphicEl(u);c&&o.remove(c)}).execute(),this._data=a},e.prototype.remove=function(t){var i=this.group,n=this._data;this._data=null,n&&n.eachItemGraphicEl(function(a){a&&i.remove(a)})},e.type="boxplot",e}(Yt),z0e=function(){function r(){}return r}(),B0e=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="boxplotBoxPath",i}return e.prototype.getDefaultShape=function(){return new z0e},e.prototype.buildPath=function(t,i){var n=i.points,a=0;for(t.moveTo(n[a][0],n[a][1]),a++;a<4;a++)t.lineTo(n[a][0],n[a][1]);for(t.closePath();a<n.length;a++)t.moveTo(n[a][0],n[a][1]),a++,t.lineTo(n[a][0],n[a][1])},e}(ut);function tq(r,e,t,i,n){var a=r.ends,o=new B0e({shape:{points:n?k0e(a,i,r):a}});return rq(r,o,e,t,n),o}function rq(r,e,t,i,n){var a=t.hostModel,o=Ct[n?"initProps":"updateProps"];o(e,{shape:{points:r.ends}},a,i),e.useStyle(t.getItemVisual(i,"style")),e.style.strokeNoScale=!0,e.z2=100;var s=t.getItemModel(i),l=s.getModel("emphasis");Gr(e,s),nr(e,l.get("focus"),l.get("blurScope"),l.get("disabled"))}function k0e(r,e,t){return de(r,function(i){return i=i.slice(),i[e]=t.initBaseline,i})}var iq=F0e;var Nx=N;function $N(r){var e=V0e(r);Nx(e,function(t){var i=t.seriesModels;i.length&&(G0e(t),Nx(i,function(n,a){H0e(n,t.boxOffsetList[a],t.boxWidthList[a])}))})}function V0e(r){var e=[],t=[];return r.eachSeriesByType("boxplot",function(i){var n=i.getBaseAxis(),a=dt(t,n);a<0&&(a=t.length,t[a]=n,e[a]={axis:n,seriesModels:[]}),e[a].seriesModels.push(i)}),e}function G0e(r){var e=r.axis,t=r.seriesModels,i=t.length,n=r.boxWidthList=[],a=r.boxOffsetList=[],o=[],s;if(e.type==="category")s=e.getBandWidth();else{var l=0;Nx(t,function(d){l=Math.max(l,d.getData().count())});var u=e.getExtent();s=Math.abs(u[1]-u[0])/l}Nx(t,function(d){var g=d.get("boxWidth");pe(g)||(g=[g,g]),o.push([Fe(g[0],s)||0,Fe(g[1],s)||0])});var c=s*.8-2,f=c/i*.3,h=(c-f*(i-1))/i,p=h/2-c/2;Nx(t,function(d,g){a.push(p),p+=f+h,n.push(Math.min(Math.max(h,o[g][0]),o[g][1]))})}function H0e(r,e,t){var i=r.coordinateSystem,n=r.getData(),a=t/2,o=r.get("layout")==="horizontal"?0:1,s=1-o,l=["x","y"],u=n.mapDimension(l[o]),c=n.mapDimensionsAll(l[s]);if(u==null||c.length<5)return;for(var f=0;f<n.count();f++){var h=n.get(u,f),p=y(h,c[2],f),d=y(h,c[0],f),g=y(h,c[1],f),m=y(h,c[3],f),v=y(h,c[4],f),_=[];x(_,g,!1),x(_,m,!0),_.push(d,g,v,m),M(_,d),M(_,v),M(_,p),n.setItemLayout(f,{initBaseline:p[s],ends:_})}function y(S,w,T){var C=n.get(w,T),b=[];b[o]=S,b[s]=C;var E;return isNaN(S)||isNaN(C)?E=[NaN,NaN]:(E=i.dataToPoint(b),E[o]+=e),E}function x(S,w,T){var C=w.slice(),b=w.slice();C[o]+=a,b[o]-=a,T?S.push(C,b):S.push(b,C)}function M(S,w){var T=w.slice(),C=w.slice();T[o]-=a,C[o]+=a,S.push(T,C)}}function QN(r,e){e=e||{};for(var t=[],i=[],n=e.boundIQR,a=n==="none"||n===0,o=0;o<r.length;o++){var s=Ti(r[o].slice()),l=km(s,.25),u=km(s,.5),c=km(s,.75),f=s[0],h=s[s.length-1],p=(n??1.5)*(c-l),d=a?f:Math.max(f,l-p),g=a?h:Math.min(h,c+p),m=e.itemNameFormatter,v=He(m)?m({value:o}):Ce(m)?m.replace("{value}",o+""):o+"";t.push([v,d,l,u,c,g]);for(var _=0;_<s.length;_++){var y=s[_];if(y<d||y>g){var x=[v,y];i.push(x)}}}return{boxData:t,outliers:i}}var nq={type:"echarts:boxplot",transform:function(e){var t=e.upstream;if(t.sourceFormat!==Ei){var i="";ur(i)}var n=QN(t.getRawData(),e.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:n.boxData},{data:n.outliers}]}};function eU(r){r.registerSeriesModel(eq),r.registerChartView(iq),r.registerLayout($N),r.registerTransform(nq)}var W0e=["color","borderColor"],X0e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(t),this._isLargeDraw?this._renderLarge(t):this._renderNormal(t)},e.prototype.incrementalPrepareRender=function(t,i,n){this._clear(),this._updateDrawMode(t)},e.prototype.incrementalRender=function(t,i,n,a){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(t,i):this._incrementalRenderNormal(t,i)},e.prototype.eachRendered=function(t){sa(this._progressiveEls||this.group,t)},e.prototype._updateDrawMode=function(t){var i=t.pipelineContext.large;(this._isLargeDraw==null||i!==this._isLargeDraw)&&(this._isLargeDraw=i,this._clear())},e.prototype._renderNormal=function(t){var i=t.getData(),n=this._data,a=this.group,o=i.getLayout("isSimpleBox"),s=t.get("clip",!0),l=t.coordinateSystem,u=l.getArea&&l.getArea();this._data||a.removeAll(),i.diff(n).add(function(c){if(i.hasValue(c)){var f=i.getItemLayout(c);if(s&&aq(u,f))return;var h=tU(f,c,!0);ar(h,{shape:{points:f.ends}},t,c),rU(h,i,c,o),a.add(h),i.setItemGraphicEl(c,h)}}).update(function(c,f){var h=n.getItemGraphicEl(f);if(!i.hasValue(c)){a.remove(h);return}var p=i.getItemLayout(c);if(s&&aq(u,p)){a.remove(h);return}h?(Dt(h,{shape:{points:p.ends}},t,c),Ii(h)):h=tU(p,c),rU(h,i,c,o),a.add(h),i.setItemGraphicEl(c,h)}).remove(function(c){var f=n.getItemGraphicEl(c);f&&a.remove(f)}).execute(),this._data=i},e.prototype._renderLarge=function(t){this._clear(),oq(t,this.group);var i=t.get("clip",!0)?ql(t.coordinateSystem,!1,t):null;i?this.group.setClipPath(i):this.group.removeClipPath()},e.prototype._incrementalRenderNormal=function(t,i){for(var n=i.getData(),a=n.getLayout("isSimpleBox"),o;(o=t.next())!=null;){var s=n.getItemLayout(o),l=tU(s,o);rU(l,n,o,a),l.incremental=!0,this.group.add(l),this._progressiveEls.push(l)}},e.prototype._incrementalRenderLarge=function(t,i){oq(i,this.group,this._progressiveEls,!0)},e.prototype.remove=function(t){this._clear()},e.prototype._clear=function(){this.group.removeAll(),this._data=null},e.type="candlestick",e}(Yt),Y0e=function(){function r(){}return r}(),q0e=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="normalCandlestickBox",i}return e.prototype.getDefaultShape=function(){return new Y0e},e.prototype.buildPath=function(t,i){var n=i.points;this.__simpleBox?(t.moveTo(n[4][0],n[4][1]),t.lineTo(n[6][0],n[6][1])):(t.moveTo(n[0][0],n[0][1]),t.lineTo(n[1][0],n[1][1]),t.lineTo(n[2][0],n[2][1]),t.lineTo(n[3][0],n[3][1]),t.closePath(),t.moveTo(n[4][0],n[4][1]),t.lineTo(n[5][0],n[5][1]),t.moveTo(n[6][0],n[6][1]),t.lineTo(n[7][0],n[7][1]))},e}(ut);function tU(r,e,t){var i=r.ends;return new q0e({shape:{points:t?Z0e(i,r):i},z2:100})}function aq(r,e){for(var t=!0,i=0;i<e.ends.length;i++)if(r.contain(e.ends[i][0],e.ends[i][1])){t=!1;break}return t}function rU(r,e,t,i){var n=e.getItemModel(t);r.useStyle(e.getItemVisual(t,"style")),r.style.strokeNoScale=!0,r.__simpleBox=i,Gr(r,n)}function Z0e(r,e){return de(r,function(t){return t=t.slice(),t[1]=e.initBaseline,t})}var j0e=function(){function r(){}return r}(),iU=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i.type="largeCandlestickBox",i}return e.prototype.getDefaultShape=function(){return new j0e},e.prototype.buildPath=function(t,i){for(var n=i.points,a=0;a<n.length;)if(this.__sign===n[a++]){var o=n[a++];t.moveTo(o,n[a++]),t.lineTo(o,n[a++])}else a+=3},e}(ut);function oq(r,e,t,i){var n=r.getData(),a=n.getLayout("largePoints"),o=new iU({shape:{points:a},__sign:1,ignoreCoarsePointer:!0});e.add(o);var s=new iU({shape:{points:a},__sign:-1,ignoreCoarsePointer:!0});e.add(s);var l=new iU({shape:{points:a},__sign:0,ignoreCoarsePointer:!0});e.add(l),nU(1,o,r,n),nU(-1,s,r,n),nU(0,l,r,n),i&&(o.incremental=!0,s.incremental=!0),t&&t.push(o,s)}function nU(r,e,t,i){var n=t.get(["itemStyle",r>0?"borderColor":"borderColor0"])||t.get(["itemStyle",r>0?"color":"color0"]);r===0&&(n=t.get(["itemStyle","borderColorDoji"]));var a=t.getModel("itemStyle").getItemStyle(W0e);e.useStyle(a),e.style.fill=null,e.style.stroke=n}var sq=X0e;var lq=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.defaultValueDimensions=[{name:"open",defaultTooltip:!0},{name:"close",defaultTooltip:!0},{name:"lowest",defaultTooltip:!0},{name:"highest",defaultTooltip:!0}],t}return e.prototype.getShadowDim=function(){return"open"},e.prototype.brushSelector=function(t,i,n){var a=i.getItemLayout(t);return a&&n.rect(a.brushRect)},e.type="series.candlestick",e.dependencies=["xAxis","yAxis","grid"],e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,clip:!0,itemStyle:{color:"#eb5454",color0:"#47b262",borderColor:"#eb5454",borderColor0:"#47b262",borderColorDoji:null,borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,large:!0,largeThreshold:600,progressive:3e3,progressiveThreshold:1e4,progressiveChunkMode:"mod",animationEasing:"linear",animationDuration:300},e}(jt);wr(lq,UT,!0);var uq=lq;function aU(r){!r||!pe(r.series)||N(r.series,function(e){qe(e)&&e.type==="k"&&(e.type="candlestick")})}var K0e=["itemStyle","borderColor"],J0e=["itemStyle","borderColor0"],$0e=["itemStyle","borderColorDoji"],Q0e=["itemStyle","color"],e_e=["itemStyle","color0"],t_e={seriesType:"candlestick",plan:Mo(),performRawSeries:!0,reset:function(r,e){function t(a,o){return o.get(a>0?Q0e:e_e)}function i(a,o){return o.get(a===0?$0e:a>0?K0e:J0e)}if(!e.isSeriesFiltered(r)){var n=r.pipelineContext.large;return!n&&{progress:function(a,o){for(var s;(s=a.next())!=null;){var l=o.getItemModel(s),u=o.getItemLayout(s).sign,c=l.getItemStyle();c.fill=t(u,l),c.stroke=i(u,l)||c.fill;var f=o.ensureUniqueItemVisual(s,"style");fe(f,c)}}}}}},cq=t_e;var r_e={seriesType:"candlestick",plan:Mo(),reset:function(r){var e=r.coordinateSystem,t=r.getData(),i=i_e(r,t),n=0,a=1,o=["x","y"],s=t.getDimensionIndex(t.mapDimension(o[n])),l=de(t.mapDimensionsAll(o[a]),t.getDimensionIndex,t),u=l[0],c=l[1],f=l[2],h=l[3];if(t.setLayout({candleWidth:i,isSimpleBox:i<=1.3}),s<0||l.length<4)return;return{progress:r.pipelineContext.large?d:p};function p(g,m){for(var v,_=m.getStore();(v=g.next())!=null;){var y=_.get(s,v),x=_.get(u,v),M=_.get(c,v),S=_.get(f,v),w=_.get(h,v),T=Math.min(x,M),C=Math.max(x,M),b=B(T,y),E=B(C,y),I=B(S,y),R=B(w,y),A=[];F(A,E,0),F(A,b,1),A.push(G(R),G(E),G(I),G(b));var D=m.getItemModel(v),U=!!D.get(["itemStyle","borderColorDoji"]);m.setItemLayout(v,{sign:fq(_,v,x,M,c,U),initBaseline:x>M?E[a]:b[a],ends:A,brushRect:k(S,w,y)})}function B(Y,J){var Q=[];return Q[n]=J,Q[a]=Y,isNaN(J)||isNaN(Y)?[NaN,NaN]:e.dataToPoint(Q)}function F(Y,J,Q){var V=J.slice(),K=J.slice();V[n]=S_(V[n]+i/2,1,!1),K[n]=S_(K[n]-i/2,1,!0),Q?Y.push(V,K):Y.push(K,V)}function k(Y,J,Q){var V=B(Y,Q),K=B(J,Q);return V[n]-=i/2,K[n]-=i/2,{x:V[0],y:V[1],width:a?i:K[0]-V[0],height:a?K[1]-V[1]:i}}function G(Y){return Y[n]=S_(Y[n],1),Y}}function d(g,m){for(var v=ca(g.count*4),_=0,y,x=[],M=[],S,w=m.getStore(),T=!!r.get(["itemStyle","borderColorDoji"]);(S=g.next())!=null;){var C=w.get(s,S),b=w.get(u,S),E=w.get(c,S),I=w.get(f,S),R=w.get(h,S);if(isNaN(C)||isNaN(I)||isNaN(R)){v[_++]=NaN,_+=3;continue}v[_++]=fq(w,S,b,E,c,T),x[n]=C,x[a]=I,y=e.dataToPoint(x,null,M),v[_++]=y?y[0]:NaN,v[_++]=y?y[1]:NaN,x[a]=R,y=e.dataToPoint(x,null,M),v[_++]=y?y[1]:NaN}m.setLayout("largePoints",v)}}};function fq(r,e,t,i,n,a){var o;return t>i?o=-1:t<i?o=1:o=a?0:e>0?r.get(n,e-1)<=i?1:-1:1,o}function i_e(r,e){var t=r.getBaseAxis(),i,n=t.type==="category"?t.getBandWidth():(i=t.getExtent(),Math.abs(i[1]-i[0])/e.count()),a=Fe(ft(r.get("barMaxWidth"),n),n),o=Fe(ft(r.get("barMinWidth"),1),n),s=r.get("barWidth");return s!=null?Fe(s,n):Math.max(Math.min(n/2,a),o)}var hq=r_e;function oU(r){r.registerChartView(sq),r.registerSeriesModel(uq),r.registerPreprocessor(aU),r.registerVisual(cq),r.registerLayout(hq)}function pq(r,e){var t=e.rippleEffectColor||e.color;r.eachChild(function(i){i.attr({z:e.z,zlevel:e.zlevel,style:{stroke:e.brushType==="stroke"?t:null,fill:e.brushType==="fill"?t:null}})})}var n_e=function(r){Z(e,r);function e(t,i){var n=r.call(this)||this,a=new ku(t,i),o=new Ze;return n.add(a),n.add(o),n.updateData(t,i),n}return e.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},e.prototype.startEffectAnimation=function(t){for(var i=t.symbolType,n=t.color,a=t.rippleNumber,o=this.childAt(1),s=0;s<a;s++){var l=Sr(i,-1,-1,2,2,n);l.attr({style:{strokeNoScale:!0},z2:99,silent:!0,scaleX:.5,scaleY:.5});var u=-s/a*t.period+t.effectOffset;l.animate("",!0).when(t.period,{scaleX:t.rippleScale/2,scaleY:t.rippleScale/2}).delay(u).start(),l.animateStyle(!0).when(t.period,{opacity:0}).delay(u).start(),o.add(l)}pq(o,t)},e.prototype.updateEffectAnimation=function(t){for(var i=this._effectCfg,n=this.childAt(1),a=["symbolType","period","rippleScale","rippleNumber"],o=0;o<a.length;o++){var s=a[o];if(i[s]!==t[s]){this.stopEffectAnimation(),this.startEffectAnimation(t);return}}pq(n,t)},e.prototype.highlight=function(){Bn(this)},e.prototype.downplay=function(){kn(this)},e.prototype.getSymbolType=function(){var t=this.childAt(0);return t&&t.getSymbolType()},e.prototype.updateData=function(t,i){var n=this,a=t.hostModel;this.childAt(0).updateData(t,i);var o=this.childAt(1),s=t.getItemModel(i),l=t.getItemVisual(i,"symbol"),u=qs(t.getItemVisual(i,"symbolSize")),c=t.getItemVisual(i,"style"),f=c&&c.fill,h=s.getModel("emphasis");o.setScale(u),o.traverse(function(m){m.setStyle("fill",f)});var p=bo(t.getItemVisual(i,"symbolOffset"),u);p&&(o.x=p[0],o.y=p[1]);var d=t.getItemVisual(i,"symbolRotate");o.rotation=(d||0)*Math.PI/180||0;var g={};g.showEffectOn=a.get("showEffectOn"),g.rippleScale=s.get(["rippleEffect","scale"]),g.brushType=s.get(["rippleEffect","brushType"]),g.period=s.get(["rippleEffect","period"])*1e3,g.effectOffset=i/t.count(),g.z=a.getShallow("z")||0,g.zlevel=a.getShallow("zlevel")||0,g.symbolType=l,g.color=f,g.rippleEffectColor=s.get(["rippleEffect","color"]),g.rippleNumber=s.get(["rippleEffect","number"]),g.showEffectOn==="render"?(this._effectCfg?this.updateEffectAnimation(g):this.startEffectAnimation(g),this._effectCfg=g):(this._effectCfg=null,this.stopEffectAnimation(),this.onHoverStateChange=function(m){m==="emphasis"?g.showEffectOn!=="render"&&n.startEffectAnimation(g):m==="normal"&&g.showEffectOn!=="render"&&n.stopEffectAnimation()}),this._effectCfg=g,nr(this,h.get("focus"),h.get("blurScope"),h.get("disabled"))},e.prototype.fadeOut=function(t){t&&t()},e}(Ze),dq=n_e;var a_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this._symbolDraw=new Yl(dq)},e.prototype.render=function(t,i,n){var a=t.getData(),o=this._symbolDraw;o.updateData(a,{clipShape:this._getClipShape(t)}),this.group.add(o.group)},e.prototype._getClipShape=function(t){var i=t.coordinateSystem,n=i&&i.getArea&&i.getArea();return t.get("clip",!0)?n:null},e.prototype.updateTransform=function(t,i,n){var a=t.getData();this.group.dirty();var o=el("").reset(t,i,n);o.progress&&o.progress({start:0,end:a.count(),count:a.count()},a),this._symbolDraw.updateLayout()},e.prototype._updateGroupTransform=function(t){var i=t.coordinateSystem;i&&i.getRoamTransform&&(this.group.transform=ZV(i.getRoamTransform()),this.group.decomposeTransform())},e.prototype.remove=function(t,i){this._symbolDraw&&this._symbolDraw.remove(!0)},e.type="effectScatter",e}(Yt),mq=a_e;var o_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{useEncodeDefaulter:!0})},e.prototype.brushSelector=function(t,i,n){return n.point(i.getItemLayout(t))},e.type="series.effectScatter",e.dependencies=["grid","polar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,effectType:"ripple",progressive:0,showEffectOn:"render",clip:!0,rippleEffect:{period:4,scale:2.5,brushType:"fill",number:3},universalTransition:{divideShape:"clone"},symbolSize:10},e}(jt),vq=o_e;function sU(r){r.registerChartView(mq),r.registerSeriesModel(vq),r.registerLayout(el("effectScatter"))}var s_e=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;return a.add(a.createLine(t,i,n)),a._updateEffectSymbol(t,i),a}return e.prototype.createLine=function(t,i,n){return new Ov(t,i,n)},e.prototype._updateEffectSymbol=function(t,i){var n=t.getItemModel(i),a=n.getModel("effect"),o=a.get("symbolSize"),s=a.get("symbol");pe(o)||(o=[o,o]);var l=t.getItemVisual(i,"style"),u=a.get("color")||l&&l.stroke,c=this.childAt(1);this._symbolType!==s&&(this.remove(c),c=Sr(s,-.5,-.5,1,1,u),c.z2=100,c.culling=!0,this.add(c)),c&&(c.setStyle("shadowColor",u),c.setStyle(a.getItemStyle(["color"])),c.scaleX=o[0],c.scaleY=o[1],c.setColor(u),this._symbolType=s,this._symbolScale=o,this._updateEffectAnimation(t,a,i))},e.prototype._updateEffectAnimation=function(t,i,n){var a=this.childAt(1);if(a){var o=t.getItemLayout(n),s=i.get("period")*1e3,l=i.get("loop"),u=i.get("roundTrip"),c=i.get("constantSpeed"),f=Br(i.get("delay"),function(p){return p/t.count()*s/3});if(a.ignore=!0,this._updateAnimationPoints(a,o),c>0&&(s=this._getLineLength(a)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){a.stopAnimation();var h=void 0;He(f)?h=f(n):h=f,a.__t>0&&(h=-s*a.__t),this._animateSymbol(a,s,h,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},e.prototype._animateSymbol=function(t,i,n,a,o){if(i>0){t.__t=0;var s=this,l=t.animate("",a).when(o?i*2:i,{__t:o?2:1}).delay(n).during(function(){s._updateSymbolPosition(t)});a||l.done(function(){s.remove(t)}),l.start()}},e.prototype._getLineLength=function(t){return Xo(t.__p1,t.__cp1)+Xo(t.__cp1,t.__p2)},e.prototype._updateAnimationPoints=function(t,i){t.__p1=i[0],t.__p2=i[1],t.__cp1=i[2]||[(i[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2]},e.prototype.updateData=function(t,i,n){this.childAt(0).updateData(t,i,n),this._updateEffectSymbol(t,i)},e.prototype._updateSymbolPosition=function(t){var i=t.__p1,n=t.__p2,a=t.__cp1,o=t.__t<1?t.__t:2-t.__t,s=[t.x,t.y],l=s.slice(),u=vi,c=G0;s[0]=u(i[0],a[0],n[0],o),s[1]=u(i[1],a[1],n[1],o);var f=t.__t<1?c(i[0],a[0],n[0],o):c(n[0],a[0],i[0],1-o),h=t.__t<1?c(i[1],a[1],n[1],o):c(n[1],a[1],i[1],1-o);t.rotation=-Math.atan2(h,f)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(t.__lastT!==void 0&&t.__lastT<t.__t?(t.scaleY=Xo(l,s)*1.05,o===1&&(s[0]=l[0]+(s[0]-l[0])/2,s[1]=l[1]+(s[1]-l[1])/2)):t.__lastT===1?t.scaleY=2*Xo(i,s):t.scaleY=this._symbolScale[1]),t.__lastT=t.__t,t.ignore=!1,t.x=s[0],t.y=s[1]},e.prototype.updateLayout=function(t,i){this.childAt(0).updateLayout(t,i);var n=t.getItemModel(i).getModel("effect");this._updateEffectAnimation(t,n,i)},e}(Ze),OT=s_e;var l_e=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;return a._createPolyline(t,i,n),a}return e.prototype._createPolyline=function(t,i,n){var a=t.getItemLayout(i),o=new $r({shape:{points:a}});this.add(o),this._updateCommonStl(t,i,n)},e.prototype.updateData=function(t,i,n){var a=t.hostModel,o=this.childAt(0),s={shape:{points:t.getItemLayout(i)}};Dt(o,s,a,i),this._updateCommonStl(t,i,n)},e.prototype._updateCommonStl=function(t,i,n){var a=this.childAt(0),o=t.getItemModel(i),s=n&&n.emphasisLineStyle,l=n&&n.focus,u=n&&n.blurScope,c=n&&n.emphasisDisabled;if(!n||t.hasItemOption){var f=o.getModel("emphasis");s=f.getModel("lineStyle").getLineStyle(),c=f.get("disabled"),l=f.get("focus"),u=f.get("blurScope")}a.useStyle(t.getItemVisual(i,"style")),a.style.fill=null,a.style.strokeNoScale=!0;var h=a.ensureState("emphasis");h.style=s,nr(this,l,u,c)},e.prototype.updateLayout=function(t,i){var n=this.childAt(0);n.setShape("points",t.getItemLayout(i))},e}(Ze),FT=l_e;var u_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._lastFrame=0,t._lastFramePercent=0,t}return e.prototype.createLine=function(t,i,n){return new FT(t,i,n)},e.prototype._updateAnimationPoints=function(t,i){this._points=i;for(var n=[0],a=0,o=1;o<i.length;o++){var s=i[o-1],l=i[o];a+=Xo(s,l),n.push(a)}if(a===0){this._length=0;return}for(var o=0;o<n.length;o++)n[o]/=a;this._offsets=n,this._length=a},e.prototype._getLineLength=function(){return this._length},e.prototype._updateSymbolPosition=function(t){var i=t.__t<1?t.__t:2-t.__t,n=this._points,a=this._offsets,o=n.length;if(a){var s=this._lastFrame,l;if(i<this._lastFramePercent){var u=Math.min(s+1,o-1);for(l=u;l>=0&&!(a[l]<=i);l--);l=Math.min(l,o-2)}else{for(l=s;l<o&&!(a[l]>i);l++);l=Math.min(l-1,o-2)}var c=(i-a[l])/(a[l+1]-a[l]),f=n[l],h=n[l+1];t.x=f[0]*(1-c)+c*h[0],t.y=f[1]*(1-c)+c*h[1];var p=t.__t<1?h[0]-f[0]:f[0]-h[0],d=t.__t<1?h[1]-f[1]:f[1]-h[1];t.rotation=-Math.atan2(d,p)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=i,t.ignore=!1}},e}(OT),gq=u_e;var c_e=function(){function r(){this.polyline=!1,this.curveness=0,this.segs=[]}return r}(),f_e=function(r){Z(e,r);function e(t){var i=r.call(this,t)||this;return i._off=0,i.hoverDataIdx=-1,i}return e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new c_e},e.prototype.buildPath=function(t,i){var n=i.segs,a=i.curveness,o;if(i.polyline)for(o=this._off;o<n.length;){var s=n[o++];if(s>0){t.moveTo(n[o++],n[o++]);for(var l=1;l<s;l++)t.lineTo(n[o++],n[o++])}}else for(o=this._off;o<n.length;){var u=n[o++],c=n[o++],f=n[o++],h=n[o++];if(t.moveTo(u,c),a>0){var p=(u+f)/2-(c-h)*a,d=(c+h)/2-(f-u)*a;t.quadraticCurveTo(p,d,f,h)}else t.lineTo(f,h)}this.incremental&&(this._off=o,this.notClear=!0)},e.prototype.findDataIndex=function(t,i){var n=this.shape,a=n.segs,o=n.curveness,s=this.style.lineWidth;if(n.polyline)for(var l=0,u=0;u<a.length;){var c=a[u++];if(c>0)for(var f=a[u++],h=a[u++],p=1;p<c;p++){var d=a[u++],g=a[u++];if(Ul(f,h,d,g,s,t,i))return l}l++}else for(var l=0,u=0;u<a.length;){var f=a[u++],h=a[u++],d=a[u++],g=a[u++];if(o>0){var m=(f+d)/2-(h-g)*o,v=(h+g)/2-(d-f)*o;if(Zb(f,h,m,v,d,g,s,t,i))return l}else if(Ul(f,h,d,g,s,t,i))return l;l++}return-1},e.prototype.contain=function(t,i){var n=this.transformCoordToLocal(t,i),a=this.getBoundingRect();if(t=n[0],i=n[1],a.contain(t,i)){var o=this.hoverDataIdx=this.findDataIndex(t,i);return o>=0}return this.hoverDataIdx=-1,!1},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var i=this.shape,n=i.segs,a=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u<n.length;){var c=n[u++],f=n[u++];a=Math.min(c,a),s=Math.max(c,s),o=Math.min(f,o),l=Math.max(f,l)}t=this._rect=new lt(a,o,s,l)}return t},e}(ut),h_e=function(){function r(){this.group=new Ze}return r.prototype.updateData=function(e){this._clear();var t=this._create();t.setShape({segs:e.getLayout("linesPoints")}),this._setCommon(t,e)},r.prototype.incrementalPrepareUpdate=function(e){this.group.removeAll(),this._clear()},r.prototype.incrementalUpdate=function(e,t){var i=this._newAdded[0],n=t.getLayout("linesPoints"),a=i&&i.shape.segs;if(a&&a.length<2e4){var o=a.length,s=new Float32Array(o+n.length);s.set(a),s.set(n,o),i.setShape({segs:s})}else{this._newAdded=[];var l=this._create();l.incremental=!0,l.setShape({segs:n}),this._setCommon(l,t),l.__startIndex=e.start}},r.prototype.remove=function(){this._clear()},r.prototype.eachRendered=function(e){this._newAdded[0]&&e(this._newAdded[0])},r.prototype._create=function(){var e=new f_e({cursor:"default",ignoreCoarsePointer:!0});return this._newAdded.push(e),this.group.add(e),e},r.prototype._setCommon=function(e,t,i){var n=t.hostModel;e.setShape({polyline:n.get("polyline"),curveness:n.get(["lineStyle","curveness"])}),e.useStyle(n.getModel("lineStyle").getLineStyle()),e.style.strokeNoScale=!0;var a=t.getVisual("style");a&&a.stroke&&e.setStyle("stroke",a.stroke),e.setStyle("fill",null);var o=rt(e);o.seriesIndex=n.seriesIndex,e.on("mousemove",function(s){o.dataIndex=null;var l=e.hoverDataIdx;l>0&&(o.dataIndex=l+e.__startIndex)})},r.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},r}(),yq=h_e;var p_e={seriesType:"lines",plan:Mo(),reset:function(r){var e=r.coordinateSystem;if(e){var t=r.get("polyline"),i=r.pipelineContext.large;return{progress:function(n,a){var o=[];if(i){var s=void 0,l=n.end-n.start;if(t){for(var u=0,c=n.start;c<n.end;c++)u+=r.getLineCoordsCount(c);s=new Float32Array(l+u*2)}else s=new Float32Array(l*4);for(var f=0,h=[],c=n.start;c<n.end;c++){var p=r.getLineCoords(c,o);t&&(s[f++]=p);for(var d=0;d<p;d++)h=e.dataToPoint(o[d],!1,h),s[f++]=h[0],s[f++]=h[1]}a.setLayout("linesPoints",s)}else for(var c=n.start;c<n.end;c++){var g=a.getItemModel(c),p=r.getLineCoords(c,o),m=[];if(t)for(var v=0;v<p;v++)m.push(e.dataToPoint(o[v]));else{m[0]=e.dataToPoint(o[0]),m[1]=e.dataToPoint(o[1]);var _=g.get(["lineStyle","curveness"]);+_&&(m[2]=[(m[0][0]+m[1][0])/2-(m[0][1]-m[1][1])*_,(m[0][1]+m[1][1])/2-(m[1][0]-m[0][0])*_])}a.setItemLayout(c,m)}}}}}},zT=p_e;var d_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this._updateLineDraw(a,t),s=t.get("zlevel"),l=t.get(["effect","trailLength"]),u=n.getZr(),c=u.painter.getType()==="svg";c||u.painter.getLayer(s).clear(!0),this._lastZlevel!=null&&!c&&u.configLayer(this._lastZlevel,{motionBlur:!1}),this._showEffect(t)&&l>0&&(c||u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)})),o.updateData(a);var f=t.get("clip",!0)&&ql(t.coordinateSystem,!1,t);f?this.group.setClipPath(f):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},e.prototype.incrementalPrepareRender=function(t,i,n){var a=t.getData(),o=this._updateLineDraw(a,t);o.incrementalPrepareUpdate(a),this._clearLayer(n),this._finished=!1},e.prototype.incrementalRender=function(t,i,n){this._lineDraw.incrementalUpdate(t,i.getData()),this._finished=t.end===i.getData().count()},e.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},e.prototype.updateTransform=function(t,i,n){var a=t.getData(),o=t.pipelineContext;if(!this._finished||o.large||o.progressiveRender)return{update:!0};var s=zT.reset(t,i,n);s.progress&&s.progress({start:0,end:a.count(),count:a.count()},a),this._lineDraw.updateLayout(),this._clearLayer(n)},e.prototype._updateLineDraw=function(t,i){var n=this._lineDraw,a=this._showEffect(i),o=!!i.get("polyline"),s=i.pipelineContext,l=s.large;return(!n||a!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(n&&n.remove(),n=this._lineDraw=l?new yq:new Fv(o?a?gq:FT:a?OT:Ov),this._hasEffet=a,this._isPolyline=o,this._isLargeDraw=l),this.group.add(n.group),n},e.prototype._showEffect=function(t){return!!t.get(["effect","show"])},e.prototype._clearLayer=function(t){var i=t.getZr(),n=i.painter.getType()==="svg";!n&&this._lastZlevel!=null&&i.painter.getLayer(this._lastZlevel).clear(!0)},e.prototype.remove=function(t,i){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(i)},e.prototype.dispose=function(t,i){this.remove(t,i)},e.type="lines",e}(Yt),_q=d_e;var m_e=typeof Uint32Array>"u"?Array:Uint32Array,v_e=typeof Float64Array>"u"?Array:Float64Array;function xq(r){var e=r.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(r.data=de(e,function(t){var i=[t[0].coord,t[1].coord],n={coords:i};return t[0].name&&(n.fromName=t[0].name),t[1].name&&(n.toName=t[1].name),Sm([n,t[0],t[1]])}))}var g_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.visualStyleAccessPath="lineStyle",t.visualDrawType="stroke",t}return e.prototype.init=function(t){t.data=t.data||[],xq(t);var i=this._processFlatCoordsArray(t.data);this._flatCoords=i.flatCoords,this._flatCoordsOffset=i.flatCoordsOffset,i.flatCoords&&(t.data=new Float32Array(i.count)),r.prototype.init.apply(this,arguments)},e.prototype.mergeOption=function(t){if(xq(t),t.data){var i=this._processFlatCoordsArray(t.data);this._flatCoords=i.flatCoords,this._flatCoordsOffset=i.flatCoordsOffset,i.flatCoords&&(t.data=new Float32Array(i.count))}r.prototype.mergeOption.apply(this,arguments)},e.prototype.appendData=function(t){var i=this._processFlatCoordsArray(t.data);i.flatCoords&&(this._flatCoords?(this._flatCoords=ep(this._flatCoords,i.flatCoords),this._flatCoordsOffset=ep(this._flatCoordsOffset,i.flatCoordsOffset)):(this._flatCoords=i.flatCoords,this._flatCoordsOffset=i.flatCoordsOffset),t.data=new Float32Array(i.count)),this.getRawData().appendData(t.data)},e.prototype._getCoordsFromItemModel=function(t){var i=this.getData().getItemModel(t),n=i.option instanceof Array?i.option:i.getShallow("coords");return n},e.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[t*2+1]:this._getCoordsFromItemModel(t).length},e.prototype.getLineCoords=function(t,i){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[t*2],a=this._flatCoordsOffset[t*2+1],o=0;o<a;o++)i[o]=i[o]||[],i[o][0]=this._flatCoords[n+o*2],i[o][1]=this._flatCoords[n+o*2+1];return a}else{for(var s=this._getCoordsFromItemModel(t),o=0;o<s.length;o++)i[o]=i[o]||[],i[o][0]=s[o][0],i[o][1]=s[o][1];return s.length}},e.prototype._processFlatCoordsArray=function(t){var i=0;if(this._flatCoords&&(i=this._flatCoords.length),At(t[0])){for(var n=t.length,a=new m_e(n),o=new v_e(n),s=0,l=0,u=0,c=0;c<n;){u++;var f=t[c++];a[l++]=s+i,a[l++]=f;for(var h=0;h<f;h++){var p=t[c++],d=t[c++];o[s++]=p,o[s++]=d,c>n}}return{flatCoordsOffset:new Uint32Array(a.buffer,0,l),flatCoords:o,count:u}}return{flatCoordsOffset:null,flatCoords:null,count:t.length}},e.prototype.getInitialData=function(t,i){if(0)var n;var a=new ti(["value"],this);return a.hasItemOption=!1,a.initData(t.data,[],function(o,s,l,u){if(o instanceof Array)return NaN;a.hasItemOption=!0;var c=o.value;if(c!=null)return c instanceof Array?c[u]:c}),a},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=a.getItemModel(t),s=o.get("name");if(s)return s;var l=o.get("fromName"),u=o.get("toName"),c=[];return l!=null&&c.push(l),u!=null&&c.push(u),Or("nameValue",{name:c.join(" > ")})},e.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},e.prototype.getProgressive=function(){var t=this.option.progressive;return t??(this.option.large?1e4:this.get("progressive"))},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return t??(this.option.large?2e4:this.get("progressiveThreshold"))},e.prototype.getZLevelKey=function(){var t=this.getModel("effect"),i=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&i>0?i+"":""},e.type="series.lines",e.dependencies=["grid","polar","geo","calendar"],e.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},e}(jt),Sq=g_e;function BT(r){return r instanceof Array||(r=[r,r]),r}var y_e={seriesType:"lines",reset:function(r){var e=BT(r.get("symbol")),t=BT(r.get("symbolSize")),i=r.getData();i.setVisual("fromSymbol",e&&e[0]),i.setVisual("toSymbol",e&&e[1]),i.setVisual("fromSymbolSize",t&&t[0]),i.setVisual("toSymbolSize",t&&t[1]);function n(a,o){var s=a.getItemModel(o),l=BT(s.getShallow("symbol",!0)),u=BT(s.getShallow("symbolSize",!0));l[0]&&a.setItemVisual(o,"fromSymbol",l[0]),l[1]&&a.setItemVisual(o,"toSymbol",l[1]),u[0]&&a.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&a.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:i.hasItemOption?n:null}}},Mq=y_e;function lU(r){r.registerChartView(_q),r.registerSeriesModel(Sq),r.registerLayout(zT),r.registerVisual(Mq)}var __e=256,x_e=function(){function r(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=zn.createCanvas();this.canvas=e}return r.prototype.update=function(e,t,i,n,a,o){var s=this._getBrush(),l=this._getGradient(a,"inRange"),u=this._getGradient(a,"outOfRange"),c=this.pointSize+this.blurSize,f=this.canvas,h=f.getContext("2d"),p=e.length;f.width=t,f.height=i;for(var d=0;d<p;++d){var g=e[d],m=g[0],v=g[1],_=g[2],y=n(_);h.globalAlpha=y,h.drawImage(s,m-c,v-c)}if(!f.width||!f.height)return f;for(var x=h.getImageData(0,0,f.width,f.height),M=x.data,S=0,w=M.length,T=this.minOpacity,C=this.maxOpacity,b=C-T;S<w;){var y=M[S+3]/256,E=Math.floor(y*(__e-1))*4;if(y>0){var I=o(y)?l:u;y>0&&(y=y*b+T),M[S++]=I[E],M[S++]=I[E+1],M[S++]=I[E+2],M[S++]=I[E+3]*y*256}else S+=4}return h.putImageData(x,0,0),f},r.prototype._getBrush=function(){var e=this._brushCanvas||(this._brushCanvas=zn.createCanvas()),t=this.pointSize+this.blurSize,i=t*2;e.width=i,e.height=i;var n=e.getContext("2d");return n.clearRect(0,0,i,i),n.shadowOffsetX=i,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-t,t,this.pointSize,0,Math.PI*2,!0),n.closePath(),n.fill(),e},r.prototype._getGradient=function(e,t){for(var i=this._gradientPixels,n=i[t]||(i[t]=new Uint8ClampedArray(256*4)),a=[0,0,0,0],o=0,s=0;s<256;s++)e[t](s/255,!0,a),n[o++]=a[0],n[o++]=a[1],n[o++]=a[2],n[o++]=a[3];return n},r}(),bq=x_e;function S_e(r,e,t){var i=r[1]-r[0];e=de(e,function(o){return{interval:[(o.interval[0]-r[0])/i,(o.interval[1]-r[0])/i]}});var n=e.length,a=0;return function(o){var s;for(s=a;s<n;s++){var l=e[s].interval;if(l[0]<=o&&o<=l[1]){a=s;break}}if(s===n)for(s=a-1;s>=0;s--){var l=e[s].interval;if(l[0]<=o&&o<=l[1]){a=s;break}}return s>=0&&s<n&&t[s]}}function M_e(r,e){var t=r[1]-r[0];return e=[(e[0]-r[0])/t,(e[1]-r[0])/t],function(i){return i>=e[0]&&i<=e[1]}}function wq(r){var e=r.dimensions;return e[0]==="lng"&&e[1]==="lat"}var b_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a;i.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===t&&(a=s)})}),this._progressiveEls=null,this.group.removeAll();var o=t.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"?this._renderOnCartesianAndCalendar(t,n,0,t.getData().count()):wq(o)&&this._renderOnGeo(o,t,a,n)},e.prototype.incrementalPrepareRender=function(t,i,n){this.group.removeAll()},e.prototype.incrementalRender=function(t,i,n,a){var o=i.coordinateSystem;o&&(wq(o)?this.render(i,n,a):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(i,a,t.start,t.end,!0)))},e.prototype.eachRendered=function(t){sa(this._progressiveEls||this.group,t)},e.prototype._renderOnCartesianAndCalendar=function(t,i,n,a,o){var s=t.coordinateSystem,l=ls(s,"cartesian2d"),u,c,f,h;if(l){var p=s.getAxis("x"),d=s.getAxis("y");u=p.getBandWidth()+.5,c=d.getBandWidth()+.5,f=p.scale.getExtent(),h=d.scale.getExtent()}for(var g=this.group,m=t.getData(),v=t.getModel(["emphasis","itemStyle"]).getItemStyle(),_=t.getModel(["blur","itemStyle"]).getItemStyle(),y=t.getModel(["select","itemStyle"]).getItemStyle(),x=t.get(["itemStyle","borderRadius"]),M=Tr(t),S=t.getModel("emphasis"),w=S.get("focus"),T=S.get("blurScope"),C=S.get("disabled"),b=l?[m.mapDimension("x"),m.mapDimension("y"),m.mapDimension("value")]:[m.mapDimension("time"),m.mapDimension("value")],E=n;E<a;E++){var I=void 0,R=m.getItemVisual(E,"style");if(l){var A=m.get(b[0],E),D=m.get(b[1],E);if(isNaN(m.get(b[2],E))||isNaN(A)||isNaN(D)||A<f[0]||A>f[1]||D<h[0]||D>h[1])continue;var U=s.dataToPoint([A,D]);I=new Tt({shape:{x:U[0]-u/2,y:U[1]-c/2,width:u,height:c},style:R})}else{if(isNaN(m.get(b[1],E)))continue;I=new Tt({z2:1,shape:s.dataToRect([m.get(b[0],E)]).contentShape,style:R})}if(m.hasItemOption){var B=m.getItemModel(E),F=B.getModel("emphasis");v=F.getModel("itemStyle").getItemStyle(),_=B.getModel(["blur","itemStyle"]).getItemStyle(),y=B.getModel(["select","itemStyle"]).getItemStyle(),x=B.get(["itemStyle","borderRadius"]),w=F.get("focus"),T=F.get("blurScope"),C=F.get("disabled"),M=Tr(B)}I.shape.r=x;var k=t.getRawValue(E),G="-";k&&k[2]!=null&&(G=k[2]+""),Nr(I,M,{labelFetcher:t,labelDataIndex:E,defaultOpacity:R.opacity,defaultText:G}),I.ensureState("emphasis").style=v,I.ensureState("blur").style=_,I.ensureState("select").style=y,nr(I,w,T,C),I.incremental=o,o&&(I.states.emphasis.hoverLayer=!0),g.add(I),m.setItemGraphicEl(E,I),this._progressiveEls&&this._progressiveEls.push(I)}},e.prototype._renderOnGeo=function(t,i,n,a){var o=n.targetVisuals.inRange,s=n.targetVisuals.outOfRange,l=i.getData(),u=this._hmLayer||this._hmLayer||new bq;u.blurSize=i.get("blurSize"),u.pointSize=i.get("pointSize"),u.minOpacity=i.get("minOpacity"),u.maxOpacity=i.get("maxOpacity");var c=t.getViewRect().clone(),f=t.getRoamTransform();c.applyTransform(f);var h=Math.max(c.x,0),p=Math.max(c.y,0),d=Math.min(c.width+c.x,a.getWidth()),g=Math.min(c.height+c.y,a.getHeight()),m=d-h,v=g-p,_=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],y=l.mapArray(_,function(w,T,C){var b=t.dataToPoint([w,T]);return b[0]-=h,b[1]-=p,b.push(C),b}),x=n.getExtent(),M=n.type==="visualMap.continuous"?M_e(x,n.option.range):S_e(x,n.getPieceList(),n.option.selected);u.update(y,m,v,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},M);var S=new Ur({style:{width:m,height:v,x:h,y:p,image:u.canvas},silent:!0});this.group.add(S)},e.type="heatmap",e}(Yt),Tq=b_e;var w_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,i){return hn(null,this,{generateCoord:"value"})},e.prototype.preventIncremental=function(){var t=Uu.get(this.get("coordinateSystem"));if(t&&t.dimensions)return t.dimensions[0]==="lng"&&t.dimensions[1]==="lat"},e.type="series.heatmap",e.dependencies=["grid","geo","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:"#212121"}}},e}(jt),Eq=w_e;function uU(r){r.registerChartView(Tq),r.registerSeriesModel(Eq)}var T_e=["itemStyle","borderWidth"],Aq=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],cU=new oa,E_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=this.group,o=t.getData(),s=this._data,l=t.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),f=l.master.getRect(),h={ecSize:{width:n.getWidth(),height:n.getHeight()},seriesModel:t,coordSys:l,coordSysExtent:[[f.x,f.x+f.width],[f.y,f.y+f.height]],isHorizontal:c,valueDim:Aq[+c],categoryDim:Aq[1-+c]};o.diff(s).add(function(d){if(o.hasValue(d)){var g=Rq(o,d),m=Cq(o,d,g,h),v=Lq(o,h,m);o.setItemGraphicEl(d,v),a.add(v),Dq(v,h,m)}}).update(function(d,g){var m=s.getItemGraphicEl(g);if(!o.hasValue(d)){a.remove(m);return}var v=Rq(o,d),_=Cq(o,d,v,h),y=Bq(o,_);m&&y!==m.__pictorialShapeStr&&(a.remove(m),o.setItemGraphicEl(d,null),m=null),m?I_e(m,h,_):m=Lq(o,h,_,!0),o.setItemGraphicEl(d,m),m.__pictorialSymbolMeta=_,a.add(m),Dq(m,h,_)}).remove(function(d){var g=s.getItemGraphicEl(d);g&&Pq(s,d,g.__pictorialSymbolMeta.animationModel,g)}).execute();var p=t.get("clip",!0)?ql(t.coordinateSystem,!1,t):null;return p?a.setClipPath(p):a.removeClipPath(),this._data=o,this.group},e.prototype.remove=function(t,i){var n=this.group,a=this._data;t.get("animation")?a&&a.eachItemGraphicEl(function(o){Pq(a,rt(o).dataIndex,t,o)}):n.removeAll()},e.type="pictorialBar",e}(Yt);function Cq(r,e,t,i){var n=r.getItemLayout(e),a=t.get("symbolRepeat"),o=t.get("symbolClip"),s=t.get("symbolPosition")||"start",l=t.get("symbolRotate"),u=(l||0)*Math.PI/180||0,c=t.get("symbolPatternSize")||2,f=t.isAnimationEnabled(),h={dataIndex:e,layout:n,itemModel:t,symbolType:r.getItemVisual(e,"symbol")||"circle",style:r.getItemVisual(e,"style"),symbolClip:o,symbolRepeat:a,symbolRepeatDirection:t.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:f?t:null,hoverScale:f&&t.get(["emphasis","scale"]),z2:t.getShallow("z",!0)||0};A_e(t,a,n,i,h),C_e(r,e,n,a,o,h.boundingLength,h.pxSign,c,i,h),R_e(t,h.symbolScale,u,i,h);var p=h.symbolSize,d=bo(t.get("symbolOffset"),p);return L_e(t,p,n,a,o,d,s,h.valueLineWidth,h.boundingLength,h.repeatCutLength,i,h),h}function A_e(r,e,t,i,n){var a=i.valueDim,o=r.get("symbolBoundingData"),s=i.coordSys.getOtherAxis(i.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(t[a.wh]<=0),c;if(pe(o)){var f=[fU(s,o[0])-l,fU(s,o[1])-l];f[1]<f[0]&&f.reverse(),c=f[u]}else o!=null?c=fU(s,o)-l:e?c=i.coordSysExtent[a.index][u]-l:c=t[a.wh];n.boundingLength=c,e&&(n.repeatCutLength=t[a.wh]),n.pxSign=c>0?1:-1}function fU(r,e){return r.toGlobalCoord(r.dataToCoord(r.scale.parse(e)))}function C_e(r,e,t,i,n,a,o,s,l,u){var c=l.valueDim,f=l.categoryDim,h=Math.abs(t[f.wh]),p=r.getItemVisual(e,"symbolSize"),d;pe(p)?d=p.slice():p==null?d=["100%","100%"]:d=[p,p],d[f.index]=Fe(d[f.index],h),d[c.index]=Fe(d[c.index],i?h:Math.abs(a)),u.symbolSize=d;var g=u.symbolScale=[d[0]/s,d[1]/s];g[c.index]*=(l.isHorizontal?-1:1)*o}function R_e(r,e,t,i,n){var a=r.get(T_e)||0;a&&(cU.attr({scaleX:e[0],scaleY:e[1],rotation:t}),cU.updateTransform(),a/=cU.getLineScale(),a*=e[i.valueDim.index]),n.valueLineWidth=a||0}function L_e(r,e,t,i,n,a,o,s,l,u,c,f){var h=c.categoryDim,p=c.valueDim,d=f.pxSign,g=Math.max(e[p.index]+s,0),m=g;if(i){var v=Math.abs(l),_=Br(r.get("symbolMargin"),"15%")+"",y=!1;_.lastIndexOf("!")===_.length-1&&(y=!0,_=_.slice(0,_.length-1));var x=Fe(_,e[p.index]),M=Math.max(g+x*2,0),S=y?0:x*2,w=yp(i),T=w?i:Iq((v+S)/M),C=v-T*g;x=C/2/(y?T:Math.max(T-1,1)),M=g+x*2,S=y?0:x*2,!w&&i!=="fixed"&&(T=u?Iq((Math.abs(u)+S)/M):0),m=T*M-S,f.repeatTimes=T,f.symbolMargin=x}var b=d*(m/2),E=f.pathPosition=[];E[h.index]=t[h.wh]/2,E[p.index]=o==="start"?b:o==="end"?l-b:l/2,a&&(E[0]+=a[0],E[1]+=a[1]);var I=f.bundlePosition=[];I[h.index]=t[h.xy],I[p.index]=t[p.xy];var R=f.barRectShape=fe({},t);R[p.wh]=d*Math.max(Math.abs(t[p.wh]),Math.abs(E[p.index]+b)),R[h.wh]=t[h.wh];var A=f.clipShape={};A[h.xy]=-t[h.xy],A[h.wh]=c.ecSize[h.wh],A[p.xy]=0,A[p.wh]=t[p.wh]}function Nq(r){var e=r.symbolPatternSize,t=Sr(r.symbolType,-e/2,-e/2,e,e);return t.attr({culling:!0}),t.type!=="image"&&t.setStyle({strokeNoScale:!0}),t}function Uq(r,e,t,i){var n=r.__pictorialBundle,a=t.symbolSize,o=t.valueLineWidth,s=t.pathPosition,l=e.valueDim,u=t.repeatTimes||0,c=0,f=a[e.valueDim.index]+o+t.symbolMargin*2;for(hU(r,function(g){g.__pictorialAnimationIndex=c,g.__pictorialRepeatTimes=u,c<u?Hv(g,null,d(c),t,i):Hv(g,null,{scaleX:0,scaleY:0},t,i,function(){n.remove(g)}),c++});c<u;c++){var h=Nq(t);h.__pictorialAnimationIndex=c,h.__pictorialRepeatTimes=u,n.add(h);var p=d(c);Hv(h,{x:p.x,y:p.y,scaleX:0,scaleY:0},{scaleX:p.scaleX,scaleY:p.scaleY,rotation:p.rotation},t,i)}function d(g){var m=s.slice(),v=t.pxSign,_=g;return(t.symbolRepeatDirection==="start"?v>0:v<0)&&(_=u-1-g),m[l.index]=f*(_-u/2+.5)+s[l.index],{x:m[0],y:m[1],scaleX:t.symbolScale[0],scaleY:t.symbolScale[1],rotation:t.rotation}}}function Oq(r,e,t,i){var n=r.__pictorialBundle,a=r.__pictorialMainPath;a?Hv(a,null,{x:t.pathPosition[0],y:t.pathPosition[1],scaleX:t.symbolScale[0],scaleY:t.symbolScale[1],rotation:t.rotation},t,i):(a=r.__pictorialMainPath=Nq(t),n.add(a),Hv(a,{x:t.pathPosition[0],y:t.pathPosition[1],scaleX:0,scaleY:0,rotation:t.rotation},{scaleX:t.symbolScale[0],scaleY:t.symbolScale[1]},t,i))}function Fq(r,e,t){var i=fe({},e.barRectShape),n=r.__pictorialBarRect;n?Hv(n,null,{shape:i},e,t):(n=r.__pictorialBarRect=new Tt({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),n.disableMorphing=!0,r.add(n))}function zq(r,e,t,i){if(t.symbolClip){var n=r.__pictorialClipPath,a=fe({},t.clipShape),o=e.valueDim,s=t.animationModel,l=t.dataIndex;if(n)Dt(n,{shape:a},s,l);else{a[o.wh]=0,n=new Tt({shape:a}),r.__pictorialBundle.setClipPath(n),r.__pictorialClipPath=n;var u={};u[o.wh]=t.clipShape[o.wh],Ct[i?"updateProps":"initProps"](n,{shape:u},s,l)}}}function Rq(r,e){var t=r.getItemModel(e);return t.getAnimationDelayParams=P_e,t.isAnimationEnabled=D_e,t}function P_e(r){return{index:r.__pictorialAnimationIndex,count:r.__pictorialRepeatTimes}}function D_e(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function Lq(r,e,t,i){var n=new Ze,a=new Ze;return n.add(a),n.__pictorialBundle=a,a.x=t.bundlePosition[0],a.y=t.bundlePosition[1],t.symbolRepeat?Uq(n,e,t):Oq(n,e,t),Fq(n,t,i),zq(n,e,t,i),n.__pictorialShapeStr=Bq(r,t),n.__pictorialSymbolMeta=t,n}function I_e(r,e,t){var i=t.animationModel,n=t.dataIndex,a=r.__pictorialBundle;Dt(a,{x:t.bundlePosition[0],y:t.bundlePosition[1]},i,n),t.symbolRepeat?Uq(r,e,t,!0):Oq(r,e,t,!0),Fq(r,t,!0),zq(r,e,t,!0)}function Pq(r,e,t,i){var n=i.__pictorialBarRect;n&&n.removeTextContent();var a=[];hU(i,function(o){a.push(o)}),i.__pictorialMainPath&&a.push(i.__pictorialMainPath),i.__pictorialClipPath&&(t=null),N(a,function(o){es(o,{scaleX:0,scaleY:0},t,e,function(){i.parent&&i.parent.remove(i)})}),r.setItemGraphicEl(e,null)}function Bq(r,e){return[r.getItemVisual(e.dataIndex,"symbol")||"none",!!e.symbolRepeat,!!e.symbolClip].join(":")}function hU(r,e,t){N(r.__pictorialBundle.children(),function(i){i!==r.__pictorialBarRect&&e.call(t,i)})}function Hv(r,e,t,i,n,a){e&&r.attr(e),i.symbolClip&&!n?t&&r.attr(t):t&&Ct[n?"updateProps":"initProps"](r,t,i.animationModel,i.dataIndex,a)}function Dq(r,e,t){var i=t.dataIndex,n=t.itemModel,a=n.getModel("emphasis"),o=a.getModel("itemStyle").getItemStyle(),s=n.getModel(["blur","itemStyle"]).getItemStyle(),l=n.getModel(["select","itemStyle"]).getItemStyle(),u=n.getShallow("cursor"),c=a.get("focus"),f=a.get("blurScope"),h=a.get("scale");hU(r,function(g){if(g instanceof Ur){var m=g.style;g.useStyle(fe({image:m.image,x:m.x,y:m.y,width:m.width,height:m.height},t.style))}else g.useStyle(t.style);var v=g.ensureState("emphasis");v.style=o,h&&(v.scaleX=g.scaleX*1.1,v.scaleY=g.scaleY*1.1),g.ensureState("blur").style=s,g.ensureState("select").style=l,u&&(g.cursor=u),g.z2=t.z2});var p=e.valueDim.posDesc[+(t.boundingLength>0)],d=r.__pictorialBarRect;d.ignoreClip=!0,Nr(d,Tr(n),{labelFetcher:e.seriesModel,labelDataIndex:i,defaultText:Qs(e.seriesModel.getData(),i),inheritColor:t.style.fill,defaultOpacity:t.style.opacity,defaultOutsidePosition:p}),nr(r,c,f,a.get("disabled"))}function Iq(r){var e=Math.round(r);return Math.abs(r-e)<1e-4?e:Math.ceil(r)}var kq=E_e;var N_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t.defaultSymbol="roundRect",t}return e.prototype.getInitialData=function(t){return t.stack=null,r.prototype.getInitialData.apply(this,arguments)},e.type="series.pictorialBar",e.dependencies=["grid"],e.defaultOption=Hn(wv.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:"#212121"}}}),e}(wv),Vq=N_e;function pU(r){r.registerChartView(kq),r.registerSeriesModel(Vq),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,ot(S1,"pictorialBar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,M1("pictorialBar"))}var U_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._layers=[],t}return e.prototype.render=function(t,i,n){var a=t.getData(),o=this,s=this.group,l=t.getLayerSeries(),u=a.getLayout("layoutInfo"),c=u.rect,f=u.boundaryGap;s.x=0,s.y=c.y+f[0];function h(m){return m.name}var p=new An(this._layersSeries||[],l,h,h),d=[];p.add(Be(g,this,"add")).update(Be(g,this,"update")).remove(Be(g,this,"remove")).execute();function g(m,v,_){var y=o._layers;if(m==="remove"){s.remove(y[v]);return}for(var x=[],M=[],S,w=l[v].indices,T=0;T<w.length;T++){var C=a.getItemLayout(w[T]),b=C.x,E=C.y0,I=C.y;x.push(b,E),M.push(b,E+I),S=a.getItemVisual(w[T],"style")}var R,A=a.getItemLayout(w[0]),D=t.getModel("label"),U=D.get("margin"),B=t.getModel("emphasis");if(m==="add"){var F=d[v]=new Ze;R=new J1({shape:{points:x,stackedOnPoints:M,smooth:.4,stackedOnSmooth:.4,smoothConstraint:!1},z2:0}),F.add(R),s.add(F),t.isAnimationEnabled()&&R.setClipPath(O_e(R.getBoundingRect(),t,function(){R.removeClipPath()}))}else{var F=y[_];R=F.childAt(0),s.add(F),d[v]=F,Dt(R,{shape:{points:x,stackedOnPoints:M}},t),Ii(R)}Nr(R,Tr(t),{labelDataIndex:w[T-1],defaultText:a.getName(w[T-1]),inheritColor:S.fill},{normal:{verticalAlign:"middle"}}),R.setTextConfig({position:null,local:!0});var k=R.getTextContent();k&&(k.x=A.x-U,k.y=A.y0+A.y/2),R.useStyle(S),a.setItemGraphicEl(v,R),Gr(R,t),nr(R,B.get("focus"),B.get("blurScope"),B.get("disabled"))}this._layersSeries=l,this._layers=d},e.type="themeRiver",e}(Yt);function O_e(r,e,t){var i=new Tt({shape:{x:r.x-10,y:r.y-10,width:0,height:r.height+20}});return ar(i,{shape:{x:r.x-50,width:r.width+100,height:r.height+20}},e,t),i}var Gq=U_e;var dU=2,F_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new jl(Be(this.getData,this),Be(this.getRawData,this))},e.prototype.fixData=function(t){var i=t.length,n={},a=a_(t,function(h){return n.hasOwnProperty(h[0]+"")||(n[h[0]+""]=-1),h[2]}),o=[];a.buckets.each(function(h,p){o.push({name:p,dataList:h})});for(var s=o.length,l=0;l<s;++l){for(var u=o[l].name,c=0;c<o[l].dataList.length;++c){var f=o[l].dataList[c][0]+"";n[f]=l}for(var f in n)n.hasOwnProperty(f)&&n[f]!==l&&(n[f]=l,t[i]=[f,0,u],i++)}return t},e.prototype.getInitialData=function(t,i){for(var n=this.getReferringComponents("singleAxis",Cr).models[0],a=n.get("type"),o=Wt(t.data,function(d){return d[2]!==void 0}),s=this.fixData(o||[]),l=[],u=this.nameMap=ke(),c=0,f=0;f<s.length;++f)l.push(s[f][dU]),u.get(s[f][dU])||(u.set(s[f][dU],c),c++);var h=js(s,{coordDimensions:["single"],dimensionsDefine:[{name:"time",type:Yp(a)},{name:"value",type:"float"},{name:"name",type:"ordinal"}],encodeDefine:{single:0,value:1,itemName:2}}).dimensions,p=new ti(h,this);return p.initData(s),p},e.prototype.getLayerSeries=function(){for(var t=this.getData(),i=t.count(),n=[],a=0;a<i;++a)n[a]=a;var o=t.mapDimension("single"),s=a_(n,function(u){return t.get("name",u)}),l=[];return s.buckets.each(function(u,c){u.sort(function(f,h){return t.get(o,f)-t.get(o,h)}),l.push({name:c,indices:u})}),l},e.prototype.getAxisTooltipData=function(t,i,n){pe(t)||(t=t?[t]:[]);for(var a=this.getData(),o=this.getLayerSeries(),s=[],l=o.length,u,c=0;c<l;++c){for(var f=Number.MAX_VALUE,h=-1,p=o[c].indices.length,d=0;d<p;++d){var g=a.get(t[0],o[c].indices[d]),m=Math.abs(g-i);m<=f&&(u=g,f=m,h=o[c].indices[d])}s.push(h)}return{dataIndices:s,nestestValue:u}},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=a.getName(t),s=a.get(a.mapDimension("value"),t);return Or("nameValue",{name:o,value:s})},e.type="series.themeRiver",e.dependencies=["singleAxis"],e.defaultOption={z:2,colorBy:"data",coordinateSystem:"singleAxis",boundaryGap:["10%","10%"],singleAxisIndex:0,animationEasing:"linear",label:{margin:4,show:!0,position:"left",fontSize:11},emphasis:{label:{show:!0}}},e}(jt),Hq=F_e;function mU(r,e){r.eachSeriesByType("themeRiver",function(t){var i=t.getData(),n=t.coordinateSystem,a={},o=n.getRect();a.rect=o;var s=t.get("boundaryGap"),l=n.getAxis();if(a.boundaryGap=s,l.orient==="horizontal"){s[0]=Fe(s[0],o.height),s[1]=Fe(s[1],o.height);var u=o.height-s[0]-s[1];Wq(i,t,u)}else{s[0]=Fe(s[0],o.width),s[1]=Fe(s[1],o.width);var c=o.width-s[0]-s[1];Wq(i,t,c)}i.setLayout("layoutInfo",a)})}function Wq(r,e,t){if(r.count())for(var i=e.coordinateSystem,n=e.getLayerSeries(),a=r.mapDimension("single"),o=r.mapDimension("value"),s=de(n,function(m){return de(m.indices,function(v){var _=i.dataToPoint(r.get(a,v));return _[1]=r.get(o,v),_})}),l=z_e(s),u=l.y0,c=t/l.max,f=n.length,h=n[0].indices.length,p,d=0;d<h;++d){p=u[d]*c,r.setItemLayout(n[0].indices[d],{layerIndex:0,x:s[0][d][0],y0:p,y:s[0][d][1]*c});for(var g=1;g<f;++g)p+=s[g-1][d][1]*c,r.setItemLayout(n[g].indices[d],{layerIndex:g,x:s[g][d][0],y0:p,y:s[g][d][1]*c})}}function z_e(r){for(var e=r.length,t=r[0].length,i=[],n=[],a=0,o=0;o<t;++o){for(var s=0,l=0;l<e;++l)s+=r[l][o][1];s>a&&(a=s),i.push(s)}for(var u=0;u<t;++u)n[u]=(a-i[u])/2;a=0;for(var c=0;c<t;++c){var f=i[c]+n[c];f>a&&(a=f)}return{y0:n,max:a}}function vU(r){r.registerChartView(Gq),r.registerSeriesModel(Hq),r.registerLayout(mU),r.registerProcessor(tl("themeRiver"))}var B_e=2,k_e=4,V_e=function(r){Z(e,r);function e(t,i,n,a){var o=r.call(this)||this;o.z2=B_e,o.textConfig={inside:!0},rt(o).seriesIndex=i.seriesIndex;var s=new Lt({z2:k_e,silent:t.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,t,i,n,a),o}return e.prototype.updateData=function(t,i,n,a,o){this.node=i,i.piece=this,n=n||this._seriesModel,a=a||this._ecModel;var s=this;rt(s).dataIndex=i.dataIndex;var l=i.getModel(),u=l.getModel("emphasis"),c=i.getLayout(),f=fe({},c);f.label=null;var h=i.getVisual("style");h.lineJoin="bevel";var p=i.getVisual("decal");p&&(h.decal=Zs(p,o));var d=Zl(l.getModel("itemStyle"),f,!0);fe(f,d),N(Bi,function(_){var y=s.ensureState(_),x=l.getModel([_,"itemStyle"]);y.style=x.getItemStyle();var M=Zl(x,f);M&&(y.shape=M)}),t?(s.setShape(f),s.shape.r=c.r0,ar(s,{shape:{r:c.r}},n,i.dataIndex)):(Dt(s,{shape:f},n),Ii(s)),s.useStyle(h),this._updateLabel(n);var g=l.getShallow("cursor");g&&s.attr("cursor",g),this._seriesModel=n||this._seriesModel,this._ecModel=a||this._ecModel;var m=u.get("focus"),v=m==="ancestor"?i.getAncestorsIndices():m==="descendant"?i.getDescendantIndices():m;nr(this,v,u.get("blurScope"),u.get("disabled"))},e.prototype._updateLabel=function(t){var i=this,n=this.node.getModel(),a=n.getModel("label"),o=this.node.getLayout(),s=o.endAngle-o.startAngle,l=(o.startAngle+o.endAngle)/2,u=Math.cos(l),c=Math.sin(l),f=this,h=f.getTextContent(),p=this.node.dataIndex,d=a.get("minAngle")/180*Math.PI,g=a.get("show")&&!(d!=null&&Math.abs(s)<d);h.ignore=!g,N(bf,function(v){var _=v==="normal"?n.getModel("label"):n.getModel([v,"label"]),y=v==="normal",x=y?h:h.ensureState(v),M=t.getFormattedLabel(p,v);y&&(M=M||i.node.name),x.style=fr(_,{},null,v!=="normal",!0),M&&(x.style.text=M);var S=_.get("show");S!=null&&!y&&(x.ignore=!S);var w=m(_,"position"),T=y?f:f.states[v],C=T.style.fill;T.textConfig={outsideFill:_.get("color")==="inherit"?C:null,inside:w!=="outside"};var b,E=m(_,"distance")||0,I=m(_,"align"),R=m(_,"rotate"),A=Math.PI*.5,D=Math.PI*1.5,U=bn(R==="tangential"?Math.PI/2-l:l),B=U>A&&!Su(U-A)&&U<D;w==="outside"?(b=o.r+E,I=B?"right":"left"):!I||I==="center"?(s===2*Math.PI&&o.r0===0?b=0:b=(o.r+o.r0)/2,I="center"):I==="left"?(b=o.r0+E,I=B?"right":"left"):I==="right"&&(b=o.r-E,I=B?"left":"right"),x.style.align=I,x.style.verticalAlign=m(_,"verticalAlign")||"middle",x.x=b*u+o.cx,x.y=b*c+o.cy;var F=0;R==="radial"?F=bn(-l)+(B?Math.PI:0):R==="tangential"?F=bn(Math.PI/2-l)+(B?Math.PI:0):At(R)&&(F=R*Math.PI/180),x.rotation=bn(F)});function m(v,_){var y=v.get(_);return y??a.get(_)}h.dirtyStyle()},e}(yi),gU=V_e;var kT="sunburstRootToNode",Xq="sunburstHighlight",G_e="sunburstUnhighlight";function Yq(r){r.registerAction({type:kT,update:"updateView"},function(e,t){t.eachComponent({mainType:"series",subType:"sunburst",query:e},i);function i(n,a){var o=Gu(e,[kT],n);if(o){var s=n.getViewRoot();s&&(e.direction=Pv(s,o.node)?"rollUp":"drillDown"),n.resetViewRoot(o.node)}}}),r.registerAction({type:Xq,update:"none"},function(e,t,i){e=fe({},e),t.eachComponent({mainType:"series",subType:"sunburst",query:e},n);function n(a){var o=Gu(e,[Xq],a);o&&(e.dataIndex=o.node.dataIndex)}i.dispatchAction(fe(e,{type:"highlight"}))}),r.registerAction({type:G_e,update:"updateView"},function(e,t,i){e=fe({},e),i.dispatchAction(fe(e,{type:"downplay"}))})}var H_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){var o=this;this.seriesModel=t,this.api=n,this.ecModel=i;var s=t.getData(),l=s.tree.root,u=t.getViewRoot(),c=this.group,f=t.get("renderLabelForZeroData"),h=[];u.eachNode(function(_){h.push(_)});var p=this._oldChildren||[];d(h,p),v(l,u),this._initEvents(),this._oldChildren=h;function d(_,y){if(_.length===0&&y.length===0)return;new An(y,_,x,x).add(M).update(M).remove(ot(M,null)).execute();function x(S){return S.getId()}function M(S,w){var T=S==null?null:_[S],C=w==null?null:y[w];g(T,C)}}function g(_,y){if(!f&&_&&!_.getValue()&&(_=null),_!==l&&y!==l){if(y&&y.piece)_?(y.piece.updateData(!1,_,t,i,n),s.setItemGraphicEl(_.dataIndex,y.piece)):m(y);else if(_){var x=new gU(_,t,i,n);c.add(x),s.setItemGraphicEl(_.dataIndex,x)}}}function m(_){_&&_.piece&&(c.remove(_.piece),_.piece=null)}function v(_,y){y.depth>0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,t,i,n):(o.virtualPiece=new gU(_,t,i,n),c.add(o.virtualPiece)),y.piece.off("click"),o.virtualPiece.on("click",function(x){o._rootToNode(y.parentNode)})):o.virtualPiece&&(c.remove(o.virtualPiece),o.virtualPiece=null)}},e.prototype._initEvents=function(){var t=this;this.group.off("click"),this.group.on("click",function(i){var n=!1,a=t.seriesModel.getViewRoot();a.eachNode(function(o){if(!n&&o.piece&&o.piece===i.target){var s=o.getModel().get("nodeClick");if(s==="rootToNode")t._rootToNode(o);else if(s==="link"){var l=o.getModel(),u=l.get("link");if(u){var c=l.get("target",!0)||"_blank";kp(u,c)}}n=!0}})})},e.prototype._rootToNode=function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:kT,from:this.uid,seriesId:this.seriesModel.id,targetNode:t})},e.prototype.containPoint=function(t,i){var n=i.getData(),a=n.getItemLayout(0);if(a){var o=t[0]-a.cx,s=t[1]-a.cy,l=Math.sqrt(o*o+s*s);return l<=a.r&&l>=a.r0}},e.type="sunburst",e}(Yt),qq=H_e;var W_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.ignoreStyleOnData=!0,t}return e.prototype.getInitialData=function(t,i){var n={name:t.name,children:t.data};Zq(n);var a=this._levelModels=de(t.levels||[],function(l){return new Zt(l,this,i)},this),o=Lv.createTree(n,this,s);function s(l){l.wrapMethod("getItemModel",function(u,c){var f=o.getNodeByDataIndex(c),h=a[f.depth];return h&&(u.parentModel=h),u})}return o.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.getDataParams=function(t){var i=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return i.treePathInfo=Yf(n,this),i},e.prototype.getLevelModel=function(t){return this._levelModels&&this._levelModels[t.depth]},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var i=this.getRawData().tree.root;(!t||t!==i&&!i.contains(t))&&(this._viewRoot=i)},e.prototype.enableAriaDecal=function(){Sx(this)},e.type="series.sunburst",e.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"},e}(jt);function Zq(r){var e=0;N(r.children,function(i){Zq(i);var n=i.value;pe(n)&&(n=n[0]),e+=n});var t=r.value;pe(t)&&(t=t[0]),(t==null||isNaN(t))&&(t=e),t<0&&(t=0),pe(r.value)?r.value[0]=t:r.value=t}var jq=W_e;var Kq=Math.PI/180;function yU(r,e,t){e.eachSeriesByType(r,function(i){var n=i.get("center"),a=i.get("radius");pe(a)||(a=[0,a]),pe(n)||(n=[n,n]);var o=t.getWidth(),s=t.getHeight(),l=Math.min(o,s),u=Fe(n[0],o),c=Fe(n[1],s),f=Fe(a[0],l/2),h=Fe(a[1],l/2),p=-i.get("startAngle")*Kq,d=i.get("minAngle")*Kq,g=i.getData().tree.root,m=i.getViewRoot(),v=m.depth,_=i.get("sort");_!=null&&Jq(m,_);var y=0;N(m.children,function(U){!isNaN(U.getValue())&&y++});var x=m.getValue(),M=Math.PI/(x||y)*2,S=m.depth>0,w=m.height-(S?-1:1),T=(h-f)/(w||1),C=i.get("clockwise"),b=i.get("stillShowZeroSum"),E=C?1:-1,I=function(U,B){if(U){var F=B;if(U!==g){var k=U.getValue(),G=x===0&&b?M:k*M;G<d&&(G=d),F=B+E*G;var Y=U.depth-v-(S?-1:1),J=f+T*Y,Q=f+T*(Y+1),V=i.getLevelModel(U);if(V){var K=V.get("r0",!0),ae=V.get("r",!0),ve=V.get("radius",!0);ve!=null&&(K=ve[0],ae=ve[1]),K!=null&&(J=Fe(K,l/2)),ae!=null&&(Q=Fe(ae,l/2))}U.setLayout({angle:G,startAngle:B,endAngle:F,clockwise:C,cx:u,cy:c,r0:J,r:Q})}if(U.children&&U.children.length){var ue=0;N(U.children,function(se){ue+=I(se,B+ue)})}return F-B}};if(S){var R=f,A=f+T,D=Math.PI*2;g.setLayout({angle:D,startAngle:p,endAngle:p+D,clockwise:C,cx:u,cy:c,r0:R,r:A})}I(m,p)})}function Jq(r,e){var t=r.children||[];r.children=X_e(t,e),t.length&&N(r.children,function(i){Jq(i,e)})}function X_e(r,e){if(He(e)){var t=de(r,function(n,a){var o=n.getValue();return{params:{depth:n.depth,height:n.height,dataIndex:n.dataIndex,getValue:function(){return o}},index:a}});return t.sort(function(n,a){return e(n.params,a.params)}),de(t,function(n){return r[n.index]})}else{var i=e==="asc";return r.sort(function(n,a){var o=(n.getValue()-a.getValue())*(i?1:-1);return o===0?(n.dataIndex-a.dataIndex)*(i?-1:1):o})}}function _U(r){var e={};function t(i,n,a){for(var o=i;o&&o.depth>1;)o=o.parentNode;var s=n.getColorFromPalette(o.name||o.dataIndex+"",e);return i.depth>1&&Ce(s)&&(s=Sb(s,(i.depth-1)/(a-1)*.5)),s}r.eachSeriesByType("sunburst",function(i){var n=i.getData(),a=n.tree;a.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=t(o,i,a.root.height));var u=n.ensureUniqueItemVisual(o.dataIndex,"style");fe(u,l)})})}function xU(r){r.registerChartView(qq),r.registerSeriesModel(jq),r.registerLayout(ot(yU,"sunburst")),r.registerProcessor(ot(tl,"sunburst")),r.registerVisual(_U),Yq(r)}var SU={color:"fill",borderColor:"stroke"},$q={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},Jl=vt(),Y_e=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},e.prototype.getInitialData=function(t,i){return hn(null,this)},e.prototype.getDataParams=function(t,i,n){var a=r.prototype.getDataParams.call(this,t,i);return n&&(a.info=Jl(n).info),a},e.type="series.custom",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,clip:!1},e}(jt),Qq=Y_e;function q_e(r,e){return e=e||[0,0],de(["x","y"],function(t,i){var n=this.getAxis(t),a=e[i],o=r[i]/2;return n.type==="category"?n.getBandWidth():Math.abs(n.dataToCoord(a-o)-n.dataToCoord(a+o))},this)}function MU(r){var e=r.master.getRect();return{coordSys:{type:"cartesian2d",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:function(t){return r.dataToPoint(t)},size:Be(q_e,r)}}}function Z_e(r,e){return e=e||[0,0],de([0,1],function(t){var i=e[t],n=r[t]/2,a=[],o=[];return a[t]=i-n,o[t]=i+n,a[1-t]=o[1-t]=e[1-t],Math.abs(this.dataToPoint(a)[t]-this.dataToPoint(o)[t])},this)}function bU(r){var e=r.getBoundingRect();return{coordSys:{type:"geo",x:e.x,y:e.y,width:e.width,height:e.height,zoom:r.getZoom()},api:{coord:function(t){return r.dataToPoint(t)},size:Be(Z_e,r)}}}function j_e(r,e){var t=this.getAxis(),i=e instanceof Array?e[0]:e,n=(r instanceof Array?r[0]:r)/2;return t.type==="category"?t.getBandWidth():Math.abs(t.dataToCoord(i-n)-t.dataToCoord(i+n))}function wU(r){var e=r.getRect();return{coordSys:{type:"singleAxis",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:function(t){return r.dataToPoint(t)},size:Be(j_e,r)}}}function K_e(r,e){return e=e||[0,0],de(["Radius","Angle"],function(t,i){var n="get"+t+"Axis",a=this[n](),o=e[i],s=r[i]/2,l=a.type==="category"?a.getBandWidth():Math.abs(a.dataToCoord(o-s)-a.dataToCoord(o+s));return t==="Angle"&&(l=l*Math.PI/180),l},this)}function TU(r){var e=r.getRadiusAxis(),t=r.getAngleAxis(),i=e.getExtent();return i[0]>i[1]&&i.reverse(),{coordSys:{type:"polar",cx:r.cx,cy:r.cy,r:i[1],r0:i[0]},api:{coord:function(n){var a=e.dataToRadius(n[0]),o=t.dataToAngle(n[1]),s=r.coordToPoint([a,o]);return s.push(a,o*Math.PI/180),s},size:Be(K_e,r)}}}function EU(r){var e=r.getRect(),t=r.getRangeInfo();return{coordSys:{type:"calendar",x:e.x,y:e.y,width:e.width,height:e.height,cellWidth:r.getCellWidth(),cellHeight:r.getCellHeight(),rangeInfo:{start:t.start,end:t.end,weeks:t.weeks,dayCount:t.allDay}},api:{coord:function(i,n){return r.dataToPoint(i,n)}}}}function VT(r,e,t,i){return r&&(r.legacy||r.legacy!==!1&&!t&&!i&&e!=="tspan"&&(e==="text"||tt(r,"text")))}function GT(r,e,t){var i=r,n,a,o;if(e==="text")o=i;else{o={},tt(i,"text")&&(o.text=i.text),tt(i,"rich")&&(o.rich=i.rich),tt(i,"textFill")&&(o.fill=i.textFill),tt(i,"textStroke")&&(o.stroke=i.textStroke),tt(i,"fontFamily")&&(o.fontFamily=i.fontFamily),tt(i,"fontSize")&&(o.fontSize=i.fontSize),tt(i,"fontStyle")&&(o.fontStyle=i.fontStyle),tt(i,"fontWeight")&&(o.fontWeight=i.fontWeight),a={type:"text",style:o,silent:!0},n={};var s=tt(i,"textPosition");t?n.position=s?i.textPosition:"inside":s&&(n.position=i.textPosition),tt(i,"textPosition")&&(n.position=i.textPosition),tt(i,"textOffset")&&(n.offset=i.textOffset),tt(i,"textRotation")&&(n.rotation=i.textRotation),tt(i,"textDistance")&&(n.distance=i.textDistance)}return eZ(o,r),N(o.rich,function(l){eZ(l,l)}),{textConfig:n,textContent:a}}function eZ(r,e){e&&(e.font=e.textFont||e.font,tt(e,"textStrokeWidth")&&(r.lineWidth=e.textStrokeWidth),tt(e,"textAlign")&&(r.align=e.textAlign),tt(e,"textVerticalAlign")&&(r.verticalAlign=e.textVerticalAlign),tt(e,"textLineHeight")&&(r.lineHeight=e.textLineHeight),tt(e,"textWidth")&&(r.width=e.textWidth),tt(e,"textHeight")&&(r.height=e.textHeight),tt(e,"textBackgroundColor")&&(r.backgroundColor=e.textBackgroundColor),tt(e,"textPadding")&&(r.padding=e.textPadding),tt(e,"textBorderColor")&&(r.borderColor=e.textBorderColor),tt(e,"textBorderWidth")&&(r.borderWidth=e.textBorderWidth),tt(e,"textBorderRadius")&&(r.borderRadius=e.textBorderRadius),tt(e,"textBoxShadowColor")&&(r.shadowColor=e.textBoxShadowColor),tt(e,"textBoxShadowBlur")&&(r.shadowBlur=e.textBoxShadowBlur),tt(e,"textBoxShadowOffsetX")&&(r.shadowOffsetX=e.textBoxShadowOffsetX),tt(e,"textBoxShadowOffsetY")&&(r.shadowOffsetY=e.textBoxShadowOffsetY))}function AU(r,e,t){var i=r;i.textPosition=i.textPosition||t.position||"inside",t.offset!=null&&(i.textOffset=t.offset),t.rotation!=null&&(i.textRotation=t.rotation),t.distance!=null&&(i.textDistance=t.distance);var n=i.textPosition.indexOf("inside")>=0,a=r.fill||"#000";tZ(i,e);var o=i.textFill==null;return n?o&&(i.textFill=t.insideFill||"#fff",!i.textStroke&&t.insideStroke&&(i.textStroke=t.insideStroke),!i.textStroke&&(i.textStroke=a),i.textStrokeWidth==null&&(i.textStrokeWidth=2)):(o&&(i.textFill=r.fill||t.outsideFill||"#000"),!i.textStroke&&t.outsideStroke&&(i.textStroke=t.outsideStroke)),i.text=e.text,i.rich=e.rich,N(e.rich,function(s){tZ(s,s)}),i}function tZ(r,e){e&&(tt(e,"fill")&&(r.textFill=e.fill),tt(e,"stroke")&&(r.textStroke=e.fill),tt(e,"lineWidth")&&(r.textStrokeWidth=e.lineWidth),tt(e,"font")&&(r.font=e.font),tt(e,"fontStyle")&&(r.fontStyle=e.fontStyle),tt(e,"fontWeight")&&(r.fontWeight=e.fontWeight),tt(e,"fontSize")&&(r.fontSize=e.fontSize),tt(e,"fontFamily")&&(r.fontFamily=e.fontFamily),tt(e,"align")&&(r.textAlign=e.align),tt(e,"verticalAlign")&&(r.textVerticalAlign=e.verticalAlign),tt(e,"lineHeight")&&(r.textLineHeight=e.lineHeight),tt(e,"width")&&(r.textWidth=e.width),tt(e,"height")&&(r.textHeight=e.height),tt(e,"backgroundColor")&&(r.textBackgroundColor=e.backgroundColor),tt(e,"padding")&&(r.textPadding=e.padding),tt(e,"borderColor")&&(r.textBorderColor=e.borderColor),tt(e,"borderWidth")&&(r.textBorderWidth=e.borderWidth),tt(e,"borderRadius")&&(r.textBorderRadius=e.borderRadius),tt(e,"shadowColor")&&(r.textBoxShadowColor=e.shadowColor),tt(e,"shadowBlur")&&(r.textBoxShadowBlur=e.shadowBlur),tt(e,"shadowOffsetX")&&(r.textBoxShadowOffsetX=e.shadowOffsetX),tt(e,"shadowOffsetY")&&(r.textBoxShadowOffsetY=e.shadowOffsetY),tt(e,"textShadowColor")&&(r.textShadowColor=e.textShadowColor),tt(e,"textShadowBlur")&&(r.textShadowBlur=e.textShadowBlur),tt(e,"textShadowOffsetX")&&(r.textShadowOffsetX=e.textShadowOffsetX),tt(e,"textShadowOffsetY")&&(r.textShadowOffsetY=e.textShadowOffsetY))}var aZ={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},rZ=bt(aZ),_st=gn(go,function(r,e){return r[e]=1,r},{}),xst=go.join(", "),Ux=["","style","shape","extra"],Wv=vt();function CU(r,e,t,i,n){var a=r+"Animation",o=Bl(r,i,n)||{},s=Wv(e).userDuring;return o.duration>0&&(o.during=s?Be(txe,{el:e,userDuring:s}):null,o.setToFinal=!0,o.scope=r),fe(o,t[a]),o}function Xv(r,e,t,i){i=i||{};var n=i.dataIndex,a=i.isInit,o=i.clearStyle,s=t.isAnimationEnabled(),l=Wv(r),u=e.style;l.userDuring=e.during;var c={},f={};if(ixe(r,e,f),nZ("shape",e,f),nZ("extra",e,f),!a&&s&&(rxe(r,e,c),iZ("shape",r,e,c),iZ("extra",r,e,c),nxe(r,e,u,c)),f.style=u,J_e(r,f,o),Q_e(r,e),s)if(a){var h={};N(Ux,function(d){var g=d?e[d]:e;g&&g.enterFrom&&(d&&(h[d]=h[d]||{}),fe(d?h[d]:h,g.enterFrom))});var p=CU("enter",r,e,t,n);p.duration>0&&r.animateFrom(h,p)}else $_e(r,e,n||0,t,c);RU(r,e),u?r.dirty():r.markRedraw()}function RU(r,e){for(var t=Wv(r).leaveToProps,i=0;i<Ux.length;i++){var n=Ux[i],a=n?e[n]:e;a&&a.leaveTo&&(t||(t=Wv(r).leaveToProps={}),n&&(t[n]=t[n]||{}),fe(n?t[n]:t,a.leaveTo))}}function Yv(r,e,t,i){if(r){var n=r.parent,a=Wv(r).leaveToProps;if(a){var o=CU("update",r,e,t,0);o.done=function(){n.remove(r),i&&i()},r.animateTo(a,o)}else n.remove(r),i&&i()}}function jf(r){return r==="all"}function J_e(r,e,t){var i=e.style;if(!r.isGroup&&i){if(t){r.useStyle({});for(var n=r.animators,a=0;a<n.length;a++){var o=n[a];o.targetName==="style"&&o.changeTarget(r.style)}}r.setStyle(i)}e&&(e.style=null,e&&r.attr(e),e.style=i)}function $_e(r,e,t,i,n){if(n){var a=CU("update",r,e,i,t);a.duration>0&&r.animateFrom(n,a)}}function Q_e(r,e){tt(e,"silent")&&(r.silent=e.silent),tt(e,"ignore")&&(r.ignore=e.ignore),r instanceof gi&&tt(e,"invisible")&&(r.invisible=e.invisible),r instanceof ut&&tt(e,"autoBatch")&&(r.autoBatch=e.autoBatch)}var $l={},exe={setTransform:function(r,e){return $l.el[r]=e,this},getTransform:function(r){return $l.el[r]},setShape:function(r,e){var t=$l.el,i=t.shape||(t.shape={});return i[r]=e,t.dirtyShape&&t.dirtyShape(),this},getShape:function(r){var e=$l.el.shape;if(e)return e[r]},setStyle:function(r,e){var t=$l.el,i=t.style;return i&&(i[r]=e,t.dirtyStyle&&t.dirtyStyle()),this},getStyle:function(r){var e=$l.el.style;if(e)return e[r]},setExtra:function(r,e){var t=$l.el.extra||($l.el.extra={});return t[r]=e,this},getExtra:function(r){var e=$l.el.extra;if(e)return e[r]}};function txe(){var r=this,e=r.el;if(e){var t=Wv(e).userDuring,i=r.userDuring;if(t!==i){r.el=r.userDuring=null;return}$l.el=e,i(exe)}}function iZ(r,e,t,i){var n=t[r];if(n){var a=e[r],o;if(a){var s=t.transition,l=n.transition;if(l)if(!o&&(o=i[r]={}),jf(l))fe(o,a);else for(var u=Jt(l),c=0;c<u.length;c++){var f=u[c],h=a[f];o[f]=h}else if(jf(s)||dt(s,r)>=0){!o&&(o=i[r]={});for(var p=bt(a),c=0;c<p.length;c++){var f=p[c],h=a[f];axe(n[f],h)&&(o[f]=h)}}}}}function nZ(r,e,t){var i=e[r];if(i)for(var n=t[r]={},a=bt(i),o=0;o<a.length;o++){var s=a[o];n[s]=fp(i[s])}}function rxe(r,e,t){for(var i=e.transition,n=jf(i)?go:Jt(i||[]),a=0;a<n.length;a++){var o=n[a];if(!(o==="style"||o==="shape"||o==="extra")){var s=r[o];t[o]=s}}}function ixe(r,e,t){for(var i=0;i<rZ.length;i++){var n=rZ[i],a=aZ[n],o=e[n];o&&(t[a[0]]=o[0],t[a[1]]=o[1])}for(var i=0;i<go.length;i++){var s=go[i];e[s]!=null&&(t[s]=e[s])}}function nxe(r,e,t,i){if(t){var n=r.style,a;if(n){var o=t.transition,s=e.transition;if(o&&!jf(o)){var l=Jt(o);!a&&(a=i.style={});for(var u=0;u<l.length;u++){var c=l[u],f=n[c];a[c]=f}}else if(r.getAnimationStyleProps&&(jf(s)||jf(o)||dt(s,"style")>=0)){var h=r.getAnimationStyleProps(),p=h?h.style:null;if(p){!a&&(a=i.style={});for(var d=bt(t),u=0;u<d.length;u++){var c=d[u];if(p[c]){var f=n[c];a[c]=f}}}}}}}function axe(r,e){return ci(r)?r!==e:r!=null&&isFinite(r)}var oZ=vt(),oxe=["percent","easing","shape","style","extra"];function HT(r){r.stopAnimation("keyframe"),r.attr(oZ(r))}function qv(r,e,t){if(!(!t.isAnimationEnabled()||!e)){if(pe(e)){N(e,function(s){qv(r,s,t)});return}var i=e.keyframes,n=e.duration;if(t&&n==null){var a=Bl("enter",t,0);n=a&&a.duration}if(!(!i||!n)){var o=oZ(r);N(Ux,function(s){if(!(s&&!r[s])){var l,u=!1;i.sort(function(c,f){return c.percent-f.percent}),N(i,function(c){var f=r.animators,h=s?c[s]:c;if(h){var p=bt(h);if(s||(p=Wt(p,function(m){return dt(oxe,m)<0})),!!p.length){l||(l=r.animate(s,e.loop,!0),l.scope="keyframe");for(var d=0;d<f.length;d++)f[d]!==l&&f[d].targetName===l.targetName&&f[d].stopTracks(p);s&&(o[s]=o[s]||{});var g=s?o[s]:o;N(p,function(m){g[m]=((s?r[s]:r)||{})[m]}),l.whenWithKeys(n*c.percent,h,p,c.easing)}}}),l&&l.delay(e.delay||0).duration(n).start(e.easing)}})}}}var Wu="emphasis",Kf="normal",UU="blur",OU="select",Jf=[Kf,Wu,UU,OU],LU={normal:["itemStyle"],emphasis:[Wu,"itemStyle"],blur:[UU,"itemStyle"],select:[OU,"itemStyle"]},PU={normal:["label"],emphasis:[Wu,"label"],blur:[UU,"label"],select:[OU,"label"]},sxe=["x","y"],lxe="e\0\0",hs={normal:{},emphasis:{},blur:{},select:{}},uxe={cartesian2d:MU,geo:bU,single:wU,polar:TU,calendar:EU};function IU(r){return r instanceof ut}function NU(r){return r instanceof gi}function cxe(r,e){e.copyTransform(r),NU(e)&&NU(r)&&(e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel,e.invisible=r.invisible,e.ignore=r.ignore,IU(e)&&IU(r)&&e.setShape(r.shape))}var fxe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){this._progressiveEls=null;var o=this._data,s=t.getData(),l=this.group,u=sZ(t,s,i,n);o||l.removeAll(),s.diff(o).add(function(f){DU(n,null,f,u(f,a),t,l,s)}).remove(function(f){var h=o.getItemGraphicEl(f);h&&Yv(h,Jl(h).option,t)}).update(function(f,h){var p=o.getItemGraphicEl(h);DU(n,p,f,u(f,a),t,l,s)}).execute();var c=t.get("clip",!0)?ql(t.coordinateSystem,!1,t):null;c?l.setClipPath(c):l.removeClipPath(),this._data=s},e.prototype.incrementalPrepareRender=function(t,i,n){this.group.removeAll(),this._data=null},e.prototype.incrementalRender=function(t,i,n,a,o){var s=i.getData(),l=sZ(i,s,n,a),u=this._progressiveEls=[];function c(p){p.isGroup||(p.incremental=!0,p.ensureState("emphasis").hoverLayer=!0)}for(var f=t.start;f<t.end;f++){var h=DU(null,null,f,l(f,o),i,this.group,s);h&&(h.traverse(c),u.push(h))}},e.prototype.eachRendered=function(t){sa(this._progressiveEls||this.group,t)},e.prototype.filterForExposedEvent=function(t,i,n,a){var o=i.element;if(o==null||n.name===o)return!0;for(;(n=n.__hostTarget||n.parent)&&n!==this.group;)if(n.name===o)return!0;return!1},e.type="custom",e}(Yt),fZ=fxe;function FU(r){var e=r.type,t;if(e==="path"){var i=r.shape,n=i.width!=null&&i.height!=null?{x:i.x||0,y:i.y||0,width:i.width,height:i.height}:null,a=dZ(i);t=tv(a,null,n,i.layout||"center"),Jl(t).customPathData=a}else if(e==="image")t=new Ur({}),Jl(t).customImagePath=r.style.image;else if(e==="text")t=new Lt({});else if(e==="group")t=new Ze;else{if(e==="compoundPath")throw new Error('"compoundPath" is not supported yet.');var o=x_(e);if(!o){var s="";ur(s)}t=new o}return Jl(t).customGraphicType=e,t.name=r.name,t.z2EmphasisLift=1,t.z2SelectLift=1,t}function zU(r,e,t,i,n,a,o){HT(e);var s=n&&n.normal.cfg;s&&e.setTextConfig(s),i&&i.transition==null&&(i.transition=sxe);var l=i&&i.style;if(l){if(e.type==="text"){var u=l;tt(u,"textFill")&&(u.fill=u.textFill),tt(u,"textStroke")&&(u.stroke=u.textStroke)}var c=void 0,f=IU(e)?l.decal:null;r&&f&&(f.dirty=!0,c=Zs(f,r)),l.__decalPattern=c}if(NU(e)&&l){var c=l.__decalPattern;c&&(l.decal=c)}Xv(e,i,a,{dataIndex:t,isInit:o,clearStyle:!0}),qv(e,i.keyframeAnimation,a)}function hZ(r,e,t,i,n){var a=e.isGroup?null:e,o=n&&n[r].cfg;if(a){var s=a.ensureState(r);if(i===!1){var l=a.getState(r);l&&(l.style=null)}else s.style=i||null;o&&(s.textConfig=o),Fs(a)}}function hxe(r,e,t){if(!r.isGroup){var i=r,n=t.currentZ,a=t.currentZLevel;i.z=n,i.zlevel=a;var o=e.z2;o!=null&&(i.z2=o||0);for(var s=0;s<Jf.length;s++)pxe(i,e,Jf[s])}}function pxe(r,e,t){var i=t===Kf,n=i?e:WT(e,t),a=n?n.z2:null,o;a!=null&&(o=i?r:r.ensureState(t),o.z2=a||0)}function sZ(r,e,t,i){var n=r.get("renderItem"),a=r.coordinateSystem,o={};a&&(o=a.prepareCustoms?a.prepareCustoms(a):uxe[a.type](a));for(var s=Ye({getWidth:i.getWidth,getHeight:i.getHeight,getZr:i.getZr,getDevicePixelRatio:i.getDevicePixelRatio,value:x,style:S,ordinalRawValue:M,styleEmphasis:w,visual:b,barLayout:E,currentSeriesIndices:I,font:R},o.api||{}),l={context:{},seriesId:r.id,seriesName:r.name,seriesIndex:r.seriesIndex,coordSys:o.coordSys,dataInsideLength:e.count(),encode:dxe(r.getData())},u,c,f={},h={},p={},d={},g=0;g<Jf.length;g++){var m=Jf[g];p[m]=r.getModel(LU[m]),d[m]=r.getModel(PU[m])}function v(A){return A===u?c||(c=e.getItemModel(A)):e.getItemModel(A)}function _(A,D){return e.hasItemOption?A===u?f[D]||(f[D]=v(A).getModel(LU[D])):v(A).getModel(LU[D]):p[D]}function y(A,D){return e.hasItemOption?A===u?h[D]||(h[D]=v(A).getModel(PU[D])):v(A).getModel(PU[D]):d[D]}return function(A,D){return u=A,c=null,f={},h={},n&&n(Ye({dataIndexInside:A,dataIndex:e.getRawIndex(A),actionType:D?D.type:null},l),s)};function x(A,D){return D==null&&(D=u),e.getStore().get(e.getDimensionIndex(A||0),D)}function M(A,D){D==null&&(D=u),A=A||0;var U=e.getDimensionInfo(A);if(!U){var B=e.getDimensionIndex(A);return B>=0?e.getStore().get(B,D):void 0}var F=e.get(U.name,D),k=U&&U.ordinalMeta;return k?k.categories[F]:F}function S(A,D){D==null&&(D=u);var U=e.getItemVisual(D,"style"),B=U&&U.fill,F=U&&U.opacity,k=_(D,Kf).getItemStyle();B!=null&&(k.fill=B),F!=null&&(k.opacity=F);var G={inheritColor:Ce(B)?B:"#000"},Y=y(D,Kf),J=fr(Y,null,G,!1,!0);J.text=Y.getShallow("show")?ft(r.getFormattedLabel(D,Kf),Qs(e,D)):null;var Q=M_(Y,G,!1);return C(A,k),k=AU(k,J,Q),A&&T(k,A),k.legacy=!0,k}function w(A,D){D==null&&(D=u);var U=_(D,Wu).getItemStyle(),B=y(D,Wu),F=fr(B,null,null,!0,!0);F.text=B.getShallow("show")?Xi(r.getFormattedLabel(D,Wu),r.getFormattedLabel(D,Kf),Qs(e,D)):null;var k=M_(B,null,!0);return C(A,U),U=AU(U,F,k),A&&T(U,A),U.legacy=!0,U}function T(A,D){for(var U in D)tt(D,U)&&(A[U]=D[U])}function C(A,D){A&&(A.textFill&&(D.textFill=A.textFill),A.textPosition&&(D.textPosition=A.textPosition))}function b(A,D){if(D==null&&(D=u),tt(SU,A)){var U=e.getItemVisual(D,"style");return U?U[SU[A]]:null}if(tt($q,A))return e.getItemVisual(D,A)}function E(A){if(a.type==="cartesian2d"){var D=a.getBaseAxis();return K6(Ye({axis:D},A))}}function I(){return t.getCurrentSeriesIndices()}function R(A){return iv(A,t)}}function dxe(r){var e={};return N(r.dimensions,function(t){var i=r.getDimensionInfo(t);if(!i.isExtraCoord){var n=i.coordDim,a=e[n]=e[n]||[];a[i.coordDimIndex]=r.getDimensionIndex(t)}}),e}function DU(r,e,t,i,n,a,o){if(!i){a.remove(e);return}var s=BU(r,e,t,i,n,a);return s&&o.setItemGraphicEl(t,s),s&&nr(s,i.focus,i.blurScope,i.emphasisDisabled),s}function BU(r,e,t,i,n,a){var o=-1,s=e;e&&pZ(e,i,n)&&(o=dt(a.childrenRef(),e),e=null);var l=!e,u=e;u?u.clearStates():(u=FU(i),s&&cxe(s,u)),i.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),hs.normal.cfg=hs.normal.conOpt=hs.emphasis.cfg=hs.emphasis.conOpt=hs.blur.cfg=hs.blur.conOpt=hs.select.cfg=hs.select.conOpt=null,hs.isLegacy=!1,vxe(u,t,i,n,l,hs),mxe(u,t,i,n,l),zU(r,u,t,i,hs,n,l),tt(i,"info")&&(Jl(u).info=i.info);for(var c=0;c<Jf.length;c++){var f=Jf[c];if(f!==Kf){var h=WT(i,f),p=kU(i,h,f);hZ(f,u,h,p,hs)}}return hxe(u,i,n),i.type==="group"&&gxe(r,u,t,i,n),o>=0?a.replaceAt(u,o):a.add(u),u}function pZ(r,e,t){var i=Jl(r),n=e.type,a=e.shape,o=e.style;return t.isUniversalTransitionEnabled()||n!=null&&n!==i.customGraphicType||n==="path"&&Sxe(a)&&dZ(a)!==i.customPathData||n==="image"&&tt(o,"image")&&o.image!==i.customImagePath}function mxe(r,e,t,i,n){var a=t.clipPath;if(a===!1)r&&r.getClipPath()&&r.removeClipPath();else if(a){var o=r.getClipPath();o&&pZ(o,a,i)&&(o=null),o||(o=FU(a),r.setClipPath(o)),zU(null,o,e,a,null,i,n)}}function vxe(r,e,t,i,n,a){if(!r.isGroup){lZ(t,null,a),lZ(t,Wu,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,l=a.blur.conOpt,u=a.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=r.getTextContent();if(o===!1)c&&r.removeTextContent();else{o=a.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=FU(o),r.setTextContent(c)),zU(null,c,e,o,null,i,n);for(var f=o&&o.style,h=0;h<Jf.length;h++){var p=Jf[h];if(p!==Kf){var d=a[p].conOpt;hZ(p,c,d,kU(o,d,p),null)}}f?c.dirty():c.markRedraw()}}}}function lZ(r,e,t){var i=e?WT(r,e):r,n=e?kU(r,i,Wu):r.style,a=r.type,o=i?i.textConfig:null,s=r.textContent,l=s?e?WT(s,e):s:null;if(n&&(t.isLegacy||VT(n,a,!!o,!!l))){t.isLegacy=!0;var u=GT(n,a,!e);!o&&u.textConfig&&(o=u.textConfig),!l&&u.textContent&&(l=u.textContent)}if(!e&&l){var c=l;!c.type&&(c.type="text")}var f=e?t[e]:t.normal;f.cfg=o,f.conOpt=l}function WT(r,e){return e?r?r[e]:null:r}function kU(r,e,t){var i=e&&e.style;return i==null&&t===Wu&&r&&(i=r.styleEmphasis),i}function gxe(r,e,t,i,n){var a=i.children,o=a?a.length:0,s=i.$mergeChildren,l=s==="byName"||i.diffChildrenByName,u=s===!1;if(!(!o&&!l&&!u)){if(l){_xe({api:r,oldChildren:e.children()||[],newChildren:a||[],dataIndex:t,seriesModel:n,group:e});return}u&&e.removeAll();for(var c=0;c<o;c++){var f=a[c],h=e.childAt(c);f?(f.ignore==null&&(f.ignore=!1),BU(r,h,t,f,n,e)):h.ignore=!0}for(var p=e.childCount()-1;p>=c;p--){var d=e.childAt(p);yxe(e,d,n)}}}function yxe(r,e,t){e&&Yv(e,Jl(r).option,t)}function _xe(r){new An(r.oldChildren,r.newChildren,uZ,uZ,r).add(cZ).update(cZ).remove(xxe).execute()}function uZ(r,e){var t=r&&r.name;return t??lxe+e}function cZ(r,e){var t=this.context,i=r!=null?t.newChildren[r]:null,n=e!=null?t.oldChildren[e]:null;BU(t.api,n,t.dataIndex,i,t.seriesModel,t.group)}function xxe(r){var e=this.context,t=e.oldChildren[r];t&&Yv(t,Jl(t).option,e.seriesModel)}function dZ(r){return r&&(r.pathData||r.d)}function Sxe(r){return r&&(tt(r,"pathData")||tt(r,"d"))}function VU(r){r.registerChartView(fZ),r.registerSeriesModel(Qq)}var cd=vt(),mZ=Qe,GU=Be,Mxe=function(){function r(){this._dragging=!1,this.animationThreshold=15}return r.prototype.render=function(e,t,i,n){var a=t.get("value"),o=t.get("status");if(this._axisModel=e,this._axisPointerModel=t,this._api=i,!(!n&&this._lastValue===a&&this._lastStatus===o)){this._lastValue=a,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,a,e,t,i);var c=u.graphicKey;c!==this._lastGraphicKey&&this.clear(i),this._lastGraphicKey=c;var f=this._moveAnimation=this.determineAnimation(e,t);if(!s)s=this._group=new Ze,this.createPointerEl(s,u,e,t),this.createLabelEl(s,u,e,t),i.getZr().add(s);else{var h=ot(vZ,t,f);this.updatePointerEl(s,u,h),this.updateLabelEl(s,u,h,t)}yZ(s,t,!0),this._renderHandle(a)}},r.prototype.remove=function(e){this.clear(e)},r.prototype.dispose=function(e){this.clear(e)},r.prototype.determineAnimation=function(e,t){var i=t.get("animation"),n=e.axis,a=n.type==="category",o=t.get("snap");if(!o&&!a)return!1;if(i==="auto"||i==null){var s=this.animationThreshold;if(a&&n.getBandWidth()>s)return!0;if(o){var l=oT(e).seriesDataCount,u=n.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return i===!0},r.prototype.makeElOption=function(e,t,i,n,a){},r.prototype.createPointerEl=function(e,t,i,n){var a=t.pointer;if(a){var o=cd(e).pointerEl=new Ct[a.type](mZ(t.pointer));e.add(o)}},r.prototype.createLabelEl=function(e,t,i,n){if(t.label){var a=cd(e).labelEl=new Lt(mZ(t.label));e.add(a),gZ(a,n)}},r.prototype.updatePointerEl=function(e,t,i){var n=cd(e).pointerEl;n&&t.pointer&&(n.setStyle(t.pointer.style),i(n,{shape:t.pointer.shape}))},r.prototype.updateLabelEl=function(e,t,i,n){var a=cd(e).labelEl;a&&(a.setStyle(t.label.style),i(a,{x:t.label.x,y:t.label.y}),gZ(a,n))},r.prototype._renderHandle=function(e){if(!(this._dragging||!this.updateHandleTransform)){var t=this._axisPointerModel,i=this._api.getZr(),n=this._handle,a=t.getModel("handle"),o=t.get("status");if(!a.get("show")||!o||o==="hide"){n&&i.remove(n),this._handle=null;return}var s;this._handle||(s=!0,n=this._handle=Pu(a.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Ea(u.event)},onmousedown:GU(this._onHandleDragMove,this,0,0),drift:GU(this._onHandleDragMove,this),ondragend:GU(this._onHandleDragEnd,this)}),i.add(n)),yZ(n,t,!1),n.setStyle(a.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=a.get("size");pe(l)||(l=[l,l]),n.scaleX=l[0]/2,n.scaleY=l[1]/2,as(this,"_doDispatchAxisPointer",a.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,s)}},r.prototype._moveHandleToValue=function(e,t){vZ(this._axisPointerModel,!t&&this._moveAnimation,this._handle,HU(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},r.prototype._onHandleDragMove=function(e,t){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(HU(i),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(HU(n)),cd(i).lastProp=null,this._doDispatchAxisPointer()}},r.prototype._doDispatchAxisPointer=function(){var e=this._handle;if(e){var t=this._payloadInfo,i=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:i.axis.dim,axisIndex:i.componentIndex}]})}},r.prototype._onHandleDragEnd=function(){this._dragging=!1;var e=this._handle;if(e){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},r.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),i=this._group,n=this._handle;t&&i&&(this._lastGraphicKey=null,i&&t.remove(i),n&&t.remove(n),this._group=null,this._handle=null,this._payloadInfo=null),zu(this,"_doDispatchAxisPointer")},r.prototype.doClear=function(){},r.prototype.buildLabel=function(e,t,i){return i=i||0,{x:e[i],y:e[1-i],width:t[i],height:t[1-i]}},r}();function vZ(r,e,t,i){_Z(cd(t).lastProp,i)||(cd(t).lastProp=i,e?Dt(t,i,r):(t.stopAnimation(),t.attr(i)))}function _Z(r,e){if(qe(r)&&qe(e)){var t=!0;return N(e,function(i,n){t=t&&_Z(r[n],i)}),!!t}else return r===e}function gZ(r,e){r[e.get(["label","show"])?"show":"hide"]()}function HU(r){return{x:r.x||0,y:r.y||0,rotation:r.rotation||0}}function yZ(r,e,t){var i=e.get("z"),n=e.get("zlevel");r&&r.traverse(function(a){a.type!=="group"&&(i!=null&&(a.z=i),n!=null&&(a.zlevel=n),a.silent=t)})}var Zv=Mxe;function jv(r){var e=r.get("type"),t=r.getModel(e+"Style"),i;return e==="line"?(i=t.getLineStyle(),i.fill=null):e==="shadow"&&(i=t.getAreaStyle(),i.stroke=null),i}function WU(r,e,t,i,n){var a=t.get("value"),o=XU(a,e.axis,e.ecModel,t.get("seriesDataIndices"),{precision:t.get(["label","precision"]),formatter:t.get(["label","formatter"])}),s=t.getModel("label"),l=Gs(s.get("padding")||0),u=s.getFont(),c=Ll(o,u),f=n.position,h=c.width+l[1]+l[3],p=c.height+l[0]+l[2],d=n.align;d==="right"&&(f[0]-=h),d==="center"&&(f[0]-=h/2);var g=n.verticalAlign;g==="bottom"&&(f[1]-=p),g==="middle"&&(f[1]-=p/2),bxe(f,h,p,i);var m=s.get("backgroundColor");(!m||m==="auto")&&(m=e.get(["axisLine","lineStyle","color"])),r.label={x:f[0],y:f[1],style:fr(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:m}),z2:10}}function bxe(r,e,t,i){var n=i.getWidth(),a=i.getHeight();r[0]=Math.min(r[0]+e,n)-e,r[1]=Math.min(r[1]+t,a)-t,r[0]=Math.max(r[0],0),r[1]=Math.max(r[1],0)}function XU(r,e,t,i,n){r=e.scale.parse(r);var a=e.scale.getLabel({value:r},{precision:n.precision}),o=n.formatter;if(o){var s={value:ox(e,{value:r}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};N(i,function(l){var u=t.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,f=u&&u.getDataParams(c);f&&s.seriesData.push(f)}),Ce(o)?a=o.replace("{value}",a):He(o)&&(a=o(s))}return a}function Ox(r,e,t){var i=wi();return Ca(i,i,t.rotation),_n(i,i,t.position),wn([r.dataToCoord(e),(t.labelOffset||0)+(t.labelDirection||1)*(t.labelMargin||0)],i)}function XT(r,e,t,i,n,a){var o=Cn.innerTextLayout(t.rotation,0,t.labelDirection);t.labelMargin=n.get(["label","margin"]),WU(e,i,n,a,{position:Ox(i.axis,r,t),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function Kv(r,e,t){return t=t||0,{x1:r[t],y1:r[1-t],x2:e[t],y2:e[1-t]}}function YT(r,e,t){return t=t||0,{x:r[t],y:r[1-t],width:e[t],height:e[1-t]}}function YU(r,e,t,i,n,a){return{cx:r,cy:e,r0:t,r:i,startAngle:n,endAngle:a,clockwise:!0}}var wxe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,i,n,a,o){var s=n.axis,l=s.grid,u=a.get("type"),c=xZ(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(i,!0));if(u&&u!=="none"){var h=jv(a),p=Txe[u](s,f,c);p.style=h,t.graphicKey=p.type,t.pointer=p}var d=gx(l.model,n);XT(i,t,d,n,a,o)},e.prototype.getHandleTransform=function(t,i,n){var a=gx(i.axis.grid.model,i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=Ox(i.axis,t,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,i,n,a){var o=n.axis,s=o.grid,l=o.getGlobalExtent(!0),u=xZ(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,f=[t.x,t.y];f[c]+=i[c],f[c]=Math.min(l[1],f[c]),f[c]=Math.max(l[0],f[c]);var h=(u[1]+u[0])/2,p=[h,h];p[c]=f[c];var d=[{verticalAlign:"middle"},{align:"center"}];return{x:f[0],y:f[1],rotation:t.rotation,cursorPoint:p,tooltipOption:d[c]}},e}(Zv);function xZ(r,e){var t={};return t[e.dim+"AxisIndex"]=e.index,r.getCartesian(t)}var Txe={line:function(r,e,t){var i=Kv([e,t[0]],[e,t[1]],SZ(r));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(r,e,t){var i=Math.max(1,r.getBandWidth()),n=t[1]-t[0];return{type:"Rect",shape:YT([e-i/2,t[0]],[i,n],SZ(r))}}};function SZ(r){return r.dim==="x"?0:1}var MZ=wxe;var Exe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(Pt),bZ=Exe;var Xu=vt(),Axe=N;function ZT(r,e,t){if(!Ft.node){var i=e.getZr();Xu(i).records||(Xu(i).records={}),Cxe(i,e);var n=Xu(i).records[r]||(Xu(i).records[r]={});n.handler=t}}function Cxe(r,e){if(Xu(r).initialized)return;Xu(r).initialized=!0,t("click",ot(wZ,"click")),t("mousemove",ot(wZ,"mousemove")),t("globalout",Lxe);function t(i,n){r.on(i,function(a){var o=Pxe(e);Axe(Xu(r).records,function(s){s&&n(s,a,o.dispatchAction)}),Rxe(o.pendings,e)})}}function Rxe(r,e){var t=r.showTip.length,i=r.hideTip.length,n;t?n=r.showTip[t-1]:i&&(n=r.hideTip[i-1]),n&&(n.dispatchAction=null,e.dispatchAction(n))}function Lxe(r,e,t){r.handler("leave",null,t)}function wZ(r,e,t,i){e.handler(r,t,i)}function Pxe(r){var e={showTip:[],hideTip:[]},t=function(i){var n=e[i.type];n?n.push(i):(i.dispatchAction=t,r.dispatchAction(i))};return{dispatchAction:t,pendings:e}}function Fx(r,e){if(!Ft.node){var t=e.getZr(),i=(Xu(t).records||{})[r];i&&(Xu(t).records[r]=null)}}var Dxe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=i.getComponent("tooltip"),o=t.get("triggerOn")||a&&a.get("triggerOn")||"mousemove|click";ZT("axisPointer",n,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},e.prototype.remove=function(t,i){Fx("axisPointer",i)},e.prototype.dispose=function(t,i){Fx("axisPointer",i)},e.type="axisPointer",e}(Qt),EZ=Dxe;function zx(r,e){var t=[],i=r.seriesIndex,n;if(i==null||!(n=e.getSeriesByIndex(i)))return{point:[]};var a=n.getData(),o=Jo(a,r);if(o==null||o<0||pe(o))return{point:[]};var s=a.getItemGraphicEl(o),l=n.coordinateSystem;if(n.getTooltipPosition)t=n.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(r.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),f=c.dim,h=u.dim,p=f==="x"||f==="radius"?1:0,d=a.mapDimension(h),g=[];g[p]=a.get(d,o),g[1-p]=a.get(a.getCalculationInfo("stackResultDimension"),o),t=l.dataToPoint(g)||[]}else t=l.dataToPoint(a.getValues(de(l.dimensions,function(v){return a.mapDimension(v)}),o))||[];else if(s){var m=s.getBoundingRect().clone();m.applyTransform(s.transform),t=[m.x+m.width/2,m.y+m.height/2]}return{point:t,el:s}}var AZ=vt();function qU(r,e,t){var i=r.currTrigger,n=[r.x,r.y],a=r,o=r.dispatchAction||Be(t.dispatchAction,t),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){jT(n)&&(n=zx({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},e).point);var l=jT(n),u=a.axesInfo,c=s.axesInfo,f=i==="leave"||jT(n),h={},p={},d={list:[],map:{}},g={showPointer:ot(Nxe,p),showTooltip:ot(Uxe,d)};N(s.coordSysMap,function(v,_){var y=l||v.containPoint(n);N(s.coordSysAxesInfo[_],function(x,M){var S=x.axis,w=Bxe(u,x);if(!f&&y&&(!u||w)){var T=w&&w.value;T==null&&!l&&(T=S.pointToData(n)),T!=null&&CZ(x,T,g,!1,h)}})});var m={};return N(c,function(v,_){var y=v.linkGroup;y&&!p[_]&&N(y.axesInfo,function(x,M){var S=p[M];if(x!==v&&S){var w=S.value;y.mapper&&(w=v.axis.scale.parse(y.mapper(w,RZ(x),RZ(v)))),m[v.key]=w}})}),N(m,function(v,_){CZ(c[_],v,g,!0,h)}),Oxe(p,c,h),Fxe(d,n,r,o),zxe(c,o,t),h}}function CZ(r,e,t,i,n){var a=r.axis;if(!(a.scale.isBlank()||!a.containData(e))){if(!r.involveSeries){t.showPointer(r,e);return}var o=Ixe(e,r),s=o.payloadBatch,l=o.snapToValue;s[0]&&n.seriesIndex==null&&fe(n,s[0]),!i&&r.snap&&a.containData(l)&&l!=null&&(e=l),t.showPointer(r,e,s),t.showTooltip(r,o,l)}}function Ixe(r,e){var t=e.axis,i=t.dim,n=r,a=[],o=Number.MAX_VALUE,s=-1;return N(e.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(i),f,h;if(l.getAxisTooltipData){var p=l.getAxisTooltipData(c,r,t);h=p.dataIndices,f=p.nestestValue}else{if(h=l.getData().indicesOfNearest(c[0],r,t.type==="category"?.5:null),!h.length)return;f=l.getData().get(c[0],h[0])}if(!(f==null||!isFinite(f))){var d=r-f,g=Math.abs(d);g<=o&&((g<o||d>=0&&s<0)&&(o=g,s=d,n=f,a.length=0),N(h,function(m){a.push({seriesIndex:l.seriesIndex,dataIndexInside:m,dataIndex:l.getData().getRawIndex(m)})}))}}),{payloadBatch:a,snapToValue:n}}function Nxe(r,e,t,i){r[e.key]={value:t,payloadBatch:i}}function Uxe(r,e,t,i){var n=t.payloadBatch,a=e.axis,o=a.model,s=e.axisPointerModel;if(!(!e.triggerTooltip||!n.length)){var l=e.coordSys.model,u=Ev(l),c=r.map[u];c||(c=r.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},r.list.push(c)),c.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:n.slice()})}}function Oxe(r,e,t){var i=t.axesInfo=[];N(e,function(n,a){var o=n.axisPointerModel.option,s=r[a];s?(!n.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!n.useHandle&&(o.status="hide"),o.status==="show"&&i.push({axisDim:n.axis.dim,axisIndex:n.axis.model.componentIndex,value:o.value})})}function Fxe(r,e,t,i){if(jT(e)||!r.list.length){i({type:"hideTip"});return}var n=((r.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:t.tooltipOption,position:t.position,dataIndexInside:n.dataIndexInside,dataIndex:n.dataIndex,seriesIndex:n.seriesIndex,dataByCoordSys:r.list})}function zxe(r,e,t){var i=t.getZr(),n="axisPointerLastHighlights",a=AZ(i)[n]||{},o=AZ(i)[n]={};N(r,function(u,c){var f=u.axisPointerModel.option;f.status==="show"&&u.triggerEmphasis&&N(f.seriesDataIndices,function(h){var p=h.seriesIndex+" | "+h.dataIndex;o[p]=h})});var s=[],l=[];N(a,function(u,c){!o[c]&&l.push(u)}),N(o,function(u,c){!a[c]&&s.push(u)}),l.length&&t.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&t.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function Bxe(r,e){for(var t=0;t<(r||[]).length;t++){var i=r[t];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}function RZ(r){var e=r.axis.model,t={},i=t.axisDim=r.axis.dim;return t.axisIndex=t[i+"AxisIndex"]=e.componentIndex,t.axisName=t[i+"AxisName"]=e.name,t.axisId=t[i+"AxisId"]=e.id,t}function jT(r){return!r||r[0]==null||isNaN(r[0])||r[1]==null||isNaN(r[1])}function il(r){Wa.registerAxisPointerClass("CartesianAxisPointer",MZ),r.registerComponentModel(bZ),r.registerComponentView(EZ),r.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!pe(t)&&(e.axisPointer.link=[t])}}),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,function(e,t){e.getComponent("axisPointer").coordSysAxesInfo=r9(e,t)}),r.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},qU)}function ZU(r){It(uT),It(il)}var kxe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,i,n,a,o){var s=n.axis;s.dim==="angle"&&(this.animationThreshold=Math.PI/18);var l=s.polar,u=l.getOtherAxis(s),c=u.getExtent(),f=s.dataToCoord(i),h=a.get("type");if(h&&h!=="none"){var p=jv(a),d=Gxe[h](s,l,f,c);d.style=p,t.graphicKey=d.type,t.pointer=d}var g=a.get(["label","margin"]),m=Vxe(i,n,a,l,g);WU(t,n,a,o,m)},e}(Zv);function Vxe(r,e,t,i,n){var a=e.axis,o=a.dataToCoord(r),s=i.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=i.getRadiusAxis().getExtent(),u,c,f;if(a.dim==="radius"){var h=wi();Ca(h,h,s),_n(h,h,[i.cx,i.cy]),u=wn([o,-n],h);var p=e.getModel("axisLabel").get("rotate")||0,d=Cn.innerTextLayout(s,p*Math.PI/180,-1);c=d.textAlign,f=d.textVerticalAlign}else{var g=l[1];u=i.coordToPoint([g+n,o]);var m=i.cx,v=i.cy;c=Math.abs(u[0]-m)/g<.3?"center":u[0]>m?"left":"right",f=Math.abs(u[1]-v)/g<.3?"middle":u[1]>v?"top":"bottom"}return{position:u,align:c,verticalAlign:f}}var Gxe={line:function(r,e,t,i){return r.dim==="angle"?{type:"Line",shape:Kv(e.coordToPoint([i[0],t]),e.coordToPoint([i[1],t]))}:{type:"Circle",shape:{cx:e.cx,cy:e.cy,r:t}}},shadow:function(r,e,t,i){var n=Math.max(1,r.getBandWidth()),a=Math.PI/180;return r.dim==="angle"?{type:"Sector",shape:YU(e.cx,e.cy,i[0],i[1],(-t-n/2)*a,(-t+n/2)*a)}:{type:"Sector",shape:YU(e.cx,e.cy,t-n/2,t+n/2,0,Math.PI*2)}}},LZ=kxe;var Hxe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.findAxisModel=function(t){var i,n=this.ecModel;return n.eachComponent(t,function(a){a.getCoordSysModel()===this&&(i=a)},this),i},e.type="polar",e.dependencies=["radiusAxis","angleAxis"],e.defaultOption={z:0,center:["50%","50%"],radius:"80%"},e}(Pt),PZ=Hxe;var jU=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Cr).models[0]},e.type="polarAxis",e}(Pt);wr(jU,Gl);var DZ=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="angleAxis",e}(jU);var IZ=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="radiusAxis",e}(jU);var KU=function(r){Z(e,r);function e(t,i){return r.call(this,"radius",t,i)||this}return e.prototype.pointToData=function(t,i){return this.polar.pointToData(t,i)[this.dim==="radius"?0:1]},e}(pn);KU.prototype.dataToRadius=pn.prototype.dataToCoord;KU.prototype.radiusToData=pn.prototype.coordToData;var NZ=KU;var Wxe=vt(),JU=function(r){Z(e,r);function e(t,i){return r.call(this,"angle",t,i||[0,360])||this}return e.prototype.pointToData=function(t,i){return this.polar.pointToData(t,i)[this.dim==="radius"?0:1]},e.prototype.calculateCategoryInterval=function(){var t=this,i=t.getLabelModel(),n=t.scale,a=n.getExtent(),o=n.count();if(a[1]-a[0]<1)return 0;var s=a[0],l=t.dataToCoord(s+1)-t.dataToCoord(s),u=Math.abs(l),c=Ll(s==null?"":s+"",i.getFont(),"center","top"),f=Math.max(c.height,7),h=f/u;isNaN(h)&&(h=1/0);var p=Math.max(0,Math.floor(h)),d=Wxe(t.model),g=d.lastAutoInterval,m=d.lastTickCount;return g!=null&&m!=null&&Math.abs(g-p)<=1&&Math.abs(m-o)<=1&&g>p?p=g:(d.lastTickCount=o,d.lastAutoInterval=p),p},e}(pn);JU.prototype.dataToAngle=pn.prototype.dataToCoord;JU.prototype.angleToData=pn.prototype.coordToData;var UZ=JU;var $U=["radius","angle"],Xxe=function(){function r(e){this.dimensions=$U,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new NZ,this._angleAxis=new UZ,this.axisPointerEnabled=!0,this.name=e||"",this._radiusAxis.polar=this._angleAxis.polar=this}return r.prototype.containPoint=function(e){var t=this.pointToCoord(e);return this._radiusAxis.contain(t[0])&&this._angleAxis.contain(t[1])},r.prototype.containData=function(e){return this._radiusAxis.containData(e[0])&&this._angleAxis.containData(e[1])},r.prototype.getAxis=function(e){var t="_"+e+"Axis";return this[t]},r.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},r.prototype.getAxesByScale=function(e){var t=[],i=this._angleAxis,n=this._radiusAxis;return i.scale.type===e&&t.push(i),n.scale.type===e&&t.push(n),t},r.prototype.getAngleAxis=function(){return this._angleAxis},r.prototype.getRadiusAxis=function(){return this._radiusAxis},r.prototype.getOtherAxis=function(e){var t=this._angleAxis;return e===t?this._radiusAxis:t},r.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},r.prototype.getTooltipAxes=function(e){var t=e!=null&&e!=="auto"?this.getAxis(e):this.getBaseAxis();return{baseAxes:[t],otherAxes:[this.getOtherAxis(t)]}},r.prototype.dataToPoint=function(e,t){return this.coordToPoint([this._radiusAxis.dataToRadius(e[0],t),this._angleAxis.dataToAngle(e[1],t)])},r.prototype.pointToData=function(e,t){var i=this.pointToCoord(e);return[this._radiusAxis.radiusToData(i[0],t),this._angleAxis.angleToData(i[1],t)]},r.prototype.pointToCoord=function(e){var t=e[0]-this.cx,i=e[1]-this.cy,n=this.getAngleAxis(),a=n.getExtent(),o=Math.min(a[0],a[1]),s=Math.max(a[0],a[1]);n.inverse?o=s-360:s=o+360;var l=Math.sqrt(t*t+i*i);t/=l,i/=l;for(var u=Math.atan2(-i,t)/Math.PI*180,c=u<o?1:-1;u<o||u>s;)u+=c*360;return[l,u]},r.prototype.coordToPoint=function(e){var t=e[0],i=e[1]/180*Math.PI,n=Math.cos(i)*t+this.cx,a=-Math.sin(i)*t+this.cy;return[n,a]},r.prototype.getArea=function(){var e=this.getAngleAxis(),t=this.getRadiusAxis(),i=t.getExtent().slice();i[0]>i[1]&&i.reverse();var n=e.getExtent(),a=Math.PI/180;return{cx:this.cx,cy:this.cy,r0:i[0],r:i[1],startAngle:-n[0]*a,endAngle:-n[1]*a,clockwise:e.inverse,contain:function(o,s){var l=o-this.cx,u=s-this.cy,c=l*l+u*u-1e-4,f=this.r,h=this.r0;return c<=f*f&&c>=h*h}}},r.prototype.convertToPixel=function(e,t,i){var n=OZ(t);return n===this?this.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=OZ(t);return n===this?this.pointToData(i):null},r}();function OZ(r){var e=r.seriesModel,t=r.polarModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}var FZ=Xxe;function Yxe(r,e,t){var i=e.get("center"),n=t.getWidth(),a=t.getHeight();r.cx=Fe(i[0],n),r.cy=Fe(i[1],a);var o=r.getRadiusAxis(),s=Math.min(n,a)/2,l=e.get("radius");l==null?l=[0,"100%"]:pe(l)||(l=[0,l]);var u=[Fe(l[0],s),Fe(l[1],s)];o.inverse?o.setExtent(u[1],u[0]):o.setExtent(u[0],u[1])}function qxe(r,e){var t=this,i=t.getAngleAxis(),n=t.getRadiusAxis();if(i.scale.setExtent(1/0,-1/0),n.scale.setExtent(1/0,-1/0),r.eachSeries(function(s){if(s.coordinateSystem===t){var l=s.getData();N(_v(l,"radius"),function(u){n.scale.unionExtentFromData(l,u)}),N(_v(l,"angle"),function(u){i.scale.unionExtentFromData(l,u)})}}),Vl(i.scale,i.model),Vl(n.scale,n.model),i.type==="category"&&!i.onBand){var a=i.getExtent(),o=360/i.scale.count();i.inverse?a[1]+=o:a[1]-=o,i.setExtent(a[0],a[1])}}function Zxe(r){return r.mainType==="angleAxis"}function zZ(r,e){var t;if(r.type=e.get("type"),r.scale=zf(e),r.onBand=e.get("boundaryGap")&&r.type==="category",r.inverse=e.get("inverse"),Zxe(e)){r.inverse=r.inverse!==e.get("clockwise");var i=e.get("startAngle"),n=(t=e.get("endAngle"))!==null&&t!==void 0?t:i+(r.inverse?-360:360);r.setExtent(i,n)}e.axis=r,r.model=e}var jxe={dimensions:$U,create:function(r,e){var t=[];return r.eachComponent("polar",function(i,n){var a=new FZ(n+"");a.update=qxe;var o=a.getRadiusAxis(),s=a.getAngleAxis(),l=i.findAxisModel("radiusAxis"),u=i.findAxisModel("angleAxis");zZ(o,l),zZ(s,u),Yxe(a,i,e),t.push(a),i.coordinateSystem=a,a.model=i}),r.eachSeries(function(i){if(i.get("coordinateSystem")==="polar"){var n=i.getReferringComponents("polar",Cr).models[0];i.coordinateSystem=n.coordinateSystem}}),t}},BZ=jxe;var Kxe=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function KT(r,e,t){e[1]>e[0]&&(e=e.slice().reverse());var i=r.coordToPoint([e[0],t]),n=r.coordToPoint([e[1],t]);return{x1:i[0],y1:i[1],x2:n[0],y2:n[1]}}function JT(r){var e=r.getRadiusAxis();return e.inverse?0:1}function kZ(r){var e=r[0],t=r[r.length-1];e&&t&&Math.abs(Math.abs(e.coord-t.coord)-360)<1e-4&&r.pop()}var Jxe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="PolarAxisPointer",t}return e.prototype.render=function(t,i){if(this.group.removeAll(),!!t.get("show")){var n=t.axis,a=n.polar,o=a.getRadiusAxis().getExtent(),s=n.getTicksCoords(),l=n.getMinorTicksCoords(),u=de(n.getViewLabels(),function(c){c=Qe(c);var f=n.scale,h=f.type==="ordinal"?f.getRawOrdinalNumber(c.tickValue):c.tickValue;return c.coord=n.dataToCoord(h),c});kZ(u),kZ(s),N(Kxe,function(c){t.get([c,"show"])&&(!n.scale.isBlank()||c==="axisLine")&&$xe[c](this.group,t,a,s,l,o,u)},this)}},e.type="angleAxis",e}(Wa),$xe={axisLine:function(r,e,t,i,n,a){var o=e.getModel(["axisLine","lineStyle"]),s=t.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=JT(t),f=c?0:1,h,p=Math.abs(u[1]-u[0])===360?"Circle":"Arc";a[f]===0?h=new Ct[p]({shape:{cx:t.cx,cy:t.cy,r:a[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):h=new Pp({shape:{cx:t.cx,cy:t.cy,r:a[c],r0:a[f]},style:o.getLineStyle(),z2:1,silent:!0}),h.style.fill=null,r.add(h)},axisTick:function(r,e,t,i,n,a){var o=e.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=a[JT(t)],u=de(i,function(c){return new Kr({shape:KT(t,[l,l+s],c.coord)})});r.add(Gn(u,{style:Ye(o.getModel("lineStyle").getLineStyle(),{stroke:e.get(["axisLine","lineStyle","color"])})}))},minorTick:function(r,e,t,i,n,a){if(n.length){for(var o=e.getModel("axisTick"),s=e.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=a[JT(t)],c=[],f=0;f<n.length;f++)for(var h=0;h<n[f].length;h++)c.push(new Kr({shape:KT(t,[u,u+l],n[f][h].coord)}));r.add(Gn(c,{style:Ye(s.getModel("lineStyle").getLineStyle(),Ye(o.getLineStyle(),{stroke:e.get(["axisLine","lineStyle","color"])}))}))}},axisLabel:function(r,e,t,i,n,a,o){var s=e.getCategories(!0),l=e.getModel("axisLabel"),u=l.get("margin"),c=e.get("triggerEvent");N(o,function(f,h){var p=l,d=f.tickValue,g=a[JT(t)],m=t.coordToPoint([g+u,f.coord]),v=t.cx,_=t.cy,y=Math.abs(m[0]-v)/g<.3?"center":m[0]>v?"left":"right",x=Math.abs(m[1]-_)/g<.3?"middle":m[1]>_?"top":"bottom";if(s&&s[d]){var M=s[d];qe(M)&&M.textStyle&&(p=new Zt(M.textStyle,l,l.ecModel))}var S=new Lt({silent:Cn.isLabelSilent(e),style:fr(p,{x:m[0],y:m[1],fill:p.getTextColor()||e.get(["axisLine","lineStyle","color"]),text:f.formattedLabel,align:y,verticalAlign:x})});if(r.add(S),c){var w=Cn.makeAxisEventDataBase(e);w.targetType="axisLabel",w.value=f.rawLabel,rt(S).eventData=w}},this)},splitLine:function(r,e,t,i,n,a){var o=e.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],f=0;f<i.length;f++){var h=u++%l.length;c[h]=c[h]||[],c[h].push(new Kr({shape:KT(t,a,i[f].coord)}))}for(var f=0;f<c.length;f++)r.add(Gn(c[f],{style:Ye({stroke:l[f%l.length]},s.getLineStyle()),silent:!0,z:e.get("z")}))},minorSplitLine:function(r,e,t,i,n,a){if(n.length){for(var o=e.getModel("minorSplitLine"),s=o.getModel("lineStyle"),l=[],u=0;u<n.length;u++)for(var c=0;c<n[u].length;c++)l.push(new Kr({shape:KT(t,a,n[u][c].coord)}));r.add(Gn(l,{style:s.getLineStyle(),silent:!0,z:e.get("z")}))}},splitArea:function(r,e,t,i,n,a){if(i.length){var o=e.getModel("splitArea"),s=o.getModel("areaStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],f=Math.PI/180,h=-i[0].coord*f,p=Math.min(a[0],a[1]),d=Math.max(a[0],a[1]),g=e.get("clockwise"),m=1,v=i.length;m<=v;m++){var _=m===v?i[0].coord:i[m].coord,y=u++%l.length;c[y]=c[y]||[],c[y].push(new yi({shape:{cx:t.cx,cy:t.cy,r0:p,r:d,startAngle:h,endAngle:-_*f,clockwise:g},silent:!0})),h=-_*f}for(var m=0;m<c.length;m++)r.add(Gn(c[m],{style:Ye({fill:l[m%l.length]},s.getAreaStyle()),silent:!0}))}}},VZ=Jxe;var Qxe=["axisLine","axisTickLabel","axisName"],eSe=["splitLine","splitArea","minorSplitLine"],tSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="PolarAxisPointer",t}return e.prototype.render=function(t,i){if(this.group.removeAll(),!!t.get("show")){var n=this._axisGroup,a=this._axisGroup=new Ze;this.group.add(a);var o=t.axis,s=o.polar,l=s.getAngleAxis(),u=o.getTicksCoords(),c=o.getMinorTicksCoords(),f=l.getExtent()[0],h=o.getExtent(),p=iSe(s,t,f),d=new Cn(t,p);N(Qxe,d.add,d),a.add(d.getGroup()),Lu(n,a,t),N(eSe,function(g){t.get([g,"show"])&&!o.scale.isBlank()&&rSe[g](this.group,t,s,f,h,u,c)},this)}},e.type="radiusAxis",e}(Wa),rSe={splitLine:function(r,e,t,i,n,a){var o=e.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0,c=t.getAngleAxis(),f=Math.PI/180,h=c.getExtent(),p=Math.abs(h[1]-h[0])===360?"Circle":"Arc";l=l instanceof Array?l:[l];for(var d=[],g=0;g<a.length;g++){var m=u++%l.length;d[m]=d[m]||[],d[m].push(new Ct[p]({shape:{cx:t.cx,cy:t.cy,r:Math.max(a[g].coord,0),startAngle:-h[0]*f,endAngle:-h[1]*f,clockwise:c.inverse}}))}for(var g=0;g<d.length;g++)r.add(Gn(d[g],{style:Ye({stroke:l[g%l.length],fill:null},s.getLineStyle()),silent:!0}))},minorSplitLine:function(r,e,t,i,n,a,o){if(o.length){for(var s=e.getModel("minorSplitLine"),l=s.getModel("lineStyle"),u=[],c=0;c<o.length;c++)for(var f=0;f<o[c].length;f++)u.push(new oa({shape:{cx:t.cx,cy:t.cy,r:o[c][f].coord}}));r.add(Gn(u,{style:Ye({fill:null},l.getLineStyle()),silent:!0}))}},splitArea:function(r,e,t,i,n,a){if(a.length){var o=e.getModel("splitArea"),s=o.getModel("areaStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],f=a[0].coord,h=1;h<a.length;h++){var p=u++%l.length;c[p]=c[p]||[],c[p].push(new yi({shape:{cx:t.cx,cy:t.cy,r0:f,r:a[h].coord,startAngle:0,endAngle:Math.PI*2},silent:!0})),f=a[h].coord}for(var h=0;h<c.length;h++)r.add(Gn(c[h],{style:Ye({fill:l[h%l.length]},s.getAreaStyle()),silent:!0}))}}};function iSe(r,e,t){return{position:[r.cx,r.cy],rotation:t/180*Math.PI,labelDirection:-1,tickDirection:-1,nameDirection:1,labelRotate:e.getModel("axisLabel").get("rotate"),z2:1}}var GZ=tSe;function HZ(r){return r.get("stack")||"__ec_stack_"+r.seriesIndex}function WZ(r,e){return e.dim+r.model.componentIndex}function nSe(r,e,t){var i={},n=aSe(Wt(e.getSeriesByType(r),function(a){return!e.isSeriesFiltered(a)&&a.coordinateSystem&&a.coordinateSystem.type==="polar"}));e.eachSeriesByType(r,function(a){if(a.coordinateSystem.type==="polar"){var o=a.getData(),s=a.coordinateSystem,l=s.getBaseAxis(),u=WZ(s,l),c=HZ(a),f=n[u][c],h=f.offset,p=f.width,d=s.getOtherAxis(l),g=a.coordinateSystem.cx,m=a.coordinateSystem.cy,v=a.get("barMinHeight")||0,_=a.get("barMinAngle")||0;i[c]=i[c]||[];for(var y=o.mapDimension(d.dim),x=o.mapDimension(l.dim),M=wo(o,y),S=l.dim!=="radius"||!a.get("roundCap",!0),w=d.dataToCoord(0),T=0,C=o.count();T<C;T++){var b=o.get(y,T),E=o.get(x,T),I=b>=0?"p":"n",R=w;M&&(i[c][E]||(i[c][E]={p:w,n:w}),R=i[c][E][I]);var A=void 0,D=void 0,U=void 0,B=void 0;if(d.dim==="radius"){var F=d.dataToCoord(b)-w,k=l.dataToCoord(E);Math.abs(F)<v&&(F=(F<0?-1:1)*v),A=R,D=R+F,U=k-h,B=U-p,M&&(i[c][E][I]=D)}else{var G=d.dataToCoord(b,S)-w,Y=l.dataToCoord(E);Math.abs(G)<_&&(G=(G<0?-1:1)*_),A=Y+h,D=A+p,U=R,B=R+G,M&&(i[c][E][I]=B)}o.setItemLayout(T,{cx:g,cy:m,r0:A,r:D,startAngle:-U*Math.PI/180,endAngle:-B*Math.PI/180,clockwise:U>=B})}}})}function aSe(r){var e={};N(r,function(i,n){var a=i.getData(),o=i.coordinateSystem,s=o.getBaseAxis(),l=WZ(o,s),u=s.getExtent(),c=s.type==="category"?s.getBandWidth():Math.abs(u[1]-u[0])/a.count(),f=e[l]||{bandWidth:c,remainedWidth:c,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},h=f.stacks;e[l]=f;var p=HZ(i);h[p]||f.autoWidthCount++,h[p]=h[p]||{width:0,maxWidth:0};var d=Fe(i.get("barWidth"),c),g=Fe(i.get("barMaxWidth"),c),m=i.get("barGap"),v=i.get("barCategoryGap");d&&!h[p].width&&(d=Math.min(f.remainedWidth,d),h[p].width=d,f.remainedWidth-=d),g&&(h[p].maxWidth=g),m!=null&&(f.gap=m),v!=null&&(f.categoryGap=v)});var t={};return N(e,function(i,n){t[n]={};var a=i.stacks,o=i.bandWidth,s=Fe(i.categoryGap,o),l=Fe(i.gap,1),u=i.remainedWidth,c=i.autoWidthCount,f=(u-s)/(c+(c-1)*l);f=Math.max(f,0),N(a,function(g,m){var v=g.maxWidth;v&&v<f&&(v=Math.min(v,u),g.width&&(v=Math.min(v,g.width)),u-=v,g.width=v,c--)}),f=(u-s)/(c+(c-1)*l),f=Math.max(f,0);var h=0,p;N(a,function(g,m){g.width||(g.width=f),p=g,h+=g.width*(1+l)}),p&&(h-=p.width*l);var d=-h/2;N(a,function(g,m){t[n][m]=t[n][m]||{offset:d,width:g.width},d+=g.width*(1+l)})}),t}var XZ=nSe;var oSe={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},sSe={splitNumber:5},lSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="polar",e}(Qt);function QU(r){It(il),Wa.registerAxisPointerClass("PolarAxisPointer",LZ),r.registerCoordinateSystem("polar",BZ),r.registerComponentModel(PZ),r.registerComponentView(lSe),rl(r,"angle",DZ,oSe),rl(r,"radius",IZ,sSe),r.registerComponentView(VZ),r.registerComponentView(GZ),r.registerLayout(ot(XZ,"bar"))}function Bx(r,e){e=e||{};var t=r.coordinateSystem,i=r.axis,n={},a=i.position,o=i.orient,s=t.getRect(),l=[s.x,s.x+s.width,s.y,s.y+s.height],u={horizontal:{top:l[2],bottom:l[3]},vertical:{left:l[0],right:l[1]}};n.position=[o==="vertical"?u.vertical[a]:l[0],o==="horizontal"?u.horizontal[a]:l[3]];var c={horizontal:0,vertical:1};n.rotation=Math.PI/2*c[o];var f={top:-1,bottom:1,right:1,left:-1};n.labelDirection=n.tickDirection=n.nameDirection=f[a],r.get(["axisTick","inside"])&&(n.tickDirection=-n.tickDirection),Br(e.labelInside,r.get(["axisLabel","inside"]))&&(n.labelDirection=-n.labelDirection);var h=e.rotate;return h==null&&(h=r.get(["axisLabel","rotate"])),n.labelRotation=a==="top"?-h:h,n.z2=1,n}var uSe=["axisLine","axisTickLabel","axisName"],cSe=["splitArea","splitLine"],fSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="SingleAxisPointer",t}return e.prototype.render=function(t,i,n,a){var o=this.group;o.removeAll();var s=this._axisGroup;this._axisGroup=new Ze;var l=Bx(t),u=new Cn(t,l);N(uSe,u.add,u),o.add(this._axisGroup),o.add(u.getGroup()),N(cSe,function(c){t.get([c,"show"])&&hSe[c](this,this.group,this._axisGroup,t)},this),Lu(s,this._axisGroup,t),r.prototype.render.call(this,t,i,n,a)},e.prototype.remove=function(){lT(this)},e.type="singleAxis",e}(Wa),hSe={splitLine:function(r,e,t,i){var n=i.axis;if(!n.scale.isBlank()){var a=i.getModel("splitLine"),o=a.getModel("lineStyle"),s=o.get("color");s=s instanceof Array?s:[s];for(var l=o.get("width"),u=i.coordinateSystem.getRect(),c=n.isHorizontal(),f=[],h=0,p=n.getTicksCoords({tickModel:a}),d=[],g=[],m=0;m<p.length;++m){var v=n.toGlobalCoord(p[m].coord);c?(d[0]=v,d[1]=u.y,g[0]=v,g[1]=u.y+u.height):(d[0]=u.x,d[1]=v,g[0]=u.x+u.width,g[1]=v);var _=new Kr({shape:{x1:d[0],y1:d[1],x2:g[0],y2:g[1]},silent:!0});Ru(_.shape,l);var y=h++%s.length;f[y]=f[y]||[],f[y].push(_)}for(var x=o.getLineStyle(["color"]),m=0;m<f.length;++m)e.add(Gn(f[m],{style:Ye({stroke:s[m%s.length]},x),silent:!0}))}},splitArea:function(r,e,t,i){sT(r,t,i,i)}},qZ=fSe;var ZZ=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getCoordSysModel=function(){return this},e.type="singleAxis",e.layoutMode="box",e.defaultOption={left:"5%",top:"5%",right:"5%",bottom:"5%",type:"value",position:"bottom",orient:"horizontal",axisLine:{show:!0,lineStyle:{width:1,type:"solid"}},tooltip:{show:!0},axisTick:{show:!0,length:6,lineStyle:{width:1}},axisLabel:{show:!0,interval:"auto"},splitLine:{show:!0,lineStyle:{type:"dashed",opacity:.2}}},e}(Pt);wr(ZZ,Gl.prototype);var $T=ZZ;var pSe=function(r){Z(e,r);function e(t,i,n,a,o){var s=r.call(this,t,i,n)||this;return s.type=a||"value",s.position=o||"bottom",s}return e.prototype.isHorizontal=function(){var t=this.position;return t==="top"||t==="bottom"},e.prototype.pointToData=function(t,i){return this.coordinateSystem.pointToData(t)[0]},e}(pn),jZ=pSe;var eO=["single"],dSe=function(){function r(e,t,i){this.type="single",this.dimension="single",this.dimensions=eO,this.axisPointerEnabled=!0,this.model=e,this._init(e,t,i)}return r.prototype._init=function(e,t,i){var n=this.dimension,a=new jZ(n,zf(e),[0,0],e.get("type"),e.get("position")),o=a.type==="category";a.onBand=o&&e.get("boundaryGap"),a.inverse=e.get("inverse"),a.orient=e.get("orient"),e.axis=a,a.model=e,a.coordinateSystem=this,this._axis=a},r.prototype.update=function(e,t){e.eachSeries(function(i){if(i.coordinateSystem===this){var n=i.getData();N(n.mapDimensionsAll(this.dimension),function(a){this._axis.scale.unionExtentFromData(n,a)},this),Vl(this._axis.scale,this._axis.model)}},this)},r.prototype.resize=function(e,t){this._rect=xr({left:e.get("left"),top:e.get("top"),right:e.get("right"),bottom:e.get("bottom"),width:e.get("width"),height:e.get("height")},{width:t.getWidth(),height:t.getHeight()}),this._adjustAxis()},r.prototype.getRect=function(){return this._rect},r.prototype._adjustAxis=function(){var e=this._rect,t=this._axis,i=t.isHorizontal(),n=i?[0,e.width]:[0,e.height],a=t.inverse?1:0;t.setExtent(n[a],n[1-a]),this._updateAxisTransform(t,i?e.x:e.y)},r.prototype._updateAxisTransform=function(e,t){var i=e.getExtent(),n=i[0]+i[1],a=e.isHorizontal();e.toGlobalCoord=a?function(o){return o+t}:function(o){return n-o+t},e.toLocalCoord=a?function(o){return o-t}:function(o){return n-o+t}},r.prototype.getAxis=function(){return this._axis},r.prototype.getBaseAxis=function(){return this._axis},r.prototype.getAxes=function(){return[this._axis]},r.prototype.getTooltipAxes=function(){return{baseAxes:[this.getAxis()],otherAxes:[]}},r.prototype.containPoint=function(e){var t=this.getRect(),i=this.getAxis(),n=i.orient;return n==="horizontal"?i.contain(i.toLocalCoord(e[0]))&&e[1]>=t.y&&e[1]<=t.y+t.height:i.contain(i.toLocalCoord(e[1]))&&e[0]>=t.y&&e[0]<=t.y+t.height},r.prototype.pointToData=function(e){var t=this.getAxis();return[t.coordToData(t.toLocalCoord(e[t.orient==="horizontal"?0:1]))]},r.prototype.dataToPoint=function(e){var t=this.getAxis(),i=this.getRect(),n=[],a=t.orient==="horizontal"?0:1;return e instanceof Array&&(e=e[0]),n[a]=t.toGlobalCoord(t.dataToCoord(+e)),n[1-a]=a===0?i.y+i.height/2:i.x+i.width/2,n},r.prototype.convertToPixel=function(e,t,i){var n=KZ(t);return n===this?this.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=KZ(t);return n===this?this.pointToData(i):null},r}();function KZ(r){var e=r.seriesModel,t=r.singleAxisModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}var JZ=dSe;function mSe(r,e){var t=[];return r.eachComponent("singleAxis",function(i,n){var a=new JZ(i,r,e);a.name="single_"+n,a.resize(i,e),i.coordinateSystem=a,t.push(a)}),r.eachSeries(function(i){if(i.get("coordinateSystem")==="singleAxis"){var n=i.getReferringComponents("singleAxis",Cr).models[0];i.coordinateSystem=n&&n.coordinateSystem}}),t}var vSe={create:mSe,dimensions:eO},$Z=vSe;var QZ=["x","y"],gSe=["width","height"],ySe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,i,n,a,o){var s=n.axis,l=s.coordinateSystem,u=tO(l,1-QT(s)),c=l.dataToPoint(i)[0],f=a.get("type");if(f&&f!=="none"){var h=jv(a),p=_Se[f](s,c,u);p.style=h,t.graphicKey=p.type,t.pointer=p}var d=Bx(n);XT(i,t,d,n,a,o)},e.prototype.getHandleTransform=function(t,i,n){var a=Bx(i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=Ox(i.axis,t,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,i,n,a){var o=n.axis,s=o.coordinateSystem,l=QT(o),u=tO(s,l),c=[t.x,t.y];c[l]+=i[l],c[l]=Math.min(u[1],c[l]),c[l]=Math.max(u[0],c[l]);var f=tO(s,1-l),h=(f[1]+f[0])/2,p=[h,h];return p[l]=c[l],{x:c[0],y:c[1],rotation:t.rotation,cursorPoint:p,tooltipOption:{verticalAlign:"middle"}}},e}(Zv),_Se={line:function(r,e,t){var i=Kv([e,t[0]],[e,t[1]],QT(r));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(r,e,t){var i=r.getBandWidth(),n=t[1]-t[0];return{type:"Rect",shape:YT([e-i/2,t[0]],[i,n],QT(r))}}};function QT(r){return r.isHorizontal()?0:1}function tO(r,e){var t=r.getRect();return[t[QZ[e]],t[QZ[e]]+t[gSe[e]]]}var ej=ySe;var xSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="single",e}(Qt);function rO(r){It(il),Wa.registerAxisPointerClass("SingleAxisPointer",ej),r.registerComponentView(xSe),r.registerComponentView(qZ),r.registerComponentModel($T),rl(r,"single",$T,$T.defaultOption),r.registerCoordinateSystem("single",$Z)}var SSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i,n){var a=rs(t);r.prototype.init.apply(this,arguments),tj(t,a)},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),tj(this.option,t)},e.prototype.getCellSize=function(){return this.option.cellSize},e.type="calendar",e.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{color:"#fff",borderWidth:1,borderColor:"#ccc"},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},e}(Pt);function tj(r,e){var t=r.cellSize,i;pe(t)?i=t:i=r.cellSize=[t,t],i.length===1&&(i[1]=i[0]);var n=de([0,1],function(a){return x5(e,a)&&(i[a]="auto"),i[a]!=null&&i[a]!=="auto"});za(r,e,{type:"box",ignoreSize:n})}var rj=SSe;var MSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){var a=this.group;a.removeAll();var o=t.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=i.getLocaleModel();this._renderDayRect(t,s,a),this._renderLines(t,s,l,a),this._renderYearText(t,s,l,a),this._renderMonthText(t,u,l,a),this._renderWeekText(t,u,s,l,a)},e.prototype._renderDayRect=function(t,i,n){for(var a=t.coordinateSystem,o=t.getModel("itemStyle").getItemStyle(),s=a.getCellWidth(),l=a.getCellHeight(),u=i.start.time;u<=i.end.time;u=a.getNextNDay(u,1).time){var c=a.dataToRect([u],!1).tl,f=new Tt({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});n.add(f)}},e.prototype._renderLines=function(t,i,n,a){var o=this,s=t.coordinateSystem,l=t.getModel(["splitLine","lineStyle"]).getLineStyle(),u=t.get(["splitLine","show"]),c=l.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var f=i.start,h=0;f.time<=i.end.time;h++){d(f.formatedDate),h===0&&(f=s.getDateInfo(i.start.y+"-"+i.start.m));var p=f.date;p.setMonth(p.getMonth()+1),f=s.getDateInfo(p)}d(s.getNextNDay(i.end.time,1).formatedDate);function d(g){o._firstDayOfMonth.push(s.getDateInfo(g)),o._firstDayPoints.push(s.dataToRect([g],!1).tl);var m=o._getLinePointsOfOneWeek(t,g,n);o._tlpoints.push(m[0]),o._blpoints.push(m[m.length-1]),u&&o._drawSplitline(m,l,a)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,n),l,a),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,n),l,a)},e.prototype._getEdgesPoints=function(t,i,n){var a=[t[0].slice(),t[t.length-1].slice()],o=n==="horizontal"?0:1;return a[0][o]=a[0][o]-i/2,a[1][o]=a[1][o]+i/2,a},e.prototype._drawSplitline=function(t,i,n){var a=new $r({z2:20,shape:{points:t},style:i});n.add(a)},e.prototype._getLinePointsOfOneWeek=function(t,i,n){for(var a=t.coordinateSystem,o=a.getDateInfo(i),s=[],l=0;l<7;l++){var u=a.getNextNDay(o.time,l),c=a.dataToRect([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[n==="horizontal"?"bl":"tr"]}return s},e.prototype._formatterLabel=function(t,i){return Ce(t)&&t?g5(t,i):He(t)?t(i):i.nameMap},e.prototype._yearTextPositionControl=function(t,i,n,a,o){var s=i[0],l=i[1],u=["center","bottom"];a==="bottom"?(l+=o,u=["center","top"]):a==="left"?s-=o:a==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(a==="left"||a==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},e.prototype._renderYearText=function(t,i,n,a){var o=t.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=n!=="horizontal"?"top":"left");var u=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(u[0][0]+u[1][0])/2,f=(u[0][1]+u[1][1])/2,h=n==="horizontal"?0:1,p={top:[c,u[h][1]],bottom:[c,u[1-h][1]],left:[u[1-h][0],f],right:[u[h][0],f]},d=i.start.y;+i.end.y>+i.start.y&&(d=d+"-"+i.end.y);var g=o.get("formatter"),m={start:i.start.y,end:i.end.y,nameMap:d},v=this._formatterLabel(g,m),_=new Lt({z2:30,style:fr(o,{text:v})});_.attr(this._yearTextPositionControl(_,p[l],n,l,s)),a.add(_)}},e.prototype._monthTextPositionControl=function(t,i,n,a,o){var s="left",l="top",u=t[0],c=t[1];return n==="horizontal"?(c=c+o,i&&(s="center"),a==="start"&&(l="bottom")):(u=u+o,i&&(l="middle"),a==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},e.prototype._renderMonthText=function(t,i,n,a){var o=t.getModel("monthLabel");if(o.get("show")){var s=o.get("nameMap"),l=o.get("margin"),u=o.get("position"),c=o.get("align"),f=[this._tlpoints,this._blpoints];(!s||Ce(s))&&(s&&(i=b_(s)||i),s=i.get(["time","monthAbbr"])||[]);var h=u==="start"?0:1,p=n==="horizontal"?0:1;l=u==="start"?-l:l;for(var d=c==="center",g=0;g<f[h].length-1;g++){var m=f[h][g].slice(),v=this._firstDayOfMonth[g];if(d){var _=this._firstDayPoints[g];m[p]=(_[p]+f[0][g+1][p])/2}var y=o.get("formatter"),x=s[+v.m-1],M={yyyy:v.y,yy:(v.y+"").slice(2),MM:v.m,M:+v.m,nameMap:x},S=this._formatterLabel(y,M),w=new Lt({z2:30,style:fe(fr(o,{text:S}),this._monthTextPositionControl(m,d,n,u,l))});a.add(w)}}},e.prototype._weekTextPositionControl=function(t,i,n,a,o){var s="center",l="middle",u=t[0],c=t[1],f=n==="start";return i==="horizontal"?(u=u+a+(f?1:-1)*o[0]/2,s=f?"right":"left"):(c=c+a+(f?1:-1)*o[1]/2,l=f?"bottom":"top"),{x:u,y:c,align:s,verticalAlign:l}},e.prototype._renderWeekText=function(t,i,n,a,o){var s=t.getModel("dayLabel");if(s.get("show")){var l=t.coordinateSystem,u=s.get("position"),c=s.get("nameMap"),f=s.get("margin"),h=l.getFirstDayOfWeek();if(!c||Ce(c)){c&&(i=b_(c)||i);var p=i.get(["time","dayOfWeekShort"]);c=p||de(i.get(["time","dayOfWeekAbbr"]),function(M){return M[0]})}var d=l.getNextNDay(n.end.time,7-n.lweek).time,g=[l.getCellWidth(),l.getCellHeight()];f=Fe(f,Math.min(g[1],g[0])),u==="start"&&(d=l.getNextNDay(n.start.time,-(7+n.fweek)).time,f=-f);for(var m=0;m<7;m++){var v=l.getNextNDay(d,m),_=l.dataToRect([v.time],!1).center,y=m;y=Math.abs((m+h)%7);var x=new Lt({z2:30,style:fe(fr(s,{text:c[y]}),this._weekTextPositionControl(_,a,u,f,g))});o.add(x)}}},e.type="calendar",e}(Qt),ij=MSe;var iO=864e5,bSe=function(){function r(e,t,i){this.type="calendar",this.dimensions=r.dimensions,this.getDimensionsInfo=r.getDimensionsInfo,this._model=e}return r.getDimensionsInfo=function(){return[{name:"time",type:"time"},"value"]},r.prototype.getRangeInfo=function(){return this._rangeInfo},r.prototype.getModel=function(){return this._model},r.prototype.getRect=function(){return this._rect},r.prototype.getCellWidth=function(){return this._sw},r.prototype.getCellHeight=function(){return this._sh},r.prototype.getOrient=function(){return this._orient},r.prototype.getFirstDayOfWeek=function(){return this._firstDayOfWeek},r.prototype.getDateInfo=function(e){e=Mn(e);var t=e.getFullYear(),i=e.getMonth()+1,n=i<10?"0"+i:""+i,a=e.getDate(),o=a<10?"0"+a:""+a,s=e.getDay();return s=Math.abs((s+7-this.getFirstDayOfWeek())%7),{y:t+"",m:n,d:o,day:s,time:e.getTime(),formatedDate:t+"-"+n+"-"+o,date:e}},r.prototype.getNextNDay=function(e,t){return t=t||0,t===0?this.getDateInfo(e):(e=new Date(this.getDateInfo(e).time),e.setDate(e.getDate()+t),this.getDateInfo(e))},r.prototype.update=function(e,t){this._firstDayOfWeek=+this._model.getModel("dayLabel").get("firstDay"),this._orient=this._model.get("orient"),this._lineWidth=this._model.getModel("itemStyle").getItemStyle().lineWidth||0,this._rangeInfo=this._getRangeInfo(this._initRangeOption());var i=this._rangeInfo.weeks||1,n=["width","height"],a=this._model.getCellSize().slice(),o=this._model.getBoxLayoutParams(),s=this._orient==="horizontal"?[i,7]:[7,i];N([0,1],function(f){c(a,f)&&(o[n[f]]=a[f]*s[f])});var l={width:t.getWidth(),height:t.getHeight()},u=this._rect=xr(o,l);N([0,1],function(f){c(a,f)||(a[f]=u[n[f]]/s[f])});function c(f,h){return f[h]!=null&&f[h]!=="auto"}this._sw=a[0],this._sh=a[1]},r.prototype.dataToPoint=function(e,t){pe(e)&&(e=e[0]),t==null&&(t=!0);var i=this.getDateInfo(e),n=this._rangeInfo,a=i.formatedDate;if(t&&!(i.time>=n.start.time&&i.time<n.end.time+iO))return[NaN,NaN];var o=i.day,s=this._getRangeInfo([n.start.time,a]).nthWeek;return this._orient==="vertical"?[this._rect.x+o*this._sw+this._sw/2,this._rect.y+s*this._sh+this._sh/2]:[this._rect.x+s*this._sw+this._sw/2,this._rect.y+o*this._sh+this._sh/2]},r.prototype.pointToData=function(e){var t=this.pointToDate(e);return t&&t.time},r.prototype.dataToRect=function(e,t){var i=this.dataToPoint(e,t);return{contentShape:{x:i[0]-(this._sw-this._lineWidth)/2,y:i[1]-(this._sh-this._lineWidth)/2,width:this._sw-this._lineWidth,height:this._sh-this._lineWidth},center:i,tl:[i[0]-this._sw/2,i[1]-this._sh/2],tr:[i[0]+this._sw/2,i[1]-this._sh/2],br:[i[0]+this._sw/2,i[1]+this._sh/2],bl:[i[0]-this._sw/2,i[1]+this._sh/2]}},r.prototype.pointToDate=function(e){var t=Math.floor((e[0]-this._rect.x)/this._sw)+1,i=Math.floor((e[1]-this._rect.y)/this._sh)+1,n=this._rangeInfo.range;return this._orient==="vertical"?this._getDateByWeeksAndDay(i,t-1,n):this._getDateByWeeksAndDay(t,i-1,n)},r.prototype.convertToPixel=function(e,t,i){var n=nj(t);return n===this?n.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=nj(t);return n===this?n.pointToData(i):null},r.prototype.containPoint=function(e){return console.warn("Not implemented."),!1},r.prototype._initRangeOption=function(){var e=this._model.get("range"),t;if(pe(e)&&e.length===1&&(e=e[0]),pe(e))t=e;else{var i=e.toString();if(/^\d{4}$/.test(i)&&(t=[i+"-01-01",i+"-12-31"]),/^\d{4}[\/|-]\d{1,2}$/.test(i)){var n=this.getDateInfo(i),a=n.date;a.setMonth(a.getMonth()+1);var o=this.getNextNDay(a,-1);t=[n.formatedDate,o.formatedDate]}/^\d{4}[\/|-]\d{1,2}[\/|-]\d{1,2}$/.test(i)&&(t=[i,i])}if(!t)return e;var s=this._getRangeInfo(t);return s.start.time>s.end.time&&t.reverse(),t},r.prototype._getRangeInfo=function(e){var t=[this.getDateInfo(e[0]),this.getDateInfo(e[1])],i;t[0].time>t[1].time&&(i=!0,t.reverse());var n=Math.floor(t[1].time/iO)-Math.floor(t[0].time/iO)+1,a=new Date(t[0].time),o=a.getDate(),s=t[1].date.getDate();a.setDate(o+n-1);var l=a.getDate();if(l!==s)for(var u=a.getTime()-t[1].time>0?1:-1;(l=a.getDate())!==s&&(a.getTime()-t[1].time)*u>0;)n-=u,a.setDate(l-u);var c=Math.floor((n+t[0].day+6)/7),f=i?-c+1:c-1;return i&&t.reverse(),{range:[t[0].formatedDate,t[1].formatedDate],start:t[0],end:t[1],allDay:n,weeks:c,nthWeek:f,fweek:t[0].day,lweek:t[1].day}},r.prototype._getDateByWeeksAndDay=function(e,t,i){var n=this._getRangeInfo(i);if(e>n.weeks||e===0&&t<n.fweek||e===n.weeks&&t>n.lweek)return null;var a=(e-1)*7-n.fweek+t,o=new Date(n.start.time);return o.setDate(+n.start.d+a),this.getDateInfo(o)},r.create=function(e,t){var i=[];return e.eachComponent("calendar",function(n){var a=new r(n,e,t);i.push(a),n.coordinateSystem=a}),e.eachSeries(function(n){n.get("coordinateSystem")==="calendar"&&(n.coordinateSystem=i[n.get("calendarIndex")||0])}),i},r.dimensions=["time","value"],r}();function nj(r){var e=r.calendarModel,t=r.seriesModel,i=e?e.coordinateSystem:t?t.coordinateSystem:null;return i}var aj=bSe;function nO(r){r.registerComponentModel(rj),r.registerComponentView(ij),r.registerCoordinateSystem("calendar",aj)}function wSe(r,e){var t=r.existing;if(e.id=r.keyInfo.id,!e.type&&t&&(e.type=t.type),e.parentId==null){var i=e.parentOption;i?e.parentId=i.id:t&&(e.parentId=t.parentId)}e.parentOption=null}function oj(r,e){var t;return N(e,function(i){r[i]!=null&&r[i]!=="auto"&&(t=!0)}),t}function TSe(r,e,t){var i=fe({},t),n=r[e],a=t.$action||"merge";if(a==="merge")if(n){if(0)var o;_t(n,i,!0),za(n,i,{ignoreSize:!0}),nD(t,n),eE(t,n),eE(t,n,"shape"),eE(t,n,"style"),eE(t,n,"extra"),t.clipPath=n.clipPath}else r[e]=i;else a==="replace"?r[e]=i:a==="remove"&&n&&(r[e]=null)}var sj=["transition","enterFrom","leaveTo"],ESe=sj.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function eE(r,e,t){if(t&&(!r[t]&&e[t]&&(r[t]={}),r=r[t],e=e[t]),!(!r||!e))for(var i=t?sj:ESe,n=0;n<i.length;n++){var a=i[n];r[a]==null&&e[a]!=null&&(r[a]=e[a])}}function ASe(r,e){if(r&&(r.hv=e.hv=[oj(e,["left","right"]),oj(e,["top","bottom"])],r.type==="group")){var t=r,i=e;t.width==null&&(t.width=i.width=0),t.height==null&&(t.height=i.height=0)}}var lj=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.preventAutoZ=!0,t}return e.prototype.mergeOption=function(t,i){var n=this.option.elements;this.option.elements=null,r.prototype.mergeOption.call(this,t,i),this.option.elements=n},e.prototype.optionUpdated=function(t,i){var n=this.option,a=(i?n:t).elements,o=n.elements=i?[]:n.elements,s=[];this._flatten(a,s,null);var l=Gb(o,s,"normalMerge"),u=this._elOptionsToUpdate=[];N(l,function(c,f){var h=c.newOption;h&&(u.push(h),wSe(c,h),TSe(o,f,h),ASe(o[f],h))},this),n.elements=Wt(o,function(c){return c&&delete c.$action,c!=null})},e.prototype._flatten=function(t,i,n){N(t,function(a){if(a){n&&(a.parentOption=n),i.push(a);var o=a.children;o&&o.length&&this._flatten(o,i,a),delete a.children}},this)},e.prototype.useElOptionsToUpdate=function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t},e.type="graphic",e.defaultOption={elements:[]},e}(Pt);var uj={path:null,compoundPath:null,group:Ze,image:Ur,text:Lt},ps=vt(),hj=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this._elMap=ke()},e.prototype.render=function(t,i,n){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t),this._relocate(t,n)},e.prototype._updateElements=function(t){var i=t.useElOptionsToUpdate();if(i){var n=this._elMap,a=this.group,o=t.get("z"),s=t.get("zlevel");N(i,function(l){var u=Yr(l.id,null),c=u!=null?n.get(u):null,f=Yr(l.parentId,null),h=f!=null?n.get(f):a,p=l.type,d=l.style;p==="text"&&d&&l.hv&&l.hv[1]&&(d.textVerticalAlign=d.textBaseline=d.verticalAlign=d.align=null);var g=l.textContent,m=l.textConfig;if(d&&VT(d,p,!!m,!!g)){var v=GT(d,p,!0);!m&&v.textConfig&&(m=l.textConfig=v.textConfig),!g&&v.textContent&&(g=v.textContent)}var _=CSe(l),y=l.$action||"merge",x=y==="merge",M=y==="replace";if(x){var S=!c,w=c;S?w=cj(u,h,l.type,n):(w&&(ps(w).isNew=!1),HT(w)),w&&(Xv(w,_,t,{isInit:S}),fj(w,l,o,s))}else if(M){tE(c,l,n,t);var T=cj(u,h,l.type,n);T&&(Xv(T,_,t,{isInit:!0}),fj(T,l,o,s))}else y==="remove"&&(RU(c,l),tE(c,l,n,t));var C=n.get(u);if(C&&g)if(x){var b=C.getTextContent();b?b.attr(g):C.setTextContent(new Lt(g))}else M&&C.setTextContent(new Lt(g));if(C){var E=l.clipPath;if(E){var I=E.type,R=void 0,S=!1;if(x){var A=C.getClipPath();S=!A||ps(A).type!==I,R=S?aO(I):A}else M&&(S=!0,R=aO(I));C.setClipPath(R),Xv(R,E,t,{isInit:S}),qv(R,E.keyframeAnimation,t)}var D=ps(C);C.setTextConfig(m),D.option=l,RSe(C,t,l),Vs({el:C,componentModel:t,itemName:C.name,itemTooltipOption:l.tooltip}),qv(C,l.keyframeAnimation,t)}})}},e.prototype._relocate=function(t,i){for(var n=t.option.elements,a=this.group,o=this._elMap,s=i.getWidth(),l=i.getHeight(),u=["x","y"],c=0;c<n.length;c++){var f=n[c],h=Yr(f.id,null),p=h!=null?o.get(h):null;if(!(!p||!p.isGroup)){var d=p.parent,g=d===a,m=ps(p),v=ps(d);m.width=Fe(m.option.width,g?s:v.width)||0,m.height=Fe(m.option.height,g?l:v.height)||0}}for(var c=n.length-1;c>=0;c--){var f=n[c],h=Yr(f.id,null),p=h!=null?o.get(h):null;if(p){var d=p.parent,v=ps(d),_=d===a?{width:s,height:l}:{width:v.width,height:v.height},y={},x=Ef(p,f,_,null,{hv:f.hv,boundingMode:f.bounding},y);if(!ps(p).isNew&&x){for(var M=f.transition,S={},w=0;w<u.length;w++){var T=u[w],C=y[T];M&&(jf(M)||dt(M,T)>=0)?S[T]=C:p[T]=C}Dt(p,S,t,0)}else p.attr(y)}}},e.prototype._clear=function(){var t=this,i=this._elMap;i.each(function(n){tE(n,ps(n).option,i,t._lastGraphicModel)}),this._elMap=ke()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(Qt);function aO(r){var e=tt(uj,r)?uj[r]:x_(r),t=new e({});return ps(t).type=r,t}function cj(r,e,t,i){var n=aO(t);return e.add(n),i.set(r,n),ps(n).id=r,ps(n).isNew=!0,n}function tE(r,e,t,i){var n=r&&r.parent;n&&(r.type==="group"&&r.traverse(function(a){tE(a,e,t,i)}),Yv(r,e,i),t.removeKey(ps(r).id))}function fj(r,e,t,i){r.isGroup||N([["cursor",gi.prototype.cursor],["zlevel",i||0],["z",t||0],["z2",0]],function(n){var a=n[0];tt(e,a)?r[a]=ft(e[a],n[1]):r[a]==null&&(r[a]=n[1])}),N(bt(e),function(n){if(n.indexOf("on")===0){var a=e[n];r[n]=He(a)?a:null}}),tt(e,"draggable")&&(r.draggable=e.draggable),e.name!=null&&(r.name=e.name),e.id!=null&&(r.id=e.id)}function CSe(r){return r=fe({},r),N(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(rD),function(e){delete r[e]}),r}function RSe(r,e,t){var i=rt(r).eventData;!r.silent&&!r.ignore&&!i&&(i=rt(r).eventData={componentType:"graphic",componentIndex:e.componentIndex,name:r.name}),i&&(i.info=t.info)}function oO(r){r.registerComponentModel(lj),r.registerComponentView(hj),r.registerPreprocessor(function(e){var t=e.graphic;pe(t)?!t[0]||!t[0].elements?e.graphic=[{elements:t}]:e.graphic=[e.graphic[0]]:t&&!t.elements&&(e.graphic=[{elements:[t]}])})}var sO=["x","y","radius","angle","single"],LSe=["cartesian2d","polar","singleAxis"];function pj(r){var e=r.get("coordinateSystem");return dt(LSe,e)>=0}function ds(r){return r+"Axis"}function dj(r,e){var t=ke(),i=[],n=ke();r.eachComponent({mainType:"dataZoom",query:e},function(c){n.get(c.uid)||s(c)});var a;do a=!1,r.eachComponent("dataZoom",o);while(a);function o(c){!n.get(c.uid)&&l(c)&&(s(c),a=!0)}function s(c){n.set(c.uid,!0),i.push(c),u(c)}function l(c){var f=!1;return c.eachTargetAxis(function(h,p){var d=t.get(h);d&&d[p]&&(f=!0)}),f}function u(c){c.eachTargetAxis(function(f,h){(t.get(f)||t.set(f,[]))[h]=!0})}return i}function rE(r){var e=r.ecModel,t={infoList:[],infoMap:ke()};return r.eachTargetAxis(function(i,n){var a=e.getComponent(ds(i),n);if(a){var o=a.getCoordSysModel();if(o){var s=o.uid,l=t.infoMap.get(s);l||(l={model:o,axisModels:[]},t.infoList.push(l),t.infoMap.set(s,l)),l.axisModels.push(a)}}}),t}var lO=function(){function r(){this.indexList=[],this.indexMap=[]}return r.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},r}(),PSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._autoThrottle=!0,t._noTarget=!0,t._rangePropMode=["percent","percent"],t}return e.prototype.init=function(t,i,n){var a=mj(t);this.settledOption=a,this.mergeDefaultAndTheme(t,n),this._doInit(a)},e.prototype.mergeOption=function(t){var i=mj(t);_t(this.option,t,!0),_t(this.settledOption,i,!0),this._doInit(i)},e.prototype._doInit=function(t){var i=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var n=this.settledOption;N([["start","startValue"],["end","endValue"]],function(a,o){this._rangePropMode[o]==="value"&&(i[a[0]]=n[a[0]]=null)},this),this._resetTarget()},e.prototype._resetTarget=function(){var t=this.get("orient",!0),i=this._targetAxisInfoMap=ke(),n=this._fillSpecifiedTargetAxis(i);n?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(i,this._orient)),this._noTarget=!0,i.each(function(a){a.indexList.length&&(this._noTarget=!1)},this)},e.prototype._fillSpecifiedTargetAxis=function(t){var i=!1;return N(sO,function(n){var a=this.getReferringComponents(ds(n),uH);if(a.specified){i=!0;var o=new lO;N(a.models,function(s){o.add(s.componentIndex)}),t.set(n,o)}},this),i},e.prototype._fillAutoTargetAxisByOrient=function(t,i){var n=this.ecModel,a=!0;if(a){var o=i==="vertical"?"y":"x",s=n.findComponents({mainType:o+"Axis"});l(s,o)}if(a){var s=n.findComponents({mainType:"singleAxis",filter:function(c){return c.get("orient",!0)===i}});l(s,"single")}function l(u,c){var f=u[0];if(f){var h=new lO;if(h.add(f.componentIndex),t.set(c,h),a=!1,c==="x"||c==="y"){var p=f.getReferringComponents("grid",Cr).models[0];p&&N(u,function(d){f.componentIndex!==d.componentIndex&&p===d.getReferringComponents("grid",Cr).models[0]&&h.add(d.componentIndex)})}}}a&&N(sO,function(u){if(a){var c=n.findComponents({mainType:ds(u),filter:function(h){return h.get("type",!0)==="category"}});if(c[0]){var f=new lO;f.add(c[0].componentIndex),t.set(u,f),a=!1}}},this)},e.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis(function(i){!t&&(t=i)},this),t==="y"?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var i=this.ecModel.option;this.option.throttle=i.animation&&i.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(t){var i=this._rangePropMode,n=this.get("rangeMode");N([["start","startValue"],["end","endValue"]],function(a,o){var s=t[a[0]]!=null,l=t[a[1]]!=null;s&&!l?i[o]="percent":!s&&l?i[o]="value":n?i[o]=n[o]:s&&(i[o]="percent")})},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis(function(i,n){t==null&&(t=this.ecModel.getComponent(ds(i),n))},this),t},e.prototype.eachTargetAxis=function(t,i){this._targetAxisInfoMap.each(function(n,a){N(n.indexList,function(o){t.call(i,a,o)})})},e.prototype.getAxisProxy=function(t,i){var n=this.getAxisModel(t,i);if(n)return n.__dzAxisProxy},e.prototype.getAxisModel=function(t,i){var n=this._targetAxisInfoMap.get(t);if(n&&n.indexMap[i])return this.ecModel.getComponent(ds(t),i)},e.prototype.setRawRange=function(t){var i=this.option,n=this.settledOption;N([["start","startValue"],["end","endValue"]],function(a){(t[a[0]]!=null||t[a[1]]!=null)&&(i[a[0]]=n[a[0]]=t[a[0]],i[a[1]]=n[a[1]]=t[a[1]])},this),this._updateRangeUse(t)},e.prototype.setCalculatedRange=function(t){var i=this.option;N(["start","startValue","end","endValue"],function(n){i[n]=t[n]})},e.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},e.prototype.getValueRange=function(t,i){if(t==null&&i==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getDataValueWindow()}else return this.getAxisProxy(t,i).getDataValueWindow()},e.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var i,n=this._targetAxisInfoMap.keys(),a=0;a<n.length;a++)for(var o=n[a],s=this._targetAxisInfoMap.get(o),l=0;l<s.indexList.length;l++){var u=this.getAxisProxy(o,s.indexList[l]);if(u.hostedBy(this))return u;i||(i=u)}return i},e.prototype.getRangePropMode=function(){return this._rangePropMode.slice()},e.prototype.getOrient=function(){return this._orient},e.type="dataZoom",e.dependencies=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","series","toolbox"],e.defaultOption={z:4,filterMode:"filter",start:0,end:100},e}(Pt);function mj(r){var e={};return N(["start","end","startValue","endValue","throttle"],function(t){r.hasOwnProperty(t)&&(e[t]=r[t])}),e}var $f=PSe;var DSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.select",e}($f),vj=DSe;var ISe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n,a){this.dataZoomModel=t,this.ecModel=i,this.api=n},e.type="dataZoom",e}(Qt),Jv=ISe;var NSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.select",e}(Jv),gj=NSe;var $v=N,yj=Ti,USe=function(){function r(e,t,i,n){this._dimName=e,this._axisIndex=t,this.ecModel=n,this._dataZoomModel=i}return r.prototype.hostedBy=function(e){return this._dataZoomModel===e},r.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},r.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},r.prototype.getTargetSeriesModels=function(){var e=[];return this.ecModel.eachSeries(function(t){if(pj(t)){var i=ds(this._dimName),n=t.getReferringComponents(i,Cr).models[0];n&&this._axisIndex===n.componentIndex&&e.push(t)}},this),e},r.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},r.prototype.getMinMaxSpan=function(){return Qe(this._minMaxSpan)},r.prototype.calculateDataWindow=function(e){var t=this._dataExtent,i=this.getAxisModel(),n=i.axis.scale,a=this._dataZoomModel.getRangePropMode(),o=[0,100],s=[],l=[],u;$v(["start","end"],function(h,p){var d=e[h],g=e[h+"Value"];a[p]==="percent"?(d==null&&(d=o[p]),g=n.parse(rr(d,o,t))):(u=!0,g=g==null?t[p]:n.parse(g),d=rr(g,t,o)),l[p]=g==null||isNaN(g)?t[p]:g,s[p]=d==null||isNaN(d)?o[p]:d}),yj(l),yj(s);var c=this._minMaxSpan;u?f(l,s,t,o,!1):f(s,l,o,t,!0);function f(h,p,d,g,m){var v=m?"Span":"ValueSpan";Xa(0,h,d,"all",c["min"+v],c["max"+v]);for(var _=0;_<2;_++)p[_]=rr(h[_],d,g,!0),m&&(p[_]=n.parse(p[_]))}return{valueWindow:l,percentWindow:s}},r.prototype.reset=function(e){if(e===this._dataZoomModel){var t=this.getTargetSeriesModels();this._dataExtent=OSe(this,this._dimName,t),this._updateMinMaxSpan();var i=this.calculateDataWindow(e.settledOption);this._valueWindow=i.valueWindow,this._percentWindow=i.percentWindow,this._setAxisModel()}},r.prototype.filterData=function(e,t){if(e!==this._dataZoomModel)return;var i=this._dimName,n=this.getTargetSeriesModels(),a=e.get("filterMode"),o=this._valueWindow;if(a==="none")return;$v(n,function(l){var u=l.getData(),c=u.mapDimensionsAll(i);if(c.length){if(a==="weakFilter"){var f=u.getStore(),h=de(c,function(p){return u.getDimensionIndex(p)},u);u.filterSelf(function(p){for(var d,g,m,v=0;v<c.length;v++){var _=f.get(h[v],p),y=!isNaN(_),x=_<o[0],M=_>o[1];if(y&&!x&&!M)return!0;y&&(m=!0),x&&(d=!0),M&&(g=!0)}return m&&d&&g})}else $v(c,function(p){if(a==="empty")l.setData(u=u.map(p,function(g){return s(g)?g:NaN}));else{var d={};d[p]=o,u.selectRange(d)}});$v(c,function(p){u.setApproximateExtent(o,p)})}});function s(l){return l>=o[0]&&l<=o[1]}},r.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,i=this._dataExtent;$v(["min","max"],function(n){var a=t.get(n+"Span"),o=t.get(n+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?a=rr(i[0]+o,i,[0,100],!0):a!=null&&(o=rr(a,[0,100],i,!0)-i[0]),e[n+"Span"]=a,e[n+"ValueSpan"]=o},this)},r.prototype._setAxisModel=function(){var e=this.getAxisModel(),t=this._percentWindow,i=this._valueWindow;if(t){var n=Fm(i,[0,500]);n=Math.min(n,20);var a=e.axis.scale.rawExtentInfo;t[0]!==0&&a.setDeterminedMinMax("min",+i[0].toFixed(n)),t[1]!==100&&a.setDeterminedMinMax("max",+i[1].toFixed(n)),a.freeze()}},r}();function OSe(r,e,t){var i=[1/0,-1/0];$v(t,function(o){l8(i,o.getData(),e)});var n=r.getAxisModel(),a=C1(n.axis.scale,n,i).calculate();return[a.min,a.max]}var _j=USe;var FSe={getTargetSeries:function(r){function e(n){r.eachComponent("dataZoom",function(a){a.eachTargetAxis(function(o,s){var l=r.getComponent(ds(o),s);n(o,s,l,a)})})}e(function(n,a,o,s){o.__dzAxisProxy=null});var t=[];e(function(n,a,o,s){o.__dzAxisProxy||(o.__dzAxisProxy=new _j(n,a,s,r),t.push(o.__dzAxisProxy))});var i=ke();return N(t,function(n){N(n.getTargetSeriesModels(),function(a){i.set(a.uid,a)})}),i},overallReset:function(r,e){r.eachComponent("dataZoom",function(t){t.eachTargetAxis(function(i,n){t.getAxisProxy(i,n).reset(t)}),t.eachTargetAxis(function(i,n){t.getAxisProxy(i,n).filterData(t,e)})}),r.eachComponent("dataZoom",function(t){var i=t.findRepresentativeAxisProxy();if(i){var n=i.getDataPercentWindow(),a=i.getDataValueWindow();t.setCalculatedRange({start:n[0],end:n[1],startValue:a[0],endValue:a[1]})}})}},xj=FSe;function uO(r){r.registerAction("dataZoom",function(e,t){var i=dj(t,e);N(i,function(n){n.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var Sj=!1;function fd(r){Sj||(Sj=!0,r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,xj),uO(r),r.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function Mj(r){r.registerComponentModel(vj),r.registerComponentView(gj),fd(r)}var $i=function(){function r(){}return r}();var bj={};function Qf(r,e){bj[r]=e}function iE(r){return bj[r]}var BSe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(){r.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;N(this.option.feature,function(i,n){var a=iE(n);a&&(a.getDefaultOption&&(a.defaultOption=a.getDefaultOption(t)),_t(i,a.defaultOption))})},e.type="toolbox",e.layoutMode={type:"box",ignoreSize:!0},e.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},e}(Pt),wj=BSe;function Tj(r,e,t){var i=e.getBoxLayoutParams(),n=e.get("padding"),a={width:t.getWidth(),height:t.getHeight()},o=xr(i,a,n);Ws(e.get("orient"),r,e.get("itemGap"),o.width,o.height),Ef(r,i,a,n)}function nE(r,e){var t=Gs(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),r=new Tt({shape:{x:r.x-t[3],y:r.y-t[0],width:r.width+t[1]+t[3],height:r.height+t[0]+t[2],r:e.get("borderRadius")},style:i,silent:!0,z2:-1}),r}var VSe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,i,n,a){var o=this.group;if(o.removeAll(),!t.get("show"))return;var s=+t.get("itemSize"),l=t.get("orient")==="vertical",u=t.get("feature")||{},c=this._features||(this._features={}),f=[];N(u,function(d,g){f.push(g)}),new An(this._featureNames||[],f).add(h).update(h).remove(ot(h,null)).execute(),this._featureNames=f;function h(d,g){var m=f[d],v=f[g],_=u[m],y=new Zt(_,t,t.ecModel),x;if(a&&a.newTitle!=null&&a.featureName===m&&(_.title=a.newTitle),m&&!v){if(GSe(m))x={onclick:y.option.onclick,featureName:m};else{var M=iE(m);if(!M)return;x=new M}c[m]=x}else if(x=c[v],!x)return;x.uid=ts("toolbox-feature"),x.model=y,x.ecModel=i,x.api=n;var S=x instanceof $i;if(!m&&v){S&&x.dispose&&x.dispose(i,n);return}if(!y.get("show")||S&&x.unusable){S&&x.remove&&x.remove(i,n);return}p(y,x,m),y.setIconStatus=function(w,T){var C=this.option,b=this.iconPaths;C.iconStatus=C.iconStatus||{},C.iconStatus[w]=T,b[w]&&(T==="emphasis"?Bn:kn)(b[w])},x instanceof $i&&x.render&&x.render(y,i,n,a)}function p(d,g,m){var v=d.getModel("iconStyle"),_=d.getModel(["emphasis","iconStyle"]),y=g instanceof $i&&g.getIcons?g.getIcons():d.get("icon"),x=d.get("title")||{},M,S;Ce(y)?(M={},M[m]=y):M=y,Ce(x)?(S={},S[m]=x):S=x;var w=d.iconPaths={};N(M,function(T,C){var b=Pu(T,{},{x:-s/2,y:-s/2,width:s,height:s});b.setStyle(v.getItemStyle());var E=b.ensureState("emphasis");E.style=_.getItemStyle();var I=new Lt({style:{text:S[C],align:_.get("textAlign"),borderRadius:_.get("textBorderRadius"),padding:_.get("textPadding"),fill:null,font:iv({fontStyle:_.get("textFontStyle"),fontFamily:_.get("textFontFamily"),fontSize:_.get("textFontSize"),fontWeight:_.get("textFontWeight")},i)},ignore:!0});b.setTextContent(I),Vs({el:b,componentModel:t,itemName:C,formatterParamsExtra:{title:S[C]}}),b.__title=S[C],b.on("mouseover",function(){var R=_.getItemStyle(),A=l?t.get("right")==null&&t.get("left")!=="right"?"right":"left":t.get("bottom")==null&&t.get("top")!=="bottom"?"bottom":"top";I.setStyle({fill:_.get("textFill")||R.fill||R.stroke||"#000",backgroundColor:_.get("textBackgroundColor")}),b.setTextConfig({position:_.get("textPosition")||A}),I.ignore=!t.get("showTitle"),n.enterEmphasis(this)}).on("mouseout",function(){d.get(["iconStatus",C])!=="emphasis"&&n.leaveEmphasis(this),I.hide()}),(d.get(["iconStatus",C])==="emphasis"?Bn:kn)(b),o.add(b),b.on("click",Be(g.onclick,g,i,n,C)),w[C]=b})}Tj(o,t,n),o.add(nE(o.getBoundingRect(),t)),l||o.eachChild(function(d){var g=d.__title,m=d.ensureState("emphasis"),v=m.textConfig||(m.textConfig={}),_=d.getTextContent(),y=_&&_.ensureState("emphasis");if(y&&!He(y)&&g){var x=y.style||(y.style={}),M=Ll(g,Lt.makeFont(x)),S=d.x+o.x,w=d.y+o.y+s,T=!1;w+M.height>n.getHeight()&&(v.position="top",T=!0);var C=T?-5-M.height:s+10;S+M.width/2>n.getWidth()?(v.position=["100%",C],x.align="right"):S-M.width/2<0&&(v.position=[0,C],x.align="left")}})},e.prototype.updateView=function(t,i,n,a){N(this._features,function(o){o instanceof $i&&o.updateView&&o.updateView(o.model,i,n,a)})},e.prototype.remove=function(t,i){N(this._features,function(n){n instanceof $i&&n.remove&&n.remove(t,i)}),this.group.removeAll()},e.prototype.dispose=function(t,i){N(this._features,function(n){n instanceof $i&&n.dispose&&n.dispose(t,i)})},e.type="toolbox",e}(Qt);function GSe(r){return r.indexOf("my")===0}var Ej=VSe;var HSe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,i){var n=this.model,a=n.get("name")||t.get("title.0.text")||"echarts",o=i.getZr().painter.getType()==="svg",s=o?"svg":n.get("type",!0)||"png",l=i.getConnectedDataURL({type:s,backgroundColor:n.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),u=Ft.browser;if(He(MouseEvent)&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=a+"."+s,c.target="_blank",c.href=l;var f=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(f)}else if(window.navigator.msSaveOrOpenBlob||o){var h=l.split(","),p=h[0].indexOf("base64")>-1,d=o?decodeURIComponent(h[1]):h[1];p&&(d=window.atob(d));var g=a+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var m=d.length,v=new Uint8Array(m);m--;)v[m]=d.charCodeAt(m);var _=new Blob([v]);window.navigator.msSaveOrOpenBlob(_,g)}else{var y=document.createElement("iframe");document.body.appendChild(y);var x=y.contentWindow,M=x.document;M.open("image/svg+xml","replace"),M.write(d),M.close(),x.focus(),M.execCommand("SaveAs",!0,g),document.body.removeChild(y)}}else{var S=n.get("lang"),w='<body style="margin:0;"><img src="'+l+'" style="max-width:100%;" title="'+(S&&S[0]||"")+'" /></body>',T=window.open();T.document.write(w),T.document.title=a}},e.getDefaultOption=function(t){var i={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return i},e}($i),Aj=HSe;var Cj="__ec_magicType_stack__";var WSe=[["line","bar"],["stack"]],XSe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getIcons=function(){var t=this.model,i=t.get("icon"),n={};return N(t.get("type"),function(a){i[a]&&(n[a]=i[a])}),n},e.getDefaultOption=function(t){var i={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return i},e.prototype.onclick=function(t,i,n){var a=this.model,o=a.get(["seriesIndex",n]);if(Rj[n]){var s={series:[]},l=function(f){var h=f.subType,p=f.id,d=Rj[n](h,p,f,a);d&&(Ye(d,f.option),s.series.push(d));var g=f.coordinateSystem;if(g&&g.type==="cartesian2d"&&(n==="line"||n==="bar")){var m=g.getAxesByScale("ordinal")[0];if(m){var v=m.dim,_=v+"Axis",y=f.getReferringComponents(_,Cr).models[0],x=y.componentIndex;s[_]=s[_]||[];for(var M=0;M<=x;M++)s[_][x]=s[_][x]||{};s[_][x].boundaryGap=n==="bar"}}};N(WSe,function(f){dt(f,n)>=0&&N(f,function(h){a.setIconStatus(h,"normal")})}),a.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=n;n==="stack"&&(u=_t({stack:a.option.title.tiled,tiled:a.option.title.stack},a.option.title),a.get(["iconStatus",n])!=="emphasis"&&(c="tiled")),i.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},e}($i),Rj={line:function(r,e,t,i){if(r==="bar")return _t({id:e,type:"line",data:t.get("data"),stack:t.get("stack"),markPoint:t.get("markPoint"),markLine:t.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(r,e,t,i){if(r==="line")return _t({id:e,type:"bar",data:t.get("data"),stack:t.get("stack"),markPoint:t.get("markPoint"),markLine:t.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(r,e,t,i){var n=t.get("stack")===Cj;if(r==="line"||r==="bar")return i.setIconStatus("stack",n?"normal":"emphasis"),_t({id:e,stack:n?"":Cj},i.get(["option","stack"])||{},!0)}};ua({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(r,e){e.mergeOption(r.newOption)});var Lj=XSe;var oE=new Array(60).join("-"),Qv=" ";function YSe(r){var e={},t=[],i=[];return r.eachRawSeries(function(n){var a=n.coordinateSystem;if(a&&(a.type==="cartesian2d"||a.type==="polar")){var o=a.getBaseAxis();if(o.type==="category"){var s=o.dim+"_"+o.index;e[s]||(e[s]={categoryAxis:o,valueAxis:a.getOtherAxis(o),series:[]},i.push({axisDim:o.dim,axisIndex:o.index})),e[s].series.push(n)}else t.push(n)}else t.push(n)}),{seriesGroupByCategoryAxis:e,other:t,meta:i}}function qSe(r){var e=[];return N(r,function(t,i){var n=t.categoryAxis,a=t.valueAxis,o=a.dim,s=[" "].concat(de(t.series,function(p){return p.name})),l=[n.model.getCategories()];N(t.series,function(p){var d=p.getRawData();l.push(p.getRawData().mapArray(d.mapDimension(o),function(g){return g}))});for(var u=[s.join(Qv)],c=0;c<l[0].length;c++){for(var f=[],h=0;h<l.length;h++)f.push(l[h][c]);u.push(f.join(Qv))}e.push(u.join(`
  2217. `))}),e.join(`
  2218. `+oE+`
  2219. `)}function ZSe(r){return de(r,function(e){var t=e.getRawData(),i=[e.name],n=[];return t.each(t.dimensions,function(){for(var a=arguments.length,o=arguments[a-1],s=t.getName(o),l=0;l<a-1;l++)n[l]=arguments[l];i.push((s?s+Qv:"")+n.join(Qv))}),i.join(`
  2220. `)}).join(`
  2221. `+oE+`
  2222. `)}function jSe(r){var e=YSe(r);return{value:Wt([qSe(e.seriesGroupByCategoryAxis),ZSe(e.other)],function(t){return!!t.replace(/[\n\t\s]/g,"")}).join(`
  2223. `+oE+`
  2224. `),meta:e.meta}}function aE(r){return r.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function KSe(r){var e=r.slice(0,r.indexOf(`
  2225. `));if(e.indexOf(Qv)>=0)return!0}var cO=new RegExp("["+Qv+"]+","g");function JSe(r){for(var e=r.split(/\n+/g),t=aE(e.shift()).split(cO),i=[],n=de(t,function(l){return{name:l,data:[]}}),a=0;a<e.length;a++){var o=aE(e[a]).split(cO);i.push(o.shift());for(var s=0;s<o.length;s++)n[s]&&(n[s].data[a]=o[s])}return{series:n,categories:i}}function $Se(r){for(var e=r.split(/\n+/g),t=aE(e.shift()),i=[],n=0;n<e.length;n++){var a=aE(e[n]);if(a){var o=a.split(cO),s="",l=void 0,u=!1;isNaN(o[0])?(u=!0,s=o[0],o=o.slice(1),i[n]={name:s,value:[]},l=i[n].value):l=i[n]=[];for(var c=0;c<o.length;c++)l.push(+o[c]);l.length===1&&(u?i[n].value=l[0]:i[n]=l[0])}}return{name:t,data:i}}function QSe(r,e){var t=r.split(new RegExp(`
  2226. *`+oE+`
  2227. *`,"g")),i={series:[]};return N(t,function(n,a){if(KSe(n)){var o=JSe(n),s=e[a],l=s.axisDim+"Axis";s&&(i[l]=i[l]||[],i[l][s.axisIndex]={data:o.categories},i.series=i.series.concat(o.series))}else{var o=$Se(n);i.series.push(o)}}),i}var eMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,i){setTimeout(function(){i.dispatchAction({type:"hideTip"})});var n=i.getDom(),a=this.model;this._dom&&n.removeChild(this._dom);var o=document.createElement("div");o.style.cssText="position:absolute;top:0;bottom:0;left:0;right:0;padding:5px",o.style.backgroundColor=a.get("backgroundColor")||"#fff";var s=document.createElement("h4"),l=a.get("lang")||[];s.innerHTML=l[0]||a.get("title"),s.style.cssText="margin:10px 20px",s.style.color=a.get("textColor");var u=document.createElement("div"),c=document.createElement("textarea");u.style.cssText="overflow:auto";var f=a.get("optionToContent"),h=a.get("contentToOption"),p=jSe(t);if(He(f)){var d=f(i.getOption());Ce(d)?u.innerHTML=d:af(d)&&u.appendChild(d)}else{c.readOnly=a.get("readOnly");var g=c.style;g.cssText="display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none",g.color=a.get("textColor"),g.borderColor=a.get("textareaBorderColor"),g.backgroundColor=a.get("textareaColor"),c.value=p.value,u.appendChild(c)}var m=p.meta,v=document.createElement("div");v.style.cssText="position:absolute;bottom:5px;left:0;right:0";var _="float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px",y=document.createElement("div"),x=document.createElement("div");_+=";background-color:"+a.get("buttonColor"),_+=";color:"+a.get("buttonTextColor");var M=this;function S(){n.removeChild(o),M._dom=null}U0(y,"click",S),U0(x,"click",function(){if(h==null&&f!=null||h!=null&&f==null){S();return}var w;try{He(h)?w=h(u,i.getOption()):w=QSe(c.value,m)}catch(T){throw S(),new Error("Data view format error "+T)}w&&i.dispatchAction({type:"changeDataView",newOption:w}),S()}),y.innerHTML=l[1],x.innerHTML=l[2],x.style.cssText=y.style.cssText=_,!a.get("readOnly")&&v.appendChild(x),v.appendChild(y),o.appendChild(s),o.appendChild(u),o.appendChild(v),u.style.height=n.clientHeight-80+"px",n.appendChild(o),this._dom=o},e.prototype.remove=function(t,i){this._dom&&i.getDom().removeChild(this._dom)},e.prototype.dispose=function(t,i){this.remove(t,i)},e.getDefaultOption=function(t){var i={show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:"M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28",title:t.getLocaleModel().get(["toolbox","dataView","title"]),lang:t.getLocaleModel().get(["toolbox","dataView","lang"]),backgroundColor:"#fff",textColor:"#000",textareaColor:"#fff",textareaBorderColor:"#333",buttonColor:"#c23531",buttonTextColor:"#fff"};return i},e}($i);function tMe(r,e){return de(r,function(t,i){var n=e&&e[i];if(qe(n)&&!pe(n)){var a=qe(t)&&!pe(t);a||(t={value:t});var o=n.name!=null&&t.name==null;return t=Ye(t,n),o&&delete t.name,t}else return t})}ua({type:"changeDataView",event:"dataViewChanged",update:"prepareAndUpdate"},function(r,e){var t=[];N(r.newOption.series,function(i){var n=e.getSeriesByName(i.name)[0];if(!n)t.push(fe({type:"scatter"},i));else{var a=n.get("data");t.push({name:i.name,data:tMe(i.data,a)})}}),e.mergeOption(Ye({series:t},r.newOption))});var Pj=eMe;var Dj=N,Ij=vt();function Nj(r,e){var t=fO(r);Dj(e,function(i,n){for(var a=t.length-1;a>=0;a--){var o=t[a];if(o[n])break}if(a<0){var s=r.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(s){var l=s.getPercentRange();t[0][n]={dataZoomId:n,start:l[0],end:l[1]}}}}),t.push(e)}function Uj(r){var e=fO(r),t=e[e.length-1];e.length>1&&e.pop();var i={};return Dj(t,function(n,a){for(var o=e.length-1;o>=0;o--)if(n=e[o][a],n){i[a]=n;break}}),i}function Oj(r){Ij(r).snapshots=null}function Fj(r){return fO(r).length}function fO(r){var e=Ij(r);return e.snapshots||(e.snapshots=[{}]),e.snapshots}var rMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,i){Oj(t),i.dispatchAction({type:"restore",from:this.uid})},e.getDefaultOption=function(t){var i={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:t.getLocaleModel().get(["toolbox","restore","title"])};return i},e}($i);ua({type:"restore",event:"restore",update:"prepareAndUpdate"},function(r,e){e.resetOption("recreate")});var Bj=rMe;var iMe=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],nMe=function(){function r(e,t,i){var n=this;this._targetInfoList=[];var a=kj(t,e);N(aMe,function(o,s){(!i||!i.include||dt(i.include,s)>=0)&&o(a,n._targetInfoList)})}return r.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,function(i,n,a){if((i.coordRanges||(i.coordRanges=[])).push(n),!i.coordRange){i.coordRange=n;var o=hO[i.brushType](0,a,n);i.__rangeOffset={offset:Wj[i.brushType](o.values,i.range,[1,1]),xyMinMax:o.xyMinMax}}}),e},r.prototype.matchOutputRanges=function(e,t,i){N(e,function(n){var a=this.findTargetInfo(n,t);a&&a!==!0&&N(a.coordSyses,function(o){var s=hO[n.brushType](1,o,n.range,!0);i(n,s.values,o,t)})},this)},r.prototype.setInputRanges=function(e,t){N(e,function(i){var n=this.findTargetInfo(i,t);if(i.range=i.range||[],n&&n!==!0){i.panelId=n.panelId;var a=hO[i.brushType](0,n.coordSys,i.coordRange),o=i.__rangeOffset;i.range=o?Wj[i.brushType](a.values,o.offset,oMe(a.xyMinMax,o.xyMinMax)):a.values}},this)},r.prototype.makePanelOpts=function(e,t){return de(this._targetInfoList,function(i){var n=i.getPanelRect();return{panelId:i.panelId,defaultBrushType:t?t(i):null,clipPath:PT(n),isTargetByCursor:IT(n,e,i.coordSysModel),getLinearBrushOtherExtent:DT(n)}})},r.prototype.controlSeries=function(e,t,i){var n=this.findTargetInfo(e,i);return n===!0||n&&dt(n.coordSyses,t.coordinateSystem)>=0},r.prototype.findTargetInfo=function(e,t){for(var i=this._targetInfoList,n=kj(t,e),a=0;a<i.length;a++){var o=i[a],s=e.panelId;if(s){if(o.panelId===s)return o}else for(var l=0;l<Vj.length;l++)if(Vj[l](n,o))return o}return!0},r}();function pO(r){return r[0]>r[1]&&r.reverse(),r}function kj(r,e){return vf(r,e,{includeMainTypes:iMe})}var aMe={grid:function(r,e){var t=r.xAxisModels,i=r.yAxisModels,n=r.gridModels,a=ke(),o={},s={};!t&&!i&&!n||(N(t,function(l){var u=l.axis.grid.model;a.set(u.id,u),o[u.id]=!0}),N(i,function(l){var u=l.axis.grid.model;a.set(u.id,u),s[u.id]=!0}),N(n,function(l){a.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),a.each(function(l){var u=l.coordinateSystem,c=[];N(u.getCartesians(),function(f,h){(dt(t,f.getAxis("x").model)>=0||dt(i,f.getAxis("y").model)>=0)&&c.push(f)}),e.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:c[0],coordSyses:c,getPanelRect:Gj.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(r,e){N(r.geoModels,function(t){var i=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:i,coordSyses:[i],getPanelRect:Gj.geo})})}},Vj=[function(r,e){var t=r.xAxisModel,i=r.yAxisModel,n=r.gridModel;return!n&&t&&(n=t.axis.grid.model),!n&&i&&(n=i.axis.grid.model),n&&n===e.gridModel},function(r,e){var t=r.geoModel;return t&&t===e.geoModel}],Gj={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var r=this.coordSys,e=r.getBoundingRect().clone();return e.applyTransform(ks(r)),e}},hO={lineX:ot(Hj,0),lineY:ot(Hj,1),rect:function(r,e,t,i){var n=r?e.pointToData([t[0][0],t[1][0]],i):e.dataToPoint([t[0][0],t[1][0]],i),a=r?e.pointToData([t[0][1],t[1][1]],i):e.dataToPoint([t[0][1],t[1][1]],i),o=[pO([n[0],a[0]]),pO([n[1],a[1]])];return{values:o,xyMinMax:o}},polygon:function(r,e,t,i){var n=[[1/0,-1/0],[1/0,-1/0]],a=de(t,function(o){var s=r?e.pointToData(o,i):e.dataToPoint(o,i);return n[0][0]=Math.min(n[0][0],s[0]),n[1][0]=Math.min(n[1][0],s[1]),n[0][1]=Math.max(n[0][1],s[0]),n[1][1]=Math.max(n[1][1],s[1]),s});return{values:a,xyMinMax:n}}};function Hj(r,e,t,i){var n=t.getAxis(["x","y"][r]),a=pO(de([0,1],function(s){return e?n.coordToData(n.toLocalCoord(i[s]),!0):n.toGlobalCoord(n.dataToCoord(i[s]))})),o=[];return o[r]=a,o[1-r]=[NaN,NaN],{values:a,xyMinMax:o}}var Wj={lineX:ot(Xj,0),lineY:ot(Xj,1),rect:function(r,e,t){return[[r[0][0]-t[0]*e[0][0],r[0][1]-t[0]*e[0][1]],[r[1][0]-t[1]*e[1][0],r[1][1]-t[1]*e[1][1]]]},polygon:function(r,e,t){return de(r,function(i,n){return[i[0]-t[0]*e[n][0],i[1]-t[1]*e[n][1]]})}};function Xj(r,e,t,i){return[e[0]-i[r]*t[0],e[1]-i[r]*t[1]]}function oMe(r,e){var t=Yj(r),i=Yj(e),n=[t[0]/i[0],t[1]/i[1]];return isNaN(n[0])&&(n[0]=1),isNaN(n[1])&&(n[1]=1),n}function Yj(r){return r?[r[0][1]-r[0][0],r[1][1]-r[1][0]]:[NaN,NaN]}var kx=nMe;var dO=N,sMe=oH("toolbox-dataZoom_");var lMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,i,n,a){this._brushController||(this._brushController=new Gv(n.getZr()),this._brushController.on("brush",Be(this._onBrush,this)).mount()),fMe(t,i,this,a,n),cMe(t,i)},e.prototype.onclick=function(t,i,n){uMe[n].call(this)},e.prototype.remove=function(t,i){this._brushController&&this._brushController.unmount()},e.prototype.dispose=function(t,i){this._brushController&&this._brushController.dispose()},e.prototype._onBrush=function(t){var i=t.areas;if(!t.isEnd||!i.length)return;var n={},a=this.ecModel;this._brushController.updateCovers([]);var o=new kx(mO(this.model),a,{include:["grid"]});o.matchOutputRanges(i,a,function(u,c,f){if(f.type==="cartesian2d"){var h=u.brushType;h==="rect"?(s("x",f,c[0]),s("y",f,c[1])):s({lineX:"x",lineY:"y"}[h],f,c)}}),Nj(a,n),this._dispatchZoomAction(n);function s(u,c,f){var h=c.getAxis(u),p=h.model,d=l(u,p,a),g=d.findRepresentativeAxisProxy(p).getMinMaxSpan();(g.minValueSpan!=null||g.maxValueSpan!=null)&&(f=Xa(0,f.slice(),h.scale.getExtent(),0,g.minValueSpan,g.maxValueSpan)),d&&(n[d.id]={dataZoomId:d.id,startValue:f[0],endValue:f[1]})}function l(u,c,f){var h;return f.eachComponent({mainType:"dataZoom",subType:"select"},function(p){var d=p.getAxisModel(u,c.componentIndex);d&&(h=p)}),h}},e.prototype._dispatchZoomAction=function(t){var i=[];dO(t,function(n,a){i.push(Qe(n))}),i.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:i})},e.getDefaultOption=function(t){var i={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}};return i},e}($i),uMe={zoom:function(){var r=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:r})},back:function(){this._dispatchZoomAction(Uj(this.ecModel))}};function mO(r){var e={xAxisIndex:r.get("xAxisIndex",!0),yAxisIndex:r.get("yAxisIndex",!0),xAxisId:r.get("xAxisId",!0),yAxisId:r.get("yAxisId",!0)};return e.xAxisIndex==null&&e.xAxisId==null&&(e.xAxisIndex="all"),e.yAxisIndex==null&&e.yAxisId==null&&(e.yAxisIndex="all"),e}function cMe(r,e){r.setIconStatus("back",Fj(e)>1?"emphasis":"normal")}function fMe(r,e,t,i,n){var a=t._isZoomActive;i&&i.type==="takeGlobalCursor"&&(a=i.key==="dataZoomSelect"?i.dataZoomSelectActive:!1),t._isZoomActive=a,r.setIconStatus("zoom",a?"emphasis":"normal");var o=new kx(mO(r),e,{include:["grid"]}),s=o.makePanelOpts(n,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});t._brushController.setPanels(s).enableBrush(a&&s.length?{brushType:"auto",brushStyle:r.getModel("brushStyle").getItemStyle()}:!1)}A5("dataZoom",function(r){var e=r.getComponent("toolbox",0),t=["feature","dataZoom"];if(!e||e.get(t)==null)return;var i=e.getModel(t),n=[],a=mO(i),o=vf(r,a);dO(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),dO(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,c){var f=l.componentIndex,h={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:sMe+u+f};h[c]=f,n.push(h)}return n});var qj=lMe;function vO(r){r.registerComponentModel(wj),r.registerComponentView(Ej),Qf("saveAsImage",Aj),Qf("magicType",Lj),Qf("dataView",Pj),Qf("dataZoom",qj),Qf("restore",Bj),It(Mj)}var hMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(Pt),Zj=hMe;function sE(r){var e=r.get("confine");return e!=null?!!e:r.get("renderMode")==="richText"}function jj(r){if(Ft.domSupported){for(var e=document.documentElement.style,t=0,i=r.length;t<i;t++)if(r[t]in e)return r[t]}}var gO=jj(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Kj=jj(["webkitTransition","transition","OTransition","MozTransition","msTransition"]);function yO(r,e){if(!r)return e;e=Tw(e,!0);var t=r.indexOf(e);return r=t===-1?e:"-"+r.slice(0,t)+"-"+e,r.toLowerCase()}function Jj(r,e){var t=r.currentStyle||document.defaultView&&document.defaultView.getComputedStyle(r);return t?e?t[e]:t:null}var pMe=yO(Kj,"transition"),_O=yO(gO,"transform"),dMe="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(Ft.transform3dSupported?"will-change:transform;":"");function mMe(r){return r=r==="left"?"right":r==="right"?"left":r==="top"?"bottom":"top",r}function vMe(r,e,t){if(!Ce(t)||t==="inside")return"";var i=r.get("backgroundColor"),n=r.get("borderWidth");e=Hs(e);var a=mMe(t),o=Math.max(Math.round(n)*1.5,6),s="",l=_O+":",u;dt(["left","right"],a)>-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=a==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=a==="top"?225:45)+"deg)");var c=u*Math.PI/180,f=o+n,h=f*Math.abs(Math.cos(c))+f*Math.abs(Math.sin(c)),p=Math.round(((h-Math.SQRT2*n)/2+Math.SQRT2*n-(h-f)/2)*100)/100;s+=";"+a+":-"+p+"px";var d=e+" solid "+n+"px;",g=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+d,"border-right:"+d,"background-color:"+i+";"];return'<div style="'+g.join("")+'"></div>'}function gMe(r,e){var t="cubic-bezier(0.23,1,0.32,1)",i=" "+r/2+"s "+t,n="opacity"+i+",visibility"+i;return e||(i=" "+r+"s "+t,n+=Ft.transformSupported?","+_O+i:",left"+i+",top"+i),pMe+":"+n}function $j(r,e,t){var i=r.toFixed(0)+"px",n=e.toFixed(0)+"px";if(!Ft.transformSupported)return t?"top:"+n+";left:"+i+";":[["top",n],["left",i]];var a=Ft.transform3dSupported,o="translate"+(a?"3d":"")+"("+i+","+n+(a?",0":"")+")";return t?"top:0;left:0;"+_O+":"+o+";":[["top",0],["left",0],[gO,o]]}function yMe(r){var e=[],t=r.get("fontSize"),i=r.getTextColor();i&&e.push("color:"+i),e.push("font:"+r.getFont()),t&&e.push("line-height:"+Math.round(t*3/2)+"px");var n=r.get("textShadowColor"),a=r.get("textShadowBlur")||0,o=r.get("textShadowOffsetX")||0,s=r.get("textShadowOffsetY")||0;return n&&a&&e.push("text-shadow:"+o+"px "+s+"px "+a+"px "+n),N(["decoration","align"],function(l){var u=r.get(l);u&&e.push("text-"+l+":"+u)}),e.join(";")}function _Me(r,e,t){var i=[],n=r.get("transitionDuration"),a=r.get("backgroundColor"),o=r.get("shadowBlur"),s=r.get("shadowColor"),l=r.get("shadowOffsetX"),u=r.get("shadowOffsetY"),c=r.getModel("textStyle"),f=Yw(r,"html"),h=l+"px "+u+"px "+o+"px "+s;return i.push("box-shadow:"+h),e&&n&&i.push(gMe(n,t)),a&&i.push("background-color:"+a),N(["width","color","radius"],function(p){var d="border-"+p,g=Tw(d),m=r.get(g);m!=null&&i.push(d+":"+m+(p==="color"?"":"px"))}),i.push(yMe(c)),f!=null&&i.push("padding:"+Gs(f).join("px ")+"px"),i.join(";")+";"}function Qj(r,e,t,i,n){var a=e&&e.painter;if(t){var o=a&&a.getViewportRoot();o&&HV(r,o,t,i,n)}else{r[0]=i,r[1]=n;var s=a&&a.getViewportRootOffset();s&&(r[0]+=s.offsetLeft,r[1]+=s.offsetTop)}r[2]=r[0]/e.getWidth(),r[3]=r[1]/e.getHeight()}var xMe=function(){function r(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,Ft.wxa)return null;var i=document.createElement("div");i.domBelongToZr=!0,this.el=i;var n=this._zr=e.getZr(),a=t.appendTo,o=a&&(Ce(a)?document.querySelector(a):af(a)?a:He(a)&&a(e.getDom()));Qj(this._styleCoord,n,o,e.getWidth()/2,e.getHeight()/2),(o||e.getDom()).appendChild(i),this._api=e,this._container=o;var s=this;i.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},i.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=n.handler,c=n.painter.getViewportRoot();Ta(c,l,!0),u.dispatch("mousemove",l)}},i.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return r.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),i=Jj(t,"position"),n=t.style;n.position!=="absolute"&&i!=="absolute"&&(n.position="relative")}var a=e.get("alwaysShowContent");a&&this._moveIfResized(),this._alwaysShowContent=a,this.el.className=e.get("className")||""},r.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var i=this.el,n=i.style,a=this._styleCoord;i.innerHTML?n.cssText=dMe+_Me(e,!this._firstShow,this._longHide)+$j(a[0],a[1],!0)+("border-color:"+Hs(t)+";")+(e.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):n.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},r.prototype.setContent=function(e,t,i,n,a){var o=this.el;if(e==null){o.innerHTML="";return}var s="";if(Ce(a)&&i.get("trigger")==="item"&&!sE(i)&&(s=vMe(i,n,a)),Ce(e))o.innerHTML=e+s;else if(e){o.innerHTML="",pe(e)||(e=[e]);for(var l=0;l<e.length;l++)af(e[l])&&e[l].parentNode!==o&&o.appendChild(e[l]);if(s&&o.childNodes.length){var u=document.createElement("div");u.innerHTML=s,o.appendChild(u)}}},r.prototype.setEnterable=function(e){this._enterable=e},r.prototype.getSize=function(){var e=this.el;return[e.offsetWidth,e.offsetHeight]},r.prototype.moveTo=function(e,t){var i=this._styleCoord;if(Qj(i,this._zr,this._container,e,t),i[0]!=null&&i[1]!=null){var n=this.el.style,a=$j(i[0],i[1]);N(a,function(o){n[o[0]]=o[1]})}},r.prototype._moveIfResized=function(){var e=this._styleCoord[2],t=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),t*this._zr.getHeight())},r.prototype.hide=function(){var e=this,t=this.el.style;t.visibility="hidden",t.opacity="0",Ft.transform3dSupported&&(t.willChange=""),this._show=!1,this._longHideTimeout=setTimeout(function(){return e._longHide=!0},500)},r.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(Be(this.hide,this),e)):this.hide())},r.prototype.isShow=function(){return this._show},r.prototype.dispose=function(){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var e=this.el.parentNode;e&&e.removeChild(this.el),this.el=this._container=null},r}(),eK=xMe;var SMe=function(){function r(e){this._show=!1,this._styleCoord=[0,0,0,0],this._alwaysShowContent=!1,this._enterable=!0,this._zr=e.getZr(),rK(this._styleCoord,this._zr,e.getWidth()/2,e.getHeight()/2)}return r.prototype.update=function(e){var t=e.get("alwaysShowContent");t&&this._moveIfResized(),this._alwaysShowContent=t},r.prototype.show=function(){this._hideTimeout&&clearTimeout(this._hideTimeout),this.el.show(),this._show=!0},r.prototype.setContent=function(e,t,i,n,a){var o=this;qe(e)&&ur(""),this.el&&this._zr.remove(this.el);var s=i.getModel("textStyle");this.el=new Lt({style:{rich:t.richTextStyles,text:e,lineHeight:22,borderWidth:1,borderColor:n,textShadowColor:s.get("textShadowColor"),fill:i.get(["textStyle","color"]),padding:Yw(i,"richText"),verticalAlign:"top",align:"left"},z:i.get("z")}),N(["backgroundColor","borderRadius","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"],function(u){o.el.style[u]=i.get(u)}),N(["textShadowBlur","textShadowOffsetX","textShadowOffsetY"],function(u){o.el.style[u]=s.get(u)||0}),this._zr.add(this.el);var l=this;this.el.on("mouseover",function(){l._enterable&&(clearTimeout(l._hideTimeout),l._show=!0),l._inContent=!0}),this.el.on("mouseout",function(){l._enterable&&l._show&&l.hideLater(l._hideDelay),l._inContent=!1})},r.prototype.setEnterable=function(e){this._enterable=e},r.prototype.getSize=function(){var e=this.el,t=this.el.getBoundingRect(),i=tK(e.style);return[t.width+i.left+i.right,t.height+i.top+i.bottom]},r.prototype.moveTo=function(e,t){var i=this.el;if(i){var n=this._styleCoord;rK(n,this._zr,e,t),e=n[0],t=n[1];var a=i.style,o=eh(a.borderWidth||0),s=tK(a);i.x=e+o+s.left,i.y=t+o+s.top,i.markRedraw()}},r.prototype._moveIfResized=function(){var e=this._styleCoord[2],t=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),t*this._zr.getHeight())},r.prototype.hide=function(){this.el&&this.el.hide(),this._show=!1},r.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(Be(this.hide,this),e)):this.hide())},r.prototype.isShow=function(){return this._show},r.prototype.dispose=function(){this._zr.remove(this.el)},r}();function eh(r){return Math.max(0,r)}function tK(r){var e=eh(r.shadowBlur||0),t=eh(r.shadowOffsetX||0),i=eh(r.shadowOffsetY||0);return{left:eh(e-t),right:eh(e+t),top:eh(e-i),bottom:eh(e+i)}}function rK(r,e,t,i){r[0]=t,r[1]=i,r[2]=r[0]/e.getWidth(),r[3]=r[1]/e.getHeight()}var iK=SMe;var MMe=new Tt({shape:{x:-1,y:-1,width:2,height:2}}),bMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){if(!(Ft.node||!i.getDom())){var n=t.getComponent("tooltip"),a=this._renderMode=fH(n.get("renderMode"));this._tooltipContent=a==="richText"?new iK(i):new eK(i,{appendTo:n.get("appendToBody",!0)?"body":n.get("appendTo",!0)})}},e.prototype.render=function(t,i,n){if(!(Ft.node||!n.getDom())){this.group.removeAll(),this._tooltipModel=t,this._ecModel=i,this._api=n;var a=this._tooltipContent;a.update(t),a.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow(),this._renderMode!=="richText"&&t.get("transitionDuration")?as(this,"_updatePosition",50,"fixRate"):zu(this,"_updatePosition")}},e.prototype._initGlobalListener=function(){var t=this._tooltipModel,i=t.get("triggerOn");ZT("itemTooltip",this._api,Be(function(n,a,o){i!=="none"&&(i.indexOf(n)>=0?this._tryShow(a,o):n==="leave"&&this._hide(o))},this))},e.prototype._keepShow=function(){var t=this._tooltipModel,i=this._ecModel,n=this._api,a=t.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&a!=="none"&&a!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&o.manuallyShowTip(t,i,n,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},e.prototype.manuallyShowTip=function(t,i,n,a){if(!(a.from===this.uid||Ft.node||!n.getDom())){var o=nK(a,n);this._ticket="";var s=a.dataByCoordSys,l=AMe(a,i,n);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:a.position,positionDefault:"bottom"},o)}else if(a.tooltip&&a.x!=null&&a.y!=null){var c=MMe;c.x=a.x,c.y=a.y,c.update(),rt(c).tooltipConfig={name:null,option:a.tooltip},this._tryShow({offsetX:a.x,offsetY:a.y,target:c},o)}else if(s)this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,dataByCoordSys:s,tooltipOption:a.tooltipOption},o);else if(a.seriesIndex!=null){if(this._manuallyAxisShowTip(t,i,n,a))return;var f=zx(a,i),h=f.point[0],p=f.point[1];h!=null&&p!=null&&this._tryShow({offsetX:h,offsetY:p,target:f.el,position:a.position,positionDefault:"bottom"},o)}else a.x!=null&&a.y!=null&&(n.dispatchAction({type:"updateAxisPointer",x:a.x,y:a.y}),this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,target:n.getZr().findHover(a.x,a.y).target},o))}},e.prototype.manuallyHideTip=function(t,i,n,a){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,a.from!==this.uid&&this._hide(nK(a,n))},e.prototype._manuallyAxisShowTip=function(t,i,n,a){var o=a.seriesIndex,s=a.dataIndex,l=i.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=i.getSeriesByIndex(o);if(u){var c=u.getData(),f=Vx([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(f.get("trigger")==="axis")return n.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:a.position}),!0}}},e.prototype._tryShow=function(t,i){var n=t.target,a=this._tooltipModel;if(a){this._lastX=t.offsetX,this._lastY=t.offsetY;var o=t.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,t);else if(n){var s=rt(n);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,u;Ys(n,function(c){if(rt(c).dataIndex!=null)return l=c,!0;if(rt(c).tooltipConfig!=null)return u=c,!0},!0),l?this._showSeriesItemTooltip(t,l,i):u?this._showComponentItemTooltip(t,u,i):this._hide(i)}else this._lastDataByCoordSys=null,this._hide(i)}},e.prototype._showOrMove=function(t,i){var n=t.get("showDelay");i=Be(i,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(i,n):i()},e.prototype._showAxisTooltip=function(t,i){var n=this._ecModel,a=this._tooltipModel,o=[i.offsetX,i.offsetY],s=Vx([i.tooltipOption],a),l=this._renderMode,u=[],c=Or("section",{blocks:[],noHeader:!0}),f=[],h=new qw;N(t,function(_){N(_.dataByAxis,function(y){var x=n.getComponent(y.axisDim+"Axis",y.axisIndex),M=y.value;if(!(!x||M==null)){var S=XU(M,x.axis,n,y.seriesDataIndices,y.valueLabelOpt),w=Or("section",{header:S,noHeader:!Yi(S),sortBlocks:!0,blocks:[]});c.blocks.push(w),N(y.seriesDataIndices,function(T){var C=n.getSeriesByIndex(T.seriesIndex),b=T.dataIndexInside,E=C.getDataParams(b);if(!(E.dataIndex<0)){E.axisDim=y.axisDim,E.axisIndex=y.axisIndex,E.axisType=y.axisType,E.axisId=y.axisId,E.axisValue=ox(x.axis,{value:M}),E.axisValueLabel=S,E.marker=h.makeTooltipMarker("item",Hs(E.color),l);var I=yD(C.formatTooltip(b,!0,null)),R=I.frag;if(R){var A=Vx([C],a).get("valueFormatter");w.blocks.push(A?fe({valueFormatter:A},R):R)}I.text&&f.push(I.text),u.push(E)}})}})}),c.blocks.reverse(),f.reverse();var p=i.position,d=s.get("order"),g=TD(c,h,l,d,n.get("useUTC"),s.get("textStyle"));g&&f.unshift(g);var m=l==="richText"?`
  2228. `:"<br/>",v=f.join(m);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(t,u)?this._updatePosition(s,p,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,v,u,Math.random()+"",o[0],o[1],p,null,h)})},e.prototype._showSeriesItemTooltip=function(t,i,n){var a=this._ecModel,o=rt(i),s=o.seriesIndex,l=a.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,f=o.dataType,h=u.getData(f),p=this._renderMode,d=t.positionDefault,g=Vx([h.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),m=g.get("trigger");if(!(m!=null&&m!=="item")){var v=u.getDataParams(c,f),_=new qw;v.marker=_.makeTooltipMarker("item",Hs(v.color),p);var y=yD(u.formatTooltip(c,!1,f)),x=g.get("order"),M=g.get("valueFormatter"),S=y.frag,w=S?TD(M?fe({valueFormatter:M},S):S,_,p,x,a.get("useUTC"),g.get("textStyle")):y.text,T="item_"+u.name+"_"+c;this._showOrMove(g,function(){this._showTooltipContent(g,w,v,T,t.offsetX,t.offsetY,t.position,t.target,_)}),n({type:"showTip",dataIndexInside:c,dataIndex:h.getRawIndex(c),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,i,n){var a=rt(i),o=a.tooltipConfig,s=o.option||{};if(Ce(s)){var l=s;s={content:l,formatter:l}}var u=[s],c=this._ecModel.getComponent(a.componentMainType,a.componentIndex);c&&u.push(c),u.push({formatter:s.content});var f=t.positionDefault,h=Vx(u,this._tooltipModel,f?{position:f}:null),p=h.get("content"),d=Math.random()+"",g=new qw;this._showOrMove(h,function(){var m=Qe(h.get("formatterParams")||{});this._showTooltipContent(h,p,m,d,t.offsetX,t.offsetY,t.position,i,g)}),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,i,n,a,o,s,l,u,c){if(this._ticket="",!(!t.get("showContent")||!t.get("show"))){var f=this._tooltipContent;f.setEnterable(t.get("enterable"));var h=t.get("formatter");l=l||t.get("position");var p=i,d=this._getNearestPoint([o,s],n,t.get("trigger"),t.get("borderColor")),g=d.color;if(h)if(Ce(h)){var m=t.ecModel.get("useUTC"),v=pe(n)?n[0]:n,_=v&&v.axisType&&v.axisType.indexOf("time")>=0;p=h,_&&(p=Bp(v.axisValue,p,m)),p=Aw(p,n,!0)}else if(He(h)){var y=Be(function(x,M){x===this._ticket&&(f.setContent(M,c,t,g,l),this._updatePosition(t,l,o,s,f,n,u))},this);this._ticket=a,p=h(n,a,y)}else p=h;f.setContent(p,c,t,g,l),f.show(t,g),this._updatePosition(t,l,o,s,f,n,u)}},e.prototype._getNearestPoint=function(t,i,n,a){if(n==="axis"||pe(i))return{color:a||(this._renderMode==="html"?"#fff":"none")};if(!pe(i))return{color:a||i.color||i.borderColor}},e.prototype._updatePosition=function(t,i,n,a,o,s,l){var u=this._api.getWidth(),c=this._api.getHeight();i=i||t.get("position");var f=o.getSize(),h=t.get("align"),p=t.get("verticalAlign"),d=l&&l.getBoundingRect().clone();if(l&&d.applyTransform(l.transform),He(i)&&(i=i([n,a],s,o.el,d,{viewSize:[u,c],contentSize:f.slice()})),pe(i))n=Fe(i[0],u),a=Fe(i[1],c);else if(qe(i)){var g=i;g.width=f[0],g.height=f[1];var m=xr(g,{width:u,height:c});n=m.x,a=m.y,h=null,p=null}else if(Ce(i)&&l){var v=EMe(i,d,f,t.get("borderWidth"));n=v[0],a=v[1]}else{var v=wMe(n,a,o,u,c,h?null:20,p?null:20);n=v[0],a=v[1]}if(h&&(n-=aK(h)?f[0]/2:h==="right"?f[0]:0),p&&(a-=aK(p)?f[1]/2:p==="bottom"?f[1]:0),sE(t)){var v=TMe(n,a,o,u,c);n=v[0],a=v[1]}o.moveTo(n,a)},e.prototype._updateContentNotChangedOnAxis=function(t,i){var n=this._lastDataByCoordSys,a=this._cbParamsList,o=!!n&&n.length===t.length;return o&&N(n,function(s,l){var u=s.dataByAxis||[],c=t[l]||{},f=c.dataByAxis||[];o=o&&u.length===f.length,o&&N(u,function(h,p){var d=f[p]||{},g=h.seriesDataIndices||[],m=d.seriesDataIndices||[];o=o&&h.value===d.value&&h.axisType===d.axisType&&h.axisId===d.axisId&&g.length===m.length,o&&N(g,function(v,_){var y=m[_];o=o&&v.seriesIndex===y.seriesIndex&&v.dataIndex===y.dataIndex}),a&&N(h.seriesDataIndices,function(v){var _=v.seriesIndex,y=i[_],x=a[_];y&&x&&x.data!==y.data&&(o=!1)})})}),this._lastDataByCoordSys=t,this._cbParamsList=i,!!o},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,i){Ft.node||!i.getDom()||(zu(this,"_updatePosition"),this._tooltipContent.dispose(),Fx("itemTooltip",i))},e.type="tooltip",e}(Qt);function Vx(r,e,t){var i=e.ecModel,n;t?(n=new Zt(t,i,i),n=new Zt(e.option,n,i)):n=e;for(var a=r.length-1;a>=0;a--){var o=r[a];o&&(o instanceof Zt&&(o=o.get("tooltip",!0)),Ce(o)&&(o={formatter:o}),o&&(n=new Zt(o,n,i)))}return n}function nK(r,e){return r.dispatchAction||Be(e.dispatchAction,e)}function wMe(r,e,t,i,n,a,o){var s=t.getSize(),l=s[0],u=s[1];return a!=null&&(r+l+a+2>i?r-=l+a:r+=a),o!=null&&(e+u+o>n?e-=u+o:e+=o),[r,e]}function TMe(r,e,t,i,n){var a=t.getSize(),o=a[0],s=a[1];return r=Math.min(r+o,i)-o,e=Math.min(e+s,n)-s,r=Math.max(r,0),e=Math.max(e,0),[r,e]}function EMe(r,e,t,i){var n=t[0],a=t[1],o=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,c=e.height;switch(r){case"inside":s=e.x+u/2-n/2,l=e.y+c/2-a/2;break;case"top":s=e.x+u/2-n/2,l=e.y-a-o;break;case"bottom":s=e.x+u/2-n/2,l=e.y+c+o;break;case"left":s=e.x-n-o,l=e.y+c/2-a/2;break;case"right":s=e.x+u+o,l=e.y+c/2-a/2}return[s,l]}function aK(r){return r==="center"||r==="middle"}function AMe(r,e,t){var i=n_(r).queryOptionMap,n=i.keys()[0];if(!(!n||n==="series")){var a=gf(e,n,i.get(n),{useDefault:!1,enableAll:!1,enableNone:!1}),o=a.models[0];if(o){var s=t.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=rt(u).tooltipConfig;if(c&&c.name===r.name)return l=u,!0}),l)return{componentMainType:n,componentIndex:o.componentIndex,el:l}}}}var oK=bMe;function xO(r){It(il),r.registerComponentModel(Zj),r.registerComponentView(oK),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Ir),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Ir)}var CMe=["rect","polygon","keep","clear"];function SO(r,e){var t=Jt(r?r.brush:[]);if(t.length){var i=[];N(t,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(i=i.concat(u))});var n=r&&r.toolbox;pe(n)&&(n=n[0]),n||(n={feature:{}},r.toolbox=[n]);var a=n.feature||(n.feature={}),o=a.brush||(a.brush={}),s=o.type||(o.type=[]);s.push.apply(s,i),RMe(s),e&&!s.length&&s.push.apply(s,CMe)}}function RMe(r){var e={};N(r,function(t){e[t]=1}),r.length=0,N(e,function(t,i){r.push(i)})}var sK=N;function lK(r){if(r){for(var e in r)if(r.hasOwnProperty(e))return!0}}function Gx(r,e,t){var i={};return sK(e,function(a){var o=i[a]=n();sK(r[a],function(s,l){if(pi.isValidType(l)){var u={type:l,visual:s};t&&t(u,a),o[l]=new pi(u),l==="opacity"&&(u=Qe(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new pi(u))}})}),i;function n(){var a=function(){};a.prototype.__hidden=a.prototype;var o=new a;return o}}function lE(r,e,t){var i;N(t,function(n){e.hasOwnProperty(n)&&lK(e[n])&&(i=!0)}),i&&N(t,function(n){e.hasOwnProperty(n)&&lK(e[n])?r[n]=Qe(e[n]):delete r[n]})}function uK(r,e,t,i,n,a){var o={};N(r,function(f){var h=pi.prepareVisualTypes(e[f]);o[f]=h});var s;function l(f){return H_(t,s,f)}function u(f,h){DD(t,s,f,h)}a==null?t.each(c):t.each([a],c);function c(f,h){s=a==null?f:h;var p=t.getRawDataItem(s);if(!(p&&p.visualMap===!1))for(var d=i.call(n,f),g=e[d],m=o[d],v=0,_=m.length;v<_;v++){var y=m[v];g[y]&&g[y].applyVisual(f,l,u)}}}function cK(r,e,t,i){var n={};return N(r,function(a){var o=pi.prepareVisualTypes(e[a]);n[a]=o}),{progress:function(o,s){var l;i!=null&&(l=s.getDimensionIndex(i));function u(M){return H_(s,f,M)}function c(M,S){DD(s,f,M,S)}for(var f,h=s.getStore();(f=o.next())!=null;){var p=s.getRawDataItem(f);if(!(p&&p.visualMap===!1))for(var d=i!=null?h.get(l,f):f,g=t(d),m=e[g],v=n[g],_=0,y=v.length;_<y;_++){var x=v[_];m[x]&&m[x].applyVisual(d,u,c)}}}}}function pK(r){var e=r.brushType,t={point:function(i){return fK[e].point(i,t,r)},rect:function(i){return fK[e].rect(i,t,r)}};return t}var fK={lineX:hK(0),lineY:hK(1),rect:{point:function(r,e,t){return r&&t.boundingRect.contain(r[0],r[1])},rect:function(r,e,t){return r&&t.boundingRect.intersect(r)}},polygon:{point:function(r,e,t){return r&&t.boundingRect.contain(r[0],r[1])&&Bu(t.range,r[0],r[1])},rect:function(r,e,t){var i=t.range;if(!r||i.length<=1)return!1;var n=r.x,a=r.y,o=r.width,s=r.height,l=i[0];if(Bu(i,n,a)||Bu(i,n+o,a)||Bu(i,n,a+s)||Bu(i,n+o,a+s)||lt.create(r).contain(l[0],l[1])||rv(n,a,n+o,a,i)||rv(n,a,n,a+s,i)||rv(n+o,a,n+o,a+s,i)||rv(n,a+s,n+o,a+s,i))return!0}}};function hK(r){var e=["x","y"],t=["width","height"];return{point:function(i,n,a){if(i){var o=a.range,s=i[r];return Hx(s,o)}},rect:function(i,n,a){if(i){var o=a.range,s=[i[e[r]],i[e[r]]+i[t[r]]];return s[1]<s[0]&&s.reverse(),Hx(s[0],o)||Hx(s[1],o)||Hx(o[0],s)||Hx(o[1],s)}}}}function Hx(r,e){return e[0]<=r&&r<=e[1]}var dK=["inBrush","outOfBrush"],MO="__ecBrushSelect",bO="__ecInBrushSelectEvent";function wO(r){r.eachComponent({mainType:"brush"},function(e){var t=e.brushTargetManager=new kx(e.option,r);t.setInputRanges(e.areas,r)})}function TO(r,e,t){var i=[],n,a;r.eachComponent({mainType:"brush"},function(o){t&&t.type==="takeGlobalCursor"&&o.setBrushOption(t.key==="brush"?t.brushOption:{brushType:!1})}),wO(r),r.eachComponent({mainType:"brush"},function(o,s){var l={brushId:o.id,brushIndex:s,brushName:o.name,areas:Qe(o.areas),selected:[]};i.push(l);var u=o.option,c=u.brushLink,f=[],h=[],p=[],d=!1;s||(n=u.throttleType,a=u.throttleDelay);var g=de(o.areas,function(M){var S=IMe[M.brushType],w=Ye({boundingRect:S?S(M):void 0},M);return w.selectors=pK(w),w}),m=Gx(o.option,dK,function(M){M.mappingMethod="fixed"});pe(c)&&N(c,function(M){f[M]=1});function v(M){return c==="all"||!!f[M]}function _(M){return!!M.length}r.eachSeries(function(M,S){var w=p[S]=[];M.subType==="parallel"?y(M,S):x(M,S,w)});function y(M,S){var w=M.coordinateSystem;d=d||w.hasAxisBrushed(),v(S)&&w.eachActiveState(M.getData(),function(T,C){T==="active"&&(h[C]=1)})}function x(M,S,w){if(!(!M.brushSelector||DMe(o,S))&&(N(g,function(C){o.brushTargetManager.controlSeries(C,M,r)&&w.push(C),d=d||_(w)}),v(S)&&_(w))){var T=M.getData();T.each(function(C){mK(M,w,T,C)&&(h[C]=1)})}}r.eachSeries(function(M,S){var w={seriesId:M.id,seriesIndex:S,seriesName:M.name,dataIndex:[]};l.selected.push(w);var T=p[S],C=M.getData(),b=v(S)?function(E){return h[E]?(w.dataIndex.push(C.getRawIndex(E)),"inBrush"):"outOfBrush"}:function(E){return mK(M,T,C,E)?(w.dataIndex.push(C.getRawIndex(E)),"inBrush"):"outOfBrush"};(v(S)?d:_(T))&&uK(dK,m,C,b)})}),LMe(e,n,a,i,t)}function LMe(r,e,t,i,n){if(n){var a=r.getZr();if(!a[bO]){a[MO]||(a[MO]=PMe);var o=as(a,MO,t,e);o(r,i)}}}function PMe(r,e){if(!r.isDisposed()){var t=r.getZr();t[bO]=!0,r.dispatchAction({type:"brushSelect",batch:e}),t[bO]=!1}}function mK(r,e,t,i){for(var n=0,a=e.length;n<a;n++){var o=e[n];if(r.brushSelector(i,t,o.selectors,o))return!0}}function DMe(r,e){var t=r.option.seriesIndex;return t!=null&&t!=="all"&&(pe(t)?dt(t,e)<0:e!==t)}var IMe={rect:function(r){return vK(r.range)},polygon:function(r){for(var e,t=r.range,i=0,n=t.length;i<n;i++){e=e||[[1/0,-1/0],[1/0,-1/0]];var a=t[i];a[0]<e[0][0]&&(e[0][0]=a[0]),a[0]>e[0][1]&&(e[0][1]=a[0]),a[1]<e[1][0]&&(e[1][0]=a[1]),a[1]>e[1][1]&&(e[1][1]=a[1])}return e&&vK(e)}};function vK(r){return new lt(r[0][0],r[1][0],r[0][1]-r[0][0],r[1][1]-r[1][0])}var NMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){this.ecModel=t,this.api=i,this.model,(this._brushController=new Gv(i.getZr())).on("brush",Be(this._onBrush,this)).mount()},e.prototype.render=function(t,i,n,a){this.model=t,this._updateController(t,i,n,a)},e.prototype.updateTransform=function(t,i,n,a){wO(i),this._updateController(t,i,n,a)},e.prototype.updateVisual=function(t,i,n,a){this.updateTransform(t,i,n,a)},e.prototype.updateView=function(t,i,n,a){this._updateController(t,i,n,a)},e.prototype._updateController=function(t,i,n,a){(!a||a.$from!==t.id)&&this._brushController.setPanels(t.brushTargetManager.makePanelOpts(n)).enableBrush(t.brushOption).updateCovers(t.areas.slice())},e.prototype.dispose=function(){this._brushController.dispose()},e.prototype._onBrush=function(t){var i=this.model.id,n=this.model.brushTargetManager.setOutputRanges(t.areas,this.ecModel);(!t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:i,areas:Qe(n),$from:i}),t.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:i,areas:Qe(n),$from:i})},e.type="brush",e}(Qt),gK=NMe;var UMe="#ddd",OMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.areas=[],t.brushOption={},t}return e.prototype.optionUpdated=function(t,i){var n=this.option;!i&&lE(n,t,["inBrush","outOfBrush"]);var a=n.inBrush=n.inBrush||{};n.outOfBrush=n.outOfBrush||{color:UMe},a.hasOwnProperty("liftZ")||(a.liftZ=5)},e.prototype.setAreas=function(t){t&&(this.areas=de(t,function(i){return yK(this.option,i)},this))},e.prototype.setBrushOption=function(t){this.brushOption=yK(this.option,t),this.brushType=this.brushOption.brushType},e.type="brush",e.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],e.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(210,219,238,0.3)",borderColor:"#D2DBEE"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},e}(Pt);function yK(r,e){return _t({brushType:r.brushType,brushMode:r.brushMode,transformable:r.transformable,brushStyle:new Zt(r.brushStyle).getItemStyle(),removeOnClick:r.removeOnClick,z:r.z},e,!0)}var _K=OMe;var FMe=["rect","polygon","lineX","lineY","keep","clear"],zMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,i,n){var a,o,s;i.eachComponent({mainType:"brush"},function(l){a=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=a,this._brushMode=o,N(t.get("type",!0),function(l){t.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===a)?"emphasis":"normal")})},e.prototype.updateView=function(t,i,n){this.render(t,i,n)},e.prototype.getIcons=function(){var t=this.model,i=t.get("icon",!0),n={};return N(t.get("type",!0),function(a){i[a]&&(n[a]=i[a])}),n},e.prototype.onclick=function(t,i,n){var a=this._brushType,o=this._brushMode;n==="clear"?(i.dispatchAction({type:"axisAreaSelect",intervals:[]}),i.dispatchAction({type:"brush",command:"clear",areas:[]})):i.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:n==="keep"?a:a===n?!1:n,brushMode:n==="keep"?o==="multiple"?"single":"multiple":o}})},e.getDefaultOption=function(t){var i={show:!0,type:FMe.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:t.getLocaleModel().get(["toolbox","brush","title"])};return i},e}($i),xK=zMe;function EO(r){r.registerComponentView(gK),r.registerComponentModel(_K),r.registerPreprocessor(SO),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,TO),r.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(e,t){t.eachComponent({mainType:"brush",query:e},function(i){i.setAreas(e.areas)})}),r.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},Ir),r.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},Ir),Qf("brush",xK)}var BMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(Pt),kMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,n){if(this.group.removeAll(),!!t.get("show")){var a=this.group,o=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),u=ft(t.get("textBaseline"),t.get("textVerticalAlign")),c=new Lt({style:fr(o,{text:t.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),f=c.getBoundingRect(),h=t.get("subtext"),p=new Lt({style:fr(s,{text:h,fill:s.getTextColor(),y:f.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),d=t.get("link"),g=t.get("sublink"),m=t.get("triggerEvent",!0);c.silent=!d&&!m,p.silent=!g&&!m,d&&c.on("click",function(){kp(d,"_"+t.get("target"))}),g&&p.on("click",function(){kp(g,"_"+t.get("subtarget"))}),rt(c).eventData=rt(p).eventData=m?{componentType:"title",componentIndex:t.componentIndex}:null,a.add(c),h&&a.add(p);var v=a.getBoundingRect(),_=t.getBoxLayoutParams();_.width=v.width,_.height=v.height;var y=xr(_,{width:n.getWidth(),height:n.getHeight()},t.get("padding"));l||(l=t.get("left")||t.get("right"),l==="middle"&&(l="center"),l==="right"?y.x+=y.width:l==="center"&&(y.x+=y.width/2)),u||(u=t.get("top")||t.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?y.y+=y.height:u==="middle"&&(y.y+=y.height/2),u=u||"top"),a.x=y.x,a.y=y.y,a.markRedraw();var x={align:l,verticalAlign:u};c.setStyle(x),p.setStyle(x),v=a.getBoundingRect();var M=y.margin,S=t.getItemStyle(["color","opacity"]);S.fill=t.get("backgroundColor");var w=new Tt({shape:{x:v.x-M[3],y:v.y-M[0],width:v.width+M[1]+M[3],height:v.height+M[0]+M[2],r:t.get("borderRadius")},style:S,subPixelOptimize:!0,silent:!0});a.add(w)}},e.type="title",e}(Qt);function AO(r){r.registerComponentModel(BMe),r.registerComponentView(kMe)}var VMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode="box",t}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n),this._initData()},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),this._initData()},e.prototype.setCurrentIndex=function(t){t==null&&(t=this.option.currentIndex);var i=this._data.count();this.option.loop?t=(t%i+i)%i:(t>=i&&(t=i-1),t<0&&(t=0)),this.option.currentIndex=t},e.prototype.getCurrentIndex=function(){return this.option.currentIndex},e.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},e.prototype.setPlayState=function(t){this.option.autoPlay=!!t},e.prototype.getPlayState=function(){return!!this.option.autoPlay},e.prototype._initData=function(){var t=this.option,i=t.data||[],n=t.axisType,a=this._names=[],o;n==="category"?(o=[],N(i,function(u,c){var f=Yr(Os(u),""),h;qe(u)?(h=Qe(u),h.value=c):h=c,o.push(h),a.push(f)})):o=i;var s={category:"ordinal",time:"time",value:"number"}[n]||"number",l=this._data=new ti([{name:"value",type:s}],this);l.initData(o,a)},e.prototype.getData=function(){return this._data},e.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},e.type="timeline",e.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},e}(Pt),CO=VMe;var SK=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline.slider",e.defaultOption=Hn(CO.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),e}(CO);wr(SK,hv.prototype);var MK=SK;var GMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline",e}(Qt),bK=GMe;var HMe=function(r){Z(e,r);function e(t,i,n,a){var o=r.call(this,t,i,n)||this;return o.type=a||"value",o}return e.prototype.getLabelModel=function(){return this.model.getModel("label")},e.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},e}(pn),wK=HMe;var RO=Math.PI,TK=vt(),WMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){this.api=i},e.prototype.render=function(t,i,n){if(this.model=t,this.api=n,this.ecModel=i,this.group.removeAll(),t.get("show",!0)){var a=this._layout(t,n),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(a,t);t.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return Or("nameValue",{noName:!0,value:c})},N(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](a,o,l,t)},this),this._renderAxisLabel(a,s,l,t),this._position(a,t)}this._doPlayStop(),this._updateTicksStatus()},e.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},e.prototype.dispose=function(){this._clearTimer()},e.prototype._layout=function(t,i){var n=t.get(["label","position"]),a=t.get("orient"),o=YMe(t,i),s;n==null||n==="auto"?s=a==="horizontal"?o.y+o.height/2<i.getHeight()/2?"-":"+":o.x+o.width/2<i.getWidth()/2?"+":"-":Ce(n)?s={horizontal:{top:"-",bottom:"+"},vertical:{left:"-",right:"+"}}[a][n]:s=n;var l={horizontal:"center",vertical:s>=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:RO/2},f=a==="vertical"?o.height:o.width,h=t.getModel("controlStyle"),p=h.get("show",!0),d=p?h.get("itemSize"):0,g=p?h.get("itemGap"):0,m=d+g,v=t.get(["label","rotate"])||0;v=v*RO/180;var _,y,x,M=h.get("position",!0),S=p&&h.get("showPlayBtn",!0),w=p&&h.get("showPrevBtn",!0),T=p&&h.get("showNextBtn",!0),C=0,b=f;M==="left"||M==="bottom"?(S&&(_=[0,0],C+=m),w&&(y=[C,0],C+=m),T&&(x=[b-d,0],b-=m)):(S&&(_=[b-d,0],b-=m),w&&(y=[0,0],C+=m),T&&(x=[b-d,0],b-=m));var E=[C,b];return t.get("inverse")&&E.reverse(),{viewRect:o,mainLength:f,orient:a,rotation:c[a],labelRotation:v,labelPosOpt:s,labelAlign:t.get(["label","align"])||l[a],labelBaseline:t.get(["label","verticalAlign"])||t.get(["label","baseline"])||u[a],playPosition:_,prevBtnPosition:y,nextBtnPosition:x,axisExtent:E,controlSize:d,controlGap:g}},e.prototype._position=function(t,i){var n=this._mainGroup,a=this._labelGroup,o=t.viewRect;if(t.orient==="vertical"){var s=wi(),l=o.x,u=o.y+o.height;_n(s,s,[-l,-u]),Ca(s,s,-RO/2),_n(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),f=_(n.getBoundingRect()),h=_(a.getBoundingRect()),p=[n.x,n.y],d=[a.x,a.y];d[0]=p[0]=c[0][0];var g=t.labelPosOpt;if(g==null||Ce(g)){var m=g==="+"?0:1;y(p,f,c,1,m),y(d,h,c,1,1-m)}else{var m=g>=0?0:1;y(p,f,c,1,m),d[1]=p[1]+g}n.setPosition(p),a.setPosition(d),n.rotation=a.rotation=t.rotation,v(n),v(a);function v(x){x.originX=c[0][0]-x.x,x.originY=c[1][0]-x.y}function _(x){return[[x.x,x.x+x.width],[x.y,x.y+x.height]]}function y(x,M,S,w,T){x[w]+=S[w][T]-M[w][T]}},e.prototype._createAxis=function(t,i){var n=i.getData(),a=i.get("axisType"),o=XMe(i,a);o.getTicks=function(){return n.mapArray(["value"],function(u){return{value:u}})};var s=n.getDataExtent("value");o.setExtent(s[0],s[1]),o.calcNiceTicks();var l=new wK("value",o,t.axisExtent,a);return l.model=i,l},e.prototype._createGroup=function(t){var i=this[t]=new Ze;return this.group.add(i),i},e.prototype._renderAxisLine=function(t,i,n,a){var o=n.getExtent();if(a.get(["lineStyle","show"])){var s=new Kr({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:fe({lineCap:"round"},a.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});i.add(s);var l=this._progressLine=new Kr({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Ye({lineCap:"round",lineWidth:s.style.lineWidth},a.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});i.add(l)}},e.prototype._renderAxisTick=function(t,i,n,a){var o=this,s=a.getData(),l=n.scale.getTicks();this._tickSymbols=[],N(l,function(u){var c=n.dataToCoord(u.value),f=s.getItemModel(u.value),h=f.getModel("itemStyle"),p=f.getModel(["emphasis","itemStyle"]),d=f.getModel(["progress","itemStyle"]),g={x:c,y:0,onclick:Be(o._changeTimeline,o,u.value)},m=EK(f,h,i,g);m.ensureState("emphasis").style=p.getItemStyle(),m.ensureState("progress").style=d.getItemStyle(),Ol(m);var v=rt(m);f.get("tooltip")?(v.dataIndex=u.value,v.dataModel=a):v.dataIndex=v.dataModel=null,o._tickSymbols.push(m)})},e.prototype._renderAxisLabel=function(t,i,n,a){var o=this,s=n.getLabelModel();if(s.get("show")){var l=a.getData(),u=n.getViewLabels();this._tickLabels=[],N(u,function(c){var f=c.tickValue,h=l.getItemModel(f),p=h.getModel("label"),d=h.getModel(["emphasis","label"]),g=h.getModel(["progress","label"]),m=n.dataToCoord(c.tickValue),v=new Lt({x:m,y:0,rotation:t.labelRotation-t.rotation,onclick:Be(o._changeTimeline,o,f),silent:!1,style:fr(p,{text:c.formattedLabel,align:t.labelAlign,verticalAlign:t.labelBaseline})});v.ensureState("emphasis").style=fr(d),v.ensureState("progress").style=fr(g),i.add(v),Ol(v),TK(v).dataIndex=f,o._tickLabels.push(v)})}},e.prototype._renderControl=function(t,i,n,a){var o=t.controlSize,s=t.rotation,l=a.getModel("controlStyle").getItemStyle(),u=a.getModel(["emphasis","controlStyle"]).getItemStyle(),c=a.getPlayState(),f=a.get("inverse",!0);h(t.nextBtnPosition,"next",Be(this._changeTimeline,this,f?"-":"+")),h(t.prevBtnPosition,"prev",Be(this._changeTimeline,this,f?"+":"-")),h(t.playPosition,c?"stop":"play",Be(this._handlePlayClick,this,!c),!0);function h(p,d,g,m){if(p){var v=xn(ft(a.get(["controlStyle",d+"BtnSize"]),o),o),_=[0,-v/2,v,v],y=qMe(a,d+"Icon",_,{x:p[0],y:p[1],originX:o/2,originY:0,rotation:m?-s:0,rectHover:!0,style:l,onclick:g});y.ensureState("emphasis").style=u,i.add(y),Ol(y)}}},e.prototype._renderCurrentPointer=function(t,i,n,a){var o=a.getData(),s=a.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(f){f.draggable=!0,f.drift=Be(u._handlePointerDrag,u),f.ondragend=Be(u._handlePointerDragend,u),AK(f,u._progressLine,s,n,a,!0)},onUpdate:function(f){AK(f,u._progressLine,s,n,a)}};this._currentPointer=EK(l,l,this._mainGroup,{},this._currentPointer,c)},e.prototype._handlePlayClick=function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},e.prototype._handlePointerDrag=function(t,i,n){this._clearTimer(),this._pointerChangeTimeline([n.offsetX,n.offsetY])},e.prototype._handlePointerDragend=function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},e.prototype._pointerChangeTimeline=function(t,i){var n=this._toAxisCoord(t)[0],a=this._axis,o=Ti(a.getExtent().slice());n>o[1]&&(n=o[1]),n<o[0]&&(n=o[0]),this._currentPointer.x=n,this._currentPointer.markRedraw();var s=this._progressLine;s&&(s.shape.x2=n,s.dirty());var l=this._findNearestTick(n),u=this.model;(i||l!==u.getCurrentIndex()&&u.get("realtime"))&&this._changeTimeline(l)},e.prototype._doPlayStop=function(){var t=this;this._clearTimer(),this.model.getPlayState()&&(this._timer=setTimeout(function(){var i=t.model;t._changeTimeline(i.getCurrentIndex()+(i.get("rewind",!0)?-1:1))},this.model.get("playInterval")))},e.prototype._toAxisCoord=function(t){var i=this._mainGroup.getLocalTransform();return wn(t,i,!0)},e.prototype._findNearestTick=function(t){var i=this.model.getData(),n=1/0,a,o=this._axis;return i.each(["value"],function(s,l){var u=o.dataToCoord(s),c=Math.abs(u-t);c<n&&(n=c,a=l)}),a},e.prototype._clearTimer=function(){this._timer&&(clearTimeout(this._timer),this._timer=null)},e.prototype._changeTimeline=function(t){var i=this.model.getCurrentIndex();t==="+"?t=i+1:t==="-"&&(t=i-1),this.api.dispatchAction({type:"timelineChange",currentIndex:t,from:this.uid})},e.prototype._updateTicksStatus=function(){var t=this.model.getCurrentIndex(),i=this._tickSymbols,n=this._tickLabels;if(i)for(var a=0;a<i.length;a++)i&&i[a]&&i[a].toggleState("progress",a<t);if(n)for(var a=0;a<n.length;a++)n&&n[a]&&n[a].toggleState("progress",TK(n[a]).dataIndex<=t)},e.type="timeline.slider",e}(bK);function XMe(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new nx({ordinalMeta:r.getCategories(),extent:[1/0,-1/0]});case"time":return new w1({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new Ha}}function YMe(r,e){return xr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()},r.get("padding"))}function qMe(r,e,t,i){var n=i.style,a=Pu(r.get(["controlStyle",e]),i||{},new lt(t[0],t[1],t[2],t[3]));return n&&a.setStyle(n),a}function EK(r,e,t,i,n,a){var o=e.get("color");if(n)n.setColor(o),t.add(n),a&&a.onUpdate(n);else{var s=r.get("symbol");n=Sr(s,-1,-1,2,2,o),n.setStyle("strokeNoScale",!0),t.add(n),a&&a.onCreate(n)}var l=e.getItemStyle(["color"]);n.setStyle(l),i=_t({rectHover:!0,z2:100},i,!0);var u=qs(r.get("symbolSize"));i.scaleX=u[0]/2,i.scaleY=u[1]/2;var c=bo(r.get("symbolOffset"),u);c&&(i.x=(i.x||0)+c[0],i.y=(i.y||0)+c[1]);var f=r.get("symbolRotate");return i.rotation=(f||0)*Math.PI/180||0,n.attr(i),n.updateTransform(),n}function AK(r,e,t,i,n,a){if(!r.dragging){var o=n.getModel("checkpointStyle"),s=i.dataToCoord(n.getData().get("value",t));if(a||!o.get("animation",!0))r.attr({x:s,y:0}),e&&e.attr({shape:{x2:s}});else{var l={duration:o.get("animationDuration",!0),easing:o.get("animationEasing",!0)};r.stopAnimation(null,!0),r.animateTo({x:s,y:0},l),e&&e.animateTo({shape:{x2:s}},l)}}}var CK=WMe;function RK(r){r.registerAction({type:"timelineChange",event:"timelineChanged",update:"prepareAndUpdate"},function(e,t,i){var n=t.getComponent("timeline");return n&&e.currentIndex!=null&&(n.setCurrentIndex(e.currentIndex),!n.get("loop",!0)&&n.isIndexMax()&&n.getPlayState()&&(n.setPlayState(!1),i.dispatchAction({type:"timelinePlayChange",playState:!1,from:e.from}))),t.resetOption("timeline",{replaceMerge:n.get("replaceMerge",!0)}),Ye({currentIndex:n.option.currentIndex},e)}),r.registerAction({type:"timelinePlayChange",event:"timelinePlayChanged",update:"update"},function(e,t){var i=t.getComponent("timeline");i&&e.playState!=null&&i.setPlayState(e.playState)})}function LO(r){var e=r&&r.timeline;pe(e)||(e=e?[e]:[]),N(e,function(t){t&&ZMe(t)})}function ZMe(r){var e=r.type,t={number:"value",time:"time"};if(t[e]&&(r.axisType=t[e],delete r.type),LK(r),hd(r,"controlPosition")){var i=r.controlStyle||(r.controlStyle={});hd(i,"position")||(i.position=r.controlPosition),i.position==="none"&&!hd(i,"show")&&(i.show=!1,delete i.position),delete r.controlPosition}N(r.data||[],function(n){qe(n)&&!pe(n)&&(!hd(n,"value")&&hd(n,"name")&&(n.value=n.name),LK(n))})}function LK(r){var e=r.itemStyle||(r.itemStyle={}),t=e.emphasis||(e.emphasis={}),i=r.label||r.label||{},n=i.normal||(i.normal={}),a={normal:1,emphasis:1};N(i,function(o,s){!a[s]&&!hd(n,s)&&(n[s]=o)}),t.label&&!hd(i,"emphasis")&&(i.emphasis=t.label,delete t.label)}function hd(r,e){return r.hasOwnProperty(e)}function PO(r){r.registerComponentModel(MK),r.registerComponentView(CK),r.registerSubTypeDefaulter("timeline",function(){return"slider"}),RK(r),r.registerPreprocessor(LO)}function pd(r,e){if(!r)return!1;for(var t=pe(r)?r:[r],i=0;i<t.length;i++)if(t[i]&&t[i][e])return!0;return!1}function cE(r){yo(r,"label",["show"])}var fE=vt(),PK=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.createdBySelf=!1,t}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n),this._mergeOption(t,n,!1,!0)},e.prototype.isAnimationEnabled=function(){if(Ft.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},e.prototype.mergeOption=function(t,i){this._mergeOption(t,i,!1,!1)},e.prototype._mergeOption=function(t,i,n,a){var o=this.mainType;n||i.eachSeries(function(s){var l=s.get(this.mainType,!0),u=fE(s)[o];if(!l||!l.data){fE(s)[o]=null;return}u?u._mergeOption(l,i,!0):(a&&cE(l),N(l.data,function(c){c instanceof Array?(cE(c[0]),cE(c[1])):cE(c)}),u=this.createMarkerModelFromSeries(l,this,i),fe(u,{mainType:this.mainType,seriesIndex:s.seriesIndex,name:s.name,createdBySelf:!0}),u.__hostSeries=s),fE(s)[o]=u},this)},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=this.getRawValue(t),s=a.getName(t);return Or("section",{header:this.name,blocks:[Or("nameValue",{name:s,value:o,noName:!s,noValue:o==null})]})},e.prototype.getData=function(){return this._data},e.prototype.setData=function(t){this._data=t},e.getMarkerModelFromSeries=function(t,i){return fE(t)[i]},e.type="marker",e.dependencies=["series","grid","polar","geo"],e}(Pt);wr(PK,hv.prototype);var da=PK;var jMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,i,n){return new e(t,i,n)},e.type="markPoint",e.defaultOption={z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{show:!0,position:"inside"},itemStyle:{borderWidth:2},emphasis:{label:{show:!0}}},e}(da),DK=jMe;function IO(r){return!(isNaN(parseFloat(r.x))&&isNaN(parseFloat(r.y)))}function KMe(r){return!isNaN(parseFloat(r.x))&&!isNaN(parseFloat(r.y))}function hE(r,e,t,i,n,a){var o=[],s=wo(e,i),l=s?e.getCalculationInfo("stackResultDimension"):i,u=dE(e,l,r),c=e.indicesOfNearest(l,u)[0];o[n]=e.get(t,c),o[a]=e.get(l,c);var f=e.get(i,c),h=Sn(e.get(i,c));return h=Math.min(h,20),h>=0&&(o[a]=+o[a].toFixed(h)),[o,f]}var DO={min:ot(hE,"min"),max:ot(hE,"max"),average:ot(hE,"average"),median:ot(hE,"median")};function th(r,e){if(e){var t=r.getData(),i=r.coordinateSystem,n=i&&i.dimensions;if(!KMe(e)&&!pe(e.coord)&&pe(n)){var a=NO(e,t,i,r);if(e=Qe(e),e.type&&DO[e.type]&&a.baseAxis&&a.valueAxis){var o=dt(n,a.baseAxis.dim),s=dt(n,a.valueAxis.dim),l=DO[e.type](t,a.baseDataDim,a.valueDataDim,o,s);e.coord=l[0],e.value=l[1]}else e.coord=[e.xAxis!=null?e.xAxis:e.radiusAxis,e.yAxis!=null?e.yAxis:e.angleAxis]}if(e.coord==null||!pe(n))e.coord=[];else for(var u=e.coord,c=0;c<2;c++)DO[u[c]]&&(u[c]=dE(t,t.mapDimension(n[c]),u[c]));return e}}function NO(r,e,t,i){var n={};return r.valueIndex!=null||r.valueDim!=null?(n.valueDataDim=r.valueIndex!=null?e.getDimension(r.valueIndex):r.valueDim,n.valueAxis=t.getAxis(JMe(i,n.valueDataDim)),n.baseAxis=t.getOtherAxis(n.valueAxis),n.baseDataDim=e.mapDimension(n.baseAxis.dim)):(n.baseAxis=i.getBaseAxis(),n.valueAxis=t.getOtherAxis(n.baseAxis),n.baseDataDim=e.mapDimension(n.baseAxis.dim),n.valueDataDim=e.mapDimension(n.valueAxis.dim)),n}function JMe(r,e){var t=r.getData().getDimensionInfo(e);return t&&t.coordDim}function rh(r,e){return r&&r.containData&&e.coord&&!IO(e)?r.containData(e.coord):!0}function IK(r,e,t){return r&&r.containZone&&e.coord&&t.coord&&!IO(e)&&!IO(t)?r.containZone(e.coord,t.coord):!0}function pE(r,e){return r?function(t,i,n,a){var o=a<2?t.coord&&t.coord[a]:t.value;return ns(o,e[a])}:function(t,i,n,a){return ns(t.value,e[a])}}function dE(r,e,t){if(t==="average"){var i=0,n=0;return r.each(e,function(a,o){isNaN(a)||(i+=a,n++)}),i/n}else return t==="median"?r.getMedian(e):r.getDataExtent(e)[t==="max"?1:0]}var OO=vt(),$Me=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this.markerGroupMap=ke()},e.prototype.render=function(t,i,n){var a=this,o=this.markerGroupMap;o.each(function(s){OO(s).keep=!1}),i.eachSeries(function(s){var l=da.getMarkerModelFromSeries(s,a.type);l&&a.renderSeries(s,l,i,n)}),o.each(function(s){!OO(s).keep&&a.group.remove(s.group)})},e.prototype.markKeep=function(t){OO(t).keep=!0},e.prototype.toggleBlurSeries=function(t,i){var n=this;N(t,function(a){var o=da.getMarkerModelFromSeries(a,n.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(i?Qb(l):d_(l))})}})},e.type="marker",e}(Qt),eg=$Me;function NK(r,e,t){var i=e.coordinateSystem;r.each(function(n){var a=r.getItemModel(n),o,s=Fe(a.get("x"),t.getWidth()),l=Fe(a.get("y"),t.getHeight());if(!isNaN(s)&&!isNaN(l))o=[s,l];else if(e.getMarkerPosition)o=e.getMarkerPosition(r.getValues(r.dimensions,n));else if(i){var u=r.get(i.dimensions[0],n),c=r.get(i.dimensions[1],n);o=i.dataToPoint([u,c])}isNaN(s)||(o[0]=s),isNaN(l)||(o[1]=l),r.setItemLayout(n,o)})}var QMe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,n){i.eachSeries(function(a){var o=da.getMarkerModelFromSeries(a,"markPoint");o&&(NK(o.getData(),a,n),this.markerGroupMap.get(a.id).updateLayout())},this)},e.prototype.renderSeries=function(t,i,n,a){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Yl),f=ebe(o,t,i);i.setData(f),NK(i.getData(),t,a),f.each(function(h){var p=f.getItemModel(h),d=p.getShallow("symbol"),g=p.getShallow("symbolSize"),m=p.getShallow("symbolRotate"),v=p.getShallow("symbolOffset"),_=p.getShallow("symbolKeepAspect");if(He(d)||He(g)||He(m)||He(v)){var y=i.getRawValue(h),x=i.getDataParams(h);He(d)&&(d=d(y,x)),He(g)&&(g=g(y,x)),He(m)&&(m=m(y,x)),He(v)&&(v=v(y,x))}var M=p.getModel("itemStyle").getItemStyle(),S=kl(l,"color");M.fill||(M.fill=S),f.setItemVisual(h,{symbol:d,symbolSize:g,symbolRotate:m,symbolOffset:v,symbolKeepAspect:_,style:M})}),c.updateData(f),this.group.add(c.group),f.eachItemGraphicEl(function(h){h.traverse(function(p){rt(p).dataModel=i})}),this.markKeep(c),c.group.silent=i.get("silent")||t.get("silent")},e.type="markPoint",e}(eg);function ebe(r,e,t){var i;r?i=de(r&&r.dimensions,function(s){var l=e.getData().getDimensionInfo(e.getData().mapDimension(s))||{};return fe(fe({},l),{name:s,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var n=new ti(i,t),a=de(t.get("data"),ot(th,e));r&&(a=Wt(a,ot(rh,r)));var o=pE(!!r,i);return n.initData(a,null,o),n}var UK=QMe;function FO(r){r.registerComponentModel(DK),r.registerComponentView(UK),r.registerPreprocessor(function(e){pd(e.series,"markPoint")&&(e.markPoint=e.markPoint||{})})}var tbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,i,n){return new e(t,i,n)},e.type="markLine",e.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},e}(da),OK=tbe;var mE=vt(),rbe=function(r,e,t,i){var n=r.getData(),a;if(pe(i))a=i;else{var o=i.type;if(o==="min"||o==="max"||o==="average"||o==="median"||i.xAxis!=null||i.yAxis!=null){var s=void 0,l=void 0;if(i.yAxis!=null||i.xAxis!=null)s=e.getAxis(i.yAxis!=null?"y":"x"),l=Br(i.yAxis,i.xAxis);else{var u=NO(i,n,e,r);s=u.valueAxis;var c=y1(n,u.valueDataDim);l=dE(n,c,o)}var f=s.dim==="x"?0:1,h=1-f,p=Qe(i),d={coord:[]};p.type=null,p.coord=[],p.coord[h]=-1/0,d.coord[h]=1/0;var g=t.get("precision");g>=0&&At(l)&&(l=+l.toFixed(Math.min(g,20))),p.coord[f]=d.coord[f]=l,a=[p,d,{type:o,valueIndex:i.valueIndex,value:l}]}else a=[]}var m=[th(r,a[0]),th(r,a[1]),fe({},a[2])];return m[2].type=m[2].type||null,_t(m[2],m[0]),_t(m[2],m[1]),m};function vE(r){return!isNaN(r)&&!isFinite(r)}function FK(r,e,t,i){var n=1-r,a=i.dimensions[r];return vE(e[n])&&vE(t[n])&&e[r]===t[r]&&i.getAxis(a).containData(e[r])}function ibe(r,e){if(r.type==="cartesian2d"){var t=e[0].coord,i=e[1].coord;if(t&&i&&(FK(1,t,i,r)||FK(0,t,i,r)))return!0}return rh(r,e[0])&&rh(r,e[1])}function zO(r,e,t,i,n){var a=i.coordinateSystem,o=r.getItemModel(e),s,l=Fe(o.get("x"),n.getWidth()),u=Fe(o.get("y"),n.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(i.getMarkerPosition)s=i.getMarkerPosition(r.getValues(r.dimensions,e));else{var c=a.dimensions,f=r.get(c[0],e),h=r.get(c[1],e);s=a.dataToPoint([f,h])}if(ls(a,"cartesian2d")){var p=a.getAxis("x"),d=a.getAxis("y"),c=a.dimensions;vE(r.get(c[0],e))?s[0]=p.toGlobalCoord(p.getExtent()[t?0:1]):vE(r.get(c[1],e))&&(s[1]=d.toGlobalCoord(d.getExtent()[t?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}r.setItemLayout(e,s)}var nbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,n){i.eachSeries(function(a){var o=da.getMarkerModelFromSeries(a,"markLine");if(o){var s=o.getData(),l=mE(o).from,u=mE(o).to;l.each(function(c){zO(l,c,!0,a,n),zO(u,c,!1,a,n)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(a.id).updateLayout()}},this)},e.prototype.renderSeries=function(t,i,n,a){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Fv);this.group.add(c.group);var f=abe(o,t,i),h=f.from,p=f.to,d=f.line;mE(i).from=h,mE(i).to=p,i.setData(d);var g=i.get("symbol"),m=i.get("symbolSize"),v=i.get("symbolRotate"),_=i.get("symbolOffset");pe(g)||(g=[g,g]),pe(m)||(m=[m,m]),pe(v)||(v=[v,v]),pe(_)||(_=[_,_]),f.from.each(function(x){y(h,x,!0),y(p,x,!1)}),d.each(function(x){var M=d.getItemModel(x).getModel("lineStyle").getLineStyle();d.setItemLayout(x,[h.getItemLayout(x),p.getItemLayout(x)]),M.stroke==null&&(M.stroke=h.getItemVisual(x,"style").fill),d.setItemVisual(x,{fromSymbolKeepAspect:h.getItemVisual(x,"symbolKeepAspect"),fromSymbolOffset:h.getItemVisual(x,"symbolOffset"),fromSymbolRotate:h.getItemVisual(x,"symbolRotate"),fromSymbolSize:h.getItemVisual(x,"symbolSize"),fromSymbol:h.getItemVisual(x,"symbol"),toSymbolKeepAspect:p.getItemVisual(x,"symbolKeepAspect"),toSymbolOffset:p.getItemVisual(x,"symbolOffset"),toSymbolRotate:p.getItemVisual(x,"symbolRotate"),toSymbolSize:p.getItemVisual(x,"symbolSize"),toSymbol:p.getItemVisual(x,"symbol"),style:M})}),c.updateData(d),f.line.eachItemGraphicEl(function(x){rt(x).dataModel=i,x.traverse(function(M){rt(M).dataModel=i})});function y(x,M,S){var w=x.getItemModel(M);zO(x,M,S,t,a);var T=w.getModel("itemStyle").getItemStyle();T.fill==null&&(T.fill=kl(l,"color")),x.setItemVisual(M,{symbolKeepAspect:w.get("symbolKeepAspect"),symbolOffset:ft(w.get("symbolOffset",!0),_[S?0:1]),symbolRotate:ft(w.get("symbolRotate",!0),v[S?0:1]),symbolSize:ft(w.get("symbolSize"),m[S?0:1]),symbol:ft(w.get("symbol",!0),g[S?0:1]),style:T})}this.markKeep(c),c.group.silent=i.get("silent")||t.get("silent")},e.type="markLine",e}(eg);function abe(r,e,t){var i;r?i=de(r&&r.dimensions,function(u){var c=e.getData().getDimensionInfo(e.getData().mapDimension(u))||{};return fe(fe({},c),{name:u,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var n=new ti(i,t),a=new ti(i,t),o=new ti([],t),s=de(t.get("data"),ot(rbe,e,r,t));r&&(s=Wt(s,ot(ibe,r)));var l=pE(!!r,i);return n.initData(de(s,function(u){return u[0]}),null,l),a.initData(de(s,function(u){return u[1]}),null,l),o.initData(de(s,function(u){return u[2]})),o.hasItemOption=!0,{from:n,to:a,line:o}}var zK=nbe;function BO(r){r.registerComponentModel(OK),r.registerComponentView(zK),r.registerPreprocessor(function(e){pd(e.series,"markLine")&&(e.markLine=e.markLine||{})})}var obe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,i,n){return new e(t,i,n)},e.type="markArea",e.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},e}(da),BK=obe;var gE=vt(),sbe=function(r,e,t,i){var n=i[0],a=i[1];if(!(!n||!a)){var o=th(r,n),s=th(r,a),l=o.coord,u=s.coord;l[0]=Br(l[0],-1/0),l[1]=Br(l[1],-1/0),u[0]=Br(u[0],1/0),u[1]=Br(u[1],1/0);var c=Sm([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function yE(r){return!isNaN(r)&&!isFinite(r)}function kK(r,e,t,i){var n=1-r;return yE(e[n])&&yE(t[n])}function lbe(r,e){var t=e.coord[0],i=e.coord[1],n={coord:t,x:e.x0,y:e.y0},a={coord:i,x:e.x1,y:e.y1};return ls(r,"cartesian2d")?t&&i&&(kK(1,t,i,r)||kK(0,t,i,r))?!0:IK(r,n,a):rh(r,n)||rh(r,a)}function VK(r,e,t,i,n){var a=i.coordinateSystem,o=r.getItemModel(e),s,l=Fe(o.get(t[0]),n.getWidth()),u=Fe(o.get(t[1]),n.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(i.getMarkerPosition){var c=r.getValues(["x0","y0"],e),f=r.getValues(["x1","y1"],e),h=a.clampData(c),p=a.clampData(f),d=[];t[0]==="x0"?d[0]=h[0]>p[0]?f[0]:c[0]:d[0]=h[0]>p[0]?c[0]:f[0],t[1]==="y0"?d[1]=h[1]>p[1]?f[1]:c[1]:d[1]=h[1]>p[1]?c[1]:f[1],s=i.getMarkerPosition(d,t,!0)}else{var g=r.get(t[0],e),m=r.get(t[1],e),v=[g,m];a.clampData&&a.clampData(v,v),s=a.dataToPoint(v,!0)}if(ls(a,"cartesian2d")){var _=a.getAxis("x"),y=a.getAxis("y"),g=r.get(t[0],e),m=r.get(t[1],e);yE(g)?s[0]=_.toGlobalCoord(_.getExtent()[t[0]==="x0"?0:1]):yE(m)&&(s[1]=y.toGlobalCoord(y.getExtent()[t[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var GK=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],ube=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,n){i.eachSeries(function(a){var o=da.getMarkerModelFromSeries(a,"markArea");if(o){var s=o.getData();s.each(function(l){var u=de(GK,function(f){return VK(s,l,f,a,n)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},e.prototype.renderSeries=function(t,i,n,a){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new Ze});this.group.add(c.group),this.markKeep(c);var f=cbe(o,t,i);i.setData(f),f.each(function(h){var p=de(GK,function(T){return VK(f,h,T,t,a)}),d=o.getAxis("x").scale,g=o.getAxis("y").scale,m=d.getExtent(),v=g.getExtent(),_=[d.parse(f.get("x0",h)),d.parse(f.get("x1",h))],y=[g.parse(f.get("y0",h)),g.parse(f.get("y1",h))];Ti(_),Ti(y);var x=!(m[0]>_[1]||m[1]<_[0]||v[0]>y[1]||v[1]<y[0]),M=!x;f.setItemLayout(h,{points:p,allClipped:M});var S=f.getItemModel(h).getModel("itemStyle").getItemStyle(),w=kl(l,"color");S.fill||(S.fill=w,Ce(S.fill)&&(S.fill=cp(S.fill,.4))),S.stroke||(S.stroke=w),f.setItemVisual(h,"style",S)}),f.diff(gE(c).data).add(function(h){var p=f.getItemLayout(h);if(!p.allClipped){var d=new ei({shape:{points:p.points}});f.setItemGraphicEl(h,d),c.group.add(d)}}).update(function(h,p){var d=gE(c).data.getItemGraphicEl(p),g=f.getItemLayout(h);g.allClipped?d&&c.group.remove(d):(d?Dt(d,{shape:{points:g.points}},i,h):d=new ei({shape:{points:g.points}}),f.setItemGraphicEl(h,d),c.group.add(d))}).remove(function(h){var p=gE(c).data.getItemGraphicEl(h);c.group.remove(p)}).execute(),f.eachItemGraphicEl(function(h,p){var d=f.getItemModel(p),g=f.getItemVisual(p,"style");h.useStyle(f.getItemVisual(p,"style")),Nr(h,Tr(d),{labelFetcher:i,labelDataIndex:p,defaultText:f.getName(p)||"",inheritColor:Ce(g.fill)?cp(g.fill,1):"#000"}),Gr(h,d),nr(h,null,null,d.get(["emphasis","disabled"])),rt(h).dataModel=i}),gE(c).data=f,c.group.silent=i.get("silent")||t.get("silent")},e.type="markArea",e}(eg);function cbe(r,e,t){var i,n,a=["x0","y0","x1","y1"];if(r){var o=de(r&&r.dimensions,function(u){var c=e.getData(),f=c.getDimensionInfo(c.mapDimension(u))||{};return fe(fe({},f),{name:u,ordinalMeta:null})});n=de(a,function(u,c){return{name:u,type:o[c%2].type}}),i=new ti(n,t)}else n=[{name:"value",type:"float"}],i=new ti(n,t);var s=de(t.get("data"),ot(sbe,e,r,t));r&&(s=Wt(s,ot(lbe,r)));var l=r?function(u,c,f,h){var p=u.coord[Math.floor(h/2)][h%2];return ns(p,n[h])}:function(u,c,f,h){return ns(u.value,n[h])};return i.initData(s,null,l),i.hasItemOption=!0,i}var HK=ube;function kO(r){r.registerComponentModel(BK),r.registerComponentView(HK),r.registerPreprocessor(function(e){pd(e.series,"markArea")&&(e.markArea=e.markArea||{})})}var fbe=function(r,e){if(e==="all")return{type:"all",title:r.getLocaleModel().get(["legend","selector","all"])};if(e==="inverse")return{type:"inverse",title:r.getLocaleModel().get(["legend","selector","inverse"])}},hbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),this._updateSelector(t)},e.prototype._updateSelector=function(t){var i=t.selector,n=this.ecModel;i===!0&&(i=t.selector=["all","inverse"]),pe(i)&&N(i,function(a,o){Ce(a)&&(a={type:a}),i[o]=_t(a,fbe(n,a.type))})},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&this.get("selectedMode")==="single"){for(var i=!1,n=0;n<t.length;n++){var a=t[n].get("name");if(this.isSelected(a)){this.select(a),i=!0;break}}!i&&this.select(t[0].get("name"))}},e.prototype._updateData=function(t){var i=[],n=[];t.eachRawSeries(function(l){var u=l.name;n.push(u);var c;if(l.legendVisualProvider){var f=l.legendVisualProvider,h=f.getAllNames();t.isSeriesFiltered(l)||(n=n.concat(h)),h.length?i=i.concat(h):c=!0}else c=!0;c&&Gm(l)&&i.push(l.name)}),this._availableNames=n;var a=this.get("data")||i,o=ke(),s=de(a,function(l){return(Ce(l)||At(l))&&(l={name:l}),o.get(l.name)?null:(o.set(l.name,!0),new Zt(l,this,this.ecModel))},this);this._data=Wt(s,function(l){return!!l})},e.prototype.getData=function(){return this._data},e.prototype.select=function(t){var i=this.option.selected,n=this.get("selectedMode");if(n==="single"){var a=this._data;N(a,function(o){i[o.get("name")]=!1})}i[t]=!0},e.prototype.unSelect=function(t){this.get("selectedMode")!=="single"&&(this.option.selected[t]=!1)},e.prototype.toggleSelected=function(t){var i=this.option.selected;i.hasOwnProperty(t)||(i[t]=!0),this[i[t]?"unSelect":"select"](t)},e.prototype.allSelect=function(){var t=this._data,i=this.option.selected;N(t,function(n){i[n.get("name",!0)]=!0})},e.prototype.inverseSelect=function(){var t=this._data,i=this.option.selected;N(t,function(n){var a=n.get("name",!0);i.hasOwnProperty(a)||(i[a]=!0),i[a]=!i[a]})},e.prototype.isSelected=function(t){var i=this.option.selected;return!(i.hasOwnProperty(t)&&!i[t])&&dt(this._availableNames,t)>=0},e.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(Pt),Wx=hbe;var tg=ot,VO=N,_E=Ze,pbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!1,t}return e.prototype.init=function(){this.group.add(this._contentGroup=new _E),this.group.add(this._selectorGroup=new _E),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,i,n){var a=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!t.get("show",!0)){var o=t.get("align"),s=t.get("orient");(!o||o==="auto")&&(o=t.get("left")==="right"&&s==="vertical"?"right":"left");var l=t.get("selector",!0),u=t.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,t,i,n,l,s,u);var c=t.getBoxLayoutParams(),f={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),p=xr(c,f,h),d=this.layoutInner(t,o,p,a,l,u),g=xr(Ye({width:d.width,height:d.height},c),f,h);this.group.x=g.x-d.x,this.group.y=g.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=nE(d,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,i,n,a,o,s,l){var u=this.getContentGroup(),c=ke(),f=i.get("selectedMode"),h=[];n.eachRawSeries(function(p){!p.get("legendHoverLink")&&h.push(p.id)}),VO(i.getData(),function(p,d){var g=p.get("name");if(!this.newlineDisabled&&(g===""||g===`
  2229. `)){var m=new _E;m.newline=!0,u.add(m);return}var v=n.getSeriesByName(g)[0];if(!c.get(g))if(v){var _=v.getData(),y=_.getVisual("legendLineStyle")||{},x=_.getVisual("legendIcon"),M=_.getVisual("style"),S=this._createItem(v,g,d,p,i,t,y,M,x,f,a);S.on("click",tg(WK,g,null,a,h)).on("mouseover",tg(GO,v.name,null,a,h)).on("mouseout",tg(HO,v.name,null,a,h)),n.ssr&&S.eachChild(function(w){var T=rt(w);T.seriesIndex=v.seriesIndex,T.dataIndex=d,T.ssrType="legend"}),c.set(g,!0)}else n.eachRawSeries(function(w){if(!c.get(g)&&w.legendVisualProvider){var T=w.legendVisualProvider;if(!T.containName(g))return;var C=T.indexOfName(g),b=T.getItemVisual(C,"style"),E=T.getItemVisual(C,"legendIcon"),I=cn(b.fill);I&&I[3]===0&&(I[3]=.2,b=fe(fe({},b),{fill:Ko(I,"rgba")}));var R=this._createItem(w,g,d,p,i,t,{},b,E,f,a);R.on("click",tg(WK,null,g,a,h)).on("mouseover",tg(GO,null,g,a,h)).on("mouseout",tg(HO,null,g,a,h)),n.ssr&&R.eachChild(function(A){var D=rt(A);D.seriesIndex=w.seriesIndex,D.dataIndex=d,D.ssrType="legend"}),c.set(g,!0)}},this)},this),o&&this._createSelector(o,i,a,s,l)},e.prototype._createSelector=function(t,i,n,a,o){var s=this.getSelectorGroup();VO(t,function(u){var c=u.type,f=new Lt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect"})}});s.add(f);var h=i.getModel("selectorLabel"),p=i.getModel(["emphasis","selectorLabel"]);Nr(f,{normal:h,emphasis:p},{defaultText:u.title}),Ol(f)})},e.prototype._createItem=function(t,i,n,a,o,s,l,u,c,f,h){var p=t.visualDrawType,d=o.get("itemWidth"),g=o.get("itemHeight"),m=o.isSelected(i),v=a.get("symbolRotate"),_=a.get("symbolKeepAspect"),y=a.get("icon");c=y||c||"roundRect";var x=dbe(c,a,l,u,p,m,h),M=new _E,S=a.getModel("textStyle");if(He(t.getLegendIcon)&&(!y||y==="inherit"))M.add(t.getLegendIcon({itemWidth:d,itemHeight:g,icon:c,iconRotate:v,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:_}));else{var w=y==="inherit"&&t.getData().getVisual("symbol")?v==="inherit"?t.getData().getVisual("symbolRotate"):v:0;M.add(mbe({itemWidth:d,itemHeight:g,icon:c,iconRotate:w,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:_}))}var T=s==="left"?d+5:-5,C=s,b=o.get("formatter"),E=i;Ce(b)&&b?E=b.replace("{name}",i??""):He(b)&&(E=b(i));var I=m?S.getTextColor():a.get("inactiveColor");M.add(new Lt({style:fr(S,{text:E,x:T,y:g/2,fill:I,align:C,verticalAlign:"middle"},{inheritColor:I})}));var R=new Tt({shape:M.getBoundingRect(),style:{fill:"transparent"}}),A=a.getModel("tooltip");return A.get("show")&&Vs({el:R,componentModel:o,itemName:i,itemTooltipOption:A.option}),M.add(R),M.eachChild(function(D){D.silent=!0}),R.silent=!f,this.getContentGroup().add(M),Ol(M),M.__legendDataIndex=n,M},e.prototype.layoutInner=function(t,i,n,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Ws(t.get("orient"),l,t.get("itemGap"),n.width,n.height);var c=l.getBoundingRect(),f=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){Ws("horizontal",u,t.get("selectorItemGap",!0));var h=u.getBoundingRect(),p=[-h.x,-h.y],d=t.get("selectorButtonGap",!0),g=t.getOrient().index,m=g===0?"width":"height",v=g===0?"height":"width",_=g===0?"y":"x";s==="end"?p[g]+=c[m]+d:f[g]+=h[m]+d,p[1-g]+=c[v]/2-h[v]/2,u.x=p[0],u.y=p[1],l.x=f[0],l.y=f[1];var y={x:0,y:0};return y[m]=c[m]+d+h[m],y[v]=Math.max(c[v],h[v]),y[_]=Math.min(0,h[_]+p[1-g]),y}else return l.x=f[0],l.y=f[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(Qt);function dbe(r,e,t,i,n,a,o){function s(m,v){m.lineWidth==="auto"&&(m.lineWidth=v.lineWidth>0?2:0),VO(m,function(_,y){m[y]==="inherit"&&(m[y]=v[y])})}var l=e.getModel("itemStyle"),u=l.getItemStyle(),c=r.lastIndexOf("empty",0)===0?"fill":"stroke",f=l.getShallow("decal");u.decal=!f||f==="inherit"?i.decal:Zs(f,o),u.fill==="inherit"&&(u.fill=i[n]),u.stroke==="inherit"&&(u.stroke=i[c]),u.opacity==="inherit"&&(u.opacity=(n==="fill"?i:t).opacity),s(u,i);var h=e.getModel("lineStyle"),p=h.getLineStyle();if(s(p,t),u.fill==="auto"&&(u.fill=i.fill),u.stroke==="auto"&&(u.stroke=i.fill),p.stroke==="auto"&&(p.stroke=i.fill),!a){var d=e.get("inactiveBorderWidth"),g=u[c];u.lineWidth=d==="auto"?i.lineWidth>0&&g?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),p.stroke=h.get("inactiveColor"),p.lineWidth=h.get("inactiveWidth")}return{itemStyle:u,lineStyle:p}}function mbe(r){var e=r.icon||"roundRect",t=Sr(e,0,0,r.itemWidth,r.itemHeight,r.itemStyle.fill,r.symbolKeepAspect);return t.setStyle(r.itemStyle),t.rotation=(r.iconRotate||0)*Math.PI/180,t.setOrigin([r.itemWidth/2,r.itemHeight/2]),e.indexOf("empty")>-1&&(t.style.stroke=t.style.fill,t.style.fill="#fff",t.style.lineWidth=2),t}function WK(r,e,t,i){HO(r,e,t,i),t.dispatchAction({type:"legendToggleSelect",name:r??e}),GO(r,e,t,i)}function XK(r){for(var e=r.getZr().storage.getDisplayList(),t,i=0,n=e.length;i<n&&!(t=e[i].states.emphasis);)i++;return t&&t.hoverLayer}function GO(r,e,t,i){XK(t)||t.dispatchAction({type:"highlight",seriesName:r,name:e,excludeSeriesId:i})}function HO(r,e,t,i){XK(t)||t.dispatchAction({type:"downplay",seriesName:r,name:e,excludeSeriesId:i})}var xE=pbe;function WO(r){var e=r.findComponents({mainType:"legend"});e&&e.length&&r.filterSeries(function(t){for(var i=0;i<e.length;i++)if(!e[i].isSelected(t.name))return!1;return!0})}function Xx(r,e,t){var i={},n=r==="toggleSelected",a;return t.eachComponent("legend",function(o){n&&a!=null?o[a?"select":"unSelect"](e.name):r==="allSelect"||r==="inverseSelect"?o[r]():(o[r](e.name),a=o.isSelected(e.name));var s=o.getData();N(s,function(l){var u=l.get("name");if(!(u===`
  2230. `||u==="")){var c=o.isSelected(u);i.hasOwnProperty(u)?i[u]=i[u]&&c:i[u]=c}})}),r==="allSelect"||r==="inverseSelect"?{selected:i}:{name:e.name,selected:i}}function YK(r){r.registerAction("legendToggleSelect","legendselectchanged",ot(Xx,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",ot(Xx,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",ot(Xx,"inverseSelect")),r.registerAction("legendSelect","legendselected",ot(Xx,"select")),r.registerAction("legendUnSelect","legendunselected",ot(Xx,"unSelect"))}function SE(r){r.registerComponentModel(Wx),r.registerComponentView(xE),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,WO),r.registerSubTypeDefaulter("legend",function(){return"plain"}),YK(r)}var vbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.setScrollDataIndex=function(t){this.option.scrollDataIndex=t},e.prototype.init=function(t,i,n){var a=rs(t);r.prototype.init.call(this,t,i,n),qK(this,t,a)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),qK(this,this.option,t)},e.type="legend.scroll",e.defaultOption=Hn(Wx.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),e}(Wx);function qK(r,e,t){var i=r.getOrient(),n=[1,1];n[i.index]=0,za(e,t,{type:"box",ignoreSize:!!n})}var ZK=vbe;var jK=Ze,XO=["width","height"],YO=["x","y"],gbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!0,t._currentIndex=0,t}return e.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new jK),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new jK)},e.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},e.prototype.renderInner=function(t,i,n,a,o,s,l){var u=this;r.prototype.renderInner.call(this,t,i,n,a,o,s,l);var c=this._controllerGroup,f=i.get("pageIconSize",!0),h=pe(f)?f:[f,f];d("pagePrev",0);var p=i.getModel("pageTextStyle");c.add(new Lt({name:"pageText",style:{text:"xx/xx",fill:p.getTextColor(),font:p.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),d("pageNext",1);function d(g,m){var v=g+"DataIndex",_=Pu(i.get("pageIcons",!0)[i.getOrient().name][m],{onclick:Be(u._pageGo,u,v,i,a)},{x:-h[0]/2,y:-h[1]/2,width:h[0],height:h[1]});_.name=g,c.add(_)}},e.prototype.layoutInner=function(t,i,n,a,o,s){var l=this.getSelectorGroup(),u=t.getOrient().index,c=XO[u],f=YO[u],h=XO[1-u],p=YO[1-u];o&&Ws("horizontal",l,t.get("selectorItemGap",!0));var d=t.get("selectorButtonGap",!0),g=l.getBoundingRect(),m=[-g.x,-g.y],v=Qe(n);o&&(v[c]=n[c]-g[c]-d);var _=this._layoutContentAndController(t,a,v,u,c,h,p,f);if(o){if(s==="end")m[u]+=_[c]+d;else{var y=g[c]+d;m[u]-=y,_[f]-=y}_[c]+=g[c]+d,m[1-u]+=_[p]+_[h]/2-g[h]/2,_[h]=Math.max(_[h],g[h]),_[p]=Math.min(_[p],g[p]+m[1-u]),l.x=m[0],l.y=m[1],l.markRedraw()}return _},e.prototype._layoutContentAndController=function(t,i,n,a,o,s,l,u){var c=this.getContentGroup(),f=this._containerGroup,h=this._controllerGroup;Ws(t.get("orient"),c,t.get("itemGap"),a?n.width:null,a?null:n.height),Ws("horizontal",h,t.get("pageButtonItemGap",!0));var p=c.getBoundingRect(),d=h.getBoundingRect(),g=this._showController=p[o]>n[o],m=[-p.x,-p.y];i||(m[a]=c[u]);var v=[0,0],_=[-d.x,-d.y],y=ft(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(g){var x=t.get("pageButtonPosition",!0);x==="end"?_[a]+=n[o]-d[o]:v[a]+=d[o]+y}_[1-a]+=p[s]/2-d[s]/2,c.setPosition(m),f.setPosition(v),h.setPosition(_);var M={x:0,y:0};if(M[o]=g?n[o]:p[o],M[s]=Math.max(p[s],d[s]),M[l]=Math.min(0,d[l]+_[1-a]),f.__rectSize=n[o],g){var S={x:0,y:0};S[o]=Math.max(n[o]-d[o]-y,0),S[s]=M[s],f.setClipPath(new Tt({shape:S})),f.__rectSize=S[o]}else h.eachChild(function(T){T.attr({invisible:!0,silent:!0})});var w=this._getPageInfo(t);return w.pageIndex!=null&&Dt(c,{x:w.contentPosition[0],y:w.contentPosition[1]},g?t:null),this._updatePageInfoView(t,w),M},e.prototype._pageGo=function(t,i,n){var a=this._getPageInfo(i)[t];a!=null&&n.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:i.id})},e.prototype._updatePageInfoView=function(t,i){var n=this._controllerGroup;N(["pagePrev","pageNext"],function(c){var f=c+"DataIndex",h=i[f]!=null,p=n.childOfName(c);p&&(p.setStyle("fill",h?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),p.cursor=h?"pointer":"default")});var a=n.childOfName("pageText"),o=t.get("pageFormatter"),s=i.pageIndex,l=s!=null?s+1:0,u=i.pageCount;a&&o&&a.setStyle("text",Ce(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},e.prototype._getPageInfo=function(t){var i=t.get("scrollDataIndex",!0),n=this.getContentGroup(),a=this._containerGroup.__rectSize,o=t.getOrient().index,s=XO[o],l=YO[o],u=this._findTargetItemIndex(i),c=n.children(),f=c[u],h=c.length,p=h?1:0,d={contentPosition:[n.x,n.y],pageCount:p,pageIndex:p-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!f)return d;var g=x(f);d.contentPosition[o]=-g.s;for(var m=u+1,v=g,_=g,y=null;m<=h;++m)y=x(c[m]),(!y&&_.e>v.s+a||y&&!M(y,v.s))&&(_.i>v.i?v=_:v=y,v&&(d.pageNextDataIndex==null&&(d.pageNextDataIndex=v.i),++d.pageCount)),_=y;for(var m=u-1,v=g,_=g,y=null;m>=-1;--m)y=x(c[m]),(!y||!M(_,y.s))&&v.i<_.i&&(_=v,d.pagePrevDataIndex==null&&(d.pagePrevDataIndex=v.i),++d.pageCount,++d.pageIndex),v=y;return d;function x(S){if(S){var w=S.getBoundingRect(),T=w[l]+S[l];return{s:T,e:T+w[s],i:S.__legendDataIndex}}}function M(S,w){return S.e>=w&&S.s<=w+a}},e.prototype._findTargetItemIndex=function(t){if(!this._showController)return 0;var i,n=this.getContentGroup(),a;return n.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===t&&(i=s)}),i??a},e.type="legend.scroll",e}(xE),KK=gbe;function qO(r){r.registerAction("legendScroll","legendscroll",function(e,t){var i=e.scrollDataIndex;i!=null&&t.eachComponent({mainType:"legend",subType:"scroll",query:e},function(n){n.setScrollDataIndex(i)})})}function JK(r){It(SE),r.registerComponentModel(ZK),r.registerComponentView(KK),qO(r)}function ZO(r){It(SE),It(JK)}var ybe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.inside",e.defaultOption=Hn($f.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e}($f),$K=ybe;var jO=vt();function QK(r,e,t){jO(r).coordSysRecordMap.each(function(i){var n=i.dataZoomInfoMap.get(e.uid);n&&(n.getRange=t)})}function eJ(r,e){for(var t=jO(r).coordSysRecordMap,i=t.keys(),n=0;n<i.length;n++){var a=i[n],o=t.get(a),s=o.dataZoomInfoMap;if(s){var l=e.uid,u=s.get(l);u&&(s.removeKey(l),s.keys().length||tJ(t,o))}}}function tJ(r,e){if(e){r.removeKey(e.model.uid);var t=e.controller;t&&t.dispose()}}function _be(r,e){var t={model:e,containsPoint:ot(Sbe,e),dispatchAction:ot(xbe,r),dataZoomInfoMap:null,controller:null},i=t.controller=new Kl(r.getZr());return N(["pan","zoom","scrollMove"],function(n){i.on(n,function(a){var o=[];t.dataZoomInfoMap.each(function(s){if(a.isAvailableBehavior(s.model.option)){var l=(s.getRange||{})[n],u=l&&l(s.dzReferCoordSysInfo,t.model.mainType,t.controller,a);!s.model.get("disabled",!0)&&u&&o.push({dataZoomId:s.model.id,start:u[0],end:u[1]})}}),o.length&&t.dispatchAction(o)})}),t}function xbe(r,e){r.isDisposed()||r.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:e})}function Sbe(r,e,t,i){return r.coordinateSystem.containPoint([t,i])}function Mbe(r){var e,t="type_",i={type_true:2,type_move:1,type_false:0,type_undefined:-1},n=!0;return r.each(function(a){var o=a.model,s=o.get("disabled",!0)?!1:o.get("zoomLock",!0)?"move":!0;i[t+s]>i[t+e]&&(e=s),n=n&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!n}}}function rJ(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var i=jO(t),n=i.coordSysRecordMap||(i.coordSysRecordMap=ke());n.each(function(a){a.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=rE(a);N(o.infoList,function(s){var l=s.model.uid,u=n.get(l)||n.set(l,_be(t,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=ke());c.set(a.uid,{dzReferCoordSysInfo:s,model:a,getRange:null})})}),n.each(function(a){var o=a.controller,s,l=a.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){tJ(n,a);return}var c=Mbe(l);o.enable(c.controlType,c.opt),o.setPointerChecker(a.containsPoint),as(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var wbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return e.prototype.render=function(t,i,n){if(r.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),QK(n,t,{pan:Be(KO.pan,this),zoom:Be(KO.zoom,this),scrollMove:Be(KO.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){eJ(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e}(Jv),KO={zoom:function(r,e,t,i){var n=this.range,a=n.slice(),o=r.axisModels[0];if(o){var s=JO[e](null,[i.originX,i.originY],o,t,r),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/i.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Xa(0,a,[0,100],0,c.minSpan,c.maxSpan),this.range=a,n[0]!==a[0]||n[1]!==a[1])return a}},pan:iJ(function(r,e,t,i,n,a){var o=JO[i]([a.oldX,a.oldY],[a.newX,a.newY],e,n,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:iJ(function(r,e,t,i,n,a){var o=JO[i]([0,0],[a.scrollDelta,a.scrollDelta],e,n,t);return o.signal*(r[1]-r[0])*a.scrollDelta})};function iJ(r){return function(e,t,i,n){var a=this.range,o=a.slice(),s=e.axisModels[0];if(s){var l=r(o,s,e,t,i,n);if(Xa(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var JO={grid:function(r,e,t,i,n){var a=t.axis,o={},s=n.model.coordinateSystem.getRect();return r=r||[0,0],a.dim==="x"?(o.pixel=e[0]-r[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(r,e,t,i,n){var a=t.axis,o={},s=n.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return r=r?s.pointToCoord(r):[0,0],e=s.pointToCoord(e),t.mainType==="radiusAxis"?(o.pixel=e[0]-r[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=a.inverse?-1:1),o},singleAxis:function(r,e,t,i,n){var a=t.axis,o=n.model.coordinateSystem.getRect(),s={};return r=r||[0,0],a.orient==="horizontal"?(s.pixel=e[0]-r[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=e[1]-r[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}},nJ=wbe;function Yx(r){fd(r),r.registerComponentModel($K),r.registerComponentView(nJ),rJ(r)}var Tbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=Hn($f.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),e}($f),aJ=Tbe;var qx=Tt,oJ=7,Ebe=1,$O=30,Abe=7,Zx="horizontal",sJ="vertical",Cbe=5,Rbe=["line","bar","candlestick","scatter"],Lbe={easing:"cubicOut",duration:100,delay:0},Pbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._displayables={},t}return e.prototype.init=function(t,i){this.api=i,this._onBrush=Be(this._onBrush,this),this._onBrushEnd=Be(this._onBrushEnd,this)},e.prototype.render=function(t,i,n,a){if(r.prototype.render.apply(this,arguments),as(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),t.get("show")===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){zu(this,"_dispatchZoomAction");var t=this.api.getZr();t.off("mousemove",this._onBrush),t.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var t=this.group;t.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var i=this._displayables.sliderGroup=new Ze;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(i),this._positionGroup()},e.prototype._resetLocation=function(){var t=this.dataZoomModel,i=this.api,n=t.get("brushSelect"),a=n?Abe:0,o=this._findCoordRect(),s={width:i.getWidth(),height:i.getHeight()},l=this._orient===Zx?{right:s.width-o.x-o.width,top:s.height-$O-oJ-a,width:o.width,height:$O}:{right:oJ,top:o.y,width:$O,height:o.height},u=rs(t.option);N(["right","top","width","height"],function(f){u[f]==="ph"&&(u[f]=l[f])});var c=xr(u,s);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===sJ&&this._size.reverse()},e.prototype._positionGroup=function(){var t=this.group,i=this._location,n=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(n===Zx&&!o?{scaleY:l?1:-1,scaleX:1}:n===Zx&&o?{scaleY:l?1:-1,scaleX:-1}:n===sJ&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=t.getBoundingRect([s]);t.x=i.x-u.x,t.y=i.y-u.y,t.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var t=this.dataZoomModel,i=this._size,n=this._displayables.sliderGroup,a=t.get("brushSelect");n.add(new qx({silent:!0,shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var o=new qx({shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:"transparent"},z2:0,onclick:Be(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),n.add(o)},e.prototype._renderDataShadow=function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!t)return;var i=this._size,n=this._shadowSize||[],a=t.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():t.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||i[0]!==n[0]||i[1]!==n[1]){var f=o.getDataExtent(l),h=(f[1]-f[0])*.3;f=[f[0]-h,f[1]+h];var p=[0,i[1]],d=[0,i[0]],g=[[i[0],0],[0,0]],m=[],v=d[1]/(o.count()-1),_=0,y=Math.round(o.count()/i[0]),x;o.each([l],function(C,b){if(y>0&&b%y){_+=v;return}var E=C==null||isNaN(C)||C==="",I=E?0:rr(C,f,p,!0);E&&!x&&b?(g.push([g[g.length-1][0],0]),m.push([m[m.length-1][0],0])):!E&&x&&(g.push([_,0]),m.push([_,0])),g.push([_,I]),m.push([_,I]),_+=v,x=E}),u=this._shadowPolygonPts=g,c=this._shadowPolylinePts=m}this._shadowData=o,this._shadowDim=l,this._shadowSize=[i[0],i[1]];var M=this.dataZoomModel;function S(C){var b=M.getModel(C?"selectedDataBackground":"dataBackground"),E=new Ze,I=new ei({shape:{points:u},segmentIgnoreThreshold:1,style:b.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),R=new $r({shape:{points:c},segmentIgnoreThreshold:1,style:b.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return E.add(I),E.add(R),E}for(var w=0;w<3;w++){var T=S(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},e.prototype._prepareDataShadowInfo=function(){var t=this.dataZoomModel,i=t.get("showDataShadow");if(i!==!1){var n,a=this.ecModel;return t.eachTargetAxis(function(o,s){var l=t.getAxisProxy(o,s).getTargetSeriesModels();N(l,function(u){if(!n&&!(i!==!0&&dt(Rbe,u.get("type"))<0)){var c=a.getComponent(ds(o),s).axis,f=Dbe(o),h,p=u.coordinateSystem;f!=null&&p.getOtherAxis&&(h=p.getOtherAxis(c).inverse),f=u.getData().mapDimension(f),n={thisAxis:c,series:u,thisDim:o,otherDim:f,otherAxisInverse:h}}},this)},this),n}},e.prototype._renderHandle=function(){var t=this.group,i=this._displayables,n=i.handles=[null,null],a=i.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,f=l.get("brushSelect"),h=i.filler=new qx({silent:f,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(h),o.add(new qx({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:Ebe,fill:"rgba(0,0,0,0)"}})),N([0,1],function(y){var x=l.get("handleIcon");!W_[x]&&x.indexOf("path://")<0&&x.indexOf("image://")<0&&(x="path://"+x);var M=Sr(x,-1,0,2,2,null,!0);M.attr({cursor:lJ(this._orient),draggable:!0,drift:Be(this._onDragMove,this,y),ondragend:Be(this._onDragEnd,this),onmouseover:Be(this._showDataInfo,this,!0),onmouseout:Be(this._showDataInfo,this,!1),z2:5});var S=M.getBoundingRect(),w=l.get("handleSize");this._handleHeight=Fe(w,this._size[1]),this._handleWidth=S.width/S.height*this._handleHeight,M.setStyle(l.getModel("handleStyle").getItemStyle()),M.style.strokeNoScale=!0,M.rectHover=!0,M.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Ol(M);var T=l.get("handleColor");T!=null&&(M.style.fill=T),o.add(n[y]=M);var C=l.getModel("textStyle");t.add(a[y]=new Lt({silent:!0,invisible:!0,style:fr(C,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:C.getTextColor(),font:C.getFont()}),z2:10}))},this);var p=h;if(f){var d=Fe(l.get("moveHandleSize"),s[1]),g=i.moveHandle=new Tt({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:d}}),m=d*.8,v=i.moveHandleIcon=Sr(l.get("moveHandleIcon"),-m/2,-m/2,m,m,"#fff",!0);v.silent=!0,v.y=s[1]+d/2-.5,g.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(d,10));p=i.moveZone=new Tt({invisible:!0,shape:{y:s[1]-_,height:d+_}}),p.on("mouseover",function(){u.enterEmphasis(g)}).on("mouseout",function(){u.leaveEmphasis(g)}),o.add(g),o.add(v),o.add(p)}p.attr({draggable:!0,cursor:lJ(this._orient),drift:Be(this._onDragMove,this,"all"),ondragstart:Be(this._showDataInfo,this,!0),ondragend:Be(this._onDragEnd,this),onmouseover:Be(this._showDataInfo,this,!0),onmouseout:Be(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var t=this._range=this.dataZoomModel.getPercentRange(),i=this._getViewExtent();this._handleEnds=[rr(t[0],[0,100],i,!0),rr(t[1],[0,100],i,!0)]},e.prototype._updateInterval=function(t,i){var n=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=n.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];Xa(i,a,o,n.get("zoomLock")?"all":t,s.minSpan!=null?rr(s.minSpan,l,o,!0):null,s.maxSpan!=null?rr(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Ti([rr(a[0],o,l,!0),rr(a[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},e.prototype._updateView=function(t){var i=this._displayables,n=this._handleEnds,a=Ti(n.slice()),o=this._size;N([0,1],function(p){var d=i.handles[p],g=this._handleHeight;d.attr({scaleX:g/2,scaleY:g/2,x:n[p]+(p?-1:1),y:o[1]/2-g/2})},this),i.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};i.moveHandle&&(i.moveHandle.setShape(s),i.moveZone.setShape(s),i.moveZone.getBoundingRect(),i.moveHandleIcon&&i.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=i.dataShadowSegs,u=[0,a[0],a[1],o[0]],c=0;c<l.length;c++){var f=l[c],h=f.getClipPath();h||(h=new Tt,f.setClipPath(h)),h.setShape({x:u[c],y:0,width:u[c+1]-u[c],height:o[1]})}this._updateDataInfo(t)},e.prototype._updateDataInfo=function(t){var i=this.dataZoomModel,n=this._displayables,a=n.handleLabels,o=this._orient,s=["",""];if(i.get("showDetail")){var l=i.findRepresentativeAxisProxy();if(l){var u=l.getAxisModel().axis,c=this._range,f=t?l.calculateDataWindow({start:c[0],end:c[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(f[0],u),this._formatLabel(f[1],u)]}}var h=Ti(this._handleEnds.slice());p.call(this,0),p.call(this,1);function p(d){var g=ks(n.handles[d].parent,this.group),m=Up(d===0?"right":"left",g),v=this._handleWidth/2+Cbe,_=wn([h[d]+(d===0?-v:v),this._size[1]/2],g);a[d].setStyle({x:_[0],y:_[1],verticalAlign:o===Zx?"middle":m,align:o===Zx?m:"center",text:s[d]})}},e.prototype._formatLabel=function(t,i){var n=this.dataZoomModel,a=n.get("labelFormatter"),o=n.get("labelPrecision");(o==null||o==="auto")&&(o=i.getPixelPrecision());var s=t==null||isNaN(t)?"":i.type==="category"||i.type==="time"?i.scale.getLabel({value:Math.round(t)}):t.toFixed(Math.min(o,20));return He(a)?a(t,s):Ce(a)?a.replace("{value}",s):s},e.prototype._showDataInfo=function(t){t=this._dragging||t;var i=this._displayables,n=i.handleLabels;n[0].attr("invisible",!t),n[1].attr("invisible",!t),i.moveHandle&&this.api[t?"enterEmphasis":"leaveEmphasis"](i.moveHandle,1)},e.prototype._onDragMove=function(t,i,n,a){this._dragging=!0,Ea(a.event);var o=this._displayables.sliderGroup.getLocalTransform(),s=wn([i,n],o,!0),l=this._updateInterval(t,s[0]),u=this.dataZoomModel.get("realtime");this._updateView(!u),l&&u&&this._dispatchZoomAction(!0)},e.prototype._onDragEnd=function(){this._dragging=!1,this._showDataInfo(!1);var t=this.dataZoomModel.get("realtime");!t&&this._dispatchZoomAction(!1)},e.prototype._onClickPanel=function(t){var i=this._size,n=this._displayables.sliderGroup.transformCoordToLocal(t.offsetX,t.offsetY);if(!(n[0]<0||n[0]>i[0]||n[1]<0||n[1]>i[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",n[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(t){var i=t.offsetX,n=t.offsetY;this._brushStart=new Nt(i,n),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(t){if(this._brushing){var i=this._displayables.brushRect;if(this._brushing=!1,!!i){i.attr("ignore",!0);var n=i.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(n.width)<5)){var o=this._getViewExtent(),s=[0,100];this._range=Ti([rr(n.x,o,s,!0),rr(n.x+n.width,o,s,!0)]),this._handleEnds=[n.x,n.x+n.width],this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(t){this._brushing&&(Ea(t.event),this._updateBrushRect(t.offsetX,t.offsetY))},e.prototype._updateBrushRect=function(t,i){var n=this._displayables,a=this.dataZoomModel,o=n.brushRect;o||(o=n.brushRect=new qx({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),n.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(t,i),c=l.transformCoordToLocal(s.x,s.y),f=this._size;u[0]=Math.max(Math.min(f[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:f[1]})},e.prototype._dispatchZoomAction=function(t){var i=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?Lbe:null,start:i[0],end:i[1]})},e.prototype._findCoordRect=function(){var t,i=rE(this.dataZoomModel).infoList;if(!t&&i.length){var n=i[0].model.coordinateSystem;t=n.getRect&&n.getRect()}if(!t){var a=this.api.getWidth(),o=this.api.getHeight();t={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return t},e.type="dataZoom.slider",e}(Jv);function Dbe(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function lJ(r){return r==="vertical"?"ns-resize":"ew-resize"}var uJ=Pbe;function jx(r){r.registerComponentModel(aJ),r.registerComponentView(uJ),fd(r)}function QO(r){It(Yx),It(jx)}var Ibe={get:function(r,e,t){var i=Qe((Nbe[r]||{})[e]);return t&&pe(i)?i[i.length-1]:i}},Nbe={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},ME=Ibe;var cJ=pi.mapVisual,Ube=pi.eachVisual,Obe=pe,fJ=N,Fbe=Ti,zbe=rr,Bbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.stateList=["inRange","outOfRange"],t.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],t.layoutMode={type:"box",ignoreSize:!0},t.dataBound=[-1/0,1/0],t.targetVisuals={},t.controllerVisuals={},t}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n)},e.prototype.optionUpdated=function(t,i){var n=this.option;!i&&lE(n,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(t){var i=this.stateList;t=Be(t,this),this.controllerVisuals=Gx(this.option.controller,i,t),this.targetVisuals=Gx(this.option.target,i,t)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var t=this.option.seriesIndex,i=[];return t==null||t==="all"?this.ecModel.eachSeries(function(n,a){i.push(a)}):i=Jt(t),i},e.prototype.eachTargetSeries=function(t,i){N(this.getTargetSeriesIndices(),function(n){var a=this.ecModel.getSeriesByIndex(n);a&&t.call(i,a)},this)},e.prototype.isTargetSeries=function(t){var i=!1;return this.eachTargetSeries(function(n){n===t&&(i=!0)}),i},e.prototype.formatValueText=function(t,i,n){var a=this.option,o=a.precision,s=this.dataBound,l=a.formatter,u;n=n||["<",">"],pe(t)&&(t=t.slice(),u=!0);var c=i?t:u?[f(t[0]),f(t[1])]:f(t);if(Ce(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(He(l))return u?l(t[0],t[1]):l(t);if(u)return t[0]===s[0]?n[0]+" "+c[1]:t[1]===s[1]?n[1]+" "+c[0]:c[0]+" - "+c[1];return c;function f(h){return h===s[0]?"min":h===s[1]?"max":(+h).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,i=Fbe([t.min,t.max]);this._dataExtent=i},e.prototype.getDataDimensionIndex=function(t){var i=this.option.dimension;if(i!=null)return t.getDimensionIndex(i);for(var n=t.dimensions,a=n.length-1;a>=0;a--){var o=n[a],s=t.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var t=this.ecModel,i=this.option,n={inRange:i.inRange,outOfRange:i.outOfRange},a=i.target||(i.target={}),o=i.controller||(i.controller={});_t(a,n),_t(o,n);var s=this.isCategory();l.call(this,a),l.call(this,o),u.call(this,a,"inRange","outOfRange"),c.call(this,o);function l(f){Obe(i.color)&&!f.inRange&&(f.inRange={color:i.color.slice().reverse()}),f.inRange=f.inRange||{color:t.get("gradientColor")}}function u(f,h,p){var d=f[h],g=f[p];d&&!g&&(g=f[p]={},fJ(d,function(m,v){if(pi.isValidType(v)){var _=ME.get(v,"inactive",s);_!=null&&(g[v]=_,v==="color"&&!g.hasOwnProperty("opacity")&&!g.hasOwnProperty("colorAlpha")&&(g.opacity=[0,0]))}}))}function c(f){var h=(f.inRange||{}).symbol||(f.outOfRange||{}).symbol,p=(f.inRange||{}).symbolSize||(f.outOfRange||{}).symbolSize,d=this.get("inactiveColor"),g=this.getItemSymbol(),m=g||"roundRect";fJ(this.stateList,function(v){var _=this.itemSize,y=f[v];y||(y=f[v]={color:s?d:[d]}),y.symbol==null&&(y.symbol=h&&Qe(h)||(s?m:[m])),y.symbolSize==null&&(y.symbolSize=p&&Qe(p)||(s?_[0]:[_[0],_[0]])),y.symbol=cJ(y.symbol,function(S){return S==="none"?m:S});var x=y.symbolSize;if(x!=null){var M=-1/0;Ube(x,function(S){S>M&&(M=S)}),y.symbolSize=cJ(x,function(S){return zbe(S,[0,M],[0,_[0]],!0)})}},this)}},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(t){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(t){return null},e.prototype.getVisualMeta=function(t){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},e}(Pt),rg=Bbe;var hJ=[20,140],kbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(t,i){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(n){n.mappingMethod="linear",n.dataExtent=this.getExtent()}),this._resetRange()},e.prototype.resetItemSize=function(){r.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=hJ[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=hJ[1])},e.prototype._resetRange=function(){var t=this.getExtent(),i=this.option.range;!i||i.auto?(t.auto=1,this.option.range=t):pe(i)&&(i[0]>i[1]&&i.reverse(),i[0]=Math.max(i[0],t[0]),i[1]=Math.min(i[1],t[1]))},e.prototype.completeVisualOption=function(){r.prototype.completeVisualOption.apply(this,arguments),N(this.stateList,function(t){var i=this.option.controller[t].symbolSize;i&&i[0]!==i[1]&&(i[0]=i[1]/3)},this)},e.prototype.setSelected=function(t){this.option.range=t.slice(),this._resetRange()},e.prototype.getSelected=function(){var t=this.getExtent(),i=Ti((this.get("range")||[]).slice());return i[0]>t[1]&&(i[0]=t[1]),i[1]>t[1]&&(i[1]=t[1]),i[0]<t[0]&&(i[0]=t[0]),i[1]<t[0]&&(i[1]=t[0]),i},e.prototype.getValueState=function(t){var i=this.option.range,n=this.getExtent();return(i[0]<=n[0]||i[0]<=t)&&(i[1]>=n[1]||t<=i[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var i=[];return this.eachTargetSeries(function(n){var a=[],o=n.getData();o.each(this.getDataDimensionIndex(o),function(s,l){t[0]<=s&&s<=t[1]&&a.push(l)},this),i.push({seriesId:n.id,dataIndex:a})},this),i},e.prototype.getVisualMeta=function(t){var i=pJ(this,"outOfRange",this.getExtent()),n=pJ(this,"inRange",this.option.range.slice()),a=[];function o(p,d){a.push({value:p,color:t(p,d)})}for(var s=0,l=0,u=n.length,c=i.length;l<c&&(!n.length||i[l]<=n[0]);l++)i[l]<n[s]&&o(i[l],"outOfRange");for(var f=1;s<u;s++,f=0)f&&a.length&&o(n[s],"outOfRange"),o(n[s],"inRange");for(var f=1;l<c;l++)(!n.length||n[n.length-1]<i[l])&&(f&&(a.length&&o(a[a.length-1].value,"outOfRange"),f=0),o(i[l],"outOfRange"));var h=a.length;return{stops:a,outerColors:[h?a[0].color:"transparent",h?a[h-1].color:"transparent"]}},e.type="visualMap.continuous",e.defaultOption=Hn(rg.defaultOption,{align:"auto",calculable:!1,hoverLink:!0,realtime:!0,handleIcon:"path://M-11.39,9.77h0a3.5,3.5,0,0,1-3.5,3.5h-22a3.5,3.5,0,0,1-3.5-3.5h0a3.5,3.5,0,0,1,3.5-3.5h22A3.5,3.5,0,0,1-11.39,9.77Z",handleSize:"120%",handleStyle:{borderColor:"#fff",borderWidth:1},indicatorIcon:"circle",indicatorSize:"50%",indicatorStyle:{borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}}),e}(rg);function pJ(r,e,t){if(t[0]===t[1])return t.slice();for(var i=200,n=(t[1]-t[0])/i,a=t[0],o=[],s=0;s<=i&&a<t[1];s++)o.push(a),a+=n;return o.push(t[1]),o}var dJ=kbe;var Vbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.autoPositionValues={left:1,right:1,top:1,bottom:1},t}return e.prototype.init=function(t,i){this.ecModel=t,this.api=i},e.prototype.render=function(t,i,n,a){if(this.visualMapModel=t,t.get("show")===!1){this.group.removeAll();return}this.doRender(t,i,n,a)},e.prototype.renderBackground=function(t){var i=this.visualMapModel,n=Gs(i.get("padding")||0),a=t.getBoundingRect();t.add(new Tt({z2:-1,silent:!0,shape:{x:a.x-n[3],y:a.y-n[0],width:a.width+n[3]+n[1],height:a.height+n[0]+n[2]},style:{fill:i.get("backgroundColor"),stroke:i.get("borderColor"),lineWidth:i.get("borderWidth")}}))},e.prototype.getControllerVisual=function(t,i,n){n=n||{};var a=n.forceState,o=this.visualMapModel,s={};if(i==="color"){var l=o.get("contentColor");s.color=l}function u(p){return s[p]}function c(p,d){s[p]=d}var f=o.controllerVisuals[a||o.getValueState(t)],h=pi.prepareVisualTypes(f);return N(h,function(p){var d=f[p];n.convertOpacityToAlpha&&p==="opacity"&&(p="colorAlpha",d=f.__alphaForOpacity),pi.dependsOn(p,i)&&d&&d.applyVisual(t,u,c)}),s[i]},e.prototype.positionGroup=function(t){var i=this.visualMapModel,n=this.api;Ef(t,i.getBoxLayoutParams(),{width:n.getWidth(),height:n.getHeight()})},e.prototype.doRender=function(t,i,n,a){},e.type="visualMap",e}(Qt),bE=Vbe;var mJ=[["left","right","width"],["top","bottom","height"]];function wE(r,e,t){var i=r.option,n=i.align;if(n!=null&&n!=="auto")return n;for(var a={width:e.getWidth(),height:e.getHeight()},o=i.orient==="horizontal"?1:0,s=mJ[o],l=[0,null,10],u={},c=0;c<3;c++)u[mJ[1-o][c]]=l[c],u[s[c]]=c===2?t[0]:i[s[c]];var f=[["x","width",3],["y","height",0]][o],h=xr(u,a,i.padding);return s[(h.margin[f[2]]||0)+h[f[0]]+h[f[1]]*.5<a[f[1]]*.5?0:1]}function ig(r,e){return N(r||[],function(t){t.dataIndex!=null&&(t.dataIndexInside=t.dataIndex,t.dataIndex=null),t.highlightKey="visualMap"+(e?e.componentIndex:"")}),r}var Ql=rr,Gbe=N,gJ=Math.min,e3=Math.max,Hbe=12,Wbe=6,Xbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._shapes={},t._dataInterval=[],t._handleEnds=[],t._hoverLinkDataIndices=[],t}return e.prototype.init=function(t,i){r.prototype.init.call(this,t,i),this._hoverLinkFromSeriesMouseOver=Be(this._hoverLinkFromSeriesMouseOver,this),this._hideIndicator=Be(this._hideIndicator,this)},e.prototype.doRender=function(t,i,n,a){(!a||a.type!=="selectDataRange"||a.from!==this.uid)&&this._buildView()},e.prototype._buildView=function(){this.group.removeAll();var t=this.visualMapModel,i=this.group;this._orient=t.get("orient"),this._useHandle=t.get("calculable"),this._resetInterval(),this._renderBar(i);var n=t.get("text");this._renderEndsText(i,n,0),this._renderEndsText(i,n,1),this._updateView(!0),this.renderBackground(i),this._updateView(),this._enableHoverLinkToSeries(),this._enableHoverLinkFromSeries(),this.positionGroup(i)},e.prototype._renderEndsText=function(t,i,n){if(i){var a=i[1-n];a=a!=null?a+"":"";var o=this.visualMapModel,s=o.get("textGap"),l=o.itemSize,u=this._shapes.mainGroup,c=this._applyTransform([l[0]/2,n===0?-s:l[1]+s],u),f=this._applyTransform(n===0?"bottom":"top",u),h=this._orient,p=this.visualMapModel.textStyleModel;this.group.add(new Lt({style:fr(p,{x:c[0],y:c[1],verticalAlign:h==="horizontal"?"middle":f,align:h==="horizontal"?f:"center",text:a})}))}},e.prototype._renderBar=function(t){var i=this.visualMapModel,n=this._shapes,a=i.itemSize,o=this._orient,s=this._useHandle,l=wE(i,this.api,a),u=n.mainGroup=this._createBarGroup(l),c=new Ze;u.add(c),c.add(n.outOfRange=yJ()),c.add(n.inRange=yJ(null,s?xJ(this._orient):null,Be(this._dragHandle,this,"all",!1),Be(this._dragHandle,this,"all",!0))),c.setClipPath(new Tt({shape:{x:0,y:0,width:a[0],height:a[1],r:3}}));var f=i.textStyleModel.getTextRect("\u56FD"),h=e3(f.width,f.height);s&&(n.handleThumbs=[],n.handleLabels=[],n.handleLabelPoints=[],this._createHandle(i,u,0,a,h,o),this._createHandle(i,u,1,a,h,o)),this._createIndicator(i,u,a,h,o),t.add(u)},e.prototype._createHandle=function(t,i,n,a,o,s){var l=Be(this._dragHandle,this,n,!1),u=Be(this._dragHandle,this,n,!0),c=xn(t.get("handleSize"),a[0]),f=Sr(t.get("handleIcon"),-c/2,-c/2,c,c,null,!0),h=xJ(this._orient);f.attr({cursor:h,draggable:!0,drift:l,ondragend:u,onmousemove:function(v){Ea(v.event)}}),f.x=a[0]/2,f.useStyle(t.getModel("handleStyle").getItemStyle()),f.setStyle({strokeNoScale:!0,strokeFirst:!0}),f.style.lineWidth*=2,f.ensureState("emphasis").style=t.getModel(["emphasis","handleStyle"]).getItemStyle(),Eu(f,!0),i.add(f);var p=this.visualMapModel.textStyleModel,d=new Lt({cursor:h,draggable:!0,drift:l,onmousemove:function(v){Ea(v.event)},ondragend:u,style:fr(p,{x:0,y:0,text:""})});d.ensureState("blur").style={opacity:.1},d.stateTransition={duration:200},this.group.add(d);var g=[c,0],m=this._shapes;m.handleThumbs[n]=f,m.handleLabelPoints[n]=g,m.handleLabels[n]=d},e.prototype._createIndicator=function(t,i,n,a,o){var s=xn(t.get("indicatorSize"),n[0]),l=Sr(t.get("indicatorIcon"),-s/2,-s/2,s,s,null,!0);l.attr({cursor:"move",invisible:!0,silent:!0,x:n[0]/2});var u=t.getModel("indicatorStyle").getItemStyle();if(l instanceof Ur){var c=l.style;l.useStyle(fe({image:c.image,x:c.x,y:c.y,width:c.width,height:c.height},u))}else l.useStyle(u);i.add(l);var f=this.visualMapModel.textStyleModel,h=new Lt({silent:!0,invisible:!0,style:fr(f,{x:0,y:0,text:""})});this.group.add(h);var p=[(o==="horizontal"?a/2:Wbe)+n[0]/2,0],d=this._shapes;d.indicator=l,d.indicatorLabel=h,d.indicatorLabelPoint=p,this._firstShowIndicator=!0},e.prototype._dragHandle=function(t,i,n,a){if(this._useHandle){if(this._dragging=!i,!i){var o=this._applyTransform([n,a],this._shapes.mainGroup,!0);this._updateInterval(t,o[1]),this._hideIndicator(),this._updateView()}i===!this.visualMapModel.get("realtime")&&this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:this._dataInterval.slice()}),i?!this._hovering&&this._clearHoverLinkToSeries():_J(this.visualMapModel)&&this._doHoverLinkToSeries(this._handleEnds[t],!1)}},e.prototype._resetInterval=function(){var t=this.visualMapModel,i=this._dataInterval=t.getSelected(),n=t.getExtent(),a=[0,t.itemSize[1]];this._handleEnds=[Ql(i[0],n,a,!0),Ql(i[1],n,a,!0)]},e.prototype._updateInterval=function(t,i){i=i||0;var n=this.visualMapModel,a=this._handleEnds,o=[0,n.itemSize[1]];Xa(i,a,o,t,0);var s=n.getExtent();this._dataInterval=[Ql(a[0],o,s,!0),Ql(a[1],o,s,!0)]},e.prototype._updateView=function(t){var i=this.visualMapModel,n=i.getExtent(),a=this._shapes,o=[0,i.itemSize[1]],s=t?o:this._handleEnds,l=this._createBarVisual(this._dataInterval,n,s,"inRange"),u=this._createBarVisual(n,n,o,"outOfRange");a.inRange.setStyle({fill:l.barColor}).setShape("points",l.barPoints),a.outOfRange.setStyle({fill:u.barColor}).setShape("points",u.barPoints),this._updateHandle(s,l)},e.prototype._createBarVisual=function(t,i,n,a){var o={forceState:a,convertOpacityToAlpha:!0},s=this._makeColorGradient(t,o),l=[this.getControllerVisual(t[0],"symbolSize",o),this.getControllerVisual(t[1],"symbolSize",o)],u=this._createBarPoints(n,l);return{barColor:new zl(0,0,0,1,s),barPoints:u,handlesColor:[s[0].color,s[s.length-1].color]}},e.prototype._makeColorGradient=function(t,i){var n=100,a=[],o=(t[1]-t[0])/n;a.push({color:this.getControllerVisual(t[0],"color",i),offset:0});for(var s=1;s<n;s++){var l=t[0]+o*s;if(l>t[1])break;a.push({color:this.getControllerVisual(l,"color",i),offset:s/n})}return a.push({color:this.getControllerVisual(t[1],"color",i),offset:1}),a},e.prototype._createBarPoints=function(t,i){var n=this.visualMapModel.itemSize;return[[n[0]-i[0],t[0]],[n[0],t[0]],[n[0],t[1]],[n[0]-i[1],t[1]]]},e.prototype._createBarGroup=function(t){var i=this._orient,n=this.visualMapModel.get("inverse");return new Ze(i==="horizontal"&&!n?{scaleX:t==="bottom"?1:-1,rotation:Math.PI/2}:i==="horizontal"&&n?{scaleX:t==="bottom"?-1:1,rotation:-Math.PI/2}:i==="vertical"&&!n?{scaleX:t==="left"?1:-1,scaleY:-1}:{scaleX:t==="left"?1:-1})},e.prototype._updateHandle=function(t,i){if(this._useHandle){var n=this._shapes,a=this.visualMapModel,o=n.handleThumbs,s=n.handleLabels,l=a.itemSize,u=a.getExtent();Gbe([0,1],function(c){var f=o[c];f.setStyle("fill",i.handlesColor[c]),f.y=t[c];var h=Ql(t[c],[0,l[1]],u,!0),p=this.getControllerVisual(h,"symbolSize");f.scaleX=f.scaleY=p/l[0],f.x=l[0]-p/2;var d=wn(n.handleLabelPoints[c],ks(f,this.group));s[c].setStyle({x:d[0],y:d[1],text:a.formatValueText(this._dataInterval[c]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",n.mainGroup):"center"})},this)}},e.prototype._showIndicator=function(t,i,n,a){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,f=c.indicator;if(f){f.attr("invisible",!1);var h={convertOpacityToAlpha:!0},p=this.getControllerVisual(t,"color",h),d=this.getControllerVisual(t,"symbolSize"),g=Ql(t,s,u,!0),m=l[0]-d/2,v={x:f.x,y:f.y};f.y=g,f.x=m;var _=wn(c.indicatorLabelPoint,ks(f,this.group)),y=c.indicatorLabel;y.attr("invisible",!1);var x=this._applyTransform("left",c.mainGroup),M=this._orient,S=M==="horizontal";y.setStyle({text:(n||"")+o.formatValueText(i),verticalAlign:S?x:"middle",align:S?"center":x});var w={x:m,y:g,style:{fill:p}},T={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var C={duration:100,easing:"cubicInOut",additive:!0};f.x=v.x,f.y=v.y,f.animateTo(w,C),y.animateTo(T,C)}else f.attr(w),y.attr(T);this._firstShowIndicator=!1;var b=this._shapes.handleLabels;if(b)for(var E=0;E<b.length;E++)this.api.enterBlur(b[E])}},e.prototype._enableHoverLinkToSeries=function(){var t=this;this._shapes.mainGroup.on("mousemove",function(i){if(t._hovering=!0,!t._dragging){var n=t.visualMapModel.itemSize,a=t._applyTransform([i.offsetX,i.offsetY],t._shapes.mainGroup,!0,!0);a[1]=gJ(e3(0,a[1]),n[1]),t._doHoverLinkToSeries(a[1],0<=a[0]&&a[0]<=n[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},e.prototype._enableHoverLinkFromSeries=function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},e.prototype._doHoverLinkToSeries=function(t,i){var n=this.visualMapModel,a=n.itemSize;if(n.option.hoverLink){var o=[0,a[1]],s=n.getExtent();t=gJ(e3(o[0],t),o[1]);var l=Ybe(n,s,o),u=[t-l,t+l],c=Ql(t,o,s,!0),f=[Ql(u[0],o,s,!0),Ql(u[1],o,s,!0)];u[0]<o[0]&&(f[0]=-1/0),u[1]>o[1]&&(f[1]=1/0),i&&(f[0]===-1/0?this._showIndicator(c,f[1],"< ",l):f[1]===1/0?this._showIndicator(c,f[0],"> ",l):this._showIndicator(c,c,"\u2248 ",l));var h=this._hoverLinkDataIndices,p=[];(i||_J(n))&&(p=this._hoverLinkDataIndices=n.findTargetDataIndices(f));var d=lH(h,p);this._dispatchHighDown("downplay",ig(d[0],n)),this._dispatchHighDown("highlight",ig(d[1],n))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var i;if(Ys(t.target,function(l){var u=rt(l);if(u.dataIndex!=null)return i=u,!0},!0),!!i){var n=this.ecModel.getSeriesByIndex(i.seriesIndex),a=this.visualMapModel;if(a.isTargetSeries(n)){var o=n.getData(i.dataType),s=o.getStore().get(a.getDataDimensionIndex(o),i.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},e.prototype._hideIndicator=function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0);var i=this._shapes.handleLabels;if(i)for(var n=0;n<i.length;n++)this.api.leaveBlur(i[n])},e.prototype._clearHoverLinkToSeries=function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",ig(t,this.visualMapModel)),t.length=0},e.prototype._clearHoverLinkFromSeries=function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},e.prototype._applyTransform=function(t,i,n,a){var o=ks(i,a?null:this.group);return pe(t)?wn(t,o,n):Up(t,o,n)},e.prototype._dispatchHighDown=function(t,i){i&&i.length&&this.api.dispatchAction({type:t,batch:i})},e.prototype.dispose=function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},e.type="visualMap.continuous",e}(bE);function yJ(r,e,t,i){return new ei({shape:{points:r},draggable:!!t,cursor:e,drift:t,onmousemove:function(n){Ea(n.event)},ondragend:i})}function Ybe(r,e,t){var i=Hbe/2,n=r.get("hoverLinkDataSize");return n&&(i=Ql(n,e,t,!0)/2),i}function _J(r){var e=r.get("hoverLinkOnHandle");return!!(e??r.get("realtime"))}function xJ(r){return r==="vertical"?"ns-resize":"ew-resize"}var SJ=Xbe;var MJ={type:"selectDataRange",event:"dataRangeSelected",update:"update"},bJ=function(r,e){e.eachComponent({mainType:"visualMap",query:r},function(t){t.setSelected(r.selected)})};var wJ=[{createOnAllSeries:!0,reset:function(r,e){var t=[];return e.eachComponent("visualMap",function(i){var n=r.pipelineContext;!i.isTargetSeries(r)||n&&n.large||t.push(cK(i.stateList,i.targetVisuals,Be(i.getValueState,i),i.getDataDimensionIndex(r.getData())))}),t}},{createOnAllSeries:!0,reset:function(r,e){var t=r.getData(),i=[];e.eachComponent("visualMap",function(n){if(n.isTargetSeries(r)){var a=n.getVisualMeta(Be(qbe,null,r,n))||{stops:[],outerColors:[]},o=n.getDataDimensionIndex(t);o>=0&&(a.dimension=o,i.push(a))}}),r.getData().setVisual("visualMeta",i)}}];function qbe(r,e,t,i){for(var n=e.targetVisuals[i],a=pi.prepareVisualTypes(n),o={color:kl(r.getData(),"color")},s=0,l=a.length;s<l;s++){var u=a[s],c=n[u==="opacity"?"__alphaForOpacity":u];c&&c.applyVisual(t,f,h)}return o.color;function f(p){return o[p]}function h(p,d){o[p]=d}}var TJ=N;function t3(r){var e=r&&r.visualMap;pe(e)||(e=e?[e]:[]),TJ(e,function(t){if(t){ng(t,"splitList")&&!ng(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var i=t.pieces;i&&pe(i)&&TJ(i,function(n){qe(n)&&(ng(n,"start")&&!ng(n,"min")&&(n.min=n.start),ng(n,"end")&&!ng(n,"max")&&(n.max=n.end))})}})}function ng(r,e){return r&&r.hasOwnProperty&&r.hasOwnProperty(e)}var EJ=!1;function Kx(r){EJ||(EJ=!0,r.registerSubTypeDefaulter("visualMap",function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(MJ,bJ),N(wJ,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor(t3))}function Jx(r){r.registerComponentModel(dJ),r.registerComponentView(SJ),Kx(r)}var Zbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._pieceList=[],t}return e.prototype.optionUpdated=function(t,i){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var n=this._mode=this._determineMode();this._pieceList=[],jbe[this._mode].call(this,this._pieceList),this._resetSelected(t,i);var a=this.option.categories;this.resetVisual(function(o,s){n==="categories"?(o.mappingMethod="category",o.categories=Qe(a)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=de(this._pieceList,function(l){return l=Qe(l),s!=="inRange"&&(l.visual=null),l}))})},e.prototype.completeVisualOption=function(){var t=this.option,i={},n=pi.listVisualTypes(),a=this.isCategory();N(t.pieces,function(s){N(n,function(l){s.hasOwnProperty(l)&&(i[l]=1)})}),N(i,function(s,l){var u=!1;N(this.stateList,function(c){u=u||o(t,c,l)||o(t.target,c,l)},this),!u&&N(this.stateList,function(c){(t[c]||(t[c]={}))[l]=ME.get(l,c==="inRange"?"active":"inactive",a)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}r.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(t,i){var n=this.option,a=this._pieceList,o=(i?n:t).selected||{};if(n.selected=o,N(a,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),n.selectedMode==="single"){var s=!1;N(a,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(t){return this._mode==="categories"?t.value+"":t.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(t){this.option.selected=Qe(t)},e.prototype.getValueState=function(t){var i=pi.findPieceIndex(t,this._pieceList);return i!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[i])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var i=[],n=this._pieceList;return this.eachTargetSeries(function(a){var o=[],s=a.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=pi.findPieceIndex(l,n);c===t&&o.push(u)},this),i.push({seriesId:a.id,dataIndex:o})},this),i},e.prototype.getRepresentValue=function(t){var i;if(this.isCategory())i=t.value;else if(t.value!=null)i=t.value;else{var n=t.interval||[];i=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return i},e.prototype.getVisualMeta=function(t){if(this.isCategory())return;var i=[],n=["",""],a=this;function o(c,f){var h=a.getRepresentValue({interval:c});f||(f=a.getValueState(h));var p=t(h,f);c[0]===-1/0?n[0]=p:c[1]===1/0?n[1]=p:i.push({value:c[0],color:p},{value:c[1],color:p})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return N(s,function(c){var f=c.interval;f&&(f[0]>u&&o([u,f[0]],"outOfRange"),o(f.slice()),u=f[1])},this),{stops:i,outerColors:n}},e.type="visualMap.piecewise",e.defaultOption=Hn(rg.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),e}(rg),jbe={splitNumber:function(r){var e=this.option,t=Math.min(e.precision,20),i=this.getExtent(),n=e.splitNumber;n=Math.max(parseInt(n,10),1),e.splitNumber=n;for(var a=(i[1]-i[0])/n;+a.toFixed(t)!==a&&t<5;)t++;e.precision=t,a=+a.toFixed(t),e.minOpen&&r.push({interval:[-1/0,i[0]],close:[0,0]});for(var o=0,s=i[0];o<n;s+=a,o++){var l=o===n-1?i[1]:s+a;r.push({interval:[s,l],close:[1,1]})}e.maxOpen&&r.push({interval:[i[1],1/0],close:[0,0]}),r_(r),N(r,function(u,c){u.index=c,u.text=this.formatValueText(u.interval)},this)},categories:function(r){var e=this.option;N(e.categories,function(t){r.push({text:this.formatValueText(t,!0),value:t})},this),AJ(e,r)},pieces:function(r){var e=this.option;N(e.pieces,function(t,i){qe(t)||(t={value:t});var n={text:"",index:i};if(t.label!=null&&(n.text=t.label),t.hasOwnProperty("value")){var a=n.value=t.value;n.interval=[a,a],n.close=[1,1]}else{for(var o=n.interval=[],s=n.close=[0,0],l=[1,0,1],u=[-1/0,1/0],c=[],f=0;f<2;f++){for(var h=[["gte","gt","min"],["lte","lt","max"]][f],p=0;p<3&&o[f]==null;p++)o[f]=t[h[p]],s[f]=l[p],c[f]=p===2;o[f]==null&&(o[f]=u[f])}c[0]&&o[1]===1/0&&(s[0]=0),c[1]&&o[0]===-1/0&&(s[1]=0),o[0]===o[1]&&s[0]&&s[1]&&(n.value=o[0])}n.visual=pi.retrieveVisuals(t),r.push(n)},this),AJ(e,r),r_(r),N(r,function(t){var i=t.close,n=[["<","\u2264"][i[1]],[">","\u2265"][i[0]]];t.text=t.text||this.formatValueText(t.value!=null?t.value:t.interval,!1,n)},this)}};function AJ(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var CJ=Zbe;var Kbe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.doRender=function(){var t=this.group;t.removeAll();var i=this.visualMapModel,n=i.get("textGap"),a=i.textStyleModel,o=a.getFont(),s=a.getTextColor(),l=this._getItemAlign(),u=i.itemSize,c=this._getViewData(),f=c.endsText,h=Br(i.get("showLabel",!0),!f);f&&this._renderEndsText(t,f[0],u,h,l),N(c.viewPieceList,function(p){var d=p.piece,g=new Ze;g.onclick=Be(this._onItemClick,this,d),this._enableHoverLink(g,p.indexInModelPieceList);var m=i.getRepresentValue(d);if(this._createItemSymbol(g,m,[0,0,u[0],u[1]]),h){var v=this.visualMapModel.getValueState(m);g.add(new Lt({style:{x:l==="right"?-n:u[0]+n,y:u[1]/2,text:d.text,verticalAlign:"middle",align:l,font:o,fill:s,opacity:v==="outOfRange"?.5:1}}))}t.add(g)},this),f&&this._renderEndsText(t,f[1],u,h,l),Ws(i.get("orient"),t,i.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},e.prototype._enableHoverLink=function(t,i){var n=this;t.on("mouseover",function(){return a("highlight")}).on("mouseout",function(){return a("downplay")});var a=function(o){var s=n.visualMapModel;s.option.hoverLink&&n.api.dispatchAction({type:o,batch:ig(s.findTargetDataIndices(i),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,i=t.option;if(i.orient==="vertical")return wE(t,this.api,t.itemSize);var n=i.align;return(!n||n==="auto")&&(n="left"),n},e.prototype._renderEndsText=function(t,i,n,a,o){if(i){var s=new Ze,l=this.visualMapModel.textStyleModel;s.add(new Lt({style:fr(l,{x:a?o==="right"?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:"middle",align:a?o:"center",text:i})})),t.add(s)}},e.prototype._getViewData=function(){var t=this.visualMapModel,i=de(t.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),n=t.get("text"),a=t.get("orient"),o=t.get("inverse");return(a==="horizontal"?o:!o)?i.reverse():n&&(n=n.slice().reverse()),{viewPieceList:i,endsText:n}},e.prototype._createItemSymbol=function(t,i,n){t.add(Sr(this.getControllerVisual(i,"symbol"),n[0],n[1],n[2],n[3],this.getControllerVisual(i,"color")))},e.prototype._onItemClick=function(t){var i=this.visualMapModel,n=i.option,a=n.selectedMode;if(a){var o=Qe(n.selected),s=i.getSelectedMapKey(t);a==="single"||a===!0?(o[s]=!0,N(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},e.type="visualMap.piecewise",e}(bE),RJ=Kbe;function $x(r){r.registerComponentModel(CJ),r.registerComponentView(RJ),Kx(r)}function r3(r){It(Jx),It($x)}var Jbe={label:{enabled:!0},decal:{show:!1}},LJ=vt(),$be={};function i3(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var i=Qe(Jbe);_t(i.label,r.getLocaleModel().get("aria"),!1),_t(t.option,i,!1),n(),a();function n(){var u=t.getModel("decal"),c=u.get("show");if(c){var f=ke();r.eachSeries(function(h){if(!h.isColorBySeries()){var p=f.get(h.type);p||(p={},f.set(h.type,p)),LJ(h).scope=p}}),r.eachRawSeries(function(h){if(r.isSeriesFiltered(h))return;if(He(h.enableAriaDecal)){h.enableAriaDecal();return}var p=h.getData();if(h.isColorBySeries()){var _=P_(h.ecModel,h.name,$be,r.getSeriesCount()),y=p.getVisual("decal");p.setVisual("decal",x(y,_))}else{var d=h.getRawData(),g={},m=LJ(h).scope;p.each(function(M){var S=p.getRawIndex(M);g[S]=M});var v=d.count();d.each(function(M){var S=g[M],w=d.getName(M)||M+"",T=P_(h.ecModel,w,m,v),C=p.getItemVisual(S,"decal");p.setItemVisual(S,"decal",x(C,T))})}function x(M,S){var w=M?fe(fe({},S),M):S;return w.dirty=!0,w}})}}function a(){var u=r.getLocaleModel().get("aria"),c=t.getModel("label");if(c.option=Ye(c.option,u),!!c.get("enabled")){var f=e.getZr().dom;if(c.get("description")){f.setAttribute("aria-label",c.get("description"));return}var h=r.getSeriesCount(),p=c.get(["data","maxCount"])||10,d=c.get(["series","maxCount"])||10,g=Math.min(h,d),m;if(!(h<1)){var v=s();if(v){var _=c.get(["general","withTitle"]);m=o(_,{title:v})}else m=c.get(["general","withoutTitle"]);var y=[],x=h>1?c.get(["series","multiple","prefix"]):c.get(["series","single","prefix"]);m+=o(x,{seriesCount:h}),r.eachSeries(function(T,C){if(C<g){var b=void 0,E=T.get("name"),I=E?"withName":"withoutName";b=h>1?c.get(["series","multiple",I]):c.get(["series","single",I]),b=o(b,{seriesId:T.seriesIndex,seriesName:T.get("name"),seriesType:l(T.subType)});var R=T.getData();if(R.count()>p){var A=c.get(["data","partialData"]);b+=o(A,{displayCnt:p})}else b+=c.get(["data","allData"]);for(var D=c.get(["data","separator","middle"]),U=c.get(["data","separator","end"]),B=[],F=0;F<R.count();F++)if(F<p){var k=R.getName(F),G=R.getValues(F),Y=c.get(["data",k?"withName":"withoutName"]);B.push(o(Y,{name:k,value:G.join(D)}))}b+=B.join(D)+U,y.push(b)}});var M=c.getModel(["series","multiple","separator"]),S=M.get("middle"),w=M.get("end");m+=y.join(S)+w,f.setAttribute("aria-label",m)}}}function o(u,c){if(!Ce(u))return u;var f=u;return N(c,function(h,p){f=f.replace(new RegExp("\\{\\s*"+p+"\\s*\\}","g"),h)}),f}function s(){var u=r.get("title");return u&&u.length&&(u=u[0]),u&&u.text}function l(u){var c=r.getLocaleModel().get(["series","typeNames"]);return c[u]||c.chart}}function n3(r){if(!(!r||!r.aria)){var e=r.aria;e.show!=null&&(e.enabled=e.show),e.label=e.label||{},N(["description","general","series","data"],function(t){e[t]!=null&&(e.label[t]=e[t])})}}function a3(r){r.registerPreprocessor(n3),r.registerVisual(r.PRIORITY.VISUAL.ARIA,i3)}var PJ={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},Qbe=function(){function r(e){var t=this._condVal=Ce(e)?new RegExp(e):FV(e)?e:null;if(t==null){var i="";ur(i)}}return r.prototype.evaluate=function(e){var t=typeof e;return Ce(t)?this._condVal.test(e):At(t)?this._condVal.test(e+""):!1},r}(),ewe=function(){function r(){}return r.prototype.evaluate=function(){return this.value},r}(),twe=function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t<e.length;t++)if(!e[t].evaluate())return!1;return!0},r}(),rwe=function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t<e.length;t++)if(e[t].evaluate())return!0;return!1},r}(),iwe=function(){function r(){}return r.prototype.evaluate=function(){return!this.child.evaluate()},r}(),nwe=function(){function r(){}return r.prototype.evaluate=function(){for(var e=!!this.valueParser,t=this.getValue,i=t(this.valueGetterParam),n=e?this.valueParser(i):null,a=0;a<this.subCondList.length;a++)if(!this.subCondList[a].evaluate(e?n:i))return!1;return!0},r}();function o3(r,e){if(r===!0||r===!1){var t=new ewe;return t.value=r,t}var i="";return IJ(r)||ur(i),r.and?DJ("and",r,e):r.or?DJ("or",r,e):r.not?awe(r,e):owe(r,e)}function DJ(r,e,t){var i=e[r],n="";pe(i)||ur(n),i.length||ur(n);var a=r==="and"?new twe:new rwe;return a.children=de(i,function(o){return o3(o,t)}),a.children.length||ur(n),a}function awe(r,e){var t=r.not,i="";IJ(t)||ur(i);var n=new iwe;return n.child=o3(t,e),n.child||ur(i),n}function owe(r,e){for(var t="",i=e.prepareGetValue(r),n=[],a=bt(r),o=r.parser,s=o?kw(o):null,l=0;l<a.length;l++){var u=a[l];if(!(u==="parser"||e.valueGetterAttrMap.get(u))){var c=tt(PJ,u)?PJ[u]:u,f=r[u],h=s?s(f):f,p=Q5(c,h)||c==="reg"&&new Qbe(h);p||ur(t),n.push(p)}}n.length||ur(t);var d=new nwe;return d.valueGetterParam=i,d.valueParser=s,d.getValue=e.getValue,d.subCondList=n,d}function IJ(r){return qe(r)&&!ci(r)}var swe=function(){function r(e,t){this._cond=o3(e,t)}return r.prototype.evaluate=function(){return this._cond.evaluate()},r}();function NJ(r,e){return new swe(r,e)}var UJ={type:"echarts:filter",transform:function(r){for(var e=r.upstream,t,i=NJ(r.config,{valueGetterAttrMap:ke({dimension:!0}),prepareGetValue:function(s){var l="",u=s.dimension;tt(s,"dimension")||ur(l);var c=e.getDimensionInfo(u);return c||ur(l),{dimIdx:c.index}},getValue:function(s){return e.retrieveValueFromItem(t,s.dimIdx)}}),n=[],a=0,o=e.count();a<o;a++)t=e.getRawDataItem(a),i.evaluate()&&n.push(t);return{data:n}}};var OJ={type:"echarts:sort",transform:function(r){var e=r.upstream,t=r.config,i="",n=Jt(t);n.length||ur(i);var a=[];N(n,function(c){var f=c.dimension,h=c.order,p=c.parser,d=c.incomparable;if(f==null&&ur(i),h!=="asc"&&h!=="desc"&&ur(i),d&&d!=="min"&&d!=="max"){var g="";ur(g)}if(h!=="asc"&&h!=="desc"){var m="";ur(m)}var v=e.getDimensionInfo(f);v||ur(i);var _=p?kw(p):null;p&&!_&&ur(i),a.push({dimIdx:v.index,parser:_,comparator:new Vw(h,d)})});var o=e.sourceFormat;o!==Ei&&o!==En&&ur(i);for(var s=[],l=0,u=e.count();l<u;l++)s.push(e.getRawDataItem(l));return s.sort(function(c,f){for(var h=0;h<a.length;h++){var p=a[h],d=e.retrieveValueFromItem(c,p.dimIdx),g=e.retrieveValueFromItem(f,p.dimIdx);p.parser&&(d=p.parser(d),g=p.parser(g));var m=p.comparator.evaluate(d,g);if(m!==0)return m}return 0}),{data:s}}};function s3(r){r.registerTransform(UJ),r.registerTransform(OJ)}var lwe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.prototype.init=function(t,i,n){r.prototype.init.call(this,t,i,n),this._sourceManager=new Ww(this),MD(this)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),MD(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:Ba},e}(Pt);var uwe=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.type="dataset",e}(Qt);function l3(r){r.registerComponentModel(lwe),r.registerComponentView(uwe)}var eu=Ki.CMD;function ag(r,e){return Math.abs(r-e)<1e-5}function TE(r){var e=r.data,t=r.len(),i=[],n,a=0,o=0,s=0,l=0;function u(R,A){n&&n.length>2&&i.push(n),n=[R,A]}function c(R,A,D,U){ag(R,D)&&ag(A,U)||n.push(R,A,D,U,D,U)}function f(R,A,D,U,B,F){var k=Math.abs(A-R),G=Math.tan(k/4)*4/3,Y=A<R?-1:1,J=Math.cos(R),Q=Math.sin(R),V=Math.cos(A),K=Math.sin(A),ae=J*B+D,ve=Q*F+U,ue=V*B+D,se=K*F+U,Ee=B*G*Y,q=F*G*Y;n.push(ae-Ee*Q,ve+q*J,ue+Ee*K,se-q*V,ue,se)}for(var h,p,d,g,m=0;m<t;){var v=e[m++],_=m===1;switch(_&&(a=e[m],o=e[m+1],s=a,l=o,(v===eu.L||v===eu.C||v===eu.Q)&&(n=[s,l])),v){case eu.M:a=s=e[m++],o=l=e[m++],u(s,l);break;case eu.L:h=e[m++],p=e[m++],c(a,o,h,p),a=h,o=p;break;case eu.C:n.push(e[m++],e[m++],e[m++],e[m++],a=e[m++],o=e[m++]);break;case eu.Q:h=e[m++],p=e[m++],d=e[m++],g=e[m++],n.push(a+2/3*(h-a),o+2/3*(p-o),d+2/3*(h-d),g+2/3*(p-g),d,g),a=d,o=g;break;case eu.A:var y=e[m++],x=e[m++],M=e[m++],S=e[m++],w=e[m++],T=e[m++]+w;m+=1;var C=!e[m++];h=Math.cos(w)*M+y,p=Math.sin(w)*S+x,_?(s=h,l=p,u(s,l)):c(a,o,h,p),a=Math.cos(T)*M+y,o=Math.sin(T)*S+x;for(var b=(C?-1:1)*Math.PI/2,E=w;C?E>T:E<T;E+=b){var I=C?Math.max(E+b,T):Math.min(E+b,T);f(E,I,y,x,M,S)}break;case eu.R:s=a=e[m++],l=o=e[m++],h=s+e[m++],p=l+e[m++],u(h,l),c(h,l,h,p),c(h,p,s,p),c(s,p,s,l),c(s,l,h,l);break;case eu.Z:n&&c(a,o,s,l),a=s,o=l;break}}return n&&n.length>2&&i.push(n),i}function u3(r,e,t,i,n,a,o,s,l,u){if(ag(r,t)&&ag(e,i)&&ag(n,o)&&ag(a,s)){l.push(o,s);return}var c=2/u,f=c*c,h=o-r,p=s-e,d=Math.sqrt(h*h+p*p);h/=d,p/=d;var g=t-r,m=i-e,v=n-o,_=a-s,y=g*g+m*m,x=v*v+_*_;if(y<f&&x<f){l.push(o,s);return}var M=h*g+p*m,S=-h*v-p*_,w=y-M*M,T=x-S*S;if(w<f&&M>=0&&T<f&&S>=0){l.push(o,s);return}var C=[],b=[];Zo(r,t,n,o,.5,C),Zo(e,i,a,s,.5,b),u3(C[0],b[0],C[1],b[1],C[2],b[2],C[3],b[3],l,u),u3(C[4],b[4],C[5],b[5],C[6],b[6],C[7],b[7],l,u)}function FJ(r,e){var t=TE(r),i=[];e=e||1;for(var n=0;n<t.length;n++){var a=t[n],o=[],s=a[0],l=a[1];o.push(s,l);for(var u=2;u<a.length;){var c=a[u++],f=a[u++],h=a[u++],p=a[u++],d=a[u++],g=a[u++];u3(s,l,c,f,h,p,d,g,o,e),s=d,l=g}i.push(o)}return i}function VJ(r,e,t){var i=r[e],n=r[1-e],a=Math.abs(i/n),o=Math.ceil(Math.sqrt(a*t)),s=Math.floor(t/o);s===0&&(s=1,o=t);for(var l=[],u=0;u<o;u++)l.push(s);var c=o*s,f=t-c;if(f>0)for(var u=0;u<f;u++)l[u%o]+=1;return l}function zJ(r,e,t){for(var i=r.r0,n=r.r,a=r.startAngle,o=r.endAngle,s=Math.abs(o-a),l=s*n,u=n-i,c=l>Math.abs(u),f=VJ([l,u],c?0:1,e),h=(c?s:u)/f.length,p=0;p<f.length;p++)for(var d=(c?u:s)/f[p],g=0;g<f[p];g++){var m={};c?(m.startAngle=a+h*p,m.endAngle=a+h*(p+1),m.r0=i+d*g,m.r=i+d*(g+1)):(m.startAngle=a+d*g,m.endAngle=a+d*(g+1),m.r0=i+h*p,m.r=i+h*(p+1)),m.clockwise=r.clockwise,m.cx=r.cx,m.cy=r.cy,t.push(m)}}function cwe(r,e,t){for(var i=r.width,n=r.height,a=i>n,o=VJ([i,n],a?0:1,e),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",c=a?"y":"x",f=r[s]/o.length,h=0;h<o.length;h++)for(var p=r[l]/o[h],d=0;d<o[h];d++){var g={};g[u]=h*f,g[c]=d*p,g[s]=f,g[l]=p,g.x+=r.x,g.y+=r.y,t.push(g)}}function BJ(r,e,t,i){return r*i-t*e}function fwe(r,e,t,i,n,a,o,s){var l=t-r,u=i-e,c=o-n,f=s-a,h=BJ(c,f,l,u);if(Math.abs(h)<1e-6)return null;var p=r-n,d=e-a,g=BJ(p,d,c,f)/h;return g<0||g>1?null:new Nt(g*l+r,g*u+e)}function hwe(r,e,t){var i=new Nt;Nt.sub(i,t,e),i.normalize();var n=new Nt;Nt.sub(n,r,e);var a=n.dot(i);return a}function og(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function pwe(r,e,t){for(var i=r.length,n=[],a=0;a<i;a++){var o=r[a],s=r[(a+1)%i],l=fwe(o[0],o[1],s[0],s[1],e.x,e.y,t.x,t.y);l&&n.push({projPt:hwe(l,e,t),pt:l,idx:a})}if(n.length<2)return[{points:r},{points:r}];n.sort(function(m,v){return m.projPt-v.projPt});var u=n[0],c=n[n.length-1];if(c.idx<u.idx){var f=u;u=c,c=f}for(var h=[u.pt.x,u.pt.y],p=[c.pt.x,c.pt.y],d=[h],g=[p],a=u.idx+1;a<=c.idx;a++)og(d,r[a].slice());og(d,p),og(d,h);for(var a=c.idx+1;a<=u.idx+i;a++)og(g,r[a%i].slice());return og(g,h),og(g,p),[{points:d},{points:g}]}function kJ(r){var e=r.points,t=[],i=[];Mp(e,t,i);var n=new lt(t[0],t[1],i[0]-t[0],i[1]-t[1]),a=n.width,o=n.height,s=n.x,l=n.y,u=new Nt,c=new Nt;return a>o?(u.x=c.x=s+a/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+a),pwe(e,u,c)}function EE(r,e,t,i){if(t===1)i.push(e);else{var n=Math.floor(t/2),a=r(e);EE(r,a[0],n,i),EE(r,a[1],t-n,i)}return i}function dwe(r,e){for(var t=[],i=0;i<e;i++)t.push(Jm(r));return t}function mwe(r,e){e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel}function vwe(r){for(var e=[],t=0;t<r.length;)e.push([r[t++],r[t++]]);return e}function GJ(r,e){var t=[],i=r.shape,n;switch(r.type){case"rect":cwe(i,e,t),n=Tt;break;case"sector":zJ(i,e,t),n=yi;break;case"circle":zJ({r0:0,r:i.r,startAngle:0,endAngle:Math.PI*2,cx:i.cx,cy:i.cy},e,t),n=yi;break;default:var a=r.getComputedTransform(),o=a?Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1],a[2]*a[2]+a[3]*a[3])):1,s=de(FJ(r.getUpdatedPathProxy(),o),function(v){return vwe(v)}),l=s.length;if(l===0)EE(kJ,{points:s[0]},e,t);else if(l===e)for(var u=0;u<l;u++)t.push({points:s[u]});else{var c=0,f=de(s,function(v){var _=[],y=[];Mp(v,_,y);var x=(y[1]-_[1])*(y[0]-_[0]);return c+=x,{poly:v,area:x}});f.sort(function(v,_){return _.area-v.area});for(var h=e,u=0;u<l;u++){var p=f[u];if(h<=0)break;var d=u===l-1?h:Math.ceil(p.area/c*e);d<0||(EE(kJ,{points:p.poly},d,t),h-=d)}}n=ei;break}if(!n)return dwe(r,e);for(var g=[],u=0;u<t.length;u++){var m=new n;m.setShape(t[u]),mwe(r,m),g.push(m)}return g}function gwe(r,e){var t=r.length,i=e.length;if(t===i)return[r,e];for(var n=[],a=[],o=t<i?r:e,s=Math.min(t,i),l=Math.abs(i-t)/6,u=(s-2)/6,c=Math.ceil(l/u)+1,f=[o[0],o[1]],h=l,p=2;p<s;){var d=o[p-2],g=o[p-1],m=o[p++],v=o[p++],_=o[p++],y=o[p++],x=o[p++],M=o[p++];if(h<=0){f.push(m,v,_,y,x,M);continue}for(var S=Math.min(h,c-1)+1,w=1;w<=S;w++){var T=w/S;Zo(d,m,_,x,T,n),Zo(g,v,y,M,T,a),d=n[3],g=a[3],f.push(n[1],a[1],n[2],a[2],d,g),m=n[5],v=a[5],_=n[6],y=a[6]}h-=S-1}return o===r?[f,e]:[r,f]}function HJ(r,e){for(var t=r.length,i=r[t-2],n=r[t-1],a=[],o=0;o<e.length;)a[o++]=i,a[o++]=n;return a}function ywe(r,e){for(var t,i,n,a=[],o=[],s=0;s<Math.max(r.length,e.length);s++){var l=r[s],u=e[s],c=void 0,f=void 0;l?u?(t=gwe(l,u),c=t[0],f=t[1],i=c,n=f):(f=HJ(n||l,l),c=l):(c=HJ(i||u,u),f=u),a.push(c),o.push(f)}return[a,o]}function WJ(r){for(var e=0,t=0,i=0,n=r.length,a=0,o=n-2;a<n;o=a,a+=2){var s=r[o],l=r[o+1],u=r[a],c=r[a+1],f=s*c-u*l;e+=f,t+=(s+u)*f,i+=(l+c)*f}return e===0?[r[0]||0,r[1]||0]:[t/e/3,i/e/3,e]}function _we(r,e,t,i){for(var n=(r.length-2)/6,a=1/0,o=0,s=r.length,l=s-2,u=0;u<n;u++){for(var c=u*6,f=0,h=0;h<s;h+=2){var p=h===0?c:(c+h-2)%l+2,d=r[p]-t[0],g=r[p+1]-t[1],m=e[h]-i[0],v=e[h+1]-i[1],_=m-d,y=v-g;f+=_*_+y*y}f<a&&(a=f,o=u)}return o}function xwe(r){for(var e=[],t=r.length,i=0;i<t;i+=2)e[i]=r[t-i-2],e[i+1]=r[t-i-1];return e}function Swe(r,e,t,i){for(var n=[],a,o=0;o<r.length;o++){var s=r[o],l=e[o],u=WJ(s),c=WJ(l);a==null&&(a=u[2]<0!=c[2]<0);var f=[],h=[],p=0,d=1/0,g=[],m=s.length;a&&(s=xwe(s));for(var v=_we(s,l,u,c)*6,_=m-2,y=0;y<_;y+=2){var x=(v+y)%_+2;f[y+2]=s[x]-u[0],f[y+3]=s[x+1]-u[1]}if(f[0]=s[v]-u[0],f[1]=s[v+1]-u[1],t>0)for(var M=i/t,S=-i/2;S<=i/2;S+=M){for(var w=Math.sin(S),T=Math.cos(S),C=0,y=0;y<s.length;y+=2){var b=f[y],E=f[y+1],I=l[y]-c[0],R=l[y+1]-c[1],A=I*T-R*w,D=I*w+R*T;g[y]=A,g[y+1]=D;var U=A-b,B=D-E;C+=U*U+B*B}if(C<d){d=C,p=S;for(var F=0;F<g.length;F++)h[F]=g[F]}}else for(var k=0;k<m;k+=2)h[k]=l[k]-c[0],h[k+1]=l[k+1]-c[1];n.push({from:f,to:h,fromCp:u,toCp:c,rotation:-p})}return n}function eS(r){return r.__isCombineMorphing}var YJ="__mOriginal_";function AE(r,e,t){var i=YJ+e,n=r[i]||r[e];r[i]||(r[i]=r[e]);var a=t.replace,o=t.after,s=t.before;r[e]=function(){var l=arguments,u;return s&&s.apply(this,l),a?u=a.apply(this,l):u=n.apply(this,l),o&&o.apply(this,l),u}}function Qx(r,e){var t=YJ+e;r[t]&&(r[e]=r[t],r[t]=null)}function XJ(r,e){for(var t=0;t<r.length;t++)for(var i=r[t],n=0;n<i.length;){var a=i[n],o=i[n+1];i[n++]=e[0]*a+e[2]*o+e[4],i[n++]=e[1]*a+e[3]*o+e[5]}}function qJ(r,e){var t=r.getUpdatedPathProxy(),i=e.getUpdatedPathProxy(),n=ywe(TE(t),TE(i)),a=n[0],o=n[1],s=r.getComputedTransform(),l=e.getComputedTransform();function u(){this.transform=null}s&&XJ(a,s),l&&XJ(o,l),AE(e,"updateTransform",{replace:u}),e.transform=null;var c=Swe(a,o,10,Math.PI),f=[];AE(e,"buildPath",{replace:function(h){for(var p=e.__morphT,d=1-p,g=[],m=0;m<c.length;m++){var v=c[m],_=v.from,y=v.to,x=v.rotation*p,M=v.fromCp,S=v.toCp,w=Math.sin(x),T=Math.cos(x);Tm(g,M,S,p);for(var C=0;C<_.length;C+=2){var b=_[C],E=_[C+1],I=y[C],R=y[C+1],A=b*d+I*p,D=E*d+R*p;f[C]=A*T-D*w+g[0],f[C+1]=A*w+D*T+g[1]}var U=f[0],B=f[1];h.moveTo(U,B);for(var C=2;C<_.length;){var I=f[C++],R=f[C++],F=f[C++],k=f[C++],G=f[C++],Y=f[C++];U===I&&B===R&&F===G&&k===Y?h.lineTo(G,Y):h.bezierCurveTo(I,R,F,k,G,Y),U=G,B=Y}}}})}function RE(r,e,t){if(!r||!e)return e;var i=t.done,n=t.during;qJ(r,e),e.__morphT=0;function a(){Qx(e,"buildPath"),Qx(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return e.animateTo({__morphT:1},Ye({during:function(o){e.dirtyShape(),n&&n(o)},done:function(){a(),i&&i()}},t)),e}function Mwe(r,e,t,i,n,a){var o=16;r=n===t?0:Math.round(32767*(r-t)/(n-t)),e=a===i?0:Math.round(32767*(e-i)/(a-i));for(var s=0,l,u=(1<<o)/2;u>0;u/=2){var c=0,f=0;(r&u)>0&&(c=1),(e&u)>0&&(f=1),s+=u*u*(3*c^f),f===0&&(c===1&&(r=u-1-r,e=u-1-e),l=r,r=e,e=l)}return s}function CE(r){var e=1/0,t=1/0,i=-1/0,n=-1/0,a=de(r,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),f=l.y+l.height/2+(u?u[5]:0);return e=Math.min(c,e),t=Math.min(f,t),i=Math.max(c,i),n=Math.max(f,n),[c,f]}),o=de(a,function(s,l){return{cp:s,z:Mwe(s[0],s[1],e,t,i,n),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function ZJ(r){return GJ(r.path,r.count)}function c3(){return{fromIndividuals:[],toIndividuals:[],count:0}}function jJ(r,e,t){var i=[];function n(M){for(var S=0;S<M.length;S++){var w=M[S];eS(w)?n(w.childrenRef()):w instanceof ut&&i.push(w)}}n(r);var a=i.length;if(!a)return c3();var o=t.dividePath||ZJ,s=o({path:e,count:a});if(s.length!==a)return console.error("Invalid morphing: unmatched splitted path"),c3();i=CE(i),s=CE(s);for(var l=t.done,u=t.during,c=t.individualDelay,f=new Ra,h=0;h<a;h++){var p=i[h],d=s[h];d.parent=e,d.copyTransform(f),c||qJ(p,d)}e.__isCombineMorphing=!0,e.childrenRef=function(){return s};function g(M){for(var S=0;S<s.length;S++)s[S].addSelfToZr(M)}AE(e,"addSelfToZr",{after:function(M){g(M)}}),AE(e,"removeSelfFromZr",{after:function(M){for(var S=0;S<s.length;S++)s[S].removeSelfFromZr(M)}});function m(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,Qx(e,"addSelfToZr"),Qx(e,"removeSelfFromZr")}var v=s.length;if(c)for(var _=v,y=function(){_--,_===0&&(m(),l&&l())},h=0;h<v;h++){var x=c?Ye({delay:(t.delay||0)+c(h,v,i[h],s[h]),done:y},t):t;RE(i[h],s[h],x)}else e.__morphT=0,e.animateTo({__morphT:1},Ye({during:function(M){for(var S=0;S<v;S++){var w=s[S];w.__morphT=e.__morphT,w.dirtyShape()}u&&u(M)},done:function(){m();for(var M=0;M<r.length;M++)Qx(r[M],"updateTransform");l&&l()}},t));return e.__zr&&g(e.__zr),{fromIndividuals:i,toIndividuals:s,count:v}}function KJ(r,e,t){var i=e.length,n=[],a=t.dividePath||ZJ;function o(p){for(var d=0;d<p.length;d++){var g=p[d];eS(g)?o(g.childrenRef()):g instanceof ut&&n.push(g)}}if(eS(r)){o(r.childrenRef());var s=n.length;if(s<i)for(var l=0,u=s;u<i;u++)n.push(Jm(n[l++%s]));n.length=i}else{n=a({path:r,count:i});for(var c=r.getComputedTransform(),u=0;u<n.length;u++)n[u].setLocalTransform(c);if(n.length!==i)return console.error("Invalid morphing: unmatched splitted path"),c3()}n=CE(n),e=CE(e);for(var f=t.individualDelay,u=0;u<i;u++){var h=f?Ye({delay:(t.delay||0)+f(u,i,n[u],e[u])},t):t;RE(n[u],e[u],h)}return{fromIndividuals:n,toIndividuals:e,count:e.length}}function JJ(r){return pe(r[0])}function $J(r,e){for(var t=[],i=r.length,n=0;n<i;n++)t.push({one:r[n],many:[]});for(var n=0;n<e.length;n++){var a=e[n].length,o=void 0;for(o=0;o<a;o++)t[o%i].many.push(e[n][o])}for(var s=0,n=i-1;n>=0;n--)if(!t[n].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var a=l.length,u=Math.ceil(a/2);t[n].many=l.slice(u,a),t[s].many=l.slice(0,u),s++}return t}var bwe={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),i=0;i<r.count;i++){var n=Jm(r.path);n.setStyle("opacity",t),e.push(n)}return e},split:null};function LE(r,e,t,i,n,a){if(!r.length||!e.length)return;var o=Bl("update",i,n);if(!(o&&o.duration>0))return;var s=i.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;JJ(r)&&(u=r,c=e),JJ(e)&&(u=e,c=r);function f(v,_,y,x,M){var S=v.many,w=v.one;if(S.length===1&&!M){var T=_?S[0]:w,C=_?w:S[0];if(eS(T))f({many:[T],one:C},!0,y,x,!0);else{var b=s?Ye({delay:s(y,x)},l):l;RE(T,C,b),a(T,C,T,C,b)}}else for(var E=Ye({dividePath:bwe[t],individualDelay:s&&function(B,F,k,G){return s(B+y,x)}},l),I=_?jJ(S,w,E):KJ(w,S,E),R=I.fromIndividuals,A=I.toIndividuals,D=R.length,U=0;U<D;U++){var b=s?Ye({delay:s(U,D)},l):l;a(R[U],A[U],_?S[U]:v.one,_?v.one:S[U],b)}}for(var h=u?u===r:r.length>e.length,p=u?$J(c,u):$J(h?e:r,[h?r:e]),d=0,g=0;g<p.length;g++)d+=p[g].many.length;for(var m=0,g=0;g<p.length;g++)f(p[g],h,m,d),m+=p[g].many.length}function ih(r){if(!r)return[];if(pe(r)){for(var e=[],t=0;t<r.length;t++)e.push(ih(r[t]));return e}var i=[];return r.traverse(function(n){n instanceof ut&&!n.disableMorphing&&!n.invisible&&!n.ignore&&i.push(n)}),i}var o$=1e4,wwe=0,QJ=1,e$=2,Twe=vt();function Ewe(r,e){for(var t=r.dimensions,i=0;i<t.length;i++){var n=r.getDimensionInfo(t[i]);if(n&&n.otherDims[e]===0)return t[i]}}function Awe(r,e,t){var i=r.getDimensionInfo(t),n=i&&i.ordinalMeta;if(i){var a=r.get(i.name,e);return n&&n.categories[a]||a+""}}function t$(r,e,t,i){var n=i?"itemChildGroupId":"itemGroupId",a=Ewe(r,n);if(a){var o=Awe(r,e,a);return o}var s=r.getRawDataItem(e),l=i?"childGroupId":"groupId";if(s&&s[l])return s[l]+"";if(!i)return t||r.getId(e)}function r$(r){var e=[];return N(r,function(t){var i=t.data,n=t.dataGroupId;if(!(i.count()>o$))for(var a=i.getIndices(),o=0;o<a.length;o++)e.push({data:i,groupId:t$(i,o,n,!1),childGroupId:t$(i,o,n,!0),divide:t.divide,dataIndex:o})}),e}function f3(r,e,t){r.traverse(function(i){i instanceof ut&&ar(i,{style:{opacity:0}},e,{dataIndex:t,isFrom:!0})})}function h3(r){if(r.parent){var e=r.getComputedTransform();r.setLocalTransform(e),r.parent.remove(r)}}function sg(r){r.stopAnimation(),r.isGroup&&r.traverse(function(e){e.stopAnimation()})}function Cwe(r,e,t){var i=Bl("update",t,e);i&&r.traverse(function(n){if(n instanceof gi){var a=W4(n);a&&n.animateFrom({style:a},i)}})}function Rwe(r,e){var t=r.length;if(t!==e.length)return!1;for(var i=0;i<t;i++){var n=r[i],a=e[i];if(n.data.getId(n.dataIndex)!==a.data.getId(a.dataIndex))return!1}return!0}function s$(r,e,t){var i=r$(r),n=r$(e);function a(y,x,M,S,w){(M||y)&&x.animateFrom({style:M&&M!==y?fe(fe({},M.style),y.style):y.style},w)}var o=!1,s=wwe,l=ke(),u=ke();i.forEach(function(y){y.groupId&&l.set(y.groupId,!0),y.childGroupId&&u.set(y.childGroupId,!0)});for(var c=0;c<n.length;c++){var f=n[c].groupId;if(u.get(f)){s=QJ;break}var h=n[c].childGroupId;if(h&&l.get(h)){s=e$;break}}function p(y,x){return function(M){var S=M.data,w=M.dataIndex;return x?S.getId(w):y?s===QJ?M.childGroupId:M.groupId:s===e$?M.childGroupId:M.groupId}}var d=Rwe(i,n),g={};if(!d)for(var c=0;c<n.length;c++){var m=n[c],v=m.data.getItemGraphicEl(m.dataIndex);v&&(g[v.id]=!0)}function _(y,x){var M=i[x],S=n[y],w=S.data.hostModel,T=M.data.getItemGraphicEl(M.dataIndex),C=S.data.getItemGraphicEl(S.dataIndex);if(T===C){C&&Cwe(C,S.dataIndex,w);return}T&&g[T.id]||C&&(sg(C),T?(sg(T),h3(T),o=!0,LE(ih(T),ih(C),S.divide,w,y,a)):f3(C,w,y))}new An(i,n,p(!0,d),p(!1,d),null,"multiple").update(_).updateManyToOne(function(y,x){var M=n[y],S=M.data,w=S.hostModel,T=S.getItemGraphicEl(M.dataIndex),C=Wt(de(x,function(b){return i[b].data.getItemGraphicEl(i[b].dataIndex)}),function(b){return b&&b!==T&&!g[b.id]});T&&(sg(T),C.length?(N(C,function(b){sg(b),h3(b)}),o=!0,LE(ih(C),ih(T),M.divide,w,y,a)):f3(T,w,M.dataIndex))}).updateOneToMany(function(y,x){var M=i[x],S=M.data.getItemGraphicEl(M.dataIndex);if(!(S&&g[S.id])){var w=Wt(de(y,function(C){return n[C].data.getItemGraphicEl(n[C].dataIndex)}),function(C){return C&&C!==S}),T=n[y[0]].data.hostModel;w.length&&(N(w,function(C){return sg(C)}),S?(sg(S),h3(S),o=!0,LE(ih(S),ih(w),M.divide,T,y[0],a)):N(w,function(C){return f3(C,T,y[0])}))}}).updateManyToMany(function(y,x){new An(x,y,function(M){return i[M].data.getId(i[M].dataIndex)},function(M){return n[M].data.getId(n[M].dataIndex)}).update(function(M,S){_(y[M],x[S])}).execute()}).execute(),o&&N(e,function(y){var x=y.data,M=x.hostModel,S=M&&t.getViewOfSeriesModel(M),w=Bl("update",M,0);S&&M.isAnimationEnabled()&&w&&w.duration>0&&S.group.traverse(function(T){T instanceof ut&&!T.animators.length&&T.animateFrom({style:{opacity:0}},w)})})}function i$(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function n$(r){return pe(r)?r.sort().join(","):r}function nh(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function Lwe(r,e){var t=ke(),i=ke(),n=ke();N(r.oldSeries,function(o,s){var l=r.oldDataGroupIds[s],u=r.oldData[s],c=i$(o),f=n$(c);i.set(f,{dataGroupId:l,data:u}),pe(c)&&N(c,function(h){n.set(h,{key:f,dataGroupId:l,data:u})})});function a(o){t.get(o)&&eH("Duplicated seriesKey in universalTransition "+o)}return N(e.updatedSeries,function(o){if(o.isUniversalTransitionEnabled()&&o.isAnimationEnabled()){var s=o.get("dataGroupId"),l=o.getData(),u=i$(o),c=n$(u),f=i.get(c);if(f)t.set(c,{oldSeries:[{dataGroupId:f.dataGroupId,divide:nh(f.data),data:f.data}],newSeries:[{dataGroupId:s,divide:nh(l),data:l}]});else if(pe(u)){var h=[];N(u,function(g){var m=i.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:nh(m.data),data:m.data})}),h.length&&t.set(c,{oldSeries:h,newSeries:[{dataGroupId:s,data:l,divide:nh(l)}]})}else{var p=n.get(u);if(p){var d=t.get(p.key);d||(d={oldSeries:[{dataGroupId:p.dataGroupId,data:p.data,divide:nh(p.data)}],newSeries:[]},t.set(p.key,d)),d.newSeries.push({dataGroupId:s,data:l,divide:nh(l)})}}}}),t}function a$(r,e){for(var t=0;t<r.length;t++){var i=e.seriesIndex!=null&&e.seriesIndex===r[t].seriesIndex||e.seriesId!=null&&e.seriesId===r[t].id;if(i)return t}}function Pwe(r,e,t,i){var n=[],a=[];N(Jt(r.from),function(o){var s=a$(e.oldSeries,o);s>=0&&n.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:nh(e.oldData[s]),groupIdDim:o.dimension})}),N(Jt(r.to),function(o){var s=a$(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();a.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:nh(l),groupIdDim:o.dimension})}}),n.length>0&&a.length>0&&s$(n,a,i)}function p3(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){N(Jt(i.seriesTransition),function(n){N(Jt(n.to),function(a){for(var o=i.updatedSeries,s=0;s<o.length;s++)(a.seriesIndex!=null&&a.seriesIndex===o[s].seriesIndex||a.seriesId!=null&&a.seriesId===o[s].id)&&(o[s][B_]=!0)})})}),r.registerUpdateLifecycle("series:transition",function(e,t,i){var n=Twe(t);if(n.oldSeries&&i.updatedSeries&&i.optionChanged){var a=i.seriesTransition;if(a)N(Jt(a),function(p){Pwe(p,n,i,t)});else{var o=Lwe(n,i);N(o.keys(),function(p){var d=o.get(p);s$(d.oldSeries,d.newSeries,t)})}N(i.updatedSeries,function(p){p[B_]&&(p[B_]=!1)})}for(var s=e.getSeries(),l=n.oldSeries=[],u=n.oldDataGroupIds=[],c=n.oldData=[],f=0;f<s.length;f++){var h=s[f].getData();h.count()<o$&&(l.push(s[f]),u.push(s[f].get("dataGroupId")),c.push(h))}})}It([Y2]);It([X2]);It([Q2,rI,lI,_I,MI,BI,jI,aN,EN,AN,RN,qN,JN,eU,oU,sU,lU,uU,pU,vU,xU,VU]);It(ZU);It(QU);It(xx);It(rO);It(Ix);It(nO);It(oO);It(vO);It(xO);It(il);It(EO);It(AO);It(PO);It(FO);It(BO);It(kO);It(ZO);It(QO);It(Yx);It(jx);It(r3);It(Jx);It($x);It(a3);It(s3);It(l3);It(p3);It(w2);var Dwe=["chart"],l$=(()=>{let e=class e{constructor(){this.chartInstance=null,this.options={},this.defaultTooltipOptions={tooltip:{trigger:"item",borderColor:"#00eff8",backgroundColor:"#12192C",padding:[6,14,6,14],textStyle:{fontSize:14,color:"#74FAFB"},position:"top",axisPointer:{type:"shadow"}},series:[{type:"gauge",startAngle:180,endAngle:0,center:["50%","75%"],radius:"90%",min:0,max:1,splitNumber:8,axisLine:{lineStyle:{width:6,color:[[.25,"#74FAFB"],[.5,"#74FAFB"],[.75,"#74FAFB"],[1,"#74FAFB"]]}},pointer:{icon:"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z",length:"12%",width:20,offsetCenter:[0,"-60%"],itemStyle:{color:"auto"}},axisTick:{length:12,lineStyle:{color:"auto",width:2}},splitLine:{length:20,lineStyle:{color:"auto",width:5}},axisLabel:{color:"#464646",fontSize:20,distance:-60,rotate:"tangential",formatter:function(i){return""}},title:{offsetCenter:[0,"-10%"],fontSize:20},tooltip:{trigger:"item",borderColor:"#00eff8",backgroundColor:"#12192C",padding:[6,14,6,14],textStyle:{fontSize:14,color:"#74FAFB"},position:"top",axisPointer:{type:"shadow"}},detail:{fontSize:30,offsetCenter:[0,"-5%"],valueAnimation:!0,formatter:function(i){return Math.round(i*100)+""},color:"inherit"}}]}}ngOnInit(){console.log("ChartComponentComponent ngOnInit"),this.initEcharts()}ngOnChanges(i){i.options&&!i.options.isFirstChange()&&(console.log("ChartComponentComponent ngOnChanges"),this.updateChartOptions())}ngOnDestroy(){this.chartInstance&&(console.log("ChartComponentComponent ngOnInit"),this.chartInstance.dispose())}initEcharts(){let i=this.chartContainer.nativeElement;this.chartInstance=ZD(i,"dark");let n=E0(E0({},this.defaultTooltipOptions),this.options);this.chartInstance.setOption(n)}updateChartOptions(){this.chartInstance&&this.chartInstance.setOption(this.options)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["app-chart-component"]],viewQuery:function(n,a){if(n&1&&vm(Dwe,7),n&2){let o;co(o=fo())&&(a.chartContainer=o.first)}},inputs:{options:"options"},standalone:!0,features:[C0,ui],decls:2,vars:0,consts:[[2,"width","100%","height","100%"],["chart",""]],template:function(n,a){n&1&&li(0,"div",0,1)}});let r=e;return r})();var ah=["*"];function Iwe(r,e){if(r&1&&li(0,"nz-avatar",3),r&2){let t=Lr();Rt("nzSrc",t.nzSrc)}}function Nwe(r,e){r&1&&Li(0,0,["*ngIf","!nzSrc"])}function Uwe(r,e){if(r&1&&li(0,"nz-list-item-meta-avatar",3),r&2){let t=Lr();Rt("nzSrc",t.avatarStr)}}function Owe(r,e){if(r&1&&(tr(0,"nz-list-item-meta-avatar"),pV(1,4),lr()),r&2){let t=Lr();Ot(),Rt("ngTemplateOutlet",t.avatarTpl)}}function Fwe(r,e){if(r&1&&(Sl(0),Pi(1),Ml()),r&2){let t=Lr(3);Ot(),Ec(t.nzTitle)}}function zwe(r,e){if(r&1&&(tr(0,"nz-list-item-meta-title"),br(1,Fwe,2,1,"ng-container",6),lr()),r&2){let t=Lr(2);Ot(),Rt("nzStringTemplateOutlet",t.nzTitle)}}function Bwe(r,e){if(r&1&&(Sl(0),Pi(1),Ml()),r&2){let t=Lr(3);Ot(),Ec(t.nzDescription)}}function kwe(r,e){if(r&1&&(tr(0,"nz-list-item-meta-description"),br(1,Bwe,2,1,"ng-container",6),lr()),r&2){let t=Lr(2);Ot(),Rt("nzStringTemplateOutlet",t.nzDescription)}}function Vwe(r,e){if(r&1&&(tr(0,"div",5),br(1,zwe,2,1,"nz-list-item-meta-title",1)(2,kwe,2,1,"nz-list-item-meta-description",1),Li(3,1),Li(4,2),lr()),r&2){let t=Lr();Ot(),Rt("ngIf",t.nzTitle&&!t.titleComponent),Ot(),Rt("ngIf",t.nzDescription&&!t.descriptionComponent)}}var Gwe=[[["nz-list-item-meta-avatar"]],[["nz-list-item-meta-title"]],[["nz-list-item-meta-description"]]],Hwe=["nz-list-item-meta-avatar","nz-list-item-meta-title","nz-list-item-meta-description"];function Wwe(r,e){r&1&&Li(0)}var Xwe=["nz-list-item-actions",""];function Ywe(r,e){}function qwe(r,e){r&1&&li(0,"em",3)}function Zwe(r,e){if(r&1&&(tr(0,"li"),br(1,Ywe,0,0,"ng-template",1)(2,qwe,1,0,"em",2),lr()),r&2){let t=e.$implicit,i=e.last;Ot(),Rt("ngTemplateOutlet",t),Ot(),Rt("ngIf",!i)}}function jwe(r,e){}var d$=(r,e)=>({$implicit:r,index:e});function Kwe(r,e){if(r&1&&(Sl(0),br(1,jwe,0,0,"ng-template",9),Ml()),r&2){let t=e.$implicit,i=e.index,n=Lr(2);Ot(),Rt("ngTemplateOutlet",n.nzRenderItem)("ngTemplateOutletContext",tL(2,d$,t,i))}}function Jwe(r,e){if(r&1&&(tr(0,"div",7),br(1,Kwe,2,5,"ng-container",8),Li(2,4),lr()),r&2){let t=Lr();Ot(),Rt("ngForOf",t.nzDataSource)}}function $we(r,e){if(r&1&&(Sl(0),Pi(1),Ml()),r&2){let t=Lr(2);Ot(),Ec(t.nzHeader)}}function Qwe(r,e){if(r&1&&(tr(0,"nz-list-header"),br(1,$we,2,1,"ng-container",10),lr()),r&2){let t=Lr();Ot(),Rt("nzStringTemplateOutlet",t.nzHeader)}}function e1e(r,e){r&1&&li(0,"div"),r&2&&fV("min-height",53,"px")}function t1e(r,e){}function r1e(r,e){if(r&1&&(tr(0,"div",13),br(1,t1e,0,0,"ng-template",9),lr()),r&2){let t=e.$implicit,i=e.index,n=Lr(2);Rt("nzSpan",n.nzGrid.span||null)("nzXs",n.nzGrid.xs||null)("nzSm",n.nzGrid.sm||null)("nzMd",n.nzGrid.md||null)("nzLg",n.nzGrid.lg||null)("nzXl",n.nzGrid.xl||null)("nzXXl",n.nzGrid.xxl||null),Ot(),Rt("ngTemplateOutlet",n.nzRenderItem)("ngTemplateOutletContext",tL(9,d$,t,i))}}function i1e(r,e){if(r&1&&(tr(0,"div",11),br(1,r1e,2,12,"div",12),lr()),r&2){let t=Lr();Rt("nzGutter",t.nzGrid.gutter||null),Ot(),Rt("ngForOf",t.nzDataSource)}}function n1e(r,e){if(r&1&&li(0,"nz-list-empty",14),r&2){let t=Lr();Rt("nzNoResult",t.nzNoResult)}}function a1e(r,e){if(r&1&&(Sl(0),Pi(1),Ml()),r&2){let t=Lr(2);Ot(),Ec(t.nzFooter)}}function o1e(r,e){if(r&1&&(tr(0,"nz-list-footer"),br(1,a1e,2,1,"ng-container",10),lr()),r&2){let t=Lr();Ot(),Rt("nzStringTemplateOutlet",t.nzFooter)}}function s1e(r,e){}function l1e(r,e){}function u1e(r,e){if(r&1&&(tr(0,"nz-list-pagination"),br(1,l1e,0,0,"ng-template",6),lr()),r&2){let t=Lr();Ot(),Rt("ngTemplateOutlet",t.nzPagination)}}var c1e=[[["nz-list-header"]],[["nz-list-footer"],["","nz-list-footer",""]],[["nz-list-load-more"],["","nz-list-load-more",""]],[["nz-list-pagination"],["","nz-list-pagination",""]],"*"],f1e=["nz-list-header","nz-list-footer, [nz-list-footer]","nz-list-load-more, [nz-list-load-more]","nz-list-pagination, [nz-list-pagination]","*"];function h1e(r,e){if(r&1&&li(0,"ul",6),r&2){let t=Lr(2);Rt("nzActions",t.nzActions)}}function p1e(r,e){if(r&1&&(br(0,h1e,1,1,"ul",5),Li(1)),r&2){let t=Lr();Rt("ngIf",t.nzActions&&t.nzActions.length>0)}}function d1e(r,e){if(r&1&&(Sl(0),Pi(1),Ml()),r&2){let t=Lr(3);Ot(),Ec(t.nzContent)}}function m1e(r,e){if(r&1&&(Sl(0),br(1,d1e,2,1,"ng-container",8),Ml()),r&2){let t=Lr(2);Ot(),Rt("nzStringTemplateOutlet",t.nzContent)}}function v1e(r,e){if(r&1&&(Li(0,1),Li(1,2),br(2,m1e,2,1,"ng-container",7)),r&2){let t=Lr();Ot(2),Rt("ngIf",t.nzContent)}}function g1e(r,e){r&1&&Li(0,3)}function y1e(r,e){}function _1e(r,e){}function x1e(r,e){}function S1e(r,e){}function M1e(r,e){if(r&1&&br(0,y1e,0,0,"ng-template",9)(1,_1e,0,0,"ng-template",9)(2,x1e,0,0,"ng-template",9)(3,S1e,0,0,"ng-template",9),r&2){let t=Lr(),i=gu(3),n=gu(5),a=gu(1);Rt("ngTemplateOutlet",i),Ot(),Rt("ngTemplateOutlet",t.nzExtra),Ot(),Rt("ngTemplateOutlet",n),Ot(),Rt("ngTemplateOutlet",a)}}function b1e(r,e){}function w1e(r,e){}function T1e(r,e){}function E1e(r,e){if(r&1&&(tr(0,"nz-list-item-extra"),br(1,T1e,0,0,"ng-template",9),lr()),r&2){let t=Lr(2);Ot(),Rt("ngTemplateOutlet",t.nzExtra)}}function A1e(r,e){}function C1e(r,e){if(r&1&&(Sl(0),tr(1,"div",10),br(2,b1e,0,0,"ng-template",9)(3,w1e,0,0,"ng-template",9),lr(),br(4,E1e,2,1,"nz-list-item-extra",7)(5,A1e,0,0,"ng-template",9),Ml()),r&2){let t=Lr(),i=gu(3),n=gu(1),a=gu(5);Ot(2),Rt("ngTemplateOutlet",i),Ot(),Rt("ngTemplateOutlet",n),Ot(),Rt("ngIf",t.nzExtra),Ot(),Rt("ngTemplateOutlet",a)}}var R1e=[[["nz-list-item-actions"],["","nz-list-item-actions",""]],[["nz-list-item-meta"],["","nz-list-item-meta",""]],"*",[["nz-list-item-extra"],["","nz-list-item-extra",""]]],L1e=["nz-list-item-actions, [nz-list-item-actions]","nz-list-item-meta, [nz-list-item-meta]","*","nz-list-item-extra, [nz-list-item-extra]"],u$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-item-meta-title"]],exportAs:["nzListItemMetaTitle"],standalone:!0,features:[ui],ngContentSelectors:ah,decls:2,vars:0,consts:[[1,"ant-list-item-meta-title"]],template:function(n,a){n&1&&(Ho(),tr(0,"h4",0),Li(1),lr())},encapsulation:2,changeDetection:0});let r=e;return r})(),c$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-item-meta-description"]],exportAs:["nzListItemMetaDescription"],standalone:!0,features:[ui],ngContentSelectors:ah,decls:2,vars:0,consts:[[1,"ant-list-item-meta-description"]],template:function(n,a){n&1&&(Ho(),tr(0,"div",0),Li(1),lr())},encapsulation:2,changeDetection:0});let r=e;return r})(),m$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-item-meta-avatar"]],inputs:{nzSrc:"nzSrc"},exportAs:["nzListItemMetaAvatar"],standalone:!0,features:[ui],ngContentSelectors:ah,decls:3,vars:2,consts:[[1,"ant-list-item-meta-avatar"],[3,"nzSrc",4,"ngIf"],[4,"ngIf"],[3,"nzSrc"]],template:function(n,a){n&1&&(Ho(),tr(0,"div",0),br(1,Iwe,1,1,"nz-avatar",1)(2,Nwe,1,0,"ng-content",2),lr()),n&2&&(Ot(),Rt("ngIf",a.nzSrc),Ot(),Rt("ngIf",!a.nzSrc))},dependencies:[El,TV,bl],encapsulation:2,changeDetection:0});let r=e;return r})(),P1e=(()=>{let e=class e{set nzAvatar(i){i instanceof eL?(this.avatarStr="",this.avatarTpl=i):this.avatarStr=i}constructor(i){this.elementRef=i,this.avatarStr=""}};e.\u0275fac=function(n){return new(n||e)(uo(uV))},e.\u0275cmp=si({type:e,selectors:[["nz-list-item-meta"],["","nz-list-item-meta",""]],contentQueries:function(n,a,o){if(n&1&&(Tc(o,c$,5),Tc(o,u$,5)),n&2){let s;co(s=fo())&&(a.descriptionComponent=s.first),co(s=fo())&&(a.titleComponent=s.first)}},hostAttrs:[1,"ant-list-item-meta"],inputs:{nzAvatar:"nzAvatar",nzTitle:"nzTitle",nzDescription:"nzDescription"},exportAs:["nzListItemMeta"],standalone:!0,features:[ui],ngContentSelectors:Hwe,decls:4,vars:3,consts:[[3,"nzSrc",4,"ngIf"],[4,"ngIf"],["class","ant-list-item-meta-content",4,"ngIf"],[3,"nzSrc"],[3,"ngTemplateOutlet"],[1,"ant-list-item-meta-content"],[4,"nzStringTemplateOutlet"]],template:function(n,a){n&1&&(Ho(Gwe),br(0,Uwe,1,1,"nz-list-item-meta-avatar",0)(1,Owe,2,1,"nz-list-item-meta-avatar",1),Li(2),br(3,Vwe,5,2,"div",2)),n&2&&(Rt("ngIf",a.avatarStr),Ot(),Rt("ngIf",a.avatarTpl),Ot(2),Rt("ngIf",a.nzTitle||a.nzDescription||a.descriptionComponent||a.titleComponent))},dependencies:[m$,bl,L0,u$,qM,YM,c$],encapsulation:2,changeDetection:0});let r=e;return r})(),f$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-item-extra"],["","nz-list-item-extra",""]],hostAttrs:[1,"ant-list-item-extra"],exportAs:["nzListItemExtra"],standalone:!0,features:[ui],ngContentSelectors:ah,decls:1,vars:0,template:function(n,a){n&1&&(Ho(),Li(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),D1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-item-action"]],viewQuery:function(n,a){if(n&1&&vm(eL,5),n&2){let o;co(o=fo())&&(a.templateRef=o.first)}},exportAs:["nzListItemAction"],standalone:!0,features:[ui],ngContentSelectors:ah,decls:1,vars:0,template:function(n,a){n&1&&(Ho(),br(0,Wwe,1,0,"ng-template"))},encapsulation:2,changeDetection:0});let r=e;return r})(),I1e=(()=>{let e=class e{constructor(i,n,a){this.ngZone=i,this.nzActions=[],this.actions=[],this.inputActionChanges$=new qR,this.contentChildrenChanges$=tV(()=>this.nzListItemActions?eV(null):this.ngZone.onStable.pipe(iV(1),this.enterZone(),nV(()=>this.nzListItemActions.changes.pipe(aV(this.nzListItemActions))))),rV(this.contentChildrenChanges$,this.inputActionChanges$).pipe(ZR(a)).subscribe(()=>{this.nzActions.length?this.actions=this.nzActions:this.actions=this.nzListItemActions.map(o=>o.templateRef),n.detectChanges()})}ngOnChanges(){this.inputActionChanges$.next(null)}enterZone(){return i=>new $k(n=>i.subscribe({next:a=>this.ngZone.run(()=>n.next(a))}))}};e.\u0275fac=function(n){return new(n||e)(uo(cV),uo(jR),uo(ZM))},e.\u0275cmp=si({type:e,selectors:[["ul","nz-list-item-actions",""]],contentQueries:function(n,a,o){if(n&1&&Tc(o,D1e,4),n&2){let s;co(s=fo())&&(a.nzListItemActions=s)}},hostAttrs:[1,"ant-list-item-action"],inputs:{nzActions:"nzActions"},exportAs:["nzListItemActions"],standalone:!0,features:[mV([ZM]),C0,ui],attrs:Xwe,decls:1,vars:1,consts:[[4,"ngFor","ngForOf"],[3,"ngTemplateOutlet"],["class","ant-list-item-action-split",4,"ngIf"],[1,"ant-list-item-action-split"]],template:function(n,a){n&1&&br(0,Zwe,3,2,"li",0),n&2&&Rt("ngForOf",a.actions)},dependencies:[R0,L0,bl],encapsulation:2,changeDetection:0});let r=e;return r})(),v$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-empty"]],hostAttrs:[1,"ant-list-empty-text"],inputs:{nzNoResult:"nzNoResult"},exportAs:["nzListHeader"],standalone:!0,features:[ui],decls:1,vars:2,consts:[[3,"nzComponentName","specificContent"]],template:function(n,a){n&1&&li(0,"nz-embed-empty",0),n&2&&Rt("nzComponentName","list")("specificContent",a.nzNoResult)},dependencies:[bV,MV],encapsulation:2,changeDetection:0});let r=e;return r})(),N1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-header"]],hostAttrs:[1,"ant-list-header"],exportAs:["nzListHeader"],standalone:!0,features:[ui],ngContentSelectors:ah,decls:1,vars:0,template:function(n,a){n&1&&(Ho(),Li(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),h$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-footer"]],hostAttrs:[1,"ant-list-footer"],exportAs:["nzListFooter"],standalone:!0,features:[ui],ngContentSelectors:ah,decls:1,vars:0,template:function(n,a){n&1&&(Ho(),Li(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),p$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["nz-list-pagination"]],hostAttrs:[1,"ant-list-pagination"],exportAs:["nzListPagination"],standalone:!0,features:[ui],ngContentSelectors:ah,decls:1,vars:0,template:function(n,a){n&1&&(Ho(),Li(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),U1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275dir=lV({type:e,selectors:[["nz-list-load-more"]],exportAs:["nzListLoadMoreDirective"],standalone:!0});let r=e;return r})();var g$=(()=>{let e=class e{get itemLayoutNotify$(){return this.itemLayoutNotifySource.asObservable()}constructor(i){this.directionality=i,this.nzBordered=!1,this.nzGrid="",this.nzItemLayout="horizontal",this.nzRenderItem=null,this.nzLoading=!1,this.nzLoadMore=null,this.nzSize="default",this.nzSplit=!0,this.hasSomethingAfterLastItem=!1,this.dir="ltr",this.itemLayoutNotifySource=new Qk(this.nzItemLayout),this.destroy$=new qR}ngOnInit(){this.dir=this.directionality.value,this.directionality.change?.pipe(ZR(this.destroy$)).subscribe(i=>{this.dir=i})}getSomethingAfterLastItem(){return!!(this.nzLoadMore||this.nzPagination||this.nzFooter||this.nzListFooterComponent||this.nzListPaginationComponent||this.nzListLoadMoreDirective)}ngOnChanges(i){i.nzItemLayout&&this.itemLayoutNotifySource.next(this.nzItemLayout)}ngOnDestroy(){this.itemLayoutNotifySource.unsubscribe(),this.destroy$.next(),this.destroy$.complete()}ngAfterContentInit(){this.hasSomethingAfterLastItem=this.getSomethingAfterLastItem()}};e.\u0275fac=function(n){return new(n||e)(uo(xV,8))},e.\u0275cmp=si({type:e,selectors:[["nz-list"],["","nz-list",""]],contentQueries:function(n,a,o){if(n&1&&(Tc(o,h$,5),Tc(o,p$,5),Tc(o,U1e,5)),n&2){let s;co(s=fo())&&(a.nzListFooterComponent=s.first),co(s=fo())&&(a.nzListPaginationComponent=s.first),co(s=fo())&&(a.nzListLoadMoreDirective=s.first)}},hostAttrs:[1,"ant-list"],hostVars:16,hostBindings:function(n,a){n&2&&KR("ant-list-rtl",a.dir==="rtl")("ant-list-vertical",a.nzItemLayout==="vertical")("ant-list-lg",a.nzSize==="large")("ant-list-sm",a.nzSize==="small")("ant-list-split",a.nzSplit)("ant-list-bordered",a.nzBordered)("ant-list-loading",a.nzLoading)("ant-list-something-after-last-item",a.hasSomethingAfterLastItem)},inputs:{nzDataSource:"nzDataSource",nzBordered:"nzBordered",nzGrid:"nzGrid",nzHeader:"nzHeader",nzFooter:"nzFooter",nzItemLayout:"nzItemLayout",nzRenderItem:"nzRenderItem",nzLoading:"nzLoading",nzLoadMore:"nzLoadMore",nzPagination:"nzPagination",nzSize:"nzSize",nzSplit:"nzSplit",nzNoResult:"nzNoResult"},exportAs:["nzList"],standalone:!0,features:[C0,ui],ngContentSelectors:f1e,decls:15,vars:9,consts:[["itemsTpl",""],[4,"ngIf"],[3,"nzSpinning"],[3,"min-height",4,"ngIf"],["nz-row","",3,"nzGutter",4,"ngIf","ngIfElse"],[3,"nzNoResult",4,"ngIf"],[3,"ngTemplateOutlet"],[1,"ant-list-items"],[4,"ngFor","ngForOf"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"nzStringTemplateOutlet"],["nz-row","",3,"nzGutter"],["nz-col","",3,"nzSpan","nzXs","nzSm","nzMd","nzLg","nzXl","nzXXl",4,"ngFor","ngForOf"],["nz-col","",3,"nzSpan","nzXs","nzSm","nzMd","nzLg","nzXl","nzXXl"],[3,"nzNoResult"]],template:function(n,a){if(n&1&&(Ho(c1e),br(0,Jwe,3,1,"ng-template",null,0,gm)(2,Qwe,2,1,"nz-list-header",1),Li(3),tr(4,"nz-spin",2),Sl(5),br(6,e1e,1,2,"div",3)(7,i1e,2,2,"div",4)(8,n1e,1,1,"nz-list-empty",5),Ml(),lr(),br(9,o1e,2,1,"nz-list-footer",1),Li(10,1),br(11,s1e,0,0,"ng-template",6),Li(12,2),br(13,u1e,2,1,"nz-list-pagination",1),Li(14,3)),n&2){let o=gu(1);Ot(2),Rt("ngIf",a.nzHeader),Ot(2),Rt("nzSpinning",a.nzLoading),Ot(2),Rt("ngIf",a.nzLoading&&a.nzDataSource&&a.nzDataSource.length===0),Ot(),Rt("ngIf",a.nzGrid&&a.nzDataSource)("ngIfElse",o),Ot(),Rt("ngIf",!a.nzLoading&&a.nzDataSource&&a.nzDataSource.length===0),Ot(),Rt("ngIf",a.nzFooter),Ot(2),Rt("ngTemplateOutlet",a.nzLoadMore),Ot(2),Rt("ngIf",a.nzPagination)}},dependencies:[L0,R0,N1e,bl,qM,YM,wl,wV,Tl,JM,KM,v$,h$,p$],encapsulation:2,changeDetection:0});let r=e;return A0([P0()],r.prototype,"nzBordered",void 0),A0([P0()],r.prototype,"nzLoading",void 0),A0([P0()],r.prototype,"nzSplit",void 0),r})(),O1e=(()=>{let e=class e{get isVerticalAndExtra(){return this.itemLayout==="vertical"&&(!!this.listItemExtraDirective||!!this.nzExtra)}constructor(i,n){this.parentComp=i,this.cdr=n,this.nzActions=[],this.nzExtra=null,this.nzNoFlex=!1}ngAfterViewInit(){this.itemLayout$=this.parentComp.itemLayoutNotify$.subscribe(i=>{this.itemLayout=i,this.cdr.detectChanges()})}ngOnDestroy(){this.itemLayout$&&this.itemLayout$.unsubscribe()}};e.\u0275fac=function(n){return new(n||e)(uo(g$),uo(jR))},e.\u0275cmp=si({type:e,selectors:[["nz-list-item"],["","nz-list-item",""]],contentQueries:function(n,a,o){if(n&1&&Tc(o,f$,5),n&2){let s;co(s=fo())&&(a.listItemExtraDirective=s.first)}},hostAttrs:[1,"ant-list-item"],hostVars:2,hostBindings:function(n,a){n&2&&KR("ant-list-item-no-flex",a.nzNoFlex)},inputs:{nzActions:"nzActions",nzContent:"nzContent",nzExtra:"nzExtra",nzNoFlex:"nzNoFlex"},exportAs:["nzListItem"],standalone:!0,features:[ui],ngContentSelectors:L1e,decls:9,vars:2,consts:[["actionsTpl",""],["contentTpl",""],["extraTpl",""],["simpleTpl",""],[4,"ngIf","ngIfElse"],["nz-list-item-actions","",3,"nzActions",4,"ngIf"],["nz-list-item-actions","",3,"nzActions"],[4,"ngIf"],[4,"nzStringTemplateOutlet"],[3,"ngTemplateOutlet"],[1,"ant-list-item-main"]],template:function(n,a){if(n&1&&(Ho(R1e),br(0,p1e,2,1,"ng-template",null,0,gm)(2,v1e,3,1,"ng-template",null,1,gm)(4,g1e,1,0,"ng-template",null,2,gm)(6,M1e,4,4,"ng-template",null,3,gm)(8,C1e,6,4,"ng-container",4)),n&2){let o=gu(7);Ot(8),Rt("ngIf",a.isVerticalAndExtra)("ngIfElse",o)}},dependencies:[I1e,bl,qM,YM,L0,f$],encapsulation:2,changeDetection:0});let r=e;return A0([P0()],r.prototype,"nzNoFlex",void 0),r})();var NE=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=sV({type:e}),e.\u0275inj=oV({imports:[g$,v$,O1e,P1e,m$]});let r=e;return r})();var z1e=r=>({margin:r,width:"100%",height:"16rem"});function B1e(r,e){if(r&1&&li(0,"app-chart-component",28),r&2){let t=Lr(2).$implicit,i=Lr();hV(vV(3,z1e,"20px "+20/i.chartConfig.rowNumber+"px")),Rt("options",t.options)}}function k1e(r,e){if(r&1&&(tr(0,"div",26),br(1,B1e,1,5,"app-chart-component",27),lr()),r&2){let t=Lr().$implicit,i=Lr();Rt("nzSpan",24/i.chartConfig.rowNumber),Ot(),Rt("ngIf",t.checked)}}function V1e(r,e){if(r&1&&br(0,k1e,2,2,"div",25),r&2){let t=e.$implicit;Rt("ngIf",t.checked)}}function G1e(r,e){if(r&1&&(tr(0,"div",4)(1,"div",29),li(2,"app-chart-component",30),lr()()),r&2){let t=e.$implicit;Ot(2),Rt("options",t)}}var _$=(()=>{let e=class e{handleCheckedItems(i){console.log("\u5F53\u524D\u9009\u4E2D\u7684\u9879\u76EE:",i)}constructor(i){this._mqttService=i,this.http=xl(_m),this.modal=xl(ym),this.chartConfig={rowNumber:1,optionsCheckList:[{label:"\u5168\u6C34",options:{},checked:!0},{label:"\u70ED\u503C",options:{},checked:!0},{label:"\u5168\u786B",options:{},checked:!1},{label:"\u5185\u6C34",options:{},checked:!1},{label:"\u7070\u5206",options:{},checked:!1},{label:"\u6325\u53D1\u5206",options:{},checked:!1}],optionBottomList:[{}],optionsList:[{label:"\u5168\u6C34",options:{},checked:!0},{label:"\u70ED\u503C",options:{},checked:!0}],tableList:[{coldef:[{headerName:"\u65F6\u95F4",field:"rwmc",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u7CFB\u7EDF/\u8BBE\u5907",field:"rwms",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u64CD\u4F5C\u63CF\u8FF0",field:"kssj",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u64CD\u4F5C\u4EBA\u5458",field:"jhwcsj",unSortIcon:!0,minWidth:void 0,flex:1}],rowData:[]},{coldef:[{headerName:"\u5E8F\u53F7",field:"rwmc",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u65F6\u95F4",field:"kssj",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",field:"rwms",unSortIcon:!0,minWidth:void 0,flex:1},{headerName:"\u7B49\u7EA7",field:"dqzt",unSortIcon:!0,minWidth:void 0,flex:1}],rowData:[]}]},this.chart_options={},this.chart_options0={},this.chart_options1={},this.chart_options2={},this.chart_options3={},this.chart_options4={},this.rowData=[],this.colDefs1=[{headerName:"\u65F6\u95F4",field:"rwmc",flex:1},{headerName:"\u7CFB\u7EDF/\u8BBE\u5907",field:"rwms",flex:1},{headerName:"\u64CD\u4F5C\u63CF\u8FF0",field:"kssj",flex:1},{headerName:"\u64CD\u4F5C\u4EBA\u5458",field:"jhwcsj",flex:1}],this.colDefs2=[{headerName:"\u5E8F\u53F7",field:"rwmc",flex:1},{headerName:"\u65F6\u95F4",field:"kssj",flex:2},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",field:"rwms",flex:1},{headerName:"\u7B49\u7EA7",field:"dqzt",flex:1.5}],this.subscription=this._mqttService.observe("s1").subscribe(n=>{let a=JSON.parse(n.payload.toString());console.log("Received message as object: ",a.msg),this.chart_options0=a.msg})}ngOnInit(){this.getServerConfig();for(var i=1;i<30;i++)this.rowData.push({rwmc:"\u4EFB\u52A1"+i,rwms:"\u4EFB\u52A1\u63CF\u8FF0"+i,kssj:"2024-1-"+i+" 13:38:"+i*11,jhwcsj:"2024-1-"+i+" 13:38:"+i*10,sfcq:"\u5426",dqzt:"\u6B63\u5E38",dqjd:"\u8282\u70B9"+i,sjwcsj:"2024-1-"+i+" 13:38:"+i*27,bjmc:"\u62A5\u8B665",bjms:"\u62A5\u8B66\u63CF\u8FF05",bjsj:"2024-1-"+i+" 13:38:"+i*12,gzyy:"-",clff:"-",tzsj:"2024-1-"+i+" 13:38:"+i*19,zycd:"\u4E00\u822C",tzmc:"\u7CFB\u7EDF\u63D0\u793A",tznr:"\u8D26\u6237\u767B\u5F55",fj:"-",cz:"\u64CD\u4F5C"});for(var n=[],a=[],o=[],s=100,i=0;i<s;i++){var l=Math.random()*1e3;a.push("category"+i),n.push([i,xv.round(Math.max(0,l-Math.random()*100)),xv.round(l+Math.random()*80)]),o.push(xv.round(l,2))}this.chart_options={backgroundColor:"transparent",series:[{type:"gauge",startAngle:180,endAngle:0,center:["50%","75%"],radius:"90%",min:0,max:1,splitNumber:8,axisLine:{lineStyle:{width:6,color:[[.25,"#74FAFB"],[.5,"#74FAFB"],[.75,"#74FAFB"],[1,"#74FAFB"]]}},pointer:{icon:"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z",length:"12%",width:20,offsetCenter:[0,"-60%"],itemStyle:{color:"auto"}},axisTick:{length:12,lineStyle:{color:"auto",width:2}},splitLine:{length:20,lineStyle:{color:"auto",width:5}},axisLabel:{color:"#464646",fontSize:20,distance:-60,rotate:"tangential",formatter:function(u){return""}},title:{offsetCenter:[0,"-10%"],fontSize:20},detail:{fontSize:30,offsetCenter:[0,"-5%"],valueAnimation:!0,formatter:function(u){return Math.round(u*100)+""},color:"inherit"},data:[{value:.9,name:""}]}]},this.chart_options0={backgroundColor:"transparent",series:[{type:"gauge",startAngle:180,endAngle:0,center:["50%","75%"],radius:"90%",min:0,max:1,splitNumber:8,axisLine:{lineStyle:{width:6,color:[[.25,"#74FAFB"],[.5,"#74FAFB"],[.75,"#74FAFB"],[1,"#74FAFB"]]}},pointer:{icon:"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z",length:"12%",width:20,offsetCenter:[0,"-60%"],itemStyle:{color:"auto"}},axisTick:{length:12,lineStyle:{color:"auto",width:2}},splitLine:{length:20,lineStyle:{color:"auto",width:5}},axisLabel:{color:"#464646",fontSize:20,distance:-60,rotate:"tangential",formatter:function(u){return""}},title:{offsetCenter:[0,"0%"],fontSize:20},detail:{fontSize:30,offsetCenter:[0,"-5%"],valueAnimation:!0,formatter:function(u){return Math.round(u*100)+""},color:"inherit"},data:[{value:.97,name:""}]}]},this.chart_options1={title:{textStyle:{color:"#ffffff"},text:"\u5168\u6C34",subtext:"(kg/kg)"},legend:{data:["\u6D4B\u91CF\u503C","\u4E0A\u9650\u503C","\u4E0B\u9650\u503C"]},calculable:!0,xAxis:[{axisLine:{lineStyle:{color:[[.25,"#74FAFB"],[.5,"#74FAFB"],[.75,"#74FAFB"],[1,"#74FAFB"]]}},position:"bottom",type:"category",data:["1","2","3","4","5","6","7","8","9","10","11","12"]}],yAxis:[{type:"value"}],series:[{name:"\u6D4B\u91CF\u503C",type:"line",data:[100,155,139,199,220,160,120,182.2,150,155,160,180],markPoint:{data:[{name:"\u6700\u5927\u503C",value:220,xAxis:4,yAxis:220},{name:"\u6700\u5C0F\u503C",value:100,xAxis:0,yAxis:100}]},markLine:{data:[{type:"average",name:"\u5E73\u5747\u503C"}]}},{type:"custom",name:"error",itemStyle:{borderWidth:1.5},renderItem:function(u,c){var f=c.value(0),h=c.coord([f,c.value(1)]),p=c.coord([f,c.value(2)]),d=c.size([1,0])[0]*.1,g=c.style({stroke:c.visual("color"),fill:void 0});return{type:"group",children:[{type:"line",transition:["shape"],shape:{x1:h[0]-d,y1:h[1],x2:h[0]+d,y2:h[1]},style:g},{type:"line",transition:["shape"],shape:{x1:h[0],y1:h[1],x2:p[0],y2:p[1]},style:g},{type:"line",transition:["shape"],shape:{x1:p[0]-d,y1:p[1],x2:p[0]+d,y2:p[1]},style:g}]}},encode:{x:0,y:[1,2]},data:n,z:100}]},this.chart_options2={title:{text:"\u70ED\u503C",subtext:"(kg/kg)"},legend:{data:["\u8D85\u5DEE\u6837\u6570\u91CF","\u4E0D\u5408\u683C\u6837\u6570\u91CF"]},xAxis:[{type:"category",data:["1","2","3","4","5","6","7","8","9","10","11","12"]}],yAxis:[{type:"value"}],series:[{name:"\u8D85\u5DEE\u6837\u6570\u91CF",type:"line",data:[2,4.9,7,23.2,25.6,76.7,135.6,162.2,32.6,20,6.4,3.3],markPoint:{data:[{type:"max",name:"Max"},{type:"min",name:"Min"}]}},{name:"\u4E0D\u5408\u683C\u6837\u6570\u91CF",type:"bar",data:[2.6,5.9,9,26.4,28.7,70.7,175.6,182.2,48.7,18.8,6,2.3],markPoint:{data:[{name:"Max",value:182.2,xAxis:7,yAxis:183},{name:"Min",value:2.3,xAxis:11,yAxis:3}]},markLine:{data:[{type:"average",name:"Avg"}]}}],grid:{left:"3%",right:"3%",bottom:"3%",containLabel:!0},toolbox:{show:!1,feature:{dataView:{show:!0,readOnly:!1},magicType:{show:!0,type:["line","bar"]},restore:{show:!0},saveAsImage:{show:!0}}},calculable:!0},this.chart_options3={title:{text:"\u7164\u6837\u8D85\u5DEE\u7387"},grid:{top:"10%",left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:["\u8D85\u5DEE\u6837\u91CF","\u603B\u6837\u91CF"]},yAxis:{type:"value"},series:[{data:[3,16],label:{show:!0,position:"top",formatter:function(u){return u.value}},type:"bar"}]},this.chart_options4={title:{text:"\u7164\u6837\u5408\u683C\u7387",left:"center"},grid:{top:"10%",left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:["\u8D85\u5DEE\u6837\u91CF","\u603B\u6837\u91CF"]},yAxis:{type:"value"},series:[{data:[15,16],type:"bar",label:{show:!0,position:"top",formatter:function(u){return u.value}}}]},this.chartConfig.optionsCheckList[1].options=this.chart_options2,this.chartConfig.optionsCheckList[2].options=this.chart_options3,this.chartConfig.optionsCheckList[3].options=this.chart_options4,this.chartConfig.optionBottomList[0]=this.chart_options3,this.chartConfig.optionBottomList[1]=this.chart_options4}unsafePublish(i,n){this._mqttService.unsafePublish(i,n,{qos:1,retain:!0})}ngOnDestroy(){this.subscription.unsubscribe()}getServerConfig(){this.http.get("http://localhost:5006/api/config/s1").subscribe(i=>{this.chartConfig.optionsCheckList[0].options=i.data,console.log(i)})}};e.\u0275fac=function(n){return new(n||e)(uo(RV))},e.\u0275cmp=si({type:e,selectors:[["app-data-v-s1"]],standalone:!0,features:[ui],decls:56,vars:13,consts:[["nz-row","",1,"s1-container",3,"nzGutter"],["nz-col","","nzSpan","8"],["title","\u7CFB\u7EDF\u72B6\u6001"],["nz-row","",2,"justify-content","center","align-items","center"],["nz-col","","nzSpan","12"],[1,"centered-element"],[2,"width","26rem","height","11rem",3,"options"],[1,"sys-status-title"],["title","\u7CFB\u7EDF\u64CD\u4F5C\u8BB0\u5F55",2,"margin-top","1rem"],[1,"ag-theme-datav",3,"rowData","columnDefs"],["title","\u7CFB\u7EDF\u62A5\u8B66\u4FE1\u606F",2,"margin-top","1rem"],["title","",2,"margin-top","1rem"],[1,"progress-container"],[1,"status-text"],[2,"width","100%",3,"nzPercent","nzStrokeColor"],[1,"status-ext-text"],[1,"progress-container","mt-sm"],["title",""],[2,"height","34.6rem"],["src","assets/dashboard/dashboard_ws_demo1.png",2,"width","100%"],["nz-row","",2,"justify-content","center","align-items","center","margin-top","0.5rem"],["nz-col","","nzSpan","12",1,"sys-status-title"],["title","\u5316\u9A8C\u7ED3\u679C",3,"showSetting","optionsList","onCheckedItemsChange"],["nz-row","",1,"scrollable-container"],["nz-row",""],["nz-col","","class","centered-element",3,"nzSpan",4,"ngIf"],["nz-col","",1,"centered-element",3,"nzSpan"],[3,"options","style",4,"ngIf"],[3,"options"],[1,"centered-element",2,"margin","2px"],[2,"width","26rem","height","11rem","margin-left","0.4rem",3,"options"],["nz-col","","class","centered-element",3,"nzSpan"]],template:function(n,a){n&1&&(tr(0,"div",0)(1,"div",1)(2,"data-v-card",2)(3,"div",3)(4,"div",4)(5,"div",5),li(6,"app-chart-component",6),lr(),tr(7,"div",7),Pi(8,"\u7CFB\u7EDF\u5065\u5EB7\u5EA6"),lr()(),tr(9,"div",4)(10,"div",5),li(11,"app-chart-component",6),lr(),tr(12,"div",7),Pi(13,"\u8BBE\u5907\u6295\u8FD0\u5EA6"),lr()()()(),tr(14,"data-v-card",8),li(15,"ag-grid-angular",9),lr(),tr(16,"data-v-card",10),li(17,"ag-grid-angular",9),lr(),tr(18,"data-v-card",11)(19,"div",12)(20,"span",13),Pi(21,"\u5316\u9A8C\u6548\u7387\uFF1A"),lr(),li(22,"nz-progress",14),tr(23,"span",15),Pi(24,"\uFF0816/25\uFF09"),lr()(),tr(25,"div",16)(26,"span",13),Pi(27,"\u5B8C \u6210 \u7387 \uFF1A"),lr(),li(28,"nz-progress",14),tr(29,"span",15),Pi(30,"\uFF0812/20\uFF09"),lr()()()(),tr(31,"div",1)(32,"data-v-card",17)(33,"div",18),li(34,"img",19),tr(35,"div",20)(36,"div",21),Pi(37," \u673A\u5668\u4EBA "),lr(),tr(38,"div",21),Pi(39," \u5168\u786B\u4EEA "),lr(),tr(40,"div",21),Pi(41," \u5168\u6C34\u5206\u6790\u4EEA "),lr(),tr(42,"div",21),Pi(43," \u6325\u53D1\u5206\u4EEA "),lr(),tr(44,"div",21),Pi(45," \u91CF\u70ED\u4EEA "),lr(),tr(46,"div",21),Pi(47," \u78B3\u6C22\u6C2E\u5143\u7D20 "),lr()()()()(),tr(48,"div",1)(49,"data-v-card",22),dV("onCheckedItemsChange",function(s){return a.handleCheckedItems(s)}),tr(50,"div",23),$R(51,V1e,1,1,"div",31,JR),lr(),tr(53,"div",24),$R(54,G1e,3,1,"div",4,JR),lr()()()()),n&2&&(Rt("nzGutter",16),Ot(6),Rt("options",a.chart_options),Ot(5),Rt("options",a.chart_options0),Ot(4),Rt("rowData",a.rowData)("columnDefs",a.colDefs1),Ot(2),Rt("rowData",a.rowData)("columnDefs",a.colDefs2),Ot(5),Rt("nzPercent",64)("nzStrokeColor","#74FAFB"),Ot(6),Rt("nzPercent",60)("nzStrokeColor","#74FAFB"),Ot(21),Rt("showSetting",!0)("optionsList",a.chartConfig.optionsCheckList),Ot(2),QR(a.chartConfig.optionsCheckList),Ot(3),QR(a.chartConfig.optionBottomList))},dependencies:[XM,bl,jM,rf,EV,AV,CV,NE,Dc,Ic,Kc,Wc,$c,Qc,Jc,Zc,Pc,Vc,Hc,nf,qc,Xc,JM,KM,Tl,Cc,Bc,kc,ef,Fc,El,Yc,Oc,Gc,zc,tf,Lc,Rc,jc,Uc,Ac,Nc,wl,l$],styles:[".dashboard-container[_ngcontent-%COMP%]{width:20rem;height:10rem;margin-top:-3rem;margin-bottom:-2rem}.sys-status-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600;color:#94ddf3;text-align:center}.ag-theme-datav[_ngcontent-%COMP%]{--ag-border-color: #74FAFB;--ag-foreground-color: #74FAFB;--ag-background-color: #0A1632;--ag-header-foreground-color: #74FAFB;--ag-header-background-color: #0A1632;--ag-odd-row-background-color: #0A1632;--ag-header-column-resize-handle-color: #7e2e84;--ag-font-size: 17px;--ag-font-family: monospace;height:5rem}.centered-element[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:100%}.status-container[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.5rem}.status-circle[_ngcontent-%COMP%]{width:18px;height:18px;border-radius:50%}.status-circle.red[_ngcontent-%COMP%]{background-color:red}.status-circle.green[_ngcontent-%COMP%]{background-color:green}.progress-container[_ngcontent-%COMP%]{display:flex;color:#fff}.progress-container[_ngcontent-%COMP%] .status-text[_ngcontent-%COMP%]{width:8rem;margin-left:6px;font-size:16px;font-weight:600;color:#74fafb}.progress-container[_ngcontent-%COMP%] .status-ext-text[_ngcontent-%COMP%]{margin-top:3px;font-size:12px}.progress-display[_ngcontent-%COMP%]{color:#fff;text-align:right}.statistic-item-container[_ngcontent-%COMP%]{display:flex;padding:1rem 0;color:#fff}.white-color-theme[_ngcontent-%COMP%]{color:#74fafb}.scrollable-container[_ngcontent-%COMP%]{scrollbar-color:auto;overflow-y:auto;width:100%;height:20rem} ::-webkit-scrollbar{width:10px} ::-webkit-scrollbar-track{background-color:#0a1632} ::-webkit-scrollbar-thumb{background-color:#74fafb;border-radius:2px} ::-webkit-scrollbar-thumb:hover{background-color:#74fafb}"]});let r=e;return r})();function H1e(r,e){if(r&1&&(tr(0,"li")(1,"a",2),Pi(2),lr()()),r&2){let t=e.$implicit;Ot(),Rt("routerLink",t.link),Ot(),Ec(t.text)}}function W1e(r,e){if(r&1&&(tr(0,"div")(1,"ul"),br(2,H1e,3,2,"li",1),lr()()),r&2){let t=Lr();Ot(2),Rt("ngForOf",t.children)}}var x$=(()=>{let e=class e{constructor(i,n){this.route=i,this.router=n,this.menu=null,this.children=null}ngOnInit(){let i=this.router.getCurrentNavigation();i?.extras.state&&(this.menu=i.extras.state.menu,this.children=this.menu?.children||null,console.log("\u7A7F\u5E26\u8FC7\u6765\u7684\u83DC\u5355\u53C2\u6570"),console.log(this.menu),console.log(this.children))}navigateToChild(i){i.link&&this.router.navigateByUrl(i.link)}};e.\u0275fac=function(n){return new(n||e)(uo(gV),uo(yV))},e.\u0275cmp=si({type:e,selectors:[["app-data-v-s1"]],standalone:!0,features:[ui],decls:1,vars:1,consts:[[4,"ngIf"],[4,"ngFor","ngForOf"],[3,"routerLink"]],template:function(n,a){n&1&&br(0,W1e,3,1,"div",0),n&2&&Rt("ngIf",a.children&&a.children.length)},dependencies:[XM,R0,bl,jM,rf,NE,Dc,Ic,_V,Kc,Wc,$c,Qc,Jc,Zc,Pc,Vc,Hc,nf,qc,Xc,Tl,Cc,Bc,kc,ef,Fc,El,Yc,Oc,Gc,zc,tf,Lc,Rc,jc,Uc,Ac,Nc,wl],styles:[".dashboard-container[_ngcontent-%COMP%]{width:20rem;height:10rem;margin-top:-3rem;margin-bottom:-2rem}.sys-status-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600;color:#94ddf3;text-align:center}.ag-theme-datav[_ngcontent-%COMP%]{--ag-border-color: #74FAFB;--ag-foreground-color: #74FAFB;--ag-background-color: #0A1632;--ag-header-foreground-color: #74FAFB;--ag-header-background-color: #0A1632;--ag-odd-row-background-color: #0A1632;--ag-header-column-resize-handle-color: #7e2e84;--ag-font-size: 17px;--ag-font-family: monospace;height:5rem}.scrollable-container[_ngcontent-%COMP%]{overflow-y:auto;width:100%;height:20rem}.centered-element[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:100%}.status-container[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.5rem}.status-circle[_ngcontent-%COMP%]{width:18px;height:18px;border-radius:50%}.status-circle.red[_ngcontent-%COMP%]{background-color:red}.status-circle.green[_ngcontent-%COMP%]{background-color:green}.progress-container[_ngcontent-%COMP%]{display:flex;color:#fff}.progress-container[_ngcontent-%COMP%] .status-text[_ngcontent-%COMP%]{width:8rem;margin-left:6px;font-size:16px;font-weight:600;color:#74fafb}.progress-container[_ngcontent-%COMP%] .status-ext-text[_ngcontent-%COMP%]{margin-top:3px;font-size:12px}.progress-display[_ngcontent-%COMP%]{color:#fff;text-align:right}.statistic-item-container[_ngcontent-%COMP%]{display:flex;padding:1rem 0;color:#fff}.white-color-theme[_ngcontent-%COMP%]{color:#74fafb}"]});let r=e;return r})();var S$=(()=>{let e=class e{constructor(){this.http=xl(_m),this.modal=xl(ym)}ngOnInit(){}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["app-data-v-threejs"]],standalone:!0,features:[ui],decls:1,vars:0,consts:[["src","http://112.33.111.160:8083/","width","100%","height","650px",2,"border","0"]],template:function(n,a){n&1&&li(0,"iframe",0)},dependencies:[Dc,Ic,Kc,Wc,$c,Qc,Jc,Zc,Pc,Vc,Hc,nf,qc,Xc,Tl,Cc,Bc,kc,ef,rf,Fc,El,Yc,Oc,Gc,zc,tf,Lc,Rc,jc,Uc,Ac,Nc,wl]});let r=e;return r})();var rS="162";var M$=0,W3=1,b$=2;var UE=1,w$=2,nl=3,Ao=0,_i=1,Co=2,ms=0,Yu=1,X3=2,Y3=3,q3=4,T$=5,qu=100,E$=101,A$=102,Z3=103,j3=104,C$=200,R$=201,L$=202,P$=203,iS=204,nS=205,D$=206,I$=207,N$=208,U$=209,O$=210,F$=211,z$=212,B$=213,k$=214,V$=0,G$=1,H$=2,lg=3,W$=4,X$=5,Y$=6,q$=7,OE=0,Z$=1,j$=2,vs=0,K$=1,J$=2,$$=3,Q$=4,eQ=5,tQ=6,rQ=7;var K3=300,al=301,tu=302,aS=303,oS=304,oh=306,sS=1e3,ma=1001,lS=1002,ki=1003,J3=1004;var ug=1005;var Qi=1006,FE=1007;var ol=1008;var Ro=1009,iQ=1010,nQ=1011,cg=1012,zE=1013,Lo=1014,Ya=1015,Zu=1016,BE=1017,kE=1018,gs=1020,aQ=1021,Rn=1023,oQ=1024,sQ=1025,sl=1026,ru=1027,lQ=1028,VE=1029,uQ=1030,GE=1031,HE=1033,WE=33776,XE=33777,YE=33778,qE=33779,$3=35840,Q3=35841,eF=35842,tF=35843,ZE=36196,rF=37492,iF=37496,nF=37808,aF=37809,oF=37810,sF=37811,lF=37812,uF=37813,cF=37814,fF=37815,hF=37816,pF=37817,dF=37818,mF=37819,vF=37820,gF=37821,jE=36492,yF=36494,_F=36495,cQ=36283,xF=36284,SF=36285,MF=36286;var fQ=3200,hQ=3201,pQ=0,dQ=1,ys="",qa="srgb",Za="srgb-linear",fg="display-p3",dd="display-p3-linear",hg="linear",Hr="srgb",pg="rec709",dg="p3";var md=7680;var bF=519,mQ=512,vQ=513,gQ=514,KE=515,yQ=516,_Q=517,xQ=518,SQ=519,wF=35044;var TF="300 es",uS=1035,ja=2e3,vd=2001;var Ka=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let n=i.slice(0);for(let a=0,o=n.length;a<o;a++)n[a].call(this,e);e.target=null}}};var Yn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var JE=Math.PI/180,cS=180/Math.PI;function iu(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Yn[r&255]+Yn[r>>8&255]+Yn[r>>16&255]+Yn[r>>24&255]+"-"+Yn[e&255]+Yn[e>>8&255]+"-"+Yn[e>>16&15|64]+Yn[e>>24&255]+"-"+Yn[t&63|128]+Yn[t>>8&255]+"-"+Yn[t>>16&255]+Yn[t>>24&255]+Yn[i&255]+Yn[i>>8&255]+Yn[i>>16&255]+Yn[i>>24&255]).toLowerCase()}function en(r,e,t){return Math.max(e,Math.min(t,r))}function MQ(r,e){return(r%e+e)%e}function $E(r,e,t){return(1-t)*r+t*e}function EF(r){return(r&r-1)===0&&r!==0}function fS(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function mg(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function va(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var Kt=class r{constructor(e=0,t=0){r.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(en(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),a=this.x-e.x,o=this.y-e.y;return this.x=a*i-o*n+e.x,this.y=a*n+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};var $t=class r{constructor(e,t,i,n,a,o,s,l,u){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,n,a,o,s,l,u)}set(e,t,i,n,a,o,s,l,u){let c=this.elements;return c[0]=e,c[1]=n,c[2]=s,c[3]=t,c[4]=a,c[5]=l,c[6]=i,c[7]=o,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,a=this.elements,o=i[0],s=i[3],l=i[6],u=i[1],c=i[4],f=i[7],h=i[2],p=i[5],d=i[8],g=n[0],m=n[3],v=n[6],_=n[1],y=n[4],x=n[7],M=n[2],S=n[5],w=n[8];return a[0]=o*g+s*_+l*M,a[3]=o*m+s*y+l*S,a[6]=o*v+s*x+l*w,a[1]=u*g+c*_+f*M,a[4]=u*m+c*y+f*S,a[7]=u*v+c*x+f*w,a[2]=h*g+p*_+d*M,a[5]=h*m+p*y+d*S,a[8]=h*v+p*x+d*w,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return t*o*c-t*s*u-i*a*c+i*s*l+n*a*u-n*o*l}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=c*o-s*u,h=s*l-c*a,p=u*a-o*l,d=t*f+i*h+n*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=f*g,e[1]=(n*u-c*i)*g,e[2]=(s*i-n*o)*g,e[3]=h*g,e[4]=(c*t-n*l)*g,e[5]=(n*a-s*t)*g,e[6]=p*g,e[7]=(i*l-u*t)*g,e[8]=(o*t-i*a)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,a,o,s){let l=Math.cos(a),u=Math.sin(a);return this.set(i*l,i*u,-i*(l*o+u*s)+o+e,-n*u,n*l,-n*(-u*o+l*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(AF.makeScale(e,t)),this}rotate(e){return this.premultiply(AF.makeRotation(-e)),this}translate(e,t){return this.premultiply(AF.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}},AF=new $t;function QE(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function vg(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function wQ(){let r=vg("canvas");return r.style.display="block",r}var bQ={};function TQ(r){r in bQ||(bQ[r]=!0,console.warn(r))}var EQ=new $t().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),AQ=new $t().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),eA={[Za]:{transfer:hg,primaries:pg,toReference:r=>r,fromReference:r=>r},[qa]:{transfer:Hr,primaries:pg,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[dd]:{transfer:hg,primaries:dg,toReference:r=>r.applyMatrix3(AQ),fromReference:r=>r.applyMatrix3(EQ)},[fg]:{transfer:Hr,primaries:dg,toReference:r=>r.convertSRGBToLinear().applyMatrix3(AQ),fromReference:r=>r.applyMatrix3(EQ).convertLinearToSRGB()}},X1e=new Set([Za,dd]),Er={enabled:!0,_workingColorSpace:Za,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!X1e.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;let i=eA[e].toReference,n=eA[t].fromReference;return n(i(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return eA[r].primaries},getTransfer:function(r){return r===ys?hg:eA[r].transfer}};function sh(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function tA(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var gg,yg=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{gg===void 0&&(gg=vg("canvas")),gg.width=e.width,gg.height=e.height;let i=gg.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=gg}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=vg("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),a=n.data;for(let o=0;o<a.length;o++)a[o]=sh(a[o]/255)*255;return i.putImageData(n,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(sh(t[i]/255)*255):t[i]=sh(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}};var Y1e=0,_g=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Y1e++}),this.uuid=iu(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(n!==null){let a;if(Array.isArray(n)){a=[];for(let o=0,s=n.length;o<s;o++)n[o].isDataTexture?a.push(CF(n[o].image)):a.push(CF(n[o]))}else a=CF(n);i.url=a}return t||(e.images[this.uuid]=i),i}};function CF(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?yg.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var q1e=0,Ja=(()=>{class r extends Ka{constructor(t=r.DEFAULT_IMAGE,i=r.DEFAULT_MAPPING,n=ma,a=ma,o=Qi,s=ol,l=Rn,u=Ro,c=r.DEFAULT_ANISOTROPY,f=ys){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:q1e++}),this.uuid=iu(),this.name="",this.source=new _g(t),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=a,this.magFilter=o,this.minFilter=s,this.anisotropy=c,this.format=l,this.internalFormat=null,this.type=u,this.offset=new Kt(0,0),this.repeat=new Kt(1,1),this.center=new Kt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new $t,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}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.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,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.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let i=t===void 0||typeof t=="string";if(!i&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),i||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==K3)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case sS:t.x=t.x-Math.floor(t.x);break;case ma:t.x=t.x<0?0:1;break;case lS:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case sS:t.y=t.y-Math.floor(t.y);break;case ma:t.y=t.y<0?0:1;break;case lS:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}}return r.DEFAULT_IMAGE=null,r.DEFAULT_MAPPING=K3,r.DEFAULT_ANISOTROPY=1,r})();var ii=class r{constructor(e=0,t=0,i=0,n=1){r.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,a=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*n+o[12]*a,this.y=o[1]*t+o[5]*i+o[9]*n+o[13]*a,this.z=o[2]*t+o[6]*i+o[10]*n+o[14]*a,this.w=o[3]*t+o[7]*i+o[11]*n+o[15]*a,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,a,l=e.elements,u=l[0],c=l[4],f=l[8],h=l[1],p=l[5],d=l[9],g=l[2],m=l[6],v=l[10];if(Math.abs(c-h)<.01&&Math.abs(f-g)<.01&&Math.abs(d-m)<.01){if(Math.abs(c+h)<.1&&Math.abs(f+g)<.1&&Math.abs(d+m)<.1&&Math.abs(u+p+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let y=(u+1)/2,x=(p+1)/2,M=(v+1)/2,S=(c+h)/4,w=(f+g)/4,T=(d+m)/4;return y>x&&y>M?y<.01?(i=0,n=.707106781,a=.707106781):(i=Math.sqrt(y),n=S/i,a=w/i):x>M?x<.01?(i=.707106781,n=0,a=.707106781):(n=Math.sqrt(x),i=S/n,a=T/n):M<.01?(i=.707106781,n=.707106781,a=0):(a=Math.sqrt(M),i=w/a,n=T/a),this.set(i,n,a,t),this}let _=Math.sqrt((m-d)*(m-d)+(f-g)*(f-g)+(h-c)*(h-c));return Math.abs(_)<.001&&(_=1),this.x=(m-d)/_,this.y=(f-g)/_,this.z=(h-c)/_,this.w=Math.acos((u+p+v-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};var rA=class extends Ka{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ii(0,0,e,t),this.scissorTest=!1,this.viewport=new ii(0,0,e,t);let n={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qi,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let a=new Ja(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);a.flipY=!1,a.generateMipmaps=i.generateMipmaps,a.internalFormat=i.internalFormat,this.textures=[];let o=i.count;for(let s=0;s<o;s++)this.textures[s]=a.clone(),this.textures[s].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,a=this.textures.length;n<a;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,n=e.textures.length;i<n;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new _g(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}};var $a=class extends rA{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}};var xg=class extends Ja{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=ki,this.minFilter=ki,this.wrapR=ma,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var iA=class extends Ja{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=ki,this.minFilter=ki,this.wrapR=ma,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var au=class{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,a,o,s){let l=i[n+0],u=i[n+1],c=i[n+2],f=i[n+3],h=a[o+0],p=a[o+1],d=a[o+2],g=a[o+3];if(s===0){e[t+0]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f;return}if(s===1){e[t+0]=h,e[t+1]=p,e[t+2]=d,e[t+3]=g;return}if(f!==g||l!==h||u!==p||c!==d){let m=1-s,v=l*h+u*p+c*d+f*g,_=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){let M=Math.sqrt(y),S=Math.atan2(M,v*_);m=Math.sin(m*S)/M,s=Math.sin(s*S)/M}let x=s*_;if(l=l*m+h*x,u=u*m+p*x,c=c*m+d*x,f=f*m+g*x,m===1-s){let M=1/Math.sqrt(l*l+u*u+c*c+f*f);l*=M,u*=M,c*=M,f*=M}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,n,a,o){let s=i[n],l=i[n+1],u=i[n+2],c=i[n+3],f=a[o],h=a[o+1],p=a[o+2],d=a[o+3];return e[t]=s*d+c*f+l*p-u*h,e[t+1]=l*d+c*h+u*f-s*p,e[t+2]=u*d+c*p+s*h-l*f,e[t+3]=c*d-s*f-l*h-u*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,n=e._y,a=e._z,o=e._order,s=Math.cos,l=Math.sin,u=s(i/2),c=s(n/2),f=s(a/2),h=l(i/2),p=l(n/2),d=l(a/2);switch(o){case"XYZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"YXZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"ZXY":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"ZYX":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"YZX":this._x=h*c*f+u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f-h*p*d;break;case"XZY":this._x=h*c*f-u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],a=t[8],o=t[1],s=t[5],l=t[9],u=t[2],c=t[6],f=t[10],h=i+s+f;if(h>0){let p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(c-l)*p,this._y=(a-u)*p,this._z=(o-n)*p}else if(i>s&&i>f){let p=2*Math.sqrt(1+i-s-f);this._w=(c-l)/p,this._x=.25*p,this._y=(n+o)/p,this._z=(a+u)/p}else if(s>f){let p=2*Math.sqrt(1+s-i-f);this._w=(a-u)/p,this._x=(n+o)/p,this._y=.25*p,this._z=(l+c)/p}else{let p=2*Math.sqrt(1+f-i-s);this._w=(o-n)/p,this._x=(a+u)/p,this._y=(l+c)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(en(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let n=Math.min(1,t/i);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,a=e._z,o=e._w,s=t._x,l=t._y,u=t._z,c=t._w;return this._x=i*c+o*s+n*u-a*l,this._y=n*c+o*l+a*s-i*u,this._z=a*c+o*u+i*l-n*s,this._w=o*c-i*s-n*l-a*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,n=this._y,a=this._z,o=this._w,s=o*e._w+i*e._x+n*e._y+a*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=i,this._y=n,this._z=a,this;let l=1-s*s;if(l<=Number.EPSILON){let p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*n+t*this._y,this._z=p*a+t*this._z,this.normalize(),this}let u=Math.sqrt(l),c=Math.atan2(u,s),f=Math.sin((1-t)*c)/u,h=Math.sin(t*c)/u;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=n*f+this._y*h,this._z=a*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),a=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),a*Math.sin(t),a*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}};var be=class r{constructor(e=0,t=0,i=0){r.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(CQ.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(CQ.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6]*n,this.y=a[1]*t+a[4]*i+a[7]*n,this.z=a[2]*t+a[5]*i+a[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,a=e.elements,o=1/(a[3]*t+a[7]*i+a[11]*n+a[15]);return this.x=(a[0]*t+a[4]*i+a[8]*n+a[12])*o,this.y=(a[1]*t+a[5]*i+a[9]*n+a[13])*o,this.z=(a[2]*t+a[6]*i+a[10]*n+a[14])*o,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,a=e.x,o=e.y,s=e.z,l=e.w,u=2*(o*n-s*i),c=2*(s*t-a*n),f=2*(a*i-o*t);return this.x=t+l*u+o*f-s*c,this.y=i+l*c+s*u-a*f,this.z=n+l*f+a*c-o*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n,this.y=a[1]*t+a[5]*i+a[9]*n,this.z=a[2]*t+a[6]*i+a[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,a=e.z,o=t.x,s=t.y,l=t.z;return this.x=n*l-a*s,this.y=a*o-i*l,this.z=i*s-n*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return RF.copy(this).projectOnVector(e),this.sub(RF)}reflect(e){return this.sub(RF.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(en(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},RF=new be,CQ=new au;var Ku=class{constructor(e=new be(1/0,1/0,1/0),t=new be(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(ll.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(ll.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=ll.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let a=i.getAttribute("position");if(t===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let o=0,s=a.count;o<s;o++)e.isMesh===!0?e.getVertexPosition(o,ll):ll.fromBufferAttribute(a,o),ll.applyMatrix4(e.matrixWorld),this.expandByPoint(ll);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),nA.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),nA.copy(i.boundingBox)),nA.applyMatrix4(e.matrixWorld),this.union(nA)}let n=e.children;for(let a=0,o=n.length;a<o;a++)this.expandByObject(n[a],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ll),ll.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(hS),aA.subVectors(this.max,hS),Sg.subVectors(e.a,hS),Mg.subVectors(e.b,hS),bg.subVectors(e.c,hS),lh.subVectors(Mg,Sg),uh.subVectors(bg,Mg),gd.subVectors(Sg,bg);let t=[0,-lh.z,lh.y,0,-uh.z,uh.y,0,-gd.z,gd.y,lh.z,0,-lh.x,uh.z,0,-uh.x,gd.z,0,-gd.x,-lh.y,lh.x,0,-uh.y,uh.x,0,-gd.y,gd.x,0];return!LF(t,Sg,Mg,bg,aA)||(t=[1,0,0,0,1,0,0,0,1],!LF(t,Sg,Mg,bg,aA))?!1:(oA.crossVectors(lh,uh),t=[oA.x,oA.y,oA.z],LF(t,Sg,Mg,bg,aA))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ll).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ll).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ju[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ju[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ju[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ju[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ju[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ju[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ju[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ju[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ju),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},ju=[new be,new be,new be,new be,new be,new be,new be,new be],ll=new be,nA=new Ku,Sg=new be,Mg=new be,bg=new be,lh=new be,uh=new be,gd=new be,hS=new be,aA=new be,oA=new be,yd=new be;function LF(r,e,t,i,n){for(let a=0,o=r.length-3;a<=o;a+=3){yd.fromArray(r,a);let s=n.x*Math.abs(yd.x)+n.y*Math.abs(yd.y)+n.z*Math.abs(yd.z),l=e.dot(yd),u=t.dot(yd),c=i.dot(yd);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var Z1e=new Ku,pS=new be,PF=new be,ch=class{constructor(e=new be,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):Z1e.setFromPoints(e).getCenter(i);let n=0;for(let a=0,o=e.length;a<o;a++)n=Math.max(n,i.distanceToSquared(e[a]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;pS.subVectors(e,this.center);let t=pS.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector(pS,n/i),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(PF.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(pS.copy(e.center).add(PF)),this.expandByPoint(pS.copy(e.center).sub(PF))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};var Ju=new be,DF=new be,sA=new be,fh=new be,IF=new be,lA=new be,NF=new be,uA=class{constructor(e=new be,t=new be(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ju)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Ju.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ju.copy(this.origin).addScaledVector(this.direction,t),Ju.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){DF.copy(e).add(t).multiplyScalar(.5),sA.copy(t).sub(e).normalize(),fh.copy(this.origin).sub(DF);let a=e.distanceTo(t)*.5,o=-this.direction.dot(sA),s=fh.dot(this.direction),l=-fh.dot(sA),u=fh.lengthSq(),c=Math.abs(1-o*o),f,h,p,d;if(c>0)if(f=o*l-s,h=o*s-l,d=a*c,f>=0)if(h>=-d)if(h<=d){let g=1/c;f*=g,h*=g,p=f*(f+o*h+2*s)+h*(o*f+h+2*l)+u}else h=a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;else h=-a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;else h<=-d?(f=Math.max(0,-(-o*a+s)),h=f>0?-a:Math.min(Math.max(-a,-l),a),p=-f*f+h*(h+2*l)+u):h<=d?(f=0,h=Math.min(Math.max(-a,-l),a),p=h*(h+2*l)+u):(f=Math.max(0,-(o*a+s)),h=f>0?a:Math.min(Math.max(-a,-l),a),p=-f*f+h*(h+2*l)+u);else h=o>0?-a:a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,f),n&&n.copy(DF).addScaledVector(sA,h),p}intersectSphere(e,t){Ju.subVectors(e.center,this.origin);let i=Ju.dot(this.direction),n=Ju.dot(Ju)-i*i,a=e.radius*e.radius;if(n>a)return null;let o=Math.sqrt(a-n),s=i-o,l=i+o;return l<0?null:s<0?this.at(l,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,a,o,s,l,u=1/this.direction.x,c=1/this.direction.y,f=1/this.direction.z,h=this.origin;return u>=0?(i=(e.min.x-h.x)*u,n=(e.max.x-h.x)*u):(i=(e.max.x-h.x)*u,n=(e.min.x-h.x)*u),c>=0?(a=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(a=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),i>o||a>n||((a>i||isNaN(i))&&(i=a),(o<n||isNaN(n))&&(n=o),f>=0?(s=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(s=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||s>n)||((s>i||i!==i)&&(i=s),(l<n||n!==n)&&(n=l),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,Ju)!==null}intersectTriangle(e,t,i,n,a){IF.subVectors(t,e),lA.subVectors(i,e),NF.crossVectors(IF,lA);let o=this.direction.dot(NF),s;if(o>0){if(n)return null;s=1}else if(o<0)s=-1,o=-o;else return null;fh.subVectors(this.origin,e);let l=s*this.direction.dot(lA.crossVectors(fh,lA));if(l<0)return null;let u=s*this.direction.dot(IF.cross(fh));if(u<0||l+u>o)return null;let c=-s*fh.dot(NF);return c<0?null:this.at(c/o,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}};var Wr=class r{constructor(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m)}set(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m){let v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=n,v[1]=a,v[5]=o,v[9]=s,v[13]=l,v[2]=u,v[6]=c,v[10]=f,v[14]=h,v[3]=p,v[7]=d,v[11]=g,v[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 r().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/wg.setFromMatrixColumn(e,0).length(),a=1/wg.setFromMatrixColumn(e,1).length(),o=1/wg.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*a,t[5]=i[5]*a,t[6]=i[6]*a,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,n=e.y,a=e.z,o=Math.cos(i),s=Math.sin(i),l=Math.cos(n),u=Math.sin(n),c=Math.cos(a),f=Math.sin(a);if(e.order==="XYZ"){let h=o*c,p=o*f,d=s*c,g=s*f;t[0]=l*c,t[4]=-l*f,t[8]=u,t[1]=p+d*u,t[5]=h-g*u,t[9]=-s*l,t[2]=g-h*u,t[6]=d+p*u,t[10]=o*l}else if(e.order==="YXZ"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h+g*s,t[4]=d*s-p,t[8]=o*u,t[1]=o*f,t[5]=o*c,t[9]=-s,t[2]=p*s-d,t[6]=g+h*s,t[10]=o*l}else if(e.order==="ZXY"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h-g*s,t[4]=-o*f,t[8]=d+p*s,t[1]=p+d*s,t[5]=o*c,t[9]=g-h*s,t[2]=-o*u,t[6]=s,t[10]=o*l}else if(e.order==="ZYX"){let h=o*c,p=o*f,d=s*c,g=s*f;t[0]=l*c,t[4]=d*u-p,t[8]=h*u+g,t[1]=l*f,t[5]=g*u+h,t[9]=p*u-d,t[2]=-u,t[6]=s*l,t[10]=o*l}else if(e.order==="YZX"){let h=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=g-h*f,t[8]=d*f+p,t[1]=f,t[5]=o*c,t[9]=-s*c,t[2]=-u*c,t[6]=p*f+d,t[10]=h-g*f}else if(e.order==="XZY"){let h=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=-f,t[8]=u*c,t[1]=h*f+g,t[5]=o*c,t[9]=p*f-d,t[2]=d*f-p,t[6]=s*c,t[10]=g*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(j1e,e,K1e)}lookAt(e,t,i){let n=this.elements;return Po.subVectors(e,t),Po.lengthSq()===0&&(Po.z=1),Po.normalize(),hh.crossVectors(i,Po),hh.lengthSq()===0&&(Math.abs(i.z)===1?Po.x+=1e-4:Po.z+=1e-4,Po.normalize(),hh.crossVectors(i,Po)),hh.normalize(),cA.crossVectors(Po,hh),n[0]=hh.x,n[4]=cA.x,n[8]=Po.x,n[1]=hh.y,n[5]=cA.y,n[9]=Po.y,n[2]=hh.z,n[6]=cA.z,n[10]=Po.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,a=this.elements,o=i[0],s=i[4],l=i[8],u=i[12],c=i[1],f=i[5],h=i[9],p=i[13],d=i[2],g=i[6],m=i[10],v=i[14],_=i[3],y=i[7],x=i[11],M=i[15],S=n[0],w=n[4],T=n[8],C=n[12],b=n[1],E=n[5],I=n[9],R=n[13],A=n[2],D=n[6],U=n[10],B=n[14],F=n[3],k=n[7],G=n[11],Y=n[15];return a[0]=o*S+s*b+l*A+u*F,a[4]=o*w+s*E+l*D+u*k,a[8]=o*T+s*I+l*U+u*G,a[12]=o*C+s*R+l*B+u*Y,a[1]=c*S+f*b+h*A+p*F,a[5]=c*w+f*E+h*D+p*k,a[9]=c*T+f*I+h*U+p*G,a[13]=c*C+f*R+h*B+p*Y,a[2]=d*S+g*b+m*A+v*F,a[6]=d*w+g*E+m*D+v*k,a[10]=d*T+g*I+m*U+v*G,a[14]=d*C+g*R+m*B+v*Y,a[3]=_*S+y*b+x*A+M*F,a[7]=_*w+y*E+x*D+M*k,a[11]=_*T+y*I+x*U+M*G,a[15]=_*C+y*R+x*B+M*Y,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],a=e[12],o=e[1],s=e[5],l=e[9],u=e[13],c=e[2],f=e[6],h=e[10],p=e[14],d=e[3],g=e[7],m=e[11],v=e[15];return d*(+a*l*f-n*u*f-a*s*h+i*u*h+n*s*p-i*l*p)+g*(+t*l*p-t*u*h+a*o*h-n*o*p+n*u*c-a*l*c)+m*(+t*u*f-t*s*p-a*o*f+i*o*p+a*s*c-i*u*c)+v*(-n*s*c-t*l*f+t*s*h+n*o*f-i*o*h+i*l*c)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],g=e[13],m=e[14],v=e[15],_=f*m*u-g*h*u+g*l*p-s*m*p-f*l*v+s*h*v,y=d*h*u-c*m*u-d*l*p+o*m*p+c*l*v-o*h*v,x=c*g*u-d*f*u+d*s*p-o*g*p-c*s*v+o*f*v,M=d*f*l-c*g*l-d*s*h+o*g*h+c*s*m-o*f*m,S=t*_+i*y+n*x+a*M;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/S;return e[0]=_*w,e[1]=(g*h*a-f*m*a-g*n*p+i*m*p+f*n*v-i*h*v)*w,e[2]=(s*m*a-g*l*a+g*n*u-i*m*u-s*n*v+i*l*v)*w,e[3]=(f*l*a-s*h*a-f*n*u+i*h*u+s*n*p-i*l*p)*w,e[4]=y*w,e[5]=(c*m*a-d*h*a+d*n*p-t*m*p-c*n*v+t*h*v)*w,e[6]=(d*l*a-o*m*a-d*n*u+t*m*u+o*n*v-t*l*v)*w,e[7]=(o*h*a-c*l*a+c*n*u-t*h*u-o*n*p+t*l*p)*w,e[8]=x*w,e[9]=(d*f*a-c*g*a-d*i*p+t*g*p+c*i*v-t*f*v)*w,e[10]=(o*g*a-d*s*a+d*i*u-t*g*u-o*i*v+t*s*v)*w,e[11]=(c*s*a-o*f*a-c*i*u+t*f*u+o*i*p-t*s*p)*w,e[12]=M*w,e[13]=(c*g*n-d*f*n+d*i*h-t*g*h-c*i*m+t*f*m)*w,e[14]=(d*s*n-o*g*n-d*i*l+t*g*l+o*i*m-t*s*m)*w,e[15]=(o*f*n-c*s*n+c*i*l-t*f*l-o*i*h+t*s*h)*w,this}scale(e){let t=this.elements,i=e.x,n=e.y,a=e.z;return t[0]*=i,t[4]*=n,t[8]*=a,t[1]*=i,t[5]*=n,t[9]*=a,t[2]*=i,t[6]*=n,t[10]*=a,t[3]*=i,t[7]*=n,t[11]*=a,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),a=1-i,o=e.x,s=e.y,l=e.z,u=a*o,c=a*s;return this.set(u*o+i,u*s-n*l,u*l+n*s,0,u*s+n*l,c*s+i,c*l-n*o,0,u*l-n*s,c*l+n*o,a*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,a,o){return this.set(1,i,a,0,e,1,o,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,a=t._x,o=t._y,s=t._z,l=t._w,u=a+a,c=o+o,f=s+s,h=a*u,p=a*c,d=a*f,g=o*c,m=o*f,v=s*f,_=l*u,y=l*c,x=l*f,M=i.x,S=i.y,w=i.z;return n[0]=(1-(g+v))*M,n[1]=(p+x)*M,n[2]=(d-y)*M,n[3]=0,n[4]=(p-x)*S,n[5]=(1-(h+v))*S,n[6]=(m+_)*S,n[7]=0,n[8]=(d+y)*w,n[9]=(m-_)*w,n[10]=(1-(h+g))*w,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,a=wg.set(n[0],n[1],n[2]).length(),o=wg.set(n[4],n[5],n[6]).length(),s=wg.set(n[8],n[9],n[10]).length();this.determinant()<0&&(a=-a),e.x=n[12],e.y=n[13],e.z=n[14],ul.copy(this);let u=1/a,c=1/o,f=1/s;return ul.elements[0]*=u,ul.elements[1]*=u,ul.elements[2]*=u,ul.elements[4]*=c,ul.elements[5]*=c,ul.elements[6]*=c,ul.elements[8]*=f,ul.elements[9]*=f,ul.elements[10]*=f,t.setFromRotationMatrix(ul),i.x=a,i.y=o,i.z=s,this}makePerspective(e,t,i,n,a,o,s=ja){let l=this.elements,u=2*a/(t-e),c=2*a/(i-n),f=(t+e)/(t-e),h=(i+n)/(i-n),p,d;if(s===ja)p=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(s===vd)p=-o/(o-a),d=-o*a/(o-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return l[0]=u,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=c,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=d,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,n,a,o,s=ja){let l=this.elements,u=1/(t-e),c=1/(i-n),f=1/(o-a),h=(t+e)*u,p=(i+n)*c,d,g;if(s===ja)d=(o+a)*f,g=-2*f;else if(s===vd)d=a*f,g=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=g,l[14]=-d,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},wg=new be,ul=new Wr,j1e=new be(0,0,0),K1e=new be(1,1,1),hh=new be,cA=new be,Po=new be;var RQ=new Wr,LQ=new au,cl=(()=>{class r{constructor(t=0,i=0,n=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=i,this._z=n,this._order=a}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,i,n,a=this._order){return this._x=t,this._y=i,this._z=n,this._order=a,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,i=this._order,n=!0){let a=t.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],f=a[9],h=a[2],p=a[6],d=a[10];switch(i){case"XYZ":this._y=Math.asin(en(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-en(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(l,d),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-h,o),this._z=0);break;case"ZXY":this._x=Math.asin(en(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(u,o));break;case"ZYX":this._y=Math.asin(-en(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(en(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(l,d));break;case"XZY":this._z=Math.asin(-en(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-f,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+i)}return this._order=i,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,i,n){return RQ.makeRotationFromQuaternion(t),this.setFromRotationMatrix(RQ,i,n)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return LQ.setFromEuler(this),this.setFromQuaternion(LQ,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],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],i=0){return t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}return r.DEFAULT_ORDER="XYZ",r})();var Tg=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}};var J1e=0,PQ=new be,Eg=new au,$u=new Wr,fA=new be,dS=new be,$1e=new be,Q1e=new au,DQ=new be(1,0,0),IQ=new be(0,1,0),NQ=new be(0,0,1),eTe={type:"added"},tTe={type:"removed"},UF={type:"childadded",child:null},OF={type:"childremoved",child:null},tn=(()=>{class r extends Ka{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:J1e++}),this.uuid=iu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new be,i=new cl,n=new au,a=new be(1,1,1);function o(){n.setFromEuler(i,!1)}function s(){i.setFromQuaternion(n,void 0,!1)}i._onChange(o),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new Wr},normalMatrix:{value:new $t}}),this.matrix=new Wr,this.matrixWorld=new Wr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Tg,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}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,i){this.quaternion.setFromAxisAngle(t,i)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,i){return Eg.setFromAxisAngle(t,i),this.quaternion.multiply(Eg),this}rotateOnWorldAxis(t,i){return Eg.setFromAxisAngle(t,i),this.quaternion.premultiply(Eg),this}rotateX(t){return this.rotateOnAxis(DQ,t)}rotateY(t){return this.rotateOnAxis(IQ,t)}rotateZ(t){return this.rotateOnAxis(NQ,t)}translateOnAxis(t,i){return PQ.copy(t).applyQuaternion(this.quaternion),this.position.add(PQ.multiplyScalar(i)),this}translateX(t){return this.translateOnAxis(DQ,t)}translateY(t){return this.translateOnAxis(IQ,t)}translateZ(t){return this.translateOnAxis(NQ,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4($u.copy(this.matrixWorld).invert())}lookAt(t,i,n){t.isVector3?fA.copy(t):fA.set(t,i,n);let a=this.parent;this.updateWorldMatrix(!0,!1),dS.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$u.lookAt(dS,fA,this.up):$u.lookAt(fA,dS,this.up),this.quaternion.setFromRotationMatrix($u),a&&($u.extractRotation(a.matrixWorld),Eg.setFromRotationMatrix($u),this.quaternion.premultiply(Eg.invert()))}add(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);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?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(eTe),UF.child=t,this.dispatchEvent(UF),UF.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let i=this.children.indexOf(t);return i!==-1&&(t.parent=null,this.children.splice(i,1),t.dispatchEvent(tTe),OF.child=t,this.dispatchEvent(OF),OF.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),$u.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),$u.multiply(t.parent.matrixWorld)),t.applyMatrix4($u),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,i){if(this[t]===i)return this;for(let n=0,a=this.children.length;n<a;n++){let s=this.children[n].getObjectByProperty(t,i);if(s!==void 0)return s}}getObjectsByProperty(t,i,n=[]){this[t]===i&&n.push(this);let a=this.children;for(let o=0,s=a.length;o<s;o++)a[o].getObjectsByProperty(t,i,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dS,t,$1e),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(dS,Q1e,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let i=this.matrixWorld.elements;return t.set(i[8],i[9],i[10]).normalize()}raycast(){}traverse(t){t(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].traverseVisible(t)}traverseAncestors(t){let i=this.parent;i!==null&&(t(i),i.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let i=this.children;for(let n=0,a=i.length;n<a;n++){let o=i[n];(o.matrixWorldAutoUpdate===!0||t===!0)&&o.updateMatrixWorld(t)}}updateWorldMatrix(t,i){let n=this.parent;if(t===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),i===!0){let a=this.children;for(let o=0,s=a.length;o<s;o++){let l=a[o];l.matrixWorldAutoUpdate===!0&&l.updateWorldMatrix(!1,!0)}}}toJSON(t){let i=t===void 0||typeof t=="string",n={};i&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.visibility=this._visibility,a.active=this._active,a.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),a.maxGeometryCount=this._maxGeometryCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.geometryCount=this._geometryCount,a.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(a.boundingSphere={center:a.boundingSphere.center.toArray(),radius:a.boundingSphere.radius}),this.boundingBox!==null&&(a.boundingBox={min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}));function o(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(t)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=o(t.geometries,this.geometry);let l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){let u=l.shapes;if(Array.isArray(u))for(let c=0,f=u.length;c<f;c++){let h=u[c];o(t.shapes,h)}else o(t.shapes,u)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let l=[];for(let u=0,c=this.material.length;u<c;u++)l.push(o(t.materials,this.material[u]));a.material=l}else a.material=o(t.materials,this.material);if(this.children.length>0){a.children=[];for(let l=0;l<this.children.length;l++)a.children.push(this.children[l].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let l=0;l<this.animations.length;l++){let u=this.animations[l];a.animations.push(o(t.animations,u))}}if(i){let l=s(t.geometries),u=s(t.materials),c=s(t.textures),f=s(t.images),h=s(t.shapes),p=s(t.skeletons),d=s(t.animations),g=s(t.nodes);l.length>0&&(n.geometries=l),u.length>0&&(n.materials=u),c.length>0&&(n.textures=c),f.length>0&&(n.images=f),h.length>0&&(n.shapes=h),p.length>0&&(n.skeletons=p),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=a,n;function s(l){let u=[];for(let c in l){let f=l[c];delete f.metadata,u.push(f)}return u}}clone(t){return new this.constructor().copy(this,t)}copy(t,i=!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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),i===!0)for(let n=0;n<t.children.length;n++){let a=t.children[n];this.add(a.clone())}return this}}return r.DEFAULT_UP=new be(0,1,0),r.DEFAULT_MATRIX_AUTO_UPDATE=!0,r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,r})();var fl=new be,Qu=new be,FF=new be,ec=new be,Ag=new be,Cg=new be,UQ=new be,zF=new be,BF=new be,kF=new be,_d=class r{constructor(e=new be,t=new be,i=new be){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),fl.subVectors(e,t),n.cross(fl);let a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,i,n,a){fl.subVectors(n,t),Qu.subVectors(i,t),FF.subVectors(e,t);let o=fl.dot(fl),s=fl.dot(Qu),l=fl.dot(FF),u=Qu.dot(Qu),c=Qu.dot(FF),f=o*u-s*s;if(f===0)return a.set(0,0,0),null;let h=1/f,p=(u*l-s*c)*h,d=(o*c-s*l)*h;return a.set(1-p-d,d,p)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,ec)===null?!1:ec.x>=0&&ec.y>=0&&ec.x+ec.y<=1}static getInterpolation(e,t,i,n,a,o,s,l){return this.getBarycoord(e,t,i,n,ec)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(a,ec.x),l.addScaledVector(o,ec.y),l.addScaledVector(s,ec.z),l)}static isFrontFacing(e,t,i,n){return fl.subVectors(i,t),Qu.subVectors(e,t),fl.cross(Qu).dot(n)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return fl.subVectors(this.c,this.b),Qu.subVectors(this.a,this.b),fl.cross(Qu).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return r.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return r.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,a){return r.getInterpolation(e,this.a,this.b,this.c,t,i,n,a)}containsPoint(e){return r.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return r.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,a=this.c,o,s;Ag.subVectors(n,i),Cg.subVectors(a,i),zF.subVectors(e,i);let l=Ag.dot(zF),u=Cg.dot(zF);if(l<=0&&u<=0)return t.copy(i);BF.subVectors(e,n);let c=Ag.dot(BF),f=Cg.dot(BF);if(c>=0&&f<=c)return t.copy(n);let h=l*f-c*u;if(h<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(Ag,o);kF.subVectors(e,a);let p=Ag.dot(kF),d=Cg.dot(kF);if(d>=0&&p<=d)return t.copy(a);let g=p*u-l*d;if(g<=0&&u>=0&&d<=0)return s=u/(u-d),t.copy(i).addScaledVector(Cg,s);let m=c*d-p*f;if(m<=0&&f-c>=0&&p-d>=0)return UQ.subVectors(a,n),s=(f-c)/(f-c+(p-d)),t.copy(n).addScaledVector(UQ,s);let v=1/(m+g+h);return o=g*v,s=h*v,t.copy(i).addScaledVector(Ag,o).addScaledVector(Cg,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};var OQ={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},ph={h:0,s:0,l:0},hA={h:0,s:0,l:0};function VF(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}var ir=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let n=e;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=qa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Er.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=Er.workingColorSpace){return this.r=e,this.g=t,this.b=i,Er.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=Er.workingColorSpace){if(e=MQ(e,1),t=en(t,0,1),i=en(i,0,1),t===0)this.r=this.g=this.b=i;else{let a=i<=.5?i*(1+t):i+t-i*t,o=2*i-a;this.r=VF(o,a,e+1/3),this.g=VF(o,a,e),this.b=VF(o,a,e-1/3)}return Er.toWorkingColorSpace(this,n),this}setStyle(e,t=qa){function i(a){a!==void 0&&parseFloat(a)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let a,o=n[1],s=n[2];switch(o){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let a=n[1],o=a.length;if(o===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(a,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=qa){let i=OQ[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=sh(e.r),this.g=sh(e.g),this.b=sh(e.b),this}copyLinearToSRGB(e){return this.r=tA(e.r),this.g=tA(e.g),this.b=tA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=qa){return Er.fromWorkingColorSpace(qn.copy(this),e),Math.round(en(qn.r*255,0,255))*65536+Math.round(en(qn.g*255,0,255))*256+Math.round(en(qn.b*255,0,255))}getHexString(e=qa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Er.workingColorSpace){Er.fromWorkingColorSpace(qn.copy(this),t);let i=qn.r,n=qn.g,a=qn.b,o=Math.max(i,n,a),s=Math.min(i,n,a),l,u,c=(s+o)/2;if(s===o)l=0,u=0;else{let f=o-s;switch(u=c<=.5?f/(o+s):f/(2-o-s),o){case i:l=(n-a)/f+(n<a?6:0);break;case n:l=(a-i)/f+2;break;case a:l=(i-n)/f+4;break}l/=6}return e.h=l,e.s=u,e.l=c,e}getRGB(e,t=Er.workingColorSpace){return Er.fromWorkingColorSpace(qn.copy(this),t),e.r=qn.r,e.g=qn.g,e.b=qn.b,e}getStyle(e=qa){Er.fromWorkingColorSpace(qn.copy(this),e);let t=qn.r,i=qn.g,n=qn.b;return e!==qa?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(n*255)})`}offsetHSL(e,t,i){return this.getHSL(ph),this.setHSL(ph.h+e,ph.s+t,ph.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ph),e.getHSL(hA);let i=$E(ph.h,hA.h,t),n=$E(ph.s,hA.s,t),a=$E(ph.l,hA.l,t);return this.setHSL(i,n,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,n=this.b,a=e.elements;return this.r=a[0]*t+a[3]*i+a[6]*n,this.g=a[1]*t+a[4]*i+a[7]*n,this.b=a[2]*t+a[5]*i+a[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},qn=new ir;ir.NAMES=OQ;var rTe=0,ou=class extends Ka{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rTe++}),this.uuid=iu(),this.name="",this.type="Material",this.blending=Yu,this.side=Ao,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=iS,this.blendDst=nS,this.blendEquation=qu,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ir(0,0,0),this.blendAlpha=0,this.depthFunc=lg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bF,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=md,this.stencilZFail=md,this.stencilZPass=md,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(n===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Yu&&(i.blending=this.blending),this.side!==Ao&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==iS&&(i.blendSrc=this.blendSrc),this.blendDst!==nS&&(i.blendDst=this.blendDst),this.blendEquation!==qu&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==lg&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==bF&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==md&&(i.stencilFail=this.stencilFail),this.stencilZFail!==md&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==md&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function n(a){let o=[];for(let s in a){let l=a[s];delete l.metadata,o.push(l)}return o}if(t){let a=n(e.textures),o=n(e.images);a.length>0&&(i.textures=a),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let n=t.length;i=new Array(n);for(let a=0;a!==n;++a)i[a]=t[a].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};var tc=class extends ou{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ir(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cl,this.combine=OE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};var Vi=new be,pA=new Kt,ga=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=wF,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ya,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return TQ("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,a=this.itemSize;n<a;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)pA.fromBufferAttribute(this,t),pA.applyMatrix3(e),this.setXY(t,pA.x,pA.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Vi.fromBufferAttribute(this,t),Vi.applyMatrix3(e),this.setXYZ(t,Vi.x,Vi.y,Vi.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Vi.fromBufferAttribute(this,t),Vi.applyMatrix4(e),this.setXYZ(t,Vi.x,Vi.y,Vi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Vi.fromBufferAttribute(this,t),Vi.applyNormalMatrix(e),this.setXYZ(t,Vi.x,Vi.y,Vi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Vi.fromBufferAttribute(this,t),Vi.transformDirection(e),this.setXYZ(t,Vi.x,Vi.y,Vi.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=mg(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=va(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=mg(t,this.array)),t}setX(e,t){return this.normalized&&(t=va(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=mg(t,this.array)),t}setY(e,t){return this.normalized&&(t=va(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=mg(t,this.array)),t}setZ(e,t){return this.normalized&&(t=va(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=mg(t,this.array)),t}setW(e,t){return this.normalized&&(t=va(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=va(t,this.array),i=va(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=va(t,this.array),i=va(i,this.array),n=va(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,a){return e*=this.itemSize,this.normalized&&(t=va(t,this.array),i=va(i,this.array),n=va(n,this.array),a=va(a,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==wF&&(e.usage=this.usage),e}};var Rg=class extends ga{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var Lg=class extends ga{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var Zn=class extends ga{constructor(e,t,i){super(new Float32Array(e),t,i)}};var iTe=0,_s=new Wr,GF=new tn,Pg=new be,Do=new Ku,mS=new Ku,dn=new be,Qa=class r extends Ka{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:iTe++}),this.uuid=iu(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(QE(e)?Lg:Rg)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let a=new $t().getNormalMatrix(e);i.applyNormalMatrix(a),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return _s.makeRotationFromQuaternion(e),this.applyMatrix4(_s),this}rotateX(e){return _s.makeRotationX(e),this.applyMatrix4(_s),this}rotateY(e){return _s.makeRotationY(e),this.applyMatrix4(_s),this}rotateZ(e){return _s.makeRotationZ(e),this.applyMatrix4(_s),this}translate(e,t,i){return _s.makeTranslation(e,t,i),this.applyMatrix4(_s),this}scale(e,t,i){return _s.makeScale(e,t,i),this.applyMatrix4(_s),this}lookAt(e){return GF.lookAt(e),GF.updateMatrix(),this.applyMatrix4(GF.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Pg).negate(),this.translate(Pg.x,Pg.y,Pg.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let a=e[i];t.push(a.x,a.y,a.z||0)}return this.setAttribute("position",new Zn(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ku);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new be(-1/0,-1/0,-1/0),new be(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,n=t.length;i<n;i++){let a=t[i];Do.setFromBufferAttribute(a),this.morphTargetsRelative?(dn.addVectors(this.boundingBox.min,Do.min),this.boundingBox.expandByPoint(dn),dn.addVectors(this.boundingBox.max,Do.max),this.boundingBox.expandByPoint(dn)):(this.boundingBox.expandByPoint(Do.min),this.boundingBox.expandByPoint(Do.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ch);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new be,1/0);return}if(e){let i=this.boundingSphere.center;if(Do.setFromBufferAttribute(e),t)for(let a=0,o=t.length;a<o;a++){let s=t[a];mS.setFromBufferAttribute(s),this.morphTargetsRelative?(dn.addVectors(Do.min,mS.min),Do.expandByPoint(dn),dn.addVectors(Do.max,mS.max),Do.expandByPoint(dn)):(Do.expandByPoint(mS.min),Do.expandByPoint(mS.max))}Do.getCenter(i);let n=0;for(let a=0,o=e.count;a<o;a++)dn.fromBufferAttribute(e,a),n=Math.max(n,i.distanceToSquared(dn));if(t)for(let a=0,o=t.length;a<o;a++){let s=t[a],l=this.morphTargetsRelative;for(let u=0,c=s.count;u<c;u++)dn.fromBufferAttribute(s,u),l&&(Pg.fromBufferAttribute(e,u),dn.add(Pg)),n=Math.max(n,i.distanceToSquared(dn))}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)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,n=t.normal,a=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ga(new Float32Array(4*i.count),4));let o=this.getAttribute("tangent"),s=[],l=[];for(let T=0;T<i.count;T++)s[T]=new be,l[T]=new be;let u=new be,c=new be,f=new be,h=new Kt,p=new Kt,d=new Kt,g=new be,m=new be;function v(T,C,b){u.fromBufferAttribute(i,T),c.fromBufferAttribute(i,C),f.fromBufferAttribute(i,b),h.fromBufferAttribute(a,T),p.fromBufferAttribute(a,C),d.fromBufferAttribute(a,b),c.sub(u),f.sub(u),p.sub(h),d.sub(h);let E=1/(p.x*d.y-d.x*p.y);isFinite(E)&&(g.copy(c).multiplyScalar(d.y).addScaledVector(f,-p.y).multiplyScalar(E),m.copy(f).multiplyScalar(p.x).addScaledVector(c,-d.x).multiplyScalar(E),s[T].add(g),s[C].add(g),s[b].add(g),l[T].add(m),l[C].add(m),l[b].add(m))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let T=0,C=_.length;T<C;++T){let b=_[T],E=b.start,I=b.count;for(let R=E,A=E+I;R<A;R+=3)v(e.getX(R+0),e.getX(R+1),e.getX(R+2))}let y=new be,x=new be,M=new be,S=new be;function w(T){M.fromBufferAttribute(n,T),S.copy(M);let C=s[T];y.copy(C),y.sub(M.multiplyScalar(M.dot(C))).normalize(),x.crossVectors(S,C);let E=x.dot(l[T])<0?-1:1;o.setXYZW(T,y.x,y.y,y.z,E)}for(let T=0,C=_.length;T<C;++T){let b=_[T],E=b.start,I=b.count;for(let R=E,A=E+I;R<A;R+=3)w(e.getX(R+0)),w(e.getX(R+1)),w(e.getX(R+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new ga(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);let n=new be,a=new be,o=new be,s=new be,l=new be,u=new be,c=new be,f=new be;if(e)for(let h=0,p=e.count;h<p;h+=3){let d=e.getX(h+0),g=e.getX(h+1),m=e.getX(h+2);n.fromBufferAttribute(t,d),a.fromBufferAttribute(t,g),o.fromBufferAttribute(t,m),c.subVectors(o,a),f.subVectors(n,a),c.cross(f),s.fromBufferAttribute(i,d),l.fromBufferAttribute(i,g),u.fromBufferAttribute(i,m),s.add(c),l.add(c),u.add(c),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(g,l.x,l.y,l.z),i.setXYZ(m,u.x,u.y,u.z)}else for(let h=0,p=t.count;h<p;h+=3)n.fromBufferAttribute(t,h+0),a.fromBufferAttribute(t,h+1),o.fromBufferAttribute(t,h+2),c.subVectors(o,a),f.subVectors(n,a),c.cross(f),i.setXYZ(h+0,c.x,c.y,c.z),i.setXYZ(h+1,c.x,c.y,c.z),i.setXYZ(h+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)dn.fromBufferAttribute(e,t),dn.normalize(),e.setXYZ(t,dn.x,dn.y,dn.z)}toNonIndexed(){function e(s,l){let u=s.array,c=s.itemSize,f=s.normalized,h=new u.constructor(l.length*c),p=0,d=0;for(let g=0,m=l.length;g<m;g++){s.isInterleavedBufferAttribute?p=l[g]*s.data.stride+s.offset:p=l[g]*c;for(let v=0;v<c;v++)h[d++]=u[p++]}return new ga(h,c,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new r,i=this.index.array,n=this.attributes;for(let s in n){let l=n[s],u=e(l,i);t.setAttribute(s,u)}let a=this.morphAttributes;for(let s in a){let l=[],u=a[s];for(let c=0,f=u.length;c<f;c++){let h=u[c],p=e(h,i);l.push(p)}t.morphAttributes[s]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let s=0,l=o.length;s<l;s++){let u=o[s];t.addGroup(u.start,u.count,u.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let l in i){let u=i[l];e.data.attributes[l]=u.toJSON(e.data)}let n={},a=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let f=0,h=u.length;f<h;f++){let p=u[f];c.push(p.toJSON(e.data))}c.length>0&&(n[l]=c,a=!0)}a&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let s=this.boundingSphere;return s!==null&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let n=e.attributes;for(let u in n){let c=n[u];this.setAttribute(u,c.clone(t))}let a=e.morphAttributes;for(let u in a){let c=[],f=a[u];for(let h=0,p=f.length;h<p;h++)c.push(f[h].clone(t));this.morphAttributes[u]=c}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let u=0,c=o.length;u<c;u++){let f=o[u];this.addGroup(f.start,f.count,f.materialIndex)}let s=e.boundingBox;s!==null&&(this.boundingBox=s.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var FQ=new Wr,xd=new uA,dA=new ch,zQ=new be,Dg=new be,Ig=new be,Ng=new be,HF=new be,mA=new be,vA=new Kt,gA=new Kt,yA=new Kt,BQ=new be,kQ=new be,VQ=new be,_A=new be,xA=new be,rn=class extends tn{constructor(e=new Qa,t=new tc){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=n.length;a<o;a++){let s=n[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=a}}}}getVertexPosition(e,t){let i=this.geometry,n=i.attributes.position,a=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(a&&s){mA.set(0,0,0);for(let l=0,u=a.length;l<u;l++){let c=s[l],f=a[l];c!==0&&(HF.fromBufferAttribute(f,e),o?mA.addScaledVector(HF,c):mA.addScaledVector(HF.sub(t),c))}t.add(mA)}return t}raycast(e,t){let i=this.geometry,n=this.material,a=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),dA.copy(i.boundingSphere),dA.applyMatrix4(a),xd.copy(e.ray).recast(e.near),!(dA.containsPoint(xd.origin)===!1&&(xd.intersectSphere(dA,zQ)===null||xd.origin.distanceToSquared(zQ)>(e.far-e.near)**2))&&(FQ.copy(a).invert(),xd.copy(e.ray).applyMatrix4(FQ),!(i.boundingBox!==null&&xd.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,xd)))}_computeIntersections(e,t,i){let n,a=this.geometry,o=this.material,s=a.index,l=a.attributes.position,u=a.attributes.uv,c=a.attributes.uv1,f=a.attributes.normal,h=a.groups,p=a.drawRange;if(s!==null)if(Array.isArray(o))for(let d=0,g=h.length;d<g;d++){let m=h[d],v=o[m.materialIndex],_=Math.max(m.start,p.start),y=Math.min(s.count,Math.min(m.start+m.count,p.start+p.count));for(let x=_,M=y;x<M;x+=3){let S=s.getX(x),w=s.getX(x+1),T=s.getX(x+2);n=SA(this,v,e,i,u,c,f,S,w,T),n&&(n.faceIndex=Math.floor(x/3),n.face.materialIndex=m.materialIndex,t.push(n))}}else{let d=Math.max(0,p.start),g=Math.min(s.count,p.start+p.count);for(let m=d,v=g;m<v;m+=3){let _=s.getX(m),y=s.getX(m+1),x=s.getX(m+2);n=SA(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}else if(l!==void 0)if(Array.isArray(o))for(let d=0,g=h.length;d<g;d++){let m=h[d],v=o[m.materialIndex],_=Math.max(m.start,p.start),y=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let x=_,M=y;x<M;x+=3){let S=x,w=x+1,T=x+2;n=SA(this,v,e,i,u,c,f,S,w,T),n&&(n.faceIndex=Math.floor(x/3),n.face.materialIndex=m.materialIndex,t.push(n))}}else{let d=Math.max(0,p.start),g=Math.min(l.count,p.start+p.count);for(let m=d,v=g;m<v;m+=3){let _=m,y=m+1,x=m+2;n=SA(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}}};function nTe(r,e,t,i,n,a,o,s){let l;if(e.side===_i?l=i.intersectTriangle(o,a,n,!0,s):l=i.intersectTriangle(n,a,o,e.side===Ao,s),l===null)return null;xA.copy(s),xA.applyMatrix4(r.matrixWorld);let u=t.ray.origin.distanceTo(xA);return u<t.near||u>t.far?null:{distance:u,point:xA.clone(),object:r}}function SA(r,e,t,i,n,a,o,s,l,u){r.getVertexPosition(s,Dg),r.getVertexPosition(l,Ig),r.getVertexPosition(u,Ng);let c=nTe(r,e,t,i,Dg,Ig,Ng,_A);if(c){n&&(vA.fromBufferAttribute(n,s),gA.fromBufferAttribute(n,l),yA.fromBufferAttribute(n,u),c.uv=_d.getInterpolation(_A,Dg,Ig,Ng,vA,gA,yA,new Kt)),a&&(vA.fromBufferAttribute(a,s),gA.fromBufferAttribute(a,l),yA.fromBufferAttribute(a,u),c.uv1=_d.getInterpolation(_A,Dg,Ig,Ng,vA,gA,yA,new Kt)),o&&(BQ.fromBufferAttribute(o,s),kQ.fromBufferAttribute(o,l),VQ.fromBufferAttribute(o,u),c.normal=_d.getInterpolation(_A,Dg,Ig,Ng,BQ,kQ,VQ,new be),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let f={a:s,b:l,c:u,normal:new be,materialIndex:0};_d.getNormal(Dg,Ig,Ng,f.normal),c.face=f}return c}var dh=class r extends Qa{constructor(e=1,t=1,i=1,n=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:a,depthSegments:o};let s=this;n=Math.floor(n),a=Math.floor(a),o=Math.floor(o);let l=[],u=[],c=[],f=[],h=0,p=0;d("z","y","x",-1,-1,i,t,e,o,a,0),d("z","y","x",1,-1,i,t,-e,o,a,1),d("x","z","y",1,1,e,i,t,n,o,2),d("x","z","y",1,-1,e,i,-t,n,o,3),d("x","y","z",1,-1,e,t,i,n,a,4),d("x","y","z",-1,-1,e,t,-i,n,a,5),this.setIndex(l),this.setAttribute("position",new Zn(u,3)),this.setAttribute("normal",new Zn(c,3)),this.setAttribute("uv",new Zn(f,2));function d(g,m,v,_,y,x,M,S,w,T,C){let b=x/w,E=M/T,I=x/2,R=M/2,A=S/2,D=w+1,U=T+1,B=0,F=0,k=new be;for(let G=0;G<U;G++){let Y=G*E-R;for(let J=0;J<D;J++){let Q=J*b-I;k[g]=Q*_,k[m]=Y*y,k[v]=A,u.push(k.x,k.y,k.z),k[g]=0,k[m]=0,k[v]=S>0?1:-1,c.push(k.x,k.y,k.z),f.push(J/w),f.push(1-G/T),B+=1}}for(let G=0;G<T;G++)for(let Y=0;Y<w;Y++){let J=h+Y+D*G,Q=h+Y+D*(G+1),V=h+(Y+1)+D*(G+1),K=h+(Y+1)+D*G;l.push(J,Q,K),l.push(Q,V,K),F+=6}s.addGroup(p,F,C),p+=F,h+=B}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function rc(r){let e={};for(let t in r){e[t]={};for(let i in r[t]){let n=r[t][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=n.clone():Array.isArray(n)?e[t][i]=n.slice():e[t][i]=n}}return e}function jn(r){let e={};for(let t=0;t<r.length;t++){let i=rc(r[t]);for(let n in i)e[n]=i[n]}return e}function GQ(r){let e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function MA(r){return r.getRenderTarget()===null?r.outputColorSpace:Er.workingColorSpace}var HQ={clone:rc,merge:jn};var WQ=`
  2231. void main() {
  2232. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  2233. }
  2234. `;var XQ=`
  2235. void main() {
  2236. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  2237. }
  2238. `;var ya=class extends ou{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=WQ,this.fragmentShader=XQ,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=rc(e.uniforms),this.uniformsGroups=GQ(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let o=this.uniforms[n].value;o&&o.isTexture?t.uniforms[n]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[n]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[n]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[n]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[n]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[n]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[n]={type:"m4",value:o.toArray()}:t.uniforms[n]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let n in this.extensions)this.extensions[n]===!0&&(i[n]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}};var Ug=class extends tn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Wr,this.projectionMatrix=new Wr,this.projectionMatrixInverse=new Wr,this.coordinateSystem=ja}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};var mh=new be,YQ=new Kt,qQ=new Kt,Gi=class extends Ug{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=cS*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(JE*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return cS*2*Math.atan(Math.tan(JE*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){mh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(mh.x,mh.y).multiplyScalar(-e/mh.z),mh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(mh.x,mh.y).multiplyScalar(-e/mh.z)}getViewSize(e,t){return this.getViewBounds(e,YQ,qQ),t.subVectors(qQ,YQ)}setViewOffset(e,t,i,n,a,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(JE*.5*this.fov)/this.zoom,i=2*t,n=this.aspect*i,a=-.5*n,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,u=o.fullHeight;a+=o.offsetX*n/l,t-=o.offsetY*i/u,n*=o.width/l,i*=o.height/u}let s=this.filmOffset;s!==0&&(a+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};var Og=-90,Fg=1,bA=class extends tn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new Gi(Og,Fg,e,t);n.layers=this.layers,this.add(n);let a=new Gi(Og,Fg,e,t);a.layers=this.layers,this.add(a);let o=new Gi(Og,Fg,e,t);o.layers=this.layers,this.add(o);let s=new Gi(Og,Fg,e,t);s.layers=this.layers,this.add(s);let l=new Gi(Og,Fg,e,t);l.layers=this.layers,this.add(l);let u=new Gi(Og,Fg,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,a,o,s,l]=t;for(let u of t)this.remove(u);if(e===ja)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===vd)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[a,o,s,l,u,c]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;let g=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,n),e.render(t,a),e.setRenderTarget(i,1,n),e.render(t,o),e.setRenderTarget(i,2,n),e.render(t,s),e.setRenderTarget(i,3,n),e.render(t,l),e.setRenderTarget(i,4,n),e.render(t,u),i.texture.generateMipmaps=g,e.setRenderTarget(i,5,n),e.render(t,c),e.setRenderTarget(f,h,p),e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}};var zg=class extends Ja{constructor(e,t,i,n,a,o,s,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:al,super(e,t,i,n,a,o,s,l,u,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var wA=class extends $a{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},n=[i,i,i,i,i,i];this.texture=new zg(n,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Qi}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
  2239. varying vec3 vWorldDirection;
  2240. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  2241. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  2242. }
  2243. void main() {
  2244. vWorldDirection = transformDirection( position, modelMatrix );
  2245. #include <begin_vertex>
  2246. #include <project_vertex>
  2247. }
  2248. `,fragmentShader:`
  2249. uniform sampler2D tEquirect;
  2250. varying vec3 vWorldDirection;
  2251. #include <common>
  2252. void main() {
  2253. vec3 direction = normalize( vWorldDirection );
  2254. vec2 sampleUV = equirectUv( direction );
  2255. gl_FragColor = texture2D( tEquirect, sampleUV );
  2256. }
  2257. `},n=new dh(5,5,5),a=new ya({name:"CubemapFromEquirect",uniforms:rc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:_i,blending:ms});a.uniforms.tEquirect.value=t;let o=new rn(n,a),s=t.minFilter;return t.minFilter===ol&&(t.minFilter=Qi),new bA(1,10,this).update(e,o),t.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,n){let a=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,n);e.setRenderTarget(a)}};var WF=new be,aTe=new be,oTe=new $t,hl=class{constructor(e=new be(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=WF.subVectors(i,t).cross(aTe.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(WF),n=this.normal.dot(i);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/n;return a<0||a>1?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||oTe.getNormalMatrix(e),n=this.coplanarPoint(WF).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};var Sd=new ch,TA=new be,vh=class{constructor(e=new hl,t=new hl,i=new hl,n=new hl,a=new hl,o=new hl){this.planes=[e,t,i,n,a,o]}set(e,t,i,n,a,o){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(a),s[5].copy(o),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=ja){let i=this.planes,n=e.elements,a=n[0],o=n[1],s=n[2],l=n[3],u=n[4],c=n[5],f=n[6],h=n[7],p=n[8],d=n[9],g=n[10],m=n[11],v=n[12],_=n[13],y=n[14],x=n[15];if(i[0].setComponents(l-a,h-u,m-p,x-v).normalize(),i[1].setComponents(l+a,h+u,m+p,x+v).normalize(),i[2].setComponents(l+o,h+c,m+d,x+_).normalize(),i[3].setComponents(l-o,h-c,m-d,x-_).normalize(),i[4].setComponents(l-s,h-f,m-g,x-y).normalize(),t===ja)i[5].setComponents(l+s,h+f,m+g,x+y).normalize();else if(t===vd)i[5].setComponents(s,f,g,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Sd.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Sd.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Sd)}intersectsSprite(e){return Sd.center.set(0,0,0),Sd.radius=.7071067811865476,Sd.applyMatrix4(e.matrixWorld),this.intersectsSphere(Sd)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(TA.x=n.normal.x>0?e.max.x:e.min.x,TA.y=n.normal.y>0?e.max.y:e.min.y,TA.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(TA)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function EA(){let r=null,e=!1,t=null,i=null;function n(a,o){t(a,o),i=r.requestAnimationFrame(n)}return{start:function(){e!==!0&&t!==null&&(i=r.requestAnimationFrame(n),e=!0)},stop:function(){r.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(a){t=a},setContext:function(a){r=a}}}function ZQ(r,e){let t=e.isWebGL2,i=new WeakMap;function n(u,c){let f=u.array,h=u.usage,p=f.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,f,h),u.onUploadCallback();let g;if(f instanceof Float32Array)g=r.FLOAT;else if(f instanceof Uint16Array)if(u.isFloat16BufferAttribute)if(t)g=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)g=r.SHORT;else if(f instanceof Uint32Array)g=r.UNSIGNED_INT;else if(f instanceof Int32Array)g=r.INT;else if(f instanceof Int8Array)g=r.BYTE;else if(f instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:d,type:g,bytesPerElement:f.BYTES_PER_ELEMENT,version:u.version,size:p}}function a(u,c,f){let h=c.array,p=c._updateRange,d=c.updateRanges;if(r.bindBuffer(f,u),p.count===-1&&d.length===0&&r.bufferSubData(f,0,h),d.length!==0){for(let g=0,m=d.length;g<m;g++){let v=d[g];t?r.bufferSubData(f,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count):r.bufferSubData(f,v.start*h.BYTES_PER_ELEMENT,h.subarray(v.start,v.start+v.count))}c.clearUpdateRanges()}p.count!==-1&&(t?r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count):r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h.subarray(p.offset,p.offset+p.count)),p.count=-1),c.onUploadCallback()}function o(u){return u.isInterleavedBufferAttribute&&(u=u.data),i.get(u)}function s(u){u.isInterleavedBufferAttribute&&(u=u.data);let c=i.get(u);c&&(r.deleteBuffer(c.buffer),i.delete(u))}function l(u,c){if(u.isGLBufferAttribute){let h=i.get(u);(!h||h.version<u.version)&&i.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}u.isInterleavedBufferAttribute&&(u=u.data);let f=i.get(u);if(f===void 0)i.set(u,n(u,c));else if(f.version<u.version){if(f.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");a(f.buffer,u,c),f.version=u.version}}return{get:o,remove:s,update:l}}var Bg=class r extends Qa{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};let a=e/2,o=t/2,s=Math.floor(i),l=Math.floor(n),u=s+1,c=l+1,f=e/s,h=t/l,p=[],d=[],g=[],m=[];for(let v=0;v<c;v++){let _=v*h-o;for(let y=0;y<u;y++){let x=y*f-a;d.push(x,-_,0),g.push(0,0,1),m.push(y/s),m.push(1-v/l)}}for(let v=0;v<l;v++)for(let _=0;_<s;_++){let y=_+u*v,x=_+u*(v+1),M=_+1+u*(v+1),S=_+1+u*v;p.push(y,x,S),p.push(x,M,S)}this.setIndex(p),this.setAttribute("position",new Zn(d,3)),this.setAttribute("normal",new Zn(g,3)),this.setAttribute("uv",new Zn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.width,e.height,e.widthSegments,e.heightSegments)}};var jQ=`
  2258. #ifdef USE_ALPHAHASH
  2259. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  2260. #endif
  2261. `;var KQ=`
  2262. #ifdef USE_ALPHAHASH
  2263. /**
  2264. * See: https://casual-effects.com/research/Wyman2017Hashed/index.html
  2265. */
  2266. const float ALPHA_HASH_SCALE = 0.05; // Derived from trials only, and may be changed.
  2267. float hash2D( vec2 value ) {
  2268. return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
  2269. }
  2270. float hash3D( vec3 value ) {
  2271. return hash2D( vec2( hash2D( value.xy ), value.z ) );
  2272. }
  2273. float getAlphaHashThreshold( vec3 position ) {
  2274. // Find the discretized derivatives of our coordinates
  2275. float maxDeriv = max(
  2276. length( dFdx( position.xyz ) ),
  2277. length( dFdy( position.xyz ) )
  2278. );
  2279. float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
  2280. // Find two nearest log-discretized noise scales
  2281. vec2 pixScales = vec2(
  2282. exp2( floor( log2( pixScale ) ) ),
  2283. exp2( ceil( log2( pixScale ) ) )
  2284. );
  2285. // Compute alpha thresholds at our two noise scales
  2286. vec2 alpha = vec2(
  2287. hash3D( floor( pixScales.x * position.xyz ) ),
  2288. hash3D( floor( pixScales.y * position.xyz ) )
  2289. );
  2290. // Factor to interpolate lerp with
  2291. float lerpFactor = fract( log2( pixScale ) );
  2292. // Interpolate alpha threshold from noise at two scales
  2293. float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
  2294. // Pass into CDF to compute uniformly distrib threshold
  2295. float a = min( lerpFactor, 1.0 - lerpFactor );
  2296. vec3 cases = vec3(
  2297. x * x / ( 2.0 * a * ( 1.0 - a ) ),
  2298. ( x - 0.5 * a ) / ( 1.0 - a ),
  2299. 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
  2300. );
  2301. // Find our final, uniformly distributed alpha threshold (\u03B1\u03C4)
  2302. float threshold = ( x < ( 1.0 - a ) )
  2303. ? ( ( x < a ) ? cases.x : cases.y )
  2304. : cases.z;
  2305. // Avoids \u03B1\u03C4 == 0. Could also do \u03B1\u03C4 =1-\u03B1\u03C4
  2306. return clamp( threshold , 1.0e-6, 1.0 );
  2307. }
  2308. #endif
  2309. `;var JQ=`
  2310. #ifdef USE_ALPHAMAP
  2311. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  2312. #endif
  2313. `;var $Q=`
  2314. #ifdef USE_ALPHAMAP
  2315. uniform sampler2D alphaMap;
  2316. #endif
  2317. `;var QQ=`
  2318. #ifdef USE_ALPHATEST
  2319. #ifdef ALPHA_TO_COVERAGE
  2320. diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
  2321. if ( diffuseColor.a == 0.0 ) discard;
  2322. #else
  2323. if ( diffuseColor.a < alphaTest ) discard;
  2324. #endif
  2325. #endif
  2326. `;var eee=`
  2327. #ifdef USE_ALPHATEST
  2328. uniform float alphaTest;
  2329. #endif
  2330. `;var tee=`
  2331. #ifdef USE_AOMAP
  2332. // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
  2333. float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
  2334. reflectedLight.indirectDiffuse *= ambientOcclusion;
  2335. #if defined( USE_CLEARCOAT )
  2336. clearcoatSpecularIndirect *= ambientOcclusion;
  2337. #endif
  2338. #if defined( USE_SHEEN )
  2339. sheenSpecularIndirect *= ambientOcclusion;
  2340. #endif
  2341. #if defined( USE_ENVMAP ) && defined( STANDARD )
  2342. float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
  2343. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  2344. #endif
  2345. #endif
  2346. `;var ree=`
  2347. #ifdef USE_AOMAP
  2348. uniform sampler2D aoMap;
  2349. uniform float aoMapIntensity;
  2350. #endif
  2351. `;var iee=`
  2352. #ifdef USE_BATCHING
  2353. attribute float batchId;
  2354. uniform highp sampler2D batchingTexture;
  2355. mat4 getBatchingMatrix( const in float i ) {
  2356. int size = textureSize( batchingTexture, 0 ).x;
  2357. int j = int( i ) * 4;
  2358. int x = j % size;
  2359. int y = j / size;
  2360. vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
  2361. vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
  2362. vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
  2363. vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
  2364. return mat4( v1, v2, v3, v4 );
  2365. }
  2366. #endif
  2367. `;var nee=`
  2368. #ifdef USE_BATCHING
  2369. mat4 batchingMatrix = getBatchingMatrix( batchId );
  2370. #endif
  2371. `;var aee=`
  2372. vec3 transformed = vec3( position );
  2373. #ifdef USE_ALPHAHASH
  2374. vPosition = vec3( position );
  2375. #endif
  2376. `;var oee=`
  2377. vec3 objectNormal = vec3( normal );
  2378. #ifdef USE_TANGENT
  2379. vec3 objectTangent = vec3( tangent.xyz );
  2380. #endif
  2381. `;var see=`
  2382. float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {
  2383. // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)
  2384. return 0.25;
  2385. }
  2386. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  2387. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  2388. }
  2389. vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
  2390. vec3 halfDir = normalize( lightDir + viewDir );
  2391. float dotNH = saturate( dot( normal, halfDir ) );
  2392. float dotVH = saturate( dot( viewDir, halfDir ) );
  2393. vec3 F = F_Schlick( specularColor, 1.0, dotVH );
  2394. float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );
  2395. float D = D_BlinnPhong( shininess, dotNH );
  2396. return F * ( G * D );
  2397. } // validated
  2398. `;var lee=`
  2399. #ifdef USE_IRIDESCENCE
  2400. // XYZ to linear-sRGB color space
  2401. const mat3 XYZ_TO_REC709 = mat3(
  2402. 3.2404542, -0.9692660, 0.0556434,
  2403. -1.5371385, 1.8760108, -0.2040259,
  2404. -0.4985314, 0.0415560, 1.0572252
  2405. );
  2406. // Assume air interface for top
  2407. // Note: We don't handle the case fresnel0 == 1
  2408. vec3 Fresnel0ToIor( vec3 fresnel0 ) {
  2409. vec3 sqrtF0 = sqrt( fresnel0 );
  2410. return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
  2411. }
  2412. // Conversion FO/IOR
  2413. vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
  2414. return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
  2415. }
  2416. // ior is a value between 1.0 and 3.0. 1.0 is air interface
  2417. float IorToFresnel0( float transmittedIor, float incidentIor ) {
  2418. return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
  2419. }
  2420. // Fresnel equations for dielectric/dielectric interfaces.
  2421. // Ref: https://belcour.github.io/blog/research/2017/05/01/brdf-thin-film.html
  2422. // Evaluation XYZ sensitivity curves in Fourier space
  2423. vec3 evalSensitivity( float OPD, vec3 shift ) {
  2424. float phase = 2.0 * PI * OPD * 1.0e-9;
  2425. vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
  2426. vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
  2427. vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
  2428. vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
  2429. xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
  2430. xyz /= 1.0685e-7;
  2431. vec3 rgb = XYZ_TO_REC709 * xyz;
  2432. return rgb;
  2433. }
  2434. vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
  2435. vec3 I;
  2436. // Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0
  2437. float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
  2438. // Evaluate the cosTheta on the base layer (Snell law)
  2439. float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
  2440. // Handle TIR:
  2441. float cosTheta2Sq = 1.0 - sinTheta2Sq;
  2442. if ( cosTheta2Sq < 0.0 ) {
  2443. return vec3( 1.0 );
  2444. }
  2445. float cosTheta2 = sqrt( cosTheta2Sq );
  2446. // First interface
  2447. float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
  2448. float R12 = F_Schlick( R0, 1.0, cosTheta1 );
  2449. float T121 = 1.0 - R12;
  2450. float phi12 = 0.0;
  2451. if ( iridescenceIOR < outsideIOR ) phi12 = PI;
  2452. float phi21 = PI - phi12;
  2453. // Second interface
  2454. vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0
  2455. vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
  2456. vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
  2457. vec3 phi23 = vec3( 0.0 );
  2458. if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
  2459. if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
  2460. if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
  2461. // Phase shift
  2462. float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
  2463. vec3 phi = vec3( phi21 ) + phi23;
  2464. // Compound terms
  2465. vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
  2466. vec3 r123 = sqrt( R123 );
  2467. vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
  2468. // Reflectance term for m = 0 (DC term amplitude)
  2469. vec3 C0 = R12 + Rs;
  2470. I = C0;
  2471. // Reflectance term for m > 0 (pairs of diracs)
  2472. vec3 Cm = Rs - T121;
  2473. for ( int m = 1; m <= 2; ++ m ) {
  2474. Cm *= r123;
  2475. vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
  2476. I += Cm * Sm;
  2477. }
  2478. // Since out of gamut colors might be produced, negative color values are clamped to 0.
  2479. return max( I, vec3( 0.0 ) );
  2480. }
  2481. #endif
  2482. `;var uee=`
  2483. #ifdef USE_BUMPMAP
  2484. uniform sampler2D bumpMap;
  2485. uniform float bumpScale;
  2486. // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen
  2487. // https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf
  2488. // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
  2489. vec2 dHdxy_fwd() {
  2490. vec2 dSTdx = dFdx( vBumpMapUv );
  2491. vec2 dSTdy = dFdy( vBumpMapUv );
  2492. float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
  2493. float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
  2494. float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
  2495. return vec2( dBx, dBy );
  2496. }
  2497. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
  2498. // normalize is done to ensure that the bump map looks the same regardless of the texture's scale
  2499. vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
  2500. vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
  2501. vec3 vN = surf_norm; // normalized
  2502. vec3 R1 = cross( vSigmaY, vN );
  2503. vec3 R2 = cross( vN, vSigmaX );
  2504. float fDet = dot( vSigmaX, R1 ) * faceDirection;
  2505. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  2506. return normalize( abs( fDet ) * surf_norm - vGrad );
  2507. }
  2508. #endif
  2509. `;var cee=`
  2510. #if NUM_CLIPPING_PLANES > 0
  2511. vec4 plane;
  2512. #ifdef ALPHA_TO_COVERAGE
  2513. float distanceToPlane, distanceGradient;
  2514. float clipOpacity = 1.0;
  2515. #pragma unroll_loop_start
  2516. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  2517. plane = clippingPlanes[ i ];
  2518. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  2519. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  2520. clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  2521. if ( clipOpacity == 0.0 ) discard;
  2522. }
  2523. #pragma unroll_loop_end
  2524. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  2525. float unionClipOpacity = 1.0;
  2526. #pragma unroll_loop_start
  2527. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  2528. plane = clippingPlanes[ i ];
  2529. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  2530. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  2531. unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  2532. }
  2533. #pragma unroll_loop_end
  2534. clipOpacity *= 1.0 - unionClipOpacity;
  2535. #endif
  2536. diffuseColor.a *= clipOpacity;
  2537. if ( diffuseColor.a == 0.0 ) discard;
  2538. #else
  2539. #pragma unroll_loop_start
  2540. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  2541. plane = clippingPlanes[ i ];
  2542. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  2543. }
  2544. #pragma unroll_loop_end
  2545. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  2546. bool clipped = true;
  2547. #pragma unroll_loop_start
  2548. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  2549. plane = clippingPlanes[ i ];
  2550. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  2551. }
  2552. #pragma unroll_loop_end
  2553. if ( clipped ) discard;
  2554. #endif
  2555. #endif
  2556. #endif
  2557. `;var fee=`
  2558. #if NUM_CLIPPING_PLANES > 0
  2559. varying vec3 vClipPosition;
  2560. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  2561. #endif
  2562. `;var hee=`
  2563. #if NUM_CLIPPING_PLANES > 0
  2564. varying vec3 vClipPosition;
  2565. #endif
  2566. `;var pee=`
  2567. #if NUM_CLIPPING_PLANES > 0
  2568. vClipPosition = - mvPosition.xyz;
  2569. #endif
  2570. `;var dee=`
  2571. #if defined( USE_COLOR_ALPHA )
  2572. diffuseColor *= vColor;
  2573. #elif defined( USE_COLOR )
  2574. diffuseColor.rgb *= vColor;
  2575. #endif
  2576. `;var mee=`
  2577. #if defined( USE_COLOR_ALPHA )
  2578. varying vec4 vColor;
  2579. #elif defined( USE_COLOR )
  2580. varying vec3 vColor;
  2581. #endif
  2582. `;var vee=`
  2583. #if defined( USE_COLOR_ALPHA )
  2584. varying vec4 vColor;
  2585. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  2586. varying vec3 vColor;
  2587. #endif
  2588. `;var gee=`
  2589. #if defined( USE_COLOR_ALPHA )
  2590. vColor = vec4( 1.0 );
  2591. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  2592. vColor = vec3( 1.0 );
  2593. #endif
  2594. #ifdef USE_COLOR
  2595. vColor *= color;
  2596. #endif
  2597. #ifdef USE_INSTANCING_COLOR
  2598. vColor.xyz *= instanceColor.xyz;
  2599. #endif
  2600. `;var yee=`
  2601. #define PI 3.141592653589793
  2602. #define PI2 6.283185307179586
  2603. #define PI_HALF 1.5707963267948966
  2604. #define RECIPROCAL_PI 0.3183098861837907
  2605. #define RECIPROCAL_PI2 0.15915494309189535
  2606. #define EPSILON 1e-6
  2607. #ifndef saturate
  2608. // <tonemapping_pars_fragment> may have defined saturate() already
  2609. #define saturate( a ) clamp( a, 0.0, 1.0 )
  2610. #endif
  2611. #define whiteComplement( a ) ( 1.0 - saturate( a ) )
  2612. float pow2( const in float x ) { return x*x; }
  2613. vec3 pow2( const in vec3 x ) { return x*x; }
  2614. float pow3( const in float x ) { return x*x*x; }
  2615. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  2616. float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  2617. float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
  2618. // expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.
  2619. // do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
  2620. highp float rand( const in vec2 uv ) {
  2621. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  2622. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  2623. return fract( sin( sn ) * c );
  2624. }
  2625. #ifdef HIGH_PRECISION
  2626. float precisionSafeLength( vec3 v ) { return length( v ); }
  2627. #else
  2628. float precisionSafeLength( vec3 v ) {
  2629. float maxComponent = max3( abs( v ) );
  2630. return length( v / maxComponent ) * maxComponent;
  2631. }
  2632. #endif
  2633. struct IncidentLight {
  2634. vec3 color;
  2635. vec3 direction;
  2636. bool visible;
  2637. };
  2638. struct ReflectedLight {
  2639. vec3 directDiffuse;
  2640. vec3 directSpecular;
  2641. vec3 indirectDiffuse;
  2642. vec3 indirectSpecular;
  2643. };
  2644. #ifdef USE_ALPHAHASH
  2645. varying vec3 vPosition;
  2646. #endif
  2647. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  2648. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  2649. }
  2650. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  2651. // dir can be either a direction vector or a normal vector
  2652. // upper-left 3x3 of matrix is assumed to be orthogonal
  2653. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  2654. }
  2655. mat3 transposeMat3( const in mat3 m ) {
  2656. mat3 tmp;
  2657. tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  2658. tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  2659. tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  2660. return tmp;
  2661. }
  2662. float luminance( const in vec3 rgb ) {
  2663. // assumes rgb is in linear color space with sRGB primaries and D65 white point
  2664. const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
  2665. return dot( weights, rgb );
  2666. }
  2667. bool isPerspectiveMatrix( mat4 m ) {
  2668. return m[ 2 ][ 3 ] == - 1.0;
  2669. }
  2670. vec2 equirectUv( in vec3 dir ) {
  2671. // dir is assumed to be unit length
  2672. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  2673. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  2674. return vec2( u, v );
  2675. }
  2676. vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
  2677. return RECIPROCAL_PI * diffuseColor;
  2678. } // validated
  2679. vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
  2680. // Original approximation by Christophe Schlick '94
  2681. // float fresnel = pow( 1.0 - dotVH, 5.0 );
  2682. // Optimized variant (presented by Epic at SIGGRAPH '13)
  2683. // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
  2684. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  2685. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  2686. } // validated
  2687. float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
  2688. // Original approximation by Christophe Schlick '94
  2689. // float fresnel = pow( 1.0 - dotVH, 5.0 );
  2690. // Optimized variant (presented by Epic at SIGGRAPH '13)
  2691. // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
  2692. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  2693. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  2694. } // validated
  2695. `;var _ee=`
  2696. #ifdef ENVMAP_TYPE_CUBE_UV
  2697. #define cubeUV_minMipLevel 4.0
  2698. #define cubeUV_minTileSize 16.0
  2699. // These shader functions convert between the UV coordinates of a single face of
  2700. // a cubemap, the 0-5 integer index of a cube face, and the direction vector for
  2701. // sampling a textureCube (not generally normalized ).
  2702. float getFace( vec3 direction ) {
  2703. vec3 absDirection = abs( direction );
  2704. float face = - 1.0;
  2705. if ( absDirection.x > absDirection.z ) {
  2706. if ( absDirection.x > absDirection.y )
  2707. face = direction.x > 0.0 ? 0.0 : 3.0;
  2708. else
  2709. face = direction.y > 0.0 ? 1.0 : 4.0;
  2710. } else {
  2711. if ( absDirection.z > absDirection.y )
  2712. face = direction.z > 0.0 ? 2.0 : 5.0;
  2713. else
  2714. face = direction.y > 0.0 ? 1.0 : 4.0;
  2715. }
  2716. return face;
  2717. }
  2718. // RH coordinate system; PMREM face-indexing convention
  2719. vec2 getUV( vec3 direction, float face ) {
  2720. vec2 uv;
  2721. if ( face == 0.0 ) {
  2722. uv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x
  2723. } else if ( face == 1.0 ) {
  2724. uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y
  2725. } else if ( face == 2.0 ) {
  2726. uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z
  2727. } else if ( face == 3.0 ) {
  2728. uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x
  2729. } else if ( face == 4.0 ) {
  2730. uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y
  2731. } else {
  2732. uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z
  2733. }
  2734. return 0.5 * ( uv + 1.0 );
  2735. }
  2736. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  2737. float face = getFace( direction );
  2738. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  2739. mipInt = max( mipInt, cubeUV_minMipLevel );
  2740. float faceSize = exp2( mipInt );
  2741. highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071
  2742. if ( face > 2.0 ) {
  2743. uv.y += faceSize;
  2744. face -= 3.0;
  2745. }
  2746. uv.x += face * faceSize;
  2747. uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  2748. uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  2749. uv.x *= CUBEUV_TEXEL_WIDTH;
  2750. uv.y *= CUBEUV_TEXEL_HEIGHT;
  2751. #ifdef texture2DGradEXT
  2752. return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disable anisotropic filtering
  2753. #else
  2754. return texture2D( envMap, uv ).rgb;
  2755. #endif
  2756. }
  2757. // These defines must match with PMREMGenerator
  2758. #define cubeUV_r0 1.0
  2759. #define cubeUV_m0 - 2.0
  2760. #define cubeUV_r1 0.8
  2761. #define cubeUV_m1 - 1.0
  2762. #define cubeUV_r4 0.4
  2763. #define cubeUV_m4 2.0
  2764. #define cubeUV_r5 0.305
  2765. #define cubeUV_m5 3.0
  2766. #define cubeUV_r6 0.21
  2767. #define cubeUV_m6 4.0
  2768. float roughnessToMip( float roughness ) {
  2769. float mip = 0.0;
  2770. if ( roughness >= cubeUV_r1 ) {
  2771. mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
  2772. } else if ( roughness >= cubeUV_r4 ) {
  2773. mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
  2774. } else if ( roughness >= cubeUV_r5 ) {
  2775. mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
  2776. } else if ( roughness >= cubeUV_r6 ) {
  2777. mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
  2778. } else {
  2779. mip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25
  2780. }
  2781. return mip;
  2782. }
  2783. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  2784. float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
  2785. float mipF = fract( mip );
  2786. float mipInt = floor( mip );
  2787. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  2788. if ( mipF == 0.0 ) {
  2789. return vec4( color0, 1.0 );
  2790. } else {
  2791. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  2792. return vec4( mix( color0, color1, mipF ), 1.0 );
  2793. }
  2794. }
  2795. #endif
  2796. `;var xee=`
  2797. vec3 transformedNormal = objectNormal;
  2798. #ifdef USE_TANGENT
  2799. vec3 transformedTangent = objectTangent;
  2800. #endif
  2801. #ifdef USE_BATCHING
  2802. // this is in lieu of a per-instance normal-matrix
  2803. // shear transforms in the instance matrix are not supported
  2804. mat3 bm = mat3( batchingMatrix );
  2805. transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
  2806. transformedNormal = bm * transformedNormal;
  2807. #ifdef USE_TANGENT
  2808. transformedTangent = bm * transformedTangent;
  2809. #endif
  2810. #endif
  2811. #ifdef USE_INSTANCING
  2812. // this is in lieu of a per-instance normal-matrix
  2813. // shear transforms in the instance matrix are not supported
  2814. mat3 im = mat3( instanceMatrix );
  2815. transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
  2816. transformedNormal = im * transformedNormal;
  2817. #ifdef USE_TANGENT
  2818. transformedTangent = im * transformedTangent;
  2819. #endif
  2820. #endif
  2821. transformedNormal = normalMatrix * transformedNormal;
  2822. #ifdef FLIP_SIDED
  2823. transformedNormal = - transformedNormal;
  2824. #endif
  2825. #ifdef USE_TANGENT
  2826. transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
  2827. #ifdef FLIP_SIDED
  2828. transformedTangent = - transformedTangent;
  2829. #endif
  2830. #endif
  2831. `;var See=`
  2832. #ifdef USE_DISPLACEMENTMAP
  2833. uniform sampler2D displacementMap;
  2834. uniform float displacementScale;
  2835. uniform float displacementBias;
  2836. #endif
  2837. `;var Mee=`
  2838. #ifdef USE_DISPLACEMENTMAP
  2839. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  2840. #endif
  2841. `;var bee=`
  2842. #ifdef USE_EMISSIVEMAP
  2843. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  2844. totalEmissiveRadiance *= emissiveColor.rgb;
  2845. #endif
  2846. `;var wee=`
  2847. #ifdef USE_EMISSIVEMAP
  2848. uniform sampler2D emissiveMap;
  2849. #endif
  2850. `;var Tee=`
  2851. gl_FragColor = linearToOutputTexel( gl_FragColor );
  2852. `;var Eee=`
  2853. // http://www.russellcottrell.com/photo/matrixCalculator.htm
  2854. // Linear sRGB => XYZ => Linear Display P3
  2855. const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
  2856. vec3( 0.8224621, 0.177538, 0.0 ),
  2857. vec3( 0.0331941, 0.9668058, 0.0 ),
  2858. vec3( 0.0170827, 0.0723974, 0.9105199 )
  2859. );
  2860. // Linear Display P3 => XYZ => Linear sRGB
  2861. const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
  2862. vec3( 1.2249401, - 0.2249404, 0.0 ),
  2863. vec3( - 0.0420569, 1.0420571, 0.0 ),
  2864. vec3( - 0.0196376, - 0.0786361, 1.0982735 )
  2865. );
  2866. vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
  2867. return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
  2868. }
  2869. vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
  2870. return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
  2871. }
  2872. vec4 LinearTransferOETF( in vec4 value ) {
  2873. return value;
  2874. }
  2875. vec4 sRGBTransferOETF( in vec4 value ) {
  2876. return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
  2877. }
  2878. // @deprecated, r156
  2879. vec4 LinearToLinear( in vec4 value ) {
  2880. return value;
  2881. }
  2882. // @deprecated, r156
  2883. vec4 LinearTosRGB( in vec4 value ) {
  2884. return sRGBTransferOETF( value );
  2885. }
  2886. `;var Aee=`
  2887. #ifdef USE_ENVMAP
  2888. #ifdef ENV_WORLDPOS
  2889. vec3 cameraToFrag;
  2890. if ( isOrthographic ) {
  2891. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  2892. } else {
  2893. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  2894. }
  2895. // Transforming Normal Vectors with the Inverse Transformation
  2896. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  2897. #ifdef ENVMAP_MODE_REFLECTION
  2898. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  2899. #else
  2900. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  2901. #endif
  2902. #else
  2903. vec3 reflectVec = vReflect;
  2904. #endif
  2905. #ifdef ENVMAP_TYPE_CUBE
  2906. vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  2907. #else
  2908. vec4 envColor = vec4( 0.0 );
  2909. #endif
  2910. #ifdef ENVMAP_BLENDING_MULTIPLY
  2911. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  2912. #elif defined( ENVMAP_BLENDING_MIX )
  2913. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  2914. #elif defined( ENVMAP_BLENDING_ADD )
  2915. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  2916. #endif
  2917. #endif
  2918. `;var Cee=`
  2919. #ifdef USE_ENVMAP
  2920. uniform float envMapIntensity;
  2921. uniform float flipEnvMap;
  2922. uniform mat3 envMapRotation;
  2923. #ifdef ENVMAP_TYPE_CUBE
  2924. uniform samplerCube envMap;
  2925. #else
  2926. uniform sampler2D envMap;
  2927. #endif
  2928. #endif
  2929. `;var Ree=`
  2930. #ifdef USE_ENVMAP
  2931. uniform float reflectivity;
  2932. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  2933. #define ENV_WORLDPOS
  2934. #endif
  2935. #ifdef ENV_WORLDPOS
  2936. varying vec3 vWorldPosition;
  2937. uniform float refractionRatio;
  2938. #else
  2939. varying vec3 vReflect;
  2940. #endif
  2941. #endif
  2942. `;var Lee=`
  2943. #ifdef USE_ENVMAP
  2944. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  2945. #define ENV_WORLDPOS
  2946. #endif
  2947. #ifdef ENV_WORLDPOS
  2948. varying vec3 vWorldPosition;
  2949. #else
  2950. varying vec3 vReflect;
  2951. uniform float refractionRatio;
  2952. #endif
  2953. #endif
  2954. `;var Pee=`
  2955. #ifdef USE_ENVMAP
  2956. #ifdef ENV_WORLDPOS
  2957. vWorldPosition = worldPosition.xyz;
  2958. #else
  2959. vec3 cameraToVertex;
  2960. if ( isOrthographic ) {
  2961. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  2962. } else {
  2963. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  2964. }
  2965. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  2966. #ifdef ENVMAP_MODE_REFLECTION
  2967. vReflect = reflect( cameraToVertex, worldNormal );
  2968. #else
  2969. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  2970. #endif
  2971. #endif
  2972. #endif
  2973. `;var Dee=`
  2974. #ifdef USE_FOG
  2975. vFogDepth = - mvPosition.z;
  2976. #endif
  2977. `;var Iee=`
  2978. #ifdef USE_FOG
  2979. varying float vFogDepth;
  2980. #endif
  2981. `;var Nee=`
  2982. #ifdef USE_FOG
  2983. #ifdef FOG_EXP2
  2984. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
  2985. #else
  2986. float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
  2987. #endif
  2988. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  2989. #endif
  2990. `;var Uee=`
  2991. #ifdef USE_FOG
  2992. uniform vec3 fogColor;
  2993. varying float vFogDepth;
  2994. #ifdef FOG_EXP2
  2995. uniform float fogDensity;
  2996. #else
  2997. uniform float fogNear;
  2998. uniform float fogFar;
  2999. #endif
  3000. #endif
  3001. `;var Oee=`
  3002. #ifdef USE_GRADIENTMAP
  3003. uniform sampler2D gradientMap;
  3004. #endif
  3005. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  3006. // dotNL will be from -1.0 to 1.0
  3007. float dotNL = dot( normal, lightDirection );
  3008. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  3009. #ifdef USE_GRADIENTMAP
  3010. return vec3( texture2D( gradientMap, coord ).r );
  3011. #else
  3012. vec2 fw = fwidth( coord ) * 0.5;
  3013. return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
  3014. #endif
  3015. }
  3016. `;var Fee=`
  3017. #ifdef USE_LIGHTMAP
  3018. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  3019. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  3020. reflectedLight.indirectDiffuse += lightMapIrradiance;
  3021. #endif
  3022. `;var zee=`
  3023. #ifdef USE_LIGHTMAP
  3024. uniform sampler2D lightMap;
  3025. uniform float lightMapIntensity;
  3026. #endif
  3027. `;var Bee=`
  3028. LambertMaterial material;
  3029. material.diffuseColor = diffuseColor.rgb;
  3030. material.specularStrength = specularStrength;
  3031. `;var kee=`
  3032. varying vec3 vViewPosition;
  3033. struct LambertMaterial {
  3034. vec3 diffuseColor;
  3035. float specularStrength;
  3036. };
  3037. void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  3038. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  3039. vec3 irradiance = dotNL * directLight.color;
  3040. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3041. }
  3042. void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  3043. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3044. }
  3045. #define RE_Direct RE_Direct_Lambert
  3046. #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert
  3047. `;var Vee=`
  3048. uniform bool receiveShadow;
  3049. uniform vec3 ambientLightColor;
  3050. #if defined( USE_LIGHT_PROBES )
  3051. uniform vec3 lightProbe[ 9 ];
  3052. #endif
  3053. // get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere
  3054. // source: https://graphics.stanford.edu/papers/envmap/envmap.pdf
  3055. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  3056. // normal is assumed to have unit length
  3057. float x = normal.x, y = normal.y, z = normal.z;
  3058. // band 0
  3059. vec3 result = shCoefficients[ 0 ] * 0.886227;
  3060. // band 1
  3061. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  3062. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  3063. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  3064. // band 2
  3065. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  3066. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  3067. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  3068. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  3069. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  3070. return result;
  3071. }
  3072. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
  3073. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  3074. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  3075. return irradiance;
  3076. }
  3077. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  3078. vec3 irradiance = ambientLightColor;
  3079. return irradiance;
  3080. }
  3081. float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  3082. #if defined ( LEGACY_LIGHTS )
  3083. if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
  3084. return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
  3085. }
  3086. return 1.0;
  3087. #else
  3088. // based upon Frostbite 3 Moving to Physically-based Rendering
  3089. // page 32, equation 26: E[window1]
  3090. // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
  3091. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  3092. if ( cutoffDistance > 0.0 ) {
  3093. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  3094. }
  3095. return distanceFalloff;
  3096. #endif
  3097. }
  3098. float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
  3099. return smoothstep( coneCosine, penumbraCosine, angleCosine );
  3100. }
  3101. #if NUM_DIR_LIGHTS > 0
  3102. struct DirectionalLight {
  3103. vec3 direction;
  3104. vec3 color;
  3105. };
  3106. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  3107. void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
  3108. light.color = directionalLight.color;
  3109. light.direction = directionalLight.direction;
  3110. light.visible = true;
  3111. }
  3112. #endif
  3113. #if NUM_POINT_LIGHTS > 0
  3114. struct PointLight {
  3115. vec3 position;
  3116. vec3 color;
  3117. float distance;
  3118. float decay;
  3119. };
  3120. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  3121. // light is an out parameter as having it as a return value caused compiler errors on some devices
  3122. void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
  3123. vec3 lVector = pointLight.position - geometryPosition;
  3124. light.direction = normalize( lVector );
  3125. float lightDistance = length( lVector );
  3126. light.color = pointLight.color;
  3127. light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
  3128. light.visible = ( light.color != vec3( 0.0 ) );
  3129. }
  3130. #endif
  3131. #if NUM_SPOT_LIGHTS > 0
  3132. struct SpotLight {
  3133. vec3 position;
  3134. vec3 direction;
  3135. vec3 color;
  3136. float distance;
  3137. float decay;
  3138. float coneCos;
  3139. float penumbraCos;
  3140. };
  3141. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  3142. // light is an out parameter as having it as a return value caused compiler errors on some devices
  3143. void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
  3144. vec3 lVector = spotLight.position - geometryPosition;
  3145. light.direction = normalize( lVector );
  3146. float angleCos = dot( light.direction, spotLight.direction );
  3147. float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  3148. if ( spotAttenuation > 0.0 ) {
  3149. float lightDistance = length( lVector );
  3150. light.color = spotLight.color * spotAttenuation;
  3151. light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
  3152. light.visible = ( light.color != vec3( 0.0 ) );
  3153. } else {
  3154. light.color = vec3( 0.0 );
  3155. light.visible = false;
  3156. }
  3157. }
  3158. #endif
  3159. #if NUM_RECT_AREA_LIGHTS > 0
  3160. struct RectAreaLight {
  3161. vec3 color;
  3162. vec3 position;
  3163. vec3 halfWidth;
  3164. vec3 halfHeight;
  3165. };
  3166. // Pre-computed values of LinearTransformedCosine approximation of BRDF
  3167. // BRDF approximation Texture is 64x64
  3168. uniform sampler2D ltc_1; // RGBA Float
  3169. uniform sampler2D ltc_2; // RGBA Float
  3170. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  3171. #endif
  3172. #if NUM_HEMI_LIGHTS > 0
  3173. struct HemisphereLight {
  3174. vec3 direction;
  3175. vec3 skyColor;
  3176. vec3 groundColor;
  3177. };
  3178. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  3179. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
  3180. float dotNL = dot( normal, hemiLight.direction );
  3181. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  3182. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  3183. return irradiance;
  3184. }
  3185. #endif
  3186. `;var Gee=`
  3187. #ifdef USE_ENVMAP
  3188. vec3 getIBLIrradiance( const in vec3 normal ) {
  3189. #ifdef ENVMAP_TYPE_CUBE_UV
  3190. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  3191. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
  3192. return PI * envMapColor.rgb * envMapIntensity;
  3193. #else
  3194. return vec3( 0.0 );
  3195. #endif
  3196. }
  3197. vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
  3198. #ifdef ENVMAP_TYPE_CUBE_UV
  3199. vec3 reflectVec = reflect( - viewDir, normal );
  3200. // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.
  3201. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
  3202. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  3203. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
  3204. return envMapColor.rgb * envMapIntensity;
  3205. #else
  3206. return vec3( 0.0 );
  3207. #endif
  3208. }
  3209. #ifdef USE_ANISOTROPY
  3210. vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
  3211. #ifdef ENVMAP_TYPE_CUBE_UV
  3212. // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy
  3213. vec3 bentNormal = cross( bitangent, viewDir );
  3214. bentNormal = normalize( cross( bentNormal, bitangent ) );
  3215. bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
  3216. return getIBLRadiance( viewDir, bentNormal, roughness );
  3217. #else
  3218. return vec3( 0.0 );
  3219. #endif
  3220. }
  3221. #endif
  3222. #endif
  3223. `;var Hee=`
  3224. ToonMaterial material;
  3225. material.diffuseColor = diffuseColor.rgb;
  3226. `;var Wee=`
  3227. varying vec3 vViewPosition;
  3228. struct ToonMaterial {
  3229. vec3 diffuseColor;
  3230. };
  3231. void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  3232. vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
  3233. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3234. }
  3235. void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  3236. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3237. }
  3238. #define RE_Direct RE_Direct_Toon
  3239. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
  3240. `;var Xee=`
  3241. BlinnPhongMaterial material;
  3242. material.diffuseColor = diffuseColor.rgb;
  3243. material.specularColor = specular;
  3244. material.specularShininess = shininess;
  3245. material.specularStrength = specularStrength;
  3246. `;var Yee=`
  3247. varying vec3 vViewPosition;
  3248. struct BlinnPhongMaterial {
  3249. vec3 diffuseColor;
  3250. vec3 specularColor;
  3251. float specularShininess;
  3252. float specularStrength;
  3253. };
  3254. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  3255. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  3256. vec3 irradiance = dotNL * directLight.color;
  3257. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3258. reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
  3259. }
  3260. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  3261. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3262. }
  3263. #define RE_Direct RE_Direct_BlinnPhong
  3264. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
  3265. `;var qee=`
  3266. PhysicalMaterial material;
  3267. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  3268. vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
  3269. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  3270. material.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.
  3271. material.roughness += geometryRoughness;
  3272. material.roughness = min( material.roughness, 1.0 );
  3273. #ifdef IOR
  3274. material.ior = ior;
  3275. #ifdef USE_SPECULAR
  3276. float specularIntensityFactor = specularIntensity;
  3277. vec3 specularColorFactor = specularColor;
  3278. #ifdef USE_SPECULAR_COLORMAP
  3279. specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
  3280. #endif
  3281. #ifdef USE_SPECULAR_INTENSITYMAP
  3282. specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
  3283. #endif
  3284. material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
  3285. #else
  3286. float specularIntensityFactor = 1.0;
  3287. vec3 specularColorFactor = vec3( 1.0 );
  3288. material.specularF90 = 1.0;
  3289. #endif
  3290. material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
  3291. #else
  3292. material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
  3293. material.specularF90 = 1.0;
  3294. #endif
  3295. #ifdef USE_CLEARCOAT
  3296. material.clearcoat = clearcoat;
  3297. material.clearcoatRoughness = clearcoatRoughness;
  3298. material.clearcoatF0 = vec3( 0.04 );
  3299. material.clearcoatF90 = 1.0;
  3300. #ifdef USE_CLEARCOATMAP
  3301. material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
  3302. #endif
  3303. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  3304. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
  3305. #endif
  3306. material.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model
  3307. material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  3308. material.clearcoatRoughness += geometryRoughness;
  3309. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  3310. #endif
  3311. #ifdef USE_IRIDESCENCE
  3312. material.iridescence = iridescence;
  3313. material.iridescenceIOR = iridescenceIOR;
  3314. #ifdef USE_IRIDESCENCEMAP
  3315. material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
  3316. #endif
  3317. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  3318. material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
  3319. #else
  3320. material.iridescenceThickness = iridescenceThicknessMaximum;
  3321. #endif
  3322. #endif
  3323. #ifdef USE_SHEEN
  3324. material.sheenColor = sheenColor;
  3325. #ifdef USE_SHEEN_COLORMAP
  3326. material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
  3327. #endif
  3328. material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
  3329. #ifdef USE_SHEEN_ROUGHNESSMAP
  3330. material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
  3331. #endif
  3332. #endif
  3333. #ifdef USE_ANISOTROPY
  3334. #ifdef USE_ANISOTROPYMAP
  3335. mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
  3336. vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
  3337. vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
  3338. #else
  3339. vec2 anisotropyV = anisotropyVector;
  3340. #endif
  3341. material.anisotropy = length( anisotropyV );
  3342. if( material.anisotropy == 0.0 ) {
  3343. anisotropyV = vec2( 1.0, 0.0 );
  3344. } else {
  3345. anisotropyV /= material.anisotropy;
  3346. material.anisotropy = saturate( material.anisotropy );
  3347. }
  3348. // Roughness along the anisotropy bitangent is the material roughness, while the tangent roughness increases with anisotropy.
  3349. material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
  3350. material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
  3351. material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
  3352. #endif
  3353. `;var Zee=`
  3354. struct PhysicalMaterial {
  3355. vec3 diffuseColor;
  3356. float roughness;
  3357. vec3 specularColor;
  3358. float specularF90;
  3359. #ifdef USE_CLEARCOAT
  3360. float clearcoat;
  3361. float clearcoatRoughness;
  3362. vec3 clearcoatF0;
  3363. float clearcoatF90;
  3364. #endif
  3365. #ifdef USE_IRIDESCENCE
  3366. float iridescence;
  3367. float iridescenceIOR;
  3368. float iridescenceThickness;
  3369. vec3 iridescenceFresnel;
  3370. vec3 iridescenceF0;
  3371. #endif
  3372. #ifdef USE_SHEEN
  3373. vec3 sheenColor;
  3374. float sheenRoughness;
  3375. #endif
  3376. #ifdef IOR
  3377. float ior;
  3378. #endif
  3379. #ifdef USE_TRANSMISSION
  3380. float transmission;
  3381. float transmissionAlpha;
  3382. float thickness;
  3383. float attenuationDistance;
  3384. vec3 attenuationColor;
  3385. #endif
  3386. #ifdef USE_ANISOTROPY
  3387. float anisotropy;
  3388. float alphaT;
  3389. vec3 anisotropyT;
  3390. vec3 anisotropyB;
  3391. #endif
  3392. };
  3393. // temporary
  3394. vec3 clearcoatSpecularDirect = vec3( 0.0 );
  3395. vec3 clearcoatSpecularIndirect = vec3( 0.0 );
  3396. vec3 sheenSpecularDirect = vec3( 0.0 );
  3397. vec3 sheenSpecularIndirect = vec3(0.0 );
  3398. vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
  3399. float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
  3400. float x2 = x * x;
  3401. float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
  3402. return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
  3403. }
  3404. // Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
  3405. // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
  3406. float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  3407. float a2 = pow2( alpha );
  3408. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  3409. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  3410. return 0.5 / max( gv + gl, EPSILON );
  3411. }
  3412. // Microfacet Models for Refraction through Rough Surfaces - equation (33)
  3413. // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
  3414. // alpha is "roughness squared" in Disney\u2019s reparameterization
  3415. float D_GGX( const in float alpha, const in float dotNH ) {
  3416. float a2 = pow2( alpha );
  3417. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1
  3418. return RECIPROCAL_PI * a2 / pow2( denom );
  3419. }
  3420. // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
  3421. #ifdef USE_ANISOTROPY
  3422. float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
  3423. float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
  3424. float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
  3425. float v = 0.5 / ( gv + gl );
  3426. return saturate(v);
  3427. }
  3428. float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
  3429. float a2 = alphaT * alphaB;
  3430. highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
  3431. highp float v2 = dot( v, v );
  3432. float w2 = a2 / v2;
  3433. return RECIPROCAL_PI * a2 * pow2 ( w2 );
  3434. }
  3435. #endif
  3436. #ifdef USE_CLEARCOAT
  3437. // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
  3438. vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
  3439. vec3 f0 = material.clearcoatF0;
  3440. float f90 = material.clearcoatF90;
  3441. float roughness = material.clearcoatRoughness;
  3442. float alpha = pow2( roughness ); // UE4's roughness
  3443. vec3 halfDir = normalize( lightDir + viewDir );
  3444. float dotNL = saturate( dot( normal, lightDir ) );
  3445. float dotNV = saturate( dot( normal, viewDir ) );
  3446. float dotNH = saturate( dot( normal, halfDir ) );
  3447. float dotVH = saturate( dot( viewDir, halfDir ) );
  3448. vec3 F = F_Schlick( f0, f90, dotVH );
  3449. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  3450. float D = D_GGX( alpha, dotNH );
  3451. return F * ( V * D );
  3452. }
  3453. #endif
  3454. vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
  3455. vec3 f0 = material.specularColor;
  3456. float f90 = material.specularF90;
  3457. float roughness = material.roughness;
  3458. float alpha = pow2( roughness ); // UE4's roughness
  3459. vec3 halfDir = normalize( lightDir + viewDir );
  3460. float dotNL = saturate( dot( normal, lightDir ) );
  3461. float dotNV = saturate( dot( normal, viewDir ) );
  3462. float dotNH = saturate( dot( normal, halfDir ) );
  3463. float dotVH = saturate( dot( viewDir, halfDir ) );
  3464. vec3 F = F_Schlick( f0, f90, dotVH );
  3465. #ifdef USE_IRIDESCENCE
  3466. F = mix( F, material.iridescenceFresnel, material.iridescence );
  3467. #endif
  3468. #ifdef USE_ANISOTROPY
  3469. float dotTL = dot( material.anisotropyT, lightDir );
  3470. float dotTV = dot( material.anisotropyT, viewDir );
  3471. float dotTH = dot( material.anisotropyT, halfDir );
  3472. float dotBL = dot( material.anisotropyB, lightDir );
  3473. float dotBV = dot( material.anisotropyB, viewDir );
  3474. float dotBH = dot( material.anisotropyB, halfDir );
  3475. float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
  3476. float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
  3477. #else
  3478. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  3479. float D = D_GGX( alpha, dotNH );
  3480. #endif
  3481. return F * ( V * D );
  3482. }
  3483. // Rect Area Light
  3484. // Real-Time Polygonal-Light Shading with Linearly Transformed Cosines
  3485. // by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
  3486. // code: https://github.com/selfshadow/ltc_code/
  3487. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  3488. const float LUT_SIZE = 64.0;
  3489. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  3490. const float LUT_BIAS = 0.5 / LUT_SIZE;
  3491. float dotNV = saturate( dot( N, V ) );
  3492. // texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )
  3493. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  3494. uv = uv * LUT_SCALE + LUT_BIAS;
  3495. return uv;
  3496. }
  3497. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  3498. // Real-Time Area Lighting: a Journey from Research to Production (p.102)
  3499. // An approximation of the form factor of a horizon-clipped rectangle.
  3500. float l = length( f );
  3501. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  3502. }
  3503. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  3504. float x = dot( v1, v2 );
  3505. float y = abs( x );
  3506. // rational polynomial approximation to theta / sin( theta ) / 2PI
  3507. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  3508. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  3509. float v = a / b;
  3510. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  3511. return cross( v1, v2 ) * theta_sintheta;
  3512. }
  3513. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  3514. // bail if point is on back side of plane of light
  3515. // assumes ccw winding order of light vertices
  3516. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  3517. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  3518. vec3 lightNormal = cross( v1, v2 );
  3519. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  3520. // construct orthonormal basis around N
  3521. vec3 T1, T2;
  3522. T1 = normalize( V - N * dot( V, N ) );
  3523. T2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system
  3524. // compute transform
  3525. mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
  3526. // transform rect
  3527. vec3 coords[ 4 ];
  3528. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  3529. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  3530. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  3531. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  3532. // project rect onto sphere
  3533. coords[ 0 ] = normalize( coords[ 0 ] );
  3534. coords[ 1 ] = normalize( coords[ 1 ] );
  3535. coords[ 2 ] = normalize( coords[ 2 ] );
  3536. coords[ 3 ] = normalize( coords[ 3 ] );
  3537. // calculate vector form factor
  3538. vec3 vectorFormFactor = vec3( 0.0 );
  3539. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  3540. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  3541. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  3542. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  3543. // adjust for horizon clipping
  3544. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  3545. /*
  3546. // alternate method of adjusting for horizon clipping (see referece)
  3547. // refactoring required
  3548. float len = length( vectorFormFactor );
  3549. float z = vectorFormFactor.z / len;
  3550. const float LUT_SIZE = 64.0;
  3551. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  3552. const float LUT_BIAS = 0.5 / LUT_SIZE;
  3553. // tabulated horizon-clipped sphere, apparently...
  3554. vec2 uv = vec2( z * 0.5 + 0.5, len );
  3555. uv = uv * LUT_SCALE + LUT_BIAS;
  3556. float scale = texture2D( ltc_2, uv ).w;
  3557. float result = len * scale;
  3558. */
  3559. return vec3( result );
  3560. }
  3561. // End Rect Area Light
  3562. #if defined( USE_SHEEN )
  3563. // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
  3564. float D_Charlie( float roughness, float dotNH ) {
  3565. float alpha = pow2( roughness );
  3566. // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
  3567. float invAlpha = 1.0 / alpha;
  3568. float cos2h = dotNH * dotNH;
  3569. float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16
  3570. return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
  3571. }
  3572. // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
  3573. float V_Neubelt( float dotNV, float dotNL ) {
  3574. // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"
  3575. return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
  3576. }
  3577. vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
  3578. vec3 halfDir = normalize( lightDir + viewDir );
  3579. float dotNL = saturate( dot( normal, lightDir ) );
  3580. float dotNV = saturate( dot( normal, viewDir ) );
  3581. float dotNH = saturate( dot( normal, halfDir ) );
  3582. float D = D_Charlie( sheenRoughness, dotNH );
  3583. float V = V_Neubelt( dotNV, dotNL );
  3584. return sheenColor * ( D * V );
  3585. }
  3586. #endif
  3587. // This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from
  3588. // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found
  3589. // in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
  3590. float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  3591. float dotNV = saturate( dot( normal, viewDir ) );
  3592. float r2 = roughness * roughness;
  3593. float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
  3594. float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
  3595. float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
  3596. return saturate( DG * RECIPROCAL_PI );
  3597. }
  3598. // Analytical approximation of the DFG LUT, one half of the
  3599. // split-sum approximation used in indirect specular lighting.
  3600. // via 'environmentBRDF' from "Physically Based Shading on Mobile"
  3601. // https://www.unrealengine.com/blog/physically-based-shading-on-mobile
  3602. vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  3603. float dotNV = saturate( dot( normal, viewDir ) );
  3604. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  3605. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  3606. vec4 r = roughness * c0 + c1;
  3607. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  3608. vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
  3609. return fab;
  3610. }
  3611. vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
  3612. vec2 fab = DFGApprox( normal, viewDir, roughness );
  3613. return specularColor * fab.x + specularF90 * fab.y;
  3614. }
  3615. // Fdez-Ag\xFCera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"
  3616. // Approximates multiscattering in order to preserve energy.
  3617. // http://www.jcgt.org/published/0008/01/03/
  3618. #ifdef USE_IRIDESCENCE
  3619. void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  3620. #else
  3621. void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  3622. #endif
  3623. vec2 fab = DFGApprox( normal, viewDir, roughness );
  3624. #ifdef USE_IRIDESCENCE
  3625. vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
  3626. #else
  3627. vec3 Fr = specularColor;
  3628. #endif
  3629. vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
  3630. float Ess = fab.x + fab.y;
  3631. float Ems = 1.0 - Ess;
  3632. vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21
  3633. vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  3634. singleScatter += FssEss;
  3635. multiScatter += Fms * Ems;
  3636. }
  3637. #if NUM_RECT_AREA_LIGHTS > 0
  3638. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  3639. vec3 normal = geometryNormal;
  3640. vec3 viewDir = geometryViewDir;
  3641. vec3 position = geometryPosition;
  3642. vec3 lightPos = rectAreaLight.position;
  3643. vec3 halfWidth = rectAreaLight.halfWidth;
  3644. vec3 halfHeight = rectAreaLight.halfHeight;
  3645. vec3 lightColor = rectAreaLight.color;
  3646. float roughness = material.roughness;
  3647. vec3 rectCoords[ 4 ];
  3648. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction
  3649. rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  3650. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  3651. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  3652. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  3653. vec4 t1 = texture2D( ltc_1, uv );
  3654. vec4 t2 = texture2D( ltc_2, uv );
  3655. mat3 mInv = mat3(
  3656. vec3( t1.x, 0, t1.y ),
  3657. vec3( 0, 1, 0 ),
  3658. vec3( t1.z, 0, t1.w )
  3659. );
  3660. // LTC Fresnel Approximation by Stephen Hill
  3661. // http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf
  3662. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  3663. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  3664. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  3665. }
  3666. #endif
  3667. void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  3668. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  3669. vec3 irradiance = dotNL * directLight.color;
  3670. #ifdef USE_CLEARCOAT
  3671. float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
  3672. vec3 ccIrradiance = dotNLcc * directLight.color;
  3673. clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
  3674. #endif
  3675. #ifdef USE_SHEEN
  3676. sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
  3677. #endif
  3678. reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
  3679. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3680. }
  3681. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  3682. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  3683. }
  3684. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
  3685. #ifdef USE_CLEARCOAT
  3686. clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  3687. #endif
  3688. #ifdef USE_SHEEN
  3689. sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
  3690. #endif
  3691. // Both indirect specular and indirect diffuse light accumulate here
  3692. vec3 singleScattering = vec3( 0.0 );
  3693. vec3 multiScattering = vec3( 0.0 );
  3694. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  3695. #ifdef USE_IRIDESCENCE
  3696. computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
  3697. #else
  3698. computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
  3699. #endif
  3700. vec3 totalScattering = singleScattering + multiScattering;
  3701. vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
  3702. reflectedLight.indirectSpecular += radiance * singleScattering;
  3703. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  3704. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  3705. }
  3706. #define RE_Direct RE_Direct_Physical
  3707. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  3708. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  3709. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  3710. // ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
  3711. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  3712. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  3713. }
  3714. `;var jee=`
  3715. /**
  3716. * This is a template that can be used to light a material, it uses pluggable
  3717. * RenderEquations (RE)for specific lighting scenarios.
  3718. *
  3719. * Instructions for use:
  3720. * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined
  3721. * - Create a material parameter that is to be passed as the third parameter to your lighting functions.
  3722. *
  3723. * TODO:
  3724. * - Add area light support.
  3725. * - Add sphere light support.
  3726. * - Add diffuse light probe (irradiance cubemap) support.
  3727. */
  3728. vec3 geometryPosition = - vViewPosition;
  3729. vec3 geometryNormal = normal;
  3730. vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  3731. vec3 geometryClearcoatNormal = vec3( 0.0 );
  3732. #ifdef USE_CLEARCOAT
  3733. geometryClearcoatNormal = clearcoatNormal;
  3734. #endif
  3735. #ifdef USE_IRIDESCENCE
  3736. float dotNVi = saturate( dot( normal, geometryViewDir ) );
  3737. if ( material.iridescenceThickness == 0.0 ) {
  3738. material.iridescence = 0.0;
  3739. } else {
  3740. material.iridescence = saturate( material.iridescence );
  3741. }
  3742. if ( material.iridescence > 0.0 ) {
  3743. material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
  3744. // Iridescence F0 approximation
  3745. material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
  3746. }
  3747. #endif
  3748. IncidentLight directLight;
  3749. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  3750. PointLight pointLight;
  3751. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  3752. PointLightShadow pointLightShadow;
  3753. #endif
  3754. #pragma unroll_loop_start
  3755. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  3756. pointLight = pointLights[ i ];
  3757. getPointLightInfo( pointLight, geometryPosition, directLight );
  3758. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  3759. pointLightShadow = pointLightShadows[ i ];
  3760. directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  3761. #endif
  3762. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3763. }
  3764. #pragma unroll_loop_end
  3765. #endif
  3766. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  3767. SpotLight spotLight;
  3768. vec4 spotColor;
  3769. vec3 spotLightCoord;
  3770. bool inSpotLightMap;
  3771. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  3772. SpotLightShadow spotLightShadow;
  3773. #endif
  3774. #pragma unroll_loop_start
  3775. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  3776. spotLight = spotLights[ i ];
  3777. getSpotLightInfo( spotLight, geometryPosition, directLight );
  3778. // spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]
  3779. #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  3780. #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
  3781. #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  3782. #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
  3783. #else
  3784. #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  3785. #endif
  3786. #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
  3787. spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
  3788. inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
  3789. spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
  3790. directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
  3791. #endif
  3792. #undef SPOT_LIGHT_MAP_INDEX
  3793. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  3794. spotLightShadow = spotLightShadows[ i ];
  3795. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  3796. #endif
  3797. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3798. }
  3799. #pragma unroll_loop_end
  3800. #endif
  3801. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  3802. DirectionalLight directionalLight;
  3803. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  3804. DirectionalLightShadow directionalLightShadow;
  3805. #endif
  3806. #pragma unroll_loop_start
  3807. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  3808. directionalLight = directionalLights[ i ];
  3809. getDirectionalLightInfo( directionalLight, directLight );
  3810. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  3811. directionalLightShadow = directionalLightShadows[ i ];
  3812. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  3813. #endif
  3814. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3815. }
  3816. #pragma unroll_loop_end
  3817. #endif
  3818. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  3819. RectAreaLight rectAreaLight;
  3820. #pragma unroll_loop_start
  3821. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  3822. rectAreaLight = rectAreaLights[ i ];
  3823. RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3824. }
  3825. #pragma unroll_loop_end
  3826. #endif
  3827. #if defined( RE_IndirectDiffuse )
  3828. vec3 iblIrradiance = vec3( 0.0 );
  3829. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  3830. #if defined( USE_LIGHT_PROBES )
  3831. irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
  3832. #endif
  3833. #if ( NUM_HEMI_LIGHTS > 0 )
  3834. #pragma unroll_loop_start
  3835. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  3836. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
  3837. }
  3838. #pragma unroll_loop_end
  3839. #endif
  3840. #endif
  3841. #if defined( RE_IndirectSpecular )
  3842. vec3 radiance = vec3( 0.0 );
  3843. vec3 clearcoatRadiance = vec3( 0.0 );
  3844. #endif
  3845. `;var Kee=`
  3846. #if defined( RE_IndirectDiffuse )
  3847. #ifdef USE_LIGHTMAP
  3848. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  3849. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  3850. irradiance += lightMapIrradiance;
  3851. #endif
  3852. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  3853. iblIrradiance += getIBLIrradiance( geometryNormal );
  3854. #endif
  3855. #endif
  3856. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  3857. #ifdef USE_ANISOTROPY
  3858. radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
  3859. #else
  3860. radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
  3861. #endif
  3862. #ifdef USE_CLEARCOAT
  3863. clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
  3864. #endif
  3865. #endif
  3866. `;var Jee=`
  3867. #if defined( RE_IndirectDiffuse )
  3868. RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3869. #endif
  3870. #if defined( RE_IndirectSpecular )
  3871. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  3872. #endif
  3873. `;var $ee=`
  3874. #if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  3875. // Doing a strict comparison with == 1.0 can cause noise artifacts
  3876. // on some platforms. See issue #17623.
  3877. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  3878. #endif
  3879. `;var Qee=`
  3880. #if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  3881. uniform float logDepthBufFC;
  3882. varying float vFragDepth;
  3883. varying float vIsPerspective;
  3884. #endif
  3885. `;var ete=`
  3886. #ifdef USE_LOGDEPTHBUF
  3887. #ifdef USE_LOGDEPTHBUF_EXT
  3888. varying float vFragDepth;
  3889. varying float vIsPerspective;
  3890. #else
  3891. uniform float logDepthBufFC;
  3892. #endif
  3893. #endif
  3894. `;var tte=`
  3895. #ifdef USE_LOGDEPTHBUF
  3896. #ifdef USE_LOGDEPTHBUF_EXT
  3897. vFragDepth = 1.0 + gl_Position.w;
  3898. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  3899. #else
  3900. if ( isPerspectiveMatrix( projectionMatrix ) ) {
  3901. gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
  3902. gl_Position.z *= gl_Position.w;
  3903. }
  3904. #endif
  3905. #endif
  3906. `;var rte=`
  3907. #ifdef USE_MAP
  3908. vec4 sampledDiffuseColor = texture2D( map, vMapUv );
  3909. #ifdef DECODE_VIDEO_TEXTURE
  3910. // use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)
  3911. sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
  3912. #endif
  3913. diffuseColor *= sampledDiffuseColor;
  3914. #endif
  3915. `;var ite=`
  3916. #ifdef USE_MAP
  3917. uniform sampler2D map;
  3918. #endif
  3919. `;var nte=`
  3920. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  3921. #if defined( USE_POINTS_UV )
  3922. vec2 uv = vUv;
  3923. #else
  3924. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  3925. #endif
  3926. #endif
  3927. #ifdef USE_MAP
  3928. diffuseColor *= texture2D( map, uv );
  3929. #endif
  3930. #ifdef USE_ALPHAMAP
  3931. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  3932. #endif
  3933. `;var ate=`
  3934. #if defined( USE_POINTS_UV )
  3935. varying vec2 vUv;
  3936. #else
  3937. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  3938. uniform mat3 uvTransform;
  3939. #endif
  3940. #endif
  3941. #ifdef USE_MAP
  3942. uniform sampler2D map;
  3943. #endif
  3944. #ifdef USE_ALPHAMAP
  3945. uniform sampler2D alphaMap;
  3946. #endif
  3947. `;var ote=`
  3948. float metalnessFactor = metalness;
  3949. #ifdef USE_METALNESSMAP
  3950. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  3951. // reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
  3952. metalnessFactor *= texelMetalness.b;
  3953. #endif
  3954. `;var ste=`
  3955. #ifdef USE_METALNESSMAP
  3956. uniform sampler2D metalnessMap;
  3957. #endif
  3958. `;var lte=`
  3959. #ifdef USE_INSTANCING_MORPH
  3960. float morphTargetInfluences[MORPHTARGETS_COUNT];
  3961. float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
  3962. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  3963. morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
  3964. }
  3965. #endif
  3966. `;var ute=`
  3967. #if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
  3968. // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
  3969. // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)
  3970. // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
  3971. vColor *= morphTargetBaseInfluence;
  3972. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  3973. #if defined( USE_COLOR_ALPHA )
  3974. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
  3975. #elif defined( USE_COLOR )
  3976. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
  3977. #endif
  3978. }
  3979. #endif
  3980. `;var cte=`
  3981. #ifdef USE_MORPHNORMALS
  3982. // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
  3983. // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)
  3984. // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
  3985. objectNormal *= morphTargetBaseInfluence;
  3986. #ifdef MORPHTARGETS_TEXTURE
  3987. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  3988. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  3989. }
  3990. #else
  3991. objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
  3992. objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
  3993. objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
  3994. objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
  3995. #endif
  3996. #endif
  3997. `;var fte=`
  3998. #ifdef USE_MORPHTARGETS
  3999. #ifndef USE_INSTANCING_MORPH
  4000. uniform float morphTargetBaseInfluence;
  4001. #endif
  4002. #ifdef MORPHTARGETS_TEXTURE
  4003. #ifndef USE_INSTANCING_MORPH
  4004. uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  4005. #endif
  4006. uniform sampler2DArray morphTargetsTexture;
  4007. uniform ivec2 morphTargetsTextureSize;
  4008. vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
  4009. int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
  4010. int y = texelIndex / morphTargetsTextureSize.x;
  4011. int x = texelIndex - y * morphTargetsTextureSize.x;
  4012. ivec3 morphUV = ivec3( x, y, morphTargetIndex );
  4013. return texelFetch( morphTargetsTexture, morphUV, 0 );
  4014. }
  4015. #else
  4016. #ifndef USE_MORPHNORMALS
  4017. uniform float morphTargetInfluences[ 8 ];
  4018. #else
  4019. uniform float morphTargetInfluences[ 4 ];
  4020. #endif
  4021. #endif
  4022. #endif
  4023. `;var hte=`
  4024. #ifdef USE_MORPHTARGETS
  4025. // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:
  4026. // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)
  4027. // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting
  4028. transformed *= morphTargetBaseInfluence;
  4029. #ifdef MORPHTARGETS_TEXTURE
  4030. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  4031. if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
  4032. }
  4033. #else
  4034. transformed += morphTarget0 * morphTargetInfluences[ 0 ];
  4035. transformed += morphTarget1 * morphTargetInfluences[ 1 ];
  4036. transformed += morphTarget2 * morphTargetInfluences[ 2 ];
  4037. transformed += morphTarget3 * morphTargetInfluences[ 3 ];
  4038. #ifndef USE_MORPHNORMALS
  4039. transformed += morphTarget4 * morphTargetInfluences[ 4 ];
  4040. transformed += morphTarget5 * morphTargetInfluences[ 5 ];
  4041. transformed += morphTarget6 * morphTargetInfluences[ 6 ];
  4042. transformed += morphTarget7 * morphTargetInfluences[ 7 ];
  4043. #endif
  4044. #endif
  4045. #endif
  4046. `;var pte=`
  4047. float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
  4048. #ifdef FLAT_SHADED
  4049. vec3 fdx = dFdx( vViewPosition );
  4050. vec3 fdy = dFdy( vViewPosition );
  4051. vec3 normal = normalize( cross( fdx, fdy ) );
  4052. #else
  4053. vec3 normal = normalize( vNormal );
  4054. #ifdef DOUBLE_SIDED
  4055. normal *= faceDirection;
  4056. #endif
  4057. #endif
  4058. #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
  4059. #ifdef USE_TANGENT
  4060. mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  4061. #else
  4062. mat3 tbn = getTangentFrame( - vViewPosition, normal,
  4063. #if defined( USE_NORMALMAP )
  4064. vNormalMapUv
  4065. #elif defined( USE_CLEARCOAT_NORMALMAP )
  4066. vClearcoatNormalMapUv
  4067. #else
  4068. vUv
  4069. #endif
  4070. );
  4071. #endif
  4072. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  4073. tbn[0] *= faceDirection;
  4074. tbn[1] *= faceDirection;
  4075. #endif
  4076. #endif
  4077. #ifdef USE_CLEARCOAT_NORMALMAP
  4078. #ifdef USE_TANGENT
  4079. mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  4080. #else
  4081. mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
  4082. #endif
  4083. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  4084. tbn2[0] *= faceDirection;
  4085. tbn2[1] *= faceDirection;
  4086. #endif
  4087. #endif
  4088. // non perturbed normal for clearcoat among others
  4089. vec3 nonPerturbedNormal = normal;
  4090. `;var dte=`
  4091. #ifdef USE_NORMALMAP_OBJECTSPACE
  4092. normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals
  4093. #ifdef FLIP_SIDED
  4094. normal = - normal;
  4095. #endif
  4096. #ifdef DOUBLE_SIDED
  4097. normal = normal * faceDirection;
  4098. #endif
  4099. normal = normalize( normalMatrix * normal );
  4100. #elif defined( USE_NORMALMAP_TANGENTSPACE )
  4101. vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  4102. mapN.xy *= normalScale;
  4103. normal = normalize( tbn * mapN );
  4104. #elif defined( USE_BUMPMAP )
  4105. normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
  4106. #endif
  4107. `;var mte=`
  4108. #ifndef FLAT_SHADED
  4109. varying vec3 vNormal;
  4110. #ifdef USE_TANGENT
  4111. varying vec3 vTangent;
  4112. varying vec3 vBitangent;
  4113. #endif
  4114. #endif
  4115. `;var vte=`
  4116. #ifndef FLAT_SHADED
  4117. varying vec3 vNormal;
  4118. #ifdef USE_TANGENT
  4119. varying vec3 vTangent;
  4120. varying vec3 vBitangent;
  4121. #endif
  4122. #endif
  4123. `;var gte=`
  4124. #ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED
  4125. vNormal = normalize( transformedNormal );
  4126. #ifdef USE_TANGENT
  4127. vTangent = normalize( transformedTangent );
  4128. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  4129. #endif
  4130. #endif
  4131. `;var yte=`
  4132. #ifdef USE_NORMALMAP
  4133. uniform sampler2D normalMap;
  4134. uniform vec2 normalScale;
  4135. #endif
  4136. #ifdef USE_NORMALMAP_OBJECTSPACE
  4137. uniform mat3 normalMatrix;
  4138. #endif
  4139. #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
  4140. // Normal Mapping Without Precomputed Tangents
  4141. // http://www.thetenthplanet.de/archives/1180
  4142. mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
  4143. vec3 q0 = dFdx( eye_pos.xyz );
  4144. vec3 q1 = dFdy( eye_pos.xyz );
  4145. vec2 st0 = dFdx( uv.st );
  4146. vec2 st1 = dFdy( uv.st );
  4147. vec3 N = surf_norm; // normalized
  4148. vec3 q1perp = cross( q1, N );
  4149. vec3 q0perp = cross( N, q0 );
  4150. vec3 T = q1perp * st0.x + q0perp * st1.x;
  4151. vec3 B = q1perp * st0.y + q0perp * st1.y;
  4152. float det = max( dot( T, T ), dot( B, B ) );
  4153. float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
  4154. return mat3( T * scale, B * scale, N );
  4155. }
  4156. #endif
  4157. `;var _te=`
  4158. #ifdef USE_CLEARCOAT
  4159. vec3 clearcoatNormal = nonPerturbedNormal;
  4160. #endif
  4161. `;var xte=`
  4162. #ifdef USE_CLEARCOAT_NORMALMAP
  4163. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
  4164. clearcoatMapN.xy *= clearcoatNormalScale;
  4165. clearcoatNormal = normalize( tbn2 * clearcoatMapN );
  4166. #endif
  4167. `;var Ste=`
  4168. #ifdef USE_CLEARCOATMAP
  4169. uniform sampler2D clearcoatMap;
  4170. #endif
  4171. #ifdef USE_CLEARCOAT_NORMALMAP
  4172. uniform sampler2D clearcoatNormalMap;
  4173. uniform vec2 clearcoatNormalScale;
  4174. #endif
  4175. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  4176. uniform sampler2D clearcoatRoughnessMap;
  4177. #endif
  4178. `;var Mte=`
  4179. #ifdef USE_IRIDESCENCEMAP
  4180. uniform sampler2D iridescenceMap;
  4181. #endif
  4182. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  4183. uniform sampler2D iridescenceThicknessMap;
  4184. #endif
  4185. `;var bte=`
  4186. #ifdef OPAQUE
  4187. diffuseColor.a = 1.0;
  4188. #endif
  4189. #ifdef USE_TRANSMISSION
  4190. diffuseColor.a *= material.transmissionAlpha;
  4191. #endif
  4192. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  4193. `;var wte=`
  4194. vec3 packNormalToRGB( const in vec3 normal ) {
  4195. return normalize( normal ) * 0.5 + 0.5;
  4196. }
  4197. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  4198. return 2.0 * rgb.xyz - 1.0;
  4199. }
  4200. const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)
  4201. const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)
  4202. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  4203. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  4204. const float ShiftRight8 = 1. / 256.;
  4205. vec4 packDepthToRGBA( const in float v ) {
  4206. vec4 r = vec4( fract( v * PackFactors ), v );
  4207. r.yzw -= r.xyz * ShiftRight8; // tidy overflow
  4208. return r * PackUpscale;
  4209. }
  4210. float unpackRGBAToDepth( const in vec4 v ) {
  4211. return dot( v, UnpackFactors );
  4212. }
  4213. vec2 packDepthToRG( in highp float v ) {
  4214. return packDepthToRGBA( v ).yx;
  4215. }
  4216. float unpackRGToDepth( const in highp vec2 v ) {
  4217. return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
  4218. }
  4219. vec4 pack2HalfToRGBA( vec2 v ) {
  4220. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
  4221. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
  4222. }
  4223. vec2 unpackRGBATo2Half( vec4 v ) {
  4224. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  4225. }
  4226. // NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera
  4227. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  4228. // -near maps to 0; -far maps to 1
  4229. return ( viewZ + near ) / ( near - far );
  4230. }
  4231. float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
  4232. // maps orthographic depth in [ 0, 1 ] to viewZ
  4233. return depth * ( near - far ) - near;
  4234. }
  4235. // NOTE: https://twitter.com/gonnavis/status/1377183786949959682
  4236. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  4237. // -near maps to 0; -far maps to 1
  4238. return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
  4239. }
  4240. float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
  4241. // maps perspective depth in [ 0, 1 ] to viewZ
  4242. return ( near * far ) / ( ( far - near ) * depth - far );
  4243. }
  4244. `;var Tte=`
  4245. #ifdef PREMULTIPLIED_ALPHA
  4246. // Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.
  4247. gl_FragColor.rgb *= gl_FragColor.a;
  4248. #endif
  4249. `;var Ete=`
  4250. vec4 mvPosition = vec4( transformed, 1.0 );
  4251. #ifdef USE_BATCHING
  4252. mvPosition = batchingMatrix * mvPosition;
  4253. #endif
  4254. #ifdef USE_INSTANCING
  4255. mvPosition = instanceMatrix * mvPosition;
  4256. #endif
  4257. mvPosition = modelViewMatrix * mvPosition;
  4258. gl_Position = projectionMatrix * mvPosition;
  4259. `;var Ate=`
  4260. #ifdef DITHERING
  4261. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  4262. #endif
  4263. `;var Cte=`
  4264. #ifdef DITHERING
  4265. // based on https://www.shadertoy.com/view/MslGR8
  4266. vec3 dithering( vec3 color ) {
  4267. //Calculate grid position
  4268. float grid_position = rand( gl_FragCoord.xy );
  4269. //Shift the individual colors differently, thus making it even harder to see the dithering pattern
  4270. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  4271. //modify shift according to grid position.
  4272. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  4273. //shift the color by dither_shift
  4274. return color + dither_shift_RGB;
  4275. }
  4276. #endif
  4277. `;var Rte=`
  4278. float roughnessFactor = roughness;
  4279. #ifdef USE_ROUGHNESSMAP
  4280. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  4281. // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
  4282. roughnessFactor *= texelRoughness.g;
  4283. #endif
  4284. `;var Lte=`
  4285. #ifdef USE_ROUGHNESSMAP
  4286. uniform sampler2D roughnessMap;
  4287. #endif
  4288. `;var Pte=`
  4289. #if NUM_SPOT_LIGHT_COORDS > 0
  4290. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  4291. #endif
  4292. #if NUM_SPOT_LIGHT_MAPS > 0
  4293. uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
  4294. #endif
  4295. #ifdef USE_SHADOWMAP
  4296. #if NUM_DIR_LIGHT_SHADOWS > 0
  4297. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  4298. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  4299. struct DirectionalLightShadow {
  4300. float shadowBias;
  4301. float shadowNormalBias;
  4302. float shadowRadius;
  4303. vec2 shadowMapSize;
  4304. };
  4305. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  4306. #endif
  4307. #if NUM_SPOT_LIGHT_SHADOWS > 0
  4308. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  4309. struct SpotLightShadow {
  4310. float shadowBias;
  4311. float shadowNormalBias;
  4312. float shadowRadius;
  4313. vec2 shadowMapSize;
  4314. };
  4315. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  4316. #endif
  4317. #if NUM_POINT_LIGHT_SHADOWS > 0
  4318. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  4319. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  4320. struct PointLightShadow {
  4321. float shadowBias;
  4322. float shadowNormalBias;
  4323. float shadowRadius;
  4324. vec2 shadowMapSize;
  4325. float shadowCameraNear;
  4326. float shadowCameraFar;
  4327. };
  4328. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  4329. #endif
  4330. /*
  4331. #if NUM_RECT_AREA_LIGHTS > 0
  4332. // TODO (abelnation): create uniforms for area light shadows
  4333. #endif
  4334. */
  4335. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  4336. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  4337. }
  4338. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  4339. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  4340. }
  4341. float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
  4342. float occlusion = 1.0;
  4343. vec2 distribution = texture2DDistribution( shadow, uv );
  4344. float hard_shadow = step( compare , distribution.x ); // Hard Shadow
  4345. if (hard_shadow != 1.0 ) {
  4346. float distance = compare - distribution.x ;
  4347. float variance = max( 0.00000, distribution.y * distribution.y );
  4348. float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality
  4349. softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed
  4350. occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
  4351. }
  4352. return occlusion;
  4353. }
  4354. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  4355. float shadow = 1.0;
  4356. shadowCoord.xyz /= shadowCoord.w;
  4357. shadowCoord.z += shadowBias;
  4358. bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
  4359. bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
  4360. if ( frustumTest ) {
  4361. #if defined( SHADOWMAP_TYPE_PCF )
  4362. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  4363. float dx0 = - texelSize.x * shadowRadius;
  4364. float dy0 = - texelSize.y * shadowRadius;
  4365. float dx1 = + texelSize.x * shadowRadius;
  4366. float dy1 = + texelSize.y * shadowRadius;
  4367. float dx2 = dx0 / 2.0;
  4368. float dy2 = dy0 / 2.0;
  4369. float dx3 = dx1 / 2.0;
  4370. float dy3 = dy1 / 2.0;
  4371. shadow = (
  4372. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  4373. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  4374. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  4375. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  4376. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  4377. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  4378. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  4379. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  4380. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  4381. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  4382. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  4383. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  4384. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  4385. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  4386. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  4387. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  4388. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  4389. ) * ( 1.0 / 17.0 );
  4390. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  4391. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  4392. float dx = texelSize.x;
  4393. float dy = texelSize.y;
  4394. vec2 uv = shadowCoord.xy;
  4395. vec2 f = fract( uv * shadowMapSize + 0.5 );
  4396. uv -= f * texelSize;
  4397. shadow = (
  4398. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  4399. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  4400. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  4401. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  4402. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  4403. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  4404. f.x ) +
  4405. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  4406. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  4407. f.x ) +
  4408. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  4409. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  4410. f.y ) +
  4411. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  4412. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  4413. f.y ) +
  4414. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  4415. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  4416. f.x ),
  4417. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  4418. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  4419. f.x ),
  4420. f.y )
  4421. ) * ( 1.0 / 9.0 );
  4422. #elif defined( SHADOWMAP_TYPE_VSM )
  4423. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  4424. #else // no percentage-closer filtering:
  4425. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  4426. #endif
  4427. }
  4428. return shadow;
  4429. }
  4430. // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D
  4431. // vector suitable for 2D texture mapping. This code uses the following layout for the
  4432. // 2D texture:
  4433. //
  4434. // xzXZ
  4435. // y Y
  4436. //
  4437. // Y - Positive y direction
  4438. // y - Negative y direction
  4439. // X - Positive x direction
  4440. // x - Negative x direction
  4441. // Z - Positive z direction
  4442. // z - Negative z direction
  4443. //
  4444. // Source and test bed:
  4445. // https://gist.github.com/tschw/da10c43c467ce8afd0c4
  4446. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  4447. // Number of texels to avoid at the edge of each square
  4448. vec3 absV = abs( v );
  4449. // Intersect unit cube
  4450. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  4451. absV *= scaleToCube;
  4452. // Apply scale to avoid seams
  4453. // two texels less per square (one texel will do for NEAREST)
  4454. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  4455. // Unwrap
  4456. // space: -1 ... 1 range for each square
  4457. //
  4458. // #X## dim := ( 4 , 2 )
  4459. // # # center := ( 1 , 1 )
  4460. vec2 planar = v.xy;
  4461. float almostATexel = 1.5 * texelSizeY;
  4462. float almostOne = 1.0 - almostATexel;
  4463. if ( absV.z >= almostOne ) {
  4464. if ( v.z > 0.0 )
  4465. planar.x = 4.0 - v.x;
  4466. } else if ( absV.x >= almostOne ) {
  4467. float signX = sign( v.x );
  4468. planar.x = v.z * signX + 2.0 * signX;
  4469. } else if ( absV.y >= almostOne ) {
  4470. float signY = sign( v.y );
  4471. planar.x = v.x + 2.0 * signY + 2.0;
  4472. planar.y = v.z * signY - 2.0;
  4473. }
  4474. // Transform to UV space
  4475. // scale := 0.5 / dim
  4476. // translate := ( center + 0.5 ) / dim
  4477. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  4478. }
  4479. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  4480. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  4481. // for point lights, the uniform @vShadowCoord is re-purposed to hold
  4482. // the vector from the light to the world-space position of the fragment.
  4483. vec3 lightToPosition = shadowCoord.xyz;
  4484. // dp = normalized distance from light to fragment position
  4485. float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?
  4486. dp += shadowBias;
  4487. // bd3D = base direction 3D
  4488. vec3 bd3D = normalize( lightToPosition );
  4489. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  4490. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  4491. return (
  4492. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  4493. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  4494. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  4495. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  4496. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  4497. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  4498. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  4499. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  4500. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  4501. ) * ( 1.0 / 9.0 );
  4502. #else // no percentage-closer filtering
  4503. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  4504. #endif
  4505. }
  4506. #endif
  4507. `;var Dte=`
  4508. #if NUM_SPOT_LIGHT_COORDS > 0
  4509. uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  4510. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  4511. #endif
  4512. #ifdef USE_SHADOWMAP
  4513. #if NUM_DIR_LIGHT_SHADOWS > 0
  4514. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  4515. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  4516. struct DirectionalLightShadow {
  4517. float shadowBias;
  4518. float shadowNormalBias;
  4519. float shadowRadius;
  4520. vec2 shadowMapSize;
  4521. };
  4522. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  4523. #endif
  4524. #if NUM_SPOT_LIGHT_SHADOWS > 0
  4525. struct SpotLightShadow {
  4526. float shadowBias;
  4527. float shadowNormalBias;
  4528. float shadowRadius;
  4529. vec2 shadowMapSize;
  4530. };
  4531. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  4532. #endif
  4533. #if NUM_POINT_LIGHT_SHADOWS > 0
  4534. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  4535. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  4536. struct PointLightShadow {
  4537. float shadowBias;
  4538. float shadowNormalBias;
  4539. float shadowRadius;
  4540. vec2 shadowMapSize;
  4541. float shadowCameraNear;
  4542. float shadowCameraFar;
  4543. };
  4544. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  4545. #endif
  4546. /*
  4547. #if NUM_RECT_AREA_LIGHTS > 0
  4548. // TODO (abelnation): uniforms for area light shadows
  4549. #endif
  4550. */
  4551. #endif
  4552. `;var Ite=`
  4553. #if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
  4554. // Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.
  4555. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  4556. vec4 shadowWorldPosition;
  4557. #endif
  4558. #if defined( USE_SHADOWMAP )
  4559. #if NUM_DIR_LIGHT_SHADOWS > 0
  4560. #pragma unroll_loop_start
  4561. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  4562. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  4563. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  4564. }
  4565. #pragma unroll_loop_end
  4566. #endif
  4567. #if NUM_POINT_LIGHT_SHADOWS > 0
  4568. #pragma unroll_loop_start
  4569. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  4570. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  4571. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  4572. }
  4573. #pragma unroll_loop_end
  4574. #endif
  4575. /*
  4576. #if NUM_RECT_AREA_LIGHTS > 0
  4577. // TODO (abelnation): update vAreaShadowCoord with area light info
  4578. #endif
  4579. */
  4580. #endif
  4581. // spot lights can be evaluated without active shadow mapping (when SpotLight.map is used)
  4582. #if NUM_SPOT_LIGHT_COORDS > 0
  4583. #pragma unroll_loop_start
  4584. for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
  4585. shadowWorldPosition = worldPosition;
  4586. #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  4587. shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
  4588. #endif
  4589. vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
  4590. }
  4591. #pragma unroll_loop_end
  4592. #endif
  4593. `;var Nte=`
  4594. float getShadowMask() {
  4595. float shadow = 1.0;
  4596. #ifdef USE_SHADOWMAP
  4597. #if NUM_DIR_LIGHT_SHADOWS > 0
  4598. DirectionalLightShadow directionalLight;
  4599. #pragma unroll_loop_start
  4600. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  4601. directionalLight = directionalLightShadows[ i ];
  4602. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  4603. }
  4604. #pragma unroll_loop_end
  4605. #endif
  4606. #if NUM_SPOT_LIGHT_SHADOWS > 0
  4607. SpotLightShadow spotLight;
  4608. #pragma unroll_loop_start
  4609. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  4610. spotLight = spotLightShadows[ i ];
  4611. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  4612. }
  4613. #pragma unroll_loop_end
  4614. #endif
  4615. #if NUM_POINT_LIGHT_SHADOWS > 0
  4616. PointLightShadow pointLight;
  4617. #pragma unroll_loop_start
  4618. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  4619. pointLight = pointLightShadows[ i ];
  4620. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  4621. }
  4622. #pragma unroll_loop_end
  4623. #endif
  4624. /*
  4625. #if NUM_RECT_AREA_LIGHTS > 0
  4626. // TODO (abelnation): update shadow for Area light
  4627. #endif
  4628. */
  4629. #endif
  4630. return shadow;
  4631. }
  4632. `;var Ute=`
  4633. #ifdef USE_SKINNING
  4634. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  4635. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  4636. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  4637. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  4638. #endif
  4639. `;var Ote=`
  4640. #ifdef USE_SKINNING
  4641. uniform mat4 bindMatrix;
  4642. uniform mat4 bindMatrixInverse;
  4643. uniform highp sampler2D boneTexture;
  4644. mat4 getBoneMatrix( const in float i ) {
  4645. int size = textureSize( boneTexture, 0 ).x;
  4646. int j = int( i ) * 4;
  4647. int x = j % size;
  4648. int y = j / size;
  4649. vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
  4650. vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
  4651. vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
  4652. vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
  4653. return mat4( v1, v2, v3, v4 );
  4654. }
  4655. #endif
  4656. `;var Fte=`
  4657. #ifdef USE_SKINNING
  4658. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  4659. vec4 skinned = vec4( 0.0 );
  4660. skinned += boneMatX * skinVertex * skinWeight.x;
  4661. skinned += boneMatY * skinVertex * skinWeight.y;
  4662. skinned += boneMatZ * skinVertex * skinWeight.z;
  4663. skinned += boneMatW * skinVertex * skinWeight.w;
  4664. transformed = ( bindMatrixInverse * skinned ).xyz;
  4665. #endif
  4666. `;var zte=`
  4667. #ifdef USE_SKINNING
  4668. mat4 skinMatrix = mat4( 0.0 );
  4669. skinMatrix += skinWeight.x * boneMatX;
  4670. skinMatrix += skinWeight.y * boneMatY;
  4671. skinMatrix += skinWeight.z * boneMatZ;
  4672. skinMatrix += skinWeight.w * boneMatW;
  4673. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  4674. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  4675. #ifdef USE_TANGENT
  4676. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  4677. #endif
  4678. #endif
  4679. `;var Bte=`
  4680. float specularStrength;
  4681. #ifdef USE_SPECULARMAP
  4682. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  4683. specularStrength = texelSpecular.r;
  4684. #else
  4685. specularStrength = 1.0;
  4686. #endif
  4687. `;var kte=`
  4688. #ifdef USE_SPECULARMAP
  4689. uniform sampler2D specularMap;
  4690. #endif
  4691. `;var Vte=`
  4692. #if defined( TONE_MAPPING )
  4693. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  4694. #endif
  4695. `;var Gte=`
  4696. #ifndef saturate
  4697. // <common> may have defined saturate() already
  4698. #define saturate( a ) clamp( a, 0.0, 1.0 )
  4699. #endif
  4700. uniform float toneMappingExposure;
  4701. // exposure only
  4702. vec3 LinearToneMapping( vec3 color ) {
  4703. return saturate( toneMappingExposure * color );
  4704. }
  4705. // source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf
  4706. vec3 ReinhardToneMapping( vec3 color ) {
  4707. color *= toneMappingExposure;
  4708. return saturate( color / ( vec3( 1.0 ) + color ) );
  4709. }
  4710. // source: http://filmicworlds.com/blog/filmic-tonemapping-operators/
  4711. vec3 OptimizedCineonToneMapping( vec3 color ) {
  4712. // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson
  4713. color *= toneMappingExposure;
  4714. color = max( vec3( 0.0 ), color - 0.004 );
  4715. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  4716. }
  4717. // source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
  4718. vec3 RRTAndODTFit( vec3 v ) {
  4719. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  4720. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  4721. return a / b;
  4722. }
  4723. // this implementation of ACES is modified to accommodate a brighter viewing environment.
  4724. // the scale factor of 1/0.6 is subjective. see discussion in #19621.
  4725. vec3 ACESFilmicToneMapping( vec3 color ) {
  4726. // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
  4727. const mat3 ACESInputMat = mat3(
  4728. vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source
  4729. vec3( 0.35458, 0.90834, 0.13383 ),
  4730. vec3( 0.04823, 0.01566, 0.83777 )
  4731. );
  4732. // ODT_SAT => XYZ => D60_2_D65 => sRGB
  4733. const mat3 ACESOutputMat = mat3(
  4734. vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source
  4735. vec3( -0.53108, 1.10813, -0.07276 ),
  4736. vec3( -0.07367, -0.00605, 1.07602 )
  4737. );
  4738. color *= toneMappingExposure / 0.6;
  4739. color = ACESInputMat * color;
  4740. // Apply RRT and ODT
  4741. color = RRTAndODTFit( color );
  4742. color = ACESOutputMat * color;
  4743. // Clamp to [0, 1]
  4744. return saturate( color );
  4745. }
  4746. // Matrices for rec 2020 <> rec 709 color space conversion
  4747. // matrix provided in row-major order so it has been transposed
  4748. // https://www.itu.int/pub/R-REP-BT.2407-2017
  4749. const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
  4750. vec3( 1.6605, - 0.1246, - 0.0182 ),
  4751. vec3( - 0.5876, 1.1329, - 0.1006 ),
  4752. vec3( - 0.0728, - 0.0083, 1.1187 )
  4753. );
  4754. const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
  4755. vec3( 0.6274, 0.0691, 0.0164 ),
  4756. vec3( 0.3293, 0.9195, 0.0880 ),
  4757. vec3( 0.0433, 0.0113, 0.8956 )
  4758. );
  4759. // https://iolite-engine.com/blog_posts/minimal_agx_implementation
  4760. // Mean error^2: 3.6705141e-06
  4761. vec3 agxDefaultContrastApprox( vec3 x ) {
  4762. vec3 x2 = x * x;
  4763. vec3 x4 = x2 * x2;
  4764. return + 15.5 * x4 * x2
  4765. - 40.14 * x4 * x
  4766. + 31.96 * x4
  4767. - 6.868 * x2 * x
  4768. + 0.4298 * x2
  4769. + 0.1191 * x
  4770. - 0.00232;
  4771. }
  4772. // AgX Tone Mapping implementation based on Filament, which in turn is based
  4773. // on Blender's implementation using rec 2020 primaries
  4774. // https://github.com/google/filament/pull/7236
  4775. // Inputs and outputs are encoded as Linear-sRGB.
  4776. vec3 AgXToneMapping( vec3 color ) {
  4777. // AgX constants
  4778. const mat3 AgXInsetMatrix = mat3(
  4779. vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
  4780. vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
  4781. vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
  4782. );
  4783. // explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv
  4784. const mat3 AgXOutsetMatrix = mat3(
  4785. vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
  4786. vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
  4787. vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
  4788. );
  4789. // LOG2_MIN = -10.0
  4790. // LOG2_MAX = +6.5
  4791. // MIDDLE_GRAY = 0.18
  4792. const float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY )
  4793. const float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY )
  4794. color *= toneMappingExposure;
  4795. color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
  4796. color = AgXInsetMatrix * color;
  4797. // Log2 encoding
  4798. color = max( color, 1e-10 ); // avoid 0 or negative numbers for log2
  4799. color = log2( color );
  4800. color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
  4801. color = clamp( color, 0.0, 1.0 );
  4802. // Apply sigmoid
  4803. color = agxDefaultContrastApprox( color );
  4804. // Apply AgX look
  4805. // v = agxLook(v, look);
  4806. color = AgXOutsetMatrix * color;
  4807. // Linearize
  4808. color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
  4809. color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
  4810. // Gamut mapping. Simple clamp for now.
  4811. color = clamp( color, 0.0, 1.0 );
  4812. return color;
  4813. }
  4814. // https://modelviewer.dev/examples/tone-mapping
  4815. vec3 NeutralToneMapping( vec3 color ) {
  4816. float startCompression = 0.8 - 0.04;
  4817. float desaturation = 0.15;
  4818. color *= toneMappingExposure;
  4819. float x = min(color.r, min(color.g, color.b));
  4820. float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
  4821. color -= offset;
  4822. float peak = max(color.r, max(color.g, color.b));
  4823. if (peak < startCompression) return color;
  4824. float d = 1. - startCompression;
  4825. float newPeak = 1. - d * d / (peak + d - startCompression);
  4826. color *= newPeak / peak;
  4827. float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
  4828. return mix(color, vec3(1, 1, 1), g);
  4829. }
  4830. vec3 CustomToneMapping( vec3 color ) { return color; }
  4831. `;var Hte=`
  4832. #ifdef USE_TRANSMISSION
  4833. material.transmission = transmission;
  4834. material.transmissionAlpha = 1.0;
  4835. material.thickness = thickness;
  4836. material.attenuationDistance = attenuationDistance;
  4837. material.attenuationColor = attenuationColor;
  4838. #ifdef USE_TRANSMISSIONMAP
  4839. material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
  4840. #endif
  4841. #ifdef USE_THICKNESSMAP
  4842. material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
  4843. #endif
  4844. vec3 pos = vWorldPosition;
  4845. vec3 v = normalize( cameraPosition - pos );
  4846. vec3 n = inverseTransformDirection( normal, viewMatrix );
  4847. vec4 transmitted = getIBLVolumeRefraction(
  4848. n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  4849. pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
  4850. material.attenuationColor, material.attenuationDistance );
  4851. material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
  4852. totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
  4853. #endif
  4854. `;var Wte=`
  4855. #ifdef USE_TRANSMISSION
  4856. // Transmission code is based on glTF-Sampler-Viewer
  4857. // https://github.com/KhronosGroup/glTF-Sample-Viewer
  4858. uniform float transmission;
  4859. uniform float thickness;
  4860. uniform float attenuationDistance;
  4861. uniform vec3 attenuationColor;
  4862. #ifdef USE_TRANSMISSIONMAP
  4863. uniform sampler2D transmissionMap;
  4864. #endif
  4865. #ifdef USE_THICKNESSMAP
  4866. uniform sampler2D thicknessMap;
  4867. #endif
  4868. uniform vec2 transmissionSamplerSize;
  4869. uniform sampler2D transmissionSamplerMap;
  4870. uniform mat4 modelMatrix;
  4871. uniform mat4 projectionMatrix;
  4872. varying vec3 vWorldPosition;
  4873. // Mipped Bicubic Texture Filtering by N8
  4874. // https://www.shadertoy.com/view/Dl2SDW
  4875. float w0( float a ) {
  4876. return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
  4877. }
  4878. float w1( float a ) {
  4879. return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
  4880. }
  4881. float w2( float a ){
  4882. return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
  4883. }
  4884. float w3( float a ) {
  4885. return ( 1.0 / 6.0 ) * ( a * a * a );
  4886. }
  4887. // g0 and g1 are the two amplitude functions
  4888. float g0( float a ) {
  4889. return w0( a ) + w1( a );
  4890. }
  4891. float g1( float a ) {
  4892. return w2( a ) + w3( a );
  4893. }
  4894. // h0 and h1 are the two offset functions
  4895. float h0( float a ) {
  4896. return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
  4897. }
  4898. float h1( float a ) {
  4899. return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
  4900. }
  4901. vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
  4902. uv = uv * texelSize.zw + 0.5;
  4903. vec2 iuv = floor( uv );
  4904. vec2 fuv = fract( uv );
  4905. float g0x = g0( fuv.x );
  4906. float g1x = g1( fuv.x );
  4907. float h0x = h0( fuv.x );
  4908. float h1x = h1( fuv.x );
  4909. float h0y = h0( fuv.y );
  4910. float h1y = h1( fuv.y );
  4911. vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  4912. vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  4913. vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  4914. vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  4915. return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
  4916. g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
  4917. }
  4918. vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
  4919. vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
  4920. vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
  4921. vec2 fLodSizeInv = 1.0 / fLodSize;
  4922. vec2 cLodSizeInv = 1.0 / cLodSize;
  4923. vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
  4924. vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
  4925. return mix( fSample, cSample, fract( lod ) );
  4926. }
  4927. vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
  4928. // Direction of refracted light.
  4929. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
  4930. // Compute rotation-independant scaling of the model matrix.
  4931. vec3 modelScale;
  4932. modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
  4933. modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
  4934. modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
  4935. // The thickness is specified in local space.
  4936. return normalize( refractionVector ) * thickness * modelScale;
  4937. }
  4938. float applyIorToRoughness( const in float roughness, const in float ior ) {
  4939. // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
  4940. // an IOR of 1.5 results in the default amount of microfacet refraction.
  4941. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
  4942. }
  4943. vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
  4944. float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
  4945. return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
  4946. }
  4947. vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
  4948. if ( isinf( attenuationDistance ) ) {
  4949. // Attenuation distance is +\u221E, i.e. the transmitted color is not attenuated at all.
  4950. return vec3( 1.0 );
  4951. } else {
  4952. // Compute light attenuation using Beer's law.
  4953. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
  4954. vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law
  4955. return transmittance;
  4956. }
  4957. }
  4958. vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
  4959. const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
  4960. const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
  4961. const in vec3 attenuationColor, const in float attenuationDistance ) {
  4962. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
  4963. vec3 refractedRayExit = position + transmissionRay;
  4964. // Project refracted vector on the framebuffer, while mapping to normalized device coordinates.
  4965. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  4966. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  4967. refractionCoords += 1.0;
  4968. refractionCoords /= 2.0;
  4969. // Sample framebuffer to get pixel the refracted ray hits.
  4970. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
  4971. vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
  4972. vec3 attenuatedColor = transmittance * transmittedLight.rgb;
  4973. // Get the specular component.
  4974. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
  4975. // As less light is transmitted, the opacity should be increased. This simple approximation does a decent job
  4976. // of modulating a CSS background, and has no effect when the buffer is opaque, due to a solid object or clear color.
  4977. float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
  4978. return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
  4979. }
  4980. #endif
  4981. `;var Xte=`
  4982. #if defined( USE_UV ) || defined( USE_ANISOTROPY )
  4983. varying vec2 vUv;
  4984. #endif
  4985. #ifdef USE_MAP
  4986. varying vec2 vMapUv;
  4987. #endif
  4988. #ifdef USE_ALPHAMAP
  4989. varying vec2 vAlphaMapUv;
  4990. #endif
  4991. #ifdef USE_LIGHTMAP
  4992. varying vec2 vLightMapUv;
  4993. #endif
  4994. #ifdef USE_AOMAP
  4995. varying vec2 vAoMapUv;
  4996. #endif
  4997. #ifdef USE_BUMPMAP
  4998. varying vec2 vBumpMapUv;
  4999. #endif
  5000. #ifdef USE_NORMALMAP
  5001. varying vec2 vNormalMapUv;
  5002. #endif
  5003. #ifdef USE_EMISSIVEMAP
  5004. varying vec2 vEmissiveMapUv;
  5005. #endif
  5006. #ifdef USE_METALNESSMAP
  5007. varying vec2 vMetalnessMapUv;
  5008. #endif
  5009. #ifdef USE_ROUGHNESSMAP
  5010. varying vec2 vRoughnessMapUv;
  5011. #endif
  5012. #ifdef USE_ANISOTROPYMAP
  5013. varying vec2 vAnisotropyMapUv;
  5014. #endif
  5015. #ifdef USE_CLEARCOATMAP
  5016. varying vec2 vClearcoatMapUv;
  5017. #endif
  5018. #ifdef USE_CLEARCOAT_NORMALMAP
  5019. varying vec2 vClearcoatNormalMapUv;
  5020. #endif
  5021. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  5022. varying vec2 vClearcoatRoughnessMapUv;
  5023. #endif
  5024. #ifdef USE_IRIDESCENCEMAP
  5025. varying vec2 vIridescenceMapUv;
  5026. #endif
  5027. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5028. varying vec2 vIridescenceThicknessMapUv;
  5029. #endif
  5030. #ifdef USE_SHEEN_COLORMAP
  5031. varying vec2 vSheenColorMapUv;
  5032. #endif
  5033. #ifdef USE_SHEEN_ROUGHNESSMAP
  5034. varying vec2 vSheenRoughnessMapUv;
  5035. #endif
  5036. #ifdef USE_SPECULARMAP
  5037. varying vec2 vSpecularMapUv;
  5038. #endif
  5039. #ifdef USE_SPECULAR_COLORMAP
  5040. varying vec2 vSpecularColorMapUv;
  5041. #endif
  5042. #ifdef USE_SPECULAR_INTENSITYMAP
  5043. varying vec2 vSpecularIntensityMapUv;
  5044. #endif
  5045. #ifdef USE_TRANSMISSIONMAP
  5046. uniform mat3 transmissionMapTransform;
  5047. varying vec2 vTransmissionMapUv;
  5048. #endif
  5049. #ifdef USE_THICKNESSMAP
  5050. uniform mat3 thicknessMapTransform;
  5051. varying vec2 vThicknessMapUv;
  5052. #endif
  5053. `;var Yte=`
  5054. #if defined( USE_UV ) || defined( USE_ANISOTROPY )
  5055. varying vec2 vUv;
  5056. #endif
  5057. #ifdef USE_MAP
  5058. uniform mat3 mapTransform;
  5059. varying vec2 vMapUv;
  5060. #endif
  5061. #ifdef USE_ALPHAMAP
  5062. uniform mat3 alphaMapTransform;
  5063. varying vec2 vAlphaMapUv;
  5064. #endif
  5065. #ifdef USE_LIGHTMAP
  5066. uniform mat3 lightMapTransform;
  5067. varying vec2 vLightMapUv;
  5068. #endif
  5069. #ifdef USE_AOMAP
  5070. uniform mat3 aoMapTransform;
  5071. varying vec2 vAoMapUv;
  5072. #endif
  5073. #ifdef USE_BUMPMAP
  5074. uniform mat3 bumpMapTransform;
  5075. varying vec2 vBumpMapUv;
  5076. #endif
  5077. #ifdef USE_NORMALMAP
  5078. uniform mat3 normalMapTransform;
  5079. varying vec2 vNormalMapUv;
  5080. #endif
  5081. #ifdef USE_DISPLACEMENTMAP
  5082. uniform mat3 displacementMapTransform;
  5083. varying vec2 vDisplacementMapUv;
  5084. #endif
  5085. #ifdef USE_EMISSIVEMAP
  5086. uniform mat3 emissiveMapTransform;
  5087. varying vec2 vEmissiveMapUv;
  5088. #endif
  5089. #ifdef USE_METALNESSMAP
  5090. uniform mat3 metalnessMapTransform;
  5091. varying vec2 vMetalnessMapUv;
  5092. #endif
  5093. #ifdef USE_ROUGHNESSMAP
  5094. uniform mat3 roughnessMapTransform;
  5095. varying vec2 vRoughnessMapUv;
  5096. #endif
  5097. #ifdef USE_ANISOTROPYMAP
  5098. uniform mat3 anisotropyMapTransform;
  5099. varying vec2 vAnisotropyMapUv;
  5100. #endif
  5101. #ifdef USE_CLEARCOATMAP
  5102. uniform mat3 clearcoatMapTransform;
  5103. varying vec2 vClearcoatMapUv;
  5104. #endif
  5105. #ifdef USE_CLEARCOAT_NORMALMAP
  5106. uniform mat3 clearcoatNormalMapTransform;
  5107. varying vec2 vClearcoatNormalMapUv;
  5108. #endif
  5109. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  5110. uniform mat3 clearcoatRoughnessMapTransform;
  5111. varying vec2 vClearcoatRoughnessMapUv;
  5112. #endif
  5113. #ifdef USE_SHEEN_COLORMAP
  5114. uniform mat3 sheenColorMapTransform;
  5115. varying vec2 vSheenColorMapUv;
  5116. #endif
  5117. #ifdef USE_SHEEN_ROUGHNESSMAP
  5118. uniform mat3 sheenRoughnessMapTransform;
  5119. varying vec2 vSheenRoughnessMapUv;
  5120. #endif
  5121. #ifdef USE_IRIDESCENCEMAP
  5122. uniform mat3 iridescenceMapTransform;
  5123. varying vec2 vIridescenceMapUv;
  5124. #endif
  5125. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5126. uniform mat3 iridescenceThicknessMapTransform;
  5127. varying vec2 vIridescenceThicknessMapUv;
  5128. #endif
  5129. #ifdef USE_SPECULARMAP
  5130. uniform mat3 specularMapTransform;
  5131. varying vec2 vSpecularMapUv;
  5132. #endif
  5133. #ifdef USE_SPECULAR_COLORMAP
  5134. uniform mat3 specularColorMapTransform;
  5135. varying vec2 vSpecularColorMapUv;
  5136. #endif
  5137. #ifdef USE_SPECULAR_INTENSITYMAP
  5138. uniform mat3 specularIntensityMapTransform;
  5139. varying vec2 vSpecularIntensityMapUv;
  5140. #endif
  5141. #ifdef USE_TRANSMISSIONMAP
  5142. uniform mat3 transmissionMapTransform;
  5143. varying vec2 vTransmissionMapUv;
  5144. #endif
  5145. #ifdef USE_THICKNESSMAP
  5146. uniform mat3 thicknessMapTransform;
  5147. varying vec2 vThicknessMapUv;
  5148. #endif
  5149. `;var qte=`
  5150. #if defined( USE_UV ) || defined( USE_ANISOTROPY )
  5151. vUv = vec3( uv, 1 ).xy;
  5152. #endif
  5153. #ifdef USE_MAP
  5154. vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  5155. #endif
  5156. #ifdef USE_ALPHAMAP
  5157. vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  5158. #endif
  5159. #ifdef USE_LIGHTMAP
  5160. vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
  5161. #endif
  5162. #ifdef USE_AOMAP
  5163. vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
  5164. #endif
  5165. #ifdef USE_BUMPMAP
  5166. vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
  5167. #endif
  5168. #ifdef USE_NORMALMAP
  5169. vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
  5170. #endif
  5171. #ifdef USE_DISPLACEMENTMAP
  5172. vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
  5173. #endif
  5174. #ifdef USE_EMISSIVEMAP
  5175. vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
  5176. #endif
  5177. #ifdef USE_METALNESSMAP
  5178. vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
  5179. #endif
  5180. #ifdef USE_ROUGHNESSMAP
  5181. vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
  5182. #endif
  5183. #ifdef USE_ANISOTROPYMAP
  5184. vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
  5185. #endif
  5186. #ifdef USE_CLEARCOATMAP
  5187. vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
  5188. #endif
  5189. #ifdef USE_CLEARCOAT_NORMALMAP
  5190. vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
  5191. #endif
  5192. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  5193. vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
  5194. #endif
  5195. #ifdef USE_IRIDESCENCEMAP
  5196. vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
  5197. #endif
  5198. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5199. vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
  5200. #endif
  5201. #ifdef USE_SHEEN_COLORMAP
  5202. vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
  5203. #endif
  5204. #ifdef USE_SHEEN_ROUGHNESSMAP
  5205. vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
  5206. #endif
  5207. #ifdef USE_SPECULARMAP
  5208. vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
  5209. #endif
  5210. #ifdef USE_SPECULAR_COLORMAP
  5211. vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
  5212. #endif
  5213. #ifdef USE_SPECULAR_INTENSITYMAP
  5214. vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
  5215. #endif
  5216. #ifdef USE_TRANSMISSIONMAP
  5217. vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
  5218. #endif
  5219. #ifdef USE_THICKNESSMAP
  5220. vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
  5221. #endif
  5222. `;var Zte=`
  5223. #if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
  5224. vec4 worldPosition = vec4( transformed, 1.0 );
  5225. #ifdef USE_BATCHING
  5226. worldPosition = batchingMatrix * worldPosition;
  5227. #endif
  5228. #ifdef USE_INSTANCING
  5229. worldPosition = instanceMatrix * worldPosition;
  5230. #endif
  5231. worldPosition = modelMatrix * worldPosition;
  5232. #endif
  5233. `;var jte=`
  5234. varying vec2 vUv;
  5235. uniform mat3 uvTransform;
  5236. void main() {
  5237. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  5238. gl_Position = vec4( position.xy, 1.0, 1.0 );
  5239. }
  5240. `,Kte=`
  5241. uniform sampler2D t2D;
  5242. uniform float backgroundIntensity;
  5243. varying vec2 vUv;
  5244. void main() {
  5245. vec4 texColor = texture2D( t2D, vUv );
  5246. #ifdef DECODE_VIDEO_TEXTURE
  5247. // use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures
  5248. texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
  5249. #endif
  5250. texColor.rgb *= backgroundIntensity;
  5251. gl_FragColor = texColor;
  5252. #include <tonemapping_fragment>
  5253. #include <colorspace_fragment>
  5254. }
  5255. `;var Jte=`
  5256. varying vec3 vWorldDirection;
  5257. #include <common>
  5258. void main() {
  5259. vWorldDirection = transformDirection( position, modelMatrix );
  5260. #include <begin_vertex>
  5261. #include <project_vertex>
  5262. gl_Position.z = gl_Position.w; // set z to camera.far
  5263. }
  5264. `,$te=`
  5265. #ifdef ENVMAP_TYPE_CUBE
  5266. uniform samplerCube envMap;
  5267. #elif defined( ENVMAP_TYPE_CUBE_UV )
  5268. uniform sampler2D envMap;
  5269. #endif
  5270. uniform float flipEnvMap;
  5271. uniform float backgroundBlurriness;
  5272. uniform float backgroundIntensity;
  5273. uniform mat3 backgroundRotation;
  5274. varying vec3 vWorldDirection;
  5275. #include <cube_uv_reflection_fragment>
  5276. void main() {
  5277. #ifdef ENVMAP_TYPE_CUBE
  5278. vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
  5279. #elif defined( ENVMAP_TYPE_CUBE_UV )
  5280. vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
  5281. #else
  5282. vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  5283. #endif
  5284. texColor.rgb *= backgroundIntensity;
  5285. gl_FragColor = texColor;
  5286. #include <tonemapping_fragment>
  5287. #include <colorspace_fragment>
  5288. }
  5289. `;var Qte=`
  5290. varying vec3 vWorldDirection;
  5291. #include <common>
  5292. void main() {
  5293. vWorldDirection = transformDirection( position, modelMatrix );
  5294. #include <begin_vertex>
  5295. #include <project_vertex>
  5296. gl_Position.z = gl_Position.w; // set z to camera.far
  5297. }
  5298. `,ere=`
  5299. uniform samplerCube tCube;
  5300. uniform float tFlip;
  5301. uniform float opacity;
  5302. varying vec3 vWorldDirection;
  5303. void main() {
  5304. vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
  5305. gl_FragColor = texColor;
  5306. gl_FragColor.a *= opacity;
  5307. #include <tonemapping_fragment>
  5308. #include <colorspace_fragment>
  5309. }
  5310. `;var tre=`
  5311. #include <common>
  5312. #include <batching_pars_vertex>
  5313. #include <uv_pars_vertex>
  5314. #include <displacementmap_pars_vertex>
  5315. #include <morphtarget_pars_vertex>
  5316. #include <skinning_pars_vertex>
  5317. #include <logdepthbuf_pars_vertex>
  5318. #include <clipping_planes_pars_vertex>
  5319. // This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.
  5320. // Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for
  5321. // depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.
  5322. varying vec2 vHighPrecisionZW;
  5323. void main() {
  5324. #include <uv_vertex>
  5325. #include <batching_vertex>
  5326. #include <skinbase_vertex>
  5327. #include <morphinstance_vertex>
  5328. #ifdef USE_DISPLACEMENTMAP
  5329. #include <beginnormal_vertex>
  5330. #include <morphnormal_vertex>
  5331. #include <skinnormal_vertex>
  5332. #endif
  5333. #include <begin_vertex>
  5334. #include <morphtarget_vertex>
  5335. #include <skinning_vertex>
  5336. #include <displacementmap_vertex>
  5337. #include <project_vertex>
  5338. #include <logdepthbuf_vertex>
  5339. #include <clipping_planes_vertex>
  5340. vHighPrecisionZW = gl_Position.zw;
  5341. }
  5342. `,rre=`
  5343. #if DEPTH_PACKING == 3200
  5344. uniform float opacity;
  5345. #endif
  5346. #include <common>
  5347. #include <packing>
  5348. #include <uv_pars_fragment>
  5349. #include <map_pars_fragment>
  5350. #include <alphamap_pars_fragment>
  5351. #include <alphatest_pars_fragment>
  5352. #include <alphahash_pars_fragment>
  5353. #include <logdepthbuf_pars_fragment>
  5354. #include <clipping_planes_pars_fragment>
  5355. varying vec2 vHighPrecisionZW;
  5356. void main() {
  5357. vec4 diffuseColor = vec4( 1.0 );
  5358. #include <clipping_planes_fragment>
  5359. #if DEPTH_PACKING == 3200
  5360. diffuseColor.a = opacity;
  5361. #endif
  5362. #include <map_fragment>
  5363. #include <alphamap_fragment>
  5364. #include <alphatest_fragment>
  5365. #include <alphahash_fragment>
  5366. #include <logdepthbuf_fragment>
  5367. // Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.
  5368. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
  5369. #if DEPTH_PACKING == 3200
  5370. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  5371. #elif DEPTH_PACKING == 3201
  5372. gl_FragColor = packDepthToRGBA( fragCoordZ );
  5373. #endif
  5374. }
  5375. `;var ire=`
  5376. #define DISTANCE
  5377. varying vec3 vWorldPosition;
  5378. #include <common>
  5379. #include <batching_pars_vertex>
  5380. #include <uv_pars_vertex>
  5381. #include <displacementmap_pars_vertex>
  5382. #include <morphtarget_pars_vertex>
  5383. #include <skinning_pars_vertex>
  5384. #include <clipping_planes_pars_vertex>
  5385. void main() {
  5386. #include <uv_vertex>
  5387. #include <batching_vertex>
  5388. #include <skinbase_vertex>
  5389. #include <morphinstance_vertex>
  5390. #ifdef USE_DISPLACEMENTMAP
  5391. #include <beginnormal_vertex>
  5392. #include <morphnormal_vertex>
  5393. #include <skinnormal_vertex>
  5394. #endif
  5395. #include <begin_vertex>
  5396. #include <morphtarget_vertex>
  5397. #include <skinning_vertex>
  5398. #include <displacementmap_vertex>
  5399. #include <project_vertex>
  5400. #include <worldpos_vertex>
  5401. #include <clipping_planes_vertex>
  5402. vWorldPosition = worldPosition.xyz;
  5403. }
  5404. `,nre=`
  5405. #define DISTANCE
  5406. uniform vec3 referencePosition;
  5407. uniform float nearDistance;
  5408. uniform float farDistance;
  5409. varying vec3 vWorldPosition;
  5410. #include <common>
  5411. #include <packing>
  5412. #include <uv_pars_fragment>
  5413. #include <map_pars_fragment>
  5414. #include <alphamap_pars_fragment>
  5415. #include <alphatest_pars_fragment>
  5416. #include <alphahash_pars_fragment>
  5417. #include <clipping_planes_pars_fragment>
  5418. void main () {
  5419. vec4 diffuseColor = vec4( 1.0 );
  5420. #include <clipping_planes_fragment>
  5421. #include <map_fragment>
  5422. #include <alphamap_fragment>
  5423. #include <alphatest_fragment>
  5424. #include <alphahash_fragment>
  5425. float dist = length( vWorldPosition - referencePosition );
  5426. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  5427. dist = saturate( dist ); // clamp to [ 0, 1 ]
  5428. gl_FragColor = packDepthToRGBA( dist );
  5429. }
  5430. `;var are=`
  5431. varying vec3 vWorldDirection;
  5432. #include <common>
  5433. void main() {
  5434. vWorldDirection = transformDirection( position, modelMatrix );
  5435. #include <begin_vertex>
  5436. #include <project_vertex>
  5437. }
  5438. `,ore=`
  5439. uniform sampler2D tEquirect;
  5440. varying vec3 vWorldDirection;
  5441. #include <common>
  5442. void main() {
  5443. vec3 direction = normalize( vWorldDirection );
  5444. vec2 sampleUV = equirectUv( direction );
  5445. gl_FragColor = texture2D( tEquirect, sampleUV );
  5446. #include <tonemapping_fragment>
  5447. #include <colorspace_fragment>
  5448. }
  5449. `;var sre=`
  5450. uniform float scale;
  5451. attribute float lineDistance;
  5452. varying float vLineDistance;
  5453. #include <common>
  5454. #include <uv_pars_vertex>
  5455. #include <color_pars_vertex>
  5456. #include <fog_pars_vertex>
  5457. #include <morphtarget_pars_vertex>
  5458. #include <logdepthbuf_pars_vertex>
  5459. #include <clipping_planes_pars_vertex>
  5460. void main() {
  5461. vLineDistance = scale * lineDistance;
  5462. #include <uv_vertex>
  5463. #include <color_vertex>
  5464. #include <morphinstance_vertex>
  5465. #include <morphcolor_vertex>
  5466. #include <begin_vertex>
  5467. #include <morphtarget_vertex>
  5468. #include <project_vertex>
  5469. #include <logdepthbuf_vertex>
  5470. #include <clipping_planes_vertex>
  5471. #include <fog_vertex>
  5472. }
  5473. `,lre=`
  5474. uniform vec3 diffuse;
  5475. uniform float opacity;
  5476. uniform float dashSize;
  5477. uniform float totalSize;
  5478. varying float vLineDistance;
  5479. #include <common>
  5480. #include <color_pars_fragment>
  5481. #include <uv_pars_fragment>
  5482. #include <map_pars_fragment>
  5483. #include <fog_pars_fragment>
  5484. #include <logdepthbuf_pars_fragment>
  5485. #include <clipping_planes_pars_fragment>
  5486. void main() {
  5487. vec4 diffuseColor = vec4( diffuse, opacity );
  5488. #include <clipping_planes_fragment>
  5489. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  5490. discard;
  5491. }
  5492. vec3 outgoingLight = vec3( 0.0 );
  5493. #include <logdepthbuf_fragment>
  5494. #include <map_fragment>
  5495. #include <color_fragment>
  5496. outgoingLight = diffuseColor.rgb; // simple shader
  5497. #include <opaque_fragment>
  5498. #include <tonemapping_fragment>
  5499. #include <colorspace_fragment>
  5500. #include <fog_fragment>
  5501. #include <premultiplied_alpha_fragment>
  5502. }
  5503. `;var ure=`
  5504. #include <common>
  5505. #include <batching_pars_vertex>
  5506. #include <uv_pars_vertex>
  5507. #include <envmap_pars_vertex>
  5508. #include <color_pars_vertex>
  5509. #include <fog_pars_vertex>
  5510. #include <morphtarget_pars_vertex>
  5511. #include <skinning_pars_vertex>
  5512. #include <logdepthbuf_pars_vertex>
  5513. #include <clipping_planes_pars_vertex>
  5514. void main() {
  5515. #include <uv_vertex>
  5516. #include <color_vertex>
  5517. #include <morphinstance_vertex>
  5518. #include <morphcolor_vertex>
  5519. #include <batching_vertex>
  5520. #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
  5521. #include <beginnormal_vertex>
  5522. #include <morphnormal_vertex>
  5523. #include <skinbase_vertex>
  5524. #include <skinnormal_vertex>
  5525. #include <defaultnormal_vertex>
  5526. #endif
  5527. #include <begin_vertex>
  5528. #include <morphtarget_vertex>
  5529. #include <skinning_vertex>
  5530. #include <project_vertex>
  5531. #include <logdepthbuf_vertex>
  5532. #include <clipping_planes_vertex>
  5533. #include <worldpos_vertex>
  5534. #include <envmap_vertex>
  5535. #include <fog_vertex>
  5536. }
  5537. `,cre=`
  5538. uniform vec3 diffuse;
  5539. uniform float opacity;
  5540. #ifndef FLAT_SHADED
  5541. varying vec3 vNormal;
  5542. #endif
  5543. #include <common>
  5544. #include <dithering_pars_fragment>
  5545. #include <color_pars_fragment>
  5546. #include <uv_pars_fragment>
  5547. #include <map_pars_fragment>
  5548. #include <alphamap_pars_fragment>
  5549. #include <alphatest_pars_fragment>
  5550. #include <alphahash_pars_fragment>
  5551. #include <aomap_pars_fragment>
  5552. #include <lightmap_pars_fragment>
  5553. #include <envmap_common_pars_fragment>
  5554. #include <envmap_pars_fragment>
  5555. #include <fog_pars_fragment>
  5556. #include <specularmap_pars_fragment>
  5557. #include <logdepthbuf_pars_fragment>
  5558. #include <clipping_planes_pars_fragment>
  5559. void main() {
  5560. vec4 diffuseColor = vec4( diffuse, opacity );
  5561. #include <clipping_planes_fragment>
  5562. #include <logdepthbuf_fragment>
  5563. #include <map_fragment>
  5564. #include <color_fragment>
  5565. #include <alphamap_fragment>
  5566. #include <alphatest_fragment>
  5567. #include <alphahash_fragment>
  5568. #include <specularmap_fragment>
  5569. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  5570. // accumulation (baked indirect lighting only)
  5571. #ifdef USE_LIGHTMAP
  5572. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  5573. reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
  5574. #else
  5575. reflectedLight.indirectDiffuse += vec3( 1.0 );
  5576. #endif
  5577. // modulation
  5578. #include <aomap_fragment>
  5579. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  5580. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  5581. #include <envmap_fragment>
  5582. #include <opaque_fragment>
  5583. #include <tonemapping_fragment>
  5584. #include <colorspace_fragment>
  5585. #include <fog_fragment>
  5586. #include <premultiplied_alpha_fragment>
  5587. #include <dithering_fragment>
  5588. }
  5589. `;var fre=`
  5590. #define LAMBERT
  5591. varying vec3 vViewPosition;
  5592. #include <common>
  5593. #include <batching_pars_vertex>
  5594. #include <uv_pars_vertex>
  5595. #include <displacementmap_pars_vertex>
  5596. #include <envmap_pars_vertex>
  5597. #include <color_pars_vertex>
  5598. #include <fog_pars_vertex>
  5599. #include <normal_pars_vertex>
  5600. #include <morphtarget_pars_vertex>
  5601. #include <skinning_pars_vertex>
  5602. #include <shadowmap_pars_vertex>
  5603. #include <logdepthbuf_pars_vertex>
  5604. #include <clipping_planes_pars_vertex>
  5605. void main() {
  5606. #include <uv_vertex>
  5607. #include <color_vertex>
  5608. #include <morphinstance_vertex>
  5609. #include <morphcolor_vertex>
  5610. #include <batching_vertex>
  5611. #include <beginnormal_vertex>
  5612. #include <morphnormal_vertex>
  5613. #include <skinbase_vertex>
  5614. #include <skinnormal_vertex>
  5615. #include <defaultnormal_vertex>
  5616. #include <normal_vertex>
  5617. #include <begin_vertex>
  5618. #include <morphtarget_vertex>
  5619. #include <skinning_vertex>
  5620. #include <displacementmap_vertex>
  5621. #include <project_vertex>
  5622. #include <logdepthbuf_vertex>
  5623. #include <clipping_planes_vertex>
  5624. vViewPosition = - mvPosition.xyz;
  5625. #include <worldpos_vertex>
  5626. #include <envmap_vertex>
  5627. #include <shadowmap_vertex>
  5628. #include <fog_vertex>
  5629. }
  5630. `,hre=`
  5631. #define LAMBERT
  5632. uniform vec3 diffuse;
  5633. uniform vec3 emissive;
  5634. uniform float opacity;
  5635. #include <common>
  5636. #include <packing>
  5637. #include <dithering_pars_fragment>
  5638. #include <color_pars_fragment>
  5639. #include <uv_pars_fragment>
  5640. #include <map_pars_fragment>
  5641. #include <alphamap_pars_fragment>
  5642. #include <alphatest_pars_fragment>
  5643. #include <alphahash_pars_fragment>
  5644. #include <aomap_pars_fragment>
  5645. #include <lightmap_pars_fragment>
  5646. #include <emissivemap_pars_fragment>
  5647. #include <envmap_common_pars_fragment>
  5648. #include <envmap_pars_fragment>
  5649. #include <fog_pars_fragment>
  5650. #include <bsdfs>
  5651. #include <lights_pars_begin>
  5652. #include <normal_pars_fragment>
  5653. #include <lights_lambert_pars_fragment>
  5654. #include <shadowmap_pars_fragment>
  5655. #include <bumpmap_pars_fragment>
  5656. #include <normalmap_pars_fragment>
  5657. #include <specularmap_pars_fragment>
  5658. #include <logdepthbuf_pars_fragment>
  5659. #include <clipping_planes_pars_fragment>
  5660. void main() {
  5661. vec4 diffuseColor = vec4( diffuse, opacity );
  5662. #include <clipping_planes_fragment>
  5663. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  5664. vec3 totalEmissiveRadiance = emissive;
  5665. #include <logdepthbuf_fragment>
  5666. #include <map_fragment>
  5667. #include <color_fragment>
  5668. #include <alphamap_fragment>
  5669. #include <alphatest_fragment>
  5670. #include <alphahash_fragment>
  5671. #include <specularmap_fragment>
  5672. #include <normal_fragment_begin>
  5673. #include <normal_fragment_maps>
  5674. #include <emissivemap_fragment>
  5675. // accumulation
  5676. #include <lights_lambert_fragment>
  5677. #include <lights_fragment_begin>
  5678. #include <lights_fragment_maps>
  5679. #include <lights_fragment_end>
  5680. // modulation
  5681. #include <aomap_fragment>
  5682. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  5683. #include <envmap_fragment>
  5684. #include <opaque_fragment>
  5685. #include <tonemapping_fragment>
  5686. #include <colorspace_fragment>
  5687. #include <fog_fragment>
  5688. #include <premultiplied_alpha_fragment>
  5689. #include <dithering_fragment>
  5690. }
  5691. `;var pre=`
  5692. #define MATCAP
  5693. varying vec3 vViewPosition;
  5694. #include <common>
  5695. #include <batching_pars_vertex>
  5696. #include <uv_pars_vertex>
  5697. #include <color_pars_vertex>
  5698. #include <displacementmap_pars_vertex>
  5699. #include <fog_pars_vertex>
  5700. #include <normal_pars_vertex>
  5701. #include <morphtarget_pars_vertex>
  5702. #include <skinning_pars_vertex>
  5703. #include <logdepthbuf_pars_vertex>
  5704. #include <clipping_planes_pars_vertex>
  5705. void main() {
  5706. #include <uv_vertex>
  5707. #include <color_vertex>
  5708. #include <morphinstance_vertex>
  5709. #include <morphcolor_vertex>
  5710. #include <batching_vertex>
  5711. #include <beginnormal_vertex>
  5712. #include <morphnormal_vertex>
  5713. #include <skinbase_vertex>
  5714. #include <skinnormal_vertex>
  5715. #include <defaultnormal_vertex>
  5716. #include <normal_vertex>
  5717. #include <begin_vertex>
  5718. #include <morphtarget_vertex>
  5719. #include <skinning_vertex>
  5720. #include <displacementmap_vertex>
  5721. #include <project_vertex>
  5722. #include <logdepthbuf_vertex>
  5723. #include <clipping_planes_vertex>
  5724. #include <fog_vertex>
  5725. vViewPosition = - mvPosition.xyz;
  5726. }
  5727. `,dre=`
  5728. #define MATCAP
  5729. uniform vec3 diffuse;
  5730. uniform float opacity;
  5731. uniform sampler2D matcap;
  5732. varying vec3 vViewPosition;
  5733. #include <common>
  5734. #include <dithering_pars_fragment>
  5735. #include <color_pars_fragment>
  5736. #include <uv_pars_fragment>
  5737. #include <map_pars_fragment>
  5738. #include <alphamap_pars_fragment>
  5739. #include <alphatest_pars_fragment>
  5740. #include <alphahash_pars_fragment>
  5741. #include <fog_pars_fragment>
  5742. #include <normal_pars_fragment>
  5743. #include <bumpmap_pars_fragment>
  5744. #include <normalmap_pars_fragment>
  5745. #include <logdepthbuf_pars_fragment>
  5746. #include <clipping_planes_pars_fragment>
  5747. void main() {
  5748. vec4 diffuseColor = vec4( diffuse, opacity );
  5749. #include <clipping_planes_fragment>
  5750. #include <logdepthbuf_fragment>
  5751. #include <map_fragment>
  5752. #include <color_fragment>
  5753. #include <alphamap_fragment>
  5754. #include <alphatest_fragment>
  5755. #include <alphahash_fragment>
  5756. #include <normal_fragment_begin>
  5757. #include <normal_fragment_maps>
  5758. vec3 viewDir = normalize( vViewPosition );
  5759. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  5760. vec3 y = cross( viewDir, x );
  5761. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks
  5762. #ifdef USE_MATCAP
  5763. vec4 matcapColor = texture2D( matcap, uv );
  5764. #else
  5765. vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing
  5766. #endif
  5767. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  5768. #include <opaque_fragment>
  5769. #include <tonemapping_fragment>
  5770. #include <colorspace_fragment>
  5771. #include <fog_fragment>
  5772. #include <premultiplied_alpha_fragment>
  5773. #include <dithering_fragment>
  5774. }
  5775. `;var mre=`
  5776. #define NORMAL
  5777. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  5778. varying vec3 vViewPosition;
  5779. #endif
  5780. #include <common>
  5781. #include <batching_pars_vertex>
  5782. #include <uv_pars_vertex>
  5783. #include <displacementmap_pars_vertex>
  5784. #include <normal_pars_vertex>
  5785. #include <morphtarget_pars_vertex>
  5786. #include <skinning_pars_vertex>
  5787. #include <logdepthbuf_pars_vertex>
  5788. #include <clipping_planes_pars_vertex>
  5789. void main() {
  5790. #include <uv_vertex>
  5791. #include <batching_vertex>
  5792. #include <beginnormal_vertex>
  5793. #include <morphinstance_vertex>
  5794. #include <morphnormal_vertex>
  5795. #include <skinbase_vertex>
  5796. #include <skinnormal_vertex>
  5797. #include <defaultnormal_vertex>
  5798. #include <normal_vertex>
  5799. #include <begin_vertex>
  5800. #include <morphtarget_vertex>
  5801. #include <skinning_vertex>
  5802. #include <displacementmap_vertex>
  5803. #include <project_vertex>
  5804. #include <logdepthbuf_vertex>
  5805. #include <clipping_planes_vertex>
  5806. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  5807. vViewPosition = - mvPosition.xyz;
  5808. #endif
  5809. }
  5810. `,vre=`
  5811. #define NORMAL
  5812. uniform float opacity;
  5813. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  5814. varying vec3 vViewPosition;
  5815. #endif
  5816. #include <packing>
  5817. #include <uv_pars_fragment>
  5818. #include <normal_pars_fragment>
  5819. #include <bumpmap_pars_fragment>
  5820. #include <normalmap_pars_fragment>
  5821. #include <logdepthbuf_pars_fragment>
  5822. #include <clipping_planes_pars_fragment>
  5823. void main() {
  5824. vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
  5825. #include <clipping_planes_fragment>
  5826. #include <logdepthbuf_fragment>
  5827. #include <normal_fragment_begin>
  5828. #include <normal_fragment_maps>
  5829. gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
  5830. #ifdef OPAQUE
  5831. gl_FragColor.a = 1.0;
  5832. #endif
  5833. }
  5834. `;var gre=`
  5835. #define PHONG
  5836. varying vec3 vViewPosition;
  5837. #include <common>
  5838. #include <batching_pars_vertex>
  5839. #include <uv_pars_vertex>
  5840. #include <displacementmap_pars_vertex>
  5841. #include <envmap_pars_vertex>
  5842. #include <color_pars_vertex>
  5843. #include <fog_pars_vertex>
  5844. #include <normal_pars_vertex>
  5845. #include <morphtarget_pars_vertex>
  5846. #include <skinning_pars_vertex>
  5847. #include <shadowmap_pars_vertex>
  5848. #include <logdepthbuf_pars_vertex>
  5849. #include <clipping_planes_pars_vertex>
  5850. void main() {
  5851. #include <uv_vertex>
  5852. #include <color_vertex>
  5853. #include <morphcolor_vertex>
  5854. #include <batching_vertex>
  5855. #include <beginnormal_vertex>
  5856. #include <morphinstance_vertex>
  5857. #include <morphnormal_vertex>
  5858. #include <skinbase_vertex>
  5859. #include <skinnormal_vertex>
  5860. #include <defaultnormal_vertex>
  5861. #include <normal_vertex>
  5862. #include <begin_vertex>
  5863. #include <morphtarget_vertex>
  5864. #include <skinning_vertex>
  5865. #include <displacementmap_vertex>
  5866. #include <project_vertex>
  5867. #include <logdepthbuf_vertex>
  5868. #include <clipping_planes_vertex>
  5869. vViewPosition = - mvPosition.xyz;
  5870. #include <worldpos_vertex>
  5871. #include <envmap_vertex>
  5872. #include <shadowmap_vertex>
  5873. #include <fog_vertex>
  5874. }
  5875. `,yre=`
  5876. #define PHONG
  5877. uniform vec3 diffuse;
  5878. uniform vec3 emissive;
  5879. uniform vec3 specular;
  5880. uniform float shininess;
  5881. uniform float opacity;
  5882. #include <common>
  5883. #include <packing>
  5884. #include <dithering_pars_fragment>
  5885. #include <color_pars_fragment>
  5886. #include <uv_pars_fragment>
  5887. #include <map_pars_fragment>
  5888. #include <alphamap_pars_fragment>
  5889. #include <alphatest_pars_fragment>
  5890. #include <alphahash_pars_fragment>
  5891. #include <aomap_pars_fragment>
  5892. #include <lightmap_pars_fragment>
  5893. #include <emissivemap_pars_fragment>
  5894. #include <envmap_common_pars_fragment>
  5895. #include <envmap_pars_fragment>
  5896. #include <fog_pars_fragment>
  5897. #include <bsdfs>
  5898. #include <lights_pars_begin>
  5899. #include <normal_pars_fragment>
  5900. #include <lights_phong_pars_fragment>
  5901. #include <shadowmap_pars_fragment>
  5902. #include <bumpmap_pars_fragment>
  5903. #include <normalmap_pars_fragment>
  5904. #include <specularmap_pars_fragment>
  5905. #include <logdepthbuf_pars_fragment>
  5906. #include <clipping_planes_pars_fragment>
  5907. void main() {
  5908. vec4 diffuseColor = vec4( diffuse, opacity );
  5909. #include <clipping_planes_fragment>
  5910. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  5911. vec3 totalEmissiveRadiance = emissive;
  5912. #include <logdepthbuf_fragment>
  5913. #include <map_fragment>
  5914. #include <color_fragment>
  5915. #include <alphamap_fragment>
  5916. #include <alphatest_fragment>
  5917. #include <alphahash_fragment>
  5918. #include <specularmap_fragment>
  5919. #include <normal_fragment_begin>
  5920. #include <normal_fragment_maps>
  5921. #include <emissivemap_fragment>
  5922. // accumulation
  5923. #include <lights_phong_fragment>
  5924. #include <lights_fragment_begin>
  5925. #include <lights_fragment_maps>
  5926. #include <lights_fragment_end>
  5927. // modulation
  5928. #include <aomap_fragment>
  5929. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  5930. #include <envmap_fragment>
  5931. #include <opaque_fragment>
  5932. #include <tonemapping_fragment>
  5933. #include <colorspace_fragment>
  5934. #include <fog_fragment>
  5935. #include <premultiplied_alpha_fragment>
  5936. #include <dithering_fragment>
  5937. }
  5938. `;var _re=`
  5939. #define STANDARD
  5940. varying vec3 vViewPosition;
  5941. #ifdef USE_TRANSMISSION
  5942. varying vec3 vWorldPosition;
  5943. #endif
  5944. #include <common>
  5945. #include <batching_pars_vertex>
  5946. #include <uv_pars_vertex>
  5947. #include <displacementmap_pars_vertex>
  5948. #include <color_pars_vertex>
  5949. #include <fog_pars_vertex>
  5950. #include <normal_pars_vertex>
  5951. #include <morphtarget_pars_vertex>
  5952. #include <skinning_pars_vertex>
  5953. #include <shadowmap_pars_vertex>
  5954. #include <logdepthbuf_pars_vertex>
  5955. #include <clipping_planes_pars_vertex>
  5956. void main() {
  5957. #include <uv_vertex>
  5958. #include <color_vertex>
  5959. #include <morphinstance_vertex>
  5960. #include <morphcolor_vertex>
  5961. #include <batching_vertex>
  5962. #include <beginnormal_vertex>
  5963. #include <morphnormal_vertex>
  5964. #include <skinbase_vertex>
  5965. #include <skinnormal_vertex>
  5966. #include <defaultnormal_vertex>
  5967. #include <normal_vertex>
  5968. #include <begin_vertex>
  5969. #include <morphtarget_vertex>
  5970. #include <skinning_vertex>
  5971. #include <displacementmap_vertex>
  5972. #include <project_vertex>
  5973. #include <logdepthbuf_vertex>
  5974. #include <clipping_planes_vertex>
  5975. vViewPosition = - mvPosition.xyz;
  5976. #include <worldpos_vertex>
  5977. #include <shadowmap_vertex>
  5978. #include <fog_vertex>
  5979. #ifdef USE_TRANSMISSION
  5980. vWorldPosition = worldPosition.xyz;
  5981. #endif
  5982. }
  5983. `,xre=`
  5984. #define STANDARD
  5985. #ifdef PHYSICAL
  5986. #define IOR
  5987. #define USE_SPECULAR
  5988. #endif
  5989. uniform vec3 diffuse;
  5990. uniform vec3 emissive;
  5991. uniform float roughness;
  5992. uniform float metalness;
  5993. uniform float opacity;
  5994. #ifdef IOR
  5995. uniform float ior;
  5996. #endif
  5997. #ifdef USE_SPECULAR
  5998. uniform float specularIntensity;
  5999. uniform vec3 specularColor;
  6000. #ifdef USE_SPECULAR_COLORMAP
  6001. uniform sampler2D specularColorMap;
  6002. #endif
  6003. #ifdef USE_SPECULAR_INTENSITYMAP
  6004. uniform sampler2D specularIntensityMap;
  6005. #endif
  6006. #endif
  6007. #ifdef USE_CLEARCOAT
  6008. uniform float clearcoat;
  6009. uniform float clearcoatRoughness;
  6010. #endif
  6011. #ifdef USE_IRIDESCENCE
  6012. uniform float iridescence;
  6013. uniform float iridescenceIOR;
  6014. uniform float iridescenceThicknessMinimum;
  6015. uniform float iridescenceThicknessMaximum;
  6016. #endif
  6017. #ifdef USE_SHEEN
  6018. uniform vec3 sheenColor;
  6019. uniform float sheenRoughness;
  6020. #ifdef USE_SHEEN_COLORMAP
  6021. uniform sampler2D sheenColorMap;
  6022. #endif
  6023. #ifdef USE_SHEEN_ROUGHNESSMAP
  6024. uniform sampler2D sheenRoughnessMap;
  6025. #endif
  6026. #endif
  6027. #ifdef USE_ANISOTROPY
  6028. uniform vec2 anisotropyVector;
  6029. #ifdef USE_ANISOTROPYMAP
  6030. uniform sampler2D anisotropyMap;
  6031. #endif
  6032. #endif
  6033. varying vec3 vViewPosition;
  6034. #include <common>
  6035. #include <packing>
  6036. #include <dithering_pars_fragment>
  6037. #include <color_pars_fragment>
  6038. #include <uv_pars_fragment>
  6039. #include <map_pars_fragment>
  6040. #include <alphamap_pars_fragment>
  6041. #include <alphatest_pars_fragment>
  6042. #include <alphahash_pars_fragment>
  6043. #include <aomap_pars_fragment>
  6044. #include <lightmap_pars_fragment>
  6045. #include <emissivemap_pars_fragment>
  6046. #include <iridescence_fragment>
  6047. #include <cube_uv_reflection_fragment>
  6048. #include <envmap_common_pars_fragment>
  6049. #include <envmap_physical_pars_fragment>
  6050. #include <fog_pars_fragment>
  6051. #include <lights_pars_begin>
  6052. #include <normal_pars_fragment>
  6053. #include <lights_physical_pars_fragment>
  6054. #include <transmission_pars_fragment>
  6055. #include <shadowmap_pars_fragment>
  6056. #include <bumpmap_pars_fragment>
  6057. #include <normalmap_pars_fragment>
  6058. #include <clearcoat_pars_fragment>
  6059. #include <iridescence_pars_fragment>
  6060. #include <roughnessmap_pars_fragment>
  6061. #include <metalnessmap_pars_fragment>
  6062. #include <logdepthbuf_pars_fragment>
  6063. #include <clipping_planes_pars_fragment>
  6064. void main() {
  6065. vec4 diffuseColor = vec4( diffuse, opacity );
  6066. #include <clipping_planes_fragment>
  6067. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  6068. vec3 totalEmissiveRadiance = emissive;
  6069. #include <logdepthbuf_fragment>
  6070. #include <map_fragment>
  6071. #include <color_fragment>
  6072. #include <alphamap_fragment>
  6073. #include <alphatest_fragment>
  6074. #include <alphahash_fragment>
  6075. #include <roughnessmap_fragment>
  6076. #include <metalnessmap_fragment>
  6077. #include <normal_fragment_begin>
  6078. #include <normal_fragment_maps>
  6079. #include <clearcoat_normal_fragment_begin>
  6080. #include <clearcoat_normal_fragment_maps>
  6081. #include <emissivemap_fragment>
  6082. // accumulation
  6083. #include <lights_physical_fragment>
  6084. #include <lights_fragment_begin>
  6085. #include <lights_fragment_maps>
  6086. #include <lights_fragment_end>
  6087. // modulation
  6088. #include <aomap_fragment>
  6089. vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
  6090. vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
  6091. #include <transmission_fragment>
  6092. vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
  6093. #ifdef USE_SHEEN
  6094. // Sheen energy compensation approximation calculation can be found at the end of
  6095. // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
  6096. float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
  6097. outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
  6098. #endif
  6099. #ifdef USE_CLEARCOAT
  6100. float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
  6101. vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
  6102. outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
  6103. #endif
  6104. #include <opaque_fragment>
  6105. #include <tonemapping_fragment>
  6106. #include <colorspace_fragment>
  6107. #include <fog_fragment>
  6108. #include <premultiplied_alpha_fragment>
  6109. #include <dithering_fragment>
  6110. }
  6111. `;var Sre=`
  6112. #define TOON
  6113. varying vec3 vViewPosition;
  6114. #include <common>
  6115. #include <batching_pars_vertex>
  6116. #include <uv_pars_vertex>
  6117. #include <displacementmap_pars_vertex>
  6118. #include <color_pars_vertex>
  6119. #include <fog_pars_vertex>
  6120. #include <normal_pars_vertex>
  6121. #include <morphtarget_pars_vertex>
  6122. #include <skinning_pars_vertex>
  6123. #include <shadowmap_pars_vertex>
  6124. #include <logdepthbuf_pars_vertex>
  6125. #include <clipping_planes_pars_vertex>
  6126. void main() {
  6127. #include <uv_vertex>
  6128. #include <color_vertex>
  6129. #include <morphinstance_vertex>
  6130. #include <morphcolor_vertex>
  6131. #include <batching_vertex>
  6132. #include <beginnormal_vertex>
  6133. #include <morphnormal_vertex>
  6134. #include <skinbase_vertex>
  6135. #include <skinnormal_vertex>
  6136. #include <defaultnormal_vertex>
  6137. #include <normal_vertex>
  6138. #include <begin_vertex>
  6139. #include <morphtarget_vertex>
  6140. #include <skinning_vertex>
  6141. #include <displacementmap_vertex>
  6142. #include <project_vertex>
  6143. #include <logdepthbuf_vertex>
  6144. #include <clipping_planes_vertex>
  6145. vViewPosition = - mvPosition.xyz;
  6146. #include <worldpos_vertex>
  6147. #include <shadowmap_vertex>
  6148. #include <fog_vertex>
  6149. }
  6150. `,Mre=`
  6151. #define TOON
  6152. uniform vec3 diffuse;
  6153. uniform vec3 emissive;
  6154. uniform float opacity;
  6155. #include <common>
  6156. #include <packing>
  6157. #include <dithering_pars_fragment>
  6158. #include <color_pars_fragment>
  6159. #include <uv_pars_fragment>
  6160. #include <map_pars_fragment>
  6161. #include <alphamap_pars_fragment>
  6162. #include <alphatest_pars_fragment>
  6163. #include <alphahash_pars_fragment>
  6164. #include <aomap_pars_fragment>
  6165. #include <lightmap_pars_fragment>
  6166. #include <emissivemap_pars_fragment>
  6167. #include <gradientmap_pars_fragment>
  6168. #include <fog_pars_fragment>
  6169. #include <bsdfs>
  6170. #include <lights_pars_begin>
  6171. #include <normal_pars_fragment>
  6172. #include <lights_toon_pars_fragment>
  6173. #include <shadowmap_pars_fragment>
  6174. #include <bumpmap_pars_fragment>
  6175. #include <normalmap_pars_fragment>
  6176. #include <logdepthbuf_pars_fragment>
  6177. #include <clipping_planes_pars_fragment>
  6178. void main() {
  6179. vec4 diffuseColor = vec4( diffuse, opacity );
  6180. #include <clipping_planes_fragment>
  6181. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  6182. vec3 totalEmissiveRadiance = emissive;
  6183. #include <logdepthbuf_fragment>
  6184. #include <map_fragment>
  6185. #include <color_fragment>
  6186. #include <alphamap_fragment>
  6187. #include <alphatest_fragment>
  6188. #include <alphahash_fragment>
  6189. #include <normal_fragment_begin>
  6190. #include <normal_fragment_maps>
  6191. #include <emissivemap_fragment>
  6192. // accumulation
  6193. #include <lights_toon_fragment>
  6194. #include <lights_fragment_begin>
  6195. #include <lights_fragment_maps>
  6196. #include <lights_fragment_end>
  6197. // modulation
  6198. #include <aomap_fragment>
  6199. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  6200. #include <opaque_fragment>
  6201. #include <tonemapping_fragment>
  6202. #include <colorspace_fragment>
  6203. #include <fog_fragment>
  6204. #include <premultiplied_alpha_fragment>
  6205. #include <dithering_fragment>
  6206. }
  6207. `;var bre=`
  6208. uniform float size;
  6209. uniform float scale;
  6210. #include <common>
  6211. #include <color_pars_vertex>
  6212. #include <fog_pars_vertex>
  6213. #include <morphtarget_pars_vertex>
  6214. #include <logdepthbuf_pars_vertex>
  6215. #include <clipping_planes_pars_vertex>
  6216. #ifdef USE_POINTS_UV
  6217. varying vec2 vUv;
  6218. uniform mat3 uvTransform;
  6219. #endif
  6220. void main() {
  6221. #ifdef USE_POINTS_UV
  6222. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  6223. #endif
  6224. #include <color_vertex>
  6225. #include <morphinstance_vertex>
  6226. #include <morphcolor_vertex>
  6227. #include <begin_vertex>
  6228. #include <morphtarget_vertex>
  6229. #include <project_vertex>
  6230. gl_PointSize = size;
  6231. #ifdef USE_SIZEATTENUATION
  6232. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  6233. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  6234. #endif
  6235. #include <logdepthbuf_vertex>
  6236. #include <clipping_planes_vertex>
  6237. #include <worldpos_vertex>
  6238. #include <fog_vertex>
  6239. }
  6240. `,wre=`
  6241. uniform vec3 diffuse;
  6242. uniform float opacity;
  6243. #include <common>
  6244. #include <color_pars_fragment>
  6245. #include <map_particle_pars_fragment>
  6246. #include <alphatest_pars_fragment>
  6247. #include <alphahash_pars_fragment>
  6248. #include <fog_pars_fragment>
  6249. #include <logdepthbuf_pars_fragment>
  6250. #include <clipping_planes_pars_fragment>
  6251. void main() {
  6252. vec4 diffuseColor = vec4( diffuse, opacity );
  6253. #include <clipping_planes_fragment>
  6254. vec3 outgoingLight = vec3( 0.0 );
  6255. #include <logdepthbuf_fragment>
  6256. #include <map_particle_fragment>
  6257. #include <color_fragment>
  6258. #include <alphatest_fragment>
  6259. #include <alphahash_fragment>
  6260. outgoingLight = diffuseColor.rgb;
  6261. #include <opaque_fragment>
  6262. #include <tonemapping_fragment>
  6263. #include <colorspace_fragment>
  6264. #include <fog_fragment>
  6265. #include <premultiplied_alpha_fragment>
  6266. }
  6267. `;var Tre=`
  6268. #include <common>
  6269. #include <batching_pars_vertex>
  6270. #include <fog_pars_vertex>
  6271. #include <morphtarget_pars_vertex>
  6272. #include <skinning_pars_vertex>
  6273. #include <logdepthbuf_pars_vertex>
  6274. #include <shadowmap_pars_vertex>
  6275. void main() {
  6276. #include <batching_vertex>
  6277. #include <beginnormal_vertex>
  6278. #include <morphinstance_vertex>
  6279. #include <morphnormal_vertex>
  6280. #include <skinbase_vertex>
  6281. #include <skinnormal_vertex>
  6282. #include <defaultnormal_vertex>
  6283. #include <begin_vertex>
  6284. #include <morphtarget_vertex>
  6285. #include <skinning_vertex>
  6286. #include <project_vertex>
  6287. #include <logdepthbuf_vertex>
  6288. #include <worldpos_vertex>
  6289. #include <shadowmap_vertex>
  6290. #include <fog_vertex>
  6291. }
  6292. `,Ere=`
  6293. uniform vec3 color;
  6294. uniform float opacity;
  6295. #include <common>
  6296. #include <packing>
  6297. #include <fog_pars_fragment>
  6298. #include <bsdfs>
  6299. #include <lights_pars_begin>
  6300. #include <logdepthbuf_pars_fragment>
  6301. #include <shadowmap_pars_fragment>
  6302. #include <shadowmask_pars_fragment>
  6303. void main() {
  6304. #include <logdepthbuf_fragment>
  6305. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  6306. #include <tonemapping_fragment>
  6307. #include <colorspace_fragment>
  6308. #include <fog_fragment>
  6309. }
  6310. `;var Are=`
  6311. uniform float rotation;
  6312. uniform vec2 center;
  6313. #include <common>
  6314. #include <uv_pars_vertex>
  6315. #include <fog_pars_vertex>
  6316. #include <logdepthbuf_pars_vertex>
  6317. #include <clipping_planes_pars_vertex>
  6318. void main() {
  6319. #include <uv_vertex>
  6320. vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
  6321. vec2 scale;
  6322. scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
  6323. scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
  6324. #ifndef USE_SIZEATTENUATION
  6325. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  6326. if ( isPerspective ) scale *= - mvPosition.z;
  6327. #endif
  6328. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  6329. vec2 rotatedPosition;
  6330. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  6331. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  6332. mvPosition.xy += rotatedPosition;
  6333. gl_Position = projectionMatrix * mvPosition;
  6334. #include <logdepthbuf_vertex>
  6335. #include <clipping_planes_vertex>
  6336. #include <fog_vertex>
  6337. }
  6338. `,Cre=`
  6339. uniform vec3 diffuse;
  6340. uniform float opacity;
  6341. #include <common>
  6342. #include <uv_pars_fragment>
  6343. #include <map_pars_fragment>
  6344. #include <alphamap_pars_fragment>
  6345. #include <alphatest_pars_fragment>
  6346. #include <alphahash_pars_fragment>
  6347. #include <fog_pars_fragment>
  6348. #include <logdepthbuf_pars_fragment>
  6349. #include <clipping_planes_pars_fragment>
  6350. void main() {
  6351. vec4 diffuseColor = vec4( diffuse, opacity );
  6352. #include <clipping_planes_fragment>
  6353. vec3 outgoingLight = vec3( 0.0 );
  6354. #include <logdepthbuf_fragment>
  6355. #include <map_fragment>
  6356. #include <alphamap_fragment>
  6357. #include <alphatest_fragment>
  6358. #include <alphahash_fragment>
  6359. outgoingLight = diffuseColor.rgb;
  6360. #include <opaque_fragment>
  6361. #include <tonemapping_fragment>
  6362. #include <colorspace_fragment>
  6363. #include <fog_fragment>
  6364. }
  6365. `;var pr={alphahash_fragment:jQ,alphahash_pars_fragment:KQ,alphamap_fragment:JQ,alphamap_pars_fragment:$Q,alphatest_fragment:QQ,alphatest_pars_fragment:eee,aomap_fragment:tee,aomap_pars_fragment:ree,batching_pars_vertex:iee,batching_vertex:nee,begin_vertex:aee,beginnormal_vertex:oee,bsdfs:see,iridescence_fragment:lee,bumpmap_pars_fragment:uee,clipping_planes_fragment:cee,clipping_planes_pars_fragment:fee,clipping_planes_pars_vertex:hee,clipping_planes_vertex:pee,color_fragment:dee,color_pars_fragment:mee,color_pars_vertex:vee,color_vertex:gee,common:yee,cube_uv_reflection_fragment:_ee,defaultnormal_vertex:xee,displacementmap_pars_vertex:See,displacementmap_vertex:Mee,emissivemap_fragment:bee,emissivemap_pars_fragment:wee,colorspace_fragment:Tee,colorspace_pars_fragment:Eee,envmap_fragment:Aee,envmap_common_pars_fragment:Cee,envmap_pars_fragment:Ree,envmap_pars_vertex:Lee,envmap_physical_pars_fragment:Gee,envmap_vertex:Pee,fog_vertex:Dee,fog_pars_vertex:Iee,fog_fragment:Nee,fog_pars_fragment:Uee,gradientmap_pars_fragment:Oee,lightmap_fragment:Fee,lightmap_pars_fragment:zee,lights_lambert_fragment:Bee,lights_lambert_pars_fragment:kee,lights_pars_begin:Vee,lights_toon_fragment:Hee,lights_toon_pars_fragment:Wee,lights_phong_fragment:Xee,lights_phong_pars_fragment:Yee,lights_physical_fragment:qee,lights_physical_pars_fragment:Zee,lights_fragment_begin:jee,lights_fragment_maps:Kee,lights_fragment_end:Jee,logdepthbuf_fragment:$ee,logdepthbuf_pars_fragment:Qee,logdepthbuf_pars_vertex:ete,logdepthbuf_vertex:tte,map_fragment:rte,map_pars_fragment:ite,map_particle_fragment:nte,map_particle_pars_fragment:ate,metalnessmap_fragment:ote,metalnessmap_pars_fragment:ste,morphinstance_vertex:lte,morphcolor_vertex:ute,morphnormal_vertex:cte,morphtarget_pars_vertex:fte,morphtarget_vertex:hte,normal_fragment_begin:pte,normal_fragment_maps:dte,normal_pars_fragment:mte,normal_pars_vertex:vte,normal_vertex:gte,normalmap_pars_fragment:yte,clearcoat_normal_fragment_begin:_te,clearcoat_normal_fragment_maps:xte,clearcoat_pars_fragment:Ste,iridescence_pars_fragment:Mte,opaque_fragment:bte,packing:wte,premultiplied_alpha_fragment:Tte,project_vertex:Ete,dithering_fragment:Ate,dithering_pars_fragment:Cte,roughnessmap_fragment:Rte,roughnessmap_pars_fragment:Lte,shadowmap_pars_fragment:Pte,shadowmap_pars_vertex:Dte,shadowmap_vertex:Ite,shadowmask_pars_fragment:Nte,skinbase_vertex:Ute,skinning_pars_vertex:Ote,skinning_vertex:Fte,skinnormal_vertex:zte,specularmap_fragment:Bte,specularmap_pars_fragment:kte,tonemapping_fragment:Vte,tonemapping_pars_fragment:Gte,transmission_fragment:Hte,transmission_pars_fragment:Wte,uv_pars_fragment:Xte,uv_pars_vertex:Yte,uv_vertex:qte,worldpos_vertex:Zte,background_vert:jte,background_frag:Kte,backgroundCube_vert:Jte,backgroundCube_frag:$te,cube_vert:Qte,cube_frag:ere,depth_vert:tre,depth_frag:rre,distanceRGBA_vert:ire,distanceRGBA_frag:nre,equirect_vert:are,equirect_frag:ore,linedashed_vert:sre,linedashed_frag:lre,meshbasic_vert:ure,meshbasic_frag:cre,meshlambert_vert:fre,meshlambert_frag:hre,meshmatcap_vert:pre,meshmatcap_frag:dre,meshnormal_vert:mre,meshnormal_frag:vre,meshphong_vert:gre,meshphong_frag:yre,meshphysical_vert:_re,meshphysical_frag:xre,meshtoon_vert:Sre,meshtoon_frag:Mre,points_vert:bre,points_frag:wre,shadow_vert:Tre,shadow_frag:Ere,sprite_vert:Are,sprite_frag:Cre};var ht={common:{diffuse:{value:new ir(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new $t}},envmap:{envMap:{value:null},envMapRotation:{value:new $t},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new $t}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new $t}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new $t},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new $t},normalScale:{value:new Kt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new $t},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new $t}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new $t}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new $t}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ir(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ir(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0},uvTransform:{value:new $t}},sprite:{diffuse:{value:new ir(16777215)},opacity:{value:1},center:{value:new Kt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}}};var xs={basic:{uniforms:jn([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:pr.meshbasic_vert,fragmentShader:pr.meshbasic_frag},lambert:{uniforms:jn([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ir(0)}}]),vertexShader:pr.meshlambert_vert,fragmentShader:pr.meshlambert_frag},phong:{uniforms:jn([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ir(0)},specular:{value:new ir(1118481)},shininess:{value:30}}]),vertexShader:pr.meshphong_vert,fragmentShader:pr.meshphong_frag},standard:{uniforms:jn([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new ir(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pr.meshphysical_vert,fragmentShader:pr.meshphysical_frag},toon:{uniforms:jn([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new ir(0)}}]),vertexShader:pr.meshtoon_vert,fragmentShader:pr.meshtoon_frag},matcap:{uniforms:jn([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:pr.meshmatcap_vert,fragmentShader:pr.meshmatcap_frag},points:{uniforms:jn([ht.points,ht.fog]),vertexShader:pr.points_vert,fragmentShader:pr.points_frag},dashed:{uniforms:jn([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pr.linedashed_vert,fragmentShader:pr.linedashed_frag},depth:{uniforms:jn([ht.common,ht.displacementmap]),vertexShader:pr.depth_vert,fragmentShader:pr.depth_frag},normal:{uniforms:jn([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:pr.meshnormal_vert,fragmentShader:pr.meshnormal_frag},sprite:{uniforms:jn([ht.sprite,ht.fog]),vertexShader:pr.sprite_vert,fragmentShader:pr.sprite_frag},background:{uniforms:{uvTransform:{value:new $t},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:pr.background_vert,fragmentShader:pr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new $t}},vertexShader:pr.backgroundCube_vert,fragmentShader:pr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pr.cube_vert,fragmentShader:pr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pr.equirect_vert,fragmentShader:pr.equirect_frag},distanceRGBA:{uniforms:jn([ht.common,ht.displacementmap,{referencePosition:{value:new be},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pr.distanceRGBA_vert,fragmentShader:pr.distanceRGBA_frag},shadow:{uniforms:jn([ht.lights,ht.fog,{color:{value:new ir(0)},opacity:{value:1}}]),vertexShader:pr.shadow_vert,fragmentShader:pr.shadow_frag}};xs.physical={uniforms:jn([xs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new $t},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new $t},clearcoatNormalScale:{value:new Kt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new $t},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new $t},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new $t},sheen:{value:0},sheenColor:{value:new ir(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new $t},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new $t},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new $t},transmissionSamplerSize:{value:new Kt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new $t},attenuationDistance:{value:0},attenuationColor:{value:new ir(0)},specularColor:{value:new ir(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new $t},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new $t},anisotropyVector:{value:new Kt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new $t}}]),vertexShader:pr.meshphysical_vert,fragmentShader:pr.meshphysical_frag};var AA={r:0,b:0,g:0},Md=new cl,wTe=new Wr;function Rre(r,e,t,i,n,a,o){let s=new ir(0),l=a===!0?0:1,u,c,f=null,h=0,p=null;function d(m,v){let _=!1,y=v.isScene===!0?v.background:null;y&&y.isTexture&&(y=(v.backgroundBlurriness>0?t:e).get(y)),y===null?g(s,l):y&&y.isColor&&(g(y,1),_=!0);let x=r.xr.getEnvironmentBlendMode();x==="additive"?i.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(r.autoClear||_)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===oh)?(c===void 0&&(c=new rn(new dh(1,1,1),new ya({name:"BackgroundCubeMaterial",uniforms:rc(xs.backgroundCube.uniforms),vertexShader:xs.backgroundCube.vertexShader,fragmentShader:xs.backgroundCube.fragmentShader,side:_i,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(M,S,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),Md.copy(v.backgroundRotation),Md.x*=-1,Md.y*=-1,Md.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Md.y*=-1,Md.z*=-1),c.material.uniforms.envMap.value=y,c.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(wTe.makeRotationFromEuler(Md)),c.material.toneMapped=Er.getTransfer(y.colorSpace)!==Hr,(f!==y||h!==y.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,f=y,h=y.version,p=r.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(u===void 0&&(u=new rn(new Bg(2,2),new ya({name:"BackgroundMaterial",uniforms:rc(xs.background.uniforms),vertexShader:xs.background.vertexShader,fragmentShader:xs.background.fragmentShader,side:Ao,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(u)),u.material.uniforms.t2D.value=y,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=Er.getTransfer(y.colorSpace)!==Hr,y.matrixAutoUpdate===!0&&y.updateMatrix(),u.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||h!==y.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,f=y,h=y.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null))}function g(m,v){m.getRGB(AA,MA(r)),i.buffers.color.setClear(AA.r,AA.g,AA.b,v,o)}return{getClearColor:function(){return s},setClearColor:function(m,v=1){s.set(m),l=v,g(s,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,g(s,l)},render:d}}function Lre(r,e,t,i){let n=r.getParameter(r.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||a!==null,s={},l=m(null),u=l,c=!1;function f(A,D,U,B,F){let k=!1;if(o){let G=g(B,U,D);u!==G&&(u=G,p(u.object)),k=v(A,B,U,F),k&&_(A,B,U,F)}else{let G=D.wireframe===!0;(u.geometry!==B.id||u.program!==U.id||u.wireframe!==G)&&(u.geometry=B.id,u.program=U.id,u.wireframe=G,k=!0)}F!==null&&t.update(F,r.ELEMENT_ARRAY_BUFFER),(k||c)&&(c=!1,T(A,D,U,B),F!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(F).buffer))}function h(){return i.isWebGL2?r.createVertexArray():a.createVertexArrayOES()}function p(A){return i.isWebGL2?r.bindVertexArray(A):a.bindVertexArrayOES(A)}function d(A){return i.isWebGL2?r.deleteVertexArray(A):a.deleteVertexArrayOES(A)}function g(A,D,U){let B=U.wireframe===!0,F=s[A.id];F===void 0&&(F={},s[A.id]=F);let k=F[D.id];k===void 0&&(k={},F[D.id]=k);let G=k[B];return G===void 0&&(G=m(h()),k[B]=G),G}function m(A){let D=[],U=[],B=[];for(let F=0;F<n;F++)D[F]=0,U[F]=0,B[F]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:D,enabledAttributes:U,attributeDivisors:B,object:A,attributes:{},index:null}}function v(A,D,U,B){let F=u.attributes,k=D.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=F[J],K=k[J];if(K===void 0&&(J==="instanceMatrix"&&A.instanceMatrix&&(K=A.instanceMatrix),J==="instanceColor"&&A.instanceColor&&(K=A.instanceColor)),V===void 0||V.attribute!==K||K&&V.data!==K.data)return!0;G++}return u.attributesNum!==G||u.index!==B}function _(A,D,U,B){let F={},k=D.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=k[J];V===void 0&&(J==="instanceMatrix"&&A.instanceMatrix&&(V=A.instanceMatrix),J==="instanceColor"&&A.instanceColor&&(V=A.instanceColor));let K={};K.attribute=V,V&&V.data&&(K.data=V.data),F[J]=K,G++}u.attributes=F,u.attributesNum=G,u.index=B}function y(){let A=u.newAttributes;for(let D=0,U=A.length;D<U;D++)A[D]=0}function x(A){M(A,0)}function M(A,D){let U=u.newAttributes,B=u.enabledAttributes,F=u.attributeDivisors;U[A]=1,B[A]===0&&(r.enableVertexAttribArray(A),B[A]=1),F[A]!==D&&((i.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](A,D),F[A]=D)}function S(){let A=u.newAttributes,D=u.enabledAttributes;for(let U=0,B=D.length;U<B;U++)D[U]!==A[U]&&(r.disableVertexAttribArray(U),D[U]=0)}function w(A,D,U,B,F,k,G){G===!0?r.vertexAttribIPointer(A,D,U,F,k):r.vertexAttribPointer(A,D,U,B,F,k)}function T(A,D,U,B){if(i.isWebGL2===!1&&(A.isInstancedMesh||B.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();let F=B.attributes,k=U.getAttributes(),G=D.defaultAttributeValues;for(let Y in k){let J=k[Y];if(J.location>=0){let Q=F[Y];if(Q===void 0&&(Y==="instanceMatrix"&&A.instanceMatrix&&(Q=A.instanceMatrix),Y==="instanceColor"&&A.instanceColor&&(Q=A.instanceColor)),Q!==void 0){let V=Q.normalized,K=Q.itemSize,ae=t.get(Q);if(ae===void 0)continue;let ve=ae.buffer,ue=ae.type,se=ae.bytesPerElement,Ee=i.isWebGL2===!0&&(ue===r.INT||ue===r.UNSIGNED_INT||Q.gpuType===zE);if(Q.isInterleavedBufferAttribute){let q=Q.data,H=q.stride,We=Q.offset;if(q.isInstancedInterleavedBuffer){for(let _e=0;_e<J.locationSize;_e++)M(J.location+_e,q.meshPerAttribute);A.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=q.meshPerAttribute*q.count)}else for(let _e=0;_e<J.locationSize;_e++)x(J.location+_e);r.bindBuffer(r.ARRAY_BUFFER,ve);for(let _e=0;_e<J.locationSize;_e++)w(J.location+_e,K/J.locationSize,ue,V,H*se,(We+K/J.locationSize*_e)*se,Ee)}else{if(Q.isInstancedBufferAttribute){for(let q=0;q<J.locationSize;q++)M(J.location+q,Q.meshPerAttribute);A.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=Q.meshPerAttribute*Q.count)}else for(let q=0;q<J.locationSize;q++)x(J.location+q);r.bindBuffer(r.ARRAY_BUFFER,ve);for(let q=0;q<J.locationSize;q++)w(J.location+q,K/J.locationSize,ue,V,K*se,K/J.locationSize*q*se,Ee)}}else if(G!==void 0){let V=G[Y];if(V!==void 0)switch(V.length){case 2:r.vertexAttrib2fv(J.location,V);break;case 3:r.vertexAttrib3fv(J.location,V);break;case 4:r.vertexAttrib4fv(J.location,V);break;default:r.vertexAttrib1fv(J.location,V)}}}}S()}function C(){I();for(let A in s){let D=s[A];for(let U in D){let B=D[U];for(let F in B)d(B[F].object),delete B[F];delete D[U]}delete s[A]}}function b(A){if(s[A.id]===void 0)return;let D=s[A.id];for(let U in D){let B=D[U];for(let F in B)d(B[F].object),delete B[F];delete D[U]}delete s[A.id]}function E(A){for(let D in s){let U=s[D];if(U[A.id]===void 0)continue;let B=U[A.id];for(let F in B)d(B[F].object),delete B[F];delete U[A.id]}}function I(){R(),c=!0,u!==l&&(u=l,p(u.object))}function R(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:f,reset:I,resetDefaultState:R,dispose:C,releaseStatesOfGeometry:b,releaseStatesOfProgram:E,initAttributes:y,enableAttribute:x,disableUnusedAttributes:S}}function Pre(r,e,t,i){let n=i.isWebGL2,a;function o(c){a=c}function s(c,f){r.drawArrays(a,c,f),t.update(f,a,1)}function l(c,f,h){if(h===0)return;let p,d;if(n)p=r,d="drawArraysInstanced";else if(p=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",p===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[d](a,c,f,h),t.update(f,a,h)}function u(c,f,h){if(h===0)return;let p=e.get("WEBGL_multi_draw");if(p===null)for(let d=0;d<h;d++)this.render(c[d],f[d]);else{p.multiDrawArraysWEBGL(a,c,0,f,0,h);let d=0;for(let g=0;g<h;g++)d+=f[g];t.update(d,a,1)}}this.setMode=o,this.render=s,this.renderInstances=l,this.renderMultiDraw=u}function Dre(r,e,t){let i;function n(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){let w=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(w){if(w==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext",s=t.precision!==void 0?t.precision:"highp",l=a(s);l!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",l,"instead."),s=l);let u=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),h=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_TEXTURE_SIZE),d=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),m=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),_=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,x=o||e.has("OES_texture_float"),M=y&&x,S=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:n,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:c,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:d,maxAttributes:g,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:_,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:M,maxSamples:S}}function Ire(r){let e=this,t=null,i=0,n=!1,a=!1,o=new hl,s=new $t,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){let p=f.length!==0||h||i!==0||n;return n=h,i=f.length,p},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(f,h){t=c(f,h,0)},this.setState=function(f,h,p){let d=f.clippingPlanes,g=f.clipIntersection,m=f.clipShadows,v=r.get(f);if(!n||d===null||d.length===0||a&&!m)a?c(null):u();else{let _=a?0:i,y=_*4,x=v.clippingState||null;l.value=x,x=c(d,h,y,p);for(let M=0;M!==y;++M)x[M]=t[M];v.clippingState=x,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=_}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(f,h,p,d){let g=f!==null?f.length:0,m=null;if(g!==0){if(m=l.value,d!==!0||m===null){let v=p+g*4,_=h.matrixWorldInverse;s.getNormalMatrix(_),(m===null||m.length<v)&&(m=new Float32Array(v));for(let y=0,x=p;y!==g;++y,x+=4)o.copy(f[y]).applyMatrix4(_,s),o.normal.toArray(m,x),m[x+3]=o.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,m}}function Nre(r){let e=new WeakMap;function t(o,s){return s===aS?o.mapping=al:s===oS&&(o.mapping=tu),o}function i(o){if(o&&o.isTexture){let s=o.mapping;if(s===aS||s===oS)if(e.has(o)){let l=e.get(o).texture;return t(l,o.mapping)}else{let l=o.image;if(l&&l.height>0){let u=new wA(l.height);return u.fromEquirectangularTexture(r,o),e.set(o,u),o.addEventListener("dispose",n),t(u.texture,o.mapping)}else return null}}return o}function n(o){let s=o.target;s.removeEventListener("dispose",n);let l=e.get(s);l!==void 0&&(e.delete(s),l.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}var kg=class extends Ug{constructor(e=-1,t=1,i=1,n=-1,a=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=a,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,a,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,a=i-e,o=i+e,s=n+t,l=n-t;if(this.view!==null&&this.view.enabled){let u=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=u*this.view.offsetX,o=a+u*this.view.width,s-=c*this.view.offsetY,l=s-c*this.view.height}this.projectionMatrix.makeOrthographic(a,o,s,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};var Gg=4,Ure=[.125,.215,.35,.446,.526,.582],wd=20,XF=new kg,Ore=new ir,YF=null,qF=0,ZF=0,bd=(1+Math.sqrt(5))/2,Vg=1/bd,Fre=[new be(1,1,1),new be(-1,1,1),new be(1,1,-1),new be(-1,1,-1),new be(0,bd,Vg),new be(0,bd,-Vg),new be(Vg,0,bd),new be(-Vg,0,bd),new be(bd,Vg,0),new be(-bd,Vg,0)],vS=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){YF=this._renderer.getRenderTarget(),qF=this._renderer.getActiveCubeFace(),ZF=this._renderer.getActiveMipmapLevel(),this._setSize(256);let a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,i,n,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=kre(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Bre(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(YF,qF,ZF),e.scissorTest=!1,CA(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===al||e.mapping===tu?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),YF=this._renderer.getRenderTarget(),qF=this._renderer.getActiveCubeFace(),ZF=this._renderer.getActiveMipmapLevel();let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Qi,minFilter:Qi,generateMipmaps:!1,type:Zu,format:Rn,colorSpace:Za,depthBuffer:!1},n=zre(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=zre(e,t,i);let{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=TTe(a)),this._blurMaterial=ETe(a,e,t)}return n}_compileMaterial(e){let t=new rn(this._lodPlanes[0],e);this._renderer.compile(t,XF)}_sceneToCubeUV(e,t,i,n){let s=new Gi(90,1,t,i),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],c=this._renderer,f=c.autoClear,h=c.toneMapping;c.getClearColor(Ore),c.toneMapping=vs,c.autoClear=!1;let p=new tc({name:"PMREM.Background",side:_i,depthWrite:!1,depthTest:!1}),d=new rn(new dh,p),g=!1,m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,g=!0):(p.color.copy(Ore),g=!0);for(let v=0;v<6;v++){let _=v%3;_===0?(s.up.set(0,l[v],0),s.lookAt(u[v],0,0)):_===1?(s.up.set(0,0,l[v]),s.lookAt(0,u[v],0)):(s.up.set(0,l[v],0),s.lookAt(0,0,u[v]));let y=this._cubeSize;CA(n,_*y,v>2?y:0,y,y),c.setRenderTarget(n),g&&c.render(d,s),c.render(e,s)}d.geometry.dispose(),d.material.dispose(),c.toneMapping=h,c.autoClear=f,e.background=m}_textureToCubeUV(e,t){let i=this._renderer,n=e.mapping===al||e.mapping===tu;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=kre()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Bre());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new rn(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let l=this._cubeSize;CA(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,XF)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let a=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),o=Fre[(n-1)%Fre.length];this._blur(e,n-1,n,a,o)}t.autoClear=i}_blur(e,t,i,n,a){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,n,"latitudinal",a),this._halfBlur(o,e,i,i,n,"longitudinal",a)}_halfBlur(e,t,i,n,a,o,s){let l=this._renderer,u=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let c=3,f=new rn(this._lodPlanes[n],u),h=u.uniforms,p=this._sizeLods[i]-1,d=isFinite(a)?Math.PI/(2*p):2*Math.PI/(2*wd-1),g=a/d,m=isFinite(a)?1+Math.floor(c*g):wd;m>wd&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${wd}`);let v=[],_=0;for(let w=0;w<wd;++w){let T=w/g,C=Math.exp(-T*T/2);v.push(C),w===0?_+=C:w<m&&(_+=2*C)}for(let w=0;w<v.length;w++)v[w]=v[w]/_;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=v,h.latitudinal.value=o==="latitudinal",s&&(h.poleAxis.value=s);let{_lodMax:y}=this;h.dTheta.value=d,h.mipInt.value=y-i;let x=this._sizeLods[n],M=3*x*(n>y-Gg?n-y+Gg:0),S=4*(this._cubeSize-x);CA(t,M,S,3*x,2*x),l.setRenderTarget(t),l.render(f,XF)}};function TTe(r){let e=[],t=[],i=[],n=r,a=r-Gg+1+Ure.length;for(let o=0;o<a;o++){let s=Math.pow(2,n);t.push(s);let l=1/s;o>r-Gg?l=Ure[o-r+Gg-1]:o===0&&(l=0),i.push(l);let u=1/(s-2),c=-u,f=1+u,h=[c,c,f,c,f,f,c,c,f,f,c,f],p=6,d=6,g=3,m=2,v=1,_=new Float32Array(g*d*p),y=new Float32Array(m*d*p),x=new Float32Array(v*d*p);for(let S=0;S<p;S++){let w=S%3*2/3-1,T=S>2?0:-1,C=[w,T,0,w+2/3,T,0,w+2/3,T+1,0,w,T,0,w+2/3,T+1,0,w,T+1,0];_.set(C,g*d*S),y.set(h,m*d*S);let b=[S,S,S,S,S,S];x.set(b,v*d*S)}let M=new Qa;M.setAttribute("position",new ga(_,g)),M.setAttribute("uv",new ga(y,m)),M.setAttribute("faceIndex",new ga(x,v)),e.push(M),n>Gg&&n--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function zre(r,e,t){let i=new $a(r,e,t);return i.texture.mapping=oh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function CA(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function ETe(r,e,t){let i=new Float32Array(wd),n=new be(0,1,0);return new ya({name:"SphericalGaussianBlur",defines:{n:wd,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:jF(),fragmentShader:`
  6366. precision mediump float;
  6367. precision mediump int;
  6368. varying vec3 vOutputDirection;
  6369. uniform sampler2D envMap;
  6370. uniform int samples;
  6371. uniform float weights[ n ];
  6372. uniform bool latitudinal;
  6373. uniform float dTheta;
  6374. uniform float mipInt;
  6375. uniform vec3 poleAxis;
  6376. #define ENVMAP_TYPE_CUBE_UV
  6377. #include <cube_uv_reflection_fragment>
  6378. vec3 getSample( float theta, vec3 axis ) {
  6379. float cosTheta = cos( theta );
  6380. // Rodrigues' axis-angle rotation
  6381. vec3 sampleDirection = vOutputDirection * cosTheta
  6382. + cross( axis, vOutputDirection ) * sin( theta )
  6383. + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
  6384. return bilinearCubeUV( envMap, sampleDirection, mipInt );
  6385. }
  6386. void main() {
  6387. vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
  6388. if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
  6389. axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
  6390. }
  6391. axis = normalize( axis );
  6392. gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  6393. gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
  6394. for ( int i = 1; i < n; i++ ) {
  6395. if ( i >= samples ) {
  6396. break;
  6397. }
  6398. float theta = dTheta * float( i );
  6399. gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
  6400. gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
  6401. }
  6402. }
  6403. `,blending:ms,depthTest:!1,depthWrite:!1})}function Bre(){return new ya({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:jF(),fragmentShader:`
  6404. precision mediump float;
  6405. precision mediump int;
  6406. varying vec3 vOutputDirection;
  6407. uniform sampler2D envMap;
  6408. #include <common>
  6409. void main() {
  6410. vec3 outputDirection = normalize( vOutputDirection );
  6411. vec2 uv = equirectUv( outputDirection );
  6412. gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
  6413. }
  6414. `,blending:ms,depthTest:!1,depthWrite:!1})}function kre(){return new ya({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:jF(),fragmentShader:`
  6415. precision mediump float;
  6416. precision mediump int;
  6417. uniform float flipEnvMap;
  6418. varying vec3 vOutputDirection;
  6419. uniform samplerCube envMap;
  6420. void main() {
  6421. gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
  6422. }
  6423. `,blending:ms,depthTest:!1,depthWrite:!1})}function jF(){return`
  6424. precision mediump float;
  6425. precision mediump int;
  6426. attribute float faceIndex;
  6427. varying vec3 vOutputDirection;
  6428. // RH coordinate system; PMREM face-indexing convention
  6429. vec3 getDirection( vec2 uv, float face ) {
  6430. uv = 2.0 * uv - 1.0;
  6431. vec3 direction = vec3( uv, 1.0 );
  6432. if ( face == 0.0 ) {
  6433. direction = direction.zyx; // ( 1, v, u ) pos x
  6434. } else if ( face == 1.0 ) {
  6435. direction = direction.xzy;
  6436. direction.xz *= -1.0; // ( -u, 1, -v ) pos y
  6437. } else if ( face == 2.0 ) {
  6438. direction.x *= -1.0; // ( -u, v, 1 ) pos z
  6439. } else if ( face == 3.0 ) {
  6440. direction = direction.zyx;
  6441. direction.xz *= -1.0; // ( -1, v, -u ) neg x
  6442. } else if ( face == 4.0 ) {
  6443. direction = direction.xzy;
  6444. direction.xy *= -1.0; // ( -u, -1, v ) neg y
  6445. } else if ( face == 5.0 ) {
  6446. direction.z *= -1.0; // ( u, v, -1 ) neg z
  6447. }
  6448. return direction;
  6449. }
  6450. void main() {
  6451. vOutputDirection = getDirection( uv, faceIndex );
  6452. gl_Position = vec4( position, 1.0 );
  6453. }
  6454. `}function Vre(r){let e=new WeakMap,t=null;function i(s){if(s&&s.isTexture){let l=s.mapping,u=l===aS||l===oS,c=l===al||l===tu;if(u||c)if(s.isRenderTargetTexture&&s.needsPMREMUpdate===!0){s.needsPMREMUpdate=!1;let f=e.get(s);return t===null&&(t=new vS(r)),f=u?t.fromEquirectangular(s,f):t.fromCubemap(s,f),e.set(s,f),f.texture}else{if(e.has(s))return e.get(s).texture;{let f=s.image;if(u&&f&&f.height>0||c&&f&&n(f)){t===null&&(t=new vS(r));let h=u?t.fromEquirectangular(s):t.fromCubemap(s);return e.set(s,h),s.addEventListener("dispose",a),h.texture}else return null}}}return s}function n(s){let l=0,u=6;for(let c=0;c<u;c++)s[c]!==void 0&&l++;return l===u}function a(s){let l=s.target;l.removeEventListener("dispose",a);let u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function Gre(r){let e={};function t(i){if(e[i]!==void 0)return e[i];let n;switch(i){case"WEBGL_depth_texture":n=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=r.getExtension(i)}return e[i]=n,n}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){let n=t(i);return n===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),n}}}function Hre(r,e,t,i){let n={},a=new WeakMap;function o(f){let h=f.target;h.index!==null&&e.remove(h.index);for(let d in h.attributes)e.remove(h.attributes[d]);for(let d in h.morphAttributes){let g=h.morphAttributes[d];for(let m=0,v=g.length;m<v;m++)e.remove(g[m])}h.removeEventListener("dispose",o),delete n[h.id];let p=a.get(h);p&&(e.remove(p),a.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function s(f,h){return n[h.id]===!0||(h.addEventListener("dispose",o),n[h.id]=!0,t.memory.geometries++),h}function l(f){let h=f.attributes;for(let d in h)e.update(h[d],r.ARRAY_BUFFER);let p=f.morphAttributes;for(let d in p){let g=p[d];for(let m=0,v=g.length;m<v;m++)e.update(g[m],r.ARRAY_BUFFER)}}function u(f){let h=[],p=f.index,d=f.attributes.position,g=0;if(p!==null){let _=p.array;g=p.version;for(let y=0,x=_.length;y<x;y+=3){let M=_[y+0],S=_[y+1],w=_[y+2];h.push(M,S,S,w,w,M)}}else if(d!==void 0){let _=d.array;g=d.version;for(let y=0,x=_.length/3-1;y<x;y+=3){let M=y+0,S=y+1,w=y+2;h.push(M,S,S,w,w,M)}}else return;let m=new(QE(h)?Lg:Rg)(h,1);m.version=g;let v=a.get(f);v&&e.remove(v),a.set(f,m)}function c(f){let h=a.get(f);if(h){let p=f.index;p!==null&&h.version<p.version&&u(f)}else u(f);return a.get(f)}return{get:s,update:l,getWireframeAttribute:c}}function Wre(r,e,t,i){let n=i.isWebGL2,a;function o(p){a=p}let s,l;function u(p){s=p.type,l=p.bytesPerElement}function c(p,d){r.drawElements(a,d,s,p*l),t.update(d,a,1)}function f(p,d,g){if(g===0)return;let m,v;if(n)m=r,v="drawElementsInstanced";else if(m=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[v](a,d,s,p*l,g),t.update(d,a,g)}function h(p,d,g){if(g===0)return;let m=e.get("WEBGL_multi_draw");if(m===null)for(let v=0;v<g;v++)this.render(p[v]/l,d[v]);else{m.multiDrawElementsWEBGL(a,d,0,s,p,0,g);let v=0;for(let _=0;_<g;_++)v+=d[_];t.update(v,a,1)}}this.setMode=o,this.setIndex=u,this.render=c,this.renderInstances=f,this.renderMultiDraw=h}function Xre(r){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,o,s){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=s*(a/3);break;case r.LINES:t.lines+=s*(a/2);break;case r.LINE_STRIP:t.lines+=s*(a-1);break;case r.LINE_LOOP:t.lines+=s*a;break;case r.POINTS:t.points+=s*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function n(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:n,update:i}}function ATe(r,e){return r[0]-e[0]}function CTe(r,e){return Math.abs(e[1])-Math.abs(r[1])}function Yre(r,e,t){let i={},n=new Float32Array(8),a=new WeakMap,o=new ii,s=[];for(let u=0;u<8;u++)s[u]=[u,0];function l(u,c,f){let h=u.morphTargetInfluences;if(e.isWebGL2===!0){let d=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,g=d!==void 0?d.length:0,m=a.get(c);if(m===void 0||m.count!==g){let R=function(){E.dispose(),a.delete(c),c.removeEventListener("dispose",R)};var p=R;m!==void 0&&m.texture.dispose();let v=c.morphAttributes.position!==void 0,_=c.morphAttributes.normal!==void 0,y=c.morphAttributes.color!==void 0,x=c.morphAttributes.position||[],M=c.morphAttributes.normal||[],S=c.morphAttributes.color||[],w=0;v===!0&&(w=1),_===!0&&(w=2),y===!0&&(w=3);let T=c.attributes.position.count*w,C=1;T>e.maxTextureSize&&(C=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);let b=new Float32Array(T*C*4*g),E=new xg(b,T,C,g);E.type=Ya,E.needsUpdate=!0;let I=w*4;for(let A=0;A<g;A++){let D=x[A],U=M[A],B=S[A],F=T*C*4*A;for(let k=0;k<D.count;k++){let G=k*I;v===!0&&(o.fromBufferAttribute(D,k),b[F+G+0]=o.x,b[F+G+1]=o.y,b[F+G+2]=o.z,b[F+G+3]=0),_===!0&&(o.fromBufferAttribute(U,k),b[F+G+4]=o.x,b[F+G+5]=o.y,b[F+G+6]=o.z,b[F+G+7]=0),y===!0&&(o.fromBufferAttribute(B,k),b[F+G+8]=o.x,b[F+G+9]=o.y,b[F+G+10]=o.z,b[F+G+11]=B.itemSize===4?o.w:1)}}m={count:g,texture:E,size:new Kt(T,C)},a.set(c,m),c.addEventListener("dispose",R)}if(u.isInstancedMesh===!0&&u.morphTexture!==null)f.getUniforms().setValue(r,"morphTexture",u.morphTexture,t);else{let v=0;for(let y=0;y<h.length;y++)v+=h[y];let _=c.morphTargetsRelative?1:1-v;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",h)}f.getUniforms().setValue(r,"morphTargetsTexture",m.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",m.size)}else{let d=h===void 0?0:h.length,g=i[c.id];if(g===void 0||g.length!==d){g=[];for(let x=0;x<d;x++)g[x]=[x,0];i[c.id]=g}for(let x=0;x<d;x++){let M=g[x];M[0]=x,M[1]=h[x]}g.sort(CTe);for(let x=0;x<8;x++)x<d&&g[x][1]?(s[x][0]=g[x][0],s[x][1]=g[x][1]):(s[x][0]=Number.MAX_SAFE_INTEGER,s[x][1]=0);s.sort(ATe);let m=c.morphAttributes.position,v=c.morphAttributes.normal,_=0;for(let x=0;x<8;x++){let M=s[x],S=M[0],w=M[1];S!==Number.MAX_SAFE_INTEGER&&w?(m&&c.getAttribute("morphTarget"+x)!==m[S]&&c.setAttribute("morphTarget"+x,m[S]),v&&c.getAttribute("morphNormal"+x)!==v[S]&&c.setAttribute("morphNormal"+x,v[S]),n[x]=w,_+=w):(m&&c.hasAttribute("morphTarget"+x)===!0&&c.deleteAttribute("morphTarget"+x),v&&c.hasAttribute("morphNormal"+x)===!0&&c.deleteAttribute("morphNormal"+x),n[x]=0)}let y=c.morphTargetsRelative?1:1-_;f.getUniforms().setValue(r,"morphTargetBaseInfluence",y),f.getUniforms().setValue(r,"morphTargetInfluences",n)}}return{update:l}}function qre(r,e,t,i){let n=new WeakMap;function a(l){let u=i.render.frame,c=l.geometry,f=e.get(l,c);if(n.get(f)!==u&&(e.update(f),n.set(f,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",s)===!1&&l.addEventListener("dispose",s),n.get(l)!==u&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),n.set(l,u))),l.isSkinnedMesh){let h=l.skeleton;n.get(h)!==u&&(h.update(),n.set(h,u))}return f}function o(){n=new WeakMap}function s(l){let u=l.target;u.removeEventListener("dispose",s),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}var Hg=class extends Ja{constructor(e,t,i,n,a,o,s,l,u,c){if(c=c!==void 0?c:sl,c!==sl&&c!==ru)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===sl&&(i=Lo),i===void 0&&c===ru&&(i=gs),super(null,n,a,o,s,l,c,i,u),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=s!==void 0?s:ki,this.minFilter=l!==void 0?l:ki,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}};var eie=new Ja,tie=new Hg(1,1);tie.compareFunction=KE;var rie=new xg,iie=new iA,nie=new zg,Zre=[],jre=[],Kre=new Float32Array(16),Jre=new Float32Array(9),$re=new Float32Array(4);function Wg(r,e,t){let i=r[0];if(i<=0||i>0)return r;let n=e*t,a=Zre[n];if(a===void 0&&(a=new Float32Array(n),Zre[n]=a),e!==0){i.toArray(a,0);for(let o=1,s=0;o!==e;++o)s+=t,r[o].toArray(a,s)}return a}function nn(r,e){if(r.length!==e.length)return!1;for(let t=0,i=r.length;t<i;t++)if(r[t]!==e[t])return!1;return!0}function an(r,e){for(let t=0,i=e.length;t<i;t++)r[t]=e[t]}function RA(r,e){let t=jre[e];t===void 0&&(t=new Int32Array(e),jre[e]=t);for(let i=0;i!==e;++i)t[i]=r.allocateTextureUnit();return t}function RTe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function LTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(nn(t,e))return;r.uniform2fv(this.addr,e),an(t,e)}}function PTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(nn(t,e))return;r.uniform3fv(this.addr,e),an(t,e)}}function DTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(nn(t,e))return;r.uniform4fv(this.addr,e),an(t,e)}}function ITe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(nn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),an(t,e)}else{if(nn(t,i))return;$re.set(i),r.uniformMatrix2fv(this.addr,!1,$re),an(t,i)}}function NTe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(nn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),an(t,e)}else{if(nn(t,i))return;Jre.set(i),r.uniformMatrix3fv(this.addr,!1,Jre),an(t,i)}}function UTe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(nn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),an(t,e)}else{if(nn(t,i))return;Kre.set(i),r.uniformMatrix4fv(this.addr,!1,Kre),an(t,i)}}function OTe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function FTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(nn(t,e))return;r.uniform2iv(this.addr,e),an(t,e)}}function zTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(nn(t,e))return;r.uniform3iv(this.addr,e),an(t,e)}}function BTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(nn(t,e))return;r.uniform4iv(this.addr,e),an(t,e)}}function kTe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function VTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(nn(t,e))return;r.uniform2uiv(this.addr,e),an(t,e)}}function GTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(nn(t,e))return;r.uniform3uiv(this.addr,e),an(t,e)}}function HTe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(nn(t,e))return;r.uniform4uiv(this.addr,e),an(t,e)}}function WTe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n);let a=this.type===r.SAMPLER_2D_SHADOW?tie:eie;t.setTexture2D(e||a,n)}function XTe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||iie,n)}function YTe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTextureCube(e||nie,n)}function qTe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||rie,n)}function ZTe(r){switch(r){case 5126:return RTe;case 35664:return LTe;case 35665:return PTe;case 35666:return DTe;case 35674:return ITe;case 35675:return NTe;case 35676:return UTe;case 5124:case 35670:return OTe;case 35667:case 35671:return FTe;case 35668:case 35672:return zTe;case 35669:case 35673:return BTe;case 5125:return kTe;case 36294:return VTe;case 36295:return GTe;case 36296:return HTe;case 35678:case 36198:case 36298:case 36306:case 35682:return WTe;case 35679:case 36299:case 36307:return XTe;case 35680:case 36300:case 36308:case 36293:return YTe;case 36289:case 36303:case 36311:case 36292:return qTe}}function jTe(r,e){r.uniform1fv(this.addr,e)}function KTe(r,e){let t=Wg(e,this.size,2);r.uniform2fv(this.addr,t)}function JTe(r,e){let t=Wg(e,this.size,3);r.uniform3fv(this.addr,t)}function $Te(r,e){let t=Wg(e,this.size,4);r.uniform4fv(this.addr,t)}function QTe(r,e){let t=Wg(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function eEe(r,e){let t=Wg(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function tEe(r,e){let t=Wg(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function rEe(r,e){r.uniform1iv(this.addr,e)}function iEe(r,e){r.uniform2iv(this.addr,e)}function nEe(r,e){r.uniform3iv(this.addr,e)}function aEe(r,e){r.uniform4iv(this.addr,e)}function oEe(r,e){r.uniform1uiv(this.addr,e)}function sEe(r,e){r.uniform2uiv(this.addr,e)}function lEe(r,e){r.uniform3uiv(this.addr,e)}function uEe(r,e){r.uniform4uiv(this.addr,e)}function cEe(r,e,t){let i=this.cache,n=e.length,a=RA(t,n);nn(i,a)||(r.uniform1iv(this.addr,a),an(i,a));for(let o=0;o!==n;++o)t.setTexture2D(e[o]||eie,a[o])}function fEe(r,e,t){let i=this.cache,n=e.length,a=RA(t,n);nn(i,a)||(r.uniform1iv(this.addr,a),an(i,a));for(let o=0;o!==n;++o)t.setTexture3D(e[o]||iie,a[o])}function hEe(r,e,t){let i=this.cache,n=e.length,a=RA(t,n);nn(i,a)||(r.uniform1iv(this.addr,a),an(i,a));for(let o=0;o!==n;++o)t.setTextureCube(e[o]||nie,a[o])}function pEe(r,e,t){let i=this.cache,n=e.length,a=RA(t,n);nn(i,a)||(r.uniform1iv(this.addr,a),an(i,a));for(let o=0;o!==n;++o)t.setTexture2DArray(e[o]||rie,a[o])}function dEe(r){switch(r){case 5126:return jTe;case 35664:return KTe;case 35665:return JTe;case 35666:return $Te;case 35674:return QTe;case 35675:return eEe;case 35676:return tEe;case 5124:case 35670:return rEe;case 35667:case 35671:return iEe;case 35668:case 35672:return nEe;case 35669:case 35673:return aEe;case 5125:return oEe;case 36294:return sEe;case 36295:return lEe;case 36296:return uEe;case 35678:case 36198:case 36298:case 36306:case 35682:return cEe;case 35679:case 36299:case 36307:return fEe;case 35680:case 36300:case 36308:case 36293:return hEe;case 36289:case 36303:case 36311:case 36292:return pEe}}var JF=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=ZTe(t.type)}},$F=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=dEe(t.type)}},QF=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let n=this.seq;for(let a=0,o=n.length;a!==o;++a){let s=n[a];s.setValue(e,t[s.id],i)}}},KF=/(\w+)(\])?(\[|\.)?/g;function Qre(r,e){r.seq.push(e),r.map[e.id]=e}function mEe(r,e,t){let i=r.name,n=i.length;for(KF.lastIndex=0;;){let a=KF.exec(i),o=KF.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){Qre(t,u===void 0?new JF(s,r,e):new $F(s,r,e));break}else{let f=t.map[s];f===void 0&&(f=new QF(s),Qre(t,f)),t=f}}}var gh=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){let a=e.getActiveUniform(t,n),o=e.getUniformLocation(t,a.name);mEe(a,o,this)}}setValue(e,t,i,n){let a=this.map[t];a!==void 0&&a.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];n!==void 0&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let a=0,o=t.length;a!==o;++a){let s=t[a],l=i[s.id];l.needsUpdate!==!1&&s.setValue(e,l.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,a=e.length;n!==a;++n){let o=e[n];o.id in t&&i.push(o)}return i}};function ez(r,e,t){let i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}var vEe=37297,gEe=0;function yEe(r,e){let t=r.split(`
  6455. `),i=[],n=Math.max(e-6,0),a=Math.min(e+6,t.length);for(let o=n;o<a;o++){let s=o+1;i.push(`${s===e?">":" "} ${s}: ${t[o]}`)}return i.join(`
  6456. `)}function _Ee(r){let e=Er.getPrimaries(Er.workingColorSpace),t=Er.getPrimaries(r),i;switch(e===t?i="":e===dg&&t===pg?i="LinearDisplayP3ToLinearSRGB":e===pg&&t===dg&&(i="LinearSRGBToLinearDisplayP3"),r){case Za:case dd:return[i,"LinearTransferOETF"];case qa:case fg:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[i,"LinearTransferOETF"]}}function aie(r,e,t){let i=r.getShaderParameter(e,r.COMPILE_STATUS),n=r.getShaderInfoLog(e).trim();if(i&&n==="")return"";let a=/ERROR: 0:(\d+)/.exec(n);if(a){let o=parseInt(a[1]);return t.toUpperCase()+`
  6457. `+n+`
  6458. `+yEe(r.getShaderSource(e),o)}else return n}function xEe(r,e){let t=_Ee(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function SEe(r,e){let t;switch(e){case K$:t="Linear";break;case J$:t="Reinhard";break;case $$:t="OptimizedCineon";break;case Q$:t="ACESFilmic";break;case tQ:t="AgX";break;case rQ:t="Neutral";break;case eQ:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function MEe(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.alphaToCoverage||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Xg).join(`
  6459. `)}function bEe(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Xg).join(`
  6460. `)}function wEe(r){let e=[];for(let t in r){let i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  6461. `)}function TEe(r,e){let t={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){let a=r.getActiveAttrib(e,n),o=a.name,s=1;a.type===r.FLOAT_MAT2&&(s=2),a.type===r.FLOAT_MAT3&&(s=3),a.type===r.FLOAT_MAT4&&(s=4),t[o]={type:a.type,location:r.getAttribLocation(e,o),locationSize:s}}return t}function Xg(r){return r!==""}function oie(r,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function sie(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var EEe=/^[ \t]*#include +<([\w\d./]+)>/gm;function tz(r){return r.replace(EEe,CEe)}var AEe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function CEe(r,e){let t=pr[e];if(t===void 0){let i=AEe.get(e);if(i!==void 0)t=pr[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return tz(t)}var REe=/#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 lie(r){return r.replace(REe,LEe)}function LEe(r,e,t,i){let n="";for(let a=parseInt(e);a<parseInt(t);a++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return n}function uie(r){let e=`precision ${r.precision} float;
  6462. precision ${r.precision} int;
  6463. precision ${r.precision} sampler2D;
  6464. precision ${r.precision} samplerCube;
  6465. `;return r.isWebGL2&&(e+=`precision ${r.precision} sampler3D;
  6466. precision ${r.precision} sampler2DArray;
  6467. precision ${r.precision} sampler2DShadow;
  6468. precision ${r.precision} samplerCubeShadow;
  6469. precision ${r.precision} sampler2DArrayShadow;
  6470. precision ${r.precision} isampler2D;
  6471. precision ${r.precision} isampler3D;
  6472. precision ${r.precision} isamplerCube;
  6473. precision ${r.precision} isampler2DArray;
  6474. precision ${r.precision} usampler2D;
  6475. precision ${r.precision} usampler3D;
  6476. precision ${r.precision} usamplerCube;
  6477. precision ${r.precision} usampler2DArray;
  6478. `),r.precision==="highp"?e+=`
  6479. #define HIGH_PRECISION`:r.precision==="mediump"?e+=`
  6480. #define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
  6481. #define LOW_PRECISION`),e}function PEe(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===UE?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===w$?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===nl&&(e="SHADOWMAP_TYPE_VSM"),e}function DEe(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case al:case tu:e="ENVMAP_TYPE_CUBE";break;case oh:e="ENVMAP_TYPE_CUBE_UV";break}return e}function IEe(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case tu:e="ENVMAP_MODE_REFRACTION";break}return e}function NEe(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case OE:e="ENVMAP_BLENDING_MULTIPLY";break;case Z$:e="ENVMAP_BLENDING_MIX";break;case j$:e="ENVMAP_BLENDING_ADD";break}return e}function UEe(r){let e=r.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function cie(r,e,t,i){let n=r.getContext(),a=t.defines,o=t.vertexShader,s=t.fragmentShader,l=PEe(t),u=DEe(t),c=IEe(t),f=NEe(t),h=UEe(t),p=t.isWebGL2?"":MEe(t),d=bEe(t),g=wEe(a),m=n.createProgram(),v,_,y=t.glslVersion?"#version "+t.glslVersion+`
  6482. `:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Xg).join(`
  6483. `),v.length>0&&(v+=`
  6484. `),_=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Xg).join(`
  6485. `),_.length>0&&(_+=`
  6486. `)):(v=[uie(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.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"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  6487. `].filter(Xg).join(`
  6488. `),_=[p,uie(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+c:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==vs?"#define TONE_MAPPING":"",t.toneMapping!==vs?pr.tonemapping_pars_fragment:"",t.toneMapping!==vs?SEe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",pr.colorspace_pars_fragment,xEe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  6489. `].filter(Xg).join(`
  6490. `)),o=tz(o),o=oie(o,t),o=sie(o,t),s=tz(s),s=oie(s,t),s=sie(s,t),o=lie(o),s=lie(s),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
  6491. `,v=[d,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
  6492. `)+`
  6493. `+v,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===TF?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===TF?"":"#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(`
  6494. `)+`
  6495. `+_);let x=y+v+o,M=y+_+s,S=ez(n,n.VERTEX_SHADER,x),w=ez(n,n.FRAGMENT_SHADER,M);n.attachShader(m,S),n.attachShader(m,w),t.index0AttributeName!==void 0?n.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&n.bindAttribLocation(m,0,"position"),n.linkProgram(m);function T(I){if(r.debug.checkShaderErrors){let R=n.getProgramInfoLog(m).trim(),A=n.getShaderInfoLog(S).trim(),D=n.getShaderInfoLog(w).trim(),U=!0,B=!0;if(n.getProgramParameter(m,n.LINK_STATUS)===!1)if(U=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(n,m,S,w);else{let F=aie(n,S,"vertex"),k=aie(n,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(m,n.VALIDATE_STATUS)+`
  6496. Material Name: `+I.name+`
  6497. Material Type: `+I.type+`
  6498. Program Info Log: `+R+`
  6499. `+F+`
  6500. `+k)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(A===""||D==="")&&(B=!1);B&&(I.diagnostics={runnable:U,programLog:R,vertexShader:{log:A,prefix:v},fragmentShader:{log:D,prefix:_}})}n.deleteShader(S),n.deleteShader(w),C=new gh(n,m),b=TEe(n,m)}let C;this.getUniforms=function(){return C===void 0&&T(this),C};let b;this.getAttributes=function(){return b===void 0&&T(this),b};let E=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=n.getProgramParameter(m,vEe)),E},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=gEe++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}var OEe=0,LA=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),a=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(n)===!1&&(o.add(n),n.usedTimes++),o.has(a)===!1&&(o.add(a),a.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new rz(e),t.set(e,i)),i}},rz=class{constructor(e){this.id=OEe++,this.code=e,this.usedTimes=0}};function fie(r,e,t,i,n,a,o){let s=new Tg,l=new LA,u=new Set,c=[],f=n.isWebGL2,h=n.logarithmicDepthBuffer,p=n.vertexTextures,d=n.precision,g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(b){return u.add(b),b===0?"uv":`uv${b}`}function v(b,E,I,R,A){let D=R.fog,U=A.geometry,B=b.isMeshStandardMaterial?R.environment:null,F=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),k=F&&F.mapping===oh?F.image.height:null,G=g[b.type];b.precision!==null&&(d=n.getMaxPrecision(b.precision),d!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",d,"instead."));let Y=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,J=Y!==void 0?Y.length:0,Q=0;U.morphAttributes.position!==void 0&&(Q=1),U.morphAttributes.normal!==void 0&&(Q=2),U.morphAttributes.color!==void 0&&(Q=3);let V,K,ae,ve;if(G){let zt=xs[G];V=zt.vertexShader,K=zt.fragmentShader}else V=b.vertexShader,K=b.fragmentShader,l.update(b),ae=l.getVertexShaderID(b),ve=l.getFragmentShaderID(b);let ue=r.getRenderTarget(),se=A.isInstancedMesh===!0,Ee=A.isBatchedMesh===!0,q=!!b.map,H=!!b.matcap,We=!!F,_e=!!b.aoMap,xe=!!b.lightMap,Le=!!b.bumpMap,Ue=!!b.normalMap,Ne=!!b.displacementMap,Ve=!!b.emissiveMap,ct=!!b.metalnessMap,z=!!b.roughnessMap,L=b.anisotropy>0,ne=b.clearcoat>0,le=b.iridescence>0,me=b.sheen>0,he=b.transmission>0,et=L&&!!b.anisotropyMap,Ke=ne&&!!b.clearcoatMap,Se=ne&&!!b.clearcoatNormalMap,Ae=ne&&!!b.clearcoatRoughnessMap,nt=le&&!!b.iridescenceMap,$=le&&!!b.iridescenceThicknessMap,it=me&&!!b.sheenColorMap,Xe=me&&!!b.sheenRoughnessMap,ze=!!b.specularMap,we=!!b.specularColorMap,Ie=!!b.specularIntensityMap,st=he&&!!b.transmissionMap,Je=he&&!!b.thicknessMap,kt=!!b.gradientMap,X=!!b.alphaMap,Te=b.alphaTest>0,te=!!b.alphaHash,Me=!!b.extensions,Pe=vs;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(Pe=r.toneMapping);let xt={isWebGL2:f,shaderID:G,shaderType:b.type,shaderName:b.name,vertexShader:V,fragmentShader:K,defines:b.defines,customVertexShaderID:ae,customFragmentShaderID:ve,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:d,batching:Ee,instancing:se,instancingColor:se&&A.instanceColor!==null,instancingMorph:se&&A.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:ue===null?r.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:Za,alphaToCoverage:!!b.alphaToCoverage,map:q,matcap:H,envMap:We,envMapMode:We&&F.mapping,envMapCubeUVHeight:k,aoMap:_e,lightMap:xe,bumpMap:Le,normalMap:Ue,displacementMap:p&&Ne,emissiveMap:Ve,normalMapObjectSpace:Ue&&b.normalMapType===dQ,normalMapTangentSpace:Ue&&b.normalMapType===pQ,metalnessMap:ct,roughnessMap:z,anisotropy:L,anisotropyMap:et,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Se,clearcoatRoughnessMap:Ae,iridescence:le,iridescenceMap:nt,iridescenceThicknessMap:$,sheen:me,sheenColorMap:it,sheenRoughnessMap:Xe,specularMap:ze,specularColorMap:we,specularIntensityMap:Ie,transmission:he,transmissionMap:st,thicknessMap:Je,gradientMap:kt,opaque:b.transparent===!1&&b.blending===Yu&&b.alphaToCoverage===!1,alphaMap:X,alphaTest:Te,alphaHash:te,combine:b.combine,mapUv:q&&m(b.map.channel),aoMapUv:_e&&m(b.aoMap.channel),lightMapUv:xe&&m(b.lightMap.channel),bumpMapUv:Le&&m(b.bumpMap.channel),normalMapUv:Ue&&m(b.normalMap.channel),displacementMapUv:Ne&&m(b.displacementMap.channel),emissiveMapUv:Ve&&m(b.emissiveMap.channel),metalnessMapUv:ct&&m(b.metalnessMap.channel),roughnessMapUv:z&&m(b.roughnessMap.channel),anisotropyMapUv:et&&m(b.anisotropyMap.channel),clearcoatMapUv:Ke&&m(b.clearcoatMap.channel),clearcoatNormalMapUv:Se&&m(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&m(b.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&m(b.iridescenceMap.channel),iridescenceThicknessMapUv:$&&m(b.iridescenceThicknessMap.channel),sheenColorMapUv:it&&m(b.sheenColorMap.channel),sheenRoughnessMapUv:Xe&&m(b.sheenRoughnessMap.channel),specularMapUv:ze&&m(b.specularMap.channel),specularColorMapUv:we&&m(b.specularColorMap.channel),specularIntensityMapUv:Ie&&m(b.specularIntensityMap.channel),transmissionMapUv:st&&m(b.transmissionMap.channel),thicknessMapUv:Je&&m(b.thicknessMap.channel),alphaMapUv:X&&m(b.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(Ue||L),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,pointsUvs:A.isPoints===!0&&!!U.attributes.uv&&(q||X),fog:!!D,useFog:b.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:A.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:J,morphTextureStride:Q,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&I.length>0,shadowMapType:r.shadowMap.type,toneMapping:Pe,useLegacyLights:r._useLegacyLights,decodeVideoTexture:q&&b.map.isVideoTexture===!0&&Er.getTransfer(b.map.colorSpace)===Hr,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Co,flipSided:b.side===_i,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:Me&&b.extensions.derivatives===!0,extensionFragDepth:Me&&b.extensions.fragDepth===!0,extensionDrawBuffers:Me&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:Me&&b.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Me&&b.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Me&&b.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionFragDepth:f||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return xt.vertexUv1s=u.has(1),xt.vertexUv2s=u.has(2),xt.vertexUv3s=u.has(3),u.clear(),xt}function _(b){let E=[];if(b.shaderID?E.push(b.shaderID):(E.push(b.customVertexShaderID),E.push(b.customFragmentShaderID)),b.defines!==void 0)for(let I in b.defines)E.push(I),E.push(b.defines[I]);return b.isRawShaderMaterial===!1&&(y(E,b),x(E,b),E.push(r.outputColorSpace)),E.push(b.customProgramCacheKey),E.join()}function y(b,E){b.push(E.precision),b.push(E.outputColorSpace),b.push(E.envMapMode),b.push(E.envMapCubeUVHeight),b.push(E.mapUv),b.push(E.alphaMapUv),b.push(E.lightMapUv),b.push(E.aoMapUv),b.push(E.bumpMapUv),b.push(E.normalMapUv),b.push(E.displacementMapUv),b.push(E.emissiveMapUv),b.push(E.metalnessMapUv),b.push(E.roughnessMapUv),b.push(E.anisotropyMapUv),b.push(E.clearcoatMapUv),b.push(E.clearcoatNormalMapUv),b.push(E.clearcoatRoughnessMapUv),b.push(E.iridescenceMapUv),b.push(E.iridescenceThicknessMapUv),b.push(E.sheenColorMapUv),b.push(E.sheenRoughnessMapUv),b.push(E.specularMapUv),b.push(E.specularColorMapUv),b.push(E.specularIntensityMapUv),b.push(E.transmissionMapUv),b.push(E.thicknessMapUv),b.push(E.combine),b.push(E.fogExp2),b.push(E.sizeAttenuation),b.push(E.morphTargetsCount),b.push(E.morphAttributeCount),b.push(E.numDirLights),b.push(E.numPointLights),b.push(E.numSpotLights),b.push(E.numSpotLightMaps),b.push(E.numHemiLights),b.push(E.numRectAreaLights),b.push(E.numDirLightShadows),b.push(E.numPointLightShadows),b.push(E.numSpotLightShadows),b.push(E.numSpotLightShadowsWithMaps),b.push(E.numLightProbes),b.push(E.shadowMapType),b.push(E.toneMapping),b.push(E.numClippingPlanes),b.push(E.numClipIntersection),b.push(E.depthPacking)}function x(b,E){s.disableAll(),E.isWebGL2&&s.enable(0),E.supportsVertexTextures&&s.enable(1),E.instancing&&s.enable(2),E.instancingColor&&s.enable(3),E.instancingMorph&&s.enable(4),E.matcap&&s.enable(5),E.envMap&&s.enable(6),E.normalMapObjectSpace&&s.enable(7),E.normalMapTangentSpace&&s.enable(8),E.clearcoat&&s.enable(9),E.iridescence&&s.enable(10),E.alphaTest&&s.enable(11),E.vertexColors&&s.enable(12),E.vertexAlphas&&s.enable(13),E.vertexUv1s&&s.enable(14),E.vertexUv2s&&s.enable(15),E.vertexUv3s&&s.enable(16),E.vertexTangents&&s.enable(17),E.anisotropy&&s.enable(18),E.alphaHash&&s.enable(19),E.batching&&s.enable(20),b.push(s.mask),s.disableAll(),E.fog&&s.enable(0),E.useFog&&s.enable(1),E.flatShading&&s.enable(2),E.logarithmicDepthBuffer&&s.enable(3),E.skinning&&s.enable(4),E.morphTargets&&s.enable(5),E.morphNormals&&s.enable(6),E.morphColors&&s.enable(7),E.premultipliedAlpha&&s.enable(8),E.shadowMapEnabled&&s.enable(9),E.useLegacyLights&&s.enable(10),E.doubleSided&&s.enable(11),E.flipSided&&s.enable(12),E.useDepthPacking&&s.enable(13),E.dithering&&s.enable(14),E.transmission&&s.enable(15),E.sheen&&s.enable(16),E.opaque&&s.enable(17),E.pointsUvs&&s.enable(18),E.decodeVideoTexture&&s.enable(19),E.alphaToCoverage&&s.enable(20),b.push(s.mask)}function M(b){let E=g[b.type],I;if(E){let R=xs[E];I=HQ.clone(R.uniforms)}else I=b.uniforms;return I}function S(b,E){let I;for(let R=0,A=c.length;R<A;R++){let D=c[R];if(D.cacheKey===E){I=D,++I.usedTimes;break}}return I===void 0&&(I=new cie(r,E,b,a),c.push(I)),I}function w(b){if(--b.usedTimes===0){let E=c.indexOf(b);c[E]=c[c.length-1],c.pop(),b.destroy()}}function T(b){l.remove(b)}function C(){l.dispose()}return{getParameters:v,getProgramCacheKey:_,getUniforms:M,acquireProgram:S,releaseProgram:w,releaseShaderCache:T,programs:c,dispose:C}}function hie(){let r=new WeakMap;function e(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function t(a){r.delete(a)}function i(a,o,s){r.get(a)[o]=s}function n(){r=new WeakMap}return{get:e,remove:t,update:i,dispose:n}}function FEe(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function pie(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function die(){let r=[],e=0,t=[],i=[],n=[];function a(){e=0,t.length=0,i.length=0,n.length=0}function o(f,h,p,d,g,m){let v=r[e];return v===void 0?(v={id:f.id,object:f,geometry:h,material:p,groupOrder:d,renderOrder:f.renderOrder,z:g,group:m},r[e]=v):(v.id=f.id,v.object=f,v.geometry=h,v.material=p,v.groupOrder=d,v.renderOrder=f.renderOrder,v.z=g,v.group=m),e++,v}function s(f,h,p,d,g,m){let v=o(f,h,p,d,g,m);p.transmission>0?i.push(v):p.transparent===!0?n.push(v):t.push(v)}function l(f,h,p,d,g,m){let v=o(f,h,p,d,g,m);p.transmission>0?i.unshift(v):p.transparent===!0?n.unshift(v):t.unshift(v)}function u(f,h){t.length>1&&t.sort(f||FEe),i.length>1&&i.sort(h||pie),n.length>1&&n.sort(h||pie)}function c(){for(let f=e,h=r.length;f<h;f++){let p=r[f];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:n,init:a,push:s,unshift:l,finish:c,sort:u}}function mie(){let r=new WeakMap;function e(i,n){let a=r.get(i),o;return a===void 0?(o=new die,r.set(i,[o])):n>=a.length?(o=new die,a.push(o)):o=a[n],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function zEe(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new be,color:new ir};break;case"SpotLight":t={position:new be,direction:new be,color:new ir,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new be,color:new ir,distance:0,decay:0};break;case"HemisphereLight":t={direction:new be,skyColor:new ir,groundColor:new ir};break;case"RectAreaLight":t={color:new ir,position:new be,halfWidth:new be,halfHeight:new be};break}return r[e.id]=t,t}}}function BEe(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var kEe=0;function VEe(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function vie(r,e){let t=new zEe,i=BEe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new be);let a=new be,o=new Wr,s=new Wr;function l(c,f){let h=0,p=0,d=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let g=0,m=0,v=0,_=0,y=0,x=0,M=0,S=0,w=0,T=0,C=0;c.sort(VEe);let b=f===!0?Math.PI:1;for(let I=0,R=c.length;I<R;I++){let A=c[I],D=A.color,U=A.intensity,B=A.distance,F=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)h+=D.r*U*b,p+=D.g*U*b,d+=D.b*U*b;else if(A.isLightProbe){for(let k=0;k<9;k++)n.probe[k].addScaledVector(A.sh.coefficients[k],U);C++}else if(A.isDirectionalLight){let k=t.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity*b),A.castShadow){let G=A.shadow,Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,n.directionalShadow[g]=Y,n.directionalShadowMap[g]=F,n.directionalShadowMatrix[g]=A.shadow.matrix,x++}n.directional[g]=k,g++}else if(A.isSpotLight){let k=t.get(A);k.position.setFromMatrixPosition(A.matrixWorld),k.color.copy(D).multiplyScalar(U*b),k.distance=B,k.coneCos=Math.cos(A.angle),k.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),k.decay=A.decay,n.spot[v]=k;let G=A.shadow;if(A.map&&(n.spotLightMap[w]=A.map,w++,G.updateMatrices(A),A.castShadow&&T++),n.spotLightMatrix[v]=G.matrix,A.castShadow){let Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,n.spotShadow[v]=Y,n.spotShadowMap[v]=F,S++}v++}else if(A.isRectAreaLight){let k=t.get(A);k.color.copy(D).multiplyScalar(U),k.halfWidth.set(A.width*.5,0,0),k.halfHeight.set(0,A.height*.5,0),n.rectArea[_]=k,_++}else if(A.isPointLight){let k=t.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity*b),k.distance=A.distance,k.decay=A.decay,A.castShadow){let G=A.shadow,Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,Y.shadowCameraNear=G.camera.near,Y.shadowCameraFar=G.camera.far,n.pointShadow[m]=Y,n.pointShadowMap[m]=F,n.pointShadowMatrix[m]=A.shadow.matrix,M++}n.point[m]=k,m++}else if(A.isHemisphereLight){let k=t.get(A);k.skyColor.copy(A.color).multiplyScalar(U*b),k.groundColor.copy(A.groundColor).multiplyScalar(U*b),n.hemi[y]=k,y++}}_>0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ht.LTC_FLOAT_1,n.rectAreaLTC2=ht.LTC_FLOAT_2):(n.rectAreaLTC1=ht.LTC_HALF_1,n.rectAreaLTC2=ht.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ht.LTC_FLOAT_1,n.rectAreaLTC2=ht.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(n.rectAreaLTC1=ht.LTC_HALF_1,n.rectAreaLTC2=ht.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=h,n.ambient[1]=p,n.ambient[2]=d;let E=n.hash;(E.directionalLength!==g||E.pointLength!==m||E.spotLength!==v||E.rectAreaLength!==_||E.hemiLength!==y||E.numDirectionalShadows!==x||E.numPointShadows!==M||E.numSpotShadows!==S||E.numSpotMaps!==w||E.numLightProbes!==C)&&(n.directional.length=g,n.spot.length=v,n.rectArea.length=_,n.point.length=m,n.hemi.length=y,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=M,n.pointShadowMap.length=M,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=M,n.spotLightMatrix.length=S+w-T,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=C,E.directionalLength=g,E.pointLength=m,E.spotLength=v,E.rectAreaLength=_,E.hemiLength=y,E.numDirectionalShadows=x,E.numPointShadows=M,E.numSpotShadows=S,E.numSpotMaps=w,E.numLightProbes=C,n.version=kEe++)}function u(c,f){let h=0,p=0,d=0,g=0,m=0,v=f.matrixWorldInverse;for(let _=0,y=c.length;_<y;_++){let x=c[_];if(x.isDirectionalLight){let M=n.directional[h];M.direction.setFromMatrixPosition(x.matrixWorld),a.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(a),M.direction.transformDirection(v),h++}else if(x.isSpotLight){let M=n.spot[d];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),M.direction.setFromMatrixPosition(x.matrixWorld),a.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(a),M.direction.transformDirection(v),d++}else if(x.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),s.identity(),o.copy(x.matrixWorld),o.premultiply(v),s.extractRotation(o),M.halfWidth.set(x.width*.5,0,0),M.halfHeight.set(0,x.height*.5,0),M.halfWidth.applyMatrix4(s),M.halfHeight.applyMatrix4(s),g++}else if(x.isPointLight){let M=n.point[p];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),p++}else if(x.isHemisphereLight){let M=n.hemi[m];M.direction.setFromMatrixPosition(x.matrixWorld),M.direction.transformDirection(v),m++}}}return{setup:l,setupView:u,state:n}}function gie(r,e){let t=new vie(r,e),i=[],n=[];function a(){i.length=0,n.length=0}function o(f){i.push(f)}function s(f){n.push(f)}function l(f){t.setup(i,f)}function u(f){t.setupView(i,f)}return{init:a,state:{lightsArray:i,shadowsArray:n,lights:t},setupLights:l,setupLightsView:u,pushLight:o,pushShadow:s}}function yie(r,e){let t=new WeakMap;function i(a,o=0){let s=t.get(a),l;return s===void 0?(l=new gie(r,e),t.set(a,[l])):o>=s.length?(l=new gie(r,e),s.push(l)):l=s[o],l}function n(){t=new WeakMap}return{get:i,dispose:n}}var PA=class extends ou{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=fQ,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};var DA=class extends ou{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};var _ie=`
  6501. void main() {
  6502. gl_Position = vec4( position, 1.0 );
  6503. }
  6504. `,xie=`
  6505. uniform sampler2D shadow_pass;
  6506. uniform vec2 resolution;
  6507. uniform float radius;
  6508. #include <packing>
  6509. void main() {
  6510. const float samples = float( VSM_SAMPLES );
  6511. float mean = 0.0;
  6512. float squared_mean = 0.0;
  6513. float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
  6514. float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
  6515. for ( float i = 0.0; i < samples; i ++ ) {
  6516. float uvOffset = uvStart + i * uvStride;
  6517. #ifdef HORIZONTAL_PASS
  6518. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
  6519. mean += distribution.x;
  6520. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  6521. #else
  6522. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
  6523. mean += depth;
  6524. squared_mean += depth * depth;
  6525. #endif
  6526. }
  6527. mean = mean / samples;
  6528. squared_mean = squared_mean / samples;
  6529. float std_dev = sqrt( squared_mean - mean * mean );
  6530. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  6531. }
  6532. `;function Sie(r,e,t){let i=new vh,n=new Kt,a=new Kt,o=new ii,s=new PA({depthPacking:hQ}),l=new DA,u={},c=t.maxTextureSize,f={[Ao]:_i,[_i]:Ao,[Co]:Co},h=new ya({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Kt},radius:{value:4}},vertexShader:_ie,fragmentShader:xie}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let d=new Qa;d.setAttribute("position",new ga(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new rn(d,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=UE;let v=this.type;this.render=function(S,w,T){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;let C=r.getRenderTarget(),b=r.getActiveCubeFace(),E=r.getActiveMipmapLevel(),I=r.state;I.setBlending(ms),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);let R=v!==nl&&this.type===nl,A=v===nl&&this.type!==nl;for(let D=0,U=S.length;D<U;D++){let B=S[D],F=B.shadow;if(F===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(F.autoUpdate===!1&&F.needsUpdate===!1)continue;n.copy(F.mapSize);let k=F.getFrameExtents();if(n.multiply(k),a.copy(F.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/k.x),n.x=a.x*k.x,F.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/k.y),n.y=a.y*k.y,F.mapSize.y=a.y)),F.map===null||R===!0||A===!0){let Y=this.type!==nl?{minFilter:ki,magFilter:ki}:{};F.map!==null&&F.map.dispose(),F.map=new $a(n.x,n.y,Y),F.map.texture.name=B.name+".shadowMap",F.camera.updateProjectionMatrix()}r.setRenderTarget(F.map),r.clear();let G=F.getViewportCount();for(let Y=0;Y<G;Y++){let J=F.getViewport(Y);o.set(a.x*J.x,a.y*J.y,a.x*J.z,a.y*J.w),I.viewport(o),F.updateMatrices(B,Y),i=F.getFrustum(),x(w,T,F.camera,B,this.type)}F.isPointLightShadow!==!0&&this.type===nl&&_(F,T),F.needsUpdate=!1}v=this.type,m.needsUpdate=!1,r.setRenderTarget(C,b,E)};function _(S,w){let T=e.update(g);h.defines.VSM_SAMPLES!==S.blurSamples&&(h.defines.VSM_SAMPLES=S.blurSamples,p.defines.VSM_SAMPLES=S.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),S.mapPass===null&&(S.mapPass=new $a(n.x,n.y)),h.uniforms.shadow_pass.value=S.map.texture,h.uniforms.resolution.value=S.mapSize,h.uniforms.radius.value=S.radius,r.setRenderTarget(S.mapPass),r.clear(),r.renderBufferDirect(w,null,T,h,g,null),p.uniforms.shadow_pass.value=S.mapPass.texture,p.uniforms.resolution.value=S.mapSize,p.uniforms.radius.value=S.radius,r.setRenderTarget(S.map),r.clear(),r.renderBufferDirect(w,null,T,p,g,null)}function y(S,w,T,C){let b=null,E=T.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(E!==void 0)b=E;else if(b=T.isPointLight===!0?l:s,r.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){let I=b.uuid,R=w.uuid,A=u[I];A===void 0&&(A={},u[I]=A);let D=A[R];D===void 0&&(D=b.clone(),A[R]=D,w.addEventListener("dispose",M)),b=D}if(b.visible=w.visible,b.wireframe=w.wireframe,C===nl?b.side=w.shadowSide!==null?w.shadowSide:w.side:b.side=w.shadowSide!==null?w.shadowSide:f[w.side],b.alphaMap=w.alphaMap,b.alphaTest=w.alphaTest,b.map=w.map,b.clipShadows=w.clipShadows,b.clippingPlanes=w.clippingPlanes,b.clipIntersection=w.clipIntersection,b.displacementMap=w.displacementMap,b.displacementScale=w.displacementScale,b.displacementBias=w.displacementBias,b.wireframeLinewidth=w.wireframeLinewidth,b.linewidth=w.linewidth,T.isPointLight===!0&&b.isMeshDistanceMaterial===!0){let I=r.properties.get(b);I.light=T}return b}function x(S,w,T,C,b){if(S.visible===!1)return;if(S.layers.test(w.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&b===nl)&&(!S.frustumCulled||i.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,S.matrixWorld);let R=e.update(S),A=S.material;if(Array.isArray(A)){let D=R.groups;for(let U=0,B=D.length;U<B;U++){let F=D[U],k=A[F.materialIndex];if(k&&k.visible){let G=y(S,k,C,b);S.onBeforeShadow(r,S,w,T,R,G,F),r.renderBufferDirect(T,null,R,G,S,F),S.onAfterShadow(r,S,w,T,R,G,F)}}}else if(A.visible){let D=y(S,A,C,b);S.onBeforeShadow(r,S,w,T,R,D,null),r.renderBufferDirect(T,null,R,D,S,null),S.onAfterShadow(r,S,w,T,R,D,null)}}let I=S.children;for(let R=0,A=I.length;R<A;R++)x(I[R],w,T,C,b)}function M(S){S.target.removeEventListener("dispose",M);for(let T in u){let C=u[T],b=S.target.uuid;b in C&&(C[b].dispose(),delete C[b])}}}function Mie(r,e,t){let i=t.isWebGL2;function n(){let X=!1,Te=new ii,te=null,Me=new ii(0,0,0,0);return{setMask:function(Pe){te!==Pe&&!X&&(r.colorMask(Pe,Pe,Pe,Pe),te=Pe)},setLocked:function(Pe){X=Pe},setClear:function(Pe,xt,zt,Mr,Zr){Zr===!0&&(Pe*=Mr,xt*=Mr,zt*=Mr),Te.set(Pe,xt,zt,Mr),Me.equals(Te)===!1&&(r.clearColor(Pe,xt,zt,Mr),Me.copy(Te))},reset:function(){X=!1,te=null,Me.set(-1,0,0,0)}}}function a(){let X=!1,Te=null,te=null,Me=null;return{setTest:function(Pe){Pe?se(r.DEPTH_TEST):Ee(r.DEPTH_TEST)},setMask:function(Pe){Te!==Pe&&!X&&(r.depthMask(Pe),Te=Pe)},setFunc:function(Pe){if(te!==Pe){switch(Pe){case V$:r.depthFunc(r.NEVER);break;case G$:r.depthFunc(r.ALWAYS);break;case H$:r.depthFunc(r.LESS);break;case lg:r.depthFunc(r.LEQUAL);break;case W$:r.depthFunc(r.EQUAL);break;case X$:r.depthFunc(r.GEQUAL);break;case Y$:r.depthFunc(r.GREATER);break;case q$:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}te=Pe}},setLocked:function(Pe){X=Pe},setClear:function(Pe){Me!==Pe&&(r.clearDepth(Pe),Me=Pe)},reset:function(){X=!1,Te=null,te=null,Me=null}}}function o(){let X=!1,Te=null,te=null,Me=null,Pe=null,xt=null,zt=null,Mr=null,Zr=null;return{setTest:function(Vt){X||(Vt?se(r.STENCIL_TEST):Ee(r.STENCIL_TEST))},setMask:function(Vt){Te!==Vt&&!X&&(r.stencilMask(Vt),Te=Vt)},setFunc:function(Vt,Dr,oi){(te!==Vt||Me!==Dr||Pe!==oi)&&(r.stencilFunc(Vt,Dr,oi),te=Vt,Me=Dr,Pe=oi)},setOp:function(Vt,Dr,oi){(xt!==Vt||zt!==Dr||Mr!==oi)&&(r.stencilOp(Vt,Dr,oi),xt=Vt,zt=Dr,Mr=oi)},setLocked:function(Vt){X=Vt},setClear:function(Vt){Zr!==Vt&&(r.clearStencil(Vt),Zr=Vt)},reset:function(){X=!1,Te=null,te=null,Me=null,Pe=null,xt=null,zt=null,Mr=null,Zr=null}}}let s=new n,l=new a,u=new o,c=new WeakMap,f=new WeakMap,h={},p={},d=new WeakMap,g=[],m=null,v=!1,_=null,y=null,x=null,M=null,S=null,w=null,T=null,C=new ir(0,0,0),b=0,E=!1,I=null,R=null,A=null,D=null,U=null,B=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),F=!1,k=0,G=r.getParameter(r.VERSION);G.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(G)[1]),F=k>=1):G.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),F=k>=2);let Y=null,J={},Q=r.getParameter(r.SCISSOR_BOX),V=r.getParameter(r.VIEWPORT),K=new ii().fromArray(Q),ae=new ii().fromArray(V);function ve(X,Te,te,Me){let Pe=new Uint8Array(4),xt=r.createTexture();r.bindTexture(X,xt),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let zt=0;zt<te;zt++)i&&(X===r.TEXTURE_3D||X===r.TEXTURE_2D_ARRAY)?r.texImage3D(Te,0,r.RGBA,1,1,Me,0,r.RGBA,r.UNSIGNED_BYTE,Pe):r.texImage2D(Te+zt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Pe);return xt}let ue={};ue[r.TEXTURE_2D]=ve(r.TEXTURE_2D,r.TEXTURE_2D,1),ue[r.TEXTURE_CUBE_MAP]=ve(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(ue[r.TEXTURE_2D_ARRAY]=ve(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),ue[r.TEXTURE_3D]=ve(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),s.setClear(0,0,0,1),l.setClear(1),u.setClear(0),se(r.DEPTH_TEST),l.setFunc(lg),Ne(!1),Ve(W3),se(r.CULL_FACE),Le(ms);function se(X){h[X]!==!0&&(r.enable(X),h[X]=!0)}function Ee(X){h[X]!==!1&&(r.disable(X),h[X]=!1)}function q(X,Te){return p[X]!==Te?(r.bindFramebuffer(X,Te),p[X]=Te,i&&(X===r.DRAW_FRAMEBUFFER&&(p[r.FRAMEBUFFER]=Te),X===r.FRAMEBUFFER&&(p[r.DRAW_FRAMEBUFFER]=Te)),!0):!1}function H(X,Te){let te=g,Me=!1;if(X){te=d.get(Te),te===void 0&&(te=[],d.set(Te,te));let Pe=X.textures;if(te.length!==Pe.length||te[0]!==r.COLOR_ATTACHMENT0){for(let xt=0,zt=Pe.length;xt<zt;xt++)te[xt]=r.COLOR_ATTACHMENT0+xt;te.length=Pe.length,Me=!0}}else te[0]!==r.BACK&&(te[0]=r.BACK,Me=!0);if(Me)if(t.isWebGL2)r.drawBuffers(te);else if(e.has("WEBGL_draw_buffers")===!0)e.get("WEBGL_draw_buffers").drawBuffersWEBGL(te);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function We(X){return m!==X?(r.useProgram(X),m=X,!0):!1}let _e={[qu]:r.FUNC_ADD,[E$]:r.FUNC_SUBTRACT,[A$]:r.FUNC_REVERSE_SUBTRACT};if(i)_e[Z3]=r.MIN,_e[j3]=r.MAX;else{let X=e.get("EXT_blend_minmax");X!==null&&(_e[Z3]=X.MIN_EXT,_e[j3]=X.MAX_EXT)}let xe={[C$]:r.ZERO,[R$]:r.ONE,[L$]:r.SRC_COLOR,[iS]:r.SRC_ALPHA,[O$]:r.SRC_ALPHA_SATURATE,[N$]:r.DST_COLOR,[D$]:r.DST_ALPHA,[P$]:r.ONE_MINUS_SRC_COLOR,[nS]:r.ONE_MINUS_SRC_ALPHA,[U$]:r.ONE_MINUS_DST_COLOR,[I$]:r.ONE_MINUS_DST_ALPHA,[F$]:r.CONSTANT_COLOR,[z$]:r.ONE_MINUS_CONSTANT_COLOR,[B$]:r.CONSTANT_ALPHA,[k$]:r.ONE_MINUS_CONSTANT_ALPHA};function Le(X,Te,te,Me,Pe,xt,zt,Mr,Zr,Vt){if(X===ms){v===!0&&(Ee(r.BLEND),v=!1);return}if(v===!1&&(se(r.BLEND),v=!0),X!==T$){if(X!==_||Vt!==E){if((y!==qu||S!==qu)&&(r.blendEquation(r.FUNC_ADD),y=qu,S=qu),Vt)switch(X){case Yu:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case X3:r.blendFunc(r.ONE,r.ONE);break;case Y3:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case q3:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}else switch(X){case Yu:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case X3:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Y3:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case q3:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}x=null,M=null,w=null,T=null,C.set(0,0,0),b=0,_=X,E=Vt}return}Pe=Pe||Te,xt=xt||te,zt=zt||Me,(Te!==y||Pe!==S)&&(r.blendEquationSeparate(_e[Te],_e[Pe]),y=Te,S=Pe),(te!==x||Me!==M||xt!==w||zt!==T)&&(r.blendFuncSeparate(xe[te],xe[Me],xe[xt],xe[zt]),x=te,M=Me,w=xt,T=zt),(Mr.equals(C)===!1||Zr!==b)&&(r.blendColor(Mr.r,Mr.g,Mr.b,Zr),C.copy(Mr),b=Zr),_=X,E=!1}function Ue(X,Te){X.side===Co?Ee(r.CULL_FACE):se(r.CULL_FACE);let te=X.side===_i;Te&&(te=!te),Ne(te),X.blending===Yu&&X.transparent===!1?Le(ms):Le(X.blending,X.blendEquation,X.blendSrc,X.blendDst,X.blendEquationAlpha,X.blendSrcAlpha,X.blendDstAlpha,X.blendColor,X.blendAlpha,X.premultipliedAlpha),l.setFunc(X.depthFunc),l.setTest(X.depthTest),l.setMask(X.depthWrite),s.setMask(X.colorWrite);let Me=X.stencilWrite;u.setTest(Me),Me&&(u.setMask(X.stencilWriteMask),u.setFunc(X.stencilFunc,X.stencilRef,X.stencilFuncMask),u.setOp(X.stencilFail,X.stencilZFail,X.stencilZPass)),z(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),X.alphaToCoverage===!0?se(r.SAMPLE_ALPHA_TO_COVERAGE):Ee(r.SAMPLE_ALPHA_TO_COVERAGE)}function Ne(X){I!==X&&(X?r.frontFace(r.CW):r.frontFace(r.CCW),I=X)}function Ve(X){X!==M$?(se(r.CULL_FACE),X!==R&&(X===W3?r.cullFace(r.BACK):X===b$?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Ee(r.CULL_FACE),R=X}function ct(X){X!==A&&(F&&r.lineWidth(X),A=X)}function z(X,Te,te){X?(se(r.POLYGON_OFFSET_FILL),(D!==Te||U!==te)&&(r.polygonOffset(Te,te),D=Te,U=te)):Ee(r.POLYGON_OFFSET_FILL)}function L(X){X?se(r.SCISSOR_TEST):Ee(r.SCISSOR_TEST)}function ne(X){X===void 0&&(X=r.TEXTURE0+B-1),Y!==X&&(r.activeTexture(X),Y=X)}function le(X,Te,te){te===void 0&&(Y===null?te=r.TEXTURE0+B-1:te=Y);let Me=J[te];Me===void 0&&(Me={type:void 0,texture:void 0},J[te]=Me),(Me.type!==X||Me.texture!==Te)&&(Y!==te&&(r.activeTexture(te),Y=te),r.bindTexture(X,Te||ue[X]),Me.type=X,Me.texture=Te)}function me(){let X=J[Y];X!==void 0&&X.type!==void 0&&(r.bindTexture(X.type,null),X.type=void 0,X.texture=void 0)}function he(){try{r.compressedTexImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function et(){try{r.compressedTexImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ke(){try{r.texSubImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Se(){try{r.texSubImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ae(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function nt(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function $(){try{r.texStorage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function it(){try{r.texStorage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Xe(){try{r.texImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function ze(){try{r.texImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function we(X){K.equals(X)===!1&&(r.scissor(X.x,X.y,X.z,X.w),K.copy(X))}function Ie(X){ae.equals(X)===!1&&(r.viewport(X.x,X.y,X.z,X.w),ae.copy(X))}function st(X,Te){let te=f.get(Te);te===void 0&&(te=new WeakMap,f.set(Te,te));let Me=te.get(X);Me===void 0&&(Me=r.getUniformBlockIndex(Te,X.name),te.set(X,Me))}function Je(X,Te){let Me=f.get(Te).get(X);c.get(Te)!==Me&&(r.uniformBlockBinding(Te,Me,X.__bindingPointIndex),c.set(Te,Me))}function kt(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),i===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},Y=null,J={},p={},d=new WeakMap,g=[],m=null,v=!1,_=null,y=null,x=null,M=null,S=null,w=null,T=null,C=new ir(0,0,0),b=0,E=!1,I=null,R=null,A=null,D=null,U=null,K.set(0,0,r.canvas.width,r.canvas.height),ae.set(0,0,r.canvas.width,r.canvas.height),s.reset(),l.reset(),u.reset()}return{buffers:{color:s,depth:l,stencil:u},enable:se,disable:Ee,bindFramebuffer:q,drawBuffers:H,useProgram:We,setBlending:Le,setMaterial:Ue,setFlipSided:Ne,setCullFace:Ve,setLineWidth:ct,setPolygonOffset:z,setScissorTest:L,activeTexture:ne,bindTexture:le,unbindTexture:me,compressedTexImage2D:he,compressedTexImage3D:et,texImage2D:Xe,texImage3D:ze,updateUBOMapping:st,uniformBlockBinding:Je,texStorage2D:$,texStorage3D:it,texSubImage2D:Ke,texSubImage3D:Se,compressedTexSubImage2D:Ae,compressedTexSubImage3D:nt,scissor:we,viewport:Ie,reset:kt}}function bie(r,e,t,i,n,a,o){let s=n.isWebGL2,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Kt,f=new WeakMap,h,p=new WeakMap,d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(z,L){return d?new OffscreenCanvas(z,L):vg("canvas")}function m(z,L,ne,le){let me=1,he=ct(z);if((he.width>le||he.height>le)&&(me=le/Math.max(he.width,he.height)),me<1||L===!0)if(typeof HTMLImageElement<"u"&&z instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&z instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&z instanceof ImageBitmap||typeof VideoFrame<"u"&&z instanceof VideoFrame){let et=L?fS:Math.floor,Ke=et(me*he.width),Se=et(me*he.height);h===void 0&&(h=g(Ke,Se));let Ae=ne?g(Ke,Se):h;return Ae.width=Ke,Ae.height=Se,Ae.getContext("2d").drawImage(z,0,0,Ke,Se),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+Ke+"x"+Se+")."),Ae}else return"data"in z&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),z;return z}function v(z){let L=ct(z);return EF(L.width)&&EF(L.height)}function _(z){return s?!1:z.wrapS!==ma||z.wrapT!==ma||z.minFilter!==ki&&z.minFilter!==Qi}function y(z,L){return z.generateMipmaps&&L&&z.minFilter!==ki&&z.minFilter!==Qi}function x(z){r.generateMipmap(z)}function M(z,L,ne,le,me=!1){if(s===!1)return L;if(z!==null){if(r[z]!==void 0)return r[z];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+z+"'")}let he=L;if(L===r.RED&&(ne===r.FLOAT&&(he=r.R32F),ne===r.HALF_FLOAT&&(he=r.R16F),ne===r.UNSIGNED_BYTE&&(he=r.R8)),L===r.RED_INTEGER&&(ne===r.UNSIGNED_BYTE&&(he=r.R8UI),ne===r.UNSIGNED_SHORT&&(he=r.R16UI),ne===r.UNSIGNED_INT&&(he=r.R32UI),ne===r.BYTE&&(he=r.R8I),ne===r.SHORT&&(he=r.R16I),ne===r.INT&&(he=r.R32I)),L===r.RG&&(ne===r.FLOAT&&(he=r.RG32F),ne===r.HALF_FLOAT&&(he=r.RG16F),ne===r.UNSIGNED_BYTE&&(he=r.RG8)),L===r.RG_INTEGER&&(ne===r.UNSIGNED_BYTE&&(he=r.RG8UI),ne===r.UNSIGNED_SHORT&&(he=r.RG16UI),ne===r.UNSIGNED_INT&&(he=r.RG32UI),ne===r.BYTE&&(he=r.RG8I),ne===r.SHORT&&(he=r.RG16I),ne===r.INT&&(he=r.RG32I)),L===r.RGBA){let et=me?hg:Er.getTransfer(le);ne===r.FLOAT&&(he=r.RGBA32F),ne===r.HALF_FLOAT&&(he=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(he=et===Hr?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(he=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(he=r.RGB5_A1)}return(he===r.R16F||he===r.R32F||he===r.RG16F||he===r.RG32F||he===r.RGBA16F||he===r.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function S(z,L,ne){return y(z,ne)===!0||z.isFramebufferTexture&&z.minFilter!==ki&&z.minFilter!==Qi?Math.log2(Math.max(L.width,L.height))+1:z.mipmaps!==void 0&&z.mipmaps.length>0?z.mipmaps.length:z.isCompressedTexture&&Array.isArray(z.image)?L.mipmaps.length:1}function w(z){return z===ki||z===J3||z===ug?r.NEAREST:r.LINEAR}function T(z){let L=z.target;L.removeEventListener("dispose",T),b(L),L.isVideoTexture&&f.delete(L)}function C(z){let L=z.target;L.removeEventListener("dispose",C),I(L)}function b(z){let L=i.get(z);if(L.__webglInit===void 0)return;let ne=z.source,le=p.get(ne);if(le){let me=le[L.__cacheKey];me.usedTimes--,me.usedTimes===0&&E(z),Object.keys(le).length===0&&p.delete(ne)}i.remove(z)}function E(z){let L=i.get(z);r.deleteTexture(L.__webglTexture);let ne=z.source,le=p.get(ne);delete le[L.__cacheKey],o.memory.textures--}function I(z){let L=i.get(z);if(z.depthTexture&&z.depthTexture.dispose(),z.isWebGLCubeRenderTarget)for(let le=0;le<6;le++){if(Array.isArray(L.__webglFramebuffer[le]))for(let me=0;me<L.__webglFramebuffer[le].length;me++)r.deleteFramebuffer(L.__webglFramebuffer[le][me]);else r.deleteFramebuffer(L.__webglFramebuffer[le]);L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer[le])}else{if(Array.isArray(L.__webglFramebuffer))for(let le=0;le<L.__webglFramebuffer.length;le++)r.deleteFramebuffer(L.__webglFramebuffer[le]);else r.deleteFramebuffer(L.__webglFramebuffer);if(L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer),L.__webglMultisampledFramebuffer&&r.deleteFramebuffer(L.__webglMultisampledFramebuffer),L.__webglColorRenderbuffer)for(let le=0;le<L.__webglColorRenderbuffer.length;le++)L.__webglColorRenderbuffer[le]&&r.deleteRenderbuffer(L.__webglColorRenderbuffer[le]);L.__webglDepthRenderbuffer&&r.deleteRenderbuffer(L.__webglDepthRenderbuffer)}let ne=z.textures;for(let le=0,me=ne.length;le<me;le++){let he=i.get(ne[le]);he.__webglTexture&&(r.deleteTexture(he.__webglTexture),o.memory.textures--),i.remove(ne[le])}i.remove(z)}let R=0;function A(){R=0}function D(){let z=R;return z>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+z+" texture units while this GPU supports only "+n.maxTextures),R+=1,z}function U(z){let L=[];return L.push(z.wrapS),L.push(z.wrapT),L.push(z.wrapR||0),L.push(z.magFilter),L.push(z.minFilter),L.push(z.anisotropy),L.push(z.internalFormat),L.push(z.format),L.push(z.type),L.push(z.generateMipmaps),L.push(z.premultiplyAlpha),L.push(z.flipY),L.push(z.unpackAlignment),L.push(z.colorSpace),L.join()}function B(z,L){let ne=i.get(z);if(z.isVideoTexture&&Ne(z),z.isRenderTargetTexture===!1&&z.version>0&&ne.__version!==z.version){let le=z.image;if(le===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ae(ne,z,L);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+L)}function F(z,L){let ne=i.get(z);if(z.version>0&&ne.__version!==z.version){ae(ne,z,L);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+L)}function k(z,L){let ne=i.get(z);if(z.version>0&&ne.__version!==z.version){ae(ne,z,L);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+L)}function G(z,L){let ne=i.get(z);if(z.version>0&&ne.__version!==z.version){ve(ne,z,L);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+L)}let Y={[sS]:r.REPEAT,[ma]:r.CLAMP_TO_EDGE,[lS]:r.MIRRORED_REPEAT},J={[ki]:r.NEAREST,[J3]:r.NEAREST_MIPMAP_NEAREST,[ug]:r.NEAREST_MIPMAP_LINEAR,[Qi]:r.LINEAR,[FE]:r.LINEAR_MIPMAP_NEAREST,[ol]:r.LINEAR_MIPMAP_LINEAR},Q={[mQ]:r.NEVER,[SQ]:r.ALWAYS,[vQ]:r.LESS,[KE]:r.LEQUAL,[gQ]:r.EQUAL,[xQ]:r.GEQUAL,[yQ]:r.GREATER,[_Q]:r.NOTEQUAL};function V(z,L,ne){if(L.type===Ya&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===Qi||L.magFilter===FE||L.magFilter===ug||L.magFilter===ol||L.minFilter===Qi||L.minFilter===FE||L.minFilter===ug||L.minFilter===ol)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),ne?(r.texParameteri(z,r.TEXTURE_WRAP_S,Y[L.wrapS]),r.texParameteri(z,r.TEXTURE_WRAP_T,Y[L.wrapT]),(z===r.TEXTURE_3D||z===r.TEXTURE_2D_ARRAY)&&r.texParameteri(z,r.TEXTURE_WRAP_R,Y[L.wrapR]),r.texParameteri(z,r.TEXTURE_MAG_FILTER,J[L.magFilter]),r.texParameteri(z,r.TEXTURE_MIN_FILTER,J[L.minFilter])):(r.texParameteri(z,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(z,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(z===r.TEXTURE_3D||z===r.TEXTURE_2D_ARRAY)&&r.texParameteri(z,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(L.wrapS!==ma||L.wrapT!==ma)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(z,r.TEXTURE_MAG_FILTER,w(L.magFilter)),r.texParameteri(z,r.TEXTURE_MIN_FILTER,w(L.minFilter)),L.minFilter!==ki&&L.minFilter!==Qi&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),L.compareFunction&&(r.texParameteri(z,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(z,r.TEXTURE_COMPARE_FUNC,Q[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===ki||L.minFilter!==ug&&L.minFilter!==ol||L.type===Ya&&e.has("OES_texture_float_linear")===!1||s===!1&&L.type===Zu&&e.has("OES_texture_half_float_linear")===!1)return;if(L.anisotropy>1||i.get(L).__currentAnisotropy){let le=e.get("EXT_texture_filter_anisotropic");r.texParameterf(z,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy}}}function K(z,L){let ne=!1;z.__webglInit===void 0&&(z.__webglInit=!0,L.addEventListener("dispose",T));let le=L.source,me=p.get(le);me===void 0&&(me={},p.set(le,me));let he=U(L);if(he!==z.__cacheKey){me[he]===void 0&&(me[he]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),me[he].usedTimes++;let et=me[z.__cacheKey];et!==void 0&&(me[z.__cacheKey].usedTimes--,et.usedTimes===0&&E(L)),z.__cacheKey=he,z.__webglTexture=me[he].texture}return ne}function ae(z,L,ne){let le=r.TEXTURE_2D;(L.isDataArrayTexture||L.isCompressedArrayTexture)&&(le=r.TEXTURE_2D_ARRAY),L.isData3DTexture&&(le=r.TEXTURE_3D);let me=K(z,L),he=L.source;t.bindTexture(le,z.__webglTexture,r.TEXTURE0+ne);let et=i.get(he);if(he.version!==et.__version||me===!0){t.activeTexture(r.TEXTURE0+ne);let Ke=Er.getPrimaries(Er.workingColorSpace),Se=L.colorSpace===ys?null:Er.getPrimaries(L.colorSpace),Ae=L.colorSpace===ys||Ke===Se?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let nt=_(L)&&v(L.image)===!1,$=m(L.image,nt,!1,n.maxTextureSize);$=Ve(L,$);let it=v($)||s,Xe=a.convert(L.format,L.colorSpace),ze=a.convert(L.type),we=M(L.internalFormat,Xe,ze,L.colorSpace,L.isVideoTexture);V(le,L,it);let Ie,st=L.mipmaps,Je=s&&L.isVideoTexture!==!0&&we!==ZE,kt=et.__version===void 0||me===!0,X=he.dataReady,Te=S(L,$,it);if(L.isDepthTexture)we=r.DEPTH_COMPONENT,s?L.type===Ya?we=r.DEPTH_COMPONENT32F:L.type===Lo?we=r.DEPTH_COMPONENT24:L.type===gs?we=r.DEPTH24_STENCIL8:we=r.DEPTH_COMPONENT16:L.type===Ya&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===sl&&we===r.DEPTH_COMPONENT&&L.type!==cg&&L.type!==Lo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Lo,ze=a.convert(L.type)),L.format===ru&&we===r.DEPTH_COMPONENT&&(we=r.DEPTH_STENCIL,L.type!==gs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=gs,ze=a.convert(L.type))),kt&&(Je?t.texStorage2D(r.TEXTURE_2D,1,we,$.width,$.height):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,ze,null));else if(L.isDataTexture)if(st.length>0&&it){Je&&kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,st[0].width,st[0].height);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,ze,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,ze,Ie.data);L.generateMipmaps=!1}else Je?(kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height),X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,$.width,$.height,Xe,ze,$.data)):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,ze,$.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){Je&&kt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Te,we,st[0].width,st[0].height,$.depth);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],L.format!==Rn?Xe!==null?Je?X&&t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,Ie.width,Ie.height,$.depth,Xe,Ie.data,0,0):t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Ie.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?X&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,Ie.width,Ie.height,$.depth,Xe,ze,Ie.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Xe,ze,Ie.data)}else{Je&&kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,st[0].width,st[0].height);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],L.format!==Rn?Xe!==null?Je?X&&t.compressedTexSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,Ie.data):t.compressedTexImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,ze,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,ze,Ie.data)}else if(L.isDataArrayTexture)Je?(kt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,$.width,$.height,$.depth,Xe,ze,$.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,we,$.width,$.height,$.depth,0,Xe,ze,$.data);else if(L.isData3DTexture)Je?(kt&&t.texStorage3D(r.TEXTURE_3D,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,Xe,ze,$.data)):t.texImage3D(r.TEXTURE_3D,0,we,$.width,$.height,$.depth,0,Xe,ze,$.data);else if(L.isFramebufferTexture){if(kt)if(Je)t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height);else{let te=$.width,Me=$.height;for(let Pe=0;Pe<Te;Pe++)t.texImage2D(r.TEXTURE_2D,Pe,we,te,Me,0,Xe,ze,null),te>>=1,Me>>=1}}else if(st.length>0&&it){if(Je&&kt){let te=ct(st[0]);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Xe,ze,Ie):t.texImage2D(r.TEXTURE_2D,te,we,Xe,ze,Ie);L.generateMipmaps=!1}else if(Je){if(kt){let te=ct($);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Xe,ze,$)}else t.texImage2D(r.TEXTURE_2D,0,we,Xe,ze,$);y(L,it)&&x(le),et.__version=he.version,L.onUpdate&&L.onUpdate(L)}z.__version=L.version}function ve(z,L,ne){if(L.image.length!==6)return;let le=K(z,L),me=L.source;t.bindTexture(r.TEXTURE_CUBE_MAP,z.__webglTexture,r.TEXTURE0+ne);let he=i.get(me);if(me.version!==he.__version||le===!0){t.activeTexture(r.TEXTURE0+ne);let et=Er.getPrimaries(Er.workingColorSpace),Ke=L.colorSpace===ys?null:Er.getPrimaries(L.colorSpace),Se=L.colorSpace===ys||et===Ke?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);let Ae=L.isCompressedTexture||L.image[0].isCompressedTexture,nt=L.image[0]&&L.image[0].isDataTexture,$=[];for(let te=0;te<6;te++)!Ae&&!nt?$[te]=m(L.image[te],!1,!0,n.maxCubemapSize):$[te]=nt?L.image[te].image:L.image[te],$[te]=Ve(L,$[te]);let it=$[0],Xe=v(it)||s,ze=a.convert(L.format,L.colorSpace),we=a.convert(L.type),Ie=M(L.internalFormat,ze,we,L.colorSpace),st=s&&L.isVideoTexture!==!0,Je=he.__version===void 0||le===!0,kt=me.dataReady,X=S(L,it,Xe);V(r.TEXTURE_CUBE_MAP,L,Xe);let Te;if(Ae){st&&Je&&t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,it.width,it.height);for(let te=0;te<6;te++){Te=$[te].mipmaps;for(let Me=0;Me<Te.length;Me++){let Pe=Te[Me];L.format!==Rn?ze!==null?st?kt&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,Pe.width,Pe.height,ze,Pe.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,Pe.width,Pe.height,0,Pe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,Pe.width,Pe.height,ze,we,Pe.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,Pe.width,Pe.height,0,ze,we,Pe.data)}}}else{if(Te=L.mipmaps,st&&Je){Te.length>0&&X++;let te=ct($[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,te.width,te.height)}for(let te=0;te<6;te++)if(nt){st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,$[te].width,$[te].height,ze,we,$[te].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,$[te].width,$[te].height,0,ze,we,$[te].data);for(let Me=0;Me<Te.length;Me++){let xt=Te[Me].image[te].image;st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,xt.width,xt.height,ze,we,xt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,xt.width,xt.height,0,ze,we,xt.data)}}else{st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,ze,we,$[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,ze,we,$[te]);for(let Me=0;Me<Te.length;Me++){let Pe=Te[Me];st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,ze,we,Pe.image[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,ze,we,Pe.image[te])}}}y(L,Xe)&&x(r.TEXTURE_CUBE_MAP),he.__version=me.version,L.onUpdate&&L.onUpdate(L)}z.__version=L.version}function ue(z,L,ne,le,me,he){let et=a.convert(ne.format,ne.colorSpace),Ke=a.convert(ne.type),Se=M(ne.internalFormat,et,Ke,ne.colorSpace);if(!i.get(L).__hasExternalTextures){let nt=Math.max(1,L.width>>he),$=Math.max(1,L.height>>he);me===r.TEXTURE_3D||me===r.TEXTURE_2D_ARRAY?t.texImage3D(me,he,Se,nt,$,L.depth,0,et,Ke,null):t.texImage2D(me,he,Se,nt,$,0,et,Ke,null)}t.bindFramebuffer(r.FRAMEBUFFER,z),Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,le,me,i.get(ne).__webglTexture,0,Le(L)):(me===r.TEXTURE_2D||me>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&me<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,le,me,i.get(ne).__webglTexture,he),t.bindFramebuffer(r.FRAMEBUFFER,null)}function se(z,L,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,z),L.depthBuffer&&!L.stencilBuffer){let le=s===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(ne||Ue(L)){let me=L.depthTexture;me&&me.isDepthTexture&&(me.type===Ya?le=r.DEPTH_COMPONENT32F:me.type===Lo&&(le=r.DEPTH_COMPONENT24));let he=Le(L);Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,he,le,L.width,L.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,he,le,L.width,L.height)}else r.renderbufferStorage(r.RENDERBUFFER,le,L.width,L.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,z)}else if(L.depthBuffer&&L.stencilBuffer){let le=Le(L);ne&&Ue(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,L.width,L.height):Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,L.width,L.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,z)}else{let le=L.textures;for(let me=0;me<le.length;me++){let he=le[me],et=a.convert(he.format,he.colorSpace),Ke=a.convert(he.type),Se=M(he.internalFormat,et,Ke,he.colorSpace),Ae=Le(L);ne&&Ue(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Ae,Se,L.width,L.height):Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Ae,Se,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,Se,L.width,L.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ee(z,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,z),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),B(L.depthTexture,0);let le=i.get(L.depthTexture).__webglTexture,me=Le(L);if(L.depthTexture.format===sl)Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,le,0,me):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,le,0);else if(L.depthTexture.format===ru)Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,le,0,me):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,le,0);else throw new Error("Unknown depthTexture format")}function q(z){let L=i.get(z),ne=z.isWebGLCubeRenderTarget===!0;if(z.depthTexture&&!L.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");Ee(L.__webglFramebuffer,z)}else if(ne){L.__webglDepthbuffer=[];for(let le=0;le<6;le++)t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer[le]),L.__webglDepthbuffer[le]=r.createRenderbuffer(),se(L.__webglDepthbuffer[le],z,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer=r.createRenderbuffer(),se(L.__webglDepthbuffer,z,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function H(z,L,ne){let le=i.get(z);L!==void 0&&ue(le.__webglFramebuffer,z,z.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ne!==void 0&&q(z)}function We(z){let L=z.texture,ne=i.get(z),le=i.get(L);z.addEventListener("dispose",C);let me=z.textures,he=z.isWebGLCubeRenderTarget===!0,et=me.length>1,Ke=v(z)||s;if(et||(le.__webglTexture===void 0&&(le.__webglTexture=r.createTexture()),le.__version=L.version,o.memory.textures++),he){ne.__webglFramebuffer=[];for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer[Se]=[];for(let Ae=0;Ae<L.mipmaps.length;Ae++)ne.__webglFramebuffer[Se][Ae]=r.createFramebuffer()}else ne.__webglFramebuffer[Se]=r.createFramebuffer()}else{if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer=[];for(let Se=0;Se<L.mipmaps.length;Se++)ne.__webglFramebuffer[Se]=r.createFramebuffer()}else ne.__webglFramebuffer=r.createFramebuffer();if(et)if(n.drawBuffers)for(let Se=0,Ae=me.length;Se<Ae;Se++){let nt=i.get(me[Se]);nt.__webglTexture===void 0&&(nt.__webglTexture=r.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(s&&z.samples>0&&Ue(z)===!1){ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Se=0;Se<me.length;Se++){let Ae=me[Se];ne.__webglColorRenderbuffer[Se]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se]);let nt=a.convert(Ae.format,Ae.colorSpace),$=a.convert(Ae.type),it=M(Ae.internalFormat,nt,$,Ae.colorSpace,z.isXRRenderTarget===!0),Xe=Le(z);r.renderbufferStorageMultisample(r.RENDERBUFFER,Xe,it,z.width,z.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Se,r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se])}r.bindRenderbuffer(r.RENDERBUFFER,null),z.depthBuffer&&(ne.__webglDepthRenderbuffer=r.createRenderbuffer(),se(ne.__webglDepthRenderbuffer,z,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(he){t.bindTexture(r.TEXTURE_CUBE_MAP,le.__webglTexture),V(r.TEXTURE_CUBE_MAP,L,Ke);for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0)for(let Ae=0;Ae<L.mipmaps.length;Ae++)ue(ne.__webglFramebuffer[Se][Ae],z,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ae);else ue(ne.__webglFramebuffer[Se],z,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0);y(L,Ke)&&x(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(et){for(let Se=0,Ae=me.length;Se<Ae;Se++){let nt=me[Se],$=i.get(nt);t.bindTexture(r.TEXTURE_2D,$.__webglTexture),V(r.TEXTURE_2D,nt,Ke),ue(ne.__webglFramebuffer,z,nt,r.COLOR_ATTACHMENT0+Se,r.TEXTURE_2D,0),y(nt,Ke)&&x(r.TEXTURE_2D)}t.unbindTexture()}else{let Se=r.TEXTURE_2D;if((z.isWebGL3DRenderTarget||z.isWebGLArrayRenderTarget)&&(s?Se=z.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Se,le.__webglTexture),V(Se,L,Ke),s&&L.mipmaps&&L.mipmaps.length>0)for(let Ae=0;Ae<L.mipmaps.length;Ae++)ue(ne.__webglFramebuffer[Ae],z,L,r.COLOR_ATTACHMENT0,Se,Ae);else ue(ne.__webglFramebuffer,z,L,r.COLOR_ATTACHMENT0,Se,0);y(L,Ke)&&x(Se),t.unbindTexture()}z.depthBuffer&&q(z)}function _e(z){let L=v(z)||s,ne=z.textures;for(let le=0,me=ne.length;le<me;le++){let he=ne[le];if(y(he,L)){let et=z.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ke=i.get(he).__webglTexture;t.bindTexture(et,Ke),x(et),t.unbindTexture()}}}function xe(z){if(s&&z.samples>0&&Ue(z)===!1){let L=z.textures,ne=z.width,le=z.height,me=r.COLOR_BUFFER_BIT,he=[],et=z.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ke=i.get(z),Se=L.length>1;if(Se)for(let Ae=0;Ae<L.length;Ae++)t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer);for(let Ae=0;Ae<L.length;Ae++){he.push(r.COLOR_ATTACHMENT0+Ae),z.depthBuffer&&he.push(et);let nt=Ke.__ignoreDepthValues!==void 0?Ke.__ignoreDepthValues:!1;if(nt===!1&&(z.depthBuffer&&(me|=r.DEPTH_BUFFER_BIT),z.stencilBuffer&&(me|=r.STENCIL_BUFFER_BIT)),Se&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ke.__webglColorRenderbuffer[Ae]),nt===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[et]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[et])),Se){let $=i.get(L[Ae]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,$,0)}r.blitFramebuffer(0,0,ne,le,0,0,ne,le,me,r.NEAREST),u&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,he)}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Se)for(let Ae=0;Ae<L.length;Ae++){t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.RENDERBUFFER,Ke.__webglColorRenderbuffer[Ae]);let nt=i.get(L[Ae]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.TEXTURE_2D,nt,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer)}}function Le(z){return Math.min(n.maxSamples,z.samples)}function Ue(z){let L=i.get(z);return s&&z.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(z){let L=o.render.frame;f.get(z)!==L&&(f.set(z,L),z.update())}function Ve(z,L){let ne=z.colorSpace,le=z.format,me=z.type;return z.isCompressedTexture===!0||z.isVideoTexture===!0||z.format===uS||ne!==Za&&ne!==ys&&(Er.getTransfer(ne)===Hr?s===!1?e.has("EXT_sRGB")===!0&&le===Rn?(z.format=uS,z.minFilter=Qi,z.generateMipmaps=!1):L=yg.sRGBToLinear(L):(le!==Rn||me!==Ro)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),L}function ct(z){return typeof HTMLImageElement<"u"&&z instanceof HTMLImageElement?(c.width=z.naturalWidth||z.width,c.height=z.naturalHeight||z.height):typeof VideoFrame<"u"&&z instanceof VideoFrame?(c.width=z.displayWidth,c.height=z.displayHeight):(c.width=z.width,c.height=z.height),c}this.allocateTextureUnit=D,this.resetTextureUnits=A,this.setTexture2D=B,this.setTexture2DArray=F,this.setTexture3D=k,this.setTextureCube=G,this.rebindTextures=H,this.setupRenderTarget=We,this.updateRenderTargetMipmap=_e,this.updateMultisampleRenderTarget=xe,this.setupDepthRenderbuffer=q,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=Ue}function wie(r,e,t){let i=t.isWebGL2;function n(a,o=ys){let s,l=Er.getTransfer(o);if(a===Ro)return r.UNSIGNED_BYTE;if(a===BE)return r.UNSIGNED_SHORT_4_4_4_4;if(a===kE)return r.UNSIGNED_SHORT_5_5_5_1;if(a===iQ)return r.BYTE;if(a===nQ)return r.SHORT;if(a===cg)return r.UNSIGNED_SHORT;if(a===zE)return r.INT;if(a===Lo)return r.UNSIGNED_INT;if(a===Ya)return r.FLOAT;if(a===Zu)return i?r.HALF_FLOAT:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(a===aQ)return r.ALPHA;if(a===Rn)return r.RGBA;if(a===oQ)return r.LUMINANCE;if(a===sQ)return r.LUMINANCE_ALPHA;if(a===sl)return r.DEPTH_COMPONENT;if(a===ru)return r.DEPTH_STENCIL;if(a===uS)return s=e.get("EXT_sRGB"),s!==null?s.SRGB_ALPHA_EXT:null;if(a===lQ)return r.RED;if(a===VE)return r.RED_INTEGER;if(a===uQ)return r.RG;if(a===GE)return r.RG_INTEGER;if(a===HE)return r.RGBA_INTEGER;if(a===WE||a===XE||a===YE||a===qE)if(l===Hr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(a===WE)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===XE)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===YE)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===qE)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(a===WE)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===XE)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===YE)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===qE)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===$3||a===Q3||a===eF||a===tF)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(a===$3)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===Q3)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===eF)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===tF)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===ZE)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===rF||a===iF)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(a===rF)return l===Hr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(a===iF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===nF||a===aF||a===oF||a===sF||a===lF||a===uF||a===cF||a===fF||a===hF||a===pF||a===dF||a===mF||a===vF||a===gF)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(a===nF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===aF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===oF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===sF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===lF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===uF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===cF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===fF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===hF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===pF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===dF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===mF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===vF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===gF)return l===Hr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===jE||a===yF||a===_F)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(a===jE)return l===Hr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===yF)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===_F)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===cQ||a===xF||a===SF||a===MF)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(a===jE)return s.COMPRESSED_RED_RGTC1_EXT;if(a===xF)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===SF)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===MF)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===gs?i?r.UNSIGNED_INT_24_8:(s=e.get("WEBGL_depth_texture"),s!==null?s.UNSIGNED_INT_24_8_WEBGL:null):r[a]!==void 0?r[a]:null}return{convert:n}}var IA=class extends Gi{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}};var Td=class extends tn{constructor(){super(),this.isGroup=!0,this.type="Group"}};var HEe={type:"move"},Yg=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Td,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Td,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new be,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new be),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Td,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new be,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new be),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let n=null,a=null,o=null,s=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(let g of e.hand.values()){let m=t.getJointPose(g,i),v=this._getHandJoint(u,g);m!==null&&(v.matrix.fromArray(m.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=m.radius),v.visible=m!==null}let c=u.joints["index-finger-tip"],f=u.joints["thumb-tip"],h=c.position.distanceTo(f.position),p=.02,d=.005;u.inputState.pinching&&h>p+d?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&h<=p-d&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(a=t.getPose(e.gripSpace,i),a!==null&&(l.matrix.fromArray(a.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,a.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(a.linearVelocity)):l.hasLinearVelocity=!1,a.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(a.angularVelocity)):l.hasAngularVelocity=!1));s!==null&&(n=t.getPose(e.targetRaySpace,i),n===null&&a!==null&&(n=a),n!==null&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,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(HEe)))}return s!==null&&(s.visible=n!==null),l!==null&&(l.visible=a!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let i=new Td;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}};var WEe=`
  6533. void main() {
  6534. gl_Position = vec4( position, 1.0 );
  6535. }`,XEe=`
  6536. uniform sampler2DArray depthColor;
  6537. uniform float depthWidth;
  6538. uniform float depthHeight;
  6539. void main() {
  6540. vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
  6541. if ( coord.x >= 1.0 ) {
  6542. gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
  6543. } else {
  6544. gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
  6545. }
  6546. }`,NA=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){let n=new Ja,a=e.properties.get(n);a.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}render(e,t){if(this.texture!==null){if(this.mesh===null){let i=t.cameras[0].viewport,n=new ya({extensions:{fragDepth:!0},vertexShader:WEe,fragmentShader:XEe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new rn(new Bg(20,20),n)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}};var UA=class extends Ka{constructor(e,t){super();let i=this,n=null,a=1,o=null,s="local-floor",l=1,u=null,c=null,f=null,h=null,p=null,d=null,g=new NA,m=t.getContextAttributes(),v=null,_=null,y=[],x=[],M=new Kt,S=null,w=new Gi;w.layers.enable(1),w.viewport=new ii;let T=new Gi;T.layers.enable(2),T.viewport=new ii;let C=[w,T],b=new IA;b.layers.enable(1),b.layers.enable(2);let E=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let K=y[V];return K===void 0&&(K=new Yg,y[V]=K),K.getTargetRaySpace()},this.getControllerGrip=function(V){let K=y[V];return K===void 0&&(K=new Yg,y[V]=K),K.getGripSpace()},this.getHand=function(V){let K=y[V];return K===void 0&&(K=new Yg,y[V]=K),K.getHandSpace()};function R(V){let K=x.indexOf(V.inputSource);if(K===-1)return;let ae=y[K];ae!==void 0&&(ae.update(V.inputSource,V.frame,u||o),ae.dispatchEvent({type:V.type,data:V.inputSource}))}function A(){n.removeEventListener("select",R),n.removeEventListener("selectstart",R),n.removeEventListener("selectend",R),n.removeEventListener("squeeze",R),n.removeEventListener("squeezestart",R),n.removeEventListener("squeezeend",R),n.removeEventListener("end",A),n.removeEventListener("inputsourceschange",D);for(let V=0;V<y.length;V++){let K=x[V];K!==null&&(x[V]=null,y[V].disconnect(K))}E=null,I=null,g.reset(),e.setRenderTarget(v),p=null,h=null,f=null,n=null,_=null,Q.stop(),i.isPresenting=!1,e.setPixelRatio(S),e.setSize(M.width,M.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){a=V,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){s=V,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||o},this.setReferenceSpace=function(V){u=V},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return f},this.getFrame=function(){return d},this.getSession=function(){return n},this.setSession=function(V){return WM(this,null,function*(){if(n=V,n!==null){if(v=e.getRenderTarget(),n.addEventListener("select",R),n.addEventListener("selectstart",R),n.addEventListener("selectend",R),n.addEventListener("squeeze",R),n.addEventListener("squeezestart",R),n.addEventListener("squeezeend",R),n.addEventListener("end",A),n.addEventListener("inputsourceschange",D),m.xrCompatible!==!0&&(yield t.makeXRCompatible()),S=e.getPixelRatio(),e.getSize(M),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let K={antialias:n.renderState.layers===void 0?m.antialias:!0,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:a};p=new XRWebGLLayer(n,t,K),n.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),_=new $a(p.framebufferWidth,p.framebufferHeight,{format:Rn,type:Ro,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let K=null,ae=null,ve=null;m.depth&&(ve=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,K=m.stencil?ru:sl,ae=m.stencil?gs:Lo);let ue={colorFormat:t.RGBA8,depthFormat:ve,scaleFactor:a};f=new XRWebGLBinding(n,t),h=f.createProjectionLayer(ue),n.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),_=new $a(h.textureWidth,h.textureHeight,{format:Rn,type:Ro,depthTexture:new Hg(h.textureWidth,h.textureHeight,ae,void 0,void 0,void 0,void 0,void 0,void 0,K),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});let se=e.properties.get(_);se.__ignoreDepthValues=h.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(l),u=null,o=yield n.requestReferenceSpace(s),Q.setContext(n),Q.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(n!==null)return n.environmentBlendMode};function D(V){for(let K=0;K<V.removed.length;K++){let ae=V.removed[K],ve=x.indexOf(ae);ve>=0&&(x[ve]=null,y[ve].disconnect(ae))}for(let K=0;K<V.added.length;K++){let ae=V.added[K],ve=x.indexOf(ae);if(ve===-1){for(let se=0;se<y.length;se++)if(se>=x.length){x.push(ae),ve=se;break}else if(x[se]===null){x[se]=ae,ve=se;break}if(ve===-1)break}let ue=y[ve];ue&&ue.connect(ae)}}let U=new be,B=new be;function F(V,K,ae){U.setFromMatrixPosition(K.matrixWorld),B.setFromMatrixPosition(ae.matrixWorld);let ve=U.distanceTo(B),ue=K.projectionMatrix.elements,se=ae.projectionMatrix.elements,Ee=ue[14]/(ue[10]-1),q=ue[14]/(ue[10]+1),H=(ue[9]+1)/ue[5],We=(ue[9]-1)/ue[5],_e=(ue[8]-1)/ue[0],xe=(se[8]+1)/se[0],Le=Ee*_e,Ue=Ee*xe,Ne=ve/(-_e+xe),Ve=Ne*-_e;K.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(Ve),V.translateZ(Ne),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();let ct=Ee+Ne,z=q+Ne,L=Le-Ve,ne=Ue+(ve-Ve),le=H*q/z*ct,me=We*q/z*ct;V.projectionMatrix.makePerspective(L,ne,le,me,ct,z),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}function k(V,K){K===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(K.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(n===null)return;g.texture!==null&&(V.near=g.depthNear,V.far=g.depthFar),b.near=T.near=w.near=V.near,b.far=T.far=w.far=V.far,(E!==b.near||I!==b.far)&&(n.updateRenderState({depthNear:b.near,depthFar:b.far}),E=b.near,I=b.far,w.near=E,w.far=I,T.near=E,T.far=I,w.updateProjectionMatrix(),T.updateProjectionMatrix(),V.updateProjectionMatrix());let K=V.parent,ae=b.cameras;k(b,K);for(let ve=0;ve<ae.length;ve++)k(ae[ve],K);ae.length===2?F(b,w,T):b.projectionMatrix.copy(w.projectionMatrix),G(V,b,K)};function G(V,K,ae){ae===null?V.matrix.copy(K.matrixWorld):(V.matrix.copy(ae.matrixWorld),V.matrix.invert(),V.matrix.multiply(K.matrixWorld)),V.matrix.decompose(V.position,V.quaternion,V.scale),V.updateMatrixWorld(!0),V.projectionMatrix.copy(K.projectionMatrix),V.projectionMatrixInverse.copy(K.projectionMatrixInverse),V.isPerspectiveCamera&&(V.fov=cS*2*Math.atan(1/V.projectionMatrix.elements[5]),V.zoom=1)}this.getCamera=function(){return b},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(V){l=V,h!==null&&(h.fixedFoveation=V),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=V)},this.hasDepthSensing=function(){return g.texture!==null};let Y=null;function J(V,K){if(c=K.getViewerPose(u||o),d=K,c!==null){let ae=c.views;p!==null&&(e.setRenderTargetFramebuffer(_,p.framebuffer),e.setRenderTarget(_));let ve=!1;ae.length!==b.cameras.length&&(b.cameras.length=0,ve=!0);for(let se=0;se<ae.length;se++){let Ee=ae[se],q=null;if(p!==null)q=p.getViewport(Ee);else{let We=f.getViewSubImage(h,Ee);q=We.viewport,se===0&&(e.setRenderTargetTextures(_,We.colorTexture,h.ignoreDepthValues?void 0:We.depthStencilTexture),e.setRenderTarget(_))}let H=C[se];H===void 0&&(H=new Gi,H.layers.enable(se),H.viewport=new ii,C[se]=H),H.matrix.fromArray(Ee.transform.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale),H.projectionMatrix.fromArray(Ee.projectionMatrix),H.projectionMatrixInverse.copy(H.projectionMatrix).invert(),H.viewport.set(q.x,q.y,q.width,q.height),se===0&&(b.matrix.copy(H.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale)),ve===!0&&b.cameras.push(H)}let ue=n.enabledFeatures;if(ue&&ue.includes("depth-sensing")){let se=f.getDepthInformation(ae[0]);se&&se.isValid&&se.texture&&g.init(e,se,n.renderState)}}for(let ae=0;ae<y.length;ae++){let ve=x[ae],ue=y[ae];ve!==null&&ue!==void 0&&ue.update(ve,K,u||o)}g.render(e,b),Y&&Y(V,K),K.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:K}),d=null}let Q=new EA;Q.setAnimationLoop(J),this.setAnimationLoop=function(V){Y=V},this.dispose=function(){}}};var Ed=new cl,YEe=new Wr;function Tie(r,e){function t(m,v){m.matrixAutoUpdate===!0&&m.updateMatrix(),v.value.copy(m.matrix)}function i(m,v){v.color.getRGB(m.fogColor.value,MA(r)),v.isFog?(m.fogNear.value=v.near,m.fogFar.value=v.far):v.isFogExp2&&(m.fogDensity.value=v.density)}function n(m,v,_,y,x){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(m,v):v.isMeshToonMaterial?(a(m,v),f(m,v)):v.isMeshPhongMaterial?(a(m,v),c(m,v)):v.isMeshStandardMaterial?(a(m,v),h(m,v),v.isMeshPhysicalMaterial&&p(m,v,x)):v.isMeshMatcapMaterial?(a(m,v),d(m,v)):v.isMeshDepthMaterial?a(m,v):v.isMeshDistanceMaterial?(a(m,v),g(m,v)):v.isMeshNormalMaterial?a(m,v):v.isLineBasicMaterial?(o(m,v),v.isLineDashedMaterial&&s(m,v)):v.isPointsMaterial?l(m,v,_,y):v.isSpriteMaterial?u(m,v):v.isShadowMaterial?(m.color.value.copy(v.color),m.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(m,v){m.opacity.value=v.opacity,v.color&&m.diffuse.value.copy(v.color),v.emissive&&m.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.bumpMap&&(m.bumpMap.value=v.bumpMap,t(v.bumpMap,m.bumpMapTransform),m.bumpScale.value=v.bumpScale,v.side===_i&&(m.bumpScale.value*=-1)),v.normalMap&&(m.normalMap.value=v.normalMap,t(v.normalMap,m.normalMapTransform),m.normalScale.value.copy(v.normalScale),v.side===_i&&m.normalScale.value.negate()),v.displacementMap&&(m.displacementMap.value=v.displacementMap,t(v.displacementMap,m.displacementMapTransform),m.displacementScale.value=v.displacementScale,m.displacementBias.value=v.displacementBias),v.emissiveMap&&(m.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,m.emissiveMapTransform)),v.specularMap&&(m.specularMap.value=v.specularMap,t(v.specularMap,m.specularMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest);let _=e.get(v),y=_.envMap,x=_.envMapRotation;if(y&&(m.envMap.value=y,Ed.copy(x),Ed.x*=-1,Ed.y*=-1,Ed.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Ed.y*=-1,Ed.z*=-1),m.envMapRotation.value.setFromMatrix4(YEe.makeRotationFromEuler(Ed)),m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=v.reflectivity,m.ior.value=v.ior,m.refractionRatio.value=v.refractionRatio),v.lightMap){m.lightMap.value=v.lightMap;let M=r._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=v.lightMapIntensity*M,t(v.lightMap,m.lightMapTransform)}v.aoMap&&(m.aoMap.value=v.aoMap,m.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,m.aoMapTransform))}function o(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform))}function s(m,v){m.dashSize.value=v.dashSize,m.totalSize.value=v.dashSize+v.gapSize,m.scale.value=v.scale}function l(m,v,_,y){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.size.value=v.size*_,m.scale.value=y*.5,v.map&&(m.map.value=v.map,t(v.map,m.uvTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function u(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.rotation.value=v.rotation,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function c(m,v){m.specular.value.copy(v.specular),m.shininess.value=Math.max(v.shininess,1e-4)}function f(m,v){v.gradientMap&&(m.gradientMap.value=v.gradientMap)}function h(m,v){m.metalness.value=v.metalness,v.metalnessMap&&(m.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,m.metalnessMapTransform)),m.roughness.value=v.roughness,v.roughnessMap&&(m.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,m.roughnessMapTransform)),e.get(v).envMap&&(m.envMapIntensity.value=v.envMapIntensity)}function p(m,v,_){m.ior.value=v.ior,v.sheen>0&&(m.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),m.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(m.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,m.sheenColorMapTransform)),v.sheenRoughnessMap&&(m.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,m.sheenRoughnessMapTransform))),v.clearcoat>0&&(m.clearcoat.value=v.clearcoat,m.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(m.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,m.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(m.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===_i&&m.clearcoatNormalScale.value.negate())),v.iridescence>0&&(m.iridescence.value=v.iridescence,m.iridescenceIOR.value=v.iridescenceIOR,m.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(m.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,m.iridescenceMapTransform)),v.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),v.transmission>0&&(m.transmission.value=v.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(m.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,m.transmissionMapTransform)),m.thickness.value=v.thickness,v.thicknessMap&&(m.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=v.attenuationDistance,m.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(m.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(m.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=v.specularIntensity,m.specularColor.value.copy(v.specularColor),v.specularColorMap&&(m.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,m.specularColorMapTransform)),v.specularIntensityMap&&(m.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,m.specularIntensityMapTransform))}function d(m,v){v.matcap&&(m.matcap.value=v.matcap)}function g(m,v){let _=e.get(v).light;m.referencePosition.value.setFromMatrixPosition(_.matrixWorld),m.nearDistance.value=_.shadow.camera.near,m.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function Eie(r,e,t,i){let n={},a={},o=[],s=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,y){let x=y.program;i.uniformBlockBinding(_,x)}function u(_,y){let x=n[_.id];x===void 0&&(d(_),x=c(_),n[_.id]=x,_.addEventListener("dispose",m));let M=y.program;i.updateUBOMapping(_,M);let S=e.render.frame;a[_.id]!==S&&(h(_),a[_.id]=S)}function c(_){let y=f();_.__bindingPointIndex=y;let x=r.createBuffer(),M=_.__size,S=_.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,M,S),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,x),x}function f(){for(let _=0;_<s;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(_){let y=n[_.id],x=_.uniforms,M=_.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let S=0,w=x.length;S<w;S++){let T=Array.isArray(x[S])?x[S]:[x[S]];for(let C=0,b=T.length;C<b;C++){let E=T[C];if(p(E,S,C,M)===!0){let I=E.__offset,R=Array.isArray(E.value)?E.value:[E.value],A=0;for(let D=0;D<R.length;D++){let U=R[D],B=g(U);typeof U=="number"||typeof U=="boolean"?(E.__data[0]=U,r.bufferSubData(r.UNIFORM_BUFFER,I+A,E.__data)):U.isMatrix3?(E.__data[0]=U.elements[0],E.__data[1]=U.elements[1],E.__data[2]=U.elements[2],E.__data[3]=0,E.__data[4]=U.elements[3],E.__data[5]=U.elements[4],E.__data[6]=U.elements[5],E.__data[7]=0,E.__data[8]=U.elements[6],E.__data[9]=U.elements[7],E.__data[10]=U.elements[8],E.__data[11]=0):(U.toArray(E.__data,A),A+=B.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,I,E.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function p(_,y,x,M){let S=_.value,w=y+"_"+x;if(M[w]===void 0)return typeof S=="number"||typeof S=="boolean"?M[w]=S:M[w]=S.clone(),!0;{let T=M[w];if(typeof S=="number"||typeof S=="boolean"){if(T!==S)return M[w]=S,!0}else if(T.equals(S)===!1)return T.copy(S),!0}return!1}function d(_){let y=_.uniforms,x=0,M=16;for(let w=0,T=y.length;w<T;w++){let C=Array.isArray(y[w])?y[w]:[y[w]];for(let b=0,E=C.length;b<E;b++){let I=C[b],R=Array.isArray(I.value)?I.value:[I.value];for(let A=0,D=R.length;A<D;A++){let U=R[A],B=g(U),F=x%M;F!==0&&M-F<B.boundary&&(x+=M-F),I.__data=new Float32Array(B.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=x,x+=B.storage}}}let S=x%M;return S>0&&(x+=M-S),_.__size=x,_.__cache={},this}function g(_){let y={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(y.boundary=4,y.storage=4):_.isVector2?(y.boundary=8,y.storage=8):_.isVector3||_.isColor?(y.boundary=16,y.storage=12):_.isVector4?(y.boundary=16,y.storage=16):_.isMatrix3?(y.boundary=48,y.storage=48):_.isMatrix4?(y.boundary=64,y.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),y}function m(_){let y=_.target;y.removeEventListener("dispose",m);let x=o.indexOf(y.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(n[y.id]),delete n[y.id],delete a[y.id]}function v(){for(let _ in n)r.deleteBuffer(n[_]);o=[],n={},a={}}return{bind:l,update:u,dispose:v}}var gS=class{constructor(e={}){let{canvas:t=wQ(),context:i=null,depth:n=!0,stencil:a=!0,alpha:o=!1,antialias:s=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;i!==null?h=i.getContextAttributes().alpha:h=o;let p=new Uint32Array(4),d=new Int32Array(4),g=null,m=null,v=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=qa,this._useLegacyLights=!1,this.toneMapping=vs,this.toneMappingExposure=1;let y=this,x=!1,M=0,S=0,w=null,T=-1,C=null,b=new ii,E=new ii,I=null,R=new ir(0),A=0,D=t.width,U=t.height,B=1,F=null,k=null,G=new ii(0,0,D,U),Y=new ii(0,0,D,U),J=!1,Q=new vh,V=!1,K=!1,ae=null,ve=new Wr,ue=new Kt,se=new be,Ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return w===null?B:1}let H=i;function We(O,j){for(let re=0;re<O.length;re++){let ie=O[re],P=t.getContext(ie,j);if(P!==null)return P}return null}try{let O={alpha:!0,depth:n,stencil:a,antialias:s,premultipliedAlpha:l,preserveDrawingBuffer:u,powerPreference:c,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${rS}`),t.addEventListener("webglcontextlost",kt,!1),t.addEventListener("webglcontextrestored",X,!1),t.addEventListener("webglcontextcreationerror",Te,!1),H===null){let j=["webgl2","webgl","experimental-webgl"];if(y.isWebGL1Renderer===!0&&j.shift(),H=We(j,O),H===null)throw We(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&H instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),H.getShaderPrecisionFormat===void 0&&(H.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(O){throw console.error("THREE.WebGLRenderer: "+O.message),O}let _e,xe,Le,Ue,Ne,Ve,ct,z,L,ne,le,me,he,et,Ke,Se,Ae,nt,$,it,Xe,ze,we,Ie;function st(){_e=new Gre(H),xe=new Dre(H,_e,e),_e.init(xe),ze=new wie(H,_e,xe),Le=new Mie(H,_e,xe),Ue=new Xre(H),Ne=new hie,Ve=new bie(H,_e,Le,Ne,xe,ze,Ue),ct=new Nre(y),z=new Vre(y),L=new ZQ(H,xe),we=new Lre(H,_e,L,xe),ne=new Hre(H,L,Ue,we),le=new qre(H,ne,L,Ue),$=new Yre(H,xe,Ve),Se=new Ire(Ne),me=new fie(y,ct,z,_e,xe,we,Se),he=new Tie(y,Ne),et=new mie,Ke=new yie(_e,xe),nt=new Rre(y,ct,z,Le,le,h,l),Ae=new Sie(y,le,xe),Ie=new Eie(H,Ue,xe,Le),it=new Pre(H,_e,Ue,xe),Xe=new Wre(H,_e,Ue,xe),Ue.programs=me.programs,y.capabilities=xe,y.extensions=_e,y.properties=Ne,y.renderLists=et,y.shadowMap=Ae,y.state=Le,y.info=Ue}st();let Je=new UA(y,H);this.xr=Je,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){let O=_e.get("WEBGL_lose_context");O&&O.loseContext()},this.forceContextRestore=function(){let O=_e.get("WEBGL_lose_context");O&&O.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(O){O!==void 0&&(B=O,this.setSize(D,U,!1))},this.getSize=function(O){return O.set(D,U)},this.setSize=function(O,j,re=!0){if(Je.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}D=O,U=j,t.width=Math.floor(O*B),t.height=Math.floor(j*B),re===!0&&(t.style.width=O+"px",t.style.height=j+"px"),this.setViewport(0,0,O,j)},this.getDrawingBufferSize=function(O){return O.set(D*B,U*B).floor()},this.setDrawingBufferSize=function(O,j,re){D=O,U=j,B=re,t.width=Math.floor(O*re),t.height=Math.floor(j*re),this.setViewport(0,0,O,j)},this.getCurrentViewport=function(O){return O.copy(b)},this.getViewport=function(O){return O.copy(G)},this.setViewport=function(O,j,re,ie){O.isVector4?G.set(O.x,O.y,O.z,O.w):G.set(O,j,re,ie),Le.viewport(b.copy(G).multiplyScalar(B).round())},this.getScissor=function(O){return O.copy(Y)},this.setScissor=function(O,j,re,ie){O.isVector4?Y.set(O.x,O.y,O.z,O.w):Y.set(O,j,re,ie),Le.scissor(E.copy(Y).multiplyScalar(B).round())},this.getScissorTest=function(){return J},this.setScissorTest=function(O){Le.setScissorTest(J=O)},this.setOpaqueSort=function(O){F=O},this.setTransparentSort=function(O){k=O},this.getClearColor=function(O){return O.copy(nt.getClearColor())},this.setClearColor=function(){nt.setClearColor.apply(nt,arguments)},this.getClearAlpha=function(){return nt.getClearAlpha()},this.setClearAlpha=function(){nt.setClearAlpha.apply(nt,arguments)},this.clear=function(O=!0,j=!0,re=!0){let ie=0;if(O){let P=!1;if(w!==null){let W=w.texture.format;P=W===HE||W===GE||W===VE}if(P){let W=w.texture.type,ee=W===Ro||W===Lo||W===cg||W===gs||W===BE||W===kE,ge=nt.getClearColor(),ce=nt.getClearAlpha(),Oe=ge.r,Ge=ge.g,Re=ge.b;ee?(p[0]=Oe,p[1]=Ge,p[2]=Re,p[3]=ce,H.clearBufferuiv(H.COLOR,0,p)):(d[0]=Oe,d[1]=Ge,d[2]=Re,d[3]=ce,H.clearBufferiv(H.COLOR,0,d))}else ie|=H.COLOR_BUFFER_BIT}j&&(ie|=H.DEPTH_BUFFER_BIT),re&&(ie|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",kt,!1),t.removeEventListener("webglcontextrestored",X,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),et.dispose(),Ke.dispose(),Ne.dispose(),ct.dispose(),z.dispose(),le.dispose(),we.dispose(),Ie.dispose(),me.dispose(),Je.dispose(),Je.removeEventListener("sessionstart",Zr),Je.removeEventListener("sessionend",Vt),ae&&(ae.dispose(),ae=null),Dr.stop()};function kt(O){O.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function X(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let O=Ue.autoReset,j=Ae.enabled,re=Ae.autoUpdate,ie=Ae.needsUpdate,P=Ae.type;st(),Ue.autoReset=O,Ae.enabled=j,Ae.autoUpdate=re,Ae.needsUpdate=ie,Ae.type=P}function Te(O){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",O.statusMessage)}function te(O){let j=O.target;j.removeEventListener("dispose",te),Me(j)}function Me(O){Pe(O),Ne.remove(O)}function Pe(O){let j=Ne.get(O).programs;j!==void 0&&(j.forEach(function(re){me.releaseProgram(re)}),O.isShaderMaterial&&me.releaseShaderCache(O))}this.renderBufferDirect=function(O,j,re,ie,P,W){j===null&&(j=Ee);let ee=P.isMesh&&P.matrixWorld.determinant()<0,ge=b0(O,j,re,ie,P);Le.setMaterial(ie,ee);let ce=re.index,Oe=1;if(ie.wireframe===!0){if(ce=ne.getWireframeAttribute(re),ce===void 0)return;Oe=2}let Ge=re.drawRange,Re=re.attributes.position,pt=Ge.start*Oe,mt=(Ge.start+Ge.count)*Oe;W!==null&&(pt=Math.max(pt,W.start*Oe),mt=Math.min(mt,(W.start+W.count)*Oe)),ce!==null?(pt=Math.max(pt,0),mt=Math.min(mt,ce.count)):Re!=null&&(pt=Math.max(pt,0),mt=Math.min(mt,Re.count));let $e=mt-pt;if($e<0||$e===1/0)return;we.setup(P,ie,ge,re,ce);let at,wt=it;if(ce!==null&&(at=L.get(ce),wt=Xe,wt.setIndex(at)),P.isMesh)ie.wireframe===!0?(Le.setLineWidth(ie.wireframeLinewidth*q()),wt.setMode(H.LINES)):wt.setMode(H.TRIANGLES);else if(P.isLine){let je=ie.linewidth;je===void 0&&(je=1),Le.setLineWidth(je*q()),P.isLineSegments?wt.setMode(H.LINES):P.isLineLoop?wt.setMode(H.LINE_LOOP):wt.setMode(H.LINE_STRIP)}else P.isPoints?wt.setMode(H.POINTS):P.isSprite&&wt.setMode(H.TRIANGLES);if(P.isBatchedMesh)wt.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else if(P.isInstancedMesh)wt.renderInstances(pt,$e,P.count);else if(re.isInstancedBufferGeometry){let je=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,mi=Math.min(re.instanceCount,je);wt.renderInstances(pt,$e,mi)}else wt.render(pt,$e)};function xt(O,j,re){O.transparent===!0&&O.side===Co&&O.forceSinglePass===!1?(O.side=_i,O.needsUpdate=!0,Go(O,j,re),O.side=Ao,O.needsUpdate=!0,Go(O,j,re),O.side=Co):Go(O,j,re)}this.compile=function(O,j,re=null){re===null&&(re=O),m=Ke.get(re),m.init(),_.push(m),re.traverseVisible(function(P){P.isLight&&P.layers.test(j.layers)&&(m.pushLight(P),P.castShadow&&m.pushShadow(P))}),O!==re&&O.traverseVisible(function(P){P.isLight&&P.layers.test(j.layers)&&(m.pushLight(P),P.castShadow&&m.pushShadow(P))}),m.setupLights(y._useLegacyLights);let ie=new Set;return O.traverse(function(P){let W=P.material;if(W)if(Array.isArray(W))for(let ee=0;ee<W.length;ee++){let ge=W[ee];xt(ge,re,P),ie.add(ge)}else xt(W,re,P),ie.add(W)}),_.pop(),m=null,ie},this.compileAsync=function(O,j,re=null){let ie=this.compile(O,j,re);return new Promise(P=>{function W(){if(ie.forEach(function(ee){Ne.get(ee).currentProgram.isReady()&&ie.delete(ee)}),ie.size===0){P(O);return}setTimeout(W,10)}_e.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let zt=null;function Mr(O){zt&&zt(O)}function Zr(){Dr.stop()}function Vt(){Dr.start()}let Dr=new EA;Dr.setAnimationLoop(Mr),typeof self<"u"&&Dr.setContext(self),this.setAnimationLoop=function(O){zt=O,Je.setAnimationLoop(O),O===null?Dr.stop():Dr.start()},Je.addEventListener("sessionstart",Zr),Je.addEventListener("sessionend",Vt),this.render=function(O,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),Je.enabled===!0&&Je.isPresenting===!0&&(Je.cameraAutoUpdate===!0&&Je.updateCamera(j),j=Je.getCamera()),O.isScene===!0&&O.onBeforeRender(y,O,j,w),m=Ke.get(O,_.length),m.init(),_.push(m),ve.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),Q.setFromProjectionMatrix(ve),K=this.localClippingEnabled,V=Se.init(this.clippingPlanes,K),g=et.get(O,v.length),g.init(),v.push(g),oi(O,j,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(F,k),this.info.render.frame++,V===!0&&Se.beginShadows();let re=m.state.shadowsArray;if(Ae.render(re,O,j),V===!0&&Se.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Je.enabled===!1||Je.isPresenting===!1||Je.hasDepthSensing()===!1)&&nt.render(g,O),m.setupLights(y._useLegacyLights),j.isArrayCamera){let ie=j.cameras;for(let P=0,W=ie.length;P<W;P++){let ee=ie[P];Yh(g,O,ee,ee.viewport)}}else Yh(g,O,j);w!==null&&(Ve.updateMultisampleRenderTarget(w),Ve.updateRenderTargetMipmap(w)),O.isScene===!0&&O.onAfterRender(y,O,j),we.resetDefaultState(),T=-1,C=null,_.pop(),_.length>0?m=_[_.length-1]:m=null,v.pop(),v.length>0?g=v[v.length-1]:g=null};function oi(O,j,re,ie){if(O.visible===!1)return;if(O.layers.test(j.layers)){if(O.isGroup)re=O.renderOrder;else if(O.isLOD)O.autoUpdate===!0&&O.update(j);else if(O.isLight)m.pushLight(O),O.castShadow&&m.pushShadow(O);else if(O.isSprite){if(!O.frustumCulled||Q.intersectsSprite(O)){ie&&se.setFromMatrixPosition(O.matrixWorld).applyMatrix4(ve);let ee=le.update(O),ge=O.material;ge.visible&&g.push(O,ee,ge,re,se.z,null)}}else if((O.isMesh||O.isLine||O.isPoints)&&(!O.frustumCulled||Q.intersectsObject(O))){let ee=le.update(O),ge=O.material;if(ie&&(O.boundingSphere!==void 0?(O.boundingSphere===null&&O.computeBoundingSphere(),se.copy(O.boundingSphere.center)):(ee.boundingSphere===null&&ee.computeBoundingSphere(),se.copy(ee.boundingSphere.center)),se.applyMatrix4(O.matrixWorld).applyMatrix4(ve)),Array.isArray(ge)){let ce=ee.groups;for(let Oe=0,Ge=ce.length;Oe<Ge;Oe++){let Re=ce[Oe],pt=ge[Re.materialIndex];pt&&pt.visible&&g.push(O,ee,pt,re,se.z,Re)}}else ge.visible&&g.push(O,ee,ge,re,se.z,null)}}let W=O.children;for(let ee=0,ge=W.length;ee<ge;ee++)oi(W[ee],j,re,ie)}function Yh(O,j,re,ie){let P=O.opaque,W=O.transmissive,ee=O.transparent;m.setupLightsView(re),V===!0&&Se.setGlobalState(y.clippingPlanes,re),W.length>0&&M0(P,W,j,re),ie&&Le.viewport(b.copy(ie)),P.length>0&&Ds(P,j,re),W.length>0&&Ds(W,j,re),ee.length>0&&Ds(ee,j,re),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function M0(O,j,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;let W=xe.isWebGL2;ae===null&&(ae=new $a(1,1,{generateMipmaps:!0,type:_e.has("EXT_color_buffer_half_float")?Zu:Ro,minFilter:ol,samples:W?4:0})),y.getDrawingBufferSize(ue),W?ae.setSize(ue.x,ue.y):ae.setSize(fS(ue.x),fS(ue.y));let ee=y.getRenderTarget();y.setRenderTarget(ae),y.getClearColor(R),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear();let ge=y.toneMapping;y.toneMapping=vs,Ds(O,re,ie),Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae);let ce=!1;for(let Oe=0,Ge=j.length;Oe<Ge;Oe++){let Re=j[Oe],pt=Re.object,mt=Re.geometry,$e=Re.material,at=Re.group;if($e.side===Co&&pt.layers.test(ie.layers)){let wt=$e.side;$e.side=_i,$e.needsUpdate=!0,qh(pt,re,ie,mt,$e,at),$e.side=wt,$e.needsUpdate=!0,ce=!0}}ce===!0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),y.setRenderTarget(ee),y.setClearColor(R,A),y.toneMapping=ge}function Ds(O,j,re){let ie=j.isScene===!0?j.overrideMaterial:null;for(let P=0,W=O.length;P<W;P++){let ee=O[P],ge=ee.object,ce=ee.geometry,Oe=ie===null?ee.material:ie,Ge=ee.group;ge.layers.test(re.layers)&&qh(ge,j,re,ce,Oe,Ge)}}function qh(O,j,re,ie,P,W){O.onBeforeRender(y,j,re,ie,P,W),O.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,O.matrixWorld),O.normalMatrix.getNormalMatrix(O.modelViewMatrix),P.onBeforeRender(y,j,re,ie,O,W),P.transparent===!0&&P.side===Co&&P.forceSinglePass===!1?(P.side=_i,P.needsUpdate=!0,y.renderBufferDirect(re,j,ie,P,O,W),P.side=Ao,P.needsUpdate=!0,y.renderBufferDirect(re,j,ie,P,O,W),P.side=Co):y.renderBufferDirect(re,j,ie,P,O,W),O.onAfterRender(y,j,re,ie,P,W)}function Go(O,j,re){j.isScene!==!0&&(j=Ee);let ie=Ne.get(O),P=m.state.lights,W=m.state.shadowsArray,ee=P.state.version,ge=me.getParameters(O,P.state,W,j,re),ce=me.getProgramCacheKey(ge),Oe=ie.programs;ie.environment=O.isMeshStandardMaterial?j.environment:null,ie.fog=j.fog,ie.envMap=(O.isMeshStandardMaterial?z:ct).get(O.envMap||ie.environment),ie.envMapRotation=ie.environment!==null&&O.envMap===null?j.environmentRotation:O.envMapRotation,Oe===void 0&&(O.addEventListener("dispose",te),Oe=new Map,ie.programs=Oe);let Ge=Oe.get(ce);if(Ge!==void 0){if(ie.currentProgram===Ge&&ie.lightsStateVersion===ee)return wc(O,ge),Ge}else ge.uniforms=me.getUniforms(O),O.onBuild(re,ge,y),O.onBeforeCompile(ge,y),Ge=me.acquireProgram(ge,ce),Oe.set(ce,Ge),ie.uniforms=ge.uniforms;let Re=ie.uniforms;return(!O.isShaderMaterial&&!O.isRawShaderMaterial||O.clipping===!0)&&(Re.clippingPlanes=Se.uniform),wc(O,ge),ie.needsLights=T0(O),ie.lightsStateVersion=ee,ie.needsLights&&(Re.ambientLightColor.value=P.state.ambient,Re.lightProbe.value=P.state.probe,Re.directionalLights.value=P.state.directional,Re.directionalLightShadows.value=P.state.directionalShadow,Re.spotLights.value=P.state.spot,Re.spotLightShadows.value=P.state.spotShadow,Re.rectAreaLights.value=P.state.rectArea,Re.ltc_1.value=P.state.rectAreaLTC1,Re.ltc_2.value=P.state.rectAreaLTC2,Re.pointLights.value=P.state.point,Re.pointLightShadows.value=P.state.pointShadow,Re.hemisphereLights.value=P.state.hemi,Re.directionalShadowMap.value=P.state.directionalShadowMap,Re.directionalShadowMatrix.value=P.state.directionalShadowMatrix,Re.spotShadowMap.value=P.state.spotShadowMap,Re.spotLightMatrix.value=P.state.spotLightMatrix,Re.spotLightMap.value=P.state.spotLightMap,Re.pointShadowMap.value=P.state.pointShadowMap,Re.pointShadowMatrix.value=P.state.pointShadowMatrix),ie.currentProgram=Ge,ie.uniformsList=null,Ge}function Zh(O){if(O.uniformsList===null){let j=O.currentProgram.getUniforms();O.uniformsList=gh.seqWithValue(j.seq,O.uniforms)}return O.uniformsList}function wc(O,j){let re=Ne.get(O);re.outputColorSpace=j.outputColorSpace,re.batching=j.batching,re.instancing=j.instancing,re.instancingColor=j.instancingColor,re.instancingMorph=j.instancingMorph,re.skinning=j.skinning,re.morphTargets=j.morphTargets,re.morphNormals=j.morphNormals,re.morphColors=j.morphColors,re.morphTargetsCount=j.morphTargetsCount,re.numClippingPlanes=j.numClippingPlanes,re.numIntersection=j.numClipIntersection,re.vertexAlphas=j.vertexAlphas,re.vertexTangents=j.vertexTangents,re.toneMapping=j.toneMapping}function b0(O,j,re,ie,P){j.isScene!==!0&&(j=Ee),Ve.resetTextureUnits();let W=j.fog,ee=ie.isMeshStandardMaterial?j.environment:null,ge=w===null?y.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:Za,ce=(ie.isMeshStandardMaterial?z:ct).get(ie.envMap||ee),Oe=ie.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,Ge=!!re.attributes.tangent&&(!!ie.normalMap||ie.anisotropy>0),Re=!!re.morphAttributes.position,pt=!!re.morphAttributes.normal,mt=!!re.morphAttributes.color,$e=vs;ie.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&($e=y.toneMapping);let at=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,wt=at!==void 0?at.length:0,je=Ne.get(ie),mi=m.state.lights;if(V===!0&&(K===!0||O!==C)){let jr=O===C&&ie.id===T;Se.setState(ie,O,jr)}let Ut=!1;ie.version===je.__version?(je.needsLights&&je.lightsStateVersion!==mi.state.version||je.outputColorSpace!==ge||P.isBatchedMesh&&je.batching===!1||!P.isBatchedMesh&&je.batching===!0||P.isInstancedMesh&&je.instancing===!1||!P.isInstancedMesh&&je.instancing===!0||P.isSkinnedMesh&&je.skinning===!1||!P.isSkinnedMesh&&je.skinning===!0||P.isInstancedMesh&&je.instancingColor===!0&&P.instanceColor===null||P.isInstancedMesh&&je.instancingColor===!1&&P.instanceColor!==null||P.isInstancedMesh&&je.instancingMorph===!0&&P.morphTexture===null||P.isInstancedMesh&&je.instancingMorph===!1&&P.morphTexture!==null||je.envMap!==ce||ie.fog===!0&&je.fog!==W||je.numClippingPlanes!==void 0&&(je.numClippingPlanes!==Se.numPlanes||je.numIntersection!==Se.numIntersection)||je.vertexAlphas!==Oe||je.vertexTangents!==Ge||je.morphTargets!==Re||je.morphNormals!==pt||je.morphColors!==mt||je.toneMapping!==$e||xe.isWebGL2===!0&&je.morphTargetsCount!==wt)&&(Ut=!0):(Ut=!0,je.__version=ie.version);let Rr=je.currentProgram;Ut===!0&&(Rr=Go(ie,j,P));let Wi=!1,Mt=!1,Mi=!1,sr=Rr.getUniforms(),un=je.uniforms;if(Le.useProgram(Rr.program)&&(Wi=!0,Mt=!0,Mi=!0),ie.id!==T&&(T=ie.id,Mt=!0),Wi||C!==O){sr.setValue(H,"projectionMatrix",O.projectionMatrix),sr.setValue(H,"viewMatrix",O.matrixWorldInverse);let jr=sr.map.cameraPosition;jr!==void 0&&jr.setValue(H,se.setFromMatrixPosition(O.matrixWorld)),xe.logarithmicDepthBuffer&&sr.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&sr.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),C!==O&&(C=O,Mt=!0,Mi=!0)}if(P.isSkinnedMesh){sr.setOptional(H,P,"bindMatrix"),sr.setOptional(H,P,"bindMatrixInverse");let jr=P.skeleton;jr&&(xe.floatVertexTextures?(jr.boneTexture===null&&jr.computeBoneTexture(),sr.setValue(H,"boneTexture",jr.boneTexture,Ve)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}P.isBatchedMesh&&(sr.setOptional(H,P,"batchingTexture"),sr.setValue(H,"batchingTexture",P._matricesTexture,Ve));let mu=re.morphAttributes;if((mu.position!==void 0||mu.normal!==void 0||mu.color!==void 0&&xe.isWebGL2===!0)&&$.update(P,re,Rr),(Mt||je.receiveShadow!==P.receiveShadow)&&(je.receiveShadow=P.receiveShadow,sr.setValue(H,"receiveShadow",P.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(un.envMap.value=ce,un.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),Mt&&(sr.setValue(H,"toneMappingExposure",y.toneMappingExposure),je.needsLights&&w0(un,Mi),W&&ie.fog===!0&&he.refreshFogUniforms(un,W),he.refreshMaterialUniforms(un,ie,B,U,ae),gh.upload(H,Zh(je),un,Ve)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(gh.upload(H,Zh(je),un,Ve),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&sr.setValue(H,"center",P.center),sr.setValue(H,"modelViewMatrix",P.modelViewMatrix),sr.setValue(H,"normalMatrix",P.normalMatrix),sr.setValue(H,"modelMatrix",P.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){let jr=ie.uniformsGroups;for(let vu=0,jh=jr.length;vu<jh;vu++)if(xe.isWebGL2){let Kh=jr[vu];Ie.update(Kh,Rr),Ie.bind(Kh,Rr)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Rr}function w0(O,j){O.ambientLightColor.needsUpdate=j,O.lightProbe.needsUpdate=j,O.directionalLights.needsUpdate=j,O.directionalLightShadows.needsUpdate=j,O.pointLights.needsUpdate=j,O.pointLightShadows.needsUpdate=j,O.spotLights.needsUpdate=j,O.spotLightShadows.needsUpdate=j,O.rectAreaLights.needsUpdate=j,O.hemisphereLights.needsUpdate=j}function T0(O){return O.isMeshLambertMaterial||O.isMeshToonMaterial||O.isMeshPhongMaterial||O.isMeshStandardMaterial||O.isShadowMaterial||O.isShaderMaterial&&O.lights===!0}this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(O,j,re){Ne.get(O.texture).__webglTexture=j,Ne.get(O.depthTexture).__webglTexture=re;let ie=Ne.get(O);ie.__hasExternalTextures=!0,ie.__autoAllocateDepthBuffer=re===void 0,ie.__autoAllocateDepthBuffer||_e.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ie.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(O,j){let re=Ne.get(O);re.__webglFramebuffer=j,re.__useDefaultFramebuffer=j===void 0},this.setRenderTarget=function(O,j=0,re=0){w=O,M=j,S=re;let ie=!0,P=null,W=!1,ee=!1;if(O){let ce=Ne.get(O);ce.__useDefaultFramebuffer!==void 0?(Le.bindFramebuffer(H.FRAMEBUFFER,null),ie=!1):ce.__webglFramebuffer===void 0?Ve.setupRenderTarget(O):ce.__hasExternalTextures&&Ve.rebindTextures(O,Ne.get(O.texture).__webglTexture,Ne.get(O.depthTexture).__webglTexture);let Oe=O.texture;(Oe.isData3DTexture||Oe.isDataArrayTexture||Oe.isCompressedArrayTexture)&&(ee=!0);let Ge=Ne.get(O).__webglFramebuffer;O.isWebGLCubeRenderTarget?(Array.isArray(Ge[j])?P=Ge[j][re]:P=Ge[j],W=!0):xe.isWebGL2&&O.samples>0&&Ve.useMultisampledRTT(O)===!1?P=Ne.get(O).__webglMultisampledFramebuffer:Array.isArray(Ge)?P=Ge[re]:P=Ge,b.copy(O.viewport),E.copy(O.scissor),I=O.scissorTest}else b.copy(G).multiplyScalar(B).floor(),E.copy(Y).multiplyScalar(B).floor(),I=J;if(Le.bindFramebuffer(H.FRAMEBUFFER,P)&&xe.drawBuffers&&ie&&Le.drawBuffers(O,P),Le.viewport(b),Le.scissor(E),Le.setScissorTest(I),W){let ce=Ne.get(O.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+j,ce.__webglTexture,re)}else if(ee){let ce=Ne.get(O.texture),Oe=j||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,ce.__webglTexture,re||0,Oe)}T=-1},this.readRenderTargetPixels=function(O,j,re,ie,P,W,ee){if(!(O&&O.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Ne.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&ee!==void 0&&(ge=ge[ee]),ge){Le.bindFramebuffer(H.FRAMEBUFFER,ge);try{let ce=O.texture,Oe=ce.format,Ge=ce.type;if(Oe!==Rn&&ze.convert(Oe)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Re=Ge===Zu&&(_e.has("EXT_color_buffer_half_float")||xe.isWebGL2&&_e.has("EXT_color_buffer_float"));if(Ge!==Ro&&ze.convert(Ge)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===Ya&&(xe.isWebGL2||_e.has("OES_texture_float")||_e.has("WEBGL_color_buffer_float")))&&!Re){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=O.width-ie&&re>=0&&re<=O.height-P&&H.readPixels(j,re,ie,P,ze.convert(Oe),ze.convert(Ge),W)}finally{let ce=w!==null?Ne.get(w).__webglFramebuffer:null;Le.bindFramebuffer(H.FRAMEBUFFER,ce)}}},this.copyFramebufferToTexture=function(O,j,re=0){let ie=Math.pow(2,-re),P=Math.floor(j.image.width*ie),W=Math.floor(j.image.height*ie);Ve.setTexture2D(j,0),H.copyTexSubImage2D(H.TEXTURE_2D,re,0,0,O.x,O.y,P,W),Le.unbindTexture()},this.copyTextureToTexture=function(O,j,re,ie=0){let P=j.image.width,W=j.image.height,ee=ze.convert(re.format),ge=ze.convert(re.type);Ve.setTexture2D(re,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,re.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,re.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,re.unpackAlignment),j.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,P,W,ee,ge,j.image.data):j.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,j.mipmaps[0].width,j.mipmaps[0].height,ee,j.mipmaps[0].data):H.texSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,ee,ge,j.image),ie===0&&re.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),Le.unbindTexture()},this.copyTextureToTexture3D=function(O,j,re,ie,P=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let W=Math.round(O.max.x-O.min.x),ee=Math.round(O.max.y-O.min.y),ge=O.max.z-O.min.z+1,ce=ze.convert(ie.format),Oe=ze.convert(ie.type),Ge;if(ie.isData3DTexture)Ve.setTexture3D(ie,0),Ge=H.TEXTURE_3D;else if(ie.isDataArrayTexture||ie.isCompressedArrayTexture)Ve.setTexture2DArray(ie,0),Ge=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,ie.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ie.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,ie.unpackAlignment);let Re=H.getParameter(H.UNPACK_ROW_LENGTH),pt=H.getParameter(H.UNPACK_IMAGE_HEIGHT),mt=H.getParameter(H.UNPACK_SKIP_PIXELS),$e=H.getParameter(H.UNPACK_SKIP_ROWS),at=H.getParameter(H.UNPACK_SKIP_IMAGES),wt=re.isCompressedTexture?re.mipmaps[P]:re.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,wt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,wt.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,O.min.x),H.pixelStorei(H.UNPACK_SKIP_ROWS,O.min.y),H.pixelStorei(H.UNPACK_SKIP_IMAGES,O.min.z),re.isDataTexture||re.isData3DTexture?H.texSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,Oe,wt.data):ie.isCompressedArrayTexture?H.compressedTexSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,wt.data):H.texSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,Oe,wt),H.pixelStorei(H.UNPACK_ROW_LENGTH,Re),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,pt),H.pixelStorei(H.UNPACK_SKIP_PIXELS,mt),H.pixelStorei(H.UNPACK_SKIP_ROWS,$e),H.pixelStorei(H.UNPACK_SKIP_IMAGES,at),P===0&&ie.generateMipmaps&&H.generateMipmap(Ge),Le.unbindTexture()},this.initTexture=function(O){O.isCubeTexture?Ve.setTextureCube(O,0):O.isData3DTexture?Ve.setTexture3D(O,0):O.isDataArrayTexture||O.isCompressedArrayTexture?Ve.setTexture2DArray(O,0):Ve.setTexture2D(O,0),Le.unbindTexture()},this.resetState=function(){M=0,S=0,w=null,Le.reset(),we.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ja}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===fg?"display-p3":"srgb",t.unpackColorSpace=Er.workingColorSpace===dd?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}};var yS=class extends tn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new cl,this.environmentRotation=new cl,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentRotation=this.environmentRotation.toArray(),t}};var OA=class r extends Qa{constructor(e=1,t=32,i=0,n=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},t=Math.max(3,t);let a=[],o=[],s=[],l=[],u=new be,c=new Kt;o.push(0,0,0),s.push(0,0,1),l.push(.5,.5);for(let f=0,h=3;f<=t;f++,h+=3){let p=i+f/t*n;u.x=e*Math.cos(p),u.y=e*Math.sin(p),o.push(u.x,u.y,u.z),s.push(0,0,1),c.x=(o[h]/e+1)/2,c.y=(o[h+1]/e+1)/2,l.push(c.x,c.y)}for(let f=1;f<=t;f++)a.push(f,f+1,0);this.setIndex(a),this.setAttribute("position",new Zn(o,3)),this.setAttribute("normal",new Zn(s,3)),this.setAttribute("uv",new Zn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.radius,e.segments,e.thetaStart,e.thetaLength)}};var qg=class extends tn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ir(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};var _S=class extends qg{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(tn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ir(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}};var iz=new Wr,Aie=new be,Cie=new be,FA=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Kt(512,512),this.map=null,this.mapPass=null,this.matrix=new Wr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new vh,this._frameExtents=new Kt(1,1),this._viewportCount=1,this._viewports=[new ii(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;Aie.setFromMatrixPosition(e.matrixWorld),t.position.copy(Aie),Cie.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Cie),t.updateMatrixWorld(),iz.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(iz),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(iz)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}};var zA=class extends FA{constructor(){super(new kg(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}};var xS=class extends qg{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(tn.DEFAULT_UP),this.updateMatrix(),this.target=new tn,this.shadow=new zA}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};var SS=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Rie(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=Rie();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function Rie(){return(typeof performance>"u"?Date:performance).now()}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:rS}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=rS);var Lse=Nse(rae());var Ik="162";var ULe=0,iae=1,OLe=2;var Xoe=1,FLe=2,vc=3,Uh=0,lo=1,yc=2,Dh=0,a0=1,nae=2,aae=3,oae=4,zLe=5,um=100,BLe=101,kLe=102,sae=103,lae=104,VLe=200,GLe=201,HLe=202,WLe=203,KB=204,JB=205,XLe=206,YLe=207,qLe=208,ZLe=209,jLe=210,KLe=211,JLe=212,$Le=213,QLe=214,ePe=0,tPe=1,rPe=2,eR=3,iPe=4,nPe=5,aPe=6,oPe=7,NR=0,sPe=1,lPe=2,Ih=0,uPe=1,cPe=2,fPe=3,hPe=4,pPe=5,dPe=6,mPe=7,uae="attached",vPe="detached",cae=300,l0=301,u0=302,LM=303,$B=304,UR=306,c0=1e3,oo=1001,QB=1002,Dn=1003,fae=1004;var SM=1005;var ao=1006,dB=1007;var fm=1008;var Nh=1009,gPe=1010,yPe=1011,Nk=1012,Yoe=1013,Ph=1014,hu=1015,PM=1016,qoe=1017,Zoe=1018,hm=1020,_Pe=1021,As=1023,xPe=1024,SPe=1025,pm=1026,f0=1027,MPe=1028,joe=1029,bPe=1030,Koe=1031,Joe=1033,mB=33776,vB=33777,gB=33778,yB=33779,hae=35840,pae=35841,dae=35842,mae=35843,$oe=36196,vae=37492,gae=37496,yae=37808,_ae=37809,xae=37810,Sae=37811,Mae=37812,bae=37813,wae=37814,Tae=37815,Eae=37816,Aae=37817,Cae=37818,Rae=37819,Lae=37820,Pae=37821,_B=36492,Dae=36494,Iae=36495,wPe=36283,Nae=36284,Uae=36285,Oae=36286;var tR=2300,rR=2301,xB=2302,Fae=2400,zae=2401,Bae=2402,TPe=2500;var EPe=3200,APe=3201,Uk=0,CPe=1,Lh="",Ma="srgb",Hh="srgb-linear",Ok="display-p3",OR="display-p3-linear",iR="linear",ai="srgb",nR="rec709",aR="p3";var zy=7680;var kae=519,RPe=512,LPe=513,PPe=514,Qoe=515,DPe=516,IPe=517,NPe=518,UPe=519,Vae=35044;var Gae="300 es",ek=1035,_c=2e3,oR=2001,Oh=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let n=i.slice(0);for(let a=0,o=n.length;a<o;a++)n[a].call(this,e);e.target=null}}},ta=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Hae=1234567,AM=Math.PI/180,h0=180/Math.PI;function Wh(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(ta[r&255]+ta[r>>8&255]+ta[r>>16&255]+ta[r>>24&255]+"-"+ta[e&255]+ta[e>>8&255]+"-"+ta[e>>16&15|64]+ta[e>>24&255]+"-"+ta[t&63|128]+ta[t>>8&255]+"-"+ta[t>>16&255]+ta[t>>24&255]+ta[i&255]+ta[i>>8&255]+ta[i>>16&255]+ta[i>>24&255]).toLowerCase()}function In(r,e,t){return Math.max(e,Math.min(t,r))}function Fk(r,e){return(r%e+e)%e}function OPe(r,e,t,i,n){return i+(r-e)*(n-i)/(t-e)}function FPe(r,e,t){return r!==e?(t-r)/(e-r):0}function CM(r,e,t){return(1-t)*r+t*e}function zPe(r,e,t,i){return CM(r,e,1-Math.exp(-t*i))}function BPe(r,e=1){return e-Math.abs(Fk(r,e*2)-e)}function kPe(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function VPe(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function GPe(r,e){return r+Math.floor(Math.random()*(e-r+1))}function HPe(r,e){return r+Math.random()*(e-r)}function WPe(r){return r*(.5-Math.random())}function XPe(r){r!==void 0&&(Hae=r);let e=Hae+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function YPe(r){return r*AM}function qPe(r){return r*h0}function tk(r){return(r&r-1)===0&&r!==0}function ZPe(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function sR(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function jPe(r,e,t,i,n){let a=Math.cos,o=Math.sin,s=a(t/2),l=o(t/2),u=a((e+i)/2),c=o((e+i)/2),f=a((e-i)/2),h=o((e-i)/2),p=a((i-e)/2),d=o((i-e)/2);switch(n){case"XYX":r.set(s*c,l*f,l*h,s*u);break;case"YZY":r.set(l*h,s*c,l*f,s*u);break;case"ZXZ":r.set(l*f,l*h,s*c,s*u);break;case"XZX":r.set(s*c,l*d,l*p,s*u);break;case"YXY":r.set(l*p,s*c,l*d,s*u);break;case"ZYZ":r.set(l*d,l*p,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}}function e0(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function xa(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var na={DEG2RAD:AM,RAD2DEG:h0,generateUUID:Wh,clamp:In,euclideanModulo:Fk,mapLinear:OPe,inverseLerp:FPe,lerp:CM,damp:zPe,pingpong:BPe,smoothstep:kPe,smootherstep:VPe,randInt:GPe,randFloat:HPe,randFloatSpread:WPe,seededRandom:XPe,degToRad:YPe,radToDeg:qPe,isPowerOfTwo:tk,ceilPowerOfTwo:ZPe,floorPowerOfTwo:sR,setQuaternionFromProperEuler:jPe,normalize:xa,denormalize:e0},yr=class r{constructor(e=0,t=0){r.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(In(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),a=this.x-e.x,o=this.y-e.y;return this.x=a*i-o*n+e.x,this.y=a*n+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},dr=class r{constructor(e,t,i,n,a,o,s,l,u){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,n,a,o,s,l,u)}set(e,t,i,n,a,o,s,l,u){let c=this.elements;return c[0]=e,c[1]=n,c[2]=s,c[3]=t,c[4]=a,c[5]=l,c[6]=i,c[7]=o,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,a=this.elements,o=i[0],s=i[3],l=i[6],u=i[1],c=i[4],f=i[7],h=i[2],p=i[5],d=i[8],g=n[0],m=n[3],v=n[6],_=n[1],y=n[4],x=n[7],M=n[2],S=n[5],w=n[8];return a[0]=o*g+s*_+l*M,a[3]=o*m+s*y+l*S,a[6]=o*v+s*x+l*w,a[1]=u*g+c*_+f*M,a[4]=u*m+c*y+f*S,a[7]=u*v+c*x+f*w,a[2]=h*g+p*_+d*M,a[5]=h*m+p*y+d*S,a[8]=h*v+p*x+d*w,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return t*o*c-t*s*u-i*a*c+i*s*l+n*a*u-n*o*l}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=c*o-s*u,h=s*l-c*a,p=u*a-o*l,d=t*f+i*h+n*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=f*g,e[1]=(n*u-c*i)*g,e[2]=(s*i-n*o)*g,e[3]=h*g,e[4]=(c*t-n*l)*g,e[5]=(n*a-s*t)*g,e[6]=p*g,e[7]=(i*l-u*t)*g,e[8]=(o*t-i*a)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,a,o,s){let l=Math.cos(a),u=Math.sin(a);return this.set(i*l,i*u,-i*(l*o+u*s)+o+e,-n*u,n*l,-n*(-u*o+l*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(SB.makeScale(e,t)),this}rotate(e){return this.premultiply(SB.makeRotation(-e)),this}translate(e,t){return this.premultiply(SB.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}},SB=new dr;function ese(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function DM(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function KPe(){let r=DM("canvas");return r.style.display="block",r}var Wae={};function JPe(r){r in Wae||(Wae[r]=!0,console.warn(r))}var Xae=new dr().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Yae=new dr().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),CC={[Hh]:{transfer:iR,primaries:nR,toReference:r=>r,fromReference:r=>r},[Ma]:{transfer:ai,primaries:nR,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[OR]:{transfer:iR,primaries:aR,toReference:r=>r.applyMatrix3(Yae),fromReference:r=>r.applyMatrix3(Xae)},[Ok]:{transfer:ai,primaries:aR,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Yae),fromReference:r=>r.applyMatrix3(Xae).convertLinearToSRGB()}},$Pe=new Set([Hh,OR]),Jr={enabled:!0,_workingColorSpace:Hh,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!$Pe.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;let i=CC[e].toReference,n=CC[t].fromReference;return n(i(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return CC[r].primaries},getTransfer:function(r){return r===Lh?iR:CC[r].transfer}};function o0(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function MB(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var By,lR=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{By===void 0&&(By=DM("canvas")),By.width=e.width,By.height=e.height;let i=By.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=By}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=DM("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),a=n.data;for(let o=0;o<a.length;o++)a[o]=o0(a[o]/255)*255;return i.putImageData(n,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(o0(t[i]/255)*255):t[i]=o0(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},QPe=0,uR=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:QPe++}),this.uuid=Wh(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(n!==null){let a;if(Array.isArray(n)){a=[];for(let o=0,s=n.length;o<s;o++)n[o].isDataTexture?a.push(bB(n[o].image)):a.push(bB(n[o]))}else a=bB(n);i.url=a}return t||(e.images[this.uuid]=i),i}};function bB(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?lR.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var eDe=0,Vo=(()=>{class r extends Oh{constructor(t=r.DEFAULT_IMAGE,i=r.DEFAULT_MAPPING,n=oo,a=oo,o=ao,s=fm,l=As,u=Nh,c=r.DEFAULT_ANISOTROPY,f=Lh){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eDe++}),this.uuid=Wh(),this.name="",this.source=new uR(t),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=a,this.magFilter=o,this.minFilter=s,this.anisotropy=c,this.format=l,this.internalFormat=null,this.type=u,this.offset=new yr(0,0),this.repeat=new yr(1,1),this.center=new yr(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new dr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}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.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,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.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let i=t===void 0||typeof t=="string";if(!i&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),i||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==cae)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case c0:t.x=t.x-Math.floor(t.x);break;case oo:t.x=t.x<0?0:1;break;case QB:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case c0:t.y=t.y-Math.floor(t.y);break;case oo:t.y=t.y<0?0:1;break;case QB:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}}return r.DEFAULT_IMAGE=null,r.DEFAULT_MAPPING=cae,r.DEFAULT_ANISOTROPY=1,r})(),Pr=class r{constructor(e=0,t=0,i=0,n=1){r.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,a=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*n+o[12]*a,this.y=o[1]*t+o[5]*i+o[9]*n+o[13]*a,this.z=o[2]*t+o[6]*i+o[10]*n+o[14]*a,this.w=o[3]*t+o[7]*i+o[11]*n+o[15]*a,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,a,l=e.elements,u=l[0],c=l[4],f=l[8],h=l[1],p=l[5],d=l[9],g=l[2],m=l[6],v=l[10];if(Math.abs(c-h)<.01&&Math.abs(f-g)<.01&&Math.abs(d-m)<.01){if(Math.abs(c+h)<.1&&Math.abs(f+g)<.1&&Math.abs(d+m)<.1&&Math.abs(u+p+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let y=(u+1)/2,x=(p+1)/2,M=(v+1)/2,S=(c+h)/4,w=(f+g)/4,T=(d+m)/4;return y>x&&y>M?y<.01?(i=0,n=.707106781,a=.707106781):(i=Math.sqrt(y),n=S/i,a=w/i):x>M?x<.01?(i=.707106781,n=0,a=.707106781):(n=Math.sqrt(x),i=S/n,a=T/n):M<.01?(i=.707106781,n=.707106781,a=0):(a=Math.sqrt(M),i=w/a,n=T/a),this.set(i,n,a,t),this}let _=Math.sqrt((m-d)*(m-d)+(f-g)*(f-g)+(h-c)*(h-c));return Math.abs(_)<.001&&(_=1),this.x=(m-d)/_,this.y=(f-g)/_,this.z=(h-c)/_,this.w=Math.acos((u+p+v-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},rk=class extends Oh{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pr(0,0,e,t),this.scissorTest=!1,this.viewport=new Pr(0,0,e,t);let n={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ao,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let a=new Vo(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);a.flipY=!1,a.generateMipmaps=i.generateMipmaps,a.internalFormat=i.internalFormat,this.textures=[];let o=i.count;for(let s=0;s<o;s++)this.textures[s]=a.clone(),this.textures[s].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,a=this.textures.length;n<a;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,n=e.textures.length;i<n;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new uR(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Sc=class extends rk{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},cR=class extends Vo{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=Dn,this.minFilter=Dn,this.wrapR=oo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var ik=class extends Vo{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=Dn,this.minFilter=Dn,this.wrapR=oo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var On=class{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,a,o,s){let l=i[n+0],u=i[n+1],c=i[n+2],f=i[n+3],h=a[o+0],p=a[o+1],d=a[o+2],g=a[o+3];if(s===0){e[t+0]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f;return}if(s===1){e[t+0]=h,e[t+1]=p,e[t+2]=d,e[t+3]=g;return}if(f!==g||l!==h||u!==p||c!==d){let m=1-s,v=l*h+u*p+c*d+f*g,_=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){let M=Math.sqrt(y),S=Math.atan2(M,v*_);m=Math.sin(m*S)/M,s=Math.sin(s*S)/M}let x=s*_;if(l=l*m+h*x,u=u*m+p*x,c=c*m+d*x,f=f*m+g*x,m===1-s){let M=1/Math.sqrt(l*l+u*u+c*c+f*f);l*=M,u*=M,c*=M,f*=M}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,n,a,o){let s=i[n],l=i[n+1],u=i[n+2],c=i[n+3],f=a[o],h=a[o+1],p=a[o+2],d=a[o+3];return e[t]=s*d+c*f+l*p-u*h,e[t+1]=l*d+c*h+u*f-s*p,e[t+2]=u*d+c*p+s*h-l*f,e[t+3]=c*d-s*f-l*h-u*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,n=e._y,a=e._z,o=e._order,s=Math.cos,l=Math.sin,u=s(i/2),c=s(n/2),f=s(a/2),h=l(i/2),p=l(n/2),d=l(a/2);switch(o){case"XYZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"YXZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"ZXY":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"ZYX":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"YZX":this._x=h*c*f+u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f-h*p*d;break;case"XZY":this._x=h*c*f-u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],a=t[8],o=t[1],s=t[5],l=t[9],u=t[2],c=t[6],f=t[10],h=i+s+f;if(h>0){let p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(c-l)*p,this._y=(a-u)*p,this._z=(o-n)*p}else if(i>s&&i>f){let p=2*Math.sqrt(1+i-s-f);this._w=(c-l)/p,this._x=.25*p,this._y=(n+o)/p,this._z=(a+u)/p}else if(s>f){let p=2*Math.sqrt(1+s-i-f);this._w=(a-u)/p,this._x=(n+o)/p,this._y=.25*p,this._z=(l+c)/p}else{let p=2*Math.sqrt(1+f-i-s);this._w=(o-n)/p,this._x=(a+u)/p,this._y=(l+c)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(In(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let n=Math.min(1,t/i);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,a=e._z,o=e._w,s=t._x,l=t._y,u=t._z,c=t._w;return this._x=i*c+o*s+n*u-a*l,this._y=n*c+o*l+a*s-i*u,this._z=a*c+o*u+i*l-n*s,this._w=o*c-i*s-n*l-a*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,n=this._y,a=this._z,o=this._w,s=o*e._w+i*e._x+n*e._y+a*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=i,this._y=n,this._z=a,this;let l=1-s*s;if(l<=Number.EPSILON){let p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*n+t*this._y,this._z=p*a+t*this._z,this.normalize(),this}let u=Math.sqrt(l),c=Math.atan2(u,s),f=Math.sin((1-t)*c)/u,h=Math.sin(t*c)/u;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=n*f+this._y*h,this._z=a*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),a=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),a*Math.sin(t),a*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},ye=class r{constructor(e=0,t=0,i=0){r.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(qae.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(qae.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6]*n,this.y=a[1]*t+a[4]*i+a[7]*n,this.z=a[2]*t+a[5]*i+a[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,a=e.elements,o=1/(a[3]*t+a[7]*i+a[11]*n+a[15]);return this.x=(a[0]*t+a[4]*i+a[8]*n+a[12])*o,this.y=(a[1]*t+a[5]*i+a[9]*n+a[13])*o,this.z=(a[2]*t+a[6]*i+a[10]*n+a[14])*o,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,a=e.x,o=e.y,s=e.z,l=e.w,u=2*(o*n-s*i),c=2*(s*t-a*n),f=2*(a*i-o*t);return this.x=t+l*u+o*f-s*c,this.y=i+l*c+s*u-a*f,this.z=n+l*f+a*c-o*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n,this.y=a[1]*t+a[5]*i+a[9]*n,this.z=a[2]*t+a[6]*i+a[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,a=e.z,o=t.x,s=t.y,l=t.z;return this.x=n*l-a*s,this.y=a*o-i*l,this.z=i*s-n*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return wB.copy(this).projectOnVector(e),this.sub(wB)}reflect(e){return this.sub(wB.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(In(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},wB=new ye,qae=new On,Fh=class{constructor(e=new ye(1/0,1/0,1/0),t=new ye(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(vl.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(vl.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=vl.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let a=i.getAttribute("position");if(t===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let o=0,s=a.count;o<s;o++)e.isMesh===!0?e.getVertexPosition(o,vl):vl.fromBufferAttribute(a,o),vl.applyMatrix4(e.matrixWorld),this.expandByPoint(vl);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),RC.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),RC.copy(i.boundingBox)),RC.applyMatrix4(e.matrixWorld),this.union(RC)}let n=e.children;for(let a=0,o=n.length;a<o;a++)this.expandByObject(n[a],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,vl),vl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(MM),LC.subVectors(this.max,MM),ky.subVectors(e.a,MM),Vy.subVectors(e.b,MM),Gy.subVectors(e.c,MM),wh.subVectors(Vy,ky),Th.subVectors(Gy,Vy),rm.subVectors(ky,Gy);let t=[0,-wh.z,wh.y,0,-Th.z,Th.y,0,-rm.z,rm.y,wh.z,0,-wh.x,Th.z,0,-Th.x,rm.z,0,-rm.x,-wh.y,wh.x,0,-Th.y,Th.x,0,-rm.y,rm.x,0];return!TB(t,ky,Vy,Gy,LC)||(t=[1,0,0,0,1,0,0,0,1],!TB(t,ky,Vy,Gy,LC))?!1:(PC.crossVectors(wh,Th),t=[PC.x,PC.y,PC.z],TB(t,ky,Vy,Gy,LC))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(vl).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(cc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),cc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),cc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),cc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),cc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),cc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),cc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),cc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(cc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},cc=[new ye,new ye,new ye,new ye,new ye,new ye,new ye,new ye],vl=new ye,RC=new Fh,ky=new ye,Vy=new ye,Gy=new ye,wh=new ye,Th=new ye,rm=new ye,MM=new ye,LC=new ye,PC=new ye,im=new ye;function TB(r,e,t,i,n){for(let a=0,o=r.length-3;a<=o;a+=3){im.fromArray(r,a);let s=n.x*Math.abs(im.x)+n.y*Math.abs(im.y)+n.z*Math.abs(im.z),l=e.dot(im),u=t.dot(im),c=i.dot(im);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var tDe=new Fh,bM=new ye,EB=new ye,zh=class{constructor(e=new ye,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):tDe.setFromPoints(e).getCenter(i);let n=0;for(let a=0,o=e.length;a<o;a++)n=Math.max(n,i.distanceToSquared(e[a]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;bM.subVectors(e,this.center);let t=bM.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector(bM,n/i),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(EB.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(bM.copy(e.center).add(EB)),this.expandByPoint(bM.copy(e.center).sub(EB))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},fc=new ye,AB=new ye,DC=new ye,Eh=new ye,CB=new ye,IC=new ye,RB=new ye,IM=class{constructor(e=new ye,t=new ye(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,fc)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=fc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(fc.copy(this.origin).addScaledVector(this.direction,t),fc.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){AB.copy(e).add(t).multiplyScalar(.5),DC.copy(t).sub(e).normalize(),Eh.copy(this.origin).sub(AB);let a=e.distanceTo(t)*.5,o=-this.direction.dot(DC),s=Eh.dot(this.direction),l=-Eh.dot(DC),u=Eh.lengthSq(),c=Math.abs(1-o*o),f,h,p,d;if(c>0)if(f=o*l-s,h=o*s-l,d=a*c,f>=0)if(h>=-d)if(h<=d){let g=1/c;f*=g,h*=g,p=f*(f+o*h+2*s)+h*(o*f+h+2*l)+u}else h=a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;else h=-a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;else h<=-d?(f=Math.max(0,-(-o*a+s)),h=f>0?-a:Math.min(Math.max(-a,-l),a),p=-f*f+h*(h+2*l)+u):h<=d?(f=0,h=Math.min(Math.max(-a,-l),a),p=h*(h+2*l)+u):(f=Math.max(0,-(o*a+s)),h=f>0?a:Math.min(Math.max(-a,-l),a),p=-f*f+h*(h+2*l)+u);else h=o>0?-a:a,f=Math.max(0,-(o*h+s)),p=-f*f+h*(h+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,f),n&&n.copy(AB).addScaledVector(DC,h),p}intersectSphere(e,t){fc.subVectors(e.center,this.origin);let i=fc.dot(this.direction),n=fc.dot(fc)-i*i,a=e.radius*e.radius;if(n>a)return null;let o=Math.sqrt(a-n),s=i-o,l=i+o;return l<0?null:s<0?this.at(l,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,a,o,s,l,u=1/this.direction.x,c=1/this.direction.y,f=1/this.direction.z,h=this.origin;return u>=0?(i=(e.min.x-h.x)*u,n=(e.max.x-h.x)*u):(i=(e.max.x-h.x)*u,n=(e.min.x-h.x)*u),c>=0?(a=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(a=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),i>o||a>n||((a>i||isNaN(i))&&(i=a),(o<n||isNaN(n))&&(n=o),f>=0?(s=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(s=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||s>n)||((s>i||i!==i)&&(i=s),(l<n||n!==n)&&(n=l),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,fc)!==null}intersectTriangle(e,t,i,n,a){CB.subVectors(t,e),IC.subVectors(i,e),RB.crossVectors(CB,IC);let o=this.direction.dot(RB),s;if(o>0){if(n)return null;s=1}else if(o<0)s=-1,o=-o;else return null;Eh.subVectors(this.origin,e);let l=s*this.direction.dot(IC.crossVectors(Eh,IC));if(l<0)return null;let u=s*this.direction.dot(CB.cross(Eh));if(u<0||l+u>o)return null;let c=-s*Eh.dot(RB);return c<0?null:this.at(c/o,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ht=class r{constructor(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m)}set(e,t,i,n,a,o,s,l,u,c,f,h,p,d,g,m){let v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=n,v[1]=a,v[5]=o,v[9]=s,v[13]=l,v[2]=u,v[6]=c,v[10]=f,v[14]=h,v[3]=p,v[7]=d,v[11]=g,v[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 r().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/Hy.setFromMatrixColumn(e,0).length(),a=1/Hy.setFromMatrixColumn(e,1).length(),o=1/Hy.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*a,t[5]=i[5]*a,t[6]=i[6]*a,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,n=e.y,a=e.z,o=Math.cos(i),s=Math.sin(i),l=Math.cos(n),u=Math.sin(n),c=Math.cos(a),f=Math.sin(a);if(e.order==="XYZ"){let h=o*c,p=o*f,d=s*c,g=s*f;t[0]=l*c,t[4]=-l*f,t[8]=u,t[1]=p+d*u,t[5]=h-g*u,t[9]=-s*l,t[2]=g-h*u,t[6]=d+p*u,t[10]=o*l}else if(e.order==="YXZ"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h+g*s,t[4]=d*s-p,t[8]=o*u,t[1]=o*f,t[5]=o*c,t[9]=-s,t[2]=p*s-d,t[6]=g+h*s,t[10]=o*l}else if(e.order==="ZXY"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h-g*s,t[4]=-o*f,t[8]=d+p*s,t[1]=p+d*s,t[5]=o*c,t[9]=g-h*s,t[2]=-o*u,t[6]=s,t[10]=o*l}else if(e.order==="ZYX"){let h=o*c,p=o*f,d=s*c,g=s*f;t[0]=l*c,t[4]=d*u-p,t[8]=h*u+g,t[1]=l*f,t[5]=g*u+h,t[9]=p*u-d,t[2]=-u,t[6]=s*l,t[10]=o*l}else if(e.order==="YZX"){let h=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=g-h*f,t[8]=d*f+p,t[1]=f,t[5]=o*c,t[9]=-s*c,t[2]=-u*c,t[6]=p*f+d,t[10]=h-g*f}else if(e.order==="XZY"){let h=o*l,p=o*u,d=s*l,g=s*u;t[0]=l*c,t[4]=-f,t[8]=u*c,t[1]=h*f+g,t[5]=o*c,t[9]=p*f-d,t[2]=d*f-p,t[6]=s*c,t[10]=g*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rDe,e,iDe)}lookAt(e,t,i){let n=this.elements;return Bo.subVectors(e,t),Bo.lengthSq()===0&&(Bo.z=1),Bo.normalize(),Ah.crossVectors(i,Bo),Ah.lengthSq()===0&&(Math.abs(i.z)===1?Bo.x+=1e-4:Bo.z+=1e-4,Bo.normalize(),Ah.crossVectors(i,Bo)),Ah.normalize(),NC.crossVectors(Bo,Ah),n[0]=Ah.x,n[4]=NC.x,n[8]=Bo.x,n[1]=Ah.y,n[5]=NC.y,n[9]=Bo.y,n[2]=Ah.z,n[6]=NC.z,n[10]=Bo.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,a=this.elements,o=i[0],s=i[4],l=i[8],u=i[12],c=i[1],f=i[5],h=i[9],p=i[13],d=i[2],g=i[6],m=i[10],v=i[14],_=i[3],y=i[7],x=i[11],M=i[15],S=n[0],w=n[4],T=n[8],C=n[12],b=n[1],E=n[5],I=n[9],R=n[13],A=n[2],D=n[6],U=n[10],B=n[14],F=n[3],k=n[7],G=n[11],Y=n[15];return a[0]=o*S+s*b+l*A+u*F,a[4]=o*w+s*E+l*D+u*k,a[8]=o*T+s*I+l*U+u*G,a[12]=o*C+s*R+l*B+u*Y,a[1]=c*S+f*b+h*A+p*F,a[5]=c*w+f*E+h*D+p*k,a[9]=c*T+f*I+h*U+p*G,a[13]=c*C+f*R+h*B+p*Y,a[2]=d*S+g*b+m*A+v*F,a[6]=d*w+g*E+m*D+v*k,a[10]=d*T+g*I+m*U+v*G,a[14]=d*C+g*R+m*B+v*Y,a[3]=_*S+y*b+x*A+M*F,a[7]=_*w+y*E+x*D+M*k,a[11]=_*T+y*I+x*U+M*G,a[15]=_*C+y*R+x*B+M*Y,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],a=e[12],o=e[1],s=e[5],l=e[9],u=e[13],c=e[2],f=e[6],h=e[10],p=e[14],d=e[3],g=e[7],m=e[11],v=e[15];return d*(+a*l*f-n*u*f-a*s*h+i*u*h+n*s*p-i*l*p)+g*(+t*l*p-t*u*h+a*o*h-n*o*p+n*u*c-a*l*c)+m*(+t*u*f-t*s*p-a*o*f+i*o*p+a*s*c-i*u*c)+v*(-n*s*c-t*l*f+t*s*h+n*o*f-i*o*h+i*l*c)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],g=e[13],m=e[14],v=e[15],_=f*m*u-g*h*u+g*l*p-s*m*p-f*l*v+s*h*v,y=d*h*u-c*m*u-d*l*p+o*m*p+c*l*v-o*h*v,x=c*g*u-d*f*u+d*s*p-o*g*p-c*s*v+o*f*v,M=d*f*l-c*g*l-d*s*h+o*g*h+c*s*m-o*f*m,S=t*_+i*y+n*x+a*M;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/S;return e[0]=_*w,e[1]=(g*h*a-f*m*a-g*n*p+i*m*p+f*n*v-i*h*v)*w,e[2]=(s*m*a-g*l*a+g*n*u-i*m*u-s*n*v+i*l*v)*w,e[3]=(f*l*a-s*h*a-f*n*u+i*h*u+s*n*p-i*l*p)*w,e[4]=y*w,e[5]=(c*m*a-d*h*a+d*n*p-t*m*p-c*n*v+t*h*v)*w,e[6]=(d*l*a-o*m*a-d*n*u+t*m*u+o*n*v-t*l*v)*w,e[7]=(o*h*a-c*l*a+c*n*u-t*h*u-o*n*p+t*l*p)*w,e[8]=x*w,e[9]=(d*f*a-c*g*a-d*i*p+t*g*p+c*i*v-t*f*v)*w,e[10]=(o*g*a-d*s*a+d*i*u-t*g*u-o*i*v+t*s*v)*w,e[11]=(c*s*a-o*f*a-c*i*u+t*f*u+o*i*p-t*s*p)*w,e[12]=M*w,e[13]=(c*g*n-d*f*n+d*i*h-t*g*h-c*i*m+t*f*m)*w,e[14]=(d*s*n-o*g*n-d*i*l+t*g*l+o*i*m-t*s*m)*w,e[15]=(o*f*n-c*s*n+c*i*l-t*f*l-o*i*h+t*s*h)*w,this}scale(e){let t=this.elements,i=e.x,n=e.y,a=e.z;return t[0]*=i,t[4]*=n,t[8]*=a,t[1]*=i,t[5]*=n,t[9]*=a,t[2]*=i,t[6]*=n,t[10]*=a,t[3]*=i,t[7]*=n,t[11]*=a,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),a=1-i,o=e.x,s=e.y,l=e.z,u=a*o,c=a*s;return this.set(u*o+i,u*s-n*l,u*l+n*s,0,u*s+n*l,c*s+i,c*l-n*o,0,u*l-n*s,c*l+n*o,a*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,a,o){return this.set(1,i,a,0,e,1,o,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,a=t._x,o=t._y,s=t._z,l=t._w,u=a+a,c=o+o,f=s+s,h=a*u,p=a*c,d=a*f,g=o*c,m=o*f,v=s*f,_=l*u,y=l*c,x=l*f,M=i.x,S=i.y,w=i.z;return n[0]=(1-(g+v))*M,n[1]=(p+x)*M,n[2]=(d-y)*M,n[3]=0,n[4]=(p-x)*S,n[5]=(1-(h+v))*S,n[6]=(m+_)*S,n[7]=0,n[8]=(d+y)*w,n[9]=(m-_)*w,n[10]=(1-(h+g))*w,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,a=Hy.set(n[0],n[1],n[2]).length(),o=Hy.set(n[4],n[5],n[6]).length(),s=Hy.set(n[8],n[9],n[10]).length();this.determinant()<0&&(a=-a),e.x=n[12],e.y=n[13],e.z=n[14],gl.copy(this);let u=1/a,c=1/o,f=1/s;return gl.elements[0]*=u,gl.elements[1]*=u,gl.elements[2]*=u,gl.elements[4]*=c,gl.elements[5]*=c,gl.elements[6]*=c,gl.elements[8]*=f,gl.elements[9]*=f,gl.elements[10]*=f,t.setFromRotationMatrix(gl),i.x=a,i.y=o,i.z=s,this}makePerspective(e,t,i,n,a,o,s=_c){let l=this.elements,u=2*a/(t-e),c=2*a/(i-n),f=(t+e)/(t-e),h=(i+n)/(i-n),p,d;if(s===_c)p=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(s===oR)p=-o/(o-a),d=-o*a/(o-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return l[0]=u,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=c,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=d,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,n,a,o,s=_c){let l=this.elements,u=1/(t-e),c=1/(i-n),f=1/(o-a),h=(t+e)*u,p=(i+n)*c,d,g;if(s===_c)d=(o+a)*f,g=-2*f;else if(s===oR)d=a*f,g=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=g,l[14]=-d,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},Hy=new ye,gl=new Ht,rDe=new ye(0,0,0),iDe=new ye(1,1,1),Ah=new ye,NC=new ye,Bo=new ye,Zae=new Ht,jae=new On,Fn=(()=>{class r{constructor(t=0,i=0,n=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=i,this._z=n,this._order=a}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,i,n,a=this._order){return this._x=t,this._y=i,this._z=n,this._order=a,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,i=this._order,n=!0){let a=t.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],f=a[9],h=a[2],p=a[6],d=a[10];switch(i){case"XYZ":this._y=Math.asin(In(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,d),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-In(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(l,d),this._z=Math.atan2(u,c)):(this._y=Math.atan2(-h,o),this._z=0);break;case"ZXY":this._x=Math.asin(In(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(u,o));break;case"ZYX":this._y=Math.asin(-In(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(In(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(l,d));break;case"XZY":this._z=Math.asin(-In(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-f,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+i)}return this._order=i,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,i,n){return Zae.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Zae,i,n)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return jae.setFromEuler(this),this.setFromQuaternion(jae,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],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],i=0){return t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}return r.DEFAULT_ORDER="XYZ",r})(),fR=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},nDe=0,Kae=new ye,Wy=new On,hc=new Ht,UC=new ye,wM=new ye,aDe=new ye,oDe=new On,Jae=new ye(1,0,0),$ae=new ye(0,1,0),Qae=new ye(0,0,1),sDe={type:"added"},lDe={type:"removed"},LB={type:"childadded",child:null},PB={type:"childremoved",child:null},ia=(()=>{class r extends Oh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:nDe++}),this.uuid=Wh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new ye,i=new Fn,n=new On,a=new ye(1,1,1);function o(){n.setFromEuler(i,!1)}function s(){i.setFromQuaternion(n,void 0,!1)}i._onChange(o),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new Ht},normalMatrix:{value:new dr}}),this.matrix=new Ht,this.matrixWorld=new Ht,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new fR,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}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,i){this.quaternion.setFromAxisAngle(t,i)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,i){return Wy.setFromAxisAngle(t,i),this.quaternion.multiply(Wy),this}rotateOnWorldAxis(t,i){return Wy.setFromAxisAngle(t,i),this.quaternion.premultiply(Wy),this}rotateX(t){return this.rotateOnAxis(Jae,t)}rotateY(t){return this.rotateOnAxis($ae,t)}rotateZ(t){return this.rotateOnAxis(Qae,t)}translateOnAxis(t,i){return Kae.copy(t).applyQuaternion(this.quaternion),this.position.add(Kae.multiplyScalar(i)),this}translateX(t){return this.translateOnAxis(Jae,t)}translateY(t){return this.translateOnAxis($ae,t)}translateZ(t){return this.translateOnAxis(Qae,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(hc.copy(this.matrixWorld).invert())}lookAt(t,i,n){t.isVector3?UC.copy(t):UC.set(t,i,n);let a=this.parent;this.updateWorldMatrix(!0,!1),wM.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?hc.lookAt(wM,UC,this.up):hc.lookAt(UC,wM,this.up),this.quaternion.setFromRotationMatrix(hc),a&&(hc.extractRotation(a.matrixWorld),Wy.setFromRotationMatrix(hc),this.quaternion.premultiply(Wy.invert()))}add(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);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?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(sDe),LB.child=t,this.dispatchEvent(LB),LB.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let i=this.children.indexOf(t);return i!==-1&&(t.parent=null,this.children.splice(i,1),t.dispatchEvent(lDe),PB.child=t,this.dispatchEvent(PB),PB.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),hc.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),hc.multiply(t.parent.matrixWorld)),t.applyMatrix4(hc),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,i){if(this[t]===i)return this;for(let n=0,a=this.children.length;n<a;n++){let s=this.children[n].getObjectByProperty(t,i);if(s!==void 0)return s}}getObjectsByProperty(t,i,n=[]){this[t]===i&&n.push(this);let a=this.children;for(let o=0,s=a.length;o<s;o++)a[o].getObjectsByProperty(t,i,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(wM,t,aDe),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(wM,oDe,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let i=this.matrixWorld.elements;return t.set(i[8],i[9],i[10]).normalize()}raycast(){}traverse(t){t(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].traverseVisible(t)}traverseAncestors(t){let i=this.parent;i!==null&&(t(i),i.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let i=this.children;for(let n=0,a=i.length;n<a;n++){let o=i[n];(o.matrixWorldAutoUpdate===!0||t===!0)&&o.updateMatrixWorld(t)}}updateWorldMatrix(t,i){let n=this.parent;if(t===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),i===!0){let a=this.children;for(let o=0,s=a.length;o<s;o++){let l=a[o];l.matrixWorldAutoUpdate===!0&&l.updateWorldMatrix(!1,!0)}}}toJSON(t){let i=t===void 0||typeof t=="string",n={};i&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.visibility=this._visibility,a.active=this._active,a.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),a.maxGeometryCount=this._maxGeometryCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.geometryCount=this._geometryCount,a.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(a.boundingSphere={center:a.boundingSphere.center.toArray(),radius:a.boundingSphere.radius}),this.boundingBox!==null&&(a.boundingBox={min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}));function o(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(t)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=o(t.geometries,this.geometry);let l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){let u=l.shapes;if(Array.isArray(u))for(let c=0,f=u.length;c<f;c++){let h=u[c];o(t.shapes,h)}else o(t.shapes,u)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let l=[];for(let u=0,c=this.material.length;u<c;u++)l.push(o(t.materials,this.material[u]));a.material=l}else a.material=o(t.materials,this.material);if(this.children.length>0){a.children=[];for(let l=0;l<this.children.length;l++)a.children.push(this.children[l].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let l=0;l<this.animations.length;l++){let u=this.animations[l];a.animations.push(o(t.animations,u))}}if(i){let l=s(t.geometries),u=s(t.materials),c=s(t.textures),f=s(t.images),h=s(t.shapes),p=s(t.skeletons),d=s(t.animations),g=s(t.nodes);l.length>0&&(n.geometries=l),u.length>0&&(n.materials=u),c.length>0&&(n.textures=c),f.length>0&&(n.images=f),h.length>0&&(n.shapes=h),p.length>0&&(n.skeletons=p),d.length>0&&(n.animations=d),g.length>0&&(n.nodes=g)}return n.object=a,n;function s(l){let u=[];for(let c in l){let f=l[c];delete f.metadata,u.push(f)}return u}}clone(t){return new this.constructor().copy(this,t)}copy(t,i=!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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),i===!0)for(let n=0;n<t.children.length;n++){let a=t.children[n];this.add(a.clone())}return this}}return r.DEFAULT_UP=new ye(0,1,0),r.DEFAULT_MATRIX_AUTO_UPDATE=!0,r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,r})(),yl=new ye,pc=new ye,DB=new ye,dc=new ye,Xy=new ye,Yy=new ye,eoe=new ye,IB=new ye,NB=new ye,UB=new ye,t0=class r{constructor(e=new ye,t=new ye,i=new ye){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),yl.subVectors(e,t),n.cross(yl);let a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,i,n,a){yl.subVectors(n,t),pc.subVectors(i,t),DB.subVectors(e,t);let o=yl.dot(yl),s=yl.dot(pc),l=yl.dot(DB),u=pc.dot(pc),c=pc.dot(DB),f=o*u-s*s;if(f===0)return a.set(0,0,0),null;let h=1/f,p=(u*l-s*c)*h,d=(o*c-s*l)*h;return a.set(1-p-d,d,p)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,dc)===null?!1:dc.x>=0&&dc.y>=0&&dc.x+dc.y<=1}static getInterpolation(e,t,i,n,a,o,s,l){return this.getBarycoord(e,t,i,n,dc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(a,dc.x),l.addScaledVector(o,dc.y),l.addScaledVector(s,dc.z),l)}static isFrontFacing(e,t,i,n){return yl.subVectors(i,t),pc.subVectors(e,t),yl.cross(pc).dot(n)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return yl.subVectors(this.c,this.b),pc.subVectors(this.a,this.b),yl.cross(pc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return r.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return r.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,a){return r.getInterpolation(e,this.a,this.b,this.c,t,i,n,a)}containsPoint(e){return r.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return r.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,a=this.c,o,s;Xy.subVectors(n,i),Yy.subVectors(a,i),IB.subVectors(e,i);let l=Xy.dot(IB),u=Yy.dot(IB);if(l<=0&&u<=0)return t.copy(i);NB.subVectors(e,n);let c=Xy.dot(NB),f=Yy.dot(NB);if(c>=0&&f<=c)return t.copy(n);let h=l*f-c*u;if(h<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(Xy,o);UB.subVectors(e,a);let p=Xy.dot(UB),d=Yy.dot(UB);if(d>=0&&p<=d)return t.copy(a);let g=p*u-l*d;if(g<=0&&u>=0&&d<=0)return s=u/(u-d),t.copy(i).addScaledVector(Yy,s);let m=c*d-p*f;if(m<=0&&f-c>=0&&p-d>=0)return eoe.subVectors(a,n),s=(f-c)/(f-c+(p-d)),t.copy(n).addScaledVector(eoe,s);let v=1/(m+g+h);return o=g*v,s=h*v,t.copy(i).addScaledVector(Xy,o).addScaledVector(Yy,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},tse={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},Ch={h:0,s:0,l:0},OC={h:0,s:0,l:0};function OB(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}var er=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let n=e;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ma){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Jr.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=Jr.workingColorSpace){return this.r=e,this.g=t,this.b=i,Jr.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=Jr.workingColorSpace){if(e=Fk(e,1),t=In(t,0,1),i=In(i,0,1),t===0)this.r=this.g=this.b=i;else{let a=i<=.5?i*(1+t):i+t-i*t,o=2*i-a;this.r=OB(o,a,e+1/3),this.g=OB(o,a,e),this.b=OB(o,a,e-1/3)}return Jr.toWorkingColorSpace(this,n),this}setStyle(e,t=Ma){function i(a){a!==void 0&&parseFloat(a)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let a,o=n[1],s=n[2];switch(o){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let a=n[1],o=a.length;if(o===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(a,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ma){let i=tse[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=o0(e.r),this.g=o0(e.g),this.b=o0(e.b),this}copyLinearToSRGB(e){return this.r=MB(e.r),this.g=MB(e.g),this.b=MB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ma){return Jr.fromWorkingColorSpace(ra.copy(this),e),Math.round(In(ra.r*255,0,255))*65536+Math.round(In(ra.g*255,0,255))*256+Math.round(In(ra.b*255,0,255))}getHexString(e=Ma){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Jr.workingColorSpace){Jr.fromWorkingColorSpace(ra.copy(this),t);let i=ra.r,n=ra.g,a=ra.b,o=Math.max(i,n,a),s=Math.min(i,n,a),l,u,c=(s+o)/2;if(s===o)l=0,u=0;else{let f=o-s;switch(u=c<=.5?f/(o+s):f/(2-o-s),o){case i:l=(n-a)/f+(n<a?6:0);break;case n:l=(a-i)/f+2;break;case a:l=(i-n)/f+4;break}l/=6}return e.h=l,e.s=u,e.l=c,e}getRGB(e,t=Jr.workingColorSpace){return Jr.fromWorkingColorSpace(ra.copy(this),t),e.r=ra.r,e.g=ra.g,e.b=ra.b,e}getStyle(e=Ma){Jr.fromWorkingColorSpace(ra.copy(this),e);let t=ra.r,i=ra.g,n=ra.b;return e!==Ma?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(n*255)})`}offsetHSL(e,t,i){return this.getHSL(Ch),this.setHSL(Ch.h+e,Ch.s+t,Ch.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Ch),e.getHSL(OC);let i=CM(Ch.h,OC.h,t),n=CM(Ch.s,OC.s,t),a=CM(Ch.l,OC.l,t);return this.setHSL(i,n,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,n=this.b,a=e.elements;return this.r=a[0]*t+a[3]*i+a[6]*n,this.g=a[1]*t+a[4]*i+a[7]*n,this.b=a[2]*t+a[5]*i+a[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},ra=new er;er.NAMES=tse;var uDe=0,Mc=class extends Oh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:uDe++}),this.uuid=Wh(),this.name="",this.type="Material",this.blending=a0,this.side=Uh,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=KB,this.blendDst=JB,this.blendEquation=um,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new er(0,0,0),this.blendAlpha=0,this.depthFunc=eR,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=kae,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=zy,this.stencilZFail=zy,this.stencilZPass=zy,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(n===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==a0&&(i.blending=this.blending),this.side!==Uh&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==KB&&(i.blendSrc=this.blendSrc),this.blendDst!==JB&&(i.blendDst=this.blendDst),this.blendEquation!==um&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==eR&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==kae&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==zy&&(i.stencilFail=this.stencilFail),this.stencilZFail!==zy&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==zy&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function n(a){let o=[];for(let s in a){let l=a[s];delete l.metadata,o.push(l)}return o}if(t){let a=n(e.textures),o=n(e.images);a.length>0&&(i.textures=a),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let n=t.length;i=new Array(n);for(let a=0;a!==n;++a)i[a]=t[a].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},hR=class extends Mc{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new er(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Fn,this.combine=NR,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};var Hi=new ye,FC=new yr,Cs=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Vae,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=hu,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return JPe("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,a=this.itemSize;n<a;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)FC.fromBufferAttribute(this,t),FC.applyMatrix3(e),this.setXY(t,FC.x,FC.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Hi.fromBufferAttribute(this,t),Hi.applyMatrix3(e),this.setXYZ(t,Hi.x,Hi.y,Hi.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Hi.fromBufferAttribute(this,t),Hi.applyMatrix4(e),this.setXYZ(t,Hi.x,Hi.y,Hi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Hi.fromBufferAttribute(this,t),Hi.applyNormalMatrix(e),this.setXYZ(t,Hi.x,Hi.y,Hi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Hi.fromBufferAttribute(this,t),Hi.transformDirection(e),this.setXYZ(t,Hi.x,Hi.y,Hi.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=e0(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=xa(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=e0(t,this.array)),t}setX(e,t){return this.normalized&&(t=xa(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=e0(t,this.array)),t}setY(e,t){return this.normalized&&(t=xa(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=e0(t,this.array)),t}setZ(e,t){return this.normalized&&(t=xa(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=e0(t,this.array)),t}setW(e,t){return this.normalized&&(t=xa(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=xa(t,this.array),i=xa(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=xa(t,this.array),i=xa(i,this.array),n=xa(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,a){return e*=this.itemSize,this.normalized&&(t=xa(t,this.array),i=xa(i,this.array),n=xa(n,this.array),a=xa(a,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Vae&&(e.usage=this.usage),e}};var p0=class extends Cs{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var pR=class extends Cs{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var Un=class extends Cs{constructor(e,t,i){super(new Float32Array(e),t,i)}},cDe=0,Es=new Ht,FB=new ia,qy=new ye,ko=new Fh,TM=new Fh,vn=new ye,Rs=class r extends Oh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:cDe++}),this.uuid=Wh(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(ese(e)?pR:p0)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let a=new dr().getNormalMatrix(e);i.applyNormalMatrix(a),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Es.makeRotationFromQuaternion(e),this.applyMatrix4(Es),this}rotateX(e){return Es.makeRotationX(e),this.applyMatrix4(Es),this}rotateY(e){return Es.makeRotationY(e),this.applyMatrix4(Es),this}rotateZ(e){return Es.makeRotationZ(e),this.applyMatrix4(Es),this}translate(e,t,i){return Es.makeTranslation(e,t,i),this.applyMatrix4(Es),this}scale(e,t,i){return Es.makeScale(e,t,i),this.applyMatrix4(Es),this}lookAt(e){return FB.lookAt(e),FB.updateMatrix(),this.applyMatrix4(FB.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(qy).negate(),this.translate(qy.x,qy.y,qy.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let a=e[i];t.push(a.x,a.y,a.z||0)}return this.setAttribute("position",new Un(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Fh);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ye(-1/0,-1/0,-1/0),new ye(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,n=t.length;i<n;i++){let a=t[i];ko.setFromBufferAttribute(a),this.morphTargetsRelative?(vn.addVectors(this.boundingBox.min,ko.min),this.boundingBox.expandByPoint(vn),vn.addVectors(this.boundingBox.max,ko.max),this.boundingBox.expandByPoint(vn)):(this.boundingBox.expandByPoint(ko.min),this.boundingBox.expandByPoint(ko.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new zh);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ye,1/0);return}if(e){let i=this.boundingSphere.center;if(ko.setFromBufferAttribute(e),t)for(let a=0,o=t.length;a<o;a++){let s=t[a];TM.setFromBufferAttribute(s),this.morphTargetsRelative?(vn.addVectors(ko.min,TM.min),ko.expandByPoint(vn),vn.addVectors(ko.max,TM.max),ko.expandByPoint(vn)):(ko.expandByPoint(TM.min),ko.expandByPoint(TM.max))}ko.getCenter(i);let n=0;for(let a=0,o=e.count;a<o;a++)vn.fromBufferAttribute(e,a),n=Math.max(n,i.distanceToSquared(vn));if(t)for(let a=0,o=t.length;a<o;a++){let s=t[a],l=this.morphTargetsRelative;for(let u=0,c=s.count;u<c;u++)vn.fromBufferAttribute(s,u),l&&(qy.fromBufferAttribute(e,u),vn.add(qy)),n=Math.max(n,i.distanceToSquared(vn))}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)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,n=t.normal,a=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Cs(new Float32Array(4*i.count),4));let o=this.getAttribute("tangent"),s=[],l=[];for(let T=0;T<i.count;T++)s[T]=new ye,l[T]=new ye;let u=new ye,c=new ye,f=new ye,h=new yr,p=new yr,d=new yr,g=new ye,m=new ye;function v(T,C,b){u.fromBufferAttribute(i,T),c.fromBufferAttribute(i,C),f.fromBufferAttribute(i,b),h.fromBufferAttribute(a,T),p.fromBufferAttribute(a,C),d.fromBufferAttribute(a,b),c.sub(u),f.sub(u),p.sub(h),d.sub(h);let E=1/(p.x*d.y-d.x*p.y);isFinite(E)&&(g.copy(c).multiplyScalar(d.y).addScaledVector(f,-p.y).multiplyScalar(E),m.copy(f).multiplyScalar(p.x).addScaledVector(c,-d.x).multiplyScalar(E),s[T].add(g),s[C].add(g),s[b].add(g),l[T].add(m),l[C].add(m),l[b].add(m))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let T=0,C=_.length;T<C;++T){let b=_[T],E=b.start,I=b.count;for(let R=E,A=E+I;R<A;R+=3)v(e.getX(R+0),e.getX(R+1),e.getX(R+2))}let y=new ye,x=new ye,M=new ye,S=new ye;function w(T){M.fromBufferAttribute(n,T),S.copy(M);let C=s[T];y.copy(C),y.sub(M.multiplyScalar(M.dot(C))).normalize(),x.crossVectors(S,C);let E=x.dot(l[T])<0?-1:1;o.setXYZW(T,y.x,y.y,y.z,E)}for(let T=0,C=_.length;T<C;++T){let b=_[T],E=b.start,I=b.count;for(let R=E,A=E+I;R<A;R+=3)w(e.getX(R+0)),w(e.getX(R+1)),w(e.getX(R+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Cs(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,p=i.count;h<p;h++)i.setXYZ(h,0,0,0);let n=new ye,a=new ye,o=new ye,s=new ye,l=new ye,u=new ye,c=new ye,f=new ye;if(e)for(let h=0,p=e.count;h<p;h+=3){let d=e.getX(h+0),g=e.getX(h+1),m=e.getX(h+2);n.fromBufferAttribute(t,d),a.fromBufferAttribute(t,g),o.fromBufferAttribute(t,m),c.subVectors(o,a),f.subVectors(n,a),c.cross(f),s.fromBufferAttribute(i,d),l.fromBufferAttribute(i,g),u.fromBufferAttribute(i,m),s.add(c),l.add(c),u.add(c),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(g,l.x,l.y,l.z),i.setXYZ(m,u.x,u.y,u.z)}else for(let h=0,p=t.count;h<p;h+=3)n.fromBufferAttribute(t,h+0),a.fromBufferAttribute(t,h+1),o.fromBufferAttribute(t,h+2),c.subVectors(o,a),f.subVectors(n,a),c.cross(f),i.setXYZ(h+0,c.x,c.y,c.z),i.setXYZ(h+1,c.x,c.y,c.z),i.setXYZ(h+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)vn.fromBufferAttribute(e,t),vn.normalize(),e.setXYZ(t,vn.x,vn.y,vn.z)}toNonIndexed(){function e(s,l){let u=s.array,c=s.itemSize,f=s.normalized,h=new u.constructor(l.length*c),p=0,d=0;for(let g=0,m=l.length;g<m;g++){s.isInterleavedBufferAttribute?p=l[g]*s.data.stride+s.offset:p=l[g]*c;for(let v=0;v<c;v++)h[d++]=u[p++]}return new Cs(h,c,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new r,i=this.index.array,n=this.attributes;for(let s in n){let l=n[s],u=e(l,i);t.setAttribute(s,u)}let a=this.morphAttributes;for(let s in a){let l=[],u=a[s];for(let c=0,f=u.length;c<f;c++){let h=u[c],p=e(h,i);l.push(p)}t.morphAttributes[s]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let s=0,l=o.length;s<l;s++){let u=o[s];t.addGroup(u.start,u.count,u.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let l in i){let u=i[l];e.data.attributes[l]=u.toJSON(e.data)}let n={},a=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let f=0,h=u.length;f<h;f++){let p=u[f];c.push(p.toJSON(e.data))}c.length>0&&(n[l]=c,a=!0)}a&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let s=this.boundingSphere;return s!==null&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let n=e.attributes;for(let u in n){let c=n[u];this.setAttribute(u,c.clone(t))}let a=e.morphAttributes;for(let u in a){let c=[],f=a[u];for(let h=0,p=f.length;h<p;h++)c.push(f[h].clone(t));this.morphAttributes[u]=c}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let u=0,c=o.length;u<c;u++){let f=o[u];this.addGroup(f.start,f.count,f.materialIndex)}let s=e.boundingBox;s!==null&&(this.boundingBox=s.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},toe=new Ht,nm=new IM,zC=new zh,roe=new ye,Zy=new ye,jy=new ye,Ky=new ye,zB=new ye,BC=new ye,kC=new yr,VC=new yr,GC=new yr,ioe=new ye,noe=new ye,aoe=new ye,HC=new ye,WC=new ye,so=class extends ia{constructor(e=new Rs,t=new hR){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=n.length;a<o;a++){let s=n[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=a}}}}getVertexPosition(e,t){let i=this.geometry,n=i.attributes.position,a=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(a&&s){BC.set(0,0,0);for(let l=0,u=a.length;l<u;l++){let c=s[l],f=a[l];c!==0&&(zB.fromBufferAttribute(f,e),o?BC.addScaledVector(zB,c):BC.addScaledVector(zB.sub(t),c))}t.add(BC)}return t}raycast(e,t){let i=this.geometry,n=this.material,a=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),zC.copy(i.boundingSphere),zC.applyMatrix4(a),nm.copy(e.ray).recast(e.near),!(zC.containsPoint(nm.origin)===!1&&(nm.intersectSphere(zC,roe)===null||nm.origin.distanceToSquared(roe)>(e.far-e.near)**2))&&(toe.copy(a).invert(),nm.copy(e.ray).applyMatrix4(toe),!(i.boundingBox!==null&&nm.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,nm)))}_computeIntersections(e,t,i){let n,a=this.geometry,o=this.material,s=a.index,l=a.attributes.position,u=a.attributes.uv,c=a.attributes.uv1,f=a.attributes.normal,h=a.groups,p=a.drawRange;if(s!==null)if(Array.isArray(o))for(let d=0,g=h.length;d<g;d++){let m=h[d],v=o[m.materialIndex],_=Math.max(m.start,p.start),y=Math.min(s.count,Math.min(m.start+m.count,p.start+p.count));for(let x=_,M=y;x<M;x+=3){let S=s.getX(x),w=s.getX(x+1),T=s.getX(x+2);n=XC(this,v,e,i,u,c,f,S,w,T),n&&(n.faceIndex=Math.floor(x/3),n.face.materialIndex=m.materialIndex,t.push(n))}}else{let d=Math.max(0,p.start),g=Math.min(s.count,p.start+p.count);for(let m=d,v=g;m<v;m+=3){let _=s.getX(m),y=s.getX(m+1),x=s.getX(m+2);n=XC(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}else if(l!==void 0)if(Array.isArray(o))for(let d=0,g=h.length;d<g;d++){let m=h[d],v=o[m.materialIndex],_=Math.max(m.start,p.start),y=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let x=_,M=y;x<M;x+=3){let S=x,w=x+1,T=x+2;n=XC(this,v,e,i,u,c,f,S,w,T),n&&(n.faceIndex=Math.floor(x/3),n.face.materialIndex=m.materialIndex,t.push(n))}}else{let d=Math.max(0,p.start),g=Math.min(l.count,p.start+p.count);for(let m=d,v=g;m<v;m+=3){let _=m,y=m+1,x=m+2;n=XC(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}}};function fDe(r,e,t,i,n,a,o,s){let l;if(e.side===lo?l=i.intersectTriangle(o,a,n,!0,s):l=i.intersectTriangle(n,a,o,e.side===Uh,s),l===null)return null;WC.copy(s),WC.applyMatrix4(r.matrixWorld);let u=t.ray.origin.distanceTo(WC);return u<t.near||u>t.far?null:{distance:u,point:WC.clone(),object:r}}function XC(r,e,t,i,n,a,o,s,l,u){r.getVertexPosition(s,Zy),r.getVertexPosition(l,jy),r.getVertexPosition(u,Ky);let c=fDe(r,e,t,i,Zy,jy,Ky,HC);if(c){n&&(kC.fromBufferAttribute(n,s),VC.fromBufferAttribute(n,l),GC.fromBufferAttribute(n,u),c.uv=t0.getInterpolation(HC,Zy,jy,Ky,kC,VC,GC,new yr)),a&&(kC.fromBufferAttribute(a,s),VC.fromBufferAttribute(a,l),GC.fromBufferAttribute(a,u),c.uv1=t0.getInterpolation(HC,Zy,jy,Ky,kC,VC,GC,new yr)),o&&(ioe.fromBufferAttribute(o,s),noe.fromBufferAttribute(o,l),aoe.fromBufferAttribute(o,u),c.normal=t0.getInterpolation(HC,Zy,jy,Ky,ioe,noe,aoe,new ye),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let f={a:s,b:l,c:u,normal:new ye,materialIndex:0};t0.getNormal(Zy,jy,Ky,f.normal),c.face=f}return c}var NM=class r extends Rs{constructor(e=1,t=1,i=1,n=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:a,depthSegments:o};let s=this;n=Math.floor(n),a=Math.floor(a),o=Math.floor(o);let l=[],u=[],c=[],f=[],h=0,p=0;d("z","y","x",-1,-1,i,t,e,o,a,0),d("z","y","x",1,-1,i,t,-e,o,a,1),d("x","z","y",1,1,e,i,t,n,o,2),d("x","z","y",1,-1,e,i,-t,n,o,3),d("x","y","z",1,-1,e,t,i,n,a,4),d("x","y","z",-1,-1,e,t,-i,n,a,5),this.setIndex(l),this.setAttribute("position",new Un(u,3)),this.setAttribute("normal",new Un(c,3)),this.setAttribute("uv",new Un(f,2));function d(g,m,v,_,y,x,M,S,w,T,C){let b=x/w,E=M/T,I=x/2,R=M/2,A=S/2,D=w+1,U=T+1,B=0,F=0,k=new ye;for(let G=0;G<U;G++){let Y=G*E-R;for(let J=0;J<D;J++){let Q=J*b-I;k[g]=Q*_,k[m]=Y*y,k[v]=A,u.push(k.x,k.y,k.z),k[g]=0,k[m]=0,k[v]=S>0?1:-1,c.push(k.x,k.y,k.z),f.push(J/w),f.push(1-G/T),B+=1}}for(let G=0;G<T;G++)for(let Y=0;Y<w;Y++){let J=h+Y+D*G,Q=h+Y+D*(G+1),V=h+(Y+1)+D*(G+1),K=h+(Y+1)+D*G;l.push(J,Q,K),l.push(Q,V,K),F+=6}s.addGroup(p,F,C),p+=F,h+=B}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function d0(r){let e={};for(let t in r){e[t]={};for(let i in r[t]){let n=r[t][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=n.clone():Array.isArray(n)?e[t][i]=n.slice():e[t][i]=n}}return e}function Sa(r){let e={};for(let t=0;t<r.length;t++){let i=d0(r[t]);for(let n in i)e[n]=i[n]}return e}function hDe(r){let e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function rse(r){return r.getRenderTarget()===null?r.outputColorSpace:Jr.workingColorSpace}var pDe={clone:d0,merge:Sa},dDe=`void main() {
  6547. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  6548. }`,mDe=`void main() {
  6549. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  6550. }`,pu=class extends Mc{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=dDe,this.fragmentShader=mDe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=d0(e.uniforms),this.uniformsGroups=hDe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let o=this.uniforms[n].value;o&&o.isTexture?t.uniforms[n]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[n]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[n]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[n]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[n]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[n]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[n]={type:"m4",value:o.toArray()}:t.uniforms[n]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let n in this.extensions)this.extensions[n]===!0&&(i[n]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},dR=class extends ia{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ht,this.projectionMatrix=new Ht,this.projectionMatrixInverse=new Ht,this.coordinateSystem=_c}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},Rh=new ye,ooe=new yr,soe=new yr,Nn=class extends dR{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=h0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(AM*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return h0*2*Math.atan(Math.tan(AM*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Rh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Rh.x,Rh.y).multiplyScalar(-e/Rh.z),Rh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Rh.x,Rh.y).multiplyScalar(-e/Rh.z)}getViewSize(e,t){return this.getViewBounds(e,ooe,soe),t.subVectors(soe,ooe)}setViewOffset(e,t,i,n,a,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(AM*.5*this.fov)/this.zoom,i=2*t,n=this.aspect*i,a=-.5*n,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,u=o.fullHeight;a+=o.offsetX*n/l,t-=o.offsetY*i/u,n*=o.width/l,i*=o.height/u}let s=this.filmOffset;s!==0&&(a+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},Jy=-90,$y=1,nk=class extends ia{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new Nn(Jy,$y,e,t);n.layers=this.layers,this.add(n);let a=new Nn(Jy,$y,e,t);a.layers=this.layers,this.add(a);let o=new Nn(Jy,$y,e,t);o.layers=this.layers,this.add(o);let s=new Nn(Jy,$y,e,t);s.layers=this.layers,this.add(s);let l=new Nn(Jy,$y,e,t);l.layers=this.layers,this.add(l);let u=new Nn(Jy,$y,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,a,o,s,l]=t;for(let u of t)this.remove(u);if(e===_c)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===oR)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[a,o,s,l,u,c]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;let g=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,n),e.render(t,a),e.setRenderTarget(i,1,n),e.render(t,o),e.setRenderTarget(i,2,n),e.render(t,s),e.setRenderTarget(i,3,n),e.render(t,l),e.setRenderTarget(i,4,n),e.render(t,u),i.texture.generateMipmaps=g,e.setRenderTarget(i,5,n),e.render(t,c),e.setRenderTarget(f,h,p),e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}},mR=class extends Vo{constructor(e,t,i,n,a,o,s,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:l0,super(e,t,i,n,a,o,s,l,u,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},ak=class extends Sc{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},n=[i,i,i,i,i,i];this.texture=new mR(n,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:ao}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
  6551. varying vec3 vWorldDirection;
  6552. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  6553. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  6554. }
  6555. void main() {
  6556. vWorldDirection = transformDirection( position, modelMatrix );
  6557. #include <begin_vertex>
  6558. #include <project_vertex>
  6559. }
  6560. `,fragmentShader:`
  6561. uniform sampler2D tEquirect;
  6562. varying vec3 vWorldDirection;
  6563. #include <common>
  6564. void main() {
  6565. vec3 direction = normalize( vWorldDirection );
  6566. vec2 sampleUV = equirectUv( direction );
  6567. gl_FragColor = texture2D( tEquirect, sampleUV );
  6568. }
  6569. `},n=new NM(5,5,5),a=new pu({name:"CubemapFromEquirect",uniforms:d0(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:lo,blending:Dh});a.uniforms.tEquirect.value=t;let o=new so(n,a),s=t.minFilter;return t.minFilter===fm&&(t.minFilter=ao),new nk(1,10,this).update(e,o),t.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,n){let a=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,n);e.setRenderTarget(a)}},BB=new ye,vDe=new ye,gDe=new dr,gc=class{constructor(e=new ye(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=BB.subVectors(i,t).cross(vDe.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(BB),n=this.normal.dot(i);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/n;return a<0||a>1?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||gDe.getNormalMatrix(e),n=this.coplanarPoint(BB).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},am=new zh,YC=new ye,UM=class{constructor(e=new gc,t=new gc,i=new gc,n=new gc,a=new gc,o=new gc){this.planes=[e,t,i,n,a,o]}set(e,t,i,n,a,o){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(a),s[5].copy(o),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=_c){let i=this.planes,n=e.elements,a=n[0],o=n[1],s=n[2],l=n[3],u=n[4],c=n[5],f=n[6],h=n[7],p=n[8],d=n[9],g=n[10],m=n[11],v=n[12],_=n[13],y=n[14],x=n[15];if(i[0].setComponents(l-a,h-u,m-p,x-v).normalize(),i[1].setComponents(l+a,h+u,m+p,x+v).normalize(),i[2].setComponents(l+o,h+c,m+d,x+_).normalize(),i[3].setComponents(l-o,h-c,m-d,x-_).normalize(),i[4].setComponents(l-s,h-f,m-g,x-y).normalize(),t===_c)i[5].setComponents(l+s,h+f,m+g,x+y).normalize();else if(t===oR)i[5].setComponents(s,f,g,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),am.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),am.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(am)}intersectsSprite(e){return am.center.set(0,0,0),am.radius=.7071067811865476,am.applyMatrix4(e.matrixWorld),this.intersectsSphere(am)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(YC.x=n.normal.x>0?e.max.x:e.min.x,YC.y=n.normal.y>0?e.max.y:e.min.y,YC.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(YC)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function ise(){let r=null,e=!1,t=null,i=null;function n(a,o){t(a,o),i=r.requestAnimationFrame(n)}return{start:function(){e!==!0&&t!==null&&(i=r.requestAnimationFrame(n),e=!0)},stop:function(){r.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(a){t=a},setContext:function(a){r=a}}}function yDe(r,e){let t=e.isWebGL2,i=new WeakMap;function n(u,c){let f=u.array,h=u.usage,p=f.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,f,h),u.onUploadCallback();let g;if(f instanceof Float32Array)g=r.FLOAT;else if(f instanceof Uint16Array)if(u.isFloat16BufferAttribute)if(t)g=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)g=r.SHORT;else if(f instanceof Uint32Array)g=r.UNSIGNED_INT;else if(f instanceof Int32Array)g=r.INT;else if(f instanceof Int8Array)g=r.BYTE;else if(f instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:d,type:g,bytesPerElement:f.BYTES_PER_ELEMENT,version:u.version,size:p}}function a(u,c,f){let h=c.array,p=c._updateRange,d=c.updateRanges;if(r.bindBuffer(f,u),p.count===-1&&d.length===0&&r.bufferSubData(f,0,h),d.length!==0){for(let g=0,m=d.length;g<m;g++){let v=d[g];t?r.bufferSubData(f,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count):r.bufferSubData(f,v.start*h.BYTES_PER_ELEMENT,h.subarray(v.start,v.start+v.count))}c.clearUpdateRanges()}p.count!==-1&&(t?r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count):r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h.subarray(p.offset,p.offset+p.count)),p.count=-1),c.onUploadCallback()}function o(u){return u.isInterleavedBufferAttribute&&(u=u.data),i.get(u)}function s(u){u.isInterleavedBufferAttribute&&(u=u.data);let c=i.get(u);c&&(r.deleteBuffer(c.buffer),i.delete(u))}function l(u,c){if(u.isGLBufferAttribute){let h=i.get(u);(!h||h.version<u.version)&&i.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}u.isInterleavedBufferAttribute&&(u=u.data);let f=i.get(u);if(f===void 0)i.set(u,n(u,c));else if(f.version<u.version){if(f.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");a(f.buffer,u,c),f.version=u.version}}return{get:o,remove:s,update:l}}var vR=class r extends Rs{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};let a=e/2,o=t/2,s=Math.floor(i),l=Math.floor(n),u=s+1,c=l+1,f=e/s,h=t/l,p=[],d=[],g=[],m=[];for(let v=0;v<c;v++){let _=v*h-o;for(let y=0;y<u;y++){let x=y*f-a;d.push(x,-_,0),g.push(0,0,1),m.push(y/s),m.push(1-v/l)}}for(let v=0;v<l;v++)for(let _=0;_<s;_++){let y=_+u*v,x=_+u*(v+1),M=_+1+u*(v+1),S=_+1+u*v;p.push(y,x,S),p.push(x,M,S)}this.setIndex(p),this.setAttribute("position",new Un(d,3)),this.setAttribute("normal",new Un(g,3)),this.setAttribute("uv",new Un(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r(e.width,e.height,e.widthSegments,e.heightSegments)}},_De=`#ifdef USE_ALPHAHASH
  6570. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  6571. #endif`,xDe=`#ifdef USE_ALPHAHASH
  6572. const float ALPHA_HASH_SCALE = 0.05;
  6573. float hash2D( vec2 value ) {
  6574. return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
  6575. }
  6576. float hash3D( vec3 value ) {
  6577. return hash2D( vec2( hash2D( value.xy ), value.z ) );
  6578. }
  6579. float getAlphaHashThreshold( vec3 position ) {
  6580. float maxDeriv = max(
  6581. length( dFdx( position.xyz ) ),
  6582. length( dFdy( position.xyz ) )
  6583. );
  6584. float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
  6585. vec2 pixScales = vec2(
  6586. exp2( floor( log2( pixScale ) ) ),
  6587. exp2( ceil( log2( pixScale ) ) )
  6588. );
  6589. vec2 alpha = vec2(
  6590. hash3D( floor( pixScales.x * position.xyz ) ),
  6591. hash3D( floor( pixScales.y * position.xyz ) )
  6592. );
  6593. float lerpFactor = fract( log2( pixScale ) );
  6594. float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
  6595. float a = min( lerpFactor, 1.0 - lerpFactor );
  6596. vec3 cases = vec3(
  6597. x * x / ( 2.0 * a * ( 1.0 - a ) ),
  6598. ( x - 0.5 * a ) / ( 1.0 - a ),
  6599. 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
  6600. );
  6601. float threshold = ( x < ( 1.0 - a ) )
  6602. ? ( ( x < a ) ? cases.x : cases.y )
  6603. : cases.z;
  6604. return clamp( threshold , 1.0e-6, 1.0 );
  6605. }
  6606. #endif`,SDe=`#ifdef USE_ALPHAMAP
  6607. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  6608. #endif`,MDe=`#ifdef USE_ALPHAMAP
  6609. uniform sampler2D alphaMap;
  6610. #endif`,bDe=`#ifdef USE_ALPHATEST
  6611. #ifdef ALPHA_TO_COVERAGE
  6612. diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
  6613. if ( diffuseColor.a == 0.0 ) discard;
  6614. #else
  6615. if ( diffuseColor.a < alphaTest ) discard;
  6616. #endif
  6617. #endif`,wDe=`#ifdef USE_ALPHATEST
  6618. uniform float alphaTest;
  6619. #endif`,TDe=`#ifdef USE_AOMAP
  6620. float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
  6621. reflectedLight.indirectDiffuse *= ambientOcclusion;
  6622. #if defined( USE_CLEARCOAT )
  6623. clearcoatSpecularIndirect *= ambientOcclusion;
  6624. #endif
  6625. #if defined( USE_SHEEN )
  6626. sheenSpecularIndirect *= ambientOcclusion;
  6627. #endif
  6628. #if defined( USE_ENVMAP ) && defined( STANDARD )
  6629. float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
  6630. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  6631. #endif
  6632. #endif`,EDe=`#ifdef USE_AOMAP
  6633. uniform sampler2D aoMap;
  6634. uniform float aoMapIntensity;
  6635. #endif`,ADe=`#ifdef USE_BATCHING
  6636. attribute float batchId;
  6637. uniform highp sampler2D batchingTexture;
  6638. mat4 getBatchingMatrix( const in float i ) {
  6639. int size = textureSize( batchingTexture, 0 ).x;
  6640. int j = int( i ) * 4;
  6641. int x = j % size;
  6642. int y = j / size;
  6643. vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
  6644. vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
  6645. vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
  6646. vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
  6647. return mat4( v1, v2, v3, v4 );
  6648. }
  6649. #endif`,CDe=`#ifdef USE_BATCHING
  6650. mat4 batchingMatrix = getBatchingMatrix( batchId );
  6651. #endif`,RDe=`vec3 transformed = vec3( position );
  6652. #ifdef USE_ALPHAHASH
  6653. vPosition = vec3( position );
  6654. #endif`,LDe=`vec3 objectNormal = vec3( normal );
  6655. #ifdef USE_TANGENT
  6656. vec3 objectTangent = vec3( tangent.xyz );
  6657. #endif`,PDe=`float G_BlinnPhong_Implicit( ) {
  6658. return 0.25;
  6659. }
  6660. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  6661. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  6662. }
  6663. vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
  6664. vec3 halfDir = normalize( lightDir + viewDir );
  6665. float dotNH = saturate( dot( normal, halfDir ) );
  6666. float dotVH = saturate( dot( viewDir, halfDir ) );
  6667. vec3 F = F_Schlick( specularColor, 1.0, dotVH );
  6668. float G = G_BlinnPhong_Implicit( );
  6669. float D = D_BlinnPhong( shininess, dotNH );
  6670. return F * ( G * D );
  6671. } // validated`,DDe=`#ifdef USE_IRIDESCENCE
  6672. const mat3 XYZ_TO_REC709 = mat3(
  6673. 3.2404542, -0.9692660, 0.0556434,
  6674. -1.5371385, 1.8760108, -0.2040259,
  6675. -0.4985314, 0.0415560, 1.0572252
  6676. );
  6677. vec3 Fresnel0ToIor( vec3 fresnel0 ) {
  6678. vec3 sqrtF0 = sqrt( fresnel0 );
  6679. return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
  6680. }
  6681. vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
  6682. return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
  6683. }
  6684. float IorToFresnel0( float transmittedIor, float incidentIor ) {
  6685. return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
  6686. }
  6687. vec3 evalSensitivity( float OPD, vec3 shift ) {
  6688. float phase = 2.0 * PI * OPD * 1.0e-9;
  6689. vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
  6690. vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
  6691. vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
  6692. vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
  6693. xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
  6694. xyz /= 1.0685e-7;
  6695. vec3 rgb = XYZ_TO_REC709 * xyz;
  6696. return rgb;
  6697. }
  6698. vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
  6699. vec3 I;
  6700. float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
  6701. float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
  6702. float cosTheta2Sq = 1.0 - sinTheta2Sq;
  6703. if ( cosTheta2Sq < 0.0 ) {
  6704. return vec3( 1.0 );
  6705. }
  6706. float cosTheta2 = sqrt( cosTheta2Sq );
  6707. float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
  6708. float R12 = F_Schlick( R0, 1.0, cosTheta1 );
  6709. float T121 = 1.0 - R12;
  6710. float phi12 = 0.0;
  6711. if ( iridescenceIOR < outsideIOR ) phi12 = PI;
  6712. float phi21 = PI - phi12;
  6713. vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
  6714. vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
  6715. vec3 phi23 = vec3( 0.0 );
  6716. if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
  6717. if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
  6718. if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
  6719. float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
  6720. vec3 phi = vec3( phi21 ) + phi23;
  6721. vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
  6722. vec3 r123 = sqrt( R123 );
  6723. vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
  6724. vec3 C0 = R12 + Rs;
  6725. I = C0;
  6726. vec3 Cm = Rs - T121;
  6727. for ( int m = 1; m <= 2; ++ m ) {
  6728. Cm *= r123;
  6729. vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
  6730. I += Cm * Sm;
  6731. }
  6732. return max( I, vec3( 0.0 ) );
  6733. }
  6734. #endif`,IDe=`#ifdef USE_BUMPMAP
  6735. uniform sampler2D bumpMap;
  6736. uniform float bumpScale;
  6737. vec2 dHdxy_fwd() {
  6738. vec2 dSTdx = dFdx( vBumpMapUv );
  6739. vec2 dSTdy = dFdy( vBumpMapUv );
  6740. float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
  6741. float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
  6742. float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
  6743. return vec2( dBx, dBy );
  6744. }
  6745. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
  6746. vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
  6747. vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
  6748. vec3 vN = surf_norm;
  6749. vec3 R1 = cross( vSigmaY, vN );
  6750. vec3 R2 = cross( vN, vSigmaX );
  6751. float fDet = dot( vSigmaX, R1 ) * faceDirection;
  6752. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  6753. return normalize( abs( fDet ) * surf_norm - vGrad );
  6754. }
  6755. #endif`,NDe=`#if NUM_CLIPPING_PLANES > 0
  6756. vec4 plane;
  6757. #ifdef ALPHA_TO_COVERAGE
  6758. float distanceToPlane, distanceGradient;
  6759. float clipOpacity = 1.0;
  6760. #pragma unroll_loop_start
  6761. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  6762. plane = clippingPlanes[ i ];
  6763. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  6764. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  6765. clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  6766. if ( clipOpacity == 0.0 ) discard;
  6767. }
  6768. #pragma unroll_loop_end
  6769. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  6770. float unionClipOpacity = 1.0;
  6771. #pragma unroll_loop_start
  6772. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  6773. plane = clippingPlanes[ i ];
  6774. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  6775. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  6776. unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  6777. }
  6778. #pragma unroll_loop_end
  6779. clipOpacity *= 1.0 - unionClipOpacity;
  6780. #endif
  6781. diffuseColor.a *= clipOpacity;
  6782. if ( diffuseColor.a == 0.0 ) discard;
  6783. #else
  6784. #pragma unroll_loop_start
  6785. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  6786. plane = clippingPlanes[ i ];
  6787. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  6788. }
  6789. #pragma unroll_loop_end
  6790. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  6791. bool clipped = true;
  6792. #pragma unroll_loop_start
  6793. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  6794. plane = clippingPlanes[ i ];
  6795. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  6796. }
  6797. #pragma unroll_loop_end
  6798. if ( clipped ) discard;
  6799. #endif
  6800. #endif
  6801. #endif`,UDe=`#if NUM_CLIPPING_PLANES > 0
  6802. varying vec3 vClipPosition;
  6803. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  6804. #endif`,ODe=`#if NUM_CLIPPING_PLANES > 0
  6805. varying vec3 vClipPosition;
  6806. #endif`,FDe=`#if NUM_CLIPPING_PLANES > 0
  6807. vClipPosition = - mvPosition.xyz;
  6808. #endif`,zDe=`#if defined( USE_COLOR_ALPHA )
  6809. diffuseColor *= vColor;
  6810. #elif defined( USE_COLOR )
  6811. diffuseColor.rgb *= vColor;
  6812. #endif`,BDe=`#if defined( USE_COLOR_ALPHA )
  6813. varying vec4 vColor;
  6814. #elif defined( USE_COLOR )
  6815. varying vec3 vColor;
  6816. #endif`,kDe=`#if defined( USE_COLOR_ALPHA )
  6817. varying vec4 vColor;
  6818. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  6819. varying vec3 vColor;
  6820. #endif`,VDe=`#if defined( USE_COLOR_ALPHA )
  6821. vColor = vec4( 1.0 );
  6822. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  6823. vColor = vec3( 1.0 );
  6824. #endif
  6825. #ifdef USE_COLOR
  6826. vColor *= color;
  6827. #endif
  6828. #ifdef USE_INSTANCING_COLOR
  6829. vColor.xyz *= instanceColor.xyz;
  6830. #endif`,GDe=`#define PI 3.141592653589793
  6831. #define PI2 6.283185307179586
  6832. #define PI_HALF 1.5707963267948966
  6833. #define RECIPROCAL_PI 0.3183098861837907
  6834. #define RECIPROCAL_PI2 0.15915494309189535
  6835. #define EPSILON 1e-6
  6836. #ifndef saturate
  6837. #define saturate( a ) clamp( a, 0.0, 1.0 )
  6838. #endif
  6839. #define whiteComplement( a ) ( 1.0 - saturate( a ) )
  6840. float pow2( const in float x ) { return x*x; }
  6841. vec3 pow2( const in vec3 x ) { return x*x; }
  6842. float pow3( const in float x ) { return x*x*x; }
  6843. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  6844. float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  6845. float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
  6846. highp float rand( const in vec2 uv ) {
  6847. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  6848. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  6849. return fract( sin( sn ) * c );
  6850. }
  6851. #ifdef HIGH_PRECISION
  6852. float precisionSafeLength( vec3 v ) { return length( v ); }
  6853. #else
  6854. float precisionSafeLength( vec3 v ) {
  6855. float maxComponent = max3( abs( v ) );
  6856. return length( v / maxComponent ) * maxComponent;
  6857. }
  6858. #endif
  6859. struct IncidentLight {
  6860. vec3 color;
  6861. vec3 direction;
  6862. bool visible;
  6863. };
  6864. struct ReflectedLight {
  6865. vec3 directDiffuse;
  6866. vec3 directSpecular;
  6867. vec3 indirectDiffuse;
  6868. vec3 indirectSpecular;
  6869. };
  6870. #ifdef USE_ALPHAHASH
  6871. varying vec3 vPosition;
  6872. #endif
  6873. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  6874. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  6875. }
  6876. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  6877. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  6878. }
  6879. mat3 transposeMat3( const in mat3 m ) {
  6880. mat3 tmp;
  6881. tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  6882. tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  6883. tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  6884. return tmp;
  6885. }
  6886. float luminance( const in vec3 rgb ) {
  6887. const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
  6888. return dot( weights, rgb );
  6889. }
  6890. bool isPerspectiveMatrix( mat4 m ) {
  6891. return m[ 2 ][ 3 ] == - 1.0;
  6892. }
  6893. vec2 equirectUv( in vec3 dir ) {
  6894. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  6895. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  6896. return vec2( u, v );
  6897. }
  6898. vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
  6899. return RECIPROCAL_PI * diffuseColor;
  6900. }
  6901. vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
  6902. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  6903. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  6904. }
  6905. float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
  6906. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  6907. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  6908. } // validated`,HDe=`#ifdef ENVMAP_TYPE_CUBE_UV
  6909. #define cubeUV_minMipLevel 4.0
  6910. #define cubeUV_minTileSize 16.0
  6911. float getFace( vec3 direction ) {
  6912. vec3 absDirection = abs( direction );
  6913. float face = - 1.0;
  6914. if ( absDirection.x > absDirection.z ) {
  6915. if ( absDirection.x > absDirection.y )
  6916. face = direction.x > 0.0 ? 0.0 : 3.0;
  6917. else
  6918. face = direction.y > 0.0 ? 1.0 : 4.0;
  6919. } else {
  6920. if ( absDirection.z > absDirection.y )
  6921. face = direction.z > 0.0 ? 2.0 : 5.0;
  6922. else
  6923. face = direction.y > 0.0 ? 1.0 : 4.0;
  6924. }
  6925. return face;
  6926. }
  6927. vec2 getUV( vec3 direction, float face ) {
  6928. vec2 uv;
  6929. if ( face == 0.0 ) {
  6930. uv = vec2( direction.z, direction.y ) / abs( direction.x );
  6931. } else if ( face == 1.0 ) {
  6932. uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
  6933. } else if ( face == 2.0 ) {
  6934. uv = vec2( - direction.x, direction.y ) / abs( direction.z );
  6935. } else if ( face == 3.0 ) {
  6936. uv = vec2( - direction.z, direction.y ) / abs( direction.x );
  6937. } else if ( face == 4.0 ) {
  6938. uv = vec2( - direction.x, direction.z ) / abs( direction.y );
  6939. } else {
  6940. uv = vec2( direction.x, direction.y ) / abs( direction.z );
  6941. }
  6942. return 0.5 * ( uv + 1.0 );
  6943. }
  6944. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  6945. float face = getFace( direction );
  6946. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  6947. mipInt = max( mipInt, cubeUV_minMipLevel );
  6948. float faceSize = exp2( mipInt );
  6949. highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
  6950. if ( face > 2.0 ) {
  6951. uv.y += faceSize;
  6952. face -= 3.0;
  6953. }
  6954. uv.x += face * faceSize;
  6955. uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  6956. uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  6957. uv.x *= CUBEUV_TEXEL_WIDTH;
  6958. uv.y *= CUBEUV_TEXEL_HEIGHT;
  6959. #ifdef texture2DGradEXT
  6960. return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
  6961. #else
  6962. return texture2D( envMap, uv ).rgb;
  6963. #endif
  6964. }
  6965. #define cubeUV_r0 1.0
  6966. #define cubeUV_m0 - 2.0
  6967. #define cubeUV_r1 0.8
  6968. #define cubeUV_m1 - 1.0
  6969. #define cubeUV_r4 0.4
  6970. #define cubeUV_m4 2.0
  6971. #define cubeUV_r5 0.305
  6972. #define cubeUV_m5 3.0
  6973. #define cubeUV_r6 0.21
  6974. #define cubeUV_m6 4.0
  6975. float roughnessToMip( float roughness ) {
  6976. float mip = 0.0;
  6977. if ( roughness >= cubeUV_r1 ) {
  6978. mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
  6979. } else if ( roughness >= cubeUV_r4 ) {
  6980. mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
  6981. } else if ( roughness >= cubeUV_r5 ) {
  6982. mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
  6983. } else if ( roughness >= cubeUV_r6 ) {
  6984. mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
  6985. } else {
  6986. mip = - 2.0 * log2( 1.16 * roughness ); }
  6987. return mip;
  6988. }
  6989. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  6990. float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
  6991. float mipF = fract( mip );
  6992. float mipInt = floor( mip );
  6993. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  6994. if ( mipF == 0.0 ) {
  6995. return vec4( color0, 1.0 );
  6996. } else {
  6997. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  6998. return vec4( mix( color0, color1, mipF ), 1.0 );
  6999. }
  7000. }
  7001. #endif`,WDe=`vec3 transformedNormal = objectNormal;
  7002. #ifdef USE_TANGENT
  7003. vec3 transformedTangent = objectTangent;
  7004. #endif
  7005. #ifdef USE_BATCHING
  7006. mat3 bm = mat3( batchingMatrix );
  7007. transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
  7008. transformedNormal = bm * transformedNormal;
  7009. #ifdef USE_TANGENT
  7010. transformedTangent = bm * transformedTangent;
  7011. #endif
  7012. #endif
  7013. #ifdef USE_INSTANCING
  7014. mat3 im = mat3( instanceMatrix );
  7015. transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
  7016. transformedNormal = im * transformedNormal;
  7017. #ifdef USE_TANGENT
  7018. transformedTangent = im * transformedTangent;
  7019. #endif
  7020. #endif
  7021. transformedNormal = normalMatrix * transformedNormal;
  7022. #ifdef FLIP_SIDED
  7023. transformedNormal = - transformedNormal;
  7024. #endif
  7025. #ifdef USE_TANGENT
  7026. transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
  7027. #ifdef FLIP_SIDED
  7028. transformedTangent = - transformedTangent;
  7029. #endif
  7030. #endif`,XDe=`#ifdef USE_DISPLACEMENTMAP
  7031. uniform sampler2D displacementMap;
  7032. uniform float displacementScale;
  7033. uniform float displacementBias;
  7034. #endif`,YDe=`#ifdef USE_DISPLACEMENTMAP
  7035. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  7036. #endif`,qDe=`#ifdef USE_EMISSIVEMAP
  7037. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  7038. totalEmissiveRadiance *= emissiveColor.rgb;
  7039. #endif`,ZDe=`#ifdef USE_EMISSIVEMAP
  7040. uniform sampler2D emissiveMap;
  7041. #endif`,jDe="gl_FragColor = linearToOutputTexel( gl_FragColor );",KDe=`
  7042. const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
  7043. vec3( 0.8224621, 0.177538, 0.0 ),
  7044. vec3( 0.0331941, 0.9668058, 0.0 ),
  7045. vec3( 0.0170827, 0.0723974, 0.9105199 )
  7046. );
  7047. const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
  7048. vec3( 1.2249401, - 0.2249404, 0.0 ),
  7049. vec3( - 0.0420569, 1.0420571, 0.0 ),
  7050. vec3( - 0.0196376, - 0.0786361, 1.0982735 )
  7051. );
  7052. vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
  7053. return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
  7054. }
  7055. vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
  7056. return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
  7057. }
  7058. vec4 LinearTransferOETF( in vec4 value ) {
  7059. return value;
  7060. }
  7061. vec4 sRGBTransferOETF( in vec4 value ) {
  7062. return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
  7063. }
  7064. vec4 LinearToLinear( in vec4 value ) {
  7065. return value;
  7066. }
  7067. vec4 LinearTosRGB( in vec4 value ) {
  7068. return sRGBTransferOETF( value );
  7069. }`,JDe=`#ifdef USE_ENVMAP
  7070. #ifdef ENV_WORLDPOS
  7071. vec3 cameraToFrag;
  7072. if ( isOrthographic ) {
  7073. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  7074. } else {
  7075. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  7076. }
  7077. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  7078. #ifdef ENVMAP_MODE_REFLECTION
  7079. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  7080. #else
  7081. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  7082. #endif
  7083. #else
  7084. vec3 reflectVec = vReflect;
  7085. #endif
  7086. #ifdef ENVMAP_TYPE_CUBE
  7087. vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  7088. #else
  7089. vec4 envColor = vec4( 0.0 );
  7090. #endif
  7091. #ifdef ENVMAP_BLENDING_MULTIPLY
  7092. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  7093. #elif defined( ENVMAP_BLENDING_MIX )
  7094. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  7095. #elif defined( ENVMAP_BLENDING_ADD )
  7096. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  7097. #endif
  7098. #endif`,$De=`#ifdef USE_ENVMAP
  7099. uniform float envMapIntensity;
  7100. uniform float flipEnvMap;
  7101. uniform mat3 envMapRotation;
  7102. #ifdef ENVMAP_TYPE_CUBE
  7103. uniform samplerCube envMap;
  7104. #else
  7105. uniform sampler2D envMap;
  7106. #endif
  7107. #endif`,QDe=`#ifdef USE_ENVMAP
  7108. uniform float reflectivity;
  7109. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  7110. #define ENV_WORLDPOS
  7111. #endif
  7112. #ifdef ENV_WORLDPOS
  7113. varying vec3 vWorldPosition;
  7114. uniform float refractionRatio;
  7115. #else
  7116. varying vec3 vReflect;
  7117. #endif
  7118. #endif`,e2e=`#ifdef USE_ENVMAP
  7119. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  7120. #define ENV_WORLDPOS
  7121. #endif
  7122. #ifdef ENV_WORLDPOS
  7123. varying vec3 vWorldPosition;
  7124. #else
  7125. varying vec3 vReflect;
  7126. uniform float refractionRatio;
  7127. #endif
  7128. #endif`,t2e=`#ifdef USE_ENVMAP
  7129. #ifdef ENV_WORLDPOS
  7130. vWorldPosition = worldPosition.xyz;
  7131. #else
  7132. vec3 cameraToVertex;
  7133. if ( isOrthographic ) {
  7134. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  7135. } else {
  7136. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  7137. }
  7138. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  7139. #ifdef ENVMAP_MODE_REFLECTION
  7140. vReflect = reflect( cameraToVertex, worldNormal );
  7141. #else
  7142. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  7143. #endif
  7144. #endif
  7145. #endif`,r2e=`#ifdef USE_FOG
  7146. vFogDepth = - mvPosition.z;
  7147. #endif`,i2e=`#ifdef USE_FOG
  7148. varying float vFogDepth;
  7149. #endif`,n2e=`#ifdef USE_FOG
  7150. #ifdef FOG_EXP2
  7151. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
  7152. #else
  7153. float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
  7154. #endif
  7155. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  7156. #endif`,a2e=`#ifdef USE_FOG
  7157. uniform vec3 fogColor;
  7158. varying float vFogDepth;
  7159. #ifdef FOG_EXP2
  7160. uniform float fogDensity;
  7161. #else
  7162. uniform float fogNear;
  7163. uniform float fogFar;
  7164. #endif
  7165. #endif`,o2e=`#ifdef USE_GRADIENTMAP
  7166. uniform sampler2D gradientMap;
  7167. #endif
  7168. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  7169. float dotNL = dot( normal, lightDirection );
  7170. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  7171. #ifdef USE_GRADIENTMAP
  7172. return vec3( texture2D( gradientMap, coord ).r );
  7173. #else
  7174. vec2 fw = fwidth( coord ) * 0.5;
  7175. return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
  7176. #endif
  7177. }`,s2e=`#ifdef USE_LIGHTMAP
  7178. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  7179. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  7180. reflectedLight.indirectDiffuse += lightMapIrradiance;
  7181. #endif`,l2e=`#ifdef USE_LIGHTMAP
  7182. uniform sampler2D lightMap;
  7183. uniform float lightMapIntensity;
  7184. #endif`,u2e=`LambertMaterial material;
  7185. material.diffuseColor = diffuseColor.rgb;
  7186. material.specularStrength = specularStrength;`,c2e=`varying vec3 vViewPosition;
  7187. struct LambertMaterial {
  7188. vec3 diffuseColor;
  7189. float specularStrength;
  7190. };
  7191. void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  7192. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  7193. vec3 irradiance = dotNL * directLight.color;
  7194. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7195. }
  7196. void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  7197. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7198. }
  7199. #define RE_Direct RE_Direct_Lambert
  7200. #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,f2e=`uniform bool receiveShadow;
  7201. uniform vec3 ambientLightColor;
  7202. #if defined( USE_LIGHT_PROBES )
  7203. uniform vec3 lightProbe[ 9 ];
  7204. #endif
  7205. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  7206. float x = normal.x, y = normal.y, z = normal.z;
  7207. vec3 result = shCoefficients[ 0 ] * 0.886227;
  7208. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  7209. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  7210. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  7211. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  7212. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  7213. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  7214. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  7215. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  7216. return result;
  7217. }
  7218. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
  7219. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  7220. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  7221. return irradiance;
  7222. }
  7223. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  7224. vec3 irradiance = ambientLightColor;
  7225. return irradiance;
  7226. }
  7227. float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  7228. #if defined ( LEGACY_LIGHTS )
  7229. if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
  7230. return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
  7231. }
  7232. return 1.0;
  7233. #else
  7234. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  7235. if ( cutoffDistance > 0.0 ) {
  7236. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  7237. }
  7238. return distanceFalloff;
  7239. #endif
  7240. }
  7241. float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
  7242. return smoothstep( coneCosine, penumbraCosine, angleCosine );
  7243. }
  7244. #if NUM_DIR_LIGHTS > 0
  7245. struct DirectionalLight {
  7246. vec3 direction;
  7247. vec3 color;
  7248. };
  7249. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  7250. void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
  7251. light.color = directionalLight.color;
  7252. light.direction = directionalLight.direction;
  7253. light.visible = true;
  7254. }
  7255. #endif
  7256. #if NUM_POINT_LIGHTS > 0
  7257. struct PointLight {
  7258. vec3 position;
  7259. vec3 color;
  7260. float distance;
  7261. float decay;
  7262. };
  7263. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  7264. void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
  7265. vec3 lVector = pointLight.position - geometryPosition;
  7266. light.direction = normalize( lVector );
  7267. float lightDistance = length( lVector );
  7268. light.color = pointLight.color;
  7269. light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
  7270. light.visible = ( light.color != vec3( 0.0 ) );
  7271. }
  7272. #endif
  7273. #if NUM_SPOT_LIGHTS > 0
  7274. struct SpotLight {
  7275. vec3 position;
  7276. vec3 direction;
  7277. vec3 color;
  7278. float distance;
  7279. float decay;
  7280. float coneCos;
  7281. float penumbraCos;
  7282. };
  7283. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  7284. void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
  7285. vec3 lVector = spotLight.position - geometryPosition;
  7286. light.direction = normalize( lVector );
  7287. float angleCos = dot( light.direction, spotLight.direction );
  7288. float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  7289. if ( spotAttenuation > 0.0 ) {
  7290. float lightDistance = length( lVector );
  7291. light.color = spotLight.color * spotAttenuation;
  7292. light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
  7293. light.visible = ( light.color != vec3( 0.0 ) );
  7294. } else {
  7295. light.color = vec3( 0.0 );
  7296. light.visible = false;
  7297. }
  7298. }
  7299. #endif
  7300. #if NUM_RECT_AREA_LIGHTS > 0
  7301. struct RectAreaLight {
  7302. vec3 color;
  7303. vec3 position;
  7304. vec3 halfWidth;
  7305. vec3 halfHeight;
  7306. };
  7307. uniform sampler2D ltc_1; uniform sampler2D ltc_2;
  7308. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  7309. #endif
  7310. #if NUM_HEMI_LIGHTS > 0
  7311. struct HemisphereLight {
  7312. vec3 direction;
  7313. vec3 skyColor;
  7314. vec3 groundColor;
  7315. };
  7316. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  7317. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
  7318. float dotNL = dot( normal, hemiLight.direction );
  7319. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  7320. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  7321. return irradiance;
  7322. }
  7323. #endif`,h2e=`#ifdef USE_ENVMAP
  7324. vec3 getIBLIrradiance( const in vec3 normal ) {
  7325. #ifdef ENVMAP_TYPE_CUBE_UV
  7326. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  7327. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
  7328. return PI * envMapColor.rgb * envMapIntensity;
  7329. #else
  7330. return vec3( 0.0 );
  7331. #endif
  7332. }
  7333. vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
  7334. #ifdef ENVMAP_TYPE_CUBE_UV
  7335. vec3 reflectVec = reflect( - viewDir, normal );
  7336. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
  7337. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  7338. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
  7339. return envMapColor.rgb * envMapIntensity;
  7340. #else
  7341. return vec3( 0.0 );
  7342. #endif
  7343. }
  7344. #ifdef USE_ANISOTROPY
  7345. vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
  7346. #ifdef ENVMAP_TYPE_CUBE_UV
  7347. vec3 bentNormal = cross( bitangent, viewDir );
  7348. bentNormal = normalize( cross( bentNormal, bitangent ) );
  7349. bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
  7350. return getIBLRadiance( viewDir, bentNormal, roughness );
  7351. #else
  7352. return vec3( 0.0 );
  7353. #endif
  7354. }
  7355. #endif
  7356. #endif`,p2e=`ToonMaterial material;
  7357. material.diffuseColor = diffuseColor.rgb;`,d2e=`varying vec3 vViewPosition;
  7358. struct ToonMaterial {
  7359. vec3 diffuseColor;
  7360. };
  7361. void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  7362. vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
  7363. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7364. }
  7365. void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  7366. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7367. }
  7368. #define RE_Direct RE_Direct_Toon
  7369. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,m2e=`BlinnPhongMaterial material;
  7370. material.diffuseColor = diffuseColor.rgb;
  7371. material.specularColor = specular;
  7372. material.specularShininess = shininess;
  7373. material.specularStrength = specularStrength;`,v2e=`varying vec3 vViewPosition;
  7374. struct BlinnPhongMaterial {
  7375. vec3 diffuseColor;
  7376. vec3 specularColor;
  7377. float specularShininess;
  7378. float specularStrength;
  7379. };
  7380. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  7381. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  7382. vec3 irradiance = dotNL * directLight.color;
  7383. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7384. reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
  7385. }
  7386. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  7387. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7388. }
  7389. #define RE_Direct RE_Direct_BlinnPhong
  7390. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,g2e=`PhysicalMaterial material;
  7391. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  7392. vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
  7393. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  7394. material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
  7395. material.roughness = min( material.roughness, 1.0 );
  7396. #ifdef IOR
  7397. material.ior = ior;
  7398. #ifdef USE_SPECULAR
  7399. float specularIntensityFactor = specularIntensity;
  7400. vec3 specularColorFactor = specularColor;
  7401. #ifdef USE_SPECULAR_COLORMAP
  7402. specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
  7403. #endif
  7404. #ifdef USE_SPECULAR_INTENSITYMAP
  7405. specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
  7406. #endif
  7407. material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
  7408. #else
  7409. float specularIntensityFactor = 1.0;
  7410. vec3 specularColorFactor = vec3( 1.0 );
  7411. material.specularF90 = 1.0;
  7412. #endif
  7413. material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
  7414. #else
  7415. material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
  7416. material.specularF90 = 1.0;
  7417. #endif
  7418. #ifdef USE_CLEARCOAT
  7419. material.clearcoat = clearcoat;
  7420. material.clearcoatRoughness = clearcoatRoughness;
  7421. material.clearcoatF0 = vec3( 0.04 );
  7422. material.clearcoatF90 = 1.0;
  7423. #ifdef USE_CLEARCOATMAP
  7424. material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
  7425. #endif
  7426. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  7427. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
  7428. #endif
  7429. material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  7430. material.clearcoatRoughness += geometryRoughness;
  7431. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  7432. #endif
  7433. #ifdef USE_IRIDESCENCE
  7434. material.iridescence = iridescence;
  7435. material.iridescenceIOR = iridescenceIOR;
  7436. #ifdef USE_IRIDESCENCEMAP
  7437. material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
  7438. #endif
  7439. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  7440. material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
  7441. #else
  7442. material.iridescenceThickness = iridescenceThicknessMaximum;
  7443. #endif
  7444. #endif
  7445. #ifdef USE_SHEEN
  7446. material.sheenColor = sheenColor;
  7447. #ifdef USE_SHEEN_COLORMAP
  7448. material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
  7449. #endif
  7450. material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
  7451. #ifdef USE_SHEEN_ROUGHNESSMAP
  7452. material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
  7453. #endif
  7454. #endif
  7455. #ifdef USE_ANISOTROPY
  7456. #ifdef USE_ANISOTROPYMAP
  7457. mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
  7458. vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
  7459. vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
  7460. #else
  7461. vec2 anisotropyV = anisotropyVector;
  7462. #endif
  7463. material.anisotropy = length( anisotropyV );
  7464. if( material.anisotropy == 0.0 ) {
  7465. anisotropyV = vec2( 1.0, 0.0 );
  7466. } else {
  7467. anisotropyV /= material.anisotropy;
  7468. material.anisotropy = saturate( material.anisotropy );
  7469. }
  7470. material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
  7471. material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
  7472. material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
  7473. #endif`,y2e=`struct PhysicalMaterial {
  7474. vec3 diffuseColor;
  7475. float roughness;
  7476. vec3 specularColor;
  7477. float specularF90;
  7478. #ifdef USE_CLEARCOAT
  7479. float clearcoat;
  7480. float clearcoatRoughness;
  7481. vec3 clearcoatF0;
  7482. float clearcoatF90;
  7483. #endif
  7484. #ifdef USE_IRIDESCENCE
  7485. float iridescence;
  7486. float iridescenceIOR;
  7487. float iridescenceThickness;
  7488. vec3 iridescenceFresnel;
  7489. vec3 iridescenceF0;
  7490. #endif
  7491. #ifdef USE_SHEEN
  7492. vec3 sheenColor;
  7493. float sheenRoughness;
  7494. #endif
  7495. #ifdef IOR
  7496. float ior;
  7497. #endif
  7498. #ifdef USE_TRANSMISSION
  7499. float transmission;
  7500. float transmissionAlpha;
  7501. float thickness;
  7502. float attenuationDistance;
  7503. vec3 attenuationColor;
  7504. #endif
  7505. #ifdef USE_ANISOTROPY
  7506. float anisotropy;
  7507. float alphaT;
  7508. vec3 anisotropyT;
  7509. vec3 anisotropyB;
  7510. #endif
  7511. };
  7512. vec3 clearcoatSpecularDirect = vec3( 0.0 );
  7513. vec3 clearcoatSpecularIndirect = vec3( 0.0 );
  7514. vec3 sheenSpecularDirect = vec3( 0.0 );
  7515. vec3 sheenSpecularIndirect = vec3(0.0 );
  7516. vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
  7517. float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
  7518. float x2 = x * x;
  7519. float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
  7520. return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
  7521. }
  7522. float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  7523. float a2 = pow2( alpha );
  7524. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  7525. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  7526. return 0.5 / max( gv + gl, EPSILON );
  7527. }
  7528. float D_GGX( const in float alpha, const in float dotNH ) {
  7529. float a2 = pow2( alpha );
  7530. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  7531. return RECIPROCAL_PI * a2 / pow2( denom );
  7532. }
  7533. #ifdef USE_ANISOTROPY
  7534. float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
  7535. float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
  7536. float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
  7537. float v = 0.5 / ( gv + gl );
  7538. return saturate(v);
  7539. }
  7540. float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
  7541. float a2 = alphaT * alphaB;
  7542. highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
  7543. highp float v2 = dot( v, v );
  7544. float w2 = a2 / v2;
  7545. return RECIPROCAL_PI * a2 * pow2 ( w2 );
  7546. }
  7547. #endif
  7548. #ifdef USE_CLEARCOAT
  7549. vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
  7550. vec3 f0 = material.clearcoatF0;
  7551. float f90 = material.clearcoatF90;
  7552. float roughness = material.clearcoatRoughness;
  7553. float alpha = pow2( roughness );
  7554. vec3 halfDir = normalize( lightDir + viewDir );
  7555. float dotNL = saturate( dot( normal, lightDir ) );
  7556. float dotNV = saturate( dot( normal, viewDir ) );
  7557. float dotNH = saturate( dot( normal, halfDir ) );
  7558. float dotVH = saturate( dot( viewDir, halfDir ) );
  7559. vec3 F = F_Schlick( f0, f90, dotVH );
  7560. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  7561. float D = D_GGX( alpha, dotNH );
  7562. return F * ( V * D );
  7563. }
  7564. #endif
  7565. vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
  7566. vec3 f0 = material.specularColor;
  7567. float f90 = material.specularF90;
  7568. float roughness = material.roughness;
  7569. float alpha = pow2( roughness );
  7570. vec3 halfDir = normalize( lightDir + viewDir );
  7571. float dotNL = saturate( dot( normal, lightDir ) );
  7572. float dotNV = saturate( dot( normal, viewDir ) );
  7573. float dotNH = saturate( dot( normal, halfDir ) );
  7574. float dotVH = saturate( dot( viewDir, halfDir ) );
  7575. vec3 F = F_Schlick( f0, f90, dotVH );
  7576. #ifdef USE_IRIDESCENCE
  7577. F = mix( F, material.iridescenceFresnel, material.iridescence );
  7578. #endif
  7579. #ifdef USE_ANISOTROPY
  7580. float dotTL = dot( material.anisotropyT, lightDir );
  7581. float dotTV = dot( material.anisotropyT, viewDir );
  7582. float dotTH = dot( material.anisotropyT, halfDir );
  7583. float dotBL = dot( material.anisotropyB, lightDir );
  7584. float dotBV = dot( material.anisotropyB, viewDir );
  7585. float dotBH = dot( material.anisotropyB, halfDir );
  7586. float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
  7587. float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
  7588. #else
  7589. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  7590. float D = D_GGX( alpha, dotNH );
  7591. #endif
  7592. return F * ( V * D );
  7593. }
  7594. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  7595. const float LUT_SIZE = 64.0;
  7596. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  7597. const float LUT_BIAS = 0.5 / LUT_SIZE;
  7598. float dotNV = saturate( dot( N, V ) );
  7599. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  7600. uv = uv * LUT_SCALE + LUT_BIAS;
  7601. return uv;
  7602. }
  7603. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  7604. float l = length( f );
  7605. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  7606. }
  7607. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  7608. float x = dot( v1, v2 );
  7609. float y = abs( x );
  7610. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  7611. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  7612. float v = a / b;
  7613. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  7614. return cross( v1, v2 ) * theta_sintheta;
  7615. }
  7616. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  7617. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  7618. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  7619. vec3 lightNormal = cross( v1, v2 );
  7620. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  7621. vec3 T1, T2;
  7622. T1 = normalize( V - N * dot( V, N ) );
  7623. T2 = - cross( N, T1 );
  7624. mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
  7625. vec3 coords[ 4 ];
  7626. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  7627. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  7628. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  7629. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  7630. coords[ 0 ] = normalize( coords[ 0 ] );
  7631. coords[ 1 ] = normalize( coords[ 1 ] );
  7632. coords[ 2 ] = normalize( coords[ 2 ] );
  7633. coords[ 3 ] = normalize( coords[ 3 ] );
  7634. vec3 vectorFormFactor = vec3( 0.0 );
  7635. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  7636. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  7637. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  7638. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  7639. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  7640. return vec3( result );
  7641. }
  7642. #if defined( USE_SHEEN )
  7643. float D_Charlie( float roughness, float dotNH ) {
  7644. float alpha = pow2( roughness );
  7645. float invAlpha = 1.0 / alpha;
  7646. float cos2h = dotNH * dotNH;
  7647. float sin2h = max( 1.0 - cos2h, 0.0078125 );
  7648. return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
  7649. }
  7650. float V_Neubelt( float dotNV, float dotNL ) {
  7651. return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
  7652. }
  7653. vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
  7654. vec3 halfDir = normalize( lightDir + viewDir );
  7655. float dotNL = saturate( dot( normal, lightDir ) );
  7656. float dotNV = saturate( dot( normal, viewDir ) );
  7657. float dotNH = saturate( dot( normal, halfDir ) );
  7658. float D = D_Charlie( sheenRoughness, dotNH );
  7659. float V = V_Neubelt( dotNV, dotNL );
  7660. return sheenColor * ( D * V );
  7661. }
  7662. #endif
  7663. float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  7664. float dotNV = saturate( dot( normal, viewDir ) );
  7665. float r2 = roughness * roughness;
  7666. float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
  7667. float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
  7668. float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
  7669. return saturate( DG * RECIPROCAL_PI );
  7670. }
  7671. vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  7672. float dotNV = saturate( dot( normal, viewDir ) );
  7673. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  7674. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  7675. vec4 r = roughness * c0 + c1;
  7676. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  7677. vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
  7678. return fab;
  7679. }
  7680. vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
  7681. vec2 fab = DFGApprox( normal, viewDir, roughness );
  7682. return specularColor * fab.x + specularF90 * fab.y;
  7683. }
  7684. #ifdef USE_IRIDESCENCE
  7685. void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  7686. #else
  7687. void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
  7688. #endif
  7689. vec2 fab = DFGApprox( normal, viewDir, roughness );
  7690. #ifdef USE_IRIDESCENCE
  7691. vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
  7692. #else
  7693. vec3 Fr = specularColor;
  7694. #endif
  7695. vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
  7696. float Ess = fab.x + fab.y;
  7697. float Ems = 1.0 - Ess;
  7698. vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  7699. singleScatter += FssEss;
  7700. multiScatter += Fms * Ems;
  7701. }
  7702. #if NUM_RECT_AREA_LIGHTS > 0
  7703. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  7704. vec3 normal = geometryNormal;
  7705. vec3 viewDir = geometryViewDir;
  7706. vec3 position = geometryPosition;
  7707. vec3 lightPos = rectAreaLight.position;
  7708. vec3 halfWidth = rectAreaLight.halfWidth;
  7709. vec3 halfHeight = rectAreaLight.halfHeight;
  7710. vec3 lightColor = rectAreaLight.color;
  7711. float roughness = material.roughness;
  7712. vec3 rectCoords[ 4 ];
  7713. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  7714. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  7715. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  7716. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  7717. vec4 t1 = texture2D( ltc_1, uv );
  7718. vec4 t2 = texture2D( ltc_2, uv );
  7719. mat3 mInv = mat3(
  7720. vec3( t1.x, 0, t1.y ),
  7721. vec3( 0, 1, 0 ),
  7722. vec3( t1.z, 0, t1.w )
  7723. );
  7724. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  7725. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  7726. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  7727. }
  7728. #endif
  7729. void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  7730. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  7731. vec3 irradiance = dotNL * directLight.color;
  7732. #ifdef USE_CLEARCOAT
  7733. float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
  7734. vec3 ccIrradiance = dotNLcc * directLight.color;
  7735. clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
  7736. #endif
  7737. #ifdef USE_SHEEN
  7738. sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
  7739. #endif
  7740. reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
  7741. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7742. }
  7743. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  7744. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  7745. }
  7746. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
  7747. #ifdef USE_CLEARCOAT
  7748. clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  7749. #endif
  7750. #ifdef USE_SHEEN
  7751. sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
  7752. #endif
  7753. vec3 singleScattering = vec3( 0.0 );
  7754. vec3 multiScattering = vec3( 0.0 );
  7755. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  7756. #ifdef USE_IRIDESCENCE
  7757. computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
  7758. #else
  7759. computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
  7760. #endif
  7761. vec3 totalScattering = singleScattering + multiScattering;
  7762. vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
  7763. reflectedLight.indirectSpecular += radiance * singleScattering;
  7764. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  7765. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  7766. }
  7767. #define RE_Direct RE_Direct_Physical
  7768. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  7769. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  7770. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  7771. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  7772. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  7773. }`,_2e=`
  7774. vec3 geometryPosition = - vViewPosition;
  7775. vec3 geometryNormal = normal;
  7776. vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  7777. vec3 geometryClearcoatNormal = vec3( 0.0 );
  7778. #ifdef USE_CLEARCOAT
  7779. geometryClearcoatNormal = clearcoatNormal;
  7780. #endif
  7781. #ifdef USE_IRIDESCENCE
  7782. float dotNVi = saturate( dot( normal, geometryViewDir ) );
  7783. if ( material.iridescenceThickness == 0.0 ) {
  7784. material.iridescence = 0.0;
  7785. } else {
  7786. material.iridescence = saturate( material.iridescence );
  7787. }
  7788. if ( material.iridescence > 0.0 ) {
  7789. material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
  7790. material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
  7791. }
  7792. #endif
  7793. IncidentLight directLight;
  7794. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  7795. PointLight pointLight;
  7796. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  7797. PointLightShadow pointLightShadow;
  7798. #endif
  7799. #pragma unroll_loop_start
  7800. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  7801. pointLight = pointLights[ i ];
  7802. getPointLightInfo( pointLight, geometryPosition, directLight );
  7803. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  7804. pointLightShadow = pointLightShadows[ i ];
  7805. directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  7806. #endif
  7807. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7808. }
  7809. #pragma unroll_loop_end
  7810. #endif
  7811. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  7812. SpotLight spotLight;
  7813. vec4 spotColor;
  7814. vec3 spotLightCoord;
  7815. bool inSpotLightMap;
  7816. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  7817. SpotLightShadow spotLightShadow;
  7818. #endif
  7819. #pragma unroll_loop_start
  7820. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  7821. spotLight = spotLights[ i ];
  7822. getSpotLightInfo( spotLight, geometryPosition, directLight );
  7823. #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  7824. #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
  7825. #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  7826. #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
  7827. #else
  7828. #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  7829. #endif
  7830. #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
  7831. spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
  7832. inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
  7833. spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
  7834. directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
  7835. #endif
  7836. #undef SPOT_LIGHT_MAP_INDEX
  7837. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  7838. spotLightShadow = spotLightShadows[ i ];
  7839. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  7840. #endif
  7841. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7842. }
  7843. #pragma unroll_loop_end
  7844. #endif
  7845. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  7846. DirectionalLight directionalLight;
  7847. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  7848. DirectionalLightShadow directionalLightShadow;
  7849. #endif
  7850. #pragma unroll_loop_start
  7851. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  7852. directionalLight = directionalLights[ i ];
  7853. getDirectionalLightInfo( directionalLight, directLight );
  7854. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  7855. directionalLightShadow = directionalLightShadows[ i ];
  7856. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  7857. #endif
  7858. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7859. }
  7860. #pragma unroll_loop_end
  7861. #endif
  7862. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  7863. RectAreaLight rectAreaLight;
  7864. #pragma unroll_loop_start
  7865. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  7866. rectAreaLight = rectAreaLights[ i ];
  7867. RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7868. }
  7869. #pragma unroll_loop_end
  7870. #endif
  7871. #if defined( RE_IndirectDiffuse )
  7872. vec3 iblIrradiance = vec3( 0.0 );
  7873. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  7874. #if defined( USE_LIGHT_PROBES )
  7875. irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
  7876. #endif
  7877. #if ( NUM_HEMI_LIGHTS > 0 )
  7878. #pragma unroll_loop_start
  7879. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  7880. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
  7881. }
  7882. #pragma unroll_loop_end
  7883. #endif
  7884. #endif
  7885. #if defined( RE_IndirectSpecular )
  7886. vec3 radiance = vec3( 0.0 );
  7887. vec3 clearcoatRadiance = vec3( 0.0 );
  7888. #endif`,x2e=`#if defined( RE_IndirectDiffuse )
  7889. #ifdef USE_LIGHTMAP
  7890. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  7891. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  7892. irradiance += lightMapIrradiance;
  7893. #endif
  7894. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  7895. iblIrradiance += getIBLIrradiance( geometryNormal );
  7896. #endif
  7897. #endif
  7898. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  7899. #ifdef USE_ANISOTROPY
  7900. radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
  7901. #else
  7902. radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
  7903. #endif
  7904. #ifdef USE_CLEARCOAT
  7905. clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
  7906. #endif
  7907. #endif`,S2e=`#if defined( RE_IndirectDiffuse )
  7908. RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7909. #endif
  7910. #if defined( RE_IndirectSpecular )
  7911. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  7912. #endif`,M2e=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  7913. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  7914. #endif`,b2e=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  7915. uniform float logDepthBufFC;
  7916. varying float vFragDepth;
  7917. varying float vIsPerspective;
  7918. #endif`,w2e=`#ifdef USE_LOGDEPTHBUF
  7919. #ifdef USE_LOGDEPTHBUF_EXT
  7920. varying float vFragDepth;
  7921. varying float vIsPerspective;
  7922. #else
  7923. uniform float logDepthBufFC;
  7924. #endif
  7925. #endif`,T2e=`#ifdef USE_LOGDEPTHBUF
  7926. #ifdef USE_LOGDEPTHBUF_EXT
  7927. vFragDepth = 1.0 + gl_Position.w;
  7928. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  7929. #else
  7930. if ( isPerspectiveMatrix( projectionMatrix ) ) {
  7931. gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
  7932. gl_Position.z *= gl_Position.w;
  7933. }
  7934. #endif
  7935. #endif`,E2e=`#ifdef USE_MAP
  7936. vec4 sampledDiffuseColor = texture2D( map, vMapUv );
  7937. #ifdef DECODE_VIDEO_TEXTURE
  7938. sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
  7939. #endif
  7940. diffuseColor *= sampledDiffuseColor;
  7941. #endif`,A2e=`#ifdef USE_MAP
  7942. uniform sampler2D map;
  7943. #endif`,C2e=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  7944. #if defined( USE_POINTS_UV )
  7945. vec2 uv = vUv;
  7946. #else
  7947. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  7948. #endif
  7949. #endif
  7950. #ifdef USE_MAP
  7951. diffuseColor *= texture2D( map, uv );
  7952. #endif
  7953. #ifdef USE_ALPHAMAP
  7954. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  7955. #endif`,R2e=`#if defined( USE_POINTS_UV )
  7956. varying vec2 vUv;
  7957. #else
  7958. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  7959. uniform mat3 uvTransform;
  7960. #endif
  7961. #endif
  7962. #ifdef USE_MAP
  7963. uniform sampler2D map;
  7964. #endif
  7965. #ifdef USE_ALPHAMAP
  7966. uniform sampler2D alphaMap;
  7967. #endif`,L2e=`float metalnessFactor = metalness;
  7968. #ifdef USE_METALNESSMAP
  7969. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  7970. metalnessFactor *= texelMetalness.b;
  7971. #endif`,P2e=`#ifdef USE_METALNESSMAP
  7972. uniform sampler2D metalnessMap;
  7973. #endif`,D2e=`#ifdef USE_INSTANCING_MORPH
  7974. float morphTargetInfluences[MORPHTARGETS_COUNT];
  7975. float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
  7976. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  7977. morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
  7978. }
  7979. #endif`,I2e=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
  7980. vColor *= morphTargetBaseInfluence;
  7981. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  7982. #if defined( USE_COLOR_ALPHA )
  7983. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
  7984. #elif defined( USE_COLOR )
  7985. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
  7986. #endif
  7987. }
  7988. #endif`,N2e=`#ifdef USE_MORPHNORMALS
  7989. objectNormal *= morphTargetBaseInfluence;
  7990. #ifdef MORPHTARGETS_TEXTURE
  7991. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  7992. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  7993. }
  7994. #else
  7995. objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
  7996. objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
  7997. objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
  7998. objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
  7999. #endif
  8000. #endif`,U2e=`#ifdef USE_MORPHTARGETS
  8001. #ifndef USE_INSTANCING_MORPH
  8002. uniform float morphTargetBaseInfluence;
  8003. #endif
  8004. #ifdef MORPHTARGETS_TEXTURE
  8005. #ifndef USE_INSTANCING_MORPH
  8006. uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  8007. #endif
  8008. uniform sampler2DArray morphTargetsTexture;
  8009. uniform ivec2 morphTargetsTextureSize;
  8010. vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
  8011. int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
  8012. int y = texelIndex / morphTargetsTextureSize.x;
  8013. int x = texelIndex - y * morphTargetsTextureSize.x;
  8014. ivec3 morphUV = ivec3( x, y, morphTargetIndex );
  8015. return texelFetch( morphTargetsTexture, morphUV, 0 );
  8016. }
  8017. #else
  8018. #ifndef USE_MORPHNORMALS
  8019. uniform float morphTargetInfluences[ 8 ];
  8020. #else
  8021. uniform float morphTargetInfluences[ 4 ];
  8022. #endif
  8023. #endif
  8024. #endif`,O2e=`#ifdef USE_MORPHTARGETS
  8025. transformed *= morphTargetBaseInfluence;
  8026. #ifdef MORPHTARGETS_TEXTURE
  8027. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  8028. if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
  8029. }
  8030. #else
  8031. transformed += morphTarget0 * morphTargetInfluences[ 0 ];
  8032. transformed += morphTarget1 * morphTargetInfluences[ 1 ];
  8033. transformed += morphTarget2 * morphTargetInfluences[ 2 ];
  8034. transformed += morphTarget3 * morphTargetInfluences[ 3 ];
  8035. #ifndef USE_MORPHNORMALS
  8036. transformed += morphTarget4 * morphTargetInfluences[ 4 ];
  8037. transformed += morphTarget5 * morphTargetInfluences[ 5 ];
  8038. transformed += morphTarget6 * morphTargetInfluences[ 6 ];
  8039. transformed += morphTarget7 * morphTargetInfluences[ 7 ];
  8040. #endif
  8041. #endif
  8042. #endif`,F2e=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
  8043. #ifdef FLAT_SHADED
  8044. vec3 fdx = dFdx( vViewPosition );
  8045. vec3 fdy = dFdy( vViewPosition );
  8046. vec3 normal = normalize( cross( fdx, fdy ) );
  8047. #else
  8048. vec3 normal = normalize( vNormal );
  8049. #ifdef DOUBLE_SIDED
  8050. normal *= faceDirection;
  8051. #endif
  8052. #endif
  8053. #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
  8054. #ifdef USE_TANGENT
  8055. mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  8056. #else
  8057. mat3 tbn = getTangentFrame( - vViewPosition, normal,
  8058. #if defined( USE_NORMALMAP )
  8059. vNormalMapUv
  8060. #elif defined( USE_CLEARCOAT_NORMALMAP )
  8061. vClearcoatNormalMapUv
  8062. #else
  8063. vUv
  8064. #endif
  8065. );
  8066. #endif
  8067. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  8068. tbn[0] *= faceDirection;
  8069. tbn[1] *= faceDirection;
  8070. #endif
  8071. #endif
  8072. #ifdef USE_CLEARCOAT_NORMALMAP
  8073. #ifdef USE_TANGENT
  8074. mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  8075. #else
  8076. mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
  8077. #endif
  8078. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  8079. tbn2[0] *= faceDirection;
  8080. tbn2[1] *= faceDirection;
  8081. #endif
  8082. #endif
  8083. vec3 nonPerturbedNormal = normal;`,z2e=`#ifdef USE_NORMALMAP_OBJECTSPACE
  8084. normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  8085. #ifdef FLIP_SIDED
  8086. normal = - normal;
  8087. #endif
  8088. #ifdef DOUBLE_SIDED
  8089. normal = normal * faceDirection;
  8090. #endif
  8091. normal = normalize( normalMatrix * normal );
  8092. #elif defined( USE_NORMALMAP_TANGENTSPACE )
  8093. vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  8094. mapN.xy *= normalScale;
  8095. normal = normalize( tbn * mapN );
  8096. #elif defined( USE_BUMPMAP )
  8097. normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
  8098. #endif`,B2e=`#ifndef FLAT_SHADED
  8099. varying vec3 vNormal;
  8100. #ifdef USE_TANGENT
  8101. varying vec3 vTangent;
  8102. varying vec3 vBitangent;
  8103. #endif
  8104. #endif`,k2e=`#ifndef FLAT_SHADED
  8105. varying vec3 vNormal;
  8106. #ifdef USE_TANGENT
  8107. varying vec3 vTangent;
  8108. varying vec3 vBitangent;
  8109. #endif
  8110. #endif`,V2e=`#ifndef FLAT_SHADED
  8111. vNormal = normalize( transformedNormal );
  8112. #ifdef USE_TANGENT
  8113. vTangent = normalize( transformedTangent );
  8114. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  8115. #endif
  8116. #endif`,G2e=`#ifdef USE_NORMALMAP
  8117. uniform sampler2D normalMap;
  8118. uniform vec2 normalScale;
  8119. #endif
  8120. #ifdef USE_NORMALMAP_OBJECTSPACE
  8121. uniform mat3 normalMatrix;
  8122. #endif
  8123. #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
  8124. mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
  8125. vec3 q0 = dFdx( eye_pos.xyz );
  8126. vec3 q1 = dFdy( eye_pos.xyz );
  8127. vec2 st0 = dFdx( uv.st );
  8128. vec2 st1 = dFdy( uv.st );
  8129. vec3 N = surf_norm;
  8130. vec3 q1perp = cross( q1, N );
  8131. vec3 q0perp = cross( N, q0 );
  8132. vec3 T = q1perp * st0.x + q0perp * st1.x;
  8133. vec3 B = q1perp * st0.y + q0perp * st1.y;
  8134. float det = max( dot( T, T ), dot( B, B ) );
  8135. float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
  8136. return mat3( T * scale, B * scale, N );
  8137. }
  8138. #endif`,H2e=`#ifdef USE_CLEARCOAT
  8139. vec3 clearcoatNormal = nonPerturbedNormal;
  8140. #endif`,W2e=`#ifdef USE_CLEARCOAT_NORMALMAP
  8141. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
  8142. clearcoatMapN.xy *= clearcoatNormalScale;
  8143. clearcoatNormal = normalize( tbn2 * clearcoatMapN );
  8144. #endif`,X2e=`#ifdef USE_CLEARCOATMAP
  8145. uniform sampler2D clearcoatMap;
  8146. #endif
  8147. #ifdef USE_CLEARCOAT_NORMALMAP
  8148. uniform sampler2D clearcoatNormalMap;
  8149. uniform vec2 clearcoatNormalScale;
  8150. #endif
  8151. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  8152. uniform sampler2D clearcoatRoughnessMap;
  8153. #endif`,Y2e=`#ifdef USE_IRIDESCENCEMAP
  8154. uniform sampler2D iridescenceMap;
  8155. #endif
  8156. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8157. uniform sampler2D iridescenceThicknessMap;
  8158. #endif`,q2e=`#ifdef OPAQUE
  8159. diffuseColor.a = 1.0;
  8160. #endif
  8161. #ifdef USE_TRANSMISSION
  8162. diffuseColor.a *= material.transmissionAlpha;
  8163. #endif
  8164. gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Z2e=`vec3 packNormalToRGB( const in vec3 normal ) {
  8165. return normalize( normal ) * 0.5 + 0.5;
  8166. }
  8167. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  8168. return 2.0 * rgb.xyz - 1.0;
  8169. }
  8170. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
  8171. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  8172. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  8173. const float ShiftRight8 = 1. / 256.;
  8174. vec4 packDepthToRGBA( const in float v ) {
  8175. vec4 r = vec4( fract( v * PackFactors ), v );
  8176. r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
  8177. }
  8178. float unpackRGBAToDepth( const in vec4 v ) {
  8179. return dot( v, UnpackFactors );
  8180. }
  8181. vec2 packDepthToRG( in highp float v ) {
  8182. return packDepthToRGBA( v ).yx;
  8183. }
  8184. float unpackRGToDepth( const in highp vec2 v ) {
  8185. return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
  8186. }
  8187. vec4 pack2HalfToRGBA( vec2 v ) {
  8188. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
  8189. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
  8190. }
  8191. vec2 unpackRGBATo2Half( vec4 v ) {
  8192. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  8193. }
  8194. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  8195. return ( viewZ + near ) / ( near - far );
  8196. }
  8197. float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
  8198. return depth * ( near - far ) - near;
  8199. }
  8200. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  8201. return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
  8202. }
  8203. float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
  8204. return ( near * far ) / ( ( far - near ) * depth - far );
  8205. }`,j2e=`#ifdef PREMULTIPLIED_ALPHA
  8206. gl_FragColor.rgb *= gl_FragColor.a;
  8207. #endif`,K2e=`vec4 mvPosition = vec4( transformed, 1.0 );
  8208. #ifdef USE_BATCHING
  8209. mvPosition = batchingMatrix * mvPosition;
  8210. #endif
  8211. #ifdef USE_INSTANCING
  8212. mvPosition = instanceMatrix * mvPosition;
  8213. #endif
  8214. mvPosition = modelViewMatrix * mvPosition;
  8215. gl_Position = projectionMatrix * mvPosition;`,J2e=`#ifdef DITHERING
  8216. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  8217. #endif`,$2e=`#ifdef DITHERING
  8218. vec3 dithering( vec3 color ) {
  8219. float grid_position = rand( gl_FragCoord.xy );
  8220. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  8221. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  8222. return color + dither_shift_RGB;
  8223. }
  8224. #endif`,Q2e=`float roughnessFactor = roughness;
  8225. #ifdef USE_ROUGHNESSMAP
  8226. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  8227. roughnessFactor *= texelRoughness.g;
  8228. #endif`,eIe=`#ifdef USE_ROUGHNESSMAP
  8229. uniform sampler2D roughnessMap;
  8230. #endif`,tIe=`#if NUM_SPOT_LIGHT_COORDS > 0
  8231. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  8232. #endif
  8233. #if NUM_SPOT_LIGHT_MAPS > 0
  8234. uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
  8235. #endif
  8236. #ifdef USE_SHADOWMAP
  8237. #if NUM_DIR_LIGHT_SHADOWS > 0
  8238. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  8239. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  8240. struct DirectionalLightShadow {
  8241. float shadowBias;
  8242. float shadowNormalBias;
  8243. float shadowRadius;
  8244. vec2 shadowMapSize;
  8245. };
  8246. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  8247. #endif
  8248. #if NUM_SPOT_LIGHT_SHADOWS > 0
  8249. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  8250. struct SpotLightShadow {
  8251. float shadowBias;
  8252. float shadowNormalBias;
  8253. float shadowRadius;
  8254. vec2 shadowMapSize;
  8255. };
  8256. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  8257. #endif
  8258. #if NUM_POINT_LIGHT_SHADOWS > 0
  8259. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  8260. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  8261. struct PointLightShadow {
  8262. float shadowBias;
  8263. float shadowNormalBias;
  8264. float shadowRadius;
  8265. vec2 shadowMapSize;
  8266. float shadowCameraNear;
  8267. float shadowCameraFar;
  8268. };
  8269. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  8270. #endif
  8271. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  8272. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  8273. }
  8274. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  8275. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  8276. }
  8277. float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
  8278. float occlusion = 1.0;
  8279. vec2 distribution = texture2DDistribution( shadow, uv );
  8280. float hard_shadow = step( compare , distribution.x );
  8281. if (hard_shadow != 1.0 ) {
  8282. float distance = compare - distribution.x ;
  8283. float variance = max( 0.00000, distribution.y * distribution.y );
  8284. float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
  8285. }
  8286. return occlusion;
  8287. }
  8288. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  8289. float shadow = 1.0;
  8290. shadowCoord.xyz /= shadowCoord.w;
  8291. shadowCoord.z += shadowBias;
  8292. bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
  8293. bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
  8294. if ( frustumTest ) {
  8295. #if defined( SHADOWMAP_TYPE_PCF )
  8296. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  8297. float dx0 = - texelSize.x * shadowRadius;
  8298. float dy0 = - texelSize.y * shadowRadius;
  8299. float dx1 = + texelSize.x * shadowRadius;
  8300. float dy1 = + texelSize.y * shadowRadius;
  8301. float dx2 = dx0 / 2.0;
  8302. float dy2 = dy0 / 2.0;
  8303. float dx3 = dx1 / 2.0;
  8304. float dy3 = dy1 / 2.0;
  8305. shadow = (
  8306. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  8307. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  8308. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  8309. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  8310. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  8311. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  8312. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  8313. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  8314. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  8315. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  8316. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  8317. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  8318. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  8319. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  8320. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  8321. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  8322. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  8323. ) * ( 1.0 / 17.0 );
  8324. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  8325. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  8326. float dx = texelSize.x;
  8327. float dy = texelSize.y;
  8328. vec2 uv = shadowCoord.xy;
  8329. vec2 f = fract( uv * shadowMapSize + 0.5 );
  8330. uv -= f * texelSize;
  8331. shadow = (
  8332. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  8333. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  8334. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  8335. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  8336. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  8337. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  8338. f.x ) +
  8339. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  8340. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  8341. f.x ) +
  8342. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  8343. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  8344. f.y ) +
  8345. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  8346. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  8347. f.y ) +
  8348. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  8349. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  8350. f.x ),
  8351. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  8352. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  8353. f.x ),
  8354. f.y )
  8355. ) * ( 1.0 / 9.0 );
  8356. #elif defined( SHADOWMAP_TYPE_VSM )
  8357. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  8358. #else
  8359. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  8360. #endif
  8361. }
  8362. return shadow;
  8363. }
  8364. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  8365. vec3 absV = abs( v );
  8366. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  8367. absV *= scaleToCube;
  8368. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  8369. vec2 planar = v.xy;
  8370. float almostATexel = 1.5 * texelSizeY;
  8371. float almostOne = 1.0 - almostATexel;
  8372. if ( absV.z >= almostOne ) {
  8373. if ( v.z > 0.0 )
  8374. planar.x = 4.0 - v.x;
  8375. } else if ( absV.x >= almostOne ) {
  8376. float signX = sign( v.x );
  8377. planar.x = v.z * signX + 2.0 * signX;
  8378. } else if ( absV.y >= almostOne ) {
  8379. float signY = sign( v.y );
  8380. planar.x = v.x + 2.0 * signY + 2.0;
  8381. planar.y = v.z * signY - 2.0;
  8382. }
  8383. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  8384. }
  8385. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  8386. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  8387. vec3 lightToPosition = shadowCoord.xyz;
  8388. float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
  8389. vec3 bd3D = normalize( lightToPosition );
  8390. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  8391. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  8392. return (
  8393. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  8394. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  8395. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  8396. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  8397. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  8398. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  8399. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  8400. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  8401. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  8402. ) * ( 1.0 / 9.0 );
  8403. #else
  8404. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  8405. #endif
  8406. }
  8407. #endif`,rIe=`#if NUM_SPOT_LIGHT_COORDS > 0
  8408. uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  8409. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  8410. #endif
  8411. #ifdef USE_SHADOWMAP
  8412. #if NUM_DIR_LIGHT_SHADOWS > 0
  8413. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  8414. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  8415. struct DirectionalLightShadow {
  8416. float shadowBias;
  8417. float shadowNormalBias;
  8418. float shadowRadius;
  8419. vec2 shadowMapSize;
  8420. };
  8421. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  8422. #endif
  8423. #if NUM_SPOT_LIGHT_SHADOWS > 0
  8424. struct SpotLightShadow {
  8425. float shadowBias;
  8426. float shadowNormalBias;
  8427. float shadowRadius;
  8428. vec2 shadowMapSize;
  8429. };
  8430. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  8431. #endif
  8432. #if NUM_POINT_LIGHT_SHADOWS > 0
  8433. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  8434. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  8435. struct PointLightShadow {
  8436. float shadowBias;
  8437. float shadowNormalBias;
  8438. float shadowRadius;
  8439. vec2 shadowMapSize;
  8440. float shadowCameraNear;
  8441. float shadowCameraFar;
  8442. };
  8443. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  8444. #endif
  8445. #endif`,iIe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
  8446. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  8447. vec4 shadowWorldPosition;
  8448. #endif
  8449. #if defined( USE_SHADOWMAP )
  8450. #if NUM_DIR_LIGHT_SHADOWS > 0
  8451. #pragma unroll_loop_start
  8452. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  8453. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  8454. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  8455. }
  8456. #pragma unroll_loop_end
  8457. #endif
  8458. #if NUM_POINT_LIGHT_SHADOWS > 0
  8459. #pragma unroll_loop_start
  8460. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  8461. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  8462. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  8463. }
  8464. #pragma unroll_loop_end
  8465. #endif
  8466. #endif
  8467. #if NUM_SPOT_LIGHT_COORDS > 0
  8468. #pragma unroll_loop_start
  8469. for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
  8470. shadowWorldPosition = worldPosition;
  8471. #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  8472. shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
  8473. #endif
  8474. vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
  8475. }
  8476. #pragma unroll_loop_end
  8477. #endif`,nIe=`float getShadowMask() {
  8478. float shadow = 1.0;
  8479. #ifdef USE_SHADOWMAP
  8480. #if NUM_DIR_LIGHT_SHADOWS > 0
  8481. DirectionalLightShadow directionalLight;
  8482. #pragma unroll_loop_start
  8483. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  8484. directionalLight = directionalLightShadows[ i ];
  8485. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  8486. }
  8487. #pragma unroll_loop_end
  8488. #endif
  8489. #if NUM_SPOT_LIGHT_SHADOWS > 0
  8490. SpotLightShadow spotLight;
  8491. #pragma unroll_loop_start
  8492. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  8493. spotLight = spotLightShadows[ i ];
  8494. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  8495. }
  8496. #pragma unroll_loop_end
  8497. #endif
  8498. #if NUM_POINT_LIGHT_SHADOWS > 0
  8499. PointLightShadow pointLight;
  8500. #pragma unroll_loop_start
  8501. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  8502. pointLight = pointLightShadows[ i ];
  8503. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  8504. }
  8505. #pragma unroll_loop_end
  8506. #endif
  8507. #endif
  8508. return shadow;
  8509. }`,aIe=`#ifdef USE_SKINNING
  8510. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  8511. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  8512. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  8513. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  8514. #endif`,oIe=`#ifdef USE_SKINNING
  8515. uniform mat4 bindMatrix;
  8516. uniform mat4 bindMatrixInverse;
  8517. uniform highp sampler2D boneTexture;
  8518. mat4 getBoneMatrix( const in float i ) {
  8519. int size = textureSize( boneTexture, 0 ).x;
  8520. int j = int( i ) * 4;
  8521. int x = j % size;
  8522. int y = j / size;
  8523. vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
  8524. vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
  8525. vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
  8526. vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
  8527. return mat4( v1, v2, v3, v4 );
  8528. }
  8529. #endif`,sIe=`#ifdef USE_SKINNING
  8530. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  8531. vec4 skinned = vec4( 0.0 );
  8532. skinned += boneMatX * skinVertex * skinWeight.x;
  8533. skinned += boneMatY * skinVertex * skinWeight.y;
  8534. skinned += boneMatZ * skinVertex * skinWeight.z;
  8535. skinned += boneMatW * skinVertex * skinWeight.w;
  8536. transformed = ( bindMatrixInverse * skinned ).xyz;
  8537. #endif`,lIe=`#ifdef USE_SKINNING
  8538. mat4 skinMatrix = mat4( 0.0 );
  8539. skinMatrix += skinWeight.x * boneMatX;
  8540. skinMatrix += skinWeight.y * boneMatY;
  8541. skinMatrix += skinWeight.z * boneMatZ;
  8542. skinMatrix += skinWeight.w * boneMatW;
  8543. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  8544. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  8545. #ifdef USE_TANGENT
  8546. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  8547. #endif
  8548. #endif`,uIe=`float specularStrength;
  8549. #ifdef USE_SPECULARMAP
  8550. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  8551. specularStrength = texelSpecular.r;
  8552. #else
  8553. specularStrength = 1.0;
  8554. #endif`,cIe=`#ifdef USE_SPECULARMAP
  8555. uniform sampler2D specularMap;
  8556. #endif`,fIe=`#if defined( TONE_MAPPING )
  8557. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  8558. #endif`,hIe=`#ifndef saturate
  8559. #define saturate( a ) clamp( a, 0.0, 1.0 )
  8560. #endif
  8561. uniform float toneMappingExposure;
  8562. vec3 LinearToneMapping( vec3 color ) {
  8563. return saturate( toneMappingExposure * color );
  8564. }
  8565. vec3 ReinhardToneMapping( vec3 color ) {
  8566. color *= toneMappingExposure;
  8567. return saturate( color / ( vec3( 1.0 ) + color ) );
  8568. }
  8569. vec3 OptimizedCineonToneMapping( vec3 color ) {
  8570. color *= toneMappingExposure;
  8571. color = max( vec3( 0.0 ), color - 0.004 );
  8572. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  8573. }
  8574. vec3 RRTAndODTFit( vec3 v ) {
  8575. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  8576. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  8577. return a / b;
  8578. }
  8579. vec3 ACESFilmicToneMapping( vec3 color ) {
  8580. const mat3 ACESInputMat = mat3(
  8581. vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
  8582. vec3( 0.04823, 0.01566, 0.83777 )
  8583. );
  8584. const mat3 ACESOutputMat = mat3(
  8585. vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
  8586. vec3( -0.07367, -0.00605, 1.07602 )
  8587. );
  8588. color *= toneMappingExposure / 0.6;
  8589. color = ACESInputMat * color;
  8590. color = RRTAndODTFit( color );
  8591. color = ACESOutputMat * color;
  8592. return saturate( color );
  8593. }
  8594. const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
  8595. vec3( 1.6605, - 0.1246, - 0.0182 ),
  8596. vec3( - 0.5876, 1.1329, - 0.1006 ),
  8597. vec3( - 0.0728, - 0.0083, 1.1187 )
  8598. );
  8599. const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
  8600. vec3( 0.6274, 0.0691, 0.0164 ),
  8601. vec3( 0.3293, 0.9195, 0.0880 ),
  8602. vec3( 0.0433, 0.0113, 0.8956 )
  8603. );
  8604. vec3 agxDefaultContrastApprox( vec3 x ) {
  8605. vec3 x2 = x * x;
  8606. vec3 x4 = x2 * x2;
  8607. return + 15.5 * x4 * x2
  8608. - 40.14 * x4 * x
  8609. + 31.96 * x4
  8610. - 6.868 * x2 * x
  8611. + 0.4298 * x2
  8612. + 0.1191 * x
  8613. - 0.00232;
  8614. }
  8615. vec3 AgXToneMapping( vec3 color ) {
  8616. const mat3 AgXInsetMatrix = mat3(
  8617. vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
  8618. vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
  8619. vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
  8620. );
  8621. const mat3 AgXOutsetMatrix = mat3(
  8622. vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
  8623. vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
  8624. vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
  8625. );
  8626. const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
  8627. color *= toneMappingExposure;
  8628. color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
  8629. color = AgXInsetMatrix * color;
  8630. color = max( color, 1e-10 ); color = log2( color );
  8631. color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
  8632. color = clamp( color, 0.0, 1.0 );
  8633. color = agxDefaultContrastApprox( color );
  8634. color = AgXOutsetMatrix * color;
  8635. color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
  8636. color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
  8637. color = clamp( color, 0.0, 1.0 );
  8638. return color;
  8639. }
  8640. vec3 NeutralToneMapping( vec3 color ) {
  8641. float startCompression = 0.8 - 0.04;
  8642. float desaturation = 0.15;
  8643. color *= toneMappingExposure;
  8644. float x = min(color.r, min(color.g, color.b));
  8645. float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
  8646. color -= offset;
  8647. float peak = max(color.r, max(color.g, color.b));
  8648. if (peak < startCompression) return color;
  8649. float d = 1. - startCompression;
  8650. float newPeak = 1. - d * d / (peak + d - startCompression);
  8651. color *= newPeak / peak;
  8652. float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
  8653. return mix(color, vec3(1, 1, 1), g);
  8654. }
  8655. vec3 CustomToneMapping( vec3 color ) { return color; }`,pIe=`#ifdef USE_TRANSMISSION
  8656. material.transmission = transmission;
  8657. material.transmissionAlpha = 1.0;
  8658. material.thickness = thickness;
  8659. material.attenuationDistance = attenuationDistance;
  8660. material.attenuationColor = attenuationColor;
  8661. #ifdef USE_TRANSMISSIONMAP
  8662. material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
  8663. #endif
  8664. #ifdef USE_THICKNESSMAP
  8665. material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
  8666. #endif
  8667. vec3 pos = vWorldPosition;
  8668. vec3 v = normalize( cameraPosition - pos );
  8669. vec3 n = inverseTransformDirection( normal, viewMatrix );
  8670. vec4 transmitted = getIBLVolumeRefraction(
  8671. n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  8672. pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
  8673. material.attenuationColor, material.attenuationDistance );
  8674. material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
  8675. totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
  8676. #endif`,dIe=`#ifdef USE_TRANSMISSION
  8677. uniform float transmission;
  8678. uniform float thickness;
  8679. uniform float attenuationDistance;
  8680. uniform vec3 attenuationColor;
  8681. #ifdef USE_TRANSMISSIONMAP
  8682. uniform sampler2D transmissionMap;
  8683. #endif
  8684. #ifdef USE_THICKNESSMAP
  8685. uniform sampler2D thicknessMap;
  8686. #endif
  8687. uniform vec2 transmissionSamplerSize;
  8688. uniform sampler2D transmissionSamplerMap;
  8689. uniform mat4 modelMatrix;
  8690. uniform mat4 projectionMatrix;
  8691. varying vec3 vWorldPosition;
  8692. float w0( float a ) {
  8693. return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
  8694. }
  8695. float w1( float a ) {
  8696. return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
  8697. }
  8698. float w2( float a ){
  8699. return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
  8700. }
  8701. float w3( float a ) {
  8702. return ( 1.0 / 6.0 ) * ( a * a * a );
  8703. }
  8704. float g0( float a ) {
  8705. return w0( a ) + w1( a );
  8706. }
  8707. float g1( float a ) {
  8708. return w2( a ) + w3( a );
  8709. }
  8710. float h0( float a ) {
  8711. return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
  8712. }
  8713. float h1( float a ) {
  8714. return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
  8715. }
  8716. vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
  8717. uv = uv * texelSize.zw + 0.5;
  8718. vec2 iuv = floor( uv );
  8719. vec2 fuv = fract( uv );
  8720. float g0x = g0( fuv.x );
  8721. float g1x = g1( fuv.x );
  8722. float h0x = h0( fuv.x );
  8723. float h1x = h1( fuv.x );
  8724. float h0y = h0( fuv.y );
  8725. float h1y = h1( fuv.y );
  8726. vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  8727. vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  8728. vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  8729. vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  8730. return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
  8731. g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
  8732. }
  8733. vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
  8734. vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
  8735. vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
  8736. vec2 fLodSizeInv = 1.0 / fLodSize;
  8737. vec2 cLodSizeInv = 1.0 / cLodSize;
  8738. vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
  8739. vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
  8740. return mix( fSample, cSample, fract( lod ) );
  8741. }
  8742. vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
  8743. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
  8744. vec3 modelScale;
  8745. modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
  8746. modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
  8747. modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
  8748. return normalize( refractionVector ) * thickness * modelScale;
  8749. }
  8750. float applyIorToRoughness( const in float roughness, const in float ior ) {
  8751. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
  8752. }
  8753. vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
  8754. float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
  8755. return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
  8756. }
  8757. vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
  8758. if ( isinf( attenuationDistance ) ) {
  8759. return vec3( 1.0 );
  8760. } else {
  8761. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
  8762. vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
  8763. }
  8764. }
  8765. vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
  8766. const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
  8767. const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
  8768. const in vec3 attenuationColor, const in float attenuationDistance ) {
  8769. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
  8770. vec3 refractedRayExit = position + transmissionRay;
  8771. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  8772. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  8773. refractionCoords += 1.0;
  8774. refractionCoords /= 2.0;
  8775. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
  8776. vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
  8777. vec3 attenuatedColor = transmittance * transmittedLight.rgb;
  8778. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
  8779. float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
  8780. return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
  8781. }
  8782. #endif`,mIe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  8783. varying vec2 vUv;
  8784. #endif
  8785. #ifdef USE_MAP
  8786. varying vec2 vMapUv;
  8787. #endif
  8788. #ifdef USE_ALPHAMAP
  8789. varying vec2 vAlphaMapUv;
  8790. #endif
  8791. #ifdef USE_LIGHTMAP
  8792. varying vec2 vLightMapUv;
  8793. #endif
  8794. #ifdef USE_AOMAP
  8795. varying vec2 vAoMapUv;
  8796. #endif
  8797. #ifdef USE_BUMPMAP
  8798. varying vec2 vBumpMapUv;
  8799. #endif
  8800. #ifdef USE_NORMALMAP
  8801. varying vec2 vNormalMapUv;
  8802. #endif
  8803. #ifdef USE_EMISSIVEMAP
  8804. varying vec2 vEmissiveMapUv;
  8805. #endif
  8806. #ifdef USE_METALNESSMAP
  8807. varying vec2 vMetalnessMapUv;
  8808. #endif
  8809. #ifdef USE_ROUGHNESSMAP
  8810. varying vec2 vRoughnessMapUv;
  8811. #endif
  8812. #ifdef USE_ANISOTROPYMAP
  8813. varying vec2 vAnisotropyMapUv;
  8814. #endif
  8815. #ifdef USE_CLEARCOATMAP
  8816. varying vec2 vClearcoatMapUv;
  8817. #endif
  8818. #ifdef USE_CLEARCOAT_NORMALMAP
  8819. varying vec2 vClearcoatNormalMapUv;
  8820. #endif
  8821. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  8822. varying vec2 vClearcoatRoughnessMapUv;
  8823. #endif
  8824. #ifdef USE_IRIDESCENCEMAP
  8825. varying vec2 vIridescenceMapUv;
  8826. #endif
  8827. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8828. varying vec2 vIridescenceThicknessMapUv;
  8829. #endif
  8830. #ifdef USE_SHEEN_COLORMAP
  8831. varying vec2 vSheenColorMapUv;
  8832. #endif
  8833. #ifdef USE_SHEEN_ROUGHNESSMAP
  8834. varying vec2 vSheenRoughnessMapUv;
  8835. #endif
  8836. #ifdef USE_SPECULARMAP
  8837. varying vec2 vSpecularMapUv;
  8838. #endif
  8839. #ifdef USE_SPECULAR_COLORMAP
  8840. varying vec2 vSpecularColorMapUv;
  8841. #endif
  8842. #ifdef USE_SPECULAR_INTENSITYMAP
  8843. varying vec2 vSpecularIntensityMapUv;
  8844. #endif
  8845. #ifdef USE_TRANSMISSIONMAP
  8846. uniform mat3 transmissionMapTransform;
  8847. varying vec2 vTransmissionMapUv;
  8848. #endif
  8849. #ifdef USE_THICKNESSMAP
  8850. uniform mat3 thicknessMapTransform;
  8851. varying vec2 vThicknessMapUv;
  8852. #endif`,vIe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  8853. varying vec2 vUv;
  8854. #endif
  8855. #ifdef USE_MAP
  8856. uniform mat3 mapTransform;
  8857. varying vec2 vMapUv;
  8858. #endif
  8859. #ifdef USE_ALPHAMAP
  8860. uniform mat3 alphaMapTransform;
  8861. varying vec2 vAlphaMapUv;
  8862. #endif
  8863. #ifdef USE_LIGHTMAP
  8864. uniform mat3 lightMapTransform;
  8865. varying vec2 vLightMapUv;
  8866. #endif
  8867. #ifdef USE_AOMAP
  8868. uniform mat3 aoMapTransform;
  8869. varying vec2 vAoMapUv;
  8870. #endif
  8871. #ifdef USE_BUMPMAP
  8872. uniform mat3 bumpMapTransform;
  8873. varying vec2 vBumpMapUv;
  8874. #endif
  8875. #ifdef USE_NORMALMAP
  8876. uniform mat3 normalMapTransform;
  8877. varying vec2 vNormalMapUv;
  8878. #endif
  8879. #ifdef USE_DISPLACEMENTMAP
  8880. uniform mat3 displacementMapTransform;
  8881. varying vec2 vDisplacementMapUv;
  8882. #endif
  8883. #ifdef USE_EMISSIVEMAP
  8884. uniform mat3 emissiveMapTransform;
  8885. varying vec2 vEmissiveMapUv;
  8886. #endif
  8887. #ifdef USE_METALNESSMAP
  8888. uniform mat3 metalnessMapTransform;
  8889. varying vec2 vMetalnessMapUv;
  8890. #endif
  8891. #ifdef USE_ROUGHNESSMAP
  8892. uniform mat3 roughnessMapTransform;
  8893. varying vec2 vRoughnessMapUv;
  8894. #endif
  8895. #ifdef USE_ANISOTROPYMAP
  8896. uniform mat3 anisotropyMapTransform;
  8897. varying vec2 vAnisotropyMapUv;
  8898. #endif
  8899. #ifdef USE_CLEARCOATMAP
  8900. uniform mat3 clearcoatMapTransform;
  8901. varying vec2 vClearcoatMapUv;
  8902. #endif
  8903. #ifdef USE_CLEARCOAT_NORMALMAP
  8904. uniform mat3 clearcoatNormalMapTransform;
  8905. varying vec2 vClearcoatNormalMapUv;
  8906. #endif
  8907. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  8908. uniform mat3 clearcoatRoughnessMapTransform;
  8909. varying vec2 vClearcoatRoughnessMapUv;
  8910. #endif
  8911. #ifdef USE_SHEEN_COLORMAP
  8912. uniform mat3 sheenColorMapTransform;
  8913. varying vec2 vSheenColorMapUv;
  8914. #endif
  8915. #ifdef USE_SHEEN_ROUGHNESSMAP
  8916. uniform mat3 sheenRoughnessMapTransform;
  8917. varying vec2 vSheenRoughnessMapUv;
  8918. #endif
  8919. #ifdef USE_IRIDESCENCEMAP
  8920. uniform mat3 iridescenceMapTransform;
  8921. varying vec2 vIridescenceMapUv;
  8922. #endif
  8923. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8924. uniform mat3 iridescenceThicknessMapTransform;
  8925. varying vec2 vIridescenceThicknessMapUv;
  8926. #endif
  8927. #ifdef USE_SPECULARMAP
  8928. uniform mat3 specularMapTransform;
  8929. varying vec2 vSpecularMapUv;
  8930. #endif
  8931. #ifdef USE_SPECULAR_COLORMAP
  8932. uniform mat3 specularColorMapTransform;
  8933. varying vec2 vSpecularColorMapUv;
  8934. #endif
  8935. #ifdef USE_SPECULAR_INTENSITYMAP
  8936. uniform mat3 specularIntensityMapTransform;
  8937. varying vec2 vSpecularIntensityMapUv;
  8938. #endif
  8939. #ifdef USE_TRANSMISSIONMAP
  8940. uniform mat3 transmissionMapTransform;
  8941. varying vec2 vTransmissionMapUv;
  8942. #endif
  8943. #ifdef USE_THICKNESSMAP
  8944. uniform mat3 thicknessMapTransform;
  8945. varying vec2 vThicknessMapUv;
  8946. #endif`,gIe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  8947. vUv = vec3( uv, 1 ).xy;
  8948. #endif
  8949. #ifdef USE_MAP
  8950. vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  8951. #endif
  8952. #ifdef USE_ALPHAMAP
  8953. vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  8954. #endif
  8955. #ifdef USE_LIGHTMAP
  8956. vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
  8957. #endif
  8958. #ifdef USE_AOMAP
  8959. vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
  8960. #endif
  8961. #ifdef USE_BUMPMAP
  8962. vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
  8963. #endif
  8964. #ifdef USE_NORMALMAP
  8965. vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
  8966. #endif
  8967. #ifdef USE_DISPLACEMENTMAP
  8968. vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
  8969. #endif
  8970. #ifdef USE_EMISSIVEMAP
  8971. vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
  8972. #endif
  8973. #ifdef USE_METALNESSMAP
  8974. vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
  8975. #endif
  8976. #ifdef USE_ROUGHNESSMAP
  8977. vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
  8978. #endif
  8979. #ifdef USE_ANISOTROPYMAP
  8980. vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
  8981. #endif
  8982. #ifdef USE_CLEARCOATMAP
  8983. vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
  8984. #endif
  8985. #ifdef USE_CLEARCOAT_NORMALMAP
  8986. vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
  8987. #endif
  8988. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  8989. vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
  8990. #endif
  8991. #ifdef USE_IRIDESCENCEMAP
  8992. vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
  8993. #endif
  8994. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8995. vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
  8996. #endif
  8997. #ifdef USE_SHEEN_COLORMAP
  8998. vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
  8999. #endif
  9000. #ifdef USE_SHEEN_ROUGHNESSMAP
  9001. vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
  9002. #endif
  9003. #ifdef USE_SPECULARMAP
  9004. vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
  9005. #endif
  9006. #ifdef USE_SPECULAR_COLORMAP
  9007. vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
  9008. #endif
  9009. #ifdef USE_SPECULAR_INTENSITYMAP
  9010. vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
  9011. #endif
  9012. #ifdef USE_TRANSMISSIONMAP
  9013. vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
  9014. #endif
  9015. #ifdef USE_THICKNESSMAP
  9016. vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
  9017. #endif`,yIe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
  9018. vec4 worldPosition = vec4( transformed, 1.0 );
  9019. #ifdef USE_BATCHING
  9020. worldPosition = batchingMatrix * worldPosition;
  9021. #endif
  9022. #ifdef USE_INSTANCING
  9023. worldPosition = instanceMatrix * worldPosition;
  9024. #endif
  9025. worldPosition = modelMatrix * worldPosition;
  9026. #endif`,_Ie=`varying vec2 vUv;
  9027. uniform mat3 uvTransform;
  9028. void main() {
  9029. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  9030. gl_Position = vec4( position.xy, 1.0, 1.0 );
  9031. }`,xIe=`uniform sampler2D t2D;
  9032. uniform float backgroundIntensity;
  9033. varying vec2 vUv;
  9034. void main() {
  9035. vec4 texColor = texture2D( t2D, vUv );
  9036. #ifdef DECODE_VIDEO_TEXTURE
  9037. texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
  9038. #endif
  9039. texColor.rgb *= backgroundIntensity;
  9040. gl_FragColor = texColor;
  9041. #include <tonemapping_fragment>
  9042. #include <colorspace_fragment>
  9043. }`,SIe=`varying vec3 vWorldDirection;
  9044. #include <common>
  9045. void main() {
  9046. vWorldDirection = transformDirection( position, modelMatrix );
  9047. #include <begin_vertex>
  9048. #include <project_vertex>
  9049. gl_Position.z = gl_Position.w;
  9050. }`,MIe=`#ifdef ENVMAP_TYPE_CUBE
  9051. uniform samplerCube envMap;
  9052. #elif defined( ENVMAP_TYPE_CUBE_UV )
  9053. uniform sampler2D envMap;
  9054. #endif
  9055. uniform float flipEnvMap;
  9056. uniform float backgroundBlurriness;
  9057. uniform float backgroundIntensity;
  9058. uniform mat3 backgroundRotation;
  9059. varying vec3 vWorldDirection;
  9060. #include <cube_uv_reflection_fragment>
  9061. void main() {
  9062. #ifdef ENVMAP_TYPE_CUBE
  9063. vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
  9064. #elif defined( ENVMAP_TYPE_CUBE_UV )
  9065. vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
  9066. #else
  9067. vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  9068. #endif
  9069. texColor.rgb *= backgroundIntensity;
  9070. gl_FragColor = texColor;
  9071. #include <tonemapping_fragment>
  9072. #include <colorspace_fragment>
  9073. }`,bIe=`varying vec3 vWorldDirection;
  9074. #include <common>
  9075. void main() {
  9076. vWorldDirection = transformDirection( position, modelMatrix );
  9077. #include <begin_vertex>
  9078. #include <project_vertex>
  9079. gl_Position.z = gl_Position.w;
  9080. }`,wIe=`uniform samplerCube tCube;
  9081. uniform float tFlip;
  9082. uniform float opacity;
  9083. varying vec3 vWorldDirection;
  9084. void main() {
  9085. vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
  9086. gl_FragColor = texColor;
  9087. gl_FragColor.a *= opacity;
  9088. #include <tonemapping_fragment>
  9089. #include <colorspace_fragment>
  9090. }`,TIe=`#include <common>
  9091. #include <batching_pars_vertex>
  9092. #include <uv_pars_vertex>
  9093. #include <displacementmap_pars_vertex>
  9094. #include <morphtarget_pars_vertex>
  9095. #include <skinning_pars_vertex>
  9096. #include <logdepthbuf_pars_vertex>
  9097. #include <clipping_planes_pars_vertex>
  9098. varying vec2 vHighPrecisionZW;
  9099. void main() {
  9100. #include <uv_vertex>
  9101. #include <batching_vertex>
  9102. #include <skinbase_vertex>
  9103. #include <morphinstance_vertex>
  9104. #ifdef USE_DISPLACEMENTMAP
  9105. #include <beginnormal_vertex>
  9106. #include <morphnormal_vertex>
  9107. #include <skinnormal_vertex>
  9108. #endif
  9109. #include <begin_vertex>
  9110. #include <morphtarget_vertex>
  9111. #include <skinning_vertex>
  9112. #include <displacementmap_vertex>
  9113. #include <project_vertex>
  9114. #include <logdepthbuf_vertex>
  9115. #include <clipping_planes_vertex>
  9116. vHighPrecisionZW = gl_Position.zw;
  9117. }`,EIe=`#if DEPTH_PACKING == 3200
  9118. uniform float opacity;
  9119. #endif
  9120. #include <common>
  9121. #include <packing>
  9122. #include <uv_pars_fragment>
  9123. #include <map_pars_fragment>
  9124. #include <alphamap_pars_fragment>
  9125. #include <alphatest_pars_fragment>
  9126. #include <alphahash_pars_fragment>
  9127. #include <logdepthbuf_pars_fragment>
  9128. #include <clipping_planes_pars_fragment>
  9129. varying vec2 vHighPrecisionZW;
  9130. void main() {
  9131. vec4 diffuseColor = vec4( 1.0 );
  9132. #include <clipping_planes_fragment>
  9133. #if DEPTH_PACKING == 3200
  9134. diffuseColor.a = opacity;
  9135. #endif
  9136. #include <map_fragment>
  9137. #include <alphamap_fragment>
  9138. #include <alphatest_fragment>
  9139. #include <alphahash_fragment>
  9140. #include <logdepthbuf_fragment>
  9141. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
  9142. #if DEPTH_PACKING == 3200
  9143. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  9144. #elif DEPTH_PACKING == 3201
  9145. gl_FragColor = packDepthToRGBA( fragCoordZ );
  9146. #endif
  9147. }`,AIe=`#define DISTANCE
  9148. varying vec3 vWorldPosition;
  9149. #include <common>
  9150. #include <batching_pars_vertex>
  9151. #include <uv_pars_vertex>
  9152. #include <displacementmap_pars_vertex>
  9153. #include <morphtarget_pars_vertex>
  9154. #include <skinning_pars_vertex>
  9155. #include <clipping_planes_pars_vertex>
  9156. void main() {
  9157. #include <uv_vertex>
  9158. #include <batching_vertex>
  9159. #include <skinbase_vertex>
  9160. #include <morphinstance_vertex>
  9161. #ifdef USE_DISPLACEMENTMAP
  9162. #include <beginnormal_vertex>
  9163. #include <morphnormal_vertex>
  9164. #include <skinnormal_vertex>
  9165. #endif
  9166. #include <begin_vertex>
  9167. #include <morphtarget_vertex>
  9168. #include <skinning_vertex>
  9169. #include <displacementmap_vertex>
  9170. #include <project_vertex>
  9171. #include <worldpos_vertex>
  9172. #include <clipping_planes_vertex>
  9173. vWorldPosition = worldPosition.xyz;
  9174. }`,CIe=`#define DISTANCE
  9175. uniform vec3 referencePosition;
  9176. uniform float nearDistance;
  9177. uniform float farDistance;
  9178. varying vec3 vWorldPosition;
  9179. #include <common>
  9180. #include <packing>
  9181. #include <uv_pars_fragment>
  9182. #include <map_pars_fragment>
  9183. #include <alphamap_pars_fragment>
  9184. #include <alphatest_pars_fragment>
  9185. #include <alphahash_pars_fragment>
  9186. #include <clipping_planes_pars_fragment>
  9187. void main () {
  9188. vec4 diffuseColor = vec4( 1.0 );
  9189. #include <clipping_planes_fragment>
  9190. #include <map_fragment>
  9191. #include <alphamap_fragment>
  9192. #include <alphatest_fragment>
  9193. #include <alphahash_fragment>
  9194. float dist = length( vWorldPosition - referencePosition );
  9195. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  9196. dist = saturate( dist );
  9197. gl_FragColor = packDepthToRGBA( dist );
  9198. }`,RIe=`varying vec3 vWorldDirection;
  9199. #include <common>
  9200. void main() {
  9201. vWorldDirection = transformDirection( position, modelMatrix );
  9202. #include <begin_vertex>
  9203. #include <project_vertex>
  9204. }`,LIe=`uniform sampler2D tEquirect;
  9205. varying vec3 vWorldDirection;
  9206. #include <common>
  9207. void main() {
  9208. vec3 direction = normalize( vWorldDirection );
  9209. vec2 sampleUV = equirectUv( direction );
  9210. gl_FragColor = texture2D( tEquirect, sampleUV );
  9211. #include <tonemapping_fragment>
  9212. #include <colorspace_fragment>
  9213. }`,PIe=`uniform float scale;
  9214. attribute float lineDistance;
  9215. varying float vLineDistance;
  9216. #include <common>
  9217. #include <uv_pars_vertex>
  9218. #include <color_pars_vertex>
  9219. #include <fog_pars_vertex>
  9220. #include <morphtarget_pars_vertex>
  9221. #include <logdepthbuf_pars_vertex>
  9222. #include <clipping_planes_pars_vertex>
  9223. void main() {
  9224. vLineDistance = scale * lineDistance;
  9225. #include <uv_vertex>
  9226. #include <color_vertex>
  9227. #include <morphinstance_vertex>
  9228. #include <morphcolor_vertex>
  9229. #include <begin_vertex>
  9230. #include <morphtarget_vertex>
  9231. #include <project_vertex>
  9232. #include <logdepthbuf_vertex>
  9233. #include <clipping_planes_vertex>
  9234. #include <fog_vertex>
  9235. }`,DIe=`uniform vec3 diffuse;
  9236. uniform float opacity;
  9237. uniform float dashSize;
  9238. uniform float totalSize;
  9239. varying float vLineDistance;
  9240. #include <common>
  9241. #include <color_pars_fragment>
  9242. #include <uv_pars_fragment>
  9243. #include <map_pars_fragment>
  9244. #include <fog_pars_fragment>
  9245. #include <logdepthbuf_pars_fragment>
  9246. #include <clipping_planes_pars_fragment>
  9247. void main() {
  9248. vec4 diffuseColor = vec4( diffuse, opacity );
  9249. #include <clipping_planes_fragment>
  9250. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  9251. discard;
  9252. }
  9253. vec3 outgoingLight = vec3( 0.0 );
  9254. #include <logdepthbuf_fragment>
  9255. #include <map_fragment>
  9256. #include <color_fragment>
  9257. outgoingLight = diffuseColor.rgb;
  9258. #include <opaque_fragment>
  9259. #include <tonemapping_fragment>
  9260. #include <colorspace_fragment>
  9261. #include <fog_fragment>
  9262. #include <premultiplied_alpha_fragment>
  9263. }`,IIe=`#include <common>
  9264. #include <batching_pars_vertex>
  9265. #include <uv_pars_vertex>
  9266. #include <envmap_pars_vertex>
  9267. #include <color_pars_vertex>
  9268. #include <fog_pars_vertex>
  9269. #include <morphtarget_pars_vertex>
  9270. #include <skinning_pars_vertex>
  9271. #include <logdepthbuf_pars_vertex>
  9272. #include <clipping_planes_pars_vertex>
  9273. void main() {
  9274. #include <uv_vertex>
  9275. #include <color_vertex>
  9276. #include <morphinstance_vertex>
  9277. #include <morphcolor_vertex>
  9278. #include <batching_vertex>
  9279. #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
  9280. #include <beginnormal_vertex>
  9281. #include <morphnormal_vertex>
  9282. #include <skinbase_vertex>
  9283. #include <skinnormal_vertex>
  9284. #include <defaultnormal_vertex>
  9285. #endif
  9286. #include <begin_vertex>
  9287. #include <morphtarget_vertex>
  9288. #include <skinning_vertex>
  9289. #include <project_vertex>
  9290. #include <logdepthbuf_vertex>
  9291. #include <clipping_planes_vertex>
  9292. #include <worldpos_vertex>
  9293. #include <envmap_vertex>
  9294. #include <fog_vertex>
  9295. }`,NIe=`uniform vec3 diffuse;
  9296. uniform float opacity;
  9297. #ifndef FLAT_SHADED
  9298. varying vec3 vNormal;
  9299. #endif
  9300. #include <common>
  9301. #include <dithering_pars_fragment>
  9302. #include <color_pars_fragment>
  9303. #include <uv_pars_fragment>
  9304. #include <map_pars_fragment>
  9305. #include <alphamap_pars_fragment>
  9306. #include <alphatest_pars_fragment>
  9307. #include <alphahash_pars_fragment>
  9308. #include <aomap_pars_fragment>
  9309. #include <lightmap_pars_fragment>
  9310. #include <envmap_common_pars_fragment>
  9311. #include <envmap_pars_fragment>
  9312. #include <fog_pars_fragment>
  9313. #include <specularmap_pars_fragment>
  9314. #include <logdepthbuf_pars_fragment>
  9315. #include <clipping_planes_pars_fragment>
  9316. void main() {
  9317. vec4 diffuseColor = vec4( diffuse, opacity );
  9318. #include <clipping_planes_fragment>
  9319. #include <logdepthbuf_fragment>
  9320. #include <map_fragment>
  9321. #include <color_fragment>
  9322. #include <alphamap_fragment>
  9323. #include <alphatest_fragment>
  9324. #include <alphahash_fragment>
  9325. #include <specularmap_fragment>
  9326. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9327. #ifdef USE_LIGHTMAP
  9328. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  9329. reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
  9330. #else
  9331. reflectedLight.indirectDiffuse += vec3( 1.0 );
  9332. #endif
  9333. #include <aomap_fragment>
  9334. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  9335. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  9336. #include <envmap_fragment>
  9337. #include <opaque_fragment>
  9338. #include <tonemapping_fragment>
  9339. #include <colorspace_fragment>
  9340. #include <fog_fragment>
  9341. #include <premultiplied_alpha_fragment>
  9342. #include <dithering_fragment>
  9343. }`,UIe=`#define LAMBERT
  9344. varying vec3 vViewPosition;
  9345. #include <common>
  9346. #include <batching_pars_vertex>
  9347. #include <uv_pars_vertex>
  9348. #include <displacementmap_pars_vertex>
  9349. #include <envmap_pars_vertex>
  9350. #include <color_pars_vertex>
  9351. #include <fog_pars_vertex>
  9352. #include <normal_pars_vertex>
  9353. #include <morphtarget_pars_vertex>
  9354. #include <skinning_pars_vertex>
  9355. #include <shadowmap_pars_vertex>
  9356. #include <logdepthbuf_pars_vertex>
  9357. #include <clipping_planes_pars_vertex>
  9358. void main() {
  9359. #include <uv_vertex>
  9360. #include <color_vertex>
  9361. #include <morphinstance_vertex>
  9362. #include <morphcolor_vertex>
  9363. #include <batching_vertex>
  9364. #include <beginnormal_vertex>
  9365. #include <morphnormal_vertex>
  9366. #include <skinbase_vertex>
  9367. #include <skinnormal_vertex>
  9368. #include <defaultnormal_vertex>
  9369. #include <normal_vertex>
  9370. #include <begin_vertex>
  9371. #include <morphtarget_vertex>
  9372. #include <skinning_vertex>
  9373. #include <displacementmap_vertex>
  9374. #include <project_vertex>
  9375. #include <logdepthbuf_vertex>
  9376. #include <clipping_planes_vertex>
  9377. vViewPosition = - mvPosition.xyz;
  9378. #include <worldpos_vertex>
  9379. #include <envmap_vertex>
  9380. #include <shadowmap_vertex>
  9381. #include <fog_vertex>
  9382. }`,OIe=`#define LAMBERT
  9383. uniform vec3 diffuse;
  9384. uniform vec3 emissive;
  9385. uniform float opacity;
  9386. #include <common>
  9387. #include <packing>
  9388. #include <dithering_pars_fragment>
  9389. #include <color_pars_fragment>
  9390. #include <uv_pars_fragment>
  9391. #include <map_pars_fragment>
  9392. #include <alphamap_pars_fragment>
  9393. #include <alphatest_pars_fragment>
  9394. #include <alphahash_pars_fragment>
  9395. #include <aomap_pars_fragment>
  9396. #include <lightmap_pars_fragment>
  9397. #include <emissivemap_pars_fragment>
  9398. #include <envmap_common_pars_fragment>
  9399. #include <envmap_pars_fragment>
  9400. #include <fog_pars_fragment>
  9401. #include <bsdfs>
  9402. #include <lights_pars_begin>
  9403. #include <normal_pars_fragment>
  9404. #include <lights_lambert_pars_fragment>
  9405. #include <shadowmap_pars_fragment>
  9406. #include <bumpmap_pars_fragment>
  9407. #include <normalmap_pars_fragment>
  9408. #include <specularmap_pars_fragment>
  9409. #include <logdepthbuf_pars_fragment>
  9410. #include <clipping_planes_pars_fragment>
  9411. void main() {
  9412. vec4 diffuseColor = vec4( diffuse, opacity );
  9413. #include <clipping_planes_fragment>
  9414. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9415. vec3 totalEmissiveRadiance = emissive;
  9416. #include <logdepthbuf_fragment>
  9417. #include <map_fragment>
  9418. #include <color_fragment>
  9419. #include <alphamap_fragment>
  9420. #include <alphatest_fragment>
  9421. #include <alphahash_fragment>
  9422. #include <specularmap_fragment>
  9423. #include <normal_fragment_begin>
  9424. #include <normal_fragment_maps>
  9425. #include <emissivemap_fragment>
  9426. #include <lights_lambert_fragment>
  9427. #include <lights_fragment_begin>
  9428. #include <lights_fragment_maps>
  9429. #include <lights_fragment_end>
  9430. #include <aomap_fragment>
  9431. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  9432. #include <envmap_fragment>
  9433. #include <opaque_fragment>
  9434. #include <tonemapping_fragment>
  9435. #include <colorspace_fragment>
  9436. #include <fog_fragment>
  9437. #include <premultiplied_alpha_fragment>
  9438. #include <dithering_fragment>
  9439. }`,FIe=`#define MATCAP
  9440. varying vec3 vViewPosition;
  9441. #include <common>
  9442. #include <batching_pars_vertex>
  9443. #include <uv_pars_vertex>
  9444. #include <color_pars_vertex>
  9445. #include <displacementmap_pars_vertex>
  9446. #include <fog_pars_vertex>
  9447. #include <normal_pars_vertex>
  9448. #include <morphtarget_pars_vertex>
  9449. #include <skinning_pars_vertex>
  9450. #include <logdepthbuf_pars_vertex>
  9451. #include <clipping_planes_pars_vertex>
  9452. void main() {
  9453. #include <uv_vertex>
  9454. #include <color_vertex>
  9455. #include <morphinstance_vertex>
  9456. #include <morphcolor_vertex>
  9457. #include <batching_vertex>
  9458. #include <beginnormal_vertex>
  9459. #include <morphnormal_vertex>
  9460. #include <skinbase_vertex>
  9461. #include <skinnormal_vertex>
  9462. #include <defaultnormal_vertex>
  9463. #include <normal_vertex>
  9464. #include <begin_vertex>
  9465. #include <morphtarget_vertex>
  9466. #include <skinning_vertex>
  9467. #include <displacementmap_vertex>
  9468. #include <project_vertex>
  9469. #include <logdepthbuf_vertex>
  9470. #include <clipping_planes_vertex>
  9471. #include <fog_vertex>
  9472. vViewPosition = - mvPosition.xyz;
  9473. }`,zIe=`#define MATCAP
  9474. uniform vec3 diffuse;
  9475. uniform float opacity;
  9476. uniform sampler2D matcap;
  9477. varying vec3 vViewPosition;
  9478. #include <common>
  9479. #include <dithering_pars_fragment>
  9480. #include <color_pars_fragment>
  9481. #include <uv_pars_fragment>
  9482. #include <map_pars_fragment>
  9483. #include <alphamap_pars_fragment>
  9484. #include <alphatest_pars_fragment>
  9485. #include <alphahash_pars_fragment>
  9486. #include <fog_pars_fragment>
  9487. #include <normal_pars_fragment>
  9488. #include <bumpmap_pars_fragment>
  9489. #include <normalmap_pars_fragment>
  9490. #include <logdepthbuf_pars_fragment>
  9491. #include <clipping_planes_pars_fragment>
  9492. void main() {
  9493. vec4 diffuseColor = vec4( diffuse, opacity );
  9494. #include <clipping_planes_fragment>
  9495. #include <logdepthbuf_fragment>
  9496. #include <map_fragment>
  9497. #include <color_fragment>
  9498. #include <alphamap_fragment>
  9499. #include <alphatest_fragment>
  9500. #include <alphahash_fragment>
  9501. #include <normal_fragment_begin>
  9502. #include <normal_fragment_maps>
  9503. vec3 viewDir = normalize( vViewPosition );
  9504. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  9505. vec3 y = cross( viewDir, x );
  9506. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
  9507. #ifdef USE_MATCAP
  9508. vec4 matcapColor = texture2D( matcap, uv );
  9509. #else
  9510. vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
  9511. #endif
  9512. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  9513. #include <opaque_fragment>
  9514. #include <tonemapping_fragment>
  9515. #include <colorspace_fragment>
  9516. #include <fog_fragment>
  9517. #include <premultiplied_alpha_fragment>
  9518. #include <dithering_fragment>
  9519. }`,BIe=`#define NORMAL
  9520. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  9521. varying vec3 vViewPosition;
  9522. #endif
  9523. #include <common>
  9524. #include <batching_pars_vertex>
  9525. #include <uv_pars_vertex>
  9526. #include <displacementmap_pars_vertex>
  9527. #include <normal_pars_vertex>
  9528. #include <morphtarget_pars_vertex>
  9529. #include <skinning_pars_vertex>
  9530. #include <logdepthbuf_pars_vertex>
  9531. #include <clipping_planes_pars_vertex>
  9532. void main() {
  9533. #include <uv_vertex>
  9534. #include <batching_vertex>
  9535. #include <beginnormal_vertex>
  9536. #include <morphinstance_vertex>
  9537. #include <morphnormal_vertex>
  9538. #include <skinbase_vertex>
  9539. #include <skinnormal_vertex>
  9540. #include <defaultnormal_vertex>
  9541. #include <normal_vertex>
  9542. #include <begin_vertex>
  9543. #include <morphtarget_vertex>
  9544. #include <skinning_vertex>
  9545. #include <displacementmap_vertex>
  9546. #include <project_vertex>
  9547. #include <logdepthbuf_vertex>
  9548. #include <clipping_planes_vertex>
  9549. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  9550. vViewPosition = - mvPosition.xyz;
  9551. #endif
  9552. }`,kIe=`#define NORMAL
  9553. uniform float opacity;
  9554. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  9555. varying vec3 vViewPosition;
  9556. #endif
  9557. #include <packing>
  9558. #include <uv_pars_fragment>
  9559. #include <normal_pars_fragment>
  9560. #include <bumpmap_pars_fragment>
  9561. #include <normalmap_pars_fragment>
  9562. #include <logdepthbuf_pars_fragment>
  9563. #include <clipping_planes_pars_fragment>
  9564. void main() {
  9565. vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
  9566. #include <clipping_planes_fragment>
  9567. #include <logdepthbuf_fragment>
  9568. #include <normal_fragment_begin>
  9569. #include <normal_fragment_maps>
  9570. gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
  9571. #ifdef OPAQUE
  9572. gl_FragColor.a = 1.0;
  9573. #endif
  9574. }`,VIe=`#define PHONG
  9575. varying vec3 vViewPosition;
  9576. #include <common>
  9577. #include <batching_pars_vertex>
  9578. #include <uv_pars_vertex>
  9579. #include <displacementmap_pars_vertex>
  9580. #include <envmap_pars_vertex>
  9581. #include <color_pars_vertex>
  9582. #include <fog_pars_vertex>
  9583. #include <normal_pars_vertex>
  9584. #include <morphtarget_pars_vertex>
  9585. #include <skinning_pars_vertex>
  9586. #include <shadowmap_pars_vertex>
  9587. #include <logdepthbuf_pars_vertex>
  9588. #include <clipping_planes_pars_vertex>
  9589. void main() {
  9590. #include <uv_vertex>
  9591. #include <color_vertex>
  9592. #include <morphcolor_vertex>
  9593. #include <batching_vertex>
  9594. #include <beginnormal_vertex>
  9595. #include <morphinstance_vertex>
  9596. #include <morphnormal_vertex>
  9597. #include <skinbase_vertex>
  9598. #include <skinnormal_vertex>
  9599. #include <defaultnormal_vertex>
  9600. #include <normal_vertex>
  9601. #include <begin_vertex>
  9602. #include <morphtarget_vertex>
  9603. #include <skinning_vertex>
  9604. #include <displacementmap_vertex>
  9605. #include <project_vertex>
  9606. #include <logdepthbuf_vertex>
  9607. #include <clipping_planes_vertex>
  9608. vViewPosition = - mvPosition.xyz;
  9609. #include <worldpos_vertex>
  9610. #include <envmap_vertex>
  9611. #include <shadowmap_vertex>
  9612. #include <fog_vertex>
  9613. }`,GIe=`#define PHONG
  9614. uniform vec3 diffuse;
  9615. uniform vec3 emissive;
  9616. uniform vec3 specular;
  9617. uniform float shininess;
  9618. uniform float opacity;
  9619. #include <common>
  9620. #include <packing>
  9621. #include <dithering_pars_fragment>
  9622. #include <color_pars_fragment>
  9623. #include <uv_pars_fragment>
  9624. #include <map_pars_fragment>
  9625. #include <alphamap_pars_fragment>
  9626. #include <alphatest_pars_fragment>
  9627. #include <alphahash_pars_fragment>
  9628. #include <aomap_pars_fragment>
  9629. #include <lightmap_pars_fragment>
  9630. #include <emissivemap_pars_fragment>
  9631. #include <envmap_common_pars_fragment>
  9632. #include <envmap_pars_fragment>
  9633. #include <fog_pars_fragment>
  9634. #include <bsdfs>
  9635. #include <lights_pars_begin>
  9636. #include <normal_pars_fragment>
  9637. #include <lights_phong_pars_fragment>
  9638. #include <shadowmap_pars_fragment>
  9639. #include <bumpmap_pars_fragment>
  9640. #include <normalmap_pars_fragment>
  9641. #include <specularmap_pars_fragment>
  9642. #include <logdepthbuf_pars_fragment>
  9643. #include <clipping_planes_pars_fragment>
  9644. void main() {
  9645. vec4 diffuseColor = vec4( diffuse, opacity );
  9646. #include <clipping_planes_fragment>
  9647. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9648. vec3 totalEmissiveRadiance = emissive;
  9649. #include <logdepthbuf_fragment>
  9650. #include <map_fragment>
  9651. #include <color_fragment>
  9652. #include <alphamap_fragment>
  9653. #include <alphatest_fragment>
  9654. #include <alphahash_fragment>
  9655. #include <specularmap_fragment>
  9656. #include <normal_fragment_begin>
  9657. #include <normal_fragment_maps>
  9658. #include <emissivemap_fragment>
  9659. #include <lights_phong_fragment>
  9660. #include <lights_fragment_begin>
  9661. #include <lights_fragment_maps>
  9662. #include <lights_fragment_end>
  9663. #include <aomap_fragment>
  9664. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  9665. #include <envmap_fragment>
  9666. #include <opaque_fragment>
  9667. #include <tonemapping_fragment>
  9668. #include <colorspace_fragment>
  9669. #include <fog_fragment>
  9670. #include <premultiplied_alpha_fragment>
  9671. #include <dithering_fragment>
  9672. }`,HIe=`#define STANDARD
  9673. varying vec3 vViewPosition;
  9674. #ifdef USE_TRANSMISSION
  9675. varying vec3 vWorldPosition;
  9676. #endif
  9677. #include <common>
  9678. #include <batching_pars_vertex>
  9679. #include <uv_pars_vertex>
  9680. #include <displacementmap_pars_vertex>
  9681. #include <color_pars_vertex>
  9682. #include <fog_pars_vertex>
  9683. #include <normal_pars_vertex>
  9684. #include <morphtarget_pars_vertex>
  9685. #include <skinning_pars_vertex>
  9686. #include <shadowmap_pars_vertex>
  9687. #include <logdepthbuf_pars_vertex>
  9688. #include <clipping_planes_pars_vertex>
  9689. void main() {
  9690. #include <uv_vertex>
  9691. #include <color_vertex>
  9692. #include <morphinstance_vertex>
  9693. #include <morphcolor_vertex>
  9694. #include <batching_vertex>
  9695. #include <beginnormal_vertex>
  9696. #include <morphnormal_vertex>
  9697. #include <skinbase_vertex>
  9698. #include <skinnormal_vertex>
  9699. #include <defaultnormal_vertex>
  9700. #include <normal_vertex>
  9701. #include <begin_vertex>
  9702. #include <morphtarget_vertex>
  9703. #include <skinning_vertex>
  9704. #include <displacementmap_vertex>
  9705. #include <project_vertex>
  9706. #include <logdepthbuf_vertex>
  9707. #include <clipping_planes_vertex>
  9708. vViewPosition = - mvPosition.xyz;
  9709. #include <worldpos_vertex>
  9710. #include <shadowmap_vertex>
  9711. #include <fog_vertex>
  9712. #ifdef USE_TRANSMISSION
  9713. vWorldPosition = worldPosition.xyz;
  9714. #endif
  9715. }`,WIe=`#define STANDARD
  9716. #ifdef PHYSICAL
  9717. #define IOR
  9718. #define USE_SPECULAR
  9719. #endif
  9720. uniform vec3 diffuse;
  9721. uniform vec3 emissive;
  9722. uniform float roughness;
  9723. uniform float metalness;
  9724. uniform float opacity;
  9725. #ifdef IOR
  9726. uniform float ior;
  9727. #endif
  9728. #ifdef USE_SPECULAR
  9729. uniform float specularIntensity;
  9730. uniform vec3 specularColor;
  9731. #ifdef USE_SPECULAR_COLORMAP
  9732. uniform sampler2D specularColorMap;
  9733. #endif
  9734. #ifdef USE_SPECULAR_INTENSITYMAP
  9735. uniform sampler2D specularIntensityMap;
  9736. #endif
  9737. #endif
  9738. #ifdef USE_CLEARCOAT
  9739. uniform float clearcoat;
  9740. uniform float clearcoatRoughness;
  9741. #endif
  9742. #ifdef USE_IRIDESCENCE
  9743. uniform float iridescence;
  9744. uniform float iridescenceIOR;
  9745. uniform float iridescenceThicknessMinimum;
  9746. uniform float iridescenceThicknessMaximum;
  9747. #endif
  9748. #ifdef USE_SHEEN
  9749. uniform vec3 sheenColor;
  9750. uniform float sheenRoughness;
  9751. #ifdef USE_SHEEN_COLORMAP
  9752. uniform sampler2D sheenColorMap;
  9753. #endif
  9754. #ifdef USE_SHEEN_ROUGHNESSMAP
  9755. uniform sampler2D sheenRoughnessMap;
  9756. #endif
  9757. #endif
  9758. #ifdef USE_ANISOTROPY
  9759. uniform vec2 anisotropyVector;
  9760. #ifdef USE_ANISOTROPYMAP
  9761. uniform sampler2D anisotropyMap;
  9762. #endif
  9763. #endif
  9764. varying vec3 vViewPosition;
  9765. #include <common>
  9766. #include <packing>
  9767. #include <dithering_pars_fragment>
  9768. #include <color_pars_fragment>
  9769. #include <uv_pars_fragment>
  9770. #include <map_pars_fragment>
  9771. #include <alphamap_pars_fragment>
  9772. #include <alphatest_pars_fragment>
  9773. #include <alphahash_pars_fragment>
  9774. #include <aomap_pars_fragment>
  9775. #include <lightmap_pars_fragment>
  9776. #include <emissivemap_pars_fragment>
  9777. #include <iridescence_fragment>
  9778. #include <cube_uv_reflection_fragment>
  9779. #include <envmap_common_pars_fragment>
  9780. #include <envmap_physical_pars_fragment>
  9781. #include <fog_pars_fragment>
  9782. #include <lights_pars_begin>
  9783. #include <normal_pars_fragment>
  9784. #include <lights_physical_pars_fragment>
  9785. #include <transmission_pars_fragment>
  9786. #include <shadowmap_pars_fragment>
  9787. #include <bumpmap_pars_fragment>
  9788. #include <normalmap_pars_fragment>
  9789. #include <clearcoat_pars_fragment>
  9790. #include <iridescence_pars_fragment>
  9791. #include <roughnessmap_pars_fragment>
  9792. #include <metalnessmap_pars_fragment>
  9793. #include <logdepthbuf_pars_fragment>
  9794. #include <clipping_planes_pars_fragment>
  9795. void main() {
  9796. vec4 diffuseColor = vec4( diffuse, opacity );
  9797. #include <clipping_planes_fragment>
  9798. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9799. vec3 totalEmissiveRadiance = emissive;
  9800. #include <logdepthbuf_fragment>
  9801. #include <map_fragment>
  9802. #include <color_fragment>
  9803. #include <alphamap_fragment>
  9804. #include <alphatest_fragment>
  9805. #include <alphahash_fragment>
  9806. #include <roughnessmap_fragment>
  9807. #include <metalnessmap_fragment>
  9808. #include <normal_fragment_begin>
  9809. #include <normal_fragment_maps>
  9810. #include <clearcoat_normal_fragment_begin>
  9811. #include <clearcoat_normal_fragment_maps>
  9812. #include <emissivemap_fragment>
  9813. #include <lights_physical_fragment>
  9814. #include <lights_fragment_begin>
  9815. #include <lights_fragment_maps>
  9816. #include <lights_fragment_end>
  9817. #include <aomap_fragment>
  9818. vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
  9819. vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
  9820. #include <transmission_fragment>
  9821. vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
  9822. #ifdef USE_SHEEN
  9823. float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
  9824. outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
  9825. #endif
  9826. #ifdef USE_CLEARCOAT
  9827. float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
  9828. vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
  9829. outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
  9830. #endif
  9831. #include <opaque_fragment>
  9832. #include <tonemapping_fragment>
  9833. #include <colorspace_fragment>
  9834. #include <fog_fragment>
  9835. #include <premultiplied_alpha_fragment>
  9836. #include <dithering_fragment>
  9837. }`,XIe=`#define TOON
  9838. varying vec3 vViewPosition;
  9839. #include <common>
  9840. #include <batching_pars_vertex>
  9841. #include <uv_pars_vertex>
  9842. #include <displacementmap_pars_vertex>
  9843. #include <color_pars_vertex>
  9844. #include <fog_pars_vertex>
  9845. #include <normal_pars_vertex>
  9846. #include <morphtarget_pars_vertex>
  9847. #include <skinning_pars_vertex>
  9848. #include <shadowmap_pars_vertex>
  9849. #include <logdepthbuf_pars_vertex>
  9850. #include <clipping_planes_pars_vertex>
  9851. void main() {
  9852. #include <uv_vertex>
  9853. #include <color_vertex>
  9854. #include <morphinstance_vertex>
  9855. #include <morphcolor_vertex>
  9856. #include <batching_vertex>
  9857. #include <beginnormal_vertex>
  9858. #include <morphnormal_vertex>
  9859. #include <skinbase_vertex>
  9860. #include <skinnormal_vertex>
  9861. #include <defaultnormal_vertex>
  9862. #include <normal_vertex>
  9863. #include <begin_vertex>
  9864. #include <morphtarget_vertex>
  9865. #include <skinning_vertex>
  9866. #include <displacementmap_vertex>
  9867. #include <project_vertex>
  9868. #include <logdepthbuf_vertex>
  9869. #include <clipping_planes_vertex>
  9870. vViewPosition = - mvPosition.xyz;
  9871. #include <worldpos_vertex>
  9872. #include <shadowmap_vertex>
  9873. #include <fog_vertex>
  9874. }`,YIe=`#define TOON
  9875. uniform vec3 diffuse;
  9876. uniform vec3 emissive;
  9877. uniform float opacity;
  9878. #include <common>
  9879. #include <packing>
  9880. #include <dithering_pars_fragment>
  9881. #include <color_pars_fragment>
  9882. #include <uv_pars_fragment>
  9883. #include <map_pars_fragment>
  9884. #include <alphamap_pars_fragment>
  9885. #include <alphatest_pars_fragment>
  9886. #include <alphahash_pars_fragment>
  9887. #include <aomap_pars_fragment>
  9888. #include <lightmap_pars_fragment>
  9889. #include <emissivemap_pars_fragment>
  9890. #include <gradientmap_pars_fragment>
  9891. #include <fog_pars_fragment>
  9892. #include <bsdfs>
  9893. #include <lights_pars_begin>
  9894. #include <normal_pars_fragment>
  9895. #include <lights_toon_pars_fragment>
  9896. #include <shadowmap_pars_fragment>
  9897. #include <bumpmap_pars_fragment>
  9898. #include <normalmap_pars_fragment>
  9899. #include <logdepthbuf_pars_fragment>
  9900. #include <clipping_planes_pars_fragment>
  9901. void main() {
  9902. vec4 diffuseColor = vec4( diffuse, opacity );
  9903. #include <clipping_planes_fragment>
  9904. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  9905. vec3 totalEmissiveRadiance = emissive;
  9906. #include <logdepthbuf_fragment>
  9907. #include <map_fragment>
  9908. #include <color_fragment>
  9909. #include <alphamap_fragment>
  9910. #include <alphatest_fragment>
  9911. #include <alphahash_fragment>
  9912. #include <normal_fragment_begin>
  9913. #include <normal_fragment_maps>
  9914. #include <emissivemap_fragment>
  9915. #include <lights_toon_fragment>
  9916. #include <lights_fragment_begin>
  9917. #include <lights_fragment_maps>
  9918. #include <lights_fragment_end>
  9919. #include <aomap_fragment>
  9920. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  9921. #include <opaque_fragment>
  9922. #include <tonemapping_fragment>
  9923. #include <colorspace_fragment>
  9924. #include <fog_fragment>
  9925. #include <premultiplied_alpha_fragment>
  9926. #include <dithering_fragment>
  9927. }`,qIe=`uniform float size;
  9928. uniform float scale;
  9929. #include <common>
  9930. #include <color_pars_vertex>
  9931. #include <fog_pars_vertex>
  9932. #include <morphtarget_pars_vertex>
  9933. #include <logdepthbuf_pars_vertex>
  9934. #include <clipping_planes_pars_vertex>
  9935. #ifdef USE_POINTS_UV
  9936. varying vec2 vUv;
  9937. uniform mat3 uvTransform;
  9938. #endif
  9939. void main() {
  9940. #ifdef USE_POINTS_UV
  9941. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  9942. #endif
  9943. #include <color_vertex>
  9944. #include <morphinstance_vertex>
  9945. #include <morphcolor_vertex>
  9946. #include <begin_vertex>
  9947. #include <morphtarget_vertex>
  9948. #include <project_vertex>
  9949. gl_PointSize = size;
  9950. #ifdef USE_SIZEATTENUATION
  9951. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  9952. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  9953. #endif
  9954. #include <logdepthbuf_vertex>
  9955. #include <clipping_planes_vertex>
  9956. #include <worldpos_vertex>
  9957. #include <fog_vertex>
  9958. }`,ZIe=`uniform vec3 diffuse;
  9959. uniform float opacity;
  9960. #include <common>
  9961. #include <color_pars_fragment>
  9962. #include <map_particle_pars_fragment>
  9963. #include <alphatest_pars_fragment>
  9964. #include <alphahash_pars_fragment>
  9965. #include <fog_pars_fragment>
  9966. #include <logdepthbuf_pars_fragment>
  9967. #include <clipping_planes_pars_fragment>
  9968. void main() {
  9969. vec4 diffuseColor = vec4( diffuse, opacity );
  9970. #include <clipping_planes_fragment>
  9971. vec3 outgoingLight = vec3( 0.0 );
  9972. #include <logdepthbuf_fragment>
  9973. #include <map_particle_fragment>
  9974. #include <color_fragment>
  9975. #include <alphatest_fragment>
  9976. #include <alphahash_fragment>
  9977. outgoingLight = diffuseColor.rgb;
  9978. #include <opaque_fragment>
  9979. #include <tonemapping_fragment>
  9980. #include <colorspace_fragment>
  9981. #include <fog_fragment>
  9982. #include <premultiplied_alpha_fragment>
  9983. }`,jIe=`#include <common>
  9984. #include <batching_pars_vertex>
  9985. #include <fog_pars_vertex>
  9986. #include <morphtarget_pars_vertex>
  9987. #include <skinning_pars_vertex>
  9988. #include <logdepthbuf_pars_vertex>
  9989. #include <shadowmap_pars_vertex>
  9990. void main() {
  9991. #include <batching_vertex>
  9992. #include <beginnormal_vertex>
  9993. #include <morphinstance_vertex>
  9994. #include <morphnormal_vertex>
  9995. #include <skinbase_vertex>
  9996. #include <skinnormal_vertex>
  9997. #include <defaultnormal_vertex>
  9998. #include <begin_vertex>
  9999. #include <morphtarget_vertex>
  10000. #include <skinning_vertex>
  10001. #include <project_vertex>
  10002. #include <logdepthbuf_vertex>
  10003. #include <worldpos_vertex>
  10004. #include <shadowmap_vertex>
  10005. #include <fog_vertex>
  10006. }`,KIe=`uniform vec3 color;
  10007. uniform float opacity;
  10008. #include <common>
  10009. #include <packing>
  10010. #include <fog_pars_fragment>
  10011. #include <bsdfs>
  10012. #include <lights_pars_begin>
  10013. #include <logdepthbuf_pars_fragment>
  10014. #include <shadowmap_pars_fragment>
  10015. #include <shadowmask_pars_fragment>
  10016. void main() {
  10017. #include <logdepthbuf_fragment>
  10018. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  10019. #include <tonemapping_fragment>
  10020. #include <colorspace_fragment>
  10021. #include <fog_fragment>
  10022. }`,JIe=`uniform float rotation;
  10023. uniform vec2 center;
  10024. #include <common>
  10025. #include <uv_pars_vertex>
  10026. #include <fog_pars_vertex>
  10027. #include <logdepthbuf_pars_vertex>
  10028. #include <clipping_planes_pars_vertex>
  10029. void main() {
  10030. #include <uv_vertex>
  10031. vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
  10032. vec2 scale;
  10033. scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
  10034. scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
  10035. #ifndef USE_SIZEATTENUATION
  10036. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  10037. if ( isPerspective ) scale *= - mvPosition.z;
  10038. #endif
  10039. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  10040. vec2 rotatedPosition;
  10041. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  10042. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  10043. mvPosition.xy += rotatedPosition;
  10044. gl_Position = projectionMatrix * mvPosition;
  10045. #include <logdepthbuf_vertex>
  10046. #include <clipping_planes_vertex>
  10047. #include <fog_vertex>
  10048. }`,$Ie=`uniform vec3 diffuse;
  10049. uniform float opacity;
  10050. #include <common>
  10051. #include <uv_pars_fragment>
  10052. #include <map_pars_fragment>
  10053. #include <alphamap_pars_fragment>
  10054. #include <alphatest_pars_fragment>
  10055. #include <alphahash_pars_fragment>
  10056. #include <fog_pars_fragment>
  10057. #include <logdepthbuf_pars_fragment>
  10058. #include <clipping_planes_pars_fragment>
  10059. void main() {
  10060. vec4 diffuseColor = vec4( diffuse, opacity );
  10061. #include <clipping_planes_fragment>
  10062. vec3 outgoingLight = vec3( 0.0 );
  10063. #include <logdepthbuf_fragment>
  10064. #include <map_fragment>
  10065. #include <alphamap_fragment>
  10066. #include <alphatest_fragment>
  10067. #include <alphahash_fragment>
  10068. outgoingLight = diffuseColor.rgb;
  10069. #include <opaque_fragment>
  10070. #include <tonemapping_fragment>
  10071. #include <colorspace_fragment>
  10072. #include <fog_fragment>
  10073. }`,vr={alphahash_fragment:_De,alphahash_pars_fragment:xDe,alphamap_fragment:SDe,alphamap_pars_fragment:MDe,alphatest_fragment:bDe,alphatest_pars_fragment:wDe,aomap_fragment:TDe,aomap_pars_fragment:EDe,batching_pars_vertex:ADe,batching_vertex:CDe,begin_vertex:RDe,beginnormal_vertex:LDe,bsdfs:PDe,iridescence_fragment:DDe,bumpmap_pars_fragment:IDe,clipping_planes_fragment:NDe,clipping_planes_pars_fragment:UDe,clipping_planes_pars_vertex:ODe,clipping_planes_vertex:FDe,color_fragment:zDe,color_pars_fragment:BDe,color_pars_vertex:kDe,color_vertex:VDe,common:GDe,cube_uv_reflection_fragment:HDe,defaultnormal_vertex:WDe,displacementmap_pars_vertex:XDe,displacementmap_vertex:YDe,emissivemap_fragment:qDe,emissivemap_pars_fragment:ZDe,colorspace_fragment:jDe,colorspace_pars_fragment:KDe,envmap_fragment:JDe,envmap_common_pars_fragment:$De,envmap_pars_fragment:QDe,envmap_pars_vertex:e2e,envmap_physical_pars_fragment:h2e,envmap_vertex:t2e,fog_vertex:r2e,fog_pars_vertex:i2e,fog_fragment:n2e,fog_pars_fragment:a2e,gradientmap_pars_fragment:o2e,lightmap_fragment:s2e,lightmap_pars_fragment:l2e,lights_lambert_fragment:u2e,lights_lambert_pars_fragment:c2e,lights_pars_begin:f2e,lights_toon_fragment:p2e,lights_toon_pars_fragment:d2e,lights_phong_fragment:m2e,lights_phong_pars_fragment:v2e,lights_physical_fragment:g2e,lights_physical_pars_fragment:y2e,lights_fragment_begin:_2e,lights_fragment_maps:x2e,lights_fragment_end:S2e,logdepthbuf_fragment:M2e,logdepthbuf_pars_fragment:b2e,logdepthbuf_pars_vertex:w2e,logdepthbuf_vertex:T2e,map_fragment:E2e,map_pars_fragment:A2e,map_particle_fragment:C2e,map_particle_pars_fragment:R2e,metalnessmap_fragment:L2e,metalnessmap_pars_fragment:P2e,morphinstance_vertex:D2e,morphcolor_vertex:I2e,morphnormal_vertex:N2e,morphtarget_pars_vertex:U2e,morphtarget_vertex:O2e,normal_fragment_begin:F2e,normal_fragment_maps:z2e,normal_pars_fragment:B2e,normal_pars_vertex:k2e,normal_vertex:V2e,normalmap_pars_fragment:G2e,clearcoat_normal_fragment_begin:H2e,clearcoat_normal_fragment_maps:W2e,clearcoat_pars_fragment:X2e,iridescence_pars_fragment:Y2e,opaque_fragment:q2e,packing:Z2e,premultiplied_alpha_fragment:j2e,project_vertex:K2e,dithering_fragment:J2e,dithering_pars_fragment:$2e,roughnessmap_fragment:Q2e,roughnessmap_pars_fragment:eIe,shadowmap_pars_fragment:tIe,shadowmap_pars_vertex:rIe,shadowmap_vertex:iIe,shadowmask_pars_fragment:nIe,skinbase_vertex:aIe,skinning_pars_vertex:oIe,skinning_vertex:sIe,skinnormal_vertex:lIe,specularmap_fragment:uIe,specularmap_pars_fragment:cIe,tonemapping_fragment:fIe,tonemapping_pars_fragment:hIe,transmission_fragment:pIe,transmission_pars_fragment:dIe,uv_pars_fragment:mIe,uv_pars_vertex:vIe,uv_vertex:gIe,worldpos_vertex:yIe,background_vert:_Ie,background_frag:xIe,backgroundCube_vert:SIe,backgroundCube_frag:MIe,cube_vert:bIe,cube_frag:wIe,depth_vert:TIe,depth_frag:EIe,distanceRGBA_vert:AIe,distanceRGBA_frag:CIe,equirect_vert:RIe,equirect_frag:LIe,linedashed_vert:PIe,linedashed_frag:DIe,meshbasic_vert:IIe,meshbasic_frag:NIe,meshlambert_vert:UIe,meshlambert_frag:OIe,meshmatcap_vert:FIe,meshmatcap_frag:zIe,meshnormal_vert:BIe,meshnormal_frag:kIe,meshphong_vert:VIe,meshphong_frag:GIe,meshphysical_vert:HIe,meshphysical_frag:WIe,meshtoon_vert:XIe,meshtoon_frag:YIe,points_vert:qIe,points_frag:ZIe,shadow_vert:jIe,shadow_frag:KIe,sprite_vert:JIe,sprite_frag:$Ie},yt={common:{diffuse:{value:new er(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new dr},alphaMap:{value:null},alphaMapTransform:{value:new dr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new dr}},envmap:{envMap:{value:null},envMapRotation:{value:new dr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new dr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new dr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new dr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new dr},normalScale:{value:new yr(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new dr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new dr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new dr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new dr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new er(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new er(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new dr},alphaTest:{value:0},uvTransform:{value:new dr}},sprite:{diffuse:{value:new er(16777215)},opacity:{value:1},center:{value:new yr(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new dr},alphaMap:{value:null},alphaMapTransform:{value:new dr},alphaTest:{value:0}}},fu={basic:{uniforms:Sa([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.fog]),vertexShader:vr.meshbasic_vert,fragmentShader:vr.meshbasic_frag},lambert:{uniforms:Sa([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,yt.lights,{emissive:{value:new er(0)}}]),vertexShader:vr.meshlambert_vert,fragmentShader:vr.meshlambert_frag},phong:{uniforms:Sa([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,yt.lights,{emissive:{value:new er(0)},specular:{value:new er(1118481)},shininess:{value:30}}]),vertexShader:vr.meshphong_vert,fragmentShader:vr.meshphong_frag},standard:{uniforms:Sa([yt.common,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.roughnessmap,yt.metalnessmap,yt.fog,yt.lights,{emissive:{value:new er(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:vr.meshphysical_vert,fragmentShader:vr.meshphysical_frag},toon:{uniforms:Sa([yt.common,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.gradientmap,yt.fog,yt.lights,{emissive:{value:new er(0)}}]),vertexShader:vr.meshtoon_vert,fragmentShader:vr.meshtoon_frag},matcap:{uniforms:Sa([yt.common,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,{matcap:{value:null}}]),vertexShader:vr.meshmatcap_vert,fragmentShader:vr.meshmatcap_frag},points:{uniforms:Sa([yt.points,yt.fog]),vertexShader:vr.points_vert,fragmentShader:vr.points_frag},dashed:{uniforms:Sa([yt.common,yt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vr.linedashed_vert,fragmentShader:vr.linedashed_frag},depth:{uniforms:Sa([yt.common,yt.displacementmap]),vertexShader:vr.depth_vert,fragmentShader:vr.depth_frag},normal:{uniforms:Sa([yt.common,yt.bumpmap,yt.normalmap,yt.displacementmap,{opacity:{value:1}}]),vertexShader:vr.meshnormal_vert,fragmentShader:vr.meshnormal_frag},sprite:{uniforms:Sa([yt.sprite,yt.fog]),vertexShader:vr.sprite_vert,fragmentShader:vr.sprite_frag},background:{uniforms:{uvTransform:{value:new dr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:vr.background_vert,fragmentShader:vr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new dr}},vertexShader:vr.backgroundCube_vert,fragmentShader:vr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:vr.cube_vert,fragmentShader:vr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:vr.equirect_vert,fragmentShader:vr.equirect_frag},distanceRGBA:{uniforms:Sa([yt.common,yt.displacementmap,{referencePosition:{value:new ye},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:vr.distanceRGBA_vert,fragmentShader:vr.distanceRGBA_frag},shadow:{uniforms:Sa([yt.lights,yt.fog,{color:{value:new er(0)},opacity:{value:1}}]),vertexShader:vr.shadow_vert,fragmentShader:vr.shadow_frag}};fu.physical={uniforms:Sa([fu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new dr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new dr},clearcoatNormalScale:{value:new yr(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new dr},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new dr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new dr},sheen:{value:0},sheenColor:{value:new er(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new dr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new dr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new dr},transmissionSamplerSize:{value:new yr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new dr},attenuationDistance:{value:0},attenuationColor:{value:new er(0)},specularColor:{value:new er(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new dr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new dr},anisotropyVector:{value:new yr},anisotropyMap:{value:null},anisotropyMapTransform:{value:new dr}}]),vertexShader:vr.meshphysical_vert,fragmentShader:vr.meshphysical_frag};var qC={r:0,b:0,g:0},om=new Fn,QIe=new Ht;function eNe(r,e,t,i,n,a,o){let s=new er(0),l=a===!0?0:1,u,c,f=null,h=0,p=null;function d(m,v){let _=!1,y=v.isScene===!0?v.background:null;y&&y.isTexture&&(y=(v.backgroundBlurriness>0?t:e).get(y)),y===null?g(s,l):y&&y.isColor&&(g(y,1),_=!0);let x=r.xr.getEnvironmentBlendMode();x==="additive"?i.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(r.autoClear||_)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===UR)?(c===void 0&&(c=new so(new NM(1,1,1),new pu({name:"BackgroundCubeMaterial",uniforms:d0(fu.backgroundCube.uniforms),vertexShader:fu.backgroundCube.vertexShader,fragmentShader:fu.backgroundCube.fragmentShader,side:lo,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(M,S,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),om.copy(v.backgroundRotation),om.x*=-1,om.y*=-1,om.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(om.y*=-1,om.z*=-1),c.material.uniforms.envMap.value=y,c.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(QIe.makeRotationFromEuler(om)),c.material.toneMapped=Jr.getTransfer(y.colorSpace)!==ai,(f!==y||h!==y.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,f=y,h=y.version,p=r.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(u===void 0&&(u=new so(new vR(2,2),new pu({name:"BackgroundMaterial",uniforms:d0(fu.background.uniforms),vertexShader:fu.background.vertexShader,fragmentShader:fu.background.fragmentShader,side:Uh,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(u)),u.material.uniforms.t2D.value=y,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=Jr.getTransfer(y.colorSpace)!==ai,y.matrixAutoUpdate===!0&&y.updateMatrix(),u.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||h!==y.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,f=y,h=y.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null))}function g(m,v){m.getRGB(qC,rse(r)),i.buffers.color.setClear(qC.r,qC.g,qC.b,v,o)}return{getClearColor:function(){return s},setClearColor:function(m,v=1){s.set(m),l=v,g(s,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,g(s,l)},render:d}}function tNe(r,e,t,i){let n=r.getParameter(r.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||a!==null,s={},l=m(null),u=l,c=!1;function f(A,D,U,B,F){let k=!1;if(o){let G=g(B,U,D);u!==G&&(u=G,p(u.object)),k=v(A,B,U,F),k&&_(A,B,U,F)}else{let G=D.wireframe===!0;(u.geometry!==B.id||u.program!==U.id||u.wireframe!==G)&&(u.geometry=B.id,u.program=U.id,u.wireframe=G,k=!0)}F!==null&&t.update(F,r.ELEMENT_ARRAY_BUFFER),(k||c)&&(c=!1,T(A,D,U,B),F!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(F).buffer))}function h(){return i.isWebGL2?r.createVertexArray():a.createVertexArrayOES()}function p(A){return i.isWebGL2?r.bindVertexArray(A):a.bindVertexArrayOES(A)}function d(A){return i.isWebGL2?r.deleteVertexArray(A):a.deleteVertexArrayOES(A)}function g(A,D,U){let B=U.wireframe===!0,F=s[A.id];F===void 0&&(F={},s[A.id]=F);let k=F[D.id];k===void 0&&(k={},F[D.id]=k);let G=k[B];return G===void 0&&(G=m(h()),k[B]=G),G}function m(A){let D=[],U=[],B=[];for(let F=0;F<n;F++)D[F]=0,U[F]=0,B[F]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:D,enabledAttributes:U,attributeDivisors:B,object:A,attributes:{},index:null}}function v(A,D,U,B){let F=u.attributes,k=D.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=F[J],K=k[J];if(K===void 0&&(J==="instanceMatrix"&&A.instanceMatrix&&(K=A.instanceMatrix),J==="instanceColor"&&A.instanceColor&&(K=A.instanceColor)),V===void 0||V.attribute!==K||K&&V.data!==K.data)return!0;G++}return u.attributesNum!==G||u.index!==B}function _(A,D,U,B){let F={},k=D.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=k[J];V===void 0&&(J==="instanceMatrix"&&A.instanceMatrix&&(V=A.instanceMatrix),J==="instanceColor"&&A.instanceColor&&(V=A.instanceColor));let K={};K.attribute=V,V&&V.data&&(K.data=V.data),F[J]=K,G++}u.attributes=F,u.attributesNum=G,u.index=B}function y(){let A=u.newAttributes;for(let D=0,U=A.length;D<U;D++)A[D]=0}function x(A){M(A,0)}function M(A,D){let U=u.newAttributes,B=u.enabledAttributes,F=u.attributeDivisors;U[A]=1,B[A]===0&&(r.enableVertexAttribArray(A),B[A]=1),F[A]!==D&&((i.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](A,D),F[A]=D)}function S(){let A=u.newAttributes,D=u.enabledAttributes;for(let U=0,B=D.length;U<B;U++)D[U]!==A[U]&&(r.disableVertexAttribArray(U),D[U]=0)}function w(A,D,U,B,F,k,G){G===!0?r.vertexAttribIPointer(A,D,U,F,k):r.vertexAttribPointer(A,D,U,B,F,k)}function T(A,D,U,B){if(i.isWebGL2===!1&&(A.isInstancedMesh||B.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();let F=B.attributes,k=U.getAttributes(),G=D.defaultAttributeValues;for(let Y in k){let J=k[Y];if(J.location>=0){let Q=F[Y];if(Q===void 0&&(Y==="instanceMatrix"&&A.instanceMatrix&&(Q=A.instanceMatrix),Y==="instanceColor"&&A.instanceColor&&(Q=A.instanceColor)),Q!==void 0){let V=Q.normalized,K=Q.itemSize,ae=t.get(Q);if(ae===void 0)continue;let ve=ae.buffer,ue=ae.type,se=ae.bytesPerElement,Ee=i.isWebGL2===!0&&(ue===r.INT||ue===r.UNSIGNED_INT||Q.gpuType===Yoe);if(Q.isInterleavedBufferAttribute){let q=Q.data,H=q.stride,We=Q.offset;if(q.isInstancedInterleavedBuffer){for(let _e=0;_e<J.locationSize;_e++)M(J.location+_e,q.meshPerAttribute);A.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=q.meshPerAttribute*q.count)}else for(let _e=0;_e<J.locationSize;_e++)x(J.location+_e);r.bindBuffer(r.ARRAY_BUFFER,ve);for(let _e=0;_e<J.locationSize;_e++)w(J.location+_e,K/J.locationSize,ue,V,H*se,(We+K/J.locationSize*_e)*se,Ee)}else{if(Q.isInstancedBufferAttribute){for(let q=0;q<J.locationSize;q++)M(J.location+q,Q.meshPerAttribute);A.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=Q.meshPerAttribute*Q.count)}else for(let q=0;q<J.locationSize;q++)x(J.location+q);r.bindBuffer(r.ARRAY_BUFFER,ve);for(let q=0;q<J.locationSize;q++)w(J.location+q,K/J.locationSize,ue,V,K*se,K/J.locationSize*q*se,Ee)}}else if(G!==void 0){let V=G[Y];if(V!==void 0)switch(V.length){case 2:r.vertexAttrib2fv(J.location,V);break;case 3:r.vertexAttrib3fv(J.location,V);break;case 4:r.vertexAttrib4fv(J.location,V);break;default:r.vertexAttrib1fv(J.location,V)}}}}S()}function C(){I();for(let A in s){let D=s[A];for(let U in D){let B=D[U];for(let F in B)d(B[F].object),delete B[F];delete D[U]}delete s[A]}}function b(A){if(s[A.id]===void 0)return;let D=s[A.id];for(let U in D){let B=D[U];for(let F in B)d(B[F].object),delete B[F];delete D[U]}delete s[A.id]}function E(A){for(let D in s){let U=s[D];if(U[A.id]===void 0)continue;let B=U[A.id];for(let F in B)d(B[F].object),delete B[F];delete U[A.id]}}function I(){R(),c=!0,u!==l&&(u=l,p(u.object))}function R(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:f,reset:I,resetDefaultState:R,dispose:C,releaseStatesOfGeometry:b,releaseStatesOfProgram:E,initAttributes:y,enableAttribute:x,disableUnusedAttributes:S}}function rNe(r,e,t,i){let n=i.isWebGL2,a;function o(c){a=c}function s(c,f){r.drawArrays(a,c,f),t.update(f,a,1)}function l(c,f,h){if(h===0)return;let p,d;if(n)p=r,d="drawArraysInstanced";else if(p=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",p===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[d](a,c,f,h),t.update(f,a,h)}function u(c,f,h){if(h===0)return;let p=e.get("WEBGL_multi_draw");if(p===null)for(let d=0;d<h;d++)this.render(c[d],f[d]);else{p.multiDrawArraysWEBGL(a,c,0,f,0,h);let d=0;for(let g=0;g<h;g++)d+=f[g];t.update(d,a,1)}}this.setMode=o,this.render=s,this.renderInstances=l,this.renderMultiDraw=u}function iNe(r,e,t){let i;function n(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){let w=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(w){if(w==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext",s=t.precision!==void 0?t.precision:"highp",l=a(s);l!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",l,"instead."),s=l);let u=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),h=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_TEXTURE_SIZE),d=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),m=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),_=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,x=o||e.has("OES_texture_float"),M=y&&x,S=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:n,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:c,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:d,maxAttributes:g,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:_,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:M,maxSamples:S}}function nNe(r){let e=this,t=null,i=0,n=!1,a=!1,o=new gc,s=new dr,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){let p=f.length!==0||h||i!==0||n;return n=h,i=f.length,p},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(f,h){t=c(f,h,0)},this.setState=function(f,h,p){let d=f.clippingPlanes,g=f.clipIntersection,m=f.clipShadows,v=r.get(f);if(!n||d===null||d.length===0||a&&!m)a?c(null):u();else{let _=a?0:i,y=_*4,x=v.clippingState||null;l.value=x,x=c(d,h,y,p);for(let M=0;M!==y;++M)x[M]=t[M];v.clippingState=x,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=_}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(f,h,p,d){let g=f!==null?f.length:0,m=null;if(g!==0){if(m=l.value,d!==!0||m===null){let v=p+g*4,_=h.matrixWorldInverse;s.getNormalMatrix(_),(m===null||m.length<v)&&(m=new Float32Array(v));for(let y=0,x=p;y!==g;++y,x+=4)o.copy(f[y]).applyMatrix4(_,s),o.normal.toArray(m,x),m[x+3]=o.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,m}}function aNe(r){let e=new WeakMap;function t(o,s){return s===LM?o.mapping=l0:s===$B&&(o.mapping=u0),o}function i(o){if(o&&o.isTexture){let s=o.mapping;if(s===LM||s===$B)if(e.has(o)){let l=e.get(o).texture;return t(l,o.mapping)}else{let l=o.image;if(l&&l.height>0){let u=new ak(l.height);return u.fromEquirectangularTexture(r,o),e.set(o,u),o.addEventListener("dispose",n),t(u.texture,o.mapping)}else return null}}return o}function n(o){let s=o.target;s.removeEventListener("dispose",n);let l=e.get(s);l!==void 0&&(e.delete(s),l.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}var m0=class extends dR{constructor(e=-1,t=1,i=1,n=-1,a=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=a,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,a,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,a=i-e,o=i+e,s=n+t,l=n-t;if(this.view!==null&&this.view.enabled){let u=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=u*this.view.offsetX,o=a+u*this.view.width,s-=c*this.view.offsetY,l=s-c*this.view.height}this.projectionMatrix.makeOrthographic(a,o,s,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},r0=4,loe=[.125,.215,.35,.446,.526,.582],cm=20,kB=new m0,uoe=new er,VB=null,GB=0,HB=0,lm=(1+Math.sqrt(5))/2,Qy=1/lm,coe=[new ye(1,1,1),new ye(-1,1,1),new ye(1,1,-1),new ye(-1,1,-1),new ye(0,lm,Qy),new ye(0,lm,-Qy),new ye(Qy,0,lm),new ye(-Qy,0,lm),new ye(lm,Qy,0),new ye(-lm,Qy,0)],gR=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){VB=this._renderer.getRenderTarget(),GB=this._renderer.getActiveCubeFace(),HB=this._renderer.getActiveMipmapLevel(),this._setSize(256);let a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,i,n,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=poe(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=hoe(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(VB,GB,HB),e.scissorTest=!1,ZC(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===l0||e.mapping===u0?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),VB=this._renderer.getRenderTarget(),GB=this._renderer.getActiveCubeFace(),HB=this._renderer.getActiveMipmapLevel();let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:ao,minFilter:ao,generateMipmaps:!1,type:PM,format:As,colorSpace:Hh,depthBuffer:!1},n=foe(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=foe(e,t,i);let{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=oNe(a)),this._blurMaterial=sNe(a,e,t)}return n}_compileMaterial(e){let t=new so(this._lodPlanes[0],e);this._renderer.compile(t,kB)}_sceneToCubeUV(e,t,i,n){let s=new Nn(90,1,t,i),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],c=this._renderer,f=c.autoClear,h=c.toneMapping;c.getClearColor(uoe),c.toneMapping=Ih,c.autoClear=!1;let p=new hR({name:"PMREM.Background",side:lo,depthWrite:!1,depthTest:!1}),d=new so(new NM,p),g=!1,m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,g=!0):(p.color.copy(uoe),g=!0);for(let v=0;v<6;v++){let _=v%3;_===0?(s.up.set(0,l[v],0),s.lookAt(u[v],0,0)):_===1?(s.up.set(0,0,l[v]),s.lookAt(0,u[v],0)):(s.up.set(0,l[v],0),s.lookAt(0,0,u[v]));let y=this._cubeSize;ZC(n,_*y,v>2?y:0,y,y),c.setRenderTarget(n),g&&c.render(d,s),c.render(e,s)}d.geometry.dispose(),d.material.dispose(),c.toneMapping=h,c.autoClear=f,e.background=m}_textureToCubeUV(e,t){let i=this._renderer,n=e.mapping===l0||e.mapping===u0;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=poe()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=hoe());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new so(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let l=this._cubeSize;ZC(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,kB)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let a=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),o=coe[(n-1)%coe.length];this._blur(e,n-1,n,a,o)}t.autoClear=i}_blur(e,t,i,n,a){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,n,"latitudinal",a),this._halfBlur(o,e,i,i,n,"longitudinal",a)}_halfBlur(e,t,i,n,a,o,s){let l=this._renderer,u=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let c=3,f=new so(this._lodPlanes[n],u),h=u.uniforms,p=this._sizeLods[i]-1,d=isFinite(a)?Math.PI/(2*p):2*Math.PI/(2*cm-1),g=a/d,m=isFinite(a)?1+Math.floor(c*g):cm;m>cm&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${cm}`);let v=[],_=0;for(let w=0;w<cm;++w){let T=w/g,C=Math.exp(-T*T/2);v.push(C),w===0?_+=C:w<m&&(_+=2*C)}for(let w=0;w<v.length;w++)v[w]=v[w]/_;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=v,h.latitudinal.value=o==="latitudinal",s&&(h.poleAxis.value=s);let{_lodMax:y}=this;h.dTheta.value=d,h.mipInt.value=y-i;let x=this._sizeLods[n],M=3*x*(n>y-r0?n-y+r0:0),S=4*(this._cubeSize-x);ZC(t,M,S,3*x,2*x),l.setRenderTarget(t),l.render(f,kB)}};function oNe(r){let e=[],t=[],i=[],n=r,a=r-r0+1+loe.length;for(let o=0;o<a;o++){let s=Math.pow(2,n);t.push(s);let l=1/s;o>r-r0?l=loe[o-r+r0-1]:o===0&&(l=0),i.push(l);let u=1/(s-2),c=-u,f=1+u,h=[c,c,f,c,f,f,c,c,f,f,c,f],p=6,d=6,g=3,m=2,v=1,_=new Float32Array(g*d*p),y=new Float32Array(m*d*p),x=new Float32Array(v*d*p);for(let S=0;S<p;S++){let w=S%3*2/3-1,T=S>2?0:-1,C=[w,T,0,w+2/3,T,0,w+2/3,T+1,0,w,T,0,w+2/3,T+1,0,w,T+1,0];_.set(C,g*d*S),y.set(h,m*d*S);let b=[S,S,S,S,S,S];x.set(b,v*d*S)}let M=new Rs;M.setAttribute("position",new Cs(_,g)),M.setAttribute("uv",new Cs(y,m)),M.setAttribute("faceIndex",new Cs(x,v)),e.push(M),n>r0&&n--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function foe(r,e,t){let i=new Sc(r,e,t);return i.texture.mapping=UR,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ZC(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function sNe(r,e,t){let i=new Float32Array(cm),n=new ye(0,1,0);return new pu({name:"SphericalGaussianBlur",defines:{n:cm,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:zk(),fragmentShader:`
  10074. precision mediump float;
  10075. precision mediump int;
  10076. varying vec3 vOutputDirection;
  10077. uniform sampler2D envMap;
  10078. uniform int samples;
  10079. uniform float weights[ n ];
  10080. uniform bool latitudinal;
  10081. uniform float dTheta;
  10082. uniform float mipInt;
  10083. uniform vec3 poleAxis;
  10084. #define ENVMAP_TYPE_CUBE_UV
  10085. #include <cube_uv_reflection_fragment>
  10086. vec3 getSample( float theta, vec3 axis ) {
  10087. float cosTheta = cos( theta );
  10088. // Rodrigues' axis-angle rotation
  10089. vec3 sampleDirection = vOutputDirection * cosTheta
  10090. + cross( axis, vOutputDirection ) * sin( theta )
  10091. + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
  10092. return bilinearCubeUV( envMap, sampleDirection, mipInt );
  10093. }
  10094. void main() {
  10095. vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
  10096. if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
  10097. axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
  10098. }
  10099. axis = normalize( axis );
  10100. gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  10101. gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
  10102. for ( int i = 1; i < n; i++ ) {
  10103. if ( i >= samples ) {
  10104. break;
  10105. }
  10106. float theta = dTheta * float( i );
  10107. gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
  10108. gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
  10109. }
  10110. }
  10111. `,blending:Dh,depthTest:!1,depthWrite:!1})}function hoe(){return new pu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:zk(),fragmentShader:`
  10112. precision mediump float;
  10113. precision mediump int;
  10114. varying vec3 vOutputDirection;
  10115. uniform sampler2D envMap;
  10116. #include <common>
  10117. void main() {
  10118. vec3 outputDirection = normalize( vOutputDirection );
  10119. vec2 uv = equirectUv( outputDirection );
  10120. gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
  10121. }
  10122. `,blending:Dh,depthTest:!1,depthWrite:!1})}function poe(){return new pu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:zk(),fragmentShader:`
  10123. precision mediump float;
  10124. precision mediump int;
  10125. uniform float flipEnvMap;
  10126. varying vec3 vOutputDirection;
  10127. uniform samplerCube envMap;
  10128. void main() {
  10129. gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
  10130. }
  10131. `,blending:Dh,depthTest:!1,depthWrite:!1})}function zk(){return`
  10132. precision mediump float;
  10133. precision mediump int;
  10134. attribute float faceIndex;
  10135. varying vec3 vOutputDirection;
  10136. // RH coordinate system; PMREM face-indexing convention
  10137. vec3 getDirection( vec2 uv, float face ) {
  10138. uv = 2.0 * uv - 1.0;
  10139. vec3 direction = vec3( uv, 1.0 );
  10140. if ( face == 0.0 ) {
  10141. direction = direction.zyx; // ( 1, v, u ) pos x
  10142. } else if ( face == 1.0 ) {
  10143. direction = direction.xzy;
  10144. direction.xz *= -1.0; // ( -u, 1, -v ) pos y
  10145. } else if ( face == 2.0 ) {
  10146. direction.x *= -1.0; // ( -u, v, 1 ) pos z
  10147. } else if ( face == 3.0 ) {
  10148. direction = direction.zyx;
  10149. direction.xz *= -1.0; // ( -1, v, -u ) neg x
  10150. } else if ( face == 4.0 ) {
  10151. direction = direction.xzy;
  10152. direction.xy *= -1.0; // ( -u, -1, v ) neg y
  10153. } else if ( face == 5.0 ) {
  10154. direction.z *= -1.0; // ( u, v, -1 ) neg z
  10155. }
  10156. return direction;
  10157. }
  10158. void main() {
  10159. vOutputDirection = getDirection( uv, faceIndex );
  10160. gl_Position = vec4( position, 1.0 );
  10161. }
  10162. `}function lNe(r){let e=new WeakMap,t=null;function i(s){if(s&&s.isTexture){let l=s.mapping,u=l===LM||l===$B,c=l===l0||l===u0;if(u||c)if(s.isRenderTargetTexture&&s.needsPMREMUpdate===!0){s.needsPMREMUpdate=!1;let f=e.get(s);return t===null&&(t=new gR(r)),f=u?t.fromEquirectangular(s,f):t.fromCubemap(s,f),e.set(s,f),f.texture}else{if(e.has(s))return e.get(s).texture;{let f=s.image;if(u&&f&&f.height>0||c&&f&&n(f)){t===null&&(t=new gR(r));let h=u?t.fromEquirectangular(s):t.fromCubemap(s);return e.set(s,h),s.addEventListener("dispose",a),h.texture}else return null}}}return s}function n(s){let l=0,u=6;for(let c=0;c<u;c++)s[c]!==void 0&&l++;return l===u}function a(s){let l=s.target;l.removeEventListener("dispose",a);let u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function uNe(r){let e={};function t(i){if(e[i]!==void 0)return e[i];let n;switch(i){case"WEBGL_depth_texture":n=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=r.getExtension(i)}return e[i]=n,n}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){let n=t(i);return n===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),n}}}function cNe(r,e,t,i){let n={},a=new WeakMap;function o(f){let h=f.target;h.index!==null&&e.remove(h.index);for(let d in h.attributes)e.remove(h.attributes[d]);for(let d in h.morphAttributes){let g=h.morphAttributes[d];for(let m=0,v=g.length;m<v;m++)e.remove(g[m])}h.removeEventListener("dispose",o),delete n[h.id];let p=a.get(h);p&&(e.remove(p),a.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function s(f,h){return n[h.id]===!0||(h.addEventListener("dispose",o),n[h.id]=!0,t.memory.geometries++),h}function l(f){let h=f.attributes;for(let d in h)e.update(h[d],r.ARRAY_BUFFER);let p=f.morphAttributes;for(let d in p){let g=p[d];for(let m=0,v=g.length;m<v;m++)e.update(g[m],r.ARRAY_BUFFER)}}function u(f){let h=[],p=f.index,d=f.attributes.position,g=0;if(p!==null){let _=p.array;g=p.version;for(let y=0,x=_.length;y<x;y+=3){let M=_[y+0],S=_[y+1],w=_[y+2];h.push(M,S,S,w,w,M)}}else if(d!==void 0){let _=d.array;g=d.version;for(let y=0,x=_.length/3-1;y<x;y+=3){let M=y+0,S=y+1,w=y+2;h.push(M,S,S,w,w,M)}}else return;let m=new(ese(h)?pR:p0)(h,1);m.version=g;let v=a.get(f);v&&e.remove(v),a.set(f,m)}function c(f){let h=a.get(f);if(h){let p=f.index;p!==null&&h.version<p.version&&u(f)}else u(f);return a.get(f)}return{get:s,update:l,getWireframeAttribute:c}}function fNe(r,e,t,i){let n=i.isWebGL2,a;function o(p){a=p}let s,l;function u(p){s=p.type,l=p.bytesPerElement}function c(p,d){r.drawElements(a,d,s,p*l),t.update(d,a,1)}function f(p,d,g){if(g===0)return;let m,v;if(n)m=r,v="drawElementsInstanced";else if(m=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[v](a,d,s,p*l,g),t.update(d,a,g)}function h(p,d,g){if(g===0)return;let m=e.get("WEBGL_multi_draw");if(m===null)for(let v=0;v<g;v++)this.render(p[v]/l,d[v]);else{m.multiDrawElementsWEBGL(a,d,0,s,p,0,g);let v=0;for(let _=0;_<g;_++)v+=d[_];t.update(v,a,1)}}this.setMode=o,this.setIndex=u,this.render=c,this.renderInstances=f,this.renderMultiDraw=h}function hNe(r){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,o,s){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=s*(a/3);break;case r.LINES:t.lines+=s*(a/2);break;case r.LINE_STRIP:t.lines+=s*(a-1);break;case r.LINE_LOOP:t.lines+=s*a;break;case r.POINTS:t.points+=s*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function n(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:n,update:i}}function pNe(r,e){return r[0]-e[0]}function dNe(r,e){return Math.abs(e[1])-Math.abs(r[1])}function mNe(r,e,t){let i={},n=new Float32Array(8),a=new WeakMap,o=new Pr,s=[];for(let u=0;u<8;u++)s[u]=[u,0];function l(u,c,f){let h=u.morphTargetInfluences;if(e.isWebGL2===!0){let d=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,g=d!==void 0?d.length:0,m=a.get(c);if(m===void 0||m.count!==g){let R=function(){E.dispose(),a.delete(c),c.removeEventListener("dispose",R)};var p=R;m!==void 0&&m.texture.dispose();let v=c.morphAttributes.position!==void 0,_=c.morphAttributes.normal!==void 0,y=c.morphAttributes.color!==void 0,x=c.morphAttributes.position||[],M=c.morphAttributes.normal||[],S=c.morphAttributes.color||[],w=0;v===!0&&(w=1),_===!0&&(w=2),y===!0&&(w=3);let T=c.attributes.position.count*w,C=1;T>e.maxTextureSize&&(C=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);let b=new Float32Array(T*C*4*g),E=new cR(b,T,C,g);E.type=hu,E.needsUpdate=!0;let I=w*4;for(let A=0;A<g;A++){let D=x[A],U=M[A],B=S[A],F=T*C*4*A;for(let k=0;k<D.count;k++){let G=k*I;v===!0&&(o.fromBufferAttribute(D,k),b[F+G+0]=o.x,b[F+G+1]=o.y,b[F+G+2]=o.z,b[F+G+3]=0),_===!0&&(o.fromBufferAttribute(U,k),b[F+G+4]=o.x,b[F+G+5]=o.y,b[F+G+6]=o.z,b[F+G+7]=0),y===!0&&(o.fromBufferAttribute(B,k),b[F+G+8]=o.x,b[F+G+9]=o.y,b[F+G+10]=o.z,b[F+G+11]=B.itemSize===4?o.w:1)}}m={count:g,texture:E,size:new yr(T,C)},a.set(c,m),c.addEventListener("dispose",R)}if(u.isInstancedMesh===!0&&u.morphTexture!==null)f.getUniforms().setValue(r,"morphTexture",u.morphTexture,t);else{let v=0;for(let y=0;y<h.length;y++)v+=h[y];let _=c.morphTargetsRelative?1:1-v;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",h)}f.getUniforms().setValue(r,"morphTargetsTexture",m.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",m.size)}else{let d=h===void 0?0:h.length,g=i[c.id];if(g===void 0||g.length!==d){g=[];for(let x=0;x<d;x++)g[x]=[x,0];i[c.id]=g}for(let x=0;x<d;x++){let M=g[x];M[0]=x,M[1]=h[x]}g.sort(dNe);for(let x=0;x<8;x++)x<d&&g[x][1]?(s[x][0]=g[x][0],s[x][1]=g[x][1]):(s[x][0]=Number.MAX_SAFE_INTEGER,s[x][1]=0);s.sort(pNe);let m=c.morphAttributes.position,v=c.morphAttributes.normal,_=0;for(let x=0;x<8;x++){let M=s[x],S=M[0],w=M[1];S!==Number.MAX_SAFE_INTEGER&&w?(m&&c.getAttribute("morphTarget"+x)!==m[S]&&c.setAttribute("morphTarget"+x,m[S]),v&&c.getAttribute("morphNormal"+x)!==v[S]&&c.setAttribute("morphNormal"+x,v[S]),n[x]=w,_+=w):(m&&c.hasAttribute("morphTarget"+x)===!0&&c.deleteAttribute("morphTarget"+x),v&&c.hasAttribute("morphNormal"+x)===!0&&c.deleteAttribute("morphNormal"+x),n[x]=0)}let y=c.morphTargetsRelative?1:1-_;f.getUniforms().setValue(r,"morphTargetBaseInfluence",y),f.getUniforms().setValue(r,"morphTargetInfluences",n)}}return{update:l}}function vNe(r,e,t,i){let n=new WeakMap;function a(l){let u=i.render.frame,c=l.geometry,f=e.get(l,c);if(n.get(f)!==u&&(e.update(f),n.set(f,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",s)===!1&&l.addEventListener("dispose",s),n.get(l)!==u&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),n.set(l,u))),l.isSkinnedMesh){let h=l.skeleton;n.get(h)!==u&&(h.update(),n.set(h,u))}return f}function o(){n=new WeakMap}function s(l){let u=l.target;u.removeEventListener("dispose",s),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}var yR=class extends Vo{constructor(e,t,i,n,a,o,s,l,u,c){if(c=c!==void 0?c:pm,c!==pm&&c!==f0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===pm&&(i=Ph),i===void 0&&c===f0&&(i=hm),super(null,n,a,o,s,l,c,i,u),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=s!==void 0?s:Dn,this.minFilter=l!==void 0?l:Dn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},nse=new Vo,ase=new yR(1,1);ase.compareFunction=Qoe;var ose=new cR,sse=new ik,lse=new mR,doe=[],moe=[],voe=new Float32Array(16),goe=new Float32Array(9),yoe=new Float32Array(4);function x0(r,e,t){let i=r[0];if(i<=0||i>0)return r;let n=e*t,a=doe[n];if(a===void 0&&(a=new Float32Array(n),doe[n]=a),e!==0){i.toArray(a,0);for(let o=1,s=0;o!==e;++o)s+=t,r[o].toArray(a,s)}return a}function sn(r,e){if(r.length!==e.length)return!1;for(let t=0,i=r.length;t<i;t++)if(r[t]!==e[t])return!1;return!0}function ln(r,e){for(let t=0,i=e.length;t<i;t++)r[t]=e[t]}function FR(r,e){let t=moe[e];t===void 0&&(t=new Int32Array(e),moe[e]=t);for(let i=0;i!==e;++i)t[i]=r.allocateTextureUnit();return t}function gNe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function yNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sn(t,e))return;r.uniform2fv(this.addr,e),ln(t,e)}}function _Ne(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(sn(t,e))return;r.uniform3fv(this.addr,e),ln(t,e)}}function xNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sn(t,e))return;r.uniform4fv(this.addr,e),ln(t,e)}}function SNe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(sn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),ln(t,e)}else{if(sn(t,i))return;yoe.set(i),r.uniformMatrix2fv(this.addr,!1,yoe),ln(t,i)}}function MNe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(sn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),ln(t,e)}else{if(sn(t,i))return;goe.set(i),r.uniformMatrix3fv(this.addr,!1,goe),ln(t,i)}}function bNe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(sn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),ln(t,e)}else{if(sn(t,i))return;voe.set(i),r.uniformMatrix4fv(this.addr,!1,voe),ln(t,i)}}function wNe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function TNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sn(t,e))return;r.uniform2iv(this.addr,e),ln(t,e)}}function ENe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(sn(t,e))return;r.uniform3iv(this.addr,e),ln(t,e)}}function ANe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sn(t,e))return;r.uniform4iv(this.addr,e),ln(t,e)}}function CNe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function RNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(sn(t,e))return;r.uniform2uiv(this.addr,e),ln(t,e)}}function LNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(sn(t,e))return;r.uniform3uiv(this.addr,e),ln(t,e)}}function PNe(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(sn(t,e))return;r.uniform4uiv(this.addr,e),ln(t,e)}}function DNe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n);let a=this.type===r.SAMPLER_2D_SHADOW?ase:nse;t.setTexture2D(e||a,n)}function INe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||sse,n)}function NNe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTextureCube(e||lse,n)}function UNe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||ose,n)}function ONe(r){switch(r){case 5126:return gNe;case 35664:return yNe;case 35665:return _Ne;case 35666:return xNe;case 35674:return SNe;case 35675:return MNe;case 35676:return bNe;case 5124:case 35670:return wNe;case 35667:case 35671:return TNe;case 35668:case 35672:return ENe;case 35669:case 35673:return ANe;case 5125:return CNe;case 36294:return RNe;case 36295:return LNe;case 36296:return PNe;case 35678:case 36198:case 36298:case 36306:case 35682:return DNe;case 35679:case 36299:case 36307:return INe;case 35680:case 36300:case 36308:case 36293:return NNe;case 36289:case 36303:case 36311:case 36292:return UNe}}function FNe(r,e){r.uniform1fv(this.addr,e)}function zNe(r,e){let t=x0(e,this.size,2);r.uniform2fv(this.addr,t)}function BNe(r,e){let t=x0(e,this.size,3);r.uniform3fv(this.addr,t)}function kNe(r,e){let t=x0(e,this.size,4);r.uniform4fv(this.addr,t)}function VNe(r,e){let t=x0(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function GNe(r,e){let t=x0(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function HNe(r,e){let t=x0(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function WNe(r,e){r.uniform1iv(this.addr,e)}function XNe(r,e){r.uniform2iv(this.addr,e)}function YNe(r,e){r.uniform3iv(this.addr,e)}function qNe(r,e){r.uniform4iv(this.addr,e)}function ZNe(r,e){r.uniform1uiv(this.addr,e)}function jNe(r,e){r.uniform2uiv(this.addr,e)}function KNe(r,e){r.uniform3uiv(this.addr,e)}function JNe(r,e){r.uniform4uiv(this.addr,e)}function $Ne(r,e,t){let i=this.cache,n=e.length,a=FR(t,n);sn(i,a)||(r.uniform1iv(this.addr,a),ln(i,a));for(let o=0;o!==n;++o)t.setTexture2D(e[o]||nse,a[o])}function QNe(r,e,t){let i=this.cache,n=e.length,a=FR(t,n);sn(i,a)||(r.uniform1iv(this.addr,a),ln(i,a));for(let o=0;o!==n;++o)t.setTexture3D(e[o]||sse,a[o])}function eUe(r,e,t){let i=this.cache,n=e.length,a=FR(t,n);sn(i,a)||(r.uniform1iv(this.addr,a),ln(i,a));for(let o=0;o!==n;++o)t.setTextureCube(e[o]||lse,a[o])}function tUe(r,e,t){let i=this.cache,n=e.length,a=FR(t,n);sn(i,a)||(r.uniform1iv(this.addr,a),ln(i,a));for(let o=0;o!==n;++o)t.setTexture2DArray(e[o]||ose,a[o])}function rUe(r){switch(r){case 5126:return FNe;case 35664:return zNe;case 35665:return BNe;case 35666:return kNe;case 35674:return VNe;case 35675:return GNe;case 35676:return HNe;case 5124:case 35670:return WNe;case 35667:case 35671:return XNe;case 35668:case 35672:return YNe;case 35669:case 35673:return qNe;case 5125:return ZNe;case 36294:return jNe;case 36295:return KNe;case 36296:return JNe;case 35678:case 36198:case 36298:case 36306:case 35682:return $Ne;case 35679:case 36299:case 36307:return QNe;case 35680:case 36300:case 36308:case 36293:return eUe;case 36289:case 36303:case 36311:case 36292:return tUe}}var ok=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=ONe(t.type)}},sk=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=rUe(t.type)}},lk=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let n=this.seq;for(let a=0,o=n.length;a!==o;++a){let s=n[a];s.setValue(e,t[s.id],i)}}},WB=/(\w+)(\])?(\[|\.)?/g;function _oe(r,e){r.seq.push(e),r.map[e.id]=e}function iUe(r,e,t){let i=r.name,n=i.length;for(WB.lastIndex=0;;){let a=WB.exec(i),o=WB.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){_oe(t,u===void 0?new ok(s,r,e):new sk(s,r,e));break}else{let f=t.map[s];f===void 0&&(f=new lk(s),_oe(t,f)),t=f}}}var s0=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){let a=e.getActiveUniform(t,n),o=e.getUniformLocation(t,a.name);iUe(a,o,this)}}setValue(e,t,i,n){let a=this.map[t];a!==void 0&&a.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];n!==void 0&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let a=0,o=t.length;a!==o;++a){let s=t[a],l=i[s.id];l.needsUpdate!==!1&&s.setValue(e,l.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,a=e.length;n!==a;++n){let o=e[n];o.id in t&&i.push(o)}return i}};function xoe(r,e,t){let i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}var nUe=37297,aUe=0;function oUe(r,e){let t=r.split(`
  10163. `),i=[],n=Math.max(e-6,0),a=Math.min(e+6,t.length);for(let o=n;o<a;o++){let s=o+1;i.push(`${s===e?">":" "} ${s}: ${t[o]}`)}return i.join(`
  10164. `)}function sUe(r){let e=Jr.getPrimaries(Jr.workingColorSpace),t=Jr.getPrimaries(r),i;switch(e===t?i="":e===aR&&t===nR?i="LinearDisplayP3ToLinearSRGB":e===nR&&t===aR&&(i="LinearSRGBToLinearDisplayP3"),r){case Hh:case OR:return[i,"LinearTransferOETF"];case Ma:case Ok:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[i,"LinearTransferOETF"]}}function Soe(r,e,t){let i=r.getShaderParameter(e,r.COMPILE_STATUS),n=r.getShaderInfoLog(e).trim();if(i&&n==="")return"";let a=/ERROR: 0:(\d+)/.exec(n);if(a){let o=parseInt(a[1]);return t.toUpperCase()+`
  10165. `+n+`
  10166. `+oUe(r.getShaderSource(e),o)}else return n}function lUe(r,e){let t=sUe(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function uUe(r,e){let t;switch(e){case uPe:t="Linear";break;case cPe:t="Reinhard";break;case fPe:t="OptimizedCineon";break;case hPe:t="ACESFilmic";break;case dPe:t="AgX";break;case mPe:t="Neutral";break;case pPe:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function cUe(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.alphaToCoverage||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(i0).join(`
  10167. `)}function fUe(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(i0).join(`
  10168. `)}function hUe(r){let e=[];for(let t in r){let i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  10169. `)}function pUe(r,e){let t={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){let a=r.getActiveAttrib(e,n),o=a.name,s=1;a.type===r.FLOAT_MAT2&&(s=2),a.type===r.FLOAT_MAT3&&(s=3),a.type===r.FLOAT_MAT4&&(s=4),t[o]={type:a.type,location:r.getAttribLocation(e,o),locationSize:s}}return t}function i0(r){return r!==""}function Moe(r,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function boe(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var dUe=/^[ \t]*#include +<([\w\d./]+)>/gm;function uk(r){return r.replace(dUe,vUe)}var mUe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function vUe(r,e){let t=vr[e];if(t===void 0){let i=mUe.get(e);if(i!==void 0)t=vr[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return uk(t)}var gUe=/#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 woe(r){return r.replace(gUe,yUe)}function yUe(r,e,t,i){let n="";for(let a=parseInt(e);a<parseInt(t);a++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return n}function Toe(r){let e=`precision ${r.precision} float;
  10170. precision ${r.precision} int;
  10171. precision ${r.precision} sampler2D;
  10172. precision ${r.precision} samplerCube;
  10173. `;return r.isWebGL2&&(e+=`precision ${r.precision} sampler3D;
  10174. precision ${r.precision} sampler2DArray;
  10175. precision ${r.precision} sampler2DShadow;
  10176. precision ${r.precision} samplerCubeShadow;
  10177. precision ${r.precision} sampler2DArrayShadow;
  10178. precision ${r.precision} isampler2D;
  10179. precision ${r.precision} isampler3D;
  10180. precision ${r.precision} isamplerCube;
  10181. precision ${r.precision} isampler2DArray;
  10182. precision ${r.precision} usampler2D;
  10183. precision ${r.precision} usampler3D;
  10184. precision ${r.precision} usamplerCube;
  10185. precision ${r.precision} usampler2DArray;
  10186. `),r.precision==="highp"?e+=`
  10187. #define HIGH_PRECISION`:r.precision==="mediump"?e+=`
  10188. #define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
  10189. #define LOW_PRECISION`),e}function _Ue(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Xoe?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===FLe?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===vc&&(e="SHADOWMAP_TYPE_VSM"),e}function xUe(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case l0:case u0:e="ENVMAP_TYPE_CUBE";break;case UR:e="ENVMAP_TYPE_CUBE_UV";break}return e}function SUe(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case u0:e="ENVMAP_MODE_REFRACTION";break}return e}function MUe(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case NR:e="ENVMAP_BLENDING_MULTIPLY";break;case sPe:e="ENVMAP_BLENDING_MIX";break;case lPe:e="ENVMAP_BLENDING_ADD";break}return e}function bUe(r){let e=r.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function wUe(r,e,t,i){let n=r.getContext(),a=t.defines,o=t.vertexShader,s=t.fragmentShader,l=_Ue(t),u=xUe(t),c=SUe(t),f=MUe(t),h=bUe(t),p=t.isWebGL2?"":cUe(t),d=fUe(t),g=hUe(a),m=n.createProgram(),v,_,y=t.glslVersion?"#version "+t.glslVersion+`
  10190. `:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(i0).join(`
  10191. `),v.length>0&&(v+=`
  10192. `),_=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(i0).join(`
  10193. `),_.length>0&&(_+=`
  10194. `)):(v=[Toe(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.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"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  10195. `].filter(i0).join(`
  10196. `),_=[p,Toe(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+c:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ih?"#define TONE_MAPPING":"",t.toneMapping!==Ih?vr.tonemapping_pars_fragment:"",t.toneMapping!==Ih?uUe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",vr.colorspace_pars_fragment,lUe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  10197. `].filter(i0).join(`
  10198. `)),o=uk(o),o=Moe(o,t),o=boe(o,t),s=uk(s),s=Moe(s,t),s=boe(s,t),o=woe(o),s=woe(s),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
  10199. `,v=[d,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
  10200. `)+`
  10201. `+v,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===Gae?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Gae?"":"#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(`
  10202. `)+`
  10203. `+_);let x=y+v+o,M=y+_+s,S=xoe(n,n.VERTEX_SHADER,x),w=xoe(n,n.FRAGMENT_SHADER,M);n.attachShader(m,S),n.attachShader(m,w),t.index0AttributeName!==void 0?n.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&n.bindAttribLocation(m,0,"position"),n.linkProgram(m);function T(I){if(r.debug.checkShaderErrors){let R=n.getProgramInfoLog(m).trim(),A=n.getShaderInfoLog(S).trim(),D=n.getShaderInfoLog(w).trim(),U=!0,B=!0;if(n.getProgramParameter(m,n.LINK_STATUS)===!1)if(U=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(n,m,S,w);else{let F=Soe(n,S,"vertex"),k=Soe(n,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(m,n.VALIDATE_STATUS)+`
  10204. Material Name: `+I.name+`
  10205. Material Type: `+I.type+`
  10206. Program Info Log: `+R+`
  10207. `+F+`
  10208. `+k)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(A===""||D==="")&&(B=!1);B&&(I.diagnostics={runnable:U,programLog:R,vertexShader:{log:A,prefix:v},fragmentShader:{log:D,prefix:_}})}n.deleteShader(S),n.deleteShader(w),C=new s0(n,m),b=pUe(n,m)}let C;this.getUniforms=function(){return C===void 0&&T(this),C};let b;this.getAttributes=function(){return b===void 0&&T(this),b};let E=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=n.getProgramParameter(m,nUe)),E},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=aUe++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}var TUe=0,ck=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),a=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(n)===!1&&(o.add(n),n.usedTimes++),o.has(a)===!1&&(o.add(a),a.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new fk(e),t.set(e,i)),i}},fk=class{constructor(e){this.id=TUe++,this.code=e,this.usedTimes=0}};function EUe(r,e,t,i,n,a,o){let s=new fR,l=new ck,u=new Set,c=[],f=n.isWebGL2,h=n.logarithmicDepthBuffer,p=n.vertexTextures,d=n.precision,g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(b){return u.add(b),b===0?"uv":`uv${b}`}function v(b,E,I,R,A){let D=R.fog,U=A.geometry,B=b.isMeshStandardMaterial?R.environment:null,F=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),k=F&&F.mapping===UR?F.image.height:null,G=g[b.type];b.precision!==null&&(d=n.getMaxPrecision(b.precision),d!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",d,"instead."));let Y=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,J=Y!==void 0?Y.length:0,Q=0;U.morphAttributes.position!==void 0&&(Q=1),U.morphAttributes.normal!==void 0&&(Q=2),U.morphAttributes.color!==void 0&&(Q=3);let V,K,ae,ve;if(G){let zt=fu[G];V=zt.vertexShader,K=zt.fragmentShader}else V=b.vertexShader,K=b.fragmentShader,l.update(b),ae=l.getVertexShaderID(b),ve=l.getFragmentShaderID(b);let ue=r.getRenderTarget(),se=A.isInstancedMesh===!0,Ee=A.isBatchedMesh===!0,q=!!b.map,H=!!b.matcap,We=!!F,_e=!!b.aoMap,xe=!!b.lightMap,Le=!!b.bumpMap,Ue=!!b.normalMap,Ne=!!b.displacementMap,Ve=!!b.emissiveMap,ct=!!b.metalnessMap,z=!!b.roughnessMap,L=b.anisotropy>0,ne=b.clearcoat>0,le=b.iridescence>0,me=b.sheen>0,he=b.transmission>0,et=L&&!!b.anisotropyMap,Ke=ne&&!!b.clearcoatMap,Se=ne&&!!b.clearcoatNormalMap,Ae=ne&&!!b.clearcoatRoughnessMap,nt=le&&!!b.iridescenceMap,$=le&&!!b.iridescenceThicknessMap,it=me&&!!b.sheenColorMap,Xe=me&&!!b.sheenRoughnessMap,ze=!!b.specularMap,we=!!b.specularColorMap,Ie=!!b.specularIntensityMap,st=he&&!!b.transmissionMap,Je=he&&!!b.thicknessMap,kt=!!b.gradientMap,X=!!b.alphaMap,Te=b.alphaTest>0,te=!!b.alphaHash,Me=!!b.extensions,Pe=Ih;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(Pe=r.toneMapping);let xt={isWebGL2:f,shaderID:G,shaderType:b.type,shaderName:b.name,vertexShader:V,fragmentShader:K,defines:b.defines,customVertexShaderID:ae,customFragmentShaderID:ve,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:d,batching:Ee,instancing:se,instancingColor:se&&A.instanceColor!==null,instancingMorph:se&&A.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:ue===null?r.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:Hh,alphaToCoverage:!!b.alphaToCoverage,map:q,matcap:H,envMap:We,envMapMode:We&&F.mapping,envMapCubeUVHeight:k,aoMap:_e,lightMap:xe,bumpMap:Le,normalMap:Ue,displacementMap:p&&Ne,emissiveMap:Ve,normalMapObjectSpace:Ue&&b.normalMapType===CPe,normalMapTangentSpace:Ue&&b.normalMapType===Uk,metalnessMap:ct,roughnessMap:z,anisotropy:L,anisotropyMap:et,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Se,clearcoatRoughnessMap:Ae,iridescence:le,iridescenceMap:nt,iridescenceThicknessMap:$,sheen:me,sheenColorMap:it,sheenRoughnessMap:Xe,specularMap:ze,specularColorMap:we,specularIntensityMap:Ie,transmission:he,transmissionMap:st,thicknessMap:Je,gradientMap:kt,opaque:b.transparent===!1&&b.blending===a0&&b.alphaToCoverage===!1,alphaMap:X,alphaTest:Te,alphaHash:te,combine:b.combine,mapUv:q&&m(b.map.channel),aoMapUv:_e&&m(b.aoMap.channel),lightMapUv:xe&&m(b.lightMap.channel),bumpMapUv:Le&&m(b.bumpMap.channel),normalMapUv:Ue&&m(b.normalMap.channel),displacementMapUv:Ne&&m(b.displacementMap.channel),emissiveMapUv:Ve&&m(b.emissiveMap.channel),metalnessMapUv:ct&&m(b.metalnessMap.channel),roughnessMapUv:z&&m(b.roughnessMap.channel),anisotropyMapUv:et&&m(b.anisotropyMap.channel),clearcoatMapUv:Ke&&m(b.clearcoatMap.channel),clearcoatNormalMapUv:Se&&m(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&m(b.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&m(b.iridescenceMap.channel),iridescenceThicknessMapUv:$&&m(b.iridescenceThicknessMap.channel),sheenColorMapUv:it&&m(b.sheenColorMap.channel),sheenRoughnessMapUv:Xe&&m(b.sheenRoughnessMap.channel),specularMapUv:ze&&m(b.specularMap.channel),specularColorMapUv:we&&m(b.specularColorMap.channel),specularIntensityMapUv:Ie&&m(b.specularIntensityMap.channel),transmissionMapUv:st&&m(b.transmissionMap.channel),thicknessMapUv:Je&&m(b.thicknessMap.channel),alphaMapUv:X&&m(b.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(Ue||L),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,pointsUvs:A.isPoints===!0&&!!U.attributes.uv&&(q||X),fog:!!D,useFog:b.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:A.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:J,morphTextureStride:Q,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&I.length>0,shadowMapType:r.shadowMap.type,toneMapping:Pe,useLegacyLights:r._useLegacyLights,decodeVideoTexture:q&&b.map.isVideoTexture===!0&&Jr.getTransfer(b.map.colorSpace)===ai,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===yc,flipSided:b.side===lo,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:Me&&b.extensions.derivatives===!0,extensionFragDepth:Me&&b.extensions.fragDepth===!0,extensionDrawBuffers:Me&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:Me&&b.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Me&&b.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Me&&b.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionFragDepth:f||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return xt.vertexUv1s=u.has(1),xt.vertexUv2s=u.has(2),xt.vertexUv3s=u.has(3),u.clear(),xt}function _(b){let E=[];if(b.shaderID?E.push(b.shaderID):(E.push(b.customVertexShaderID),E.push(b.customFragmentShaderID)),b.defines!==void 0)for(let I in b.defines)E.push(I),E.push(b.defines[I]);return b.isRawShaderMaterial===!1&&(y(E,b),x(E,b),E.push(r.outputColorSpace)),E.push(b.customProgramCacheKey),E.join()}function y(b,E){b.push(E.precision),b.push(E.outputColorSpace),b.push(E.envMapMode),b.push(E.envMapCubeUVHeight),b.push(E.mapUv),b.push(E.alphaMapUv),b.push(E.lightMapUv),b.push(E.aoMapUv),b.push(E.bumpMapUv),b.push(E.normalMapUv),b.push(E.displacementMapUv),b.push(E.emissiveMapUv),b.push(E.metalnessMapUv),b.push(E.roughnessMapUv),b.push(E.anisotropyMapUv),b.push(E.clearcoatMapUv),b.push(E.clearcoatNormalMapUv),b.push(E.clearcoatRoughnessMapUv),b.push(E.iridescenceMapUv),b.push(E.iridescenceThicknessMapUv),b.push(E.sheenColorMapUv),b.push(E.sheenRoughnessMapUv),b.push(E.specularMapUv),b.push(E.specularColorMapUv),b.push(E.specularIntensityMapUv),b.push(E.transmissionMapUv),b.push(E.thicknessMapUv),b.push(E.combine),b.push(E.fogExp2),b.push(E.sizeAttenuation),b.push(E.morphTargetsCount),b.push(E.morphAttributeCount),b.push(E.numDirLights),b.push(E.numPointLights),b.push(E.numSpotLights),b.push(E.numSpotLightMaps),b.push(E.numHemiLights),b.push(E.numRectAreaLights),b.push(E.numDirLightShadows),b.push(E.numPointLightShadows),b.push(E.numSpotLightShadows),b.push(E.numSpotLightShadowsWithMaps),b.push(E.numLightProbes),b.push(E.shadowMapType),b.push(E.toneMapping),b.push(E.numClippingPlanes),b.push(E.numClipIntersection),b.push(E.depthPacking)}function x(b,E){s.disableAll(),E.isWebGL2&&s.enable(0),E.supportsVertexTextures&&s.enable(1),E.instancing&&s.enable(2),E.instancingColor&&s.enable(3),E.instancingMorph&&s.enable(4),E.matcap&&s.enable(5),E.envMap&&s.enable(6),E.normalMapObjectSpace&&s.enable(7),E.normalMapTangentSpace&&s.enable(8),E.clearcoat&&s.enable(9),E.iridescence&&s.enable(10),E.alphaTest&&s.enable(11),E.vertexColors&&s.enable(12),E.vertexAlphas&&s.enable(13),E.vertexUv1s&&s.enable(14),E.vertexUv2s&&s.enable(15),E.vertexUv3s&&s.enable(16),E.vertexTangents&&s.enable(17),E.anisotropy&&s.enable(18),E.alphaHash&&s.enable(19),E.batching&&s.enable(20),b.push(s.mask),s.disableAll(),E.fog&&s.enable(0),E.useFog&&s.enable(1),E.flatShading&&s.enable(2),E.logarithmicDepthBuffer&&s.enable(3),E.skinning&&s.enable(4),E.morphTargets&&s.enable(5),E.morphNormals&&s.enable(6),E.morphColors&&s.enable(7),E.premultipliedAlpha&&s.enable(8),E.shadowMapEnabled&&s.enable(9),E.useLegacyLights&&s.enable(10),E.doubleSided&&s.enable(11),E.flipSided&&s.enable(12),E.useDepthPacking&&s.enable(13),E.dithering&&s.enable(14),E.transmission&&s.enable(15),E.sheen&&s.enable(16),E.opaque&&s.enable(17),E.pointsUvs&&s.enable(18),E.decodeVideoTexture&&s.enable(19),E.alphaToCoverage&&s.enable(20),b.push(s.mask)}function M(b){let E=g[b.type],I;if(E){let R=fu[E];I=pDe.clone(R.uniforms)}else I=b.uniforms;return I}function S(b,E){let I;for(let R=0,A=c.length;R<A;R++){let D=c[R];if(D.cacheKey===E){I=D,++I.usedTimes;break}}return I===void 0&&(I=new wUe(r,E,b,a),c.push(I)),I}function w(b){if(--b.usedTimes===0){let E=c.indexOf(b);c[E]=c[c.length-1],c.pop(),b.destroy()}}function T(b){l.remove(b)}function C(){l.dispose()}return{getParameters:v,getProgramCacheKey:_,getUniforms:M,acquireProgram:S,releaseProgram:w,releaseShaderCache:T,programs:c,dispose:C}}function AUe(){let r=new WeakMap;function e(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function t(a){r.delete(a)}function i(a,o,s){r.get(a)[o]=s}function n(){r=new WeakMap}return{get:e,remove:t,update:i,dispose:n}}function CUe(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Eoe(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Aoe(){let r=[],e=0,t=[],i=[],n=[];function a(){e=0,t.length=0,i.length=0,n.length=0}function o(f,h,p,d,g,m){let v=r[e];return v===void 0?(v={id:f.id,object:f,geometry:h,material:p,groupOrder:d,renderOrder:f.renderOrder,z:g,group:m},r[e]=v):(v.id=f.id,v.object=f,v.geometry=h,v.material=p,v.groupOrder=d,v.renderOrder=f.renderOrder,v.z=g,v.group=m),e++,v}function s(f,h,p,d,g,m){let v=o(f,h,p,d,g,m);p.transmission>0?i.push(v):p.transparent===!0?n.push(v):t.push(v)}function l(f,h,p,d,g,m){let v=o(f,h,p,d,g,m);p.transmission>0?i.unshift(v):p.transparent===!0?n.unshift(v):t.unshift(v)}function u(f,h){t.length>1&&t.sort(f||CUe),i.length>1&&i.sort(h||Eoe),n.length>1&&n.sort(h||Eoe)}function c(){for(let f=e,h=r.length;f<h;f++){let p=r[f];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:n,init:a,push:s,unshift:l,finish:c,sort:u}}function RUe(){let r=new WeakMap;function e(i,n){let a=r.get(i),o;return a===void 0?(o=new Aoe,r.set(i,[o])):n>=a.length?(o=new Aoe,a.push(o)):o=a[n],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function LUe(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ye,color:new er};break;case"SpotLight":t={position:new ye,direction:new ye,color:new er,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ye,color:new er,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ye,skyColor:new er,groundColor:new er};break;case"RectAreaLight":t={color:new er,position:new ye,halfWidth:new ye,halfHeight:new ye};break}return r[e.id]=t,t}}}function PUe(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var DUe=0;function IUe(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function NUe(r,e){let t=new LUe,i=PUe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new ye);let a=new ye,o=new Ht,s=new Ht;function l(c,f){let h=0,p=0,d=0;for(let I=0;I<9;I++)n.probe[I].set(0,0,0);let g=0,m=0,v=0,_=0,y=0,x=0,M=0,S=0,w=0,T=0,C=0;c.sort(IUe);let b=f===!0?Math.PI:1;for(let I=0,R=c.length;I<R;I++){let A=c[I],D=A.color,U=A.intensity,B=A.distance,F=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)h+=D.r*U*b,p+=D.g*U*b,d+=D.b*U*b;else if(A.isLightProbe){for(let k=0;k<9;k++)n.probe[k].addScaledVector(A.sh.coefficients[k],U);C++}else if(A.isDirectionalLight){let k=t.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity*b),A.castShadow){let G=A.shadow,Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,n.directionalShadow[g]=Y,n.directionalShadowMap[g]=F,n.directionalShadowMatrix[g]=A.shadow.matrix,x++}n.directional[g]=k,g++}else if(A.isSpotLight){let k=t.get(A);k.position.setFromMatrixPosition(A.matrixWorld),k.color.copy(D).multiplyScalar(U*b),k.distance=B,k.coneCos=Math.cos(A.angle),k.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),k.decay=A.decay,n.spot[v]=k;let G=A.shadow;if(A.map&&(n.spotLightMap[w]=A.map,w++,G.updateMatrices(A),A.castShadow&&T++),n.spotLightMatrix[v]=G.matrix,A.castShadow){let Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,n.spotShadow[v]=Y,n.spotShadowMap[v]=F,S++}v++}else if(A.isRectAreaLight){let k=t.get(A);k.color.copy(D).multiplyScalar(U),k.halfWidth.set(A.width*.5,0,0),k.halfHeight.set(0,A.height*.5,0),n.rectArea[_]=k,_++}else if(A.isPointLight){let k=t.get(A);if(k.color.copy(A.color).multiplyScalar(A.intensity*b),k.distance=A.distance,k.decay=A.decay,A.castShadow){let G=A.shadow,Y=i.get(A);Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,Y.shadowCameraNear=G.camera.near,Y.shadowCameraFar=G.camera.far,n.pointShadow[m]=Y,n.pointShadowMap[m]=F,n.pointShadowMatrix[m]=A.shadow.matrix,M++}n.point[m]=k,m++}else if(A.isHemisphereLight){let k=t.get(A);k.skyColor.copy(A.color).multiplyScalar(U*b),k.groundColor.copy(A.groundColor).multiplyScalar(U*b),n.hemi[y]=k,y++}}_>0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=yt.LTC_FLOAT_1,n.rectAreaLTC2=yt.LTC_FLOAT_2):(n.rectAreaLTC1=yt.LTC_HALF_1,n.rectAreaLTC2=yt.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=yt.LTC_FLOAT_1,n.rectAreaLTC2=yt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(n.rectAreaLTC1=yt.LTC_HALF_1,n.rectAreaLTC2=yt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=h,n.ambient[1]=p,n.ambient[2]=d;let E=n.hash;(E.directionalLength!==g||E.pointLength!==m||E.spotLength!==v||E.rectAreaLength!==_||E.hemiLength!==y||E.numDirectionalShadows!==x||E.numPointShadows!==M||E.numSpotShadows!==S||E.numSpotMaps!==w||E.numLightProbes!==C)&&(n.directional.length=g,n.spot.length=v,n.rectArea.length=_,n.point.length=m,n.hemi.length=y,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=M,n.pointShadowMap.length=M,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=M,n.spotLightMatrix.length=S+w-T,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=C,E.directionalLength=g,E.pointLength=m,E.spotLength=v,E.rectAreaLength=_,E.hemiLength=y,E.numDirectionalShadows=x,E.numPointShadows=M,E.numSpotShadows=S,E.numSpotMaps=w,E.numLightProbes=C,n.version=DUe++)}function u(c,f){let h=0,p=0,d=0,g=0,m=0,v=f.matrixWorldInverse;for(let _=0,y=c.length;_<y;_++){let x=c[_];if(x.isDirectionalLight){let M=n.directional[h];M.direction.setFromMatrixPosition(x.matrixWorld),a.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(a),M.direction.transformDirection(v),h++}else if(x.isSpotLight){let M=n.spot[d];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),M.direction.setFromMatrixPosition(x.matrixWorld),a.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(a),M.direction.transformDirection(v),d++}else if(x.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),s.identity(),o.copy(x.matrixWorld),o.premultiply(v),s.extractRotation(o),M.halfWidth.set(x.width*.5,0,0),M.halfHeight.set(0,x.height*.5,0),M.halfWidth.applyMatrix4(s),M.halfHeight.applyMatrix4(s),g++}else if(x.isPointLight){let M=n.point[p];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(v),p++}else if(x.isHemisphereLight){let M=n.hemi[m];M.direction.setFromMatrixPosition(x.matrixWorld),M.direction.transformDirection(v),m++}}}return{setup:l,setupView:u,state:n}}function Coe(r,e){let t=new NUe(r,e),i=[],n=[];function a(){i.length=0,n.length=0}function o(f){i.push(f)}function s(f){n.push(f)}function l(f){t.setup(i,f)}function u(f){t.setupView(i,f)}return{init:a,state:{lightsArray:i,shadowsArray:n,lights:t},setupLights:l,setupLightsView:u,pushLight:o,pushShadow:s}}function UUe(r,e){let t=new WeakMap;function i(a,o=0){let s=t.get(a),l;return s===void 0?(l=new Coe(r,e),t.set(a,[l])):o>=s.length?(l=new Coe(r,e),s.push(l)):l=s[o],l}function n(){t=new WeakMap}return{get:i,dispose:n}}var hk=class extends Mc{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=EPe,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},pk=class extends Mc{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},OUe=`void main() {
  10209. gl_Position = vec4( position, 1.0 );
  10210. }`,FUe=`uniform sampler2D shadow_pass;
  10211. uniform vec2 resolution;
  10212. uniform float radius;
  10213. #include <packing>
  10214. void main() {
  10215. const float samples = float( VSM_SAMPLES );
  10216. float mean = 0.0;
  10217. float squared_mean = 0.0;
  10218. float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
  10219. float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
  10220. for ( float i = 0.0; i < samples; i ++ ) {
  10221. float uvOffset = uvStart + i * uvStride;
  10222. #ifdef HORIZONTAL_PASS
  10223. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
  10224. mean += distribution.x;
  10225. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  10226. #else
  10227. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
  10228. mean += depth;
  10229. squared_mean += depth * depth;
  10230. #endif
  10231. }
  10232. mean = mean / samples;
  10233. squared_mean = squared_mean / samples;
  10234. float std_dev = sqrt( squared_mean - mean * mean );
  10235. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  10236. }`;function zUe(r,e,t){let i=new UM,n=new yr,a=new yr,o=new Pr,s=new hk({depthPacking:APe}),l=new pk,u={},c=t.maxTextureSize,f={[Uh]:lo,[lo]:Uh,[yc]:yc},h=new pu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new yr},radius:{value:4}},vertexShader:OUe,fragmentShader:FUe}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let d=new Rs;d.setAttribute("position",new Cs(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new so(d,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Xoe;let v=this.type;this.render=function(S,w,T){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||S.length===0)return;let C=r.getRenderTarget(),b=r.getActiveCubeFace(),E=r.getActiveMipmapLevel(),I=r.state;I.setBlending(Dh),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);let R=v!==vc&&this.type===vc,A=v===vc&&this.type!==vc;for(let D=0,U=S.length;D<U;D++){let B=S[D],F=B.shadow;if(F===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(F.autoUpdate===!1&&F.needsUpdate===!1)continue;n.copy(F.mapSize);let k=F.getFrameExtents();if(n.multiply(k),a.copy(F.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/k.x),n.x=a.x*k.x,F.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/k.y),n.y=a.y*k.y,F.mapSize.y=a.y)),F.map===null||R===!0||A===!0){let Y=this.type!==vc?{minFilter:Dn,magFilter:Dn}:{};F.map!==null&&F.map.dispose(),F.map=new Sc(n.x,n.y,Y),F.map.texture.name=B.name+".shadowMap",F.camera.updateProjectionMatrix()}r.setRenderTarget(F.map),r.clear();let G=F.getViewportCount();for(let Y=0;Y<G;Y++){let J=F.getViewport(Y);o.set(a.x*J.x,a.y*J.y,a.x*J.z,a.y*J.w),I.viewport(o),F.updateMatrices(B,Y),i=F.getFrustum(),x(w,T,F.camera,B,this.type)}F.isPointLightShadow!==!0&&this.type===vc&&_(F,T),F.needsUpdate=!1}v=this.type,m.needsUpdate=!1,r.setRenderTarget(C,b,E)};function _(S,w){let T=e.update(g);h.defines.VSM_SAMPLES!==S.blurSamples&&(h.defines.VSM_SAMPLES=S.blurSamples,p.defines.VSM_SAMPLES=S.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),S.mapPass===null&&(S.mapPass=new Sc(n.x,n.y)),h.uniforms.shadow_pass.value=S.map.texture,h.uniforms.resolution.value=S.mapSize,h.uniforms.radius.value=S.radius,r.setRenderTarget(S.mapPass),r.clear(),r.renderBufferDirect(w,null,T,h,g,null),p.uniforms.shadow_pass.value=S.mapPass.texture,p.uniforms.resolution.value=S.mapSize,p.uniforms.radius.value=S.radius,r.setRenderTarget(S.map),r.clear(),r.renderBufferDirect(w,null,T,p,g,null)}function y(S,w,T,C){let b=null,E=T.isPointLight===!0?S.customDistanceMaterial:S.customDepthMaterial;if(E!==void 0)b=E;else if(b=T.isPointLight===!0?l:s,r.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){let I=b.uuid,R=w.uuid,A=u[I];A===void 0&&(A={},u[I]=A);let D=A[R];D===void 0&&(D=b.clone(),A[R]=D,w.addEventListener("dispose",M)),b=D}if(b.visible=w.visible,b.wireframe=w.wireframe,C===vc?b.side=w.shadowSide!==null?w.shadowSide:w.side:b.side=w.shadowSide!==null?w.shadowSide:f[w.side],b.alphaMap=w.alphaMap,b.alphaTest=w.alphaTest,b.map=w.map,b.clipShadows=w.clipShadows,b.clippingPlanes=w.clippingPlanes,b.clipIntersection=w.clipIntersection,b.displacementMap=w.displacementMap,b.displacementScale=w.displacementScale,b.displacementBias=w.displacementBias,b.wireframeLinewidth=w.wireframeLinewidth,b.linewidth=w.linewidth,T.isPointLight===!0&&b.isMeshDistanceMaterial===!0){let I=r.properties.get(b);I.light=T}return b}function x(S,w,T,C,b){if(S.visible===!1)return;if(S.layers.test(w.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&b===vc)&&(!S.frustumCulled||i.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,S.matrixWorld);let R=e.update(S),A=S.material;if(Array.isArray(A)){let D=R.groups;for(let U=0,B=D.length;U<B;U++){let F=D[U],k=A[F.materialIndex];if(k&&k.visible){let G=y(S,k,C,b);S.onBeforeShadow(r,S,w,T,R,G,F),r.renderBufferDirect(T,null,R,G,S,F),S.onAfterShadow(r,S,w,T,R,G,F)}}}else if(A.visible){let D=y(S,A,C,b);S.onBeforeShadow(r,S,w,T,R,D,null),r.renderBufferDirect(T,null,R,D,S,null),S.onAfterShadow(r,S,w,T,R,D,null)}}let I=S.children;for(let R=0,A=I.length;R<A;R++)x(I[R],w,T,C,b)}function M(S){S.target.removeEventListener("dispose",M);for(let T in u){let C=u[T],b=S.target.uuid;b in C&&(C[b].dispose(),delete C[b])}}}function BUe(r,e,t){let i=t.isWebGL2;function n(){let X=!1,Te=new Pr,te=null,Me=new Pr(0,0,0,0);return{setMask:function(Pe){te!==Pe&&!X&&(r.colorMask(Pe,Pe,Pe,Pe),te=Pe)},setLocked:function(Pe){X=Pe},setClear:function(Pe,xt,zt,Mr,Zr){Zr===!0&&(Pe*=Mr,xt*=Mr,zt*=Mr),Te.set(Pe,xt,zt,Mr),Me.equals(Te)===!1&&(r.clearColor(Pe,xt,zt,Mr),Me.copy(Te))},reset:function(){X=!1,te=null,Me.set(-1,0,0,0)}}}function a(){let X=!1,Te=null,te=null,Me=null;return{setTest:function(Pe){Pe?se(r.DEPTH_TEST):Ee(r.DEPTH_TEST)},setMask:function(Pe){Te!==Pe&&!X&&(r.depthMask(Pe),Te=Pe)},setFunc:function(Pe){if(te!==Pe){switch(Pe){case ePe:r.depthFunc(r.NEVER);break;case tPe:r.depthFunc(r.ALWAYS);break;case rPe:r.depthFunc(r.LESS);break;case eR:r.depthFunc(r.LEQUAL);break;case iPe:r.depthFunc(r.EQUAL);break;case nPe:r.depthFunc(r.GEQUAL);break;case aPe:r.depthFunc(r.GREATER);break;case oPe:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}te=Pe}},setLocked:function(Pe){X=Pe},setClear:function(Pe){Me!==Pe&&(r.clearDepth(Pe),Me=Pe)},reset:function(){X=!1,Te=null,te=null,Me=null}}}function o(){let X=!1,Te=null,te=null,Me=null,Pe=null,xt=null,zt=null,Mr=null,Zr=null;return{setTest:function(Vt){X||(Vt?se(r.STENCIL_TEST):Ee(r.STENCIL_TEST))},setMask:function(Vt){Te!==Vt&&!X&&(r.stencilMask(Vt),Te=Vt)},setFunc:function(Vt,Dr,oi){(te!==Vt||Me!==Dr||Pe!==oi)&&(r.stencilFunc(Vt,Dr,oi),te=Vt,Me=Dr,Pe=oi)},setOp:function(Vt,Dr,oi){(xt!==Vt||zt!==Dr||Mr!==oi)&&(r.stencilOp(Vt,Dr,oi),xt=Vt,zt=Dr,Mr=oi)},setLocked:function(Vt){X=Vt},setClear:function(Vt){Zr!==Vt&&(r.clearStencil(Vt),Zr=Vt)},reset:function(){X=!1,Te=null,te=null,Me=null,Pe=null,xt=null,zt=null,Mr=null,Zr=null}}}let s=new n,l=new a,u=new o,c=new WeakMap,f=new WeakMap,h={},p={},d=new WeakMap,g=[],m=null,v=!1,_=null,y=null,x=null,M=null,S=null,w=null,T=null,C=new er(0,0,0),b=0,E=!1,I=null,R=null,A=null,D=null,U=null,B=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),F=!1,k=0,G=r.getParameter(r.VERSION);G.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(G)[1]),F=k>=1):G.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),F=k>=2);let Y=null,J={},Q=r.getParameter(r.SCISSOR_BOX),V=r.getParameter(r.VIEWPORT),K=new Pr().fromArray(Q),ae=new Pr().fromArray(V);function ve(X,Te,te,Me){let Pe=new Uint8Array(4),xt=r.createTexture();r.bindTexture(X,xt),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let zt=0;zt<te;zt++)i&&(X===r.TEXTURE_3D||X===r.TEXTURE_2D_ARRAY)?r.texImage3D(Te,0,r.RGBA,1,1,Me,0,r.RGBA,r.UNSIGNED_BYTE,Pe):r.texImage2D(Te+zt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Pe);return xt}let ue={};ue[r.TEXTURE_2D]=ve(r.TEXTURE_2D,r.TEXTURE_2D,1),ue[r.TEXTURE_CUBE_MAP]=ve(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(ue[r.TEXTURE_2D_ARRAY]=ve(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),ue[r.TEXTURE_3D]=ve(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),s.setClear(0,0,0,1),l.setClear(1),u.setClear(0),se(r.DEPTH_TEST),l.setFunc(eR),Ne(!1),Ve(iae),se(r.CULL_FACE),Le(Dh);function se(X){h[X]!==!0&&(r.enable(X),h[X]=!0)}function Ee(X){h[X]!==!1&&(r.disable(X),h[X]=!1)}function q(X,Te){return p[X]!==Te?(r.bindFramebuffer(X,Te),p[X]=Te,i&&(X===r.DRAW_FRAMEBUFFER&&(p[r.FRAMEBUFFER]=Te),X===r.FRAMEBUFFER&&(p[r.DRAW_FRAMEBUFFER]=Te)),!0):!1}function H(X,Te){let te=g,Me=!1;if(X){te=d.get(Te),te===void 0&&(te=[],d.set(Te,te));let Pe=X.textures;if(te.length!==Pe.length||te[0]!==r.COLOR_ATTACHMENT0){for(let xt=0,zt=Pe.length;xt<zt;xt++)te[xt]=r.COLOR_ATTACHMENT0+xt;te.length=Pe.length,Me=!0}}else te[0]!==r.BACK&&(te[0]=r.BACK,Me=!0);if(Me)if(t.isWebGL2)r.drawBuffers(te);else if(e.has("WEBGL_draw_buffers")===!0)e.get("WEBGL_draw_buffers").drawBuffersWEBGL(te);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function We(X){return m!==X?(r.useProgram(X),m=X,!0):!1}let _e={[um]:r.FUNC_ADD,[BLe]:r.FUNC_SUBTRACT,[kLe]:r.FUNC_REVERSE_SUBTRACT};if(i)_e[sae]=r.MIN,_e[lae]=r.MAX;else{let X=e.get("EXT_blend_minmax");X!==null&&(_e[sae]=X.MIN_EXT,_e[lae]=X.MAX_EXT)}let xe={[VLe]:r.ZERO,[GLe]:r.ONE,[HLe]:r.SRC_COLOR,[KB]:r.SRC_ALPHA,[jLe]:r.SRC_ALPHA_SATURATE,[qLe]:r.DST_COLOR,[XLe]:r.DST_ALPHA,[WLe]:r.ONE_MINUS_SRC_COLOR,[JB]:r.ONE_MINUS_SRC_ALPHA,[ZLe]:r.ONE_MINUS_DST_COLOR,[YLe]:r.ONE_MINUS_DST_ALPHA,[KLe]:r.CONSTANT_COLOR,[JLe]:r.ONE_MINUS_CONSTANT_COLOR,[$Le]:r.CONSTANT_ALPHA,[QLe]:r.ONE_MINUS_CONSTANT_ALPHA};function Le(X,Te,te,Me,Pe,xt,zt,Mr,Zr,Vt){if(X===Dh){v===!0&&(Ee(r.BLEND),v=!1);return}if(v===!1&&(se(r.BLEND),v=!0),X!==zLe){if(X!==_||Vt!==E){if((y!==um||S!==um)&&(r.blendEquation(r.FUNC_ADD),y=um,S=um),Vt)switch(X){case a0:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case nae:r.blendFunc(r.ONE,r.ONE);break;case aae:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case oae:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}else switch(X){case a0:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case nae:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case aae:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case oae:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}x=null,M=null,w=null,T=null,C.set(0,0,0),b=0,_=X,E=Vt}return}Pe=Pe||Te,xt=xt||te,zt=zt||Me,(Te!==y||Pe!==S)&&(r.blendEquationSeparate(_e[Te],_e[Pe]),y=Te,S=Pe),(te!==x||Me!==M||xt!==w||zt!==T)&&(r.blendFuncSeparate(xe[te],xe[Me],xe[xt],xe[zt]),x=te,M=Me,w=xt,T=zt),(Mr.equals(C)===!1||Zr!==b)&&(r.blendColor(Mr.r,Mr.g,Mr.b,Zr),C.copy(Mr),b=Zr),_=X,E=!1}function Ue(X,Te){X.side===yc?Ee(r.CULL_FACE):se(r.CULL_FACE);let te=X.side===lo;Te&&(te=!te),Ne(te),X.blending===a0&&X.transparent===!1?Le(Dh):Le(X.blending,X.blendEquation,X.blendSrc,X.blendDst,X.blendEquationAlpha,X.blendSrcAlpha,X.blendDstAlpha,X.blendColor,X.blendAlpha,X.premultipliedAlpha),l.setFunc(X.depthFunc),l.setTest(X.depthTest),l.setMask(X.depthWrite),s.setMask(X.colorWrite);let Me=X.stencilWrite;u.setTest(Me),Me&&(u.setMask(X.stencilWriteMask),u.setFunc(X.stencilFunc,X.stencilRef,X.stencilFuncMask),u.setOp(X.stencilFail,X.stencilZFail,X.stencilZPass)),z(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),X.alphaToCoverage===!0?se(r.SAMPLE_ALPHA_TO_COVERAGE):Ee(r.SAMPLE_ALPHA_TO_COVERAGE)}function Ne(X){I!==X&&(X?r.frontFace(r.CW):r.frontFace(r.CCW),I=X)}function Ve(X){X!==ULe?(se(r.CULL_FACE),X!==R&&(X===iae?r.cullFace(r.BACK):X===OLe?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Ee(r.CULL_FACE),R=X}function ct(X){X!==A&&(F&&r.lineWidth(X),A=X)}function z(X,Te,te){X?(se(r.POLYGON_OFFSET_FILL),(D!==Te||U!==te)&&(r.polygonOffset(Te,te),D=Te,U=te)):Ee(r.POLYGON_OFFSET_FILL)}function L(X){X?se(r.SCISSOR_TEST):Ee(r.SCISSOR_TEST)}function ne(X){X===void 0&&(X=r.TEXTURE0+B-1),Y!==X&&(r.activeTexture(X),Y=X)}function le(X,Te,te){te===void 0&&(Y===null?te=r.TEXTURE0+B-1:te=Y);let Me=J[te];Me===void 0&&(Me={type:void 0,texture:void 0},J[te]=Me),(Me.type!==X||Me.texture!==Te)&&(Y!==te&&(r.activeTexture(te),Y=te),r.bindTexture(X,Te||ue[X]),Me.type=X,Me.texture=Te)}function me(){let X=J[Y];X!==void 0&&X.type!==void 0&&(r.bindTexture(X.type,null),X.type=void 0,X.texture=void 0)}function he(){try{r.compressedTexImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function et(){try{r.compressedTexImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ke(){try{r.texSubImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Se(){try{r.texSubImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ae(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function nt(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function $(){try{r.texStorage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function it(){try{r.texStorage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Xe(){try{r.texImage2D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function ze(){try{r.texImage3D.apply(r,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function we(X){K.equals(X)===!1&&(r.scissor(X.x,X.y,X.z,X.w),K.copy(X))}function Ie(X){ae.equals(X)===!1&&(r.viewport(X.x,X.y,X.z,X.w),ae.copy(X))}function st(X,Te){let te=f.get(Te);te===void 0&&(te=new WeakMap,f.set(Te,te));let Me=te.get(X);Me===void 0&&(Me=r.getUniformBlockIndex(Te,X.name),te.set(X,Me))}function Je(X,Te){let Me=f.get(Te).get(X);c.get(Te)!==Me&&(r.uniformBlockBinding(Te,Me,X.__bindingPointIndex),c.set(Te,Me))}function kt(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),i===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},Y=null,J={},p={},d=new WeakMap,g=[],m=null,v=!1,_=null,y=null,x=null,M=null,S=null,w=null,T=null,C=new er(0,0,0),b=0,E=!1,I=null,R=null,A=null,D=null,U=null,K.set(0,0,r.canvas.width,r.canvas.height),ae.set(0,0,r.canvas.width,r.canvas.height),s.reset(),l.reset(),u.reset()}return{buffers:{color:s,depth:l,stencil:u},enable:se,disable:Ee,bindFramebuffer:q,drawBuffers:H,useProgram:We,setBlending:Le,setMaterial:Ue,setFlipSided:Ne,setCullFace:Ve,setLineWidth:ct,setPolygonOffset:z,setScissorTest:L,activeTexture:ne,bindTexture:le,unbindTexture:me,compressedTexImage2D:he,compressedTexImage3D:et,texImage2D:Xe,texImage3D:ze,updateUBOMapping:st,uniformBlockBinding:Je,texStorage2D:$,texStorage3D:it,texSubImage2D:Ke,texSubImage3D:Se,compressedTexSubImage2D:Ae,compressedTexSubImage3D:nt,scissor:we,viewport:Ie,reset:kt}}function kUe(r,e,t,i,n,a,o){let s=n.isWebGL2,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new yr,f=new WeakMap,h,p=new WeakMap,d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(z,L){return d?new OffscreenCanvas(z,L):DM("canvas")}function m(z,L,ne,le){let me=1,he=ct(z);if((he.width>le||he.height>le)&&(me=le/Math.max(he.width,he.height)),me<1||L===!0)if(typeof HTMLImageElement<"u"&&z instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&z instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&z instanceof ImageBitmap||typeof VideoFrame<"u"&&z instanceof VideoFrame){let et=L?sR:Math.floor,Ke=et(me*he.width),Se=et(me*he.height);h===void 0&&(h=g(Ke,Se));let Ae=ne?g(Ke,Se):h;return Ae.width=Ke,Ae.height=Se,Ae.getContext("2d").drawImage(z,0,0,Ke,Se),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+Ke+"x"+Se+")."),Ae}else return"data"in z&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),z;return z}function v(z){let L=ct(z);return tk(L.width)&&tk(L.height)}function _(z){return s?!1:z.wrapS!==oo||z.wrapT!==oo||z.minFilter!==Dn&&z.minFilter!==ao}function y(z,L){return z.generateMipmaps&&L&&z.minFilter!==Dn&&z.minFilter!==ao}function x(z){r.generateMipmap(z)}function M(z,L,ne,le,me=!1){if(s===!1)return L;if(z!==null){if(r[z]!==void 0)return r[z];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+z+"'")}let he=L;if(L===r.RED&&(ne===r.FLOAT&&(he=r.R32F),ne===r.HALF_FLOAT&&(he=r.R16F),ne===r.UNSIGNED_BYTE&&(he=r.R8)),L===r.RED_INTEGER&&(ne===r.UNSIGNED_BYTE&&(he=r.R8UI),ne===r.UNSIGNED_SHORT&&(he=r.R16UI),ne===r.UNSIGNED_INT&&(he=r.R32UI),ne===r.BYTE&&(he=r.R8I),ne===r.SHORT&&(he=r.R16I),ne===r.INT&&(he=r.R32I)),L===r.RG&&(ne===r.FLOAT&&(he=r.RG32F),ne===r.HALF_FLOAT&&(he=r.RG16F),ne===r.UNSIGNED_BYTE&&(he=r.RG8)),L===r.RG_INTEGER&&(ne===r.UNSIGNED_BYTE&&(he=r.RG8UI),ne===r.UNSIGNED_SHORT&&(he=r.RG16UI),ne===r.UNSIGNED_INT&&(he=r.RG32UI),ne===r.BYTE&&(he=r.RG8I),ne===r.SHORT&&(he=r.RG16I),ne===r.INT&&(he=r.RG32I)),L===r.RGBA){let et=me?iR:Jr.getTransfer(le);ne===r.FLOAT&&(he=r.RGBA32F),ne===r.HALF_FLOAT&&(he=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(he=et===ai?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(he=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(he=r.RGB5_A1)}return(he===r.R16F||he===r.R32F||he===r.RG16F||he===r.RG32F||he===r.RGBA16F||he===r.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function S(z,L,ne){return y(z,ne)===!0||z.isFramebufferTexture&&z.minFilter!==Dn&&z.minFilter!==ao?Math.log2(Math.max(L.width,L.height))+1:z.mipmaps!==void 0&&z.mipmaps.length>0?z.mipmaps.length:z.isCompressedTexture&&Array.isArray(z.image)?L.mipmaps.length:1}function w(z){return z===Dn||z===fae||z===SM?r.NEAREST:r.LINEAR}function T(z){let L=z.target;L.removeEventListener("dispose",T),b(L),L.isVideoTexture&&f.delete(L)}function C(z){let L=z.target;L.removeEventListener("dispose",C),I(L)}function b(z){let L=i.get(z);if(L.__webglInit===void 0)return;let ne=z.source,le=p.get(ne);if(le){let me=le[L.__cacheKey];me.usedTimes--,me.usedTimes===0&&E(z),Object.keys(le).length===0&&p.delete(ne)}i.remove(z)}function E(z){let L=i.get(z);r.deleteTexture(L.__webglTexture);let ne=z.source,le=p.get(ne);delete le[L.__cacheKey],o.memory.textures--}function I(z){let L=i.get(z);if(z.depthTexture&&z.depthTexture.dispose(),z.isWebGLCubeRenderTarget)for(let le=0;le<6;le++){if(Array.isArray(L.__webglFramebuffer[le]))for(let me=0;me<L.__webglFramebuffer[le].length;me++)r.deleteFramebuffer(L.__webglFramebuffer[le][me]);else r.deleteFramebuffer(L.__webglFramebuffer[le]);L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer[le])}else{if(Array.isArray(L.__webglFramebuffer))for(let le=0;le<L.__webglFramebuffer.length;le++)r.deleteFramebuffer(L.__webglFramebuffer[le]);else r.deleteFramebuffer(L.__webglFramebuffer);if(L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer),L.__webglMultisampledFramebuffer&&r.deleteFramebuffer(L.__webglMultisampledFramebuffer),L.__webglColorRenderbuffer)for(let le=0;le<L.__webglColorRenderbuffer.length;le++)L.__webglColorRenderbuffer[le]&&r.deleteRenderbuffer(L.__webglColorRenderbuffer[le]);L.__webglDepthRenderbuffer&&r.deleteRenderbuffer(L.__webglDepthRenderbuffer)}let ne=z.textures;for(let le=0,me=ne.length;le<me;le++){let he=i.get(ne[le]);he.__webglTexture&&(r.deleteTexture(he.__webglTexture),o.memory.textures--),i.remove(ne[le])}i.remove(z)}let R=0;function A(){R=0}function D(){let z=R;return z>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+z+" texture units while this GPU supports only "+n.maxTextures),R+=1,z}function U(z){let L=[];return L.push(z.wrapS),L.push(z.wrapT),L.push(z.wrapR||0),L.push(z.magFilter),L.push(z.minFilter),L.push(z.anisotropy),L.push(z.internalFormat),L.push(z.format),L.push(z.type),L.push(z.generateMipmaps),L.push(z.premultiplyAlpha),L.push(z.flipY),L.push(z.unpackAlignment),L.push(z.colorSpace),L.join()}function B(z,L){let ne=i.get(z);if(z.isVideoTexture&&Ne(z),z.isRenderTargetTexture===!1&&z.version>0&&ne.__version!==z.version){let le=z.image;if(le===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ae(ne,z,L);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+L)}function F(z,L){let ne=i.get(z);if(z.version>0&&ne.__version!==z.version){ae(ne,z,L);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+L)}function k(z,L){let ne=i.get(z);if(z.version>0&&ne.__version!==z.version){ae(ne,z,L);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+L)}function G(z,L){let ne=i.get(z);if(z.version>0&&ne.__version!==z.version){ve(ne,z,L);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+L)}let Y={[c0]:r.REPEAT,[oo]:r.CLAMP_TO_EDGE,[QB]:r.MIRRORED_REPEAT},J={[Dn]:r.NEAREST,[fae]:r.NEAREST_MIPMAP_NEAREST,[SM]:r.NEAREST_MIPMAP_LINEAR,[ao]:r.LINEAR,[dB]:r.LINEAR_MIPMAP_NEAREST,[fm]:r.LINEAR_MIPMAP_LINEAR},Q={[RPe]:r.NEVER,[UPe]:r.ALWAYS,[LPe]:r.LESS,[Qoe]:r.LEQUAL,[PPe]:r.EQUAL,[NPe]:r.GEQUAL,[DPe]:r.GREATER,[IPe]:r.NOTEQUAL};function V(z,L,ne){if(L.type===hu&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===ao||L.magFilter===dB||L.magFilter===SM||L.magFilter===fm||L.minFilter===ao||L.minFilter===dB||L.minFilter===SM||L.minFilter===fm)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),ne?(r.texParameteri(z,r.TEXTURE_WRAP_S,Y[L.wrapS]),r.texParameteri(z,r.TEXTURE_WRAP_T,Y[L.wrapT]),(z===r.TEXTURE_3D||z===r.TEXTURE_2D_ARRAY)&&r.texParameteri(z,r.TEXTURE_WRAP_R,Y[L.wrapR]),r.texParameteri(z,r.TEXTURE_MAG_FILTER,J[L.magFilter]),r.texParameteri(z,r.TEXTURE_MIN_FILTER,J[L.minFilter])):(r.texParameteri(z,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(z,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(z===r.TEXTURE_3D||z===r.TEXTURE_2D_ARRAY)&&r.texParameteri(z,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(L.wrapS!==oo||L.wrapT!==oo)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(z,r.TEXTURE_MAG_FILTER,w(L.magFilter)),r.texParameteri(z,r.TEXTURE_MIN_FILTER,w(L.minFilter)),L.minFilter!==Dn&&L.minFilter!==ao&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),L.compareFunction&&(r.texParameteri(z,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(z,r.TEXTURE_COMPARE_FUNC,Q[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===Dn||L.minFilter!==SM&&L.minFilter!==fm||L.type===hu&&e.has("OES_texture_float_linear")===!1||s===!1&&L.type===PM&&e.has("OES_texture_half_float_linear")===!1)return;if(L.anisotropy>1||i.get(L).__currentAnisotropy){let le=e.get("EXT_texture_filter_anisotropic");r.texParameterf(z,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy}}}function K(z,L){let ne=!1;z.__webglInit===void 0&&(z.__webglInit=!0,L.addEventListener("dispose",T));let le=L.source,me=p.get(le);me===void 0&&(me={},p.set(le,me));let he=U(L);if(he!==z.__cacheKey){me[he]===void 0&&(me[he]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),me[he].usedTimes++;let et=me[z.__cacheKey];et!==void 0&&(me[z.__cacheKey].usedTimes--,et.usedTimes===0&&E(L)),z.__cacheKey=he,z.__webglTexture=me[he].texture}return ne}function ae(z,L,ne){let le=r.TEXTURE_2D;(L.isDataArrayTexture||L.isCompressedArrayTexture)&&(le=r.TEXTURE_2D_ARRAY),L.isData3DTexture&&(le=r.TEXTURE_3D);let me=K(z,L),he=L.source;t.bindTexture(le,z.__webglTexture,r.TEXTURE0+ne);let et=i.get(he);if(he.version!==et.__version||me===!0){t.activeTexture(r.TEXTURE0+ne);let Ke=Jr.getPrimaries(Jr.workingColorSpace),Se=L.colorSpace===Lh?null:Jr.getPrimaries(L.colorSpace),Ae=L.colorSpace===Lh||Ke===Se?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let nt=_(L)&&v(L.image)===!1,$=m(L.image,nt,!1,n.maxTextureSize);$=Ve(L,$);let it=v($)||s,Xe=a.convert(L.format,L.colorSpace),ze=a.convert(L.type),we=M(L.internalFormat,Xe,ze,L.colorSpace,L.isVideoTexture);V(le,L,it);let Ie,st=L.mipmaps,Je=s&&L.isVideoTexture!==!0&&we!==$oe,kt=et.__version===void 0||me===!0,X=he.dataReady,Te=S(L,$,it);if(L.isDepthTexture)we=r.DEPTH_COMPONENT,s?L.type===hu?we=r.DEPTH_COMPONENT32F:L.type===Ph?we=r.DEPTH_COMPONENT24:L.type===hm?we=r.DEPTH24_STENCIL8:we=r.DEPTH_COMPONENT16:L.type===hu&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===pm&&we===r.DEPTH_COMPONENT&&L.type!==Nk&&L.type!==Ph&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Ph,ze=a.convert(L.type)),L.format===f0&&we===r.DEPTH_COMPONENT&&(we=r.DEPTH_STENCIL,L.type!==hm&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=hm,ze=a.convert(L.type))),kt&&(Je?t.texStorage2D(r.TEXTURE_2D,1,we,$.width,$.height):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,ze,null));else if(L.isDataTexture)if(st.length>0&&it){Je&&kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,st[0].width,st[0].height);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,ze,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,ze,Ie.data);L.generateMipmaps=!1}else Je?(kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height),X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,$.width,$.height,Xe,ze,$.data)):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,ze,$.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){Je&&kt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Te,we,st[0].width,st[0].height,$.depth);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],L.format!==As?Xe!==null?Je?X&&t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,Ie.width,Ie.height,$.depth,Xe,Ie.data,0,0):t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Ie.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?X&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,Ie.width,Ie.height,$.depth,Xe,ze,Ie.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Xe,ze,Ie.data)}else{Je&&kt&&t.texStorage2D(r.TEXTURE_2D,Te,we,st[0].width,st[0].height);for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],L.format!==As?Xe!==null?Je?X&&t.compressedTexSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,Ie.data):t.compressedTexImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Ie.width,Ie.height,Xe,ze,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,ze,Ie.data)}else if(L.isDataArrayTexture)Je?(kt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,$.width,$.height,$.depth,Xe,ze,$.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,we,$.width,$.height,$.depth,0,Xe,ze,$.data);else if(L.isData3DTexture)Je?(kt&&t.texStorage3D(r.TEXTURE_3D,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,Xe,ze,$.data)):t.texImage3D(r.TEXTURE_3D,0,we,$.width,$.height,$.depth,0,Xe,ze,$.data);else if(L.isFramebufferTexture){if(kt)if(Je)t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height);else{let te=$.width,Me=$.height;for(let Pe=0;Pe<Te;Pe++)t.texImage2D(r.TEXTURE_2D,Pe,we,te,Me,0,Xe,ze,null),te>>=1,Me>>=1}}else if(st.length>0&&it){if(Je&&kt){let te=ct(st[0]);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}for(let te=0,Me=st.length;te<Me;te++)Ie=st[te],Je?X&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Xe,ze,Ie):t.texImage2D(r.TEXTURE_2D,te,we,Xe,ze,Ie);L.generateMipmaps=!1}else if(Je){if(kt){let te=ct($);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Xe,ze,$)}else t.texImage2D(r.TEXTURE_2D,0,we,Xe,ze,$);y(L,it)&&x(le),et.__version=he.version,L.onUpdate&&L.onUpdate(L)}z.__version=L.version}function ve(z,L,ne){if(L.image.length!==6)return;let le=K(z,L),me=L.source;t.bindTexture(r.TEXTURE_CUBE_MAP,z.__webglTexture,r.TEXTURE0+ne);let he=i.get(me);if(me.version!==he.__version||le===!0){t.activeTexture(r.TEXTURE0+ne);let et=Jr.getPrimaries(Jr.workingColorSpace),Ke=L.colorSpace===Lh?null:Jr.getPrimaries(L.colorSpace),Se=L.colorSpace===Lh||et===Ke?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);let Ae=L.isCompressedTexture||L.image[0].isCompressedTexture,nt=L.image[0]&&L.image[0].isDataTexture,$=[];for(let te=0;te<6;te++)!Ae&&!nt?$[te]=m(L.image[te],!1,!0,n.maxCubemapSize):$[te]=nt?L.image[te].image:L.image[te],$[te]=Ve(L,$[te]);let it=$[0],Xe=v(it)||s,ze=a.convert(L.format,L.colorSpace),we=a.convert(L.type),Ie=M(L.internalFormat,ze,we,L.colorSpace),st=s&&L.isVideoTexture!==!0,Je=he.__version===void 0||le===!0,kt=me.dataReady,X=S(L,it,Xe);V(r.TEXTURE_CUBE_MAP,L,Xe);let Te;if(Ae){st&&Je&&t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,it.width,it.height);for(let te=0;te<6;te++){Te=$[te].mipmaps;for(let Me=0;Me<Te.length;Me++){let Pe=Te[Me];L.format!==As?ze!==null?st?kt&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,Pe.width,Pe.height,ze,Pe.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,Pe.width,Pe.height,0,Pe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,Pe.width,Pe.height,ze,we,Pe.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,Pe.width,Pe.height,0,ze,we,Pe.data)}}}else{if(Te=L.mipmaps,st&&Je){Te.length>0&&X++;let te=ct($[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,X,Ie,te.width,te.height)}for(let te=0;te<6;te++)if(nt){st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,$[te].width,$[te].height,ze,we,$[te].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,$[te].width,$[te].height,0,ze,we,$[te].data);for(let Me=0;Me<Te.length;Me++){let xt=Te[Me].image[te].image;st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,xt.width,xt.height,ze,we,xt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,xt.width,xt.height,0,ze,we,xt.data)}}else{st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,ze,we,$[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,ze,we,$[te]);for(let Me=0;Me<Te.length;Me++){let Pe=Te[Me];st?kt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,ze,we,Pe.image[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,ze,we,Pe.image[te])}}}y(L,Xe)&&x(r.TEXTURE_CUBE_MAP),he.__version=me.version,L.onUpdate&&L.onUpdate(L)}z.__version=L.version}function ue(z,L,ne,le,me,he){let et=a.convert(ne.format,ne.colorSpace),Ke=a.convert(ne.type),Se=M(ne.internalFormat,et,Ke,ne.colorSpace);if(!i.get(L).__hasExternalTextures){let nt=Math.max(1,L.width>>he),$=Math.max(1,L.height>>he);me===r.TEXTURE_3D||me===r.TEXTURE_2D_ARRAY?t.texImage3D(me,he,Se,nt,$,L.depth,0,et,Ke,null):t.texImage2D(me,he,Se,nt,$,0,et,Ke,null)}t.bindFramebuffer(r.FRAMEBUFFER,z),Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,le,me,i.get(ne).__webglTexture,0,Le(L)):(me===r.TEXTURE_2D||me>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&me<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,le,me,i.get(ne).__webglTexture,he),t.bindFramebuffer(r.FRAMEBUFFER,null)}function se(z,L,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,z),L.depthBuffer&&!L.stencilBuffer){let le=s===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(ne||Ue(L)){let me=L.depthTexture;me&&me.isDepthTexture&&(me.type===hu?le=r.DEPTH_COMPONENT32F:me.type===Ph&&(le=r.DEPTH_COMPONENT24));let he=Le(L);Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,he,le,L.width,L.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,he,le,L.width,L.height)}else r.renderbufferStorage(r.RENDERBUFFER,le,L.width,L.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,z)}else if(L.depthBuffer&&L.stencilBuffer){let le=Le(L);ne&&Ue(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,L.width,L.height):Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,L.width,L.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,z)}else{let le=L.textures;for(let me=0;me<le.length;me++){let he=le[me],et=a.convert(he.format,he.colorSpace),Ke=a.convert(he.type),Se=M(he.internalFormat,et,Ke,he.colorSpace),Ae=Le(L);ne&&Ue(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Ae,Se,L.width,L.height):Ue(L)?l.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Ae,Se,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,Se,L.width,L.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ee(z,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,z),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),B(L.depthTexture,0);let le=i.get(L.depthTexture).__webglTexture,me=Le(L);if(L.depthTexture.format===pm)Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,le,0,me):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,le,0);else if(L.depthTexture.format===f0)Ue(L)?l.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,le,0,me):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,le,0);else throw new Error("Unknown depthTexture format")}function q(z){let L=i.get(z),ne=z.isWebGLCubeRenderTarget===!0;if(z.depthTexture&&!L.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");Ee(L.__webglFramebuffer,z)}else if(ne){L.__webglDepthbuffer=[];for(let le=0;le<6;le++)t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer[le]),L.__webglDepthbuffer[le]=r.createRenderbuffer(),se(L.__webglDepthbuffer[le],z,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer=r.createRenderbuffer(),se(L.__webglDepthbuffer,z,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function H(z,L,ne){let le=i.get(z);L!==void 0&&ue(le.__webglFramebuffer,z,z.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ne!==void 0&&q(z)}function We(z){let L=z.texture,ne=i.get(z),le=i.get(L);z.addEventListener("dispose",C);let me=z.textures,he=z.isWebGLCubeRenderTarget===!0,et=me.length>1,Ke=v(z)||s;if(et||(le.__webglTexture===void 0&&(le.__webglTexture=r.createTexture()),le.__version=L.version,o.memory.textures++),he){ne.__webglFramebuffer=[];for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer[Se]=[];for(let Ae=0;Ae<L.mipmaps.length;Ae++)ne.__webglFramebuffer[Se][Ae]=r.createFramebuffer()}else ne.__webglFramebuffer[Se]=r.createFramebuffer()}else{if(s&&L.mipmaps&&L.mipmaps.length>0){ne.__webglFramebuffer=[];for(let Se=0;Se<L.mipmaps.length;Se++)ne.__webglFramebuffer[Se]=r.createFramebuffer()}else ne.__webglFramebuffer=r.createFramebuffer();if(et)if(n.drawBuffers)for(let Se=0,Ae=me.length;Se<Ae;Se++){let nt=i.get(me[Se]);nt.__webglTexture===void 0&&(nt.__webglTexture=r.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(s&&z.samples>0&&Ue(z)===!1){ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let Se=0;Se<me.length;Se++){let Ae=me[Se];ne.__webglColorRenderbuffer[Se]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se]);let nt=a.convert(Ae.format,Ae.colorSpace),$=a.convert(Ae.type),it=M(Ae.internalFormat,nt,$,Ae.colorSpace,z.isXRRenderTarget===!0),Xe=Le(z);r.renderbufferStorageMultisample(r.RENDERBUFFER,Xe,it,z.width,z.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Se,r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se])}r.bindRenderbuffer(r.RENDERBUFFER,null),z.depthBuffer&&(ne.__webglDepthRenderbuffer=r.createRenderbuffer(),se(ne.__webglDepthRenderbuffer,z,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(he){t.bindTexture(r.TEXTURE_CUBE_MAP,le.__webglTexture),V(r.TEXTURE_CUBE_MAP,L,Ke);for(let Se=0;Se<6;Se++)if(s&&L.mipmaps&&L.mipmaps.length>0)for(let Ae=0;Ae<L.mipmaps.length;Ae++)ue(ne.__webglFramebuffer[Se][Ae],z,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ae);else ue(ne.__webglFramebuffer[Se],z,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0);y(L,Ke)&&x(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(et){for(let Se=0,Ae=me.length;Se<Ae;Se++){let nt=me[Se],$=i.get(nt);t.bindTexture(r.TEXTURE_2D,$.__webglTexture),V(r.TEXTURE_2D,nt,Ke),ue(ne.__webglFramebuffer,z,nt,r.COLOR_ATTACHMENT0+Se,r.TEXTURE_2D,0),y(nt,Ke)&&x(r.TEXTURE_2D)}t.unbindTexture()}else{let Se=r.TEXTURE_2D;if((z.isWebGL3DRenderTarget||z.isWebGLArrayRenderTarget)&&(s?Se=z.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Se,le.__webglTexture),V(Se,L,Ke),s&&L.mipmaps&&L.mipmaps.length>0)for(let Ae=0;Ae<L.mipmaps.length;Ae++)ue(ne.__webglFramebuffer[Ae],z,L,r.COLOR_ATTACHMENT0,Se,Ae);else ue(ne.__webglFramebuffer,z,L,r.COLOR_ATTACHMENT0,Se,0);y(L,Ke)&&x(Se),t.unbindTexture()}z.depthBuffer&&q(z)}function _e(z){let L=v(z)||s,ne=z.textures;for(let le=0,me=ne.length;le<me;le++){let he=ne[le];if(y(he,L)){let et=z.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ke=i.get(he).__webglTexture;t.bindTexture(et,Ke),x(et),t.unbindTexture()}}}function xe(z){if(s&&z.samples>0&&Ue(z)===!1){let L=z.textures,ne=z.width,le=z.height,me=r.COLOR_BUFFER_BIT,he=[],et=z.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ke=i.get(z),Se=L.length>1;if(Se)for(let Ae=0;Ae<L.length;Ae++)t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer);for(let Ae=0;Ae<L.length;Ae++){he.push(r.COLOR_ATTACHMENT0+Ae),z.depthBuffer&&he.push(et);let nt=Ke.__ignoreDepthValues!==void 0?Ke.__ignoreDepthValues:!1;if(nt===!1&&(z.depthBuffer&&(me|=r.DEPTH_BUFFER_BIT),z.stencilBuffer&&(me|=r.STENCIL_BUFFER_BIT)),Se&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ke.__webglColorRenderbuffer[Ae]),nt===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[et]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[et])),Se){let $=i.get(L[Ae]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,$,0)}r.blitFramebuffer(0,0,ne,le,0,0,ne,le,me,r.NEAREST),u&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,he)}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Se)for(let Ae=0;Ae<L.length;Ae++){t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.RENDERBUFFER,Ke.__webglColorRenderbuffer[Ae]);let nt=i.get(L[Ae]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ke.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ae,r.TEXTURE_2D,nt,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer)}}function Le(z){return Math.min(n.maxSamples,z.samples)}function Ue(z){let L=i.get(z);return s&&z.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(z){let L=o.render.frame;f.get(z)!==L&&(f.set(z,L),z.update())}function Ve(z,L){let ne=z.colorSpace,le=z.format,me=z.type;return z.isCompressedTexture===!0||z.isVideoTexture===!0||z.format===ek||ne!==Hh&&ne!==Lh&&(Jr.getTransfer(ne)===ai?s===!1?e.has("EXT_sRGB")===!0&&le===As?(z.format=ek,z.minFilter=ao,z.generateMipmaps=!1):L=lR.sRGBToLinear(L):(le!==As||me!==Nh)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),L}function ct(z){return typeof HTMLImageElement<"u"&&z instanceof HTMLImageElement?(c.width=z.naturalWidth||z.width,c.height=z.naturalHeight||z.height):typeof VideoFrame<"u"&&z instanceof VideoFrame?(c.width=z.displayWidth,c.height=z.displayHeight):(c.width=z.width,c.height=z.height),c}this.allocateTextureUnit=D,this.resetTextureUnits=A,this.setTexture2D=B,this.setTexture2DArray=F,this.setTexture3D=k,this.setTextureCube=G,this.rebindTextures=H,this.setupRenderTarget=We,this.updateRenderTargetMipmap=_e,this.updateMultisampleRenderTarget=xe,this.setupDepthRenderbuffer=q,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=Ue}function VUe(r,e,t){let i=t.isWebGL2;function n(a,o=Lh){let s,l=Jr.getTransfer(o);if(a===Nh)return r.UNSIGNED_BYTE;if(a===qoe)return r.UNSIGNED_SHORT_4_4_4_4;if(a===Zoe)return r.UNSIGNED_SHORT_5_5_5_1;if(a===gPe)return r.BYTE;if(a===yPe)return r.SHORT;if(a===Nk)return r.UNSIGNED_SHORT;if(a===Yoe)return r.INT;if(a===Ph)return r.UNSIGNED_INT;if(a===hu)return r.FLOAT;if(a===PM)return i?r.HALF_FLOAT:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(a===_Pe)return r.ALPHA;if(a===As)return r.RGBA;if(a===xPe)return r.LUMINANCE;if(a===SPe)return r.LUMINANCE_ALPHA;if(a===pm)return r.DEPTH_COMPONENT;if(a===f0)return r.DEPTH_STENCIL;if(a===ek)return s=e.get("EXT_sRGB"),s!==null?s.SRGB_ALPHA_EXT:null;if(a===MPe)return r.RED;if(a===joe)return r.RED_INTEGER;if(a===bPe)return r.RG;if(a===Koe)return r.RG_INTEGER;if(a===Joe)return r.RGBA_INTEGER;if(a===mB||a===vB||a===gB||a===yB)if(l===ai)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(a===mB)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===vB)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===gB)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===yB)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(a===mB)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===vB)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===gB)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===yB)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===hae||a===pae||a===dae||a===mae)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(a===hae)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===pae)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===dae)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===mae)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===$oe)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===vae||a===gae)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(a===vae)return l===ai?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(a===gae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===yae||a===_ae||a===xae||a===Sae||a===Mae||a===bae||a===wae||a===Tae||a===Eae||a===Aae||a===Cae||a===Rae||a===Lae||a===Pae)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(a===yae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===_ae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===xae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===Sae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===Mae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===bae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===wae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===Tae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===Eae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===Aae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===Cae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===Rae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===Lae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===Pae)return l===ai?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===_B||a===Dae||a===Iae)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(a===_B)return l===ai?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===Dae)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===Iae)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===wPe||a===Nae||a===Uae||a===Oae)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(a===_B)return s.COMPRESSED_RED_RGTC1_EXT;if(a===Nae)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===Uae)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===Oae)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===hm?i?r.UNSIGNED_INT_24_8:(s=e.get("WEBGL_depth_texture"),s!==null?s.UNSIGNED_INT_24_8_WEBGL:null):r[a]!==void 0?r[a]:null}return{convert:n}}var dk=class extends Nn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},xc=class extends ia{constructor(){super(),this.isGroup=!0,this.type="Group"}},GUe={type:"move"},RM=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xc,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new xc,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ye,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ye),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xc,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ye,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ye),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let n=null,a=null,o=null,s=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(let g of e.hand.values()){let m=t.getJointPose(g,i),v=this._getHandJoint(u,g);m!==null&&(v.matrix.fromArray(m.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=m.radius),v.visible=m!==null}let c=u.joints["index-finger-tip"],f=u.joints["thumb-tip"],h=c.position.distanceTo(f.position),p=.02,d=.005;u.inputState.pinching&&h>p+d?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&h<=p-d&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(a=t.getPose(e.gripSpace,i),a!==null&&(l.matrix.fromArray(a.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,a.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(a.linearVelocity)):l.hasLinearVelocity=!1,a.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(a.angularVelocity)):l.hasAngularVelocity=!1));s!==null&&(n=t.getPose(e.targetRaySpace,i),n===null&&a!==null&&(n=a),n!==null&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,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(GUe)))}return s!==null&&(s.visible=n!==null),l!==null&&(l.visible=a!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let i=new xc;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},HUe=`
  10237. void main() {
  10238. gl_Position = vec4( position, 1.0 );
  10239. }`,WUe=`
  10240. uniform sampler2DArray depthColor;
  10241. uniform float depthWidth;
  10242. uniform float depthHeight;
  10243. void main() {
  10244. vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
  10245. if ( coord.x >= 1.0 ) {
  10246. gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
  10247. } else {
  10248. gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
  10249. }
  10250. }`,mk=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){let n=new Vo,a=e.properties.get(n);a.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}render(e,t){if(this.texture!==null){if(this.mesh===null){let i=t.cameras[0].viewport,n=new pu({extensions:{fragDepth:!0},vertexShader:HUe,fragmentShader:WUe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new so(new vR(20,20),n)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}},vk=class extends Oh{constructor(e,t){super();let i=this,n=null,a=1,o=null,s="local-floor",l=1,u=null,c=null,f=null,h=null,p=null,d=null,g=new mk,m=t.getContextAttributes(),v=null,_=null,y=[],x=[],M=new yr,S=null,w=new Nn;w.layers.enable(1),w.viewport=new Pr;let T=new Nn;T.layers.enable(2),T.viewport=new Pr;let C=[w,T],b=new dk;b.layers.enable(1),b.layers.enable(2);let E=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let K=y[V];return K===void 0&&(K=new RM,y[V]=K),K.getTargetRaySpace()},this.getControllerGrip=function(V){let K=y[V];return K===void 0&&(K=new RM,y[V]=K),K.getGripSpace()},this.getHand=function(V){let K=y[V];return K===void 0&&(K=new RM,y[V]=K),K.getHandSpace()};function R(V){let K=x.indexOf(V.inputSource);if(K===-1)return;let ae=y[K];ae!==void 0&&(ae.update(V.inputSource,V.frame,u||o),ae.dispatchEvent({type:V.type,data:V.inputSource}))}function A(){n.removeEventListener("select",R),n.removeEventListener("selectstart",R),n.removeEventListener("selectend",R),n.removeEventListener("squeeze",R),n.removeEventListener("squeezestart",R),n.removeEventListener("squeezeend",R),n.removeEventListener("end",A),n.removeEventListener("inputsourceschange",D);for(let V=0;V<y.length;V++){let K=x[V];K!==null&&(x[V]=null,y[V].disconnect(K))}E=null,I=null,g.reset(),e.setRenderTarget(v),p=null,h=null,f=null,n=null,_=null,Q.stop(),i.isPresenting=!1,e.setPixelRatio(S),e.setSize(M.width,M.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){a=V,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){s=V,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||o},this.setReferenceSpace=function(V){u=V},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return f},this.getFrame=function(){return d},this.getSession=function(){return n},this.setSession=function(V){return WM(this,null,function*(){if(n=V,n!==null){if(v=e.getRenderTarget(),n.addEventListener("select",R),n.addEventListener("selectstart",R),n.addEventListener("selectend",R),n.addEventListener("squeeze",R),n.addEventListener("squeezestart",R),n.addEventListener("squeezeend",R),n.addEventListener("end",A),n.addEventListener("inputsourceschange",D),m.xrCompatible!==!0&&(yield t.makeXRCompatible()),S=e.getPixelRatio(),e.getSize(M),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let K={antialias:n.renderState.layers===void 0?m.antialias:!0,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:a};p=new XRWebGLLayer(n,t,K),n.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),_=new Sc(p.framebufferWidth,p.framebufferHeight,{format:As,type:Nh,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let K=null,ae=null,ve=null;m.depth&&(ve=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,K=m.stencil?f0:pm,ae=m.stencil?hm:Ph);let ue={colorFormat:t.RGBA8,depthFormat:ve,scaleFactor:a};f=new XRWebGLBinding(n,t),h=f.createProjectionLayer(ue),n.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),_=new Sc(h.textureWidth,h.textureHeight,{format:As,type:Nh,depthTexture:new yR(h.textureWidth,h.textureHeight,ae,void 0,void 0,void 0,void 0,void 0,void 0,K),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});let se=e.properties.get(_);se.__ignoreDepthValues=h.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(l),u=null,o=yield n.requestReferenceSpace(s),Q.setContext(n),Q.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(n!==null)return n.environmentBlendMode};function D(V){for(let K=0;K<V.removed.length;K++){let ae=V.removed[K],ve=x.indexOf(ae);ve>=0&&(x[ve]=null,y[ve].disconnect(ae))}for(let K=0;K<V.added.length;K++){let ae=V.added[K],ve=x.indexOf(ae);if(ve===-1){for(let se=0;se<y.length;se++)if(se>=x.length){x.push(ae),ve=se;break}else if(x[se]===null){x[se]=ae,ve=se;break}if(ve===-1)break}let ue=y[ve];ue&&ue.connect(ae)}}let U=new ye,B=new ye;function F(V,K,ae){U.setFromMatrixPosition(K.matrixWorld),B.setFromMatrixPosition(ae.matrixWorld);let ve=U.distanceTo(B),ue=K.projectionMatrix.elements,se=ae.projectionMatrix.elements,Ee=ue[14]/(ue[10]-1),q=ue[14]/(ue[10]+1),H=(ue[9]+1)/ue[5],We=(ue[9]-1)/ue[5],_e=(ue[8]-1)/ue[0],xe=(se[8]+1)/se[0],Le=Ee*_e,Ue=Ee*xe,Ne=ve/(-_e+xe),Ve=Ne*-_e;K.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(Ve),V.translateZ(Ne),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();let ct=Ee+Ne,z=q+Ne,L=Le-Ve,ne=Ue+(ve-Ve),le=H*q/z*ct,me=We*q/z*ct;V.projectionMatrix.makePerspective(L,ne,le,me,ct,z),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}function k(V,K){K===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(K.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(n===null)return;g.texture!==null&&(V.near=g.depthNear,V.far=g.depthFar),b.near=T.near=w.near=V.near,b.far=T.far=w.far=V.far,(E!==b.near||I!==b.far)&&(n.updateRenderState({depthNear:b.near,depthFar:b.far}),E=b.near,I=b.far,w.near=E,w.far=I,T.near=E,T.far=I,w.updateProjectionMatrix(),T.updateProjectionMatrix(),V.updateProjectionMatrix());let K=V.parent,ae=b.cameras;k(b,K);for(let ve=0;ve<ae.length;ve++)k(ae[ve],K);ae.length===2?F(b,w,T):b.projectionMatrix.copy(w.projectionMatrix),G(V,b,K)};function G(V,K,ae){ae===null?V.matrix.copy(K.matrixWorld):(V.matrix.copy(ae.matrixWorld),V.matrix.invert(),V.matrix.multiply(K.matrixWorld)),V.matrix.decompose(V.position,V.quaternion,V.scale),V.updateMatrixWorld(!0),V.projectionMatrix.copy(K.projectionMatrix),V.projectionMatrixInverse.copy(K.projectionMatrixInverse),V.isPerspectiveCamera&&(V.fov=h0*2*Math.atan(1/V.projectionMatrix.elements[5]),V.zoom=1)}this.getCamera=function(){return b},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(V){l=V,h!==null&&(h.fixedFoveation=V),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=V)},this.hasDepthSensing=function(){return g.texture!==null};let Y=null;function J(V,K){if(c=K.getViewerPose(u||o),d=K,c!==null){let ae=c.views;p!==null&&(e.setRenderTargetFramebuffer(_,p.framebuffer),e.setRenderTarget(_));let ve=!1;ae.length!==b.cameras.length&&(b.cameras.length=0,ve=!0);for(let se=0;se<ae.length;se++){let Ee=ae[se],q=null;if(p!==null)q=p.getViewport(Ee);else{let We=f.getViewSubImage(h,Ee);q=We.viewport,se===0&&(e.setRenderTargetTextures(_,We.colorTexture,h.ignoreDepthValues?void 0:We.depthStencilTexture),e.setRenderTarget(_))}let H=C[se];H===void 0&&(H=new Nn,H.layers.enable(se),H.viewport=new Pr,C[se]=H),H.matrix.fromArray(Ee.transform.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale),H.projectionMatrix.fromArray(Ee.projectionMatrix),H.projectionMatrixInverse.copy(H.projectionMatrix).invert(),H.viewport.set(q.x,q.y,q.width,q.height),se===0&&(b.matrix.copy(H.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale)),ve===!0&&b.cameras.push(H)}let ue=n.enabledFeatures;if(ue&&ue.includes("depth-sensing")){let se=f.getDepthInformation(ae[0]);se&&se.isValid&&se.texture&&g.init(e,se,n.renderState)}}for(let ae=0;ae<y.length;ae++){let ve=x[ae],ue=y[ae];ve!==null&&ue!==void 0&&ue.update(ve,K,u||o)}g.render(e,b),Y&&Y(V,K),K.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:K}),d=null}let Q=new ise;Q.setAnimationLoop(J),this.setAnimationLoop=function(V){Y=V},this.dispose=function(){}}},sm=new Fn,XUe=new Ht;function YUe(r,e){function t(m,v){m.matrixAutoUpdate===!0&&m.updateMatrix(),v.value.copy(m.matrix)}function i(m,v){v.color.getRGB(m.fogColor.value,rse(r)),v.isFog?(m.fogNear.value=v.near,m.fogFar.value=v.far):v.isFogExp2&&(m.fogDensity.value=v.density)}function n(m,v,_,y,x){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(m,v):v.isMeshToonMaterial?(a(m,v),f(m,v)):v.isMeshPhongMaterial?(a(m,v),c(m,v)):v.isMeshStandardMaterial?(a(m,v),h(m,v),v.isMeshPhysicalMaterial&&p(m,v,x)):v.isMeshMatcapMaterial?(a(m,v),d(m,v)):v.isMeshDepthMaterial?a(m,v):v.isMeshDistanceMaterial?(a(m,v),g(m,v)):v.isMeshNormalMaterial?a(m,v):v.isLineBasicMaterial?(o(m,v),v.isLineDashedMaterial&&s(m,v)):v.isPointsMaterial?l(m,v,_,y):v.isSpriteMaterial?u(m,v):v.isShadowMaterial?(m.color.value.copy(v.color),m.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(m,v){m.opacity.value=v.opacity,v.color&&m.diffuse.value.copy(v.color),v.emissive&&m.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.bumpMap&&(m.bumpMap.value=v.bumpMap,t(v.bumpMap,m.bumpMapTransform),m.bumpScale.value=v.bumpScale,v.side===lo&&(m.bumpScale.value*=-1)),v.normalMap&&(m.normalMap.value=v.normalMap,t(v.normalMap,m.normalMapTransform),m.normalScale.value.copy(v.normalScale),v.side===lo&&m.normalScale.value.negate()),v.displacementMap&&(m.displacementMap.value=v.displacementMap,t(v.displacementMap,m.displacementMapTransform),m.displacementScale.value=v.displacementScale,m.displacementBias.value=v.displacementBias),v.emissiveMap&&(m.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,m.emissiveMapTransform)),v.specularMap&&(m.specularMap.value=v.specularMap,t(v.specularMap,m.specularMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest);let _=e.get(v),y=_.envMap,x=_.envMapRotation;if(y&&(m.envMap.value=y,sm.copy(x),sm.x*=-1,sm.y*=-1,sm.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(sm.y*=-1,sm.z*=-1),m.envMapRotation.value.setFromMatrix4(XUe.makeRotationFromEuler(sm)),m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=v.reflectivity,m.ior.value=v.ior,m.refractionRatio.value=v.refractionRatio),v.lightMap){m.lightMap.value=v.lightMap;let M=r._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=v.lightMapIntensity*M,t(v.lightMap,m.lightMapTransform)}v.aoMap&&(m.aoMap.value=v.aoMap,m.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,m.aoMapTransform))}function o(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform))}function s(m,v){m.dashSize.value=v.dashSize,m.totalSize.value=v.dashSize+v.gapSize,m.scale.value=v.scale}function l(m,v,_,y){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.size.value=v.size*_,m.scale.value=y*.5,v.map&&(m.map.value=v.map,t(v.map,m.uvTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function u(m,v){m.diffuse.value.copy(v.color),m.opacity.value=v.opacity,m.rotation.value=v.rotation,v.map&&(m.map.value=v.map,t(v.map,m.mapTransform)),v.alphaMap&&(m.alphaMap.value=v.alphaMap,t(v.alphaMap,m.alphaMapTransform)),v.alphaTest>0&&(m.alphaTest.value=v.alphaTest)}function c(m,v){m.specular.value.copy(v.specular),m.shininess.value=Math.max(v.shininess,1e-4)}function f(m,v){v.gradientMap&&(m.gradientMap.value=v.gradientMap)}function h(m,v){m.metalness.value=v.metalness,v.metalnessMap&&(m.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,m.metalnessMapTransform)),m.roughness.value=v.roughness,v.roughnessMap&&(m.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,m.roughnessMapTransform)),e.get(v).envMap&&(m.envMapIntensity.value=v.envMapIntensity)}function p(m,v,_){m.ior.value=v.ior,v.sheen>0&&(m.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),m.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(m.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,m.sheenColorMapTransform)),v.sheenRoughnessMap&&(m.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,m.sheenRoughnessMapTransform))),v.clearcoat>0&&(m.clearcoat.value=v.clearcoat,m.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(m.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,m.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(m.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===lo&&m.clearcoatNormalScale.value.negate())),v.iridescence>0&&(m.iridescence.value=v.iridescence,m.iridescenceIOR.value=v.iridescenceIOR,m.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(m.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,m.iridescenceMapTransform)),v.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),v.transmission>0&&(m.transmission.value=v.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(m.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,m.transmissionMapTransform)),m.thickness.value=v.thickness,v.thicknessMap&&(m.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=v.attenuationDistance,m.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(m.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(m.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=v.specularIntensity,m.specularColor.value.copy(v.specularColor),v.specularColorMap&&(m.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,m.specularColorMapTransform)),v.specularIntensityMap&&(m.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,m.specularIntensityMapTransform))}function d(m,v){v.matcap&&(m.matcap.value=v.matcap)}function g(m,v){let _=e.get(v).light;m.referencePosition.value.setFromMatrixPosition(_.matrixWorld),m.nearDistance.value=_.shadow.camera.near,m.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function qUe(r,e,t,i){let n={},a={},o=[],s=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,y){let x=y.program;i.uniformBlockBinding(_,x)}function u(_,y){let x=n[_.id];x===void 0&&(d(_),x=c(_),n[_.id]=x,_.addEventListener("dispose",m));let M=y.program;i.updateUBOMapping(_,M);let S=e.render.frame;a[_.id]!==S&&(h(_),a[_.id]=S)}function c(_){let y=f();_.__bindingPointIndex=y;let x=r.createBuffer(),M=_.__size,S=_.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,M,S),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,x),x}function f(){for(let _=0;_<s;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(_){let y=n[_.id],x=_.uniforms,M=_.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let S=0,w=x.length;S<w;S++){let T=Array.isArray(x[S])?x[S]:[x[S]];for(let C=0,b=T.length;C<b;C++){let E=T[C];if(p(E,S,C,M)===!0){let I=E.__offset,R=Array.isArray(E.value)?E.value:[E.value],A=0;for(let D=0;D<R.length;D++){let U=R[D],B=g(U);typeof U=="number"||typeof U=="boolean"?(E.__data[0]=U,r.bufferSubData(r.UNIFORM_BUFFER,I+A,E.__data)):U.isMatrix3?(E.__data[0]=U.elements[0],E.__data[1]=U.elements[1],E.__data[2]=U.elements[2],E.__data[3]=0,E.__data[4]=U.elements[3],E.__data[5]=U.elements[4],E.__data[6]=U.elements[5],E.__data[7]=0,E.__data[8]=U.elements[6],E.__data[9]=U.elements[7],E.__data[10]=U.elements[8],E.__data[11]=0):(U.toArray(E.__data,A),A+=B.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,I,E.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function p(_,y,x,M){let S=_.value,w=y+"_"+x;if(M[w]===void 0)return typeof S=="number"||typeof S=="boolean"?M[w]=S:M[w]=S.clone(),!0;{let T=M[w];if(typeof S=="number"||typeof S=="boolean"){if(T!==S)return M[w]=S,!0}else if(T.equals(S)===!1)return T.copy(S),!0}return!1}function d(_){let y=_.uniforms,x=0,M=16;for(let w=0,T=y.length;w<T;w++){let C=Array.isArray(y[w])?y[w]:[y[w]];for(let b=0,E=C.length;b<E;b++){let I=C[b],R=Array.isArray(I.value)?I.value:[I.value];for(let A=0,D=R.length;A<D;A++){let U=R[A],B=g(U),F=x%M;F!==0&&M-F<B.boundary&&(x+=M-F),I.__data=new Float32Array(B.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=x,x+=B.storage}}}let S=x%M;return S>0&&(x+=M-S),_.__size=x,_.__cache={},this}function g(_){let y={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(y.boundary=4,y.storage=4):_.isVector2?(y.boundary=8,y.storage=8):_.isVector3||_.isColor?(y.boundary=16,y.storage=12):_.isVector4?(y.boundary=16,y.storage=16):_.isMatrix3?(y.boundary=48,y.storage=48):_.isMatrix4?(y.boundary=64,y.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),y}function m(_){let y=_.target;y.removeEventListener("dispose",m);let x=o.indexOf(y.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(n[y.id]),delete n[y.id],delete a[y.id]}function v(){for(let _ in n)r.deleteBuffer(n[_]);o=[],n={},a={}}return{bind:l,update:u,dispose:v}}var gk=class{constructor(e={}){let{canvas:t=KPe(),context:i=null,depth:n=!0,stencil:a=!0,alpha:o=!1,antialias:s=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;i!==null?h=i.getContextAttributes().alpha:h=o;let p=new Uint32Array(4),d=new Int32Array(4),g=null,m=null,v=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ma,this._useLegacyLights=!1,this.toneMapping=Ih,this.toneMappingExposure=1;let y=this,x=!1,M=0,S=0,w=null,T=-1,C=null,b=new Pr,E=new Pr,I=null,R=new er(0),A=0,D=t.width,U=t.height,B=1,F=null,k=null,G=new Pr(0,0,D,U),Y=new Pr(0,0,D,U),J=!1,Q=new UM,V=!1,K=!1,ae=null,ve=new Ht,ue=new yr,se=new ye,Ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return w===null?B:1}let H=i;function We(O,j){for(let re=0;re<O.length;re++){let ie=O[re],P=t.getContext(ie,j);if(P!==null)return P}return null}try{let O={alpha:!0,depth:n,stencil:a,antialias:s,premultipliedAlpha:l,preserveDrawingBuffer:u,powerPreference:c,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ik}`),t.addEventListener("webglcontextlost",kt,!1),t.addEventListener("webglcontextrestored",X,!1),t.addEventListener("webglcontextcreationerror",Te,!1),H===null){let j=["webgl2","webgl","experimental-webgl"];if(y.isWebGL1Renderer===!0&&j.shift(),H=We(j,O),H===null)throw We(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&H instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),H.getShaderPrecisionFormat===void 0&&(H.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(O){throw console.error("THREE.WebGLRenderer: "+O.message),O}let _e,xe,Le,Ue,Ne,Ve,ct,z,L,ne,le,me,he,et,Ke,Se,Ae,nt,$,it,Xe,ze,we,Ie;function st(){_e=new uNe(H),xe=new iNe(H,_e,e),_e.init(xe),ze=new VUe(H,_e,xe),Le=new BUe(H,_e,xe),Ue=new hNe(H),Ne=new AUe,Ve=new kUe(H,_e,Le,Ne,xe,ze,Ue),ct=new aNe(y),z=new lNe(y),L=new yDe(H,xe),we=new tNe(H,_e,L,xe),ne=new cNe(H,L,Ue,we),le=new vNe(H,ne,L,Ue),$=new mNe(H,xe,Ve),Se=new nNe(Ne),me=new EUe(y,ct,z,_e,xe,we,Se),he=new YUe(y,Ne),et=new RUe,Ke=new UUe(_e,xe),nt=new eNe(y,ct,z,Le,le,h,l),Ae=new zUe(y,le,xe),Ie=new qUe(H,Ue,xe,Le),it=new rNe(H,_e,Ue,xe),Xe=new fNe(H,_e,Ue,xe),Ue.programs=me.programs,y.capabilities=xe,y.extensions=_e,y.properties=Ne,y.renderLists=et,y.shadowMap=Ae,y.state=Le,y.info=Ue}st();let Je=new vk(y,H);this.xr=Je,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){let O=_e.get("WEBGL_lose_context");O&&O.loseContext()},this.forceContextRestore=function(){let O=_e.get("WEBGL_lose_context");O&&O.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(O){O!==void 0&&(B=O,this.setSize(D,U,!1))},this.getSize=function(O){return O.set(D,U)},this.setSize=function(O,j,re=!0){if(Je.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}D=O,U=j,t.width=Math.floor(O*B),t.height=Math.floor(j*B),re===!0&&(t.style.width=O+"px",t.style.height=j+"px"),this.setViewport(0,0,O,j)},this.getDrawingBufferSize=function(O){return O.set(D*B,U*B).floor()},this.setDrawingBufferSize=function(O,j,re){D=O,U=j,B=re,t.width=Math.floor(O*re),t.height=Math.floor(j*re),this.setViewport(0,0,O,j)},this.getCurrentViewport=function(O){return O.copy(b)},this.getViewport=function(O){return O.copy(G)},this.setViewport=function(O,j,re,ie){O.isVector4?G.set(O.x,O.y,O.z,O.w):G.set(O,j,re,ie),Le.viewport(b.copy(G).multiplyScalar(B).round())},this.getScissor=function(O){return O.copy(Y)},this.setScissor=function(O,j,re,ie){O.isVector4?Y.set(O.x,O.y,O.z,O.w):Y.set(O,j,re,ie),Le.scissor(E.copy(Y).multiplyScalar(B).round())},this.getScissorTest=function(){return J},this.setScissorTest=function(O){Le.setScissorTest(J=O)},this.setOpaqueSort=function(O){F=O},this.setTransparentSort=function(O){k=O},this.getClearColor=function(O){return O.copy(nt.getClearColor())},this.setClearColor=function(){nt.setClearColor.apply(nt,arguments)},this.getClearAlpha=function(){return nt.getClearAlpha()},this.setClearAlpha=function(){nt.setClearAlpha.apply(nt,arguments)},this.clear=function(O=!0,j=!0,re=!0){let ie=0;if(O){let P=!1;if(w!==null){let W=w.texture.format;P=W===Joe||W===Koe||W===joe}if(P){let W=w.texture.type,ee=W===Nh||W===Ph||W===Nk||W===hm||W===qoe||W===Zoe,ge=nt.getClearColor(),ce=nt.getClearAlpha(),Oe=ge.r,Ge=ge.g,Re=ge.b;ee?(p[0]=Oe,p[1]=Ge,p[2]=Re,p[3]=ce,H.clearBufferuiv(H.COLOR,0,p)):(d[0]=Oe,d[1]=Ge,d[2]=Re,d[3]=ce,H.clearBufferiv(H.COLOR,0,d))}else ie|=H.COLOR_BUFFER_BIT}j&&(ie|=H.DEPTH_BUFFER_BIT),re&&(ie|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",kt,!1),t.removeEventListener("webglcontextrestored",X,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),et.dispose(),Ke.dispose(),Ne.dispose(),ct.dispose(),z.dispose(),le.dispose(),we.dispose(),Ie.dispose(),me.dispose(),Je.dispose(),Je.removeEventListener("sessionstart",Zr),Je.removeEventListener("sessionend",Vt),ae&&(ae.dispose(),ae=null),Dr.stop()};function kt(O){O.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function X(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let O=Ue.autoReset,j=Ae.enabled,re=Ae.autoUpdate,ie=Ae.needsUpdate,P=Ae.type;st(),Ue.autoReset=O,Ae.enabled=j,Ae.autoUpdate=re,Ae.needsUpdate=ie,Ae.type=P}function Te(O){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",O.statusMessage)}function te(O){let j=O.target;j.removeEventListener("dispose",te),Me(j)}function Me(O){Pe(O),Ne.remove(O)}function Pe(O){let j=Ne.get(O).programs;j!==void 0&&(j.forEach(function(re){me.releaseProgram(re)}),O.isShaderMaterial&&me.releaseShaderCache(O))}this.renderBufferDirect=function(O,j,re,ie,P,W){j===null&&(j=Ee);let ee=P.isMesh&&P.matrixWorld.determinant()<0,ge=b0(O,j,re,ie,P);Le.setMaterial(ie,ee);let ce=re.index,Oe=1;if(ie.wireframe===!0){if(ce=ne.getWireframeAttribute(re),ce===void 0)return;Oe=2}let Ge=re.drawRange,Re=re.attributes.position,pt=Ge.start*Oe,mt=(Ge.start+Ge.count)*Oe;W!==null&&(pt=Math.max(pt,W.start*Oe),mt=Math.min(mt,(W.start+W.count)*Oe)),ce!==null?(pt=Math.max(pt,0),mt=Math.min(mt,ce.count)):Re!=null&&(pt=Math.max(pt,0),mt=Math.min(mt,Re.count));let $e=mt-pt;if($e<0||$e===1/0)return;we.setup(P,ie,ge,re,ce);let at,wt=it;if(ce!==null&&(at=L.get(ce),wt=Xe,wt.setIndex(at)),P.isMesh)ie.wireframe===!0?(Le.setLineWidth(ie.wireframeLinewidth*q()),wt.setMode(H.LINES)):wt.setMode(H.TRIANGLES);else if(P.isLine){let je=ie.linewidth;je===void 0&&(je=1),Le.setLineWidth(je*q()),P.isLineSegments?wt.setMode(H.LINES):P.isLineLoop?wt.setMode(H.LINE_LOOP):wt.setMode(H.LINE_STRIP)}else P.isPoints?wt.setMode(H.POINTS):P.isSprite&&wt.setMode(H.TRIANGLES);if(P.isBatchedMesh)wt.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else if(P.isInstancedMesh)wt.renderInstances(pt,$e,P.count);else if(re.isInstancedBufferGeometry){let je=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,mi=Math.min(re.instanceCount,je);wt.renderInstances(pt,$e,mi)}else wt.render(pt,$e)};function xt(O,j,re){O.transparent===!0&&O.side===yc&&O.forceSinglePass===!1?(O.side=lo,O.needsUpdate=!0,Go(O,j,re),O.side=Uh,O.needsUpdate=!0,Go(O,j,re),O.side=yc):Go(O,j,re)}this.compile=function(O,j,re=null){re===null&&(re=O),m=Ke.get(re),m.init(),_.push(m),re.traverseVisible(function(P){P.isLight&&P.layers.test(j.layers)&&(m.pushLight(P),P.castShadow&&m.pushShadow(P))}),O!==re&&O.traverseVisible(function(P){P.isLight&&P.layers.test(j.layers)&&(m.pushLight(P),P.castShadow&&m.pushShadow(P))}),m.setupLights(y._useLegacyLights);let ie=new Set;return O.traverse(function(P){let W=P.material;if(W)if(Array.isArray(W))for(let ee=0;ee<W.length;ee++){let ge=W[ee];xt(ge,re,P),ie.add(ge)}else xt(W,re,P),ie.add(W)}),_.pop(),m=null,ie},this.compileAsync=function(O,j,re=null){let ie=this.compile(O,j,re);return new Promise(P=>{function W(){if(ie.forEach(function(ee){Ne.get(ee).currentProgram.isReady()&&ie.delete(ee)}),ie.size===0){P(O);return}setTimeout(W,10)}_e.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let zt=null;function Mr(O){zt&&zt(O)}function Zr(){Dr.stop()}function Vt(){Dr.start()}let Dr=new ise;Dr.setAnimationLoop(Mr),typeof self<"u"&&Dr.setContext(self),this.setAnimationLoop=function(O){zt=O,Je.setAnimationLoop(O),O===null?Dr.stop():Dr.start()},Je.addEventListener("sessionstart",Zr),Je.addEventListener("sessionend",Vt),this.render=function(O,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),Je.enabled===!0&&Je.isPresenting===!0&&(Je.cameraAutoUpdate===!0&&Je.updateCamera(j),j=Je.getCamera()),O.isScene===!0&&O.onBeforeRender(y,O,j,w),m=Ke.get(O,_.length),m.init(),_.push(m),ve.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),Q.setFromProjectionMatrix(ve),K=this.localClippingEnabled,V=Se.init(this.clippingPlanes,K),g=et.get(O,v.length),g.init(),v.push(g),oi(O,j,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(F,k),this.info.render.frame++,V===!0&&Se.beginShadows();let re=m.state.shadowsArray;if(Ae.render(re,O,j),V===!0&&Se.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Je.enabled===!1||Je.isPresenting===!1||Je.hasDepthSensing()===!1)&&nt.render(g,O),m.setupLights(y._useLegacyLights),j.isArrayCamera){let ie=j.cameras;for(let P=0,W=ie.length;P<W;P++){let ee=ie[P];Yh(g,O,ee,ee.viewport)}}else Yh(g,O,j);w!==null&&(Ve.updateMultisampleRenderTarget(w),Ve.updateRenderTargetMipmap(w)),O.isScene===!0&&O.onAfterRender(y,O,j),we.resetDefaultState(),T=-1,C=null,_.pop(),_.length>0?m=_[_.length-1]:m=null,v.pop(),v.length>0?g=v[v.length-1]:g=null};function oi(O,j,re,ie){if(O.visible===!1)return;if(O.layers.test(j.layers)){if(O.isGroup)re=O.renderOrder;else if(O.isLOD)O.autoUpdate===!0&&O.update(j);else if(O.isLight)m.pushLight(O),O.castShadow&&m.pushShadow(O);else if(O.isSprite){if(!O.frustumCulled||Q.intersectsSprite(O)){ie&&se.setFromMatrixPosition(O.matrixWorld).applyMatrix4(ve);let ee=le.update(O),ge=O.material;ge.visible&&g.push(O,ee,ge,re,se.z,null)}}else if((O.isMesh||O.isLine||O.isPoints)&&(!O.frustumCulled||Q.intersectsObject(O))){let ee=le.update(O),ge=O.material;if(ie&&(O.boundingSphere!==void 0?(O.boundingSphere===null&&O.computeBoundingSphere(),se.copy(O.boundingSphere.center)):(ee.boundingSphere===null&&ee.computeBoundingSphere(),se.copy(ee.boundingSphere.center)),se.applyMatrix4(O.matrixWorld).applyMatrix4(ve)),Array.isArray(ge)){let ce=ee.groups;for(let Oe=0,Ge=ce.length;Oe<Ge;Oe++){let Re=ce[Oe],pt=ge[Re.materialIndex];pt&&pt.visible&&g.push(O,ee,pt,re,se.z,Re)}}else ge.visible&&g.push(O,ee,ge,re,se.z,null)}}let W=O.children;for(let ee=0,ge=W.length;ee<ge;ee++)oi(W[ee],j,re,ie)}function Yh(O,j,re,ie){let P=O.opaque,W=O.transmissive,ee=O.transparent;m.setupLightsView(re),V===!0&&Se.setGlobalState(y.clippingPlanes,re),W.length>0&&M0(P,W,j,re),ie&&Le.viewport(b.copy(ie)),P.length>0&&Ds(P,j,re),W.length>0&&Ds(W,j,re),ee.length>0&&Ds(ee,j,re),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function M0(O,j,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;let W=xe.isWebGL2;ae===null&&(ae=new Sc(1,1,{generateMipmaps:!0,type:_e.has("EXT_color_buffer_half_float")?PM:Nh,minFilter:fm,samples:W?4:0})),y.getDrawingBufferSize(ue),W?ae.setSize(ue.x,ue.y):ae.setSize(sR(ue.x),sR(ue.y));let ee=y.getRenderTarget();y.setRenderTarget(ae),y.getClearColor(R),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear();let ge=y.toneMapping;y.toneMapping=Ih,Ds(O,re,ie),Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae);let ce=!1;for(let Oe=0,Ge=j.length;Oe<Ge;Oe++){let Re=j[Oe],pt=Re.object,mt=Re.geometry,$e=Re.material,at=Re.group;if($e.side===yc&&pt.layers.test(ie.layers)){let wt=$e.side;$e.side=lo,$e.needsUpdate=!0,qh(pt,re,ie,mt,$e,at),$e.side=wt,$e.needsUpdate=!0,ce=!0}}ce===!0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),y.setRenderTarget(ee),y.setClearColor(R,A),y.toneMapping=ge}function Ds(O,j,re){let ie=j.isScene===!0?j.overrideMaterial:null;for(let P=0,W=O.length;P<W;P++){let ee=O[P],ge=ee.object,ce=ee.geometry,Oe=ie===null?ee.material:ie,Ge=ee.group;ge.layers.test(re.layers)&&qh(ge,j,re,ce,Oe,Ge)}}function qh(O,j,re,ie,P,W){O.onBeforeRender(y,j,re,ie,P,W),O.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,O.matrixWorld),O.normalMatrix.getNormalMatrix(O.modelViewMatrix),P.onBeforeRender(y,j,re,ie,O,W),P.transparent===!0&&P.side===yc&&P.forceSinglePass===!1?(P.side=lo,P.needsUpdate=!0,y.renderBufferDirect(re,j,ie,P,O,W),P.side=Uh,P.needsUpdate=!0,y.renderBufferDirect(re,j,ie,P,O,W),P.side=yc):y.renderBufferDirect(re,j,ie,P,O,W),O.onAfterRender(y,j,re,ie,P,W)}function Go(O,j,re){j.isScene!==!0&&(j=Ee);let ie=Ne.get(O),P=m.state.lights,W=m.state.shadowsArray,ee=P.state.version,ge=me.getParameters(O,P.state,W,j,re),ce=me.getProgramCacheKey(ge),Oe=ie.programs;ie.environment=O.isMeshStandardMaterial?j.environment:null,ie.fog=j.fog,ie.envMap=(O.isMeshStandardMaterial?z:ct).get(O.envMap||ie.environment),ie.envMapRotation=ie.environment!==null&&O.envMap===null?j.environmentRotation:O.envMapRotation,Oe===void 0&&(O.addEventListener("dispose",te),Oe=new Map,ie.programs=Oe);let Ge=Oe.get(ce);if(Ge!==void 0){if(ie.currentProgram===Ge&&ie.lightsStateVersion===ee)return wc(O,ge),Ge}else ge.uniforms=me.getUniforms(O),O.onBuild(re,ge,y),O.onBeforeCompile(ge,y),Ge=me.acquireProgram(ge,ce),Oe.set(ce,Ge),ie.uniforms=ge.uniforms;let Re=ie.uniforms;return(!O.isShaderMaterial&&!O.isRawShaderMaterial||O.clipping===!0)&&(Re.clippingPlanes=Se.uniform),wc(O,ge),ie.needsLights=T0(O),ie.lightsStateVersion=ee,ie.needsLights&&(Re.ambientLightColor.value=P.state.ambient,Re.lightProbe.value=P.state.probe,Re.directionalLights.value=P.state.directional,Re.directionalLightShadows.value=P.state.directionalShadow,Re.spotLights.value=P.state.spot,Re.spotLightShadows.value=P.state.spotShadow,Re.rectAreaLights.value=P.state.rectArea,Re.ltc_1.value=P.state.rectAreaLTC1,Re.ltc_2.value=P.state.rectAreaLTC2,Re.pointLights.value=P.state.point,Re.pointLightShadows.value=P.state.pointShadow,Re.hemisphereLights.value=P.state.hemi,Re.directionalShadowMap.value=P.state.directionalShadowMap,Re.directionalShadowMatrix.value=P.state.directionalShadowMatrix,Re.spotShadowMap.value=P.state.spotShadowMap,Re.spotLightMatrix.value=P.state.spotLightMatrix,Re.spotLightMap.value=P.state.spotLightMap,Re.pointShadowMap.value=P.state.pointShadowMap,Re.pointShadowMatrix.value=P.state.pointShadowMatrix),ie.currentProgram=Ge,ie.uniformsList=null,Ge}function Zh(O){if(O.uniformsList===null){let j=O.currentProgram.getUniforms();O.uniformsList=s0.seqWithValue(j.seq,O.uniforms)}return O.uniformsList}function wc(O,j){let re=Ne.get(O);re.outputColorSpace=j.outputColorSpace,re.batching=j.batching,re.instancing=j.instancing,re.instancingColor=j.instancingColor,re.instancingMorph=j.instancingMorph,re.skinning=j.skinning,re.morphTargets=j.morphTargets,re.morphNormals=j.morphNormals,re.morphColors=j.morphColors,re.morphTargetsCount=j.morphTargetsCount,re.numClippingPlanes=j.numClippingPlanes,re.numIntersection=j.numClipIntersection,re.vertexAlphas=j.vertexAlphas,re.vertexTangents=j.vertexTangents,re.toneMapping=j.toneMapping}function b0(O,j,re,ie,P){j.isScene!==!0&&(j=Ee),Ve.resetTextureUnits();let W=j.fog,ee=ie.isMeshStandardMaterial?j.environment:null,ge=w===null?y.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:Hh,ce=(ie.isMeshStandardMaterial?z:ct).get(ie.envMap||ee),Oe=ie.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,Ge=!!re.attributes.tangent&&(!!ie.normalMap||ie.anisotropy>0),Re=!!re.morphAttributes.position,pt=!!re.morphAttributes.normal,mt=!!re.morphAttributes.color,$e=Ih;ie.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&($e=y.toneMapping);let at=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,wt=at!==void 0?at.length:0,je=Ne.get(ie),mi=m.state.lights;if(V===!0&&(K===!0||O!==C)){let jr=O===C&&ie.id===T;Se.setState(ie,O,jr)}let Ut=!1;ie.version===je.__version?(je.needsLights&&je.lightsStateVersion!==mi.state.version||je.outputColorSpace!==ge||P.isBatchedMesh&&je.batching===!1||!P.isBatchedMesh&&je.batching===!0||P.isInstancedMesh&&je.instancing===!1||!P.isInstancedMesh&&je.instancing===!0||P.isSkinnedMesh&&je.skinning===!1||!P.isSkinnedMesh&&je.skinning===!0||P.isInstancedMesh&&je.instancingColor===!0&&P.instanceColor===null||P.isInstancedMesh&&je.instancingColor===!1&&P.instanceColor!==null||P.isInstancedMesh&&je.instancingMorph===!0&&P.morphTexture===null||P.isInstancedMesh&&je.instancingMorph===!1&&P.morphTexture!==null||je.envMap!==ce||ie.fog===!0&&je.fog!==W||je.numClippingPlanes!==void 0&&(je.numClippingPlanes!==Se.numPlanes||je.numIntersection!==Se.numIntersection)||je.vertexAlphas!==Oe||je.vertexTangents!==Ge||je.morphTargets!==Re||je.morphNormals!==pt||je.morphColors!==mt||je.toneMapping!==$e||xe.isWebGL2===!0&&je.morphTargetsCount!==wt)&&(Ut=!0):(Ut=!0,je.__version=ie.version);let Rr=je.currentProgram;Ut===!0&&(Rr=Go(ie,j,P));let Wi=!1,Mt=!1,Mi=!1,sr=Rr.getUniforms(),un=je.uniforms;if(Le.useProgram(Rr.program)&&(Wi=!0,Mt=!0,Mi=!0),ie.id!==T&&(T=ie.id,Mt=!0),Wi||C!==O){sr.setValue(H,"projectionMatrix",O.projectionMatrix),sr.setValue(H,"viewMatrix",O.matrixWorldInverse);let jr=sr.map.cameraPosition;jr!==void 0&&jr.setValue(H,se.setFromMatrixPosition(O.matrixWorld)),xe.logarithmicDepthBuffer&&sr.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&sr.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),C!==O&&(C=O,Mt=!0,Mi=!0)}if(P.isSkinnedMesh){sr.setOptional(H,P,"bindMatrix"),sr.setOptional(H,P,"bindMatrixInverse");let jr=P.skeleton;jr&&(xe.floatVertexTextures?(jr.boneTexture===null&&jr.computeBoneTexture(),sr.setValue(H,"boneTexture",jr.boneTexture,Ve)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}P.isBatchedMesh&&(sr.setOptional(H,P,"batchingTexture"),sr.setValue(H,"batchingTexture",P._matricesTexture,Ve));let mu=re.morphAttributes;if((mu.position!==void 0||mu.normal!==void 0||mu.color!==void 0&&xe.isWebGL2===!0)&&$.update(P,re,Rr),(Mt||je.receiveShadow!==P.receiveShadow)&&(je.receiveShadow=P.receiveShadow,sr.setValue(H,"receiveShadow",P.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(un.envMap.value=ce,un.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),Mt&&(sr.setValue(H,"toneMappingExposure",y.toneMappingExposure),je.needsLights&&w0(un,Mi),W&&ie.fog===!0&&he.refreshFogUniforms(un,W),he.refreshMaterialUniforms(un,ie,B,U,ae),s0.upload(H,Zh(je),un,Ve)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(s0.upload(H,Zh(je),un,Ve),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&sr.setValue(H,"center",P.center),sr.setValue(H,"modelViewMatrix",P.modelViewMatrix),sr.setValue(H,"normalMatrix",P.normalMatrix),sr.setValue(H,"modelMatrix",P.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){let jr=ie.uniformsGroups;for(let vu=0,jh=jr.length;vu<jh;vu++)if(xe.isWebGL2){let Kh=jr[vu];Ie.update(Kh,Rr),Ie.bind(Kh,Rr)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Rr}function w0(O,j){O.ambientLightColor.needsUpdate=j,O.lightProbe.needsUpdate=j,O.directionalLights.needsUpdate=j,O.directionalLightShadows.needsUpdate=j,O.pointLights.needsUpdate=j,O.pointLightShadows.needsUpdate=j,O.spotLights.needsUpdate=j,O.spotLightShadows.needsUpdate=j,O.rectAreaLights.needsUpdate=j,O.hemisphereLights.needsUpdate=j}function T0(O){return O.isMeshLambertMaterial||O.isMeshToonMaterial||O.isMeshPhongMaterial||O.isMeshStandardMaterial||O.isShadowMaterial||O.isShaderMaterial&&O.lights===!0}this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(O,j,re){Ne.get(O.texture).__webglTexture=j,Ne.get(O.depthTexture).__webglTexture=re;let ie=Ne.get(O);ie.__hasExternalTextures=!0,ie.__autoAllocateDepthBuffer=re===void 0,ie.__autoAllocateDepthBuffer||_e.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ie.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(O,j){let re=Ne.get(O);re.__webglFramebuffer=j,re.__useDefaultFramebuffer=j===void 0},this.setRenderTarget=function(O,j=0,re=0){w=O,M=j,S=re;let ie=!0,P=null,W=!1,ee=!1;if(O){let ce=Ne.get(O);ce.__useDefaultFramebuffer!==void 0?(Le.bindFramebuffer(H.FRAMEBUFFER,null),ie=!1):ce.__webglFramebuffer===void 0?Ve.setupRenderTarget(O):ce.__hasExternalTextures&&Ve.rebindTextures(O,Ne.get(O.texture).__webglTexture,Ne.get(O.depthTexture).__webglTexture);let Oe=O.texture;(Oe.isData3DTexture||Oe.isDataArrayTexture||Oe.isCompressedArrayTexture)&&(ee=!0);let Ge=Ne.get(O).__webglFramebuffer;O.isWebGLCubeRenderTarget?(Array.isArray(Ge[j])?P=Ge[j][re]:P=Ge[j],W=!0):xe.isWebGL2&&O.samples>0&&Ve.useMultisampledRTT(O)===!1?P=Ne.get(O).__webglMultisampledFramebuffer:Array.isArray(Ge)?P=Ge[re]:P=Ge,b.copy(O.viewport),E.copy(O.scissor),I=O.scissorTest}else b.copy(G).multiplyScalar(B).floor(),E.copy(Y).multiplyScalar(B).floor(),I=J;if(Le.bindFramebuffer(H.FRAMEBUFFER,P)&&xe.drawBuffers&&ie&&Le.drawBuffers(O,P),Le.viewport(b),Le.scissor(E),Le.setScissorTest(I),W){let ce=Ne.get(O.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+j,ce.__webglTexture,re)}else if(ee){let ce=Ne.get(O.texture),Oe=j||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,ce.__webglTexture,re||0,Oe)}T=-1},this.readRenderTargetPixels=function(O,j,re,ie,P,W,ee){if(!(O&&O.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Ne.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&ee!==void 0&&(ge=ge[ee]),ge){Le.bindFramebuffer(H.FRAMEBUFFER,ge);try{let ce=O.texture,Oe=ce.format,Ge=ce.type;if(Oe!==As&&ze.convert(Oe)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Re=Ge===PM&&(_e.has("EXT_color_buffer_half_float")||xe.isWebGL2&&_e.has("EXT_color_buffer_float"));if(Ge!==Nh&&ze.convert(Ge)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===hu&&(xe.isWebGL2||_e.has("OES_texture_float")||_e.has("WEBGL_color_buffer_float")))&&!Re){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=O.width-ie&&re>=0&&re<=O.height-P&&H.readPixels(j,re,ie,P,ze.convert(Oe),ze.convert(Ge),W)}finally{let ce=w!==null?Ne.get(w).__webglFramebuffer:null;Le.bindFramebuffer(H.FRAMEBUFFER,ce)}}},this.copyFramebufferToTexture=function(O,j,re=0){let ie=Math.pow(2,-re),P=Math.floor(j.image.width*ie),W=Math.floor(j.image.height*ie);Ve.setTexture2D(j,0),H.copyTexSubImage2D(H.TEXTURE_2D,re,0,0,O.x,O.y,P,W),Le.unbindTexture()},this.copyTextureToTexture=function(O,j,re,ie=0){let P=j.image.width,W=j.image.height,ee=ze.convert(re.format),ge=ze.convert(re.type);Ve.setTexture2D(re,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,re.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,re.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,re.unpackAlignment),j.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,P,W,ee,ge,j.image.data):j.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,j.mipmaps[0].width,j.mipmaps[0].height,ee,j.mipmaps[0].data):H.texSubImage2D(H.TEXTURE_2D,ie,O.x,O.y,ee,ge,j.image),ie===0&&re.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),Le.unbindTexture()},this.copyTextureToTexture3D=function(O,j,re,ie,P=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let W=Math.round(O.max.x-O.min.x),ee=Math.round(O.max.y-O.min.y),ge=O.max.z-O.min.z+1,ce=ze.convert(ie.format),Oe=ze.convert(ie.type),Ge;if(ie.isData3DTexture)Ve.setTexture3D(ie,0),Ge=H.TEXTURE_3D;else if(ie.isDataArrayTexture||ie.isCompressedArrayTexture)Ve.setTexture2DArray(ie,0),Ge=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,ie.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ie.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,ie.unpackAlignment);let Re=H.getParameter(H.UNPACK_ROW_LENGTH),pt=H.getParameter(H.UNPACK_IMAGE_HEIGHT),mt=H.getParameter(H.UNPACK_SKIP_PIXELS),$e=H.getParameter(H.UNPACK_SKIP_ROWS),at=H.getParameter(H.UNPACK_SKIP_IMAGES),wt=re.isCompressedTexture?re.mipmaps[P]:re.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,wt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,wt.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,O.min.x),H.pixelStorei(H.UNPACK_SKIP_ROWS,O.min.y),H.pixelStorei(H.UNPACK_SKIP_IMAGES,O.min.z),re.isDataTexture||re.isData3DTexture?H.texSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,Oe,wt.data):ie.isCompressedArrayTexture?H.compressedTexSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,wt.data):H.texSubImage3D(Ge,P,j.x,j.y,j.z,W,ee,ge,ce,Oe,wt),H.pixelStorei(H.UNPACK_ROW_LENGTH,Re),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,pt),H.pixelStorei(H.UNPACK_SKIP_PIXELS,mt),H.pixelStorei(H.UNPACK_SKIP_ROWS,$e),H.pixelStorei(H.UNPACK_SKIP_IMAGES,at),P===0&&ie.generateMipmaps&&H.generateMipmap(Ge),Le.unbindTexture()},this.initTexture=function(O){O.isCubeTexture?Ve.setTextureCube(O,0):O.isData3DTexture?Ve.setTexture3D(O,0):O.isDataArrayTexture||O.isCompressedArrayTexture?Ve.setTexture2DArray(O,0):Ve.setTexture2D(O,0),Le.unbindTexture()},this.resetState=function(){M=0,S=0,w=null,Le.reset(),we.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return _c}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===Ok?"display-p3":"srgb",t.unpackColorSpace=Jr.workingColorSpace===OR?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}},yk=class extends gk{};yk.prototype.isWebGL1Renderer=!0;var Roe=new ye,Loe=new Pr,Poe=new Pr,ZUe=new ye,Doe=new Ht,jC=new ye,XB=new zh,Ioe=new Ht,YB=new IM,_R=class extends so{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=uae,this.bindMatrix=new Ht,this.bindMatrixInverse=new Ht,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Fh),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,jC),this.boundingBox.expandByPoint(jC)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new zh),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,jC),this.boundingSphere.expandByPoint(jC)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let i=this.material,n=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),XB.copy(this.boundingSphere),XB.applyMatrix4(n),e.ray.intersectsSphere(XB)!==!1&&(Ioe.copy(n).invert(),YB.copy(e.ray).applyMatrix4(Ioe),!(this.boundingBox!==null&&YB.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,YB)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Pr,t=this.geometry.attributes.skinWeight;for(let i=0,n=t.count;i<n;i++){e.fromBufferAttribute(t,i);let a=1/e.manhattanLength();a!==1/0?e.multiplyScalar(a):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===uae?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===vPe?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let i=this.skeleton,n=this.geometry;Loe.fromBufferAttribute(n.attributes.skinIndex,e),Poe.fromBufferAttribute(n.attributes.skinWeight,e),Roe.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let a=0;a<4;a++){let o=Poe.getComponent(a);if(o!==0){let s=Loe.getComponent(a);Doe.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(ZUe.copy(Roe).applyMatrix4(Doe),o)}}return t.applyMatrix4(this.bindMatrixInverse)}},v0=class extends ia{constructor(){super(),this.isBone=!0,this.type="Bone"}},_k=class extends Vo{constructor(e=null,t=1,i=1,n,a,o,s,l,u=Dn,c=Dn,f,h){super(null,o,s,l,u,c,n,a,f,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Noe=new Ht,jUe=new Ht,xR=class r{constructor(e=[],t=[]){this.uuid=Wh(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new Ht)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let i=new Ht;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let a=0,o=e.length;a<o;a++){let s=e[a]?e[a].matrixWorld:jUe;Noe.multiplyMatrices(s,t[a]),Noe.toArray(i,a*16)}n!==null&&(n.needsUpdate=!0)}clone(){return new r(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let i=new _k(t,e,e,As,hu);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,n=e.bones.length;i<n;i++){let a=e.bones[i],o=t[a];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",a),o=new v0),this.bones.push(o),this.boneInverses.push(new Ht().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let n=0,a=t.length;n<a;n++){let o=t[n];e.bones.push(o.uuid);let s=i[n];e.boneInverses.push(s.toArray())}return e}};var OM=class extends Mc{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new er(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Uoe=new ye,Ooe=new ye,Foe=new Ht,qB=new IM,KC=new zh,SR=class extends ia{constructor(e=new Rs,t=new OM){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,i=[0];for(let n=1,a=t.count;n<a;n++)Uoe.fromBufferAttribute(t,n-1),Ooe.fromBufferAttribute(t,n),i[n]=i[n-1],i[n]+=Uoe.distanceTo(Ooe);e.setAttribute("lineDistance",new Un(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,a=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),KC.copy(i.boundingSphere),KC.applyMatrix4(n),KC.radius+=a,e.ray.intersectsSphere(KC)===!1)return;Foe.copy(n).invert(),qB.copy(e.ray).applyMatrix4(Foe);let s=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=s*s,u=new ye,c=new ye,f=new ye,h=new ye,p=this.isLineSegments?2:1,d=i.index,m=i.attributes.position;if(d!==null){let v=Math.max(0,o.start),_=Math.min(d.count,o.start+o.count);for(let y=v,x=_-1;y<x;y+=p){let M=d.getX(y),S=d.getX(y+1);if(u.fromBufferAttribute(m,M),c.fromBufferAttribute(m,S),qB.distanceSqToSegment(u,c,h,f)>l)continue;h.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{let v=Math.max(0,o.start),_=Math.min(m.count,o.start+o.count);for(let y=v,x=_-1;y<x;y+=p){if(u.fromBufferAttribute(m,y),c.fromBufferAttribute(m,y+1),qB.distanceSqToSegment(u,c,h,f)>l)continue;h.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(h);S<e.near||S>e.far||t.push({distance:S,point:f.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,o=n.length;a<o;a++){let s=n[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=a}}}}};var MR=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),a=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),a+=i.distanceTo(n),t.push(a),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),n=0,a=i.length,o;t?o=t:o=e*i[a-1];let s=0,l=a-1,u;for(;s<=l;)if(n=Math.floor(s+(l-s)/2),u=i[n]-o,u<0)s=n+1;else if(u>0)l=n-1;else{l=n;break}if(n=l,i[n]===o)return n/(a-1);let c=i[n],h=i[n+1]-c,p=(o-c)/h;return(n+p)/(a-1)}getTangent(e,t){let n=e-1e-4,a=e+1e-4;n<0&&(n=0),a>1&&(a=1);let o=this.getPoint(n),s=this.getPoint(a),l=t||(o.isVector2?new yr:new ye);return l.copy(s).sub(o).normalize(),l}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new ye,n=[],a=[],o=[],s=new ye,l=new Ht;for(let p=0;p<=e;p++){let d=p/e;n[p]=this.getTangentAt(d,new ye)}a[0]=new ye,o[0]=new ye;let u=Number.MAX_VALUE,c=Math.abs(n[0].x),f=Math.abs(n[0].y),h=Math.abs(n[0].z);c<=u&&(u=c,i.set(1,0,0)),f<=u&&(u=f,i.set(0,1,0)),h<=u&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),a[0].crossVectors(n[0],s),o[0].crossVectors(n[0],a[0]);for(let p=1;p<=e;p++){if(a[p]=a[p-1].clone(),o[p]=o[p-1].clone(),s.crossVectors(n[p-1],n[p]),s.length()>Number.EPSILON){s.normalize();let d=Math.acos(In(n[p-1].dot(n[p]),-1,1));a[p].applyMatrix4(l.makeRotationAxis(s,d))}o[p].crossVectors(n[p],a[p])}if(t===!0){let p=Math.acos(In(a[0].dot(a[e]),-1,1));p/=e,n[0].dot(s.crossVectors(a[0],a[e]))>0&&(p=-p);for(let d=1;d<=e;d++)a[d].applyMatrix4(l.makeRotationAxis(n[d],p*d)),o[d].crossVectors(n[d],a[d])}return{tangents:n,normals:a,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}};var KUe={triangulate:function(r,e,t=2){let i=e&&e.length,n=i?e[0]*t:r.length,a=use(r,0,n,t,!0),o=[];if(!a||a.next===a.prev)return o;let s,l,u,c,f,h,p;if(i&&(a=tOe(r,e,a,t)),r.length>80*t){s=u=r[0],l=c=r[1];for(let d=t;d<n;d+=t)f=r[d],h=r[d+1],f<s&&(s=f),h<l&&(l=h),f>u&&(u=f),h>c&&(c=h);p=Math.max(u-s,c-l),p=p!==0?32767/p:0}return FM(a,o,t,s,l,p,0),o}};function use(r,e,t,i,n){let a,o;if(n===hOe(r,e,t,i)>0)for(a=e;a<t;a+=i)o=zoe(a,r[a],r[a+1],o);else for(a=t-i;a>=e;a-=i)o=zoe(a,r[a],r[a+1],o);return o&&zR(o,o.next)&&(BM(o),o=o.next),o}function dm(r,e){if(!r)return r;e||(e=r);let t=r,i;do if(i=!1,!t.steiner&&(zR(t,t.next)||Si(t.prev,t,t.next)===0)){if(BM(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function FM(r,e,t,i,n,a,o){if(!r)return;!o&&a&&oOe(r,i,n,a);let s=r,l,u;for(;r.prev!==r.next;){if(l=r.prev,u=r.next,a?$Ue(r,i,n,a):JUe(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),BM(r),r=u.next,s=u.next;continue}if(r=u,r===s){o?o===1?(r=QUe(dm(r),e,t),FM(r,e,t,i,n,a,2)):o===2&&eOe(r,e,t,i,n,a):FM(dm(r),e,t,i,n,a,1);break}}}function JUe(r){let e=r.prev,t=r,i=r.next;if(Si(e,t,i)>=0)return!1;let n=e.x,a=t.x,o=i.x,s=e.y,l=t.y,u=i.y,c=n<a?n<o?n:o:a<o?a:o,f=s<l?s<u?s:u:l<u?l:u,h=n>a?n>o?n:o:a>o?a:o,p=s>l?s>u?s:u:l>u?l:u,d=i.next;for(;d!==e;){if(d.x>=c&&d.x<=h&&d.y>=f&&d.y<=p&&n0(n,s,a,l,o,u,d.x,d.y)&&Si(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function $Ue(r,e,t,i){let n=r.prev,a=r,o=r.next;if(Si(n,a,o)>=0)return!1;let s=n.x,l=a.x,u=o.x,c=n.y,f=a.y,h=o.y,p=s<l?s<u?s:u:l<u?l:u,d=c<f?c<h?c:h:f<h?f:h,g=s>l?s>u?s:u:l>u?l:u,m=c>f?c>h?c:h:f>h?f:h,v=xk(p,d,e,t,i),_=xk(g,m,e,t,i),y=r.prevZ,x=r.nextZ;for(;y&&y.z>=v&&x&&x.z<=_;){if(y.x>=p&&y.x<=g&&y.y>=d&&y.y<=m&&y!==n&&y!==o&&n0(s,c,l,f,u,h,y.x,y.y)&&Si(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=p&&x.x<=g&&x.y>=d&&x.y<=m&&x!==n&&x!==o&&n0(s,c,l,f,u,h,x.x,x.y)&&Si(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=v;){if(y.x>=p&&y.x<=g&&y.y>=d&&y.y<=m&&y!==n&&y!==o&&n0(s,c,l,f,u,h,y.x,y.y)&&Si(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=_;){if(x.x>=p&&x.x<=g&&x.y>=d&&x.y<=m&&x!==n&&x!==o&&n0(s,c,l,f,u,h,x.x,x.y)&&Si(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function QUe(r,e,t){let i=r;do{let n=i.prev,a=i.next.next;!zR(n,a)&&cse(n,i,i.next,a)&&zM(n,a)&&zM(a,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(a.i/t|0),BM(i),BM(i.next),i=r=a),i=i.next}while(i!==r);return dm(i)}function eOe(r,e,t,i,n,a){let o=r;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&uOe(o,s)){let l=fse(o,s);o=dm(o,o.next),l=dm(l,l.next),FM(o,e,t,i,n,a,0),FM(l,e,t,i,n,a,0);return}s=s.next}o=o.next}while(o!==r)}function tOe(r,e,t,i){let n=[],a,o,s,l,u;for(a=0,o=e.length;a<o;a++)s=e[a]*i,l=a<o-1?e[a+1]*i:r.length,u=use(r,s,l,i,!1),u===u.next&&(u.steiner=!0),n.push(lOe(u));for(n.sort(rOe),a=0;a<n.length;a++)t=iOe(n[a],t);return t}function rOe(r,e){return r.x-e.x}function iOe(r,e){let t=nOe(r,e);if(!t)return e;let i=fse(t,r);return dm(i,i.next),dm(t,t.next)}function nOe(r,e){let t=e,i=-1/0,n,a=r.x,o=r.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){let h=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=a&&h>i&&(i=h,n=t.x<t.next.x?t:t.next,h===a))return n}t=t.next}while(t!==e);if(!n)return null;let s=n,l=n.x,u=n.y,c=1/0,f;t=n;do a>=t.x&&t.x>=l&&a!==t.x&&n0(o<u?a:i,o,l,u,o<u?i:a,o,t.x,t.y)&&(f=Math.abs(o-t.y)/(a-t.x),zM(t,r)&&(f<c||f===c&&(t.x>n.x||t.x===n.x&&aOe(n,t)))&&(n=t,c=f)),t=t.next;while(t!==s);return n}function aOe(r,e){return Si(r.prev,r,e.prev)<0&&Si(e.next,r,r.next)<0}function oOe(r,e,t,i){let n=r;do n.z===0&&(n.z=xk(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,sOe(n)}function sOe(r){let e,t,i,n,a,o,s,l,u=1;do{for(t=r,r=null,a=null,o=0;t;){for(o++,i=t,s=0,e=0;e<u&&(s++,i=i.nextZ,!!i);e++);for(l=u;s>0||l>0&&i;)s!==0&&(l===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,s--):(n=i,i=i.nextZ,l--),a?a.nextZ=n:r=n,n.prevZ=a,a=n;t=i}a.nextZ=null,u*=2}while(o>1);return r}function xk(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function lOe(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function n0(r,e,t,i,n,a,o,s){return(n-o)*(e-s)>=(r-o)*(a-s)&&(r-o)*(i-s)>=(t-o)*(e-s)&&(t-o)*(a-s)>=(n-o)*(i-s)}function uOe(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!cOe(r,e)&&(zM(r,e)&&zM(e,r)&&fOe(r,e)&&(Si(r.prev,r,e.prev)||Si(r,e.prev,e))||zR(r,e)&&Si(r.prev,r,r.next)>0&&Si(e.prev,e,e.next)>0)}function Si(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function zR(r,e){return r.x===e.x&&r.y===e.y}function cse(r,e,t,i){let n=$C(Si(r,e,t)),a=$C(Si(r,e,i)),o=$C(Si(t,i,r)),s=$C(Si(t,i,e));return!!(n!==a&&o!==s||n===0&&JC(r,t,e)||a===0&&JC(r,i,e)||o===0&&JC(t,r,i)||s===0&&JC(t,e,i))}function JC(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function $C(r){return r>0?1:r<0?-1:0}function cOe(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&cse(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function zM(r,e){return Si(r.prev,r,r.next)<0?Si(r,e,r.next)>=0&&Si(r,r.prev,e)>=0:Si(r,e,r.prev)<0||Si(r,r.next,e)<0}function fOe(r,e){let t=r,i=!1,n=(r.x+e.x)/2,a=(r.y+e.y)/2;do t.y>a!=t.next.y>a&&t.next.y!==t.y&&n<(t.next.x-t.x)*(a-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function fse(r,e){let t=new Sk(r.i,r.x,r.y),i=new Sk(e.i,e.x,e.y),n=r.next,a=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,a.next=i,i.prev=a,i}function zoe(r,e,t,i){let n=new Sk(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function BM(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Sk(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function hOe(r,e,t,i){let n=0;for(let a=e,o=t-i;a<t;a+=i)n+=(r[o]-r[a])*(r[a+1]+r[o+1]),o=a;return n}var bR=class r{static area(e){let t=e.length,i=0;for(let n=t-1,a=0;a<t;n=a++)i+=e[n].x*e[a].y-e[a].x*e[n].y;return i*.5}static isClockWise(e){return r.area(e)<0}static triangulateShape(e,t){let i=[],n=[],a=[];Boe(e),koe(i,e);let o=e.length;t.forEach(Boe);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,koe(i,t[l]);let s=KUe.triangulate(i,n);for(let l=0;l<s.length;l+=3)a.push(s.slice(l,l+3));return a}};function Boe(r){let e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function koe(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}var g0=class extends Mc{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new er(16777215),this.specular=new er(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new er(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Uk,this.normalScale=new yr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Fn,this.combine=NR,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};var wR=class extends Mc{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new er(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new er(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Uk,this.normalScale=new yr(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Fn,this.combine=NR,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};function QC(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function pOe(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function dOe(r){function e(n,a){return r[n]-r[a]}let t=r.length,i=new Array(t);for(let n=0;n!==t;++n)i[n]=n;return i.sort(e),i}function Voe(r,e,t){let i=r.length,n=new r.constructor(i);for(let a=0,o=0;o!==i;++a){let s=t[a]*e;for(let l=0;l!==e;++l)n[o++]=r[s+l]}return n}function hse(r,e,t,i){let n=1,a=r[0];for(;a!==void 0&&a[i]===void 0;)a=r[n++];if(a===void 0)return;let o=a[i];if(o!==void 0)if(Array.isArray(o))do o=a[i],o!==void 0&&(e.push(a.time),t.push.apply(t,o)),a=r[n++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[i],o!==void 0&&(e.push(a.time),o.toArray(t,t.length)),a=r[n++];while(a!==void 0);else do o=a[i],o!==void 0&&(e.push(a.time),t.push(o)),a=r[n++];while(a!==void 0)}var y0=class{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],a=t[i-1];e:{t:{let o;r:{i:if(!(e<n)){for(let s=i+2;;){if(n===void 0){if(e<a)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===s)break;if(a=n,n=t[++i],e<n)break t}o=t.length;break r}if(!(e>=a)){let s=t[1];e<s&&(i=2,a=s);for(let l=i-2;;){if(a===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(n=a,a=t[--i-1],e>=a)break t}o=i,i=0;break r}break e}for(;i<o;){let s=i+o>>>1;e<t[s]?o=s:i=s+1}if(n=t[i],a=t[i-1],a===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,a,n)}return this.interpolate_(i,a,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,a=e*n;for(let o=0;o!==n;++o)t[o]=i[a+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Mk=class extends y0{constructor(e,t,i,n){super(e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Fae,endingEnd:Fae}}intervalChanged_(e,t,i){let n=this.parameterPositions,a=e-2,o=e+1,s=n[a],l=n[o];if(s===void 0)switch(this.getSettings_().endingStart){case zae:a=e,s=2*t-i;break;case Bae:a=n.length-2,s=t+n[a]-n[a+1];break;default:a=e,s=i}if(l===void 0)switch(this.getSettings_().endingEnd){case zae:o=e,l=2*i-t;break;case Bae:o=1,l=i+n[1]-n[0];break;default:o=e-1,l=t}let u=(i-t)*.5,c=this.valueSize;this._weightPrev=u/(t-s),this._weightNext=u/(l-i),this._offsetPrev=a*c,this._offsetNext=o*c}interpolate_(e,t,i,n){let a=this.resultBuffer,o=this.sampleValues,s=this.valueSize,l=e*s,u=l-s,c=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,p=this._weightNext,d=(i-t)/(n-t),g=d*d,m=g*d,v=-h*m+2*h*g-h*d,_=(1+h)*m+(-1.5-2*h)*g+(-.5+h)*d+1,y=(-1-p)*m+(1.5+p)*g+.5*d,x=p*m-p*g;for(let M=0;M!==s;++M)a[M]=v*o[c+M]+_*o[u+M]+y*o[l+M]+x*o[f+M];return a}},bk=class extends y0{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let a=this.resultBuffer,o=this.sampleValues,s=this.valueSize,l=e*s,u=l-s,c=(i-t)/(n-t),f=1-c;for(let h=0;h!==s;++h)a[h]=o[u+h]*f+o[l+h]*c;return a}},wk=class extends y0{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}},Ls=class{constructor(e,t,i,n){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=QC(t,this.TimeBufferType),this.values=QC(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:QC(e.times,Array),values:QC(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(i.interpolation=n)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new wk(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new bk(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Mk(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case tR:t=this.InterpolantFactoryMethodDiscrete;break;case rR:t=this.InterpolantFactoryMethodLinear;break;case xB:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return tR;case this.InterpolantFactoryMethodLinear:return rR;case this.InterpolantFactoryMethodSmooth:return xB}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){let i=this.times,n=i.length,a=0,o=n-1;for(;a!==n&&i[a]<e;)++a;for(;o!==-1&&i[o]>t;)--o;if(++o,a!==0||o!==n){a>=o&&(o=Math.max(o,1),a=o-1);let s=this.getValueSize();this.times=i.slice(a,o),this.values=this.values.slice(a*s,o*s)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,n=this.values,a=i.length;a===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let s=0;s!==a;s++){let l=i[s];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,l,o),e=!1;break}o=l}if(n!==void 0&&pOe(n))for(let s=0,l=n.length;s!==l;++s){let u=n[s];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,s,u),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===xB,a=e.length-1,o=1;for(let s=1;s<a;++s){let l=!1,u=e[s],c=e[s+1];if(u!==c&&(s!==1||u!==e[0]))if(n)l=!0;else{let f=s*i,h=f-i,p=f+i;for(let d=0;d!==i;++d){let g=t[f+d];if(g!==t[h+d]||g!==t[p+d]){l=!0;break}}}if(l){if(s!==o){e[o]=e[s];let f=s*i,h=o*i;for(let p=0;p!==i;++p)t[h+p]=t[f+p]}++o}}if(a>0){e[o]=e[a];for(let s=a*i,l=o*i,u=0;u!==i;++u)t[l+u]=t[s+u];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,n=new i(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};Ls.prototype.TimeBufferType=Float32Array;Ls.prototype.ValueBufferType=Float32Array;Ls.prototype.DefaultInterpolation=rR;var Bh=class extends Ls{};Bh.prototype.ValueTypeName="bool";Bh.prototype.ValueBufferType=Array;Bh.prototype.DefaultInterpolation=tR;Bh.prototype.InterpolantFactoryMethodLinear=void 0;Bh.prototype.InterpolantFactoryMethodSmooth=void 0;var TR=class extends Ls{};TR.prototype.ValueTypeName="color";var kh=class extends Ls{};kh.prototype.ValueTypeName="number";var Tk=class extends y0{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let a=this.resultBuffer,o=this.sampleValues,s=this.valueSize,l=(i-t)/(n-t),u=e*s;for(let c=u+s;u!==c;u+=4)On.slerpFlat(a,0,o,u-s,o,u,l);return a}},du=class extends Ls{InterpolantFactoryMethodLinear(e){return new Tk(this.times,this.values,this.getValueSize(),e)}};du.prototype.ValueTypeName="quaternion";du.prototype.DefaultInterpolation=rR;du.prototype.InterpolantFactoryMethodSmooth=void 0;var Vh=class extends Ls{};Vh.prototype.ValueTypeName="string";Vh.prototype.ValueBufferType=Array;Vh.prototype.DefaultInterpolation=tR;Vh.prototype.InterpolantFactoryMethodLinear=void 0;Vh.prototype.InterpolantFactoryMethodSmooth=void 0;var Gh=class extends Ls{};Gh.prototype.ValueTypeName="vector";var ER=class{constructor(e,t=-1,i,n=TPe){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=Wh(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,n=1/(e.fps||1);for(let o=0,s=i.length;o!==s;++o)t.push(vOe(i[o]).scale(n));let a=new this(e.name,e.duration,t,e.blendMode);return a.uuid=e.uuid,a}static toJSON(e){let t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let a=0,o=i.length;a!==o;++a)t.push(Ls.toJSON(i[a]));return n}static CreateFromMorphTargetSequence(e,t,i,n){let a=t.length,o=[];for(let s=0;s<a;s++){let l=[],u=[];l.push((s+a-1)%a,s,(s+1)%a),u.push(0,1,0);let c=dOe(l);l=Voe(l,1,c),u=Voe(u,1,c),!n&&l[0]===0&&(l.push(a),u.push(u[0])),o.push(new kh(".morphTargetInfluences["+t[s].name+"]",l,u).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){let n=e;i=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<i.length;n++)if(i[n].name===t)return i[n];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let n={},a=/^([\w-]*?)([\d]+)$/;for(let s=0,l=e.length;s<l;s++){let u=e[s],c=u.name.match(a);if(c&&c.length>1){let f=c[1],h=n[f];h||(n[f]=h=[]),h.push(u)}}let o=[];for(let s in n)o.push(this.CreateFromMorphTargetSequence(s,n[s],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(f,h,p,d,g){if(p.length!==0){let m=[],v=[];hse(p,m,v,d),m.length!==0&&g.push(new f(h,m,v))}},n=[],a=e.name||"default",o=e.fps||30,s=e.blendMode,l=e.length||-1,u=e.hierarchy||[];for(let f=0;f<u.length;f++){let h=u[f].keys;if(!(!h||h.length===0))if(h[0].morphTargets){let p={},d;for(d=0;d<h.length;d++)if(h[d].morphTargets)for(let g=0;g<h[d].morphTargets.length;g++)p[h[d].morphTargets[g]]=-1;for(let g in p){let m=[],v=[];for(let _=0;_!==h[d].morphTargets.length;++_){let y=h[d];m.push(y.time),v.push(y.morphTarget===g?1:0)}n.push(new kh(".morphTargetInfluence["+g+"]",m,v))}l=p.length*o}else{let p=".bones["+t[f].name+"]";i(Gh,p+".position",h,"pos",n),i(du,p+".quaternion",h,"rot",n),i(Gh,p+".scale",h,"scl",n)}}return n.length===0?null:new this(a,l,n,s)}resetDuration(){let e=this.tracks,t=0;for(let i=0,n=e.length;i!==n;++i){let a=this.tracks[i];t=Math.max(t,a.times[a.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function mOe(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return kh;case"vector":case"vector2":case"vector3":case"vector4":return Gh;case"color":return TR;case"quaternion":return du;case"bool":case"boolean":return Bh;case"string":return Vh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function vOe(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=mOe(r.type);if(r.times===void 0){let t=[],i=[];hse(r.keys,t,i,"value"),r.times=t,r.values=i}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}var AR={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}},Ek=class{constructor(e,t,i){let n=this,a=!1,o=0,s=0,l,u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(c){s++,a===!1&&n.onStart!==void 0&&n.onStart(c,o,s),a=!0},this.itemEnd=function(c){o++,n.onProgress!==void 0&&n.onProgress(c,o,s),o===s&&(a=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(c){n.onError!==void 0&&n.onError(c)},this.resolveURL=function(c){return l?l(c):c},this.setURLModifier=function(c){return l=c,this},this.addHandler=function(c,f){return u.push(c,f),this},this.removeHandler=function(c){let f=u.indexOf(c);return f!==-1&&u.splice(f,2),this},this.getHandler=function(c){for(let f=0,h=u.length;f<h;f+=2){let p=u[f],d=u[f+1];if(p.global&&(p.lastIndex=0),p.test(c))return d}return null}}},gOe=new Ek,mm=(()=>{class r{constructor(t){this.manager=t!==void 0?t:gOe,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,i){let n=this;return new Promise(function(a,o){n.load(t,a,i,o)})}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}}return r.DEFAULT_MATERIAL_NAME="__DEFAULT",r})(),mc={},Ak=class extends Error{constructor(e,t){super(e),this.response=t}},CR=class extends mm{constructor(e){super(e)}load(e,t,i,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let a=AR.get(e);if(a!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0),a;if(mc[e]!==void 0){mc[e].push({onLoad:t,onProgress:i,onError:n});return}mc[e]=[],mc[e].push({onLoad:t,onProgress:i,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,l=this.responseType;fetch(o).then(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;let c=mc[e],f=u.body.getReader(),h=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),p=h?parseInt(h):0,d=p!==0,g=0,m=new ReadableStream({start(v){_();function _(){f.read().then(({done:y,value:x})=>{if(y)v.close();else{g+=x.byteLength;let M=new ProgressEvent("progress",{lengthComputable:d,loaded:g,total:p});for(let S=0,w=c.length;S<w;S++){let T=c[S];T.onProgress&&T.onProgress(M)}v.enqueue(x),_()}})}}});return new Response(m)}else throw new Ak(`fetch for "${u.url}" responded with ${u.status}: ${u.statusText}`,u)}).then(u=>{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(c=>new DOMParser().parseFromString(c,s));case"json":return u.json();default:if(s===void 0)return u.text();{let f=/charset="?([^;"\s]*)"?/i.exec(s),h=f&&f[1]?f[1].toLowerCase():void 0,p=new TextDecoder(h);return u.arrayBuffer().then(d=>p.decode(d))}}}).then(u=>{AR.add(e,u);let c=mc[e];delete mc[e];for(let f=0,h=c.length;f<h;f++){let p=c[f];p.onLoad&&p.onLoad(u)}}).catch(u=>{let c=mc[e];if(c===void 0)throw this.manager.itemError(e),u;delete mc[e];for(let f=0,h=c.length;f<h;f++){let p=c[f];p.onError&&p.onError(u)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var Ck=class extends mm{constructor(e){super(e)}load(e,t,i,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let a=this,o=AR.get(e);if(o!==void 0)return a.manager.itemStart(e),setTimeout(function(){t&&t(o),a.manager.itemEnd(e)},0),o;let s=DM("img");function l(){c(),AR.add(e,this),t&&t(this),a.manager.itemEnd(e)}function u(f){c(),n&&n(f),a.manager.itemError(e),a.manager.itemEnd(e)}function c(){s.removeEventListener("load",l,!1),s.removeEventListener("error",u,!1)}return s.addEventListener("load",l,!1),s.addEventListener("error",u,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(s.crossOrigin=this.crossOrigin),a.manager.itemStart(e),s.src=e,s}};var RR=class extends mm{constructor(e){super(e)}load(e,t,i,n){let a=new Vo,o=new Ck(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(s){a.image=s,a.needsUpdate=!0,t!==void 0&&t(a)},i,n),a}},_0=class extends ia{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new er(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};var ZB=new Ht,Goe=new ye,Hoe=new ye,kM=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new yr(512,512),this.map=null,this.mapPass=null,this.matrix=new Ht,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new UM,this._frameExtents=new yr(1,1),this._viewportCount=1,this._viewports=[new Pr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;Goe.setFromMatrixPosition(e.matrixWorld),t.position.copy(Goe),Hoe.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Hoe),t.updateMatrixWorld(),ZB.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ZB),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ZB)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},Rk=class extends kM{constructor(){super(new Nn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=h0*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;(i!==t.fov||n!==t.aspect||a!==t.far)&&(t.fov=i,t.aspect=n,t.far=a,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},LR=class extends _0{constructor(e,t,i=0,n=Math.PI/3,a=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.target=new ia,this.distance=i,this.angle=n,this.penumbra=a,this.decay=o,this.map=null,this.shadow=new Rk}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},Woe=new Ht,EM=new ye,jB=new ye,Lk=class extends kM{constructor(){super(new Nn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new yr(4,2),this._viewportCount=6,this._viewports=[new Pr(2,1,1,1),new Pr(0,1,1,1),new Pr(3,1,1,1),new Pr(1,1,1,1),new Pr(3,0,1,1),new Pr(1,0,1,1)],this._cubeDirections=[new ye(1,0,0),new ye(-1,0,0),new ye(0,0,1),new ye(0,0,-1),new ye(0,1,0),new ye(0,-1,0)],this._cubeUps=[new ye(0,1,0),new ye(0,1,0),new ye(0,1,0),new ye(0,1,0),new ye(0,0,1),new ye(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,n=this.matrix,a=e.distance||i.far;a!==i.far&&(i.far=a,i.updateProjectionMatrix()),EM.setFromMatrixPosition(e.matrixWorld),i.position.copy(EM),jB.copy(i.position),jB.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(jB),i.updateMatrixWorld(),n.makeTranslation(-EM.x,-EM.y,-EM.z),Woe.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Woe)}},VM=class extends _0{constructor(e,t,i=0,n=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new Lk}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},Pk=class extends kM{constructor(){super(new m0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},PR=class extends _0{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ia.DEFAULT_UP),this.updateMatrix(),this.target=new ia,this.shadow=new Pk}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},DR=class extends _0{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var IR=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,n=e.length;i<n;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}};var Bk="\\[\\]\\.:\\/",yOe=new RegExp("["+Bk+"]","g"),kk="[^"+Bk+"]",_Oe="[^"+Bk.replace("\\.","")+"]",xOe=/((?:WC+[\/:])*)/.source.replace("WC",kk),SOe=/(WCOD+)?/.source.replace("WCOD",_Oe),MOe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",kk),bOe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",kk),wOe=new RegExp("^"+xOe+SOe+MOe+bOe+"$"),TOe=["material","materials","bones","map"],Dk=class{constructor(e,t,i){let n=i||ri.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];n!==void 0&&n.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,a=i.length;n!==a;++n)i[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},ri=(()=>{class r{constructor(t,i,n){this.path=i,this.parsedPath=n||r.parseTrackName(i),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,i,n){return t&&t.isAnimationObjectGroup?new r.Composite(t,i,n):new r(t,i,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(yOe,"")}static parseTrackName(t){let i=wOe.exec(t);if(i===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]},a=n.nodeName&&n.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let o=n.nodeName.substring(a+1);TOe.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,a),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,i){if(i===void 0||i===""||i==="."||i===-1||i===t.name||i===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(i);if(n!==void 0)return n}if(t.children){let n=function(o){for(let s=0;s<o.length;s++){let l=o[s];if(l.name===i||l.uuid===i)return l;let u=n(l.children);if(u)return u}return null},a=n(t.children);if(a)return a}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,i){t[i]=this.targetObject[this.propertyName]}_getValue_array(t,i){let n=this.resolvedProperty;for(let a=0,o=n.length;a!==o;++a)t[i++]=n[a]}_getValue_arrayElement(t,i){t[i]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,i){this.resolvedProperty.toArray(t,i)}_setValue_direct(t,i){this.targetObject[this.propertyName]=t[i]}_setValue_direct_setNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,i){let n=this.resolvedProperty;for(let a=0,o=n.length;a!==o;++a)n[a]=t[i++]}_setValue_array_setNeedsUpdate(t,i){let n=this.resolvedProperty;for(let a=0,o=n.length;a!==o;++a)n[a]=t[i++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,i){let n=this.resolvedProperty;for(let a=0,o=n.length;a!==o;++a)n[a]=t[i++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,i){this.resolvedProperty[this.propertyIndex]=t[i]}_setValue_arrayElement_setNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,i){this.resolvedProperty.fromArray(t,i)}_setValue_fromArray_setNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,i){this.bind(),this.getValue(t,i)}_setValue_unbound(t,i){this.bind(),this.setValue(t,i)}bind(){let t=this.node,i=this.parsedPath,n=i.objectName,a=i.propertyName,o=i.propertyIndex;if(t||(t=r.findNode(this.rootNode,i.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=i.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let f=0;f<t.length;f++)if(t[f].name===c){c=f;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}let s=t[a];if(s===void 0){let c=i.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+a+" but it wasn't found.",t);return}let l=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(o!==void 0){if(a==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[o]!==void 0&&(o=t.morphTargetDictionary[o])}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=o}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=a;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}return r.Composite=Dk,r})();ri.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ri.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ri.prototype.GetterByBindingType=[ri.prototype._getValue_direct,ri.prototype._getValue_array,ri.prototype._getValue_arrayElement,ri.prototype._getValue_toArray];ri.prototype.SetterByBindingTypeAndVersioning=[[ri.prototype._setValue_direct,ri.prototype._setValue_direct_setNeedsUpdate,ri.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ri.prototype._setValue_array,ri.prototype._setValue_array_setNeedsUpdate,ri.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ri.prototype._setValue_arrayElement,ri.prototype._setValue_arrayElement_setNeedsUpdate,ri.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ri.prototype._setValue_fromArray,ri.prototype._setValue_fromArray_setNeedsUpdate,ri.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var uDt=new Float32Array(1);typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ik}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ik);var pse=function(r){return URL.createObjectURL(new Blob([r],{type:"text/javascript"}))},EOe=function(r){return new Worker(r)};try{URL.revokeObjectURL(pse(""))}catch{pse=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},EOe=function(e){return new Worker(e,{type:"module"})}}var Ps=Uint8Array,Xh=Uint16Array,Hk=Uint32Array,dse=new Ps([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),mse=new Ps([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),AOe=new Ps([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vse=function(r,e){for(var t=new Xh(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new Hk(t[30]),i=1;i<30;++i)for(var a=t[i];a<t[i+1];++a)n[a]=a-t[i]<<5|i;return[t,n]},gse=vse(dse,2),yse=gse[0],COe=gse[1];yse[28]=258,COe[258]=28;var _se=vse(mse,0),ROe=_se[0],hDt=_se[1],Wk=new Xh(32768);for(zr=0;zr<32768;++zr)bc=(zr&43690)>>>1|(zr&21845)<<1,bc=(bc&52428)>>>2|(bc&13107)<<2,bc=(bc&61680)>>>4|(bc&3855)<<4,Wk[zr]=((bc&65280)>>>8|(bc&255)<<8)>>>1;var bc,zr,GM=function(r,e,t){for(var i=r.length,n=0,a=new Xh(e);n<i;++n)++a[r[n]-1];var o=new Xh(e);for(n=0;n<e;++n)o[n]=o[n-1]+a[n-1]<<1;var s;if(t){s=new Xh(1<<e);var l=15-e;for(n=0;n<i;++n)if(r[n])for(var u=n<<4|r[n],c=e-r[n],f=o[r[n]-1]++<<c,h=f|(1<<c)-1;f<=h;++f)s[Wk[f]>>>l]=u}else for(s=new Xh(i),n=0;n<i;++n)r[n]&&(s[n]=Wk[o[r[n]-1]++]>>>15-r[n]);return s},HM=new Ps(288);for(zr=0;zr<144;++zr)HM[zr]=8;var zr;for(zr=144;zr<256;++zr)HM[zr]=9;var zr;for(zr=256;zr<280;++zr)HM[zr]=7;var zr;for(zr=280;zr<288;++zr)HM[zr]=8;var zr,xse=new Ps(32);for(zr=0;zr<32;++zr)xse[zr]=5;var zr;var LOe=GM(HM,9,1);var POe=GM(xse,5,1),Vk=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},_l=function(r,e,t){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&t},Gk=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},DOe=function(r){return(r/8|0)+(r&7&&1)},IOe=function(r,e,t){(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Xh?Xh:r instanceof Hk?Hk:Ps)(t-e);return i.set(r.subarray(e,t)),i},NOe=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new Ps(0);var n=!e||t,a=!t||t.i;t||(t={}),e||(e=new Ps(i*3));var o=function(ae){var ve=e.length;if(ae>ve){var ue=new Ps(Math.max(ve*2,ae));ue.set(e),e=ue}},s=t.f||0,l=t.p||0,u=t.b||0,c=t.l,f=t.d,h=t.m,p=t.n,d=i*8;do{if(!c){t.f=s=_l(r,l,1);var g=_l(r,l+1,3);if(l+=3,g)if(g==1)c=LOe,f=POe,h=9,p=5;else if(g==2){var y=_l(r,l,31)+257,x=_l(r,l+10,15)+4,M=y+_l(r,l+5,31)+1;l+=14;for(var S=new Ps(M),w=new Ps(19),T=0;T<x;++T)w[AOe[T]]=_l(r,l+T*3,7);l+=x*3;for(var C=Vk(w),b=(1<<C)-1,E=GM(w,C,1),T=0;T<M;){var I=E[_l(r,l,b)];l+=I&15;var m=I>>>4;if(m<16)S[T++]=m;else{var R=0,A=0;for(m==16?(A=3+_l(r,l,3),l+=2,R=S[T-1]):m==17?(A=3+_l(r,l,7),l+=3):m==18&&(A=11+_l(r,l,127),l+=7);A--;)S[T++]=R}}var D=S.subarray(0,y),U=S.subarray(y);h=Vk(D),p=Vk(U),c=GM(D,h,1),f=GM(U,p,1)}else throw"invalid block type";else{var m=DOe(l)+4,v=r[m-4]|r[m-3]<<8,_=m+v;if(_>i){if(a)throw"unexpected EOF";break}n&&o(u+v),e.set(r.subarray(m,_),u),t.b=u+=v,t.p=l=_*8;continue}if(l>d){if(a)throw"unexpected EOF";break}}n&&o(u+131072);for(var B=(1<<h)-1,F=(1<<p)-1,k=l;;k=l){var R=c[Gk(r,l)&B],G=R>>>4;if(l+=R&15,l>d){if(a)throw"unexpected EOF";break}if(!R)throw"invalid length/literal";if(G<256)e[u++]=G;else if(G==256){k=l,c=null;break}else{var Y=G-254;if(G>264){var T=G-257,J=dse[T];Y=_l(r,l,(1<<J)-1)+yse[T],l+=J}var Q=f[Gk(r,l)&F],V=Q>>>4;if(!Q)throw"invalid distance";l+=Q&15;var U=ROe[V];if(V>3){var J=mse[V];U+=Gk(r,l)&(1<<J)-1,l+=J}if(l>d){if(a)throw"unexpected EOF";break}n&&o(u+131072);for(var K=u+Y;u<K;u+=4)e[u]=e[u-U],e[u+1]=e[u+1-U],e[u+2]=e[u+2-U],e[u+3]=e[u+3-U];u=K}}t.l=c,t.p=k,t.b=u,c&&(s=1,t.m=h,t.d=f,t.n=p)}while(!s);return u==e.length?e:IOe(e,0,u)};var UOe=new Ps(0);var OOe=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Sse(r,e){return NOe((OOe(r),r.subarray(2,-4)),e)}var FOe=typeof TextDecoder<"u"&&new TextDecoder,zOe=0;try{FOe.decode(UOe,{stream:!0}),zOe=1}catch{}function Mse(r,e,t){let i=t.length-r-1;if(e>=t[i])return i-1;if(e<=t[r])return r;let n=r,a=i,o=Math.floor((n+a)/2);for(;e<t[o]||e>=t[o+1];)e<t[o]?a=o:n=o,o=Math.floor((n+a)/2);return o}function kOe(r,e,t,i){let n=[],a=[],o=[];n[0]=1;for(let s=1;s<=t;++s){a[s]=e-i[r+1-s],o[s]=i[r+s]-e;let l=0;for(let u=0;u<s;++u){let c=o[u+1],f=a[s-u],h=n[u]/(c+f);n[u]=l+c*h,l=f*h}n[s]=l}return n}function bse(r,e,t,i){let n=Mse(r,i,e),a=kOe(n,i,r,e),o=new Pr(0,0,0,0);for(let s=0;s<=r;++s){let l=t[n-r+s],u=a[s],c=l.w*u;o.x+=l.x*c,o.y+=l.y*c,o.z+=l.z*c,o.w+=l.w*u}return o}function VOe(r,e,t,i,n){let a=[];for(let f=0;f<=t;++f)a[f]=0;let o=[];for(let f=0;f<=i;++f)o[f]=a.slice(0);let s=[];for(let f=0;f<=t;++f)s[f]=a.slice(0);s[0][0]=1;let l=a.slice(0),u=a.slice(0);for(let f=1;f<=t;++f){l[f]=e-n[r+1-f],u[f]=n[r+f]-e;let h=0;for(let p=0;p<f;++p){let d=u[p+1],g=l[f-p];s[f][p]=d+g;let m=s[p][f-1]/s[f][p];s[p][f]=h+d*m,h=g*m}s[f][f]=h}for(let f=0;f<=t;++f)o[0][f]=s[f][t];for(let f=0;f<=t;++f){let h=0,p=1,d=[];for(let g=0;g<=t;++g)d[g]=a.slice(0);d[0][0]=1;for(let g=1;g<=i;++g){let m=0,v=f-g,_=t-g;f>=g&&(d[p][0]=d[h][0]/s[_+1][v],m=d[p][0]*s[v][_]);let y=v>=-1?1:-v,x=f-1<=_?g-1:t-f;for(let S=y;S<=x;++S)d[p][S]=(d[h][S]-d[h][S-1])/s[_+1][v+S],m+=d[p][S]*s[v+S][_];f<=_&&(d[p][g]=-d[h][g-1]/s[_+1][f],m+=d[p][g]*s[f][_]),o[g][f]=m;let M=h;h=p,p=M}}let c=t;for(let f=1;f<=i;++f){for(let h=0;h<=t;++h)o[f][h]*=c;c*=t-f}return o}function GOe(r,e,t,i,n){let a=n<r?n:r,o=[],s=Mse(r,i,e),l=VOe(s,i,r,a,e),u=[];for(let c=0;c<t.length;++c){let f=t[c].clone(),h=f.w;f.x*=h,f.y*=h,f.z*=h,u[c]=f}for(let c=0;c<=a;++c){let f=u[s-r].clone().multiplyScalar(l[c][0]);for(let h=1;h<=r;++h)f.add(u[s-r+h].clone().multiplyScalar(l[c][h]));o[c]=f}for(let c=a+1;c<=n+1;++c)o[c]=new Pr(0,0,0);return o}function HOe(r,e){let t=1;for(let n=2;n<=r;++n)t*=n;let i=1;for(let n=2;n<=e;++n)i*=n;for(let n=2;n<=r-e;++n)i*=n;return t/i}function WOe(r){let e=r.length,t=[],i=[];for(let a=0;a<e;++a){let o=r[a];t[a]=new ye(o.x,o.y,o.z),i[a]=o.w}let n=[];for(let a=0;a<e;++a){let o=t[a].clone();for(let s=1;s<=a;++s)o.sub(n[a-s].clone().multiplyScalar(HOe(a,s)*i[s]));n[a]=o.divideScalar(i[0])}return n}function wse(r,e,t,i,n){let a=GOe(r,e,t,i,n);return WOe(a)}var BR=class extends MR{constructor(e,t,i,n,a){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=a||this.knots.length-1;for(let o=0;o<i.length;++o){let s=i[o];this.controlPoints[o]=new Pr(s.x,s.y,s.z,s.w)}}getPoint(e,t=new ye){let i=t,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),a=bse(this.degree,this.knots,this.controlPoints,n);return a.w!==1&&a.divideScalar(a.w),i.set(a.x,a.y,a.z)}getTangent(e,t=new ye){let i=t,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),a=wse(this.degree,this.knots,this.controlPoints,n,1);return i.copy(a[1]).normalize(),i}};var _r,Fi,ba,VR=class extends mm{constructor(e){super(e)}load(e,t,i,n){let a=this,o=a.path===""?IR.extractUrlBase(e):a.path,s=new CR(this.manager);s.setPath(a.path),s.setResponseType("arraybuffer"),s.setRequestHeader(a.requestHeader),s.setWithCredentials(a.withCredentials),s.load(e,function(l){try{t(a.parse(l,o))}catch(u){n?n(u):console.error(u),a.manager.itemError(e)}},i,n)}parse(e,t){if(YOe(e))_r=new Jk().parse(e);else{let n=Cse(e);if(!qOe(n))throw new Error("THREE.FBXLoader: Unknown format.");if(Tse(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Tse(n));_r=new Kk().parse(n)}let i=new RR(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new qk(i,this.manager).parse(_r)}},qk=class{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Fi=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),n=this.parseDeformers(),a=new Zk().parse(n);return this.parseScene(n,a,i),ba}parseConnections(){let e=new Map;return"Connections"in _r&&_r.Connections.connections.forEach(function(i){let n=i[0],a=i[1],o=i[2];e.has(n)||e.set(n,{parents:[],children:[]});let s={ID:a,relationship:o};e.get(n).parents.push(s),e.has(a)||e.set(a,{parents:[],children:[]});let l={ID:n,relationship:o};e.get(a).children.push(l)}),e}parseImages(){let e={},t={};if("Video"in _r.Objects){let i=_r.Objects.Video;for(let n in i){let a=i[n],o=parseInt(n);if(e[o]=a.RelativeFilename||a.Filename,"Content"in a){let s=a.Content instanceof ArrayBuffer&&a.Content.byteLength>0,l=typeof a.Content=="string"&&a.Content!=="";if(s||l){let u=this.parseImage(i[n]);t[a.RelativeFilename||a.Filename]=u}}}}for(let i in e){let n=e[i];t[n]!==void 0?e[i]=t[n]:e[i]=e[i].split("\\").pop()}return e}parseImage(e){let t=e.Content,i=e.RelativeFilename||e.Filename,n=i.slice(i.lastIndexOf(".")+1).toLowerCase(),a;switch(n){case"bmp":a="image/bmp";break;case"jpg":case"jpeg":a="image/jpeg";break;case"png":a="image/png";break;case"tif":a="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",i),a="image/tga";break;default:console.warn('FBXLoader: Image type "'+n+'" is not supported.');return}if(typeof t=="string")return"data:"+a+";base64,"+t;{let o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:a}))}}parseTextures(e){let t=new Map;if("Texture"in _r.Objects){let i=_r.Objects.Texture;for(let n in i){let a=this.parseTexture(i[n],e);t.set(parseInt(n),a)}}return t}parseTexture(e,t){let i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;let n=e.WrapModeU,a=e.WrapModeV,o=n!==void 0?n.value:0,s=a!==void 0?a.value:0;if(i.wrapS=o===0?c0:oo,i.wrapT=s===0?c0:oo,"Scaling"in e){let l=e.Scaling.value;i.repeat.x=l[0],i.repeat.y=l[1]}if("Translation"in e){let l=e.Translation.value;i.offset.x=l[0],i.offset.y=l[1]}return i}loadTexture(e,t){let i,n=this.textureLoader.path,a=Fi.get(e.id).children;a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(i=t[a[0].ID],(i.indexOf("blob:")===0||i.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o,s=e.FileName.slice(-3).toLowerCase();if(s==="tga"){let l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new Vo):(l.setPath(this.textureLoader.path),o=l.load(i))}else if(s==="dds"){let l=this.manager.getHandler(".dds");l===null?(console.warn("FBXLoader: DDS loader not found, creating placeholder texture for",e.RelativeFilename),o=new Vo):(l.setPath(this.textureLoader.path),o=l.load(i))}else s==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new Vo):o=this.textureLoader.load(i);return this.textureLoader.setPath(n),o}parseMaterials(e){let t=new Map;if("Material"in _r.Objects){let i=_r.Objects.Material;for(let n in i){let a=this.parseMaterial(i[n],e);a!==null&&t.set(parseInt(n),a)}}return t}parseMaterial(e,t){let i=e.id,n=e.attrName,a=e.ShadingModel;if(typeof a=="object"&&(a=a.value),!Fi.has(i))return null;let o=this.parseParameters(e,t,i),s;switch(a.toLowerCase()){case"phong":s=new g0;break;case"lambert":s=new wR;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),s=new g0;break}return s.setValues(o),s.name=n,s}parseParameters(e,t,i){let n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=new er().fromArray(e.Diffuse.value).convertSRGBToLinear():e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=new er().fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=new er().fromArray(e.Emissive.value).convertSRGBToLinear():e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=new er().fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=new er().fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=new er().fromArray(e.SpecularColor.value).convertSRGBToLinear());let a=this;return Fi.get(i).children.forEach(function(o){let s=o.relationship;switch(s){case"Bump":n.bumpMap=a.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,o.ID),n.map!==void 0&&(n.map.colorSpace=Ma);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,o.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,o.ID),n.emissiveMap!==void 0&&(n.emissiveMap.colorSpace=Ma);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,o.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,o.ID),n.envMap!==void 0&&(n.envMap.mapping=LM,n.envMap.colorSpace=Ma);break;case"SpecularColor":n.specularMap=a.getTexture(t,o.ID),n.specularMap!==void 0&&(n.specularMap.colorSpace=Ma);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,o.ID),n.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",s);break}}),n}getTexture(e,t){return"LayeredTexture"in _r.Objects&&t in _r.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Fi.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if("Deformer"in _r.Objects){let i=_r.Objects.Deformer;for(let n in i){let a=i[n],o=Fi.get(parseInt(n));if(a.attrType==="Skin"){let s=this.parseSkeleton(o,i);s.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),s.geometryID=o.parents[0].ID,e[n]=s}else if(a.attrType==="BlendShape"){let s={id:n};s.rawTargets=this.parseMorphTargets(o,i),s.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=s}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){let i=[];return e.children.forEach(function(n){let a=t[n.ID];if(a.attrType!=="Cluster")return;let o={ID:n.ID,indices:[],weights:[],transformLink:new Ht().fromArray(a.TransformLink.a)};"Indexes"in a&&(o.indices=a.Indexes.a,o.weights=a.Weights.a),i.push(o)}),{rawBones:i,bones:[]}}parseMorphTargets(e,t){let i=[];for(let n=0;n<e.children.length;n++){let a=e.children[n],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;s.geoID=Fi.get(parseInt(a.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,i.push(s)}return i}parseScene(e,t,i){ba=new xc;let n=this.parseModels(e.skeletons,t,i),a=_r.Objects.Model,o=this;n.forEach(function(l){let u=a[l.ID];o.setLookAtProperties(l,u),Fi.get(l.ID).parents.forEach(function(f){let h=n.get(f.ID);h!==void 0&&h.add(l)}),l.parent===null&&ba.add(l)}),this.bindSkeleton(e.skeletons,t,n),this.addGlobalSceneSettings(),ba.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);let u=Ese(l.userData.transformData);l.applyMatrix4(u),l.updateWorldMatrix()}});let s=new jk().parse();ba.children.length===1&&ba.children[0].isGroup&&(ba.children[0].animations=s,ba=ba.children[0]),ba.animations=s}parseModels(e,t,i){let n=new Map,a=_r.Objects.Model;for(let o in a){let s=parseInt(o),l=a[o],u=Fi.get(s),c=this.buildSkeleton(u,e,s,l.attrName);if(!c){switch(l.attrType){case"Camera":c=this.createCamera(u);break;case"Light":c=this.createLight(u);break;case"Mesh":c=this.createMesh(u,t,i);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new v0;break;case"Null":default:c=new xc;break}c.name=l.attrName?ri.sanitizeNodeName(l.attrName):"",c.userData.originalName=l.attrName,c.ID=s}this.getTransformData(c,l),n.set(s,c)}return n}buildSkeleton(e,t,i,n){let a=null;return e.parents.forEach(function(o){for(let s in t){let l=t[s];l.rawBones.forEach(function(u,c){if(u.ID===o.ID){let f=a;a=new v0,a.matrixWorld.copy(u.transformLink),a.name=n?ri.sanitizeNodeName(n):"",a.userData.originalName=n,a.ID=i,l.bones[c]=a,f!==null&&a.add(f)}})}}),a}createCamera(e){let t,i;if(e.children.forEach(function(n){let a=_r.Objects.NodeAttribute[n.ID];a!==void 0&&(i=a)}),i===void 0)t=new ia;else{let n=0;i.CameraProjectionType!==void 0&&i.CameraProjectionType.value===1&&(n=1);let a=1;i.NearPlane!==void 0&&(a=i.NearPlane.value/1e3);let o=1e3;i.FarPlane!==void 0&&(o=i.FarPlane.value/1e3);let s=window.innerWidth,l=window.innerHeight;i.AspectWidth!==void 0&&i.AspectHeight!==void 0&&(s=i.AspectWidth.value,l=i.AspectHeight.value);let u=s/l,c=45;i.FieldOfView!==void 0&&(c=i.FieldOfView.value);let f=i.FocalLength?i.FocalLength.value:null;switch(n){case 0:t=new Nn(c,u,a,o),f!==null&&t.setFocalLength(f);break;case 1:t=new m0(-s/2,s/2,l/2,-l/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new ia;break}}return t}createLight(e){let t,i;if(e.children.forEach(function(n){let a=_r.Objects.NodeAttribute[n.ID];a!==void 0&&(i=a)}),i===void 0)t=new ia;else{let n;i.LightType===void 0?n=0:n=i.LightType.value;let a=16777215;i.Color!==void 0&&(a=new er().fromArray(i.Color.value).convertSRGBToLinear());let o=i.Intensity===void 0?1:i.Intensity.value/100;i.CastLightOnObject!==void 0&&i.CastLightOnObject.value===0&&(o=0);let s=0;i.FarAttenuationEnd!==void 0&&(i.EnableFarAttenuation!==void 0&&i.EnableFarAttenuation.value===0?s=0:s=i.FarAttenuationEnd.value);let l=1;switch(n){case 0:t=new VM(a,o,s,l);break;case 1:t=new PR(a,o);break;case 2:let u=Math.PI/3;i.InnerAngle!==void 0&&(u=na.degToRad(i.InnerAngle.value));let c=0;i.OuterAngle!==void 0&&(c=na.degToRad(i.OuterAngle.value),c=Math.max(c,1)),t=new LR(a,o,s,u,c,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new VM(a,o);break}i.CastShadows!==void 0&&i.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,i){let n,a=null,o=null,s=[];return e.children.forEach(function(l){t.has(l.ID)&&(a=t.get(l.ID)),i.has(l.ID)&&s.push(i.get(l.ID))}),s.length>1?o=s:s.length>0?o=s[0]:(o=new g0({name:mm.DEFAULT_MATERIAL_NAME,color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach(function(l){l.vertexColors=!0}),a.FBX_Deformer?(n=new _R(a,o),n.normalizeSkinWeights()):n=new so(a,o),n}createCurve(e,t){let i=e.children.reduce(function(a,o){return t.has(o.ID)&&(a=t.get(o.ID)),a},null),n=new OM({name:mm.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new SR(i,n)}getTransformData(e,t){let i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=Ase(t.RotationOrder.value):i.eulerOrder="ZYX","Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(i.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(i.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(i.rotationPivot=t.RotationPivot.value),e.userData.transformData=i}setLookAtProperties(e,t){"LookAtProperty"in t&&Fi.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){let a=_r.Objects.Model[n.ID];if("Lcl_Translation"in a){let o=a.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),ba.add(e.target)):e.lookAt(new ye().fromArray(o))}}})}bindSkeleton(e,t,i){let n=this.parsePoseNodes();for(let a in e){let o=e[a];Fi.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){let u=l.ID;Fi.get(u).parents.forEach(function(f){i.has(f.ID)&&i.get(f.ID).bind(new xR(o.bones),n[f.ID])})}})}}parsePoseNodes(){let e={};if("Pose"in _r.Objects){let t=_r.Objects.Pose;for(let i in t)if(t[i].attrType==="BindPose"&&t[i].NbPoseNodes>0){let n=t[i].PoseNode;Array.isArray(n)?n.forEach(function(a){e[a.Node]=new Ht().fromArray(a.Matrix.a)}):e[n.Node]=new Ht().fromArray(n.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in _r){if("AmbientColor"in _r.GlobalSettings){let e=_r.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],n=e[2];if(t!==0||i!==0||n!==0){let a=new er(t,i,n).convertSRGBToLinear();ba.add(new DR(a,1))}}"UnitScaleFactor"in _r.GlobalSettings&&(ba.userData.unitScaleFactor=_r.GlobalSettings.UnitScaleFactor.value)}}},Zk=class{constructor(){this.negativeMaterialIndices=!1}parse(e){let t=new Map;if("Geometry"in _r.Objects){let i=_r.Objects.Geometry;for(let n in i){let a=Fi.get(parseInt(n)),o=this.parseGeometry(a,i[n],e);t.set(parseInt(n),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,i){let n=i.skeletons,a=[],o=e.parents.map(function(f){return _r.Objects.Model[f.ID]});if(o.length===0)return;let s=e.children.reduce(function(f,h){return n[h.ID]!==void 0&&(f=n[h.ID]),f},null);e.children.forEach(function(f){i.morphTargets[f.ID]!==void 0&&a.push(i.morphTargets[f.ID])});let l=o[0],u={};"RotationOrder"in l&&(u.eulerOrder=Ase(l.RotationOrder.value)),"InheritType"in l&&(u.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(u.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(u.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(u.scale=l.GeometricScaling.value);let c=Ese(u);return this.genGeometry(t,s,a,c)}genGeometry(e,t,i,n){let a=new Rs;e.attrName&&(a.name=e.attrName);let o=this.parseGeoNode(e,t),s=this.genBuffers(o),l=new Un(s.vertex,3);if(l.applyMatrix4(n),a.setAttribute("position",l),s.colors.length>0&&a.setAttribute("color",new Un(s.colors,3)),t&&(a.setAttribute("skinIndex",new p0(s.weightsIndices,4)),a.setAttribute("skinWeight",new Un(s.vertexWeights,4)),a.FBX_Deformer=t),s.normal.length>0){let u=new dr().getNormalMatrix(n),c=new Un(s.normal,3);c.applyNormalMatrix(u),a.setAttribute("normal",c)}if(s.uvs.forEach(function(u,c){let f=c===0?"uv":`uv${c}`;a.setAttribute(f,new Un(s.uvs[c],2))}),o.material&&o.material.mappingType!=="AllSame"){let u=s.materialIndex[0],c=0;if(s.materialIndex.forEach(function(f,h){f!==u&&(a.addGroup(c,h-c,u),u=f,c=h)}),a.groups.length>0){let f=a.groups[a.groups.length-1],h=f.start+f.count;h!==s.materialIndex.length&&a.addGroup(h,s.materialIndex.length-h,u)}a.groups.length===0&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(a,e,i,n),a}parseGeoNode(e,t){let i={};if(i.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],i.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];let n=0;for(;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&i.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return i.weightTable={},t!==null&&(i.skeleton=t,t.rawBones.forEach(function(n,a){n.indices.forEach(function(o,s){i.weightTable[o]===void 0&&(i.weightTable[o]=[]),i.weightTable[o].push({id:a,weight:n.weights[s]})})})),i}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},i=0,n=0,a=!1,o=[],s=[],l=[],u=[],c=[],f=[],h=this;return e.vertexIndices.forEach(function(p,d){let g,m=!1;p<0&&(p=p^-1,m=!0);let v=[],_=[];if(o.push(p*3,p*3+1,p*3+2),e.color){let y=kR(d,i,p,e.color);l.push(y[0],y[1],y[2])}if(e.skeleton){if(e.weightTable[p]!==void 0&&e.weightTable[p].forEach(function(y){_.push(y.weight),v.push(y.id)}),_.length>4){a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0);let y=[0,0,0,0],x=[0,0,0,0];_.forEach(function(M,S){let w=M,T=v[S];x.forEach(function(C,b,E){if(w>C){E[b]=w,w=C;let I=y[b];y[b]=T,T=I}})}),v=y,_=x}for(;_.length<4;)_.push(0),v.push(0);for(let y=0;y<4;++y)c.push(_[y]),f.push(v[y])}if(e.normal){let y=kR(d,i,p,e.normal);s.push(y[0],y[1],y[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=kR(d,i,p,e.material)[0],g<0&&(h.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(y,x){let M=kR(d,i,p,y);u[x]===void 0&&(u[x]=[]),u[x].push(M[0]),u[x].push(M[1])}),n++,m&&(h.genFace(t,e,o,g,s,l,u,c,f,n),i++,n=0,o=[],s=[],l=[],u=[],c=[],f=[])}),t}getNormalNewell(e){let t=new ye(0,0,0);for(let i=0;i<e.length;i++){let n=e[i],a=e[(i+1)%e.length];t.x+=(n.y-a.y)*(n.z+a.z),t.y+=(n.z-a.z)*(n.x+a.x),t.z+=(n.x-a.x)*(n.y+a.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new ye(0,1,0):new ye(0,0,1)).cross(t).normalize(),a=t.clone().cross(n).normalize();return{normal:t,tangent:n,bitangent:a}}flattenVertex(e,t,i){return new yr(e.dot(t),e.dot(i))}genFace(e,t,i,n,a,o,s,l,u,c){let f;if(c>3){let h=[];for(let m=0;m<i.length;m+=3)h.push(new ye(t.vertexPositions[i[m]],t.vertexPositions[i[m+1]],t.vertexPositions[i[m+2]]));let{tangent:p,bitangent:d}=this.getNormalTangentAndBitangent(h),g=[];for(let m of h)g.push(this.flattenVertex(m,p,d));f=bR.triangulateShape(g,[])}else f=[[0,1,2]];for(let[h,p,d]of f)e.vertex.push(t.vertexPositions[i[h*3]]),e.vertex.push(t.vertexPositions[i[h*3+1]]),e.vertex.push(t.vertexPositions[i[h*3+2]]),e.vertex.push(t.vertexPositions[i[p*3]]),e.vertex.push(t.vertexPositions[i[p*3+1]]),e.vertex.push(t.vertexPositions[i[p*3+2]]),e.vertex.push(t.vertexPositions[i[d*3]]),e.vertex.push(t.vertexPositions[i[d*3+1]]),e.vertex.push(t.vertexPositions[i[d*3+2]]),t.skeleton&&(e.vertexWeights.push(l[h*4]),e.vertexWeights.push(l[h*4+1]),e.vertexWeights.push(l[h*4+2]),e.vertexWeights.push(l[h*4+3]),e.vertexWeights.push(l[p*4]),e.vertexWeights.push(l[p*4+1]),e.vertexWeights.push(l[p*4+2]),e.vertexWeights.push(l[p*4+3]),e.vertexWeights.push(l[d*4]),e.vertexWeights.push(l[d*4+1]),e.vertexWeights.push(l[d*4+2]),e.vertexWeights.push(l[d*4+3]),e.weightsIndices.push(u[h*4]),e.weightsIndices.push(u[h*4+1]),e.weightsIndices.push(u[h*4+2]),e.weightsIndices.push(u[h*4+3]),e.weightsIndices.push(u[p*4]),e.weightsIndices.push(u[p*4+1]),e.weightsIndices.push(u[p*4+2]),e.weightsIndices.push(u[p*4+3]),e.weightsIndices.push(u[d*4]),e.weightsIndices.push(u[d*4+1]),e.weightsIndices.push(u[d*4+2]),e.weightsIndices.push(u[d*4+3])),t.color&&(e.colors.push(o[h*3]),e.colors.push(o[h*3+1]),e.colors.push(o[h*3+2]),e.colors.push(o[p*3]),e.colors.push(o[p*3+1]),e.colors.push(o[p*3+2]),e.colors.push(o[d*3]),e.colors.push(o[d*3+1]),e.colors.push(o[d*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(a[h*3]),e.normal.push(a[h*3+1]),e.normal.push(a[h*3+2]),e.normal.push(a[p*3]),e.normal.push(a[p*3+1]),e.normal.push(a[p*3+2]),e.normal.push(a[d*3]),e.normal.push(a[d*3+1]),e.normal.push(a[d*3+2])),t.uv&&t.uv.forEach(function(g,m){e.uvs[m]===void 0&&(e.uvs[m]=[]),e.uvs[m].push(s[m][h*2]),e.uvs[m].push(s[m][h*2+1]),e.uvs[m].push(s[m][p*2]),e.uvs[m].push(s[m][p*2+1]),e.uvs[m].push(s[m][d*2]),e.uvs[m].push(s[m][d*2+1])})}addMorphTargets(e,t,i,n){if(i.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];let a=this;i.forEach(function(o){o.rawTargets.forEach(function(s){let l=_r.Objects.Geometry[s.geoID];l!==void 0&&a.genMorphGeometry(e,t,l,n,s.name)})})}genMorphGeometry(e,t,i,n,a){let o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],s=i.Vertices!==void 0?i.Vertices.a:[],l=i.Indexes!==void 0?i.Indexes.a:[],u=e.attributes.position.count*3,c=new Float32Array(u);for(let d=0;d<l.length;d++){let g=l[d]*3;c[g]=s[d*3],c[g+1]=s[d*3+1],c[g+2]=s[d*3+2]}let f={vertexIndices:o,vertexPositions:c},h=this.genBuffers(f),p=new Un(h.vertex,3);p.name=a||i.attrName,p.applyMatrix4(n),e.morphAttributes.position.push(p)}parseNormals(e){let t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Normals.a,a=[];return i==="IndexToDirect"&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:a,mappingType:t,referenceType:i}}parseUVs(e){let t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.UV.a,a=[];return i==="IndexToDirect"&&(a=e.UVIndex.a),{dataSize:2,buffer:n,indices:a,mappingType:t,referenceType:i}}parseVertexColors(e){let t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Colors.a,a=[];i==="IndexToDirect"&&(a=e.ColorIndex.a);for(let o=0,s=new er;o<n.length;o+=4)s.fromArray(n,o).convertSRGBToLinear().toArray(n,o);return{dataSize:4,buffer:n,indices:a,mappingType:t,referenceType:i}}parseMaterialIndices(e){let t=e.MappingInformationType,i=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};let n=e.Materials.a,a=[];for(let o=0;o<n.length;++o)a.push(o);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:i}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Rs;let i=t-1,n=e.KnotVector.a,a=[],o=e.Points.a;for(let f=0,h=o.length;f<h;f+=4)a.push(new Pr().fromArray(o,f));let s,l;if(e.Form==="Closed")a.push(a[0]);else if(e.Form==="Periodic"){s=i,l=n.length-1-s;for(let f=0;f<i;++f)a.push(a[f])}let c=new BR(i,n,a,s,l).getPoints(a.length*12);return new Rs().setFromPoints(c)}},jk=class{parse(){let e=[],t=this.parseClips();if(t!==void 0)for(let i in t){let n=t[i],a=this.addClip(n);e.push(a)}return e}parseClips(){if(_r.Objects.AnimationCurve===void 0)return;let e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);let t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){let e=_r.Objects.AnimationCurveNode,t=new Map;for(let i in e){let n=e[i];if(n.attrName.match(/S|R|T|DeformPercent/)!==null){let a={id:n.id,attr:n.attrName,curves:{}};t.set(a.id,a)}}return t}parseAnimationCurves(e){let t=_r.Objects.AnimationCurve;for(let i in t){let n={id:t[i].id,times:t[i].KeyTime.a.map(ZOe),values:t[i].KeyValueFloat.a},a=Fi.get(n.id);if(a!==void 0){let o=a.parents[0].ID,s=a.parents[0].relationship;s.match(/X/)?e.get(o).curves.x=n:s.match(/Y/)?e.get(o).curves.y=n:s.match(/Z/)?e.get(o).curves.z=n:s.match(/DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=n)}}}parseAnimationLayers(e){let t=_r.Objects.AnimationLayer,i=new Map;for(let n in t){let a=[],o=Fi.get(parseInt(n));o!==void 0&&(o.children.forEach(function(l,u){if(e.has(l.ID)){let c=e.get(l.ID);if(c.curves.x!==void 0||c.curves.y!==void 0||c.curves.z!==void 0){if(a[u]===void 0){let f=Fi.get(l.ID).parents.filter(function(h){return h.relationship!==void 0})[0].ID;if(f!==void 0){let h=_r.Objects.Model[f.toString()];if(h===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}let p={modelName:h.attrName?ri.sanitizeNodeName(h.attrName):"",ID:h.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};ba.traverse(function(d){d.ID===h.id&&(p.transform=d.matrix,d.userData.transformData&&(p.eulerOrder=d.userData.transformData.eulerOrder))}),p.transform||(p.transform=new Ht),"PreRotation"in h&&(p.preRotation=h.PreRotation.value),"PostRotation"in h&&(p.postRotation=h.PostRotation.value),a[u]=p}}a[u]&&(a[u][c.attr]=c)}else if(c.curves.morph!==void 0){if(a[u]===void 0){let f=Fi.get(l.ID).parents.filter(function(v){return v.relationship!==void 0})[0].ID,h=Fi.get(f).parents[0].ID,p=Fi.get(h).parents[0].ID,d=Fi.get(p).parents[0].ID,g=_r.Objects.Model[d],m={modelName:g.attrName?ri.sanitizeNodeName(g.attrName):"",morphName:_r.Objects.Deformer[f].attrName};a[u]=m}a[u][c.attr]=c}}}),i.set(parseInt(n),a))}return i}parseAnimStacks(e){let t=_r.Objects.AnimationStack,i={};for(let n in t){let a=Fi.get(parseInt(n)).children;a.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");let o=e.get(a[0].ID);i[n]={name:t[n].attrName,layer:o}}return i}addClip(e){let t=[],i=this;return e.layer.forEach(function(n){t=t.concat(i.generateTracks(n))}),new ER(e.name,-1,t)}generateTracks(e){let t=[],i=new ye,n=new ye;if(e.transform&&e.transform.decompose(i,new On,n),i=i.toArray(),n=n.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){let a=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");a!==void 0&&t.push(a)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let a=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);a!==void 0&&t.push(a)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let a=this.generateVectorTrack(e.modelName,e.S.curves,n,"scale");a!==void 0&&t.push(a)}if(e.DeformPercent!==void 0){let a=this.generateMorphTrack(e);a!==void 0&&t.push(a)}return t}generateVectorTrack(e,t,i,n){let a=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(a,t,i);return new Gh(e+"."+n,a,o)}generateRotationTrack(e,t,i,n,a){let o,s;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){let f=this.interpolateRotations(t.x,t.y,t.z,a);o=f[0],s=f[1]}i!==void 0&&(i=i.map(na.degToRad),i.push(a),i=new Fn().fromArray(i),i=new On().setFromEuler(i)),n!==void 0&&(n=n.map(na.degToRad),n.push(a),n=new Fn().fromArray(n),n=new On().setFromEuler(n).invert());let l=new On,u=new Fn,c=[];if(!s||!o)return new du(e+".quaternion",[],[]);for(let f=0;f<s.length;f+=3)u.set(s[f],s[f+1],s[f+2],a),l.setFromEuler(u),i!==void 0&&l.premultiply(i),n!==void 0&&l.multiply(n),f>2&&new On().fromArray(c,(f-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(c,f/3*4);return new du(e+".quaternion",o,c)}generateMorphTrack(e){let t=e.DeformPercent.curves.morph,i=t.values.map(function(a){return a/100}),n=ba.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new kh(e.modelName+".morphTargetInfluences["+n+"]",t.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(i,n){return i-n}),t.length>1){let i=1,n=t[0];for(let a=1;a<t.length;a++){let o=t[a];o!==n&&(t[i]=o,n=o,i++)}t=t.slice(0,i)}return t}getKeyframeTrackValues(e,t,i){let n=i,a=[],o=-1,s=-1,l=-1;return e.forEach(function(u){if(t.x&&(o=t.x.times.indexOf(u)),t.y&&(s=t.y.times.indexOf(u)),t.z&&(l=t.z.times.indexOf(u)),o!==-1){let c=t.x.values[o];a.push(c),n[0]=c}else a.push(n[0]);if(s!==-1){let c=t.y.values[s];a.push(c),n[1]=c}else a.push(n[1]);if(l!==-1){let c=t.z.values[l];a.push(c),n[2]=c}else a.push(n[2])}),a}interpolateRotations(e,t,i,n){let a=[],o=[];a.push(e.times[0]),o.push(na.degToRad(e.values[0])),o.push(na.degToRad(t.values[0])),o.push(na.degToRad(i.values[0]));for(let s=1;s<e.values.length;s++){let l=[e.values[s-1],t.values[s-1],i.values[s-1]];if(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))continue;let u=l.map(na.degToRad),c=[e.values[s],t.values[s],i.values[s]];if(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))continue;let f=c.map(na.degToRad),h=[c[0]-l[0],c[1]-l[1],c[2]-l[2]],p=[Math.abs(h[0]),Math.abs(h[1]),Math.abs(h[2])];if(p[0]>=180||p[1]>=180||p[2]>=180){let g=Math.max(...p)/180,m=new Fn(...u,n),v=new Fn(...f,n),_=new On().setFromEuler(m),y=new On().setFromEuler(v);_.dot(y)&&y.set(-y.x,-y.y,-y.z,-y.w);let x=e.times[s-1],M=e.times[s]-x,S=new On,w=new Fn;for(let T=0;T<1;T+=1/g)S.copy(_.clone().slerp(y.clone(),T)),a.push(x+T*M),w.setFromQuaternion(S,n),o.push(w.x),o.push(w.y),o.push(w.z)}else a.push(e.times[s]),o.push(na.degToRad(e.values[s])),o.push(na.degToRad(t.values[s])),o.push(na.degToRad(i.values[s]))}return[a,o]}},Kk=class{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new HR,this.nodeStack=[],this.currentProp=[],this.currentPropName="";let t=this,i=e.split(/[\r\n]+/);return i.forEach(function(n,a){let o=n.match(/^[\s\t]*;/),s=n.match(/^[\s\t]*$/);if(o||s)return;let l=n.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),u=n.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),c=n.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(n,l):u?t.parseNodeProperty(n,u,i[++a]):c?t.popStack():n.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(n)}),this.allNodes}parseNodeBegin(e,t){let i=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),a={name:i},o=this.parseNodeAttr(n),s=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(i,a):i in s?(i==="PoseNode"?s.PoseNode.push(a):s[i].id!==void 0&&(s[i]={},s[i][s[i].id]=s[i]),o.id!==""&&(s[i][o.id]=a)):typeof o.id=="number"?(s[i]={},s[i][o.id]=a):i!=="Properties70"&&(i==="PoseNode"?s[i]=[a]:s[i]=a),typeof o.id=="number"&&(a.id=o.id),o.name!==""&&(a.attrName=o.name),o.type!==""&&(a.attrType=o.type),this.pushStack(a)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let i="",n="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:i,type:n}}parseNodeProperty(e,t,i){let n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),a=t[2].replace(/^"/,"").replace(/"$/,"").trim();n==="Content"&&a===","&&(a=i.replace(/"/g,"").replace(/,$/,"").trim());let o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,n,a);return}if(n==="C"){let l=a.split(",").slice(1),u=parseInt(l[0]),c=parseInt(l[1]),f=a.split(",").slice(3);f=f.map(function(h){return h.trim().replace(/^"/,"")}),n="connections",a=[u,c],KOe(a,f),o[n]===void 0&&(o[n]=[])}n==="Node"&&(o.id=a),n in o&&Array.isArray(o[n])?o[n].push(a):n!=="a"?o[n]=a:o.a=a,this.setCurrentProp(o,n),n==="a"&&a.slice(-1)!==","&&(o.a=Yk(a))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Yk(t.a))}parseNodeSpecialProperty(e,t,i){let n=i.split('",').map(function(c){return c.trim().replace(/^\"/,"").replace(/\s/,"_")}),a=n[0],o=n[1],s=n[2],l=n[3],u=n[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":u=parseFloat(u);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":u=Yk(u);break}this.getPrevNode()[a]={type:o,type2:s,flag:l,value:u},this.setCurrentProp(this.getPrevNode(),a)}},Jk=class{parse(e){let t=new GR(e);t.skip(23);let i=t.getUint32();if(i<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+i);let n=new HR;for(;!this.endOfContent(t);){let a=this.parseNode(t,i);a!==null&&n.add(a.name,a)}return n}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let i={},n=t>=7500?e.getUint64():e.getUint32(),a=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let o=e.getUint8(),s=e.getString(o);if(n===0)return null;let l=[];for(let h=0;h<a;h++)l.push(this.parseProperty(e));let u=l.length>0?l[0]:"",c=l.length>1?l[1]:"",f=l.length>2?l[2]:"";for(i.singleProperty=a===1&&e.getOffset()===n;n>e.getOffset();){let h=this.parseNode(e,t);h!==null&&this.parseSubNode(s,i,h)}return i.propertyList=l,typeof u=="number"&&(i.id=u),c!==""&&(i.attrName=c),f!==""&&(i.attrType=f),s!==""&&(i.name=s),i}parseSubNode(e,t,i){if(i.singleProperty===!0){let n=i.propertyList[0];Array.isArray(n)?(t[i.name]=i,i.a=n):t[i.name]=n}else if(e==="Connections"&&i.name==="C"){let n=[];i.propertyList.forEach(function(a,o){o!==0&&n.push(a)}),t.connections===void 0&&(t.connections=[]),t.connections.push(n)}else if(i.name==="Properties70")Object.keys(i).forEach(function(a){t[a]=i[a]});else if(e==="Properties70"&&i.name==="P"){let n=i.propertyList[0],a=i.propertyList[1],o=i.propertyList[2],s=i.propertyList[3],l;n.indexOf("Lcl ")===0&&(n=n.replace("Lcl ","Lcl_")),a.indexOf("Lcl ")===0&&(a=a.replace("Lcl ","Lcl_")),a==="Color"||a==="ColorRGB"||a==="Vector"||a==="Vector3D"||a.indexOf("Lcl_")===0?l=[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:l=i.propertyList[4],t[n]={type:a,type2:o,flag:s,value:l}}else t[i.name]===void 0?typeof i.id=="number"?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:i.name==="PoseNode"?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):t[i.name][i.id]===void 0&&(t[i.name][i.id]=i)}parseProperty(e){let t=e.getString(1),i;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":let n=e.getUint32(),a=e.getUint32(),o=e.getUint32();if(a===0)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}let s=Sse(new Uint8Array(e.getArrayBuffer(o))),l=new GR(s.buffer);switch(t){case"b":case"c":return l.getBooleanArray(n);case"d":return l.getFloat64Array(n);case"f":return l.getFloat32Array(n);case"i":return l.getInt32Array(n);case"l":return l.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},GR=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){let t=[];for(let i=0;i<e;i++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let i=0;i<e;i++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let i=0;i<e;i++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let i=0;i<e;i++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let i=0;i<e;i++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,i=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let n=i.indexOf(0);return n>=0&&(i=new Uint8Array(this.dv.buffer,t,n)),this._textDecoder.decode(i)}},HR=class{add(e,t){this[e]=t}};function YOe(r){let e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===Cse(r,0,e.length)}function qOe(r){let e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],t=0;function i(n){let a=r[n-1];return r=r.slice(t+n),t++,a}for(let n=0;n<e.length;++n)if(i(1)===e[n])return!1;return!0}function Tse(r){let e=/FBXVersion: (\d+)/,t=r.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function ZOe(r){return r/46186158e3}var jOe=[];function kR(r,e,t,i){let n;switch(i.mappingType){case"ByPolygonVertex":n=r;break;case"ByPolygon":n=e;break;case"ByVertice":n=t;break;case"AllSame":n=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}i.referenceType==="IndexToDirect"&&(n=i.indices[n]);let a=n*i.dataSize,o=a+i.dataSize;return JOe(jOe,i.buffer,a,o)}var Xk=new Fn,S0=new ye;function Ese(r){let e=new Ht,t=new Ht,i=new Ht,n=new Ht,a=new Ht,o=new Ht,s=new Ht,l=new Ht,u=new Ht,c=new Ht,f=new Ht,h=new Ht,p=r.inheritType?r.inheritType:0;if(r.translation&&e.setPosition(S0.fromArray(r.translation)),r.preRotation){let b=r.preRotation.map(na.degToRad);b.push(r.eulerOrder||Fn.DEFAULT_ORDER),t.makeRotationFromEuler(Xk.fromArray(b))}if(r.rotation){let b=r.rotation.map(na.degToRad);b.push(r.eulerOrder||Fn.DEFAULT_ORDER),i.makeRotationFromEuler(Xk.fromArray(b))}if(r.postRotation){let b=r.postRotation.map(na.degToRad);b.push(r.eulerOrder||Fn.DEFAULT_ORDER),n.makeRotationFromEuler(Xk.fromArray(b)),n.invert()}r.scale&&a.scale(S0.fromArray(r.scale)),r.scalingOffset&&s.setPosition(S0.fromArray(r.scalingOffset)),r.scalingPivot&&o.setPosition(S0.fromArray(r.scalingPivot)),r.rotationOffset&&l.setPosition(S0.fromArray(r.rotationOffset)),r.rotationPivot&&u.setPosition(S0.fromArray(r.rotationPivot)),r.parentMatrixWorld&&(f.copy(r.parentMatrix),c.copy(r.parentMatrixWorld));let d=t.clone().multiply(i).multiply(n),g=new Ht;g.extractRotation(c);let m=new Ht;m.copyPosition(c);let v=m.clone().invert().multiply(c),_=g.clone().invert().multiply(v),y=a,x=new Ht;if(p===0)x.copy(g).multiply(d).multiply(_).multiply(y);else if(p===1)x.copy(g).multiply(_).multiply(d).multiply(y);else{let E=new Ht().scale(new ye().setFromMatrixScale(f)).clone().invert(),I=_.clone().multiply(E);x.copy(g).multiply(d).multiply(I).multiply(y)}let M=u.clone().invert(),S=o.clone().invert(),w=e.clone().multiply(l).multiply(u).multiply(t).multiply(i).multiply(n).multiply(M).multiply(s).multiply(o).multiply(a).multiply(S),T=new Ht().copyPosition(w),C=c.clone().multiply(T);return h.copyPosition(C),w=h.clone().multiply(x),w.premultiply(c.invert()),w}function Ase(r){r=r||0;let e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return r===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[r]}function Yk(r){return r.split(",").map(function(t){return parseFloat(t)})}function Cse(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=r.byteLength),new TextDecoder().decode(new Uint8Array(r,e,t))}function KOe(r,e){for(let t=0,i=r.length,n=e.length;t<n;t++,i++)r[i]=e[t]}function JOe(r,e,t,i){for(let n=t,a=0;n<i;n++,a++)r[a]=e[n];return r}var $Oe=["Three"],QOe=new SS,Rse,Pse=(()=>{let e=class e{constructor(){this.http=xl(_m),this.modal=xl(ym),this.titleService=xl(SV),this.animate=()=>{requestAnimationFrame(this.animate);let i=QOe.getDelta();Rse&&Rse.update(i),this.renderer.render(this.scene,this.camera)}}ngOnInit(){this.titleService.setTitle("\u91CD\u78C53D"),this.initThreeJs(),this.animate()}initThreeJs(){this.camera=new Gi(40,window.innerWidth/window.innerHeight,1,2e4),this.camera.position.set(2200,300,-3100),this.scene=new yS,this.scene.background=new ir(263446);let i=new _S(16777215,4473924,5);i.position.set(0,200,0),this.scene.add(i);let n=new xS(16777215,5);n.position.set(0,200,100),n.castShadow=!0,n.shadow.camera.top=180,n.shadow.camera.bottom=-100,n.shadow.camera.left=-120,n.shadow.camera.right=120,this.scene.add(n);let a=this;new VR().load("assets/fbx/bb.fbx",function(p){p.traverse(function(d){}),a.scene.add(p)},p=>{},p=>{console.error("An error happened",p)}),this.renderer=new gS({antialias:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.shadowMap.enabled=!0,this.container.nativeElement.appendChild(this.renderer.domElement);let s=5,l=32,u=new OA(s,l),c=new tc({color:16711680}),f=new rn(u,c);f.position.set(850,100,-2e3),this.scene.add(f);let h=new Lse.OrbitControls(this.camera,this.renderer.domElement);h.target.set(850,100,-2e3),h.update(),window.addEventListener("resize",this.onWindowResize)}render(){this.cube.rotation.x+=.01,this.cube.rotation.y+=.01,this.renderer.render(this.scene,this.camera)}onWindowResize(){this.camera.aspect=window.innerWidth/window.innerHeight,this.camera.updateProjectionMatrix(),this.renderer.setSize(window.innerWidth,window.innerHeight)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=si({type:e,selectors:[["app-data-v-t1"]],viewQuery:function(n,a){if(n&1&&vm($Oe,7),n&2){let o;co(o=fo())&&(a.container=o.first)}},standalone:!0,features:[ui],decls:3,vars:0,consts:[[2,"display","flex","flex-direction","column","height","100vh"],[2,"flex-grow","1"],["Three",""]],template:function(n,a){n&1&&(tr(0,"div",0),li(1,"div",1,2),lr())},dependencies:[Dc,Ic,Kc,Wc,$c,Qc,Jc,Zc,Pc,Vc,Hc,nf,qc,Xc,Tl,Cc,Bc,kc,ef,rf,Fc,El,Yc,Oc,Gc,zc,tf,Lc,Rc,jc,Uc,Ac,Nc,wl],encapsulation:2});let r=e;return r})();var DDt=[{path:"s1/:id",component:_$,data:{menu:null}},{path:"second1/:id",component:x$,data:{menu:null}},{path:"threejs/:id",component:S$},{path:"t1/:id",component:Pse}];export{DDt as routes};