数据可视化大屏
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

12544 行
2.5MB

  1. import{a as z0,b as UV,c as GL,d as OV,e as zV,f as Ob}from"./chunk-PKVOCI4N.js";import{$a as Ss,A as rs,Aa as Mm,Ba as Nb,C as is,Ca as La,Ga as ps,Ia as ms,La as vs,Pa as gs,Sa as ys,Ua as _s,V as ns,W as LV,X as DV,Xa as xs,_ as as,aa as Sm,b as Ib,ba as PV,bb as Ms,ca as Ra,cb as IV,db as Da,e as Qo,fb as bs,gb as NV,hb as ws,jb as Ts,kb as Ub,la as os,pa as ss,ra as ls,ta as us,u as es,ua as cs,v as ts,wa as fs,y as RV,ya as hs}from"./chunk-WD6SV3WH.js";import{$ as mV,Ab as Ca,Bb as Pi,Cb as Ii,D as fV,Db as ju,Eb as Pr,Fb as of,Ge as jo,Ha as Ab,I as hV,Ib as TV,Jb as Fr,Ka as Lt,Kb as EV,La as Zo,Lb as AV,Le as Ko,Ma as NL,Mb as kL,Me as Lb,Ne as Db,Nf as ds,Pa as _V,Q as pV,Sb as xm,Ta as Ar,U as dV,Va as _t,Wa as xV,Xa as UL,Ya as SV,Za as MV,a as Tb,ba as IL,cc as VL,cd as CV,db as OL,dc as nu,e as Vse,eb as zL,f as Gse,fb as FL,g as DL,gb as Dt,h as Hse,hb as Pt,hf as Jo,i as Wse,ia as vV,ib as mr,ic as U0,j as Eb,jb as ru,kb as iu,la as sa,lb as bV,lf as $o,m as lV,na as zr,nc as Rb,o as PL,oa as gV,p as uV,pa as yV,qb as wV,ra as N0,sb as Dr,tb as Aa,tf as Pb,u as I0,ub as gi,vb as Cb,vf as sf,w as cV,xd as O0,xf as lf,yb as BL,zb as af}from"./chunk-VDRVUQCF.js";var Pse={};DL(Pse,{AddEquation:()=>Uk,AddOperation:()=>Voe,AdditiveBlending:()=>Dk,AlphaFormat:()=>$oe,AlwaysDepth:()=>Noe,AmbientLight:()=>oL,AnimationClip:()=>Go,AnimationMixer:()=>nV,AnimationObjectGroup:()=>yk,AnimationUtils:()=>ia,ArcCurve:()=>yL,ArrowHelper:()=>vm,Audio:()=>d0,AudioAnalyser:()=>iV,AudioContext:()=>tV,AudioListener:()=>vk,AudioLoader:()=>rV,AxisHelper:()=>gL,BackSide:()=>Wh,BasicDepthPacking:()=>hse,BasicShadowMap:()=>RIe,BinaryTextureLoader:()=>Zk,BlendingMode:()=>Soe,Bone:()=>KR,BooleanKeyframeTrack:()=>fL,BoundingBoxHelper:()=>i3e,Box2:()=>UM,Box3:()=>Wu,BoxBufferGeometry:()=>Qd,BoxGeometry:()=>cb,BoxHelper:()=>w0,BufferAttribute:()=>yt,BufferGeometry:()=>Vt,BufferGeometryLoader:()=>Kk,ByteType:()=>Yoe,Cache:()=>dk,Camera:()=>aa,CameraHelper:()=>_b,CanvasRenderer:()=>c3e,CanvasTexture:()=>QR,CatmullRomCurve3:()=>aV,CineonToneMapping:()=>Woe,CircleBufferGeometry:()=>u0,CircleGeometry:()=>ub,ClampToEdgeWrapping:()=>Ho,Clock:()=>bk,ClosedSplineCurve3:()=>Dse,Color:()=>Wt,ColorKeyframeTrack:()=>hL,CompressedTexture:()=>jy,CompressedTextureLoader:()=>Tse,ConeBufferGeometry:()=>lb,ConeGeometry:()=>sb,CubeCamera:()=>pL,CubeGeometry:()=>cb,CubeReflectionMapping:()=>SL,CubeRefractionMapping:()=>WR,CubeTexture:()=>Xh,CubeTextureLoader:()=>jk,CubeUVReflectionMapping:()=>ML,CubeUVRefractionMapping:()=>bL,CubicBezierCurve:()=>pm,CubicBezierCurve3:()=>POe,CubicInterpolant:()=>sL,CullFaceBack:()=>CM,CullFaceFront:()=>Ek,CullFaceFrontBack:()=>AIe,CullFaceNone:()=>yoe,Curve:()=>oa,CurvePath:()=>db,CurveUtils:()=>bb,CustomBlending:()=>Nk,CylinderBufferGeometry:()=>ef,CylinderGeometry:()=>am,Cylindrical:()=>Tk,DataTexture:()=>$d,DataTextureLoader:()=>ROe,DefaultLoadingManager:()=>Yo,DepthFormat:()=>Yd,DepthStencilFormat:()=>Gy,DepthTexture:()=>YM,DirectionalLight:()=>aL,DirectionalLightHelper:()=>b0,DirectionalLightShadow:()=>nL,DiscreteInterpolant:()=>lL,DodecahedronBufferGeometry:()=>e0,DodecahedronGeometry:()=>JM,DoubleSide:()=>T0,DstAlphaFactor:()=>Coe,DstColorFactor:()=>Loe,DynamicBufferAttribute:()=>qOe,EdgesGeometry:()=>l0,EdgesHelper:()=>n3e,EllipseCurve:()=>tf,EqualDepth:()=>Ooe,EquirectangularReflectionMapping:()=>Bk,EquirectangularRefractionMapping:()=>XR,Euler:()=>jh,EventDispatcher:()=>cl,ExtrudeGeometry:()=>hl,Face3:()=>Xo,Face4:()=>OOe,FaceColors:()=>Lk,FaceNormalsHelper:()=>yb,FileLoader:()=>pl,FlatShading:()=>Ck,Float32Attribute:()=>t3e,Float32BufferAttribute:()=>xr,Float64Attribute:()=>r3e,Float64BufferAttribute:()=>GM,FloatType:()=>ky,Fog:()=>qy,FogExp2:()=>Yy,Font:()=>eV,FontLoader:()=>Ase,FrontFaceDirectionCCW:()=>CIe,FrontFaceDirectionCW:()=>_oe,FrontSide:()=>By,Frustum:()=>OM,GammaEncoding:()=>Wk,Geometry:()=>sr,GeometryIdCount:()=>Xk,GeometryUtils:()=>s3e,GreaterDepth:()=>Foe,GreaterEqualDepth:()=>zoe,GridHelper:()=>gb,Group:()=>XM,HalfFloatType:()=>qR,HemisphereLight:()=>eL,HemisphereLightHelper:()=>M0,IcosahedronBufferGeometry:()=>Qy,IcosahedronGeometry:()=>KM,ImageLoader:()=>Mb,ImageUtils:()=>l3e,ImmediateRenderObject:()=>mb,InstancedBufferAttribute:()=>g0,InstancedBufferGeometry:()=>mm,InstancedInterleavedBuffer:()=>v0,Int16Attribute:()=>JOe,Int16BufferAttribute:()=>kM,Int32Attribute:()=>QOe,Int32BufferAttribute:()=>VM,Int8Attribute:()=>ZOe,Int8BufferAttribute:()=>zM,IntType:()=>Zoe,InterleavedBuffer:()=>m0,InterleavedBufferAttribute:()=>xk,Interpolant:()=>mo,InterpolateDiscrete:()=>PM,InterpolateLinear:()=>AM,InterpolateSmooth:()=>GR,JSONLoader:()=>Jk,KeyframeTrack:()=>fm,LOD:()=>WM,LatheBufferGeometry:()=>a0,LatheGeometry:()=>ob,Layers:()=>ZR,LensFlare:()=>pk,LessDepth:()=>Uoe,LessEqualDepth:()=>HR,Light:()=>Bi,LightShadow:()=>ym,Line:()=>Qc,Line3:()=>qd,LineBasicMaterial:()=>Fi,LineCurve:()=>Yu,LineCurve3:()=>NOe,LineDashedMaterial:()=>cm,LinePieces:()=>FOe,LineSegments:()=>mi,LineStrip:()=>zOe,LinearEncoding:()=>NM,LinearFilter:()=>po,LinearInterpolant:()=>hb,LinearMipMapLinearFilter:()=>Sb,LinearMipMapNearestFilter:()=>Vk,LinearToneMapping:()=>Fk,Loader:()=>Zd,LoadingManager:()=>qk,LogLuvEncoding:()=>DIe,LoopOnce:()=>rse,LoopPingPong:()=>nse,LoopRepeat:()=>ise,LuminanceAlphaFormat:()=>ese,LuminanceFormat:()=>Qoe,MOUSE:()=>EIe,Material:()=>gr,MaterialLoader:()=>AL,Math:()=>cr,Matrix3:()=>fl,Matrix4:()=>jt,MaxEquation:()=>tk,Mesh:()=>yn,MeshBasicMaterial:()=>vo,MeshDepthMaterial:()=>qh,MeshFaceMaterial:()=>BOe,MeshLambertMaterial:()=>um,MeshNormalMaterial:()=>lm,MeshPhongMaterial:()=>tu,MeshPhysicalMaterial:()=>om,MeshStandardMaterial:()=>Xu,MeshToonMaterial:()=>sm,MinEquation:()=>ek,MirroredRepeatWrapping:()=>Kd,MixOperation:()=>koe,MorphBlendMesh:()=>Bn,MultiMaterial:()=>fb,MultiplyBlending:()=>Ik,MultiplyOperation:()=>xb,NearestFilter:()=>Wo,NearestMipMapLinearFilter:()=>TL,NearestMipMapNearestFilter:()=>wL,NeverDepth:()=>Ioe,NoBlending:()=>RM,NoColors:()=>_L,NoToneMapping:()=>VR,NormalBlending:()=>E0,NotEqualDepth:()=>Boe,NumberKeyframeTrack:()=>p0,Object3D:()=>At,ObjectLoader:()=>Ese,OctahedronBufferGeometry:()=>im,OctahedronGeometry:()=>jM,OneFactor:()=>Toe,OneMinusDstAlphaFactor:()=>Roe,OneMinusDstColorFactor:()=>Doe,OneMinusSrcAlphaFactor:()=>zk,OneMinusSrcColorFactor:()=>Aoe,OrthographicCamera:()=>Xy,PCFShadowMap:()=>Ak,PCFSoftShadowMap:()=>xoe,ParametricBufferGeometry:()=>Jy,ParametricGeometry:()=>qM,Particle:()=>VOe,ParticleBasicMaterial:()=>WOe,ParticleSystem:()=>GOe,ParticleSystemMaterial:()=>XOe,Path:()=>wb,PerspectiveCamera:()=>ra,Plane:()=>Vo,PlaneBufferGeometry:()=>em,PlaneGeometry:()=>ab,PointCloud:()=>kOe,PointCloudMaterial:()=>HOe,PointLight:()=>iL,PointLightHelper:()=>x0,Points:()=>Zy,PointsMaterial:()=>eu,PolarGridHelper:()=>vL,PolyhedronBufferGeometry:()=>go,PolyhedronGeometry:()=>$M,PositionalAudio:()=>gk,Projector:()=>u3e,PropertyBinding:()=>Di,PropertyMixer:()=>dL,QuadraticBezierCurve:()=>dm,QuadraticBezierCurve3:()=>IOe,Quaternion:()=>cn,QuaternionKeyframeTrack:()=>pb,QuaternionLinearInterpolant:()=>uL,REVISION:()=>goe,RGBADepthPacking:()=>pse,RGBAFormat:()=>Hu,RGBA_PVRTC_2BPPV1_Format:()=>fk,RGBA_PVRTC_4BPPV1_Format:()=>ck,RGBA_S3TC_DXT1_Format:()=>ak,RGBA_S3TC_DXT3_Format:()=>ok,RGBA_S3TC_DXT5_Format:()=>sk,RGBDEncoding:()=>fse,RGBEEncoding:()=>lse,RGBEFormat:()=>LIe,RGBFormat:()=>Vy,RGBM16Encoding:()=>cse,RGBM7Encoding:()=>use,RGB_ETC1_Format:()=>tse,RGB_PVRTC_2BPPV1_Format:()=>uk,RGB_PVRTC_4BPPV1_Format:()=>lk,RGB_S3TC_DXT1_Format:()=>nk,RawShaderMaterial:()=>f0,Ray:()=>Zh,Raycaster:()=>Sk,RectAreaLight:()=>mk,RectAreaLightHelper:()=>S0,ReinhardToneMapping:()=>Goe,RepeatWrapping:()=>Kc,ReverseSubtractEquation:()=>boe,RingBufferGeometry:()=>n0,RingGeometry:()=>nb,Scene:()=>tm,SceneUtils:()=>UOe,ShaderChunk:()=>jr,ShaderLib:()=>Wy,ShaderMaterial:()=>Ea,ShadowMaterial:()=>c0,Shape:()=>jd,ShapeBufferGeometry:()=>o0,ShapeGeometry:()=>s0,ShapePath:()=>Qk,ShapeUtils:()=>Fn,ShortType:()=>qoe,Skeleton:()=>jR,SkeletonHelper:()=>_0,SkinnedMesh:()=>JR,SmoothShading:()=>Rk,Sphere:()=>na,SphereBufferGeometry:()=>nm,SphereGeometry:()=>ib,Spherical:()=>wk,SphericalReflectionMapping:()=>kk,Spline:()=>LOe,SplineCurve:()=>hm,SplineCurve3:()=>DOe,SpotLight:()=>rL,SpotLightHelper:()=>y0,SpotLightShadow:()=>tL,Sprite:()=>HM,SpriteMaterial:()=>rm,SrcAlphaFactor:()=>Ok,SrcAlphaSaturateFactor:()=>Poe,SrcColorFactor:()=>Eoe,StereoCamera:()=>Cse,StringKeyframeTrack:()=>cL,SubtractEquation:()=>Moe,SubtractiveBlending:()=>Pk,TetrahedronBufferGeometry:()=>$y,TetrahedronGeometry:()=>ZM,TextGeometry:()=>rb,Texture:()=>ui,TextureFilter:()=>ik,TextureLoader:()=>EL,TextureMapping:()=>Xoe,TextureWrapping:()=>rk,TorusBufferGeometry:()=>i0,TorusGeometry:()=>tb,TorusKnotBufferGeometry:()=>r0,TorusKnotGeometry:()=>eb,Triangle:()=>ul,TriangleFanDrawMode:()=>ose,TriangleStripDrawMode:()=>ase,TrianglesDrawMode:()=>Hk,TubeBufferGeometry:()=>t0,TubeGeometry:()=>QM,UVMapping:()=>xL,Uint16Attribute:()=>$Oe,Uint16BufferAttribute:()=>Jc,Uint32Attribute:()=>e3e,Uint32BufferAttribute:()=>$c,Uint8Attribute:()=>jOe,Uint8BufferAttribute:()=>FM,Uint8ClampedAttribute:()=>KOe,Uint8ClampedBufferAttribute:()=>BM,Uncharted2ToneMapping:()=>Hoe,Uniform:()=>mL,UniformsLib:()=>hr,UniformsUtils:()=>ho,UnsignedByteType:()=>YR,UnsignedInt248Type:()=>DM,UnsignedIntType:()=>Gk,UnsignedShort4444Type:()=>joe,UnsignedShort5551Type:()=>Koe,UnsignedShort565Type:()=>Joe,UnsignedShortType:()=>LM,Vector2:()=>Mt,Vector3:()=>oe,Vector4:()=>ii,VectorKeyframeTrack:()=>h0,Vertex:()=>YOe,VertexColors:()=>gm,VertexNormalsHelper:()=>vb,VideoTexture:()=>$R,WebGLRenderTarget:()=>A0,WebGLRenderTargetCube:()=>Hy,WebGLRenderer:()=>Yk,WireframeGeometry:()=>Ky,WireframeHelper:()=>a3e,WrapAroundEnding:()=>IM,XHRLoader:()=>o3e,ZeroCurvatureEnding:()=>Jd,ZeroFactor:()=>woe,ZeroSlopeEnding:()=>Xd,sRGBEncoding:()=>sse});function cl(){}function Mt(r,e){this.x=r||0,this.y=e||0}function ui(r,e,t,i,n,a,o,s,l,u){Object.defineProperty(this,"id",{value:PIe++}),this.uuid=cr.generateUUID(),this.name="",this.image=r!==void 0?r:ui.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=e!==void 0?e:ui.DEFAULT_MAPPING,this.wrapS=t!==void 0?t:Ho,this.wrapT=i!==void 0?i:Ho,this.magFilter=n!==void 0?n:po,this.minFilter=a!==void 0?a:Sb,this.anisotropy=l!==void 0?l:1,this.format=o!==void 0?o:Hu,this.type=s!==void 0?s:YR,this.offset=new Mt(0,0),this.repeat=new Mt(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u!==void 0?u:NM,this.version=0,this.onUpdate=null}function ii(r,e,t,i){this.x=r||0,this.y=e||0,this.z=t||0,this.w=i!==void 0?i:1}function A0(r,e,t){this.uuid=cr.generateUUID(),this.width=r,this.height=e,this.scissor=new ii(0,0,r,e),this.scissorTest=!1,this.viewport=new ii(0,0,r,e),t=t||{},t.minFilter===void 0&&(t.minFilter=po),this.texture=new ui(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 Hy(r,e,t){A0.call(this,r,e,t),this.activeCubeFace=0,this.activeMipMapLevel=0}function cn(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 jt(){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 Xh(r,e,t,i,n,a,o,s,l,u){r=r!==void 0?r:[],e=e!==void 0?e:SL,ui.call(this,r,e,t,i,n,a,o,s,l,u),this.flipY=!1}function vse(){this.seq=[],this.map={}}function C0(r,e,t){var i=r[0];if(i<=0||i>0)return r;var n=e*t,a=coe[n];if(a===void 0&&(a=new Float32Array(n),coe[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 gse(r,e){var t=foe[e];t===void 0&&(t=new Int32Array(e),foe[e]=t);for(var i=0;i!==e;++i)t[i]=r.allocTextureUnit();return t}function IIe(r,e){r.uniform1f(this.addr,e)}function NIe(r,e){r.uniform1i(this.addr,e)}function UIe(r,e){e.x===void 0?r.uniform2fv(this.addr,e):r.uniform2f(this.addr,e.x,e.y)}function OIe(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 zIe(r,e){e.x===void 0?r.uniform4fv(this.addr,e):r.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function FIe(r,e){r.uniformMatrix2fv(this.addr,!1,e.elements||e)}function BIe(r,e){r.uniformMatrix3fv(this.addr,!1,e.elements||e)}function kIe(r,e){r.uniformMatrix4fv(this.addr,!1,e.elements||e)}function VIe(r,e,t){var i=t.allocTextureUnit();r.uniform1i(this.addr,i),t.setTexture2D(e||dse,i)}function GIe(r,e,t){var i=t.allocTextureUnit();r.uniform1i(this.addr,i),t.setTextureCube(e||mse,i)}function yse(r,e){r.uniform2iv(this.addr,e)}function _se(r,e){r.uniform3iv(this.addr,e)}function xse(r,e){r.uniform4iv(this.addr,e)}function HIe(r){switch(r){case 5126:return IIe;case 35664:return UIe;case 35665:return OIe;case 35666:return zIe;case 35674:return FIe;case 35675:return BIe;case 35676:return kIe;case 35678:return VIe;case 35680:return GIe;case 5124:case 35670:return NIe;case 35667:case 35671:return yse;case 35668:case 35672:return _se;case 35669:case 35673:return xse}}function WIe(r,e){r.uniform1fv(this.addr,e)}function XIe(r,e){r.uniform1iv(this.addr,e)}function YIe(r,e){r.uniform2fv(this.addr,C0(e,this.size,2))}function qIe(r,e){r.uniform3fv(this.addr,C0(e,this.size,3))}function ZIe(r,e){r.uniform4fv(this.addr,C0(e,this.size,4))}function jIe(r,e){r.uniformMatrix2fv(this.addr,!1,C0(e,this.size,4))}function KIe(r,e){r.uniformMatrix3fv(this.addr,!1,C0(e,this.size,9))}function JIe(r,e){r.uniformMatrix4fv(this.addr,!1,C0(e,this.size,16))}function $Ie(r,e,t){var i=e.length,n=gse(t,i);r.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)t.setTexture2D(e[a]||dse,n[a])}function QIe(r,e,t){var i=e.length,n=gse(t,i);r.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)t.setTextureCube(e[a]||mse,n[a])}function eNe(r){switch(r){case 5126:return WIe;case 35664:return YIe;case 35665:return qIe;case 35666:return ZIe;case 35674:return jIe;case 35675:return KIe;case 35676:return JIe;case 35678:return $Ie;case 35680:return QIe;case 5124:case 35670:return XIe;case 35667:case 35671:return yse;case 35668:case 35672:return _se;case 35669:case 35673:return xse}}function tNe(r,e,t){this.id=r,this.addr=t,this.setValue=HIe(e.type)}function rNe(r,e,t){this.id=r,this.addr=t,this.size=e.size,this.setValue=eNe(e.type)}function Sse(r){this.id=r,vse.call(this)}function hoe(r,e){r.seq.push(e),r.map[e.id]=e}function iNe(r,e,t){var i=r.name,n=i.length;for($B.lastIndex=0;;){var a=$B.exec(i),o=$B.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){hoe(t,u===void 0?new tNe(s,r,e):new rNe(s,r,e));break}else{var c=t.map,f=c[s];f===void 0&&(f=new Sse(s),hoe(t,f)),t=f}}}function Yh(r,e,t){vse.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);iNe(a,s,this)}}function Wt(r,e,t){return e===void 0&&t===void 0?this.set(r):this.setRGB(r,e,t)}function $d(r,e,t,i,n,a,o,s,l,u,c,f){ui.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:Wo,this.minFilter=u!==void 0?u:Wo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function UM(r,e){this.min=r!==void 0?r:new Mt(1/0,1/0),this.max=e!==void 0?e:new Mt(-1/0,-1/0)}function iOe(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 Mt(M*_,M),w=new oe(1,1,0),T=new Mt(1,1),C=new UM;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 P=I.lensFlares[R];P.opacity>.001&&P.scale>.001&&(w.x=P.x,w.y=P.y,w.z=P.z,M=P.size*P.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,P.rotation),t.uniform1f(u.opacity,P.opacity),t.uniform3f(u.color,P.color.r,P.color.g,P.color.b),i.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),r.setTexture2D(P.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 nOe(r,e){var t=r.context,i=r.state,n,a,o,s,l,u,c=new oe,f=new cn,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 ui(_),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 gr(){Object.defineProperty(this,"id",{value:aOe++}),this.uuid=cr.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=E0,this.side=By,this.shading=Rk,this.vertexColors=_L,this.opacity=1,this.transparent=!1,this.blendSrc=Ok,this.blendDst=zk,this.blendEquation=Uk,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=HR,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 Ea(r){gr.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 qh(r){gr.call(this),this.type="MeshDepthMaterial",this.depthPacking=hse,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 Wu(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 na(r,e){this.center=r!==void 0?r:new oe,this.radius=e!==void 0?e:0}function fl(){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 Vo(r,e){this.normal=r!==void 0?r:new oe(1,0,0),this.constant=e!==void 0?e:0}function OM(r,e,t,i,n,a){this.planes=[r!==void 0?r:new Vo,e!==void 0?e:new Vo,t!==void 0?t:new Vo,i!==void 0?i:new Vo,n!==void 0?n:new Vo,a!==void 0?a:new Vo]}function Mse(r,e,t,i){var n=r.context,a=r.state,o=new OM,s=new jt,l=e.shadows,u=new Mt,c=new Mt(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 ii,new ii,new ii,new ii,new ii,new ii],w=new qh;w.depthPacking=pse,w.clipping=!0;for(var T=Wy.distanceRGBA,C=ho.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 Ea({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:T.vertexShader,fragmentShader:T.fragmentShader,morphTargets:E,skinning:I,clipping:!0});_[b]=A}var P=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ak,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(z,k){if(P.enabled!==!1&&!(P.autoUpdate===!1&&P.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:Wo,magFilter:Wo,format:Hu};K.map=new A0(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(z,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,F=0,L=Ve.length;F<L;F++){var ne=Ve[F],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),P.needsUpdate=!1}};function U(z,k,G,Y){var J=z.geometry,Q=null,V=v,K=z.customDepthMaterial;if(G&&(V=_,K=z.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=z.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 P.renderSingleSided&&We==T0&&(We=By),P.renderReverseSided&&(We===By?We=Wh:We===Wh&&(We=By)),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(z,k,G){if(z.visible!==!1){var Y=(z.layers.mask&k.layers.mask)!==0;if(Y&&(z.isMesh||z.isLine||z.isPoints)&&z.castShadow&&(z.frustumCulled===!1||o.intersectsObject(z)===!0)){var J=z.material;J.visible===!0&&(z.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,z.matrixWorld),p.push(z))}for(var Q=z.children,V=0,K=Q.length;V<K;V++)B(Q[V],k,G)}}}function Zh(r,e){this.origin=r!==void 0?r:new oe,this.direction=e!==void 0?e:new oe}function jh(r,e,t,i){this._x=r||0,this._y=e||0,this._z=t||0,this._order=i||jh.DefaultOrder}function ZR(){this.mask=1}function At(){Object.defineProperty(this,"id",{value:oOe++}),this.uuid=cr.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=At.DefaultUp.clone();var r=new oe,e=new jh,t=new cn,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 jt},normalMatrix:{value:new fl}}),this.matrix=new jt,this.matrixWorld=new jt,this.matrixAutoUpdate=At.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ZR,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function qd(r,e){this.start=r!==void 0?r:new oe,this.end=e!==void 0?e:new oe}function ul(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 Xo(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 Wt,this.vertexColors=Array.isArray(n)?n:[],this.materialIndex=a!==void 0?a:0}function vo(r){gr.call(this),this.type="MeshBasicMaterial",this.color=new Wt(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=xb,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 yt(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 zM(r,e){yt.call(this,new Int8Array(r),e)}function FM(r,e){yt.call(this,new Uint8Array(r),e)}function BM(r,e){yt.call(this,new Uint8ClampedArray(r),e)}function kM(r,e){yt.call(this,new Int16Array(r),e)}function Jc(r,e){yt.call(this,new Uint16Array(r),e)}function VM(r,e){yt.call(this,new Int32Array(r),e)}function $c(r,e){yt.call(this,new Uint32Array(r),e)}function xr(r,e){yt.call(this,new Float32Array(r),e)}function GM(r,e){yt.call(this,new Float64Array(r),e)}function bse(){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 sr(){Object.defineProperty(this,"id",{value:Xk()}),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 Xk(){return sOe++}function Vt(){Object.defineProperty(this,"id",{value:Xk()}),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 yn(r,e){At.call(this),this.type="Mesh",this.geometry=r!==void 0?r:new Vt,this.material=e!==void 0?e:new vo({color:Math.random()*16777215}),this.drawMode=Hk,this.updateMorphTargets()}function Qd(r,e,t,i,n,a){Vt.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 yt(u,1)),this.addAttribute("position",new yt(c,3)),this.addAttribute("normal",new yt(f,3)),this.addAttribute("uv",new yt(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,P){for(var U=b/R,B=E/A,z=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-z;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,P),v+=V,m+=Q}}function em(r,e,t,i){Vt.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 yt(M,1)),this.addAttribute("position",new yt(h,3)),this.addAttribute("normal",new yt(p,3)),this.addAttribute("uv",new yt(d,2))}function aa(){At.call(this),this.type="Camera",this.matrixWorldInverse=new jt,this.projectionMatrix=new jt}function ra(r,e,t,i){aa.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 Xy(r,e,t,i,n,a){aa.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 lOe(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 uOe(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 cOe(){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 Wt,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"SpotLight":t={position:new oe,direction:new oe,color:new Wt,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"PointLight":t={position:new oe,color:new Wt,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Mt};break;case"HemisphereLight":t={direction:new oe,skyColor:new Wt,groundColor:new Wt};break;case"RectAreaLight":t={color:new Wt,position:new oe,halfWidth:new oe,halfHeight:new oe};break}return r[e.id]=t,t}}}function fOe(r){for(var e=r.split(`
  11. `),t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
  12. `)}function poe(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),fOe(t)),i}function wse(r){switch(r){case NM:return["Linear","( value )"];case sse:return["sRGB","( value )"];case lse:return["RGBE","( value )"];case use:return["RGBM","( value, 7.0 )"];case cse:return["RGBM","( value, 16.0 )"];case fse:return["RGBD","( value, 256.0 )"];case Wk:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+r)}}function QB(r,e){var t=wse(e);return"vec4 "+r+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function pOe(r,e){var t=wse(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function dOe(r,e){var t;switch(e){case Fk:t="Linear";break;case Goe:t="Reinhard";break;case Hoe:t="Uncharted2";break;case Woe:t="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function mOe(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(EM).join(`
  13. `)}function vOe(r){var e=[];for(var t in r){var i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  14. `)}function gOe(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 EM(r){return r!==""}function doe(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 hk(r){var e=/#include +<([\w\d.]+)>/g;function t(i,n){var a=jr[n];if(a===void 0)throw new Error("Can not resolve #include <"+n+">");return hk(a)}return r.replace(e,t)}function moe(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 yOe(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===Ak?u="SHADOWMAP_TYPE_PCF":i.shadowMapType===xoe&&(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 SL:case WR:c="ENVMAP_TYPE_CUBE";break;case ML:case bL:c="ENVMAP_TYPE_CUBE_UV";break;case Bk:case XR:c="ENVMAP_TYPE_EQUIREC";break;case kk:c="ENVMAP_TYPE_SPHERE";break}switch(t.envMap.mapping){case WR:case XR:f="ENVMAP_MODE_REFRACTION";break}switch(t.combine){case xb:h="ENVMAP_BLENDING_MULTIPLY";break;case koe:h="ENVMAP_BLENDING_MIX";break;case Voe:h="ENVMAP_BLENDING_ADD";break}}var p=r.gammaFactor>0?r.gammaFactor:1,d=mOe(a,i,r.extensions),g=vOe(o),m=n.createProgram(),v,_;t.isRawShaderMaterial?(v=[g,`
  15. `].filter(EM).join(`
  16. `),_=[d,g,`
  17. `].filter(EM).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(EM).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!==VR?"#define TONE_MAPPING":"",i.toneMapping!==VR?jr.tonemapping_pars_fragment:"",i.toneMapping!==VR?dOe("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?jr.encodings_pars_fragment:"",i.mapEncoding?QB("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?QB("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?QB("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?pOe("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  21. `].filter(EM).join(`
  22. `)),s=hk(s,i),s=doe(s,i),l=hk(l,i),l=doe(l,i),t.isShaderMaterial||(s=moe(s),l=moe(l));var y=v+s,x=_+l,M=poe(n,n.VERTEX_SHADER,y),S=poe(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 Yh(n,m,r)),I};var R;return this.getAttributes=function(){return R===void 0&&(R=gOe(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=hOe++,this.code=e,this.usedTimes=1,this.program=m,this.vertexShader=M,this.fragmentShader=S,this}function _Oe(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=NM,u===NM&&l&&(u=Wk),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===ML||s.envMap.mapping===bL),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===Ck,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===T0,flipSided:s.side===Wh,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 yOe(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 xOe(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 Vt().setFromObject(u)),f=c._bufferGeometry),i[c.id]=f,t.memory.geometries++,f}}}function SOe(r,e,t){var i=new xOe(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 yt(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 MOe(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 P=A/Math.max(R.width,R.height),U=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");U.width=Math.floor(R.width*P),U.height=Math.floor(R.height*P);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 P=A.getContext("2d");return P.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!==Ho||R.wrapT!==Ho||R.minFilter!==Wo&&R.minFilter!==po}function p(R){return R===Wo||R===wL||R===TL?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),P=i.get(R.texture);if(R){if(P.__webglTexture!==void 0&&r.deleteTexture(P.__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 P=i.get(R);if(R.version>0&&P.__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(P,R,A);return}}t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_2D,P.__webglTexture)}function y(R,A){var P=i.get(R);if(R.image.length===6)if(R.version>0&&P.__version!==R.version){P.__image__webglTextureCube||(R.addEventListener("dispose",d),P.__image__webglTextureCube=r.createTexture(),s.textures++),t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,P.__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,z=[],k=0;k<6;k++)!U&&!B?z[k]=u(R.image[k],n.maxCubemapSize):z[k]=B?R.image[k].image:R.image[k];var G=z[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,z[k].width,z[k].height,0,J,Q,z[k].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,J,J,Q,z[k]);else for(var V,K=z[k].mipmaps,ae=0,ve=K.length;ae<ve;ae++)V=K[ae],R.format!==Hu&&R.format!==Vy?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),P.__version=R.version,R.onUpdate&&R.onUpdate(R)}else t.activeTexture(r.TEXTURE0+A),t.bindTexture(r.TEXTURE_CUBE_MAP,P.__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,P){var U;if(P?(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!==Ho||A.wrapT!==Ho)&&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!==Wo&&A.minFilter!==po&&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===ky&&e.get("OES_texture_float_linear")===null||A.type===qR&&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,P){R.__webglInit===void 0&&(R.__webglInit=!0,A.addEventListener("dispose",d),R.__webglTexture=r.createTexture(),s.textures++),t.activeTexture(r.TEXTURE0+P),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),z=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===ky){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===Yd&&J===r.DEPTH_COMPONENT&&A.type!==LM&&A.type!==Gk&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),A.type=LM,k=a(A.type)),A.format===Gy&&(J=r.DEPTH_STENCIL,A.type!==DM&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),A.type=DM,k=a(A.type))),t.texImage2D(r.TEXTURE_2D,0,J,U.width,U.height,0,z,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,z,G.width,G.height,0,z,k,G.data);A.generateMipmaps=!1}else t.texImage2D(r.TEXTURE_2D,0,z,U.width,U.height,0,z,k,U.data);else if(A.isCompressedTexture)for(var Q=0,V=Y.length;Q<V;Q++)G=Y[Q],A.format!==Hu&&A.format!==Vy?t.getCompressedTextureFormats().indexOf(z)>-1?t.compressedTexImage2D(r.TEXTURE_2D,Q,z,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,z,G.width,G.height,0,z,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,z,z,k,G);A.generateMipmaps=!1}else t.texImage2D(r.TEXTURE_2D,0,z,z,k,U);A.generateMipmaps&&B&&r.generateMipmap(r.TEXTURE_2D),R.__version=A.version,A.onUpdate&&A.onUpdate(A)}function w(R,A,P,U){var B=a(A.texture.format),z=a(A.texture.type);t.texImage2D(U,0,B,A.width,A.height,0,B,z,null),r.bindFramebuffer(r.FRAMEBUFFER,R),r.framebufferTexture2D(r.FRAMEBUFFER,P,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 P=A&&A.isWebGLRenderTargetCube;if(P)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===Yd)r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,U,0);else if(A.depthTexture.format===Gy)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),P=R.isWebGLRenderTargetCube===!0;if(R.depthTexture){if(P)throw new Error("target.depthTexture not supported in Cube render targets");C(A.__webglFramebuffer,R)}else if(P){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),P=i.get(R.texture);R.addEventListener("dispose",g),P.__webglTexture=r.createTexture(),s.textures++;var U=R.isWebGLRenderTargetCube===!0,B=c(R);if(U){A.__webglFramebuffer=[];for(var z=0;z<6;z++)A.__webglFramebuffer[z]=r.createFramebuffer()}else A.__webglFramebuffer=r.createFramebuffer();if(U){t.bindTexture(r.TEXTURE_CUBE_MAP,P.__webglTexture),M(r.TEXTURE_CUBE_MAP,R.texture,B);for(var z=0;z<6;z++)w(A.__webglFramebuffer[z],R,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+z);R.texture.generateMipmaps&&B&&r.generateMipmap(r.TEXTURE_CUBE_MAP),t.bindTexture(r.TEXTURE_CUBE_MAP,null)}else t.bindTexture(r.TEXTURE_2D,P.__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!==Wo&&A.minFilter!==po){var P=R&&R.isWebGLRenderTargetCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,U=i.get(A).__webglTexture;t.bindTexture(P,U),r.generateMipmap(P),t.bindTexture(P,null)}}this.setTexture2D=_,this.setTextureCube=y,this.setTextureCubeDynamic=x,this.setupRenderTarget=E,this.updateRenderTargetMipmap=I}function bOe(){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 wOe(r,e,t){function i(){var $=!1,it=new ii,Xe=null,Fe=new ii;return{setMask:function(we){Xe!==we&&!$&&(r.colorMask(we,we,we,we),Xe=we)},setLocked:function(we){$=we},setClear:function(we,Ie,st,Je,Gt){Gt===!0&&(we*=Je,Ie*=Je,st*=Je),it.set(we,Ie,st,Je),Fe.equals(it)===!1&&(r.clearColor(we,Ie,st,Je),Fe.copy(it))},reset:function(){$=!1,Xe=null,Fe.set(0,0,0,1)}}}function n(){var $=!1,it=null,Xe=null,Fe=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 Ioe:r.depthFunc(r.NEVER);break;case Noe:r.depthFunc(r.ALWAYS);break;case Uoe:r.depthFunc(r.LESS);break;case HR:r.depthFunc(r.LEQUAL);break;case Ooe:r.depthFunc(r.EQUAL);break;case zoe:r.depthFunc(r.GEQUAL);break;case Foe:r.depthFunc(r.GREATER);break;case Boe:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}else r.depthFunc(r.LEQUAL);Xe=we}},setLocked:function(we){$=we},setClear:function(we){Fe!==we&&(r.clearDepth(we),Fe=we)},reset:function(){$=!1,it=null,Xe=null,Fe=null}}}function a(){var $=!1,it=null,Xe=null,Fe=null,we=null,Ie=null,st=null,Je=null,Gt=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||Fe!==Te||we!==te)&&(r.stencilFunc(X,Te,te),Xe=X,Fe=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){Gt!==X&&(r.clearStencil(X),Gt=X)},reset:function(){$=!1,it=null,Xe=null,Fe=null,we=null,Ie=null,st=null,Je=null,Gt=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]),P=parseFloat(A)>=1,U=null,B={},z=new ii,k=new ii;function G($,it,Xe){var Fe=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,Fe);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(HR),Ve(!1),ct(CM),ve(r.CULL_FACE),ve(r.BLEND),Ee(E0)}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,Fe,we,Ie,st,Je){$!==RM?ve(r.BLEND):ue(r.BLEND),($!==g||Je!==S)&&($===Dk?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)):$===Pk?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)):$===Ik?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),$===Nk?(we=we||it,Ie=Ie||Xe,st=st||Fe,(it!==m||we!==y)&&(r.blendEquationSeparate(t(it),t(we)),m=it,y=we),(Xe!==v||Fe!==_||Ie!==x||st!==M)&&(r.blendFuncSeparate(t(Xe),t(Fe),t(Ie),t(st)),v=Xe,_=Fe,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($){$!==yoe?(ve(r.CULL_FACE),$!==T&&($===CM?r.cullFace(r.BACK):$===Ek?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):ue(r.CULL_FACE),T=$}function F($){$!==C&&(P&&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($){z.equals($)===!1&&(r.scissor($.x,$.y,$.z,$.w),z.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:F,setPolygonOffset:L,getScissorTest:ne,setScissorTest:le,activeTexture:me,bindTexture:he,compressedTexImage2D:et,texImage2D:Ke,scissor:Se,viewport:Ae,reset:nt}}function TOe(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 EOe(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 AOe(){var r=this,e=null,t=0,i=!1,n=!1,a=new Vo,o=new fl,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 Yk(r){console.log("THREE.WebGLRenderer",goe),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=Fk,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 ii,C=null,b=new ii,E=0,I=new Wt(0),R=0,A=e.width,P=e.height,U=1,B=new ii(0,0,A,P),z=!1,k=new ii(0,0,A,P),G=new OM,Y=new AOe,J=!1,Q=!1,V=new na,K=new jt,ae=new oe,ve=new jt,ue=new jt,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(D){console.error("THREE.WebGLRenderer: "+D)}var We=new EOe(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")&&(Vt.MaxIndex=4294967296);var _e=new TOe(q,We,r),xe=new wOe(q,We,ie),Le=new bOe,Ue=new MOe(q,We,xe,Le,_e,ie,this.info),Ne=new SOe(q,Le,this.info),Ve=new _Oe(this,_e),ct=new cOe;this.info.programs=Ve.programs;var F=new uOe(q,We,Ee),L=new lOe(q,We,Ee),ne=new Xy(-1,1,1,-1,0,1),le=new ra,me=new yn(new em(2,2),new vo({depthTest:!1,depthWrite:!1,fog:!1})),he=Wy.cube,et=new yn(new Qd(5,5,5),new Ea({uniforms:he.uniforms,vertexShader:he.vertexShader,fragmentShader:he.fragmentShader,side:Wh,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 Mse(this,se,Ne,_e);this.shadowMap=nt;var $=new nOe(this,g),it=new iOe(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(D){D!==void 0&&(U=D,this.setSize(k.z,k.w,!1))},this.getSize=function(){return{width:A,height:P}},this.setSize=function(D,W,ee){A=D,P=W,e.width=D*U,e.height=W*U,ee!==!1&&(e.style.width=D+"px",e.style.height=W+"px"),this.setViewport(0,0,D,W)},this.setViewport=function(D,W,ee,ge){xe.viewport(k.set(D,W,ee,ge))},this.setScissor=function(D,W,ee,ge){xe.scissor(B.set(D,W,ee,ge))},this.setScissorTest=function(D){xe.setScissorTest(z=D)},this.getClearColor=function(){return I},this.setClearColor=function(D,W){I.set(D),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(D){R=D,xe.buffers.color.setClear(I.r,I.g,I.b,R,s)},this.clear=function(D,W,ee){var ge=0;(D===void 0||D)&&(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(D,W,ee,ge){this.setRenderTarget(D),this.clear(W,ee,ge)},this.resetGLState=Ae,this.dispose=function(){h=[],p=-1,c=[],f=-1,e.removeEventListener("webglcontextlost",Xe,!1)};function Xe(D){D.preventDefault(),Ae(),Se(),Le.clear()}function Fe(D){var W=D.target;W.removeEventListener("dispose",Fe),we(W)}function we(D){Ie(D),Le.delete(D)}function Ie(D){var W=Le.get(D).program;D.program=void 0,W!==void 0&&Ve.releaseProgram(W)}this.renderBufferImmediate=function(D,W,ee){xe.initAttributes();var ge=Le.get(D);D.hasPositions&&!ge.position&&(ge.position=q.createBuffer()),D.hasNormals&&!ge.normal&&(ge.normal=q.createBuffer()),D.hasUvs&&!ge.uv&&(ge.uv=q.createBuffer()),D.hasColors&&!ge.color&&(ge.color=q.createBuffer());var ce=W.getAttributes();if(D.hasPositions&&(q.bindBuffer(q.ARRAY_BUFFER,ge.position),q.bufferData(q.ARRAY_BUFFER,D.positionArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.position),q.vertexAttribPointer(ce.position,3,q.FLOAT,!1,0,0)),D.hasNormals){if(q.bindBuffer(q.ARRAY_BUFFER,ge.normal),!ee.isMeshPhongMaterial&&!ee.isMeshStandardMaterial&&!ee.isMeshNormalMaterial&&ee.shading===Ck)for(var Oe=0,Ge=D.count*3;Oe<Ge;Oe+=9){var Re=D.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,D.normalArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.normal),q.vertexAttribPointer(ce.normal,3,q.FLOAT,!1,0,0)}D.hasUvs&&ee.map&&(q.bindBuffer(q.ARRAY_BUFFER,ge.uv),q.bufferData(q.ARRAY_BUFFER,D.uvArray,q.DYNAMIC_DRAW),xe.enableAttribute(ce.uv),q.vertexAttribPointer(ce.uv,2,q.FLOAT,!1,0,0)),D.hasColors&&ee.vertexColors!==_L&&(q.bindBuffer(q.ARRAY_BUFFER,ge.color),q.bufferData(q.ARRAY_BUFFER,D.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,D.count),D.count=0},this.renderBufferDirect=function(D,W,ee,ge,ce,Oe){$r(ge);var Ge=Ht(D,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,Tt=mt.length;at<Tt;at++){var je=mt[at];$e.push([je,at])}$e.sort(Je),$e.length>8&&($e.length=8);for(var vi=ee.morphAttributes,at=0,Tt=$e.length;at<Tt;at++){var je=$e[at];if(d[at]=je[0],je[0]!==0){var Lr=je[1];ge.morphTargets===!0&&vi.position&&ee.addAttribute("morphTarget"+at,vi.position[Lr]),ge.morphNormals===!0&&vi.normal&&ee.addAttribute("morphNormal"+at,vi.normal[Lr])}else ge.morphTargets===!0&&ee.removeAttribute("morphTarget"+at),ge.morphNormals===!0&&ee.removeAttribute("morphNormal"+at)}for(var at=$e.length,Ft=d.length;at<Ft;at++)d[at]=0;Ge.getUniforms().setValue(q,"morphTargetInfluences",d),Re=!0}var Lr=ee.index,Yi=ee.attributes.position,bt=1;ge.wireframe===!0&&(Lr=Ne.getWireframeAttribute(ee),bt=2);var wi;Lr!==null?(wi=L,wi.setIndex(Lr)):wi=F,Re&&(st(ge,Ge,ee),Lr!==null&&q.bindBuffer(q.ELEMENT_ARRAY_BUFFER,Ne.getAttributeBuffer(Lr)));var lr=0;Lr!==null?lr=Lr.count:Yi!==void 0&&(lr=Yi.count);var fn=ee.drawRange.start*bt,qu=ee.drawRange.count*bt,Qr=Oe!==null?Oe.start*bt:0,Zu=Oe!==null?Oe.count*bt:1/0,Qh=Math.max(fn,Qr),ep=Math.min(lr,fn+qu,Qr+Zu)-1,RL=Math.max(0,ep-Qh+1);if(RL!==0){if(ce.isMesh)if(ge.wireframe===!0)xe.setLineWidth(ge.wireframeLinewidth*Ke()),wi.setMode(q.LINES);else switch(ce.drawMode){case Hk:wi.setMode(q.TRIANGLES);break;case ase:wi.setMode(q.TRIANGLE_STRIP);break;case ose:wi.setMode(q.TRIANGLE_FAN);break}else if(ce.isLine){var LL=ge.linewidth;LL===void 0&&(LL=1),xe.setLineWidth(LL*Ke()),ce.isLineSegments?wi.setMode(q.LINES):wi.setMode(q.LINE_STRIP)}else ce.isPoints&&wi.setMode(q.POINTS);ee&&ee.isInstancedBufferGeometry?ee.maxInstancedCount>0&&wi.renderInstances(ee,Qh,RL):wi.render(Qh,RL)}};function st(D,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=D.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,Tt=$e.itemSize,je=Ne.getAttributeProperties($e),vi=je.__webglBuffer,Ft=je.type,Lr=je.bytesPerElement;if($e.isInterleavedBufferAttribute){var Yi=$e.data,bt=Yi.stride,wi=$e.offset;Yi&&Yi.isInstancedInterleavedBuffer?(xe.enableAttributeAndDivisor(mt,Yi.meshPerAttribute,ce),ee.maxInstancedCount===void 0&&(ee.maxInstancedCount=Yi.meshPerAttribute*Yi.count)):xe.enableAttribute(mt),q.bindBuffer(q.ARRAY_BUFFER,vi),q.vertexAttribPointer(mt,Tt,Ft,at,bt*Lr,(ge*bt+wi)*Lr)}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,vi),q.vertexAttribPointer(mt,Tt,Ft,at,0,ge*Tt*Lr)}else if(Re!==void 0){var lr=Re[pt];if(lr!==void 0)switch(lr.length){case 2:q.vertexAttrib2fv(mt,lr);break;case 3:q.vertexAttrib3fv(mt,lr);break;case 4:q.vertexAttrib4fv(mt,lr);break;default:q.vertexAttrib1fv(mt,lr)}}}}xe.disableUnusedAttributes()}function Je(D,W){return Math.abs(W[0])-Math.abs(D[0])}function Gt(D,W){return D.object.renderOrder!==W.object.renderOrder?D.object.renderOrder-W.object.renderOrder:D.material.program&&W.material.program&&D.material.program!==W.material.program?D.material.program.id-W.material.program.id:D.material.id!==W.material.id?D.material.id-W.material.id:D.z!==W.z?D.z-W.z:D.id-W.id}function X(D,W){return D.object.renderOrder!==W.object.renderOrder?D.object.renderOrder-W.object.renderOrder:D.z!==W.z?W.z-D.z:D.id-W.id}this.render=function(D,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,D.autoUpdate===!0&&D.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),St(D,W),c.length=f+1,h.length=p+1,v.sortObjects===!0&&(c.sort(Gt),h.sort(X)),J&&Y.beginShadows(),O(u),nt.render(D,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=D.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)),D.overrideMaterial){var Oe=D.overrideMaterial;kt(c,D,W,Oe),kt(h,D,W,Oe)}else xe.setBlending(RM),kt(c,D,W),kt(h,D,W);$.render(D,W),it.render(D,W,b),ee&&Ue.updateRenderTargetMipmap(ee),xe.setDepthTest(!0),xe.setDepthWrite(!0),xe.setColorWrite(!0)};function Te(D,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=D.id,Re.object=D,Re.geometry=W,Re.material=ee,Re.z=ae.z,Re.group=ce):(Re={id:D.id,object:D,geometry:W,material:ee,z:ae.z,group:ce},Oe.push(Re))}function te(D){var W=D.geometry;return W.boundingSphere===null&&W.computeBoundingSphere(),V.copy(W.boundingSphere).applyMatrix4(D.matrixWorld),De(V)}function Me(D){return V.center.set(0,0,0),V.radius=.7071067811865476,V.applyMatrix4(D.matrixWorld),De(V)}function De(D){if(!G.intersectsSphere(D))return!1;var W=Y.numPlanes;if(W===0)return!0;var ee=v.clippingPlanes,ge=D.center,ce=-D.radius,Oe=0;do if(ee[Oe].distanceToPoint(ge)<ce)return!1;while(++Oe!==W);return!0}function St(D,W){if(D.visible!==!1){var ee=(D.layers.mask&W.layers.mask)!==0;if(ee){if(D.isLight)u.push(D);else if(D.isSprite)(D.frustumCulled===!1||Me(D)===!0)&&g.push(D);else if(D.isLensFlare)m.push(D);else if(D.isImmediateRenderObject)v.sortObjects===!0&&(ae.setFromMatrixPosition(D.matrixWorld),ae.applyProjection(K)),Te(D,null,D.material,ae.z,null);else if((D.isMesh||D.isLine||D.isPoints)&&(D.isSkinnedMesh&&D.skeleton.update(),D.frustumCulled===!1||te(D)===!0)){var ge=D.material;if(ge.visible===!0){v.sortObjects===!0&&(ae.setFromMatrixPosition(D.matrixWorld),ae.applyProjection(K));var ce=Ne.update(D);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(D,ce,$e,ae.z,mt)}else Te(D,ce,ge,ae.z,null)}}}for(var at=D.children,Re=0,pt=at.length;Re<pt;Re++)St(at[Re],W)}}function kt(D,W,ee,ge){for(var ce=0,Oe=D.length;ce<Oe;ce++){var Ge=D[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){$r(mt);var at=Ht(ee,W.fog,mt,Re);S="",Re.render(function(Tt){v.renderBufferImmediate(Tt,at,mt)})}else v.renderBufferDirect(ee,W.fog,pt,mt,Re,$e);Re.onAfterRender(v,W,ee,pt,mt,$e)}}function br(D,W,ee){var ge=Le.get(D),ce=Ve.getParameters(D,se,W,Y.numPlanes,Y.numIntersection,ee),Oe=Ve.getProgramCode(D,ce),Ge=ge.program,Re=!0;if(Ge===void 0)D.addEventListener("dispose",Fe);else if(Ge.code!==Oe)Ie(D);else{if(ce.shaderID!==void 0)return;Re=!1}if(Re){if(ce.shaderID){var pt=Wy[ce.shaderID];ge.__webglShader={name:D.type,uniforms:ho.clone(pt.uniforms),vertexShader:pt.vertexShader,fragmentShader:pt.fragmentShader}}else ge.__webglShader={name:D.type,uniforms:D.uniforms,vertexShader:D.vertexShader,fragmentShader:D.fragmentShader};D.__webglShader=ge.__webglShader,Ge=Ve.acquireProgram(D,ce,Oe),ge.program=Ge,D.program=Ge}var mt=Ge.getAttributes();if(D.morphTargets){D.numSupportedMorphTargets=0;for(var $e=0;$e<v.maxMorphTargets;$e++)mt["morphTarget"+$e]>=0&&D.numSupportedMorphTargets++}if(D.morphNormals){D.numSupportedMorphNormals=0;for(var $e=0;$e<v.maxMorphNormals;$e++)mt["morphNormal"+$e]>=0&&D.numSupportedMorphNormals++}var at=ge.__webglShader.uniforms;(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(ge.numClippingPlanes=Y.numPlanes,ge.numIntersection=Y.numIntersection,at.clippingPlanes=Y.uniform),ge.fog=W,ge.lightsHash=se.hash,D.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 Tt=ge.program.getUniforms(),je=Yh.seqWithValue(Tt.seq,at);ge.uniformsList=je}function $r(D){D.side===T0?xe.disable(q.CULL_FACE):xe.enable(q.CULL_FACE),xe.setFlipSided(D.side===Wh),D.transparent===!0?xe.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha):xe.setBlending(RM),xe.setDepthFunc(D.depthFunc),xe.setDepthTest(D.depthTest),xe.setDepthWrite(D.depthWrite),xe.setColorWrite(D.colorWrite),xe.setPolygonOffset(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits)}function Ht(D,W,ee,ge){E=0;var ce=Le.get(ee);if(J&&(Q||D!==w)){var Oe=D===w&&ee.id===M;Y.setState(ee.clippingPlanes,ee.clipIntersection,ee.clipShadows,D,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&&(br(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||D!==w){if($e.set(q,D,"projectionMatrix"),_e.logarithmicDepthBuffer&&$e.setValue(q,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),D!==w&&(w=D,Re=!0,pt=!0),ee.isShaderMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.envMap){var Tt=$e.map.cameraPosition;Tt!==void 0&&Tt.setValue(q,ae.setFromMatrixPosition(D.matrixWorld))}(ee.isMeshPhongMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial||ee.skinning)&&$e.setValue(q,"viewMatrix",D.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&&P0(at,pt),W&&ee.fog&&dl(at,W),(ee.isMeshBasicMaterial||ee.isMeshLambertMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.isMeshNormalMaterial||ee.isMeshDepthMaterial)&&Nr(at,ee),ee.isLineBasicMaterial?ci(at,ee):ee.isLineDashedMaterial?(ci(at,ee),Kh(at,ee)):ee.isPointsMaterial?R0(at,ee):ee.isMeshLambertMaterial?Jh(at,ee):ee.isMeshToonMaterial?$h(at,ee):ee.isMeshPhongMaterial?qo(at,ee):ee.isMeshPhysicalMaterial?L0(at,ee):ee.isMeshStandardMaterial?nf(at,ee):ee.isMeshDepthMaterial?ee.displacementMap&&(at.displacementMap.value=ee.displacementMap,at.displacementScale.value=ee.displacementScale,at.displacementBias.value=ee.displacementBias):ee.isMeshNormalMaterial&&D0(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),Yh.upload(q,ce.uniformsList,at,v)),$e.set(q,ge,"modelViewMatrix"),$e.set(q,ge,"normalMatrix"),$e.setValue(q,"modelMatrix",ge.matrixWorld),mt}function Nr(D,W){D.opacity.value=W.opacity,D.diffuse.value=W.color,W.emissive&&D.emissive.value.copy(W.emissive).multiplyScalar(W.emissiveIntensity),D.map.value=W.map,D.specularMap.value=W.specularMap,D.alphaMap.value=W.alphaMap,W.lightMap&&(D.lightMap.value=W.lightMap,D.lightMapIntensity.value=W.lightMapIntensity),W.aoMap&&(D.aoMap.value=W.aoMap,D.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;D.offsetRepeat.value.set(ge.x,ge.y,ce.x,ce.y)}D.envMap.value=W.envMap,D.flipEnvMap.value=W.envMap&&W.envMap.isCubeTexture?-1:1,D.reflectivity.value=W.reflectivity,D.refractionRatio.value=W.refractionRatio}function ci(D,W){D.diffuse.value=W.color,D.opacity.value=W.opacity}function Kh(D,W){D.dashSize.value=W.dashSize,D.totalSize.value=W.dashSize+W.gapSize,D.scale.value=W.scale}function R0(D,W){if(D.diffuse.value=W.color,D.opacity.value=W.opacity,D.size.value=W.size*U,D.scale.value=P*.5,D.map.value=W.map,W.map!==null){var ee=W.map.offset,ge=W.map.repeat;D.offsetRepeat.value.set(ee.x,ee.y,ge.x,ge.y)}}function dl(D,W){D.fogColor.value=W.color,W.isFog?(D.fogNear.value=W.near,D.fogFar.value=W.far):W.isFogExp2&&(D.fogDensity.value=W.density)}function Jh(D,W){W.emissiveMap&&(D.emissiveMap.value=W.emissiveMap)}function qo(D,W){D.specular.value=W.specular,D.shininess.value=Math.max(W.shininess,1e-4),W.emissiveMap&&(D.emissiveMap.value=W.emissiveMap),W.bumpMap&&(D.bumpMap.value=W.bumpMap,D.bumpScale.value=W.bumpScale),W.normalMap&&(D.normalMap.value=W.normalMap,D.normalScale.value.copy(W.normalScale)),W.displacementMap&&(D.displacementMap.value=W.displacementMap,D.displacementScale.value=W.displacementScale,D.displacementBias.value=W.displacementBias)}function $h(D,W){qo(D,W),W.gradientMap&&(D.gradientMap.value=W.gradientMap)}function nf(D,W){D.roughness.value=W.roughness,D.metalness.value=W.metalness,W.roughnessMap&&(D.roughnessMap.value=W.roughnessMap),W.metalnessMap&&(D.metalnessMap.value=W.metalnessMap),W.emissiveMap&&(D.emissiveMap.value=W.emissiveMap),W.bumpMap&&(D.bumpMap.value=W.bumpMap,D.bumpScale.value=W.bumpScale),W.normalMap&&(D.normalMap.value=W.normalMap,D.normalScale.value.copy(W.normalScale)),W.displacementMap&&(D.displacementMap.value=W.displacementMap,D.displacementScale.value=W.displacementScale,D.displacementBias.value=W.displacementBias),W.envMap&&(D.envMapIntensity.value=W.envMapIntensity)}function L0(D,W){D.clearCoat.value=W.clearCoat,D.clearCoatRoughness.value=W.clearCoatRoughness,nf(D,W)}function D0(D,W){W.bumpMap&&(D.bumpMap.value=W.bumpMap,D.bumpScale.value=W.bumpScale),W.normalMap&&(D.normalMap.value=W.normalMap,D.normalScale.value.copy(W.normalScale)),W.displacementMap&&(D.displacementMap.value=W.displacementMap,D.displacementScale.value=W.displacementScale,D.displacementBias.value=W.displacementBias)}function P0(D,W){D.ambientLightColor.needsUpdate=W,D.directionalLights.needsUpdate=W,D.pointLights.needsUpdate=W,D.spotLights.needsUpdate=W,D.rectAreaLights.needsUpdate=W,D.hemisphereLights.needsUpdate=W}function O(D){for(var W=0,ee=0,ge=D.length;ee<ge;ee++){var ce=D[ee];ce.castShadow&&(se.shadows[W++]=ce)}se.shadows.length=W}function j(D,W){var ee,ge,ce,Oe=0,Ge=0,Re=0,pt,mt,$e,at,Tt=W.matrixWorldInverse,je=0,vi=0,Ft=0,Lr=0,Yi=0;for(ee=0,ge=D.length;ee<ge;ee++)if(ce=D[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 bt=ct.get(ce);bt.color.copy(ce.color).multiplyScalar(ce.intensity),bt.direction.setFromMatrixPosition(ce.matrixWorld),ae.setFromMatrixPosition(ce.target.matrixWorld),bt.direction.sub(ae),bt.direction.transformDirection(Tt),bt.shadow=ce.castShadow,ce.castShadow&&(bt.shadowBias=ce.shadow.bias,bt.shadowRadius=ce.shadow.radius,bt.shadowMapSize=ce.shadow.mapSize),se.directionalShadowMap[je]=at,se.directionalShadowMatrix[je]=ce.shadow.matrix,se.directional[je++]=bt}else if(ce.isSpotLight){var bt=ct.get(ce);bt.position.setFromMatrixPosition(ce.matrixWorld),bt.position.applyMatrix4(Tt),bt.color.copy(pt).multiplyScalar(mt),bt.distance=$e,bt.direction.setFromMatrixPosition(ce.matrixWorld),ae.setFromMatrixPosition(ce.target.matrixWorld),bt.direction.sub(ae),bt.direction.transformDirection(Tt),bt.coneCos=Math.cos(ce.angle),bt.penumbraCos=Math.cos(ce.angle*(1-ce.penumbra)),bt.decay=ce.distance===0?0:ce.decay,bt.shadow=ce.castShadow,ce.castShadow&&(bt.shadowBias=ce.shadow.bias,bt.shadowRadius=ce.shadow.radius,bt.shadowMapSize=ce.shadow.mapSize),se.spotShadowMap[Ft]=at,se.spotShadowMatrix[Ft]=ce.shadow.matrix,se.spot[Ft++]=bt}else if(ce.isRectAreaLight){var bt=ct.get(ce);bt.color.copy(pt).multiplyScalar(mt/(ce.width*ce.height)),bt.position.setFromMatrixPosition(ce.matrixWorld),bt.position.applyMatrix4(Tt),ue.identity(),ve.copy(ce.matrixWorld),ve.premultiply(Tt),ue.extractRotation(ve),bt.halfWidth.set(ce.width*.5,0,0),bt.halfHeight.set(0,ce.height*.5,0),bt.halfWidth.applyMatrix4(ue),bt.halfHeight.applyMatrix4(ue),se.rectArea[Lr++]=bt}else if(ce.isPointLight){var bt=ct.get(ce);bt.position.setFromMatrixPosition(ce.matrixWorld),bt.position.applyMatrix4(Tt),bt.color.copy(ce.color).multiplyScalar(ce.intensity),bt.distance=ce.distance,bt.decay=ce.distance===0?0:ce.decay,bt.shadow=ce.castShadow,ce.castShadow&&(bt.shadowBias=ce.shadow.bias,bt.shadowRadius=ce.shadow.radius,bt.shadowMapSize=ce.shadow.mapSize),se.pointShadowMap[vi]=at,se.pointShadowMatrix[vi]===void 0&&(se.pointShadowMatrix[vi]=new jt),ae.setFromMatrixPosition(ce.matrixWorld).negate(),se.pointShadowMatrix[vi].identity().setPosition(ae),se.point[vi++]=bt}else if(ce.isHemisphereLight){var bt=ct.get(ce);bt.direction.setFromMatrixPosition(ce.matrixWorld),bt.direction.transformDirection(Tt),bt.direction.normalize(),bt.skyColor.copy(ce.color).multiplyScalar(mt),bt.groundColor.copy(ce.groundColor).multiplyScalar(mt),se.hemi[Yi++]=bt}se.ambient[0]=Oe,se.ambient[1]=Ge,se.ambient[2]=Re,se.directional.length=je,se.spot.length=Ft,se.rectArea.length=Lr,se.point.length=vi,se.hemi.length=Yi,se.hash=je+","+vi+","+Ft+","+Lr+","+Yi+","+se.shadows.length}this.setFaceCulling=function(D,W){xe.setCullFace(D),xe.setFlipSided(W===_oe)};function re(){var D=E;return D>=_e.maxTextures&&console.warn("WebGLRenderer: trying to use "+D+" texture units while this GPU supports only "+_e.maxTextures),E+=1,D}this.allocTextureUnit=re,this.setTexture2D=function(){var D=!1;return function(ee,ge){ee&&ee.isWebGLRenderTarget&&(D||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),D=!0),ee=ee.texture),Ue.setTexture2D(ee,ge)}}(),this.setTexture=function(){var D=!1;return function(ee,ge){D||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),D=!0),Ue.setTexture2D(ee,ge)}}(),this.setTextureCube=function(){var D=!1;return function(ee,ge){ee&&ee.isWebGLRenderTargetCube&&(D||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),D=!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(D){y=D,D&&Le.get(D).__webglFramebuffer===void 0&&Ue.setupRenderTarget(D);var W=D&&D.isWebGLRenderTargetCube,ee;if(D){var ge=Le.get(D);W?ee=ge.__webglFramebuffer[D.activeCubeFace]:ee=ge.__webglFramebuffer,T.copy(D.scissor),C=D.scissorTest,b.copy(D.viewport)}else ee=null,T.copy(B).multiplyScalar(U),C=z,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(D.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+D.activeCubeFace,ce.__webglTexture,D.activeMipMapLevel)}},this.readRenderTargetPixels=function(D,W,ee,ge,ce,Oe){if((D&&D.isWebGLRenderTarget)===!1){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}var Ge=Le.get(D).__webglFramebuffer;if(Ge){var Re=!1;Ge!==x&&(q.bindFramebuffer(q.FRAMEBUFFER,Ge),Re=!0);try{var pt=D.texture,mt=pt.format,$e=pt.type;if(mt!==Hu&&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!==YR&&ie($e)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_TYPE)&&!($e===ky&&(We.get("OES_texture_float")||We.get("WEBGL_color_buffer_float")))&&!($e===qR&&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<=D.width-ge&&ee>=0&&ee<=D.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(D){var W;if(D===Kc)return q.REPEAT;if(D===Ho)return q.CLAMP_TO_EDGE;if(D===Kd)return q.MIRRORED_REPEAT;if(D===Wo)return q.NEAREST;if(D===wL)return q.NEAREST_MIPMAP_NEAREST;if(D===TL)return q.NEAREST_MIPMAP_LINEAR;if(D===po)return q.LINEAR;if(D===Vk)return q.LINEAR_MIPMAP_NEAREST;if(D===Sb)return q.LINEAR_MIPMAP_LINEAR;if(D===YR)return q.UNSIGNED_BYTE;if(D===joe)return q.UNSIGNED_SHORT_4_4_4_4;if(D===Koe)return q.UNSIGNED_SHORT_5_5_5_1;if(D===Joe)return q.UNSIGNED_SHORT_5_6_5;if(D===Yoe)return q.BYTE;if(D===qoe)return q.SHORT;if(D===LM)return q.UNSIGNED_SHORT;if(D===Zoe)return q.INT;if(D===Gk)return q.UNSIGNED_INT;if(D===ky)return q.FLOAT;if(D===qR&&(W=We.get("OES_texture_half_float"),W!==null))return W.HALF_FLOAT_OES;if(D===$oe)return q.ALPHA;if(D===Vy)return q.RGB;if(D===Hu)return q.RGBA;if(D===Qoe)return q.LUMINANCE;if(D===ese)return q.LUMINANCE_ALPHA;if(D===Yd)return q.DEPTH_COMPONENT;if(D===Gy)return q.DEPTH_STENCIL;if(D===Uk)return q.FUNC_ADD;if(D===Moe)return q.FUNC_SUBTRACT;if(D===boe)return q.FUNC_REVERSE_SUBTRACT;if(D===woe)return q.ZERO;if(D===Toe)return q.ONE;if(D===Eoe)return q.SRC_COLOR;if(D===Aoe)return q.ONE_MINUS_SRC_COLOR;if(D===Ok)return q.SRC_ALPHA;if(D===zk)return q.ONE_MINUS_SRC_ALPHA;if(D===Coe)return q.DST_ALPHA;if(D===Roe)return q.ONE_MINUS_DST_ALPHA;if(D===Loe)return q.DST_COLOR;if(D===Doe)return q.ONE_MINUS_DST_COLOR;if(D===Poe)return q.SRC_ALPHA_SATURATE;if((D===nk||D===ak||D===ok||D===sk)&&(W=We.get("WEBGL_compressed_texture_s3tc"),W!==null)){if(D===nk)return W.COMPRESSED_RGB_S3TC_DXT1_EXT;if(D===ak)return W.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(D===ok)return W.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(D===sk)return W.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((D===lk||D===uk||D===ck||D===fk)&&(W=We.get("WEBGL_compressed_texture_pvrtc"),W!==null)){if(D===lk)return W.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(D===uk)return W.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(D===ck)return W.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(D===fk)return W.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(D===tse&&(W=We.get("WEBGL_compressed_texture_etc1"),W!==null))return W.COMPRESSED_RGB_ETC1_WEBGL;if((D===ek||D===tk)&&(W=We.get("EXT_blend_minmax"),W!==null)){if(D===ek)return W.MIN_EXT;if(D===tk)return W.MAX_EXT}return D===DM&&(W=We.get("WEBGL_depth_texture"),W!==null)?W.UNSIGNED_INT_24_8_WEBGL:0}}function Yy(r,e){this.name="",this.color=new Wt(r),this.density=e!==void 0?e:25e-5}function qy(r,e,t){this.name="",this.color=new Wt(r),this.near=e!==void 0?e:1,this.far=t!==void 0?t:1e3}function tm(){At.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function pk(r,e,t,i,n){At.call(this),this.lensFlares=[],this.positionScreen=new oe,this.customUpdateCallback=void 0,r!==void 0&&this.add(r,e,t,i,n)}function rm(r){gr.call(this),this.type="SpriteMaterial",this.color=new Wt(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(r)}function HM(r){At.call(this),this.type="Sprite",this.material=r!==void 0?r:new rm}function WM(){At.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function jR(r,e,t){if(this.useVertexTexture=t!==void 0?t:!0,this.identityMatrix=new jt,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 $d(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Hu,ky)}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 jt)}}function KR(){At.call(this),this.type="Bone"}function JR(r,e,t){yn.call(this,r,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new jt,this.bindMatrixInverse=new jt;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 KR,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 jR(i,void 0,t),this.matrixWorld)}function Fi(r){gr.call(this),this.type="LineBasicMaterial",this.color=new Wt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(r)}function Qc(r,e,t){if(t===1)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new mi(r,e);At.call(this),this.type="Line",this.geometry=r!==void 0?r:new Vt,this.material=e!==void 0?e:new Fi({color:Math.random()*16777215})}function mi(r,e){Qc.call(this,r,e),this.type="LineSegments"}function eu(r){gr.call(this),this.type="PointsMaterial",this.color=new Wt(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(r)}function Zy(r,e){At.call(this),this.type="Points",this.geometry=r!==void 0?r:new Vt,this.material=e!==void 0?e:new eu({color:Math.random()*16777215})}function XM(){At.call(this),this.type="Group"}function $R(r,e,t,i,n,a,o,s,l){ui.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 jy(r,e,t,i,n,a,o,s,l,u,c,f){ui.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 QR(r,e,t,i,n,a,o,s,l){ui.call(this,r,e,t,i,n,a,o,s,l),this.needsUpdate=!0}function YM(r,e,t,i,n,a,o,s,l,u){if(u=u!==void 0?u:Yd,u!==Yd&&u!==Gy)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");t===void 0&&u===Yd&&(t=LM),t===void 0&&u===Gy&&(t=DM),ui.call(this,null,i,n,a,o,s,u,t,l),this.image={width:r,height:e},this.magFilter=o!==void 0?o:Wo,this.minFilter=s!==void 0?s:Wo,this.flipY=!1,this.generateMipmaps=!1}function Ky(r){Vt.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 yt(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 yt(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 yt(d,3))}}function Jy(r,e,t){Vt.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?$c:Jc)(f,1)),this.addAttribute("position",new xr(i,3)),this.addAttribute("uv",new xr(n,2)),this.computeVertexNormals()}function qM(r,e,t){sr.call(this),this.type="ParametricGeometry",this.parameters={func:r,slices:e,stacks:t},this.fromBufferGeometry(new Jy(r,e,t)),this.mergeVertices()}function go(r,e,t,i){Vt.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 xr(n,3)),this.addAttribute("normal",new xr(n.slice(),3)),this.addAttribute("uv",new xr(a,2)),this.normalizeNormals(),this.boundingSphere=new na(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 Mt,S=new Mt,w=new Mt,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 $y(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];go.call(this,t,i,r,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:r,detail:e}}function ZM(r,e){sr.call(this),this.type="TetrahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new $y(r,e)),this.mergeVertices()}function im(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];go.call(this,t,i,r,e),this.type="OctahedronBufferGeometry",this.parameters={radius:r,detail:e}}function jM(r,e){sr.call(this),this.type="OctahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new im(r,e)),this.mergeVertices()}function Qy(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];go.call(this,i,n,r,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:r,detail:e}}function KM(r,e){sr.call(this),this.type="IcosahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new Qy(r,e)),this.mergeVertices()}function e0(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];go.call(this,n,a,r,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:r,detail:e}}function JM(r,e){sr.call(this),this.type="DodecahedronGeometry",this.parameters={radius:r,detail:e},this.fromBufferGeometry(new e0(r,e)),this.mergeVertices()}function $M(r,e,t,i){sr.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:r,indices:e,radius:t,detail:i},this.fromBufferGeometry(new go(r,e,t,i)),this.mergeVertices()}function t0(r,e,t,i,n){Vt.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 Mt,u,c,f=[],h=[],p=[],d=[];g(),this.setIndex(new(d.length>65535?$c:Jc)(d,1)),this.addAttribute("position",new xr(f,3)),this.addAttribute("normal",new xr(h,3)),this.addAttribute("uv",new xr(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 QM(r,e,t,i,n,a){sr.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 t0(r,e,t,i,n);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function r0(r,e,t,i,n,a){Vt.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 yt(new(s>65535?Uint32Array:Uint16Array)(s),1),u=new yt(new Float32Array(o*3),3),c=new yt(new Float32Array(o*3),3),f=new yt(new Float32Array(o*2),2),h,p,d=0,g=0,m=new oe,v=new oe,_=new Mt,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,P=(i+1)*(p-1)+h;l.setX(g,I),g++,l.setX(g,R),g++,l.setX(g,P),g++,l.setX(g,R),g++,l.setX(g,A),g++,l.setX(g,P),g++}this.setIndex(l),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",f);function U(B,z,k,G,Y){var J=Math.cos(B),Q=Math.sin(B),V=k/z*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 eb(r,e,t,i,n,a,o){sr.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 r0(r,e,t,i,n,a)),this.mergeVertices()}function i0(r,e,t,i,n){Vt.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 yt(s,1)),this.addAttribute("position",new yt(l,3)),this.addAttribute("normal",new yt(u,3)),this.addAttribute("uv",new yt(c,2))}function tb(r,e,t,i,n){sr.call(this),this.type="TorusGeometry",this.parameters={radius:r,tube:e,radialSegments:t,tubularSegments:i,arc:n},this.fromBufferGeometry(new i0(r,e,t,i,n))}function hl(r,e){if(typeof r>"u"){r=[];return}sr.call(this),this.type="ExtrudeGeometry",r=Array.isArray(r)?r:[r],this.addShapeList(r,e),this.computeFaceNormals()}function rb(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 sr;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),hl.call(this,i,e),this.type="TextGeometry"}function nm(r,e,t,i,n,a,o){Vt.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 yt(new Float32Array(l*3),3),c=new yt(new Float32Array(l*3),3),f=new yt(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?$c:Jc)(w,1)),this.addAttribute("position",u),this.addAttribute("normal",c),this.addAttribute("uv",f),this.boundingSphere=new na(new oe,r)}function ib(r,e,t,i,n,a,o){sr.call(this),this.type="SphereGeometry",this.parameters={radius:r,widthSegments:e,heightSegments:t,phiStart:i,phiLength:n,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new nm(r,e,t,i,n,a,o))}function n0(r,e,t,i,n,a){Vt.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 yt(new(s>65535?Uint32Array:Uint16Array)(s),1),u=new yt(new Float32Array(o*3),3),c=new yt(new Float32Array(o*3),3),f=new yt(new Float32Array(o*2),2),h=0,p=0,d,g=r,m=(e-r)/i,v=new oe,_=new Mt,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 nb(r,e,t,i,n,a){sr.call(this),this.type="RingGeometry",this.parameters={innerRadius:r,outerRadius:e,thetaSegments:t,phiSegments:i,thetaStart:n,thetaLength:a},this.fromBufferGeometry(new n0(r,e,t,i,n,a))}function ab(r,e,t,i){sr.call(this),this.type="PlaneGeometry",this.parameters={width:r,height:e,widthSegments:t,heightSegments:i},this.fromBufferGeometry(new em(r,e,t,i))}function a0(r,e,t,i){Vt.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 yt(new(a>65535?Uint32Array:Uint16Array)(a),1),s=new yt(new Float32Array(n*3),3),l=new yt(new Float32Array(n*2),2),u=0,c=0,f,h=1/e,p=new oe,d=new Mt,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 ob(r,e,t,i){sr.call(this),this.type="LatheGeometry",this.parameters={points:r,segments:e,phiStart:t,phiLength:i},this.fromBufferGeometry(new a0(r,e,t,i)),this.mergeVertices()}function o0(r,e){Vt.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?$c:Jc)(a,1)),this.addAttribute("position",new xr(t,3)),this.addAttribute("normal",new xr(i,3)),this.addAttribute("uv",new xr(n,2));function u(c){var f,h,p,d=t.length/3,g=c.extractPoints(e),m=g.shape,v=g.holes;if(Fn.isClockWise(m)===!1)for(m=m.reverse(),f=0,h=v.length;f<h;f++)p=v[f],Fn.isClockWise(p)===!0&&(v[f]=p.reverse());var _=Fn.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 s0(r,e){sr.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 o0(r,e)),this.mergeVertices()}function l0(r,e){Vt.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 sr,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 xr(g,3))}function ef(r,e,t,i,n,a,o,s){Vt.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 yt(new(f>65535?Uint32Array:Uint16Array)(f),1),p=new yt(new Float32Array(c*3),3),d=new yt(new Float32Array(c*3),3),g=new yt(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 P=[],U=b/n,B=U*(e-r)+r;for(C=0;C<=i;C++){var z=C/i,k=z*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,z,1-U),P.push(m),m++}_.push(P)}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 Mt,A=new oe,P=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 z=b/i,k=z*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++),P+=3}l.addGroup(x,P,C===!0?1:2),x+=P}}function am(r,e,t,i,n,a,o,s){sr.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 ef(r,e,t,i,n,a,o,s)),this.mergeVertices()}function sb(r,e,t,i,n,a,o){am.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 lb(r,e,t,i,n,a,o){ef.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 u0(r,e,t,i){Vt.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 yt(new Uint16Array(h),1)),this.addAttribute("position",new yt(a,3)),this.addAttribute("normal",new yt(o,3)),this.addAttribute("uv",new yt(s,2)),this.boundingSphere=new na(new oe,r)}function ub(r,e,t,i){sr.call(this),this.type="CircleGeometry",this.parameters={radius:r,segments:e,thetaStart:t,thetaLength:i},this.fromBufferGeometry(new u0(r,e,t,i))}function cb(r,e,t,i,n,a){sr.call(this),this.type="BoxGeometry",this.parameters={width:r,height:e,depth:t,widthSegments:i,heightSegments:n,depthSegments:a},this.fromBufferGeometry(new Qd(r,e,t,i,n,a)),this.mergeVertices()}function c0(){Ea.call(this,{uniforms:ho.merge([hr.lights,{opacity:{value:1}}]),vertexShader:jr.shadow_vert,fragmentShader:jr.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 f0(r){Ea.call(this,r),this.type="RawShaderMaterial"}function fb(r){this.uuid=cr.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(r)?r:[],this.visible=!0}function Xu(r){gr.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Wt(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 Wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Mt(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 om(r){Xu.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(r)}function tu(r){gr.call(this),this.type="MeshPhongMaterial",this.color=new Wt(16777215),this.specular=new Wt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Mt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=xb,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 sm(r){tu.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(r)}function lm(r){gr.call(this,r),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new Mt(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 um(r){gr.call(this),this.type="MeshLambertMaterial",this.color=new Wt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=xb,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 cm(r){gr.call(this),this.type="LineDashedMaterial",this.color=new Wt(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(r)}function qk(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 pl(r){this.manager=r!==void 0?r:Yo}function Tse(r){this.manager=r!==void 0?r:Yo,this._parser=null}function Zk(r){this.manager=r!==void 0?r:Yo,this._parser=null}function Mb(r){this.manager=r!==void 0?r:Yo}function jk(r){this.manager=r!==void 0?r:Yo}function EL(r){this.manager=r!==void 0?r:Yo}function Bi(r,e){At.call(this),this.type="Light",this.color=new Wt(r),this.intensity=e!==void 0?e:1,this.receiveShadow=void 0}function eL(r,e,t){Bi.call(this,r,t),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(At.DefaultUp),this.updateMatrix(),this.groundColor=new Wt(e)}function ym(r){this.camera=r,this.bias=0,this.radius=1,this.mapSize=new Mt(512,512),this.map=null,this.matrix=new jt}function tL(){ym.call(this,new ra(50,1,.5,500))}function rL(r,e,t,i,n,a){Bi.call(this,r,e),this.type="SpotLight",this.position.copy(At.DefaultUp),this.updateMatrix(),this.target=new At,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 tL}function iL(r,e,t,i){Bi.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 ym(new ra(90,1,.5,500))}function nL(r){ym.call(this,new Xy(-5,5,5,-5,.5,500))}function aL(r,e){Bi.call(this,r,e),this.type="DirectionalLight",this.position.copy(At.DefaultUp),this.updateMatrix(),this.target=new At,this.shadow=new nL}function oL(r,e){Bi.call(this,r,e),this.type="AmbientLight",this.castShadow=void 0}function mo(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 sL(r,e,t,i){mo.call(this,r,e,t,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function hb(r,e,t,i){mo.call(this,r,e,t,i)}function lL(r,e,t,i){mo.call(this,r,e,t,i)}function _m(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=ia.convertArray(e,this.TimeBufferType),this.values=ia.convertArray(t,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function h0(r,e,t,i){_m.call(this,r,e,t,i)}function uL(r,e,t,i){mo.call(this,r,e,t,i)}function pb(r,e,t,i){_m.call(this,r,e,t,i)}function p0(r,e,t,i){_m.call(this,r,e,t,i)}function cL(r,e,t,i){_m.call(this,r,e,t,i)}function fL(r,e,t){_m.call(this,r,e,t)}function hL(r,e,t,i){_m.call(this,r,e,t,i)}function fm(r,e,t,i){_m.apply(this,arguments)}function Go(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 AL(r){this.manager=r!==void 0?r:Yo,this.textures={}}function Kk(r){this.manager=r!==void 0?r:Yo}function Zd(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function Jk(r){typeof r=="boolean"&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),r=void 0),this.manager=r!==void 0?r:Yo,this.withCredentials=!1}function Ese(r){this.manager=r!==void 0?r:Yo,this.texturePath=""}function oa(){}function Yu(r,e){this.v1=r,this.v2=e}function db(){this.curves=[],this.autoClose=!1}function tf(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 hm(r){this.points=r===void 0?[]:r}function pm(r,e,t,i){this.v0=r,this.v1=e,this.v2=t,this.v3=i}function dm(r,e,t){this.v0=r,this.v1=e,this.v2=t}function jd(){wb.apply(this,arguments),this.holes=[]}function wb(r){db.call(this),this.currentPoint=new Mt,r&&this.fromPoints(r)}function Qk(){this.subPaths=[],this.currentPath=null}function eV(r){this.data=r}function Ase(r){this.manager=r!==void 0?r:Yo}function rV(r){this.manager=r!==void 0?r:Yo}function mk(r,e,t,i){Bi.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 Cse(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ra,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ra,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function pL(r,e,t){At.call(this),this.type="CubeCamera";var i=90,n=1,a=new ra(i,n,r,e);a.up.set(0,-1,0),a.lookAt(new oe(1,0,0)),this.add(a);var o=new ra(i,n,r,e);o.up.set(0,-1,0),o.lookAt(new oe(-1,0,0)),this.add(o);var s=new ra(i,n,r,e);s.up.set(0,0,1),s.lookAt(new oe(0,1,0)),this.add(s);var l=new ra(i,n,r,e);l.up.set(0,0,-1),l.lookAt(new oe(0,-1,0)),this.add(l);var u=new ra(i,n,r,e);u.up.set(0,-1,0),u.lookAt(new oe(0,0,1)),this.add(u);var c=new ra(i,n,r,e);c.up.set(0,-1,0),c.lookAt(new oe(0,0,-1)),this.add(c);var f={format:Vy,magFilter:po,minFilter:po};this.renderTarget=new Hy(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 vk(){At.call(this),this.type="AudioListener",this.context=tV.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function d0(r){At.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 gk(r){d0.call(this,r),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function iV(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 dL(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 Di(r,e,t){this.path=e,this.parsedPath=t||Di.parseTrackName(e),this.node=Di.findNode(r,this.parsedPath.nodeName)||r,this.rootNode=r}function yk(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 _k(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:Jd,endingEnd:Jd},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=ise,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 nV(r){this._root=r,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function mL(r){typeof r=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),r=arguments[1]),this.value=r}function mm(){Vt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function xk(r,e,t,i){this.uuid=cr.generateUUID(),this.data=r,this.itemSize=e,this.offset=t,this.normalized=i===!0}function m0(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 v0(r,e,t){m0.call(this,r,e),this.meshPerAttribute=t||1}function g0(r,e,t){yt.call(this,r,e),this.meshPerAttribute=t||1}function Sk(r,e,t,i){this.ray=new Zh(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 voe(r,e){return r.distance-e.distance}function Mk(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++)Mk(n[a],e,t,!0)}function bk(r){this.autoStart=r!==void 0?r:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function LOe(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 wk(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 Tk(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 Bn(r,e){yn.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 mb(r){At.call(this),this.material=r,this.render=function(e){}}function vb(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 Vt,u=new xr(o*2*3,3);l.addAttribute("position",u),mi.call(this,l,new Fi({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function y0(r){At.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Vt,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 xr(t,3));var l=new Fi({fog:!1});this.cone=new mi(e,l),this.add(this.cone),this.update()}function _0(r){this.bones=this.getBoneList(r);for(var e=new Vt,t=[],i=[],n=new Wt(0,0,1),a=new Wt(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 xr(t,3)),e.addAttribute("color",new xr(i,3));var l=new Fi({vertexColors:gm,depthTest:!1,depthWrite:!1,transparent:!0});mi.call(this,e,l),this.root=r,this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function x0(r,e){this.light=r,this.light.updateMatrixWorld();var t=new nm(e,4,2),i=new vo({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),yn.call(this,t,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function S0(r){At.call(this),this.light=r,this.light.updateMatrixWorld();var e=new vo({color:r.color,fog:!1}),t=new vo({color:r.color,fog:!1,wireframe:!0}),i=new Vt;i.addAttribute("position",new yt(new Float32Array(6*3),3)),this.add(new yn(i,e)),this.add(new yn(i,t)),this.update()}function M0(r,e){At.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1;var t=new im(e);t.rotateY(Math.PI*.5);var i=new vo({vertexColors:gm,wireframe:!0}),n=t.getAttribute("position"),a=new Float32Array(n.count*3);t.addAttribute("color",new yt(a,3)),this.add(new yn(t,i)),this.update()}function gb(r,e,t,i){r=r||10,e=e||10,t=new Wt(t!==void 0?t:4473924),i=new Wt(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 Vt;h.addAttribute("position",new xr(o,3)),h.addAttribute("color",new xr(s,3));var p=new Fi({vertexColors:gm});mi.call(this,h,p)}function vL(r,e,t,i,n,a){r=r||10,e=e||16,t=t||8,i=i||64,n=new Wt(n!==void 0?n:4473924),a=new Wt(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 Vt;g.addAttribute("position",new xr(o,3)),g.addAttribute("color",new xr(s,3));var m=new Fi({vertexColors:gm});mi.call(this,g,m)}function yb(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 Vt,u=new xr(o*2*3,3);l.addAttribute("position",u),mi.call(this,l,new Fi({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function b0(r,e){At.call(this),this.light=r,this.light.updateMatrixWorld(),this.matrix=r.matrixWorld,this.matrixAutoUpdate=!1,e===void 0&&(e=1);var t=new Vt;t.addAttribute("position",new xr([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var i=new Fi({fog:!1});this.add(new Qc(t,i)),t=new Vt,t.addAttribute("position",new xr([0,0,0,0,0,1],3)),this.add(new Qc(t,i)),this.update()}function _b(r){var e=new Vt,t=new Fi({color:16777215,vertexColors:Lk}),i=[],n=[],a={},o=new Wt(16755200),s=new Wt(16711680),l=new Wt(43775),u=new Wt(16777215),c=new Wt(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 xr(i,3)),e.addAttribute("color",new xr(n,3)),mi.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 w0(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 Vt;n.setIndex(new yt(t,1)),n.addAttribute("position",new yt(i,3)),mi.call(this,n,new Fi({color:e})),r!==void 0&&this.update(r)}function vm(r,e,t,i,n,a){At.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 Qc(Rse,new Fi({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new yn(Lse,new vo({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(t,n,a)}function gL(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 Vt;i.addAttribute("position",new xr(e,3)),i.addAttribute("color",new xr(t,3));var n=new Fi({vertexColors:gm});mi.call(this,i,n)}function yL(r,e,t,i,n,a){tf.call(this,r,e,t,t,i,n,a)}function OOe(r,e,t,i,n,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Xo(r,e,t,n,a,o)}function BOe(r){return console.warn("THREE.MeshFaceMaterial has been renamed to THREE.MultiMaterial."),new fb(r)}function kOe(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Zy(r,e)}function VOe(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new HM(r)}function GOe(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Zy(r,e)}function HOe(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new eu(r)}function WOe(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new eu(r)}function XOe(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new eu(r)}function YOe(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new oe(r,e,t)}function qOe(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new yt(r,e).setDynamic(!0)}function ZOe(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new zM(r,e)}function jOe(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new FM(r,e)}function KOe(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new BM(r,e)}function JOe(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new kM(r,e)}function $Oe(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Jc(r,e)}function QOe(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new VM(r,e)}function e3e(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new $c(r,e)}function t3e(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new xr(r,e)}function r3e(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new GM(r,e)}function Dse(r){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),aV.call(this,r),this.type="catmullrom",this.closed=!0}function i3e(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new w0(r,e)}function n3e(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new mi(new l0(r.geometry),new Fi({color:e!==void 0?e:16777215}))}function a3e(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new mi(new Ky(r.geometry),new Fi({color:e!==void 0?e:16777215}))}function o3e(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new pl(r)}function u3e(){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 c3e(){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 goe,EIe,yoe,CM,Ek,AIe,_oe,CIe,RIe,Ak,xoe,By,Wh,T0,Ck,Rk,_L,Lk,gm,RM,E0,Dk,Pk,Ik,Nk,Soe,Uk,Moe,boe,ek,tk,woe,Toe,Eoe,Aoe,Ok,zk,Coe,Roe,Loe,Doe,Poe,Ioe,Noe,Uoe,HR,Ooe,zoe,Foe,Boe,xb,koe,Voe,VR,Fk,Goe,Hoe,Woe,xL,SL,WR,Bk,XR,kk,ML,bL,Xoe,Kc,Ho,Kd,rk,Wo,wL,TL,po,Vk,Sb,ik,YR,Yoe,qoe,LM,Zoe,Gk,ky,qR,joe,Koe,Joe,DM,$oe,Vy,Hu,Qoe,ese,LIe,Yd,Gy,nk,ak,ok,sk,lk,uk,ck,fk,tse,rse,ise,nse,PM,AM,GR,Jd,Xd,IM,Hk,ase,ose,NM,sse,Wk,lse,DIe,use,cse,fse,hse,pse,cr,PIe,dse,mse,coe,foe,$B,ho,nNe,aNe,oNe,sNe,lNe,uNe,cNe,fNe,hNe,pNe,dNe,mNe,vNe,gNe,yNe,_Ne,xNe,SNe,MNe,bNe,wNe,TNe,ENe,ANe,CNe,RNe,LNe,DNe,PNe,INe,NNe,UNe,ONe,zNe,FNe,BNe,kNe,VNe,GNe,HNe,WNe,XNe,YNe,qNe,ZNe,jNe,KNe,JNe,$Ne,QNe,eUe,tUe,rUe,iUe,nUe,aUe,oUe,sUe,lUe,uUe,cUe,fUe,hUe,pUe,dUe,mUe,vUe,gUe,yUe,_Ue,xUe,SUe,MUe,bUe,wUe,TUe,EUe,AUe,CUe,RUe,LUe,DUe,PUe,IUe,NUe,UUe,OUe,zUe,FUe,BUe,kUe,VUe,GUe,HUe,WUe,XUe,YUe,qUe,ZUe,jUe,KUe,JUe,$Ue,QUe,eOe,tOe,jr,rOe,hr,Wy,aOe,oOe,sOe,hOe,Fn,Ql,COe,dk,Yo,ROe,ia,rf,bb,$k,kR,tV,Rse,Lse,aV,DOe,POe,IOe,NOe,UOe,zOe,FOe,s3e,l3e,Ise=Vse(()=>{"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(cl.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)}}}});goe="83",EIe={LEFT:0,MIDDLE:1,RIGHT:2},yoe=0,CM=1,Ek=2,AIe=3,_oe=0,CIe=1,RIe=0,Ak=1,xoe=2,By=0,Wh=1,T0=2,Ck=1,Rk=2,_L=0,Lk=1,gm=2,RM=0,E0=1,Dk=2,Pk=3,Ik=4,Nk=5,Soe={NoBlending:RM,NormalBlending:E0,AdditiveBlending:Dk,SubtractiveBlending:Pk,MultiplyBlending:Ik,CustomBlending:Nk},Uk=100,Moe=101,boe=102,ek=103,tk=104,woe=200,Toe=201,Eoe=202,Aoe=203,Ok=204,zk=205,Coe=206,Roe=207,Loe=208,Doe=209,Poe=210,Ioe=0,Noe=1,Uoe=2,HR=3,Ooe=4,zoe=5,Foe=6,Boe=7,xb=0,koe=1,Voe=2,VR=0,Fk=1,Goe=2,Hoe=3,Woe=4,xL=300,SL=301,WR=302,Bk=303,XR=304,kk=305,ML=306,bL=307,Xoe={UVMapping:xL,CubeReflectionMapping:SL,CubeRefractionMapping:WR,EquirectangularReflectionMapping:Bk,EquirectangularRefractionMapping:XR,SphericalReflectionMapping:kk,CubeUVReflectionMapping:ML,CubeUVRefractionMapping:bL},Kc=1e3,Ho=1001,Kd=1002,rk={RepeatWrapping:Kc,ClampToEdgeWrapping:Ho,MirroredRepeatWrapping:Kd},Wo=1003,wL=1004,TL=1005,po=1006,Vk=1007,Sb=1008,ik={NearestFilter:Wo,NearestMipMapNearestFilter:wL,NearestMipMapLinearFilter:TL,LinearFilter:po,LinearMipMapNearestFilter:Vk,LinearMipMapLinearFilter:Sb},YR=1009,Yoe=1010,qoe=1011,LM=1012,Zoe=1013,Gk=1014,ky=1015,qR=1016,joe=1017,Koe=1018,Joe=1019,DM=1020,$oe=1021,Vy=1022,Hu=1023,Qoe=1024,ese=1025,LIe=Hu,Yd=1026,Gy=1027,nk=2001,ak=2002,ok=2003,sk=2004,lk=2100,uk=2101,ck=2102,fk=2103,tse=2151,rse=2200,ise=2201,nse=2202,PM=2300,AM=2301,GR=2302,Jd=2400,Xd=2401,IM=2402,Hk=0,ase=1,ose=2,NM=3e3,sse=3001,Wk=3007,lse=3002,DIe=3003,use=3004,cse=3005,fse=3006,hse=3200,pse=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}};Mt.prototype={constructor:Mt,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 Mt,e=new Mt),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}};PIe=0;ui.DEFAULT_IMAGE=void 0;ui.DEFAULT_MAPPING=xL;ui.prototype={constructor:ui,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===xL){if(r.multiply(this.repeat),r.add(this.offset),r.x<0||r.x>1)switch(this.wrapS){case Kc:r.x=r.x-Math.floor(r.x);break;case Ho:r.x=r.x<0?0:1;break;case Kd: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 Kc:r.y=r.y-Math.floor(r.y);break;case Ho:r.y=r.y<0?0:1;break;case Kd: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(ui.prototype,cl.prototype);ii.prototype={constructor:ii,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 ii,e=new ii),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(A0.prototype,cl.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"})}});Hy.prototype=Object.create(A0.prototype);Hy.prototype.constructor=Hy;Hy.prototype.isWebGLRenderTargetCube=!0;cn.prototype={constructor:cn,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(cn,{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 cn),this.applyQuaternion(r.setFromEuler(t))}}(),applyAxisAngle:function(){var r;return function(t,i){return r===void 0&&(r=new cn),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 jt),r.multiplyMatrices(t.projectionMatrix,r.getInverse(t.matrixWorld)),this.applyProjection(r)}}(),unproject:function(){var r;return function(t){return r===void 0&&(r=new jt),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}};jt.prototype={constructor:jt,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 jt().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],P=i[10],U=i[14],B=i[3],z=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*z,n[8]=a*w+o*E+s*P+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*z,n[9]=u*w+c*E+f*P+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*z,n[10]=p*w+d*E+g*P+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*z,n[11]=v*w+_*E+y*P+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 jt);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}};Xh.prototype=Object.create(ui.prototype);Xh.prototype.constructor=Xh;Xh.prototype.isCubeTexture=!0;Object.defineProperty(Xh.prototype,"images",{get:function(){return this.image},set:function(r){this.image=r}});dse=new ui,mse=new Xh;coe=[],foe=[];Sse.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])}};$B=/([\w\d_]+)(\])?(\[|\.)?/g;Yh.prototype.setValue=function(r,e,t){var i=this.map[e];i!==void 0&&i.setValue(r,t,this.renderer)};Yh.prototype.set=function(r,e,t){var i=this.map[t];i!==void 0&&i.setValue(r,e[t],this.renderer)};Yh.prototype.setOptional=function(r,e,t){var i=e[t];i!==void 0&&this.setValue(r,t,i)};Yh.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)}};Yh.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};ho={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}},nNe=`#ifdef USE_ALPHAMAP
  23. diffuseColor.a *= texture2D( alphaMap, vUv ).g;
  24. #endif
  25. `,aNe=`#ifdef USE_ALPHAMAP
  26. uniform sampler2D alphaMap;
  27. #endif
  28. `,oNe=`#ifdef ALPHATEST
  29. if ( diffuseColor.a < ALPHATEST ) discard;
  30. #endif
  31. `,sNe=`#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. `,lNe=`#ifdef USE_AOMAP
  40. uniform sampler2D aoMap;
  41. uniform float aoMapIntensity;
  42. #endif`,uNe=`
  43. vec3 transformed = vec3( position );
  44. `,cNe=`
  45. vec3 objectNormal = vec3( normal );
  46. `,fNe=`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. `,hNe=`#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. `,pNe=`#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. `,dNe=`#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. `,mNe=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )
  329. varying vec3 vViewPosition;
  330. #endif
  331. `,vNe=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )
  332. vViewPosition = - mvPosition.xyz;
  333. #endif
  334. `,gNe=`#ifdef USE_COLOR
  335. diffuseColor.rgb *= vColor;
  336. #endif`,yNe=`#ifdef USE_COLOR
  337. varying vec3 vColor;
  338. #endif
  339. `,_Ne=`#ifdef USE_COLOR
  340. varying vec3 vColor;
  341. #endif`,xNe=`#ifdef USE_COLOR
  342. vColor.xyz = color.xyz;
  343. #endif`,SNe=`#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. `,MNe=`#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. `,bNe=`#ifdef FLIP_SIDED
  505. objectNormal = -objectNormal;
  506. #endif
  507. vec3 transformedNormal = normalMatrix * objectNormal;
  508. `,wNe=`#ifdef USE_DISPLACEMENTMAP
  509. uniform sampler2D displacementMap;
  510. uniform float displacementScale;
  511. uniform float displacementBias;
  512. #endif
  513. `,TNe=`#ifdef USE_DISPLACEMENTMAP
  514. transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );
  515. #endif
  516. `,ENe=`#ifdef USE_EMISSIVEMAP
  517. vec4 emissiveColor = texture2D( emissiveMap, vUv );
  518. emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
  519. totalEmissiveRadiance *= emissiveColor.rgb;
  520. #endif
  521. `,ANe=`#ifdef USE_EMISSIVEMAP
  522. uniform sampler2D emissiveMap;
  523. #endif
  524. `,CNe=` gl_FragColor = linearToOutputTexel( gl_FragColor );
  525. `,RNe=`
  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. `,LNe=`#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. `,DNe=`#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. `,PNe=`#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. `,INe=`#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. `,NNe=`#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. `,UNe=`#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`,ONe=`#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. `,zNe=`#ifdef USE_LIGHTMAP
  697. reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
  698. #endif
  699. `,FNe=`#ifdef USE_LIGHTMAP
  700. uniform sampler2D lightMap;
  701. uniform float lightMapIntensity;
  702. #endif`,BNe=`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. `,kNe=`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. `,VNe=`BlinnPhongMaterial material;
  932. material.diffuseColor = diffuseColor.rgb;
  933. material.specularColor = specular;
  934. material.specularShininess = shininess;
  935. material.specularStrength = specularStrength;
  936. `,GNe=`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. `,HNe=`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. `,WNe=`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. `,XNe=`
  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. `,YNe=`#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)
  1142. gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;
  1143. #endif`,qNe=`#ifdef USE_LOGDEPTHBUF
  1144. uniform float logDepthBufFC;
  1145. #ifdef USE_LOGDEPTHBUF_EXT
  1146. varying float vFragDepth;
  1147. #endif
  1148. #endif
  1149. `,ZNe=`#ifdef USE_LOGDEPTHBUF
  1150. #ifdef USE_LOGDEPTHBUF_EXT
  1151. varying float vFragDepth;
  1152. #endif
  1153. uniform float logDepthBufFC;
  1154. #endif`,jNe=`#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. `,KNe=`#ifdef USE_MAP
  1163. vec4 texelColor = texture2D( map, vUv );
  1164. texelColor = mapTexelToLinear( texelColor );
  1165. diffuseColor *= texelColor;
  1166. #endif
  1167. `,JNe=`#ifdef USE_MAP
  1168. uniform sampler2D map;
  1169. #endif
  1170. `,$Ne=`#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. `,QNe=`#ifdef USE_MAP
  1175. uniform vec4 offsetRepeat;
  1176. uniform sampler2D map;
  1177. #endif
  1178. `,eUe=`float metalnessFactor = metalness;
  1179. #ifdef USE_METALNESSMAP
  1180. vec4 texelMetalness = texture2D( metalnessMap, vUv );
  1181. metalnessFactor *= texelMetalness.r;
  1182. #endif
  1183. `,tUe=`#ifdef USE_METALNESSMAP
  1184. uniform sampler2D metalnessMap;
  1185. #endif`,rUe=`#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. `,iUe=`#ifdef USE_MORPHTARGETS
  1192. #ifndef USE_MORPHNORMALS
  1193. uniform float morphTargetInfluences[ 8 ];
  1194. #else
  1195. uniform float morphTargetInfluences[ 4 ];
  1196. #endif
  1197. #endif`,nUe=`#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. `,aUe=`#ifdef DOUBLE_SIDED
  1210. float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );
  1211. #else
  1212. float flipNormal = 1.0;
  1213. #endif
  1214. `,oUe=`#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. `,sUe=`#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. `,lUe=`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. `,uUe=`#ifdef PREMULTIPLIED_ALPHA
  1273. gl_FragColor.rgb *= gl_FragColor.a;
  1274. #endif
  1275. `,cUe=`#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. `,fUe=`float roughnessFactor = roughness;
  1282. #ifdef USE_ROUGHNESSMAP
  1283. vec4 texelRoughness = texture2D( roughnessMap, vUv );
  1284. roughnessFactor *= texelRoughness.r;
  1285. #endif
  1286. `,hUe=`#ifdef USE_ROUGHNESSMAP
  1287. uniform sampler2D roughnessMap;
  1288. #endif`,pUe=`#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. `,dUe=`#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. `,mUe=`#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. `,vUe=`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. `,gUe=`#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`,yUe=`#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. `,_Ue=`#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. `,xUe=`#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. `,SUe=`float specularStrength;
  1529. #ifdef USE_SPECULARMAP
  1530. vec4 texelSpecular = texture2D( specularMap, vUv );
  1531. specularStrength = texelSpecular.r;
  1532. #else
  1533. specularStrength = 1.0;
  1534. #endif`,MUe=`#ifdef USE_SPECULARMAP
  1535. uniform sampler2D specularMap;
  1536. #endif`,bUe=`#if defined( TONE_MAPPING )
  1537. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  1538. #endif
  1539. `,wUe=`#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. `,TUe=`#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`,EUe=`#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. `,AUe=`#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`,CUe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1568. varying vec2 vUv2;
  1569. #endif`,RUe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1570. attribute vec2 uv2;
  1571. varying vec2 vUv2;
  1572. #endif`,LUe=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
  1573. vUv2 = uv2;
  1574. #endif`,DUe=`#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. `,PUe=`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. `,IUe=`varying vec3 vWorldPosition;
  1591. #include <common>
  1592. void main() {
  1593. vWorldPosition = transformDirection( position, modelMatrix );
  1594. #include <begin_vertex>
  1595. #include <project_vertex>
  1596. }
  1597. `,NUe=`#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. `,UUe=`#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. `,OUe=`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. `,zUe=`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. `,FUe=`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. `,BUe=`varying vec3 vWorldPosition;
  1677. #include <common>
  1678. void main() {
  1679. vWorldPosition = transformDirection( position, modelMatrix );
  1680. #include <begin_vertex>
  1681. #include <project_vertex>
  1682. }
  1683. `,kUe=`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. `,VUe=`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. `,GUe=`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. `,HUe=`#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. `,WUe=`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. `,XUe=`#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. `,YUe=`#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. `,qUe=`#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. `,ZUe=`#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. `,jUe=`#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. `,KUe=`#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. `,JUe=`#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. `,$Ue=`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. `,QUe=`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. `,eOe=`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. `,tOe=`#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. `,jr={alphamap_fragment:nNe,alphamap_pars_fragment:aNe,alphatest_fragment:oNe,aomap_fragment:sNe,aomap_pars_fragment:lNe,begin_vertex:uNe,beginnormal_vertex:cNe,bsdfs:fNe,bumpmap_pars_fragment:hNe,clipping_planes_fragment:pNe,clipping_planes_pars_fragment:dNe,clipping_planes_pars_vertex:mNe,clipping_planes_vertex:vNe,color_fragment:gNe,color_pars_fragment:yNe,color_pars_vertex:_Ne,color_vertex:xNe,common:SNe,cube_uv_reflection_fragment:MNe,defaultnormal_vertex:bNe,displacementmap_pars_vertex:wNe,displacementmap_vertex:TNe,emissivemap_fragment:ENe,emissivemap_pars_fragment:ANe,encodings_fragment:CNe,encodings_pars_fragment:RNe,envmap_fragment:LNe,envmap_pars_fragment:DNe,envmap_pars_vertex:PNe,envmap_vertex:INe,fog_fragment:NNe,fog_pars_fragment:UNe,gradientmap_pars_fragment:ONe,lightmap_fragment:zNe,lightmap_pars_fragment:FNe,lights_lambert_vertex:BNe,lights_pars:kNe,lights_phong_fragment:VNe,lights_phong_pars_fragment:GNe,lights_physical_fragment:HNe,lights_physical_pars_fragment:WNe,lights_template:XNe,logdepthbuf_fragment:YNe,logdepthbuf_pars_fragment:qNe,logdepthbuf_pars_vertex:ZNe,logdepthbuf_vertex:jNe,map_fragment:KNe,map_pars_fragment:JNe,map_particle_fragment:$Ne,map_particle_pars_fragment:QNe,metalnessmap_fragment:eUe,metalnessmap_pars_fragment:tUe,morphnormal_vertex:rUe,morphtarget_pars_vertex:iUe,morphtarget_vertex:nUe,normal_flip:aUe,normal_fragment:oUe,normalmap_pars_fragment:sUe,packing:lUe,premultiplied_alpha_fragment:uUe,project_vertex:cUe,roughnessmap_fragment:fUe,roughnessmap_pars_fragment:hUe,shadowmap_pars_fragment:pUe,shadowmap_pars_vertex:dUe,shadowmap_vertex:mUe,shadowmask_pars_fragment:vUe,skinbase_vertex:gUe,skinning_pars_vertex:yUe,skinning_vertex:_Ue,skinnormal_vertex:xUe,specularmap_fragment:SUe,specularmap_pars_fragment:MUe,tonemapping_fragment:bUe,tonemapping_pars_fragment:wUe,uv_pars_fragment:TUe,uv_pars_vertex:EUe,uv_vertex:AUe,uv2_pars_fragment:CUe,uv2_pars_vertex:RUe,uv2_vertex:LUe,worldpos_vertex:DUe,cube_frag:PUe,cube_vert:IUe,depth_frag:NUe,depth_vert:UUe,distanceRGBA_frag:OUe,distanceRGBA_vert:zUe,equirect_frag:FUe,equirect_vert:BUe,linedashed_frag:kUe,linedashed_vert:VUe,meshbasic_frag:GUe,meshbasic_vert:HUe,meshlambert_frag:WUe,meshlambert_vert:XUe,meshphong_frag:YUe,meshphong_vert:qUe,meshphysical_frag:ZUe,meshphysical_vert:jUe,normal_frag:KUe,normal_vert:JUe,points_frag:$Ue,points_vert:QUe,shadow_frag:eOe,shadow_vert:tOe};Wt.prototype={constructor:Wt,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=rOe[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()}};rOe={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};$d.prototype=Object.create(ui.prototype);$d.prototype.constructor=$d;$d.prototype.isDataTexture=!0;hr={common:{diffuse:{value:new Wt(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new ii(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 Mt(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 Wt(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 Wt(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new ii(0,0,1,1)}}},Wy={basic:{uniforms:ho.merge([hr.common,hr.aomap,hr.lightmap,hr.fog]),vertexShader:jr.meshbasic_vert,fragmentShader:jr.meshbasic_frag},lambert:{uniforms:ho.merge([hr.common,hr.aomap,hr.lightmap,hr.emissivemap,hr.fog,hr.lights,{emissive:{value:new Wt(0)}}]),vertexShader:jr.meshlambert_vert,fragmentShader:jr.meshlambert_frag},phong:{uniforms:ho.merge([hr.common,hr.aomap,hr.lightmap,hr.emissivemap,hr.bumpmap,hr.normalmap,hr.displacementmap,hr.gradientmap,hr.fog,hr.lights,{emissive:{value:new Wt(0)},specular:{value:new Wt(1118481)},shininess:{value:30}}]),vertexShader:jr.meshphong_vert,fragmentShader:jr.meshphong_frag},standard:{uniforms:ho.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 Wt(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:jr.meshphysical_vert,fragmentShader:jr.meshphysical_frag},points:{uniforms:ho.merge([hr.points,hr.fog]),vertexShader:jr.points_vert,fragmentShader:jr.points_frag},dashed:{uniforms:ho.merge([hr.common,hr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:jr.linedashed_vert,fragmentShader:jr.linedashed_frag},depth:{uniforms:ho.merge([hr.common,hr.displacementmap]),vertexShader:jr.depth_vert,fragmentShader:jr.depth_frag},normal:{uniforms:ho.merge([hr.common,hr.bumpmap,hr.normalmap,hr.displacementmap,{opacity:{value:1}}]),vertexShader:jr.normal_vert,fragmentShader:jr.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:jr.cube_vert,fragmentShader:jr.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:jr.equirect_vert,fragmentShader:jr.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new oe}},vertexShader:jr.distanceRGBA_vert,fragmentShader:jr.distanceRGBA_frag}};Wy.physical={uniforms:ho.merge([Wy.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:jr.meshphysical_vert,fragmentShader:jr.meshphysical_frag};UM.prototype={constructor:UM,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 Mt;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 Mt;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(r){var e=r||new Mt;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 Mt;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 Mt;return t.copy(r).clamp(this.min,this.max)},distanceToPoint:function(){var r=new Mt;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)}};aOe=0;gr.prototype={constructor:gr,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!==E0&&(t.blending=this.blending),this.shading!==Rk&&(t.shading=this.shading),this.side!==By&&(t.side=this.side),this.vertexColors!==_L&&(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(gr.prototype,cl.prototype);Ea.prototype=Object.create(gr.prototype);Ea.prototype.constructor=Ea;Ea.prototype.isShaderMaterial=!0;Ea.prototype.copy=function(r){return gr.prototype.copy.call(this,r),this.fragmentShader=r.fragmentShader,this.vertexShader=r.vertexShader,this.uniforms=ho.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};Ea.prototype.toJSON=function(r){var e=gr.prototype.toJSON.call(this,r);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e};qh.prototype=Object.create(gr.prototype);qh.prototype.constructor=qh;qh.prototype.isMeshDepthMaterial=!0;qh.prototype.copy=function(r){return gr.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};Wu.prototype={constructor:Wu,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 na;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)}};na.prototype={constructor:na,set:function(r,e){return this.center.copy(r),this.radius=e,this},setFromPoints:function(){var r=new Wu;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 Wu;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}};fl.prototype={constructor:fl,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}};Vo.prototype={constructor:Vo,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 fl;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}};OM.prototype={constructor:OM,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 na;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 na;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}};Zh.prototype={constructor:Zh,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)}};jh.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];jh.DefaultOrder="XYZ";jh.prototype={constructor:jh,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 jt),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 cn;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(){}};ZR.prototype={constructor:ZR,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}};oOe=0;At.DefaultUp=new oe(0,1,0);At.DefaultMatrixAutoUpdate=!0;Object.assign(At.prototype,cl.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 cn;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 jt;return function(t){return t.applyMatrix4(r.getInverse(this.matrixWorld))}}(),lookAt:function(){var r=new jt;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 cn;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,n,e),n}}(),getWorldRotation:function(){var r=new cn;return function(t){var i=t||new jh;return this.getWorldQuaternion(r),i.setFromQuaternion(r,this.rotation.order,!1)}}(),getWorldScale:function(){var r=new oe,e=new cn;return function(i){var n=i||new oe;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(r,e,n),n}}(),getWorldDirection:function(){var r=new cn;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}});qd.prototype={constructor:qd,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)}};ul.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)}}();ul.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)}}();ul.containsPoint=function(){var r=new oe;return function(t,i,n,a){var o=ul.barycoordFromPoint(t,i,n,a,r);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}();ul.prototype={constructor:ul,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 ul.normal(this.a,this.b,this.c,r)},plane:function(r){var e=r||new Vo;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(r,e){return ul.barycoordFromPoint(r,this.a,this.b,this.c,e)},containsPoint:function(r){return ul.containsPoint(r,this.a,this.b,this.c)},closestPointToPoint:function(){var r,e,t,i;return function(a,o){r===void 0&&(r=new Vo,e=[new qd,new qd,new qd],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)}};Xo.prototype={constructor:Xo,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}};vo.prototype=Object.create(gr.prototype);vo.prototype.constructor=vo;vo.prototype.isMeshBasicMaterial=!0;vo.prototype.copy=function(r){return gr.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};yt.prototype={constructor:yt,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 Wt),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 Mt),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 ii),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)}};zM.prototype=Object.create(yt.prototype);zM.prototype.constructor=zM;FM.prototype=Object.create(yt.prototype);FM.prototype.constructor=FM;BM.prototype=Object.create(yt.prototype);BM.prototype.constructor=BM;kM.prototype=Object.create(yt.prototype);kM.prototype.constructor=kM;Jc.prototype=Object.create(yt.prototype);Jc.prototype.constructor=Jc;VM.prototype=Object.create(yt.prototype);VM.prototype.constructor=VM;$c.prototype=Object.create(yt.prototype);$c.prototype.constructor=$c;xr.prototype=Object.create(yt.prototype);xr.prototype.constructor=xr;GM.prototype=Object.create(yt.prototype);GM.prototype.constructor=GM;Object.assign(bse.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 Mt,new Mt,new Mt))}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 Mt,new Mt,new Mt))}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(sr.prototype,cl.prototype,{isGeometry:!0,applyMatrix:function(r){for(var e=new fl().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 jt),r.makeRotationX(t),this.applyMatrix(r),this}}(),rotateY:function(){var r;return function(t){return r===void 0&&(r=new jt),r.makeRotationY(t),this.applyMatrix(r),this}}(),rotateZ:function(){var r;return function(t){return r===void 0&&(r=new jt),r.makeRotationZ(t),this.applyMatrix(r),this}}(),translate:function(){var r;return function(t,i,n){return r===void 0&&(r=new jt),r.makeTranslation(t,i,n),this.applyMatrix(r),this}}(),scale:function(){var r;return function(t,i,n){return r===void 0&&(r=new jt),r.makeScale(t,i,n),this.applyMatrix(r),this}}(),lookAt:function(){var r;return function(t){r===void 0&&(r=new At),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 Wt(o[h],o[h+1],o[h+2])),s!==void 0&&c.push(new Mt(s[p],s[p+1])),l!==void 0&&f.push(new Mt(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 Xo(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 jt;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 sr;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 Wu),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new na),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 fl().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 Xo(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,P){return P?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 sr().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"})}});sOe=0;Object.assign(Vt.prototype,cl.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 yt(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 fl().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 jt),r.makeRotationX(t),this.applyMatrix(r),this}}(),rotateY:function(){var r;return function(t){return r===void 0&&(r=new jt),r.makeRotationY(t),this.applyMatrix(r),this}}(),rotateZ:function(){var r;return function(t){return r===void 0&&(r=new jt),r.makeRotationZ(t),this.applyMatrix(r),this}}(),translate:function(){var r;return function(t,i,n){return r===void 0&&(r=new jt),r.makeTranslation(t,i,n),this.applyMatrix(r),this}}(),scale:function(){var r;return function(t,i,n){return r===void 0&&(r=new jt),r.makeScale(t,i,n),this.applyMatrix(r),this}}(),lookAt:function(){var r;return function(t){r===void 0&&(r=new At),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 xr(e.vertices.length*3,3),i=new xr(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 xr(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 bse().fromGeometry(r),this.fromDirectGeometry(r.__directGeometry)},fromDirectGeometry:function(r){var e=new Float32Array(r.vertices.length*3);if(this.addAttribute("position",new yt(e,3).copyVector3sArray(r.vertices)),r.normals.length>0){var t=new Float32Array(r.normals.length*3);this.addAttribute("normal",new yt(t,3).copyVector3sArray(r.normals))}if(r.colors.length>0){var i=new Float32Array(r.colors.length*3);this.addAttribute("color",new yt(i,3).copyColorsArray(r.colors))}if(r.uvs.length>0){var n=new Float32Array(r.uvs.length*2);this.addAttribute("uv",new yt(n,2).copyVector2sArray(r.uvs))}if(r.uvs2.length>0){var a=new Float32Array(r.uvs2.length*2);this.addAttribute("uv2",new yt(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 yt(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 xr(p.length*3,3);u.push(d.copyVector3sArray(p))}this.morphAttributes[l]=u}if(r.skinIndices.length>0){var g=new xr(r.skinIndices.length*4,4);this.addAttribute("skinIndex",g.copyVector4sArray(r.skinIndices))}if(r.skinWeights.length>0){var m=new xr(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 Wu);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 Wu,e=new oe;return function(){this.boundingSphere===null&&(this.boundingSphere=new na);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 yt(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 Vt,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 yt(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 Vt().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"})}});Vt.MaxIndex=65535;yn.prototype=Object.assign(Object.create(At.prototype),{constructor:yn,isMesh:!0,setDrawMode:function(r){this.drawMode=r},copy:function(r){return At.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 jt,e=new Zh,t=new na,i=new oe,n=new oe,a=new oe,o=new oe,s=new oe,l=new oe,u=new Mt,c=new Mt,f=new Mt,h=new oe,p=new oe,d=new oe;function g(_,y,x,M,S,w,T){return ul.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===Wh?C=x.intersectTriangle(w,S,M,!0,T):C=x.intersectTriangle(M,S,w,b.side!==T0,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 Xo(w,T,C,ul.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,P=A.position.array;if(A.uv!==void 0&&(T=A.uv.array),R!==null)for(var U=R.array,B=0,z=U.length;B<z;B+=3)b=U[B],E=U[B+1],I=U[B+2],C=v(this,y,e,P,T,b,E,I),C&&(C.faceIndex=Math.floor(B/3),x.push(C));else for(var B=0,z=P.length;B<z;B+=9)b=B/3,E=b+1,I=b+2,C=v(this,y,e,P,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)}});Qd.prototype=Object.create(Vt.prototype);Qd.prototype.constructor=Qd;em.prototype=Object.create(Vt.prototype);em.prototype.constructor=em;aa.prototype=Object.create(At.prototype);aa.prototype.constructor=aa;aa.prototype.isCamera=!0;aa.prototype.getWorldDirection=function(){var r=new cn;return function(t){var i=t||new oe;return this.getWorldQuaternion(r),i.set(0,0,-1).applyQuaternion(r)}}();aa.prototype.lookAt=function(){var r=new jt;return function(t){r.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(r)}}();aa.prototype.clone=function(){return new this.constructor().copy(this)};aa.prototype.copy=function(r){return At.prototype.copy.call(this,r),this.matrixWorldInverse.copy(r.matrixWorldInverse),this.projectionMatrix.copy(r.projectionMatrix),this};ra.prototype=Object.assign(Object.create(aa.prototype),{constructor:ra,isPerspectiveCamera:!0,copy:function(r){return aa.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=At.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}});Xy.prototype=Object.assign(Object.create(aa.prototype),{constructor:Xy,isOrthographicCamera:!0,copy:function(r){return aa.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=At.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}});hOe=0;Yy.prototype.isFogExp2=!0;Yy.prototype.clone=function(){return new Yy(this.color.getHex(),this.density)};Yy.prototype.toJSON=function(r){return{type:"FogExp2",color:this.color.getHex(),density:this.density}};qy.prototype.isFog=!0;qy.prototype.clone=function(){return new qy(this.color.getHex(),this.near,this.far)};qy.prototype.toJSON=function(r){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}};tm.prototype=Object.create(At.prototype);tm.prototype.constructor=tm;tm.prototype.copy=function(r,e){return At.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};tm.prototype.toJSON=function(r){var e=At.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};pk.prototype=Object.assign(Object.create(At.prototype),{constructor:pk,isLensFlare:!0,copy:function(r){At.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 Wt(16777215)),i===void 0&&(i=E0),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}});rm.prototype=Object.create(gr.prototype);rm.prototype.constructor=rm;rm.prototype.copy=function(r){return gr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.rotation=r.rotation,this};HM.prototype=Object.assign(Object.create(At.prototype),{constructor:HM,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)}});WM.prototype=Object.assign(Object.create(At.prototype),{constructor:WM,copy:function(r){At.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=At.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(jR.prototype,{calculateInverses:function(){this.boneInverses=[];for(var r=0,e=this.bones.length;r<e;r++){var t=new jt;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 jt;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 jR(this.bones,this.boneInverses,this.useVertexTexture)}});KR.prototype=Object.assign(Object.create(At.prototype),{constructor:KR,isBone:!0});JR.prototype=Object.assign(Object.create(yn.prototype),{constructor:JR,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 ii,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){yn.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)}});Fi.prototype=Object.create(gr.prototype);Fi.prototype.constructor=Fi;Fi.prototype.isLineBasicMaterial=!0;Fi.prototype.copy=function(r){return gr.prototype.copy.call(this,r),this.color.copy(r.color),this.linewidth=r.linewidth,this.linecap=r.linecap,this.linejoin=r.linejoin,this};Qc.prototype=Object.assign(Object.create(At.prototype),{constructor:Qc,isLine:!0,raycast:function(){var r=new jt,e=new Zh,t=new na;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)}});mi.prototype=Object.assign(Object.create(Qc.prototype),{constructor:mi,isLineSegments:!0});eu.prototype=Object.create(gr.prototype);eu.prototype.constructor=eu;eu.prototype.isPointsMaterial=!0;eu.prototype.copy=function(r){return gr.prototype.copy.call(this,r),this.color.copy(r.color),this.map=r.map,this.size=r.size,this.sizeAttenuation=r.sizeAttenuation,this};Zy.prototype=Object.assign(Object.create(At.prototype),{constructor:Zy,isPoints:!0,raycast:function(){var r=new jt,e=new Zh,t=new na;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)}});XM.prototype=Object.assign(Object.create(At.prototype),{constructor:XM});$R.prototype=Object.create(ui.prototype);$R.prototype.constructor=$R;jy.prototype=Object.create(ui.prototype);jy.prototype.constructor=jy;jy.prototype.isCompressedTexture=!0;QR.prototype=Object.create(ui.prototype);QR.prototype.constructor=QR;YM.prototype=Object.create(ui.prototype);YM.prototype.constructor=YM;YM.prototype.isDepthTexture=!0;Ky.prototype=Object.create(Vt.prototype);Ky.prototype.constructor=Ky;Jy.prototype=Object.create(Vt.prototype);Jy.prototype.constructor=Jy;qM.prototype=Object.create(sr.prototype);qM.prototype.constructor=qM;go.prototype=Object.create(Vt.prototype);go.prototype.constructor=go;$y.prototype=Object.create(go.prototype);$y.prototype.constructor=$y;ZM.prototype=Object.create(sr.prototype);ZM.prototype.constructor=ZM;im.prototype=Object.create(go.prototype);im.prototype.constructor=im;jM.prototype=Object.create(sr.prototype);jM.prototype.constructor=jM;Qy.prototype=Object.create(go.prototype);Qy.prototype.constructor=Qy;KM.prototype=Object.create(sr.prototype);KM.prototype.constructor=KM;e0.prototype=Object.create(go.prototype);e0.prototype.constructor=e0;JM.prototype=Object.create(sr.prototype);JM.prototype.constructor=JM;$M.prototype=Object.create(sr.prototype);$M.prototype.constructor=$M;t0.prototype=Object.create(Vt.prototype);t0.prototype.constructor=t0;QM.prototype=Object.create(sr.prototype);QM.prototype.constructor=QM;r0.prototype=Object.create(Vt.prototype);r0.prototype.constructor=r0;eb.prototype=Object.create(sr.prototype);eb.prototype.constructor=eb;i0.prototype=Object.create(Vt.prototype);i0.prototype.constructor=i0;tb.prototype=Object.create(sr.prototype);tb.prototype.constructor=tb;Fn={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(Fn.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,P=C*I-T*R;if(Math.abs(A)>Number.EPSILON){var U;if(A>0){if(P<0||P>A)return[];if(U=E*I-b*R,U<0||U>A)return[]}else{if(P>0||P<A)return[];if(U=E*I-b*R,U>0||U<A)return[]}if(U===0)return w&&(P===0||P===A)?[]:[y];if(U===A)return w&&(P===0||P===A)?[]:[x];if(P===0)return[M];if(P===A)return[S];var B=U/A;return[{x:y.x+B*T,y:y.y+B*C}]}else{if(P!==0||E*I!==b*R)return[];var z=T===0&&C===0,k=b===0&&E===0;if(z&&k)return y.x!==M.x||y.y!==M.y?[]:[y];if(z)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 P=E*b-I*C;return R>0?A>=0&&P>=0:A>=0||P>=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,P,U,B=[],z,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(P=C[J],U=R.x+":"+R.y+":"+P,B[U]===void 0){S=x[P];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),z=M.slice(0,I+1),k=M.slice(I),G=S.slice(E),Y=S.slice(0,E+1),M=z.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),_=Fn.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 Fn.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)}}()};hl.prototype=Object.create(sr.prototype);hl.prototype.constructor=hl;hl.prototype.addShapeList=function(r,e){for(var t=r.length,i=0;i<t;i++){var n=r[i];this.addShape(n,e)}};hl.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:hl.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=!Fn.isClockWise(w);if(C){for(w=w.reverse(),_=0,y=T.length;_<y;_++)v=T[_],Fn.isClockWise(v)&&(T[_]=v.reverse());C=!1}var b=Fn.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,P,U,B,z=w.length,k,G=b.length;function Y(Ue,Ne,Ve){var ct,F,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,Fe=((it-nt)*he-(Xe-$)*me)/(ne*he-le*me);ct=nt+ne*Fe-Ue.x,F=$+le*Fe-Ue.y;var we=ct*ct+F*F;if(we<=2)return new Mt(ct,F);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,F=ne,L=Math.sqrt(et)):(ct=ne,F=le,L=Math.sqrt(et/2))}return new Mt(ct/L,F/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(P=R/a,U=i*Math.cos(P*Math.PI/2),A=n*Math.sin(P*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<z;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<z;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(P=R/a,U=i*Math.cos(P*Math.PI/2),A=n*Math.sin(P*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=z*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=z*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]+z*l,k[1]+z*l,k[2]+z*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 F=0,L=l+a*2;for(F=0;F<L;F++){var ne=z*F,le=z*(F+1),me=Ne+Ve+ne,he=Ne+ct+ne,et=Ne+ct+le,Ke=Ne+Ve+le;Le(me,he,et,Ke,Ue,F,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 Xo(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,F,L,ne,le,me){Ue+=M,Ne+=M,Ve+=M,ct+=M,x.faces.push(new Xo(Ue,Ne,ct,null,null,1)),x.faces.push(new Xo(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]])}};hl.WorldUVGenerator={generateTopUV:function(r,e,t,i){var n=r.vertices,a=n[e],o=n[t],s=n[i];return[new Mt(a.x,a.y),new Mt(o.x,o.y),new Mt(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 Mt(o.x,1-o.z),new Mt(s.x,1-s.z),new Mt(l.x,1-l.z),new Mt(u.x,1-u.z)]:[new Mt(o.y,1-o.z),new Mt(s.y,1-s.z),new Mt(l.y,1-l.z),new Mt(u.y,1-u.z)]}};rb.prototype=Object.create(hl.prototype);rb.prototype.constructor=rb;nm.prototype=Object.create(Vt.prototype);nm.prototype.constructor=nm;ib.prototype=Object.create(sr.prototype);ib.prototype.constructor=ib;n0.prototype=Object.create(Vt.prototype);n0.prototype.constructor=n0;nb.prototype=Object.create(sr.prototype);nb.prototype.constructor=nb;ab.prototype=Object.create(sr.prototype);ab.prototype.constructor=ab;a0.prototype=Object.create(Vt.prototype);a0.prototype.constructor=a0;ob.prototype=Object.create(sr.prototype);ob.prototype.constructor=ob;o0.prototype=Object.create(Vt.prototype);o0.prototype.constructor=o0;s0.prototype=Object.create(sr.prototype);s0.prototype.constructor=s0;l0.prototype=Object.create(Vt.prototype);l0.prototype.constructor=l0;ef.prototype=Object.create(Vt.prototype);ef.prototype.constructor=ef;am.prototype=Object.create(sr.prototype);am.prototype.constructor=am;sb.prototype=Object.create(am.prototype);sb.prototype.constructor=sb;lb.prototype=Object.create(ef.prototype);lb.prototype.constructor=lb;u0.prototype=Object.create(Vt.prototype);u0.prototype.constructor=u0;ub.prototype=Object.create(sr.prototype);ub.prototype.constructor=ub;cb.prototype=Object.create(sr.prototype);cb.prototype.constructor=cb;Ql=Object.freeze({WireframeGeometry:Ky,ParametricGeometry:qM,ParametricBufferGeometry:Jy,TetrahedronGeometry:ZM,TetrahedronBufferGeometry:$y,OctahedronGeometry:jM,OctahedronBufferGeometry:im,IcosahedronGeometry:KM,IcosahedronBufferGeometry:Qy,DodecahedronGeometry:JM,DodecahedronBufferGeometry:e0,PolyhedronGeometry:$M,PolyhedronBufferGeometry:go,TubeGeometry:QM,TubeBufferGeometry:t0,TorusKnotGeometry:eb,TorusKnotBufferGeometry:r0,TorusGeometry:tb,TorusBufferGeometry:i0,TextGeometry:rb,SphereBufferGeometry:nm,SphereGeometry:ib,RingGeometry:nb,RingBufferGeometry:n0,PlaneBufferGeometry:em,PlaneGeometry:ab,LatheGeometry:ob,LatheBufferGeometry:a0,ShapeGeometry:s0,ShapeBufferGeometry:o0,ExtrudeGeometry:hl,EdgesGeometry:l0,ConeGeometry:sb,ConeBufferGeometry:lb,CylinderGeometry:am,CylinderBufferGeometry:ef,CircleBufferGeometry:u0,CircleGeometry:ub,BoxBufferGeometry:Qd,BoxGeometry:cb});c0.prototype=Object.create(Ea.prototype);c0.prototype.constructor=c0;c0.prototype.isShadowMaterial=!0;f0.prototype=Object.create(Ea.prototype);f0.prototype.constructor=f0;f0.prototype.isRawShaderMaterial=!0;fb.prototype={constructor:fb,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}};Xu.prototype=Object.create(gr.prototype);Xu.prototype.constructor=Xu;Xu.prototype.isMeshStandardMaterial=!0;Xu.prototype.copy=function(r){return gr.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};om.prototype=Object.create(Xu.prototype);om.prototype.constructor=om;om.prototype.isMeshPhysicalMaterial=!0;om.prototype.copy=function(r){return Xu.prototype.copy.call(this,r),this.defines={PHYSICAL:""},this.reflectivity=r.reflectivity,this.clearCoat=r.clearCoat,this.clearCoatRoughness=r.clearCoatRoughness,this};tu.prototype=Object.create(gr.prototype);tu.prototype.constructor=tu;tu.prototype.isMeshPhongMaterial=!0;tu.prototype.copy=function(r){return gr.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};sm.prototype=Object.create(tu.prototype);sm.prototype.constructor=sm;sm.prototype.isMeshToonMaterial=!0;sm.prototype.copy=function(r){return tu.prototype.copy.call(this,r),this.gradientMap=r.gradientMap,this};lm.prototype=Object.create(gr.prototype);lm.prototype.constructor=lm;lm.prototype.isMeshNormalMaterial=!0;lm.prototype.copy=function(r){return gr.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};um.prototype=Object.create(gr.prototype);um.prototype.constructor=um;um.prototype.isMeshLambertMaterial=!0;um.prototype.copy=function(r){return gr.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};cm.prototype=Object.create(gr.prototype);cm.prototype.constructor=cm;cm.prototype.isLineDashedMaterial=!0;cm.prototype.copy=function(r){return gr.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};COe=Object.freeze({ShadowMaterial:c0,SpriteMaterial:rm,RawShaderMaterial:f0,ShaderMaterial:Ea,PointsMaterial:eu,MultiMaterial:fb,MeshPhysicalMaterial:om,MeshStandardMaterial:Xu,MeshPhongMaterial:tu,MeshToonMaterial:sm,MeshNormalMaterial:lm,MeshLambertMaterial:um,MeshDepthMaterial:qh,MeshBasicMaterial:vo,LineDashedMaterial:cm,LineBasicMaterial:Fi,Material:gr}),dk={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={}}};Yo=new qk;Object.assign(pl.prototype,{load:function(r,e,t,i){r===void 0&&(r=""),this.path!==void 0&&(r=this.path+r);var n=this,a=dk.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;dk.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(Tse.prototype,{load:function(r,e,t,i){var n=this,a=[],o=new jy;o.image=a;var s=new pl(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=po),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=po),o.format=p.format,o.needsUpdate=!0,e&&e(o)},t,i);return o},setPath:function(r){return this.path=r,this}});ROe=Zk;Object.assign(Zk.prototype,{load:function(r,e,t,i){var n=this,a=new $d,o=new pl(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:Ho,a.wrapT=l.wrapT!==void 0?l.wrapT:Ho,a.magFilter=l.magFilter!==void 0?l.magFilter:po,a.minFilter=l.minFilter!==void 0?l.minFilter:Sb,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=po),a.needsUpdate=!0,e&&e(a,l))},t,i),a}});Object.assign(Mb.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 pl;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(jk.prototype,{load:function(r,e,t,i){var n=new Xh,a=new Mb(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(EL.prototype,{load:function(r,e,t,i){var n=new ui,a=new Mb(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?Vy:Hu,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}});Bi.prototype=Object.assign(Object.create(At.prototype),{constructor:Bi,isLight:!0,copy:function(r){return At.prototype.copy.call(this,r),this.color.copy(r.color),this.intensity=r.intensity,this},toJSON:function(r){var e=At.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}});eL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:eL,isHemisphereLight:!0,copy:function(r){return Bi.prototype.copy.call(this,r),this.groundColor.copy(r.groundColor),this}});Object.assign(ym.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}});tL.prototype=Object.assign(Object.create(ym.prototype),{constructor:tL,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())}});rL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:rL,isSpotLight:!0,copy:function(r){return Bi.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}});iL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:iL,isPointLight:!0,copy:function(r){return Bi.prototype.copy.call(this,r),this.distance=r.distance,this.decay=r.decay,this.shadow=r.shadow.clone(),this}});nL.prototype=Object.assign(Object.create(ym.prototype),{constructor:nL});aL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:aL,isDirectionalLight:!0,copy:function(r){return Bi.prototype.copy.call(this,r),this.target=r.target.clone(),this.shadow=r.shadow.clone(),this}});oL.prototype=Object.assign(Object.create(Bi.prototype),{constructor:oL,isAmbientLight:!0});ia={arraySlice:function(r,e,t){return ia.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)}}};mo.prototype={constructor:mo,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(mo.prototype,{beforeStart_:mo.prototype.copySampleValue_,afterEnd_:mo.prototype.copySampleValue_});sL.prototype=Object.assign(Object.create(mo.prototype),{constructor:sL,DefaultSettings_:{endingStart:Jd,endingEnd:Jd},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 Xd:n=r,o=2*e-t;break;case IM: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 Xd:a=r,s=2*t-e;break;case IM: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}});hb.prototype=Object.assign(Object.create(mo.prototype),{constructor:hb,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}});lL.prototype=Object.assign(Object.create(mo.prototype),{constructor:lL,interpolate_:function(r,e,t,i){return this.copySampleValue_(r-1)}});rf={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:AM,InterpolantFactoryMethodDiscrete:function(r){return new lL(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodLinear:function(r){return new hb(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodSmooth:function(r){return new sL(this.times,this.values,this.getValueSize(),r)},setInterpolation:function(r){var e;switch(r){case PM:e=this.InterpolantFactoryMethodDiscrete;break;case AM:e=this.InterpolantFactoryMethodLinear;break;case GR: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 PM;case this.InterpolantFactoryMethodLinear:return AM;case this.InterpolantFactoryMethodSmooth:return GR}},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=ia.arraySlice(t,n,a),this.values=ia.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&&ia.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()===GR,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=ia.arraySlice(r,0,n),this.values=ia.arraySlice(e,0,n*t)),this}};h0.prototype=Object.assign(Object.create(rf),{constructor:h0,ValueTypeName:"vector"});uL.prototype=Object.assign(Object.create(mo.prototype),{constructor:uL,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)cn.slerpFlat(n,0,a,s-o,a,s,l);return n}});pb.prototype=Object.assign(Object.create(rf),{constructor:pb,ValueTypeName:"quaternion",DefaultInterpolation:AM,InterpolantFactoryMethodLinear:function(r){return new uL(this.times,this.values,this.getValueSize(),r)},InterpolantFactoryMethodSmooth:void 0});p0.prototype=Object.assign(Object.create(rf),{constructor:p0,ValueTypeName:"number"});cL.prototype=Object.assign(Object.create(rf),{constructor:cL,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:PM,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});fL.prototype=Object.assign(Object.create(rf),{constructor:fL,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:PM,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});hL.prototype=Object.assign(Object.create(rf),{constructor:hL,ValueTypeName:"color"});fm.prototype=rf;rf.constructor=fm;Object.assign(fm,{parse:function(r){if(r.type===void 0)throw new Error("track type undefined, can not parse");var e=fm._getTrackTypeForValueTypeName(r.type);if(r.times===void 0){var t=[],i=[];ia.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:ia.convertArray(r.times,Array),values:ia.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 p0;case"vector":case"vector2":case"vector3":case"vector4":return h0;case"color":return hL;case"quaternion":return pb;case"bool":case"boolean":return fL;case"string":return cL}throw new Error("Unsupported typeName: "+r)}});Go.prototype={constructor:Go,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(Go,{parse:function(r){for(var e=[],t=r.tracks,i=1/(r.fps||1),n=0,a=t.length;n!==a;++n)e.push(fm.parse(t[n]).scale(i));return new Go(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(fm.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=ia.getKeyframeOrder(s);s=ia.sortedArray(s,1,u),l=ia.sortedArray(l,1,u),!i&&s[0]===0&&(s.push(n),l.push(l[0])),a.push(new p0(".morphTargetInfluences["+e[o].name+"]",s,l).scale(1/t))}return new Go(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(Go.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=[];ia.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 p0(".morphTargetInfluence["+p+"]",d,g))}a=c.length*(o||1)}else{var v=".bones["+e[l].name+"]";t(h0,v+".position",u,"pos",i),t(pb,v+".quaternion",u,"rot",i),t(h0,v+".scale",u,"scl",i)}}if(i.length===0)return null;var _=new Go(n,a,i);return _}});Object.assign(AL.prototype,{load:function(r,e,t,i){var n=this,a=new pl(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 COe[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 Mt().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(Kk.prototype,{load:function(r,e,t,i){var n=this,a=new pl(n.manager);a.load(r,function(o){e(n.parse(JSON.parse(o)))},t,i)},parse:function(r){var e=new Vt,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 yt(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 yt(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 na(p,h.radius)}return e}});Zd.prototype={constructor:Zd,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 Wt),e===void 0&&(e=new EL),t===void 0&&(t=new AL);var s={};function l(h,p,d,g,m){var v=a+h,_=Zd.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=Kc),p[1]!==1&&(y.wrapT=Kc)),d!==void 0&&y.offset.fromArray(d),g!==void 0&&(g[0]==="repeat"&&(y.wrapS=Kc),g[0]==="mirror"&&(y.wrapS=Kd),g[1]==="repeat"&&(y.wrapT=Kc),g[1]==="mirror"&&(y.wrapT=Kd)),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=Soe[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=Wh;break;case"doubleSided":u.side=T0;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=gm),f==="face"&&(u.vertexColors=Lk);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)}}()};Zd.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(Jk.prototype,{load:function(r,e,t,i){var n=this,a=this.texturePath&&typeof this.texturePath=="string"?this.texturePath:Zd.prototype.extractUrlBase(r),o=new pl(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 sr,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,P,U,B,z,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 Xo,A.a=J[d],A.b=J[d+1],A.c=J[d+3],P=new Xo,P.a=J[d+1],P.b=J[d+2],P.c=J[d+3],d+=4,S&&(y=J[d++],A.materialIndex=y,P.materialIndex=y),p=t.faces.length,w)for(f=0;f<ae;f++)for(z=r.uvs[f],t.faceVertexUvs[f][p]=[],t.faceVertexUvs[f][p+1]=[],h=0;h<4;h++)_=J[d++],G=z[_*2],Y=z[_*2+1],k=new Mt(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]),P.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&&P.vertexNormals.push(B);if(b&&(m=J[d++],U=K[m],A.color.setHex(U),P.color.setHex(U)),E)for(f=0;f<4;f++)m=J[d++],U=K[m],f!==2&&A.vertexColors.push(new Wt(U)),f!==0&&P.vertexColors.push(new Wt(U));t.faces.push(A),t.faces.push(P)}else{if(R=new Xo,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(z=r.uvs[f],t.faceVertexUvs[f][p]=[],h=0;h<3;h++)_=J[d++],G=z[_*2],Y=z[_*2+1],k=new Mt(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 Wt(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 ii(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 ii(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=Go.parseAnimation(c[f],t.bones);h&&u.push(h)}if(t.morphTargets){var p=Go.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=Zd.prototype.initMaterials(r.materials,e,this.crossOrigin);return{geometry:t,materials:l}}});Object.assign(Ese.prototype,{load:function(r,e,t,i){this.texturePath===""&&(this.texturePath=r.substring(0,r.lastIndexOf("/")+1));var n=this,a=new pl(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 Jk,i=new Kk,n=0,a=r.length;n<a;n++){var o,s=r[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Ql[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Ql[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Ql[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Ql[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 Ql[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Ql[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 Ql[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Ql[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Ql[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Ql[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Ql[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 AL;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=Go.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 qk(e),o=new Mb(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 ui(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,Xoe)),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],rk),s.wrapT=t(o.wrap[1],rk)),o.minFilter!==void 0&&(s.minFilter=t(o.minFilter,ik)),o.magFilter!==void 0&&(s.magFilter=t(o.magFilter,ik)),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 jt;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 tm,t.background!==void 0&&Number.isInteger(t.background)&&(a.background=new Wt(t.background)),t.fog!==void 0&&(t.fog.type==="Fog"?a.fog=new qy(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(a.fog=new Yy(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":a=new ra(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 Xy(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":a=new oL(t.color,t.intensity);break;case"DirectionalLight":a=new aL(t.color,t.intensity);break;case"PointLight":a=new iL(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":a=new rL(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":a=new eL(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 JR(l,u):a=new yn(l,u);break;case"LOD":a=new WM;break;case"Line":a=new Qc(o(t.geometry),s(t.material),t.mode);break;case"LineSegments":a=new mi(o(t.geometry),s(t.material));break;case"PointCloud":case"Points":a=new Zy(o(t.geometry),s(t.material));break;case"Sprite":a=new HM(s(t.material));break;case"Group":a=new XM;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new At}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}}()});oa.prototype={constructor:oa,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 jt,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}}};oa.create=function(r,e){return r.prototype=Object.create(oa.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};Yu.prototype=Object.create(oa.prototype);Yu.prototype.constructor=Yu;Yu.prototype.isLineCurve=!0;Yu.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};Yu.prototype.getPointAt=function(r){return this.getPoint(r)};Yu.prototype.getTangent=function(r){var e=this.v2.clone().sub(this.v1);return e.normalize()};db.prototype=Object.assign(Object.create(oa.prototype),{constructor:db,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 Yu(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 sr,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}});tf.prototype=Object.create(oa.prototype);tf.prototype.constructor=tf;tf.prototype.isEllipseCurve=!0;tf.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 Mt(a,o)};bb={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}};hm.prototype=Object.create(oa.prototype);hm.prototype.constructor=hm;hm.prototype.isSplineCurve=!0;hm.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=bb.interpolate;return new Mt(u(a.x,o.x,s.x,l.x,n),u(a.y,o.y,s.y,l.y,n))};pm.prototype=Object.create(oa.prototype);pm.prototype.constructor=pm;pm.prototype.getPoint=function(r){var e=Fn.b3;return new Mt(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))};pm.prototype.getTangent=function(r){var e=bb.tangentCubicBezier;return new Mt(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()};dm.prototype=Object.create(oa.prototype);dm.prototype.constructor=dm;dm.prototype.getPoint=function(r){var e=Fn.b2;return new Mt(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y))};dm.prototype.getTangent=function(r){var e=bb.tangentQuadraticBezier;return new Mt(e(r,this.v0.x,this.v1.x,this.v2.x),e(r,this.v0.y,this.v1.y,this.v2.y)).normalize()};$k=Object.assign(Object.create(db.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 Yu(this.currentPoint.clone(),new Mt(r,e));this.curves.push(t),this.currentPoint.set(r,e)},quadraticCurveTo:function(r,e,t,i){var n=new dm(this.currentPoint.clone(),new Mt(r,e),new Mt(t,i));this.curves.push(n),this.currentPoint.set(t,i)},bezierCurveTo:function(r,e,t,i,n,a){var o=new pm(this.currentPoint.clone(),new Mt(r,e),new Mt(t,i),new Mt(n,a));this.curves.push(o),this.currentPoint.set(n,a)},splineThru:function(r){var e=[this.currentPoint.clone()].concat(r),t=new hm(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 tf(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)}});jd.prototype=Object.assign(Object.create($k),{constructor:jd,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)}});wb.prototype=$k;$k.constructor=wb;Qk.prototype={moveTo:function(r,e){this.currentPath=new wb,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(P){for(var U=[],B=0,z=P.length;B<z;B++){var k=P[B],G=new jd;G.curves=k.curves,U.push(G)}return U}function i(P,U){for(var B=U.length,z=!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),P.y<Y.y||P.y>J.y)continue;if(P.y===Y.y){if(P.x===Y.x)return!0}else{var K=V*(P.x-Y.x)-Q*(P.y-Y.y);if(K===0)return!0;if(K<0)continue;z=!z}}else{if(P.y!==Y.y)continue;if(J.x<=P.x&&P.x<=Y.x||Y.x<=P.x&&P.x<=J.x)return!0}}return z}var n=Fn.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 jd,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 jd,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(eV.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 Qk,g=[],m=Fn.b2,v=Fn.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,P=R.length;A<P;){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 z=B/t;m(z,S,T,x),m(z,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 z=B/t;v(z,S,T,b,x),v(z,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(Ase.prototype,{load:function(r,e,t,i){var n=this,a=new pl(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 eV(r)}});tV={getContext:function(){return kR===void 0&&(kR=new(window.AudioContext||window.webkitAudioContext)),kR},setContext:function(r){kR=r}};Object.assign(rV.prototype,{load:function(r,e,t,i){var n=new pl(this.manager);n.setResponseType("arraybuffer"),n.load(r,function(a){var o=tV.getContext();o.decodeAudioData(a,function(s){e(s)})},t,i)}});mk.prototype=Object.assign(Object.create(Bi.prototype),{constructor:mk,isRectAreaLight:!0,copy:function(r){return Bi.prototype.copy.call(this,r),this.width=r.width,this.height=r.height,this}});Object.assign(Cse.prototype,{update:function(){var r,e,t,i,n,a,o,s=new jt,l=new jt;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)}}()});pL.prototype=Object.create(At.prototype);pL.prototype.constructor=pL;vk.prototype=Object.assign(Object.create(At.prototype),{constructor:vk,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 cn,t=new oe,i=new oe;return function(a){At.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))}}()});d0.prototype=Object.assign(Object.create(At.prototype),{constructor:d0,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}});gk.prototype=Object.assign(Object.create(d0.prototype),{constructor:gk,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){At.prototype.updateMatrixWorld.call(this,t),r.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(r.x,r.y,r.z)}}()});Object.assign(iV.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}});dL.prototype={constructor:dL,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){cn.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}}};Di.prototype={constructor:Di,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=Di.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(Di.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:Di.prototype.getValue,_setValue_unbound:Di.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}]]});Di.Composite=function(r,e,t){var i=t||Di.parseTrackName(e);this._targetGroup=r,this._bindings=r.subscribe_(e,i)};Di.Composite.prototype={constructor:Di.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()}};Di.create=function(r,e,t){return r&&r.isAnimationObjectGroup?new Di.Composite(r,e,t):new Di(r,e,t)};Di.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};Di.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};yk.prototype={constructor:yk,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 Di(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 Di(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 Di(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()}}};_k.prototype={constructor:_k,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===rse){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===nse;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=Xd,i.endingEnd=Xd):(r?i.endingStart=this.zeroSlopeAtStart?Xd:Jd:i.endingStart=IM,e?i.endingEnd=this.zeroSlopeAtEnd?Xd:Jd:i.endingEnd=IM)},_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(nV.prototype,cl.prototype,{clipAction:function(r,e){var t=e||this._root,i=t.uuid,n=typeof r=="string"?Go.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 _k(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"?Go.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(nV.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 dL(Di.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 hb(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)});mL.prototype.clone=function(){return new mL(this.value.clone===void 0?this.value:this.value.clone())};mm.prototype=Object.create(Vt.prototype);mm.prototype.constructor=mm;mm.prototype.isInstancedBufferGeometry=!0;mm.prototype.addGroup=function(r,e,t){this.groups.push({start:r,count:e,materialIndex:t})};mm.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};xk.prototype={constructor:xk,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}};m0.prototype={constructor:m0,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}};v0.prototype=Object.create(m0.prototype);v0.prototype.constructor=v0;v0.prototype.isInstancedInterleavedBuffer=!0;v0.prototype.copy=function(r){return m0.prototype.copy.call(this,r),this.meshPerAttribute=r.meshPerAttribute,this};g0.prototype=Object.create(yt.prototype);g0.prototype.constructor=g0;g0.prototype.isInstancedBufferAttribute=!0;g0.prototype.copy=function(r){return yt.prototype.copy.call(this,r),this.meshPerAttribute=r.meshPerAttribute,this};Sk.prototype={constructor:Sk,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 Mk(r,this,t,e),t.sort(voe),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++)Mk(r[i],this,t,e);return t.sort(voe),t}};bk.prototype={constructor:bk,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}};wk.prototype={constructor:wk,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}};Tk.prototype={constructor:Tk,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}};Bn.prototype=Object.create(yn.prototype);Bn.prototype.constructor=Bn;Bn.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)};Bn.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};Bn.prototype.setAnimationDirectionForward=function(r){var e=this.animationsMap[r];e&&(e.direction=1,e.directionBackwards=!1)};Bn.prototype.setAnimationDirectionBackward=function(r){var e=this.animationsMap[r];e&&(e.direction=-1,e.directionBackwards=!0)};Bn.prototype.setAnimationFPS=function(r,e){var t=this.animationsMap[r];t&&(t.fps=e,t.duration=(t.end-t.start)/t.fps)};Bn.prototype.setAnimationDuration=function(r,e){var t=this.animationsMap[r];t&&(t.duration=e,t.fps=(t.end-t.start)/t.duration)};Bn.prototype.setAnimationWeight=function(r,e){var t=this.animationsMap[r];t&&(t.weight=e)};Bn.prototype.setAnimationTime=function(r,e){var t=this.animationsMap[r];t&&(t.time=e)};Bn.prototype.getAnimationTime=function(r){var e=0,t=this.animationsMap[r];return t&&(e=t.time),e};Bn.prototype.getAnimationDuration=function(r){var e=-1,t=this.animationsMap[r];return t&&(e=t.duration),e};Bn.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()")};Bn.prototype.stopAnimation=function(r){var e=this.animationsMap[r];e&&(e.active=!1)};Bn.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}}};mb.prototype=Object.create(At.prototype);mb.prototype.constructor=mb;mb.prototype.isImmediateRenderObject=!0;vb.prototype=Object.create(mi.prototype);vb.prototype.constructor=vb;vb.prototype.update=function(){var r=new oe,e=new oe,t=new fl;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}}();y0.prototype=Object.create(At.prototype);y0.prototype.constructor=y0;y0.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()};y0.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)}}();_0.prototype=Object.create(mi.prototype);_0.prototype.constructor=_0;_0.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};_0.prototype.update=function(){var r=new oe,e=new jt,t=new jt;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}}();x0.prototype=Object.create(yn.prototype);x0.prototype.constructor=x0;x0.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()};x0.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};S0.prototype=Object.create(At.prototype);S0.prototype.constructor=S0;S0.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose(),this.children[1].geometry.dispose(),this.children[1].material.dispose()};S0.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}}();M0.prototype=Object.create(At.prototype);M0.prototype.constructor=M0;M0.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()};M0.prototype.update=function(){var r=new oe,e=new Wt,t=new Wt;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}}();gb.prototype=Object.create(mi.prototype);gb.prototype.constructor=gb;vL.prototype=Object.create(mi.prototype);vL.prototype.constructor=vL;yb.prototype=Object.create(mi.prototype);yb.prototype.constructor=yb;yb.prototype.update=function(){var r=new oe,e=new oe,t=new fl;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}}();b0.prototype=Object.create(At.prototype);b0.prototype.constructor=b0;b0.prototype.dispose=function(){var r=this.children[0],e=this.children[1];r.geometry.dispose(),r.material.dispose(),e.geometry.dispose(),e.material.dispose()};b0.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()}}();_b.prototype=Object.create(mi.prototype);_b.prototype.constructor=_b;_b.prototype.update=function(){var r,e,t=new oe,i=new aa;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}}();w0.prototype=Object.create(mi.prototype);w0.prototype.constructor=w0;w0.prototype.update=function(){var r=new Wu;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()}}}();Rse=new Vt;Rse.addAttribute("position",new xr([0,0,0,0,1,0],3));Lse=new ef(0,.5,1,5,1);Lse.translate(0,-.5,0);vm.prototype=Object.create(At.prototype);vm.prototype.constructor=vm;vm.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))}}();vm.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()};vm.prototype.setColor=function(r){this.line.material.color.copy(r),this.cone.material.color.copy(r)};gL.prototype=Object.create(mi.prototype);gL.prototype.constructor=gL;aV=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},oa.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})}(),DOe=oa.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=bb.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))}),POe=oa.create(function(r,e,t,i){this.v0=r,this.v1=e,this.v2=t,this.v3=i},function(r){var e=Fn.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))}),IOe=oa.create(function(r,e,t){this.v0=r,this.v1=e,this.v2=t},function(r){var e=Fn.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))}),NOe=oa.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});yL.prototype=Object.create(tf.prototype);yL.prototype.constructor=yL;UOe={createMultiMaterialObject:function(r,e){for(var t=new XM,i=0,n=e.length;i<n;i++)t.add(new yn(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 jt;i.getInverse(t.matrixWorld),r.applyMatrix(i),e.remove(r),t.add(r)}};zOe=0,FOe=1;Dse.prototype=Object.create(aV.prototype);gb.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Object.assign(UM.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(Wu.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)}});qd.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(fl.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(jt.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)}});Vo.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)};cn.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(Zh.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(jd.prototype,{extrude:function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new hl(this,r)},makeGeometry:function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new s0(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)}});sr.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")};Object.assign(At.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(At.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(WM.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}});ra.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(Bi.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(yt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}});Object.assign(Vt.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(Vt.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(mL.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(gr.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 Wt}}});Object.defineProperties(tu.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(Ea.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}}});cl.prototype=Object.assign(Object.create({constructor:cl,apply:function(r){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(r,this)}}),cl.prototype);Object.assign(Yk.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(Yk.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(Mse.prototype,{cullFace:{get:function(){return this.renderReverseSided?Ek:CM},set:function(r){var e=r!==CM;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}});Object.defineProperties(A0.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}}});d0.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this,t=new rV;return t.load(r,function(i){e.setBuffer(i)}),this};iV.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};s3e={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()}},l3e={crossOrigin:void 0,loadTexture:function(r,e,t,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new EL;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 jk;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 Ose=Gse(CL=>{"use strict";var f3e=CL&&CL.__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)},Gr=(Ise(),Wse(Pse)),bi={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},Nse={type:"change"},oV={type:"start"},sV={type:"end"},Use=1e-6,h3e=function(r){f3e(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 Gr.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:Gr.MOUSE.LEFT,ZOOM:Gr.MOUSE.MIDDLE,PAN:Gr.MOUSE.RIGHT},a.target0=a.target.clone(),a.position0=a.object.position.clone(),a.zoom0=a.object.zoom,a.updateOffset=new Gr.Vector3,a.updateQuat=new Gr.Quaternion().setFromUnitVectors(t.up,new Gr.Vector3(0,1,0)),a.updateQuatInverse=a.updateQuat.clone().inverse(),a.updateLastPosition=new Gr.Vector3,a.updateLastQuaternion=new Gr.Quaternion,a.state=bi.NONE,a.scale=1,a.spherical=new Gr.Spherical,a.sphericalDelta=new Gr.Spherical,a.panOffset=new Gr.Vector3,a.zoomChanged=!1,a.rotateStart=new Gr.Vector2,a.rotateEnd=new Gr.Vector2,a.rotateDelta=new Gr.Vector2,a.panStart=new Gr.Vector2,a.panEnd=new Gr.Vector2,a.panDelta=new Gr.Vector2,a.dollyStart=new Gr.Vector2,a.dollyEnd=new Gr.Vector2,a.dollyDelta=new Gr.Vector2,a.panLeftV=new Gr.Vector3,a.panUpV=new Gr.Vector3,a.panInternalOffset=new Gr.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=bi.ROTATE}else if(o.button===a.mouseButtons.ZOOM){if(a.enableZoom===!1)return;a.dollyStart.set(o.clientX,o.clientY),a.state=bi.DOLLY}else if(o.button===a.mouseButtons.PAN){if(a.enablePan===!1)return;a.panStart.set(o.clientX,o.clientY),a.state=bi.PAN}a.state!==bi.NONE&&(document.addEventListener("mousemove",a.onMouseMove,!1),document.addEventListener("mouseup",a.onMouseUp,!1),a.dispatchEvent(oV))}},a.onMouseMove=function(o){if(a.enabled!==!1){if(o.preventDefault(),a.state===bi.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===bi.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===bi.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(sV),a.state=bi.NONE)},a.onMouseWheel=function(o){a.enabled===!1||a.enableZoom===!1||a.state!==bi.NONE&&a.state!==bi.ROTATE||(o.preventDefault(),o.stopPropagation(),o.deltaY<0?a.dollyOut(a.getZoomScale()):o.deltaY>0&&a.dollyIn(a.getZoomScale()),a.update(),a.dispatchEvent(oV),a.dispatchEvent(sV))},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=bi.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=bi.TOUCH_DOLLY}break;case 3:{if(a.enablePan===!1)return;a.panStart.set(o.touches[0].pageX,o.touches[0].pageY),a.state=bi.TOUCH_PAN}break;default:a.state=bi.NONE}a.state!==bi.NONE&&a.dispatchEvent(oV)}},a.onTouchMove=function(o){if(a.enabled!==!1)switch(o.preventDefault(),o.stopPropagation(),o.touches.length){case 1:{if(a.enableRotate===!1||a.state!==bi.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!==bi.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!==bi.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=bi.NONE}},a.onTouchEnd=function(o){a.enabled!==!1&&(a.dispatchEvent(sV),a.state=bi.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===bi.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)>Use||8*(1-this.updateLastQuaternion.dot(this.object.quaternion))>Use?(this.dispatchEvent(Nse),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 Gr.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 Gr.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 Gr.PerspectiveCamera?this.scale/=t:this.object instanceof Gr.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 Gr.PerspectiveCamera?this.scale*=t:this.object instanceof Gr.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(Nse),this.update(),this.state=bi.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}(Gr.EventDispatcher);CL.OrbitControls=h3e});var HL=function(r,e){return HL=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])},HL(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");HL(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Xse=function(){function r(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return r}(),Yse=function(){function r(){this.browser=new Xse,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}(),tp=new Yse;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(tp.wxa=!0,tp.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?tp.worker=!0:typeof navigator>"u"||navigator.userAgent.indexOf("Node.js")===0?(tp.node=!0,tp.svgSupported=!0):qse(navigator.userAgent,tp);function qse(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 Bt=tp;var zb=12,WL="sans-serif",yo=zb+"px "+WL,Zse=20,jse=100,Kse="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function Jse(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)-Zse)/jse;e[i]=n}return e}var $se=Jse(Kse),kn={createCanvas:function(){return typeof document<"u"&&document.createElement("canvas")},measureText:function(){var r,e;return function(t,i){if(!r){var n=kn.createCanvas();r=n&&n.getContext("2d")}if(r)return e!==i&&(e=r.font=i||yo),r.measureText(t);t=t||"",i=i||yo;var a=/(\d+)px/.exec(i),o=a&&+a[1]||zb,s=0;if(i.indexOf("mono")>=0)s=o*t.length;else for(var l=0;l<t.length;l++){var u=$se[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 kV=_n(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(r,e){return r["[object "+e+"]"]=!0,r},{}),VV=_n(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(r,e){return r["[object "+e+"Array]"]=!0,r},{}),bm=Object.prototype.toString,Bb=Array.prototype,Qse=Bb.forEach,ele=Bb.filter,XL=Bb.slice,tle=Bb.map,FV=(function(){}).constructor,Fb=FV?FV.prototype:null,YL="__proto__",rle=2311;function kb(){return rle++}function rp(){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=bm.call(r);if(t==="[object Array]"){if(!F0(r)){e=[];for(var i=0,n=r.length;i<n;i++)e[i]=Qe(r[i])}}else if(VV[t]){if(!F0(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(!kV[t]&&!F0(r)&&!uf(r)){e={};for(var o in r)r.hasOwnProperty(o)&&o!==YL&&(e[o]=Qe(r[o]))}return e}function xt(r,e,t){if(!qe(e)||!qe(r))return t?Qe(e):r;for(var i in e)if(e.hasOwnProperty(i)&&i!==YL){var n=r[i],a=e[i];qe(a)&&qe(n)&&!pe(a)&&!pe(n)&&!uf(a)&&!uf(n)&&!BV(a)&&!BV(n)&&!F0(a)&&!F0(n)?xt(n,a,t):(t||!(i in r))&&(r[i]=Qe(e[i]))}return r}function wm(r,e){for(var t=r[0],i=1,n=r.length;i<n;i++)t=xt(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!==YL&&(r[t]=e[t]);return r}function Ye(r,e,t){for(var i=wt(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 _3e=kn.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 GV(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 fi(r){return!r||typeof r=="string"?!1:typeof r.length=="number"}function N(r,e,t){if(r&&e)if(r.forEach&&r.forEach===Qse)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 Vb(r);if(r.map&&r.map===tle)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 _n(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 Yt(r,e,t){if(!r)return[];if(!e)return Vb(r);if(r.filter&&r.filter===ele)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 HV(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 wt(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 ile(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];return function(){return r.apply(e,t.concat(XL.call(arguments)))}}var Be=Fb&&He(Fb.bind)?Fb.call.bind(Fb.bind):ile;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(XL.call(arguments)))}}function pe(r){return Array.isArray?Array.isArray(r):bm.call(r)==="[object Array]"}function He(r){return typeof r=="function"}function Ce(r){return typeof r=="string"}function B0(r){return bm.call(r)==="[object String]"}function Ct(r){return typeof r=="number"}function qe(r){var e=typeof r;return e==="function"||!!r&&e==="object"}function BV(r){return!!kV[bm.call(r)]}function Ti(r){return!!VV[bm.call(r)]}function uf(r){return typeof r=="object"&&typeof r.nodeType=="number"&&typeof r.ownerDocument=="object"}function cf(r){return r.colorStops!=null}function WV(r){return r.image!=null}function XV(r){return bm.call(r)==="[object RegExp]"}function ff(r){return r!==r}function Hr(){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 qi(r,e,t){return r??e??t}function Vb(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return XL.apply(r,e)}function Tm(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 Wr(r,e){if(!r)throw new Error(e)}function Zi(r){return r==null?null:typeof r.trim=="function"?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}var YV="__ec_primitive__";function ip(r){r[YV]=!0}function F0(r){return r[YV]}var nle=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 wt(this.data)},r.prototype.forEach=function(e){var t=this.data;for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},r}(),qV=typeof Map=="function";function ale(){return qV?new Map:new nle}var ole=function(){function r(e){var t=pe(e);this.data=ale();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 qV?Array.from(e):e},r.prototype.removeKey=function(e){this.data.delete(e)},r}();function ke(r){return new ole(r)}function np(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 hf(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 Gb(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 Ur(){}var Em=180/Math.PI;var qL=function(r,e){return qL=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])},qL(r,e)};function qt(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");qL(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function au(r,e){return r==null&&(r=0),e==null&&(e=0),[r,e]}function ji(r,e){return r[0]=e[0],r[1]=e[1],r}function Pa(r){return[r[0],r[1]]}function ZV(r,e,t){return r[0]=e,r[1]=t,r}function ZL(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function k0(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r}function ml(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function Hb(r){return Math.sqrt(sle(r))}function sle(r){return r[0]*r[0]+r[1]*r[1]}function Am(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function Es(r,e){var t=Hb(e);return t===0?(r[0]=0,r[1]=0):(r[0]=e[0]/t,r[1]=e[1]/t),r}function Wb(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}var As=Wb;function lle(r,e){return(r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1])}var Ku=lle;function Cm(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 hi(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 _o(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function xo(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}var Rm=function(){function r(e,t){this.target=e,this.topTarget=t&&t.topTarget}return r}(),ule=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 Rm(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 Rm(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 Rm(l,e),"dragleave",e.event),s&&s!==l&&this.handler.dispatchToElement(new Rm(s,e),"dragenter",e.event))}},r.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new Rm(t,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new Rm(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},r}(),jV=ule;var cle=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}(),Ni=cle;var fle=Math.log(2);function jL(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)/fle);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]*jL(r,e-1,c,u,n|d,a),p++)}return a[o]=f,f}function KL(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=jL(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)*jL(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 KV="___zrEVENTSAVED",JL=[];function JV(r,e,t,i,n){return Xb(JL,e,i,n,!0)&&Xb(r,t,JL[0],JL[1])}function Xb(r,e,t,i,n){if(e.getBoundingClientRect&&Bt.domSupported&&!$L(e)){var a=e[KV]||(e[KV]={}),o=hle(e,a),s=ple(o,a,n);if(s)return s(r,t,i),!0}return!1}function hle(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 ple(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?KL(s,o):KL(o,s))}function $L(r){return r.nodeName.toUpperCase()==="CANVAS"}var dle=/([&<>"'])/g,mle={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function xn(r){return r==null?"":(r+"").replace(dle,function(e,t){return mle[t]})}var vle=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,QL=[],gle=Bt.browser.firefox&&+Bt.browser.version.split(".")[0]<39;function Yb(r,e,t,i){return t=t||{},i?$V(r,e,t):gle&&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):$V(r,e,t),t}function $V(r,e,t){if(Bt.domSupported&&r.getBoundingClientRect){var i=e.clientX,n=e.clientY;if($L(r)){var a=r.getBoundingClientRect();t.zrX=i-a.left,t.zrY=n-a.top;return}else if(Xb(QL,r,i,n)){t.zrX=QL[0],t.zrY=QL[1];return}}t.zrX=t.zrY=0}function qb(r){return r||window.event}function Ia(r,e,t){if(e=qb(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&&Yb(r,o,e,t)}else{Yb(r,e,e,t);var a=yle(e);e.zrDelta=a?a/120:-(e.detail||0)/3}var s=e.button;return e.which==null&&s!==void 0&&vle.test(e.type)&&(e.which=s&1?1:s&2?3:s&4?2:0),e}function yle(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 V0(r,e,t,i){r.addEventListener(e,t,i)}function QV(r,e,t,i){r.removeEventListener(e,t,i)}var Na=function(r){r.preventDefault(),r.stopPropagation(),r.cancelBubble=!0};function e2(r){return r.which===2||r.which===3}var tG=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=Yb(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 t2)if(t2.hasOwnProperty(t)){var i=t2[t](this._track,e);if(i)return i}},r}();function eG(r){var e=r[1][0]-r[0][0],t=r[1][1]-r[0][1];return Math.sqrt(e*e+t*t)}function _le(r){return[(r[0][0]+r[1][0])/2,(r[0][1]+r[1][1])/2]}var t2={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=eG(i)/eG(n);!isFinite(a)&&(a=1),e.pinchScale=a;var o=_le(i);return e.pinchX=o[0],e.pinchY=o[1],{type:"pinch",target:r[0].target,event:e}}}}};function Ei(){return[1,0,0,1,0,0]}function pf(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function G0(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 Ua(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 Sn(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 Oa(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 Dm(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 Cs(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 rG(r){var e=Ei();return G0(e,r),e}var xle=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}(),zt=xle;var Zb=Math.min,jb=Math.max,ap=new zt,op=new zt,sp=new zt,lp=new zt,H0=new zt,W0=new zt,Sle=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=Zb(e.x,this.x),i=Zb(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=jb(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=jb(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=Ei();return Sn(a,a,[-t.x,-t.y]),Dm(a,a,[i,n]),Sn(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?zt.set(W0,-g,0):zt.set(W0,m,0)):y<p&&(p=y,g<m?zt.set(H0,g,0):zt.set(H0,-m,0)),s<c||f<o?x>d&&(d=x,v<_?zt.set(W0,0,-v):zt.set(W0,0,_)):y<p&&(p=y,v<_?zt.set(H0,0,v):zt.set(H0,0,-_))}return t&&zt.copy(t,h?H0:W0),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}ap.x=sp.x=t.x,ap.y=lp.y=t.y,op.x=lp.x=t.x+t.width,op.y=sp.y=t.y+t.height,ap.transform(i),lp.transform(i),op.transform(i),sp.transform(i),e.x=Zb(ap.x,op.x,sp.x,lp.x),e.y=Zb(ap.y,op.y,sp.y,lp.y);var l=jb(ap.x,op.x,sp.x,lp.x),u=jb(ap.y,op.y,sp.y,lp.y);e.width=l-e.x,e.height=u-e.y},r}(),lt=Sle;var nG="silent";function Mle(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:ble}}function ble(){Na(this.event)}var wle=function(r){qt(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}(Ni),X0=function(){function r(e,t){this.x=e,this.y=t}return r}(),Tle=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],r2=new lt(0,0,0,0),aG=function(r){qt(e,r);function e(t,i,n,a,o){var s=r.call(this)||this;return s._hovered=new X0(0,0),s.storage=t,s.painter=i,s.painterRoot=a,s._pointerSize=o,n=n||new wle,s.proxy=null,s.setHandlerProxy(n),s._draggingMgr=new jV(s),s}return e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(N(Tle,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=oG(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 X0(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 X0(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=Mle(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 X0(t,i);if(iG(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)&&(r2.copy(h.getBoundingRect()),h.transform&&r2.applyTransform(h.transform),r2.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(iG(s,o,_,y,n),o.target)return o}}return o},e.prototype.processGesture=function(t,i){this._gestureMgr||(this._gestureMgr=new tG);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 X0;s.target=a.target,this.dispatchToElement(s,o,a.event)}},e}(Ni);N(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(r){aG.prototype[r]=function(e){var t=e.zrX,i=e.zrY,n=oG(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||As(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(a,r,e)}});function Ele(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?nG:!0}return!1}function iG(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=Ele(o,t,i))&&(!e.topTarget&&(e.topTarget=o),s!==nG)){e.target=o;break}}}function oG(r,e,t){var i=r.painter;return e<0||e>i.getWidth()||t<0||t>i.getHeight()}var sG=aG;var cG=32,Y0=7;function Ale(r){for(var e=0;r>=cG;)e|=r&1,r>>=1;return r+e}function lG(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++;Cle(r,e,n)}else for(;n<t&&i(r[n],r[n-1])>=0;)n++;return n-e}function Cle(r,e,t){for(t--;e<t;){var i=r[e];r[e++]=r[t],r[t--]=i}}function uG(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 i2(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 n2(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 Rle(r,e){var t=Y0,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 _=n2(r[m],r,d,g,0,e);d+=_,g-=_,g!==0&&(v=i2(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=n2(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=i2(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>=Y0||w>=Y0);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-n2(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-i2(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>=Y0||C>=Y0);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 up(r,e,t,i){t||(t=0),i||(i=r.length);var n=i-t;if(!(n<2)){var a=0;if(n<cG){a=lG(r,t,i,e),uG(r,t,i,t+a,e);return}var o=Rle(r,e),s=Ale(n);do{if(a=lG(r,t,i,e),a<s){var l=n;l>s&&(l=s),uG(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 ki=1,cp=2,df=4;var fG=!1;function a2(){fG||(fG=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function hG(r,e){return r.zlevel===e.zlevel?r.z===e.z?r.z2-e.z2:r.z-e.z:r.zlevel-e.zlevel}var Lle=function(){function r(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=hG}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,up(i,hG)},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|=ki),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)&&(a2(),c.z=0),isNaN(c.z2)&&(a2(),c.z2=0),isNaN(c.zlevel)&&(a2(),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}(),pG=Lle;var dG;dG=Bt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(r){return setTimeout(r,16)};var q0=dG;var Kb={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-Kb.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?Kb.bounceIn(r*2)*.5:Kb.bounceOut(r*2-1)*.5+.5}},Jb=Kb;var $b=Math.pow,vf=Math.sqrt,ew=1e-8,vG=1e-4,mG=vf(3),Qb=1/3,ou=au(),Rs=au(),Pm=au();function mf(r){return r>-ew&&r<ew}function gG(r){return r>ew||r<-ew}function pi(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 o2(r,e,t,i,n){var a=1-n;return 3*(((e-r)*a+2*(t-e)*n)*a+(i-t)*n*n)}function fp(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(mf(c)&&mf(f))if(mf(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(mf(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 _=vf(g),y=c*s+1.5*o*(-f+_),x=c*s+1.5*o*(-f-_);y<0?y=-$b(-y,Qb):y=$b(y,Qb),x<0?x=-$b(-x,Qb):x=$b(x,Qb);var d=(-s-(y+x))/(3*o);d>=0&&d<=1&&(a[p++]=d)}else{var M=(2*c*s-3*o*f)/(2*vf(c*c*c)),S=Math.acos(M)/3,w=vf(c),T=Math.cos(S),d=(-s-2*w*T)/(3*o),v=(-s+w*(T+mG*Math.sin(S)))/(3*o),C=(-s+w*(T-mG*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 tw(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(mf(o)){if(gG(a)){var u=-s/a;u>=0&&u<=1&&(n[l++]=u)}}else{var c=a*a-4*o*s;if(mf(c))n[0]=-a/(2*o);else if(c>0){var f=vf(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 Ls(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 rw(r,e,t,i,n,a,o,s,l,u,c){var f,h=.005,p=1/0,d,g,m,v;ou[0]=l,ou[1]=u;for(var _=0;_<1;_+=.05)Rs[0]=pi(r,t,n,o,_),Rs[1]=pi(e,i,a,s,_),m=Ku(ou,Rs),m<p&&(f=_,p=m);p=1/0;for(var y=0;y<32&&!(h<vG);y++)d=f-h,g=f+h,Rs[0]=pi(r,t,n,o,d),Rs[1]=pi(e,i,a,s,d),m=Ku(Rs,ou),d>=0&&m<p?(f=d,p=m):(Pm[0]=pi(r,t,n,o,g),Pm[1]=pi(e,i,a,s,g),v=Ku(Pm,ou),g<=1&&v<p?(f=g,p=v):h*=.5);return c&&(c[0]=pi(r,t,n,o,f),c[1]=pi(e,i,a,s,f)),vf(p)}function yG(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=pi(r,t,n,o,d),m=pi(e,i,a,s,d),v=g-u,_=m-c;f+=Math.sqrt(v*v+_*_),u=g,c=m}return f}function yi(r,e,t,i){var n=1-i;return n*(n*r+2*i*e)+i*i*t}function Z0(r,e,t,i){return 2*((1-i)*(e-r)+i*(t-e))}function _G(r,e,t,i,n){var a=r-2*e+t,o=2*(e-r),s=r-i,l=0;if(mf(a)){if(gG(o)){var u=-s/o;u>=0&&u<=1&&(n[l++]=u)}}else{var c=o*o-4*a*s;if(mf(c)){var u=-o/(2*a);u>=0&&u<=1&&(n[l++]=u)}else if(c>0){var f=vf(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 iw(r,e,t){var i=r+t-2*e;return i===0?.5:(r-e)/i}function gf(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 nw(r,e,t,i,n,a,o,s,l){var u,c=.005,f=1/0;ou[0]=o,ou[1]=s;for(var h=0;h<1;h+=.05){Rs[0]=yi(r,t,n,h),Rs[1]=yi(e,i,a,h);var p=Ku(ou,Rs);p<f&&(u=h,f=p)}f=1/0;for(var d=0;d<32&&!(c<vG);d++){var g=u-c,m=u+c;Rs[0]=yi(r,t,n,g),Rs[1]=yi(e,i,a,g);var p=Ku(Rs,ou);if(g>=0&&p<f)u=g,f=p;else{Pm[0]=yi(r,t,n,m),Pm[1]=yi(e,i,a,m);var v=Ku(Pm,ou);m<=1&&v<f?(u=m,f=v):c*=.5}}return l&&(l[0]=yi(r,t,n,u),l[1]=yi(e,i,a,u)),vf(f)}function xG(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=yi(r,t,n,h),d=yi(e,i,a,h),g=p-s,m=d-l;u+=Math.sqrt(g*g+m*m),s=p,l=d}return u}var Dle=/cubic-bezier\(([0-9,\.e ]+)\)/;function Im(r){var e=r&&Dle.exec(r);if(e){var t=e[1].split(","),i=+Zi(t[0]),n=+Zi(t[1]),a=+Zi(t[2]),o=+Zi(t[3]);if(isNaN(i+n+a+o))return;var s=[];return function(l){return l<=0?0:l>=1?1:fp(0,i,a,1,l,s)&&pi(0,n,o,1,s[0])}}}var Ple=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||Ur,this.ondestroy=e.ondestroy||Ur,this.onrestart=e.onrestart||Ur,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:Jb[e]||Im(e)},r}(),SG=Ple;var MG=function(){function r(e){this.value=e}return r}();var Ile=function(){function r(){this._len=0}return r.prototype.insert=function(e){var t=new MG(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 Nle=function(){function r(e){this._list=new Ile,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 MG(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}(),Ju=Nle;var bG={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 vl(r){return r=Math.round(r),r<0?0:r>255?255:r}function Ule(r){return r=Math.round(r),r<0?0:r>360?360:r}function K0(r){return r<0?0:r>1?1:r}function s2(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?vl(parseFloat(e)/100*255):vl(parseInt(e,10))}function hp(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?K0(parseFloat(e)/100):K0(parseFloat(e))}function l2(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 yf(r,e,t){return r+(e-r)*t}function Ds(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function u2(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}var TG=new Ju(20),aw=null;function Nm(r,e){aw&&u2(aw,e),aw=TG.put(r,aw||e.slice())}function hn(r,e){if(r){e=e||[];var t=TG.get(r);if(t)return u2(e,t);r=r+"";var i=r.replace(/ /g,"").toLowerCase();if(i in bG)return u2(e,bG[i]),Nm(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)){Ds(e,0,0,0,1);return}return Ds(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),Nm(r,e),e}else if(n===7||n===9){var a=parseInt(i.slice(1,7),16);if(!(a>=0&&a<=16777215)){Ds(e,0,0,0,1);return}return Ds(e,(a&16711680)>>16,(a&65280)>>8,a&255,n===9?parseInt(i.slice(7),16)/255:1),Nm(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?Ds(e,+u[0],+u[1],+u[2],1):Ds(e,0,0,0,1);c=hp(u.pop());case"rgb":if(u.length>=3)return Ds(e,s2(u[0]),s2(u[1]),s2(u[2]),u.length===3?c:hp(u[3])),Nm(r,e),e;Ds(e,0,0,0,1);return;case"hsla":if(u.length!==4){Ds(e,0,0,0,1);return}return u[3]=hp(u[3]),c2(u,e),Nm(r,e),e;case"hsl":if(u.length!==3){Ds(e,0,0,0,1);return}return c2(u,e),Nm(r,e),e;default:return}}Ds(e,0,0,0,1)}}function c2(r,e){var t=(parseFloat(r[0])%360+360)%360/360,i=hp(r[1]),n=hp(r[2]),a=n<=.5?n*(i+1):n+i-n*i,o=n*2-a;return e=e||[],Ds(e,vl(l2(o,a,t+1/3)*255),vl(l2(o,a,t)*255),vl(l2(o,a,t-1/3)*255),1),r.length===4&&(e[3]=r[3]),e}function Ole(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 ow(r,e){var t=hn(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 Ps(t,t.length===4?"rgba":"rgb")}}function sw(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]=vl(yf(o[0],s[0],l)),t[1]=vl(yf(o[1],s[1],l)),t[2]=vl(yf(o[2],s[2],l)),t[3]=K0(yf(o[3],s[3],l)),t}}function EG(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=hn(e[n]),s=hn(e[a]),l=i-n,u=Ps([vl(yf(o[0],s[0],l)),vl(yf(o[1],s[1],l)),vl(yf(o[2],s[2],l)),K0(yf(o[3],s[3],l))],"rgba");return t?{color:u,leftIndex:n,rightIndex:a,value:i}:u}}function pp(r,e,t,i){var n=hn(r);if(r)return n=Ole(n),e!=null&&(n[0]=Ule(e)),t!=null&&(n[1]=hp(t)),i!=null&&(n[2]=hp(i)),Ps(c2(n),"rgba")}function dp(r,e){var t=hn(r);if(t&&e!=null)return t[3]=K0(e),Ps(t,"rgba")}function Ps(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 Um(r,e){var t=hn(r);return t?(.299*t[0]+.587*t[1]+.114*t[2])*t[3]/255+(1-t[3])*e:0}var wG=new Ju(100);function J0(r){if(Ce(r)){var e=wG.get(r);return e||(e=ow(r,-.1),wG.put(r,e)),e}else if(cf(r)){var t=fe({},r);return t.colorStops=de(r.colorStops,function(i){return{offset:i.offset,color:ow(i.color,-.1)}}),t}return r}var uw=Math.round;function _f(r){var e;if(!r||r==="transparent")r="none";else if(typeof r=="string"&&r.indexOf("rgba")>-1){var t=hn(r);t&&(r="rgb("+t[0]+","+t[1]+","+t[2]+")",e=t[3])}return{color:r,opacity:e??1}}var AG=1e-4;function su(r){return r<AG&&r>-AG}function lw(r){return uw(r*1e3)/1e3}function cw(r){return uw(r*1e4)/1e4}function CG(r){return"matrix("+lw(r[0])+","+lw(r[1])+","+lw(r[2])+","+lw(r[3])+","+cw(r[4])+","+cw(r[5])+")"}var RG={left:"start",right:"end",center:"middle",middle:"middle"};function LG(r,e,t){return t==="top"?r+=e/2:t==="bottom"&&(r-=e/2),r}function DG(r){return r&&(r.shadowBlur||r.shadowOffsetX||r.shadowOffsetY)}function PG(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 h2(r){return r&&!!r.image}function zle(r){return r&&!!r.svgElement}function $0(r){return h2(r)||zle(r)}function fw(r){return r.type==="linear"}function hw(r){return r.type==="radial"}function pw(r){return r&&(r.type==="linear"||r.type==="radial")}function Q0(r){return"url(#"+r+")"}function dw(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 mw(r){var e=r.x||0,t=r.y||0,i=(r.rotation||0)*Em,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("+uw(o*Em)+"deg, "+uw(s*Em)+"deg)"),l.join(" ")}var IG=function(){return Bt.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 d2=Array.prototype.slice;function $u(r,e,t){return(e-r)*t+r}function p2(r,e,t,i){for(var n=e.length,a=0;a<n;a++)r[a]=$u(e[a],t[a],i);return r}function Fle(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]=$u(e[o][s],t[o][s],i)}return r}function vw(r,e,t,i){for(var n=e.length,a=0;a<n;a++)r[a]=e[a]+t[a]*i;return r}function NG(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 Ble(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 kle(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]:d2.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 mp(r){if(fi(r)){var e=r.length;if(fi(r[0])){for(var t=[],i=0;i<e;i++)t.push(d2.call(r[i]));return t}return d2.call(r)}return r}function _w(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 Vle(r){return fi(r&&r[0])?2:1}var gw=0,xw=1,zG=2,t_=3,m2=4,v2=5,UG=6;function OG(r){return r===m2||r===v2}function yw(r){return r===xw||r===zG}var e_=[0,0,0,0],Gle=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=UG,l=t;if(fi(t)){var u=Vle(t);s=u,(u===1&&!Ct(t[0])||u===2&&!Ct(t[0][0]))&&(o=!0)}else if(Ct(t)&&!ff(t))s=gw;else if(Ce(t))if(!isNaN(+t))s=gw;else{var c=hn(t);c&&(l=c,s=t_)}else if(cf(t)){var f=fe({},l);f.colorStops=de(t.colorStops,function(p){return{offset:p.offset,color:hn(p.color)}}),fw(t)?s=m2:hw(t)&&(s=v2),l=f}a===0?this.valType=s:(s!==this.valType||s===UG)&&(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:Jb[i]||Im(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=yw(n),u=OG(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?kle(h,p,n):u&&Ble(h.colorStops,p.colorStops))}if(!s&&n!==v2&&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===gw?i[c].additiveValue=i[c].value-d:n===t_?i[c].additiveValue=vw([],i[c].value,d,-1):yw(n)&&(i[c].additiveValue=n===xw?vw([],i[c].value,d,-1):NG([],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===t_,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?e_:e[l];if((yw(a)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)e[l]=v<1?p.rawValue:d.rawValue;else if(yw(a))a===xw?p2(_,p[n],d[n],v):Fle(_,p[n],d[n],v);else if(OG(a)){var y=p[n],x=d[n],M=a===m2;e[l]={type:M?"linear":"radial",x:$u(y.x,x.x,v),y:$u(y.y,x.y,v),colorStops:de(y.colorStops,function(w,T){var C=x.colorStops[T];return{offset:$u(w.offset,C.offset,v),color:_w(p2([],w.color,C.color,v))}}),global:x.global},M?(e[l].x2=$u(y.x2,x.x2,v),e[l].y2=$u(y.y2,x.y2,v)):e[l].r=$u(y.r,x.r,v)}else if(u)p2(_,p[n],d[n],v),i||(e[l]=_w(_));else{var S=$u(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===gw?e[i]=e[i]+n:t===t_?(hn(e[i],e_),vw(e_,e_,n,1),e[i]=_w(e_)):t===xw?vw(e[i],e[i],n,1):t===zG&&NG(e[i],e[i],n,1)},r}(),Hle=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){rp("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,wt(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 Gle(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===t_&&u&&(u=_w(u))}else u=this._target[s];if(u==null)continue;e>0&&l.addKeyframe(0,mp(u),n),this._trackKeys.push(s)}l.addKeyframe(e,mp(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 SG({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]=mp(l.rawValue))}}}},r.prototype.__changeFinalValue=function(e,t){t=t||wt(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}(),r_=Hle;function vp(){return new Date().getTime()}var Wle=function(r){qt(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=vp()-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&&(q0(i),!t._paused&&t.update())}q0(i)},e.prototype.start=function(){this._running||(this._time=vp(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=vp(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=vp()-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 r_(t,i.loop);return this.addAnimator(n),n},e}(Ni),FG=Wle;var Xle=300,g2=Bt.domSupported,y2=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}}(),BG={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},kG=!1;function S2(r){var e=r.pointerType;return e==="pen"||e==="touch"}function Yle(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 _2(r){r&&(r.zrByTouch=!0)}function qle(r,e){return Ia(r.dom,new Zle(r,e),!0)}function GG(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 Zle=function(){function r(e,t){this.stopPropagation=Ur,this.stopImmediatePropagation=Ur,this.preventDefault=Ur,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return r}(),gl={mousedown:function(r){r=Ia(this.dom,r),this.__mayPointerCapture=[r.zrX,r.zrY],this.trigger("mousedown",r)},mousemove:function(r){r=Ia(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=Ia(this.dom,r),this.__togglePointerCapture(!1),this.trigger("mouseup",r)},mouseout:function(r){r=Ia(this.dom,r);var e=r.toElement||r.relatedTarget;GG(this,e)||(this.__pointerCapturing&&(r.zrEventControl="no_globalout"),this.trigger("mouseout",r))},wheel:function(r){kG=!0,r=Ia(this.dom,r),this.trigger("mousewheel",r)},mousewheel:function(r){kG||(r=Ia(this.dom,r),this.trigger("mousewheel",r))},touchstart:function(r){r=Ia(this.dom,r),_2(r),this.__lastTouchMoment=new Date,this.handler.processGesture(r,"start"),gl.mousemove.call(this,r),gl.mousedown.call(this,r)},touchmove:function(r){r=Ia(this.dom,r),_2(r),this.handler.processGesture(r,"change"),gl.mousemove.call(this,r)},touchend:function(r){r=Ia(this.dom,r),_2(r),this.handler.processGesture(r,"end"),gl.mouseup.call(this,r),+new Date-+this.__lastTouchMoment<Xle&&gl.click.call(this,r)},pointerdown:function(r){gl.mousedown.call(this,r)},pointermove:function(r){S2(r)||gl.mousemove.call(this,r)},pointerup:function(r){gl.mouseup.call(this,r)},pointerout:function(r){S2(r)||gl.mouseout.call(this,r)}};N(["click","dblclick","contextmenu"],function(r){gl[r]=function(e){e=Ia(this.dom,e),this.trigger(r,e)}});var M2={pointermove:function(r){S2(r)||M2.mousemove.call(this,r)},pointerup:function(r){M2.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 jle(r,e){var t=e.domHandlers;Bt.pointerEventsSupported?N(y2.pointer,function(i){Sw(e,i,function(n){t[i].call(r,n)})}):(Bt.touchEventsSupported&&N(y2.touch,function(i){Sw(e,i,function(n){t[i].call(r,n),Yle(e)})}),N(y2.mouse,function(i){Sw(e,i,function(n){n=qb(n),e.touching||t[i].call(r,n)})}))}function Kle(r,e){Bt.pointerEventsSupported?N(BG.pointer,t):Bt.touchEventsSupported||N(BG.mouse,t);function t(i){function n(a){a=qb(a),GG(r,a.target)||(a=qle(r,a),e.domHandlers[i].call(r,a))}Sw(e,i,n,{capture:!0})}}function Sw(r,e,t,i){r.mounted[e]=t,r.listenerOpts[e]=i,V0(r.domTarget,e,t,i)}function x2(r){var e=r.mounted;for(var t in e)e.hasOwnProperty(t)&&QV(r.domTarget,t,e[t],r.listenerOpts[t]);r.mounted={}}var VG=function(){function r(e,t){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=t}return r}(),Jle=function(r){qt(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 VG(t,gl),g2&&(n._globalHandlerScope=new VG(document,M2)),jle(n,n._localHandlerScope),n}return e.prototype.dispose=function(){x2(this._localHandlerScope),g2&&x2(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,g2&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var i=this._globalHandlerScope;t?Kle(this,i):x2(i)}},e}(Ni),HG=Jle;var WG=1;Bt.hasGlobalWindow&&(WG=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var gp=WG,i_=.4,n_="#333",a_="#ccc",XG="#eee";var YG=pf,qG=5e-5;function yp(r){return r>qG||r<-qG}var _p=[],Om=[],b2=Ei(),w2=Math.abs,$le=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 yp(this.rotation)||yp(this.x)||yp(this.y)||yp(this.scaleX-1)||yp(this.scaleY-1)||yp(this.skewX)||yp(this.skewY)},r.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),i=this.transform;if(!(t||e)){i&&(YG(i),this.invTransform=null);return}i=i||Ei(),t?this.getLocalTransform(i):YG(i),e&&(t?Ua(i,e,i):G0(i,e)),this.transform=i,this._resolveGlobalScaleRatio(i)},r.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(_p);var i=_p[0]<0?-1:1,n=_p[1]<0?-1:1,a=((_p[0]-i)*t+i)/_p[0]||0,o=((_p[1]-n)*t+n)/_p[1]||0;e[0]*=a,e[1]*=a,e[2]*=o,e[3]*=o}this.invTransform=this.invTransform||Ei(),Cs(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||Ei(),Ua(Om,e.invTransform,t),t=Om);var i=this.originX,n=this.originY;(i||n)&&(b2[4]=i,b2[5]=n,Ua(Om,t,b2),Om[4]-=i,Om[5]-=n,t=Om),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&&hi(i,i,n),i},r.prototype.transformCoordToGlobal=function(e,t){var i=[e,t],n=this.transform;return n&&hi(i,i,n),i},r.prototype.getLineScale=function(){var e=this.transform;return e&&w2(e[0]-1)>1e-10&&w2(e[3]-1)>1e-10?Math.sqrt(w2(e[0]*e[3]-e[2]*e[1])):1},r.prototype.copyTransform=function(e){T2(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&&Oa(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}(),Mo=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function T2(r,e){for(var t=0;t<Mo.length;t++){var i=Mo[t];r[i]=e[i]}}var za=$le;var ZG={};function Fa(r,e){e=e||yo;var t=ZG[e];t||(t=ZG[e]=new Ju(500));var i=t.get(r);return i==null&&(i=kn.measureText(r,e).width,t.put(r,i)),i}function jG(r,e,t,i){var n=Fa(r,e),a=Fm(e),o=zm(0,n,t),s=xp(0,a,i),l=new lt(o,s,n,a);return l}function lu(r,e,t,i){var n=((r||"")+"").split(`
  2203. `),a=n.length;if(a===1)return jG(n[0],e,t,i);for(var o=new lt(0,0,0,0),s=0;s<n.length;s++){var l=jG(n[s],e,t,i);s===0?o.copy(l):o.union(l)}return o}function zm(r,e,t){return t==="right"?r-=e:t==="center"&&(r-=e/2),r}function xp(r,e,t){return t==="middle"?r-=e/2:t==="bottom"&&(r-=e),r}function Fm(r){return Fa("\u56FD",r)}function Mn(r,e){return typeof r=="string"?r.lastIndexOf("%")>=0?parseFloat(r)/100*e:parseFloat(r):r}function Sp(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+=Mn(i[0],t.width),u+=Mn(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 E2="__zr_normal__",A2=Mo.concat(["ignore"]),Qle=_n(Mo,function(r,e){return r[e]=!0,r},{ignore:!1}),Bm={},eue=new lt(0,0,0,0),L2=function(){function r(e){this.id=kb(),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=eue;i.layoutRect?c.copy(i.layoutRect):c.copy(this.getBoundingRect()),n||c.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Bm,i,c):Sp(Bm,i,c),a.x=Bm.x,a.y=Bm.y,o=Bm.align,s=Bm.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=Mn(f[0],c.width),p=Mn(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|=ki,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()?a_:n_},r.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),i=typeof t=="string"&&hn(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,Ps(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=wt(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!==E2)){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,A2)},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(E2,!1,e)},r.prototype.useState=function(e,t,i,n){var a=e===E2,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){rp("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&=~ki),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&=~ki)}},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<A2.length;c++){var f=A2[c],h=a&&Qle[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 za,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|=ki;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 r_(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){C2(this,e,t,i)},r.prototype.animateFrom=function(e,t,i){C2(this,e,t,i,!0)},r.prototype._transitionState=function(e,t,i,n){for(var a=C2(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=ki;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(L2,Ni);wr(L2,za);function C2(r,e,t,i,n){t=t||{};var a=[];KG(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 R2(r,e,t){for(var i=0;i<t;i++)r[i]=e[i]}function tue(r){return fi(r[0])}function rue(r,e,t){if(fi(e[t]))if(fi(r[t])||(r[t]=[]),Ti(e[t])){var i=e[t].length;r[t].length!==i&&(r[t]=new e[t].constructor(i),R2(r[t],e[t],i))}else{var n=e[t],a=r[t],o=n.length;if(tue(n))for(var s=n[0].length,l=0;l<o;l++)a[l]?R2(a[l],n[l],s):a[l]=Array.prototype.slice.call(n[l]);else R2(a,n,o);a.length=n.length}else r[t]=e[t]}function iue(r,e){return r===e||fi(r)&&fi(e)&&nue(r,e)}function nue(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 KG(r,e,t,i,n,a,o,s){for(var l=wt(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(_)&&!fi(_)&&!cf(_)){if(e){s||(t[v]=_,r.updateDuringAnimation(e));continue}KG(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=Yt(g,function(E){return!iue(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]=mp(t[v]),rue(t,i,v)}}var M=new r_(t,!1,!1,f?Yt(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 bw=L2;var JG=function(r){qt(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}(bw);JG.prototype.type="group";var Ze=JG;var ww={},$G={};function aue(r){delete $G[r]}function oue(r){if(!r)return!1;if(typeof r=="string")return Um(r,1)<i_;if(r.colorStops){for(var e=r.colorStops,t=0,i=e.length,n=0;n<i;n++)t+=Um(e[n].color,1);return t/=i,t<i_}return!1}var sue=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 pG,o=i.renderer||"canvas";ww[o]||(o=wt(ww)[0]),i.useDirtyRect=i.useDirtyRect==null?!1:i.useDirtyRect;var s=new ww[o](t,a,i,e),l=i.ssr||s.ssrOnly;this.storage=a,this.painter=s;var u=!Bt.node&&!Bt.worker&&!l?new HG(s.getViewportRoot(),s.root):null,c=i.useCoarsePointer,f=c==null||c==="auto"?Bt.touchEventsSupported:!!c,h=44,p;f&&(p=ft(i.pointerSize,h)),this.handler=new sG(a,s,u,s.root,p),this.animation=new FG({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=oue(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=vp();this._needsRefresh&&(t=!0,this.refreshImmediately(e)),this._needsRefreshHover&&(t=!0,this.refreshHoverImmediately());var n=vp();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,aue(this.id))},r}();function P2(r,e){var t=new sue(kb(),r,e);return $G[t.id]=t,t}function QG(r,e){ww[r]=e}var D2;function eH(r){if(typeof D2=="function")return D2(r)}function tH(r){D2=r}var rH=1e-4,iH=20;function uue(r){return r.replace(/^\s+|\s+$/g,"")}function ir(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 ze(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)?uue(r).match(/%$/)?parseFloat(r)/100*e:parseFloat(r):r==null?NaN:+r}function Cr(r,e,t){return e==null&&(e=10),e=Math.min(Math.max(0,e),iH),r=(+r).toFixed(e),t?r:+r}function Ai(r){return r.sort(function(e,t){return e-t}),r}function bn(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 I2(r)}function I2(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 km(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 nH(r,e,t){if(!r[e])return 0;var i=N2(r,t);return i[e]||0}function N2(r,e){var t=_n(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=_n(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 aH(r,e){var t=Math.max(bn(r),bn(e)),i=r+e;return t>iH?i:Cr(i,t)}var o_=9007199254740991;function s_(r){var e=Math.PI*2;return(r%e+e)%e}function Qu(r){return r>-rH&&r<rH}var cue=/^(?:(\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 wn(r){if(r instanceof Date)return r;if(Ce(r)){var e=cue.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 Tw(r){return Math.pow(10,Vm(r))}function Vm(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 Gm(r,e){var t=Vm(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 Hm(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 l_(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 Ba(r){var e=parseFloat(r);return e==r&&(e!==0||!Ce(r)||r.indexOf("x")<=0)?e:NaN}function Mp(r){return!isNaN(Ba(r))}function Ew(){return Math.round(Math.random()*9)}function oH(r,e){return e===0?r:oH(e,r%e)}function U2(r,e){return r==null?e:e==null?r:r*e/oH(r,e)}var fue="[ECharts] ",sH={},hue=typeof console<"u"&&console.warn&&console.log;function pue(r,e,t){if(hue){if(t){if(sH[e])return;sH[e]=!0}console[r](fue+e)}}function lH(r,e){pue("warn",r,e)}function ur(r){throw new Error(r)}function uH(r,e,t){return(e-r)*t+r}var cH="series\0",fH="\0_ec_\0";function Qt(r){return r instanceof Array?r:r==null?[]:[r]}function bo(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 O2=["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 yl(r){return qe(r)&&!pe(r)&&!(r instanceof Date)?r.value:r}function hH(r){return qe(r)&&!(r instanceof Array)}function Aw(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=due(r,o,t);return(i||n)&&mue(s,r,o,e),i&&vue(s,e),i||n?gue(s,e,n):a&&yue(s,e),_ue(s),s}function due(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"||Wm(a)?null:a,newOption:null,keyInfo:null,brandNew:null})}return i}function mue(r,e,t,i){N(i,function(n,a){if(!(!n||n.id==null)){var o=u_(n.id),s=t.get(o);if(s!=null){var l=r[s];Wr(!l.newOption,'Duplicated option on id "'+o+'".'),l.newOption=n,l.existing=e[s],i[a]=null}}})}function vue(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)&&!Wm(t)&&!Wm(a)&&pH("name",a,t)){r[n].newOption=t,e[i]=null;return}}})}function gue(r,e,t){N(e,function(i){if(i){for(var n,a=0;(n=r[a])&&(n.newOption||Wm(n.existing)||n.existing&&i.id!=null&&!pH("id",i,n.existing));)a++;n?(n.newOption=i,n.brandNew=t):r.push({newOption:i,brandNew:t,existing:null,keyInfo:null}),a++}})}function yue(r,e){N(e,function(t){r.push({newOption:t,brandNew:!0,existing:null,keyInfo:null})})}function _ue(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;Wr(!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?u_(a.name):n?n.name:cH+i,n)o.id=u_(n.id);else if(a.id!=null)o.id=u_(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 pH(r,e,t){var i=Kr(e[r],null),n=Kr(t[r],null);return i!=null&&n!=null&&i===n}function u_(r){return Kr(r,"")}function Kr(r,e){return r==null?e:Ce(r)?r:Ct(r)||B0(r)?r+"":e}function Xm(r){var e=r.name;return!!(e&&e.indexOf(cH))}function Wm(r){return r&&r.id!=null&&u_(r.id).indexOf(fH)===0}function dH(r){return fH+r}function mH(r,e,t){N(r,function(i){var n=i.newOption;qe(n)&&(i.keyInfo.mainType=e,i.keyInfo.subType=xue(e,n,i.existing,t))})}function xue(r,e,t,i){var n=e.type?e.type:t?t.subType:i.determineSubType(r,e);return n}function vH(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=Kr(o[u].seriesId,null);if(f==null)return;for(var h=Qt(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 Is(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_"+Sue++;return function(e){return e[r]||(e[r]={})}}var Sue=Ew();function xf(r,e,t){var i=c_(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=Sf(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 c_(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 Rr={useDefault:!0,enableAll:!1,enableNone:!1},gH={useDefault:!1,enableAll:!0,enableNone:!0};function Sf(r,e,t,i){i=i||Rr;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?(Wr(i.enableNone,'`"none"` or `false` is not a valid value on index option.'),s.models=[],s):(n==="all"&&(Wr(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 z2(r,e,t){r.setAttribute?r.setAttribute(e,t):r[e]=t}function yH(r,e){return r.getAttribute?r.getAttribute(e):r[e]}function _H(r){return r==="auto"?Bt.domSupported?"html":"richText":r||"html"}function f_(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 Cw(r,e,t,i,n){var a=e==null||e==="auto";if(i==null)return i;if(Ct(i)){var o=uH(t||0,i,n);return Cr(o,a?Math.max(bn(t||0),bn(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=uH(p,d,n);s[f]=Cr(o,a?Math.max(bn(p),bn(d)):e)}}return s}}var Mue=".",bp="___EC__COMPONENT__CONTAINER___",xH="___EC__EXTENDED_CLASS___";function Va(r){var e={main:"",sub:""};if(r){var t=r.split(Mue);e.main=t[0]||"",e.sub=t[1]||""}return e}function bue(r){Wr(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(r),'componentType "'+r+'" illegal')}function SH(r){return!!(r&&r[xH])}function Ym(r,e){r.$constructor=r,r.extend=function(t){var i=this,n;return wue(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)},GV(n,this)),fe(n.prototype,t),n[xH]=!0,n.extend=this.extend,n.superCall=Eue,n.superApply=Aue,n.superClass=i,n}}function wue(r){return He(r)&&/^class\s/.test(Function.prototype.toString.call(r))}function Rw(r,e){r.extend=e.extend}var Tue=Math.round(Math.random()*10);function MH(r){var e=["__\0is_clz",Tue++].join("_");r.prototype[e]=!0,r.isInstance=function(t){return!!(t&&t[e])}}function Eue(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 Aue(r,e,t){return this.superClass.prototype[e].apply(r,t)}function Mf(r){var e={};r.registerClass=function(i){var n=i.type||i.prototype.type;if(n){bue(n),i.prototype.type=n;var a=Va(n);if(!a.sub)e[a.main]=i;else if(a.sub!==bp){var o=t(a);o[a.sub]=i}}return i},r.getClass=function(i,n,a){var o=e[i];if(o&&o[bp]&&(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=Va(i),a=[],o=e[n.main];return o&&o[bp]?N(o,function(s,l){l!==bp&&a.push(s)}):a.push(o),a},r.hasClass=function(i){var n=Va(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=Va(i),a=e[n.main];return a&&a[bp]};function t(i){var n=e[i.main];return(!n||!n[bp])&&(n=e[i.main]={},n[bp]=!0),n}}function Ga(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 Cue=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],Rue=Ga(Cue),bH=function(){function r(){}return r.prototype.getAreaStyle=function(e,t){return Rue(this,e,t)},r}();var B2=new Ju(50);function TH(r){if(typeof r=="string"){var e=B2.get(r);return e&&e.image}else return r}function h_(r,e,t,i,n){if(r)if(typeof r=="string"){if(e&&e.__zrImageSrc===r||!t)return e;var a=B2.get(r),o={hostEl:t,cb:i,cbPayload:n};return a?(e=a.image,!qm(e)&&a.pending.push(o)):(e=kn.loadImage(r,wH,wH),e.__zrImageSrc=r,B2.put(r,e.__cachedImgObj={image:e,pending:[o]})),e}else return r;else return e}function wH(){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 qm(r){return r&&r.width&&r.height}var k2=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function Due(r,e,t,i,n){if(!e)return"";var a=(r+"").split(`
  2204. `);n=AH(e,t,i,n);for(var o=0,s=a.length;o<s;o++)a[o]=CH(a[o],n);return a.join(`
  2205. `)}function AH(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=Fa("\u56FD",e);var o=n.ascCharWidth=Fa("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=Fa(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 CH(r,e){var t=e.containerWidth,i=e.font,n=e.contentWidth;if(!t)return"";var a=Fa(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?Pue(r,n,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(r.length*n/a):0;r=r.substr(0,s),a=Fa(r,i)}return r===""&&(r=e.placeholder),r}function Pue(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 RH(r,e){r!=null&&(r+="");var t=e.overflow,i=e.padding,n=e.font,a=t==="truncate",o=Fm(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?DH(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=AH(c,n,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),m=0;m<f.length;m++)f[m]=CH(f[m],g);for(var v=p,_=0,m=0;m<f.length;m++)_=Math.max(Fa(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 Iue=function(){function r(){}return r}(),EH=function(){function r(e){this.tokens=[],e&&(this.tokens=e)}return r}(),Nue=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 LH(r,e){var t=new Nue;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=k2.lastIndex=0,l;(l=k2.exec(r))!=null;){var u=l.index;u>s&&V2(t,r.substring(s,u),e,o),V2(t,l[2],e,o,l[1]),s=k2.lastIndex}s<r.length&&V2(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(z,k,G){z.width=k,z.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=Fm(b);var E=ft(w.height,S.contentHeight);if(S.innerHeight=E,T&&(E+=T[0]+T[2]),S.height=E,S.lineHeight=qi(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=Fa(S.text,b);else{if(R){var A=w.backgroundColor,P=A&&A.image;P&&(P=TH(P),qm(P)&&(S.width=Math.max(S.width,P.width*E/P.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=Due(S.text,U-C,b,e.ellipsis,{minChar:e.truncateMinChar}),S.width=S.contentWidth=Fa(S.text,b)):S.contentWidth=Fa(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 V2(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=Mn(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=DH(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 Iue;if(_.styleName=n,_.text=v,_.isLineHolder=!v&&!a,typeof o.width=="number"?_.width=o.width:_.width=f?f[m]:Fa(v,l),!m&&!u){var y=(s[s.length-1]||(s[0]=new EH)).tokens,x=y.length;x===1&&y[0].isLineHolder?y[0]=_:(v||!x||a)&&y.push(_)}else s.push(new EH([_]))}}function Uue(r){var e=r.charCodeAt(0);return e>=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}var Oue=_n(",&?/;] ".split(""),function(r,e){return r[e]=!0,r},{});function zue(r){return Uue(r)?!!Oue[r]:!0}function DH(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=Fa(h,e),d=i?!1:!zue(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 W2="__zr_style_"+Math.round(Math.random()*10),uu={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},wp={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};uu[W2]=!0;var PH=["z","z2","invisible"],Fue=["invisible"],Bue=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype._init=function(t){for(var i=wt(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&&kue(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|=cp,this._rect&&(this._rect=null)},e.prototype.dirty=function(){this.dirtyStyle()},e.prototype.styleChanged=function(){return!!(this.__dirty&cp)},e.prototype.styleUpdated=function(){this.__dirty&=~cp},e.prototype.createStyle=function(t){return hf(uu,t)},e.prototype.useStyle=function(t){t[W2]||(t=this.createStyle(t)),this.__inHover?this.__hoverStyle=t:this.style=t,this.dirtyStyle()},e.prototype.isStyleObject=function(t){return t[W2]},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,PH)},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=wt(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=wt(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?Fue:PH,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 wp},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=ki|cp}(),e}(bw),G2=new lt(0,0,0,0),H2=new lt(0,0,0,0);function kue(r,e,t){return G2.copy(r.getBoundingRect()),r.transform&&G2.applyTransform(r.transform),H2.width=e,H2.height=t,!G2.intersect(H2)}var _i=Bue;var Ha=Math.min,Wa=Math.max,X2=Math.sin,Y2=Math.cos,Tp=Math.PI*2,Lw=au(),Dw=au(),Pw=au();function Ep(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=Ha(n,i[0]),a=Wa(a,i[0]),o=Ha(o,i[1]),s=Wa(s,i[1]);e[0]=n,e[1]=o,t[0]=a,t[1]=s}}function q2(r,e,t,i,n,a){n[0]=Ha(r,t),n[1]=Ha(e,i),a[0]=Wa(r,t),a[1]=Wa(e,i)}var IH=[],NH=[];function UH(r,e,t,i,n,a,o,s,l,u){var c=tw,f=pi,h=c(r,t,n,o,IH);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,IH[p]);l[0]=Ha(d,l[0]),u[0]=Wa(d,u[0])}h=c(e,i,a,s,NH);for(var p=0;p<h;p++){var g=f(e,i,a,s,NH[p]);l[1]=Ha(g,l[1]),u[1]=Wa(g,u[1])}l[0]=Ha(r,l[0]),u[0]=Wa(r,u[0]),l[0]=Ha(o,l[0]),u[0]=Wa(o,u[0]),l[1]=Ha(e,l[1]),u[1]=Wa(e,u[1]),l[1]=Ha(s,l[1]),u[1]=Wa(s,u[1])}function OH(r,e,t,i,n,a,o,s){var l=iw,u=yi,c=Wa(Ha(l(r,t,n),1),0),f=Wa(Ha(l(e,i,a),1),0),h=u(r,t,n,c),p=u(e,i,a,f);o[0]=Ha(r,n,h),o[1]=Ha(e,a,p),s[0]=Wa(r,n,h),s[1]=Wa(e,a,p)}function zH(r,e,t,i,n,a,o,s,l){var u=_o,c=xo,f=Math.abs(n-a);if(f%Tp<1e-4&&f>1e-4){s[0]=r-t,s[1]=e-i,l[0]=r+t,l[1]=e+i;return}if(Lw[0]=Y2(n)*t+r,Lw[1]=X2(n)*i+e,Dw[0]=Y2(a)*t+r,Dw[1]=X2(a)*i+e,u(s,Lw,Dw),c(l,Lw,Dw),n=n%Tp,n<0&&(n=n+Tp),a=a%Tp,a<0&&(a=a+Tp),n>a&&!o?a+=Tp:n<a&&o&&(n+=Tp),o){var h=a;a=n,n=h}for(var p=0;p<a;p+=Math.PI/2)p>n&&(Pw[0]=Y2(p)*t+r,Pw[1]=X2(p)*i+e,u(s,Pw,s),c(l,Pw,l))}var Xr={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Ap=[],Cp=[],cu=[],bf=[],fu=[],hu=[],Z2=Math.min,j2=Math.max,Rp=Math.cos,Lp=Math.sin,ec=Math.abs,$2=Math.PI,wf=$2*2,K2=typeof Float32Array<"u",p_=[];function J2(r){var e=Math.round(r/$2*1e8)/1e8;return e%2*$2}function d_(r,e){var t=J2(r[0]);t<0&&(t+=wf);var i=t-r[0],n=r[1];n+=i,!e&&n-t>=wf?n=t+wf:e&&t-n>=wf?n=t-wf:!e&&t>n?n=t+(wf-J2(t-n)):e&&t<n&&(n=t-(wf-J2(n-t))),r[0]=t,r[1]=n}var Vue=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=ec(i/gp/e)||0,this._uy=ec(i/gp/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(Xr.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=ec(e-this._xi),n=ec(t-this._yi),a=i>this._ux||n>this._uy;if(this.addData(Xr.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(Xr.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(Xr.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(),p_[0]=n,p_[1]=a,d_(p_,o),n=p_[0],a=p_[1];var s=a-n;return this.addData(Xr.A,e,t,i,i,n,s,0,o?0:1),this._ctx&&this._ctx.arc(e,t,i,n,a,o),this._xi=Rp(a)*i+e,this._yi=Lp(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(Xr.R,e,t,i,n),this},r.prototype.closePath=function(){this._drawPendingPt(),this.addData(Xr.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)&&K2&&(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();K2&&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,K2&&this._len>11&&(this.data=new Float32Array(e)))}},r.prototype.getBoundingRect=function(){cu[0]=cu[1]=fu[0]=fu[1]=Number.MAX_VALUE,bf[0]=bf[1]=hu[0]=hu[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 Xr.M:t=n=e[o++],i=a=e[o++],fu[0]=n,fu[1]=a,hu[0]=n,hu[1]=a;break;case Xr.L:q2(t,i,e[o],e[o+1],fu,hu),t=e[o++],i=e[o++];break;case Xr.C:UH(t,i,e[o++],e[o++],e[o++],e[o++],e[o],e[o+1],fu,hu),t=e[o++],i=e[o++];break;case Xr.Q:OH(t,i,e[o++],e[o++],e[o],e[o+1],fu,hu),t=e[o++],i=e[o++];break;case Xr.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=Rp(p)*f+u,a=Lp(p)*h+c),zH(u,c,f,h,p,d,g,fu,hu),t=Rp(d)*f+u,i=Lp(d)*h+c;break;case Xr.R:n=t=e[o++],a=i=e[o++];var m=e[o++],v=e[o++];q2(n,a,n+m,a+v,fu,hu);break;case Xr.Z:t=n,i=a;break}_o(cu,cu,fu),xo(bf,bf,hu)}return o===0&&(cu[0]=cu[1]=bf[0]=bf[1]=0),new lt(cu[0],cu[1],bf[0]-cu[0],bf[1]-cu[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 Xr.M:a=s=e[h++],o=l=e[h++];break;case Xr.L:{var m=e[h++],v=e[h++],_=m-a,y=v-o;(ec(_)>i||ec(y)>n||h===t-1)&&(g=Math.sqrt(_*_+y*y),a=m,o=v);break}case Xr.C:{var x=e[h++],M=e[h++],m=e[h++],v=e[h++],S=e[h++],w=e[h++];g=yG(a,o,x,M,m,v,S,w,10),a=S,o=w;break}case Xr.Q:{var x=e[h++],M=e[h++],m=e[h++],v=e[h++];g=xG(a,o,x,M,m,v,10),a=m,o=v;break}case Xr.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=Rp(I)*b+T,l=Lp(I)*E+C),g=j2(b,E)*Z2(wf,Math.abs(R)),a=Rp(A)*b+T,o=Lp(A)*E+C;break;case Xr.R:{s=a=e[h++],l=o=e[h++];var P=e[h++],U=e[h++];g=P*2+U*2;break}case Xr.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!==Xr.L&&y>0&&(e.lineTo(x,M),y=0),w){case Xr.M:s=u=i[S++],l=c=i[S++],e.moveTo(u,c);break;case Xr.L:{f=i[S++],h=i[S++];var C=ec(f-u),b=ec(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 Xr.C:{var A=i[S++],P=i[S++],U=i[S++],B=i[S++],z=i[S++],k=i[S++];if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;Ls(u,A,U,z,I,Ap),Ls(c,P,B,k,I,Cp),e.bezierCurveTo(Ap[1],Cp[1],Ap[2],Cp[2],Ap[3],Cp[3]);break e}m+=E}e.bezierCurveTo(A,P,U,B,z,k),u=z,c=k;break}case Xr.Q:{var A=i[S++],P=i[S++],U=i[S++],B=i[S++];if(p){var E=d[v++];if(m+E>_){var I=(_-m)/E;gf(u,A,U,I,Ap),gf(c,P,B,I,Cp),e.quadraticCurveTo(Ap[1],Cp[1],Ap[2],Cp[2]);break e}m+=E}e.quadraticCurveTo(A,P,U,B),u=U,c=B;break}case Xr.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=ec(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=Rp(V)*J+G,l=Lp(V)*Q+Y),u=Rp(Ee)*J+G,c=Lp(Ee)*Q+Y;break;case Xr.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+Z2(_e,H),h),_e-=H,_e>0&&e.lineTo(f+H,h+Z2(_e,We)),_e-=We,_e>0&&e.lineTo(f+j2(H-_e,0),h+We),_e-=H,_e>0&&e.lineTo(f,h+j2(We-_e,0));break e}m+=E}e.rect(f,h,H,We);break;case Xr.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=Xr,r.initDefaultProps=function(){var e=r.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),r}(),$i=Vue;function pu(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 kH(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=rw(r,e,t,i,n,a,o,s,u,c,null);return h<=f/2}function Iw(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=nw(r,e,t,i,n,a,s,l,null);return c<=u/2}var GH=Math.PI*2;function Tn(r){return r%=GH,r<0&&(r+=GH),r}var m_=Math.PI*2;function HH(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)%m_<1e-4)return!0;if(a){var f=i;i=Tn(n),n=Tn(f)}else i=Tn(i),n=Tn(n);i>n&&(n+=m_);var h=Math.atan2(l,s);return h<0&&(h+=m_),h>=i&&h<=n||h+m_>=i&&h+m_<=n}function Ns(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 Tf=$i.CMD,Dp=Math.PI*2,Wue=1e-4;function Xue(r,e){return Math.abs(r-e)<Wue}var la=[-1,-1,-1],Us=[-1,-1];function Yue(){var r=Us[0];Us[0]=Us[1],Us[1]=r}function que(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=fp(e,i,a,s,u,la);if(c===0)return 0;for(var f=0,h=-1,p=void 0,d=void 0,g=0;g<c;g++){var m=la[g],v=m===0||m===1?.5:1,_=pi(r,t,n,o,m);_<l||(h<0&&(h=tw(e,i,a,s,Us),Us[1]<Us[0]&&h>1&&Yue(),p=pi(e,i,a,s,Us[0]),h>1&&(d=pi(e,i,a,s,Us[1]))),h===2?m<Us[0]?f+=p<e?v:-v:m<Us[1]?f+=d<p?v:-v:f+=s<d?v:-v:m<Us[0]?f+=p<e?v:-v:f+=s<p?v:-v)}return f}function Zue(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=_G(e,i,a,s,la);if(l===0)return 0;var u=iw(e,i,a);if(u>=0&&u<=1){for(var c=0,f=yi(e,i,a,u),h=0;h<l;h++){var p=la[h]===0||la[h]===1?.5:1,d=yi(r,t,n,la[h]);d<o||(la[h]<u?c+=f<e?p:-p:c+=a<f?p:-p)}return c}else{var p=la[0]===0||la[0]===1?.5:1,d=yi(r,t,n,la[0]);return d<o?0:a<e?p:-p}}function jue(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);la[0]=-l,la[1]=l;var u=Math.abs(i-n);if(u<1e-4)return 0;if(u>=Dp-1e-4){i=0,n=Dp;var c=a?1:-1;return o>=la[0]+r&&o<=la[1]+r?c:0}if(i>n){var f=i;i=n,n=f}i<0&&(i+=Dp,n+=Dp);for(var h=0,p=0;p<2;p++){var d=la[p];if(d+r>o){var g=Math.atan2(s,d),c=a?1:-1;g<0&&(g=Dp+g),(g>=i&&g<=n||g+Dp>=i&&g+Dp<=n)&&(g>Math.PI/2&&g<Math.PI*1.5&&(c=-c),h+=c)}}return h}function WH(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===Tf.M&&d>1&&(t||(s+=Ns(l,u,c,f,i,n))),m&&(l=a[d],u=a[d+1],c=l,f=u),g){case Tf.M:c=a[d++],f=a[d++],l=c,u=f;break;case Tf.L:if(t){if(pu(l,u,a[d],a[d+1],e,i,n))return!0}else s+=Ns(l,u,a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Tf.C:if(t){if(kH(l,u,a[d++],a[d++],a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=que(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 Tf.Q:if(t){if(Iw(l,u,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+1],i,n)||0;l=a[d++],u=a[d++];break;case Tf.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+=Ns(l,u,h,p,i,n);var T=(i-v)*x/y+v;if(t){if(HH(v,_,x,M,M+S,w,e,T,n))return!0}else s+=jue(v,_,x,M,M+S,w,T,n);l=Math.cos(M+S)*y+v,u=Math.sin(M+S)*x+_;break;case Tf.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(pu(c,f,h,f,e,i,n)||pu(h,f,h,p,e,i,n)||pu(h,p,c,p,e,i,n)||pu(c,p,c,f,e,i,n))return!0}else s+=Ns(h,f,h,p,i,n),s+=Ns(c,p,c,f,i,n);break;case Tf.Z:if(t){if(pu(l,u,c,f,e,i,n))return!0}else s+=Ns(l,u,c,f,i,n);l=c,u=f;break}}return!t&&!Xue(u,f)&&(s+=Ns(l,u,c,f,i,n)||0),s!==0}function XH(r,e,t){return WH(r,0,!1,e,t)}function YH(r,e,t,i){return WH(r,e,!0,t,i)}var Zm=Ye({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},uu),Jue={style:Ye({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},wp.style)},Q2=Mo.concat(["invisible","culling","z","z2","zlevel","parent"]),$ue=function(r){qt(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<Q2.length;++s)n[Q2[s]]=this[Q2[s]];n.__dirty|=ki}else this._decalEl&&(this._decalEl=null)},e.prototype.getDecalElement=function(){return this._decalEl},e.prototype._init=function(t){var i=wt(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=Um(t,0);return i>.5?n_:i>.2?XG:a_}else if(t)return a_}return n_},e.prototype.getInsideTextStroke=function(t){var i=this.style.fill;if(Ce(i)){var n=this.__zr,a=!!(n&&n.isDarkMode()),o=Um(t,0)<i_;if(a===o)return i}},e.prototype.buildPath=function(t,i,n){},e.prototype.pathUpdated=function(){this.__dirty&=~df},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 $i(!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&df)&&(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)),YH(s,l/u,t,i)))return!0}if(this.hasFill())return XH(s,t,i)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=df,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&df)},e.prototype.createStyle=function(t){return hf(Zm,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=wt(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 Jue},e.prototype.isZeroArea=function(){return!1},e.extend=function(t){var i=function(a){qt(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=ki|cp|df}(),e}(_i),ut=$ue;var Que=Ye({strokeFirst:!0,font:yo,x:0,y:0,textAlign:"left",textBaseline:"top",miterLimit:2},Zm),qH=function(r){qt(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 hf(Que,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=lu(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}(_i);qH.prototype.type="tspan";var tc=qH;var ece=Ye({x:0,y:0},uu),tce={style:Ye({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},wp.style)};function rce(r){return!!(r&&typeof r!="string"&&r.width&&r.height)}var ZH=function(r){qt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.createStyle=function(t){return hf(ece,t)},e.prototype._getSize=function(t){var i=this.style,n=i[t];if(n!=null)return n;var a=rce(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 tce},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}(_i);ZH.prototype.type="image";var Br=ZH;function jH(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 jm=Math.round;function Nw(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&&(jm(i*2)===jm(n*2)&&(r.x1=r.x2=Ef(i,s,!0)),jm(a*2)===jm(o*2)&&(r.y1=r.y2=Ef(a,s,!0))),r}}function Uw(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=Ef(i,s,!0),r.y=Ef(n,s,!0),r.width=Math.max(Ef(i+a,s,!1)-r.x,a===0?0:1),r.height=Math.max(Ef(n+o,s,!1)-r.y,o===0?0:1)),r}}function Ef(r,e,t){if(!e)return r;var i=jm(r*2);return(i+jm(e))%2===0?i/2:(i+(t?1:-1))/2}var ace=function(){function r(){this.x=0,this.y=0,this.width=0,this.height=0}return r}();var oce={},KH=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new ace},e.prototype.buildPath=function(t,i){var n,a,o,s;if(this.subPixelOptimize){var l=Uw(oce,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?jH(t,i):t.rect(n,a,o,s)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(ut);KH.prototype.type="rect";var Et=KH;var JH={fill:"#000"},$H=2,sce={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},wp.style)},o4=function(r){qt(e,r);function e(t){var i=r.call(this)||this;return i.type="text",i._children=[],i._defaultStyle=JH,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,cce(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||JH},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=wt(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 sce},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||yo,n=t.padding,a=a4(t),o=RH(a,t),s=eD(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=xp(m,o.contentHeight,_);if(s||n){var M=zm(g,c,v),S=xp(m,u,_);s&&this._renderBackground(t,t,M,S,c,u)}x+=p/2,n&&(y=n4(g,v,n),_==="top"?x+=n[0]:_==="bottom"&&(x-=n[2]));for(var w=0,T=!1,C=i4("fill"in t?t.fill:(T=!0,d.fill)),b=r4("stroke"in t?t.stroke:!l&&(!d.autoStroke||T)?(w=$H,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 P=this._getOrCreateChild(tc),U=P.createStyle();P.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,e4(U,t),x+=p,I&&P.setBoundingRect(new lt(zm(U.x,t.width,U.textAlign),xp(U.y,R,U.textBaseline),f,R))}},e.prototype._updateRichTexts=function(){var t=this.style,i=a4(t),n=LH(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=zm(u,o,h),g=xp(c,s,p),m=d,v=g;l&&(m+=l[3],v+=l[0]);var _=m+a;eD(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&&eD(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=n4(o,s,d),f-=t.height/2-d[0]-t.innerHeight/2);var g=this._getOrCreateChild(tc),m=g.createStyle();g.useStyle(m);var v=this._defaultStyle,_=!1,y=0,x=i4("fill"in u?u.fill:"fill"in i?i.fill:(_=!0,v.fill)),M=r4("stroke"in u?u.stroke:"stroke"in i?i.stroke:!p&&!l&&(!v.autoStroke||_)?(y=$H,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||yo,m.opacity=qi(u.opacity,i.opacity,1),e4(m,u),M&&(m.lineWidth=qi(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(zm(m.x,w,m.textAlign),xp(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(Et),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(Br),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=qi(t.opacity,i.opacity,1)},e.makeFont=function(t){var i="";return rD(t)&&(i=[t.fontStyle,t.fontWeight,tD(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),i&&Zi(i)||t.textFont||t.font},e}(_i),lce={left:!0,right:1,center:1},uce={top:1,bottom:1,middle:1},QH=["fontStyle","fontWeight","fontSize","fontFamily"];function tD(r){return typeof r=="string"&&(r.indexOf("px")!==-1||r.indexOf("rem")!==-1||r.indexOf("em")!==-1)?r:isNaN(+r)?zb+"px":r+"px"}function e4(r,e){for(var t=0;t<QH.length;t++){var i=QH[t],n=e[i];n!=null&&(r[i]=n)}}function rD(r){return r.fontSize!=null||r.fontFamily||r.fontWeight}function cce(r){return t4(r),N(r.rich,t4),r}function t4(r){if(r){r.font=o4.makeFont(r);var e=r.align;e==="middle"&&(e="center"),r.align=e==null||lce[e]?e:"left";var t=r.verticalAlign;t==="center"&&(t="middle"),r.verticalAlign=t==null||uce[t]?t:"top";var i=r.padding;i&&(r.padding=Tm(r.padding))}}function r4(r,e){return r==null||e<=0||r==="transparent"||r==="none"?null:r.image||r.colorStops?"#000":r}function i4(r){return r==null||r==="none"?null:r.image||r.colorStops?"#000":r}function n4(r,e,t){return e==="right"?r-t[1]:e==="center"?r+t[3]/2-t[1]/2:r+t[3]}function a4(r){var e=r.text;return e!=null&&(e+=""),e}function eD(r){return!!(r.backgroundColor||r.lineHeight||r.borderWidth&&r.borderColor)}var It=o4;var rt=vt(),v_=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 s4=1,l4={},p4=vt(),aD=vt(),oD=0,Pp=1,g_=2,Vi=["emphasis","blur","select"],Af=["normal","emphasis","blur","select"],rc=10,fce=9,Cf="highlight",y_="downplay",Jm="select",__="unselect",$m="toggleSelect";function Km(r){return r!=null&&r!=="none"}function zw(r,e,t){r.onHoverStateChange&&(r.hoverState||0)!==t&&r.onHoverStateChange(e),r.hoverState=t}function d4(r){zw(r,"emphasis",g_)}function m4(r){r.hoverState===g_&&zw(r,"normal",oD)}function sD(r){zw(r,"blur",Pp)}function v4(r){r.hoverState===Pp&&zw(r,"normal",oD)}function hce(r){r.selected=!0}function pce(r){r.selected=!1}function u4(r,e,t){e(r,t)}function ic(r,e,t){u4(r,e,t),r.isGroup&&r.traverse(function(i){u4(i,e,t)})}function Ip(r,e){switch(e){case"emphasis":r.hoverState=g_;break;case"normal":r.hoverState=oD;break;case"blur":r.hoverState=Pp;break;case"select":r.selected=!0}}function dce(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 mce(r,e,t,i){var n=t&&dt(t,"select")>=0,a=!1;if(r instanceof ut){var o=p4(r),s=n&&o.selectFill||o.normalFill,l=n&&o.selectStroke||o.normalStroke;if(Km(s)||Km(l)){i=i||{};var u=i.style||{};u.fill==="inherit"?(a=!0,i=fe({},i),u=fe({},u),u.fill=s):!Km(u.fill)&&Km(s)?(a=!0,i=fe({},i),u=fe({},u),u.fill=J0(s)):!Km(u.stroke)&&Km(l)&&(a||(i=fe({},i),u=fe({},u)),u.stroke=J0(l)),i.style=u}}if(i&&i.z2==null){a||(i=fe({},i));var c=r.z2EmphasisLift;i.z2=r.z2+(c??rc)}return i}function vce(r,e,t){if(t&&t.z2==null){t=fe({},t);var i=r.z2SelectLift;t.z2=r.z2+(i??fce)}return t}function gce(r,e,t){var i=dt(r.currentStates,e)>=0,n=r.style.opacity,a=i?null:dce(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 iD(r,e){var t=this.states[r];if(this.style){if(r==="emphasis")return mce(this,r,e,t);if(r==="blur")return gce(this,r,t);if(r==="select")return vce(this,r,t)}return t}function _l(r){r.stateProxy=iD;var e=r.getTextContent(),t=r.getTextGuideLine();e&&(e.stateProxy=iD),t&&(t.stateProxy=iD)}function c4(r,e){!g4(r,e)&&!r.__highByOuter&&ic(r,d4)}function f4(r,e){!g4(r,e)&&!r.__highByOuter&&ic(r,m4)}function Vn(r,e){r.__highByOuter|=1<<(e||0),ic(r,d4)}function Gn(r,e){!(r.__highByOuter&=~(1<<(e||0)))&&ic(r,m4)}function Fw(r){ic(r,sD)}function x_(r){ic(r,v4)}function lD(r){ic(r,hce)}function uD(r){ic(r,pce)}function g4(r,e){return r.__highDownSilentOnTouch&&e.zrByTouch}function cD(r){var e=r.getModel(),t=[],i=[];e.eachComponent(function(n,a){var o=aD(a),s=n==="series",l=s?r.getViewOfSeriesModel(a):r.getViewOfComponentModel(a);!s&&i.push(l),o.isBlured&&(l.group.traverse(function(u){v4(u)}),s&&t.push(a)),o.isBlured=!1}),N(i,function(n){n&&n.toggleBlurSeries&&n.toggleBlurSeries(t,!1,e)})}function nD(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&&x_(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"||sD(m)}),fi(e))a(u.getData(),e);else if(qe(e))for(var d=wt(e),g=0;g<d.length;g++)a(u.getData(d[g]),e[d[g]]);l.push(u),aD(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 Ow(r,e,t){if(!(r==null||e==null)){var i=t.getModel().getComponent(r,e);if(i){aD(i).isBlured=!0;var n=t.getViewOfComponentModel(i);!n||!n.focusBlurEnabled||n.group.traverse(function(a){sD(a)})}}}function y4(r,e,t){var i=r.seriesIndex,n=r.getData(e.dataType);if(n){var a=Is(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);nD(i,u.focus,u.blurScope,t)}else{var c=r.get(["emphasis","focus"]),f=r.get(["emphasis","blurScope"]);c!=null&&nD(i,c,f,t)}}}function Bw(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 _4(r,e,t){var i=rt(r),n=Bw(i.componentMainType,i.componentIndex,i.componentHighDownName,t),a=n.dispatchers,o=n.focusSelf;a?(o&&Ow(i.componentMainType,i.componentIndex,t),N(a,function(s){return c4(s,e)})):(nD(i.seriesIndex,i.focus,i.blurScope,t),i.focus==="self"&&Ow(i.componentMainType,i.componentIndex,t),c4(r,e))}function x4(r,e,t){cD(t);var i=rt(r),n=Bw(i.componentMainType,i.componentIndex,i.componentHighDownName,t).dispatchers;n?N(n,function(a){return f4(a,e)}):f4(r,e)}function S4(r,e,t){if(Vw(e)){var i=e.dataType,n=r.getData(i),a=Is(n,e);pe(a)||(a=[a]),r[e.type===$m?"toggleSelect":e.type===Jm?"select":"unselect"](a,i)}}function fD(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)?lD(a):uD(a)})})}function M4(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 du(r,e,t){nc(r,!0),ic(r,_l),kw(r,e,t)}function yce(r){nc(r,!1)}function ar(r,e,t,i){i?yce(r):du(r,e,t)}function kw(r,e,t){var i=rt(r);e!=null?(i.focus=e,i.blurScope=t):i.focus&&(i.focus=null)}var h4=["emphasis","blur","select"],_ce={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Yr(r,e,t,i){t=t||"itemStyle";for(var n=0;n<h4.length;n++){var a=h4[n],o=e.getModel([a,t]),s=r.ensureState(a);s.style=i?i(o):o[_ce[t]]()}}function nc(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 Rf(r){return!!(r&&r.__highDownDispatcher)}function b4(r,e,t){var i=rt(r);i.componentMainType=e.mainType,i.componentIndex=e.componentIndex,i.componentHighDownName=t}function w4(r){var e=l4[r];return e==null&&s4<=32&&(e=l4[r]=s4++),e}function Vw(r){var e=r.type;return e===Jm||e===__||e===$m}function hD(r){var e=r.type;return e===Cf||e===y_}function T4(r){var e=p4(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 Rt={};DL(Rt,{Arc:()=>T_,BezierCurve:()=>Op,BoundingRect:()=>lt,Circle:()=>ua,CompoundPath:()=>rv,Ellipse:()=>M_,Group:()=>Ze,Image:()=>Br,IncrementalDisplayable:()=>j4,Line:()=>ei,LinearGradient:()=>vu,OrientedBoundingRect:()=>iv,Path:()=>ut,Point:()=>zt,Polygon:()=>ni,Polyline:()=>ri,RadialGradient:()=>jw,Rect:()=>Et,Ring:()=>Up,Sector:()=>xi,Text:()=>It,applyTransform:()=>En,clipPointsByRect:()=>SD,clipRectByRect:()=>$ce,createIcon:()=>uc,extendPath:()=>jce,extendShape:()=>qce,getShapeClass:()=>E_,getTransform:()=>Ml,groupTransition:()=>lc,initProps:()=>or,isElementRemoved:()=>ac,lineLineIntersect:()=>i5,linePolygonIntersect:()=>av,makeImage:()=>xD,makePath:()=>nv,mergePath:()=>Wn,registerShape:()=>Sl,removeElement:()=>Os,removeElementWithFadeOut:()=>oc,resizePath:()=>r5,setTooltipConfig:()=>bl,subPixelOptimize:()=>A_,subPixelOptimizeLine:()=>sc,subPixelOptimizeRect:()=>Kce,transformDirection:()=>Bp,traverseElements:()=>ca,updateProps:()=>Ut});var Qm=$i.CMD,xce=[[],[],[]],E4=Math.sqrt,Sce=Math.atan2;function Gw(r,e){if(e){var t=r.data,i=r.len(),n,a,o,s,l,u,c=Qm.M,f=Qm.C,h=Qm.L,p=Qm.R,d=Qm.A,g=Qm.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],_=E4(e[0]*e[0]+e[1]*e[1]),y=E4(e[2]*e[2]+e[3]*e[3]),x=Sce(-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++],hi(u,u,e),t[s++]=u[0],t[s++]=u[1],u[0]+=t[o++],u[1]+=t[o++],hi(u,u,e),t[s++]=u[0],t[s++]=u[1]}for(l=0;l<a;l++){var M=xce[l];M[0]=t[o++],M[1]=t[o++],hi(M,M,e),t[s++]=M[0],t[s++]=M[1]}}r.increaseVersion()}}var pD=Math.sqrt,Hw=Math.sin,Ww=Math.cos,S_=Math.PI;function A4(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function dD(r,e){return(r[0]*e[0]+r[1]*e[1])/(A4(r)*A4(e))}function C4(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(dD(r,e))}function R4(r,e,t,i,n,a,o,s,l,u,c){var f=l*(S_/180),h=Ww(f)*(r-t)/2+Hw(f)*(e-i)/2,p=-1*Hw(f)*(r-t)/2+Ww(f)*(e-i)/2,d=h*h/(o*o)+p*p/(s*s);d>1&&(o*=pD(d),s*=pD(d));var g=(n===a?-1:1)*pD((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+Ww(f)*m-Hw(f)*v,y=(e+i)/2+Hw(f)*m+Ww(f)*v,x=C4([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=C4(M,S);if(dD(M,S)<=-1&&(w=S_),dD(M,S)>=1&&(w=0),w<0){var T=Math.round(w/S_*1e6)/1e6;w=S_*2+T%2*S_}c.addData(u,_,y,o,s,x,w,f,a)}var Mce=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,bce=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function wce(r){var e=new $i;if(!r)return e;var t=0,i=0,n=t,a=i,o,s=$i.CMD,l=r.match(Mce);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(bce)||[],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,R4(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,R4(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 L4=function(r){qt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.applyTransform=function(t){},e}(ut);function D4(r){return r.setData!=null}function P4(r,e){var t=wce(r),i=fe({},e);return i.buildPath=function(n){if(D4(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){Gw(t,n),this.dirtyShape()},i}function Xw(r,e){return new L4(P4(r,e))}function I4(r,e){var t=P4(r,e),i=function(n){qt(a,n);function a(o){var s=n.call(this,o)||this;return s.applyTransform=t.applyTransform,s.buildPath=t.buildPath,s}return a}(L4);return i}function N4(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(D4(s)){s.appendPath(t);var l=s.getContext();l&&s.rebuildPath(l,1)}},o}function ev(r,e){e=e||{};var t=new ut;return r.shape&&t.setShape(r.shape),t.setStyle(r.style),e.bakeTransform?Gw(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 Ece=function(){function r(){this.cx=0,this.cy=0,this.r=0}return r}();var U4=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Ece},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);U4.prototype.type="circle";var ua=U4;var Ace=function(){function r(){this.cx=0,this.cy=0,this.rx=0,this.ry=0}return r}();var O4=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Ace},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);O4.prototype.type="ellipse";var M_=O4;var F4=Math.PI,mD=F4*2,Np=Math.sin,tv=Math.cos,Cce=Math.acos,Hn=Math.atan2,z4=Math.abs,w_=Math.sqrt,b_=Math.max,mu=Math.min,xl=1e-4;function Rce(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<xl))return h=(c*(e-a)-f*(r-n))/h,[r+h*l,e+h*u]}function Yw(r,e,t,i,n,a,o){var s=r-t,l=e-i,u=(o?a:-a)/w_(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)*w_(b_(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,P=E-v;return I*I+R*R>A*A+P*P&&(T=b,C=E),{cx:T,cy:C,x0:-c,y0:-f,x1:T*(n/M-1),y1:C*(n/M-1)}}function Lce(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 B4(r,e){var t,i=b_(e.r,0),n=b_(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=z4(u-l),d=p>mD&&p%mD;if(d>xl&&(p=d),!(i>xl))r.moveTo(c,f);else if(p>mD-xl)r.moveTo(c+i*tv(l),f+i*Np(l)),r.arc(c,f,i,l,u,!h),n>xl&&(r.moveTo(c+n*tv(u),f+n*Np(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,P=i*tv(l),U=i*Np(l),B=n*tv(u),z=n*Np(u),k=p>xl;if(k){var G=e.cornerRadius;G&&(t=Lce(G),g=t[0],m=t[1],v=t[2],_=t[3]);var Y=z4(i-n)/2;if(y=mu(Y,v),x=mu(Y,_),M=mu(Y,g),S=mu(Y,m),C=w=b_(y,x),b=T=b_(M,S),(w>xl||T>xl)&&(E=i*tv(u),I=i*Np(u),R=n*tv(l),A=n*Np(l),p<F4)){var J=Rce(P,U,R,A,E,I,B,z);if(J){var Q=P-J[0],V=U-J[1],K=E-J[0],ae=I-J[1],ve=1/Np(Cce((Q*K+V*ae)/(w_(Q*Q+V*V)*w_(K*K+ae*ae)))/2),ue=w_(J[0]*J[0]+J[1]*J[1]);C=mu(w,(i-ue)/(ve+1)),b=mu(T,(n-ue)/(ve-1))}}}if(!k)r.moveTo(c+P,f+U);else if(C>xl){var se=mu(v,C),Ee=mu(_,C),q=Yw(R,A,P,U,i,se,h),H=Yw(E,I,B,z,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,Hn(q.y0,q.x0),Hn(H.y0,H.x0),!h):(se>0&&r.arc(c+q.cx,f+q.cy,se,Hn(q.y0,q.x0),Hn(q.y1,q.x1),!h),r.arc(c,f,i,Hn(q.cy+q.y1,q.cx+q.x1),Hn(H.cy+H.y1,H.cx+H.x1),!h),Ee>0&&r.arc(c+H.cx,f+H.cy,Ee,Hn(H.y1,H.x1),Hn(H.y0,H.x0),!h))}else r.moveTo(c+P,f+U),r.arc(c,f,i,l,u,!h);if(!(n>xl)||!k)r.lineTo(c+B,f+z);else if(b>xl){var se=mu(g,b),Ee=mu(m,b),q=Yw(B,z,E,I,n,-Ee,h),H=Yw(P,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,Hn(q.y0,q.x0),Hn(H.y0,H.x0),!h):(Ee>0&&r.arc(c+q.cx,f+q.cy,Ee,Hn(q.y0,q.x0),Hn(q.y1,q.x1),!h),r.arc(c,f,n,Hn(q.cy+q.y1,q.cx+q.x1),Hn(H.cy+H.y1,H.cx+H.x1),h),se>0&&r.arc(c+H.cx,f+H.cy,se,Hn(H.y1,H.x1),Hn(H.y0,H.x0),!h))}else r.lineTo(c+B,f+z),r.arc(c,f,n,u,l,h)}r.closePath()}}}var Pce=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 k4=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Pce},e.prototype.buildPath=function(t,i){B4(t,i)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(ut);k4.prototype.type="sector";var xi=k4;var Ice=function(){function r(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return r}();var V4=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Ice},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);V4.prototype.type="ring";var Up=V4;function vD(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++)_o(c,c,r[h]),xo(f,f,r[h]);_o(c,c,i[0]),xo(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(Pa(r[h]));continue}else l=r[h-1],u=r[h+1];ml(a,u,l),Am(a,a,e);var g=Wb(d,l),m=Wb(d,u),v=g+m;v!==0&&(g/=v,m/=v),Am(o,a,-g),Am(s,a,m);var _=ZL([],d,o),y=ZL([],d,s);i&&(xo(_,_,c),_o(_,_,f),xo(y,y,c),_o(y,y,f)),n.push(_),n.push(y)}return t&&n.push(n.shift()),n}function qw(r,e,t){var i=e.smooth,n=e.points;if(n&&n.length>=2){if(i){var a=vD(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 Nce=function(){function r(){this.points=null,this.smooth=0,this.smoothConstraint=null}return r}();var H4=function(r){qt(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new Nce},e.prototype.buildPath=function(t,i){qw(t,i,!0)},e}(ut);H4.prototype.type="polygon";var ni=H4;var Uce=function(){function r(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null}return r}();var W4=function(r){qt(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 Uce},e.prototype.buildPath=function(t,i){qw(t,i,!1)},e}(ut);W4.prototype.type="polyline";var ri=W4;var Oce={},zce=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return r}();var X4=function(r){qt(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 zce},e.prototype.buildPath=function(t,i){var n,a,o,s;if(this.subPixelOptimize){var l=Nw(Oce,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);X4.prototype.type="line";var ei=X4;var Xa=[],Fce=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 Y4(r,e,t){var i=r.cpx2,n=r.cpy2;return i!=null||n!=null?[(t?o2:pi)(r.x1,r.cpx1,r.cpx2,r.x2,e),(t?o2:pi)(r.y1,r.cpy1,r.cpy2,r.y2,e)]:[(t?Z0:yi)(r.x1,r.cpx1,r.x2,e),(t?Z0:yi)(r.y1,r.cpy1,r.y2,e)]}var q4=function(r){qt(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 Fce},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&&(gf(n,l,o,h,Xa),l=Xa[1],o=Xa[2],gf(a,u,s,h,Xa),u=Xa[1],s=Xa[2]),t.quadraticCurveTo(l,u,o,s)):(h<1&&(Ls(n,l,c,o,h,Xa),l=Xa[1],c=Xa[2],o=Xa[3],Ls(a,u,f,s,h,Xa),u=Xa[1],f=Xa[2],s=Xa[3]),t.bezierCurveTo(l,u,c,f,o,s)))},e.prototype.pointAt=function(t){return Y4(this.shape,t,!1)},e.prototype.tangentAt=function(t){var i=Y4(this.shape,t,!0);return Es(i,i)},e}(ut);q4.prototype.type="bezier-curve";var Op=q4;var Bce=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 Z4=function(r){qt(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 Bce},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);Z4.prototype.type="arc";var T_=Z4;var kce=function(r){qt(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),rv=kce;var Vce=function(){function r(e){this.colorStops=e||[]}return r.prototype.addColorStop=function(e,t){this.colorStops.push({offset:e,color:t})},r}(),Zw=Vce;var Gce=function(r){qt(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}(Zw),vu=Gce;var Hce=function(r){qt(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}(Zw),jw=Hce;var zp=[0,0],Fp=[0,0],Kw=new zt,Jw=new zt,Wce=function(){function r(e,t){this._corners=[],this._axes=[],this._origin=[0,0];for(var i=0;i<4;i++)this._corners[i]=new zt;for(var i=0;i<2;i++)this._axes[i]=new zt;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);zt.sub(n[0],i[1],i[0]),zt.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 Kw.set(1/0,1/0),Jw.set(0,0),!this._intersectCheckOneSide(this,e,Kw,Jw,n,1)&&(i=!1,n)||!this._intersectCheckOneSide(e,this,Kw,Jw,n,-1)&&(i=!1,n)||n||zt.copy(t,i?Kw:Jw),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,zp),this._getProjMinMaxOnAxis(l,t._corners,Fp),zp[1]<Fp[0]||zp[0]>Fp[1]){if(s=!1,a)return s;var c=Math.abs(Fp[0]-zp[1]),f=Math.abs(zp[0]-Fp[1]);Math.min(c,f)>n.len()&&(c<f?zt.scale(n,u,-c*o):zt.scale(n,u,f*o))}else if(i){var c=Math.abs(Fp[0]-zp[1]),f=Math.abs(zp[0]-Fp[1]);Math.min(c,f)<i.len()&&(c<f?zt.scale(i,u,c*o):zt.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}(),iv=Wce;var Xce=[],Yce=function(r){qt(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(Xce)),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}(_i),j4=Yce;var J4=vt();function gu(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 gD(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=gu(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 Ut(r,e,t,i,n,a){gD("update",r,e,t,i,n,a)}function or(r,e,t,i,n,a){gD("enter",r,e,t,i,n,a)}function ac(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 Os(r,e,t,i,n,a){ac(r)||gD("leave",r,e,t,i,n,a)}function K4(r,e,t,i){r.removeTextContent(),r.removeTextGuideLine(),Os(r,{style:{opacity:0}},e,t,i)}function oc(r,e,t){function i(){r.parent&&r.parent.remove(r)}r.isGroup?r.traverse(function(n){n.isGroup||K4(n,e,t,i)}):K4(r,e,t,i)}function Ui(r){J4(r).oldStyle=r.style}function $4(r){return J4(r).oldStyle}var $w=Math.max,Qw=Math.min,_D={};function qce(r){return ut.extend(r)}var Zce=I4;function jce(r,e){return Zce(r,e)}function Sl(r,e){_D[r]=e}function E_(r){if(_D.hasOwnProperty(r))return _D[r]}function nv(r,e,t,i){var n=Xw(r,e);return t&&(i==="center"&&(t=t5(t,n.getBoundingRect())),r5(n,t)),n}function xD(r,e,t){var i=new Br({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(t5(e,a))}}});return i}function t5(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 Wn=N4;function r5(r,e){if(r.applyTransform){var t=r.getBoundingRect(),i=t.calculateTransform(e);r.applyTransform(i)}}function sc(r,e){return Nw(r,r,{lineWidth:e}),r}function Kce(r){return Uw(r.shape,r.shape,r.style),r}var A_=Ef;function Ml(r,e){for(var t=pf([]);r&&r!==e;)Ua(t,r.getLocalTransform(),t),r=r.parent;return t}function En(r,e,t){return e&&!fi(e)&&(e=za.getLocalTransform(e)),t&&(e=Cs([],e)),hi([],r,e)}function Bp(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=En(a,e,t),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function Q4(r){return!r.isGroup}function Jce(r){return r.shape!=null}function lc(r,e,t){if(!r||!e)return;function i(o){var s={};return o.traverse(function(l){Q4(l)&&l.anid&&(s[l.anid]=l)}),s}function n(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Jce(o)&&(s.shape=fe({},o.shape)),s}var a=i(r);e.traverse(function(o){if(Q4(o)&&o.anid){var s=a[o.anid];if(s){var l=n(o);o.attr(n(s)),Ut(o,l,t,rt(o).dataIndex)}}})}function SD(r,e){return de(r,function(t){var i=t[0];i=$w(i,e.x),i=Qw(i,e.x+e.width);var n=t[1];return n=$w(n,e.y),n=Qw(n,e.y+e.height),[i,n]})}function $ce(r,e){var t=$w(r.x,e.x),i=Qw(r.x+r.width,e.x+e.width),n=$w(r.y,e.y),a=Qw(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 uc(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 Br(i)):nv(r.replace("path://",""),i,t,"center")}function av(r,e,t,i,n){for(var a=0,o=n[n.length-1];a<n.length;a++){var s=n[a];if(i5(r,e,t,i,s[0],s[1],o[0],o[1]))return!0;o=s}}function i5(r,e,t,i,n,a,o,s){var l=t-r,u=i-e,c=o-n,f=s-a,h=yD(c,f,l,u);if(Qce(h))return!1;var p=r-n,d=e-a,g=yD(p,d,l,u)/h;if(g<0||g>1)return!1;var m=yD(p,d,c,f)/h;return!(m<0||m>1)}function yD(r,e,t,i){return r*i-t*e}function Qce(r){return r<=1e-6&&r>=-1e-6}function bl(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(wt(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 e5(r,e){var t;r.isGroup&&(t=e(r)),t||r.traverse(e)}function ca(r,e){if(r)if(pe(r))for(var t=0;t<r.length;t++)e5(r[t],e);else e5(r,e)}Sl("circle",ua);Sl("ellipse",M_);Sl("sector",xi);Sl("ring",Up);Sl("polygon",ni);Sl("polyline",ri);Sl("rect",Et);Sl("line",ei);Sl("bezierCurve",Op);Sl("arc",T_);var e1={};function l5(r,e){for(var t=0;t<Vi.length;t++){var i=Vi[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 MD(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<Vi.length;u++){var c=Vi[u],f=e[c];l[c]=ft(i?i.getFormattedLabel(n,c,null,a,f&&f.get("formatter")):null,s)}return l}function Or(r,e,t,i){t=t||e1;for(var n=r instanceof It,a=!1,o=0;o<Af.length;o++){var s=e[Af[o]];if(s&&s.getShallow("show")){a=!0;break}}var l=n?r:r.getTextContent();if(a){n||(l||(l=new It,r.setTextContent(l)),r.stateProxy&&(l.stateProxy=r.stateProxy));var u=MD(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(C_(c,t,!1));for(var o=0;o<Vi.length;o++){var p=Vi[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=C_(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&&(cc(l).setLabelText=function(v){var _=MD(t,e,v);l5(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<Vi.length;i++){var n=Vi[i];t[n]=r.getModel([n,e])}return t}function fr(r,e,t,i,n){var a={};return efe(a,r,t,i,n),e&&fe(a,e),a}function C_(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 efe(r,e,t,i,n){t=t||e1;var a=e.ecModel,o=a&&a.option.textStyle,s=tfe(e),l;if(s){l={};for(var u in s)if(s.hasOwnProperty(u)){var c=e.getModel(["rich",u]);s5(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),s5(r,e,o,t,i,n,!0,!1)}function tfe(r){for(var e;r&&r!==r.ecModel;){var t=(r.option||e1).rich;if(t){e=e||{};for(var i=wt(t),n=0;n<i.length;n++){var a=i[n];e[a]=1}}r=r.parentModel}return e}var n5=["fontStyle","fontWeight","fontSize","fontFamily","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY"],a5=["align","lineHeight","width","height","tag","verticalAlign","ellipsis"],o5=["padding","borderWidth","borderRadius","borderDashOffset","backgroundColor","borderColor","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];function s5(r,e,t,i,n,a,o,s){t=!n&&t||e1;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<n5.length;g++){var m=n5[g],v=ft(e.getShallow(m),t[m]);v!=null&&(r[m]=v)}for(var g=0;g<a5.length;g++){var m=a5[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<o5.length;g++){var m=o5[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 ov(r,e){var t=e&&e.getModel("textStyle");return Zi([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 cc=vt();function t1(r,e,t,i){if(r){var n=cc(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 r1(r,e,t,i,n){var a=cc(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=Cw(t,a.precision,s,l,c);a.interpolatedValue=c===1?null:f;var h=MD({labelDataIndex:e,labelFetcher:n,defaultText:o?o(f):f+""},a.statesModels,f);l5(r,h)}r.percent=0,(a.prevValue==null?or:Ut)(r,{percent:1},i,e,null,u)}var ife=["textStyle","color"],bD=["fontStyle","fontWeight","fontSize","fontFamily","padding","lineHeight","rich","width","height","overflow"],wD=new It,nfe=function(){function r(){}return r.prototype.getTextColor=function(e){var t=this.ecModel;return this.getShallow("color")||(!e&&t?t.get(ife):null)},r.prototype.getFont=function(){return ov({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<bD.length;i++)t[bD[i]]=this.getShallow(bD[i]);return wD.useStyle(t),wD.update(),wD.getBoundingRect()},r}(),u5=nfe;var TD=[["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","type"],["lineDashOffset","dashOffset"],["lineCap","cap"],["lineJoin","join"],["miterLimit"]],afe=Ga(TD),c5=function(){function r(){}return r.prototype.getLineStyle=function(e){return afe(this,e)},r}();var ED=[["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","borderType"],["lineDashOffset","borderDashOffset"],["lineCap","borderCap"],["lineJoin","borderJoin"],["miterLimit","borderMiterLimit"]],ofe=Ga(ED),f5=function(){function r(){}return r.prototype.getItemStyle=function(e,t){return ofe(this,e,t)},r}();var kp=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){xt(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(!Bt.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}();Ym(kp);MH(kp);wr(kp,c5);wr(kp,f5);wr(kp,bH);wr(kp,u5);var Kt=kp;var sfe=Math.round(Math.random()*10);function zs(r){return[r||"",sfe++].join("_")}function h5(r){var e={};r.registerSubTypeDefaulter=function(t,i){var n=Va(t);e[n.main]=i},r.determineSubType=function(t,i){var n=i.type;if(!n){var a=Va(t).main;r.hasSubTypes(t)&&e[a]&&(n=e[a](i))}return n}}function p5(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 Xn(r,e){return xt(xt({},r,!0),e,!0)}var d5={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 m5={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 n1="ZH",CD="EN",sv=CD,i1={},RD={},a1=Bt.domSupported?function(){var r=(document.documentElement.lang||navigator.language||navigator.browserLanguage||sv).toUpperCase();return r.indexOf(n1)>-1?n1:sv}():sv;function v5(r,e){r=r.toUpperCase(),RD[r]=new Kt(e),i1[r]=e}function g5(r){if(Ce(r)){var e=i1[r.toUpperCase()]||{};return r===n1||r===CD?Qe(e):xt(Qe(e),Qe(i1[sv]),!1)}else return xt(Qe(r),Qe(i1[sv]),!1)}function R_(r){return RD[r]}function y5(){return RD[sv]}v5(CD,d5);v5(n1,m5);var s1=1e3,l1=s1*60,uv=l1*60,wo=uv*24,DD=wo*365,L_={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}"},o1="{yyyy}-{MM}-{dd}",PD={year:"{yyyy}",month:"{yyyy}-{MM}",day:o1,hour:o1+" "+L_.hour,minute:o1+" "+L_.minute,second:o1+" "+L_.second,millisecond:L_.none},LD=["year","month","day","hour","minute","second","millisecond"],ID=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function fc(r,e){return r+="","0000".substr(0,e-r.length)+r}function Gp(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 _5(r){return r===Gp(r)}function x5(r){switch(r){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Hp(r,e,t,i){var n=wn(r),a=n[u1(t)](),o=n[Vp(t)]()+1,s=Math.floor((o-1)/3)+1,l=n[D_(t)](),u=n["get"+(t?"UTC":"")+"Day"](),c=n[lv(t)](),f=(c-1)%12+1,h=n[P_(t)](),p=n[I_(t)](),d=n[N_(t)](),g=i instanceof Kt?i:R_(i||a1)||y5(),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,fc(a%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,v[o-1]).replace(/{MMM}/g,_[o-1]).replace(/{MM}/g,fc(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,fc(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,y[u]).replace(/{ee}/g,x[u]).replace(/{e}/g,u+"").replace(/{HH}/g,fc(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,fc(f+"",2)).replace(/{h}/g,f+"").replace(/{mm}/g,fc(h,2)).replace(/{m}/g,h+"").replace(/{ss}/g,fc(p,2)).replace(/{s}/g,p+"").replace(/{SSS}/g,fc(d,3)).replace(/{S}/g,d+"")}function S5(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({},L_);if(r.level>0)for(var s=0;s<LD.length;++s)o[LD[s]]="{primary|"+o[LD[s]]+"}";var l=t?t.inherit===!1?t:Ye(t,o):o,u=M5(r.value,n);if(l[u])a=l[u];else if(l.inherit){for(var c=ID.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 Hp(new Date(r.value),a,n,i)}function M5(r,e){var t=wn(r),i=t[Vp(e)]()+1,n=t[D_(e)](),a=t[lv(e)](),o=t[P_(e)](),s=t[I_(e)](),l=t[N_(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 ND(r,e,t){var i=Ct(r)?wn(r):r;switch(e=e||M5(r,t),e){case"year":return i[u1(t)]();case"half-year":return i[Vp(t)]()>=6?1:0;case"quarter":return Math.floor((i[Vp(t)]()+1)/4);case"month":return i[Vp(t)]();case"day":return i[D_(t)]();case"half-day":return i[lv(t)]()/24;case"hour":return i[lv(t)]();case"minute":return i[P_(t)]();case"second":return i[I_(t)]();case"millisecond":return i[N_(t)]()}}function u1(r){return r?"getUTCFullYear":"getFullYear"}function Vp(r){return r?"getUTCMonth":"getMonth"}function D_(r){return r?"getUTCDate":"getDate"}function lv(r){return r?"getUTCHours":"getHours"}function P_(r){return r?"getUTCMinutes":"getMinutes"}function I_(r){return r?"getUTCSeconds":"getSeconds"}function N_(r){return r?"getUTCMilliseconds":"getMilliseconds"}function b5(r){return r?"setUTCFullYear":"setFullYear"}function UD(r){return r?"setUTCMonth":"setMonth"}function OD(r){return r?"setUTCDate":"setDate"}function zD(r){return r?"setUTCHours":"setHours"}function FD(r){return r?"setUTCMinutes":"setMinutes"}function BD(r){return r?"setUTCSeconds":"setSeconds"}function kD(r){return r?"setUTCMilliseconds":"setMilliseconds"}function GD(r){if(!Mp(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 c1(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 wl=Tm;function f1(r,e,t){var i="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function n(c){return c&&Zi(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?wn(r):r;if(isNaN(+l)){if(s)return"-"}else return Hp(l,i,t)}if(e==="ordinal")return B0(r)?n(r):Ct(r)&&a(r)?r+"":"-";var u=Ba(r);return a(u)?GD(u):B0(r)?n(r):typeof r=="boolean"?r+"":"-"}var w5=["a","b","c","d","e","f","g"],VD=function(r,e){return"{"+r+(e??"")+"}"};function h1(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=w5[a];r=r.replace(VD(o),VD(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(VD(w5[l],s),t?xn(u):u)}return r}function T5(r,e,t){return N(e,function(i,n){r=r.replace("{"+n+"}",t?xn(i):i)}),r}function E5(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:'+xn(i)+";"+(e||"")+'"></span>':'<span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:'+xn(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 Tl(r,e){return e=e||"transparent",Ce(r)?r:qe(r)&&r.colorStops&&(r.colorStops[0]||{}).color||e}function Wp(r,e){if(e==="_blank"||e==="blank"){var t=window.open();t.opener=null,t.location.href=r}else window.open(r,e)}var p1=N,HD=["left","right","top","bottom","width","height"],Xp=[["width","left","right"],["height","top","bottom"]];function WD(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 El=WD,IVe=ot(WD,"vertical"),NVe=ot(WD,"horizontal");function A5(r,e,t){var i=e.width,n=e.height,a=ze(r.left,i),o=ze(r.top,n),s=ze(r.right,i),l=ze(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=wl(t||0),{width:Math.max(s-a-t[1]-t[3],0),height:Math.max(l-o-t[0]-t[2],0)}}function Sr(r,e,t){t=wl(t||0);var i=e.width,n=e.height,a=ze(r.left,i),o=ze(r.top,n),s=ze(r.right,i),l=ze(r.bottom,n),u=ze(r.width,i),c=ze(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 Lf(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=Sr(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 C5(r,e){return r[Xp[e][0]]!=null||r[Xp[e][1]]!=null&&r[Xp[e][2]]!=null}function Df(r){var e=r.layoutMode||r.constructor.layoutMode;return qe(e)?e:e?{type:e}:null}function Ya(r,e,t){var i=t&&t.ignoreSize;!pe(i)&&(i=[i,i]);var n=o(Xp[0],0),a=o(Xp[1],1);u(Xp[0],r,n),u(Xp[1],r,a);function o(c,f){var h={},p=0,d={},g=0,m=2;if(p1(c,function(y){d[y]=r[y]}),p1(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){p1(c,function(p){f[p]=h[p]})}}function Fs(r){return XD({},r)}function XD(r,e){return e&&r&&p1(HD,function(t){e.hasOwnProperty(t)&&(r[t]=e[t])}),r}var lfe=vt(),cv=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t,i,n)||this;return a.uid=zs("ec_cpt_model"),a}return e.prototype.init=function(t,i,n){this.mergeDefaultAndTheme(t,n)},e.prototype.mergeDefaultAndTheme=function(t,i){var n=Df(this),a=n?Fs(t):{},o=i.getTheme();xt(t,o.get(this.mainType)),xt(t,this.getDefaultOption()),n&&Ya(t,a,n)},e.prototype.mergeOption=function(t,i){xt(this.option,t,!0);var n=Df(this);n&&Ya(this.option,t,n)},e.prototype.optionUpdated=function(t,i){},e.prototype.getDefaultOption=function(){var t=this.constructor;if(!SH(t))return t.defaultOption;var i=lfe(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=xt(s,n[l],!0);i.defaultOption=s}return i.defaultOption},e.prototype.getReferringComponents=function(t,i){var n=t+"Index",a=t+"Id";return Sf(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}(Kt);Rw(cv,Kt);Mf(cv);h5(cv);p5(cv,ufe);function ufe(r){var e=[];return N(cv.getClassesByMainType(r),function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])}),e=de(e,function(t){return Va(t).main}),r!=="dataset"&&dt(e,"dataset")<=0&&e.unshift("dataset"),e}var Nt=cv;var R5="";typeof navigator<"u"&&(R5=navigator.platform||"");var fv="rgba(0, 0, 0, 0.2)",L5={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:fv,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:fv,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:fv,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:fv,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:fv,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:fv,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:R5.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 d1=ke(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),pn="original",Ci="arrayRows",Cn="objectRows",To="keyedColumns",Eo="typedArray",YD="unknown",qa="column",hc="row";var Qi={Must:1,Might:2,Not:3},D5=vt();function P5(r){D5(r).datasetMap=ke()}function m1(r,e,t){var i={},n=v1(e);if(!n||!r)return i;var a=[],o=[],s=e.ecModel,l=D5(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 hv(r,e,t){var i={},n=v1(r);if(!n)return i;var a=e.sourceFormat,o=e.dimensionsDefine,s;(a===Cn||a===To)&&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=N5(e.data,a,e.seriesLayoutBy,o,e.startIndex,p);h.push(g);var m=g===Qi.Not;if(m&&c.v==null&&p!==s&&(c.v=p),(c.n==null||c.n===c.v||!m&&h[c.n]===Qi.Not)&&(c.n=p),v(c)&&h[c.n]!==Qi.Not)return c;m||(g===Qi.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 v1(r){var e=r.get("data",!0);if(!e)return Sf(r.ecModel,"dataset",{index:r.get("datasetIndex",!0),id:r.get("datasetId",!0)},Rr).models[0]}function I5(r){return!r.get("transform",!0)&&!r.get("fromTransformResult",!0)?[]:Sf(r.ecModel,"dataset",{index:r.get("fromDatasetIndex",!0),id:r.get("fromDatasetId",!0)},Rr).models}function g1(r,e){return N5(r.data,r.sourceFormat,r.seriesLayoutBy,r.dimensionsDefine,r.startIndex,e)}function N5(r,e,t,i,n,a){var o,s=5;if(Ti(r))return Qi.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"?Qi.Must:Qi.Not;if(e===Ci){var f=r;if(t===hc){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===Cn){var g=r;if(!l)return Qi.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===To){var v=r;if(!l)return Qi.Not;var h=v[l];if(!h||Ti(h))return Qi.Not;for(var p=0;p<h.length&&p<s;p++)if((o=x(h[p]))!=null)return o}else if(e===pn)for(var _=r,p=0;p<_.length&&p<s;p++){var m=_[p],y=yl(m);if(!pe(y))return Qi.Not;if((o=x(y[a]))!=null)return o}function x(M){var S=Ce(M);if(M!=null&&isFinite(M)&&M!=="")return S?Qi.Might:Qi.Not;if(S&&M!=="-")return Qi.Must}return Qi.Not}var qD=ke();function U5(r,e){Wr(qD.get(r)==null&&e),qD.set(r,e)}function O5(r,e,t){var i=qD.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 z5=vt(),cfe=vt(),O_=function(){function r(){}return r.prototype.getColorFromPalette=function(e,t,i){var n=Qt(this.get("color",!0)),a=this.get("colorLayer",!0);return F5(this,z5,n,a,e,t,i)},r.prototype.clearColorPalette=function(){hfe(this,z5)},r}();function z_(r,e,t,i){var n=Qt(r.get(["aria","decal","decals"]));return F5(r,cfe,n,null,e,t,i)}function ffe(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 F5(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:ffe(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 hfe(r,e){e(r).paletteIdx=0,e(r).paletteNameMap={}}var y1,F_,B5,k5="\0_ec_inner",pfe=1;var W5=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 Kt(a),this._locale=new Kt(o),this._optionManager=s},e.prototype.setOption=function(t,i,n){var a=H5(i);this._optionManager.setOption(t,n,a),this._resetOption(null,a)},e.prototype.resetOption=function(t,i){return this._resetOption(t,H5(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"?B5(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;P5(this),N(t,function(f,h){f!=null&&(Nt.hasClass(h)?h&&(s.push(h),l.set(h,!0)):n[h]=n[h]==null?Qe(f):xt(n[h],f,!0))}),u&&u.each(function(f,h){Nt.hasClass(h)&&!l.get(h)&&(s.push(h),l.set(h,!0))}),Nt.topologicalTravel(s,Nt.getAllClassMainTypes(),c,this);function c(f){var h=O5(this,f,Qt(t[f])),p=a.get(f),d=p?u&&u.get(f)?"replaceMerge":"normalMerge":"replaceAll",g=Aw(p,h,d);mH(g,f,Nt),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=Nt.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"&&y1(this)}this._seriesIndices||y1(this)},e.prototype.getOption=function(){var t=Qe(this.option);return N(t,function(i,n){if(Nt.hasClass(n)){for(var a=Qt(i),o=a.length,s=!1,l=o-1;l>=0;l--)a[l]&&!Wm(a[l])?s=!0:(a[l]=null,!s&&o--);a.length=o,t[n]=a}}),delete t[k5],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(Qt(n),function(u){s[u]&&l.push(s[u])})):a!=null?l=V5("id",a,s):o!=null?l=V5("name",o,s):l=Yt(s,function(u){return!!u}),G5(l,t)},e.prototype.findComponents=function(t){var i=t.query,n=t.mainType,a=s(i),o=a?this.queryComponents(a):Yt(this._componentsMap.get(n),function(u){return!!u});return l(G5(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?Yt(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=Kr(t,null);return Yt(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 Yt(this._componentsMap.get("series"),function(i){return!!i&&i.subType===t})},e.prototype.getSeries=function(){return Yt(this._componentsMap.get("series"),function(t){return!!t})},e.prototype.getSeriesCount=function(){return this._componentsCount.get("series")},e.prototype.eachSeries=function(t,i){F_(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){F_(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 F_(this),this._seriesIndicesMap.get(t.componentIndex)==null},e.prototype.getCurrentSeriesIndices=function(){return(this._seriesIndices||[]).slice()},e.prototype.filterSeries=function(t,i){F_(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){y1(this);var i=this._componentsMap,n=[];i.each(function(a,o){Nt.hasClass(o)&&n.push(o)}),Nt.topologicalTravel(n,Nt.getAllClassMainTypes(),function(a){N(i.get(a),function(o){o&&(a!=="series"||!dfe(o,t))&&o.restoreData()})})},e.internalField=function(){y1=function(t){var i=t._seriesIndices=[];N(t._componentsMap.get("series"),function(n){n&&i.push(n.componentIndex)}),t._seriesIndicesMap=ke(i)},F_=function(t){},B5=function(t,i){t.option={},t.option[k5]=pfe,t._componentsMap=ke({series:[]}),t._componentsCount=ke();var n=i.aria;qe(n)&&n.enabled==null&&(n.enabled=!0),mfe(i,t._theme.option),xt(i,L5,!1),t._mergeOption(i,null)}}(),e}(Kt);function dfe(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 mfe(r,e){var t=r.color&&!r.colorLayer;N(e,function(i,n){n==="colorLayer"&&t||Nt.hasClass(n)||(typeof i=="object"?r[n]=r[n]?xt(r[n],i,!1):Qe(i):r[n]==null&&(r[n]=i))})}function V5(r,e,t){if(pe(e)){var i=ke();return N(e,function(a){if(a!=null){var o=Kr(a,null);o!=null&&i.set(a,!0)}}),Yt(t,function(a){return a&&i.get(a[r])})}else{var n=Kr(e,null);return Yt(t,function(a){return a&&n!=null&&a[r]===n})}}function G5(r,e){return e.hasOwnProperty("subType")?Yt(r,function(t){return t&&t.subType===e.subType}):r}function H5(r){var e=ke();return r&&N(Qt(r.replaceMerge),function(t){e.set(t,!0)}),{replaceMergeMainTypeMap:e}}wr(W5,O_);var _1=W5;var vfe=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isSSR","isDisposed","on","off","getDataURL","getConnectedDataURL","getOption","getId","updateLabelLayout"],gfe=function(){function r(e){N(vfe,function(t){this[t]=Be(e[t],e)},this)}return r}(),x1=gfe;var ZD={},yfe=function(){function r(){this._coordinateSystems=[]}return r.prototype.create=function(e,t){var i=[];N(ZD,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){ZD[e]=t},r.get=function(e){return ZD[e]},r}(),pc=yfe;var _fe=/^(min|max)?(.+)$/,xfe=function(){function r(e){this._timelineOptions=[],this._mediaList=[],this._currentMediaIndices=[],this._api=e}return r.prototype.setOption=function(e,t,i){e&&(N(Qt(e.series),function(o){o&&o.data&&Ti(o.data)&&ip(o.data)}),N(Qt(e.dataset),function(o){o&&o.source&&Ti(o.source)&&ip(o.source)})),e=Qe(e);var n=this._optionBackup,a=Sfe(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++)Mfe(n[l].query,t,i)&&o.push(l);return!o.length&&a&&(o=[-1]),o.length&&!wfe(o,this._currentMediaIndices)&&(s=de(o,function(c){return Qe(c===-1?a.option:n[c].option)})),this._currentMediaIndices=o,s},r}();function Sfe(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 Mfe(r,e,t){var i={width:e,height:t,aspectratio:e/t},n=!0;return N(r,function(a,o){var s=o.match(_fe);if(!(!s||!s[1]||!s[2])){var l=s[1],u=s[2].toLowerCase();bfe(i[u],a,l)||(n=!1)}}),n}function bfe(r,e,t){return t==="min"?r>=e:t==="max"?r<=e:r===e}function wfe(r,e){return r.join(",")===e.join(",")}var X5=xfe;var Al=N,k_=qe,Y5=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function jD(r){var e=r&&r.itemStyle;if(e)for(var t=0,i=Y5.length;t<i;t++){var n=Y5[t],a=e.normal,o=e.emphasis;a&&a[n]&&(r[n]=r[n]||{},r[n].normal?xt(r[n].normal,a[n]):r[n].normal=a[n],a[n]=null),o&&o[n]&&(r[n]=r[n]||{},r[n].emphasis?xt(r[n].emphasis,o[n]):r[n].emphasis=o[n],o[n]=null)}}function Yn(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 B_(r){Yn(r,"itemStyle"),Yn(r,"lineStyle"),Yn(r,"areaStyle"),Yn(r,"label"),Yn(r,"labelLine"),Yn(r,"upperLabel"),Yn(r,"edgeLabel")}function Oi(r,e){var t=k_(r)&&r[e],i=k_(t)&&t.textStyle;if(i)for(var n=0,a=O2.length;n<a;n++){var o=O2[n];i.hasOwnProperty(o)&&(t[o]=i[o])}}function Bs(r){r&&(B_(r),Oi(r,"label"),r.emphasis&&Oi(r.emphasis,"label"))}function Tfe(r){if(k_(r)){jD(r),B_(r),Oi(r,"label"),Oi(r,"upperLabel"),Oi(r,"edgeLabel"),r.emphasis&&(Oi(r.emphasis,"label"),Oi(r.emphasis,"upperLabel"),Oi(r.emphasis,"edgeLabel"));var e=r.markPoint;e&&(jD(e),Bs(e));var t=r.markLine;t&&(jD(t),Bs(t));var i=r.markArea;i&&Bs(i);var n=r.data;if(r.type==="graph"){n=n||r.nodes;var a=r.links||r.edges;if(a&&!Ti(a))for(var o=0;o<a.length;o++)Bs(a[o]);N(r.categories,function(u){B_(u)})}if(n&&!Ti(n))for(var o=0;o<n.length;o++)Bs(n[o]);if(e=r.markPoint,e&&e.data)for(var s=e.data,o=0;o<s.length;o++)Bs(s[o]);if(t=r.markLine,t&&t.data)for(var l=t.data,o=0;o<l.length;o++)pe(l[o])?(Bs(l[o][0]),Bs(l[o][1])):Bs(l[o]);r.type==="gauge"?(Oi(r,"axisLabel"),Oi(r,"title"),Oi(r,"detail")):r.type==="treemap"?(Yn(r.breadcrumb,"itemStyle"),N(r.levels,function(u){B_(u)})):r.type==="tree"&&B_(r.leaves)}}function dc(r){return pe(r)?r:r?[r]:[]}function q5(r){return(pe(r)?r[0]:r)||{}}function KD(r,e){Al(dc(r.series),function(i){k_(i)&&Tfe(i)});var t=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","parallelAxis","radar"];e&&t.push("valueAxis","categoryAxis","logAxis","timeAxis"),Al(t,function(i){Al(dc(r[i]),function(n){n&&(Oi(n,"axisLabel"),Oi(n.axisPointer,"label"))})}),Al(dc(r.parallel),function(i){var n=i&&i.parallelAxisDefault;Oi(n,"axisLabel"),Oi(n&&n.axisPointer,"label")}),Al(dc(r.calendar),function(i){Yn(i,"itemStyle"),Oi(i,"dayLabel"),Oi(i,"monthLabel"),Oi(i,"yearLabel")}),Al(dc(r.radar),function(i){Oi(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)}),Al(dc(r.geo),function(i){k_(i)&&(Bs(i),Al(dc(i.regions),function(n){Bs(n)}))}),Al(dc(r.timeline),function(i){Bs(i),Yn(i,"label"),Yn(i,"itemStyle"),Yn(i,"controlStyle",!0);var n=i.data;pe(n)&&N(n,function(a){qe(a)&&(Yn(a,"label"),Yn(a,"itemStyle"))})}),Al(dc(r.toolbox),function(i){Yn(i,"iconStyle"),Al(i.feature,function(n){Yn(n,"iconStyle")})}),Oi(q5(r.axisPointer),"label"),Oi(q5(r.tooltip).axisPointer,"label")}function Efe(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 Afe(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 Z5(r){r&&N(Cfe,function(e){e[0]in r&&!(e[1]in r)&&(r[e[1]]=r[e[0]])})}var Cfe=[["x","left"],["y","top"],["x2","right"],["y2","bottom"]],Rfe=["grid","geo","parallel","legend","toolbox","title","visualMap","dataZoom","timeline"],JD=[["borderRadius","barBorderRadius"],["borderColor","barBorderColor"],["borderWidth","barBorderWidth"]];function V_(r){var e=r&&r.itemStyle;if(e)for(var t=0;t<JD.length;t++){var i=JD[t][1],n=JD[t][0];e[i]!=null&&(e[n]=e[i])}}function j5(r){r&&r.alignTo==="edge"&&r.margin!=null&&r.edgeDistance==null&&(r.edgeDistance=r.margin)}function K5(r){r&&r.downplay&&!r.blur&&(r.blur=r.downplay)}function Lfe(r){r&&r.focusNodeAdjacency!=null&&(r.emphasis=r.emphasis||{},r.emphasis.focus==null&&(r.emphasis.focus="adjacency"))}function J5(r,e){if(r)for(var t=0;t<r.length;t++)e(r[t]),r[t]&&J5(r[t].children,e)}function S1(r,e){KD(r,e),r.series=Qt(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),j5(t.label);var n=t.data;if(n&&!Ti(n))for(var a=0;a<n.length;a++)j5(n[a]);t.hoverOffset!=null&&(t.emphasis=t.emphasis||{},(t.emphasis.scaleSize=null)&&(t.emphasis.scaleSize=t.hoverOffset))}else if(i==="gauge"){var o=Efe(t,"pointer.color");o!=null&&Afe(t,"itemStyle.color",o)}else if(i==="bar"){V_(t),V_(t.backgroundStyle),V_(t.emphasis);var n=t.data;if(n&&!Ti(n))for(var a=0;a<n.length;a++)typeof n[a]=="object"&&(V_(n[a]),V_(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)),K5(t),J5(t.data,K5)}else i==="graph"||i==="sankey"?Lfe(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)),Z5(t)}}),r.dataRange&&(r.visualMap=r.dataRange),N(Rfe,function(t){var i=r[t];i&&(pe(i)||(i=[i]),N(i,function(n){Z5(n)}))})}function $D(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(Dfe)}function Dfe(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=aH(h,_),g=_;break}}}return i[0]=h,i[1]=g,i})})}var M1=function(){function r(e){this.data=e.data||(e.sourceFormat===To?{}:[]),this.sourceFormat=e.sourceFormat||YD,this.seriesLayoutBy=e.seriesLayoutBy||qa,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&&g1(this,i)===Qi.Must&&(n.type="ordinal")}}return r}();function pv(r){return r instanceof M1}function G_(r,e,t){t=t||QD(r);var i=e.seriesLayoutBy,n=Pfe(r,t,i,e.sourceHeader,e.dimensions),a=new M1({data:r,sourceFormat:t,seriesLayoutBy:i,dimensionsDefine:n.dimensionsDefine,startIndex:n.startIndex,dimensionsDetectedCount:n.dimensionsDetectedCount,metaRawOption:Qe(e)});return a}function dv(r){return new M1({data:r,sourceFormat:Ti(r)?Eo:pn})}function eW(r){return new M1({data:r.data,sourceFormat:r.sourceFormat,seriesLayoutBy:r.seriesLayoutBy,dimensionsDefine:Qe(r.dimensionsDefine),startIndex:r.startIndex,dimensionsDetectedCount:r.dimensionsDetectedCount})}function QD(r){var e=YD;if(Ti(r))e=Eo;else if(pe(r)){r.length===0&&(e=Ci);for(var t=0,i=r.length;t<i;t++){var n=r[t];if(n!=null){if(pe(n)||Ti(n)){e=Ci;break}else if(qe(n)){e=Cn;break}}}}else if(qe(r)){for(var a in r)if(tt(r,a)&&fi(r[a])){e=To;break}}return e}function Pfe(r,e,t,i,n){var a,o;if(!r)return{dimensionsDefine:$5(n),startIndex:o,dimensionsDetectedCount:a};if(e===Ci){var s=r;i==="auto"||i==null?Q5(function(u){u!=null&&u!=="-"&&(Ce(u)?o==null&&(o=1):o=0)},t,s,10):o=Ct(i)?i:i?1:0,!n&&o===1&&(n=[],Q5(function(u,c){n[c]=u!=null?u+"":""},t,s,1/0)),a=n?n.length:t===hc?s.length:s[0]?s[0].length:null}else if(e===Cn)n||(n=Ife(r));else if(e===To)n||(n=[],N(r,function(u,c){n.push(c)}));else if(e===pn){var l=yl(r[0]);a=pe(l)&&l.length||1}return{startIndex:o,dimensionsDefine:$5(n),dimensionsDetectedCount:a}}function Ife(r){for(var e=0,t;e<r.length&&!(t=r[e++]););if(t)return wt(t)}function $5(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 Q5(r,e,t,i){if(e===hc)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 b1(r){var e=r.sourceFormat;return e===Cn||e===To}var Yp,qp,Zp,tW,rW,w1=function(){function r(e,t){var i=pv(e)?e:dv(e);this._source=i;var n=this._data=i.data;i.sourceFormat===Eo&&(this._offset=0,this._dimSize=t,this._data=n),rW(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;rW=function(o,s,l){var u=l.sourceFormat,c=l.seriesLayoutBy,f=l.startIndex,h=l.dimensionsDefine,p=tW[nP(u,c)];if(fe(o,p),u===Eo)o.getItem=t,o.count=n,o.fillStorage=i;else{var d=tP(u,c);o.getItem=Be(d,null,s,f,h);var g=rP(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};tW=(e={},e[Ci+"_"+qa]={pure:!0,appendData:a},e[Ci+"_"+hc]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[Cn]={pure:!0,appendData:a},e[To]={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[pn]={appendData:a},e[Eo]={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 iW=function(r,e,t,i){return r[i]},Nfe=(Yp={},Yp[Ci+"_"+qa]=function(r,e,t,i){return r[i+e]},Yp[Ci+"_"+hc]=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},Yp[Cn]=iW,Yp[To]=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},Yp[pn]=iW,Yp);function tP(r,e){var t=Nfe[nP(r,e)];return t}var nW=function(r,e,t){return r.length},Ufe=(qp={},qp[Ci+"_"+qa]=function(r,e,t){return Math.max(0,r.length-e)},qp[Ci+"_"+hc]=function(r,e,t){var i=r[0];return i?Math.max(0,i.length-e):0},qp[Cn]=nW,qp[To]=function(r,e,t){var i=t[0].name,n=r[i];return n?n.length:0},qp[pn]=nW,qp);function rP(r,e){var t=Ufe[nP(r,e)];return t}var eP=function(r,e,t){return r[e]},Ofe=(Zp={},Zp[Ci]=eP,Zp[Cn]=function(r,e,t){return r[t]},Zp[To]=eP,Zp[pn]=function(r,e,t){var i=yl(r);return i instanceof Array?i[e]:i},Zp[Eo]=eP,Zp);function iP(r){var e=Ofe[r];return e}function nP(r,e){return r===Ci?r+"_"+e:r}function mc(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 iP(a)(i,o,s)}else{var l=i;return a===pn&&(l=yl(i)),l}}}}var zfe=/\{@(.+?)\}/g,mv=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=h1(a,l);return c.replace(zfe,function(f,h){var p=h.length,d=h;d.charAt(0)==="["&&d.charAt(p-1)==="]"&&(d=+d.slice(1,p-1));var g=mc(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 mc(this.getData(t),e)},r.prototype.formatTooltip=function(e,t,i){},r}();function aP(r){var e,t;return qe(r)?r.type&&(t=r):e=r,{text:e,frag:t}}function Pf(r){return new Ffe(r)}var Ffe=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){aW.reset(t,i,n,a),this._callingProgress=e,this._callingProgress({start:t,end:i,count:i-t,next:aW.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 aW=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 ks(r,e){var t=e&&e.type;return t==="ordinal"?r:(t==="time"&&!Ct(r)&&r!=null&&r!=="-"&&(r=+wn(r)),r==null||r===""?NaN:+r)}var Bfe=ke({number:function(r){return parseFloat(r)},time:function(r){return+wn(r)},trim:function(r){return Ce(r)?Zi(r):r}});function T1(r){return Bfe.get(r)}var oW={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}},kfe=function(){function r(e,t){if(!Ct(t)){var i="";ur(i)}this._opFn=oW[e],this._rvalFloat=Ba(t)}return r.prototype.evaluate=function(e){return Ct(e)?this._opFn(e,this._rvalFloat):this._opFn(Ba(e),this._rvalFloat)},r}(),E1=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=Ct(e)?e:Ba(e),n=Ct(t)?t:Ba(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 Vfe=function(){function r(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=Ba(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=Ba(e)===this._rvalFloat)}return this._isEQ?t:!t},r}();function sW(r,e){return r==="eq"||r==="ne"?new Vfe(r==="eq",e):tt(oW,r)?new kfe(r,e):null}var Gfe=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 ks(e,t)},r}();function Hfe(r,e){var t=new Gfe,i=r.data,n=t.sourceFormat=r.sourceFormat,a=r.startIndex,o="";r.seriesLayoutBy!==qa&&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=tP(n,qa);e.__isBuiltIn&&(t.getRawDataItem=function(g){return f(i,a,s,g)},t.getRawData=Be(Wfe,null,r)),t.cloneRawData=Be(Xfe,null,r);var h=rP(n,qa);t.count=Be(h,null,i,a,s);var p=iP(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(Yfe,null,s,l),t.cloneAllDimensionInfo=Be(qfe,null,s),t}function Wfe(r){var e=r.sourceFormat;if(!oP(e)){var t="";ur(t)}return r.data}function Xfe(r){var e=r.sourceFormat,t=r.data;if(!oP(e)){var i="";ur(i)}if(e===Ci){for(var n=[],a=0,o=t.length;a<o;a++)n.push(t[a].slice());return n}else if(e===Cn){for(var n=[],a=0,o=t.length;a<o;a++)n.push(fe({},t[a]));return n}}function Yfe(r,e,t){if(t!=null){if(Ct(t)||!isNaN(t)&&!tt(e,t))return r[t];if(tt(e,t))return e[t]}}function qfe(r){return Qe(r)}var lW=ke();function uW(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,lW.set(e,r)}function cW(r,e,t){var i=Qt(r),n=i.length,a="";n||ur(a);for(var o=0,s=n;o<s;o++){var l=i[o];e=Zfe(l,e,t,n===1?null:o),o!==s-1&&(e.length=Math.max(e.length,1))}return e}function Zfe(r,e,t,i){var n="";e.length||ur(n),qe(r)||ur(n);var a=r.type,o=lW.get(a);o||ur(n);var s=de(e,function(c){return Hfe(c,o)}),l=Qt(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=QD(c.data);oP(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:qa,sourceHeader:m,dimensions:g.metaRawOption.dimensions}}else d={seriesLayoutBy:qa,sourceHeader:0,dimensions:c.dimensions};return G_(c.data,d,null)})}function oP(r){return r===Ci||r===Cn}var A1="undefined",jfe=typeof Uint32Array===A1?Array:Uint32Array,Kfe=typeof Uint16Array===A1?Array:Uint16Array,lP=typeof Int32Array===A1?Array:Int32Array,fW=typeof Float64Array===A1?Array:Float64Array,pW={float:fW,int:lP,ordinal:Array,number:Array,time:fW},sP;function H_(r){return r>65535?jfe:Kfe}function vv(){return[1/0,-1/0]}function Jfe(r){var e=r.constructor;return e===Array?r.slice():new e(r)}function hW(r,e,t,i,n){var a=pW[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 $fe=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=sP[n.sourceFormat];this._dimValueGetter=i||a,this._rawExtent=[];var o=b1(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 pW[t||"float"](this._rawCount),this._rawExtent[a]=vv(),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]=vv());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];hW(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=sP.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]=vv()),hW(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=H_(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=H_(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=wt(e),a=n.length;if(!a)return this;var o=t.count(),s=H_(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]]=vv();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(H_(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]=vv(),h=new(H_(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=vv();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&&_n(e,function(s,l){return s[l]=!0,s},{});if(a)for(var o=0;o<n.length;o++)i._chunks[o]=a[o]?Jfe(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 ks(t[a],this._dimensions[a])}sP={arrayRows:e,objectRows:function(t,i,n,a){return ks(t[i],this._dimensions[a])},keyedColumns:e,original:function(t,i,n,a){var o=t&&(t.value==null?t:t.value);return ks(o instanceof Array?o[a]:o,this._dimensions[a])},typedArray:function(t,i,n,a){return t[a]}}}(),r}(),W_=$fe;var R1=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(C1(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=Ti(s)?Eo:pn,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?[G_(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=[G_(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&&dW(a)}var o,s=[],l=[];return N(e,function(u){u.prepareSource();var c=u.getSource(n||0),f="";n!=null&&!c&&dW(f),s.push(c),l.push(u._getVersionSign())}),i?o=cW(i,s,{datasetIndex:t.componentIndex}):n!=null&&(o=[eW(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];C1(this._sourceHost)&&l?s=l._innerGetDataStore(e,t,i):(s=new W_,s.initData(new w1(t,e.length),e)),o[i]=s}return s},r.prototype._getUpstreamSourceManagers=function(){var e=this._sourceHost;if(C1(e)){var t=v1(e);return t?[t.getSourceManager()]:[]}else return de(I5(e),function(i){return i.getSourceManager()})},r.prototype._getSourceMetaRawOption=function(){var e=this._sourceHost,t,i,n;if(C1(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 uP(r){var e=r.option.transform;e&&ip(r.option.transform)}function C1(r){return r.mainType==="series"}function dW(r){throw new Error(r)}var mW="line-height:1";function vW(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:"+xn(i+"")+"px;color:"+xn(t)+";font-weight:"+xn(n+""),valueStyle:"font-size:"+xn(o+"")+"px;color:"+xn(a)+";font-weight:"+xn(s+"")}:{nameStyle:{fontSize:i,fill:t,fontWeight:n},valueStyle:{fontSize:o,fill:a,fontWeight:s}}}var Qfe=[0,10,20,30],ehe=["",`
  2210. `,`
  2211. `,`
  2212. `];function kr(r,e){return e.type=r,e}function cP(r){return r.type==="section"}function gW(r){return cP(r)?the:rhe}function yW(r){if(cP(r)){var e=0,t=r.blocks.length,i=t>1||t>0&&!r.noHeader;return N(r.blocks,function(n){var a=yW(n);a>=e&&(e=a+ +(i&&(!a||cP(n)&&!n.noHeader)))}),e}return 0}function the(r,e,t,i){var n=e.noHeader,a=ihe(yW(e)),o=[],s=e.blocks||[];Wr(!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 E1(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=gW(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):fP(o.join(""),n?t:a.html);if(n)return f;var h=f1(e.header,"ordinal",r.useUTC),p=vW(i,r.renderMode).nameStyle;return r.renderMode==="richText"?_W(r,h,p)+a.richText+f:fP('<div style="'+p+";"+mW+';">'+xn(h)+"</div>"+f,t)}function rhe(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 f1(M,pe(p)?p[S]:p,u)})};if(!(a&&o)){var f=s?"":r.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",n),h=a?"":f1(l,"ordinal",u),p=e.valueType,d=o?[]:c(e.value,e.dataIndex),g=!s||!a,m=!s&&a,v=vW(i,n),_=v.nameStyle,y=v.valueStyle;return n==="richText"?(s?"":f)+(a?"":_W(r,h,_))+(o?"":ohe(r,d,g,m,y)):fP((s?"":f)+(a?"":nhe(h,!s,_))+(o?"":ahe(d,g,m,y)),t)}}function hP(r,e,t,i,n,a){if(r){var o=gW(r),s={useUTC:n,renderMode:t,orderMode:i,markupStyleCreator:e,valueFormatter:r.valueFormatter};return o(s,r,0,a)}}function ihe(r){return{html:Qfe[r],richText:ehe[r]}}function fP(r,e){var t='<div style="clear:both"></div>',i="margin: "+e+"px 0 0";return'<div style="'+i+";"+mW+';">'+r+t+"</div>"}function nhe(r,e,t){var i=e?"margin-left:2px":"";return'<span style="'+t+";"+i+'">'+xn(r)+"</span>"}function ahe(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 xn(o)}).join("&nbsp;&nbsp;")+"</span>"}function _W(r,e,t){return r.markupStyleCreator.wrapRichTextStyle(e,t)}function ohe(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 L1(r,e){var t=r.getData().getItemVisual(e,"style"),i=t[r.visualDrawType];return Tl(i)}function D1(r,e){var t=r.get("padding");return t??(e==="richText"?[8,10]:10)}var P1=function(){function r(){this.richTextStyles={},this._nextStyleNameId=Ew()}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=E5({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 I1(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=L1(e,t),c,f,h,p;if(o>1||l&&!o){var d=she(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=mc(n,t,a[0]),f=g.type}else p=c=l?s[0]:s;var m=Xm(e),v=m&&e.name||"",_=n.getName(t),y=i?v:_;return kr("section",{header:v,noHeader:i||!m,sortParam:p,blocks:[kr("nameValue",{markerType:"item",markerColor:u,name:y,noName:!Zi(y),value:c,valueType:f,dataIndex:t})].concat(h||[])})}function she(r,e,t,i,n){var a=e.getData(),o=_n(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(mc(a,t,f),f)}):N(r,c);function c(f,h){var p=a.getDimensionInfo(h);!p||p.otherDims.tooltip===!1||(o?u.push(kr("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 If=vt();function N1(r,e){return r.getName(e)||r.getId(e)}var X_="__universalTransitionEnabled",U1=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=Pf({count:uhe,reset:che}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n);var a=If(this).sourceManager=new R1(this);a.prepareSource();var o=this.getInitialData(t,n);SW(o,this),this.dataTask.context.data=o,If(this).dataBeforeProcessed=o,xW(this),this._initSelectedMapFromData(o)},e.prototype.mergeDefaultAndTheme=function(t,i){var n=Df(this),a=n?Fs(t):{},o=this.subType;Nt.hasClass(o)&&(o+="Series"),xt(t,i.getTheme().get(this.subType)),xt(t,this.getDefaultOption()),bo(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&Ya(t,a,n)},e.prototype.mergeOption=function(t,i){t=xt(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Df(this);n&&Ya(this.option,t,n);var a=If(this).sourceManager;a.dirty(),a.prepareSource();var o=this.getInitialData(t,i);SW(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,If(this).dataBeforeProcessed=o,xW(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(t){if(t&&!Ti(t))for(var i=["show"],n=0;n<t.length;n++)t[n]&&t[n].label&&bo(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=pP(this);if(i){var n=i.context.data;return t==null?n:n.getLinkedData(t)}else return If(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=pP(this);if(i){var n=i.context;n.outputData=t,i!==this.dataTask&&(n.data=t)}If(this).data=t},e.prototype.getEncode=function(){var t=this.get("encode",!0);if(t)return ke(t)},e.prototype.getSourceManager=function(){return If(this).sourceManager},e.prototype.getSource=function(){return this.getSourceManager().getSource()},e.prototype.getRawData=function(){return If(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 I1({series:this,dataIndex:t,multipleSeries:i})},e.prototype.isAnimationEnabled=function(){var t=this.ecModel;if(Bt.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=O_.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=N1(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=wt(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[N1(a,t)])&&!a.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[X_])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=N1(t,f);u[h]=!0,this._selectedDataIndicesMap[h]=t.getRawIndex(f)}}else if(s==="single"||s===!0){var p=i[l-1],h=N1(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 Nt.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}(Nt);wr(U1,mv);wr(U1,O_);Rw(U1,Nt);function xW(r){var e=r.name;Xm(r)||(r.name=lhe(r)||e)}function lhe(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 uhe(r){return r.model.getRawData().count()}function che(r){var e=r.model;return e.setData(e.getRawData().cloneShallow()),fhe}function fhe(r,e){e.outputData&&r.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function SW(r,e){N(np(r.CHANGABLE_METHODS,r.DOWNSAMPLE_METHODS),function(t){r.wrapMethod(t,ot(hhe,e))})}function hhe(r,e){var t=pP(r);return t&&t.setOutputEnd((e||this).count()),e}function pP(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=U1;var dP=function(){function r(){this.group=new Ze,this.uid=zs("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}();Ym(dP);Mf(dP);var tr=dP;function Ao(){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 wW=vt(),phe=Ao(),mP=function(){function r(){this.group=new Ze,this.uid=zs("viewChart"),this.renderTask=Pf({plan:dhe,reset:mhe}),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&&bW(a,n,"emphasis")},r.prototype.downplay=function(e,t,i,n){var a=e.getData(n&&n.dataType);a&&bW(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){ca(this.group,e)},r.markUpdateMethod=function(e,t){wW(e).updateMethod=t},r.protoInitialize=function(){var e=r.prototype;e.type="chart"}(),r}();function MW(r,e,t){r&&Rf(r)&&(e==="emphasis"?Vn:Gn)(r,t)}function bW(r,e,t){var i=Is(r,e),n=e&&e.highlightKey!=null?w4(e.highlightKey):null;i!=null?N(Qt(i),function(a){MW(r.getItemGraphicEl(a),t,n)}):r.eachItemGraphicEl(function(a){MW(a,t,n)})}Ym(mP,["dispose"]);Mf(mP);function dhe(r){return phe(r.model)}function mhe(r){var e=r.model,t=r.ecModel,i=r.api,n=r.payload,a=e.pipelineContext.progressiveRender,o=r.view,s=n&&wW(n).updateMethod,l=a?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](e,t,i,n),vhe[l]}var vhe={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)}}},Zt=mP;var O1="\0__throttleOriginMethod",TW="\0__throttleRate",EW="\0__throttleType";function Y_(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 Vs(r,e,t,i){var n=r[e];if(n){var a=n[O1]||n,o=n[EW],s=n[TW];if(s!==t||o!==i){if(t==null||!i)return r[e]=a;n=r[e]=Y_(a,t,i==="debounce"),n[O1]=a,n[EW]=i,n[TW]=t}return n}}function vc(r,e){var t=r[e];t&&t[O1]&&(t.clear&&t.clear(),r[e]=t[O1])}var AW=vt(),CW={itemStyle:Ga(ED,!0),lineStyle:Ga(TD,!0)},ghe={lineStyle:"stroke",itemStyle:"fill"};function RW(r,e){var t=r.visualStyleMapper||CW[e];return t||(console.warn("Unknown style type '"+e+"'."),CW.itemStyle)}function LW(r,e){var t=r.visualDrawType||ghe[e];return t||(console.warn("Unknown style type '"+e+"'."),"fill")}var DW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){var t=r.getData(),i=r.visualStyleAccessPath||"itemStyle",n=r.getModel(i),a=RW(r,i),o=a(n),s=n.getShallow("decal");s&&(t.setVisual("decal",s),s.dirty=!0);var l=LW(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)}}}},q_=new Kt,PW={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){if(!(r.ignoreStyleOnData||e.isSeriesFiltered(r))){var t=r.getData(),i=r.visualStyleAccessPath||"itemStyle",n=RW(r,i),a=t.getVisual("drawType");return{dataEach:t.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[i]){q_.option=l[i];var u=n(q_),c=o.ensureUniqueItemVisual(s,"style");fe(c,u),q_.option.decal&&(o.setItemVisual(s,"decal",q_.option.decal),q_.option.decal.dirty=!0),a in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},IW={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)),AW(t).scope=a}}),r.eachSeries(function(t){if(!(t.isColorBySeries()||r.isSeriesFiltered(t))){var i=t.getRawData(),n={},a=t.getData(),o=AW(t).scope,s=t.visualStyleAccessPath||"itemStyle",l=LW(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 F1=Math.PI;function vP(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 Et({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});t.add(i);var n=new It({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 Et({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 T_({shape:{startAngle:-F1/2,endAngle:-F1/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:F1*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:F1*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 yhe=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="";Wr(!(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)||Pf({plan:bhe,reset:whe,count:Ehe}));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||Pf({reset:_he});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="";Wr(!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,Pf({reset:xhe,onDirty:Mhe})));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:Ahe(e)}),e.uid=zs("stageHandler"),t&&(e.visualType=t),e},r}();function _he(r){r.overallReset(r.ecModel,r.api,r.payload)}function xhe(r){return r.overallProgress&&She}function She(){this.agent.dirty(),this.getDownstream().dirty()}function Mhe(){this.agent&&this.agent.dirty()}function bhe(r){return r.plan?r.plan(r.model,r.ecModel,r.api,r.payload):null}function whe(r){r.useClearVisual&&r.data.clearAllVisual();var e=r.resetDefines=Qt(r.reset(r.model,r.ecModel,r.api,r.payload));return e.length>1?de(e,function(t,i){return NW(i)}):The}var The=NW(0);function NW(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 Ehe(r){return r.data.count()}function Ahe(r){B1=null;try{r(Z_,UW)}catch{}return B1}var Z_={},UW={},B1;OW(Z_,_1);OW(UW,x1);Z_.eachSeriesByType=Z_.eachRawSeriesByType=function(r){B1=r};Z_.eachComponent=function(r){r.mainType==="series"&&r.subType&&(B1=r.subType)};function OW(r,e){for(var t in e.prototype)r[t]=Ur}var gP=yhe;var zW=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"],FW={color:zW,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],zW]};var fa="#B9B8CE",BW="#100C2A",k1=function(){return{axisLine:{lineStyle:{color:fa}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},kW=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],VW={darkMode:!0,color:kW,backgroundColor:BW,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:fa}},textStyle:{color:fa},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:fa}},dataZoom:{borderColor:"#71708A",textStyle:{color:fa},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:fa}},timeline:{lineStyle:{color:fa},label:{color:fa},controlStyle:{color:fa,borderColor:fa}},calendar:{itemStyle:{color:BW},dayLabel:{color:fa},monthLabel:{color:fa},yearLabel:{color:fa}},timeAxis:k1(),logAxis:k1(),valueAxis:k1(),categoryAxis:k1(),line:{symbol:"circle"},graph:{color:kW},gauge:{title:{color:fa},axisLine:{lineStyle:{color:[[1,"rgba(207,212,219,0.2)"]]}},axisLabel:{color:fa},detail:{color:"#EEF1FA"}},candlestick:{itemStyle:{color:"#f64e56",color0:"#54ea92",borderColor:"#f64e56",borderColor0:"#54ea92"}}};VW.categoryAxis.splitLine.show=!1;var GW=VW;var HW=function(){function r(){}return r.prototype.normalizeQuery=function(e){var t={},i={},n={};if(Ce(e)){var a=Va(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 yP=["symbol","symbolSize","symbolRotate","symbolOffset"],WW=yP.concat(["symbolKeepAspect"]),XW={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<yP.length;o++){var s=yP[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=wt(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}}},YW={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<WW.length;s++){var l=WW[s],u=o.getShallow(l,!0);u!=null&&n.setItemVisual(a,l,u)}}return{dataEach:t.hasItemOption?i:null}}};function j_(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 yu(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 _P(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 V1(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 gv(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=Is(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 qW(r,e,t){r.on("selectchanged",function(i){var n=t.getModel();i.isFromClick?(gv("map","selectchanged",e,n,i),gv("pie","selectchanged",e,n,i)):i.fromAction==="select"?(gv("map","selected",e,n,i),gv("pie","selected",e,n,i)):i.fromAction==="unselect"&&(gv("map","unselected",e,n,i),gv("pie","unselected",e,n,i))})}function Cl(r,e,t){for(var i;r&&!(e(r)&&(i=r,t));)r=r.__hostTarget||r.parent;return i}var Che=Math.round(Math.random()*9),Rhe=typeof Object.defineProperty=="function",Lhe=function(){function r(){this._id="__ec_inner_"+Che++}return r.prototype.get=function(e){return this._guard(e)[this._id]},r.prototype.set=function(e,t){var i=this._guard(e);return Rhe?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}(),ZW=Lhe;var Dhe=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()}}),Phe=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()}}),Ihe=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()}}),Nhe=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()}}),Uhe={line:ei,rect:Et,roundRect:Et,square:Et,circle:ua,diamond:Phe,pin:Ihe,arrow:Nhe,triangle:Dhe},Ohe={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}},K_={};N(Uhe,function(r,e){K_[e]=new r});var zhe=ut.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(r,e,t){var i=Sp(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=K_[i];n||(i="rect",n=K_[i]),Ohe[i](e.x,e.y,e.width,e.height,n.shape),n.buildPath(r,n.shape,t)}}});function Fhe(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 Mr(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=xD(r.slice(8),new lt(e,t,i,n),o?"center":"cover"):r.indexOf("path://")===0?l=nv(r.slice(7),{},new lt(e,t,i,n),o?"center":"cover"):l=new zhe({shape:{symbolType:r,x:e,y:t,width:i,height:n}}),l.__isEmptyBrush=s,l.setColor=Fhe,a&&l.setColor(a),l}function Rl(r){return pe(r)||(r=[+r,+r]),[r[0]||0,r[1]||0]}function Co(r,e){if(r!=null)return pe(r)||(r=[r,r]),[ze(r[0],e[0])||0,ze(ft(r[1],r[0]),e[1])||0]}function jp(r){return isFinite(r)}function Bhe(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=jp(i)?i:0,n=jp(n)?n:1,a=jp(a)?a:0,o=jp(o)?o:0;var s=r.createLinearGradient(i,a,n,o);return s}function khe(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=jp(o)?o:.5,s=jp(s)?s:.5,l=l>=0&&jp(l)?l:.5;var u=r.createRadialGradient(o,s,0,o,s,l);return u}function J_(r,e,t){for(var i=e.type==="radial"?khe(r,e,t):Bhe(r,e,t),n=e.colorStops,a=0;a<n.length;a++)i.addColorStop(n[a].offset,n[a].color);return i}function KW(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 G1(r){return parseInt(r,10)}function Nf(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]||G1(s[i])||G1(r.style[i]))-(G1(s[a])||0)-(G1(s[o])||0)|0}function Vhe(r,e){return!r||r==="solid"||!(e>0)?null:r==="dashed"?[4*e,2*e]:r==="dotted"?[e]:Ct(r)?[r]:pe(r)?r:null}function $_(r){var e=r.style,t=e.lineDash&&e.lineWidth>0&&Vhe(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 Ghe=new $i(!0);function H1(r){var e=r.stroke;return!(e==null||e==="none"||!(r.lineWidth>0))}function JW(r){return typeof r=="string"&&r!=="none"}function W1(r){var e=r.fill;return e!=null&&e!=="none"}function $W(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 QW(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 X1(r,e,t){var i=h_(e.image,e.__image,t);if(qm(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)*Em),a.scaleSelf(e.scaleX||1,e.scaleY||1),n.setTransform(a)}return n}}function Hhe(r,e,t,i){var n,a=H1(t),o=W1(t),s=t.strokePercent,l=s<1,u=!e.path;(!e.silent||l)&&u&&e.createPathProxy();var c=e.path||Ghe,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?J_(r,h,S):e.__canvasFillGradient,e.__canvasFillGradient=_),g&&(y=f?J_(r,p,S):e.__canvasStrokeGradient,e.__canvasStrokeGradient=y),m&&(x=f||!e.__canvasFillPattern?X1(r,h,e):e.__canvasFillPattern,e.__canvasFillPattern=x),v&&(M=f||!e.__canvasStrokePattern?X1(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=$_(e),T=n[0],C=n[1]);var b=!0;(u||f&df)&&(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&&QW(r,t),o&&$W(r,t)):(o&&$W(r,t),a&&QW(r,t))),T&&r.setLineDash([])}function Whe(r,e,t){var i=e.__image=h_(t.image,e.__image,e,e.onload);if(!(!i||!qm(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 Xhe(r,e,t){var i,n=t.text;if(n!=null&&(n+=""),n){r.font=t.font||yo,r.textAlign=t.textAlign,r.textBaseline=t.textBaseline;var a=void 0,o=void 0;r.setLineDash&&t.lineDash&&(i=$_(e),a=i[0],o=i[1]),a&&(r.setLineDash(a),r.lineDashOffset=o),t.strokeFirst?(H1(t)&&r.strokeText(n,t.x,t.y),W1(t)&&r.fillText(n,t.x,t.y)):(W1(t)&&r.fillText(n,t.x,t.y),H1(t)&&r.strokeText(n,t.x,t.y)),a&&r.setLineDash([])}}var e8=["shadowBlur","shadowOffsetX","shadowOffsetY"],t8=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function s8(r,e,t,i,n){var a=!1;if(!i&&(t=t||{},e===t))return!1;if(i||e.opacity!==t.opacity){Za(r,n),a=!0;var o=Math.max(Math.min(e.opacity,1),0);r.globalAlpha=isNaN(o)?uu.opacity:o}(i||e.blend!==t.blend)&&(a||(Za(r,n),a=!0),r.globalCompositeOperation=e.blend||uu.blend);for(var s=0;s<e8.length;s++){var l=e8[s];(i||e[l]!==t[l])&&(a||(Za(r,n),a=!0),r[l]=r.dpr*(e[l]||0))}return(i||e.shadowColor!==t.shadowColor)&&(a||(Za(r,n),a=!0),r.shadowColor=e.shadowColor||uu.shadowColor),a}function r8(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=s8(r,a,o,i,n);if((i||a.fill!==o.fill)&&(s||(Za(r,n),s=!0),JW(a.fill)&&(r.fillStyle=a.fill)),(i||a.stroke!==o.stroke)&&(s||(Za(r,n),s=!0),JW(a.stroke)&&(r.strokeStyle=a.stroke)),(i||a.opacity!==o.opacity)&&(s||(Za(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||(Za(r,n),s=!0),r.lineWidth=u)}for(var c=0;c<t8.length;c++){var f=t8[c],h=f[0];(i||a[h]!==o[h])&&(s||(Za(r,n),s=!0),r[h]=a[h]||f[1])}return s}function Yhe(r,e,t,i,n){return s8(r,Q_(e,n.inHover),t&&Q_(t,n.inHover),i,n)}function l8(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 qhe(r,e,t){for(var i=!1,n=0;n<r.length;n++){var a=r[n];i=i||a.isZeroArea(),l8(e,a),e.beginPath(),a.buildPath(e,a.shape),e.clip()}t.allClipped=i}function Zhe(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 i8=1,n8=2,a8=3,o8=4;function jhe(r){var e=W1(r),t=H1(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 Za(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 Y1(r,e){Uf(r,e,{inHover:!1,viewWidth:0,viewHeight:0},!0)}function Uf(r,e,t,i){var n=e.transform;if(!e.shouldBePainted(t.viewWidth,t.viewHeight,!1,!1)){e.__dirty&=~ki,e.__isRendered=!1;return}var a=e.__clipPaths,o=t.prevElClipPaths,s=!1,l=!1;if((!o||KW(a,o))&&(o&&o.length&&(Za(r,t),r.restore(),l=s=!0,t.prevElClipPaths=null,t.allClipped=!1,t.prevEl=null),a&&a.length&&(Za(r,t),r.save(),qhe(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&&jhe(e.style);s||Zhe(n,u.transform)?(Za(r,t),l8(r,e)):c||Za(r,t);var f=Q_(e,t.inHover);e instanceof ut?(t.lastDrawType!==i8&&(l=!0,t.lastDrawType=i8),r8(r,e,u,l,t),(!c||!t.batchFill&&!t.batchStroke)&&r.beginPath(),Hhe(r,e,f,c),c&&(t.batchFill=f.fill||"",t.batchStroke=f.stroke||"")):e instanceof tc?(t.lastDrawType!==a8&&(l=!0,t.lastDrawType=a8),r8(r,e,u,l,t),Xhe(r,e,f)):e instanceof Br?(t.lastDrawType!==n8&&(l=!0,t.lastDrawType=n8),Yhe(r,e,u,l,t),Whe(r,e,f)):e.getTemporalDisplayables&&(t.lastDrawType!==o8&&(l=!0,t.lastDrawType=o8),Khe(r,e,t)),c&&i&&Za(r,t),e.innerAfterBrush(),e.afterBrush&&e.afterBrush(),t.prevEl=e,e.__dirty=0,e.__isRendered=!0}function Khe(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(),Uf(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(),Uf(r,l,a,u===c-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),a.prevEl=l}e.clearTemporalDisplayables(),e.notClear=!0,r.restore()}var xP=new ZW,u8=new Ju(100),c8=["symbol","symbolSize","symbolKeepAspect","color","backgroundColor","dashArrayX","dashArrayY","maxTileWidth","maxTileHeight"];function Ll(r,e){if(r==="none")return null;var t=e.getDevicePixelRatio(),i=e.getZr(),n=i.painter.type==="svg";r.dirty&&xP.delete(r);var a=xP.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,xP.set(r,s),r.dirty=!1,s;function l(u){for(var c=[t],f=!0,h=0;h<c8.length;++h){var p=o[c8[h]];if(p!=null&&!pe(p)&&!Ce(p)&&!Ct(p)&&typeof p!="boolean"){f=!1;break}c.push(p)}var d;if(f){d=c.join(",")+(n?"-svg":"");var g=u8.get(d);g&&(n?u.svgElement=g:u.image=g)}var m=h8(o.dashArrayX),v=Jhe(o.dashArrayY),_=f8(o.symbol),y=$he(m),x=p8(v),M=!n&&kn.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&&u8.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=U2(E,y[I]);for(var A=1,I=0,R=_.length;I<R;++I)A=U2(A,_[I].length);E*=A;var P=x*y.length*_.length;if(0)var U;return{width:Math.max(1,Math.min(E,o.maxTileWidth)),height:Math.max(1,Math.min(P,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,P=0,U=0;R<w.height;){if(A%2===0){for(var B=P/2%_.length,z=0,k=0,G=0;z<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=z+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])}z+=m[U][k],++G,++k,k===m[U].length&&(k=0)}++U,U===m.length&&(U=0)}R+=v[A],++P,++A,A===v.length&&(A=0)}function ue(se,Ee,q,H,We){var _e=n?1:t,xe=Mr(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 Y1(T,xe)}}}}function f8(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 f8([r]);for(var i=[],t=0;t<r.length;++t)Ce(r[t])?i.push([r[t]]):i.push(r[t]);return i}function h8(r){if(!r||r.length===0)return[[0,0]];if(Ct(r)){var e=Math.ceil(r);return[[e,e]]}for(var t=!0,i=0;i<r.length;++i)if(!Ct(r[i])){t=!1;break}if(t)return h8([r]);for(var n=[],i=0;i<r.length;++i)if(Ct(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 Jhe(r){if(!r||typeof r=="object"&&r.length===0)return[0,0];if(Ct(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 $he(r){return de(r,function(e){return p8(e)})}function p8(r){for(var e=0,t=0;t<r.length;++t)e+=r[t];return r.length%2===1?e*2:e}function SP(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=Ll(s,e)}});var n=i.getVisual("decal");if(n){var a=i.getVisual("style");a.decal=Ll(n,e)}}})}var Qhe=new Ni,Gs=Qhe;var d8={};function m8(r,e){d8[r]=e}function v8(r){return d8[r]}var epe=1,tpe=800,rpe=900,ipe=1e3,npe=2e3,ape=5e3,E8=1e3,ope=1100,PP=2e3,A8=3e3,spe=4e3,J1=4500,lpe=4600,upe=5e3,cpe=6e3,C8=7e3,R8={PROCESSOR:{FILTER:ipe,SERIES_FILTER:tpe,STATISTIC:ape},VISUAL:{LAYOUT:E8,PROGRESSIVE_LAYOUT:ope,GLOBAL:PP,CHART:A8,POST_CHART_LAYOUT:lpe,COMPONENT:spe,BRUSH:upe,CHART_ITEM:J1,ARIA:cpe,DECAL:C8}},qn="__flagInMainProcess",ja="__pendingUpdate",MP="__needsUpdateStatus",g8=/^[a-zA-Z0-9_]+$/,bP="__connectUpdateStatus",y8=0,fpe=1,hpe=2;function L8(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.isDisposed()){this.id;return}return P8(this,r,e)}}function D8(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return P8(this,r,e)}}function P8(r,e,t){return t[0]=t[0]&&t[0].toLowerCase(),Ni.prototype[e].apply(r,t)}var I8=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Ni),N8=I8.prototype;N8.on=D8("on");N8.off=D8("off");var yv,wP,q1,Of,TP,EP,AP,ex,tx,_8,x8,CP,S8,Z1,M8,U8,Hs,b8,O8=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,new HW)||this;a._chartsViews=[],a._chartsMap={},a._componentsViews=[],a._componentsMap={},a._pendingActions=[],n=n||{},Ce(i)&&(i=z8[i]),a._dom=t;var o="canvas",s="auto",l=!1;if(0)var u;n.ssr&&tH(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=P2(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=Y_(Be(c.flush,c),17),i=Qe(i),i&&S1(i,!0),a._theme=i,a._locale=g5(n.locale||a1),a._coordSysMgr=new pc;var f=a._api=M8(a);function h(p,d){return p.__prio-d.__prio}return up(K1,h),up(RP,h),a._scheduler=new gP(a,f,RP,K1),a._messageCenter=new I8,a._initEvents(),a.resize=Be(a.resize,a),c.animation.on("frame",a._onframe,a),_8(c,a),x8(c,a),ip(a),a}return e.prototype._onframe=function(){if(!this._disposed){b8(this);var t=this._scheduler;if(this[ja]){var i=this[ja].silent;this[qn]=!0;try{yv(this),Of.update.call(this,null,this[ja].updateParams)}catch(l){throw this[qn]=!1,this[ja]=null,l}this._zr.flush(),this[qn]=!1,this[ja]=null,ex.call(this,i),tx.call(this,i)}else if(t.unfinished){var n=epe,a=this._model,o=this._api;t.unfinished=!1;do{var s=+new Date;t.performSeriesTasks(a),t.performDataProcessorTasks(a),EP(this,a),t.performVisualTasks(a),Z1(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[qn]){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[qn]=!0,!this._model||i){var l=new X5(this._api),u=this._theme,c=this._model=new _1;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(t,{replaceMerge:o},LP);var f={seriesTransition:s,optionChanged:!0};if(n)this[ja]={silent:a,updateParams:f},this[qn]=!1,this.getZr().wakeUp();else{try{yv(this),Of.update.call(this,null,f)}catch(h){throw this[ja]=null,this[qn]=!1,h}this._ssr||this._zr.flush(),this[ja]=null,this[qn]=!1,ex.call(this,a),tx.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||Bt.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(Bt.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(w8[n]){var l=s,u=s,c=-s,f=-s,h=[],p=t&&t.pixelRatio||this.getDevicePixelRatio();N(ix,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=kn.createCanvas(),v=P2(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 Et({shape:{x:0,y:0,width:d,height:g},style:{fill:t.connectedBackgroundColor}})),N(h,function(y){var x=new Br({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 TP(this,"convertToPixel",t,i)},e.prototype.convertFromPixel=function(t,i){return TP(this,"convertFromPixel",t,i)},e.prototype.containPixel=function(t,i){if(this._disposed){this.id;return}var n=this._model,a,o=xf(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=xf(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?j_(s,l,i):yu(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(ppe,function(i){var n=function(a){var o=t.getModel(),s=a.target,l,u=i==="globalout";if(u?l={}:s&&Cl(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(rx,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)}),qW(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&&z2(this.getDom(),NP,"");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 ix[i.id]},e.prototype.resize=function(t){if(!this[qn]){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[ja]&&(a==null&&(a=this[ja].silent),n=!0,this[ja]=null),this[qn]=!0;try{n&&yv(this),Of.update.call(this,{type:"resize",animation:fe({duration:0},t&&t.animation)})}catch(o){throw this[qn]=!1,o}this[qn]=!1,ex.call(this,a),tx.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(),!!DP[t]){var n=DP[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=rx[t.type],i},e.prototype.dispatchAction=function(t,i){if(this._disposed){this.id;return}if(qe(i)||(i={silent:!!i}),!!j1[t.type]&&this._model){if(this[qn]){this._pendingActions.push(t);return}var n=i.silent;AP.call(this,t,n);var a=i.flush;a?this._zr.flush():a!==!1&&Bt.browser.weChat&&this._throttledZrFlush(),ex.call(this,n),tx.call(this,n)}},e.prototype.updateLabelLayout=function(){Gs.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(){yv=function(f){var h=f._scheduler;h.restorePipelines(f._model),h.prepareStageTasks(),wP(f,!0),wP(f,!1),h.plan()},wP=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=Va(S.type),E=h?tr.getClass(b.main,b.sub):Zt.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)}},q1=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(Qt(y),function(S){var w=Kr(S,null);w!=null&&x.set(w,!0)})),m&&m.eachComponent(_,function(S){var w=x&&x.get(S.id)!=null;if(!w)if(hD(p))if(S instanceof Jt)p.type===Cf&&!p.notBlur&&!S.get(["emphasis","disabled"])&&y4(S,p,f._api);else{var T=Bw(S.mainType,S.componentIndex,p.name,f._api),C=T.focusSelf,b=T.dispatchers;p.type===Cf&&C&&!p.notBlur&&Ow(S.mainType,S.componentIndex,f._api),b&&N(b,function(E){p.type===Cf?Vn(E):Gn(E)})}else Vw(p)&&S instanceof Jt&&(S4(S,p,f._api),fD(S),Hs(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)}},Of={prepareAndUpdate:function(f){yv(this),Of.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),EP(this,p),m.update(p,d),t(p),v.performVisualTasks(p,f),CP(this,p,d,f,h);var _=p.get("backgroundColor")||"transparent",y=p.get("darkMode");g.setBackgroundColor(_),y!=null&&y!=="auto"&&g.setDarkMode(y),Gs.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}),Z1(this,p,d,f,{},m),Gs.trigger("afterupdate",p,d)}},updateView:function(f){var h=this._model;h&&(h.setUpdatePayload(f),Zt.markUpdateMethod(f,"updateView"),t(h),this._scheduler.performVisualTasks(h,f,{setDirty:!0}),CP(this,h,this._api,f,{}),Gs.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()}),Zt.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)}),Gs.trigger("afterupdate",p,this._api))},updateLayout:function(f){Of.update.call(this,f)}},TP=function(f,h,p,d){if(f._disposed){f.id;return}for(var g=f._model,m=f._coordSysMgr.getCoordinateSystems(),v,_=xf(g,p),y=0;y<m.length;y++){var x=m[y];if(x[h]&&(v=x[h](g,_,d))!=null)return v}},EP=function(f,h){var p=f._chartsMap,d=f._scheduler;h.eachSeries(function(g){d.updateStreamModes(g,p[g.__viewId])})},AP=function(f,h){var p=this,d=this.getModel(),g=f.type,m=f.escapeConnect,v=j1[g],_=v.actionInfo,y=(_.update||"update").split(":"),x=y.pop(),M=y[0]!=null&&Va(y[0]);this[qn]=!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=Vw(f),E=hD(f);if(E&&cD(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 P=c_(f),U=P.queryOptionMap,B=P.mainTypeSpecified,z=B?U.keys()[0]:"series";q1(p,x,A,z),Hs(p)}else b?(q1(p,x,A,"series"),Hs(p)):M&&q1(p,x,A,M.main,M.sub)}),x!=="none"&&!E&&!b&&!M)try{this[ja]?(yv(this),Of.update.call(this,f),this[ja]=null):Of[x].call(this,f)}catch(A){throw this[qn]=!1,A}if(w?C={type:_.event||g,escapeConnect:m,batch:T}:C=T[0],this[qn]=!1,!h){var I=this._messageCenter;if(I.trigger(C.type,C),b){var R={type:"selectchanged",escapeConnect:m,selected:M4(d),isFromClick:f.isFromClick||!1,fromAction:f.type,fromActionPayload:f};I.trigger(R.type,R)}}},ex=function(f){for(var h=this._pendingActions;h.length;){var p=h.shift();AP.call(this,p,f)}},tx=function(f){!f&&this.trigger("updated")},_8=function(f,h){f.on("rendered",function(p){h.trigger("rendered",p),f.animation.isFinished()&&!h[ja]&&!h._scheduler.unfinished&&!h._pendingActions.length&&h.trigger("finished")})},x8=function(f,h){f.on("mouseover",function(p){var d=p.target,g=Cl(d,Rf);g&&(_4(g,p,h._api),Hs(h))}).on("mouseout",function(p){var d=p.target,g=Cl(d,Rf);g&&(x4(g,p,h._api),Hs(h))}).on("click",function(p){var d=p.target,g=Cl(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;up(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)})}}CP=function(f,h,p,d,g){i(h),S8(f,h,p,d,g),N(f._chartsViews,function(m){m.__alive=!1}),Z1(f,h,p,d,g),N(f._chartsViews,function(m){m.__alive||m.remove(h,p)})},S8=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)})},Z1=function(f,h,p,d,g,m){var v=f._scheduler;g=fe(g||{},{updatedSeries:h.getSeries()}),Gs.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),fD(y)}),v.unfinished=_||v.unfinished,Gs.trigger("series:layoutlabels",h,p,g),Gs.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),Gs.trigger("series:afterupdate",h,p,g)},Hs=function(f){f[MP]=!0,f.getZr().wakeUp()},b8=function(f){f[MP]&&(f.getZr().storage.traverse(function(h){ac(h)||n(h)}),f[MP]=!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===g_&&f.states.emphasis?h.push("emphasis"):f.hoverState===Pp&&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")&&!Bt.node&&!Bt.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(!ac(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(ac(v))return;if(v instanceof ut&&T4(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)}})}M8=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){Vn(d,g),Hs(f)},p.prototype.leaveEmphasis=function(d,g){Gn(d,g),Hs(f)},p.prototype.enterBlur=function(d){Fw(d),Hs(f)},p.prototype.leaveBlur=function(d){x_(d),Hs(f)},p.prototype.enterSelect=function(d){lD(d),Hs(f)},p.prototype.leaveSelect=function(d){uD(d),Hs(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}(x1))(f)},U8=function(f){function h(p,d){for(var g=0;g<p.length;g++){var m=p[g];m[bP]=d}}N(rx,function(p,d){f._messageCenter.on(d,function(g){if(w8[f.group]&&f[bP]!==y8){if(g&&g.escapeConnect)return;var m=f.makeActionFromEvent(g),v=[];N(ix,function(_){_!==f&&_.group===f.group&&v.push(_)}),h(v,y8),N(v,function(_){_[bP]!==fpe&&_.dispatchAction(m)}),h(v,hpe)}})})}}(),e}(Ni),IP=O8.prototype;IP.on=L8("on");IP.off=L8("off");IP.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 ppe=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];var j1={},rx={},RP=[],LP=[],K1=[],z8={},DP={},ix={},w8={},dpe=+new Date-0,N5e=+new Date-0,NP="_echarts_instance_";function _v(r,e,t){var i=!(t&&t.ssr);if(i){var n=mpe(r);if(n)return n}var a=new O8(r,e,t);return a.id="ec_"+dpe++,ix[a.id]=a,i&&z2(r,NP,a.id),U8(a),Gs.trigger("afterinit",a),a}function mpe(r){return ix[yH(r,NP)]}function F8(r,e){z8[r]=e}function UP(r){dt(LP,r)<0&&LP.push(r)}function OP(r,e){zP(RP,r,e,npe)}function B8(r){$1("afterinit",r)}function k8(r){$1("afterupdate",r)}function $1(r,e){Gs.on(r,e)}function ha(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,!rx[e]&&(Wr(g8.test(i)&&g8.test(e)),j1[i]||(j1[i]={action:t,actionInfo:r}),rx[e]=i)}function V8(r,e){pc.register(r,e)}function G8(r,e){zP(K1,r,e,E8,"layout")}function zf(r,e){zP(K1,r,e,A8,"visual")}var T8=[];function zP(r,e,t,i,n){if((He(e)||qe(e))&&(t=e,e=i),!(dt(T8,t)>=0)){T8.push(t);var a=gP.wrapStageHandler(t,n);a.__prio=e,a.__raw=t,r.push(a)}}function FP(r,e){DP[r]=e}function H8(r,e,t){var i=v8("registerMap");i&&i(r,e,t)}var W8=uW;zf(PP,DW);zf(J1,PW);zf(J1,IW);zf(PP,XW);zf(J1,YW);zf(C8,SP);UP(S1);OP(rpe,$D);FP("default",vP);ha({type:Cf,event:Cf,update:Cf},Ur);ha({type:y_,event:y_,update:y_},Ur);ha({type:Jm,event:Jm,update:Jm},Ur);ha({type:__,event:__,update:__},Ur);ha({type:$m,event:$m,update:$m},Ur);F8("light",FW);F8("dark",GW);var X8=[],vpe={registerPreprocessor:UP,registerProcessor:OP,registerPostInit:B8,registerPostUpdate:k8,registerUpdateLifecycle:$1,registerAction:ha,registerCoordinateSystem:V8,registerLayout:G8,registerVisual:zf,registerTransform:W8,registerLoading:FP,registerMap:H8,registerImpl:m8,PRIORITY:R8,ComponentModel:Nt,ComponentView:tr,SeriesModel:Jt,ChartView:Zt,registerComponentModel:function(r){Nt.registerClass(r)},registerComponentView:function(r){tr.registerClass(r)},registerSeriesModel:function(r){Jt.registerClass(r)},registerChartView:function(r){Zt.registerClass(r)},registerSubTypeDefaulter:function(r,e){Nt.registerSubTypeDefaulter(r,e)},registerPainter:function(r,e){QG(r,e)}};function Ot(r){if(pe(r)){N(r,function(e){Ot(e)});return}dt(X8,r)>=0||(X8.push(r),He(r)&&(r={install:r}),r.install(vpe))}function nx(r){return r==null?0:r.length||1}function Y8(r){return r}var gpe=function(){function r(e,t,i,n,a,o){this._old=e,this._new=t,this._oldKeyGetter=i||Y8,this._newKeyGetter=n||Y8,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=nx(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=nx(u),h=nx(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=nx(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=nx(l);u===0?(t[s]=o,a&&i.push(s)):u===1?t[s]=[l,o]:l.push(o)}}},r}(),Rn=gpe;var ype=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 q8(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;BP(i,d)[g]=h,p.isExtraCoord||(n.set(d,1),_pe(p.type)&&(a[0]=h),BP(s,d)[g]=r.getDimensionIndex(p.name)),p.defaultTooltip&&o.push(h)}d1.each(function(m,v){var _=BP(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 ype(s,e),t}function BP(r,e){return r.hasOwnProperty(e)||(r[e]=[]),r[e]}function Kp(r){return r==="category"?"ordinal":r==="time"?"time":"float"}function _pe(r){return!(r==="ordinal"||r==="time")}var xpe=function(){function r(e){this.otherDims={},e!=null&&fe(this,e)}return r}(),xv=xpe;var Spe=vt(),Mpe={float:"f",int:"i",ordinal:"o",number:"n",time:"t"},kP=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=GP(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=b1(this.source),i=!HP(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+=Mpe[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 eT(r){return r instanceof kP}function VP(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 GP(r){var e=Spe(r);return e.dimNameMap||(e.dimNameMap=VP(r.dimensionsDefine))}function HP(r){return r>30}var ax=qe,Ff=de,bpe=typeof Int32Array>"u"?Array:Int32Array,wpe="e\0\0",Z8=-1,Tpe=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],Epe=["_approximateExtent"],j8,tT,ox,sx,WP,rT,XP,Ape=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;eT(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 xv({name:f}):f instanceof xv?f:new xv(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(Ct(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 W_&&(a=e),!a){var o=this.dimensions,s=pv(e)||fi(e)?new w1(e,o.length):e;a=new W_;var l=Ff(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=q8(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&&XP(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!==Eo&&!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===pn;if(l&&!n.pure)for(var u=[],c=e;c<t;c++){var f=n.getItem(c,u);if(!this.hasItemOption&&hH(f)&&(this.hasItemOption=!0),f){var h=f.name;a[c]==null&&h!=null&&(a[c]=Kr(h,null));var p=f.id;o[c]==null&&p!=null&&(o[c]=Kr(p,null))}}if(this._shouldMakeIdFromName())for(var c=e;c<t;c++)XP(this,c);j8(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){ax(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=ox(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 tT(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(Ff(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)?Z8: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=Ff(sx(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=Ff(sx(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=wt(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=Ff(sx(e),this._getStoreDimIndex,this),s=rT(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=Ff(sx(e),this._getStoreDimIndex,this);this._store.modify(s,o?Be(t,o):t)},r.prototype.downSample=function(e,t,i,n){var a=rT(this);return a._store=this._store.downSample(this._getStoreDimIndex(e),t,i,n),a},r.prototype.lttbDownSample=function(e,t){var i=rT(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 Kt(i,t,t&&t.ecModel)},r.prototype.diff=function(e){var t=this;return new Rn(e?e.getStore().getIndices():[],this.getStore().getIndices(),function(i){return tT(e,i)},function(i){return tT(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||{},ax(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():ax(a)&&(a=fe({},a)),n[t]=a),a},r.prototype.setItemVisual=function(e,t,i){var n=this._itemVisuals[e]||{};this._itemVisuals[e]=n,ax(t)?fe(n,t):n[t]=i},r.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},r.prototype.setLayout=function(e,t){ax(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;v_(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:Ff(this.dimensions,this._getDimInfo,this),this.hostModel)),WP(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(Vb(arguments)))})},r.internalField=function(){j8=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 bpe(o.categories.length);for(var l=0;l<i.length;l++)i[l]=Z8;for(var l=0;l<s.count();l++)i[s.get(a.storeDimIndex,l)]=l}})},ox=function(e,t,i){return Kr(e._getCategory(t,i),null)},tT=function(e,t){var i=e._idList[t];return i==null&&e._idDimIdx!=null&&(i=ox(e,e._idDimIdx,t)),i==null&&(i=wpe+t),i},sx=function(e){return pe(e)||(e=e!=null?[e]:[]),e},rT=function(e){var t=new r(e._schema?e._schema:Ff(e.dimensions,e._getDimInfo,e),e.hostModel);return WP(t,e),t},WP=function(e,t){N(Tpe.concat(t.__wrappedMethods||[]),function(i){t.hasOwnProperty(i)&&(e[i]=t[i])}),e.__wrappedMethods=t.__wrappedMethods,N(Epe,function(i){e[i]=Qe(t[i])}),e._calculationInfo=fe({},t._calculationInfo)},XP=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=ox(e,a,t)),l==null&&o!=null&&(n[t]=l=ox(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}(),ai=Ape;function Dl(r,e){pv(r)||(r=dv(r)),e=e||{};var t=e.coordDimensions||[],i=e.dimensionsDefine||r.dimensionsDefine||[],n=ke(),a=[],o=Rpe(r,t,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&HP(o),l=i===r.dimensionsDefine,u=l?GP(r):VP(i),c=e.encodeDefine;!c&&e.encodeDefaulter&&(c=e.encodeDefaulter(r,o));for(var f=ke(c),h=new lP(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 xv,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 P=a.length;return h[C]=P,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=Qt(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 P=Ce(R)?u.get(R):R;P!=null&&P<o&&(I[A]=P,m(d(P),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 P=f.get(b);if(P!==!1){if(P=Qt(P),!P.length)for(var U=0;U<(E&&E.length||1);U++){for(;g<o&&d(g).coordDim!=null;)g++;g<o&&P.push(g++)}N(P,function(B,z){var k=d(B);if(l&&R.type!=null&&(k.type=R.type),m(Ye(k,R),b,z),k.name==null&&E){var G=E[z];!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){d1.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=Lpe(x,n,y),w.coordDimIndex=0,(!v||_<=0)&&(w.isExtraCoord=!0),_--),M(w),w.type==null&&(g1(r,S)===Qi.Must||w.isExtraCoord&&(w.otherDims.itemName!=null||w.otherDims.seriesName!=null))&&(w.type="ordinal")}return Cpe(a),new kP({source:r,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function Cpe(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 Rpe(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 Lpe(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 Dpe=function(){function r(e){this.coordSysDims=[],this.axisMap=ke(),this.categoryAxisMap=ke(),this.coordSysName=e}return r}();function K8(r){var e=r.get("coordinateSystem"),t=new Dpe(e),i=Ppe[e];if(i)return i(r,t,t.axisMap,t.categoryAxisMap),t}var Ppe={cartesian2d:function(r,e,t,i){var n=r.getReferringComponents("xAxis",Rr).models[0],a=r.getReferringComponents("yAxis",Rr).models[0];e.coordSysDims=["x","y"],t.set("x",n),t.set("y",a),Sv(n)&&(i.set("x",n),e.firstCategoryDimIndex=0),Sv(a)&&(i.set("y",a),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},singleAxis:function(r,e,t,i){var n=r.getReferringComponents("singleAxis",Rr).models[0];e.coordSysDims=["single"],t.set("single",n),Sv(n)&&(i.set("single",n),e.firstCategoryDimIndex=0)},polar:function(r,e,t,i){var n=r.getReferringComponents("polar",Rr).models[0],a=n.findAxisModel("radiusAxis"),o=n.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],t.set("radius",a),t.set("angle",o),Sv(a)&&(i.set("radius",a),e.firstCategoryDimIndex=0),Sv(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),Sv(u)&&(i.set(c,u),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=l))})}};function Sv(r){return r.get("type")==="category"}function J8(r,e,t){t=t||{};var i=t.byIndex,n=t.stackedCoordDimension,a,o,s;Ipe(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 Ipe(r){return!eT(r.schema)}function Ro(r,e){return!!e&&e===r.getCalculationInfo("stackedDimension")}function iT(r,e){return Ro(r,e)?r.getCalculationInfo("stackResultDimension"):e}function Npe(r,e){var t=r.get("coordinateSystem"),i=pc.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=Kp(l)}return o})),n||(n=i&&(i.getDimensionsInfo?i.getDimensionsInfo():i.dimensions.slice())||["x","y"]),n}function Upe(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 Ope(r,e,t){t=t||{};var i=e.getSourceManager(),n,a=!1;r?(a=!0,n=dv(r)):(n=i.getSource(),a=n.sourceFormat===pn);var o=K8(e),s=Npe(e,o),l=t.useEncodeDefaulter,u=He(l)?l:l?ot(m1,s,e):null,c={coordDimensions:s,generateCoord:t.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!a},f=Dl(n,c),h=Upe(f.dimensions,t.createInvertedIndices,o),p=a?null:i.getSharedDataStore(f),d=J8(e,{schema:f,store:p}),g=new ai(f,e);g.setCalculationInfo(d);var m=h!=null&&zpe(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 zpe(r){if(r.sourceFormat===pn){var e=Fpe(r.data||[]);return!pe(yl(e))}}function Fpe(r){for(var e=0;e<r.length&&r[e]==null;)e++;return r[e]}var dn=Ope;var $8=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}();Mf($8);var Ka=$8;var Bpe=0,kpe=function(){function r(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++Bpe}return r.createByAxisModel=function(e){var t=e.option,i=t.data,n=i&&de(i,Vpe);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 Vpe(r){return qe(r)&&r.value!=null?r.value:r+""}var lx=kpe;function ux(r){return r.type==="interval"||r.type==="log"}function e6(r,e,t,i){var n={},a=r[1]-r[0],o=n.interval=Gm(a/e,!0);t!=null&&o<t&&(o=n.interval=t),i!=null&&o>i&&(o=n.interval=i);var s=n.intervalPrecision=YP(o),l=n.niceTickExtent=[Cr(Math.ceil(r[0]/o)*o,s),Cr(Math.floor(r[1]/o)*o,s)];return Gpe(l,r),n}function nT(r){var e=Math.pow(10,Vm(r)),t=r/e;return t?t===2?t=3:t===3?t=5:t*=2:t=1,Cr(t*e)}function YP(r){return bn(r)+2}function Q8(r,e,t){r[e]=Math.max(Math.min(r[e],t[1]),t[0])}function Gpe(r,e){!isFinite(r[0])&&(r[0]=e[0]),!isFinite(r[1])&&(r[1]=e[1]),Q8(r,0,e),Q8(r,1,e),r[0]>r[1]&&(r[0]=r[1])}function Bf(r,e){return r>=e[0]&&r<=e[1]}function kf(r,e){return e[1]===e[0]?.5:(r-e[0])/(e[1]-e[0])}function Vf(r,e){return r*(e[1]-e[0])+e[0]}var t6=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 lx({})),pe(n)&&(n=new lx({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),Bf(t,this._extent)&&this._ordinalMeta.categories[t]!=null},e.prototype.normalize=function(t){return t=this._getTickNumber(this.parse(t)),kf(t,this._extent)},e.prototype.scale=function(t){return t=Math.round(Vf(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}(Ka);Ka.registerClass(t6);var cx=t6;var Jp=Cr,r6=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 Bf(t,this._extent)},e.prototype.normalize=function(t){return kf(t,this._extent)},e.prototype.scale=function(t){return Vf(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=YP(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:Jp(a[0]-i,o)}):s.push({value:n[0]}));for(var u=a[0];u<=a[1]&&(s.push({value:u}),u=Jp(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:Jp(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=Jp(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=bn(t.value)||0:n==="auto"&&(n=this._intervalPrecision);var a=Jp(t.value,n,!0);return GD(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=e6(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]=Jp(Math.floor(i[0]/o)*o)),t.fixMax||(i[1]=Jp(Math.ceil(i[1]/o)*o))},e.prototype.setNiceExtent=function(t,i){this._niceExtent=[t,i]},e.type="interval",e}(Ka);Ka.registerClass(r6);var Ja=r6;var i6=typeof Float32Array<"u",Hpe=i6?Float32Array:Array;function pa(r){return pe(r)?i6?new Float32Array(r):r:new Hpe(r)}var qP="__ec_stack_";function ZP(r){return r.get("stack")||qP+r.seriesIndex}function jP(r){return r.dim+r.index}function n6(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:qP+a},r));for(var o=a6(e),s=[],a=0;a<r.count;a++){var l=o[i][qP+a];l.offsetCenter=l.offset+l.width/2,s.push(l)}return s}}function KP(r,e){var t=[];return e.eachSeriesByType(r,function(i){s6(i)&&t.push(i)}),t}function Wpe(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 JP(r){var e=Wpe(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=ze(i.get("barWidth"),s),g=ze(i.get("barMaxWidth"),s),m=ze(i.get("barMinWidth")||(l6(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:jP(a),stackId:ZP(i)})}),a6(t)}function a6(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=wt(a).length;s=Math.max(35-l*4,15)+"%"}var u=ze(s,o),c=ze(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 o6(r,e,t){if(r&&e){var i=r[jP(e)];return i!=null&&t!=null?i[ZP(t)]:i}}function oT(r,e){var t=KP(r,e),i=JP(t);N(t,function(n){var a=n.getData(),o=n.coordinateSystem,s=o.getBaseAxis(),l=ZP(n),u=i[jP(s)][l],c=u.offset,f=u.width;a.setLayout({bandWidth:u.bandWidth,offset:c,size:f})})}function sT(r){return{seriesType:r,plan:Ao(),reset:function(e){if(s6(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=Ro(t,u)&&!!t.getCalculationInfo("stackedOnSeries"),h=a.isHorizontal(),p=Xpe(n,a),d=l6(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&&pa(M*3),w=d&&l&&pa(M*3),T=d&&pa(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),P=I.get(s,E),U=p,B=void 0;f&&(B=+A-I.get(o,E));var z=void 0,k=void 0,G=void 0,Y=void 0;if(h){var J=i.dataToPoint([A,P]);if(f){var Q=i.dataToPoint([B,P]);U=Q[0]}z=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([P,A]);if(f){var Q=i.dataToPoint([P,B]);U=Q[1]}z=J[0]+_,k=U,G=v,Y=J[1]-U,Math.abs(Y)<g&&(Y=(Y<=0?-1:1)*g)}d?(S[R]=z,S[R+1]=k,S[R+2]=h?G:Y,w&&(w[R]=h?C.x:z,w[R+1]=h?k:C.y,w[R+2]=b),T[E]=E):x.setItemLayout(E,{x:z,y:k,width:G,height:Y}),R+=3}d&&x.setLayout({largePoints:S,largeDataIndices:T,largeBackgroundPoints:w,valueAxisHorizontal:h})}}}}}}function s6(r){return r.coordinateSystem&&r.coordinateSystem.type==="cartesian2d"}function l6(r){return r.pipelineContext&&r.pipelineContext.large}function Xpe(r,e){return e.toGlobalCoord(e.dataToCoord(e.type==="log"?1:0))}var Ype=function(r,e,t,i){for(;t<i;){var n=t+i>>>1;r[n][1]<e?t=n+1:i=n}return t},c6=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 Hp(t.value,PD[x5(Gp(this._minLevelUnit))]||PD.second,i,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(t,i,n){var a=this.getSetting("useUTC"),o=this.getSetting("locale");return S5(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=Qpe(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]-=wo,i[1]+=wo),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]-wo}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=lT.length,l=Math.min(Ype(lT,this._approxInterval,0,s),s-1);this._interval=lT[l][1],this._minLevelUnit=lT[Math.max(l-1,0)][0]},e.prototype.parse=function(t){return Ct(t)?t:+wn(t)},e.prototype.contain=function(t){return Bf(this.parse(t),this._extent)},e.prototype.normalize=function(t){return kf(this.parse(t),this._extent)},e.prototype.scale=function(t){return Vf(t,this._extent)},e.type="time",e}(Ja),lT=[["second",s1],["minute",l1],["hour",uv],["quarter-day",uv*6],["half-day",uv*12],["day",wo*1.2],["half-week",wo*3.5],["week",wo*7],["month",wo*31],["quarter",wo*95],["half-year",DD/2],["year",DD]];function qpe(r,e,t,i){var n=wn(e),a=wn(t),o=function(d){return ND(n,d,i)===ND(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 Zpe(r,e){return r/=wo,r>16?16:r>7.5?7:r>3.5?4:r>1.5?2:1}function jpe(r){var e=30*wo;return r/=e,r>6?6:r>3?3:r>2?2:1}function Kpe(r){return r/=uv,r>12?12:r>6?6:r>3.5?4:r>2?2:1}function u6(r,e){return r/=e?l1:s1,r>30?30:r>20?20:r>15?15:r>10?10:r>5?5:r>2?2:1}function Jpe(r){return Gm(r,!0)}function $pe(r,e,t){var i=new Date(r);switch(Gp(e)){case"year":case"month":i[UD(t)](0);case"day":i[OD(t)](1);case"hour":i[zD(t)](0);case"minute":i[FD(t)](0);case"second":i[BD(t)](0),i[kD(t)](0)}return i.getTime()}function Qpe(r,e,t,i){var n=1e4,a=ID,o=0;function s(b,E,I,R,A,P,U){for(var B=new Date(E),z=E,k=B[R]();z<I&&z<=i[1];)U.push({value:z}),k+=b,B[A](k),z=B.getTime();U.push({value:z,notAdd:!0})}function l(b,E,I){var R=[],A=!E.length;if(!qpe(Gp(b),i[0],i[1],t)){A&&(E=[{value:$pe(new Date(i[0]),b,t)},{value:i[1]}]);for(var P=0;P<E.length-1;P++){var U=E[P].value,B=E[P+1].value;if(U!==B){var z=void 0,k=void 0,G=void 0,Y=!1;switch(b){case"year":z=Math.max(1,Math.round(e/wo/365)),k=u1(t),G=b5(t);break;case"half-year":case"quarter":case"month":z=jpe(e),k=Vp(t),G=UD(t);break;case"week":case"half-week":case"day":z=Zpe(e,31),k=D_(t),G=OD(t),Y=!0;break;case"half-day":case"quarter-day":case"hour":z=Kpe(e),k=lv(t),G=zD(t);break;case"minute":z=u6(e,!0),k=P_(t),G=FD(t);break;case"second":z=u6(e,!1),k=I_(t),G=BD(t);break;case"millisecond":z=Jpe(e),k=N_(t),G=kD(t);break}s(z,U,B,k,G,Y,R),b==="year"&&I.length>1&&P===0&&I.unshift({value:I[0].value-z})}}for(var P=0;P<R.length;P++)I.push(R[P]);return R}}for(var u=[],c=[],f=0,h=0,p=0;p<a.length&&o++<n;++p){var d=Gp(a[p]);if(_5(a[p])){l(a[p],u[u.length-1]||[],c);var g=a[p+1]?Gp(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=Yt(de(u,function(b){return Yt(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}Ka.registerClass(c6);var uT=c6;var f6=Ka.prototype,fx=Ja.prototype,ede=Cr,tde=Math.floor,rde=Math.ceil,cT=Math.pow,Pl=Math.log,$P=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 Ja,t._interval=0,t}return e.prototype.getTicks=function(t){var i=this._originalScale,n=this._extent,a=i.getExtent(),o=fx.getTicks.call(this,t);return de(o,function(s){var l=s.value,u=Cr(cT(this.base,l));return u=l===n[0]&&this._fixMin?fT(u,a[0]):u,u=l===n[1]&&this._fixMax?fT(u,a[1]):u,{value:u}},this)},e.prototype.setExtent=function(t,i){var n=Pl(this.base);t=Pl(Math.max(0,t))/n,i=Pl(Math.max(0,i))/n,fx.setExtent.call(this,t,i)},e.prototype.getExtent=function(){var t=this.base,i=f6.getExtent.call(this);i[0]=cT(t,i[0]),i[1]=cT(t,i[1]);var n=this._originalScale,a=n.getExtent();return this._fixMin&&(i[0]=fT(i[0],a[0])),this._fixMax&&(i[1]=fT(i[1],a[1])),i},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var i=this.base;t[0]=Pl(t[0])/Pl(i),t[1]=Pl(t[1])/Pl(i),f6.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=Tw(n),o=t/n*a;for(o<=.5&&(a*=10);!isNaN(a)&&Math.abs(a)<1&&Math.abs(a)>0;)a*=10;var s=[Cr(rde(i[0]/a)*a),Cr(tde(i[1]/a)*a)];this._interval=a,this._niceExtent=s}},e.prototype.calcNiceExtent=function(t){fx.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=Pl(t)/Pl(this.base),Bf(t,this._extent)},e.prototype.normalize=function(t){return t=Pl(t)/Pl(this.base),kf(t,this._extent)},e.prototype.scale=function(t){return t=Vf(t,this._extent),cT(this.base,t)},e.type="log",e}(Ka),h6=$P.prototype;h6.getMinorTicks=fx.getMinorTicks;h6.getLabel=fx.getLabel;function fT(r,e){return ede(r,bn(e))}Ka.registerClass($P);var p6=$P;var ide=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=hT(e,a({min:i[0],max:i[1]})):a!=="dataMin"&&(this._modelMinNum=hT(e,a));var o=this._modelMaxRaw=t.get("max",!0);if(He(o)?this._modelMaxNum=hT(e,o({min:i[0],max:i[1]})):o!=="dataMax"&&(this._modelMaxNum=hT(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=[Mn(l[0],1),Mn(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=ff(s)||ff(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[ade[e]]=t},r.prototype.setDeterminedMinMax=function(e,t){var i=nde[e];this[i]=t},r.prototype.freeze=function(){this.frozen=!0},r}();var nde={min:"_determinedMin",max:"_determinedMax"},ade={min:"_dataMin",max:"_dataMax"};function pT(r,e,t){var i=r.rawExtentInfo;return i||(i=new ide(r,e,t),r.rawExtentInfo=i,i)}function hT(r,e){return e==null?null:ff(e)?NaN:r.parse(e)}function QP(r,e){var t=r.type,i=pT(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=KP("bar",o),l=!1;if(N(s,function(f){l=l||f.getBaseAxis()===e.axis}),l){var u=JP(s),c=ode(n,a,e,u);n=c.min,a=c.max}}return{extent:[n,a],fixMin:i.minFixed,fixMax:i.maxFixed}}function ode(r,e,t,i){var n=t.axis.getExtent(),a=n[1]-n[0],o=o6(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 _u(r,e){var t=e,i=QP(r,t),n=i.extent,a=t.get("splitNumber");r instanceof p6&&(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 Gf(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new cx({ordinalMeta:r.getOrdinalMeta?r.getOrdinalMeta():r.getCategories(),extent:[1/0,-1/0]});case"time":return new uT({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new(Ka.getClass(e)||Ja)}}function d6(r){var e=r.scale.getExtent(),t=e[0],i=e[1];return!(t>0&&i>0||t<0&&i<0)}function Mv(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(hx(r,n),a,n.level!=null?{level:n.level}:null)}}(e):function(i){return r.scale.getLabel(i)}}function hx(r,e){return r.type==="category"?r.scale.getLabel(e):e.value}function m6(r){var e=r.model,t=r.scale;if(!(!e.get(["axisLabel","show"])||t.isBlank())){var i,n,a=t.getExtent();t instanceof cx?n=t.count():(i=t.getTicks(),n=i.length);var o=r.getLabelModel(),s=Mv(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=sde(p,o.get("rotate")||0);l?l.union(d):l=d}return l}}function sde(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 dT(r){var e=r.get("interval");return e??"auto"}function mT(r){return r.type==="category"&&dT(r.getLabelModel())===0}function bv(r,e){var t={};return N(r.mapDimensionsAll(e),function(i){t[iT(r,i)]=!0}),wt(t)}function v6(r,e,t){e&&N(bv(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 xu=function(){function r(){}return r.prototype.getNeedCrossZero=function(){var e=this.option;return!e.scale},r.prototype.getCoordSysModel=function(){},r}();var lde=1e-8;function g6(r,e){return Math.abs(r-e)<lde}function gc(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+=Ns(n[0],n[1],o[0],o[1],e,t),n=o}var s=r[0];return(!g6(n[0],s[0])||!g6(n[1],s[1]))&&(i+=Ns(n[0],n[1],s[0],s[1],e,t)),i!==0}var ude=[];function eI(r,e){for(var t=0;t<r.length;t++)hi(r[t],r[t],e)}function _6(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])&&(_o(e,e,a),xo(t,t,a))}}function cde(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 x6=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 tI=function(){function r(e,t){this.type="polygon",this.exterior=e,this.interiors=t}return r}();var rI=function(){function r(e){this.type="linestring",this.points=e}return r}();var gT=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 cde(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"?_6(s.exterior,n,a,t):N(s.points,function(l){_6(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(gc(l,t[0],t[1])){for(var c=0;c<(u?u.length:0);c++)if(gc(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"?(eI(h.exterior,u),N(h.interiors,function(p){eI(p,u)})):N(h.points,function(p){eI(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}(x6);var S6=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=pf(ude),o=t;o&&!o.isGeoSVGGraphicRoot;)Ua(a,o.getLocalTransform(),a),o=o.parent;return Cs(a,a),hi(n,n,a),n},e}(x6);function fde(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=M6(s,o,t);break;case"Polygon":iI(s,o,t);break;case"MultiLineString":iI(s,o,t);break;case"MultiPolygon":N(s,function(l,u){return iI(l,o[u],t)})}}),e.UTF8Encoding=!1,e}function iI(r,e,t){for(var i=0;i<r.length;i++)r[i]=M6(r[i],e[i],t)}function M6(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 nI(r,e){return r=fde(r),de(Yt(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 tI(o[0],o.slice(1)));break;case"MultiPolygon":N(n.coordinates,function(l){l[0]&&a.push(new tI(l[0],l.slice(1)))});break;case"LineString":a.push(new rI([n.coordinates]));break;case"MultiLineString":a.push(new rI(n.coordinates))}var s=new gT(i[e||"name"],a,i.cp);return s.properties=i,s})}var wv={};DL(wv,{MAX_SAFE_INTEGER:()=>o_,asc:()=>Ai,getPercentWithPrecision:()=>nH,getPixelPrecision:()=>km,getPrecision:()=>bn,getPrecisionSafe:()=>I2,isNumeric:()=>Mp,isRadianAroundZero:()=>Qu,linearMap:()=>ir,nice:()=>Gm,numericToNumber:()=>Ba,parseDate:()=>wn,quantile:()=>Hm,quantity:()=>Tw,quantityExponent:()=>Vm,reformIntervals:()=>l_,remRadian:()=>s_,round:()=>Cr});var px=vt();function b6(r){return r.type==="category"?hde(r):dde(r)}function w6(r,e){return r.type==="category"?pde(r,e):{ticks:de(r.scale.getTicks(),function(t){return t.value})}}function hde(r){var e=r.getLabelModel(),t=T6(r,e);return!e.get("show")||r.scale.isBlank()?{labels:[],labelCategoryInterval:t.labelCategoryInterval}:t}function T6(r,e){var t=E6(r,"labels"),i=dT(e),n=A6(t,i);if(n)return n;var a,o;return He(i)?a=D6(r,i):(o=i==="auto"?mde(r):i,a=L6(r,o)),C6(t,i,{labels:a,labelCategoryInterval:o})}function pde(r,e){var t=E6(r,"ticks"),i=dT(e),n=A6(t,i);if(n)return n;var a,o;if((!e.get("show")||r.scale.isBlank())&&(a=[]),He(i))a=D6(r,i,!0);else if(i==="auto"){var s=T6(r,r.getLabelModel());o=s.labelCategoryInterval,a=de(s.labels,function(l){return l.tickValue})}else o=i,a=L6(r,o,!0);return C6(t,i,{ticks:a,tickCategoryInterval:o})}function dde(r){var e=r.scale.getTicks(),t=Mv(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 E6(r,e){return px(r)[e]||(px(r)[e]=[])}function A6(r,e){for(var t=0;t<r.length;t++)if(r[t].key===e)return r[t].value}function C6(r,e,t){return r.push({key:e,value:t}),t}function mde(r){var e=px(r).autoInterval;return e??(px(r).autoInterval=r.calculateCategoryInterval())}function R6(r){var e=vde(r),t=Mv(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=lu(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=px(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 vde(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 L6(r,e,t){var i=Mv(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=mT(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 D6(r,e,t){var i=r.scale,n=Mv(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 P6=[0,1],gde=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 km(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(),I6(i,n.count())),ir(e,P6,i,t)},r.prototype.coordToData=function(e,t){var i=this._extent,n=this.scale;this.onBand&&n.type==="ordinal"&&(i=i.slice(),I6(i,n.count()));var a=ir(e,i,P6,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=w6(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 yde(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 b6(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 R6(this)},r}();function I6(r,e){var t=r[1]-r[0],i=e,n=t/i/2;r[0]+=n,r[1]-=n}function yde(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=Cr(p),d=Cr(d),f?p>d:p<d}}var mn=gde;var dx=Math.PI*2,$p=$i.CMD,_de=["top","right","bottom","left"];function xde(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 Sde(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)%dx<1e-4)return l[0]=c,l[1]=f,u-t;if(a){var h=i;i=Tn(n),n=Tn(h)}else i=Tn(i),n=Tn(n);i>n&&(n+=dx);var p=Math.atan2(s,o);if(p<0&&(p+=dx),p>=i&&p<=n||p+dx>=i&&p+dx<=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 yT(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 N6(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 Il=[];function Mde(r,e,t){var i=N6(e.x,e.y,e.width,e.height,r.x,r.y,Il);return t.set(Il[0],Il[1]),i}function bde(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 $p.M:a=c[p++],o=c[p++],i=a,n=o;break;case $p.L:g=yT(i,n,c[p],c[p+1],f,h,Il,!0),i=c[p++],n=c[p++];break;case $p.C:g=rw(i,n,c[p++],c[p++],c[p++],c[p++],c[p],c[p+1],f,h,Il),i=c[p++],n=c[p++];break;case $p.Q:g=nw(i,n,c[p++],c[p++],c[p],c[p+1],f,h,Il),i=c[p++],n=c[p++];break;case $p.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=Sde(m,v,y,x,x+M,S,w,h,Il),i=Math.cos(x+M)*_+m,n=Math.sin(x+M)*y+v;break;case $p.R:a=i=c[p++],o=n=c[p++];var T=c[p++],C=c[p++];g=N6(a,o,T,C,f,h,Il);break;case $p.Z:g=yT(i,n,a,o,f,h,Il,!0),i=a,n=o;break}g<u&&(u=g,t.set(Il[0],Il[1]))}return u}var Nl=new zt,Jr=new zt,Ri=new zt,Mu=new zt,Su=new zt;function oI(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||_de,s=i.getBoundingRect().clone();s.applyTransform(i.getComputedTransform());var l=1/0,u=n.anchor,c=r.getComputedTransform(),f=c&&Cs([],c),h=e.get("length2")||0;u&&Ri.copy(u);for(var p=0;p<o.length;p++){var d=o[p];xde(d,0,s,Nl,Mu),zt.scaleAndAdd(Jr,Nl,Mu,h),Jr.transform(f);var g=r.getBoundingRect(),m=u?u.distance(Jr):r instanceof ut?bde(Jr,r.path,Ri):Mde(Jr,g,Ri);m<l&&(l=m,Jr.transform(c),Ri.transform(c),Ri.toArray(a[0]),Jr.toArray(a[1]),Nl.toArray(a[2]))}sI(a,e.get("minTurnAngle")),t.setShape({points:a})}}}var _T=[],da=new zt;function sI(r,e){if(e<=180&&e>0){e=e/180*Math.PI,Nl.fromArray(r[0]),Jr.fromArray(r[1]),Ri.fromArray(r[2]),zt.sub(Mu,Nl,Jr),zt.sub(Su,Ri,Jr);var t=Mu.len(),i=Su.len();if(!(t<.001||i<.001)){Mu.scale(1/t),Su.scale(1/i);var n=Mu.dot(Su),a=Math.cos(e);if(a<n){var o=yT(Jr.x,Jr.y,Ri.x,Ri.y,Nl.x,Nl.y,_T,!1);da.fromArray(_T),da.scaleAndAdd(Su,o/Math.tan(Math.PI-e));var s=Ri.x!==Jr.x?(da.x-Jr.x)/(Ri.x-Jr.x):(da.y-Jr.y)/(Ri.y-Jr.y);if(isNaN(s))return;s<0?zt.copy(da,Jr):s>1&&zt.copy(da,Ri),da.toArray(r[1])}}}}function U6(r,e,t){if(t<=180&&t>0){t=t/180*Math.PI,Nl.fromArray(r[0]),Jr.fromArray(r[1]),Ri.fromArray(r[2]),zt.sub(Mu,Jr,Nl),zt.sub(Su,Ri,Jr);var i=Mu.len(),n=Su.len();if(!(i<.001||n<.001)){Mu.scale(1/i),Su.scale(1/n);var a=Mu.dot(e),o=Math.cos(t);if(a<o){var s=yT(Jr.x,Jr.y,Ri.x,Ri.y,Nl.x,Nl.y,_T,!1);da.fromArray(_T);var l=Math.PI/2,u=Math.acos(Su.dot(e)),c=l+u-t;if(c>=l)zt.copy(da,Ri);else{da.scaleAndAdd(Su,s/Math.tan(Math.PI/2-c));var f=Ri.x!==Jr.x?(da.x-Jr.x)/(Ri.x-Jr.x):(da.y-Jr.y)/(Ri.y-Jr.y);if(isNaN(f))return;f<0?zt.copy(da,Jr):f>1&&zt.copy(da,Ri)}da.toArray(r[1])}}}}function aI(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 wde(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=As(i[0],i[1]),a=As(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=Cm([],i[1],i[0],o/n),l=Cm([],i[1],i[2],o/a),u=Cm([],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 Tv(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<Af.length;l++){var u=Af[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&&aI(i,!0,u,c);continue}i||(i=new ri,r.setTextGuideLine(i),!f&&(s||!o)&&aI(i,!0,"normal",e.normal),r.stateProxy&&(i.stateProxy=r.stateProxy)),aI(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=wde}}function Ev(r,e){e=e||"labelLine";for(var t={normal:r.getModel(e)},i=0;i<Vi.length;i++){var n=Vi[i];t[n]=r.getModel([n,e])}return t}function xT(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 iv(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 O6(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,P=Math.max(r[R].rect[e]-A[e]-A[t],0);E.push(P),I+=P}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 z6(r,e,t,i){return O6(r,"x","width",e,t,i)}function ST(r,e,t,i){return O6(r,"y","height",e,t,i)}function MT(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 iv(d.localRect,d.transform)),f||(f=new iv(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 Tde(r){if(r){for(var e=[],t=0;t<r.length;t++)e.push(r[t].slice());return e}}function Ede(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:Tde(i&&i.shape.points)}}var F6=["align","verticalAlign","width","height","fontSize"],ma=new za,lI=vt(),Ade=vt();function bT(r,e,t){for(var i=0;i<t.length;i++){var n=t[i];e[n]!=null&&(r[n]=e[n])}}var wT=["x","y","rotation"],Cde=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?ma.setLocalTransform(u):(ma.x=ma.y=ma.rotation=ma.originX=ma.originY=0,ma.scaleX=ma.scaleY=1),ma.rotation=Tn(ma.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:ma.x,y:ma.y,scaleX:ma.scaleX,scaleY:ma.scaleY,rotation:ma.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)||wt(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(){oI(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(Ede(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=ze(c.x,t),s.setStyle("x",0),h=!0):(s.x=u.x,s.setStyle("x",u.style.x)),c.y!=null?(s.y=ze(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=lI(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<F6.length;g++){var m=F6[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=xT(this._labelList),a=Yt(n,function(l){return l.layoutOption.moveOverlap==="shiftX"}),o=Yt(n,function(l){return l.layoutOption.moveOverlap==="shiftY"});z6(a,0,t),ST(o,0,i);var s=Yt(n,function(l){return l.layoutOption.hideOverlap});MT(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=lI(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");Tv(e,Ev(s),l),oI(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&&!ac(e))){var a=lI(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)),Ut(i,u,t,l)}else if(i.attr(u),!cc(i).valueAnimation){var f=ft(i.style.opacity,1);i.style.opacity=0,or(i,{style:{opacity:f}},t,l)}if(a.oldLayout=u,i.states.select){var p=a.oldLayoutSelect={};bT(p,u,wT),bT(p,i.states.select,wT)}if(i.states.emphasis){var d=a.oldLayoutEmphasis={};bT(d,u,wT),bT(d,i.states.emphasis,wT)}r1(i,l,c,t,t)}if(n&&!n.ignore&&!n.invisible){var a=Ade(n),o=a.oldLayout,g={points:n.shape.points};o?(n.attr({shape:o}),Ut(n,{shape:g},t)):(n.setShape(g),n.style.strokePercent=0,or(n,{style:{strokePercent:1}},t)),a.oldLayout=g}},r}(),B6=Cde;var uI=vt();function cI(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){var n=uI(t).labelManager;n||(n=uI(t).labelManager=new B6),n.clearLabels()}),r.registerUpdateLifecycle("series:layoutlabels",function(e,t,i){var n=uI(t).labelManager;i.updatedSeries.forEach(function(a){n.addLabelsOfSeries(t.getViewOfSeriesModel(a))}),n.updateLayoutConfig(t),n.layout(t),n.processLabelsOverall()})}var fI=Math.sin,hI=Math.cos,k6=Math.PI,Qp=Math.PI*2,Rde=180/k6,Lde=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=su(f-Qp)||(c?u>=Qp:-u>=Qp),p=u>0?u%Qp:u%Qp+Qp,d=!1;h?d=!0:su(f)?d=!1:d=p>=k6==!!c;var g=e+i*hI(o),m=t+n*fI(o);this._start&&this._add("M",g,m);var v=Math.round(a*Rde);if(h){var _=1/this._p,y=(c?1:-1)*(Qp-_);this._add("A",i,n,v,1,+c,e+i*hI(o+y),t+n*fI(o+y)),_>.01&&this._add("A",i,n,v,0,+c,g,m)}else{var x=e+i*hI(s),M=t+n*fI(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}(),TT=Lde;var mx="none",Dde=Math.round;function Pde(r){var e=r.fill;return e!=null&&e!==mx}function Ide(r){var e=r.stroke;return e!=null&&e!==mx}var pI=["lineCap","miterLimit","lineJoin"],Nde=de(pI,function(r){return"stroke-"+r.toLowerCase()});function dI(r,e,t,i){var n=e.opacity==null?1:e.opacity;if(t instanceof Br){r("opacity",n);return}if(Pde(e)){var a=_f(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",mx);if(Ide(e)){var s=_f(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=$_(t),p=h[0],d=h[1];p&&(d=Dde(d||0),r("stroke-dasharray",p.join(",")),(d||i)&&r("stroke-dashoffset",d))}else i&&r("stroke-dasharray",mx);for(var g=0;g<pI.length;g++){var m=pI[g];if(i||e[m]!==Zm[m]){var v=e[m]||Zm[m];v&&r(Nde[g],v)}}}else i&&r("stroke",mx)}var V6="http://www.w3.org/2000/svg",mI="http://www.w3.org/1999/xlink",G6="http://www.w3.org/2000/xmlns/",H6="http://www.w3.org/XML/1998/namespace",vI="ecmeta_";function ET(r){return document.createElementNS(V6,r)}function Li(r,e,t,i,n){return{tag:r,attrs:t||{},children:i,text:n,key:e}}function Ude(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 Ode(r){return"</"+r+">"}function vx(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 Ude(o,s)+(o!=="style"?xn(l):l||"")+(a?""+t+de(a,function(u){return i(u)}).join(t)+t:"")+Ode(o)}return i(r)}function W6(r,e,t){t=t||{};var i=t.newline?`
  2214. `:"",n=" {"+i,a=i+"}",o=de(wt(r),function(l){return l+n+de(wt(r[l]),function(u){return u+":"+r[l][u]+";"}).join(i)+a}).join(i),s=de(wt(e),function(l){return"@keyframes "+l+n+de(wt(e[l]),function(u){return u+n+de(wt(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 gx(r){return{zrId:r,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function gI(r,e,t,i){return Li("svg","root",{width:r,height:e,xmlns:V6,"xmlns:xlink":mI,version:"1.1",baseProfile:"full",viewBox:i?"0 0 "+r+" "+e:!1},t)}var zde=0;function AT(){return zde++}var X6={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"},ed="transform-origin";function Fde(r,e,t){var i=fe({},r.shape);fe(i,e),r.buildPath(t,i);var n=new TT;return n.reset(dw(r)),t.rebuildPath(n,1),n.generateStr(),n.getStr()}function Bde(r,e){var t=e.originX,i=e.originY;(t||i)&&(r[ed]=t+"px "+i+"px")}var kde={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function q6(r,e){var t=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[t]=r,t}function Vde(r,e,t){var i=r.shape.paths,n={},a,o;if(N(i,function(l){var u=gx(t.zrId);u.animation=!0,yx(l,{},u,!0);var c=u.cssAnims,f=u.cssNodes,h=wt(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=q6(n,t);return a.replace(o,s)}}function Y6(r){return Ce(r)?X6[r]?"cubic-bezier("+X6[r]+")":Im(r)?r:"":""}function yx(r,e,t,i){var n=r.animators,a=n.length,o=[];if(r instanceof rv){var s=Vde(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=Y6(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=Y6(Ne.easing),F=Ne.rawValue;(Ce(F)||Ct(F))&&(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={};T2(A,r),fe(A,M[R]);var P=mw(A),U=M[R][T];w[R]=P?{transform:P}:{},Bde(w[R],A),U&&(w[R][T]=U)}var B,z=!0;for(var R in S){w[R]=w[R]||{};var k=!B,U=S[R][T];k&&(B=new $i);var G=B.len();B.reset(),w[R].d=Fde(r,S[R],B);var Y=B.len();if(!k&&G!==Y){z=!1;break}U&&(w[R][T]=U)}if(!z)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 kde[q]})}for(var J=wt(w),Q=!0,V,b=1;b<J.length;b++){var K=J[b-1],ae=J[b];if(w[K][ed]!==w[ae][ed]){Q=!1;break}V=w[K][ed]}if(Q&&V){for(var R in w)w[R][ed]&&delete w[R][ed];e[ed]=V}if(Yt(J,function(ue){return wt(w[ue]).length>0}).length){var ve=q6(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-"+AT();t.cssNodes["."+v]={animation:o.join(",")},e.class=v}}function j6(r,e,t){if(!r.ignore)if(r.isSilent()){var i={"pointer-events":"none"};Z6(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=J0(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),Z6(i,e,t,!0)}}function Z6(r,e,t,i){var n=JSON.stringify(r),a=t.cssStyleCache[n];a||(a=t.zrId+"-cls-"+AT(),t.cssStyleCache[n]=a,t.cssNodes["."+a+(i?":hover":"")]=r),e.class=e.class?e.class+" "+a:a}var _x=Math.round;function Q6(r){return r&&Ce(r.src)}function eX(r){return r&&He(r.toDataURL)}function yI(r,e,t,i){dI(function(n,a){var o=n==="fill"||n==="stroke";o&&pw(a)?MI(e,r,n,i):o&&$0(a)?bI(t,r,n,i):o&&a==="none"?r[n]="transparent":r[n]=a},e,t,!1),Zde(t,r,i)}function _I(r,e){var t=eH(e);t&&(t.each(function(i,n){i!=null&&(r[(vI+n).toLowerCase()]=i+"")}),e.isSilent()&&(r[vI+"silent"]="true"))}function K6(r){return su(r[0]-1)&&su(r[1])&&su(r[2])&&su(r[3]-1)}function Gde(r){return su(r[4])&&su(r[5])}function xI(r,e,t){if(e&&!(Gde(e)&&K6(e))){var i=t?10:1e4;r.transform=K6(e)?"translate("+_x(e[4]*i)/i+" "+_x(e[5]*i)/i+")":CG(e)}}function J6(r,e,t){for(var i=r.points,n=[],a=0;a<i.length;a++)n.push(_x(i[a][0]*t)/t),n.push(_x(i[a][1]*t)/t);e.points=n.join(" ")}function $6(r){return!r.smooth}function Hde(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]]=_x(s*n)/n)}}}var Wde={circle:[Hde(["cx","cy","r"])],polyline:[J6,$6],polygon:[J6,$6]};function Xde(r){for(var e=r.animators,t=0;t<e.length;t++)if(e[t].targetName==="shape")return!0;return!1}function tX(r,e){var t=r.style,i=r.shape,n=Wde[r.type],a={},o=e.animation,s="path",l=r.style.strokePercent,u=e.compress&&dw(r)||4;if(n&&!e.willUpdate&&!(n[1]&&!n[1](i))&&!(o&&Xde(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 TT),g.reset(u),h.rebuildPath(g,l),g.generateStr(),d.__svgPathVersion=p,d.__svgPathStrokePercent=l),a.d=g.getStr()}return xI(a,r.transform),yI(a,t,r,e),_I(a,r),e.animation&&yx(r,a,e),e.emphasis&&j6(r,a,e),Li(s,r.id+"",a)}function Yde(r,e){var t=r.style,i=t.image;if(i&&!Ce(i)&&(Q6(i)?i=i.src:eX(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),xI(l,r.transform),yI(l,t,r,e),_I(l,r),e.animation&&yx(r,l,e),Li("image",r.id+"",l)}}function qde(r,e){var t=r.style,i=t.text;if(i!=null&&(i+=""),!(!i||isNaN(t.x)||isNaN(t.y))){var n=t.font||yo,a=t.x||0,o=LG(t.y||0,Fm(n),t.textBaseline),s=RG[t.textAlign]||t.textAlign,l={"dominant-baseline":"central","text-anchor":s};if(rD(t)){var u="",c=t.fontStyle,f=tD(t.fontSize);if(!parseFloat(f))return;var h=t.fontFamily||WL,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),xI(l,r.transform),yI(l,t,r,e),_I(l,r),e.animation&&yx(r,l,e),Li("text",r.id+"",l,void 0,i)}}function SI(r,e){if(r instanceof ut)return tX(r,e);if(r instanceof Br)return Yde(r,e);if(r instanceof tc)return qde(r,e)}function Zde(r,e,t){var i=r.style;if(DG(i)){var n=PG(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=_f(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]=Li("filter",o,{id:o,x:"-100%",y:"-100%",width:"300%",height:"300%"},[Li("feDropShadow","",{dx:c/l,dy:f/u,stdDeviation:_,"flood-color":g,"flood-opacity":d})]),a[n]=o}e.filter=Q0(o)}}function MI(r,e,t,i){var n=r[t],a,o={gradientUnits:n.global?"userSpaceOnUse":"objectBoundingBox"};if(fw(n))a="linearGradient",o.x1=n.x,o.y1=n.y,o.x2=n.x2,o.y2=n.y2;else if(hw(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=cw(s[u].offset)*100+"%",h=s[u].color,p=_f(h),d=p.color,g=p.opacity,m={offset:f};m["stop-color"]=d,g<1&&(m["stop-opacity"]=g),l.push(Li("stop",u+"",m))}var v=Li(a,"",o,l),_=vx(v),y=i.gradientCache,x=y[_];x||(x=i.zrId+"-g"+i.gradientIdx++,y[_]=x,o.id=x,i.defs[x]=Li(a,x,o,l)),e[t]=Q0(x)}function bI(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(h2(n)){var h=n.imageWidth,p=n.imageHeight,d=void 0,g=n.image;if(Ce(g)?d=g:Q6(g)?d=g.src:eX(g)&&(d=g.toDataURL()),typeof Image>"u"){var m="Image width/height must been given explictly in svg-ssr renderer.";Wr(h,m),Wr(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))}},_=h_(d,null,r,function(b){l||v(S,b),v(f,b)});_&&_.width&&_.height&&(h=h||_.width,p=p||_.height)}f=Li("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=mw(n);M&&(o.patternTransform=M);var S=Li("pattern","",o,[f]),w=vx(S),T=i.patternCache,C=T[w];C||(C=i.zrId+"-p"+i.patternIdx++,T[w]=C,o.id=C,S=i.defs[C]=Li("pattern",C,o,[f])),e[t]=Q0(C)}}function rX(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]=Li("clipPath",a,o,[tX(r,t)])}e["clip-path"]=Q0(a)}function wI(r){return document.createTextNode(r)}function Hf(r,e,t){r.insertBefore(e,t)}function TI(r,e){r.removeChild(e)}function EI(r,e){r.appendChild(e)}function AI(r){return r.parentNode}function CI(r){return r.nextSibling}function CT(r,e){r.textContent=e}var iX=58,Kde=120,Jde=Li("","");function RI(r){return r===void 0}function bu(r){return r!==void 0}function $de(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 xx(r,e){var t=r.key===e.key,i=r.tag===e.tag;return i&&t}function Sx(r){var e,t=r.children,i=r.tag;if(bu(i)){var n=r.elm=ET(i);if(LT(Jde,r),pe(t))for(e=0;e<t.length;++e){var a=t[e];a!=null&&EI(n,Sx(a))}else bu(r.text)&&!qe(r.text)&&EI(n,wI(r.text))}else r.elm=wI(r.text);return r.elm}function nX(r,e,t,i,n){for(;i<=n;++i){var a=t[i];a!=null&&Hf(r,Sx(a),e)}}function RT(r,e,t,i){for(;t<=i;++t){var n=e[t];if(n!=null)if(bu(n.tag)){var a=AI(n.elm);TI(a,n.elm)}else TI(r,n.elm)}}function LT(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)!==Kde?i.setAttribute(t,o):t==="xmlns:xlink"||t==="xmlns"?i.setAttributeNS(G6,t,o):t.charCodeAt(3)===iX?i.setAttributeNS(H6,t,o):t.charCodeAt(5)===iX?i.setAttributeNS(mI,t,o):i.setAttribute(t,o))}for(t in n)t in a||i.removeAttribute(t)}}function Qde(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]:xx(o,u)?(Av(o,u),o=e[++i],u=t[++n]):xx(s,c)?(Av(s,c),s=e[--a],c=t[--l]):xx(o,c)?(Av(o,c),Hf(r,o.elm,CI(s.elm)),o=e[++i],c=t[--l]):xx(s,u)?(Av(s,u),Hf(r,s.elm,o.elm),s=e[--a],u=t[++n]):(RI(f)&&(f=$de(e,i,a)),h=f[u.key],RI(h)?Hf(r,Sx(u),o.elm):(p=e[h],p.tag!==u.tag?Hf(r,Sx(u),o.elm):(Av(p,u),e[h]=void 0,Hf(r,p.elm,o.elm))),u=t[++n]);(i<=a||n<=l)&&(i>a?(d=t[l+1]==null?null:t[l+1].elm,nX(r,d,t,n,l)):RT(r,e,i,a))}function Av(r,e){var t=e.elm=r.elm,i=r.children,n=e.children;r!==e&&(LT(r,e),RI(e.text)?bu(i)&&bu(n)?i!==n&&Qde(t,i,n):bu(n)?(bu(r.text)&&CT(t,""),nX(t,null,n,0,n.length-1)):bu(i)?RT(t,i,0,i.length-1):bu(r.text)&&CT(t,""):r.text!==e.text&&(bu(i)&&RT(t,i,0,i.length-1),CT(t,e.text)))}function LI(r,e){if(xx(r,e))Av(r,e);else{var t=r.elm,i=AI(t);Sx(e),i!==null&&(Hf(i,e.elm,CI(t)),RT(i,[r],0,0))}return e}var eme=0,tme=function(){function r(e,t,i){if(this.type="svg",this.refreshHover=aX("refreshHover"),this.configLayer=aX("configLayer"),this.storage=t,this._opts=i=fe({},i),this.root=e,this._id="zr"+eme++,this._oldVNode=gI(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=ET("svg");LT(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",LI(this._oldVNode,e),this._oldVNode=e}},r.prototype.renderOneToVNode=function(e){return SI(e,gx(this._id))},r.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),i=this._width,n=this._height,a=gx(this._id);a.animation=e.animation,a.willUpdate=e.willUpdate,a.compress=e.compress,a.emphasis=e.emphasis;var o=[],s=this._bgVNode=rme(i,n,this._backgroundColor,a);s&&o.push(s);var l=e.compress?null:this._mainVNode=Li("g","main",{},[]);this._paintList(t,a,l?l.children:o),l&&o.push(l);var u=de(wt(a.defs),function(h){return a.defs[h]});if(u.length&&o.push(Li("defs","defs",{},u)),e.animation){var c=W6(a.cssNodes,a.cssAnims,{newline:!0});if(c){var f=Li("style","stl",{},[],c);o.push(f)}}return gI(i,n,o,e.useViewBox)},r.prototype.renderToString=function(e){return e=e||{},vx(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 _={};rX(h[v],_,t);var y=Li("g","clip-g-"+u++,_,[]);(s?s.children:i).push(y),a[o++]=y,s=y}l=h;var x=SI(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=Nf(n,0,i),t=Nf(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($0(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=IG(t),t&&i+"base64,"+t):i+"charset=UTF-8,"+encodeURIComponent(t)},r}();function aX(r){return function(){}}function rme(r,e,t,i){var n;if(t&&t!=="none")if(n=Li("rect","bg",{width:r,height:e,x:"0",y:"0"}),pw(t))MI({fill:t},n.attrs,"fill",i);else if($0(t))bI({style:{fill:t},dirty:Ur,getBoundingRect:function(){return{width:r,height:e}}},n.attrs,"fill",i);else{var a=_f(t),o=a.color,s=a.opacity;n.attrs.fill=o,s<1&&(n.attrs["fill-opacity"]=s)}return n}var oX=tme;function DI(r){r.registerPainter("svg",oX)}function sX(r,e,t){var i=kn.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 ime=function(r){qt(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||gp,typeof t=="string"?o=sX(t,i,n):qe(t)&&(o=t,t=o.id),a.id=t,a.dom=o;var s=o.style;return s&&(Gb(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=sX("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&ki||!p)?h.getPrevPaintRect():null;d&&c(d);var g=p&&(h.__dirty&ki||!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(cf(i)){var x=i.global||i.__width===v&&i.__height===_;y=x&&i.__canvasGradient||J_(o,i,{x:0,y:0,width:v,height:_}),i.__canvasGradient=y,i.__width=v,i.__height=_}else WV(i)&&(i.scaleX=i.scaleX||f,i.scaleY=i.scaleY||f,y=X1(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}(Ni),DT=ime;var lX=1e5,td=314159,PT=.01,nme=.001;function ame(r){return r?r.__builtin__?!0:!(typeof r.resize!="function"||typeof r.refresh!="function"):!1}function ome(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 sme=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||gp,this._singleCanvas=a,this.root=e;var o=e.style;o&&(Gb(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 DT(c,this,this.dpr);p.__builtin__=!0,p.initContext(),l[td]=p,p.zlevel=td,s.push(td),this._domRoot=e}else{this._width=Nf(e,0,i),this._height=Nf(e,1,i);var u=this._domRoot=ome(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(lX)),a||(a=i.ctx,a.save()),Uf(a,s,n,o===t-1))}a&&a.restore()}},r.prototype.getHoverLayer=function(){return this.getLayer(lX)},r.prototype.paintOne=function(e,t){Y1(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;q0(function(){l._paintList(e,t,i,n)})}}},r.prototype._compositeManually=function(){var e=this.getLayer(td).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 P=e[T];if(P.__inHover&&(f=!0),n._doPaintEl(P,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 Bt.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))&&(Uf(s,e,a,o),e.setPrevPaintRect(l))}else Uf(s,e,a,o)},r.prototype.getLayer=function(e,t){this._singleCanvas&&!this._needsManuallyCompositing&&(e=td);var i=this._layers[e];return i||(i=new DT("zr_"+e,this,this.dpr),i.zlevel=e,i.__builtin__=!0,this._layerConfig[e]?xt(i,this._layerConfig[e],!0):this._layerConfig[e-PT]&&xt(i,this._layerConfig[e-PT],!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]&&ame(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+nme,this._needsManuallyCompositing),c.incremental=!0,o=1):c=this.getLayer(u+(o>0?PT:0),this._needsManuallyCompositing),c.__builtin__||rp("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&ki&&!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]?xt(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+PT){var o=this._layers[a];xt(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=Nf(a,0,n),t=Nf(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(td).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[td].dom;var t=new DT("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];Uf(i,c,o,l===u-1)}return t.dom},r.prototype.getWidth=function(){return this._width},r.prototype.getHeight=function(){return this._height},r}(),uX=sme;function PI(r){r.registerPainter("canvas",uX)}var lme=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 dn(null,this,{useEncodeDefaulter:!0})},e.prototype.getLegendIcon=function(t){var i=new Ze,n=Mr("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=Mr(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),cX=lme;function Ul(r,e){var t=r.mapDimensionsAll("defaultedLabel"),i=t.length;if(i===1){var n=mc(r,e,t[0]);return n!=null?n+"":null}else if(i){for(var a=[],o=0;o<t.length;o++)a.push(mc(r,e,t[o]));return a.join(" ")}}function IT(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 ume=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=Mr(t,-1,-1,2,2,null,o);s.attr({z2:100,culling:!0,scaleX:a[0]/2,scaleY:a[1]/2}),s.drift=cme,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(){Vn(this.childAt(0))},e.prototype.downplay=function(){Gn(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):Ut(h,p,s,i),Ui(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,or(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=Co(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 Br){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;Or(s,g,{labelFetcher:l,labelDataIndex:i,defaultText:I,inheritColor:w,defaultOpacity:S.opacity});function I(P){return E?t.getName(P):Ul(t,P)}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),ar(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&&Os(l,{style:{opacity:0}},i,{dataIndex:o,removeOpt:s,cb:function(){a.removeTextContent()}})}else a.removeTextContent();Os(a,{style:{opacity:0},scaleX:0,scaleY:0},i,{dataIndex:o,cb:t,removeOpt:s})},e.getSymbolSize=function(t,i){return Rl(t.getItemVisual(i,"symbolSize"))},e}(Ze);function cme(r,e){this.parent.drift(r,e)}var yc=ume;function II(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 fX(r){return r!=null&&!qe(r)&&(r={isIgnore:r}),r||{}}function hX(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 fme=function(){function r(e){this.group=new Ze,this._SymbolCtor=e||yc}return r.prototype.updateData=function(e,t){this._progressiveEls=null,t=fX(t);var i=this.group,n=e.hostModel,a=this._data,o=this._SymbolCtor,s=t.disableAnimation,l=hX(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(II(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(!II(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):Ut(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=hX(e),this._data=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t,i){this._progressiveEls=[],i=fX(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(II(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){ca(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}(),wu=fme;function NT(r,e,t){var i=r.getBaseAxis(),n=r.getOtherAxis(i),a=hme(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 Ro(e,f[0])&&(h=!0,f[0]=p),Ro(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 hme(r,e){var t=0,i=r.scale.getExtent();return e==="start"?t=i[0]:e==="end"?t=i[1]:Ct(e)&&!isNaN(e)?t=e:i[0]>0?t=i[0]:i[1]<0&&(t=i[1]),t}function UT(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 pme(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 NI(r,e,t,i,n,a,o,s){for(var l=pme(r,e),u=[],c=[],f=[],h=[],p=[],d=[],g=[],m=NT(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 P=UT(m,n,e,I);f.push(P[0],P[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=pa(U),z=pa(U),k=pa(U),G=pa(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],z[Q]=c[V],z[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:z,stackedOnCurrent:k,stackedOnNext:G,status:Y}}var Wf=Math.min,Xf=Math.max;function rd(r,e){return isNaN(r)||isNaN(e)}function UI(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(rd(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(;rd(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||rd(S,w))p=v,d=_;else{b=S-u,E=w-c;var A=v-u,P=S-v,U=_-c,B=w-_,z=void 0,k=void 0;if(s==="x"){z=Math.abs(A),k=Math.abs(P);var G=b>0?1:-1;p=v-G*z*o,d=_,I=v+G*k*o,R=_}else if(s==="y"){z=Math.abs(U),k=Math.abs(B);var Y=E>0?1:-1;p=v,d=_-Y*z*o,I=v,R=_+Y*k*o}else z=Math.sqrt(A*A+U*U),k=Math.sqrt(P*P+B*B),C=k/(k+z),p=v-b*o*(1-C),d=_-E*o*(1-C),I=v+b*o*C,R=_+E*o*C,I=Wf(I,Xf(S,v)),R=Wf(R,Xf(w,_)),I=Xf(I,Wf(S,v)),R=Xf(R,Wf(w,_)),b=I-v,E=R-_,p=v-b*z/k,d=_-E*z/k,p=Wf(p,Xf(u,v)),d=Wf(d,Xf(c,_)),p=Xf(p,Wf(u,v)),d=Xf(d,Wf(c,_)),b=v-p,E=_-d,I=v+b*k/z,R=_+E*k/z}r.bezierCurveTo(f,h,p,d,v,_),f=I,h=R}else r.lineTo(v,_)}u=v,c=_,g+=a}return m}var pX=function(){function r(){this.smooth=0,this.smoothConstraint=!0}return r}(),dX=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 pX},e.prototype.buildPath=function(t,i){var n=i.points,a=0,o=n.length/2;if(i.connectNulls){for(;o>0&&rd(n[o*2-2],n[o*2-1]);o--);for(;a<o&&rd(n[a*2],n[a*2+1]);a++);}for(;a<o;)a+=UI(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=$i.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?fp(s,p,g,v,t,c):fp(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?pi(l,d,m,_,w):pi(s,p,g,v,w);return u?[t,x]:[x,t]}}s=v,l=_;break}}},e}(ut);var dme=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(pX),OT=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 dme},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&&rd(n[s*2-2],n[s*2-1]);s--);for(;o<s&&rd(n[o*2],n[o*2+1]);o++);}for(;o<s;){var u=UI(t,n,o,s,s,1,i.smooth,l,i.connectNulls);UI(t,a,o+u-1,u,s,-1,i.stackedOnSmooth,l,i.connectNulls),o+=u+1,t.closePath()}},e}(ut);function OI(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 Et({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;or(f,{shape:{width:l,height:u,x:o,y:s}},t,null,i,g)}return f}function zI(r,e,t){var i=r.getArea(),n=Cr(i.r0,1),a=Cr(i.r,1),o=new xi({shape:{cx:Cr(r.cx,1),cy:Cr(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,or(o,{shape:{endAngle:i.endAngle,r:a}},t)}return o}function Tu(r,e,t,i,n){if(r){if(r.type==="polar")return zI(r,e,t);if(r.type==="cartesian2d")return OI(r,e,t,i,n)}else return null;return null}function Ws(r,e){return r.type===e}function mX(r,e){if(r.length===e.length){for(var t=0;t<r.length;t++)if(r[t]!==e[t])return;return!0}}function vX(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 gX(r,e){var t=vX(r),i=t[0],n=t[1],a=vX(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 yX(r){return Ct(r)?r:r?.5:0}function mme(r,e,t){if(!t.valueDim)return[];for(var i=e.count(),n=pa(i*2),a=0;a<i;a++){var o=UT(t,r,e,a);n[a*2]=o[0],n[a*2+1]=o[1]}return n}function Yf(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 vme(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=EG(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 gme(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=vme(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 vu(0,0,0,0,h,!0);return _[n]=g,_[n+"2"]=m,_}}}function yme(r,e,t){var i=r.get("showAllSymbol"),n=i==="auto";if(!(i&&!n)){var a=t.getAxesByScale("ordinal")[0];if(a&&!(n&&_me(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 _me(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(yc.getSymbolSize(e,o)[r.isHorizontal()?1:0]*1.5>i)return!1;return!0}function xme(r,e){return isNaN(r)||isNaN(e)}function Sme(r){for(var e=r.length/2;e>0&&xme(r[e*2-2],r[e*2-1]);e--);return e-1}function _X(r,e){return[r[e*2],r[e*2+1]]}function Mme(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 xX(r){if(r.get(["endLabel","show"]))return!0;for(var e=0;e<Vi.length;e++)if(r.get([Vi[e],"endLabel","show"]))return!0;return!1}function FI(r,e,t,i){if(Ws(e,"cartesian2d")){var n=i.getModel("endLabel"),a=n.get("valueAnimation"),o=i.getData(),s={lastFrameIndex:0},l=xX(i)?function(p,d){r._endLabelOnDuring(p,d,o,s,a,n,e)}:null,u=e.getBaseAxis().isHorizontal(),c=OI(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 zI(e,t,i)}function bme(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 wme=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 wu;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=NT(o,l,x),S=y&&mme(o,l,M),w=t.get("showSymbol"),T=t.get("connectNulls"),C=w&&!h&&yme(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=gme(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=Yf(f,o,E,T),S&&(S=Yf(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,Tl(R)),v.setClipPath(FI(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,Tl(R));var A=v.getClipPath();if(A){var P=FI(this,o,!1,t);or(A,{shape:P.shape},t)}else v.setClipPath(FI(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]]}}),(!mX(this._stackedOnPoints,S)||!mX(this._points,f))&&(_?this._doUpdateAnimation(l,S,o,n,E,x,T):(E&&(f=Yf(f,o,E,T),S&&(S=Yf(S,o,E,T))),g.setShape({points:f}),m&&m.setShape({points:f,stackedOnPoints:S})))}var U=t.getModel("emphasis"),B=U.get("focus"),z=U.get("blurScope"),k=U.get("disabled");if(g.useStyle(Ye(u.getLineStyle(),{fill:"none",stroke:R,lineJoin:"bevel"})),Yr(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,ar(g,B,z,k);var Y=yX(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=yX(Q.get("smooth"))),m.setShape({smooth:Y,stackedOnSmooth:V,smoothMonotone:J,connectNulls:T}),Yr(m,t,"areaStyle"),rt(m).seriesIndex=t.seriesIndex,ar(m,B,z,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=Is(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 yc(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 Zt.prototype.highlight.call(this,t,i,n,a)},e.prototype.downplay=function(t,i,n,a){var o=t.getData(),s=Is(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 Zt.prototype.downplay.call(this,t,i,n,a)},e.prototype._changePolyState=function(t){var i=this._polygon;Ip(this._polyline,t),i&&Ip(i,t)},e.prototype._newPolyline=function(t){var i=this._polyline;return i&&this._lineGroup.remove(i),i=new dX({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 OT({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(xX(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 It({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=Sme(l);c>=0&&(Or(s,Tr(t,"endLabel"),{inheritColor:n,labelFetcher:t,labelDataIndex:c,defaultText:function(f,h,p){return p!=null?IT(o,p):Ul(o,f)},enableTextSetter:!0},bme(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=Mme(f,x,w),C=T.range,b=C[1]-C[0],E=void 0;if(b>=1){if(b>1&&!p){var I=_X(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=Cw(n,d,R,A,T.t))}a.lastFrameIndex=C[0]}else{var P=t===1||a.lastFrameIndex>0?C[0]:0,I=_X(f,P);o&&(E=h.getRawValue(P)),u.attr({x:I[0]+M,y:I[1]+S})}if(o){var U=cc(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=NI(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=Yf(h.current,n,o,l),d=Yf(h.stackedOnCurrent,n,o,l),g=Yf(h.next,n,o,l),m=Yf(h.stackedOnNext,n,o,l)),gX(p,g)>3e3||c&&gX(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(),Ut(u,v,f),c&&(c.setShape({points:p,stackedOnPoints:d}),c.stopAnimation(),Ut(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}(Zt),SX=wme;function Ol(r,e){return{seriesType:r,plan:Ao(),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");Ro(i,s[0])&&(s[0]=u),Ro(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&&pa(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 Tme={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]}},Eme=function(r){return Math.round(r.length/2)};function Mx(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=Tme[a]:He(a)&&(d=a),d&&e.setData(n.downSample(n.mapDimension(u.dim),1/p,d,Eme))}}}}}function BI(r){r.registerChartView(SX),r.registerSeriesModel(cX),r.registerLayout(Ol("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,Mx("line"))}var MX=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 dn(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(MX);var Cv=MX;var Ame=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 dn(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=Xn(Cv.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}(Cv),bX=Ame;var Cme=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}(),Rme=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 Cme},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),Rv=Rme;function wX(r,e){e=e||{};var t=e.isRoundCap;return function(i,n,a){var o=n.position;if(!o||o instanceof Array)return Sp(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)+zT(g,l+_,!1),S=f+d*x(g)+FT(g,l+_,!1),w="right",T="middle";break;case"insideStartAngle":M=c+d*y(g)+zT(g,-l+_,!1),S=f+d*x(g)+FT(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)+zT(m,l+_,!0),S=f+d*x(m)+FT(m,l+_,!0),w="left",T="middle";break;case"insideEndAngle":M=c+d*y(m)+zT(m,-l+_,!0),S=f+d*x(m)+FT(m,-l+_,!0),w="right",T="middle";break;default:return Sp(i,n,a)}return i=i||{},i.x=M,i.y=S,i.align=w,i.verticalAlign=T,i}}function TX(r,e,t,i){if(Ct(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 zT(r,e,t){return e*Math.sin(r)*(t?-1:1)}function FT(r,e,t){return e*Math.cos(r)*(t?1:-1)}function Eu(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 Mn(a,n)})}}var kI=Math.max,VI=Math.min;function Lme(r,e){var t=r.getArea&&r.getArea();if(Ws(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 Dme=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){ca(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=Pme(t,u);p&&this._enableRealtimeSort(p,s,n);var d=t.get("clip",!0)||p,g=Lme(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=BT[u.type](s,E),R=Bme(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=BT[u.type](s,E,I);if(v&&T(E),!(!s.hasValue(E)||!LX[u.type](R))){var A=!1;d&&(A=EX[u.type](g,R));var P=AX[u.type](t,s,E,R,f,h,c.model,!1,m);p&&(P.forceLabelAnimation=!0),DX(P,s,E,I,R,t,f,u.type==="polar"),S?P.attr({shape:R}):p?CX(p,h,P,R,E,f,!1,!1):or(P,{shape:R},t,E),s.setItemGraphicEl(E,P),o.add(P),P.ignore=A}}).update(function(E,I){var R=s.getItemModel(E),A=BT[u.type](s,E,R);if(v){var P=void 0;M.length===0?P=T(I):(P=M[I],P.useStyle(_.getItemStyle()),u.type==="cartesian2d"?P.setShape("r",y):P.setShape("cornerRadius",y),x[E]=P);var U=BT[u.type](s,E),B=OX(f,U,u);Ut(P,{shape:B},h,E)}var z=l.getItemGraphicEl(I);if(!s.hasValue(E)||!LX[u.type](A)){o.remove(z);return}var k=!1;if(d&&(k=EX[u.type](g,A),k&&o.remove(z)),z?Ui(z):z=AX[u.type](t,s,E,A,f,h,c.model,!!z,m),p&&(z.forceLabelAnimation=!0),w){var G=z.getTextContent();if(G){var Y=cc(G);Y.prevValue!=null&&(Y.prevValue=Y.value)}}else DX(z,s,E,R,A,t,f,u.type==="polar");S?z.attr({shape:A}):p?CX(p,h,z,A,E,f,!0,w):Ut(z,{shape:A},t,E,null),s.setItemGraphicEl(E,z),z.ignore=k,o.add(z)}).remove(function(E){var I=l.getItemGraphicEl(E);I&&oc(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(),IX(t,this.group),this._updateLargeClip(t)},e.prototype._incrementalRenderLarge=function(t,i){this._removeBackground(),IX(i,this.group,this._progressiveEls,!0)},e.prototype._updateLargeClip=function(t){var i=t.get("clip",!0)&&Tu(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){oc(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}(Zt),EX={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=kI(e.x,r.x),s=VI(e.x+e.width,n),l=kI(e.y,r.y),u=VI(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=VI(e.r,r.r),a=kI(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}},AX={cartesian2d:function(r,e,t,i,n,a,o,s,l){var u=new Et({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?Rv:xi,c=new u({shape:i,z2:1});c.name="item";var f=UX(n);if(c.calculateTextPosition=wX(f,{isRoundCap:u===Rv}),a){var h=c.shape,p=n?"r":"endAngle",d={};h[p]=n?i.r0:i.startAngle,d[p]=i[p],(s?Ut:or)(c,{shape:d},a)}return c}};function Pme(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 CX(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?Ut:or)(t,{shape:l},e,n,null);var c=e?r.baseAxis.model:null;(o?Ut:or)(t,{shape:u},c,n)}function RX(r,e){for(var t=0;t<e.length;t++)if(!isFinite(r[e[t]]))return!0;return!1}var Ime=["x","y","width","height"],Nme=["cx","cy","r","startAngle","endAngle"],LX={cartesian2d:function(r){return!RX(r,Ime)},polar:function(r){return!RX(r,Nme)}},BT={cartesian2d:function(r,e,t){var i=r.getItemLayout(e),n=t?Ome(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 Ume(r){return r.startAngle!=null&&r.endAngle!=null&&r.startAngle===r.endAngle}function UX(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 DX(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=Eu(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);Or(r,d,{labelFetcher:a,labelDataIndex:t,defaultText:Ul(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,TX(r,m==="outside"?p:m,UX(o),i.get(["label","rotate"]))}t1(g,d,a.getRawValue(t),function(_){return IT(e,_)});var v=i.getModel(["emphasis"]);ar(r,v.get("focus"),v.get("blurScope"),v.get("disabled")),Yr(r,i),Ume(n)&&(r.style.fill="none",r.style.stroke="none",N(r.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function Ome(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 zme=function(){function r(){}return r}(),PX=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 zme},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 IX(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 PX({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 PX({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",NX),f.on("mousemove",NX)),t&&t.push(f)}var NX=Y_(function(r){var e=this,t=Fme(e,r.offsetX,r.offsetY);rt(e).dataIndex=t>=0?t:null},30,!1);function Fme(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 OX(r,e,t){if(Ws(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 Bme(r,e,t){var i=r.type==="polar"?xi:Et;return new i({shape:OX(e,t,r),silent:!0,z2:0})}var zX=Dme;function GI(r){r.registerChartView(zX),r.registerSeriesModel(bX),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,ot(oT,"bar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,sT("bar")),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,Mx("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 FX=Math.PI*2,kT=Math.PI/180;function BX(r,e){return Sr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function HI(r,e){var t=BX(r,e),i=r.get("center"),n=r.get("radius");pe(n)||(n=[0,n]);var a=ze(t.width,e.getWidth()),o=ze(t.height,e.getHeight()),s=Math.min(a,o),l=ze(n[0],s/2),u=ze(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=ze(i[0],a)+t.x,f=ze(i[1],o)+t.y;return{cx:c,cy:f,r0:l,r:u}}function WI(r,e,t){e.eachSeriesByType(r,function(i){var n=i.getData(),a=n.mapDimension("value"),o=BX(i,t),s=HI(i,t),l=s.cx,u=s.cy,c=s.r,f=s.r0,h=-i.get("startAngle")*kT,p=i.get("endAngle"),d=i.get("padAngle")*kT;p=p==="auto"?h-FX:-p*kT;var g=i.get("minAngle")*kT,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;d_(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 z;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"?z=_===0&&S?y:U*y:z=E/v,z<m?(z=m,I-=m):R+=U;var k=A+T*z,G=0,Y=0;d>z?(G=A+T*z/2,Y=G):(G=A+b,Y=k-b),n.setItemLayout(B,{angle:z,startAngle:G,endAngle:Y,clockwise:x,cx:l,cy:u,r0:f,r:M?ir(U,w,[f,c]):c}),A=k}),I<FX&&v)if(I<=.001){var P=E/v;n.each(a,function(U,B){if(!isNaN(U)){var z=n.getItemLayout(B);z.angle=P;var k=0,G=0;P<d?(k=h+T*(B+1/2)*P,G=k):(k=h+T*B*P+b,G=h+T*(B+1)*P-b),z.startAngle=k,z.endAngle=G}})}else y=I/R,A=h,n.each(a,function(U,B){if(!isNaN(U)){var z=n.getItemLayout(B),k=z.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),z.startAngle=G,z.endAngle=Y,A+=T*k}})})}function zl(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 kme=Math.PI/180;function kX(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;VX(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}ST(r,l,l+o)&&f(r)}function Vme(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;XI(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(!XI(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,VX(d,m)}}kX(u,e,t,i,1,n,a,o,s,f),kX(l,e,t,i,-1,n,a,o,s,c);for(var h=0;h<r.length;h++){var d=r[h];if(!XI(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 VX(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 XI(r){return r.position==="center"}function YI(r){var e=r.getData(),t=[],i,n,a=!1,o=(r.get("minShowLabelAngle")||0)*kme,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"),P=I.get("alignTo"),U=ze(I.get("edgeDistance"),u),B=I.get("bleedMargin"),z=E.getModel("labelLine"),k=z.get("length");k=ze(k,u);var G=z.get("length2");if(G=ze(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;P==="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":P==="edge"?J>0?"right":"left":J>0?"left":"right"}var xe=Math.PI,Le=0,Ue=I.get("rotate");if(Ct(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 F=C.getBoundingRect().clone();F.applyTransform(C.getComputedTransform());var L=(C.style.margin||0)+2.1;F.y-=L/2,F.height+=L,t.push({label:C,labelLine:b,position:R,len:k,len2:G,minTurnAngle:z.get("minTurnAngle"),maxSurfaceAngle:z.get("maxSurfaceAngle"),surfaceNormal:new zt(J,Q),linePoints:ae,textAlign:ve,labelDistance:A,labelAlignTo:P,edgeDistance:U,bleedMargin:B,rect:F,unconstrainedWidth:F.width,labelStyleWidth:C.style.width})}w.setTextConfig({inside:ue})}}),!a&&r.get("avoidLabelOverlap")&&Vme(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):(sI(M,m.minTurnAngle),U6(M,m.surfaceNormal,m.maxSurfaceAngle),_.setShape({points:M}),v.__hostTarget.textGuideLineConfig={anchor:new zt(M[0][0],M[0][1])})}}}var Gme=function(r){Z(e,r);function e(t,i,n){var a=r.call(this)||this;a.z2=2;var o=new It;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(Eu(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?(or(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,or(o,{shape:{r:c.r}},s,i)):n!=null?(o.setShape({startAngle:n,endAngle:n}),or(o,{shape:{startAngle:c.startAngle,endAngle:c.endAngle}},s,i)):(o.shape.endAngle=c.startAngle,Ut(o,{shape:{endAngle:c.endAngle}},s,i))}else Ui(o),Ut(o,{shape:f},s,i);o.useStyle(t.getItemVisual(i,"style")),Yr(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)},Eu(u.getModel("itemStyle"),c)),fe(o.ensureState("select"),{x:g,y:m,shape:Eu(l.getModel(["select","itemStyle"]),c)}),fe(o.ensureState("blur"),{shape:Eu(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}),ar(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;Or(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 ri,this.setTextGuideLine(p)),Tv(this,Ev(o),{stroke:u,opacity:qi(s.get(["lineStyle","opacity"]),c,1)})}},e}(xi),Hme=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 xi({shape:HI(t,n)});h.useStyle(t.getModel("emptyCircleStyle").getItemStyle()),this._emptyCircleSector=h,l.add(h)}o.diff(s).add(function(p){var d=new Gme(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);oc(d,t,p)}).execute(),YI(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}(Zt),GX=Hme;function Lo(r,e,t){e=pe(e)&&{coordDimensions:e}||fe({encodeDefine:r.getEncode()},e);var i=r.getSource(),n=Dl(i,e).dimensions,a=new ai(n,r);return a.initData(i,t),a}var Wme=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}(),Au=Wme;var Xme=vt(),Yme=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 Au(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 Lo(this,{coordDimensions:["value"],encodeDefaulter:ot(hv,this)})},e.prototype.getDataParams=function(t){var i=this.getData(),n=Xme(i),a=n.seats;if(!a){var o=[];i.each(i.mapDimension("value"),function(l){o.push(l)}),a=n.seats=N2(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){bo(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),HX=Yme;function qI(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!(Ct(o)&&!isNaN(o)&&o<0)})}}}function ZI(r){r.registerChartView(GX),r.registerSeriesModel(HX),V1("pie",r.registerAction),r.registerLayout(ot(WI,"pie")),r.registerProcessor(zl("pie")),r.registerProcessor(qI("pie"))}var qme=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 dn(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),WX=qme;var XX=4,Zme=function(){function r(){}return r}(),jme=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 Zme},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]<XX,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),Kme=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 jme({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=Mr(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor;var o=e.shape.size[0]<XX;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}(),YX=Kme;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.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=Ol("").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 YX:new wu,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}(Zt),qX=Jme;var $me=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}(Nt),ZX=$me;var VT=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Rr).models[0]},e.type="cartesian2dAxis",e}(Nt);wr(VT,xu);var jX={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)"]}}},Qme=xt({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},jX),jI=xt({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}}},jX),eve=xt({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},jI),tve=Ye({logBase:10},jI),GT={category:Qme,value:jI,time:eve,log:tve};var KX={value:1,category:1,time:1,log:1};function Fl(r,e,t,i){N(KX,function(n,a){var o=xt(xt({},GT[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=Df(this),p=h?Fs(c):{},d=f.getTheme();xt(c,d.get(a+"Axis")),xt(c,this.getDefaultOption()),c.type=JX(c),h&&Ya(c,p,h)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=lx.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",JX)}function JX(r){return r.type||(r.data?"category":"value")}var rve=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(),Yt(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}(),$X=rve;var HT=["x","y"];function QX(r){return r.type==="interval"||r.type==="time"}var ive=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=HT,t}return e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,i=this.getAxis("y").scale;if(!(!QX(t)||!QX(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=Cs([],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 hi(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 hi(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}($X),e9=ive;var nve=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}(mn),t9=nve;function bx(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),Hr(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 KI(r){return r.get("coordinateSystem")==="cartesian2d"}function JI(r){var e={xAxisModel:null,yAxisModel:null};return N(e,function(t,i){var n=i.replace(/Model$/,""),a=r.getReferringComponents(n,Rr).models[0];e[i]=a}),e}var $I=Math.log;function WT(r,e,t){var i=Ja.prototype,n=i.getTicks.call(t),a=i.getTicks.call(t,!0),o=n.length-1,s=i.getInterval.call(t),l=QP(r,e),u=l.extent,c=l.fixMin,f=l.fixMax;if(r.type==="log"){var h=$I(r.base);u=[$I(u[0])/h,$I(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=nT(d),m=u[0]+d*o;else if(f)for(g=u[1]-d*o;g>u[0]&&isFinite(g)&&isFinite(u[0]);)d=nT(d),g=u[1]-d*o;else{var v=r.getTicks().length-1;v>o&&(d=nT(d));var _=d*o;m=Math.ceil(u[1]/d)*d,g=Cr(m-_),g<0&&u[0]>=0?(g=0,m=Cr(_)):m>0&&u[1]<=0&&(m=0,g=-Cr(_))}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 ave=function(){function r(e,t,i){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=HT,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=wt(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;ux(g)&&d.get("alignTicks")&&d.get("interval")==null?c.push(p):(_u(g,d),ux(g)&&(s=p))}c.length&&(s||(s=c.pop(),_u(s.scale,s.model)),N(c,function(m){WT(m.scale,m.model,s.scale)}))}}n(i.x),n(i.y);var a={};N(i.x,function(o){i9(i,"y",o,a)}),N(i.y,function(o){i9(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=Sr(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=m6(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]),ove(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",Rr).models[0],n=e.yAxisModel||t&&t.getReferringComponents("yAxis",Rr).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 e9(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(QI(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 t9(c,Gf(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(KI(n)){var a=JI(n),o=a.xAxisModel,s=a.yAxisModel;if(!QI(o,t)||!QI(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(bv(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(KI(n)){var a=JI(n),o=a.xAxisModel,s=a.yAxisModel,l=o.getCoordSysModel(),u=l.coordinateSystem;n.coordinateSystem=u.getCartesian(o.componentIndex,s.componentIndex)}}),i},r.dimensions=HT,r}();function QI(r,e){return r.getCoordSysModel()===e}function i9(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)n9(n[l])&&(a=n[l]);else for(var u in n)if(n.hasOwnProperty(u)&&n9(n[u])&&!i[c(n[u])]){a=n[u];break}a&&(i[c(a)]=!0);function c(f){return f.dim+"_"+f.index}}function n9(r){return r&&r.type!=="category"&&r.type!=="time"&&d6(r)}function ove(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 a9=ave;var qf=Math.PI,id=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!!o9[e]},r.prototype.add=function(e){o9[e](this.opt,this.axisModel,this.group,this._transformGroup)},r.prototype.getGroup=function(){return this.group},r.innerTextLayout=function(e,t,i){var n=s_(t-e),a,o;return Qu(n)?(o=i>0?"top":"bottom",a="center"):Qu(n-qf)?(o=i>0?"bottom":"top",a="center"):(o="middle",n>0&&n<qf?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}(),o9={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&&(hi(s,s,o),hi(l,l,o));var c=fe({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),f=new ei({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:r.strokeContainThreshold||5,silent:!0,z2:1});sc(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)||Ct(p))&&(p=[p,p]);var d=Co(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=Mr(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=uve(t,i,e,r),a=fve(t,i,e,r);if(lve(e,a,n),cve(t,i,e,r.tickDirection),e.get(["axisLabel","hideOverlap"])){var o=xT(de(a,function(s){return{label:s,priority:s.z2,defaultAttr:{ignore:s.ignore}}}));MT(o)}},axisName:function(r,e,t,i){var n=Hr(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,l9(a)?r.labelOffset+o*l:0],h,p=e.get("nameRotate");p!=null&&(p=p*qf/180);var d;l9(a)?h=id.innerTextLayout(r.rotation,p??r.rotation,o):(h=sve(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,_=Hr(r.nameTruncateMaxWidth,m.maxWidth,d),y=new It({x:f[0],y:f[1],rotation:h.rotation,silent:id.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(bl({el:y,componentModel:e,itemName:n}),y.__fullText=n,y.anid="name",e.get("triggerEvent")){var x=id.makeAxisEventDataBase(e);x.targetType="axisName",x.name=n,rt(y).eventData=x}i.add(y),y.updateTransform(),t.add(y),y.decomposeTransform()}}};function sve(r,e,t,i){var n=s_(t-r),a,o,s=i[0]>i[1],l=e==="start"&&!s||e!=="start"&&s;return Qu(n-qf/2)?(o=l?"bottom":"top",a="center"):Qu(n-qf*1.5)?(o=l?"top":"bottom",a="center"):(o="middle",n<qf*1.5&&n>qf/2?a=l?"left":"right":a=l?"right":"left"),{rotation:n,textAlign:a,textVerticalAlign:o}}function lve(r,e,t){if(!mT(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?(Xs(a),Xs(u)):s9(a,o)&&(i?(Xs(o),Xs(c)):(Xs(a),Xs(u))),n===!1?(Xs(s),Xs(f)):s9(l,s)&&(n?(Xs(l),Xs(h)):(Xs(s),Xs(f)))}}function Xs(r){r&&(r.ignore=!0)}function s9(r,e){var t=r&&r.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(!(!t||!i)){var n=pf([]);return Oa(n,n,-r.rotation),t.applyTransform(Ua([],n,r.getLocalTransform())),i.applyTransform(Ua([],n,e.getLocalTransform())),t.intersect(i)}}function l9(r){return r==="middle"||r==="center"}function u9(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&&(hi(o,o,e),hi(s,s,e));var c=new ei({shape:{x1:o[0],y1:o[1],x2:s[0],y2:s[1]},style:i,z2:2,autoBatch:!0,silent:!0});sc(c.shape,c.style.lineWidth),c.anid=n+"_"+r[l].tickValue,a.push(c)}return a}function uve(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=u9(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 cve(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=u9(o[c],e.transform,l,u,"minorticks_"+c),h=0;h<f.length;h++)r.add(f[h])}}function fve(r,e,t,i){var n=t.axis,a=Hr(i.axisLabelShow,t.get(["axisLabel","show"]));if(!(!a||n.scale.isBlank())){var o=t.getModel("axisLabel"),s=o.get("margin"),l=n.getViewLabels(),u=(Hr(i.labelRotate,o.get("rotate"))||0)*qf/180,c=id.innerTextLayout(i.rotation,u,i.labelDirection),f=t.getCategories&&t.getCategories(!0),h=[],p=id.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 Kt(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 It({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 P=id.makeAxisEventDataBase(t);P.targetType="axisLabel",P.value=y,P.tickIndex=m,n.type==="category"&&(P.dataIndex=v),rt(A).eventData=P}e.add(A),A.updateTransform(),h.push(A),r.add(A),A.decomposeTransform()}),h}}var Ln=id;function c9(r,e){var t={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return hve(t,r,e),t.seriesInvolved&&dve(t,r),t}function hve(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=Lv(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&&!tN(y))){v==null&&(v=y.get("triggerTooltip")),y=m?pve(_,f,n,e,m,v):y;var M=y.get("snap"),S=y.get("triggerEmphasis"),w=Lv(_.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:tN(y),seriesModels:[],linkGroup:null};u[w]=C,r.seriesInvolved=r.seriesInvolved||T;var b=mve(a,_);if(b!=null){var E=o[b]||(o[b]={axesInfo:{}});E.axesInfo[w]=C,E.mapper=a[b].mapper,C.linkGroup=E}}}})}function pve(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 Kt(l,t,i))}function dve(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[Lv(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 mve(r,e){for(var t=e.model,i=e.dim,n=0;n<r.length;n++){var a=r[n]||{};if(eN(a[i+"AxisId"],t.id)||eN(a[i+"AxisIndex"],t.componentIndex)||eN(a[i+"AxisName"],t.name))return n}}function eN(r,e){return r==="all"||pe(r)&&dt(r,e)>=0||r===e}function f9(r){var e=XT(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=tN(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 XT(r){var e=(r.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[Lv(r)]}function h9(r){var e=XT(r);return e&&e.axisPointerModel}function tN(r){return!!r.get(["handle","show"])}function Lv(r){return r.type+"||"+r.id}var p9={},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){this.axisPointerClass&&f9(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=h9(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){p9[t]=i},e.getAxisPointerClass=function(t){return t&&p9[t]},e.type="axis",e}(tr),$a=vve;var iN=vt();function YT(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=iN(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 Et({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}iN(r).splitAreaColors=h}}}function qT(r){iN(r).splitAreaColors=null}var gve=["axisLine","axisTickLabel","axisName"],yve=["splitArea","splitLine","minorSplitLine"],d9=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=bx(s,t),u=new Ln(t,fe({handleAutoShown:function(f){for(var h=s.coordinateSystem.getCartesians(),p=0;p<h.length;p++)if(ux(h[p].getOtherAxis(t.axis).scale))return!0;return!1}},l));N(gve,u.add,u),this._axisGroup.add(u.getGroup()),N(yve,function(f){t.get([f,"show"])&&_ve[f](this,this._axisGroup,t,s)},this);var c=a&&a.type==="changeAxisOrder"&&a.isInitSort;c||lc(o,this._axisGroup,t),r.prototype.render.call(this,t,i,n,a)}},e.prototype.remove=function(){qT(this)},e.type="cartesianAxis",e}($a),_ve={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 ei({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});sc(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 ei({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});sc(m.shape,h.lineWidth),e.add(m)}},splitArea:function(r,e,t,i){YT(r,e,t,i)}},nN=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}(d9);var m9=function(r){Z(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=nN.type,t}return e.type="yAxis",e}(d9);var xve=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 Et({shape:t.coordinateSystem.getRect(),style:Ye({fill:t.get("backgroundColor")},t.getItemStyle()),silent:!0,z2:-1}))},e.type="grid",e}(tr),v9={offset:0};function ZT(r){r.registerComponentView(xve),r.registerComponentModel(ZX),r.registerCoordinateSystem("cartesian2d",a9),Fl(r,"x",VT,v9),Fl(r,"y",VT,v9),r.registerComponentView(nN),r.registerComponentView(m9),r.registerPreprocessor(function(e){e.xAxis&&e.yAxis&&!e.grid&&(e.grid={})})}function aN(r){Ot(ZT),r.registerSeriesModel(WX),r.registerChartView(qX),r.registerLayout(Ol("scatter"))}function oN(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]=g9(c)?c:y9(n)})}),t.each(function(o){var s=HV(i[o],function(l){return g9(l)})||y9(n);i[o].push(s.slice()),t.setItemLayout(o,i[o])})}})}function g9(r){return!isNaN(r[0])&&!isNaN(r[1])}function y9(r){return[r.cx,r.cy]}function sN(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 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){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=Rl(h.getItemVisual(p,"symbolSize")),m=Mr(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[_]),Rt[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 ni,g=new ri,m={shape:{points:p}};d.shape.points=f(p),g.shape.points=f(p),or(d,m,t,h),or(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),Ui(m),Ui(g),Ut(g,_,t),Ut(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})),Yr(g,d,"lineStyle"),Yr(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 Br){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=""),Or(T,Tr(d),{labelFetcher:s.hostModel,labelDataIndex:p,labelDimIndex:T.__dimIdx,defaultText:E,inheritColor:y,defaultOpacity:_.opacity})}),ar(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}(Zt),_9=Sve;var Mve=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 Au(Be(this.getData,this),Be(this.getRawData,this))},e.prototype.getInitialData=function(t,i){return Lo(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=L1(this,t);return kr("section",{header:u,sortBlocks:!0,blocks:de(s,function(f){var h=a.get(a.mapDimension(f.dim),t);return kr("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),x9=Mve;var Tx=GT.value;function jT(r,e){return Ye({show:e},r)}var bve=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=xt(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 Kt(m,null,this.ecModel);return wr(_,xu.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:xt({lineStyle:{color:"#bbb"}},Tx.axisLine),axisLabel:jT(Tx.axisLabel,!1),axisTick:jT(Tx.axisTick,!1),splitLine:jT(Tx.splitLine,!0),splitArea:jT(Tx.splitArea,!0),indicator:[]},e}(Nt),S9=bve;var wve=["axisLine","axisTickLabel","axisName"],Tve=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 Ln(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(wve,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 _(P,U,B){var z=B%U.length;return P[z]=P[z]||[],z}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 ua({shape:{cx:x,cy:M,r:y[S].coord}}))}if(f&&S<y.length-1){var w=_(v,g,S);v[w].push(new Up({shape:{cx:x,cy:M,r0:y[S].coord,r:y[S+1].coord}}))}}else for(var T,C=de(n,function(P,U){var B=P.getTicksCoords();return T=T==null?B.length-1:Math.min(B.length-1,T),de(B,function(z){return i.coordToPoint(z.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 ri({shape:{points:E}}))}if(f&&b){var w=_(v,g,S-1);v[w].push(new ni({shape:{points:E.concat(b)}}))}b=E.slice().reverse()}var R=l.getLineStyle(),A=u.getAreaStyle();N(v,function(P,U){this.group.add(Wn(P,{style:Ye({stroke:"none",fill:g[U%g.length]},A),silent:!0}))},this),N(m,function(P,U){this.group.add(Wn(P,{style:Ye({fill:"none",stroke:d[U%d.length]},R),silent:!0}))},this)},e.type="radar",e}(tr),M9=Tve;var Eve=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}(mn),b9=Eve;var Ave=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 b9(o,new Ja);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=ze(i[0],n),this.cy=ze(i[1],a),this.startAngle=e.get("startAngle")*Math.PI/180;var s=e.get("radius");(Ce(s)||Ct(s))&&(s=[0,s]),this.r0=ze(s[0],o),this.r=ze(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 Ja;o.setExtent(0,a),o.setInterval(1),N(i,function(s,l){WT(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}(),w9=Ave;function T9(r){r.registerCoordinateSystem("radar",w9),r.registerComponentModel(S9),r.registerComponentView(M9),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 lN(r){Ot(T9),r.registerChartView(_9),r.registerSeriesModel(x9),r.registerLayout(oN),r.registerProcessor(zl("radar")),r.registerPreprocessor(sN)}var E9="\0_ec_interaction_mutex";function A9(r,e,t){var i=cN(r);i[e]=t}function C9(r,e,t){var i=cN(r),n=i[e];n===t&&(i[e]=null)}function uN(r,e){return!!cN(r)[e]}function cN(r){return r[E9]||(r[E9]={})}ha({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},Ur);var Cve=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(!e2(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||!KT("moveOnMouseMove",t,this._opt)||t.gestureEvent==="pinch"||uN(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&&Na(t.event),L9(this,"pan","moveOnMouseMove",t,{dx:s,dy:l,oldX:a,oldY:o,newX:i,newY:n,isAvailableBehavior:null})}},e.prototype._mouseupHandler=function(t){e2(t)||(this._dragging=!1)},e.prototype._mousewheelHandler=function(t){var i=KT("zoomOnMouseWheel",t,this._opt),n=KT("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;fN(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);fN(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:h,originX:s,originY:l,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){if(!uN(this._zr,"globalPan")){var i=t.pinchScale>1?1.1:1/1.1;fN(this,"zoom",null,t,{scale:i,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})}},e}(Ni);function fN(r,e,t,i,n){r.pointerChecker&&r.pointerChecker(i,n.originX,n.originY)&&(Na(i.event),L9(r,e,t,i,n))}function L9(r,e,t,i,n){n.isAvailableBehavior=Be(KT,null,t,i),r.trigger(e,n)}function KT(r,e,t){var i=t[r];return!r||i&&(!Ce(i)||e.event[i+"Key"])}var Cu=Cve;function Dv(r,e,t){var i=r.target;i.x+=e,i.y+=t,i.dirty()}function Pv(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 Rve={axisPointer:1,tooltip:1,brush:1};function Zf(r,e,t){var i=e.getComponentByElement(r.topTarget),n=i&&i.coordinateSystem;return i&&i!==t&&!Rve.hasOwnProperty(i.mainType)&&n&&n.model!==t}function JT(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 pN,$T={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"},D9=wt($T),QT={"alignment-baseline":"textBaseline","stop-color":"stopColor"},P9=wt(QT),Lve=function(){function r(){this._defs={},this._root=null}return r.prototype.parse=function(e,t){t=t||{};var i=JT(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),Do(i,n,null,!0,!1);for(var u=i.firstChild;u;)this._parseNode(u,n,a,null,!1,!1),u=u.nextSibling;Ive(this._defs,this._defsUsePending),this._defsUsePending=[];var c,f;if(o){var h=eE(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=mN(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 Et({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=pN[s];if(c&&tt(pN,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=I9[s];if(p&&tt(I9,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 tc({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});Ys(t,i),Do(e,i,this._defsUsePending,!1,!1),Dve(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(){pN={g:function(e,t){var i=new Ze;return Ys(t,i),Do(e,i,this._defsUsePending,!1,!1),i},rect:function(e,t){var i=new Et;return Ys(t,i),Do(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 ua;return Ys(t,i),Do(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 ei;return Ys(t,i),Do(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 M_;return Ys(t,i),Do(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=O9(i));var a=new ni({shape:{points:n||[]},silent:!0});return Ys(t,a),Do(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var i=e.getAttribute("points"),n;i&&(n=O9(i));var a=new ri({shape:{points:n||[]},silent:!0});return Ys(t,a),Do(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var i=new Br;return Ys(t,i),Do(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 Ys(t,s),Do(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 Ys(t,s),Do(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=Xw(i);return Ys(t,n),Do(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}}(),r}(),I9={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 vu(e,t,i,n);return N9(r,a),U9(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 jw(e,t,i);return N9(r,n),U9(r,n),n}};function N9(r,e){var t=r.getAttribute("gradientUnits");t==="userSpaceOnUse"&&(e.global=!0)}function U9(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={};B9(t,a,a);var o=a.stopColor||t.getAttribute("stop-color")||"#000000";e.colorStops.push({offset:n,color:o})}t=t.nextSibling}}function Ys(r,e){r&&r.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),Ye(e.__inheritedStyle,r.__inheritedStyle))}function O9(r){for(var e=eE(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 Do(r,e,t,i,n){var a=e,o=a.__inheritedStyle=a.__inheritedStyle||{},s={};r.nodeType===1&&(Ove(r,e),B9(r,o,s),i||zve(r,o,s)),a.style=a.style||{},o.fill!=null&&(a.style.fill=z9(a,"fill",o.fill,t)),o.stroke!=null&&(a.style.stroke=z9(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(eE(o.lineDash),function(l){return parseFloat(l)})),(o.visibility==="hidden"||o.visibility==="collapse")&&(a.invisible=!0),o.display==="none"&&(a.ignore=!0)}function Dve(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 Pve=/^url\(\s*#(.*?)\)/;function z9(r,e,t,i){var n=t&&t.match(Pve);if(n){var a=Zi(n[1]);i.push([r,e,a]);return}return t==="none"&&(t=null),t}function Ive(r,e){for(var t=0;t<e.length;t++){var i=e[t];i[0].style[i[1]]=r[i[2]]}}var Nve=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function eE(r){return r.match(Nve)||[]}var Uve=/(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.eE,]*)\)/g,dN=Math.PI/180;function Ove(r,e){var t=r.getAttribute("transform");if(t){t=t.replace(/,/g," ");var i=[],n=null;t.replace(Uve,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=eE(o);switch(n=n||Ei(),s){case"translate":Sn(n,n,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Dm(n,n,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Oa(n,n,-parseFloat(l[0])*dN,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*dN);Ua(n,[1,0,u,1,0,0],n);break;case"skewY":var c=Math.tan(parseFloat(l[0])*dN);Ua(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 F9=/([^\s:;]+)\s*:\s*([^:;]+)/g;function B9(r,e,t){var i=r.getAttribute("style");if(i){F9.lastIndex=0;for(var n;(n=F9.exec(i))!=null;){var a=n[1],o=tt($T,a)?$T[a]:null;o&&(e[o]=n[2]);var s=tt(QT,a)?QT[a]:null;s&&(t[s]=n[2])}}}function zve(r,e,t){for(var i=0;i<D9.length;i++){var n=D9[i],a=r.getAttribute(n);a!=null&&(e[$T[n]]=a)}for(var i=0;i<P9.length;i++){var n=P9[i],a=r.getAttribute(n);a!=null&&(t[QT[n]]=a)}}function mN(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 k9(r,e){var t=new Lve;return t.parse(r,e)}var Fve=ke(["rect","circle","line","ellipse","polygon","polyline","path","text","tspan","g"]),V9=function(){function r(e,t){this.type="geoSVG",this._usedGraphicMap=ke(),this._freedGraphics=[],this._mapName=e,this._parsedXML=JT(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=kve(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&&k9(e,{ignoreViewBox:!0,ignoreRootClip:!0})||{},i=t.root,Wr(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=mN(s,l);i.scaleX=i.scaleY=d.scale,i.x=d.x,i.y=d.y}n.setClipPath(new Et({shape:l.plain()}));var g=[];return N(t.named,function(m){Fve.get(m.svgNodeTagLower)!=null&&(g.push(m),Bve(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 Bve(r){r.silent=!1,r.isGroup&&r.traverse(function(e){e.silent=!1})}function kve(r){var e=[],t=ke();return N(r,function(i){if(i.namedFrom==null){var n=new S6(i.name,i.el);e.push(n),t.set(i.name,n)}}),{regions:e,regionsMap:t}}var vN=[126,25],G9="\u5357\u6D77\u8BF8\u5C9B",ad=[[[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(jf=0;jf<ad.length;jf++)for(nd=0;nd<ad[jf].length;nd++)ad[jf][nd][0]/=10.5,ad[jf][nd][1]/=-10.5/.75,ad[jf][nd][0]+=vN[0],ad[jf][nd][1]+=vN[1];var nd,jf;function gN(r,e){if(r==="china"){for(var t=0;t<e.length;t++)if(e[t].name===G9)return;e.push(new gT(G9,de(ad,function(i){return{type:"polygon",exterior:i}}),vN))}}var Vve={\u5357\u6D77\u8BF8\u5C9B:[32,80],\u5E7F\u4E1C:[0,-10],\u9999\u6E2F:[10,5],\u6FB3\u95E8:[-10,10],\u5929\u6D25:[5,5]};function yN(r,e){if(r==="china"){var t=Vve[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 Gve=[[[123.45165252685547,25.73527164402261],[123.49731445312499,25.73527164402261],[123.49731445312499,25.750734064600884],[123.45165252685547,25.750734064600884],[123.45165252685547,25.73527164402261]]];function _N(r,e){r==="china"&&e.name==="\u53F0\u6E7E"&&e.geometries.push({type:"polygon",exterior:Gve[0]})}var Hve="name",H9=function(){function r(e,t,i){this.type="geoJSON",this._parsedMap=ke(),this._mapName=e,this._specialAreas=i,this._geoJSON=Xve(t)}return r.prototype.load=function(e,t){t=t||Hve;var i=this._parsedMap.get(t);if(!i){var n=this._parseToRegions(t);i=this._parsedMap.set(t,{regions:n,boundingRect:Wve(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?nI(i,e):[]}catch(a){throw new Error(`Invalid geoJson format
  2216. `+a.message)}return gN(t,n),N(n,function(a){var o=a.name;yN(t,a),_N(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 Wve(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 Xve(r){return Ce(r)?typeof JSON<"u"&&JSON.parse?JSON.parse(r):new Function("return ("+r+");")():r}var Ex=ke(),va={registerMap:function(r,e,t){if(e.svg){var i=new V9(r,e.svg);Ex.set(r,i)}else{var n=e.geoJson||e.geoJSON;n&&!e.features?t=e.specialAreas:n=e;var i=new H9(r,n,t);Ex.set(r,i)}},getGeoResource:function(r){return Ex.get(r)},getMapForUser:function(r){var e=Ex.get(r);return e&&e.type==="geoJSON"&&e.getMapForUser()},load:function(r,e,t){var i=Ex.get(r);if(i)return i.load(e,t)}};var xN=["rect","circle","line","ellipse","polygon","polyline","path"],Yve=ke(xN),qve=ke(xN.concat(["g"])),Zve=ke(xN.concat(["g"])),J9=vt();function tE(r){var e=r.getItemStyle(),t=r.get("areaColor");return t!=null&&(e.fill=t),e}function W9(r){var e=r.style;e&&(e.stroke=e.stroke||e.fill,e.fill=null)}var jve=function(){function r(e){var t=new Ze;this.uid=zs("ec_map_draw"),this._controller=new Cu(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()):Ut(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=K9(T,u)),N(T,function(b){y.push(new ni(h(b)))})}else{var C=w.points;u&&(C=K9(C,u,!0)),N(C,function(b){x.push(new ri(h(b)))})}});var M=c(p.getCenter(),l&&l.project);function S(w,T){if(w.length){var C=new rv({culling:!0,segmentIgnoreThreshold:1,shape:{paths:w}});g.add(C),X9(e,C,v,_),Y9(e,C,d,_,o,v,M),T&&(W9(C),N(C.states,W9))}}S(y),S(x,!0)}),t.each(function(p,d){var g=i.get(d),m=g.dataIdx,v=g.regionModel;q9(e,p,d,v,o,m),Z9(e,p,d,v,o),j9(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(Yve.get(c)!=null&&f instanceof _i&&X9(e,f,h,p),f instanceof _i&&(f.culling=!0),f.z2EmphasisLift=0,!o.namedFrom&&(Zve.get(c)!=null&&Y9(e,f,s,p,l,h,null),q9(e,f,s,p,l,h),Z9(e,f,s,p,l),qve.get(c)!=null)){var d=j9(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){_l(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=va.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=va.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,Dv(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,Pv(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])&&!Zf(u,i,e)})},r.prototype.resetForLabelLayout=function(){this.group.traverse(function(e){var t=e.getTextContent();t&&(t.ignore=J9(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 X9(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=tE(n),u=tE(a),c=tE(s),f=tE(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=Ll(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,_l(e)}function Y9(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;Or(e,Tr(i),{labelFetcher:h,labelDataIndex:f,defaultText:t},p);var d=e.getTextContent();if(d&&(J9(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 q9(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 Z9(r,e,t,i,n){r.data||bl({el:e,componentModel:n,itemName:t,itemTooltipOption:i.get("tooltip")})}function j9(r,e,t,i,n){e.highDownSilentOnTouch=!!n.get("selectedMode");var a=i.getModel("emphasis"),o=a.get("focus");return ar(e,o,a.get("blurScope"),a.get("disabled")),r.isGeo&&b4(e,n,t),o}function K9(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 rE=jve;var Kve=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 rE(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 ua({style:{fill:t.getData().getVisual("style").fill},shape:{cx:c[0]+f*9,cy:c[1],r:3},silent:!0,z2:8+(f?0:rc+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);Or(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){Ip(h,y)}}o.add(h)}}})},e.type="map",e}(Zt),$9=Kve;var Jve=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=Lo(this,{coordDimensions:["value"],encodeDefaulter:ot(hv,this)}),n=ke(),a=[],o=0,s=i.count();o<s;o++){var l=i.getName(o);n.set(l,!0)}var u=va.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 kr("section",{header:u.join(", "),noHeader:!u.length,blocks:[kr("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=Mr(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),Q9=Jve;function $ve(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 SN(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=$ve(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 MN(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 e7=hi,Qve=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 za,i._rawTransformable=new za,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=[ze(t[0],i.getWidth()),ze(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=hi([],a,t),n=hi([],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(),G0(this.transform||(this.transform=[]),i.transform||Ei()),this._rawTransform=i.getLocalTransform(),this.invTransform=this.invTransform||[],Cs(this.invTransform,this.transform),this.decomposeTransform()},e.prototype.getTransformInfo=function(){var t=this._rawTransformable,i=this._roamTransformable,n=new za;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?e7(n,t,a):ji(n,t)},e.prototype.pointToData=function(t){var i=this.invTransform;return i?e7([],t,i):[t[0],t[1]]},e.prototype.convertToPixel=function(t,i,n){var a=t7(i);return a===this?a.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,i,n){var a=t7(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}(za);function t7(r){var e=r.seriesModel;return e?e.coordinateSystem:null}var _c=Qve;var ege={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},bN=["lng","lat"],i7=function(r){Z(e,r);function e(t,i,n){var a=r.call(this,t)||this;a.dimensions=bN,a.type="geo",a._nameCoordMap=ke(),a.map=i;var o=n.projection,s=va.load(i,n.nameMap,n.nameProperty),l=va.getGeoResource(i),u=a.resourceType=l?l.type:null,c=a.regions=s.regions,f=ege[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=r7(i);return a===this?a.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,i,n){var a=r7(i);return a===this?a.pointToData(n):null},e}(_c);wr(i7,_c);function r7(r){var e=r.geoModel,t=r.seriesModel;return e?e.coordinateSystem:t?t.coordinateSystem||(t.getReferringComponents("geo",Rr).models[0]||{}).coordinateSystem:null}var wN=i7;function n7(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]);_o(i,i,A),xo(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&&(_=[ze(h[0],d),ze(h[1],g)],y=ze(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=Sr(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 tge(r,e){N(e.get("geoCoord"),function(t,i){r.addGeoCoord(i,t)})}var rge=function(){function r(){this.dimensions=bN}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 wN(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=n7,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 wN(s,s,fe({nameMap:wm(l)},n(o[0])));u.zoomLimit=Hr.apply(null,de(o,function(c){return c.get("scaleLimit")})),i.push(u),u.resize=n7,u.resize(o[0],t),N(o,function(c){c.coordinateSystem=u,tge(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=va.load(t,i,n);return N(l.regions,function(u){var c=u.name;!o.get(c)&&a.push({name:c})}),a},r}(),ige=new rge,iE=ige;var nge=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=va.getGeoResource(t.map);if(a&&a.type==="geoJSON"){var o=t.itemStyle=t.itemStyle||{};"color"in o||(o.color="#eee")}this.mergeDefaultAndTheme(t,n),bo(t,"label",["show"])},e.prototype.optionUpdated=function(){var t=this,i=this.option;i.regions=iE.getFilledRegions(i.regions,i.map,i.nameMap,i.nameProperty);var n={};this._optionModelMap=_n(i.regions||[],function(a,o){var s=o.name;return s&&(a.set(s,new Kt(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 Kt(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}(Nt),a7=nge;function o7(r,e){return r.pointToProjected?r.pointToProjected(e):r.pointToData(e)}function Iv(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(o7(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(o7(r,s),i),r.setZoom(o*n)}return{center:r.getCenter(),zoom:r.getZoom()}}var age=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 rE(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;Cl(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}(tr),s7=age;function oge(r,e,t){va.registerMap(r,e,t)}function Ax(r){r.registerCoordinateSystem("geo",iE),r.registerComponentModel(a7),r.registerComponentView(s7),r.registerImpl("registerMap",oge),r.registerImpl("getMap",function(t){return va.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=Iv(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 TN(r){Ot(Ax),r.registerChartView($9),r.registerSeriesModel(Q9),r.registerLayout(MN),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,SN),V1("map",r.registerAction)}function l7(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 u7(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){sge(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=lge(r,n,r.parentNode.hierNode.defaultAncestor||i[0],e)}function c7(r){var e=r.hierNode.prelim+r.parentNode.hierNode.modifier;r.setLayout({x:e},!0),r.hierNode.modifier+=r.parentNode.hierNode.modifier}function CN(r){return arguments.length?r:fge}function od(r,e){return r-=Math.PI/2,{x:e*Math.cos(r),y:e*Math.sin(r)}}function f7(r,e){return Sr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function sge(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 lge(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=EN(s),a=AN(a),s&&a;){n=EN(n),o=AN(o),n.hierNode.ancestor=r;var h=s.hierNode.prelim+f-a.hierNode.prelim-u+i(s,a);h>0&&(cge(uge(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&&!EN(n)&&(n.hierNode.thread=s,n.hierNode.modifier+=f-l),a&&!AN(o)&&(o.hierNode.thread=a,o.hierNode.modifier+=u-c,t=r)}return t}function EN(r){var e=r.children;return e.length&&r.isExpand?e[e.length-1]:r.hierNode.thread}function AN(r){var e=r.children;return e.length&&r.isExpand?e[0]:r.hierNode.thread}function uge(r,e,t){return r.hierNode.ancestor.parentNode===e.parentNode?r.hierNode.ancestor:t}function cge(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 fge(r,e){return r.parentNode===e.parentNode?1:2}var hge=function(){function r(){this.parentPoint=[],this.childPoints=[]}return r}(),pge=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 hge},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=ze(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),dge=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 Cu(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){h7(a,c)&&p7(a,c,null,s,t)}).update(function(c,f){var h=u.getItemGraphicEl(f);if(!h7(a,c)){h&&m7(u,f,h,s,t);return}p7(a,c,h,s,t)}).remove(function(c){var f=u.getItemGraphicEl(c);f&&m7(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=[];Ep(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 _c;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)&&!Zf(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){Dv(s,u.dx,u.dy),n.dispatchAction({seriesId:t.id,type:"treeRoam",dx:u.dx,dy:u.dy})}).on("zoom",function(u){Pv(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}(Zt);function h7(r,e){var t=r.getItemLayout(e);return t&&!isNaN(t.x)&&!isNaN(t.y)}function p7(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 yc(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,Ut(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"?np(o.getAncestorsIndices(),o.getDescendantIndices()):I==="ancestor"?o.getAncestorsIndices():I==="descendant"?o.getDescendantIndices():null;R&&(rt(t).focus=R),mge(n,o,c,t,d,p,g,i),t.__edge&&(t.onHoverStateChange=function(A){if(A!=="blur"){var P=o.parentNode&&r.getItemGraphicEl(o.parentNode.dataIndex);P&&P.hoverState===Pp||Ip(t.__edge,A)}})}function mge(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 Op({shape:RN(c,f,h,n,n)})),Ut(g,{shape:RN(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 pge({shape:{parentPoint:[o.x,o.y],childPoints:[[o.x,o.y]],orient:f,forkPosition:p}})),Ut(g,{shape:{parentPoint:[o.x,o.y],childPoints:v}},r)}g&&!(u==="polyline"&&!e.isExpand)&&(g.useStyle(Ye({strokeNoScale:!0,fill:null},d)),Yr(g,l,"lineStyle"),_l(g),s.add(g))}function d7(r,e,t,i,n){var a=e.tree.root,o=v7(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"?Os(h,{shape:RN(d,g,m,l,l),style:{opacity:0}},i,{cb:function(){t.remove(h)},removeOpt:n}):p==="polyline"&&i.get("layout")==="orthogonal"&&Os(h,{shape:{parentPoint:[l.x,l.y],childPoints:[[l.x,l.y]]},style:{opacity:0}},i,{cb:function(){t.remove(h)},removeOpt:n}))}}function v7(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 m7(r,e,t,i,n){var a=r.tree.getNodeByDataIndex(e),o=r.tree.root,s=v7(o,a).sourceLayout,l={duration:n.get("animationDurationUpdate"),easing:n.get("animationEasingUpdate")};Os(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){d7(u,r,i,n,l)}),d7(a,r,i,n,l)}function RN(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=od(u,f),d=od(u,f+(h-f)*t),g=od(c,h+(f-h)*t),m=od(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 g7=dge;var qs=vt();function vge(r){var e=r.mainData,t=r.datas;t||(t={main:e},r.datasAttr={main:"data"}),r.datas=r.mainData=null,y7(e,t,r),N(t,function(i){N(e.TRANSFERABLE_METHODS,function(n){i.wrapMethod(n,ot(gge,r))})}),e.wrapMethod("cloneShallow",ot(_ge,r)),N(e.CHANGABLE_METHODS,function(i){e.wrapMethod(i,ot(yge,r))}),Wr(t[e.dataType]===e)}function gge(r,e){if(Mge(this)){var t=fe({},qs(this).datas);t[this.dataType]=e,y7(e,t,r)}else LN(e,this.dataType,qs(this).mainData,r);return e}function yge(r,e){return r.struct&&r.struct.update(),e}function _ge(r,e){return N(qs(e).datas,function(t,i){t!==e&&LN(t.cloneShallow(),i,e,r)}),e}function xge(r){var e=qs(this).mainData;return r==null||e==null?e:qs(e).datas[r]}function Sge(){var r=qs(this).mainData;return r==null?[{data:r}]:de(wt(qs(r).datas),function(e){return{type:e,data:qs(r).datas[e]}})}function Mge(r){return qs(r).mainData===r}function y7(r,e,t){qs(r).datas={},N(e,function(i,n){LN(i,n,r,t)})}function LN(r,e,t,i){qs(t).datas[e]=r,qs(r).mainData=t,r.dataType=e,i.struct&&(r[i.structAttr]=i.struct,i.struct[i.datasAttr[e]]=r),r.getLinkedData=xge,r.getLinkedDataAll=Sge}var nE=vge;var bge=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 wge=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 bge(Kr(c.name,""),n);f?Tge(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=Dl(a,{coordDimensions:["value"],dimensionsCount:o}).dimensions,u=new ai(l,t);return u.initData(a),i&&i(u),nE({mainData:u,struct:n,structAttr:"tree"}),n.update(),n},r}();function Tge(r,e){var t=e.children;r.parentNode!==e&&(t.push(r),r.parentNode=e)}var Nv=wge;function xc(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 DN(r){for(var e=[];r;)r=r.parentNode,r&&e.push(r);return e.reverse()}function Uv(r,e){var t=DN(r);return dt(t,e)>=0}function Kf(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 Ege=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 Kt(n,this,this.ecModel),o=Nv.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 kr("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=Kf(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),_7=Ege;function x7(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 Ov(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 IN(r,e){r.eachSeriesByType("tree",function(t){Age(t,e)})}function Age(r,e){var t=f7(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=CN(function(y,x){return(y.parentNode===x.parentNode?1:2)/y.depth})):(n=t.width,a=t.height,o=CN());var s=r.getData().tree.root,l=s.children[0];if(l){l7(s),x7(l,u7,o),s.hierNode.modifier=-l.hierNode.prelim,Ov(l,c7);var u=l,c=l,f=l;Ov(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),Ov(l,function(y){m=(y.getLayout().x+p)*d,v=(y.depth-1)*g;var x=od(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),Ov(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),Ov(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 NN(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 S7(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=Iv(a,e,void 0,i);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}function UN(r){r.registerChartView(g7),r.registerSeriesModel(_7),r.registerLayout(IN),r.registerVisual(NN),S7(r)}var M7=["treemapZoomToNode","treemapRender","treemapMove"];function b7(r){for(var e=0;e<M7.length;e++)r.registerAction({type:M7[e],update:"updateView"},Ur);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=xc(t,s,a);if(l){var u=a.getViewRoot();u&&(t.direction=Uv(u,l.node)?"rollUp":"drillDown"),a.resetViewRoot(l.node)}}})}function Cx(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=z_(r.ecModel,a.name||a.dataIndex+"",i);n.setVisual("decal",o)})}var Cge=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};w7(n);var a=t.levels||[],o=this.designatedVisualItemStyle={},s=new Kt({itemStyle:o},this,i);a=t.levels=Rge(a,i);var l=de(a||[],function(f){return new Kt(f,s,i)},this),u=Nv.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 kr("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=Kf(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(){Cx(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 w7(r){var e=0;N(r.children,function(i){w7(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 Rge(r,e){var t=Qt(e.get("color")),i=Qt(e.get(["aria","decal","decals"]));if(t){r=r||[];var n,a;N(r,function(s){var l=new Kt(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 T7=Cge;var Lge=8,E7=8,ON=5,Dge=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),Lf(o,f.pos,f.box)}},r.prototype._prepare=function(e,t,i){for(var n=e;n;n=n.parentNode){var a=Kr(n.getModel().get("name"),""),o=i.getTextRect(a),s=Math.max(o.width+Lge*2,t.emptyItemWidth);t.totalWidth+=s+E7,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=A5(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 ni({shape:{points:Pge(l,0,_,c,g===p.length-1,g===0)},style:Ye(i.getItemStyle(),{lineJoin:"bevel"}),textContent:new It({style:fr(a,{text:y})}),textConfig:{position:"inside"},z2:rc*1e4,onclick:ot(s,v)});x.disableLabelAnimation=!0,x.getTextContent().ensureState("emphasis").style=fr(o,{text:y}),x.ensureState("emphasis").style=d,ar(x,n.get("focus"),n.get("blurScope"),n.get("disabled")),this.group.add(x),Ige(x,e,v),l+=_+E7}},r.prototype.remove=function(){this.group.removeAll()},r}();function Pge(r,e,t,i,n,a){var o=[[n?r:r-ON,e],[r+t,e],[r+t,e+i],[n?r:r-ON,e+i]];return!a&&o.splice(2,0,[r+t+ON,e+i/2]),!n&&o.push([r,e+i/2]),o}function Ige(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&&Kf(t,e)}}var A7=Dge;var Nge=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 C7(){return new Nge}var zN=Ze,R7=Et,L7=3,D7="label",P7="upperLabel",Oge=rc*10,zge=rc*2,Fge=rc*3,sd=Ga([["fill","color"],["stroke","strokeColor"],["lineWidth","strokeWidth"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),I7=function(r){var e=sd(r);return e.stroke=e.fill=e.lineWidth=null,e},aE=vt(),Bge=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=Rx(),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=xc(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 zN,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=Rx(),l=Rx(),u=this._storage,c=[];function f(m,v,_,y){return kge(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 Rn(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=Rx();return m&&N(m,function(_,y){var x=v[y];N(_,function(M){M&&(x.push(M),aE(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=C7();N(i.willDeleteEls,function(f,h){N(f,function(p,d){if(!p.invisible){var g=p.parent,m,v=aE(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 Cu(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)>L7||Math.abs(t.dy)>L7)){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=Ei();Sn(u,u,[-i,-n]),Dm(u,u,[t.scale,t.scale]),Sn(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&&Wp(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 A7(this.group))).render(t,i,n.node,function(o){a._state!=="animating"&&(Uv(t.getViewRoot(),o)?a._rootToNode({node:o}):a._zoomToNode({node:o}))})},e.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=Rx(),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}(Zt);function Rx(){return{nodeGroup:[],background:[],content:[]}}function kge(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",zN);if(!E)return;if(l.add(E),E.x=c.x||0,E.y=c.y||0,E.markRedraw(),aE(E).nodeWidth=p,aE(E).nodeHeight=d,c.isAboveViewRoot)return E;var I=V("background",R7,u,zge);I&&k(E,I,M&&c.upperLabelHeight);var R=h.getModel("emphasis"),A=R.get("focus"),P=R.get("blurScope"),U=R.get("disabled"),B=A==="ancestor"?o.getAncestorsIndices():A==="descendant"?o.getDescendantIndices():A;if(M)Rf(E)&&nc(E,!1),I&&(nc(I,!U),f.setItemGraphicEl(o.dataIndex,I),kw(I,B,P));else{var z=V("content",R7,u,Fge);z&&G(E,z),I.disableMorphing=!0,I&&Rf(I)&&nc(I,!1),nc(E,!U),f.setItemGraphicEl(o.dataIndex,E),kw(E,B,P)}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=I7(S);We.fill=H;var _e=sd(w);_e.fill=w.get("borderColor");var xe=sd(T);xe.fill=T.get("borderColor");var Le=sd(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,_l(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=I7(S);_e.fill=We,_e.decal=H.decal;var xe=sd(w),Le=sd(T),Ue=sd(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,_l(ue)}ve.add(ue)}function Y(ve){!ve.invisible&&a.push(ve)}function J(ve,ue,se,Ee){var q=h.getModel(Ee?P7:D7),H=Kr(h.get("name"),null),We=q.getShallow("show");Or(ve,Tr(h,Ee?P7:D7),{defaultText:We?H:null,inheritColor:ue,defaultOpacity:se,labelFetcher:r,labelDataIndex:o.dataIndex});var _e=ve.getTextContent();if(_e){var xe=_e.style,Le=Tm(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 _i&&(q.z2=Vge(se,Ee)),ae(H,q)),e[ve][v]=q}function K(ve,ue){var se=ve[v]={};ue instanceof zN?(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 Vge(r,e){return r*Oge+e}var N7=Bge;var Px=N,Gge=qe,lE=-1,VN=function(){function r(e){var t=e.mappingMethod,i=e.type,n=this.option=Qe(e);this.type=i,this.mappingMethod=t,this._normalizeData=Xge[t];var a=r.visualHandlers[i];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[t],t==="piecewise"?(FN(n),Hge(n)):t==="category"?n.categories?Wge(n):FN(n,!0):(Wr(t!=="linear"||n.dataExtent),FN(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 wt(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&&Px(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(Gge(e)){var t=[];Px(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(sE(f[1],e,c[1]))return o}else if(c[1]===1/0){if(sE(f[0],c[0],e))return o}else if(sE(f[0],c[0],e)&&sE(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:Lx("color"),getColorMapper:function(){var e=this.option;return Be(e.mappingMethod==="category"?function(t,i){return!i&&(t=this._normalizeData(t)),Dx.call(this,t)}:function(t,i,n){var a=!!n;return!i&&(t=this._normalizeData(t)),n=sw(t,e.parsedVisual,n),a?n:Ps(n,"rgba")},this)},_normalizedToVisual:{linear:function(e){return Ps(sw(e,this.option.parsedVisual),"rgba")},category:Dx,piecewise:function(e,t){var i=kN.call(this,t);return i==null&&(i=Ps(sw(e,this.option.parsedVisual),"rgba")),i},fixed:ld}},colorHue:oE(function(e,t){return pp(e,t)}),colorSaturation:oE(function(e,t){return pp(e,null,t)}),colorLightness:oE(function(e,t){return pp(e,null,null,t)}),colorAlpha:oE(function(e,t){return dp(e,t)}),decal:{applyVisual:Lx("decal"),_normalizedToVisual:{linear:null,category:Dx,piecewise:null,fixed:null}},opacity:{applyVisual:Lx("opacity"),_normalizedToVisual:BN([0,1])},liftZ:{applyVisual:Lx("liftZ"),_normalizedToVisual:{linear:ld,category:ld,piecewise:ld,fixed:ld}},symbol:{applyVisual:function(e,t,i){var n=this.mapValueToVisual(e);i("symbol",n)},_normalizedToVisual:{linear:U7,category:Dx,piecewise:function(e,t){var i=kN.call(this,t);return i==null&&(i=U7.call(this,e)),i},fixed:ld}},symbolSize:{applyVisual:Lx("symbolSize"),_normalizedToVisual:BN([0,1])}},r}();function Hge(r){var e=r.pieceList;r.hasSpecialVisual=!1,N(e,function(t,i){t.originIndex=i,t.visual!=null&&(r.hasSpecialVisual=!0)})}function Wge(r){var e=r.categories,t=r.categoryMap={},i=r.visual;if(Px(e,function(o,s){t[o]=s}),!pe(i)){var n=[];qe(i)?Px(i,function(o,s){var l=t[s];n[l??lE]=o}):n[lE]=i,i=O7(r,n)}for(var a=e.length-1;a>=0;a--)i[a]==null&&(delete t[e[a]],e.pop())}function FN(r,e){var t=r.visual,i=[];qe(t)?Px(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]),O7(r,i)}function oE(r){return{applyVisual:function(e,t,i){var n=this.mapValueToVisual(e);i("color",r(t("color"),n))},_normalizedToVisual:BN([0,1])}}function U7(r){var e=this.option.visual;return e[Math.round(ir(r,[0,1],[0,e.length-1],!0))]||{}}function Lx(r){return function(e,t,i){i(r,this.mapValueToVisual(e))}}function Dx(r){var e=this.option.visual;return e[this.option.loop&&r!==lE?r%e.length:r]}function ld(){return this.option.visual[0]}function BN(r){return{linear:function(e){return ir(e,r,this.option.visual,!0)},category:Dx,piecewise:function(e,t){var i=kN.call(this,t);return i==null&&(i=ir(e,r,this.option.visual,!0)),i},fixed:ld}}function kN(r){var e=this.option,t=e.pieceList;if(e.hasSpecialVisual){var i=VN.findPieceIndex(r,t),n=t[i];if(n&&n.visual)return n.visual[this.type]}}function O7(r,e){return r.visual=e,r.type==="color"&&(r.parsedVisual=de(e,function(t){var i=hn(t);return i||[0,0,0,1]})),e}var Xge={linear:function(r){return ir(r,this.option.dataExtent,[0,1],!0)},piecewise:function(r){var e=this.option.pieceList,t=VN.findPieceIndex(r,e,!0);if(t!=null)return ir(t,[0,e.length-1],[0,1],!0)},category:function(r){var e=this.option.categories?this.option.categoryMap[r]:r;return e??lE},fixed:Ur};function sE(r,e,t){return r?e<=t:e<t}var di=VN;var Yge="itemStyle",F7=vt(),B7={seriesType:"treemap",reset:function(r){var e=r.getData().tree,t=e.root;t.isRemoved()||k7(t,{},r.getViewRoot().getAncestors(),r)}};function k7(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(Yge),l=qge(s,e,i),u=o.ensureUniqueItemVisual(r.dataIndex,"style"),c=s.get("borderColor"),f=s.get("borderColorSaturation"),h;f!=null&&(h=z7(l),c=Zge(f,h)),u.stroke=c;var p=r.viewChildren;if(!p||!p.length)h=z7(l),u.fill=h;else{var d=jge(r,n,a,s,l,p);N(p,function(g,m){if(g.depth>=t.length||g===t[g.depth]){var v=Kge(n,l,g,m,d,i);k7(g,v,t,i)}})}}}function qge(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 z7(r){var e=GN(r,"color");if(e){var t=GN(r,"colorAlpha"),i=GN(r,"colorSaturation");return i&&(e=pp(e,null,null,i)),t&&(e=dp(e,t)),e}}function Zge(r,e){return e!=null?pp(e,null,null,r):null}function GN(r,e){var t=r[e];if(t!=null&&t!=="none")return t}function jge(r,e,t,i,n,a){if(!(!a||!a.length)){var o=HN(e,"color")||n.color!=null&&n.color!=="none"&&(HN(e,"colorAlpha")||HN(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 di(f);return F7(h).drColorMappingBy=c,h}}}function HN(r,e){var t=r.get(e);return pe(t)&&t.length?{name:e,range:t}:null}function Kge(r,e,t,i,n,a){var o=fe({},e);if(n){var s=n.type,l=s==="color"&&F7(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 Ix=Math.max,uE=Math.min,V7=Hr,WN=N,H7=["itemStyle","borderWidth"],Jge=["itemStyle","gapWidth"],$ge=["upperLabel","show"],Qge=["upperLabel","height"],W7={seriesType:"treemap",reset:function(r,e,t,i){var n=t.getWidth(),a=t.getHeight(),o=r.option,s=Sr(r.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),l=o.size||[],u=ze(V7(s.width,l[0]),n),c=ze(V7(s.height,l[1]),a),f=i&&i.type,h=["treemapZoomToNode","treemapRootToNode"],p=xc(i,h,r),d=f==="treemapRender"||f==="treemapMove"?i.rootRect:null,g=r.getViewRoot(),m=DN(g);if(f!=="treemapMove"){var v=f==="treemapZoomToNode"?aye(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),X7(g,y,!1,0),x=g.getLayout(),WN(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(oye(s,d,p),!0),r.setLayoutInfo(s),Y7(M,new lt(-s.x,-s.y,n,a),m,g,0)}};function X7(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(H7),u=s.get(Jge)/2,c=q7(s),f=Math.max(l,c),h=l-u,p=f-u;r.setLayout({borderWidth:l,upperHeight:f,upperLabelHeight:c},!0),n=Ix(n-2*h,0),a=Ix(a-h-p,0);var d=n*a,g=eye(r,s,d,e,t,i);if(g.length){var m={x:h,y:p,width:n,height:a},v=uE(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=nye(y,v,e.squareRatio);w<=_?(x++,_=w):(y.area-=y.pop().getLayout().area,G7(y,v,m,u,!1),v=uE(m.width,m.height),y.length=y.area=0,_=1/0)}if(y.length&&G7(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++)X7(g[x],e,t,i+1)}}}function eye(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=Yt(o,function(p){return!p.isRemoved()}),rye(o,s);var u=iye(e,o,s);if(u.sum===0)return r.viewChildren=[];if(u.sum=tye(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 tye(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 rye(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 iye(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],WN(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 nye(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?Ix(u*i/l,l/(u*n)):1/0}function G7(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]]=Ix(c-2*i,0),v=t[s[a]]+t[l[a]]-u,_=f===h-1||v<g?v:g,y=d[l[a]]=Ix(_-2*i,0);d[s[o]]=t[s[o]]+uE(i,m/2),d[s[a]]=u+uE(i,y/2),u+=_,p.setLayout(d,!0)}t[s[o]]+=c,t[l[o]]-=c}function aye(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(H7),v=Math.max(m,q7(g));u+=4*m*m+(3*m+v)*Math.pow(u,.5),u>o_&&(u=o_),a=s}u<l&&(u=l);var _=Math.pow(u/l,.5);return[i*_,n*_]}function oye(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 Y7(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);WN(r.viewChildren||[],function(u){Y7(u,l,t,i,n+1)})}}function q7(r){return r.get($ge)?r.get(Qge):0}function XN(r){r.registerSeriesModel(T7),r.registerChartView(N7),r.registerVisual(B7),r.registerLayout(W7),b7(r)}function YN(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){Ct(u)&&(u=o[u]);for(var c=0;c<e.length;c++)if(!e[c].isSelected(u))return!1}return!0})})}function qN(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 cE(r){return r instanceof Array||(r=[r,r]),r}function ZN(r){r.eachSeriesByType("graph",function(e){var t=e.getGraph(),i=e.getEdgeData(),n=cE(e.get("edgeSymbol")),a=cE(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=cE(s.getShallow("symbol",!0)),c=cE(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 jN="-->",fE=function(r){return r.get("autoCurveness")||null},Z7=function(r,e){var t=fE(r),i=20,n=[];if(Ct(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},Nx=function(r,e,t){var i=[r.id,r.dataIndex].join("."),n=[e.id,e.dataIndex].join(".");return[t.uid,i,n].join(jN)},j7=function(r){var e=r.split(jN);return[e[0],e[2],e[1]].join(jN)},sye=function(r,e){var t=Nx(r.node1,r.node2,e);return e.__edgeMap[t]},lye=function(r,e){var t=KN(Nx(r.node1,r.node2,e),e),i=KN(Nx(r.node2,r.node1,e),e);return t+i},KN=function(r,e){var t=e.__edgeMap;return t[r]?t[r].length:0};function K7(r){fE(r)&&(r.__curvenessList=[],r.__edgeMap={},Z7(r))}function J7(r,e,t,i){if(fE(t)){var n=Nx(r,e,t),a=t.__edgeMap,o=a[j7(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 zv(r,e,t,i){var n=fE(e),a=pe(n);if(!n)return null;var o=sye(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=lye(r,e);Z7(e,u),r.lineStyle=r.lineStyle||{};var c=Nx(r.node1,r.node2,e),f=e.__curvenessList,h=a||u%2?0:1;if(o.isForward)return f[h+s];var p=j7(c),d=KN(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 hE(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")])}),Ux(t,r)}}function Ux(r,e){r.eachEdge(function(t,i){var n=qi(t.getModel().get(["lineStyle","curveness"]),-zv(t,e,i,!0),0),a=Pa(t.node1.getLayout()),o=Pa(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 JN(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])}Ux(a.graph,t)}else(!i||i==="none")&&hE(t)})}function ud(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 cd(r){var e=r.getVisual("symbolSize");return e instanceof Array&&(e=(e[0]+e[1])/2),+e}var $7=Math.PI,$N=[];function Fv(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];Es(g,g),Am(g,g,c),t.setLayout([l+g[0],u+g[1]],!0);var m=r.get(["circular","rotateLabel"]);QN(t,m,l,u)}uye[e](r,s,o,c,l,u,f),s.eachEdge(function(v,_){var y=qi(v.getModel().get(["lineStyle","curveness"]),zv(v,r,_),0),x=Pa(v.node1.getLayout()),M=Pa(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 uye={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;$N.length=o;var l=ud(r);e.eachNode(function(f){var h=cd(f);isNaN(h)&&(h=2),h<0&&(h=0),h*=l;var p=Math.asin(h/2/i);isNaN(p)&&(p=$7/2),$N[f.dataIndex]=p,s+=p*2});var u=(2*$7-s)/o/2,c=0;e.eachNode(function(f){var h=u+$N[f.dataIndex];c+=h,(!f.getLayout()||!f.getLayout().fixed)&&f.setLayout([i*Math.cos(c)+n,i*Math.sin(c)+a]),c+=h})}};function QN(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 eU(r){r.eachSeriesByType("graph",function(e){e.get("layout")==="circular"&&Fv(e,"symbolSize")})}var Bv=k0;function Q7(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=au(o*(Math.random()-.5)+l[0],s*(Math.random()-.5)+l[1])),f.pp=Pa(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;ml(v,S.p,M.p);var w=Hb(v)-x.d,T=S.w/(M.w+S.w);isNaN(T)&&(T=0),Es(v,v),!M.fixed&&Bv(M.p,M.p,v,T*w*p),!S.fixed&&Bv(S.p,S.p,v,-(1-T)*w*p)}}for(var y=0;y<_;y++){var C=i[y];C.fixed||(ml(v,l,C.p),Bv(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];ml(v,S.p,M.p);var w=Hb(v);w===0&&(ZV(v,Math.random()-.5,Math.random()-.5),w=1);var E=(M.rep+S.rep)/w/w;!M.fixed&&Bv(M.pp,M.pp,v,E),!S.fixed&&Bv(S.pp,S.pp,v,-E)}for(var I=[],y=0;y<_;y++){var C=i[y];C.fixed||(ml(I,C.p,C.pp),Bv(C.p,C.p,I,p),ji(C.pp,C.p))}p=p*.992;var R=p<.01;g&&g(i,n,R),m&&m(R)}}}function tU(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"?hE(e):l==="circular"&&Fv(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=ir(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=ir(y,c,d);isNaN(S)&&(S=(d[0]+d[1])/2);var w=M.getModel(),T=qi(M.getModel().get(["lineStyle","curveness"]),-zv(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(),_=Q7(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&&ji(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]||[],ji(I[0],b),ji(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 cye(r,e,t){var i=fe(r.getBoxLayoutParams(),{aspect:t});return Sr(i,{width:e.getWidth(),height:e.getHeight()})}function rU(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=[];Ep(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=cye(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 _c;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 eY=ei.prototype,iU=Op.prototype,tY=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return r}(),PQe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(tY);function nU(r){return isNaN(+r.cpx1)||isNaN(+r.cpy1)}var fye=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 tY},e.prototype.buildPath=function(t,i){nU(i)?eY.buildPath.call(this,t,i):iU.buildPath.call(this,t,i)},e.prototype.pointAt=function(t){return nU(this.shape)?eY.pointAt.call(this,t):iU.pointAt.call(this,t)},e.prototype.tangentAt=function(t){var i=this.shape,n=nU(i)?[i.x2-i.x1,i.y2-i.y1]:iU.tangentAt.call(this,t);return Es(n,n)},e}(ut),rY=fye;var aU=["fromSymbol","toSymbol"];function iY(r){return"_"+r+"Type"}function nY(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=Rl(n),u=Co(o||0,l);return i+l+u+(a||"")+(s||"")}function aY(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=Rl(n),u=Co(o||0,l),c=Mr(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 hye(r){var e=new rY({name:"line",subPixelOptimize:!0});return oU(e.shape,r),e}function oU(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 pye=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=hye(o);s.shape.percent=0,or(s,{shape:{percent:1}},a,i),this.add(s),N(aU,function(l){var u=aY(l,t,i);this.add(u),this[iY(l)]=nY(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:{}};oU(l.shape,s),Ut(o,l,a,i),N(aU,function(u){var c=nY(u,t,i),f=iY(u);if(this[f]!==c){this.remove(this.childOfName(u));var h=aY(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(aU,function(S){var w=this.childOfName(S);if(w){w.setColor(v),w.style.opacity=m.opacity;for(var T=0;T<Vi.length;T++){var C=Vi[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);Or(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(_)?Cr(_):_)+""});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}),ar(this,h,p,f)},e.prototype.highlight=function(){Vn(this)},e.prototype.downplay=function(){Gn(this)},e.prototype.updateLayout=function(t,i){this.setLinePoints(t.getItemLayout(i))},e.prototype.setLinePoints=function(t){var i=this.childOfName("line");oU(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=ml([],f,c);Es(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),kv=pye;var dye=function(){function r(e){this.group=new Ze,this._LineCtor=e||kv}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=oY(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=oY(e),this._lineData=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t){this._progressiveEls=[];function i(s){!s.isGroup&&!mye(s)&&(s.incremental=!0,s.ensureState("emphasis").hoverLayer=!0)}for(var n=e.start;n<e.end;n++){var a=t.getItemLayout(n);if(sU(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){ca(this._progressiveEls||this.group,e)},r.prototype._doAdd=function(e,t,i){var n=e.getItemLayout(t);if(sU(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(!sU(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 mye(r){return r.animators&&r.animators.length>0}function oY(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 sY(r){return isNaN(r[0])||isNaN(r[1])}function sU(r){return r&&!sY(r[0])&&!sY(r[1])}var Vv=dye;var lU=[],uU=[],cU=[],Gv=yi,fU=Ku,lY=Math.abs;function uY(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){lU[0]=Gv(i[0],n[0],a[0],c),lU[1]=Gv(i[1],n[1],a[1],c);var f=lY(fU(lU,e)-l);f<o&&(o=f,s=c)}for(var h=0;h<32;h++){var p=s+u;uU[0]=Gv(i[0],n[0],a[0],s),uU[1]=Gv(i[1],n[1],a[1],s),cU[0]=Gv(i[0],n[0],a[0],p),cU[1]=Gv(i[1],n[1],a[1],p);var f=fU(uU,e)-l;if(lY(f)<.01)break;var d=fU(cU,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 Ox(r,e){var t=[],i=gf,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=[Pa(u[0]),Pa(u[1])],u[2]&&u.__original.push(Pa(u[2])));var h=u.__original;if(u[2]!=null){if(ji(n[0],h[0]),ji(n[1],h[2]),ji(n[2],h[1]),c&&c!=="none"){var p=cd(s.node1),d=uY(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=cd(s.node2),d=uY(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]}ji(u[0],n[0]),ji(u[1],n[2]),ji(u[2],n[1])}else{if(ji(a[0],h[0]),ji(a[1],h[1]),ml(o,a[1],a[0]),Es(o,o),c&&c!=="none"){var p=cd(s.node1);k0(a[0],a[0],o,p*e)}if(f&&f!=="none"){var p=cd(s.node2);k0(a[1],a[1],o,-p*e)}ji(u[0],a[0]),ji(u[1],a[1])}})}function cY(r){return r.type==="view"}var vye=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 wu,a=new Vv,o=this.group;this._controller=new Cu(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(cY(o)){var c={x:o.x,y:o.y,scaleX:o.scaleX,scaleY:o.scaleY};this._firstRender?u.attr(c):Ut(u,c,t)}Ox(t.getGraph(),ud(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),Fv(t,"symbolSize",y,[C.offsetX,C.offsetY]),a.updateLayout(t);break;case"none":default:f.setItemLayout(x,[M.x,M.y]),Ux(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){QN(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)&&!Zf(u,n,t)}),!cY(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){Dv(s,u.dx,u.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:u.dx,dy:u.dy})}).on("zoom",function(u){Pv(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(),Ox(t.getGraph(),ud(t)),a._lineDraw.updateLayout(),n.updateLabelLayout()})},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,i=t.getData(),n=ud(t);i.eachItemGraphicEl(function(a,o){a&&a.setSymbolScale(n)})},e.prototype.updateLayout=function(t){Ox(t.getGraph(),ud(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}(Zt),fY=vye;function Hv(r){return"_EC_"+r}var gye=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[Hv(e)]){var n=new fd(e,t);return n.hostGraph=this,this.nodes.push(n),i[Hv(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[Hv(e)]},r.prototype.addEdge=function(e,t,i){var n=this._nodesMap,a=this._edgesMap;if(Ct(e)&&(e=this.nodes[e]),Ct(t)&&(t=this.nodes[t]),e instanceof fd||(e=n[Hv(e)]),t instanceof fd||(t=n[Hv(t)]),!(!e||!t)){var o=e.id+"-"+t.id,s=new hY(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 fd&&(e=e.id),t instanceof fd&&(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 fd||(t=this._nodesMap[Hv(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}(),fd=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}(),hY=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 pY(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(fd,pY("hostGraph","data"));wr(hY,pY("hostGraph","edgeData"));var dY=gye;function zx(r,e,t,i,n){for(var a=new dY(i),o=0;o<r.length;o++)a.addNode(Hr(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(Hr(Kr(c.id,null),f+" > "+h)),u++)}var p=t.get("coordinateSystem"),d;if(p==="cartesian2d"||p==="polar")d=dn(r,t);else{var g=pc.get(p),m=g?g.dimensions||[]:[];dt(m,"value")<0&&m.concat(["value"]);var v=Dl(r,{coordDimensions:m,encodeDefine:t.getEncode()}).dimensions;d=new ai(v,t),d.initData(r)}var _=new ai(["value"],t);return _.initData(l,s),n&&n(d,_),nE({mainData:d,struct:a,structAttr:"graph",datas:{node:d,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a}var yye=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 Au(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),bo(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){K7(this);var s=zx(a,n,this,!0,l);return N(s.edges,function(u){J7(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=Kt.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),kr("nameValue",{name:c.join(" > "),value:o.value,noValue:o.value==null})}var f=I1({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 ai(["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),mY=yye;var _ye={type:"graphRoam",event:"graphRoam",update:"none"};function hU(r){r.registerChartView(fY),r.registerSeriesModel(mY),r.registerProcessor(YN),r.registerVisual(qN),r.registerVisual(ZN),r.registerLayout(JN),r.registerLayout(r.PRIORITY.VISUAL.POST_CHART_LAYOUT,eU),r.registerLayout(tU),r.registerCoordinateSystem("graphView",{dimensions:_c.dimensions,create:rU}),r.registerAction({type:"focusNodeAdjacency",event:"focusNodeAdjacency",update:"series:focusNodeAdjacency"},Ur),r.registerAction({type:"unfocusNodeAdjacency",event:"unfocusNodeAdjacency",update:"series:unfocusNodeAdjacency"},Ur),r.registerAction(_ye,function(e,t,i){t.eachComponent({mainType:"series",query:e},function(n){var a=n.coordinateSystem,o=Iv(a,e,void 0,i);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}var xye=function(){function r(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return r}(),Sye=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 xye},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),vY=Sye;function Mye(r,e){var t=r.get("center"),i=e.getWidth(),n=e.getHeight(),a=Math.min(i,n),o=ze(t[0],e.getWidth()),s=ze(t[1],e.getHeight()),l=ze(r.get("radius"),a/2);return{cx:o,cy:s,r:l}}function pE(r,e){var t=r==null?"":r+"";return e&&(Ce(e)?t=e.replace("{value}",t):He(e)&&(t=e(r))),t}var bye=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=Mye(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?Rv:xi,d=f.get("show"),g=f.getModel("lineStyle"),m=g.get("width"),v=[u,c];d_(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=ze(v.get("length"),d),w=ze(_.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,P,U=0;U<=x;U++){if(A=Math.cos(T),P=Math.sin(T),v.get("show")){var B=R?R+c:c,z=new ei({shape:{x1:A*(d-B)+h,y1:P*(d-B)+p,x2:A*(d-S-B)+h,y2:P*(d-S-B)+p},style:E,silent:!0});E.stroke==="auto"&&z.setStyle({stroke:a(U/x)}),f.add(z)}if(y.get("show")){var B=y.get("distance")+R,k=pE(Cr(U/x*(m-g)+g),y.get("formatter")),G=a(U/x),Y=A*(d-S-B)+h,J=P*(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:Ct(Q)&&(V=Q*Math.PI/180),V===0?f.add(new It({style:fr(y,{text:k,x:Y,y:J,verticalAlign:P<-.8?"top":P>.8?"bottom":"middle",align:A<-.4?"left":A>.4?"right":"center"},{inheritColor:G}),silent:!0})):f.add(new It({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),P=Math.sin(T);var ae=new ei({shape:{x1:A*(d-B)+h,y1:P*(d-B)+p,x2:A*(d-w-B)+h,y2:P*(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=ze(R.get("width"),o.r),P=ze(R.get("length"),o.r),U=t.get(["pointer","icon"]),B=R.get("offsetCenter"),z=ze(B[0],o.r),k=ze(B[1],o.r),G=R.get("keepAspect"),Y;return U?Y=Mr(U,z-A/2,k-P,A,P,null,G):Y=new vY({shape:{angle:-Math.PI/2,width:A,r:P,x:z,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?Rv:xi,A=m.get("overlap"),P=A?m.get("width"):c/_.count(),U=A?o.r-P:o.r-(b+1)*P,B=A?o.r:o.r-b*P,z=new R({shape:{startAngle:s,endAngle:E,cx:o.cx,cy:o.cy,clockwise:u,r0:U,r:B}});return A&&(z.z2=M-_.get(y,b)%M),z}(v||g)&&(_.diff(h).add(function(b){var E=_.get(y,b);if(g){var I=T(b,s);or(I,{rotation:-((isNaN(+E)?w[0]:ir(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");or(R,{shape:{endAngle:ir(E,S,w,A)}},t),f.add(R),v_(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,P=T(b,A);P.rotation=A,Ut(P,{rotation:-((isNaN(+I)?w[0]:ir(I,S,w,!0))+Math.PI/2)},t),f.add(P),_.setItemGraphicEl(b,P)}if(v){var U=p[E],B=U?U.shape.endAngle:s,z=C(b,B),k=m.get("clip");Ut(z,{shape:{endAngle:ir(I,S,w,k)}},t),f.add(z),v_(t.seriesIndex,_.dataType,b,z),d[b]=z}}).execute(),_.each(function(b){var E=_.getItemModel(b),I=E.getModel("emphasis"),R=I.get("focus"),A=I.get("blurScope"),P=I.get("disabled");if(g){var U=_.getItemGraphicEl(b),B=_.getItemVisual(b,"style"),z=B.fill;if(U instanceof Br){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(z);U.setStyle(E.getModel(["pointer","itemStyle"]).getItemStyle()),U.style.fill==="auto"&&U.setStyle("fill",a(ir(_.get(y,b),S,[0,1],!0))),U.z2EmphasisLift=0,Yr(U,E),ar(U,R,A,P)}if(v){var G=d[b];G.useStyle(_.getItemVisual(b,"style")),G.setStyle(E.getModel(["progress","itemStyle"]).getItemStyle()),G.z2EmphasisLift=0,Yr(G,E),ar(G,R,A,P)}}),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=Mr(s,i.cx-o/2+ze(l[0],i.r),i.cy-o/2+ze(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 It({silent:!0}),d[v]=new It({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(ir(y,[c,f],[0,1],!0)),S=_.getModel("title");if(S.get("show")){var w=S.get("offsetCenter"),T=o.cx+ze(w[0],o.r),C=o.cy+ze(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+ze(I[0],o.r),A=o.cy+ze(I[1],o.r),P=ze(E.get("width"),o.r),U=ze(E.get("height"),o.r),B=t.get(["progress","show"])?l.getItemVisual(v,"style").fill:M,b=d[v],z=E.get("formatter");b.attr({z2:m?0:2,style:fr(E,{x:R,y:A,text:pE(y,z),width:isNaN(P)?null:P,height:isNaN(U)?null:U,align:"center",verticalAlign:"middle"},{inheritColor:B})}),t1(b,{normal:E},y,function(G){return pE(G,z)}),g&&r1(b,v,l,t,{getFormattedLabel:function(G,Y,J,Q,V,K){return pE(K?K.interpolatedValue:y,z)}}),x.add(b)}h.add(x)}),this.group.add(h),this._titleEls=p,this._detailEls=d},e.type="gauge",e}(Zt),gY=bye;var wye=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 Lo(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),yY=wye;function pU(r){r.registerChartView(gY),r.registerSeriesModel(yY)}var Tye=["itemStyle","opacity"],Eye=function(r){Z(e,r);function e(t,i){var n=r.call(this)||this,a=n,o=new ri,s=new It;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(Tye);c=c??1,n||Ui(a),a.useStyle(t.getItemVisual(i,"style")),a.style.lineJoin="round",n?(a.setShape({points:l.points}),a.style.opacity=0,or(a,{style:{opacity:c}},o,i)):Ut(a,{style:{opacity:c},shape:{points:l.points}},o,i),Yr(a,s),this._updateLabel(t,i),ar(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;Or(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 zt(p[0][0],p[0][1]):null},Ut(o,{style:{x:c.x,y:c.y}},s,i),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),Tv(n,Ev(l),{stroke:h})},e}(ni),Aye=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 Eye(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);oc(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}(Zt),_Y=Aye;var Cye=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 Au(Be(this.getData,this),Be(this.getRawData,this)),this._defaultLabelLine(t)},e.prototype.getInitialData=function(t,i){return Lo(this,{coordDimensions:["value"],encodeDefaulter:ot(hv,this)})},e.prototype._defaultLabelLine=function(t){bo(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),xY=Cye;function Rye(r,e){return Sr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function Lye(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 Dye(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 dU(r,e){r.eachSeriesByType("funnel",function(t){var i=t.getData(),n=i.mapDimension("value"),a=t.get("sort"),o=Rye(t,e),s=t.get("orient"),l=o.width,u=o.height,c=Lye(i,a),f=o.x,h=o.y,p=s==="horizontal"?[ze(t.get("minSize"),u),ze(t.get("maxSize"),u)]:[ze(t.get("minSize"),l),ze(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,P){if(s==="horizontal"){var U=i.get(n,A)||0,B=ir(U,[g,m],p,!0),z=void 0;switch(v){case"top":z=h;break;case"center":z=h+(u-B)/2;break;case"bottom":z=h+(u-B);break}return[[P,z],[P,z+B]]}var k=i.get(n,A)||0,G=ir(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,P],[Y+G,P]]};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=ze(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=ze(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())})}}Dye(i)})}function mU(r){r.registerChartView(_Y),r.registerSeriesModel(xY),r.registerLayout(dU),r.registerProcessor(zl("funnel"))}var Pye=.3,Iye=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=MY(t);s.diff(l).add(h).update(p).remove(d).execute();function h(m){var v=SY(s,o,m,c,u);vU(v,s,m,f)}function p(m,v){var _=l.getItemGraphicEl(v),y=bY(s,m,c,u);s.setItemGraphicEl(m,_),Ut(_,{shape:{points:y}},t,m),Ui(_),vU(_,s,m,f)}function d(m){var v=l.getItemGraphicEl(m);o.remove(v)}if(!this._initialized){this._initialized=!0;var g=Nye(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=MY(i),u=this._progressiveEls=[],c=t.start;c<t.end;c++){var f=SY(a,this._dataGroup,c,s,o);f.incremental=!0,vU(f,a,c,l),u.push(f)}},e.prototype.remove=function(){this._dataGroup&&this._dataGroup.removeAll(),this._data=null},e.type="parallel",e}(Zt);function Nye(r,e,t){var i=r.model,n=r.getRect(),a=new Et({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),or(a,{shape:{width:n.width,height:n.height}},e,t),a}function bY(r,e,t,i){for(var n=[],a=0;a<t.length;a++){var o=t[a],s=r.get(r.mapDimension(o),e);Uye(s,i.getAxis(o).type)||n.push(i.dataToPoint(s,o))}return n}function SY(r,e,t,i,n){var a=bY(r,t,i,n),o=new ri({shape:{points:a},z2:10});return e.add(o),r.setItemGraphicEl(t,o),o}function MY(r){var e=r.get("smooth",!0);return e===!0&&(e=Pye),e=Ba(e),ff(e)&&(e=0),{smooth:e}}function vU(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");Yr(r,n,"lineStyle"),ar(r,a.get("focus"),a.get("blurScope"),a.get("disabled"))}function Uye(r,e){return e==="category"?r==null:r==null||isNaN(r)}var wY=Iye;var Oye=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 dn(null,this,{useEncodeDefaulter:Be(zye,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 zye(r){var e=r.ecModel.getComponent("parallel",r.get("parallelIndex"));if(e){var t={};return N(e.dimensions,function(i){var n=Fye(i);t[i]=n}),t}}function Fye(r){return+r.replace("dim","")}var TY=Oye;var Bye=["lineStyle","opacity"],kye={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(Bye,!0);u!=null&&(l=u)}var c=a.ensureUniqueItemVisual(s,"style");c.opacity=l},n.start,n.end)}}}},EY=kye;function gU(r){Vye(r),Gye(r)}function Vye(r){if(!r.parallel){var e=!1;N(r.series,function(t){t&&t.type==="parallel"&&(e=!0)}),e&&(r.parallel=[{}])}}function Gye(r){var e=Qt(r.parallelAxis);N(e,function(t){if(qe(t)){var i=t.parallelIndex||0,n=Qt(r.parallel)[i];n&&n.parallelAxisDefault&&xt(t,n.parallelAxisDefault,!1)}})}var Hye=5,Wye=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(Xye,function(a,o){n.getZr().on(o,this._handlers[o]=Be(a,this))},this)),Vs(this,"_throttledDispatchExpand",t.get("axisExpandRate"),"fixRate")},e.prototype.dispose=function(t,i){vc(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}(tr),Xye={mousedown:function(r){yU(this,"click")&&(this._mouseDownPoint=[r.offsetX,r.offsetY])},mouseup:function(r){var e=this._mouseDownPoint;if(yU(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>Hye)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||!yU(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 yU(r,e){var t=r._model;return t.get("axisExpandable")&&t.get("axisExpandTriggerOn")===e}var AY=Wye;var Yye=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&&xt(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=Yt(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}(Nt),CY=Yye;var qye=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}(mn),RY=qye;function Qa(r,e,t,i,n,a){r=r||0;var o=t[1]-t[0];if(n!=null&&(n=Wv(n,[0,o])),a!=null&&(a=Math.max(a,n??0)),i==="all"){var s=Math.abs(e[1]-e[0]);s=Wv(s,[0,o]),n=a=Wv(s,[n,a]),i=0}e[0]=Wv(e[0],t),e[1]=Wv(e[1],t);var l=_U(e,i);e[i]+=r;var u=n||0,c=t.slice();l.sign<0?c[0]+=u:c[1]-=u,e[i]=Wv(e[i],c);var f;return f=_U(e,i),n!=null&&(f.sign!==l.sign||f.span<n)&&(e[1-i]=e[i]+l.sign*n),f=_U(e,i),a!=null&&f.span>a&&(e[1-i]=e[i]+f.sign*a),e}function _U(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 Wv(r,e){return Math.min(e[1]!=null?e[1]:1/0,Math.max(e[0]!=null?e[0]:-1/0,r))}var xU=N,PY=Math.min,IY=Math.max,LY=Math.floor,Zye=Math.ceil,DY=Cr,jye=Math.PI,Kye=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;xU(n,function(o,s){var l=a[s],u=t.getComponent("parallelAxis",l),c=this._axesMap.set(o,new RY(o,Gf(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();xU(this.dimensions,function(a){var o=this._axesMap.get(a);o.scale.unionExtentFromData(n,n.mapDimension(a)),_u(o.scale,o.model)},this)}},this)},r.prototype.resize=function(e,t){this._rect=Sr(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=dE(e.get("axisExpandWidth"),l),f=dE(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=dE(p[1]-p[0],l),p[1]=p[0]+d;else{d=dE(c*(f-1),l);var g=e.get("axisExpandCenter")||LY(u/2);p=[c*g-d/2],p[1]=p[0]+d}var m=(s-d)/(u-f);m<3&&(m=0);var v=[LY(DY(p[0]/c,1))+1,Zye(DY(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])}),xU(i,function(o,s){var l=(n.axisExpandable?$ye:Jye)(s,n),u={horizontal:{x:l.position,y:n.axisLength},vertical:{x:0,y:l.position}},c={horizontal:jye/2,vertical:0},f=[u[a].x+e.x,u[a].y+e.y],h=c[a],p=Ei();Oa(p,p,h),Sn(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 En([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?Qa(l,n,o,"all"):u="none";else{var p=n[1]-n[0],d=o[1]*s/p;n=[IY(0,d-p/2)],n[1]=PY(o[1],n[0]+p),n[0]=n[1]-p}return{axisExpandWindow:n,behavior:u}},r}();function dE(r,e){return PY(IY(r,e[0]),e[1])}function Jye(r,e){var t=e.layoutLength/(e.axisCount-1);return{position:t*r,axisNameAvailableWidth:t,axisLabelShow:!0}}function $ye(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 NY=Kye;function Qye(r,e){var t=[];return r.eachComponent("parallel",function(i,n){var a=new NY(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",Rr).models[0];i.coordinateSystem=n.coordinateSystem}}),t}var e0e={create:Qye},UY=e0e;var OY=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 Ga([["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--)Ai(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}(Nt);wr(OY,xu);var SU=OY;var hd=!0,Fx=Math.min,Xv=Math.max,t0e=Math.pow,r0e=1e4,i0e=6,n0e=6,zY="globalPan",a0e={w:[0,0],e:[0,1],n:[1,0],s:[1,1]},o0e={w:"ew",e:"ew",n:"ns",s:"ns",ne:"nesw",sw:"nesw",nw:"nwse",se:"nwse"},FY={brushStyle:{lineWidth:2,stroke:"rgba(210,219,238,0.3)",fill:"#D2DBEE"},transformable:!0,brushMode:"single",removeOnClick:!1},s0e=0,l0e=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_"+s0e++,N(m0e,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||A9(i,zY,this._uid),N(this._handlers,function(n,a){i.on(a,n)}),this._brushType=t.brushType,this._brushOption=xt(Qe(FY),t,!0)},e.prototype._doDisableBrush=function(){var t=this._zr;C9(t,zY,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 xt(Qe(FY),h,!0)});var i="\0-brush-index-",n=this._covers,a=this._covers=[],o=this,s=this._creatingCover;return new Rn(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]):WY(o,HY(o,d));AU(o,g)}}function f(h){n[h]!==s&&o.group.remove(n[h])}},e.prototype.unmount=function(){return this.enableBrush(!1),MU(this),this._zr.remove(this.group),this},e.prototype.dispose=function(){this.unmount(),this.off()},e}(Ni);function HY(r,e){var t=mE[e.brushType].createCover(r,e);return t.__brushOption=e,YY(t,e),r.group.add(t),t}function WY(r,e){var t=CU(e);return t.endCreating&&(t.endCreating(r,e),YY(e,e.__brushOption)),e}function XY(r,e){var t=e.__brushOption;CU(e).updateCoverShape(r,e,t.range,t)}function YY(r,e){var t=e.z;t==null&&(t=r0e),r.traverse(function(i){i.z=t,i.z2=t})}function AU(r,e){CU(e).updateCommon(r,e),XY(r,e)}function CU(r){return mE[r.__brushOption.brushType]}function RU(r,e,t){var i=r._panels;if(!i)return hd;var n,a=r._transform;return N(i,function(o){o.isTargetByCursor(e,t,a)&&(n=o)}),n}function qY(r,e){var t=r._panels;if(!t)return hd;var i=e.__brushOption.panelId;return i!=null?t[i]:hd}function MU(r){var e=r._covers,t=e.length;return N(e,function(i){r.group.remove(i)},r),e.length=0,!!t}function pd(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 u0e(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=t0e(n*n+a*a,.5);return o>i0e}function ZY(r){var e=r.length-1;return e<0&&(e=0),[r[0],r[e]]}function jY(r,e,t,i){var n=new Ze;return n.add(new Et({name:"main",style:LU(t),silent:!0,draggable:!0,cursor:"move",drift:ot(BY,r,e,n,["n","s","w","e"]),ondragend:ot(pd,e,{isEnd:!0})})),N(i,function(a){n.add(new Et({name:a.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:ot(BY,r,e,n,a),ondragend:ot(pd,e,{isEnd:!0})}))}),n}function KY(r,e,t,i){var n=i.brushStyle.lineWidth||0,a=Xv(n,n0e),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;Sc(r,e,"main",o,s,d,g),i.transformable&&(Sc(r,e,"w",l,u,a,v),Sc(r,e,"e",h,u,a,v),Sc(r,e,"n",l,u,m,a),Sc(r,e,"s",l,p,m,a),Sc(r,e,"nw",l,u,a,a),Sc(r,e,"ne",h,u,a,a),Sc(r,e,"sw",l,p,a,a),Sc(r,e,"se",h,p,a,a))}function bU(r,e){var t=e.__brushOption,i=t.transformable,n=e.childAt(0);n.useStyle(LU(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?wU(r,a[0]):f0e(r,a);o&&o.attr({silent:!i,invisible:!i,cursor:i?o0e[s]+"-resize":null})})}function Sc(r,e,t,i,n,a,o){var s=e.childOfName(t);s&&s.setShape(p0e(DU(r,e,[[i,n],[i+a,n+o]])))}function LU(r){return Ye({strokeNoScale:!0},r.brushStyle)}function JY(r,e,t,i){var n=[Fx(r,t),Fx(e,i)],a=[Xv(r,t),Xv(e,i)];return[[n[0],a[0]],[n[1],a[1]]]}function c0e(r){return Ml(r.group)}function wU(r,e){var t={w:"left",e:"right",n:"top",s:"bottom"},i={left:"w",right:"e",top:"n",bottom:"s"},n=Bp(t[e],c0e(r));return i[n]}function f0e(r,e){var t=[wU(r,e[0]),wU(r,e[1])];return(t[0]==="e"||t[0]==="w")&&t.reverse(),t.join("")}function BY(r,e,t,i,n,a){var o=t.__brushOption,s=r.toRectRange(o.range),l=$Y(e,n,a);N(i,function(u){var c=a0e[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=r.fromRectRange(JY(s[0][0],s[1][0],s[0][1],s[1][1])),AU(e,t),pd(e,{isEnd:!1})}function h0e(r,e,t,i){var n=e.__brushOption.range,a=$Y(r,t,i);N(n,function(o){o[0]+=a[0],o[1]+=a[1]}),AU(r,e),pd(r,{isEnd:!1})}function $Y(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 DU(r,e,t){var i=qY(r,e);return i&&i!==hd?i.clipPath(t,r._transform):Qe(t)}function p0e(r){var e=Fx(r[0][0],r[1][0]),t=Fx(r[0][1],r[1][1]),i=Xv(r[0][0],r[1][0]),n=Xv(r[0][1],r[1][1]);return{x:e,y:t,width:i-e,height:n-t}}function d0e(r,e,t){if(!(!r._brushType||v0e(r,e.offsetX,e.offsetY))){var i=r._zr,n=r._covers,a=RU(r,e,t);if(!r._dragging)for(var o=0;o<n.length;o++){var s=n[o].__brushOption;if(a&&(a===hd||s.panelId===a.panelId)&&mE[s.brushType].contain(n[o],t[0],t[1]))return}a&&i.setCursorStyle("crosshair")}}function TU(r){var e=r.event;e.preventDefault&&e.preventDefault()}function EU(r,e,t){return r.childOfName("main").contain(e,t)}function QY(r,e,t,i){var n=r._creatingCover,a=r._creatingPanel,o=r._brushOption,s;if(r._track.push(t.slice()),u0e(r)||n){if(a&&!n){o.brushMode==="single"&&MU(r);var l=Qe(o);l.brushType=kY(l.brushType,a),l.panelId=a===hd?null:a.panelId,n=r._creatingCover=HY(r,l),r._covers.push(n)}if(n){var u=mE[kY(r._brushType,a)],c=n.__brushOption;c.range=u.getCreatingRange(DU(r,n,r._track)),i&&(WY(r,n),u.updateCommon(r,n)),XY(r,n),s={isEnd:i}}}else i&&o.brushMode==="single"&&o.removeOnClick&&RU(r,e,t)&&MU(r)&&(s={isEnd:i,removeOnClick:!0});return s}function kY(r,e){return r==="auto"?e.defaultBrushType:r}var m0e={mousedown:function(r){if(this._dragging)VY(this,r);else if(!r.target||!r.target.draggable){TU(r);var e=this.group.transformCoordToLocal(r.offsetX,r.offsetY);this._creatingCover=null;var t=this._creatingPanel=RU(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(d0e(this,r,i),this._dragging){TU(r);var n=QY(this,r,i,!1);n&&pd(this,n)}},mouseup:function(r){VY(this,r)}};function VY(r,e){if(r._dragging){TU(e);var t=e.offsetX,i=e.offsetY,n=r.group.transformCoordToLocal(t,i),a=QY(r,e,n,!0);r._dragging=!1,r._track=[],r._creatingCover=null,a&&pd(r,a)}}function v0e(r,e,t){var i=r._zr;return e<0||e>i.getWidth()||t<0||t>i.getHeight()}var mE={lineX:GY(0),lineY:GY(1),rect:{createCover:function(r,e){function t(i){return i}return jY({toRectRange:t,fromRectRange:t},r,e,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(r){var e=ZY(r);return JY(e[1][0],e[1][1],e[0][0],e[0][1])},updateCoverShape:function(r,e,t,i){KY(r,e,t,i)},updateCommon:bU,contain:EU},polygon:{createCover:function(r,e){var t=new Ze;return t.add(new ri({name:"main",style:LU(e),silent:!0})),t},getCreatingRange:function(r){return r},endCreating:function(r,e){e.remove(e.childAt(0)),e.add(new ni({name:"main",draggable:!0,drift:ot(h0e,r,e),ondragend:ot(pd,r,{isEnd:!0})}))},updateCoverShape:function(r,e,t,i){e.childAt(0).setShape({points:DU(r,e,t)})},updateCommon:bU,contain:EU}};function GY(r){return{createCover:function(e,t){return jY({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=ZY(e),i=Fx(t[0][r],t[1][r]),n=Xv(t[0][r],t[1][r]);return[i,n]},updateCoverShape:function(e,t,i,n){var a,o=qY(e,t);if(o!==hd&&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(),KY(e,t,l,n)},updateCommon:bU,contain:EU}}var Yv=l0e;function vE(r){return r=PU(r),function(e){return SD(e,r)}}function gE(r,e){return r=PU(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 yE(r,e,t){var i=PU(r);return function(n,a){return i.contain(a[0],a[1])&&!Zf(n,e,t)}}function PU(r){return lt.create(r)}var g0e=["axisLine","axisTickLabel","axisName"],y0e=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 Yv(i.getZr())).on("brush",Be(this._onBrush,this))},e.prototype.render=function(t,i,n,a){if(!_0e(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=S0e(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 Ln(t,p);N(g0e,d.add,d),this._axisGroup.add(d.getGroup()),this._refreshBrushController(p,u,t,s,c,n),lc(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:vE(f),isTargetByCursor:yE(f,s,a),getLinearBrushOtherExtent:gE(f,0)}]).enableBrush({brushType:"lineX",brushStyle:i,removeOnClick:!0}).updateCovers(x0e(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}(tr);function _0e(r,e,t){return t&&t.type==="axisAreaSelect"&&e.findComponents({mainType:"parallelAxis",query:t})[0]===r}function x0e(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 S0e(r,e){return e.getComponent("parallel",r.get("parallelIndex"))}var tq=y0e;var M0e={type:"axisAreaSelect",event:"axisAreaSelected"};function rq(r){r.registerAction(M0e,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 b0e={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function Bx(r){r.registerComponentView(AY),r.registerComponentModel(CY),r.registerCoordinateSystem("parallel",UY),r.registerPreprocessor(gU),r.registerComponentModel(SU),r.registerComponentView(tq),Fl(r,"parallel",SU,b0e),rq(r)}function IU(r){Ot(Bx),r.registerChartView(wY),r.registerSeriesModel(TY),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,EY)}var w0e=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}(),T0e=function(r){Z(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new w0e},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(){Vn(this)},e.prototype.downplay=function(){Gn(this)},e}(ut),E0e=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 T0e,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,P,U,B,z,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,P=(b!=null?b*u:T.x)+I.ty,U=E!=null?E*c:T.y,B=R,z=A*(1-y)+U*y,k=P,G=A*y+U*(1-y)):(R=(S!=null?S*u:x.x)+x.dx,A=(w!=null?w*c:x.y)+I.sy,P=b!=null?b*u:T.x,U=(E!=null?E*c:T.y)+I.ty,B=R*(1-y)+P*y,z=A,k=R*y+P*(1-y),G=U),g.setShape({x1:R,y1:A,x2:P,y2:U,cpx1:B,cpy1:z,cpx2:k,cpy2:G}),g.useStyle(_.getItemStyle()),iq(g.style,p,d);var Y=""+v.get("value"),J=Tr(v,"edgeLabel");Or(g,J,{labelFetcher:{getFormattedLabel:function(K,ae,ve,ue,se,Ee){return t.getFormattedLabel(K,ae,"edge",ue,qi(se,J.normal&&J.normal.get("formatter"),Y),Ee)}},labelDataIndex:d.dataIndex,defaultText:Y}),g.setTextConfig({position:"inside"});var Q=v.getModel("emphasis");Yr(g,v,"lineStyle",function(K){var ae=K.getItemStyle();return iq(ae,p,d),ae}),s.add(g),h.setItemGraphicEl(d.dataIndex,g);var V=Q.get("focus");ar(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 Et({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});Or(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),Yr(x,m),s.add(x),f.setItemGraphicEl(d.dataIndex,x),rt(x).dataType="node";var M=y.get("focus");ar(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(A0e(s.getBoundingRect(),t,function(){s.removeClipPath()})),this._data=t.getData()},e.prototype.dispose=function(){},e.type="sankey",e}(Zt);function iq(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 vu(0,0,+(e==="horizontal"),+(e==="vertical"),[{color:i,offset:0},{color:n,offset:1}]))}}function A0e(r,e,t){var i=new Et({shape:{x:r.x-10,y:r.y-10,width:0,height:r.height+20}});return or(i,{shape:{width:r.width+20}},e,t),i}var nq=E0e;var C0e=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 Kt(o[l],this,i));if(a&&n){var u=zx(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 kr("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 kr("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),aq=C0e;function UU(r,e){r.eachSeriesByType("sankey",function(t){var i=t.get("nodeWidth"),n=t.get("nodeGap"),a=R0e(t,e);t.layoutInfo=a;var o=a.width,s=a.height,l=t.getGraph(),u=l.nodes,c=l.edges;D0e(u);var f=Yt(u,function(g){return g.getLayout().value===0}),h=f.length!==0?0:t.get("layoutIterations"),p=t.get("orient"),d=t.get("nodeAlign");L0e(u,c,i,n,o,s,h,p,d)})}function R0e(r,e){return Sr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function L0e(r,e,t,i,n,a,o,s,l){P0e(r,e,t,n,a,s,l),O0e(r,e,a,n,i,o,s),X0e(r,s)}function D0e(r){N(r,function(e){var t=Jf(e.outEdges,_E),i=Jf(e.inEdges,_E),n=e.getValue()||0,a=Math.max(t,i,n);e.setLayout({value:a},!0)})}function P0e(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"&&I0e(r,o,a,w);var T=a==="vertical"?(n-t)/w:(i-t)/w;U0e(r,T,a)}function oq(r){var e=r.hostGraph.data.getRawDataItem(r.dataIndex);return e.depth!=null&&e.depth>=0}function I0e(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){oq(f)||f.setLayout({depth:Math.max(0,i-f.getLayout().skNodeHeight)},!0)})}else e==="justify"&&N0e(r,i)}function N0e(r,e){N(r,function(t){!oq(t)&&!t.outEdges.length&&t.setLayout({depth:e},!0)})}function U0e(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 O0e(r,e,t,i,n,a,o){var s=z0e(r,o);F0e(s,e,t,i,n,o),NU(s,n,t,i,o);for(var l=1;a>0;a--)l*=.99,B0e(s,l,o),NU(s,n,t,i,o),W0e(s,l,o),NU(s,n,t,i,o)}function z0e(r,e){var t=[],i=e==="vertical"?"y":"x",n=f_(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 F0e(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 NU(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 B0e(r,e,t){N(r.slice().reverse(),function(i){N(i,function(n){if(n.outEdges.length){var a=Jf(n.outEdges,k0e,t)/Jf(n.outEdges,_E);if(isNaN(a)){var o=n.outEdges.length;a=o?Jf(n.outEdges,V0e,t)/o:0}if(t==="vertical"){var s=n.getLayout().x+(a-$f(n,t))*e;n.setLayout({x:s},!0)}else{var l=n.getLayout().y+(a-$f(n,t))*e;n.setLayout({y:l},!0)}}})})}function k0e(r,e){return $f(r.node2,e)*r.getValue()}function V0e(r,e){return $f(r.node2,e)}function G0e(r,e){return $f(r.node1,e)*r.getValue()}function H0e(r,e){return $f(r.node1,e)}function $f(r,e){return e==="vertical"?r.getLayout().x+r.getLayout().dx/2:r.getLayout().y+r.getLayout().dy/2}function _E(r){return r.getValue()}function Jf(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 W0e(r,e,t){N(r,function(i){N(i,function(n){if(n.inEdges.length){var a=Jf(n.inEdges,G0e,t)/Jf(n.inEdges,_E);if(isNaN(a)){var o=n.inEdges.length;a=o?Jf(n.inEdges,H0e,t)/o:0}if(t==="vertical"){var s=n.getLayout().x+(a-$f(n,t))*e;n.setLayout({x:s},!0)}else{var l=n.getLayout().y+(a-$f(n,t))*e;n.setLayout({y:l},!0)}}})})}function X0e(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 OU(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 di({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 zU(r){r.registerChartView(nq),r.registerSeriesModel(aq),r.registerLayout(UU),r.registerVisual(OU),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 xE=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:Kp(d),ordinalMeta:i,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:h,type:Kp(g),dimsDef:_.slice()}];return Lo(this,{coordDimensions:y,dimensionsCount:_.length+1,encodeDefaulter:ot(m1,y,this)})},r.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},r}();var sq=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(sq,xE,!0);var lq=sq;var Y0e=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=uq(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?(Ui(f),cq(h,f,a,u)):f=uq(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}(Zt),q0e=function(){function r(){}return r}(),Z0e=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 q0e},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 uq(r,e,t,i,n){var a=r.ends,o=new Z0e({shape:{points:n?j0e(a,i,r):a}});return cq(r,o,e,t,n),o}function cq(r,e,t,i,n){var a=t.hostModel,o=Rt[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");Yr(e,s),ar(e,l.get("focus"),l.get("blurScope"),l.get("disabled"))}function j0e(r,e,t){return de(r,function(i){return i=i.slice(),i[e]=t.initBaseline,i})}var fq=Y0e;var kx=N;function FU(r){var e=K0e(r);kx(e,function(t){var i=t.seriesModels;i.length&&(J0e(t),kx(i,function(n,a){$0e(n,t.boxOffsetList[a],t.boxWidthList[a])}))})}function K0e(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 J0e(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;kx(t,function(d){l=Math.max(l,d.getData().count())});var u=e.getExtent();s=Math.abs(u[1]-u[0])/l}kx(t,function(d){var g=d.get("boxWidth");pe(g)||(g=[g,g]),o.push([ze(g[0],s)||0,ze(g[1],s)||0])});var c=s*.8-2,f=c/i*.3,h=(c-f*(i-1))/i,p=h/2-c/2;kx(t,function(d,g){a.push(p),p+=f+h,n.push(Math.min(Math.max(h,o[g][0]),o[g][1]))})}function $0e(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 BU(r,e){e=e||{};for(var t=[],i=[],n=e.boundIQR,a=n==="none"||n===0,o=0;o<r.length;o++){var s=Ai(r[o].slice()),l=Hm(s,.25),u=Hm(s,.5),c=Hm(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 hq={type:"echarts:boxplot",transform:function(e){var t=e.upstream;if(t.sourceFormat!==Ci){var i="";ur(i)}var n=BU(t.getRawData(),e.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:n.boxData},{data:n.outliers}]}};function kU(r){r.registerSeriesModel(lq),r.registerChartView(fq),r.registerLayout(FU),r.registerTransform(hq)}var Q0e=["color","borderColor"],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){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){ca(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&&pq(u,f))return;var h=VU(f,c,!0);or(h,{shape:{points:f.ends}},t,c),GU(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&&pq(u,p)){a.remove(h);return}h?(Ut(h,{shape:{points:p.ends}},t,c),Ui(h)):h=VU(p,c),GU(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(),dq(t,this.group);var i=t.get("clip",!0)?Tu(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=VU(s,o);GU(l,n,o,a),l.incremental=!0,this.group.add(l),this._progressiveEls.push(l)}},e.prototype._incrementalRenderLarge=function(t,i){dq(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}(Zt),t_e=function(){function r(){}return r}(),r_e=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 t_e},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 VU(r,e,t){var i=r.ends;return new r_e({shape:{points:t?i_e(i,r):i},z2:100})}function pq(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 GU(r,e,t,i){var n=e.getItemModel(t);r.useStyle(e.getItemVisual(t,"style")),r.style.strokeNoScale=!0,r.__simpleBox=i,Yr(r,n)}function i_e(r,e){return de(r,function(t){return t=t.slice(),t[1]=e.initBaseline,t})}var n_e=function(){function r(){}return r}(),HU=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 n_e},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 dq(r,e,t,i){var n=r.getData(),a=n.getLayout("largePoints"),o=new HU({shape:{points:a},__sign:1,ignoreCoarsePointer:!0});e.add(o);var s=new HU({shape:{points:a},__sign:-1,ignoreCoarsePointer:!0});e.add(s);var l=new HU({shape:{points:a},__sign:0,ignoreCoarsePointer:!0});e.add(l),WU(1,o,r,n),WU(-1,s,r,n),WU(0,l,r,n),i&&(o.incremental=!0,s.incremental=!0),t&&t.push(o,s)}function WU(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(Q0e);e.useStyle(a),e.style.fill=null,e.style.stroke=n}var mq=e_e;var vq=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(vq,xE,!0);var gq=vq;function XU(r){!r||!pe(r.series)||N(r.series,function(e){qe(e)&&e.type==="k"&&(e.type="candlestick")})}var a_e=["itemStyle","borderColor"],o_e=["itemStyle","borderColor0"],s_e=["itemStyle","borderColorDoji"],l_e=["itemStyle","color"],u_e=["itemStyle","color0"],c_e={seriesType:"candlestick",plan:Ao(),performRawSeries:!0,reset:function(r,e){function t(a,o){return o.get(a>0?l_e:u_e)}function i(a,o){return o.get(a===0?s_e:a>0?a_e:o_e)}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)}}}}}},yq=c_e;var f_e={seriesType:"candlestick",plan:Ao(),reset:function(r){var e=r.coordinateSystem,t=r.getData(),i=h_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=[];z(A,E,0),z(A,b,1),A.push(G(R),G(E),G(I),G(b));var P=m.getItemModel(v),U=!!P.get(["itemStyle","borderColorDoji"]);m.setItemLayout(v,{sign:_q(_,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 z(Y,J,Q){var V=J.slice(),K=J.slice();V[n]=A_(V[n]+i/2,1,!1),K[n]=A_(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]=A_(Y[n],1),Y}}function d(g,m){for(var v=pa(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[_++]=_q(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 _q(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 h_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=ze(ft(r.get("barMaxWidth"),n),n),o=ze(ft(r.get("barMinWidth"),1),n),s=r.get("barWidth");return s!=null?ze(s,n):Math.max(Math.min(n/2,a),o)}var xq=f_e;function YU(r){r.registerChartView(mq),r.registerSeriesModel(gq),r.registerPreprocessor(XU),r.registerVisual(yq),r.registerLayout(xq)}function Sq(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 p_e=function(r){Z(e,r);function e(t,i){var n=r.call(this)||this,a=new yc(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=Mr(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)}Sq(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}}Sq(n,t)},e.prototype.highlight=function(){Vn(this)},e.prototype.downplay=function(){Gn(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=Rl(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=Co(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,ar(this,h.get("focus"),h.get("blurScope"),h.get("disabled"))},e.prototype.fadeOut=function(t){t&&t()},e}(Ze),Mq=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.init=function(){this._symbolDraw=new wu(Mq)},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=Ol("").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=rG(i.getRoamTransform()),this.group.decomposeTransform())},e.prototype.remove=function(t,i){this._symbolDraw&&this._symbolDraw.remove(!0)},e.type="effectScatter",e}(Zt),bq=d_e;var m_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 dn(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),wq=m_e;function qU(r){r.registerChartView(bq),r.registerSeriesModel(wq),r.registerLayout(Ol("effectScatter"))}var v_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 kv(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=Mr(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=Hr(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 As(t.__p1,t.__cp1)+As(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=yi,c=Z0;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=As(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*As(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),SE=v_e;var g_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 ri({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)}};Ut(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,ar(this,l,u,c)},e.prototype.updateLayout=function(t,i){var n=this.childAt(0);n.setShape("points",t.getItemLayout(i))},e}(Ze),ME=g_e;var y_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 ME(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+=As(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}(SE),Tq=y_e;var __e=function(){function r(){this.polyline=!1,this.curveness=0,this.segs=[]}return r}(),x_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 __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(pu(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(Iw(f,h,m,v,d,g,s,t,i))return l}else if(pu(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),S_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 x_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}(),Eq=S_e;var M_e={seriesType:"lines",plan:Ao(),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)}}}}}},bE=M_e;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=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)&&Tu(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=bE.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 Eq:new Vv(o?a?Tq:ME:a?SE:kv),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}(Zt),Aq=b_e;var w_e=typeof Uint32Array>"u"?Array:Uint32Array,T_e=typeof Float64Array>"u"?Array:Float64Array;function Cq(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),wm([n,t[0],t[1]])}))}var E_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||[],Cq(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(Cq(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=np(this._flatCoords,i.flatCoords),this._flatCoordsOffset=np(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),Ct(t[0])){for(var n=t.length,a=new w_e(n),o=new T_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 ai(["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),kr("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),Rq=E_e;function wE(r){return r instanceof Array||(r=[r,r]),r}var A_e={seriesType:"lines",reset:function(r){var e=wE(r.get("symbol")),t=wE(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=wE(s.getShallow("symbol",!0)),u=wE(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}}},Lq=A_e;function ZU(r){r.registerChartView(Aq),r.registerSeriesModel(Rq),r.registerLayout(bE),r.registerVisual(Lq)}var C_e=256,R_e=function(){function r(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=kn.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*(C_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=kn.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}(),Dq=R_e;function L_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 D_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 Pq(r){var e=r.dimensions;return e[0]==="lng"&&e[1]==="lat"}var P_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()):Pq(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&&(Pq(o)?this.render(i,n,a):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(i,a,t.start,t.end,!0)))},e.prototype.eachRendered=function(t){ca(this._progressiveEls||this.group,t)},e.prototype._renderOnCartesianAndCalendar=function(t,i,n,a,o){var s=t.coordinateSystem,l=Ws(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),P=m.get(b[1],E);if(isNaN(m.get(b[2],E))||isNaN(A)||isNaN(P)||A<f[0]||A>f[1]||P<h[0]||P>h[1])continue;var U=s.dataToPoint([A,P]);I=new Et({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 Et({z2:1,shape:s.dataToRect([m.get(b[0],E)]).contentShape,style:R})}if(m.hasItemOption){var B=m.getItemModel(E),z=B.getModel("emphasis");v=z.getModel("itemStyle").getItemStyle(),_=B.getModel(["blur","itemStyle"]).getItemStyle(),y=B.getModel(["select","itemStyle"]).getItemStyle(),x=B.get(["itemStyle","borderRadius"]),w=z.get("focus"),T=z.get("blurScope"),C=z.get("disabled"),M=Tr(B)}I.shape.r=x;var k=t.getRawValue(E),G="-";k&&k[2]!=null&&(G=k[2]+""),Or(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,ar(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 Dq;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"?D_e(x,n.option.range):L_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 Br({style:{width:m,height:v,x:h,y:p,image:u.canvas},silent:!0});this.group.add(S)},e.type="heatmap",e}(Zt),Iq=P_e;var I_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 dn(null,this,{generateCoord:"value"})},e.prototype.preventIncremental=function(){var t=pc.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),Nq=I_e;function jU(r){r.registerChartView(Iq),r.registerSeriesModel(Nq)}var N_e=["itemStyle","borderWidth"],Uq=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],KU=new ua,U_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:Uq[+c],categoryDim:Uq[1-+c]};o.diff(s).add(function(d){if(o.hasValue(d)){var g=zq(o,d),m=Oq(o,d,g,h),v=Fq(o,h,m);o.setItemGraphicEl(d,v),a.add(v),kq(v,h,m)}}).update(function(d,g){var m=s.getItemGraphicEl(g);if(!o.hasValue(d)){a.remove(m);return}var v=zq(o,d),_=Oq(o,d,v,h),y=qq(o,_);m&&y!==m.__pictorialShapeStr&&(a.remove(m),o.setItemGraphicEl(d,null),m=null),m?G_e(m,h,_):m=Fq(o,h,_,!0),o.setItemGraphicEl(d,m),m.__pictorialSymbolMeta=_,a.add(m),kq(m,h,_)}).remove(function(d){var g=s.getItemGraphicEl(d);g&&Bq(s,d,g.__pictorialSymbolMeta.animationModel,g)}).execute();var p=t.get("clip",!0)?Tu(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){Bq(a,rt(o).dataIndex,t,o)}):n.removeAll()},e.type="pictorialBar",e}(Zt);function Oq(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};O_e(t,a,n,i,h),z_e(r,e,n,a,o,h.boundingLength,h.pxSign,c,i,h),F_e(t,h.symbolScale,u,i,h);var p=h.symbolSize,d=Co(t.get("symbolOffset"),p);return B_e(t,p,n,a,o,d,s,h.valueLineWidth,h.boundingLength,h.repeatCutLength,i,h),h}function O_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=[JU(s,o[0])-l,JU(s,o[1])-l];f[1]<f[0]&&f.reverse(),c=f[u]}else o!=null?c=JU(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 JU(r,e){return r.toGlobalCoord(r.dataToCoord(r.scale.parse(e)))}function z_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]=ze(d[f.index],h),d[c.index]=ze(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 F_e(r,e,t,i,n){var a=r.get(N_e)||0;a&&(KU.attr({scaleX:e[0],scaleY:e[1],rotation:t}),KU.updateTransform(),a/=KU.getLineScale(),a*=e[i.valueDim.index]),n.valueLineWidth=a||0}function B_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),_=Hr(r.get("symbolMargin"),"15%")+"",y=!1;_.lastIndexOf("!")===_.length-1&&(y=!0,_=_.slice(0,_.length-1));var x=ze(_,e[p.index]),M=Math.max(g+x*2,0),S=y?0:x*2,w=Mp(i),T=w?i:Vq((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?Vq((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 Gq(r){var e=r.symbolPatternSize,t=Mr(r.symbolType,-e/2,-e/2,e,e);return t.attr({culling:!0}),t.type!=="image"&&t.setStyle({strokeNoScale:!0}),t}function Hq(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($U(r,function(g){g.__pictorialAnimationIndex=c,g.__pictorialRepeatTimes=u,c<u?qv(g,null,d(c),t,i):qv(g,null,{scaleX:0,scaleY:0},t,i,function(){n.remove(g)}),c++});c<u;c++){var h=Gq(t);h.__pictorialAnimationIndex=c,h.__pictorialRepeatTimes=u,n.add(h);var p=d(c);qv(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 Wq(r,e,t,i){var n=r.__pictorialBundle,a=r.__pictorialMainPath;a?qv(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=Gq(t),n.add(a),qv(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 Xq(r,e,t){var i=fe({},e.barRectShape),n=r.__pictorialBarRect;n?qv(n,null,{shape:i},e,t):(n=r.__pictorialBarRect=new Et({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),n.disableMorphing=!0,r.add(n))}function Yq(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)Ut(n,{shape:a},s,l);else{a[o.wh]=0,n=new Et({shape:a}),r.__pictorialBundle.setClipPath(n),r.__pictorialClipPath=n;var u={};u[o.wh]=t.clipShape[o.wh],Rt[i?"updateProps":"initProps"](n,{shape:u},s,l)}}}function zq(r,e){var t=r.getItemModel(e);return t.getAnimationDelayParams=k_e,t.isAnimationEnabled=V_e,t}function k_e(r){return{index:r.__pictorialAnimationIndex,count:r.__pictorialRepeatTimes}}function V_e(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function Fq(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?Hq(n,e,t):Wq(n,e,t),Xq(n,t,i),Yq(n,e,t,i),n.__pictorialShapeStr=qq(r,t),n.__pictorialSymbolMeta=t,n}function G_e(r,e,t){var i=t.animationModel,n=t.dataIndex,a=r.__pictorialBundle;Ut(a,{x:t.bundlePosition[0],y:t.bundlePosition[1]},i,n),t.symbolRepeat?Hq(r,e,t,!0):Wq(r,e,t,!0),Xq(r,t,!0),Yq(r,e,t,!0)}function Bq(r,e,t,i){var n=i.__pictorialBarRect;n&&n.removeTextContent();var a=[];$U(i,function(o){a.push(o)}),i.__pictorialMainPath&&a.push(i.__pictorialMainPath),i.__pictorialClipPath&&(t=null),N(a,function(o){Os(o,{scaleX:0,scaleY:0},t,e,function(){i.parent&&i.parent.remove(i)})}),r.setItemGraphicEl(e,null)}function qq(r,e){return[r.getItemVisual(e.dataIndex,"symbol")||"none",!!e.symbolRepeat,!!e.symbolClip].join(":")}function $U(r,e,t){N(r.__pictorialBundle.children(),function(i){i!==r.__pictorialBarRect&&e.call(t,i)})}function qv(r,e,t,i,n,a){e&&r.attr(e),i.symbolClip&&!n?t&&r.attr(t):t&&Rt[n?"updateProps":"initProps"](r,t,i.animationModel,i.dataIndex,a)}function kq(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");$U(r,function(g){if(g instanceof Br){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,Or(d,Tr(n),{labelFetcher:e.seriesModel,labelDataIndex:i,defaultText:Ul(e.seriesModel.getData(),i),inheritColor:t.style.fill,defaultOpacity:t.style.opacity,defaultOutsidePosition:p}),ar(r,c,f,a.get("disabled"))}function Vq(r){var e=Math.round(r);return Math.abs(r-e)<1e-4?e:Math.ceil(r)}var Zq=U_e;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.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=Xn(Cv.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}(Cv),jq=H_e;function QU(r){r.registerChartView(Zq),r.registerSeriesModel(jq),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,ot(oT,"pictorialBar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,sT("pictorialBar"))}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._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 Rn(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]),P=t.getModel("label"),U=P.get("margin"),B=t.getModel("emphasis");if(m==="add"){var z=d[v]=new Ze;R=new OT({shape:{points:x,stackedOnPoints:M,smooth:.4,stackedOnSmooth:.4,smoothConstraint:!1},z2:0}),z.add(R),s.add(z),t.isAnimationEnabled()&&R.setClipPath(X_e(R.getBoundingRect(),t,function(){R.removeClipPath()}))}else{var z=y[_];R=z.childAt(0),s.add(z),d[v]=z,Ut(R,{shape:{points:x,stackedOnPoints:M}},t),Ui(R)}Or(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),Yr(R,t),ar(R,B.get("focus"),B.get("blurScope"),B.get("disabled"))}this._layersSeries=l,this._layers=d},e.type="themeRiver",e}(Zt);function X_e(r,e,t){var i=new Et({shape:{x:r.x-10,y:r.y-10,width:0,height:r.height+20}});return or(i,{shape:{x:r.x-50,width:r.width+100,height:r.height+20}},e,t),i}var Kq=W_e;var eO=2,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.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new Au(Be(this.getData,this),Be(this.getRawData,this))},e.prototype.fixData=function(t){var i=t.length,n={},a=f_(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",Rr).models[0],a=n.get("type"),o=Yt(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][eO]),u.get(s[f][eO])||(u.set(s[f][eO],c),c++);var h=Dl(s,{coordDimensions:["single"],dimensionsDefine:[{name:"time",type:Kp(a)},{name:"value",type:"float"},{name:"name",type:"ordinal"}],encodeDefine:{single:0,value:1,itemName:2}}).dimensions,p=new ai(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=f_(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 kr("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),Jq=Y_e;function tO(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]=ze(s[0],o.height),s[1]=ze(s[1],o.height);var u=o.height-s[0]-s[1];$q(i,t,u)}else{s[0]=ze(s[0],o.width),s[1]=ze(s[1],o.width);var c=o.width-s[0]-s[1];$q(i,t,c)}i.setLayout("layoutInfo",a)})}function $q(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=q_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 q_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 rO(r){r.registerChartView(Kq),r.registerSeriesModel(Jq),r.registerLayout(tO),r.registerProcessor(zl("themeRiver"))}var Z_e=2,j_e=4,K_e=function(r){Z(e,r);function e(t,i,n,a){var o=r.call(this)||this;o.z2=Z_e,o.textConfig={inside:!0},rt(o).seriesIndex=i.seriesIndex;var s=new It({z2:j_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=Ll(p,o));var d=Eu(l.getModel("itemStyle"),f,!0);fe(f,d),N(Vi,function(_){var y=s.ensureState(_),x=l.getModel([_,"itemStyle"]);y.style=x.getItemStyle();var M=Eu(x,f);M&&(y.shape=M)}),t?(s.setShape(f),s.shape.r=c.r0,or(s,{shape:{r:c.r}},n,i.dataIndex)):(Ut(s,{shape:f},n),Ui(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;ar(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(Af,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,P=Math.PI*1.5,U=Tn(R==="tangential"?Math.PI/2-l:l),B=U>A&&!Qu(U-A)&&U<P;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 z=0;R==="radial"?z=Tn(-l)+(B?Math.PI:0):R==="tangential"?z=Tn(Math.PI/2-l)+(B?Math.PI:0):Ct(R)&&(z=R*Math.PI/180),x.rotation=Tn(z)});function m(v,_){var y=v.get(_);return y??a.get(_)}h.dirtyStyle()},e}(xi),iO=K_e;var TE="sunburstRootToNode",Qq="sunburstHighlight",J_e="sunburstUnhighlight";function eZ(r){r.registerAction({type:TE,update:"updateView"},function(e,t){t.eachComponent({mainType:"series",subType:"sunburst",query:e},i);function i(n,a){var o=xc(e,[TE],n);if(o){var s=n.getViewRoot();s&&(e.direction=Uv(s,o.node)?"rollUp":"drillDown"),n.resetViewRoot(o.node)}}}),r.registerAction({type:Qq,update:"none"},function(e,t,i){e=fe({},e),t.eachComponent({mainType:"series",subType:"sunburst",query:e},n);function n(a){var o=xc(e,[Qq],a);o&&(e.dataIndex=o.node.dataIndex)}i.dispatchAction(fe(e,{type:"highlight"}))}),r.registerAction({type:J_e,update:"updateView"},function(e,t,i){e=fe({},e),i.dispatchAction(fe(e,{type:"downplay"}))})}var $_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 Rn(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 iO(_,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 iO(_,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";Wp(u,c)}}n=!0}})})},e.prototype._rootToNode=function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:TE,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}(Zt),tZ=$_e;var Q_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};rZ(n);var a=this._levelModels=de(t.levels||[],function(l){return new Kt(l,this,i)},this),o=Nv.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=Kf(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(){Cx(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 rZ(r){var e=0;N(r.children,function(i){rZ(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 iZ=Q_e;var nZ=Math.PI/180;function nO(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=ze(n[0],o),c=ze(n[1],s),f=ze(a[0],l/2),h=ze(a[1],l/2),p=-i.get("startAngle")*nZ,d=i.get("minAngle")*nZ,g=i.getData().tree.root,m=i.getViewRoot(),v=m.depth,_=i.get("sort");_!=null&&aZ(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 z=B;if(U!==g){var k=U.getValue(),G=x===0&&b?M:k*M;G<d&&(G=d),z=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=ze(K,l/2)),ae!=null&&(Q=ze(ae,l/2))}U.setLayout({angle:G,startAngle:B,endAngle:z,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 z-B}};if(S){var R=f,A=f+T,P=Math.PI*2;g.setLayout({angle:P,startAngle:p,endAngle:p+P,clockwise:C,cx:u,cy:c,r0:R,r:A})}I(m,p)})}function aZ(r,e){var t=r.children||[];r.children=exe(t,e),t.length&&N(r.children,function(i){aZ(i,e)})}function exe(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 aO(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=ow(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 oO(r){r.registerChartView(tZ),r.registerSeriesModel(iZ),r.registerLayout(ot(nO,"sunburst")),r.registerProcessor(ot(zl,"sunburst")),r.registerVisual(aO),eZ(r)}var sO={color:"fill",borderColor:"stroke"},oZ={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},Ru=vt(),txe=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 dn(null,this)},e.prototype.getDataParams=function(t,i,n){var a=r.prototype.getDataParams.call(this,t,i);return n&&(a.info=Ru(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),sZ=txe;function rxe(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 lO(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(rxe,r)}}}function ixe(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 uO(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(ixe,r)}}}function nxe(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 cO(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(nxe,r)}}}function axe(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 fO(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(axe,r)}}}function hO(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 EE(r,e,t,i){return r&&(r.legacy||r.legacy!==!1&&!t&&!i&&e!=="tspan"&&(e==="text"||tt(r,"text")))}function AE(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 lZ(o,r),N(o.rich,function(l){lZ(l,l)}),{textConfig:n,textContent:a}}function lZ(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 pO(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";uZ(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){uZ(s,s)}),i}function uZ(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 pZ={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},cZ=wt(pZ),Nst=_n(Mo,function(r,e){return r[e]=1,r},{}),Ust=Mo.join(", "),Vx=["","style","shape","extra"],Zv=vt();function dO(r,e,t,i,n){var a=r+"Animation",o=gu(r,i,n)||{},s=Zv(e).userDuring;return o.duration>0&&(o.during=s?Be(cxe,{el:e,userDuring:s}):null,o.setToFinal=!0,o.scope=r),fe(o,t[a]),o}function jv(r,e,t,i){i=i||{};var n=i.dataIndex,a=i.isInit,o=i.clearStyle,s=t.isAnimationEnabled(),l=Zv(r),u=e.style;l.userDuring=e.during;var c={},f={};if(hxe(r,e,f),hZ("shape",e,f),hZ("extra",e,f),!a&&s&&(fxe(r,e,c),fZ("shape",r,e,c),fZ("extra",r,e,c),pxe(r,e,u,c)),f.style=u,oxe(r,f,o),lxe(r,e),s)if(a){var h={};N(Vx,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=dO("enter",r,e,t,n);p.duration>0&&r.animateFrom(h,p)}else sxe(r,e,n||0,t,c);mO(r,e),u?r.dirty():r.markRedraw()}function mO(r,e){for(var t=Zv(r).leaveToProps,i=0;i<Vx.length;i++){var n=Vx[i],a=n?e[n]:e;a&&a.leaveTo&&(t||(t=Zv(r).leaveToProps={}),n&&(t[n]=t[n]||{}),fe(n?t[n]:t,a.leaveTo))}}function Kv(r,e,t,i){if(r){var n=r.parent,a=Zv(r).leaveToProps;if(a){var o=dO("update",r,e,t,0);o.done=function(){n.remove(r),i&&i()},r.animateTo(a,o)}else n.remove(r),i&&i()}}function Qf(r){return r==="all"}function oxe(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 sxe(r,e,t,i,n){if(n){var a=dO("update",r,e,i,t);a.duration>0&&r.animateFrom(n,a)}}function lxe(r,e){tt(e,"silent")&&(r.silent=e.silent),tt(e,"ignore")&&(r.ignore=e.ignore),r instanceof _i&&tt(e,"invisible")&&(r.invisible=e.invisible),r instanceof ut&&tt(e,"autoBatch")&&(r.autoBatch=e.autoBatch)}var Lu={},uxe={setTransform:function(r,e){return Lu.el[r]=e,this},getTransform:function(r){return Lu.el[r]},setShape:function(r,e){var t=Lu.el,i=t.shape||(t.shape={});return i[r]=e,t.dirtyShape&&t.dirtyShape(),this},getShape:function(r){var e=Lu.el.shape;if(e)return e[r]},setStyle:function(r,e){var t=Lu.el,i=t.style;return i&&(i[r]=e,t.dirtyStyle&&t.dirtyStyle()),this},getStyle:function(r){var e=Lu.el.style;if(e)return e[r]},setExtra:function(r,e){var t=Lu.el.extra||(Lu.el.extra={});return t[r]=e,this},getExtra:function(r){var e=Lu.el.extra;if(e)return e[r]}};function cxe(){var r=this,e=r.el;if(e){var t=Zv(e).userDuring,i=r.userDuring;if(t!==i){r.el=r.userDuring=null;return}Lu.el=e,i(uxe)}}function fZ(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]={}),Qf(l))fe(o,a);else for(var u=Qt(l),c=0;c<u.length;c++){var f=u[c],h=a[f];o[f]=h}else if(Qf(s)||dt(s,r)>=0){!o&&(o=i[r]={});for(var p=wt(a),c=0;c<p.length;c++){var f=p[c],h=a[f];dxe(n[f],h)&&(o[f]=h)}}}}}function hZ(r,e,t){var i=e[r];if(i)for(var n=t[r]={},a=wt(i),o=0;o<a.length;o++){var s=a[o];n[s]=mp(i[s])}}function fxe(r,e,t){for(var i=e.transition,n=Qf(i)?Mo:Qt(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 hxe(r,e,t){for(var i=0;i<cZ.length;i++){var n=cZ[i],a=pZ[n],o=e[n];o&&(t[a[0]]=o[0],t[a[1]]=o[1])}for(var i=0;i<Mo.length;i++){var s=Mo[i];e[s]!=null&&(t[s]=e[s])}}function pxe(r,e,t,i){if(t){var n=r.style,a;if(n){var o=t.transition,s=e.transition;if(o&&!Qf(o)){var l=Qt(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&&(Qf(s)||Qf(o)||dt(s,"style")>=0)){var h=r.getAnimationStyleProps(),p=h?h.style:null;if(p){!a&&(a=i.style={});for(var d=wt(t),u=0;u<d.length;u++){var c=d[u];if(p[c]){var f=n[c];a[c]=f}}}}}}}function dxe(r,e){return fi(r)?r!==e:r!=null&&isFinite(r)}var dZ=vt(),mxe=["percent","easing","shape","style","extra"];function CE(r){r.stopAnimation("keyframe"),r.attr(dZ(r))}function Jv(r,e,t){if(!(!t.isAnimationEnabled()||!e)){if(pe(e)){N(e,function(s){Jv(r,s,t)});return}var i=e.keyframes,n=e.duration;if(t&&n==null){var a=gu("enter",t,0);n=a&&a.duration}if(!(!i||!n)){var o=dZ(r);N(Vx,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=wt(h);if(s||(p=Yt(p,function(m){return dt(mxe,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 Mc="emphasis",eh="normal",SO="blur",MO="select",th=[eh,Mc,SO,MO],vO={normal:["itemStyle"],emphasis:[Mc,"itemStyle"],blur:[SO,"itemStyle"],select:[MO,"itemStyle"]},gO={normal:["label"],emphasis:[Mc,"label"],blur:[SO,"label"],select:[MO,"label"]},vxe=["x","y"],gxe="e\0\0",Zs={normal:{},emphasis:{},blur:{},select:{}},yxe={cartesian2d:lO,geo:uO,single:cO,polar:fO,calendar:hO};function _O(r){return r instanceof ut}function xO(r){return r instanceof _i}function _xe(r,e){e.copyTransform(r),xO(e)&&xO(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,_O(e)&&_O(r)&&e.setShape(r.shape))}var xxe=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=mZ(t,s,i,n);o||l.removeAll(),s.diff(o).add(function(f){yO(n,null,f,u(f,a),t,l,s)}).remove(function(f){var h=o.getItemGraphicEl(f);h&&Kv(h,Ru(h).option,t)}).update(function(f,h){var p=o.getItemGraphicEl(h);yO(n,p,f,u(f,a),t,l,s)}).execute();var c=t.get("clip",!0)?Tu(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=mZ(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=yO(null,null,f,l(f,o),i,this.group,s);h&&(h.traverse(c),u.push(h))}},e.prototype.eachRendered=function(t){ca(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}(Zt),_Z=xxe;function bO(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=MZ(i);t=nv(a,null,n,i.layout||"center"),Ru(t).customPathData=a}else if(e==="image")t=new Br({}),Ru(t).customImagePath=r.style.image;else if(e==="text")t=new It({});else if(e==="group")t=new Ze;else{if(e==="compoundPath")throw new Error('"compoundPath" is not supported yet.');var o=E_(e);if(!o){var s="";ur(s)}t=new o}return Ru(t).customGraphicType=e,t.name=r.name,t.z2EmphasisLift=1,t.z2SelectLift=1,t}function wO(r,e,t,i,n,a,o){CE(e);var s=n&&n.normal.cfg;s&&e.setTextConfig(s),i&&i.transition==null&&(i.transition=vxe);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=_O(e)?l.decal:null;r&&f&&(f.dirty=!0,c=Ll(f,r)),l.__decalPattern=c}if(xO(e)&&l){var c=l.__decalPattern;c&&(l.decal=c)}jv(e,i,a,{dataIndex:t,isInit:o,clearStyle:!0}),Jv(e,i.keyframeAnimation,a)}function xZ(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),_l(a)}}function Sxe(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<th.length;s++)Mxe(i,e,th[s])}}function Mxe(r,e,t){var i=t===eh,n=i?e:RE(e,t),a=n?n.z2:null,o;a!=null&&(o=i?r:r.ensureState(t),o.z2=a||0)}function mZ(r,e,t,i){var n=r.get("renderItem"),a=r.coordinateSystem,o={};a&&(o=a.prepareCustoms?a.prepareCustoms(a):yxe[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:bxe(r.getData())},u,c,f={},h={},p={},d={},g=0;g<th.length;g++){var m=th[g];p[m]=r.getModel(vO[m]),d[m]=r.getModel(gO[m])}function v(A){return A===u?c||(c=e.getItemModel(A)):e.getItemModel(A)}function _(A,P){return e.hasItemOption?A===u?f[P]||(f[P]=v(A).getModel(vO[P])):v(A).getModel(vO[P]):p[P]}function y(A,P){return e.hasItemOption?A===u?h[P]||(h[P]=v(A).getModel(gO[P])):v(A).getModel(gO[P]):d[P]}return function(A,P){return u=A,c=null,f={},h={},n&&n(Ye({dataIndexInside:A,dataIndex:e.getRawIndex(A),actionType:P?P.type:null},l),s)};function x(A,P){return P==null&&(P=u),e.getStore().get(e.getDimensionIndex(A||0),P)}function M(A,P){P==null&&(P=u),A=A||0;var U=e.getDimensionInfo(A);if(!U){var B=e.getDimensionIndex(A);return B>=0?e.getStore().get(B,P):void 0}var z=e.get(U.name,P),k=U&&U.ordinalMeta;return k?k.categories[z]:z}function S(A,P){P==null&&(P=u);var U=e.getItemVisual(P,"style"),B=U&&U.fill,z=U&&U.opacity,k=_(P,eh).getItemStyle();B!=null&&(k.fill=B),z!=null&&(k.opacity=z);var G={inheritColor:Ce(B)?B:"#000"},Y=y(P,eh),J=fr(Y,null,G,!1,!0);J.text=Y.getShallow("show")?ft(r.getFormattedLabel(P,eh),Ul(e,P)):null;var Q=C_(Y,G,!1);return C(A,k),k=pO(k,J,Q),A&&T(k,A),k.legacy=!0,k}function w(A,P){P==null&&(P=u);var U=_(P,Mc).getItemStyle(),B=y(P,Mc),z=fr(B,null,null,!0,!0);z.text=B.getShallow("show")?qi(r.getFormattedLabel(P,Mc),r.getFormattedLabel(P,eh),Ul(e,P)):null;var k=C_(B,null,!0);return C(A,U),U=pO(U,z,k),A&&T(U,A),U.legacy=!0,U}function T(A,P){for(var U in P)tt(P,U)&&(A[U]=P[U])}function C(A,P){A&&(A.textFill&&(P.textFill=A.textFill),A.textPosition&&(P.textPosition=A.textPosition))}function b(A,P){if(P==null&&(P=u),tt(sO,A)){var U=e.getItemVisual(P,"style");return U?U[sO[A]]:null}if(tt(oZ,A))return e.getItemVisual(P,A)}function E(A){if(a.type==="cartesian2d"){var P=a.getBaseAxis();return n6(Ye({axis:P},A))}}function I(){return t.getCurrentSeriesIndices()}function R(A){return ov(A,t)}}function bxe(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 yO(r,e,t,i,n,a,o){if(!i){a.remove(e);return}var s=TO(r,e,t,i,n,a);return s&&o.setItemGraphicEl(t,s),s&&ar(s,i.focus,i.blurScope,i.emphasisDisabled),s}function TO(r,e,t,i,n,a){var o=-1,s=e;e&&SZ(e,i,n)&&(o=dt(a.childrenRef(),e),e=null);var l=!e,u=e;u?u.clearStates():(u=bO(i),s&&_xe(s,u)),i.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),Zs.normal.cfg=Zs.normal.conOpt=Zs.emphasis.cfg=Zs.emphasis.conOpt=Zs.blur.cfg=Zs.blur.conOpt=Zs.select.cfg=Zs.select.conOpt=null,Zs.isLegacy=!1,Txe(u,t,i,n,l,Zs),wxe(u,t,i,n,l),wO(r,u,t,i,Zs,n,l),tt(i,"info")&&(Ru(u).info=i.info);for(var c=0;c<th.length;c++){var f=th[c];if(f!==eh){var h=RE(i,f),p=EO(i,h,f);xZ(f,u,h,p,Zs)}}return Sxe(u,i,n),i.type==="group"&&Exe(r,u,t,i,n),o>=0?a.replaceAt(u,o):a.add(u),u}function SZ(r,e,t){var i=Ru(r),n=e.type,a=e.shape,o=e.style;return t.isUniversalTransitionEnabled()||n!=null&&n!==i.customGraphicType||n==="path"&&Lxe(a)&&MZ(a)!==i.customPathData||n==="image"&&tt(o,"image")&&o.image!==i.customImagePath}function wxe(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&&SZ(o,a,i)&&(o=null),o||(o=bO(a),r.setClipPath(o)),wO(null,o,e,a,null,i,n)}}function Txe(r,e,t,i,n,a){if(!r.isGroup){vZ(t,null,a),vZ(t,Mc,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=bO(o),r.setTextContent(c)),wO(null,c,e,o,null,i,n);for(var f=o&&o.style,h=0;h<th.length;h++){var p=th[h];if(p!==eh){var d=a[p].conOpt;xZ(p,c,d,EO(o,d,p),null)}}f?c.dirty():c.markRedraw()}}}}function vZ(r,e,t){var i=e?RE(r,e):r,n=e?EO(r,i,Mc):r.style,a=r.type,o=i?i.textConfig:null,s=r.textContent,l=s?e?RE(s,e):s:null;if(n&&(t.isLegacy||EE(n,a,!!o,!!l))){t.isLegacy=!0;var u=AE(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 RE(r,e){return e?r?r[e]:null:r}function EO(r,e,t){var i=e&&e.style;return i==null&&t===Mc&&r&&(i=r.styleEmphasis),i}function Exe(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){Cxe({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),TO(r,h,t,f,n,e)):h.ignore=!0}for(var p=e.childCount()-1;p>=c;p--){var d=e.childAt(p);Axe(e,d,n)}}}function Axe(r,e,t){e&&Kv(e,Ru(r).option,t)}function Cxe(r){new Rn(r.oldChildren,r.newChildren,gZ,gZ,r).add(yZ).update(yZ).remove(Rxe).execute()}function gZ(r,e){var t=r&&r.name;return t??gxe+e}function yZ(r,e){var t=this.context,i=r!=null?t.newChildren[r]:null,n=e!=null?t.oldChildren[e]:null;TO(t.api,n,t.dataIndex,i,t.seriesModel,t.group)}function Rxe(r){var e=this.context,t=e.oldChildren[r];t&&Kv(t,Ru(t).option,e.seriesModel)}function MZ(r){return r&&(r.pathData||r.d)}function Lxe(r){return r&&(tt(r,"pathData")||tt(r,"d"))}function AO(r){r.registerChartView(_Z),r.registerSeriesModel(sZ)}var dd=vt(),bZ=Qe,CO=Be,Dxe=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(wZ,t,f);this.updatePointerEl(s,u,h),this.updateLabelEl(s,u,h,t)}EZ(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=XT(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=dd(e).pointerEl=new Rt[a.type](bZ(t.pointer));e.add(o)}},r.prototype.createLabelEl=function(e,t,i,n){if(t.label){var a=dd(e).labelEl=new It(bZ(t.label));e.add(a),TZ(a,n)}},r.prototype.updatePointerEl=function(e,t,i){var n=dd(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=dd(e).labelEl;a&&(a.setStyle(t.label.style),i(a,{x:t.label.x,y:t.label.y}),TZ(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=uc(a.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Na(u.event)},onmousedown:CO(this._onHandleDragMove,this,0,0),drift:CO(this._onHandleDragMove,this),ondragend:CO(this._onHandleDragEnd,this)}),i.add(n)),EZ(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,Vs(this,"_doDispatchAxisPointer",a.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,s)}},r.prototype._moveHandleToValue=function(e,t){wZ(this._axisPointerModel,!t&&this._moveAnimation,this._handle,RO(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(RO(i),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(RO(n)),dd(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),vc(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 wZ(r,e,t,i){AZ(dd(t).lastProp,i)||(dd(t).lastProp=i,e?Ut(t,i,r):(t.stopAnimation(),t.attr(i)))}function AZ(r,e){if(qe(r)&&qe(e)){var t=!0;return N(e,function(i,n){t=t&&AZ(r[n],i)}),!!t}else return r===e}function TZ(r,e){r[e.get(["label","show"])?"show":"hide"]()}function RO(r){return{x:r.x||0,y:r.y||0,rotation:r.rotation||0}}function EZ(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 $v=Dxe;function Qv(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 LO(r,e,t,i,n){var a=t.get("value"),o=DO(a,e.axis,e.ecModel,t.get("seriesDataIndices"),{precision:t.get(["label","precision"]),formatter:t.get(["label","formatter"])}),s=t.getModel("label"),l=wl(s.get("padding")||0),u=s.getFont(),c=lu(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),Pxe(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 Pxe(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 DO(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:hx(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 Gx(r,e,t){var i=Ei();return Oa(i,i,t.rotation),Sn(i,i,t.position),En([r.dataToCoord(e),(t.labelOffset||0)+(t.labelDirection||1)*(t.labelMargin||0)],i)}function LE(r,e,t,i,n,a){var o=Ln.innerTextLayout(t.rotation,0,t.labelDirection);t.labelMargin=n.get(["label","margin"]),LO(e,i,n,a,{position:Gx(i.axis,r,t),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function eg(r,e,t){return t=t||0,{x1:r[t],y1:r[1-t],x2:e[t],y2:e[1-t]}}function DE(r,e,t){return t=t||0,{x:r[t],y:r[1-t],width:e[t],height:e[1-t]}}function PO(r,e,t,i,n,a){return{cx:r,cy:e,r0:t,r:i,startAngle:n,endAngle:a,clockwise:!0}}var Ixe=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=CZ(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(i,!0));if(u&&u!=="none"){var h=Qv(a),p=Nxe[u](s,f,c);p.style=h,t.graphicKey=p.type,t.pointer=p}var d=bx(l.model,n);LE(i,t,d,n,a,o)},e.prototype.getHandleTransform=function(t,i,n){var a=bx(i.axis.grid.model,i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=Gx(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=CZ(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}($v);function CZ(r,e){var t={};return t[e.dim+"AxisIndex"]=e.index,r.getCartesian(t)}var Nxe={line:function(r,e,t){var i=eg([e,t[0]],[e,t[1]],RZ(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:DE([e-i/2,t[0]],[i,n],RZ(r))}}};function RZ(r){return r.dim==="x"?0:1}var LZ=Ixe;var Uxe=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}(Nt),DZ=Uxe;var bc=vt(),Oxe=N;function IE(r,e,t){if(!Bt.node){var i=e.getZr();bc(i).records||(bc(i).records={}),zxe(i,e);var n=bc(i).records[r]||(bc(i).records[r]={});n.handler=t}}function zxe(r,e){if(bc(r).initialized)return;bc(r).initialized=!0,t("click",ot(PZ,"click")),t("mousemove",ot(PZ,"mousemove")),t("globalout",Bxe);function t(i,n){r.on(i,function(a){var o=kxe(e);Oxe(bc(r).records,function(s){s&&n(s,a,o.dispatchAction)}),Fxe(o.pendings,e)})}}function Fxe(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 Bxe(r,e,t){r.handler("leave",null,t)}function PZ(r,e,t,i){e.handler(r,t,i)}function kxe(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 Hx(r,e){if(!Bt.node){var t=e.getZr(),i=(bc(t).records||{})[r];i&&(bc(t).records[r]=null)}}var Vxe=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";IE("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){Hx("axisPointer",i)},e.prototype.dispose=function(t,i){Hx("axisPointer",i)},e.type="axisPointer",e}(tr),NZ=Vxe;function Wx(r,e){var t=[],i=r.seriesIndex,n;if(i==null||!(n=e.getSeriesByIndex(i)))return{point:[]};var a=n.getData(),o=Is(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 UZ=vt();function IO(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){NE(n)&&(n=Wx({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},e).point);var l=NE(n),u=a.axesInfo,c=s.axesInfo,f=i==="leave"||NE(n),h={},p={},d={list:[],map:{}},g={showPointer:ot(Hxe,p),showTooltip:ot(Wxe,d)};N(s.coordSysMap,function(v,_){var y=l||v.containPoint(n);N(s.coordSysAxesInfo[_],function(x,M){var S=x.axis,w=Zxe(u,x);if(!f&&y&&(!u||w)){var T=w&&w.value;T==null&&!l&&(T=S.pointToData(n)),T!=null&&OZ(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,zZ(x),zZ(v)))),m[v.key]=w}})}),N(m,function(v,_){OZ(c[_],v,g,!0,h)}),Xxe(p,c,h),Yxe(d,n,r,o),qxe(c,o,t),h}}function OZ(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=Gxe(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 Gxe(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 Hxe(r,e,t,i){r[e.key]={value:t,payloadBatch:i}}function Wxe(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=Lv(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 Xxe(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 Yxe(r,e,t,i){if(NE(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 qxe(r,e,t){var i=t.getZr(),n="axisPointerLastHighlights",a=UZ(i)[n]||{},o=UZ(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 Zxe(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 zZ(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 NE(r){return!r||r[0]==null||isNaN(r[0])||r[1]==null||isNaN(r[1])}function Bl(r){$a.registerAxisPointerClass("CartesianAxisPointer",LZ),r.registerComponentModel(DZ),r.registerComponentView(NZ),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=c9(e,t)}),r.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},IO)}function NO(r){Ot(ZT),Ot(Bl)}var jxe=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=Qv(a),d=Jxe[h](s,l,f,c);d.style=p,t.graphicKey=d.type,t.pointer=d}var g=a.get(["label","margin"]),m=Kxe(i,n,a,l,g);LO(t,n,a,o,m)},e}($v);function Kxe(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=Ei();Oa(h,h,s),Sn(h,h,[i.cx,i.cy]),u=En([o,-n],h);var p=e.getModel("axisLabel").get("rotate")||0,d=Ln.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 Jxe={line:function(r,e,t,i){return r.dim==="angle"?{type:"Line",shape:eg(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:PO(e.cx,e.cy,i[0],i[1],(-t-n/2)*a,(-t+n/2)*a)}:{type:"Sector",shape:PO(e.cx,e.cy,t-n/2,t+n/2,0,Math.PI*2)}}},FZ=jxe;var $xe=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}(Nt),BZ=$xe;var UO=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Rr).models[0]},e.type="polarAxis",e}(Nt);wr(UO,xu);var kZ=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}(UO);var VZ=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}(UO);var OO=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}(mn);OO.prototype.dataToRadius=mn.prototype.dataToCoord;OO.prototype.radiusToData=mn.prototype.coordToData;var GZ=OO;var Qxe=vt(),zO=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=lu(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=Qxe(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}(mn);zO.prototype.dataToAngle=mn.prototype.dataToCoord;zO.prototype.angleToData=mn.prototype.coordToData;var HZ=zO;var FO=["radius","angle"],eSe=function(){function r(e){this.dimensions=FO,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new GZ,this._angleAxis=new HZ,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=WZ(t);return n===this?this.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=WZ(t);return n===this?this.pointToData(i):null},r}();function WZ(r){var e=r.seriesModel,t=r.polarModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}var XZ=eSe;function tSe(r,e,t){var i=e.get("center"),n=t.getWidth(),a=t.getHeight();r.cx=ze(i[0],n),r.cy=ze(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=[ze(l[0],s),ze(l[1],s)];o.inverse?o.setExtent(u[1],u[0]):o.setExtent(u[0],u[1])}function rSe(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(bv(l,"radius"),function(u){n.scale.unionExtentFromData(l,u)}),N(bv(l,"angle"),function(u){i.scale.unionExtentFromData(l,u)})}}),_u(i.scale,i.model),_u(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 iSe(r){return r.mainType==="angleAxis"}function YZ(r,e){var t;if(r.type=e.get("type"),r.scale=Gf(e),r.onBand=e.get("boundaryGap")&&r.type==="category",r.inverse=e.get("inverse"),iSe(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 nSe={dimensions:FO,create:function(r,e){var t=[];return r.eachComponent("polar",function(i,n){var a=new XZ(n+"");a.update=rSe;var o=a.getRadiusAxis(),s=a.getAngleAxis(),l=i.findAxisModel("radiusAxis"),u=i.findAxisModel("angleAxis");YZ(o,l),YZ(s,u),tSe(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",Rr).models[0];i.coordinateSystem=n.coordinateSystem}}),t}},qZ=nSe;var aSe=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function UE(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 OE(r){var e=r.getRadiusAxis();return e.inverse?0:1}function ZZ(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 oSe=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});ZZ(u),ZZ(s),N(aSe,function(c){t.get([c,"show"])&&(!n.scale.isBlank()||c==="axisLine")&&sSe[c](this.group,t,a,s,l,o,u)},this)}},e.type="angleAxis",e}($a),sSe={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=OE(t),f=c?0:1,h,p=Math.abs(u[1]-u[0])===360?"Circle":"Arc";a[f]===0?h=new Rt[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 Up({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[OE(t)],u=de(i,function(c){return new ei({shape:UE(t,[l,l+s],c.coord)})});r.add(Wn(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[OE(t)],c=[],f=0;f<n.length;f++)for(var h=0;h<n[f].length;h++)c.push(new ei({shape:UE(t,[u,u+l],n[f][h].coord)}));r.add(Wn(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[OE(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 Kt(M.textStyle,l,l.ecModel))}var S=new It({silent:Ln.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=Ln.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 ei({shape:UE(t,a,i[f].coord)}))}for(var f=0;f<c.length;f++)r.add(Wn(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 ei({shape:UE(t,a,n[u][c].coord)}));r.add(Wn(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 xi({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(Wn(c[m],{style:Ye({fill:l[m%l.length]},s.getAreaStyle()),silent:!0}))}}},jZ=oSe;var lSe=["axisLine","axisTickLabel","axisName"],uSe=["splitLine","splitArea","minorSplitLine"],cSe=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=hSe(s,t,f),d=new Ln(t,p);N(lSe,d.add,d),a.add(d.getGroup()),lc(n,a,t),N(uSe,function(g){t.get([g,"show"])&&!o.scale.isBlank()&&fSe[g](this.group,t,s,f,h,u,c)},this)}},e.type="radiusAxis",e}($a),fSe={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 Rt[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(Wn(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 ua({shape:{cx:t.cx,cy:t.cy,r:o[c][f].coord}}));r.add(Wn(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 xi({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(Wn(c[h],{style:Ye({fill:l[h%l.length]},s.getAreaStyle()),silent:!0}))}}};function hSe(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 KZ=cSe;function JZ(r){return r.get("stack")||"__ec_stack_"+r.seriesIndex}function $Z(r,e){return e.dim+r.model.componentIndex}function pSe(r,e,t){var i={},n=dSe(Yt(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=$Z(s,l),c=JZ(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=Ro(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,P=void 0,U=void 0,B=void 0;if(d.dim==="radius"){var z=d.dataToCoord(b)-w,k=l.dataToCoord(E);Math.abs(z)<v&&(z=(z<0?-1:1)*v),A=R,P=R+z,U=k-h,B=U-p,M&&(i[c][E][I]=P)}else{var G=d.dataToCoord(b,S)-w,Y=l.dataToCoord(E);Math.abs(G)<_&&(G=(G<0?-1:1)*_),A=Y+h,P=A+p,U=R,B=R+G,M&&(i[c][E][I]=B)}o.setItemLayout(T,{cx:g,cy:m,r0:A,r:P,startAngle:-U*Math.PI/180,endAngle:-B*Math.PI/180,clockwise:U>=B})}}})}function dSe(r){var e={};N(r,function(i,n){var a=i.getData(),o=i.coordinateSystem,s=o.getBaseAxis(),l=$Z(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=JZ(i);h[p]||f.autoWidthCount++,h[p]=h[p]||{width:0,maxWidth:0};var d=ze(i.get("barWidth"),c),g=ze(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=ze(i.categoryGap,o),l=ze(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 QZ=pSe;var mSe={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},vSe={splitNumber:5},gSe=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}(tr);function BO(r){Ot(Bl),$a.registerAxisPointerClass("PolarAxisPointer",FZ),r.registerCoordinateSystem("polar",qZ),r.registerComponentModel(BZ),r.registerComponentView(gSe),Fl(r,"angle",kZ,mSe),Fl(r,"radius",VZ,vSe),r.registerComponentView(jZ),r.registerComponentView(KZ),r.registerLayout(ot(QZ,"bar"))}function Xx(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),Hr(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 ySe=["axisLine","axisTickLabel","axisName"],_Se=["splitArea","splitLine"],xSe=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=Xx(t),u=new Ln(t,l);N(ySe,u.add,u),o.add(this._axisGroup),o.add(u.getGroup()),N(_Se,function(c){t.get([c,"show"])&&SSe[c](this,this.group,this._axisGroup,t)},this),lc(s,this._axisGroup,t),r.prototype.render.call(this,t,i,n,a)},e.prototype.remove=function(){qT(this)},e.type="singleAxis",e}($a),SSe={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 ei({shape:{x1:d[0],y1:d[1],x2:g[0],y2:g[1]},silent:!0});sc(_.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(Wn(f[m],{style:Ye({stroke:s[m%s.length]},x),silent:!0}))}},splitArea:function(r,e,t,i){YT(r,t,i,i)}},tj=xSe;var rj=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}(Nt);wr(rj,xu.prototype);var zE=rj;var MSe=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}(mn),ij=MSe;var kO=["single"],bSe=function(){function r(e,t,i){this.type="single",this.dimension="single",this.dimensions=kO,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 ij(n,Gf(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),_u(this._axis.scale,this._axis.model)}},this)},r.prototype.resize=function(e,t){this._rect=Sr({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=nj(t);return n===this?this.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=nj(t);return n===this?this.pointToData(i):null},r}();function nj(r){var e=r.seriesModel,t=r.singleAxisModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}var aj=bSe;function wSe(r,e){var t=[];return r.eachComponent("singleAxis",function(i,n){var a=new aj(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",Rr).models[0];i.coordinateSystem=n&&n.coordinateSystem}}),t}var TSe={create:wSe,dimensions:kO},oj=TSe;var sj=["x","y"],ESe=["width","height"],ASe=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=VO(l,1-FE(s)),c=l.dataToPoint(i)[0],f=a.get("type");if(f&&f!=="none"){var h=Qv(a),p=CSe[f](s,c,u);p.style=h,t.graphicKey=p.type,t.pointer=p}var d=Xx(n);LE(i,t,d,n,a,o)},e.prototype.getHandleTransform=function(t,i,n){var a=Xx(i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=Gx(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=FE(o),u=VO(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=VO(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}($v),CSe={line:function(r,e,t){var i=eg([e,t[0]],[e,t[1]],FE(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:DE([e-i/2,t[0]],[i,n],FE(r))}}};function FE(r){return r.isHorizontal()?0:1}function VO(r,e){var t=r.getRect();return[t[sj[e]],t[sj[e]]+t[ESe[e]]]}var lj=ASe;var RSe=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}(tr);function GO(r){Ot(Bl),$a.registerAxisPointerClass("SingleAxisPointer",lj),r.registerComponentView(RSe),r.registerComponentView(tj),r.registerComponentModel(zE),Fl(r,"single",zE,zE.defaultOption),r.registerCoordinateSystem("single",oj)}var 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.prototype.init=function(t,i,n){var a=Fs(t);r.prototype.init.apply(this,arguments),uj(t,a)},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),uj(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}(Nt);function uj(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 C5(e,a)&&(i[a]="auto"),i[a]!=null&&i[a]!=="auto"});Ya(r,e,{type:"box",ignoreSize:n})}var cj=LSe;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.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 Et({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 ri({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?T5(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 It({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=R_(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 It({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=R_(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=ze(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 It({z2:30,style:fe(fr(s,{text:c[y]}),this._weekTextPositionControl(_,a,u,f,g))});o.add(x)}}},e.type="calendar",e}(tr),fj=DSe;var HO=864e5,PSe=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=wn(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=Sr(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+HO))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=hj(t);return n===this?n.dataToPoint(i):null},r.prototype.convertFromPixel=function(e,t,i){var n=hj(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/HO)-Math.floor(t[0].time/HO)+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 hj(r){var e=r.calendarModel,t=r.seriesModel,i=e?e.coordinateSystem:t?t.coordinateSystem:null;return i}var pj=PSe;function WO(r){r.registerComponentModel(cj),r.registerComponentView(fj),r.registerCoordinateSystem("calendar",pj)}function ISe(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 dj(r,e){var t;return N(e,function(i){r[i]!=null&&r[i]!=="auto"&&(t=!0)}),t}function NSe(r,e,t){var i=fe({},t),n=r[e],a=t.$action||"merge";if(a==="merge")if(n){if(0)var o;xt(n,i,!0),Ya(n,i,{ignoreSize:!0}),XD(t,n),BE(t,n),BE(t,n,"shape"),BE(t,n,"style"),BE(t,n,"extra"),t.clipPath=n.clipPath}else r[e]=i;else a==="replace"?r[e]=i:a==="remove"&&n&&(r[e]=null)}var mj=["transition","enterFrom","leaveTo"],USe=mj.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function BE(r,e,t){if(t&&(!r[t]&&e[t]&&(r[t]={}),r=r[t],e=e[t]),!(!r||!e))for(var i=t?mj:USe,n=0;n<i.length;n++){var a=i[n];r[a]==null&&e[a]!=null&&(r[a]=e[a])}}function OSe(r,e){if(r&&(r.hv=e.hv=[dj(e,["left","right"]),dj(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 vj=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=Aw(o,s,"normalMerge"),u=this._elOptionsToUpdate=[];N(l,function(c,f){var h=c.newOption;h&&(u.push(h),ISe(c,h),NSe(o,f,h),OSe(o[f],h))},this),n.elements=Yt(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}(Nt);var gj={path:null,compoundPath:null,group:Ze,image:Br,text:It},js=vt(),xj=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=Kr(l.id,null),c=u!=null?n.get(u):null,f=Kr(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&&EE(d,p,!!m,!!g)){var v=AE(d,p,!0);!m&&v.textConfig&&(m=l.textConfig=v.textConfig),!g&&v.textContent&&(g=v.textContent)}var _=zSe(l),y=l.$action||"merge",x=y==="merge",M=y==="replace";if(x){var S=!c,w=c;S?w=yj(u,h,l.type,n):(w&&(js(w).isNew=!1),CE(w)),w&&(jv(w,_,t,{isInit:S}),_j(w,l,o,s))}else if(M){kE(c,l,n,t);var T=yj(u,h,l.type,n);T&&(jv(T,_,t,{isInit:!0}),_j(T,l,o,s))}else y==="remove"&&(mO(c,l),kE(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 It(g))}else M&&C.setTextContent(new It(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||js(A).type!==I,R=S?XO(I):A}else M&&(S=!0,R=XO(I));C.setClipPath(R),jv(R,E,t,{isInit:S}),Jv(R,E.keyframeAnimation,t)}var P=js(C);C.setTextConfig(m),P.option=l,FSe(C,t,l),bl({el:C,componentModel:t,itemName:C.name,itemTooltipOption:l.tooltip}),Jv(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=Kr(f.id,null),p=h!=null?o.get(h):null;if(!(!p||!p.isGroup)){var d=p.parent,g=d===a,m=js(p),v=js(d);m.width=ze(m.option.width,g?s:v.width)||0,m.height=ze(m.option.height,g?l:v.height)||0}}for(var c=n.length-1;c>=0;c--){var f=n[c],h=Kr(f.id,null),p=h!=null?o.get(h):null;if(p){var d=p.parent,v=js(d),_=d===a?{width:s,height:l}:{width:v.width,height:v.height},y={},x=Lf(p,f,_,null,{hv:f.hv,boundingMode:f.bounding},y);if(!js(p).isNew&&x){for(var M=f.transition,S={},w=0;w<u.length;w++){var T=u[w],C=y[T];M&&(Qf(M)||dt(M,T)>=0)?S[T]=C:p[T]=C}Ut(p,S,t,0)}else p.attr(y)}}},e.prototype._clear=function(){var t=this,i=this._elMap;i.each(function(n){kE(n,js(n).option,i,t._lastGraphicModel)}),this._elMap=ke()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(tr);function XO(r){var e=tt(gj,r)?gj[r]:E_(r),t=new e({});return js(t).type=r,t}function yj(r,e,t,i){var n=XO(t);return e.add(n),i.set(r,n),js(n).id=r,js(n).isNew=!0,n}function kE(r,e,t,i){var n=r&&r.parent;n&&(r.type==="group"&&r.traverse(function(a){kE(a,e,t,i)}),Kv(r,e,i),t.removeKey(js(r).id))}function _j(r,e,t,i){r.isGroup||N([["cursor",_i.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(wt(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 zSe(r){return r=fe({},r),N(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(HD),function(e){delete r[e]}),r}function FSe(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 YO(r){r.registerComponentModel(vj),r.registerComponentView(xj),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 qO=["x","y","radius","angle","single"],BSe=["cartesian2d","polar","singleAxis"];function Sj(r){var e=r.get("coordinateSystem");return dt(BSe,e)>=0}function Ks(r){return r+"Axis"}function Mj(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 VE(r){var e=r.ecModel,t={infoList:[],infoMap:ke()};return r.eachTargetAxis(function(i,n){var a=e.getComponent(Ks(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 ZO=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}(),kSe=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=bj(t);this.settledOption=a,this.mergeDefaultAndTheme(t,n),this._doInit(a)},e.prototype.mergeOption=function(t){var i=bj(t);xt(this.option,t,!0),xt(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(qO,function(n){var a=this.getReferringComponents(Ks(n),gH);if(a.specified){i=!0;var o=new ZO;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 ZO;if(h.add(f.componentIndex),t.set(c,h),a=!1,c==="x"||c==="y"){var p=f.getReferringComponents("grid",Rr).models[0];p&&N(u,function(d){f.componentIndex!==d.componentIndex&&p===d.getReferringComponents("grid",Rr).models[0]&&h.add(d.componentIndex)})}}}a&&N(qO,function(u){if(a){var c=n.findComponents({mainType:Ks(u),filter:function(h){return h.get("type",!0)==="category"}});if(c[0]){var f=new ZO;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(Ks(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(Ks(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}(Nt);function bj(r){var e={};return N(["start","end","startValue","endValue","throttle"],function(t){r.hasOwnProperty(t)&&(e[t]=r[t])}),e}var rh=kSe;var VSe=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}(rh),wj=VSe;var GSe=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}(tr),tg=GSe;var HSe=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}(tg),Tj=HSe;var rg=N,Ej=Ai,WSe=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(Sj(t)){var i=Ks(this._dimName),n=t.getReferringComponents(i,Rr).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;rg(["start","end"],function(h,p){var d=e[h],g=e[h+"Value"];a[p]==="percent"?(d==null&&(d=o[p]),g=n.parse(ir(d,o,t))):(u=!0,g=g==null?t[p]:n.parse(g),d=ir(g,t,o)),l[p]=g==null||isNaN(g)?t[p]:g,s[p]=d==null||isNaN(d)?o[p]:d}),Ej(l),Ej(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";Qa(0,h,d,"all",c["min"+v],c["max"+v]);for(var _=0;_<2;_++)p[_]=ir(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=XSe(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;rg(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 rg(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)}});rg(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;rg(["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=ir(i[0]+o,i,[0,100],!0):a!=null&&(o=ir(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=km(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 XSe(r,e,t){var i=[1/0,-1/0];rg(t,function(o){v6(i,o.getData(),e)});var n=r.getAxisModel(),a=pT(n.axis.scale,n,i).calculate();return[a.min,a.max]}var Aj=WSe;var YSe={getTargetSeries:function(r){function e(n){r.eachComponent("dataZoom",function(a){a.eachTargetAxis(function(o,s){var l=r.getComponent(Ks(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 Aj(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]})}})}},Cj=YSe;function jO(r){r.registerAction("dataZoom",function(e,t){var i=Mj(t,e);N(i,function(n){n.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var Rj=!1;function md(r){Rj||(Rj=!0,r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,Cj),jO(r),r.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function Lj(r){r.registerComponentModel(wj),r.registerComponentView(Tj),md(r)}var en=function(){function r(){}return r}();var Dj={};function ih(r,e){Dj[r]=e}function GE(r){return Dj[r]}var ZSe=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=GE(n);a&&(a.getDefaultOption&&(a.defaultOption=a.getDefaultOption(t)),xt(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}(Nt),Pj=ZSe;function Ij(r,e,t){var i=e.getBoxLayoutParams(),n=e.get("padding"),a={width:t.getWidth(),height:t.getHeight()},o=Sr(i,a,n);El(e.get("orient"),r,e.get("itemGap"),o.width,o.height),Lf(r,i,a,n)}function HE(r,e){var t=wl(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),r=new Et({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 KSe=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 Rn(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 Kt(_,t,t.ecModel),x;if(a&&a.newTitle!=null&&a.featureName===m&&(_.title=a.newTitle),m&&!v){if(JSe(m))x={onclick:y.option.onclick,featureName:m};else{var M=GE(m);if(!M)return;x=new M}c[m]=x}else if(x=c[v],!x)return;x.uid=zs("toolbox-feature"),x.model=y,x.ecModel=i,x.api=n;var S=x instanceof en;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"?Vn:Gn)(b[w])},x instanceof en&&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 en&&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=uc(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 It({style:{text:S[C],align:_.get("textAlign"),borderRadius:_.get("textBorderRadius"),padding:_.get("textPadding"),fill:null,font:ov({fontStyle:_.get("textFontStyle"),fontFamily:_.get("textFontFamily"),fontSize:_.get("textFontSize"),fontWeight:_.get("textFontWeight")},i)},ignore:!0});b.setTextContent(I),bl({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"?Vn:Gn)(b),o.add(b),b.on("click",Be(g.onclick,g,i,n,C)),w[C]=b})}Ij(o,t,n),o.add(HE(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=lu(g,It.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 en&&o.updateView&&o.updateView(o.model,i,n,a)})},e.prototype.remove=function(t,i){N(this._features,function(n){n instanceof en&&n.remove&&n.remove(t,i)}),this.group.removeAll()},e.prototype.dispose=function(t,i){N(this._features,function(n){n instanceof en&&n.dispose&&n.dispose(t,i)})},e.type="toolbox",e}(tr);function JSe(r){return r.indexOf("my")===0}var Nj=KSe;var $Se=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=Bt.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}(en),Uj=$Se;var Oj="__ec_magicType_stack__";var QSe=[["line","bar"],["stack"]],eMe=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(zj[n]){var s={series:[]},l=function(f){var h=f.subType,p=f.id,d=zj[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(_,Rr).models[0],x=y.componentIndex;s[_]=s[_]||[];for(var M=0;M<=x;M++)s[_][x]=s[_][x]||{};s[_][x].boundaryGap=n==="bar"}}};N(QSe,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=xt({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}(en),zj={line:function(r,e,t,i){if(r==="bar")return xt({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 xt({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")===Oj;if(r==="line"||r==="bar")return i.setIconStatus("stack",n?"normal":"emphasis"),xt({id:e,stack:n?"":Oj},i.get(["option","stack"])||{},!0)}};ha({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(r,e){e.mergeOption(r.newOption)});var Fj=eMe;var XE=new Array(60).join("-"),ig=" ";function tMe(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 rMe(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(ig)],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(ig))}e.push(u.join(`
  2217. `))}),e.join(`
  2218. `+XE+`
  2219. `)}function iMe(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+ig:"")+n.join(ig))}),i.join(`
  2220. `)}).join(`
  2221. `+XE+`
  2222. `)}function nMe(r){var e=tMe(r);return{value:Yt([rMe(e.seriesGroupByCategoryAxis),iMe(e.other)],function(t){return!!t.replace(/[\n\t\s]/g,"")}).join(`
  2223. `+XE+`
  2224. `),meta:e.meta}}function WE(r){return r.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function aMe(r){var e=r.slice(0,r.indexOf(`
  2225. `));if(e.indexOf(ig)>=0)return!0}var KO=new RegExp("["+ig+"]+","g");function oMe(r){for(var e=r.split(/\n+/g),t=WE(e.shift()).split(KO),i=[],n=de(t,function(l){return{name:l,data:[]}}),a=0;a<e.length;a++){var o=WE(e[a]).split(KO);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 sMe(r){for(var e=r.split(/\n+/g),t=WE(e.shift()),i=[],n=0;n<e.length;n++){var a=WE(e[n]);if(a){var o=a.split(KO),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 lMe(r,e){var t=r.split(new RegExp(`
  2226. *`+XE+`
  2227. *`,"g")),i={series:[]};return N(t,function(n,a){if(aMe(n)){var o=oMe(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=sMe(n);i.series.push(o)}}),i}var uMe=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=nMe(t);if(He(f)){var d=f(i.getOption());Ce(d)?u.innerHTML=d:uf(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}V0(y,"click",S),V0(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=lMe(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}(en);function cMe(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})}ha({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:cMe(i.data,a)})}}),e.mergeOption(Ye({series:t},r.newOption))});var Bj=uMe;var kj=N,Vj=vt();function Gj(r,e){var t=JO(r);kj(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 Hj(r){var e=JO(r),t=e[e.length-1];e.length>1&&e.pop();var i={};return kj(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 Wj(r){Vj(r).snapshots=null}function Xj(r){return JO(r).length}function JO(r){var e=Vj(r);return e.snapshots||(e.snapshots=[{}]),e.snapshots}var fMe=function(r){Z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,i){Wj(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}(en);ha({type:"restore",event:"restore",update:"prepareAndUpdate"},function(r,e){e.resetOption("recreate")});var qj=fMe;var hMe=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],pMe=function(){function r(e,t,i){var n=this;this._targetInfoList=[];var a=Zj(t,e);N(dMe,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=$O[i.brushType](0,a,n);i.__rangeOffset={offset:$j[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=$O[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=$O[i.brushType](0,n.coordSys,i.coordRange),o=i.__rangeOffset;i.range=o?$j[i.brushType](a.values,o.offset,mMe(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:vE(n),isTargetByCursor:yE(n,e,i.coordSysModel),getLinearBrushOtherExtent:gE(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=Zj(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<jj.length;l++)if(jj[l](n,o))return o}return!0},r}();function QO(r){return r[0]>r[1]&&r.reverse(),r}function Zj(r,e){return xf(r,e,{includeMainTypes:hMe})}var dMe={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:Kj.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:Kj.geo})})}},jj=[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}],Kj={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var r=this.coordSys,e=r.getBoundingRect().clone();return e.applyTransform(Ml(r)),e}},$O={lineX:ot(Jj,0),lineY:ot(Jj,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=[QO([n[0],a[0]]),QO([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 Jj(r,e,t,i){var n=t.getAxis(["x","y"][r]),a=QO(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 $j={lineX:ot(Qj,0),lineY:ot(Qj,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 Qj(r,e,t,i){return[e[0]-i[r]*t[0],e[1]-i[r]*t[1]]}function mMe(r,e){var t=eK(r),i=eK(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 eK(r){return r?[r[0][1]-r[0][0],r[1][1]-r[1][0]]:[NaN,NaN]}var Yx=pMe;var e3=N,vMe=dH("toolbox-dataZoom_");var gMe=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 Yv(n.getZr()),this._brushController.on("brush",Be(this._onBrush,this)).mount()),xMe(t,i,this,a,n),_Me(t,i)},e.prototype.onclick=function(t,i,n){yMe[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 Yx(t3(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)}}),Gj(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=Qa(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=[];e3(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}(en),yMe={zoom:function(){var r=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:r})},back:function(){this._dispatchZoomAction(Hj(this.ecModel))}};function t3(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 _Me(r,e){r.setIconStatus("back",Xj(e)>1?"emphasis":"normal")}function xMe(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 Yx(t3(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)}U5("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=t3(i),o=xf(r,a);e3(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),e3(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:vMe+u+f};h[c]=f,n.push(h)}return n});var tK=gMe;function r3(r){r.registerComponentModel(Pj),r.registerComponentView(Nj),ih("saveAsImage",Uj),ih("magicType",Fj),ih("dataView",Bj),ih("dataZoom",tK),ih("restore",qj),Ot(Lj)}var SMe=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}(Nt),rK=SMe;function YE(r){var e=r.get("confine");return e!=null?!!e:r.get("renderMode")==="richText"}function iK(r){if(Bt.domSupported){for(var e=document.documentElement.style,t=0,i=r.length;t<i;t++)if(r[t]in e)return r[t]}}var i3=iK(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),nK=iK(["webkitTransition","transition","OTransition","MozTransition","msTransition"]);function n3(r,e){if(!r)return e;e=c1(e,!0);var t=r.indexOf(e);return r=t===-1?e:"-"+r.slice(0,t)+"-"+e,r.toLowerCase()}function aK(r,e){var t=r.currentStyle||document.defaultView&&document.defaultView.getComputedStyle(r);return t?e?t[e]:t:null}var MMe=n3(nK,"transition"),a3=n3(i3,"transform"),bMe="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(Bt.transform3dSupported?"will-change:transform;":"");function wMe(r){return r=r==="left"?"right":r==="right"?"left":r==="top"?"bottom":"top",r}function TMe(r,e,t){if(!Ce(t)||t==="inside")return"";var i=r.get("backgroundColor"),n=r.get("borderWidth");e=Tl(e);var a=wMe(t),o=Math.max(Math.round(n)*1.5,6),s="",l=a3+":",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 EMe(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+=Bt.transformSupported?","+a3+i:",left"+i+",top"+i),MMe+":"+n}function oK(r,e,t){var i=r.toFixed(0)+"px",n=e.toFixed(0)+"px";if(!Bt.transformSupported)return t?"top:"+n+";left:"+i+";":[["top",n],["left",i]];var a=Bt.transform3dSupported,o="translate"+(a?"3d":"")+"("+i+","+n+(a?",0":"")+")";return t?"top:0;left:0;"+a3+":"+o+";":[["top",0],["left",0],[i3,o]]}function AMe(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 CMe(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=D1(r,"html"),h=l+"px "+u+"px "+o+"px "+s;return i.push("box-shadow:"+h),e&&n&&i.push(EMe(n,t)),a&&i.push("background-color:"+a),N(["width","color","radius"],function(p){var d="border-"+p,g=c1(d),m=r.get(g);m!=null&&i.push(d+":"+m+(p==="color"?"":"px"))}),i.push(AMe(c)),f!=null&&i.push("padding:"+wl(f).join("px ")+"px"),i.join(";")+";"}function sK(r,e,t,i,n){var a=e&&e.painter;if(t){var o=a&&a.getViewportRoot();o&&JV(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 RMe=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,Bt.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):uf(a)?a:He(a)&&a(e.getDom()));sK(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();Ia(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=aK(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=bMe+CMe(e,!this._firstShow,this._longHide)+oK(a[0],a[1],!0)+("border-color:"+Tl(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"&&!YE(i)&&(s=TMe(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++)uf(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(sK(i,this._zr,this._container,e,t),i[0]!=null&&i[1]!=null){var n=this.el.style,a=oK(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",Bt.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}(),lK=RMe;var LMe=function(){function r(e){this._show=!1,this._styleCoord=[0,0,0,0],this._alwaysShowContent=!1,this._enterable=!0,this._zr=e.getZr(),cK(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 It({style:{rich:t.richTextStyles,text:e,lineHeight:22,borderWidth:1,borderColor:n,textShadowColor:s.get("textShadowColor"),fill:i.get(["textStyle","color"]),padding:D1(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=uK(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;cK(n,this._zr,e,t),e=n[0],t=n[1];var a=i.style,o=nh(a.borderWidth||0),s=uK(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 nh(r){return Math.max(0,r)}function uK(r){var e=nh(r.shadowBlur||0),t=nh(r.shadowOffsetX||0),i=nh(r.shadowOffsetY||0);return{left:nh(e-t),right:nh(e+t),top:nh(e-i),bottom:nh(e+i)}}function cK(r,e,t,i){r[0]=t,r[1]=i,r[2]=r[0]/e.getWidth(),r[3]=r[1]/e.getHeight()}var fK=LMe;var DMe=new Et({shape:{x:-1,y:-1,width:2,height:2}}),PMe=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(!(Bt.node||!i.getDom())){var n=t.getComponent("tooltip"),a=this._renderMode=_H(n.get("renderMode"));this._tooltipContent=a==="richText"?new fK(i):new lK(i,{appendTo:n.get("appendToBody",!0)?"body":n.get("appendTo",!0)})}},e.prototype.render=function(t,i,n){if(!(Bt.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")?Vs(this,"_updatePosition",50,"fixRate"):vc(this,"_updatePosition")}},e.prototype._initGlobalListener=function(){var t=this._tooltipModel,i=t.get("triggerOn");IE("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||Bt.node||!n.getDom())){var o=hK(a,n);this._ticket="";var s=a.dataByCoordSys,l=OMe(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=DMe;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=Wx(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(hK(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=qx([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;Cl(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=qx([i.tooltipOption],a),l=this._renderMode,u=[],c=kr("section",{blocks:[],noHeader:!0}),f=[],h=new P1;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=DO(M,x.axis,n,y.seriesDataIndices,y.valueLabelOpt),w=kr("section",{header:S,noHeader:!Zi(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=hx(x.axis,{value:M}),E.axisValueLabel=S,E.marker=h.makeTooltipMarker("item",Tl(E.color),l);var I=aP(C.formatTooltip(b,!0,null)),R=I.frag;if(R){var A=qx([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=hP(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=qx([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 P1;v.marker=_.makeTooltipMarker("item",Tl(v.color),p);var y=aP(u.formatTooltip(c,!1,f)),x=g.get("order"),M=g.get("valueFormatter"),S=y.frag,w=S?hP(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=qx(u,this._tooltipModel,f?{position:f}:null),p=h.get("content"),d=Math.random()+"",g=new P1;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=Hp(v.axisValue,p,m)),p=h1(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=ze(i[0],u),a=ze(i[1],c);else if(qe(i)){var g=i;g.width=f[0],g.height=f[1];var m=Sr(g,{width:u,height:c});n=m.x,a=m.y,h=null,p=null}else if(Ce(i)&&l){var v=UMe(i,d,f,t.get("borderWidth"));n=v[0],a=v[1]}else{var v=IMe(n,a,o,u,c,h?null:20,p?null:20);n=v[0],a=v[1]}if(h&&(n-=pK(h)?f[0]/2:h==="right"?f[0]:0),p&&(a-=pK(p)?f[1]/2:p==="bottom"?f[1]:0),YE(t)){var v=NMe(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){Bt.node||!i.getDom()||(vc(this,"_updatePosition"),this._tooltipContent.dispose(),Hx("itemTooltip",i))},e.type="tooltip",e}(tr);function qx(r,e,t){var i=e.ecModel,n;t?(n=new Kt(t,i,i),n=new Kt(e.option,n,i)):n=e;for(var a=r.length-1;a>=0;a--){var o=r[a];o&&(o instanceof Kt&&(o=o.get("tooltip",!0)),Ce(o)&&(o={formatter:o}),o&&(n=new Kt(o,n,i)))}return n}function hK(r,e){return r.dispatchAction||Be(e.dispatchAction,e)}function IMe(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 NMe(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 UMe(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 pK(r){return r==="center"||r==="middle"}function OMe(r,e,t){var i=c_(r).queryOptionMap,n=i.keys()[0];if(!(!n||n==="series")){var a=Sf(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 dK=PMe;function o3(r){Ot(Bl),r.registerComponentModel(rK),r.registerComponentView(dK),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Ur),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Ur)}var zMe=["rect","polygon","keep","clear"];function s3(r,e){var t=Qt(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),FMe(s),e&&!s.length&&s.push.apply(s,zMe)}}function FMe(r){var e={};N(r,function(t){e[t]=1}),r.length=0,N(e,function(t,i){r.push(i)})}var mK=N;function vK(r){if(r){for(var e in r)if(r.hasOwnProperty(e))return!0}}function Zx(r,e,t){var i={};return mK(e,function(a){var o=i[a]=n();mK(r[a],function(s,l){if(di.isValidType(l)){var u={type:l,visual:s};t&&t(u,a),o[l]=new di(u),l==="opacity"&&(u=Qe(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new di(u))}})}),i;function n(){var a=function(){};a.prototype.__hidden=a.prototype;var o=new a;return o}}function qE(r,e,t){var i;N(t,function(n){e.hasOwnProperty(n)&&vK(e[n])&&(i=!0)}),i&&N(t,function(n){e.hasOwnProperty(n)&&vK(e[n])?r[n]=Qe(e[n]):delete r[n]})}function gK(r,e,t,i,n,a){var o={};N(r,function(f){var h=di.prepareVisualTypes(e[f]);o[f]=h});var s;function l(f){return j_(t,s,f)}function u(f,h){_P(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 yK(r,e,t,i){var n={};return N(r,function(a){var o=di.prepareVisualTypes(e[a]);n[a]=o}),{progress:function(o,s){var l;i!=null&&(l=s.getDimensionIndex(i));function u(M){return j_(s,f,M)}function c(M,S){_P(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 SK(r){var e=r.brushType,t={point:function(i){return _K[e].point(i,t,r)},rect:function(i){return _K[e].rect(i,t,r)}};return t}var _K={lineX:xK(0),lineY:xK(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])&&gc(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(gc(i,n,a)||gc(i,n+o,a)||gc(i,n,a+s)||gc(i,n+o,a+s)||lt.create(r).contain(l[0],l[1])||av(n,a,n+o,a,i)||av(n,a,n,a+s,i)||av(n+o,a,n+o,a+s,i)||av(n,a+s,n+o,a+s,i))return!0}}};function xK(r){var e=["x","y"],t=["width","height"];return{point:function(i,n,a){if(i){var o=a.range,s=i[r];return jx(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(),jx(s[0],o)||jx(s[1],o)||jx(o[0],s)||jx(o[1],s)}}}}function jx(r,e){return e[0]<=r&&r<=e[1]}var MK=["inBrush","outOfBrush"],l3="__ecBrushSelect",u3="__ecInBrushSelectEvent";function c3(r){r.eachComponent({mainType:"brush"},function(e){var t=e.brushTargetManager=new Yx(e.option,r);t.setInputRanges(e.areas,r)})}function f3(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})}),c3(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=GMe[M.brushType],w=Ye({boundingRect:S?S(M):void 0},M);return w.selectors=SK(w),w}),m=Zx(o.option,MK,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||VMe(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){bK(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 bK(M,T,C,E)?(w.dataIndex.push(C.getRawIndex(E)),"inBrush"):"outOfBrush"};(v(S)?d:_(T))&&gK(MK,m,C,b)})}),BMe(e,n,a,i,t)}function BMe(r,e,t,i,n){if(n){var a=r.getZr();if(!a[u3]){a[l3]||(a[l3]=kMe);var o=Vs(a,l3,t,e);o(r,i)}}}function kMe(r,e){if(!r.isDisposed()){var t=r.getZr();t[u3]=!0,r.dispatchAction({type:"brushSelect",batch:e}),t[u3]=!1}}function bK(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 VMe(r,e){var t=r.option.seriesIndex;return t!=null&&t!=="all"&&(pe(t)?dt(t,e)<0:e!==t)}var GMe={rect:function(r){return wK(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&&wK(e)}};function wK(r){return new lt(r[0][0],r[1][0],r[0][1]-r[0][0],r[1][1]-r[1][0])}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.prototype.init=function(t,i){this.ecModel=t,this.api=i,this.model,(this._brushController=new Yv(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){c3(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}(tr),TK=HMe;var WMe="#ddd",XMe=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&&qE(n,t,["inBrush","outOfBrush"]);var a=n.inBrush=n.inBrush||{};n.outOfBrush=n.outOfBrush||{color:WMe},a.hasOwnProperty("liftZ")||(a.liftZ=5)},e.prototype.setAreas=function(t){t&&(this.areas=de(t,function(i){return EK(this.option,i)},this))},e.prototype.setBrushOption=function(t){this.brushOption=EK(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}(Nt);function EK(r,e){return xt({brushType:r.brushType,brushMode:r.brushMode,transformable:r.transformable,brushStyle:new Kt(r.brushStyle).getItemStyle(),removeOnClick:r.removeOnClick,z:r.z},e,!0)}var AK=XMe;var YMe=["rect","polygon","lineX","lineY","keep","clear"],qMe=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:YMe.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}(en),CK=qMe;function h3(r){r.registerComponentView(TK),r.registerComponentModel(AK),r.registerPreprocessor(s3),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,f3),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"},Ur),r.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},Ur),ih("brush",CK)}var ZMe=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}(Nt),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.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 It({style:fr(o,{text:t.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),f=c.getBoundingRect(),h=t.get("subtext"),p=new It({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(){Wp(d,"_"+t.get("target"))}),g&&p.on("click",function(){Wp(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=Sr(_,{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 Et({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}(tr);function p3(r){r.registerComponentModel(ZMe),r.registerComponentView(jMe)}var KMe=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=Kr(yl(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 ai([{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}(Nt),d3=KMe;var RK=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=Xn(d3.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}(d3);wr(RK,mv.prototype);var LK=RK;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.type="timeline",e}(tr),DK=JMe;var $Me=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}(mn),PK=$Me;var m3=Math.PI,IK=vt(),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.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 kr("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=tbe(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:m3/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*m3/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=Ei(),l=o.x,u=o.y+o.height;Sn(s,s,[-l,-u]),Oa(s,s,-m3/2),Sn(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=ebe(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 PK("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 ei({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 ei({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=NK(f,h,i,g);m.ensureState("emphasis").style=p.getItemStyle(),m.ensureState("progress").style=d.getItemStyle(),du(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 It({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),du(v),IK(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=Mn(ft(a.get(["controlStyle",d+"BtnSize"]),o),o),_=[0,-v/2,v,v],y=rbe(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),du(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),UK(f,u._progressLine,s,n,a,!0)},onUpdate:function(f){UK(f,u._progressLine,s,n,a)}};this._currentPointer=NK(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=Ai(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 En(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",IK(n[a]).dataIndex<=t)},e.type="timeline.slider",e}(DK);function ebe(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new cx({ordinalMeta:r.getCategories(),extent:[1/0,-1/0]});case"time":return new uT({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new Ja}}function tbe(r,e){return Sr(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()},r.get("padding"))}function rbe(r,e,t,i){var n=i.style,a=uc(r.get(["controlStyle",e]),i||{},new lt(t[0],t[1],t[2],t[3]));return n&&a.setStyle(n),a}function NK(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=Mr(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=xt({rectHover:!0,z2:100},i,!0);var u=Rl(r.get("symbolSize"));i.scaleX=u[0]/2,i.scaleY=u[1]/2;var c=Co(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 UK(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 OK=QMe;function zK(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 v3(r){var e=r&&r.timeline;pe(e)||(e=e?[e]:[]),N(e,function(t){t&&ibe(t)})}function ibe(r){var e=r.type,t={number:"value",time:"time"};if(t[e]&&(r.axisType=t[e],delete r.type),FK(r),vd(r,"controlPosition")){var i=r.controlStyle||(r.controlStyle={});vd(i,"position")||(i.position=r.controlPosition),i.position==="none"&&!vd(i,"show")&&(i.show=!1,delete i.position),delete r.controlPosition}N(r.data||[],function(n){qe(n)&&!pe(n)&&(!vd(n,"value")&&vd(n,"name")&&(n.value=n.name),FK(n))})}function FK(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]&&!vd(n,s)&&(n[s]=o)}),t.label&&!vd(i,"emphasis")&&(i.emphasis=t.label,delete t.label)}function vd(r,e){return r.hasOwnProperty(e)}function g3(r){r.registerComponentModel(LK),r.registerComponentView(OK),r.registerSubTypeDefaulter("timeline",function(){return"slider"}),zK(r),r.registerPreprocessor(v3)}function gd(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 jE(r){bo(r,"label",["show"])}var KE=vt(),BK=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(Bt.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=KE(s)[o];if(!l||!l.data){KE(s)[o]=null;return}u?u._mergeOption(l,i,!0):(a&&jE(l),N(l.data,function(c){c instanceof Array?(jE(c[0]),jE(c[1])):jE(c)}),u=this.createMarkerModelFromSeries(l,this,i),fe(u,{mainType:this.mainType,seriesIndex:s.seriesIndex,name:s.name,createdBySelf:!0}),u.__hostSeries=s),KE(s)[o]=u},this)},e.prototype.formatTooltip=function(t,i,n){var a=this.getData(),o=this.getRawValue(t),s=a.getName(t);return kr("section",{header:this.name,blocks:[kr("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 KE(t)[i]},e.type="marker",e.dependencies=["series","grid","polar","geo"],e}(Nt);wr(BK,mv.prototype);var ga=BK;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.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}(ga),kK=nbe;function _3(r){return!(isNaN(parseFloat(r.x))&&isNaN(parseFloat(r.y)))}function abe(r){return!isNaN(parseFloat(r.x))&&!isNaN(parseFloat(r.y))}function JE(r,e,t,i,n,a){var o=[],s=Ro(e,i),l=s?e.getCalculationInfo("stackResultDimension"):i,u=QE(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=bn(e.get(i,c));return h=Math.min(h,20),h>=0&&(o[a]=+o[a].toFixed(h)),[o,f]}var y3={min:ot(JE,"min"),max:ot(JE,"max"),average:ot(JE,"average"),median:ot(JE,"median")};function ah(r,e){if(e){var t=r.getData(),i=r.coordinateSystem,n=i&&i.dimensions;if(!abe(e)&&!pe(e.coord)&&pe(n)){var a=x3(e,t,i,r);if(e=Qe(e),e.type&&y3[e.type]&&a.baseAxis&&a.valueAxis){var o=dt(n,a.baseAxis.dim),s=dt(n,a.valueAxis.dim),l=y3[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++)y3[u[c]]&&(u[c]=QE(t,t.mapDimension(n[c]),u[c]));return e}}function x3(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(obe(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 obe(r,e){var t=r.getData().getDimensionInfo(e);return t&&t.coordDim}function oh(r,e){return r&&r.containData&&e.coord&&!_3(e)?r.containData(e.coord):!0}function VK(r,e,t){return r&&r.containZone&&e.coord&&t.coord&&!_3(e)&&!_3(t)?r.containZone(e.coord,t.coord):!0}function $E(r,e){return r?function(t,i,n,a){var o=a<2?t.coord&&t.coord[a]:t.value;return ks(o,e[a])}:function(t,i,n,a){return ks(t.value,e[a])}}function QE(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 M3=vt(),sbe=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){M3(s).keep=!1}),i.eachSeries(function(s){var l=ga.getMarkerModelFromSeries(s,a.type);l&&a.renderSeries(s,l,i,n)}),o.each(function(s){!M3(s).keep&&a.group.remove(s.group)})},e.prototype.markKeep=function(t){M3(t).keep=!0},e.prototype.toggleBlurSeries=function(t,i){var n=this;N(t,function(a){var o=ga.getMarkerModelFromSeries(a,n.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(i?Fw(l):x_(l))})}})},e.type="marker",e}(tr),ng=sbe;function GK(r,e,t){var i=e.coordinateSystem;r.each(function(n){var a=r.getItemModel(n),o,s=ze(a.get("x"),t.getWidth()),l=ze(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 lbe=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=ga.getMarkerModelFromSeries(a,"markPoint");o&&(GK(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 wu),f=ube(o,t,i);i.setData(f),GK(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=yu(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}(ng);function ube(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 ai(i,t),a=de(t.get("data"),ot(ah,e));r&&(a=Yt(a,ot(oh,r)));var o=$E(!!r,i);return n.initData(a,null,o),n}var HK=lbe;function b3(r){r.registerComponentModel(kK),r.registerComponentView(HK),r.registerPreprocessor(function(e){gd(e.series,"markPoint")&&(e.markPoint=e.markPoint||{})})}var cbe=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}(ga),WK=cbe;var eA=vt(),fbe=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=Hr(i.yAxis,i.xAxis);else{var u=x3(i,n,e,r);s=u.valueAxis;var c=iT(n,u.valueDataDim);l=QE(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&&Ct(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=[ah(r,a[0]),ah(r,a[1]),fe({},a[2])];return m[2].type=m[2].type||null,xt(m[2],m[0]),xt(m[2],m[1]),m};function tA(r){return!isNaN(r)&&!isFinite(r)}function XK(r,e,t,i){var n=1-r,a=i.dimensions[r];return tA(e[n])&&tA(t[n])&&e[r]===t[r]&&i.getAxis(a).containData(e[r])}function hbe(r,e){if(r.type==="cartesian2d"){var t=e[0].coord,i=e[1].coord;if(t&&i&&(XK(1,t,i,r)||XK(0,t,i,r)))return!0}return oh(r,e[0])&&oh(r,e[1])}function w3(r,e,t,i,n){var a=i.coordinateSystem,o=r.getItemModel(e),s,l=ze(o.get("x"),n.getWidth()),u=ze(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(Ws(a,"cartesian2d")){var p=a.getAxis("x"),d=a.getAxis("y"),c=a.dimensions;tA(r.get(c[0],e))?s[0]=p.toGlobalCoord(p.getExtent()[t?0:1]):tA(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 pbe=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=ga.getMarkerModelFromSeries(a,"markLine");if(o){var s=o.getData(),l=eA(o).from,u=eA(o).to;l.each(function(c){w3(l,c,!0,a,n),w3(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 Vv);this.group.add(c.group);var f=dbe(o,t,i),h=f.from,p=f.to,d=f.line;eA(i).from=h,eA(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);w3(x,M,S,t,a);var T=w.getModel("itemStyle").getItemStyle();T.fill==null&&(T.fill=yu(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}(ng);function dbe(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 ai(i,t),a=new ai(i,t),o=new ai([],t),s=de(t.get("data"),ot(fbe,e,r,t));r&&(s=Yt(s,ot(hbe,r)));var l=$E(!!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 YK=pbe;function T3(r){r.registerComponentModel(WK),r.registerComponentView(YK),r.registerPreprocessor(function(e){gd(e.series,"markLine")&&(e.markLine=e.markLine||{})})}var mbe=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}(ga),qK=mbe;var rA=vt(),vbe=function(r,e,t,i){var n=i[0],a=i[1];if(!(!n||!a)){var o=ah(r,n),s=ah(r,a),l=o.coord,u=s.coord;l[0]=Hr(l[0],-1/0),l[1]=Hr(l[1],-1/0),u[0]=Hr(u[0],1/0),u[1]=Hr(u[1],1/0);var c=wm([{},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 iA(r){return!isNaN(r)&&!isFinite(r)}function ZK(r,e,t,i){var n=1-r;return iA(e[n])&&iA(t[n])}function gbe(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 Ws(r,"cartesian2d")?t&&i&&(ZK(1,t,i,r)||ZK(0,t,i,r))?!0:VK(r,n,a):oh(r,n)||oh(r,a)}function jK(r,e,t,i,n){var a=i.coordinateSystem,o=r.getItemModel(e),s,l=ze(o.get(t[0]),n.getWidth()),u=ze(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(Ws(a,"cartesian2d")){var _=a.getAxis("x"),y=a.getAxis("y"),g=r.get(t[0],e),m=r.get(t[1],e);iA(g)?s[0]=_.toGlobalCoord(_.getExtent()[t[0]==="x0"?0:1]):iA(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 KK=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],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.prototype.updateTransform=function(t,i,n){i.eachSeries(function(a){var o=ga.getMarkerModelFromSeries(a,"markArea");if(o){var s=o.getData();s.each(function(l){var u=de(KK,function(f){return jK(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=_be(o,t,i);i.setData(f),f.each(function(h){var p=de(KK,function(T){return jK(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))];Ai(_),Ai(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=yu(l,"color");S.fill||(S.fill=w,Ce(S.fill)&&(S.fill=dp(S.fill,.4))),S.stroke||(S.stroke=w),f.setItemVisual(h,"style",S)}),f.diff(rA(c).data).add(function(h){var p=f.getItemLayout(h);if(!p.allClipped){var d=new ni({shape:{points:p.points}});f.setItemGraphicEl(h,d),c.group.add(d)}}).update(function(h,p){var d=rA(c).data.getItemGraphicEl(p),g=f.getItemLayout(h);g.allClipped?d&&c.group.remove(d):(d?Ut(d,{shape:{points:g.points}},i,h):d=new ni({shape:{points:g.points}}),f.setItemGraphicEl(h,d),c.group.add(d))}).remove(function(h){var p=rA(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")),Or(h,Tr(d),{labelFetcher:i,labelDataIndex:p,defaultText:f.getName(p)||"",inheritColor:Ce(g.fill)?dp(g.fill,1):"#000"}),Yr(h,d),ar(h,null,null,d.get(["emphasis","disabled"])),rt(h).dataModel=i}),rA(c).data=f,c.group.silent=i.get("silent")||t.get("silent")},e.type="markArea",e}(ng);function _be(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 ai(n,t)}else n=[{name:"value",type:"float"}],i=new ai(n,t);var s=de(t.get("data"),ot(vbe,e,r,t));r&&(s=Yt(s,ot(gbe,r)));var l=r?function(u,c,f,h){var p=u.coord[Math.floor(h/2)][h%2];return ks(p,n[h])}:function(u,c,f,h){return ks(u.value,n[h])};return i.initData(s,null,l),i.hasItemOption=!0,i}var JK=ybe;function E3(r){r.registerComponentModel(qK),r.registerComponentView(JK),r.registerPreprocessor(function(e){gd(e.series,"markArea")&&(e.markArea=e.markArea||{})})}var xbe=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"])}},Sbe=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]=xt(a,xbe(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&&Xm(l)&&i.push(l.name)}),this._availableNames=n;var a=this.get("data")||i,o=ke(),s=de(a,function(l){return(Ce(l)||Ct(l))&&(l={name:l}),o.get(l.name)?null:(o.set(l.name,!0),new Kt(l,this,this.ecModel))},this);this._data=Yt(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}(Nt),Kx=Sbe;var ag=ot,A3=N,nA=Ze,Mbe=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 nA),this.group.add(this._selectorGroup=new nA),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=Sr(c,f,h),d=this.layoutInner(t,o,p,a,l,u),g=Sr(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=HE(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)}),A3(i.getData(),function(p,d){var g=p.get("name");if(!this.newlineDisabled&&(g===""||g===`
  2229. `)){var m=new nA;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",ag($K,g,null,a,h)).on("mouseover",ag(C3,v.name,null,a,h)).on("mouseout",ag(R3,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=hn(b.fill);I&&I[3]===0&&(I[3]=.2,b=fe(fe({},b),{fill:Ps(I,"rgba")}));var R=this._createItem(w,g,d,p,i,t,{},b,E,f,a);R.on("click",ag($K,null,g,a,h)).on("mouseover",ag(C3,null,g,a,h)).on("mouseout",ag(R3,null,g,a,h)),n.ssr&&R.eachChild(function(A){var P=rt(A);P.seriesIndex=w.seriesIndex,P.dataIndex=d,P.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();A3(t,function(u){var c=u.type,f=new It({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"]);Or(f,{normal:h,emphasis:p},{defaultText:u.title}),du(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=bbe(c,a,l,u,p,m,h),M=new nA,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(wbe({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 It({style:fr(S,{text:E,x:T,y:g/2,fill:I,align:C,verticalAlign:"middle"},{inheritColor:I})}));var R=new Et({shape:M.getBoundingRect(),style:{fill:"transparent"}}),A=a.getModel("tooltip");return A.get("show")&&bl({el:R,componentModel:o,itemName:i,itemTooltipOption:A.option}),M.add(R),M.eachChild(function(P){P.silent=!0}),R.silent=!f,this.getContentGroup().add(M),du(M),M.__legendDataIndex=n,M},e.prototype.layoutInner=function(t,i,n,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();El(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){El("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}(tr);function bbe(r,e,t,i,n,a,o){function s(m,v){m.lineWidth==="auto"&&(m.lineWidth=v.lineWidth>0?2:0),A3(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:Ll(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 wbe(r){var e=r.icon||"roundRect",t=Mr(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 $K(r,e,t,i){R3(r,e,t,i),t.dispatchAction({type:"legendToggleSelect",name:r??e}),C3(r,e,t,i)}function QK(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 C3(r,e,t,i){QK(t)||t.dispatchAction({type:"highlight",seriesName:r,name:e,excludeSeriesId:i})}function R3(r,e,t,i){QK(t)||t.dispatchAction({type:"downplay",seriesName:r,name:e,excludeSeriesId:i})}var aA=Mbe;function L3(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 Jx(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 eJ(r){r.registerAction("legendToggleSelect","legendselectchanged",ot(Jx,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",ot(Jx,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",ot(Jx,"inverseSelect")),r.registerAction("legendSelect","legendselected",ot(Jx,"select")),r.registerAction("legendUnSelect","legendunselected",ot(Jx,"unSelect"))}function oA(r){r.registerComponentModel(Kx),r.registerComponentView(aA),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,L3),r.registerSubTypeDefaulter("legend",function(){return"plain"}),eJ(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.prototype.setScrollDataIndex=function(t){this.option.scrollDataIndex=t},e.prototype.init=function(t,i,n){var a=Fs(t);r.prototype.init.call(this,t,i,n),tJ(this,t,a)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),tJ(this,this.option,t)},e.type="legend.scroll",e.defaultOption=Xn(Kx.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}(Kx);function tJ(r,e,t){var i=r.getOrient(),n=[1,1];n[i.index]=0,Ya(e,t,{type:"box",ignoreSize:!!n})}var rJ=Tbe;var iJ=Ze,D3=["width","height"],P3=["x","y"],Ebe=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 iJ),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new iJ)},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 It({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",_=uc(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=D3[u],f=P3[u],h=D3[1-u],p=P3[1-u];o&&El("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;El(t.get("orient"),c,t.get("itemGap"),a?n.width:null,a?null:n.height),El("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 Et({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&&Ut(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=D3[o],l=P3[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}(aA),nJ=Ebe;function I3(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 aJ(r){Ot(oA),r.registerComponentModel(rJ),r.registerComponentView(nJ),I3(r)}function N3(r){Ot(oA),Ot(aJ)}var Abe=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=Xn(rh.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e}(rh),oJ=Abe;var U3=vt();function sJ(r,e,t){U3(r).coordSysRecordMap.each(function(i){var n=i.dataZoomInfoMap.get(e.uid);n&&(n.getRange=t)})}function lJ(r,e){for(var t=U3(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||uJ(t,o))}}}function uJ(r,e){if(e){r.removeKey(e.model.uid);var t=e.controller;t&&t.dispose()}}function Cbe(r,e){var t={model:e,containsPoint:ot(Lbe,e),dispatchAction:ot(Rbe,r),dataZoomInfoMap:null,controller:null},i=t.controller=new Cu(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 Rbe(r,e){r.isDisposed()||r.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:e})}function Lbe(r,e,t,i){return r.coordinateSystem.containPoint([t,i])}function Dbe(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 cJ(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var i=U3(t),n=i.coordSysRecordMap||(i.coordSysRecordMap=ke());n.each(function(a){a.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=VE(a);N(o.infoList,function(s){var l=s.model.uid,u=n.get(l)||n.set(l,Cbe(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){uJ(n,a);return}var c=Dbe(l);o.enable(c.controlType,c.opt),o.setPointerChecker(a.containsPoint),Vs(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var Ibe=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(),sJ(n,t,{pan:Be(O3.pan,this),zoom:Be(O3.zoom,this),scrollMove:Be(O3.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){lJ(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e}(tg),O3={zoom:function(r,e,t,i){var n=this.range,a=n.slice(),o=r.axisModels[0];if(o){var s=z3[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(Qa(0,a,[0,100],0,c.minSpan,c.maxSpan),this.range=a,n[0]!==a[0]||n[1]!==a[1])return a}},pan:fJ(function(r,e,t,i,n,a){var o=z3[i]([a.oldX,a.oldY],[a.newX,a.newY],e,n,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:fJ(function(r,e,t,i,n,a){var o=z3[i]([0,0],[a.scrollDelta,a.scrollDelta],e,n,t);return o.signal*(r[1]-r[0])*a.scrollDelta})};function fJ(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(Qa(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var z3={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}},hJ=Ibe;function $x(r){md(r),r.registerComponentModel(oJ),r.registerComponentView(hJ),cJ(r)}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.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=Xn(rh.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}(rh),pJ=Nbe;var Qx=Et,dJ=7,Ube=1,F3=30,Obe=7,eS="horizontal",mJ="vertical",zbe=5,Fbe=["line","bar","candlestick","scatter"],Bbe={easing:"cubicOut",duration:100,delay:0},kbe=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),Vs(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(){vc(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?Obe:0,o=this._findCoordRect(),s={width:i.getWidth(),height:i.getHeight()},l=this._orient===eS?{right:s.width-o.x-o.width,top:s.height-F3-dJ-a,width:o.width,height:F3}:{right:dJ,top:o.y,width:F3,height:o.height},u=Fs(t.option);N(["right","top","width","height"],function(f){u[f]==="ph"&&(u[f]=l[f])});var c=Sr(u,s);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===mJ&&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===eS&&!o?{scaleY:l?1:-1,scaleX:1}:n===eS&&o?{scaleY:l?1:-1,scaleX:-1}:n===mJ&&!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:ir(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 ni({shape:{points:u},segmentIgnoreThreshold:1,style:b.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),R=new ri({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(Fbe,u.get("type"))<0)){var c=a.getComponent(Ks(o),s).axis,f=Vbe(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:Ube,fill:"rgba(0,0,0,0)"}})),N([0,1],function(y){var x=l.get("handleIcon");!K_[x]&&x.indexOf("path://")<0&&x.indexOf("image://")<0&&(x="path://"+x);var M=Mr(x,-1,0,2,2,null,!0);M.attr({cursor:vJ(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=ze(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(),du(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 It({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=ze(l.get("moveHandleSize"),s[1]),g=i.moveHandle=new Et({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=Mr(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 Et({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:vJ(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=[ir(t[0],[0,100],i,!0),ir(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];Qa(i,a,o,n.get("zoomLock")?"all":t,s.minSpan!=null?ir(s.minSpan,l,o,!0):null,s.maxSpan!=null?ir(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Ai([ir(a[0],o,l,!0),ir(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=Ai(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 Et,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=Ai(this._handleEnds.slice());p.call(this,0),p.call(this,1);function p(d){var g=Ml(n.handles[d].parent,this.group),m=Bp(d===0?"right":"left",g),v=this._handleWidth/2+zbe,_=En([h[d]+(d===0?-v:v),this._size[1]/2],g);a[d].setStyle({x:_[0],y:_[1],verticalAlign:o===eS?"middle":m,align:o===eS?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,Na(a.event);var o=this._displayables.sliderGroup.getLocalTransform(),s=En([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 zt(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=Ai([ir(n.x,o,s,!0),ir(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&&(Na(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?Bbe:null,start:i[0],end:i[1]})},e.prototype._findCoordRect=function(){var t,i=VE(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}(tg);function Vbe(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function vJ(r){return r==="vertical"?"ns-resize":"ew-resize"}var gJ=kbe;function tS(r){r.registerComponentModel(pJ),r.registerComponentView(gJ),md(r)}function B3(r){Ot($x),Ot(tS)}var Gbe={get:function(r,e,t){var i=Qe((Hbe[r]||{})[e]);return t&&pe(i)?i[i.length-1]:i}},Hbe={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]}},sA=Gbe;var yJ=di.mapVisual,Wbe=di.eachVisual,Xbe=pe,_J=N,Ybe=Ai,qbe=ir,Zbe=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&&qE(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=Zx(this.option.controller,i,t),this.targetVisuals=Zx(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=Qt(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=Ybe([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={});xt(a,n),xt(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){Xbe(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]={},_J(d,function(m,v){if(di.isValidType(v)){var _=sA.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";_J(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=yJ(y.symbol,function(S){return S==="none"?m:S});var x=y.symbolSize;if(x!=null){var M=-1/0;Wbe(x,function(S){S>M&&(M=S)}),y.symbolSize=yJ(x,function(S){return qbe(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}(Nt),og=Zbe;var xJ=[20,140],jbe=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]=xJ[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=xJ[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=Ai((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=SJ(this,"outOfRange",this.getExtent()),n=SJ(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=Xn(og.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}(og);function SJ(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 MJ=jbe;var Kbe=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=wl(i.get("padding")||0),a=t.getBoundingRect();t.add(new Et({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=di.prepareVisualTypes(f);return N(h,function(p){var d=f[p];n.convertOpacityToAlpha&&p==="opacity"&&(p="colorAlpha",d=f.__alphaForOpacity),di.dependsOn(p,i)&&d&&d.applyVisual(t,u,c)}),s[i]},e.prototype.positionGroup=function(t){var i=this.visualMapModel,n=this.api;Lf(t,i.getBoxLayoutParams(),{width:n.getWidth(),height:n.getHeight()})},e.prototype.doRender=function(t,i,n,a){},e.type="visualMap",e}(tr),lA=Kbe;var bJ=[["left","right","width"],["top","bottom","height"]];function uA(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=bJ[o],l=[0,null,10],u={},c=0;c<3;c++)u[bJ[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=Sr(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 sg(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 Du=ir,Jbe=N,TJ=Math.min,k3=Math.max,$be=12,Qbe=6,ewe=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 It({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=uA(i,this.api,a),u=n.mainGroup=this._createBarGroup(l),c=new Ze;u.add(c),c.add(n.outOfRange=EJ()),c.add(n.inRange=EJ(null,s?CJ(this._orient):null,Be(this._dragHandle,this,"all",!1),Be(this._dragHandle,this,"all",!0))),c.setClipPath(new Et({shape:{x:0,y:0,width:a[0],height:a[1],r:3}}));var f=i.textStyleModel.getTextRect("\u56FD"),h=k3(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=Mn(t.get("handleSize"),a[0]),f=Mr(t.get("handleIcon"),-c/2,-c/2,c,c,null,!0),h=CJ(this._orient);f.attr({cursor:h,draggable:!0,drift:l,ondragend:u,onmousemove:function(v){Na(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(),nc(f,!0),i.add(f);var p=this.visualMapModel.textStyleModel,d=new It({cursor:h,draggable:!0,drift:l,onmousemove:function(v){Na(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=Mn(t.get("indicatorSize"),n[0]),l=Mr(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 Br){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 It({silent:!0,invisible:!0,style:fr(f,{x:0,y:0,text:""})});this.group.add(h);var p=[(o==="horizontal"?a/2:Qbe)+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():AJ(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=[Du(i[0],n,a,!0),Du(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]];Qa(i,a,o,t,0);var s=n.getExtent();this._dataInterval=[Du(a[0],o,s,!0),Du(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 vu(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();Jbe([0,1],function(c){var f=o[c];f.setStyle("fill",i.handlesColor[c]),f.y=t[c];var h=Du(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=En(n.handleLabelPoints[c],Ml(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=Du(t,s,u,!0),m=l[0]-d/2,v={x:f.x,y:f.y};f.y=g,f.x=m;var _=En(c.indicatorLabelPoint,Ml(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]=TJ(k3(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=TJ(k3(o[0],t),o[1]);var l=twe(n,s,o),u=[t-l,t+l],c=Du(t,o,s,!0),f=[Du(u[0],o,s,!0),Du(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||AJ(n))&&(p=this._hoverLinkDataIndices=n.findTargetDataIndices(f));var d=vH(h,p);this._dispatchHighDown("downplay",sg(d[0],n)),this._dispatchHighDown("highlight",sg(d[1],n))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var i;if(Cl(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",sg(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=Ml(i,a?null:this.group);return pe(t)?En(t,o,n):Bp(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}(lA);function EJ(r,e,t,i){return new ni({shape:{points:r},draggable:!!t,cursor:e,drift:t,onmousemove:function(n){Na(n.event)},ondragend:i})}function twe(r,e,t){var i=$be/2,n=r.get("hoverLinkDataSize");return n&&(i=Du(n,e,t,!0)/2),i}function AJ(r){var e=r.get("hoverLinkOnHandle");return!!(e??r.get("realtime"))}function CJ(r){return r==="vertical"?"ns-resize":"ew-resize"}var RJ=ewe;var LJ={type:"selectDataRange",event:"dataRangeSelected",update:"update"},DJ=function(r,e){e.eachComponent({mainType:"visualMap",query:r},function(t){t.setSelected(r.selected)})};var PJ=[{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(yK(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(rwe,null,r,n))||{stops:[],outerColors:[]},o=n.getDataDimensionIndex(t);o>=0&&(a.dimension=o,i.push(a))}}),r.getData().setVisual("visualMeta",i)}}];function rwe(r,e,t,i){for(var n=e.targetVisuals[i],a=di.prepareVisualTypes(n),o={color:yu(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 IJ=N;function V3(r){var e=r&&r.visualMap;pe(e)||(e=e?[e]:[]),IJ(e,function(t){if(t){lg(t,"splitList")&&!lg(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var i=t.pieces;i&&pe(i)&&IJ(i,function(n){qe(n)&&(lg(n,"start")&&!lg(n,"min")&&(n.min=n.start),lg(n,"end")&&!lg(n,"max")&&(n.max=n.end))})}})}function lg(r,e){return r&&r.hasOwnProperty&&r.hasOwnProperty(e)}var NJ=!1;function rS(r){NJ||(NJ=!0,r.registerSubTypeDefaulter("visualMap",function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(LJ,DJ),N(PJ,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor(V3))}function iS(r){r.registerComponentModel(MJ),r.registerComponentView(RJ),rS(r)}var iwe=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=[],nwe[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=di.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]=sA.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=di.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=di.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=Xn(og.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}(og),nwe={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]}),l_(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),UJ(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=di.retrieveVisuals(t),r.push(n)},this),UJ(e,r),l_(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 UJ(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var OJ=iwe;var awe=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=Hr(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 It({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),El(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:sg(s.findTargetDataIndices(i),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,i=t.option;if(i.orient==="vertical")return uA(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 It({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(Mr(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}(lA),zJ=awe;function nS(r){r.registerComponentModel(OJ),r.registerComponentView(zJ),rS(r)}function G3(r){Ot(iS),Ot(nS)}var owe={label:{enabled:!0},decal:{show:!1}},FJ=vt(),swe={};function H3(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var i=Qe(owe);xt(i.label,r.getLocaleModel().get("aria"),!1),xt(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)),FJ(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 _=z_(h.ecModel,h.name,swe,r.getSeriesCount()),y=p.getVisual("decal");p.setVisual("decal",x(y,_))}else{var d=h.getRawData(),g={},m=FJ(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=z_(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 P=c.get(["data","separator","middle"]),U=c.get(["data","separator","end"]),B=[],z=0;z<R.count();z++)if(z<p){var k=R.getName(z),G=R.getValues(z),Y=c.get(["data",k?"withName":"withoutName"]);B.push(o(Y,{name:k,value:G.join(P)}))}b+=B.join(P)+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 W3(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 X3(r){r.registerPreprocessor(W3),r.registerVisual(r.PRIORITY.VISUAL.ARIA,H3)}var BJ={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},lwe=function(){function r(e){var t=this._condVal=Ce(e)?new RegExp(e):XV(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):Ct(t)?this._condVal.test(e+""):!1},r}(),uwe=function(){function r(){}return r.prototype.evaluate=function(){return this.value},r}(),cwe=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}(),fwe=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}(),hwe=function(){function r(){}return r.prototype.evaluate=function(){return!this.child.evaluate()},r}(),pwe=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 Y3(r,e){if(r===!0||r===!1){var t=new uwe;return t.value=r,t}var i="";return VJ(r)||ur(i),r.and?kJ("and",r,e):r.or?kJ("or",r,e):r.not?dwe(r,e):mwe(r,e)}function kJ(r,e,t){var i=e[r],n="";pe(i)||ur(n),i.length||ur(n);var a=r==="and"?new cwe:new fwe;return a.children=de(i,function(o){return Y3(o,t)}),a.children.length||ur(n),a}function dwe(r,e){var t=r.not,i="";VJ(t)||ur(i);var n=new hwe;return n.child=Y3(t,e),n.child||ur(i),n}function mwe(r,e){for(var t="",i=e.prepareGetValue(r),n=[],a=wt(r),o=r.parser,s=o?T1(o):null,l=0;l<a.length;l++){var u=a[l];if(!(u==="parser"||e.valueGetterAttrMap.get(u))){var c=tt(BJ,u)?BJ[u]:u,f=r[u],h=s?s(f):f,p=sW(c,h)||c==="reg"&&new lwe(h);p||ur(t),n.push(p)}}n.length||ur(t);var d=new pwe;return d.valueGetterParam=i,d.valueParser=s,d.getValue=e.getValue,d.subCondList=n,d}function VJ(r){return qe(r)&&!fi(r)}var vwe=function(){function r(e,t){this._cond=Y3(e,t)}return r.prototype.evaluate=function(){return this._cond.evaluate()},r}();function GJ(r,e){return new vwe(r,e)}var HJ={type:"echarts:filter",transform:function(r){for(var e=r.upstream,t,i=GJ(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 WJ={type:"echarts:sort",transform:function(r){var e=r.upstream,t=r.config,i="",n=Qt(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?T1(p):null;p&&!_&&ur(i),a.push({dimIdx:v.index,parser:_,comparator:new E1(h,d)})});var o=e.sourceFormat;o!==Ci&&o!==Cn&&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 q3(r){r.registerTransform(HJ),r.registerTransform(WJ)}var gwe=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 R1(this),uP(this)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),uP(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:qa},e}(Nt);var ywe=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}(tr);function Z3(r){r.registerComponentModel(gwe),r.registerComponentView(ywe)}var Pu=$i.CMD;function ug(r,e){return Math.abs(r-e)<1e-5}function cA(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,P,U){ug(R,P)&&ug(A,U)||n.push(R,A,P,U,P,U)}function f(R,A,P,U,B,z){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+P,ve=Q*z+U,ue=V*B+P,se=K*z+U,Ee=B*G*Y,q=z*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===Pu.L||v===Pu.C||v===Pu.Q)&&(n=[s,l])),v){case Pu.M:a=s=e[m++],o=l=e[m++],u(s,l);break;case Pu.L:h=e[m++],p=e[m++],c(a,o,h,p),a=h,o=p;break;case Pu.C:n.push(e[m++],e[m++],e[m++],e[m++],a=e[m++],o=e[m++]);break;case Pu.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 Pu.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 Pu.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 Pu.Z:n&&c(a,o,s,l),a=s,o=l;break}}return n&&n.length>2&&i.push(n),i}function j3(r,e,t,i,n,a,o,s,l,u){if(ug(r,t)&&ug(e,i)&&ug(n,o)&&ug(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=[];Ls(r,t,n,o,.5,C),Ls(e,i,a,s,.5,b),j3(C[0],b[0],C[1],b[1],C[2],b[2],C[3],b[3],l,u),j3(C[4],b[4],C[5],b[5],C[6],b[6],C[7],b[7],l,u)}function XJ(r,e){var t=cA(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++];j3(s,l,c,f,h,p,d,g,o,e),s=d,l=g}i.push(o)}return i}function jJ(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 YJ(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=jJ([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 _we(r,e,t){for(var i=r.width,n=r.height,a=i>n,o=jJ([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 qJ(r,e,t,i){return r*i-t*e}function xwe(r,e,t,i,n,a,o,s){var l=t-r,u=i-e,c=o-n,f=s-a,h=qJ(c,f,l,u);if(Math.abs(h)<1e-6)return null;var p=r-n,d=e-a,g=qJ(p,d,c,f)/h;return g<0||g>1?null:new zt(g*l+r,g*u+e)}function Swe(r,e,t){var i=new zt;zt.sub(i,t,e),i.normalize();var n=new zt;zt.sub(n,r,e);var a=n.dot(i);return a}function cg(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function Mwe(r,e,t){for(var i=r.length,n=[],a=0;a<i;a++){var o=r[a],s=r[(a+1)%i],l=xwe(o[0],o[1],s[0],s[1],e.x,e.y,t.x,t.y);l&&n.push({projPt:Swe(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++)cg(d,r[a].slice());cg(d,p),cg(d,h);for(var a=c.idx+1;a<=u.idx+i;a++)cg(g,r[a%i].slice());return cg(g,h),cg(g,p),[{points:d},{points:g}]}function ZJ(r){var e=r.points,t=[],i=[];Ep(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 zt,c=new zt;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),Mwe(e,u,c)}function fA(r,e,t,i){if(t===1)i.push(e);else{var n=Math.floor(t/2),a=r(e);fA(r,a[0],n,i),fA(r,a[1],t-n,i)}return i}function bwe(r,e){for(var t=[],i=0;i<e;i++)t.push(ev(r));return t}function wwe(r,e){e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel}function Twe(r){for(var e=[],t=0;t<r.length;)e.push([r[t++],r[t++]]);return e}function KJ(r,e){var t=[],i=r.shape,n;switch(r.type){case"rect":_we(i,e,t),n=Et;break;case"sector":YJ(i,e,t),n=xi;break;case"circle":YJ({r0:0,r:i.r,startAngle:0,endAngle:Math.PI*2,cx:i.cx,cy:i.cy},e,t),n=xi;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(XJ(r.getUpdatedPathProxy(),o),function(v){return Twe(v)}),l=s.length;if(l===0)fA(ZJ,{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=[];Ep(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||(fA(ZJ,{points:p.poly},d,t),h-=d)}}n=ni;break}if(!n)return bwe(r,e);for(var g=[],u=0;u<t.length;u++){var m=new n;m.setShape(t[u]),wwe(r,m),g.push(m)}return g}function Ewe(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;Ls(d,m,_,x,T,n),Ls(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 JJ(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 Awe(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=Ewe(l,u),c=t[0],f=t[1],i=c,n=f):(f=JJ(n||l,l),c=l):(c=JJ(i||u,u),f=u),a.push(c),o.push(f)}return[a,o]}function $J(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 Cwe(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 Rwe(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 Lwe(r,e,t,i){for(var n=[],a,o=0;o<r.length;o++){var s=r[o],l=e[o],u=$J(s),c=$J(l);a==null&&(a=u[2]<0!=c[2]<0);var f=[],h=[],p=0,d=1/0,g=[],m=s.length;a&&(s=Rwe(s));for(var v=Cwe(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,P=I*w+R*T;g[y]=A,g[y+1]=P;var U=A-b,B=P-E;C+=U*U+B*B}if(C<d){d=C,p=S;for(var z=0;z<g.length;z++)h[z]=g[z]}}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 oS(r){return r.__isCombineMorphing}var e$="__mOriginal_";function hA(r,e,t){var i=e$+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 aS(r,e){var t=e$+e;r[t]&&(r[e]=r[t],r[t]=null)}function QJ(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 t$(r,e){var t=r.getUpdatedPathProxy(),i=e.getUpdatedPathProxy(),n=Awe(cA(t),cA(i)),a=n[0],o=n[1],s=r.getComputedTransform(),l=e.getComputedTransform();function u(){this.transform=null}s&&QJ(a,s),l&&QJ(o,l),hA(e,"updateTransform",{replace:u}),e.transform=null;var c=Lwe(a,o,10,Math.PI),f=[];hA(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);Cm(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,P=E*d+R*p;f[C]=A*T-P*w+g[0],f[C+1]=A*w+P*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++],z=f[C++],k=f[C++],G=f[C++],Y=f[C++];U===I&&B===R&&z===G&&k===Y?h.lineTo(G,Y):h.bezierCurveTo(I,R,z,k,G,Y),U=G,B=Y}}}})}function dA(r,e,t){if(!r||!e)return e;var i=t.done,n=t.during;t$(r,e),e.__morphT=0;function a(){aS(e,"buildPath"),aS(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 Dwe(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 pA(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:Dwe(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 r$(r){return KJ(r.path,r.count)}function K3(){return{fromIndividuals:[],toIndividuals:[],count:0}}function i$(r,e,t){var i=[];function n(M){for(var S=0;S<M.length;S++){var w=M[S];oS(w)?n(w.childrenRef()):w instanceof ut&&i.push(w)}}n(r);var a=i.length;if(!a)return K3();var o=t.dividePath||r$,s=o({path:e,count:a});if(s.length!==a)return console.error("Invalid morphing: unmatched splitted path"),K3();i=pA(i),s=pA(s);for(var l=t.done,u=t.during,c=t.individualDelay,f=new za,h=0;h<a;h++){var p=i[h],d=s[h];d.parent=e,d.copyTransform(f),c||t$(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)}hA(e,"addSelfToZr",{after:function(M){g(M)}}),hA(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,aS(e,"addSelfToZr"),aS(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;dA(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++)aS(r[M],"updateTransform");l&&l()}},t));return e.__zr&&g(e.__zr),{fromIndividuals:i,toIndividuals:s,count:v}}function n$(r,e,t){var i=e.length,n=[],a=t.dividePath||r$;function o(p){for(var d=0;d<p.length;d++){var g=p[d];oS(g)?o(g.childrenRef()):g instanceof ut&&n.push(g)}}if(oS(r)){o(r.childrenRef());var s=n.length;if(s<i)for(var l=0,u=s;u<i;u++)n.push(ev(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"),K3()}n=pA(n),e=pA(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;dA(n[u],e[u],h)}return{fromIndividuals:n,toIndividuals:e,count:e.length}}function a$(r){return pe(r[0])}function o$(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 Pwe={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=ev(r.path);n.setStyle("opacity",t),e.push(n)}return e},split:null};function mA(r,e,t,i,n,a){if(!r.length||!e.length)return;var o=gu("update",i,n);if(!(o&&o.duration>0))return;var s=i.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;a$(r)&&(u=r,c=e),a$(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(oS(T))f({many:[T],one:C},!0,y,x,!0);else{var b=s?Ye({delay:s(y,x)},l):l;dA(T,C,b),a(T,C,T,C,b)}}else for(var E=Ye({dividePath:Pwe[t],individualDelay:s&&function(B,z,k,G){return s(B+y,x)}},l),I=_?i$(S,w,E):n$(w,S,E),R=I.fromIndividuals,A=I.toIndividuals,P=R.length,U=0;U<P;U++){var b=s?Ye({delay:s(U,P)},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?o$(c,u):o$(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 sh(r){if(!r)return[];if(pe(r)){for(var e=[],t=0;t<r.length;t++)e.push(sh(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 d$=1e4,Iwe=0,s$=1,l$=2,Nwe=vt();function Uwe(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 Owe(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 u$(r,e,t,i){var n=i?"itemChildGroupId":"itemGroupId",a=Uwe(r,n);if(a){var o=Owe(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 c$(r){var e=[];return N(r,function(t){var i=t.data,n=t.dataGroupId;if(!(i.count()>d$))for(var a=i.getIndices(),o=0;o<a.length;o++)e.push({data:i,groupId:u$(i,o,n,!1),childGroupId:u$(i,o,n,!0),divide:t.divide,dataIndex:o})}),e}function J3(r,e,t){r.traverse(function(i){i instanceof ut&&or(i,{style:{opacity:0}},e,{dataIndex:t,isFrom:!0})})}function $3(r){if(r.parent){var e=r.getComputedTransform();r.setLocalTransform(e),r.parent.remove(r)}}function fg(r){r.stopAnimation(),r.isGroup&&r.traverse(function(e){e.stopAnimation()})}function zwe(r,e,t){var i=gu("update",t,e);i&&r.traverse(function(n){if(n instanceof _i){var a=$4(n);a&&n.animateFrom({style:a},i)}})}function Fwe(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 m$(r,e,t){var i=c$(r),n=c$(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=Iwe,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=s$;break}var h=n[c].childGroupId;if(h&&l.get(h)){s=l$;break}}function p(y,x){return function(M){var S=M.data,w=M.dataIndex;return x?S.getId(w):y?s===s$?M.childGroupId:M.groupId:s===l$?M.childGroupId:M.groupId}}var d=Fwe(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&&zwe(C,S.dataIndex,w);return}T&&g[T.id]||C&&(fg(C),T?(fg(T),$3(T),o=!0,mA(sh(T),sh(C),S.divide,w,y,a)):J3(C,w,y))}new Rn(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=Yt(de(x,function(b){return i[b].data.getItemGraphicEl(i[b].dataIndex)}),function(b){return b&&b!==T&&!g[b.id]});T&&(fg(T),C.length?(N(C,function(b){fg(b),$3(b)}),o=!0,mA(sh(C),sh(T),M.divide,w,y,a)):J3(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=Yt(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 fg(C)}),S?(fg(S),$3(S),o=!0,mA(sh(S),sh(w),M.divide,T,y[0],a)):N(w,function(C){return J3(C,T,y[0])}))}}).updateManyToMany(function(y,x){new Rn(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=gu("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 f$(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function h$(r){return pe(r)?r.sort().join(","):r}function lh(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function Bwe(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=f$(o),f=h$(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)&&lH("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=f$(o),c=h$(u),f=i.get(c);if(f)t.set(c,{oldSeries:[{dataGroupId:f.dataGroupId,divide:lh(f.data),data:f.data}],newSeries:[{dataGroupId:s,divide:lh(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:lh(m.data),data:m.data})}),h.length&&t.set(c,{oldSeries:h,newSeries:[{dataGroupId:s,data:l,divide:lh(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:lh(p.data)}],newSeries:[]},t.set(p.key,d)),d.newSeries.push({dataGroupId:s,data:l,divide:lh(l)})}}}}),t}function p$(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 kwe(r,e,t,i){var n=[],a=[];N(Qt(r.from),function(o){var s=p$(e.oldSeries,o);s>=0&&n.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:lh(e.oldData[s]),groupIdDim:o.dimension})}),N(Qt(r.to),function(o){var s=p$(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();a.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:lh(l),groupIdDim:o.dimension})}}),n.length>0&&a.length>0&&m$(n,a,i)}function Q3(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){N(Qt(i.seriesTransition),function(n){N(Qt(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][X_]=!0)})})}),r.registerUpdateLifecycle("series:transition",function(e,t,i){var n=Nwe(t);if(n.oldSeries&&i.updatedSeries&&i.optionChanged){var a=i.seriesTransition;if(a)N(Qt(a),function(p){kwe(p,n,i,t)});else{var o=Bwe(n,i);N(o.keys(),function(p){var d=o.get(p);m$(d.oldSeries,d.newSeries,t)})}N(i.updatedSeries,function(p){p[X_]&&(p[X_]=!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()<d$&&(l.push(s[f]),u.push(s[f].get("dataGroupId")),c.push(h))}})}Ot([PI]);Ot([DI]);Ot([BI,GI,ZI,aN,lN,TN,UN,XN,hU,pU,mU,IU,zU,kU,YU,qU,ZU,jU,QU,rO,oO,AO]);Ot(NO);Ot(BO);Ot(Ax);Ot(GO);Ot(Bx);Ot(WO);Ot(YO);Ot(r3);Ot(o3);Ot(Bl);Ot(h3);Ot(p3);Ot(g3);Ot(b3);Ot(T3);Ot(E3);Ot(N3);Ot(B3);Ot($x);Ot(tS);Ot(G3);Ot(iS);Ot(nS);Ot(X3);Ot(q3);Ot(Z3);Ot(Q3);Ot(cI);var uh=["*"];function Vwe(r,e){if(r&1&&mr(0,"nz-avatar",3),r&2){let t=Dr();_t("nzSrc",t.nzSrc)}}function Gwe(r,e){r&1&&gi(0,0,["*ngIf","!nzSrc"])}function Hwe(r,e){if(r&1&&mr(0,"nz-list-item-meta-avatar",3),r&2){let t=Dr();_t("nzSrc",t.avatarStr)}}function Wwe(r,e){if(r&1&&(Dt(0,"nz-list-item-meta-avatar"),bV(1,4),Pt()),r&2){let t=Dr();Lt(),_t("ngTemplateOutlet",t.avatarTpl)}}function Xwe(r,e){if(r&1&&(ru(0),Pr(1),iu()),r&2){let t=Dr(3);Lt(),of(t.nzTitle)}}function Ywe(r,e){if(r&1&&(Dt(0,"nz-list-item-meta-title"),Ar(1,Xwe,2,1,"ng-container",6),Pt()),r&2){let t=Dr(2);Lt(),_t("nzStringTemplateOutlet",t.nzTitle)}}function qwe(r,e){if(r&1&&(ru(0),Pr(1),iu()),r&2){let t=Dr(3);Lt(),of(t.nzDescription)}}function Zwe(r,e){if(r&1&&(Dt(0,"nz-list-item-meta-description"),Ar(1,qwe,2,1,"ng-container",6),Pt()),r&2){let t=Dr(2);Lt(),_t("nzStringTemplateOutlet",t.nzDescription)}}function jwe(r,e){if(r&1&&(Dt(0,"div",5),Ar(1,Ywe,2,1,"nz-list-item-meta-title",1)(2,Zwe,2,1,"nz-list-item-meta-description",1),gi(3,1),gi(4,2),Pt()),r&2){let t=Dr();Lt(),_t("ngIf",t.nzTitle&&!t.titleComponent),Lt(),_t("ngIf",t.nzDescription&&!t.descriptionComponent)}}var Kwe=[[["nz-list-item-meta-avatar"]],[["nz-list-item-meta-title"]],[["nz-list-item-meta-description"]]],Jwe=["nz-list-item-meta-avatar","nz-list-item-meta-title","nz-list-item-meta-description"];function $we(r,e){r&1&&gi(0)}var Qwe=["nz-list-item-actions",""];function e1e(r,e){}function t1e(r,e){r&1&&mr(0,"em",3)}function r1e(r,e){if(r&1&&(Dt(0,"li"),Ar(1,e1e,0,0,"ng-template",1)(2,t1e,1,0,"em",2),Pt()),r&2){let t=e.$implicit,i=e.last;Lt(),_t("ngTemplateOutlet",t),Lt(),_t("ngIf",!i)}}function i1e(r,e){}var S$=(r,e)=>({$implicit:r,index:e});function n1e(r,e){if(r&1&&(ru(0),Ar(1,i1e,0,0,"ng-template",9),iu()),r&2){let t=e.$implicit,i=e.index,n=Dr(2);Lt(),_t("ngTemplateOutlet",n.nzRenderItem)("ngTemplateOutletContext",kL(2,S$,t,i))}}function a1e(r,e){if(r&1&&(Dt(0,"div",7),Ar(1,n1e,2,5,"ng-container",8),gi(2,4),Pt()),r&2){let t=Dr();Lt(),_t("ngForOf",t.nzDataSource)}}function o1e(r,e){if(r&1&&(ru(0),Pr(1),iu()),r&2){let t=Dr(2);Lt(),of(t.nzHeader)}}function s1e(r,e){if(r&1&&(Dt(0,"nz-list-header"),Ar(1,o1e,2,1,"ng-container",10),Pt()),r&2){let t=Dr();Lt(),_t("nzStringTemplateOutlet",t.nzHeader)}}function l1e(r,e){r&1&&mr(0,"div"),r&2&&xV("min-height",53,"px")}function u1e(r,e){}function c1e(r,e){if(r&1&&(Dt(0,"div",13),Ar(1,u1e,0,0,"ng-template",9),Pt()),r&2){let t=e.$implicit,i=e.index,n=Dr(2);_t("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),Lt(),_t("ngTemplateOutlet",n.nzRenderItem)("ngTemplateOutletContext",kL(9,S$,t,i))}}function f1e(r,e){if(r&1&&(Dt(0,"div",11),Ar(1,c1e,2,12,"div",12),Pt()),r&2){let t=Dr();_t("nzGutter",t.nzGrid.gutter||null),Lt(),_t("ngForOf",t.nzDataSource)}}function h1e(r,e){if(r&1&&mr(0,"nz-list-empty",14),r&2){let t=Dr();_t("nzNoResult",t.nzNoResult)}}function p1e(r,e){if(r&1&&(ru(0),Pr(1),iu()),r&2){let t=Dr(2);Lt(),of(t.nzFooter)}}function d1e(r,e){if(r&1&&(Dt(0,"nz-list-footer"),Ar(1,p1e,2,1,"ng-container",10),Pt()),r&2){let t=Dr();Lt(),_t("nzStringTemplateOutlet",t.nzFooter)}}function m1e(r,e){}function v1e(r,e){}function g1e(r,e){if(r&1&&(Dt(0,"nz-list-pagination"),Ar(1,v1e,0,0,"ng-template",6),Pt()),r&2){let t=Dr();Lt(),_t("ngTemplateOutlet",t.nzPagination)}}var y1e=[[["nz-list-header"]],[["nz-list-footer"],["","nz-list-footer",""]],[["nz-list-load-more"],["","nz-list-load-more",""]],[["nz-list-pagination"],["","nz-list-pagination",""]],"*"],_1e=["nz-list-header","nz-list-footer, [nz-list-footer]","nz-list-load-more, [nz-list-load-more]","nz-list-pagination, [nz-list-pagination]","*"];function x1e(r,e){if(r&1&&mr(0,"ul",6),r&2){let t=Dr(2);_t("nzActions",t.nzActions)}}function S1e(r,e){if(r&1&&(Ar(0,x1e,1,1,"ul",5),gi(1)),r&2){let t=Dr();_t("ngIf",t.nzActions&&t.nzActions.length>0)}}function M1e(r,e){if(r&1&&(ru(0),Pr(1),iu()),r&2){let t=Dr(3);Lt(),of(t.nzContent)}}function b1e(r,e){if(r&1&&(ru(0),Ar(1,M1e,2,1,"ng-container",8),iu()),r&2){let t=Dr(2);Lt(),_t("nzStringTemplateOutlet",t.nzContent)}}function w1e(r,e){if(r&1&&(gi(0,1),gi(1,2),Ar(2,b1e,2,1,"ng-container",7)),r&2){let t=Dr();Lt(2),_t("ngIf",t.nzContent)}}function T1e(r,e){r&1&&gi(0,3)}function E1e(r,e){}function A1e(r,e){}function C1e(r,e){}function R1e(r,e){}function L1e(r,e){if(r&1&&Ar(0,E1e,0,0,"ng-template",9)(1,A1e,0,0,"ng-template",9)(2,C1e,0,0,"ng-template",9)(3,R1e,0,0,"ng-template",9),r&2){let t=Dr(),i=ju(3),n=ju(5),a=ju(1);_t("ngTemplateOutlet",i),Lt(),_t("ngTemplateOutlet",t.nzExtra),Lt(),_t("ngTemplateOutlet",n),Lt(),_t("ngTemplateOutlet",a)}}function D1e(r,e){}function P1e(r,e){}function I1e(r,e){}function N1e(r,e){if(r&1&&(Dt(0,"nz-list-item-extra"),Ar(1,I1e,0,0,"ng-template",9),Pt()),r&2){let t=Dr(2);Lt(),_t("ngTemplateOutlet",t.nzExtra)}}function U1e(r,e){}function O1e(r,e){if(r&1&&(ru(0),Dt(1,"div",10),Ar(2,D1e,0,0,"ng-template",9)(3,P1e,0,0,"ng-template",9),Pt(),Ar(4,N1e,2,1,"nz-list-item-extra",7)(5,U1e,0,0,"ng-template",9),iu()),r&2){let t=Dr(),i=ju(3),n=ju(1),a=ju(5);Lt(2),_t("ngTemplateOutlet",i),Lt(),_t("ngTemplateOutlet",n),Lt(),_t("ngIf",t.nzExtra),Lt(),_t("ngTemplateOutlet",a)}}var z1e=[[["nz-list-item-actions"],["","nz-list-item-actions",""]],[["nz-list-item-meta"],["","nz-list-item-meta",""]],"*",[["nz-list-item-extra"],["","nz-list-item-extra",""]]],F1e=["nz-list-item-actions, [nz-list-item-actions]","nz-list-item-meta, [nz-list-item-meta]","*","nz-list-item-extra, [nz-list-item-extra]"],v$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-item-meta-title"]],exportAs:["nzListItemMetaTitle"],standalone:!0,features:[Fr],ngContentSelectors:uh,decls:2,vars:0,consts:[[1,"ant-list-item-meta-title"]],template:function(n,a){n&1&&(Aa(),Dt(0,"h4",0),gi(1),Pt())},encapsulation:2,changeDetection:0});let r=e;return r})(),g$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-item-meta-description"]],exportAs:["nzListItemMetaDescription"],standalone:!0,features:[Fr],ngContentSelectors:uh,decls:2,vars:0,consts:[[1,"ant-list-item-meta-description"]],template:function(n,a){n&1&&(Aa(),Dt(0,"div",0),gi(1),Pt())},encapsulation:2,changeDetection:0});let r=e;return r})(),M$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-item-meta-avatar"]],inputs:{nzSrc:"nzSrc"},exportAs:["nzListItemMetaAvatar"],standalone:!0,features:[Fr],ngContentSelectors:uh,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&&(Aa(),Dt(0,"div",0),Ar(1,Vwe,1,1,"nz-avatar",1)(2,Gwe,1,0,"ng-content",2),Pt()),n&2&&(Lt(),_t("ngIf",a.nzSrc),Lt(),_t("ngIf",!a.nzSrc))},dependencies:[Da,IV,nu],encapsulation:2,changeDetection:0});let r=e;return r})(),B1e=(()=>{let e=class e{set nzAvatar(i){i instanceof BL?(this.avatarStr="",this.avatarTpl=i):this.avatarStr=i}constructor(i){this.elementRef=i,this.avatarStr=""}};e.\u0275fac=function(n){return new(n||e)(Zo(Ab))},e.\u0275cmp=zr({type:e,selectors:[["nz-list-item-meta"],["","nz-list-item-meta",""]],contentQueries:function(n,a,o){if(n&1&&(af(o,g$,5),af(o,v$,5)),n&2){let s;Pi(s=Ii())&&(a.descriptionComponent=s.first),Pi(s=Ii())&&(a.titleComponent=s.first)}},hostAttrs:[1,"ant-list-item-meta"],inputs:{nzAvatar:"nzAvatar",nzTitle:"nzTitle",nzDescription:"nzDescription"},exportAs:["nzListItemMeta"],standalone:!0,features:[Fr],ngContentSelectors:Jwe,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&&(Aa(Kwe),Ar(0,Hwe,1,1,"nz-list-item-meta-avatar",0)(1,Wwe,2,1,"nz-list-item-meta-avatar",1),gi(2),Ar(3,jwe,5,2,"div",2)),n&2&&(_t("ngIf",a.avatarStr),Lt(),_t("ngIf",a.avatarTpl),Lt(2),_t("ngIf",a.nzTitle||a.nzDescription||a.descriptionComponent||a.titleComponent))},dependencies:[M$,nu,U0,v$,Db,Lb,g$],encapsulation:2,changeDetection:0});let r=e;return r})(),y$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-item-extra"],["","nz-list-item-extra",""]],hostAttrs:[1,"ant-list-item-extra"],exportAs:["nzListItemExtra"],standalone:!0,features:[Fr],ngContentSelectors:uh,decls:1,vars:0,template:function(n,a){n&1&&(Aa(),gi(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),k1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-item-action"]],viewQuery:function(n,a){if(n&1&&Ca(BL,5),n&2){let o;Pi(o=Ii())&&(a.templateRef=o.first)}},exportAs:["nzListItemAction"],standalone:!0,features:[Fr],ngContentSelectors:uh,decls:1,vars:0,template:function(n,a){n&1&&(Aa(),Ar(0,$we,1,0,"ng-template"))},encapsulation:2,changeDetection:0});let r=e;return r})(),V1e=(()=>{let e=class e{constructor(i,n,a){this.ngZone=i,this.nzActions=[],this.actions=[],this.inputActionChanges$=new PL,this.contentChildrenChanges$=fV(()=>this.nzListItemActions?cV(null):this.ngZone.onStable.pipe(pV(1),this.enterZone(),dV(()=>this.nzListItemActions.changes.pipe(mV(this.nzListItemActions))))),hV(this.contentChildrenChanges$,this.inputActionChanges$).pipe(IL(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 lV(n=>i.subscribe({next:a=>this.ngZone.run(()=>n.next(a))}))}};e.\u0275fac=function(n){return new(n||e)(Zo(_V),Zo(NL),Zo(Ib))},e.\u0275cmp=zr({type:e,selectors:[["ul","nz-list-item-actions",""]],contentQueries:function(n,a,o){if(n&1&&af(o,k1e,4),n&2){let s;Pi(s=Ii())&&(a.nzListItemActions=s)}},hostAttrs:[1,"ant-list-item-action"],inputs:{nzActions:"nzActions"},exportAs:["nzListItemActions"],standalone:!0,features:[TV([Ib]),N0,Fr],attrs:Qwe,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&&Ar(0,r1e,3,2,"li",0),n&2&&_t("ngForOf",a.actions)},dependencies:[VL,U0,nu],encapsulation:2,changeDetection:0});let r=e;return r})(),b$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-empty"]],hostAttrs:[1,"ant-list-empty-text"],inputs:{nzNoResult:"nzNoResult"},exportAs:["nzListHeader"],standalone:!0,features:[Fr],decls:1,vars:2,consts:[[3,"nzComponentName","specificContent"]],template:function(n,a){n&1&&mr(0,"nz-embed-empty",0),n&2&&_t("nzComponentName","list")("specificContent",a.nzNoResult)},dependencies:[DV,LV],encapsulation:2,changeDetection:0});let r=e;return r})(),G1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-header"]],hostAttrs:[1,"ant-list-header"],exportAs:["nzListHeader"],standalone:!0,features:[Fr],ngContentSelectors:uh,decls:1,vars:0,template:function(n,a){n&1&&(Aa(),gi(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),_$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-footer"]],hostAttrs:[1,"ant-list-footer"],exportAs:["nzListFooter"],standalone:!0,features:[Fr],ngContentSelectors:uh,decls:1,vars:0,template:function(n,a){n&1&&(Aa(),gi(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),x$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["nz-list-pagination"]],hostAttrs:[1,"ant-list-pagination"],exportAs:["nzListPagination"],standalone:!0,features:[Fr],ngContentSelectors:uh,decls:1,vars:0,template:function(n,a){n&1&&(Aa(),gi(0))},encapsulation:2,changeDetection:0});let r=e;return r})(),H1e=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275dir=yV({type:e,selectors:[["nz-list-load-more"]],exportAs:["nzListLoadMoreDirective"],standalone:!0});let r=e;return r})();var w$=(()=>{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 uV(this.nzItemLayout),this.destroy$=new PL}ngOnInit(){this.dir=this.directionality.value,this.directionality.change?.pipe(IL(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)(Zo(CV,8))},e.\u0275cmp=zr({type:e,selectors:[["nz-list"],["","nz-list",""]],contentQueries:function(n,a,o){if(n&1&&(af(o,_$,5),af(o,x$,5),af(o,H1e,5)),n&2){let s;Pi(s=Ii())&&(a.nzListFooterComponent=s.first),Pi(s=Ii())&&(a.nzListPaginationComponent=s.first),Pi(s=Ii())&&(a.nzListLoadMoreDirective=s.first)}},hostAttrs:[1,"ant-list"],hostVars:16,hostBindings:function(n,a){n&2&&UL("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:[N0,Fr],ngContentSelectors:_1e,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&&(Aa(y1e),Ar(0,a1e,3,1,"ng-template",null,0,xm)(2,s1e,2,1,"nz-list-header",1),gi(3),Dt(4,"nz-spin",2),ru(5),Ar(6,l1e,1,2,"div",3)(7,f1e,2,2,"div",4)(8,h1e,1,1,"nz-list-empty",5),iu(),Pt(),Ar(9,d1e,2,1,"nz-list-footer",1),gi(10,1),Ar(11,m1e,0,0,"ng-template",6),gi(12,2),Ar(13,g1e,2,1,"nz-list-pagination",1),gi(14,3)),n&2){let o=ju(1);Lt(2),_t("ngIf",a.nzHeader),Lt(2),_t("nzSpinning",a.nzLoading),Lt(2),_t("ngIf",a.nzLoading&&a.nzDataSource&&a.nzDataSource.length===0),Lt(),_t("ngIf",a.nzGrid&&a.nzDataSource)("ngIfElse",o),Lt(),_t("ngIf",!a.nzLoading&&a.nzDataSource&&a.nzDataSource.length===0),Lt(),_t("ngIf",a.nzFooter),Lt(2),_t("ngTemplateOutlet",a.nzLoadMore),Lt(2),_t("ngIf",a.nzPagination)}},dependencies:[U0,VL,G1e,nu,Db,Lb,Ra,PV,La,Nb,Mm,b$,_$,x$],encapsulation:2,changeDetection:0});let r=e;return I0([O0()],r.prototype,"nzBordered",void 0),I0([O0()],r.prototype,"nzLoading",void 0),I0([O0()],r.prototype,"nzSplit",void 0),r})(),W1e=(()=>{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)(Zo(w$),Zo(NL))},e.\u0275cmp=zr({type:e,selectors:[["nz-list-item"],["","nz-list-item",""]],contentQueries:function(n,a,o){if(n&1&&af(o,y$,5),n&2){let s;Pi(s=Ii())&&(a.listItemExtraDirective=s.first)}},hostAttrs:[1,"ant-list-item"],hostVars:2,hostBindings:function(n,a){n&2&&UL("ant-list-item-no-flex",a.nzNoFlex)},inputs:{nzActions:"nzActions",nzContent:"nzContent",nzExtra:"nzExtra",nzNoFlex:"nzNoFlex"},exportAs:["nzListItem"],standalone:!0,features:[Fr],ngContentSelectors:F1e,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&&(Aa(z1e),Ar(0,S1e,2,1,"ng-template",null,0,xm)(2,w1e,3,1,"ng-template",null,1,xm)(4,T1e,1,0,"ng-template",null,2,xm)(6,L1e,4,4,"ng-template",null,3,xm)(8,O1e,6,4,"ng-container",4)),n&2){let o=ju(7);Lt(8),_t("ngIf",a.isVerticalAndExtra)("ngIfElse",o)}},dependencies:[V1e,nu,Db,Lb,U0,y$],encapsulation:2,changeDetection:0});let r=e;return I0([O0()],r.prototype,"nzNoFlex",void 0),r})();var T$=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=gV({type:e}),e.\u0275inj=vV({imports:[w$,b$,W1e,B1e,M$]});let r=e;return r})();var X1e=["chart"],E$=(()=>{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=_v(i,"dark");let n=Tb(Tb({},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=zr({type:e,selectors:[["app-chart-component"]],viewQuery:function(n,a){if(n&1&&Ca(X1e,7),n&2){let o;Pi(o=Ii())&&(a.chartContainer=o.first)}},inputs:{options:"options"},standalone:!0,features:[N0,Fr],decls:2,vars:0,consts:[[2,"width","100%","height","100%"],["chart",""]],template:function(n,a){n&1&&mr(0,"div",0,1)}});let r=e;return r})();var Z1e=r=>({margin:r,width:"100%",height:"16rem"});function j1e(r,e){if(r&1&&mr(0,"app-chart-component",28),r&2){let t=Dr(2).$implicit,i=Dr();SV(AV(3,Z1e,"20px "+20/i.chartConfig.rowNumber+"px")),_t("options",t.options)}}function K1e(r,e){if(r&1&&(Dt(0,"div",26),Ar(1,j1e,1,5,"app-chart-component",27),Pt()),r&2){let t=Dr().$implicit,i=Dr();_t("nzSpan",24/i.chartConfig.rowNumber),Lt(),_t("ngIf",t.checked)}}function J1e(r,e){if(r&1&&Ar(0,K1e,2,2,"div",25),r&2){let t=e.$implicit;_t("ngIf",t.checked)}}function $1e(r,e){if(r&1&&(Dt(0,"div",4)(1,"div",29),mr(2,"app-chart-component",30),Pt()()),r&2){let t=e.$implicit;Lt(2),_t("options",t)}}var A$=(()=>{let e=class e{handleCheckedItems(i){console.log("\u5F53\u524D\u9009\u4E2D\u7684\u9879\u76EE:",i)}constructor(i){this._mqttService=i,this.http=sa(lf),this.modal=sa(sf),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,wv.round(Math.max(0,l-Math.random()*100)),wv.round(l+Math.random()*80)]),o.push(wv.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)(Zo(Ob))},e.\u0275cmp=zr({type:e,selectors:[["app-data-v-s1"]],standalone:!0,features:[Fr],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&&(Dt(0,"div",0)(1,"div",1)(2,"data-v-card",2)(3,"div",3)(4,"div",4)(5,"div",5),mr(6,"app-chart-component",6),Pt(),Dt(7,"div",7),Pr(8,"\u7CFB\u7EDF\u5065\u5EB7\u5EA6"),Pt()(),Dt(9,"div",4)(10,"div",5),mr(11,"app-chart-component",6),Pt(),Dt(12,"div",7),Pr(13,"\u8BBE\u5907\u6295\u8FD0\u5EA6"),Pt()()()(),Dt(14,"data-v-card",8),mr(15,"ag-grid-angular",9),Pt(),Dt(16,"data-v-card",10),mr(17,"ag-grid-angular",9),Pt(),Dt(18,"data-v-card",11)(19,"div",12)(20,"span",13),Pr(21,"\u5316\u9A8C\u6548\u7387\uFF1A"),Pt(),mr(22,"nz-progress",14),Dt(23,"span",15),Pr(24,"\uFF0816/25\uFF09"),Pt()(),Dt(25,"div",16)(26,"span",13),Pr(27,"\u5B8C \u6210 \u7387 \uFF1A"),Pt(),mr(28,"nz-progress",14),Dt(29,"span",15),Pr(30,"\uFF0812/20\uFF09"),Pt()()()(),Dt(31,"div",1)(32,"data-v-card",17)(33,"div",18),mr(34,"img",19),Dt(35,"div",20)(36,"div",21),Pr(37," \u673A\u5668\u4EBA "),Pt(),Dt(38,"div",21),Pr(39," \u5168\u786B\u4EEA "),Pt(),Dt(40,"div",21),Pr(41," \u5168\u6C34\u5206\u6790\u4EEA "),Pt(),Dt(42,"div",21),Pr(43," \u6325\u53D1\u5206\u4EEA "),Pt(),Dt(44,"div",21),Pr(45," \u91CF\u70ED\u4EEA "),Pt(),Dt(46,"div",21),Pr(47," \u78B3\u6C22\u6C2E\u5143\u7D20 "),Pt()()()()(),Dt(48,"div",1)(49,"data-v-card",22),wV("onCheckedItemsChange",function(s){return a.handleCheckedItems(s)}),Dt(50,"div",23),zL(51,J1e,1,1,"div",31,OL),Pt(),Dt(53,"div",24),zL(54,$1e,3,1,"div",4,OL),Pt()()()()),n&2&&(_t("nzGutter",16),Lt(6),_t("options",a.chart_options),Lt(5),_t("options",a.chart_options0),Lt(4),_t("rowData",a.rowData)("columnDefs",a.colDefs1),Lt(2),_t("rowData",a.rowData)("columnDefs",a.colDefs2),Lt(5),_t("nzPercent",64)("nzStrokeColor","#74FAFB"),Lt(6),_t("nzPercent",60)("nzStrokeColor","#74FAFB"),Lt(21),_t("showSetting",!0)("optionsList",a.chartConfig.optionsCheckList),Lt(2),FL(a.chartConfig.optionsCheckList),Lt(3),FL(a.chartConfig.optionBottomList))},dependencies:[Rb,nu,RV,ws,NV,Ub,zV,T$,es,ts,ys,hs,xs,Ss,_s,vs,Qo,us,fs,Ts,ms,ps,Nb,Mm,La,Ko,ss,ls,Ms,as,Da,ds,ns,cs,os,bs,$o,Jo,gs,is,jo,rs,Ra,E$],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})();var Q1e=["myGrid"],C$=(()=>{let e=class e{constructor(){this.gridOptions={headerHeight:0,width:"100%"},this.defaultColDef={width:130,editable:!1},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz"}ngOnInit(){console.log("-----\u8868\u683C\u521D\u59CB\u5316-----"),this.pageSize=10,this.pageIndex=1,this.pageRowTotal=this.rowData.length}nzPageSizeChange(i){this.pageSize=i}nzPageIndexChange(i){console.log(`nzPageIndexChange${i}`),this.grid.api&&(i==1?this.grid.api.paginationGoToFirstPage():this.grid.api.paginationGoToPage(i))}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["lj-car-ag-grid-component"]],viewQuery:function(n,a){if(n&1&&Ca(Q1e,5),n&2){let o;Pi(o=Ii())&&(a.grid=o.first)}},inputs:{defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Fr],decls:2,vars:11,consts:[[3,"pagination","suppressPaginationPanel","suppressScrollOnNewData","paginationPageSize","defaultColDef","rowData","columnDefs","gridOptions"],["myGrid",""]],template:function(n,a){n&1&&mr(0,"ag-grid-angular",0,1),n&2&&(MV(a.gridThemeClass),_t("pagination",!0)("suppressPaginationPanel",!0)("suppressPaginationPanel",!0)("suppressScrollOnNewData",!0)("paginationPageSize",a.pageSize)("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.columnDefs)("gridOptions",a.gridOptions))},dependencies:[Ub,Sm],styles:[".grid-pagination[_ngcontent-%COMP%]{display:flex;justify-content:space-between;height:32px}.grid-pagination[_ngcontent-%COMP%] .ant-select-selection-item, .ant-select-selector[_ngcontent-%COMP%]{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .page-total-style{font-size:medium;font-weight:700;color:#00eff8} .ant-select-item-option{color:#00eff8!important} .ant-select-item-option-active div{font-weight:800!important;color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .anticon{color:#00eff8}.grid-pagination[_ngcontent-%COMP%] .ant-select-selector{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-prev .ant-pagination-item-link{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item a{color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active a{color:#000!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-next button, .ant-pagination-prev[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active:focus-visible, .ant-pagination-item-active[_ngcontent-%COMP%]:hover, .ant-pagination-next[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%], .ant-pagination-prev[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%]{border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active{font-weight:500;background-color:#00eff8;border-color:#00eff8;border-width:2px}"]});let r=e;return r})();var eTe=["myGrid"],tTe=["*"],gA=(()=>{let e=class e{constructor(){this.gridThemedClass="ag-theme-quartz ag-theme-datav",this.title="",this.defaultColDef={width:130,editable:!1,headerClass:"ag-header-center",cellStyle:{"font-weight":"bold",textAlign:"center","justify-content":"center","line-height":"38px"}},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz",this.tableColumns=[{key:"sort",title:"\u5E8F\u53F7"},{key:"time",title:"\u65F6\u95F4"},{key:"option",title:"\u64CD\u4F5C"},{key:"optionDesc",title:"\u64CD\u4F5C\u63CF\u8FF0"},{key:"optionMan",title:"\u64CD\u4F5C\u4EBA\u5458"},{key:"mark",title:"\u5907\u6CE8"},{key:"edit",title:"\u7F16\u8F91"}],this.colDefs1=[{headerName:"\u5E8F\u53F7",valueGetter:function(i){return parseInt(i.node.id)+1},width:90,sortable:!0,unSortIcon:!0,field:"xh"},{headerName:"\u4EFB\u52A1\u540D\u79F0",unSortIcon:!0,width:120,field:"rwmc"},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",unSortIcon:!0,field:"rwms",width:120},{headerName:"\u5F00\u59CB\u65F6\u95F4",headerClass:"ag-header-center",unSortIcon:!0,field:"kssj",width:180},{headerName:"\u8BA1\u5212\u5B8C\u6210\u65F6\u95F4",unSortIcon:!0,field:"jhwcsj",width:180},{headerName:"\u8D85\u671F",width:70,field:"sfcq"},{headerName:"\u64CD\u4F5C",width:90,field:"cz",cellRenderer:z0}],this.tableData=[{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"}]}ngOnInit(){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"});console.log("-----\u8868\u683C\u521D\u59CB\u5316-----"),this.pageSize=5,this.pageIndex=1,this.pageRowTotal=this.rowData.length}nzPageSizeChange(i){this.pageSize=i}nzPageIndexChange(i){console.log(`nzPageIndexChange${i}`),this.grid.api&&(i==1?this.grid.api.paginationGoToFirstPage():this.grid.api.paginationGoToPage(i))}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["app-data-v-lj-car-info-table"]],viewQuery:function(n,a){if(n&1&&Ca(eTe,5),n&2){let o;Pi(o=Ii())&&(a.grid=o.first)}},inputs:{title:"title",defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Fr],ngContentSelectors:tTe,decls:35,vars:12,consts:[[1,"card-content"],[1,"table-container"],[1,"table-header"],[1,"grid-container"],[1,"grid-item"],["gridThemeClass","ag-theme-quartz ag-theme-datav",2,"width","30%",3,"defaultColDef","rowData","columnDefs"]],template:function(n,a){n&1&&(Aa(),Dt(0,"div",0)(1,"div",1)(2,"div",2)(3,"span"),Pr(4,"\u5E8F\u53F7"),Pt(),Dt(5,"span"),Pr(6,"\u65F6\u95F4"),Pt(),Dt(7,"span"),Pr(8,"\u8F66\u724C"),Pt(),Dt(9,"span"),Pr(10,"\u8F66\u578B"),Pt(),Dt(11,"span"),Pr(12,"\u5361\u53F7"),Pt(),Dt(13,"span"),Pr(14,"\u4F9B\u5E94\u5546"),Pt(),Dt(15,"span"),Pr(16,"\u6BDB\u91CD"),Pt(),Dt(17,"span"),Pr(18,"\u4E0A\u62A5"),mr(19,"br"),Pr(20,"\u70ED\u503C"),Pt(),Dt(21,"span"),Pr(22,"\u4F30\u7B97"),mr(23,"br"),Pr(24,"\u70ED\u503C"),Pt()()(),Dt(25,"div",3)(26,"div",4),mr(27,"lj-car-ag-grid-component",5),Pt(),Dt(28,"div",4),mr(29,"lj-car-ag-grid-component",5),Pt(),Dt(30,"div",4),mr(31,"lj-car-ag-grid-component",5),Pt(),Dt(32,"div",4),mr(33,"lj-car-ag-grid-component",5),Pt()(),gi(34),Pt()),n&2&&(Lt(27),_t("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs1),Lt(2),_t("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs1),Lt(2),_t("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs1),Lt(2),_t("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs1))},dependencies:[es,ts,ys,hs,xs,Ss,_s,vs,Qo,us,fs,Ts,ms,ps,La,Ko,ss,ls,Ms,ws,as,Da,ds,ns,cs,os,bs,$o,Jo,gs,is,jo,rs,Ra,C$],styles:['.card-top-content[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto auto;align-items:center;justify-content:space-between;margin-bottom:10px}.buttons-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}.card-button[_ngcontent-%COMP%], span[nz-icon][_ngcontent-%COMP%]{margin-left:.5rem}.card-button[_ngcontent-%COMP%]{cursor:pointer;width:82px;height:40px;font-size:26px;line-height:20px;color:#00eff8;text-align:center;background-color:#213069;border:none;border-radius:3px}.card-content[_ngcontent-%COMP%]{overflow:hidden;margin-bottom:.5rem;//height: 18rem;padding:1rem 1.5rem;padding:1rem;//position: relative;background-image:url("./media/dashboard_card_bg-2QFDBQFD.jpg");background-repeat:no-repeat;background-position:center;// background-position: top;background-size:100% 100%}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%]{display:flex;flex-grow:1;align-items:center;justify-content:space-between;width:fit-content;height:fit-content;margin-bottom:.5rem;padding:5px 20px;font-size:28px;font-weight:600;line-height:22px;color:#74fafb;color:#00eff8;text-align:center;background-color:#19426e;border:1px solid #1f6f97;border-radius:10px 10px 0 0;box-shadow:inset 0 0 10px #1f6f97}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-l[_ngcontent-%COMP%]{flex:1;align-self:flex-start}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-r[_ngcontent-%COMP%]{align-self:flex-end}.table-container[_ngcontent-%COMP%]{margin:10px 5px 20px;padding:10px;border:1px solid #fff}.table-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.table-header[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;text-align:center}.grid-item[_ngcontent-%COMP%]{margin-bottom:10px}']});let r=e;return r})();function rTe(r,e){if(r&1&&mr(0,"div",5),r&2){let t=Dr();Cb("id",t.chartId)}}var yA=(()=>{let e=class e{constructor(){this.chartId="",this.text=""}ngOnInit(){setTimeout(()=>this.initCharts(),0)}initCharts(){console.log("\u521D\u59CB\u5316\u56FE\u8868"),console.log(this,this.chartId),console.log(this,this.chartId.toString());let i=_v(document.getElementById(this.chartId)),n={tooltip:{formatter:"{a} <br/>{b} : {c}%"},series:[{name:"Pressure",type:"gauge",progress:{show:!0},detail:{valueAnimation:!0,formatter:"{value}"},data:[{value:50,name:"SCORE"}]}]};i.setOption(n)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["app-data-v-lj-text-dashboard"]],inputs:{chartId:"chartId",text:"text"},standalone:!0,features:[Fr],decls:7,vars:2,consts:[[1,"chart-card"],[1,"chart-container"],["style","width: 15rem; height: 15rem",3,"id",4,"ngIf"],[1,"chart-text"],[1,"chart-button"],[2,"width","15rem","height","15rem",3,"id"]],template:function(n,a){n&1&&(Dt(0,"div",0)(1,"div",1),Ar(2,rTe,1,1,"div",2),Pt(),Dt(3,"p",3),Pr(4),Pt(),Dt(5,"button",4),Pr(6,"1#\u91CD\u78C5"),Pt()()),n&2&&(Lt(2),_t("ngIf",a.chartId),Lt(2),of(a.text))},dependencies:[es,ts,ys,hs,xs,Ss,_s,vs,Qo,us,fs,Ts,ms,ps,La,Ko,ss,ls,Ms,ws,as,Da,ds,ns,cs,os,bs,$o,Jo,gs,is,jo,rs,Ra,Rb,nu],styles:[".chart-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;text-align:center}.chart-text[_ngcontent-%COMP%]{margin:0;font-size:28px;color:#7eddf3}.chart-button[_ngcontent-%COMP%]{width:175px;height:51px;margin:5px;font-size:28px;line-height:22px;color:red;text-align:center;background-color:#06467800;background-image:url(/assets/dashboardButtonBg.png);background-repeat:no-repeat;background-position:center;background-size:contain;border-width:0}"]});let r=e;return r})();var iTe=["myGrid"],_A=(()=>{let e=class e{constructor(){this.title="",this.showSetting=!0,this.defaultColDef={width:130,editable:!1,headerClass:"ag-header-center",cellStyle:{"font-weight":"bold",textAlign:"center","justify-content":"center","line-height":"38px"}},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz"}ngOnInit(){}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["app-data-v-lj-dashboard"]],viewQuery:function(n,a){if(n&1&&Ca(iTe,5),n&2){let o;Pi(o=Ii())&&(a.grid=o.first)}},inputs:{title:"title",defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Fr],decls:4,vars:1,consts:[["nz-col","","nzSpan","24","nzXs","24","nzSm","24","nzMd","12","nzLg","12","nzXl","12","nzXXl","12",3,"title"],[2,"display","flex","justify-content","center","align-items","center"],["chartId","leftChart","text","\u91CD\u8861\u7CFB\u7EDF\u5065\u5EB7\u5EA6"],["chartId","rightChart","text","\u91CD\u8861\u7CFB\u7EDF\u6295\u8FD0\u7387"]],template:function(n,a){n&1&&(Dt(0,"lj-data-v-card",0)(1,"div",1),mr(2,"app-data-v-lj-text-dashboard",2)(3,"app-data-v-lj-text-dashboard",3),Pt()()),n&2&&Cb("title",a.title)},dependencies:[Sm,UV,yA],encapsulation:2});let r=e;return r})();var nTe=["myGrid"],aTe=()=>[12,12],R$=(()=>{let e=class e{constructor(i){this._mqttService=i,this.http=sa(lf),this.modal=sa(sf),this.elementRef=sa(Ab),this.titleService=sa(Pb),this.chartDom=document.getElementById("main"),this.defaultColDef={width:170,editable:!1},this.gridThemedClass="ag-theme-quartz ag-theme-datav",this.rowData=[],this.colDefs1=[{headerName:"\u5E8F\u53F7",valueGetter:function(n){return parseInt(n.node.id)+1},width:90,sortable:!0,unSortIcon:!0,field:"xh"},{headerName:"\u4EFB\u52A1\u540D\u79F0",unSortIcon:!0,width:120,field:"rwmc"},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",unSortIcon:!0,field:"rwms",width:120},{headerName:"\u5F00\u59CB\u65F6\u95F4",headerClass:"ag-header-center",unSortIcon:!0,field:"kssj",width:180},{headerName:"\u8BA1\u5212\u5B8C\u6210\u65F6\u95F4",unSortIcon:!0,field:"jhwcsj",width:180},{headerName:"\u8D85\u671F",width:70,field:"sfcq"},{headerName:"\u64CD\u4F5C",width:90,autoHeaderHeight:!0,field:"cz",cellRenderer:z0}],this.colDefs2=[{headerName:"\u5E8F\u53F7",valueGetter:function(n){return parseInt(n.node.id)+1},width:90,unSortIcon:!0,field:"xh"},{headerName:"\u4EFB\u52A1\u540D\u79F0",unSortIcon:!0,field:"rwmc"},{headerName:"\u4EFB\u52A1\u63CF\u8FF0",unSortIcon:!0,field:"rwms",minWidth:170,flex:1},{headerName:"\u5F00\u59CB\u65F6\u95F4",unSortIcon:!0,field:"kssj",minWidth:170,flex:1},{headerName:"\u5F53\u524D\u72B6\u6001",field:"dqzt"},{headerName:"\u5F53\u524D\u8282\u70B9",field:"dqjd"},{headerName:"\u5B9E\u9645\u5B8C\u6210\u65F6\u95F4",field:"sjwcsj",minWidth:170,flex:1},{headerName:"\u64CD\u4F5C",autoHeaderHeight:!0,width:110,field:"cz",cellRenderer:z0}],this.client=i}initCharts(){let i=_v(document.getElementById("lineChart")),n={tooltip:{formatter:"{a} <br/>{b} : {c}%"},series:[{name:"Pressure",type:"gauge",progress:{show:!0},detail:{valueAnimation:!0,formatter:"{value}"},data:[{value:50,name:"SCORE"}]}]};i.setOption(n)}ngOnInit(){this.titleService.setTitle("\u6211\u7684\u5DE5\u4F5C\u7AD9");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"});this.initCharts()}ngAfterViewInit(){let i=this.elementRef.nativeElement.querySelector(".ag-theme-datav"),n=i.querySelector(".ag-body-viewport"),a=i.querySelector(".ag-scroller")}add(){}};e.\u0275fac=function(n){return new(n||e)(Zo(Ob))},e.\u0275cmp=zr({type:e,selectors:[["app-data-v-s1"]],viewQuery:function(n,a){if(n&1&&Ca(nTe,5),n&2){let o;Pi(o=Ii())&&(a.grid=o.first)}},standalone:!0,features:[Fr],decls:8,vars:16,consts:[["nz-row","",2,"display","flex","justify-content","space-between",3,"nzGutter"],[2,"display","flex","flex-direction","column","width","40%"],["title","\u7CFB\u7EDF\u72B6\u6001",2,"width","100%"],["title","\u8FD0\u884C\u4FE1\u606F",2,"width","100%",3,"defaultColDef","rowData","columnDefs","gridThemeClass"],["title","\u7CFB\u7EDF\u62A5\u8B66\u4FE1\u606F",2,"width","100%",3,"defaultColDef","rowData","columnDefs","gridThemeClass"],[2,"display","flex","flex-direction","column"],["title","\u4ECA\u65E5\u6C47\u603B",2,"width","100%",3,"showPageTurning","showEditButton","defaultColDef","rowData","columnDefs","gridThemeClass"],[2,"width","100%"]],template:function(n,a){n&1&&(Dt(0,"div",0)(1,"div",1),mr(2,"app-data-v-lj-dashboard",2)(3,"lj-app-ag-grid-component",3)(4,"lj-app-ag-grid-component",4),Pt(),Dt(5,"div",5),mr(6,"lj-app-ag-grid-component",6)(7,"app-data-v-lj-car-info-table",7),Pt()()),n&2&&(_t("nzGutter",EV(15,aTe)),Lt(3),_t("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs1)("gridThemeClass",a.gridThemedClass),Lt(),_t("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs1)("gridThemeClass",a.gridThemedClass),Lt(2),_t("showPageTurning",!1)("showEditButton",!0)("defaultColDef",a.defaultColDef)("rowData",a.rowData)("columnDefs",a.colDefs2)("gridThemeClass",a.gridThemedClass))},dependencies:[gA,OV,Sm,_A,es,ts,ys,hs,xs,Ss,_s,vs,Qo,us,fs,Ts,ms,ps,Mm,La,Ko,ss,ls,Ms,ws,as,Da,ds,ns,cs,os,bs,$o,Jo,gs,is,jo,rs,Ra],styles:[".ag-header-center[_ngcontent-%COMP%] .ag-header-group-cell-label[_ngcontent-%COMP%], .ag-header-center[_ngcontent-%COMP%] .ag-header-cell-label[_ngcontent-%COMP%]{display:grid;justify-content:center;color:#000;text-align:center;background:#000} .ag-theme-datav .ag-row-selected .ag-ltr .ag-cell{color:red!important} .ag-theme-datav .ag-ltr .ag-row-focus{font-weight:600;color:red} .ag-theme-datav .ag-ltr .ag-row-focus .ag-cell-focus{border:#74FAFB} .ag-theme-datav .ag-ltr .ag-row-focus .ag-grid-button-style{color:red;border-color:red} .ag-theme-datav{--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: 12px;--ag-font-family: monospace;height:17rem;font-weight:700;border-width:3px} .ag-theme-datav .ag-header-cell-resize{--ag-header-column-resize-handle-color: #00eff8} .ag-theme-datav .ag-header-row{font-size:14px;font-weight:700} .ag-theme-datav .ag-root-wrapper{border-radius:0} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar{width:12em} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar-thumb{margin-left:40px;background-color:#00eff8;border:2px solid #00eff8} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar-track{background-color:transparent;border-color:#00eff8} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar-thumb:hover{margin-left:40px;background-color:#00eff8} .ag-theme-datav .ag-body-vertical-scroll-viewport::-webkit-scrollbar-thumb:active{background-color:#00eff8} .ag-body-vertical-scroll-viewport{scrollbar-color:auto} .ag-body-horizontal-scroll-viewport{scrollbar-color:auto} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar{height:14em;color:#000} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-track{background-color:transparent;border-color:#00eff8} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb:hover{background-color:#00eff8} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb:active{background-color:#00eff8} .ag-theme-datav .ag-body-horizontal-scroll-viewport::-webkit-scrollbar-thumb{background-color:#00eff8}"]});let r=e;return r})();var zS="162";var L$=0,ez=1,D$=2;var xA=1,P$=2,kl=3,Po=0,Si=1,Io=2,Js=0,Tc=1,tz=2,rz=3,iz=4,I$=5,Ec=100,N$=101,U$=102,nz=103,az=104,O$=200,z$=201,F$=202,B$=203,FS=204,BS=205,k$=206,V$=207,G$=208,H$=209,W$=210,X$=211,Y$=212,q$=213,Z$=214,j$=0,K$=1,J$=2,mg=3,$$=4,Q$=5,eQ=6,tQ=7,SA=0,rQ=1,iQ=2,$s=0,nQ=1,aQ=2,oQ=3,sQ=4,lQ=5,uQ=6,cQ=7;var oz=300,Vl=301,Iu=302,kS=303,VS=304,ch=306,GS=1e3,ya=1001,HS=1002,Gi=1003,sz=1004;var vg=1005;var tn=1006,MA=1007;var Gl=1008;var No=1009,fQ=1010,hQ=1011,gg=1012,bA=1013,Uo=1014,eo=1015,Ac=1016,wA=1017,TA=1018,Qs=1020,pQ=1021,Dn=1023,dQ=1024,mQ=1025,Hl=1026,Nu=1027,vQ=1028,EA=1029,gQ=1030,AA=1031,CA=1033,RA=33776,LA=33777,DA=33778,PA=33779,lz=35840,uz=35841,cz=35842,fz=35843,IA=36196,hz=37492,pz=37496,dz=37808,mz=37809,vz=37810,gz=37811,yz=37812,_z=37813,xz=37814,Sz=37815,Mz=37816,bz=37817,wz=37818,Tz=37819,Ez=37820,Az=37821,NA=36492,Cz=36494,Rz=36495,yQ=36283,Lz=36284,Dz=36285,Pz=36286;var _Q=3200,xQ=3201,SQ=0,MQ=1,el="",to="srgb",ro="srgb-linear",yg="display-p3",yd="display-p3-linear",_g="linear",qr="srgb",xg="rec709",Sg="p3";var _d=7680;var Iz=519,bQ=512,wQ=513,TQ=514,UA=515,EQ=516,AQ=517,CQ=518,RQ=519,Nz=35044;var Uz="300 es",WS=1035,io=2e3,xd=2001;var no=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 Zn=["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 OA=Math.PI/180,XS=180/Math.PI;function Uu(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Zn[r&255]+Zn[r>>8&255]+Zn[r>>16&255]+Zn[r>>24&255]+"-"+Zn[e&255]+Zn[e>>8&255]+"-"+Zn[e>>16&15|64]+Zn[e>>24&255]+"-"+Zn[t&63|128]+Zn[t>>8&255]+"-"+Zn[t>>16&255]+Zn[t>>24&255]+Zn[i&255]+Zn[i>>8&255]+Zn[i>>16&255]+Zn[i>>24&255]).toLowerCase()}function rn(r,e,t){return Math.max(e,Math.min(t,r))}function LQ(r,e){return(r%e+e)%e}function zA(r,e,t){return(1-t)*r+t*e}function Oz(r){return(r&r-1)===0&&r!==0}function YS(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 _a(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 $t=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(rn(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 er=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(zz.makeScale(e,t)),this}rotate(e){return this.premultiply(zz.makeRotation(-e)),this}translate(e,t){return this.premultiply(zz.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)}},zz=new er;function FA(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function bg(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function PQ(){let r=bg("canvas");return r.style.display="block",r}var DQ={};function IQ(r){r in DQ||(DQ[r]=!0,console.warn(r))}var NQ=new er().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),UQ=new er().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),BA={[ro]:{transfer:_g,primaries:xg,toReference:r=>r,fromReference:r=>r},[to]:{transfer:qr,primaries:xg,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[yd]:{transfer:_g,primaries:Sg,toReference:r=>r.applyMatrix3(UQ),fromReference:r=>r.applyMatrix3(NQ)},[yg]:{transfer:qr,primaries:Sg,toReference:r=>r.convertSRGBToLinear().applyMatrix3(UQ),fromReference:r=>r.applyMatrix3(NQ).convertLinearToSRGB()}},oTe=new Set([ro,yd]),Er={enabled:!0,_workingColorSpace:ro,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!oTe.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=BA[e].toReference,n=BA[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 BA[r].primaries},getTransfer:function(r){return r===el?_g:BA[r].transfer}};function fh(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function kA(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var wg,Tg=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{wg===void 0&&(wg=bg("canvas")),wg.width=e.width,wg.height=e.height;let i=wg.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=wg}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=bg("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]=fh(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(fh(t[i]/255)*255):t[i]=fh(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 sTe=0,Eg=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:sTe++}),this.uuid=Uu(),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(Fz(n[o].image)):a.push(Fz(n[o]))}else a=Fz(n);i.url=a}return t||(e.images[this.uuid]=i),i}};function Fz(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?Tg.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 lTe=0,ao=(()=>{class r extends no{constructor(t=r.DEFAULT_IMAGE,i=r.DEFAULT_MAPPING,n=ya,a=ya,o=tn,s=Gl,l=Dn,u=No,c=r.DEFAULT_ANISOTROPY,f=el){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:lTe++}),this.uuid=Uu(),this.name="",this.source=new Eg(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 $t(0,0),this.repeat=new $t(1,1),this.center=new $t(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new er,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!==oz)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case GS:t.x=t.x-Math.floor(t.x);break;case ya:t.x=t.x<0?0:1;break;case HS: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 GS:t.y=t.y-Math.floor(t.y);break;case ya:t.y=t.y<0?0:1;break;case HS: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=oz,r.DEFAULT_ANISOTROPY=1,r})();var si=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 VA=class extends no{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new si(0,0,e,t),this.scissorTest=!1,this.viewport=new si(0,0,e,t);let n={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:tn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let a=new ao(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 Eg(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 oo=class extends VA{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}};var Ag=class extends ao{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=Gi,this.minFilter=Gi,this.wrapR=ya,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var GA=class extends ao{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=Gi,this.minFilter=Gi,this.wrapR=ya,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var zu=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(rn(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(OQ.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(OQ.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 Bz.copy(this).projectOnVector(e),this.sub(Bz)}reflect(e){return this.sub(Bz.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(rn(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}},Bz=new be,OQ=new zu;var Rc=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(Wl.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Wl.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=Wl.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,Wl):Wl.fromBufferAttribute(a,o),Wl.applyMatrix4(e.matrixWorld),this.expandByPoint(Wl);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),HA.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),HA.copy(i.boundingBox)),HA.applyMatrix4(e.matrixWorld),this.union(HA)}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,Wl),Wl.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(qS),WA.subVectors(this.max,qS),Cg.subVectors(e.a,qS),Rg.subVectors(e.b,qS),Lg.subVectors(e.c,qS),hh.subVectors(Rg,Cg),ph.subVectors(Lg,Rg),Sd.subVectors(Cg,Lg);let t=[0,-hh.z,hh.y,0,-ph.z,ph.y,0,-Sd.z,Sd.y,hh.z,0,-hh.x,ph.z,0,-ph.x,Sd.z,0,-Sd.x,-hh.y,hh.x,0,-ph.y,ph.x,0,-Sd.y,Sd.x,0];return!kz(t,Cg,Rg,Lg,WA)||(t=[1,0,0,0,1,0,0,0,1],!kz(t,Cg,Rg,Lg,WA))?!1:(XA.crossVectors(hh,ph),t=[XA.x,XA.y,XA.z],kz(t,Cg,Rg,Lg,WA))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Wl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Wl).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 be,new be,new be,new be,new be,new be,new be,new be],Wl=new be,HA=new Rc,Cg=new be,Rg=new be,Lg=new be,hh=new be,ph=new be,Sd=new be,qS=new be,WA=new be,XA=new be,Md=new be;function kz(r,e,t,i,n){for(let a=0,o=r.length-3;a<=o;a+=3){Md.fromArray(r,a);let s=n.x*Math.abs(Md.x)+n.y*Math.abs(Md.y)+n.z*Math.abs(Md.z),l=e.dot(Md),u=t.dot(Md),c=i.dot(Md);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var uTe=new Rc,ZS=new be,Vz=new be,dh=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):uTe.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;ZS.subVectors(e,this.center);let t=ZS.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector(ZS,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):(Vz.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ZS.copy(e.center).add(Vz)),this.expandByPoint(ZS.copy(e.center).sub(Vz))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};var Lc=new be,Gz=new be,YA=new be,mh=new be,Hz=new be,qA=new be,Wz=new be,ZA=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,Lc)),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=Lc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Lc.copy(this.origin).addScaledVector(this.direction,t),Lc.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){Gz.copy(e).add(t).multiplyScalar(.5),YA.copy(t).sub(e).normalize(),mh.copy(this.origin).sub(Gz);let a=e.distanceTo(t)*.5,o=-this.direction.dot(YA),s=mh.dot(this.direction),l=-mh.dot(YA),u=mh.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(Gz).addScaledVector(YA,h),p}intersectSphere(e,t){Lc.subVectors(e.center,this.origin);let i=Lc.dot(this.direction),n=Lc.dot(Lc)-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,Lc)!==null}intersectTriangle(e,t,i,n,a){Hz.subVectors(t,e),qA.subVectors(i,e),Wz.crossVectors(Hz,qA);let o=this.direction.dot(Wz),s;if(o>0){if(n)return null;s=1}else if(o<0)s=-1,o=-o;else return null;mh.subVectors(this.origin,e);let l=s*this.direction.dot(qA.crossVectors(mh,qA));if(l<0)return null;let u=s*this.direction.dot(Hz.cross(mh));if(u<0||l+u>o)return null;let c=-s*mh.dot(Wz);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 Zr=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/Dg.setFromMatrixColumn(e,0).length(),a=1/Dg.setFromMatrixColumn(e,1).length(),o=1/Dg.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(cTe,e,fTe)}lookAt(e,t,i){let n=this.elements;return Oo.subVectors(e,t),Oo.lengthSq()===0&&(Oo.z=1),Oo.normalize(),vh.crossVectors(i,Oo),vh.lengthSq()===0&&(Math.abs(i.z)===1?Oo.x+=1e-4:Oo.z+=1e-4,Oo.normalize(),vh.crossVectors(i,Oo)),vh.normalize(),jA.crossVectors(Oo,vh),n[0]=vh.x,n[4]=jA.x,n[8]=Oo.x,n[1]=vh.y,n[5]=jA.y,n[9]=Oo.y,n[2]=vh.z,n[6]=jA.z,n[10]=Oo.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],P=n[6],U=n[10],B=n[14],z=n[3],k=n[7],G=n[11],Y=n[15];return a[0]=o*S+s*b+l*A+u*z,a[4]=o*w+s*E+l*P+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*z,a[5]=c*w+f*E+h*P+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*z,a[6]=d*w+g*E+m*P+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*z,a[7]=_*w+y*E+x*P+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=Dg.set(n[0],n[1],n[2]).length(),o=Dg.set(n[4],n[5],n[6]).length(),s=Dg.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],Xl.copy(this);let u=1/a,c=1/o,f=1/s;return Xl.elements[0]*=u,Xl.elements[1]*=u,Xl.elements[2]*=u,Xl.elements[4]*=c,Xl.elements[5]*=c,Xl.elements[6]*=c,Xl.elements[8]*=f,Xl.elements[9]*=f,Xl.elements[10]*=f,t.setFromRotationMatrix(Xl),i.x=a,i.y=o,i.z=s,this}makePerspective(e,t,i,n,a,o,s=io){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===io)p=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(s===xd)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=io){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===io)d=(o+a)*f,g=-2*f;else if(s===xd)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}},Dg=new be,Xl=new Zr,cTe=new be(0,0,0),fTe=new be(1,1,1),vh=new be,jA=new be,Oo=new be;var zQ=new Zr,FQ=new zu,Yl=(()=>{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(rn(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(-rn(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(rn(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(-rn(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(rn(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(-rn(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 zQ.makeRotationFromQuaternion(t),this.setFromRotationMatrix(zQ,i,n)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return FQ.setFromEuler(this),this.setFromQuaternion(FQ,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 Pg=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 hTe=0,BQ=new be,Ig=new zu,Dc=new Zr,KA=new be,jS=new be,pTe=new be,dTe=new zu,kQ=new be(1,0,0),VQ=new be(0,1,0),GQ=new be(0,0,1),mTe={type:"added"},vTe={type:"removed"},Xz={type:"childadded",child:null},Yz={type:"childremoved",child:null},nn=(()=>{class r extends no{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:hTe++}),this.uuid=Uu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new be,i=new Yl,n=new zu,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 Zr},normalMatrix:{value:new er}}),this.matrix=new Zr,this.matrixWorld=new Zr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Pg,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 Ig.setFromAxisAngle(t,i),this.quaternion.multiply(Ig),this}rotateOnWorldAxis(t,i){return Ig.setFromAxisAngle(t,i),this.quaternion.premultiply(Ig),this}rotateX(t){return this.rotateOnAxis(kQ,t)}rotateY(t){return this.rotateOnAxis(VQ,t)}rotateZ(t){return this.rotateOnAxis(GQ,t)}translateOnAxis(t,i){return BQ.copy(t).applyQuaternion(this.quaternion),this.position.add(BQ.multiplyScalar(i)),this}translateX(t){return this.translateOnAxis(kQ,t)}translateY(t){return this.translateOnAxis(VQ,t)}translateZ(t){return this.translateOnAxis(GQ,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Dc.copy(this.matrixWorld).invert())}lookAt(t,i,n){t.isVector3?KA.copy(t):KA.set(t,i,n);let a=this.parent;this.updateWorldMatrix(!0,!1),jS.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Dc.lookAt(jS,KA,this.up):Dc.lookAt(KA,jS,this.up),this.quaternion.setFromRotationMatrix(Dc),a&&(Dc.extractRotation(a.matrixWorld),Ig.setFromRotationMatrix(Dc),this.quaternion.premultiply(Ig.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(mTe),Xz.child=t,this.dispatchEvent(Xz),Xz.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(vTe),Yz.child=t,this.dispatchEvent(Yz),Yz.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),Dc.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Dc.multiply(t.parent.matrixWorld)),t.applyMatrix4(Dc),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(jS,t,pTe),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(jS,dTe,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 ql=new be,Pc=new be,qz=new be,Ic=new be,Ng=new be,Ug=new be,HQ=new be,Zz=new be,jz=new be,Kz=new be,bd=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),ql.subVectors(e,t),n.cross(ql);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){ql.subVectors(n,t),Pc.subVectors(i,t),qz.subVectors(e,t);let o=ql.dot(ql),s=ql.dot(Pc),l=ql.dot(qz),u=Pc.dot(Pc),c=Pc.dot(qz),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,Ic)===null?!1:Ic.x>=0&&Ic.y>=0&&Ic.x+Ic.y<=1}static getInterpolation(e,t,i,n,a,o,s,l){return this.getBarycoord(e,t,i,n,Ic)===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,Ic.x),l.addScaledVector(o,Ic.y),l.addScaledVector(s,Ic.z),l)}static isFrontFacing(e,t,i,n){return ql.subVectors(i,t),Pc.subVectors(e,t),ql.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 ql.subVectors(this.c,this.b),Pc.subVectors(this.a,this.b),ql.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;Ng.subVectors(n,i),Ug.subVectors(a,i),Zz.subVectors(e,i);let l=Ng.dot(Zz),u=Ug.dot(Zz);if(l<=0&&u<=0)return t.copy(i);jz.subVectors(e,n);let c=Ng.dot(jz),f=Ug.dot(jz);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(Ng,o);Kz.subVectors(e,a);let p=Ng.dot(Kz),d=Ug.dot(Kz);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(Ug,s);let m=c*d-p*f;if(m<=0&&f-c>=0&&p-d>=0)return HQ.subVectors(a,n),s=(f-c)/(f-c+(p-d)),t.copy(n).addScaledVector(HQ,s);let v=1/(m+g+h);return o=g*v,s=h*v,t.copy(i).addScaledVector(Ng,o).addScaledVector(Ug,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};var WQ={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},gh={h:0,s:0,l:0},JA={h:0,s:0,l:0};function Jz(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 nr=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=to){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=LQ(e,1),t=rn(t,0,1),i=rn(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=Jz(o,a,e+1/3),this.g=Jz(o,a,e),this.b=Jz(o,a,e-1/3)}return Er.toWorkingColorSpace(this,n),this}setStyle(e,t=to){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=to){let i=WQ[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=fh(e.r),this.g=fh(e.g),this.b=fh(e.b),this}copyLinearToSRGB(e){return this.r=kA(e.r),this.g=kA(e.g),this.b=kA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=to){return Er.fromWorkingColorSpace(jn.copy(this),e),Math.round(rn(jn.r*255,0,255))*65536+Math.round(rn(jn.g*255,0,255))*256+Math.round(rn(jn.b*255,0,255))}getHexString(e=to){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Er.workingColorSpace){Er.fromWorkingColorSpace(jn.copy(this),t);let i=jn.r,n=jn.g,a=jn.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(jn.copy(this),t),e.r=jn.r,e.g=jn.g,e.b=jn.b,e}getStyle(e=to){Er.fromWorkingColorSpace(jn.copy(this),e);let t=jn.r,i=jn.g,n=jn.b;return e!==to?`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(gh),this.setHSL(gh.h+e,gh.s+t,gh.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(gh),e.getHSL(JA);let i=zA(gh.h,JA.h,t),n=zA(gh.s,JA.s,t),a=zA(gh.l,JA.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}},jn=new nr;nr.NAMES=WQ;var gTe=0,Fu=class extends no{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gTe++}),this.uuid=Uu(),this.name="",this.type="Material",this.blending=Tc,this.side=Po,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=FS,this.blendDst=BS,this.blendEquation=Ec,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new nr(0,0,0),this.blendAlpha=0,this.depthFunc=mg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Iz,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=_d,this.stencilZFail=_d,this.stencilZPass=_d,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!==Tc&&(i.blending=this.blending),this.side!==Po&&(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!==FS&&(i.blendSrc=this.blendSrc),this.blendDst!==BS&&(i.blendDst=this.blendDst),this.blendEquation!==Ec&&(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!==mg&&(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!==Iz&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==_d&&(i.stencilFail=this.stencilFail),this.stencilZFail!==_d&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==_d&&(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 Nc=class extends Fu{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new nr(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 Yl,this.combine=SA,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 be,$A=new $t,xa=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=Nz,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=eo,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return IQ("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++)$A.fromBufferAttribute(this,t),$A.applyMatrix3(e),this.setXY(t,$A.x,$A.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=Mg(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=_a(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=_a(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=_a(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=_a(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=_a(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=_a(t,this.array),i=_a(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=_a(t,this.array),i=_a(i,this.array),n=_a(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=_a(t,this.array),i=_a(i,this.array),n=_a(n,this.array),a=_a(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!==Nz&&(e.usage=this.usage),e}};var Og=class extends xa{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var zg=class extends xa{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var Kn=class extends xa{constructor(e,t,i){super(new Float32Array(e),t,i)}};var yTe=0,tl=new Zr,$z=new nn,Fg=new be,zo=new Rc,KS=new Rc,vn=new be,so=class r extends no{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:yTe++}),this.uuid=Uu(),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(FA(e)?zg:Og)(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 er().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 tl.makeRotationFromQuaternion(e),this.applyMatrix4(tl),this}rotateX(e){return tl.makeRotationX(e),this.applyMatrix4(tl),this}rotateY(e){return tl.makeRotationY(e),this.applyMatrix4(tl),this}rotateZ(e){return tl.makeRotationZ(e),this.applyMatrix4(tl),this}translate(e,t,i){return tl.makeTranslation(e,t,i),this.applyMatrix4(tl),this}scale(e,t,i){return tl.makeScale(e,t,i),this.applyMatrix4(tl),this}lookAt(e){return $z.lookAt(e),$z.updateMatrix(),this.applyMatrix4($z.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fg).negate(),this.translate(Fg.x,Fg.y,Fg.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 Kn(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Rc);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];zo.setFromBufferAttribute(a),this.morphTargetsRelative?(vn.addVectors(this.boundingBox.min,zo.min),this.boundingBox.expandByPoint(vn),vn.addVectors(this.boundingBox.max,zo.max),this.boundingBox.expandByPoint(vn)):(this.boundingBox.expandByPoint(zo.min),this.boundingBox.expandByPoint(zo.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 dh);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(zo.setFromBufferAttribute(e),t)for(let a=0,o=t.length;a<o;a++){let s=t[a];KS.setFromBufferAttribute(s),this.morphTargetsRelative?(vn.addVectors(zo.min,KS.min),zo.expandByPoint(vn),vn.addVectors(zo.max,KS.max),zo.expandByPoint(vn)):(zo.expandByPoint(KS.min),zo.expandByPoint(KS.max))}zo.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&&(Fg.fromBufferAttribute(e,u),vn.add(Fg)),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 xa(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 $t,p=new $t,d=new $t,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 xa(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++)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 xa(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 XQ=new Zr,wd=new ZA,QA=new dh,YQ=new be,Bg=new be,kg=new be,Vg=new be,Qz=new be,eC=new be,tC=new $t,rC=new $t,iC=new $t,qQ=new be,ZQ=new be,jQ=new be,nC=new be,aC=new be,an=class extends nn{constructor(e=new so,t=new Nc){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){eC.set(0,0,0);for(let l=0,u=a.length;l<u;l++){let c=s[l],f=a[l];c!==0&&(Qz.fromBufferAttribute(f,e),o?eC.addScaledVector(Qz,c):eC.addScaledVector(Qz.sub(t),c))}t.add(eC)}return t}raycast(e,t){let i=this.geometry,n=this.material,a=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),QA.copy(i.boundingSphere),QA.applyMatrix4(a),wd.copy(e.ray).recast(e.near),!(QA.containsPoint(wd.origin)===!1&&(wd.intersectSphere(QA,YQ)===null||wd.origin.distanceToSquared(YQ)>(e.far-e.near)**2))&&(XQ.copy(a).invert(),wd.copy(e.ray).applyMatrix4(XQ),!(i.boundingBox!==null&&wd.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,wd)))}_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=oC(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=oC(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=oC(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=oC(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}}};function _Te(r,e,t,i,n,a,o,s){let l;if(e.side===Si?l=i.intersectTriangle(o,a,n,!0,s):l=i.intersectTriangle(n,a,o,e.side===Po,s),l===null)return null;aC.copy(s),aC.applyMatrix4(r.matrixWorld);let u=t.ray.origin.distanceTo(aC);return u<t.near||u>t.far?null:{distance:u,point:aC.clone(),object:r}}function oC(r,e,t,i,n,a,o,s,l,u){r.getVertexPosition(s,Bg),r.getVertexPosition(l,kg),r.getVertexPosition(u,Vg);let c=_Te(r,e,t,i,Bg,kg,Vg,nC);if(c){n&&(tC.fromBufferAttribute(n,s),rC.fromBufferAttribute(n,l),iC.fromBufferAttribute(n,u),c.uv=bd.getInterpolation(nC,Bg,kg,Vg,tC,rC,iC,new $t)),a&&(tC.fromBufferAttribute(a,s),rC.fromBufferAttribute(a,l),iC.fromBufferAttribute(a,u),c.uv1=bd.getInterpolation(nC,Bg,kg,Vg,tC,rC,iC,new $t)),o&&(qQ.fromBufferAttribute(o,s),ZQ.fromBufferAttribute(o,l),jQ.fromBufferAttribute(o,u),c.normal=bd.getInterpolation(nC,Bg,kg,Vg,qQ,ZQ,jQ,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};bd.getNormal(Bg,kg,Vg,f.normal),c.face=f}return c}var yh=class r extends so{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 Kn(u,3)),this.setAttribute("normal",new Kn(c,3)),this.setAttribute("uv",new Kn(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,P=w+1,U=T+1,B=0,z=0,k=new be;for(let G=0;G<U;G++){let Y=G*E-R;for(let J=0;J<P;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+P*G,Q=h+Y+P*(G+1),V=h+(Y+1)+P*(G+1),K=h+(Y+1)+P*G;l.push(J,Q,K),l.push(Q,V,K),z+=6}s.addGroup(p,z,C),p+=z,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 Uc(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=Uc(r[t]);for(let n in i)e[n]=i[n]}return e}function KQ(r){let e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function sC(r){return r.getRenderTarget()===null?r.outputColorSpace:Er.workingColorSpace}var JQ={clone:Uc,merge:Jn};var $Q=`
  2231. void main() {
  2232. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  2233. }
  2234. `;var QQ=`
  2235. void main() {
  2236. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  2237. }
  2238. `;var Sa=class extends Fu{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=$Q,this.fragmentShader=QQ,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=Uc(e.uniforms),this.uniformsGroups=KQ(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 Gg=class extends nn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Zr,this.projectionMatrix=new Zr,this.projectionMatrixInverse=new Zr,this.coordinateSystem=io}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 _h=new be,eee=new $t,tee=new $t,Wi=class extends Gg{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=XS*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(OA*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return XS*2*Math.atan(Math.tan(OA*.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){_h.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(_h.x,_h.y).multiplyScalar(-e/_h.z),_h.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(_h.x,_h.y).multiplyScalar(-e/_h.z)}getViewSize(e,t){return this.getViewBounds(e,eee,tee),t.subVectors(tee,eee)}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(OA*.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 Hg=-90,Wg=1,lC=class extends nn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new Wi(Hg,Wg,e,t);n.layers=this.layers,this.add(n);let a=new Wi(Hg,Wg,e,t);a.layers=this.layers,this.add(a);let o=new Wi(Hg,Wg,e,t);o.layers=this.layers,this.add(o);let s=new Wi(Hg,Wg,e,t);s.layers=this.layers,this.add(s);let l=new Wi(Hg,Wg,e,t);l.layers=this.layers,this.add(l);let u=new Wi(Hg,Wg,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===io)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===xd)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 Xg=class extends ao{constructor(e,t,i,n,a,o,s,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:Vl,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 uC=class extends oo{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 Xg(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:tn}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 yh(5,5,5),a=new Sa({name:"CubemapFromEquirect",uniforms:Uc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Si,blending:Js});a.uniforms.tEquirect.value=t;let o=new an(n,a),s=t.minFilter;return t.minFilter===Gl&&(t.minFilter=tn),new lC(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 eF=new be,xTe=new be,STe=new er,Zl=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=eF.subVectors(i,t).cross(xTe.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(eF),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||STe.getNormalMatrix(e),n=this.coplanarPoint(eF).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 Td=new dh,cC=new be,xh=class{constructor(e=new Zl,t=new Zl,i=new Zl,n=new Zl,a=new Zl,o=new Zl){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=io){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===io)i[5].setComponents(l+s,h+f,m+g,x+y).normalize();else if(t===xd)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(),Td.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Td.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Td)}intersectsSprite(e){return Td.center.set(0,0,0),Td.radius=.7071067811865476,Td.applyMatrix4(e.matrixWorld),this.intersectsSphere(Td)}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(cC.x=n.normal.x>0?e.max.x:e.min.x,cC.y=n.normal.y>0?e.max.y:e.min.y,cC.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(cC)<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 fC(){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 ree(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 Yg=class r extends so{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 Kn(d,3)),this.setAttribute("normal",new Kn(g,3)),this.setAttribute("uv",new Kn(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 iee=`
  2258. #ifdef USE_ALPHAHASH
  2259. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  2260. #endif
  2261. `;var nee=`
  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 aee=`
  2310. #ifdef USE_ALPHAMAP
  2311. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  2312. #endif
  2313. `;var oee=`
  2314. #ifdef USE_ALPHAMAP
  2315. uniform sampler2D alphaMap;
  2316. #endif
  2317. `;var see=`
  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 lee=`
  2327. #ifdef USE_ALPHATEST
  2328. uniform float alphaTest;
  2329. #endif
  2330. `;var uee=`
  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 cee=`
  2347. #ifdef USE_AOMAP
  2348. uniform sampler2D aoMap;
  2349. uniform float aoMapIntensity;
  2350. #endif
  2351. `;var fee=`
  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 hee=`
  2368. #ifdef USE_BATCHING
  2369. mat4 batchingMatrix = getBatchingMatrix( batchId );
  2370. #endif
  2371. `;var pee=`
  2372. vec3 transformed = vec3( position );
  2373. #ifdef USE_ALPHAHASH
  2374. vPosition = vec3( position );
  2375. #endif
  2376. `;var dee=`
  2377. vec3 objectNormal = vec3( normal );
  2378. #ifdef USE_TANGENT
  2379. vec3 objectTangent = vec3( tangent.xyz );
  2380. #endif
  2381. `;var mee=`
  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 vee=`
  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 gee=`
  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 yee=`
  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 _ee=`
  2558. #if NUM_CLIPPING_PLANES > 0
  2559. varying vec3 vClipPosition;
  2560. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  2561. #endif
  2562. `;var xee=`
  2563. #if NUM_CLIPPING_PLANES > 0
  2564. varying vec3 vClipPosition;
  2565. #endif
  2566. `;var See=`
  2567. #if NUM_CLIPPING_PLANES > 0
  2568. vClipPosition = - mvPosition.xyz;
  2569. #endif
  2570. `;var Mee=`
  2571. #if defined( USE_COLOR_ALPHA )
  2572. diffuseColor *= vColor;
  2573. #elif defined( USE_COLOR )
  2574. diffuseColor.rgb *= vColor;
  2575. #endif
  2576. `;var bee=`
  2577. #if defined( USE_COLOR_ALPHA )
  2578. varying vec4 vColor;
  2579. #elif defined( USE_COLOR )
  2580. varying vec3 vColor;
  2581. #endif
  2582. `;var wee=`
  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 Tee=`
  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 Eee=`
  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 Aee=`
  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 Cee=`
  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 Ree=`
  2832. #ifdef USE_DISPLACEMENTMAP
  2833. uniform sampler2D displacementMap;
  2834. uniform float displacementScale;
  2835. uniform float displacementBias;
  2836. #endif
  2837. `;var Lee=`
  2838. #ifdef USE_DISPLACEMENTMAP
  2839. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  2840. #endif
  2841. `;var Dee=`
  2842. #ifdef USE_EMISSIVEMAP
  2843. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  2844. totalEmissiveRadiance *= emissiveColor.rgb;
  2845. #endif
  2846. `;var Pee=`
  2847. #ifdef USE_EMISSIVEMAP
  2848. uniform sampler2D emissiveMap;
  2849. #endif
  2850. `;var Iee=`
  2851. gl_FragColor = linearToOutputTexel( gl_FragColor );
  2852. `;var Nee=`
  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 Uee=`
  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 Oee=`
  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 zee=`
  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 Fee=`
  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 Bee=`
  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 kee=`
  2974. #ifdef USE_FOG
  2975. vFogDepth = - mvPosition.z;
  2976. #endif
  2977. `;var Vee=`
  2978. #ifdef USE_FOG
  2979. varying float vFogDepth;
  2980. #endif
  2981. `;var Gee=`
  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 Hee=`
  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 Wee=`
  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 Xee=`
  3017. #ifdef USE_LIGHTMAP
  3018. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  3019. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  3020. reflectedLight.indirectDiffuse += lightMapIrradiance;
  3021. #endif
  3022. `;var Yee=`
  3023. #ifdef USE_LIGHTMAP
  3024. uniform sampler2D lightMap;
  3025. uniform float lightMapIntensity;
  3026. #endif
  3027. `;var qee=`
  3028. LambertMaterial material;
  3029. material.diffuseColor = diffuseColor.rgb;
  3030. material.specularStrength = specularStrength;
  3031. `;var Zee=`
  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 jee=`
  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 Kee=`
  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 Jee=`
  3224. ToonMaterial material;
  3225. material.diffuseColor = diffuseColor.rgb;
  3226. `;var $ee=`
  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 Qee=`
  3241. BlinnPhongMaterial material;
  3242. material.diffuseColor = diffuseColor.rgb;
  3243. material.specularColor = specular;
  3244. material.specularShininess = shininess;
  3245. material.specularStrength = specularStrength;
  3246. `;var ete=`
  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 tte=`
  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 rte=`
  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 ite=`
  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 nte=`
  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 ate=`
  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 ote=`
  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 ste=`
  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 lte=`
  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 ute=`
  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 cte=`
  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 fte=`
  3916. #ifdef USE_MAP
  3917. uniform sampler2D map;
  3918. #endif
  3919. `;var hte=`
  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 pte=`
  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 dte=`
  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 mte=`
  3955. #ifdef USE_METALNESSMAP
  3956. uniform sampler2D metalnessMap;
  3957. #endif
  3958. `;var vte=`
  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 gte=`
  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 yte=`
  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 _te=`
  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 xte=`
  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 Ste=`
  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 Mte=`
  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 bte=`
  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 wte=`
  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 Tte=`
  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 Ete=`
  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 Ate=`
  4158. #ifdef USE_CLEARCOAT
  4159. vec3 clearcoatNormal = nonPerturbedNormal;
  4160. #endif
  4161. `;var Cte=`
  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 Rte=`
  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 Lte=`
  4179. #ifdef USE_IRIDESCENCEMAP
  4180. uniform sampler2D iridescenceMap;
  4181. #endif
  4182. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  4183. uniform sampler2D iridescenceThicknessMap;
  4184. #endif
  4185. `;var Dte=`
  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 Pte=`
  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 Ite=`
  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 Nte=`
  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 Ute=`
  4260. #ifdef DITHERING
  4261. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  4262. #endif
  4263. `;var Ote=`
  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 zte=`
  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 Fte=`
  4285. #ifdef USE_ROUGHNESSMAP
  4286. uniform sampler2D roughnessMap;
  4287. #endif
  4288. `;var Bte=`
  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 kte=`
  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 Vte=`
  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 Gte=`
  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 Hte=`
  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 Wte=`
  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 Xte=`
  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 Yte=`
  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 qte=`
  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 Zte=`
  4688. #ifdef USE_SPECULARMAP
  4689. uniform sampler2D specularMap;
  4690. #endif
  4691. `;var jte=`
  4692. #if defined( TONE_MAPPING )
  4693. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  4694. #endif
  4695. `;var Kte=`
  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 Jte=`
  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 $te=`
  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 Qte=`
  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 ere=`
  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 tre=`
  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 rre=`
  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 ire=`
  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. `,nre=`
  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 are=`
  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. `,ore=`
  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 sre=`
  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. `,lre=`
  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 ure=`
  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. `,cre=`
  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 fre=`
  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. `,hre=`
  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 pre=`
  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. `,dre=`
  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 mre=`
  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. `,vre=`
  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 gre=`
  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. `,yre=`
  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 _re=`
  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. `,xre=`
  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 Sre=`
  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. `,Mre=`
  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 bre=`
  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. `,wre=`
  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 Tre=`
  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. `,Ere=`
  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 Are=`
  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. `,Cre=`
  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 Rre=`
  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. `,Lre=`
  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 Dre=`
  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. `,Pre=`
  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 Ire=`
  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. `,Nre=`
  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 Ure=`
  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. `,Ore=`
  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:iee,alphahash_pars_fragment:nee,alphamap_fragment:aee,alphamap_pars_fragment:oee,alphatest_fragment:see,alphatest_pars_fragment:lee,aomap_fragment:uee,aomap_pars_fragment:cee,batching_pars_vertex:fee,batching_vertex:hee,begin_vertex:pee,beginnormal_vertex:dee,bsdfs:mee,iridescence_fragment:vee,bumpmap_pars_fragment:gee,clipping_planes_fragment:yee,clipping_planes_pars_fragment:_ee,clipping_planes_pars_vertex:xee,clipping_planes_vertex:See,color_fragment:Mee,color_pars_fragment:bee,color_pars_vertex:wee,color_vertex:Tee,common:Eee,cube_uv_reflection_fragment:Aee,defaultnormal_vertex:Cee,displacementmap_pars_vertex:Ree,displacementmap_vertex:Lee,emissivemap_fragment:Dee,emissivemap_pars_fragment:Pee,colorspace_fragment:Iee,colorspace_pars_fragment:Nee,envmap_fragment:Uee,envmap_common_pars_fragment:Oee,envmap_pars_fragment:zee,envmap_pars_vertex:Fee,envmap_physical_pars_fragment:Kee,envmap_vertex:Bee,fog_vertex:kee,fog_pars_vertex:Vee,fog_fragment:Gee,fog_pars_fragment:Hee,gradientmap_pars_fragment:Wee,lightmap_fragment:Xee,lightmap_pars_fragment:Yee,lights_lambert_fragment:qee,lights_lambert_pars_fragment:Zee,lights_pars_begin:jee,lights_toon_fragment:Jee,lights_toon_pars_fragment:$ee,lights_phong_fragment:Qee,lights_phong_pars_fragment:ete,lights_physical_fragment:tte,lights_physical_pars_fragment:rte,lights_fragment_begin:ite,lights_fragment_maps:nte,lights_fragment_end:ate,logdepthbuf_fragment:ote,logdepthbuf_pars_fragment:ste,logdepthbuf_pars_vertex:lte,logdepthbuf_vertex:ute,map_fragment:cte,map_pars_fragment:fte,map_particle_fragment:hte,map_particle_pars_fragment:pte,metalnessmap_fragment:dte,metalnessmap_pars_fragment:mte,morphinstance_vertex:vte,morphcolor_vertex:gte,morphnormal_vertex:yte,morphtarget_pars_vertex:_te,morphtarget_vertex:xte,normal_fragment_begin:Ste,normal_fragment_maps:Mte,normal_pars_fragment:bte,normal_pars_vertex:wte,normal_vertex:Tte,normalmap_pars_fragment:Ete,clearcoat_normal_fragment_begin:Ate,clearcoat_normal_fragment_maps:Cte,clearcoat_pars_fragment:Rte,iridescence_pars_fragment:Lte,opaque_fragment:Dte,packing:Pte,premultiplied_alpha_fragment:Ite,project_vertex:Nte,dithering_fragment:Ute,dithering_pars_fragment:Ote,roughnessmap_fragment:zte,roughnessmap_pars_fragment:Fte,shadowmap_pars_fragment:Bte,shadowmap_pars_vertex:kte,shadowmap_vertex:Vte,shadowmask_pars_fragment:Gte,skinbase_vertex:Hte,skinning_pars_vertex:Wte,skinning_vertex:Xte,skinnormal_vertex:Yte,specularmap_fragment:qte,specularmap_pars_fragment:Zte,tonemapping_fragment:jte,tonemapping_pars_fragment:Kte,transmission_fragment:Jte,transmission_pars_fragment:$te,uv_pars_fragment:Qte,uv_pars_vertex:ere,uv_vertex:tre,worldpos_vertex:rre,background_vert:ire,background_frag:nre,backgroundCube_vert:are,backgroundCube_frag:ore,cube_vert:sre,cube_frag:lre,depth_vert:ure,depth_frag:cre,distanceRGBA_vert:fre,distanceRGBA_frag:hre,equirect_vert:pre,equirect_frag:dre,linedashed_vert:mre,linedashed_frag:vre,meshbasic_vert:gre,meshbasic_frag:yre,meshlambert_vert:_re,meshlambert_frag:xre,meshmatcap_vert:Sre,meshmatcap_frag:Mre,meshnormal_vert:bre,meshnormal_frag:wre,meshphong_vert:Tre,meshphong_frag:Ere,meshphysical_vert:Are,meshphysical_frag:Cre,meshtoon_vert:Rre,meshtoon_frag:Lre,points_vert:Dre,points_frag:Pre,shadow_vert:Ire,shadow_frag:Nre,sprite_vert:Ure,sprite_frag:Ore};var ht={common:{diffuse:{value:new nr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new er},alphaMap:{value:null},alphaMapTransform:{value:new er},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new er}},envmap:{envMap:{value:null},envMapRotation:{value:new er},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new er}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new er}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new er},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new er},normalScale:{value:new $t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new er},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new er}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new er}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new er}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new nr(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 nr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new er},alphaTest:{value:0},uvTransform:{value:new er}},sprite:{diffuse:{value:new nr(16777215)},opacity:{value:1},center:{value:new $t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new er},alphaMap:{value:null},alphaMapTransform:{value:new er},alphaTest:{value:0}}};var rl={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 nr(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 nr(0)},specular:{value:new nr(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 nr(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 nr(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 er},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 er}},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 nr(0)},opacity:{value:1}}]),vertexShader:pr.shadow_vert,fragmentShader:pr.shadow_frag}};rl.physical={uniforms:Jn([rl.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new er},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new er},clearcoatNormalScale:{value:new $t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new er},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new er},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new er},sheen:{value:0},sheenColor:{value:new nr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new er},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new er},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new er},transmissionSamplerSize:{value:new $t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new er},attenuationDistance:{value:0},attenuationColor:{value:new nr(0)},specularColor:{value:new nr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new er},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new er},anisotropyVector:{value:new $t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new er}}]),vertexShader:pr.meshphysical_vert,fragmentShader:pr.meshphysical_frag};var hC={r:0,b:0,g:0},Ed=new Yl,BTe=new Zr;function zre(r,e,t,i,n,a,o){let s=new nr(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===ch)?(c===void 0&&(c=new an(new yh(1,1,1),new Sa({name:"BackgroundCubeMaterial",uniforms:Uc(rl.backgroundCube.uniforms),vertexShader:rl.backgroundCube.vertexShader,fragmentShader:rl.backgroundCube.fragmentShader,side:Si,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)),Ed.copy(v.backgroundRotation),Ed.x*=-1,Ed.y*=-1,Ed.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Ed.y*=-1,Ed.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(BTe.makeRotationFromEuler(Ed)),c.material.toneMapped=Er.getTransfer(y.colorSpace)!==qr,(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 an(new Yg(2,2),new Sa({name:"BackgroundMaterial",uniforms:Uc(rl.background.uniforms),vertexShader:rl.background.vertexShader,fragmentShader:rl.background.fragmentShader,side:Po,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)!==qr,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(hC,sC(r)),i.buffers.color.setClear(hC.r,hC.g,hC.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 Fre(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,P,U,B,z){let k=!1;if(o){let G=g(B,U,P);u!==G&&(u=G,p(u.object)),k=v(A,B,U,z),k&&_(A,B,U,z)}else{let G=P.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)}z!==null&&t.update(z,r.ELEMENT_ARRAY_BUFFER),(k||c)&&(c=!1,T(A,P,U,B),z!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(z).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,P,U){let B=U.wireframe===!0,z=s[A.id];z===void 0&&(z={},s[A.id]=z);let k=z[P.id];k===void 0&&(k={},z[P.id]=k);let G=k[B];return G===void 0&&(G=m(h()),k[B]=G),G}function m(A){let P=[],U=[],B=[];for(let z=0;z<n;z++)P[z]=0,U[z]=0,B[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:P,enabledAttributes:U,attributeDivisors:B,object:A,attributes:{},index:null}}function v(A,P,U,B){let z=u.attributes,k=P.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=z[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,P,U,B){let z={},k=P.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),z[J]=K,G++}u.attributes=z,u.attributesNum=G,u.index=B}function y(){let A=u.newAttributes;for(let P=0,U=A.length;P<U;P++)A[P]=0}function x(A){M(A,0)}function M(A,P){let U=u.newAttributes,B=u.enabledAttributes,z=u.attributeDivisors;U[A]=1,B[A]===0&&(r.enableVertexAttribArray(A),B[A]=1),z[A]!==P&&((i.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](A,P),z[A]=P)}function S(){let A=u.newAttributes,P=u.enabledAttributes;for(let U=0,B=P.length;U<B;U++)P[U]!==A[U]&&(r.disableVertexAttribArray(U),P[U]=0)}function w(A,P,U,B,z,k,G){G===!0?r.vertexAttribIPointer(A,P,U,z,k):r.vertexAttribPointer(A,P,U,B,z,k)}function T(A,P,U,B){if(i.isWebGL2===!1&&(A.isInstancedMesh||B.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();let z=B.attributes,k=U.getAttributes(),G=P.defaultAttributeValues;for(let Y in k){let J=k[Y];if(J.location>=0){let Q=z[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===bA);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 P=s[A];for(let U in P){let B=P[U];for(let z in B)d(B[z].object),delete B[z];delete P[U]}delete s[A]}}function b(A){if(s[A.id]===void 0)return;let P=s[A.id];for(let U in P){let B=P[U];for(let z in B)d(B[z].object),delete B[z];delete P[U]}delete s[A.id]}function E(A){for(let P in s){let U=s[P];if(U[A.id]===void 0)continue;let B=U[A.id];for(let z in B)d(B[z].object),delete B[z];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 Bre(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 kre(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 Vre(r){let e=this,t=null,i=0,n=!1,a=!1,o=new Zl,s=new er,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 Gre(r){let e=new WeakMap;function t(o,s){return s===kS?o.mapping=Vl:s===VS&&(o.mapping=Iu),o}function i(o){if(o&&o.isTexture){let s=o.mapping;if(s===kS||s===VS)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 uC(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 qg=class extends Gg{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 jg=4,Hre=[.125,.215,.35,.446,.526,.582],Cd=20,tF=new qg,Wre=new nr,rF=null,iF=0,nF=0,Ad=(1+Math.sqrt(5))/2,Zg=1/Ad,Xre=[new be(1,1,1),new be(-1,1,1),new be(1,1,-1),new be(-1,1,-1),new be(0,Ad,Zg),new be(0,Ad,-Zg),new be(Zg,0,Ad),new be(-Zg,0,Ad),new be(Ad,Zg,0),new be(-Ad,Zg,0)],JS=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){rF=this._renderer.getRenderTarget(),iF=this._renderer.getActiveCubeFace(),nF=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=Zre(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=qre(),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(rF,iF,nF),e.scissorTest=!1,pC(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Vl||e.mapping===Iu?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),rF=this._renderer.getRenderTarget(),iF=this._renderer.getActiveCubeFace(),nF=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:tn,minFilter:tn,generateMipmaps:!1,type:Ac,format:Dn,colorSpace:ro,depthBuffer:!1},n=Yre(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Yre(e,t,i);let{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=kTe(a)),this._blurMaterial=VTe(a,e,t)}return n}_compileMaterial(e){let t=new an(this._lodPlanes[0],e);this._renderer.compile(t,tF)}_sceneToCubeUV(e,t,i,n){let s=new Wi(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(Wre),c.toneMapping=$s,c.autoClear=!1;let p=new Nc({name:"PMREM.Background",side:Si,depthWrite:!1,depthTest:!1}),d=new an(new yh,p),g=!1,m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,g=!0):(p.color.copy(Wre),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;pC(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===Vl||e.mapping===Iu;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=Zre()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=qre());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new an(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let l=this._cubeSize;pC(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,tF)}_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=Xre[(n-1)%Xre.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 an(this._lodPlanes[n],u),h=u.uniforms,p=this._sizeLods[i]-1,d=isFinite(a)?Math.PI/(2*p):2*Math.PI/(2*Cd-1),g=a/d,m=isFinite(a)?1+Math.floor(c*g):Cd;m>Cd&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Cd}`);let v=[],_=0;for(let w=0;w<Cd;++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-jg?n-y+jg:0),S=4*(this._cubeSize-x);pC(t,M,S,3*x,2*x),l.setRenderTarget(t),l.render(f,tF)}};function kTe(r){let e=[],t=[],i=[],n=r,a=r-jg+1+Hre.length;for(let o=0;o<a;o++){let s=Math.pow(2,n);t.push(s);let l=1/s;o>r-jg?l=Hre[o-r+jg-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 so;M.setAttribute("position",new xa(_,g)),M.setAttribute("uv",new xa(y,m)),M.setAttribute("faceIndex",new xa(x,v)),e.push(M),n>jg&&n--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function Yre(r,e,t){let i=new oo(r,e,t);return i.texture.mapping=ch,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function pC(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function VTe(r,e,t){let i=new Float32Array(Cd),n=new be(0,1,0);return new Sa({name:"SphericalGaussianBlur",defines:{n:Cd,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:aF(),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:Js,depthTest:!1,depthWrite:!1})}function qre(){return new Sa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:aF(),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:Js,depthTest:!1,depthWrite:!1})}function Zre(){return new Sa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:aF(),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:Js,depthTest:!1,depthWrite:!1})}function aF(){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 jre(r){let e=new WeakMap,t=null;function i(s){if(s&&s.isTexture){let l=s.mapping,u=l===kS||l===VS,c=l===Vl||l===Iu;if(u||c)if(s.isRenderTargetTexture&&s.needsPMREMUpdate===!0){s.needsPMREMUpdate=!1;let f=e.get(s);return t===null&&(t=new JS(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 JS(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 Kre(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 Jre(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(FA(h)?zg:Og)(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 $re(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 Qre(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 GTe(r,e){return r[0]-e[0]}function HTe(r,e){return Math.abs(e[1])-Math.abs(r[1])}function eie(r,e,t){let i={},n=new Float32Array(8),a=new WeakMap,o=new si,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 Ag(b,T,C,g);E.type=eo,E.needsUpdate=!0;let I=w*4;for(let A=0;A<g;A++){let P=x[A],U=M[A],B=S[A],z=T*C*4*A;for(let k=0;k<P.count;k++){let G=k*I;v===!0&&(o.fromBufferAttribute(P,k),b[z+G+0]=o.x,b[z+G+1]=o.y,b[z+G+2]=o.z,b[z+G+3]=0),_===!0&&(o.fromBufferAttribute(U,k),b[z+G+4]=o.x,b[z+G+5]=o.y,b[z+G+6]=o.z,b[z+G+7]=0),y===!0&&(o.fromBufferAttribute(B,k),b[z+G+8]=o.x,b[z+G+9]=o.y,b[z+G+10]=o.z,b[z+G+11]=B.itemSize===4?o.w:1)}}m={count:g,texture:E,size:new $t(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(HTe);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(GTe);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 tie(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 Kg=class extends ao{constructor(e,t,i,n,a,o,s,l,u,c){if(c=c!==void 0?c:Hl,c!==Hl&&c!==Nu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===Hl&&(i=Uo),i===void 0&&c===Nu&&(i=Qs),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:Gi,this.minFilter=l!==void 0?l:Gi,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 lie=new ao,uie=new Kg(1,1);uie.compareFunction=UA;var cie=new Ag,fie=new GA,hie=new Xg,rie=[],iie=[],nie=new Float32Array(16),aie=new Float32Array(9),oie=new Float32Array(4);function Jg(r,e,t){let i=r[0];if(i<=0||i>0)return r;let n=e*t,a=rie[n];if(a===void 0&&(a=new Float32Array(n),rie[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 on(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 sn(r,e){for(let t=0,i=e.length;t<i;t++)r[t]=e[t]}function dC(r,e){let t=iie[e];t===void 0&&(t=new Int32Array(e),iie[e]=t);for(let i=0;i!==e;++i)t[i]=r.allocateTextureUnit();return t}function WTe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function XTe(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(on(t,e))return;r.uniform2fv(this.addr,e),sn(t,e)}}function YTe(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(on(t,e))return;r.uniform3fv(this.addr,e),sn(t,e)}}function qTe(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(on(t,e))return;r.uniform4fv(this.addr,e),sn(t,e)}}function ZTe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(on(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),sn(t,e)}else{if(on(t,i))return;oie.set(i),r.uniformMatrix2fv(this.addr,!1,oie),sn(t,i)}}function jTe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(on(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),sn(t,e)}else{if(on(t,i))return;aie.set(i),r.uniformMatrix3fv(this.addr,!1,aie),sn(t,i)}}function KTe(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(on(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),sn(t,e)}else{if(on(t,i))return;nie.set(i),r.uniformMatrix4fv(this.addr,!1,nie),sn(t,i)}}function JTe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function $Te(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(on(t,e))return;r.uniform2iv(this.addr,e),sn(t,e)}}function QTe(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(on(t,e))return;r.uniform3iv(this.addr,e),sn(t,e)}}function eEe(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(on(t,e))return;r.uniform4iv(this.addr,e),sn(t,e)}}function tEe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function rEe(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(on(t,e))return;r.uniform2uiv(this.addr,e),sn(t,e)}}function iEe(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(on(t,e))return;r.uniform3uiv(this.addr,e),sn(t,e)}}function nEe(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(on(t,e))return;r.uniform4uiv(this.addr,e),sn(t,e)}}function aEe(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?uie:lie;t.setTexture2D(e||a,n)}function oEe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||fie,n)}function sEe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTextureCube(e||hie,n)}function lEe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||cie,n)}function uEe(r){switch(r){case 5126:return WTe;case 35664:return XTe;case 35665:return YTe;case 35666:return qTe;case 35674:return ZTe;case 35675:return jTe;case 35676:return KTe;case 5124:case 35670:return JTe;case 35667:case 35671:return $Te;case 35668:case 35672:return QTe;case 35669:case 35673:return eEe;case 5125:return tEe;case 36294:return rEe;case 36295:return iEe;case 36296:return nEe;case 35678:case 36198:case 36298:case 36306:case 35682:return aEe;case 35679:case 36299:case 36307:return oEe;case 35680:case 36300:case 36308:case 36293:return sEe;case 36289:case 36303:case 36311:case 36292:return lEe}}function cEe(r,e){r.uniform1fv(this.addr,e)}function fEe(r,e){let t=Jg(e,this.size,2);r.uniform2fv(this.addr,t)}function hEe(r,e){let t=Jg(e,this.size,3);r.uniform3fv(this.addr,t)}function pEe(r,e){let t=Jg(e,this.size,4);r.uniform4fv(this.addr,t)}function dEe(r,e){let t=Jg(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function mEe(r,e){let t=Jg(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function vEe(r,e){let t=Jg(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function gEe(r,e){r.uniform1iv(this.addr,e)}function yEe(r,e){r.uniform2iv(this.addr,e)}function _Ee(r,e){r.uniform3iv(this.addr,e)}function xEe(r,e){r.uniform4iv(this.addr,e)}function SEe(r,e){r.uniform1uiv(this.addr,e)}function MEe(r,e){r.uniform2uiv(this.addr,e)}function bEe(r,e){r.uniform3uiv(this.addr,e)}function wEe(r,e){r.uniform4uiv(this.addr,e)}function TEe(r,e,t){let i=this.cache,n=e.length,a=dC(t,n);on(i,a)||(r.uniform1iv(this.addr,a),sn(i,a));for(let o=0;o!==n;++o)t.setTexture2D(e[o]||lie,a[o])}function EEe(r,e,t){let i=this.cache,n=e.length,a=dC(t,n);on(i,a)||(r.uniform1iv(this.addr,a),sn(i,a));for(let o=0;o!==n;++o)t.setTexture3D(e[o]||fie,a[o])}function AEe(r,e,t){let i=this.cache,n=e.length,a=dC(t,n);on(i,a)||(r.uniform1iv(this.addr,a),sn(i,a));for(let o=0;o!==n;++o)t.setTextureCube(e[o]||hie,a[o])}function CEe(r,e,t){let i=this.cache,n=e.length,a=dC(t,n);on(i,a)||(r.uniform1iv(this.addr,a),sn(i,a));for(let o=0;o!==n;++o)t.setTexture2DArray(e[o]||cie,a[o])}function REe(r){switch(r){case 5126:return cEe;case 35664:return fEe;case 35665:return hEe;case 35666:return pEe;case 35674:return dEe;case 35675:return mEe;case 35676:return vEe;case 5124:case 35670:return gEe;case 35667:case 35671:return yEe;case 35668:case 35672:return _Ee;case 35669:case 35673:return xEe;case 5125:return SEe;case 36294:return MEe;case 36295:return bEe;case 36296:return wEe;case 35678:case 36198:case 36298:case 36306:case 35682:return TEe;case 35679:case 36299:case 36307:return EEe;case 35680:case 36300:case 36308:case 36293:return AEe;case 36289:case 36303:case 36311:case 36292:return CEe}}var sF=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=uEe(t.type)}},lF=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=REe(t.type)}},uF=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)}}},oF=/(\w+)(\])?(\[|\.)?/g;function sie(r,e){r.seq.push(e),r.map[e.id]=e}function LEe(r,e,t){let i=r.name,n=i.length;for(oF.lastIndex=0;;){let a=oF.exec(i),o=oF.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){sie(t,u===void 0?new sF(s,r,e):new lF(s,r,e));break}else{let f=t.map[s];f===void 0&&(f=new uF(s),sie(t,f)),t=f}}}var Sh=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);LEe(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 cF(r,e,t){let i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}var DEe=37297,PEe=0;function IEe(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 NEe(r){let e=Er.getPrimaries(Er.workingColorSpace),t=Er.getPrimaries(r),i;switch(e===t?i="":e===Sg&&t===xg?i="LinearDisplayP3ToLinearSRGB":e===xg&&t===Sg&&(i="LinearSRGBToLinearDisplayP3"),r){case ro:case yd:return[i,"LinearTransferOETF"];case to:case yg:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[i,"LinearTransferOETF"]}}function pie(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. `+IEe(r.getShaderSource(e),o)}else return n}function UEe(r,e){let t=NEe(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function OEe(r,e){let t;switch(e){case nQ:t="Linear";break;case aQ:t="Reinhard";break;case oQ:t="OptimizedCineon";break;case sQ:t="ACESFilmic";break;case uQ:t="AgX";break;case cQ:t="Neutral";break;case lQ:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function zEe(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($g).join(`
  6459. `)}function FEe(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter($g).join(`
  6460. `)}function BEe(r){let e=[];for(let t in r){let i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  6461. `)}function kEe(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 $g(r){return r!==""}function die(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 mie(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var VEe=/^[ \t]*#include +<([\w\d./]+)>/gm;function fF(r){return r.replace(VEe,HEe)}var GEe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function HEe(r,e){let t=pr[e];if(t===void 0){let i=GEe.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 fF(t)}var WEe=/#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 vie(r){return r.replace(WEe,XEe)}function XEe(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 gie(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 YEe(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===xA?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===P$?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===kl&&(e="SHADOWMAP_TYPE_VSM"),e}function qEe(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Vl:case Iu:e="ENVMAP_TYPE_CUBE";break;case ch:e="ENVMAP_TYPE_CUBE_UV";break}return e}function ZEe(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Iu:e="ENVMAP_MODE_REFRACTION";break}return e}function jEe(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case SA:e="ENVMAP_BLENDING_MULTIPLY";break;case rQ:e="ENVMAP_BLENDING_MIX";break;case iQ:e="ENVMAP_BLENDING_ADD";break}return e}function KEe(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 yie(r,e,t,i){let n=r.getContext(),a=t.defines,o=t.vertexShader,s=t.fragmentShader,l=YEe(t),u=qEe(t),c=ZEe(t),f=jEe(t),h=KEe(t),p=t.isWebGL2?"":zEe(t),d=FEe(t),g=BEe(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($g).join(`
  6483. `),v.length>0&&(v+=`
  6484. `),_=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter($g).join(`
  6485. `),_.length>0&&(_+=`
  6486. `)):(v=[gie(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($g).join(`
  6488. `),_=[p,gie(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!==$s?"#define TONE_MAPPING":"",t.toneMapping!==$s?pr.tonemapping_pars_fragment:"",t.toneMapping!==$s?OEe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",pr.colorspace_pars_fragment,UEe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  6489. `].filter($g).join(`
  6490. `)),o=fF(o),o=die(o,t),o=mie(o,t),s=fF(s),s=die(s,t),s=mie(s,t),o=vie(o),s=vie(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===Uz?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Uz?"":"#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=cF(n,n.VERTEX_SHADER,x),w=cF(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(),P=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 z=pie(n,S,"vertex"),k=pie(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. `+z+`
  6500. `+k)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(A===""||P==="")&&(B=!1);B&&(I.diagnostics={runnable:U,programLog:R,vertexShader:{log:A,prefix:v},fragmentShader:{log:P,prefix:_}})}n.deleteShader(S),n.deleteShader(w),C=new Sh(n,m),b=kEe(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,DEe)),E},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=PEe++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}var JEe=0,mC=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 hF(e),t.set(e,i)),i}},hF=class{constructor(e){this.id=JEe++,this.code=e,this.usedTimes=0}};function _ie(r,e,t,i,n,a,o){let s=new Pg,l=new mC,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 P=R.fog,U=A.geometry,B=b.isMeshStandardMaterial?R.environment:null,z=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),k=z&&z.mapping===ch?z.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 kt=rl[G];V=kt.vertexShader,K=kt.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=!!z,_e=!!b.aoMap,xe=!!b.lightMap,Le=!!b.bumpMap,Ue=!!b.normalMap,Ne=!!b.displacementMap,Ve=!!b.emissiveMap,ct=!!b.metalnessMap,F=!!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,Fe=!!b.specularMap,we=!!b.specularColorMap,Ie=!!b.specularIntensityMap,st=he&&!!b.transmissionMap,Je=he&&!!b.thicknessMap,Gt=!!b.gradientMap,X=!!b.alphaMap,Te=b.alphaTest>0,te=!!b.alphaHash,Me=!!b.extensions,De=$s;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(De=r.toneMapping);let St={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:ro,alphaToCoverage:!!b.alphaToCoverage,map:q,matcap:H,envMap:We,envMapMode:We&&z.mapping,envMapCubeUVHeight:k,aoMap:_e,lightMap:xe,bumpMap:Le,normalMap:Ue,displacementMap:p&&Ne,emissiveMap:Ve,normalMapObjectSpace:Ue&&b.normalMapType===MQ,normalMapTangentSpace:Ue&&b.normalMapType===SQ,metalnessMap:ct,roughnessMap:F,anisotropy:L,anisotropyMap:et,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Se,clearcoatRoughnessMap:Ae,iridescence:le,iridescenceMap:nt,iridescenceThicknessMap:$,sheen:me,sheenColorMap:it,sheenRoughnessMap:Xe,specularMap:Fe,specularColorMap:we,specularIntensityMap:Ie,transmission:he,transmissionMap:st,thicknessMap:Je,gradientMap:Gt,opaque:b.transparent===!1&&b.blending===Tc&&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:F&&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:Fe&&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:!!P,useFog:b.fog===!0,fogExp2:!!P&&P.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:De,useLegacyLights:r._useLegacyLights,decodeVideoTexture:q&&b.map.isVideoTexture===!0&&Er.getTransfer(b.map.colorSpace)===qr,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Io,flipSided:b.side===Si,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 St.vertexUv1s=u.has(1),St.vertexUv2s=u.has(2),St.vertexUv3s=u.has(3),u.clear(),St}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=rl[E];I=JQ.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 P=c[R];if(P.cacheKey===E){I=P,++I.usedTimes;break}}return I===void 0&&(I=new yie(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 xie(){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 $Ee(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 Sie(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 Mie(){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||$Ee),i.length>1&&i.sort(h||Sie),n.length>1&&n.sort(h||Sie)}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 bie(){let r=new WeakMap;function e(i,n){let a=r.get(i),o;return a===void 0?(o=new Mie,r.set(i,[o])):n>=a.length?(o=new Mie,a.push(o)):o=a[n],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function QEe(){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 nr};break;case"SpotLight":t={position:new be,direction:new be,color:new nr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new be,color:new nr,distance:0,decay:0};break;case"HemisphereLight":t={direction:new be,skyColor:new nr,groundColor:new nr};break;case"RectAreaLight":t={color:new nr,position:new be,halfWidth:new be,halfHeight:new be};break}return r[e.id]=t,t}}}function eAe(){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 $t};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $t};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $t,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var tAe=0;function rAe(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function wie(r,e){let t=new QEe,i=eAe(),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 Zr,s=new Zr;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(rAe);let b=f===!0?Math.PI:1;for(let I=0,R=c.length;I<R;I++){let A=c[I],P=A.color,U=A.intensity,B=A.distance,z=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)h+=P.r*U*b,p+=P.g*U*b,d+=P.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]=z,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(P).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]=z,S++}v++}else if(A.isRectAreaLight){let k=t.get(A);k.color.copy(P).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]=z,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=tAe++)}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 Tie(r,e){let t=new wie(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 Eie(r,e){let t=new WeakMap;function i(a,o=0){let s=t.get(a),l;return s===void 0?(l=new Tie(r,e),t.set(a,[l])):o>=s.length?(l=new Tie(r,e),s.push(l)):l=s[o],l}function n(){t=new WeakMap}return{get:i,dispose:n}}var vC=class extends Fu{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=_Q,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 gC=class extends Fu{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 Aie=`
  6501. void main() {
  6502. gl_Position = vec4( position, 1.0 );
  6503. }
  6504. `,Cie=`
  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 Rie(r,e,t){let i=new xh,n=new $t,a=new $t,o=new si,s=new vC({depthPacking:xQ}),l=new gC,u={},c=t.maxTextureSize,f={[Po]:Si,[Si]:Po,[Io]:Io},h=new Sa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new $t},radius:{value:4}},vertexShader:Aie,fragmentShader:Cie}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let d=new so;d.setAttribute("position",new xa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new an(d,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=xA;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(Js),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);let R=v!==kl&&this.type===kl,A=v===kl&&this.type!==kl;for(let P=0,U=S.length;P<U;P++){let B=S[P],z=B.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;n.copy(z.mapSize);let k=z.getFrameExtents();if(n.multiply(k),a.copy(z.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/k.x),n.x=a.x*k.x,z.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/k.y),n.y=a.y*k.y,z.mapSize.y=a.y)),z.map===null||R===!0||A===!0){let Y=this.type!==kl?{minFilter:Gi,magFilter:Gi}:{};z.map!==null&&z.map.dispose(),z.map=new oo(n.x,n.y,Y),z.map.texture.name=B.name+".shadowMap",z.camera.updateProjectionMatrix()}r.setRenderTarget(z.map),r.clear();let G=z.getViewportCount();for(let Y=0;Y<G;Y++){let J=z.getViewport(Y);o.set(a.x*J.x,a.y*J.y,a.x*J.z,a.y*J.w),I.viewport(o),z.updateMatrices(B,Y),i=z.getFrustum(),x(w,T,z.camera,B,this.type)}z.isPointLightShadow!==!0&&this.type===kl&&_(z,T),z.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 oo(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 P=A[R];P===void 0&&(P=b.clone(),A[R]=P,w.addEventListener("dispose",M)),b=P}if(b.visible=w.visible,b.wireframe=w.wireframe,C===kl?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===kl)&&(!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 P=R.groups;for(let U=0,B=P.length;U<B;U++){let z=P[U],k=A[z.materialIndex];if(k&&k.visible){let G=y(S,k,C,b);S.onBeforeShadow(r,S,w,T,R,G,z),r.renderBufferDirect(T,null,R,G,S,z),S.onAfterShadow(r,S,w,T,R,G,z)}}}else if(A.visible){let P=y(S,A,C,b);S.onBeforeShadow(r,S,w,T,R,P,null),r.renderBufferDirect(T,null,R,P,S,null),S.onAfterShadow(r,S,w,T,R,P,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 Lie(r,e,t){let i=t.isWebGL2;function n(){let X=!1,Te=new si,te=null,Me=new si(0,0,0,0);return{setMask:function(De){te!==De&&!X&&(r.colorMask(De,De,De,De),te=De)},setLocked:function(De){X=De},setClear:function(De,St,kt,br,$r){$r===!0&&(De*=br,St*=br,kt*=br),Te.set(De,St,kt,br),Me.equals(Te)===!1&&(r.clearColor(De,St,kt,br),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(De){De?se(r.DEPTH_TEST):Ee(r.DEPTH_TEST)},setMask:function(De){Te!==De&&!X&&(r.depthMask(De),Te=De)},setFunc:function(De){if(te!==De){switch(De){case j$:r.depthFunc(r.NEVER);break;case K$:r.depthFunc(r.ALWAYS);break;case J$:r.depthFunc(r.LESS);break;case mg:r.depthFunc(r.LEQUAL);break;case $$:r.depthFunc(r.EQUAL);break;case Q$:r.depthFunc(r.GEQUAL);break;case eQ:r.depthFunc(r.GREATER);break;case tQ:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}te=De}},setLocked:function(De){X=De},setClear:function(De){Me!==De&&(r.clearDepth(De),Me=De)},reset:function(){X=!1,Te=null,te=null,Me=null}}}function o(){let X=!1,Te=null,te=null,Me=null,De=null,St=null,kt=null,br=null,$r=null;return{setTest:function(Ht){X||(Ht?se(r.STENCIL_TEST):Ee(r.STENCIL_TEST))},setMask:function(Ht){Te!==Ht&&!X&&(r.stencilMask(Ht),Te=Ht)},setFunc:function(Ht,Nr,ci){(te!==Ht||Me!==Nr||De!==ci)&&(r.stencilFunc(Ht,Nr,ci),te=Ht,Me=Nr,De=ci)},setOp:function(Ht,Nr,ci){(St!==Ht||kt!==Nr||br!==ci)&&(r.stencilOp(Ht,Nr,ci),St=Ht,kt=Nr,br=ci)},setLocked:function(Ht){X=Ht},setClear:function(Ht){$r!==Ht&&(r.clearStencil(Ht),$r=Ht)},reset:function(){X=!1,Te=null,te=null,Me=null,De=null,St=null,kt=null,br=null,$r=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 nr(0,0,0),b=0,E=!1,I=null,R=null,A=null,P=null,U=null,B=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),z=!1,k=0,G=r.getParameter(r.VERSION);G.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(G)[1]),z=k>=1):G.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),z=k>=2);let Y=null,J={},Q=r.getParameter(r.SCISSOR_BOX),V=r.getParameter(r.VIEWPORT),K=new si().fromArray(Q),ae=new si().fromArray(V);function ve(X,Te,te,Me){let De=new Uint8Array(4),St=r.createTexture();r.bindTexture(X,St),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let kt=0;kt<te;kt++)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,De):r.texImage2D(Te+kt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,De);return St}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(mg),Ne(!1),Ve(ez),se(r.CULL_FACE),Le(Js);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 De=X.textures;if(te.length!==De.length||te[0]!==r.COLOR_ATTACHMENT0){for(let St=0,kt=De.length;St<kt;St++)te[St]=r.COLOR_ATTACHMENT0+St;te.length=De.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={[Ec]:r.FUNC_ADD,[N$]:r.FUNC_SUBTRACT,[U$]:r.FUNC_REVERSE_SUBTRACT};if(i)_e[nz]=r.MIN,_e[az]=r.MAX;else{let X=e.get("EXT_blend_minmax");X!==null&&(_e[nz]=X.MIN_EXT,_e[az]=X.MAX_EXT)}let xe={[O$]:r.ZERO,[z$]:r.ONE,[F$]:r.SRC_COLOR,[FS]:r.SRC_ALPHA,[W$]:r.SRC_ALPHA_SATURATE,[G$]:r.DST_COLOR,[k$]:r.DST_ALPHA,[B$]:r.ONE_MINUS_SRC_COLOR,[BS]:r.ONE_MINUS_SRC_ALPHA,[H$]:r.ONE_MINUS_DST_COLOR,[V$]:r.ONE_MINUS_DST_ALPHA,[X$]:r.CONSTANT_COLOR,[Y$]:r.ONE_MINUS_CONSTANT_COLOR,[q$]:r.CONSTANT_ALPHA,[Z$]:r.ONE_MINUS_CONSTANT_ALPHA};function Le(X,Te,te,Me,De,St,kt,br,$r,Ht){if(X===Js){v===!0&&(Ee(r.BLEND),v=!1);return}if(v===!1&&(se(r.BLEND),v=!0),X!==I$){if(X!==_||Ht!==E){if((y!==Ec||S!==Ec)&&(r.blendEquation(r.FUNC_ADD),y=Ec,S=Ec),Ht)switch(X){case Tc:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case tz:r.blendFunc(r.ONE,r.ONE);break;case rz:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case iz: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 Tc:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case tz:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case rz:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case iz: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=Ht}return}De=De||Te,St=St||te,kt=kt||Me,(Te!==y||De!==S)&&(r.blendEquationSeparate(_e[Te],_e[De]),y=Te,S=De),(te!==x||Me!==M||St!==w||kt!==T)&&(r.blendFuncSeparate(xe[te],xe[Me],xe[St],xe[kt]),x=te,M=Me,w=St,T=kt),(br.equals(C)===!1||$r!==b)&&(r.blendColor(br.r,br.g,br.b,$r),C.copy(br),b=$r),_=X,E=!1}function Ue(X,Te){X.side===Io?Ee(r.CULL_FACE):se(r.CULL_FACE);let te=X.side===Si;Te&&(te=!te),Ne(te),X.blending===Tc&&X.transparent===!1?Le(Js):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)),F(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!==L$?(se(r.CULL_FACE),X!==R&&(X===ez?r.cullFace(r.BACK):X===D$?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Ee(r.CULL_FACE),R=X}function ct(X){X!==A&&(z&&r.lineWidth(X),A=X)}function F(X,Te,te){X?(se(r.POLYGON_OFFSET_FILL),(P!==Te||U!==te)&&(r.polygonOffset(Te,te),P=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 Fe(){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 Gt(){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 nr(0,0,0),b=0,E=!1,I=null,R=null,A=null,P=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:F,setScissorTest:L,activeTexture:ne,bindTexture:le,unbindTexture:me,compressedTexImage2D:he,compressedTexImage3D:et,texImage2D:Xe,texImage3D:Fe,updateUBOMapping:st,uniformBlockBinding:Je,texStorage2D:$,texStorage3D:it,texSubImage2D:Ke,texSubImage3D:Se,compressedTexSubImage2D:Ae,compressedTexSubImage3D:nt,scissor:we,viewport:Ie,reset:Gt}}function Die(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 $t,f=new WeakMap,h,p=new WeakMap,d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(F,L){return d?new OffscreenCanvas(F,L):bg("canvas")}function m(F,L,ne,le){let me=1,he=ct(F);if((he.width>le||he.height>le)&&(me=le/Math.max(he.width,he.height)),me<1||L===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap||typeof VideoFrame<"u"&&F instanceof VideoFrame){let et=L?YS: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(F,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 F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),F;return F}function v(F){let L=ct(F);return Oz(L.width)&&Oz(L.height)}function _(F){return s?!1:F.wrapS!==ya||F.wrapT!==ya||F.minFilter!==Gi&&F.minFilter!==tn}function y(F,L){return F.generateMipmaps&&L&&F.minFilter!==Gi&&F.minFilter!==tn}function x(F){r.generateMipmap(F)}function M(F,L,ne,le,me=!1){if(s===!1)return L;if(F!==null){if(r[F]!==void 0)return r[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}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?_g:Er.getTransfer(le);ne===r.FLOAT&&(he=r.RGBA32F),ne===r.HALF_FLOAT&&(he=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(he=et===qr?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(F,L,ne){return y(F,ne)===!0||F.isFramebufferTexture&&F.minFilter!==Gi&&F.minFilter!==tn?Math.log2(Math.max(L.width,L.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?L.mipmaps.length:1}function w(F){return F===Gi||F===sz||F===vg?r.NEAREST:r.LINEAR}function T(F){let L=F.target;L.removeEventListener("dispose",T),b(L),L.isVideoTexture&&f.delete(L)}function C(F){let L=F.target;L.removeEventListener("dispose",C),I(L)}function b(F){let L=i.get(F);if(L.__webglInit===void 0)return;let ne=F.source,le=p.get(ne);if(le){let me=le[L.__cacheKey];me.usedTimes--,me.usedTimes===0&&E(F),Object.keys(le).length===0&&p.delete(ne)}i.remove(F)}function E(F){let L=i.get(F);r.deleteTexture(L.__webglTexture);let ne=F.source,le=p.get(ne);delete le[L.__cacheKey],o.memory.textures--}function I(F){let L=i.get(F);if(F.depthTexture&&F.depthTexture.dispose(),F.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=F.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(F)}let R=0;function A(){R=0}function P(){let F=R;return F>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+n.maxTextures),R+=1,F}function U(F){let L=[];return L.push(F.wrapS),L.push(F.wrapT),L.push(F.wrapR||0),L.push(F.magFilter),L.push(F.minFilter),L.push(F.anisotropy),L.push(F.internalFormat),L.push(F.format),L.push(F.type),L.push(F.generateMipmaps),L.push(F.premultiplyAlpha),L.push(F.flipY),L.push(F.unpackAlignment),L.push(F.colorSpace),L.join()}function B(F,L){let ne=i.get(F);if(F.isVideoTexture&&Ne(F),F.isRenderTargetTexture===!1&&F.version>0&&ne.__version!==F.version){let le=F.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,F,L);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+L)}function z(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ae(ne,F,L);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+L)}function k(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ae(ne,F,L);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+L)}function G(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ve(ne,F,L);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+L)}let Y={[GS]:r.REPEAT,[ya]:r.CLAMP_TO_EDGE,[HS]:r.MIRRORED_REPEAT},J={[Gi]:r.NEAREST,[sz]:r.NEAREST_MIPMAP_NEAREST,[vg]:r.NEAREST_MIPMAP_LINEAR,[tn]:r.LINEAR,[MA]:r.LINEAR_MIPMAP_NEAREST,[Gl]:r.LINEAR_MIPMAP_LINEAR},Q={[bQ]:r.NEVER,[RQ]:r.ALWAYS,[wQ]:r.LESS,[UA]:r.LEQUAL,[TQ]:r.EQUAL,[CQ]:r.GEQUAL,[EQ]:r.GREATER,[AQ]:r.NOTEQUAL};function V(F,L,ne){if(L.type===eo&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===tn||L.magFilter===MA||L.magFilter===vg||L.magFilter===Gl||L.minFilter===tn||L.minFilter===MA||L.minFilter===vg||L.minFilter===Gl)&&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(F,r.TEXTURE_WRAP_S,Y[L.wrapS]),r.texParameteri(F,r.TEXTURE_WRAP_T,Y[L.wrapT]),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,Y[L.wrapR]),r.texParameteri(F,r.TEXTURE_MAG_FILTER,J[L.magFilter]),r.texParameteri(F,r.TEXTURE_MIN_FILTER,J[L.minFilter])):(r.texParameteri(F,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(F,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(L.wrapS!==ya||L.wrapT!==ya)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(F,r.TEXTURE_MAG_FILTER,w(L.magFilter)),r.texParameteri(F,r.TEXTURE_MIN_FILTER,w(L.minFilter)),L.minFilter!==Gi&&L.minFilter!==tn&&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(F,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(F,r.TEXTURE_COMPARE_FUNC,Q[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===Gi||L.minFilter!==vg&&L.minFilter!==Gl||L.type===eo&&e.has("OES_texture_float_linear")===!1||s===!1&&L.type===Ac&&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(F,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy}}}function K(F,L){let ne=!1;F.__webglInit===void 0&&(F.__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!==F.__cacheKey){me[he]===void 0&&(me[he]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),me[he].usedTimes++;let et=me[F.__cacheKey];et!==void 0&&(me[F.__cacheKey].usedTimes--,et.usedTimes===0&&E(L)),F.__cacheKey=he,F.__webglTexture=me[he].texture}return ne}function ae(F,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(F,L),he=L.source;t.bindTexture(le,F.__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===el?null:Er.getPrimaries(L.colorSpace),Ae=L.colorSpace===el||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),Fe=a.convert(L.type),we=M(L.internalFormat,Xe,Fe,L.colorSpace,L.isVideoTexture);V(le,L,it);let Ie,st=L.mipmaps,Je=s&&L.isVideoTexture!==!0&&we!==IA,Gt=et.__version===void 0||me===!0,X=he.dataReady,Te=S(L,$,it);if(L.isDepthTexture)we=r.DEPTH_COMPONENT,s?L.type===eo?we=r.DEPTH_COMPONENT32F:L.type===Uo?we=r.DEPTH_COMPONENT24:L.type===Qs?we=r.DEPTH24_STENCIL8:we=r.DEPTH_COMPONENT16:L.type===eo&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Hl&&we===r.DEPTH_COMPONENT&&L.type!==gg&&L.type!==Uo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Uo,Fe=a.convert(L.type)),L.format===Nu&&we===r.DEPTH_COMPONENT&&(we=r.DEPTH_STENCIL,L.type!==Qs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=Qs,Fe=a.convert(L.type))),Gt&&(Je?t.texStorage2D(r.TEXTURE_2D,1,we,$.width,$.height):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,Fe,null));else if(L.isDataTexture)if(st.length>0&&it){Je&&Gt&&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,Fe,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,Fe,Ie.data);L.generateMipmaps=!1}else Je?(Gt&&t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height),X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,$.width,$.height,Xe,Fe,$.data)):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,Fe,$.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){Je&&Gt&&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!==Dn?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,Fe,Ie.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Xe,Fe,Ie.data)}else{Je&&Gt&&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!==Dn?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,Fe,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,Fe,Ie.data)}else if(L.isDataArrayTexture)Je?(Gt&&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,Fe,$.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,we,$.width,$.height,$.depth,0,Xe,Fe,$.data);else if(L.isData3DTexture)Je?(Gt&&t.texStorage3D(r.TEXTURE_3D,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,Xe,Fe,$.data)):t.texImage3D(r.TEXTURE_3D,0,we,$.width,$.height,$.depth,0,Xe,Fe,$.data);else if(L.isFramebufferTexture){if(Gt)if(Je)t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height);else{let te=$.width,Me=$.height;for(let De=0;De<Te;De++)t.texImage2D(r.TEXTURE_2D,De,we,te,Me,0,Xe,Fe,null),te>>=1,Me>>=1}}else if(st.length>0&&it){if(Je&&Gt){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,Fe,Ie):t.texImage2D(r.TEXTURE_2D,te,we,Xe,Fe,Ie);L.generateMipmaps=!1}else if(Je){if(Gt){let te=ct($);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Xe,Fe,$)}else t.texImage2D(r.TEXTURE_2D,0,we,Xe,Fe,$);y(L,it)&&x(le),et.__version=he.version,L.onUpdate&&L.onUpdate(L)}F.__version=L.version}function ve(F,L,ne){if(L.image.length!==6)return;let le=K(F,L),me=L.source;t.bindTexture(r.TEXTURE_CUBE_MAP,F.__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===el?null:Er.getPrimaries(L.colorSpace),Se=L.colorSpace===el||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,Fe=a.convert(L.format,L.colorSpace),we=a.convert(L.type),Ie=M(L.internalFormat,Fe,we,L.colorSpace),st=s&&L.isVideoTexture!==!0,Je=he.__version===void 0||le===!0,Gt=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 De=Te[Me];L.format!==Dn?Fe!==null?st?Gt&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,De.width,De.height,Fe,De.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,De.width,De.height,0,De.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):st?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,De.width,De.height,Fe,we,De.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,De.width,De.height,0,Fe,we,De.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?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,$[te].width,$[te].height,Fe,we,$[te].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,$[te].width,$[te].height,0,Fe,we,$[te].data);for(let Me=0;Me<Te.length;Me++){let St=Te[Me].image[te].image;st?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,St.width,St.height,Fe,we,St.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,St.width,St.height,0,Fe,we,St.data)}}else{st?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,Fe,we,$[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,Fe,we,$[te]);for(let Me=0;Me<Te.length;Me++){let De=Te[Me];st?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,Fe,we,De.image[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,Fe,we,De.image[te])}}}y(L,Xe)&&x(r.TEXTURE_CUBE_MAP),he.__version=me.version,L.onUpdate&&L.onUpdate(L)}F.__version=L.version}function ue(F,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,F),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(F,L,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,F),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===eo?le=r.DEPTH_COMPONENT32F:me.type===Uo&&(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,F)}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,F)}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(F,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,F),!(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===Hl)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===Nu)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(F){let L=i.get(F),ne=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!L.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");Ee(L.__webglFramebuffer,F)}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],F,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer=r.createRenderbuffer(),se(L.__webglDepthbuffer,F,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function H(F,L,ne){let le=i.get(F);L!==void 0&&ue(le.__webglFramebuffer,F,F.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ne!==void 0&&q(F)}function We(F){let L=F.texture,ne=i.get(F),le=i.get(L);F.addEventListener("dispose",C);let me=F.textures,he=F.isWebGLCubeRenderTarget===!0,et=me.length>1,Ke=v(F)||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&&F.samples>0&&Ue(F)===!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,F.isXRRenderTarget===!0),Xe=Le(F);r.renderbufferStorageMultisample(r.RENDERBUFFER,Xe,it,F.width,F.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Se,r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se])}r.bindRenderbuffer(r.RENDERBUFFER,null),F.depthBuffer&&(ne.__webglDepthRenderbuffer=r.createRenderbuffer(),se(ne.__webglDepthRenderbuffer,F,!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],F,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ae);else ue(ne.__webglFramebuffer[Se],F,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,F,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((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(s?Se=F.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],F,L,r.COLOR_ATTACHMENT0,Se,Ae);else ue(ne.__webglFramebuffer,F,L,r.COLOR_ATTACHMENT0,Se,0);y(L,Ke)&&x(Se),t.unbindTexture()}F.depthBuffer&&q(F)}function _e(F){let L=v(F)||s,ne=F.textures;for(let le=0,me=ne.length;le<me;le++){let he=ne[le];if(y(he,L)){let et=F.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ke=i.get(he).__webglTexture;t.bindTexture(et,Ke),x(et),t.unbindTexture()}}}function xe(F){if(s&&F.samples>0&&Ue(F)===!1){let L=F.textures,ne=F.width,le=F.height,me=r.COLOR_BUFFER_BIT,he=[],et=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ke=i.get(F),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),F.depthBuffer&&he.push(et);let nt=Ke.__ignoreDepthValues!==void 0?Ke.__ignoreDepthValues:!1;if(nt===!1&&(F.depthBuffer&&(me|=r.DEPTH_BUFFER_BIT),F.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(F){return Math.min(n.maxSamples,F.samples)}function Ue(F){let L=i.get(F);return s&&F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(F){let L=o.render.frame;f.get(F)!==L&&(f.set(F,L),F.update())}function Ve(F,L){let ne=F.colorSpace,le=F.format,me=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===WS||ne!==ro&&ne!==el&&(Er.getTransfer(ne)===qr?s===!1?e.has("EXT_sRGB")===!0&&le===Dn?(F.format=WS,F.minFilter=tn,F.generateMipmaps=!1):L=Tg.sRGBToLinear(L):(le!==Dn||me!==No)&&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(F){return typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement?(c.width=F.naturalWidth||F.width,c.height=F.naturalHeight||F.height):typeof VideoFrame<"u"&&F instanceof VideoFrame?(c.width=F.displayWidth,c.height=F.displayHeight):(c.width=F.width,c.height=F.height),c}this.allocateTextureUnit=P,this.resetTextureUnits=A,this.setTexture2D=B,this.setTexture2DArray=z,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 Pie(r,e,t){let i=t.isWebGL2;function n(a,o=el){let s,l=Er.getTransfer(o);if(a===No)return r.UNSIGNED_BYTE;if(a===wA)return r.UNSIGNED_SHORT_4_4_4_4;if(a===TA)return r.UNSIGNED_SHORT_5_5_5_1;if(a===fQ)return r.BYTE;if(a===hQ)return r.SHORT;if(a===gg)return r.UNSIGNED_SHORT;if(a===bA)return r.INT;if(a===Uo)return r.UNSIGNED_INT;if(a===eo)return r.FLOAT;if(a===Ac)return i?r.HALF_FLOAT:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(a===pQ)return r.ALPHA;if(a===Dn)return r.RGBA;if(a===dQ)return r.LUMINANCE;if(a===mQ)return r.LUMINANCE_ALPHA;if(a===Hl)return r.DEPTH_COMPONENT;if(a===Nu)return r.DEPTH_STENCIL;if(a===WS)return s=e.get("EXT_sRGB"),s!==null?s.SRGB_ALPHA_EXT:null;if(a===vQ)return r.RED;if(a===EA)return r.RED_INTEGER;if(a===gQ)return r.RG;if(a===AA)return r.RG_INTEGER;if(a===CA)return r.RGBA_INTEGER;if(a===RA||a===LA||a===DA||a===PA)if(l===qr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(a===RA)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===LA)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===DA)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===PA)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(a===RA)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===LA)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===DA)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===PA)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===lz||a===uz||a===cz||a===fz)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(a===lz)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===uz)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===cz)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===fz)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===IA)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===hz||a===pz)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(a===hz)return l===qr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(a===pz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===dz||a===mz||a===vz||a===gz||a===yz||a===_z||a===xz||a===Sz||a===Mz||a===bz||a===wz||a===Tz||a===Ez||a===Az)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(a===dz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===mz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===vz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===gz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===yz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===_z)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===xz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===Sz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===Mz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===bz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===wz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===Tz)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===Ez)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===Az)return l===qr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===NA||a===Cz||a===Rz)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(a===NA)return l===qr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===Cz)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===Rz)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===yQ||a===Lz||a===Dz||a===Pz)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(a===NA)return s.COMPRESSED_RED_RGTC1_EXT;if(a===Lz)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===Dz)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===Pz)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===Qs?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 yC=class extends Wi{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}};var Rd=class extends nn{constructor(){super(),this.isGroup=!0,this.type="Group"}};var nAe={type:"move"},Qg=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Rd,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 Rd,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 Rd,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(nAe)))}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 Rd;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}};var aAe=`
  6533. void main() {
  6534. gl_Position = vec4( position, 1.0 );
  6535. }`,oAe=`
  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. }`,_C=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 ao,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 Sa({extensions:{fragDepth:!0},vertexShader:aAe,fragmentShader:oAe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new an(new Yg(20,20),n)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}};var xC=class extends no{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 _C,m=t.getContextAttributes(),v=null,_=null,y=[],x=[],M=new $t,S=null,w=new Wi;w.layers.enable(1),w.viewport=new si;let T=new Wi;T.layers.enable(2),T.viewport=new si;let C=[w,T],b=new yC;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 Qg,y[V]=K),K.getTargetRaySpace()},this.getControllerGrip=function(V){let K=y[V];return K===void 0&&(K=new Qg,y[V]=K),K.getGripSpace()},this.getHand=function(V){let K=y[V];return K===void 0&&(K=new Qg,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",P);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 Eb(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",P),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 oo(p.framebufferWidth,p.framebufferHeight,{format:Dn,type:No,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?Nu:Hl,ae=m.stencil?Qs:Uo);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 oo(h.textureWidth,h.textureHeight,{format:Dn,type:No,depthTexture:new Kg(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 P(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 z(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,F=q+Ne,L=Le-Ve,ne=Ue+(ve-Ve),le=H*q/F*ct,me=We*q/F*ct;V.projectionMatrix.makePerspective(L,ne,le,me,ct,F),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?z(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=XS*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 Wi,H.layers.enable(se),H.viewport=new si,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 fC;Q.setAnimationLoop(J),this.setAnimationLoop=function(V){Y=V},this.dispose=function(){}}};var Ld=new Yl,sAe=new Zr;function Iie(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,sC(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===Si&&(m.bumpScale.value*=-1)),v.normalMap&&(m.normalMap.value=v.normalMap,t(v.normalMap,m.normalMapTransform),m.normalScale.value.copy(v.normalScale),v.side===Si&&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,Ld.copy(x),Ld.x*=-1,Ld.y*=-1,Ld.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Ld.y*=-1,Ld.z*=-1),m.envMapRotation.value.setFromMatrix4(sAe.makeRotationFromEuler(Ld)),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===Si&&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 Nie(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 P=0;P<R.length;P++){let U=R[P],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,P=R.length;A<P;A++){let U=R[A],B=g(U),z=x%M;z!==0&&M-z<B.boundary&&(x+=M-z),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 $S=class{constructor(e={}){let{canvas:t=PQ(),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=to,this._useLegacyLights=!1,this.toneMapping=$s,this.toneMappingExposure=1;let y=this,x=!1,M=0,S=0,w=null,T=-1,C=null,b=new si,E=new si,I=null,R=new nr(0),A=0,P=t.width,U=t.height,B=1,z=null,k=null,G=new si(0,0,P,U),Y=new si(0,0,P,U),J=!1,Q=new xh,V=!1,K=!1,ae=null,ve=new Zr,ue=new $t,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],D=t.getContext(ie,j);if(D!==null)return D}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${zS}`),t.addEventListener("webglcontextlost",Gt,!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,F,L,ne,le,me,he,et,Ke,Se,Ae,nt,$,it,Xe,Fe,we,Ie;function st(){_e=new Kre(H),xe=new kre(H,_e,e),_e.init(xe),Fe=new Pie(H,_e,xe),Le=new Lie(H,_e,xe),Ue=new Qre(H),Ne=new xie,Ve=new Die(H,_e,Le,Ne,xe,Fe,Ue),ct=new Gre(y),F=new jre(y),L=new ree(H,xe),we=new Fre(H,_e,L,xe),ne=new Jre(H,L,Ue,we),le=new tie(H,ne,L,Ue),$=new eie(H,xe,Ve),Se=new Vre(Ne),me=new _ie(y,ct,F,_e,xe,we,Se),he=new Iie(y,Ne),et=new bie,Ke=new Eie(_e,xe),nt=new zre(y,ct,F,Le,le,h,l),Ae=new Rie(y,le,xe),Ie=new Nie(H,Ue,xe,Le),it=new Bre(H,_e,Ue,xe),Xe=new $re(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 xC(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(P,U,!1))},this.getSize=function(O){return O.set(P,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}P=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(P*B,U*B).floor()},this.setDrawingBufferSize=function(O,j,re){P=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){z=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 D=!1;if(w!==null){let W=w.texture.format;D=W===CA||W===AA||W===EA}if(D){let W=w.texture.type,ee=W===No||W===Uo||W===gg||W===Qs||W===wA||W===TA,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",Gt,!1),t.removeEventListener("webglcontextrestored",X,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),et.dispose(),Ke.dispose(),Ne.dispose(),ct.dispose(),F.dispose(),le.dispose(),we.dispose(),Ie.dispose(),me.dispose(),Je.dispose(),Je.removeEventListener("sessionstart",$r),Je.removeEventListener("sessionend",Ht),ae&&(ae.dispose(),ae=null),Nr.stop()};function Gt(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,D=Ae.type;st(),Ue.autoReset=O,Ae.enabled=j,Ae.autoUpdate=re,Ae.needsUpdate=ie,Ae.type=D}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){De(O),Ne.remove(O)}function De(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,D,W){j===null&&(j=Ee);let ee=D.isMesh&&D.matrixWorld.determinant()<0,ge=L0(O,j,re,ie,D);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(D,ie,ge,re,ce);let at,Tt=it;if(ce!==null&&(at=L.get(ce),Tt=Xe,Tt.setIndex(at)),D.isMesh)ie.wireframe===!0?(Le.setLineWidth(ie.wireframeLinewidth*q()),Tt.setMode(H.LINES)):Tt.setMode(H.TRIANGLES);else if(D.isLine){let je=ie.linewidth;je===void 0&&(je=1),Le.setLineWidth(je*q()),D.isLineSegments?Tt.setMode(H.LINES):D.isLineLoop?Tt.setMode(H.LINE_LOOP):Tt.setMode(H.LINE_STRIP)}else D.isPoints?Tt.setMode(H.POINTS):D.isSprite&&Tt.setMode(H.TRIANGLES);if(D.isBatchedMesh)Tt.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else if(D.isInstancedMesh)Tt.renderInstances(pt,$e,D.count);else if(re.isInstancedBufferGeometry){let je=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,vi=Math.min(re.instanceCount,je);Tt.renderInstances(pt,$e,vi)}else Tt.render(pt,$e)};function St(O,j,re){O.transparent===!0&&O.side===Io&&O.forceSinglePass===!1?(O.side=Si,O.needsUpdate=!0,qo(O,j,re),O.side=Po,O.needsUpdate=!0,qo(O,j,re),O.side=Io):qo(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(D){D.isLight&&D.layers.test(j.layers)&&(m.pushLight(D),D.castShadow&&m.pushShadow(D))}),O!==re&&O.traverseVisible(function(D){D.isLight&&D.layers.test(j.layers)&&(m.pushLight(D),D.castShadow&&m.pushShadow(D))}),m.setupLights(y._useLegacyLights);let ie=new Set;return O.traverse(function(D){let W=D.material;if(W)if(Array.isArray(W))for(let ee=0;ee<W.length;ee++){let ge=W[ee];St(ge,re,D),ie.add(ge)}else St(W,re,D),ie.add(W)}),_.pop(),m=null,ie},this.compileAsync=function(O,j,re=null){let ie=this.compile(O,j,re);return new Promise(D=>{function W(){if(ie.forEach(function(ee){Ne.get(ee).currentProgram.isReady()&&ie.delete(ee)}),ie.size===0){D(O);return}setTimeout(W,10)}_e.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let kt=null;function br(O){kt&&kt(O)}function $r(){Nr.stop()}function Ht(){Nr.start()}let Nr=new fC;Nr.setAnimationLoop(br),typeof self<"u"&&Nr.setContext(self),this.setAnimationLoop=function(O){kt=O,Je.setAnimationLoop(O),O===null?Nr.stop():Nr.start()},Je.addEventListener("sessionstart",$r),Je.addEventListener("sessionend",Ht),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),ci(O,j,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(z,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 D=0,W=ie.length;D<W;D++){let ee=ie[D];Kh(g,O,ee,ee.viewport)}}else Kh(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 ci(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++)ci(W[ee],j,re,ie)}function Kh(O,j,re,ie){let D=O.opaque,W=O.transmissive,ee=O.transparent;m.setupLightsView(re),V===!0&&Se.setGlobalState(y.clippingPlanes,re),W.length>0&&R0(D,W,j,re),ie&&Le.viewport(b.copy(ie)),D.length>0&&dl(D,j,re),W.length>0&&dl(W,j,re),ee.length>0&&dl(ee,j,re),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function R0(O,j,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;let W=xe.isWebGL2;ae===null&&(ae=new oo(1,1,{generateMipmaps:!0,type:_e.has("EXT_color_buffer_half_float")?Ac:No,minFilter:Gl,samples:W?4:0})),y.getDrawingBufferSize(ue),W?ae.setSize(ue.x,ue.y):ae.setSize(YS(ue.x),YS(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=$s,dl(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===Io&&pt.layers.test(ie.layers)){let Tt=$e.side;$e.side=Si,$e.needsUpdate=!0,Jh(pt,re,ie,mt,$e,at),$e.side=Tt,$e.needsUpdate=!0,ce=!0}}ce===!0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),y.setRenderTarget(ee),y.setClearColor(R,A),y.toneMapping=ge}function dl(O,j,re){let ie=j.isScene===!0?j.overrideMaterial:null;for(let D=0,W=O.length;D<W;D++){let ee=O[D],ge=ee.object,ce=ee.geometry,Oe=ie===null?ee.material:ie,Ge=ee.group;ge.layers.test(re.layers)&&Jh(ge,j,re,ce,Oe,Ge)}}function Jh(O,j,re,ie,D,W){O.onBeforeRender(y,j,re,ie,D,W),O.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,O.matrixWorld),O.normalMatrix.getNormalMatrix(O.modelViewMatrix),D.onBeforeRender(y,j,re,ie,O,W),D.transparent===!0&&D.side===Io&&D.forceSinglePass===!1?(D.side=Si,D.needsUpdate=!0,y.renderBufferDirect(re,j,ie,D,O,W),D.side=Po,D.needsUpdate=!0,y.renderBufferDirect(re,j,ie,D,O,W),D.side=Io):y.renderBufferDirect(re,j,ie,D,O,W),O.onAfterRender(y,j,re,ie,D,W)}function qo(O,j,re){j.isScene!==!0&&(j=Ee);let ie=Ne.get(O),D=m.state.lights,W=m.state.shadowsArray,ee=D.state.version,ge=me.getParameters(O,D.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?F: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 nf(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),nf(O,ge),ie.needsLights=P0(O),ie.lightsStateVersion=ee,ie.needsLights&&(Re.ambientLightColor.value=D.state.ambient,Re.lightProbe.value=D.state.probe,Re.directionalLights.value=D.state.directional,Re.directionalLightShadows.value=D.state.directionalShadow,Re.spotLights.value=D.state.spot,Re.spotLightShadows.value=D.state.spotShadow,Re.rectAreaLights.value=D.state.rectArea,Re.ltc_1.value=D.state.rectAreaLTC1,Re.ltc_2.value=D.state.rectAreaLTC2,Re.pointLights.value=D.state.point,Re.pointLightShadows.value=D.state.pointShadow,Re.hemisphereLights.value=D.state.hemi,Re.directionalShadowMap.value=D.state.directionalShadowMap,Re.directionalShadowMatrix.value=D.state.directionalShadowMatrix,Re.spotShadowMap.value=D.state.spotShadowMap,Re.spotLightMatrix.value=D.state.spotLightMatrix,Re.spotLightMap.value=D.state.spotLightMap,Re.pointShadowMap.value=D.state.pointShadowMap,Re.pointShadowMatrix.value=D.state.pointShadowMatrix),ie.currentProgram=Ge,ie.uniformsList=null,Ge}function $h(O){if(O.uniformsList===null){let j=O.currentProgram.getUniforms();O.uniformsList=Sh.seqWithValue(j.seq,O.uniforms)}return O.uniformsList}function nf(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 L0(O,j,re,ie,D){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:ro,ce=(ie.isMeshStandardMaterial?F: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=$s;ie.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&($e=y.toneMapping);let at=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Tt=at!==void 0?at.length:0,je=Ne.get(ie),vi=m.state.lights;if(V===!0&&(K===!0||O!==C)){let Qr=O===C&&ie.id===T;Se.setState(ie,O,Qr)}let Ft=!1;ie.version===je.__version?(je.needsLights&&je.lightsStateVersion!==vi.state.version||je.outputColorSpace!==ge||D.isBatchedMesh&&je.batching===!1||!D.isBatchedMesh&&je.batching===!0||D.isInstancedMesh&&je.instancing===!1||!D.isInstancedMesh&&je.instancing===!0||D.isSkinnedMesh&&je.skinning===!1||!D.isSkinnedMesh&&je.skinning===!0||D.isInstancedMesh&&je.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&je.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&je.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&je.instancingMorph===!1&&D.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!==Tt)&&(Ft=!0):(Ft=!0,je.__version=ie.version);let Lr=je.currentProgram;Ft===!0&&(Lr=qo(ie,j,D));let Yi=!1,bt=!1,wi=!1,lr=Lr.getUniforms(),fn=je.uniforms;if(Le.useProgram(Lr.program)&&(Yi=!0,bt=!0,wi=!0),ie.id!==T&&(T=ie.id,bt=!0),Yi||C!==O){lr.setValue(H,"projectionMatrix",O.projectionMatrix),lr.setValue(H,"viewMatrix",O.matrixWorldInverse);let Qr=lr.map.cameraPosition;Qr!==void 0&&Qr.setValue(H,se.setFromMatrixPosition(O.matrixWorld)),xe.logarithmicDepthBuffer&&lr.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&lr.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),C!==O&&(C=O,bt=!0,wi=!0)}if(D.isSkinnedMesh){lr.setOptional(H,D,"bindMatrix"),lr.setOptional(H,D,"bindMatrixInverse");let Qr=D.skeleton;Qr&&(xe.floatVertexTextures?(Qr.boneTexture===null&&Qr.computeBoneTexture(),lr.setValue(H,"boneTexture",Qr.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."))}D.isBatchedMesh&&(lr.setOptional(H,D,"batchingTexture"),lr.setValue(H,"batchingTexture",D._matricesTexture,Ve));let qu=re.morphAttributes;if((qu.position!==void 0||qu.normal!==void 0||qu.color!==void 0&&xe.isWebGL2===!0)&&$.update(D,re,Lr),(bt||je.receiveShadow!==D.receiveShadow)&&(je.receiveShadow=D.receiveShadow,lr.setValue(H,"receiveShadow",D.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(fn.envMap.value=ce,fn.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),bt&&(lr.setValue(H,"toneMappingExposure",y.toneMappingExposure),je.needsLights&&D0(fn,wi),W&&ie.fog===!0&&he.refreshFogUniforms(fn,W),he.refreshMaterialUniforms(fn,ie,B,U,ae),Sh.upload(H,$h(je),fn,Ve)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(Sh.upload(H,$h(je),fn,Ve),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&lr.setValue(H,"center",D.center),lr.setValue(H,"modelViewMatrix",D.modelViewMatrix),lr.setValue(H,"normalMatrix",D.normalMatrix),lr.setValue(H,"modelMatrix",D.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){let Qr=ie.uniformsGroups;for(let Zu=0,Qh=Qr.length;Zu<Qh;Zu++)if(xe.isWebGL2){let ep=Qr[Zu];Ie.update(ep,Lr),Ie.bind(ep,Lr)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Lr}function D0(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 P0(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,D=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])?D=Ge[j][re]:D=Ge[j],W=!0):xe.isWebGL2&&O.samples>0&&Ve.useMultisampledRTT(O)===!1?D=Ne.get(O).__webglMultisampledFramebuffer:Array.isArray(Ge)?D=Ge[re]:D=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,D)&&xe.drawBuffers&&ie&&Le.drawBuffers(O,D),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,D,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!==Dn&&Fe.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===Ac&&(_e.has("EXT_color_buffer_half_float")||xe.isWebGL2&&_e.has("EXT_color_buffer_float"));if(Ge!==No&&Fe.convert(Ge)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===eo&&(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-D&&H.readPixels(j,re,ie,D,Fe.convert(Oe),Fe.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),D=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,D,W),Le.unbindTexture()},this.copyTextureToTexture=function(O,j,re,ie=0){let D=j.image.width,W=j.image.height,ee=Fe.convert(re.format),ge=Fe.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,D,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,D=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=Fe.convert(ie.format),Oe=Fe.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),Tt=re.isCompressedTexture?re.mipmaps[D]:re.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,Tt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Tt.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,D,j.x,j.y,j.z,W,ee,ge,ce,Oe,Tt.data):ie.isCompressedArrayTexture?H.compressedTexSubImage3D(Ge,D,j.x,j.y,j.z,W,ee,ge,ce,Tt.data):H.texSubImage3D(Ge,D,j.x,j.y,j.z,W,ee,ge,ce,Oe,Tt),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),D===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 io}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===yg?"display-p3":"srgb",t.unpackColorSpace=Er.workingColorSpace===yd?"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 QS=class extends nn{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 Yl,this.environmentRotation=new Yl,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 SC=class r extends so{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 $t;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 Kn(o,3)),this.setAttribute("normal",new Kn(s,3)),this.setAttribute("uv",new Kn(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 ey=class extends nn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new nr(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 eM=class extends ey{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(nn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new nr(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}};var pF=new Zr,Uie=new be,Oie=new be,MC=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new $t(512,512),this.map=null,this.mapPass=null,this.matrix=new Zr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xh,this._frameExtents=new $t(1,1),this._viewportCount=1,this._viewports=[new si(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;Uie.setFromMatrixPosition(e.matrixWorld),t.position.copy(Uie),Oie.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Oie),t.updateMatrixWorld(),pF.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pF),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(pF)}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 bC=class extends MC{constructor(){super(new qg(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}};var tM=class extends ey{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nn.DEFAULT_UP),this.updateMatrix(),this.target=new nn,this.shadow=new bC}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};var rM=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=zie(),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=zie();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function zie(){return(typeof performance>"u"?Date:performance).now()}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:zS}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=zS);var IB="162";var uAe=0,Fie=1,cAe=2;var Eae=1,fAe=2,Gc=3,Ih=0,fo=1,Wc=2,Lh=0,My=1,Bie=2,kie=3,Vie=4,hAe=5,Fd=100,pAe=101,dAe=102,Gie=103,Hie=104,mAe=200,vAe=201,gAe=202,yAe=203,KF=204,JF=205,_Ae=206,xAe=207,SAe=208,MAe=209,bAe=210,wAe=211,TAe=212,EAe=213,AAe=214,CAe=0,RAe=1,LAe=2,KC=3,DAe=4,PAe=5,IAe=6,NAe=7,LR=0,UAe=1,OAe=2,Dh=0,zAe=1,FAe=2,BAe=3,kAe=4,VAe=5,GAe=6,HAe=7,Wie="attached",WAe="detached",Xie=300,Ty=301,Ey=302,hM=303,$F=304,DR=306,Ay=1e3,uo=1001,QF=1002,Pn=1003,Yie=1004;var iM=1005;var lo=1006,dF=1007;var kd=1008;var Ph=1009,XAe=1010,YAe=1011,NB=1012,Aae=1013,Rh=1014,ku=1015,pM=1016,Cae=1017,Rae=1018,Vd=1020,qAe=1021,nl=1023,ZAe=1024,jAe=1025,Gd=1026,Cy=1027,KAe=1028,Lae=1029,JAe=1030,Dae=1031,Pae=1033,mF=33776,vF=33777,gF=33778,yF=33779,qie=35840,Zie=35841,jie=35842,Kie=35843,Iae=36196,Jie=37492,$ie=37496,Qie=37808,ene=37809,tne=37810,rne=37811,ine=37812,nne=37813,ane=37814,one=37815,sne=37816,lne=37817,une=37818,cne=37819,fne=37820,hne=37821,_F=36492,pne=36494,dne=36495,$Ae=36283,mne=36284,vne=36285,gne=36286;var JC=2300,$C=2301,xF=2302,yne=2400,_ne=2401,xne=2402,QAe=2500;var eCe=3200,tCe=3201,UB=0,rCe=1,Ch="",wa="srgb",Vh="srgb-linear",OB="display-p3",PR="display-p3-linear",QC="linear",li="srgb",eR="rec709",tR="p3";var ty=7680;var Sne=519,iCe=512,nCe=513,aCe=514,Nae=515,oCe=516,sCe=517,lCe=518,uCe=519,Mne=35044;var bne="300 es",eB=1035,Xc=2e3,rR=2001,Nh=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}}},$n=["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"],wne=1234567,uM=Math.PI/180,Ry=180/Math.PI;function Gh(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return($n[r&255]+$n[r>>8&255]+$n[r>>16&255]+$n[r>>24&255]+"-"+$n[e&255]+$n[e>>8&255]+"-"+$n[e>>16&15|64]+$n[e>>24&255]+"-"+$n[t&63|128]+$n[t>>8&255]+"-"+$n[t>>16&255]+$n[t>>24&255]+$n[i&255]+$n[i>>8&255]+$n[i>>16&255]+$n[i>>24&255]).toLowerCase()}function In(r,e,t){return Math.max(e,Math.min(t,r))}function zB(r,e){return(r%e+e)%e}function cCe(r,e,t,i,n){return i+(r-e)*(n-i)/(t-e)}function fCe(r,e,t){return r!==e?(t-r)/(e-r):0}function cM(r,e,t){return(1-t)*r+t*e}function hCe(r,e,t,i){return cM(r,e,1-Math.exp(-t*i))}function pCe(r,e=1){return e-Math.abs(zB(r,e*2)-e)}function dCe(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function mCe(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function vCe(r,e){return r+Math.floor(Math.random()*(e-r+1))}function gCe(r,e){return r+Math.random()*(e-r)}function yCe(r){return r*(.5-Math.random())}function _Ce(r){r!==void 0&&(wne=r);let e=wne+=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 xCe(r){return r*uM}function SCe(r){return r*Ry}function tB(r){return(r&r-1)===0&&r!==0}function MCe(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function iR(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function bCe(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 gy(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 Ma(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 ta={DEG2RAD:uM,RAD2DEG:Ry,generateUUID:Gh,clamp:In,euclideanModulo:zB,mapLinear:cCe,inverseLerp:fCe,lerp:cM,damp:hCe,pingpong:pCe,smoothstep:dCe,smootherstep:mCe,randInt:vCe,randFloat:gCe,randFloatSpread:yCe,seededRandom:_Ce,degToRad:xCe,radToDeg:SCe,isPowerOfTwo:tB,ceilPowerOfTwo:MCe,floorPowerOfTwo:iR,setQuaternionFromProperEuler:bCe,normalize:Ma,denormalize:gy},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(SF.makeScale(e,t)),this}rotate(e){return this.premultiply(SF.makeRotation(-e)),this}translate(e,t){return this.premultiply(SF.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)}},SF=new dr;function Uae(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 wCe(){let r=dM("canvas");return r.style.display="block",r}var Tne={};function TCe(r){r in Tne||(Tne[r]=!0,console.warn(r))}var Ene=new dr().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ane=new dr().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),wC={[Vh]:{transfer:QC,primaries:eR,toReference:r=>r,fromReference:r=>r},[wa]:{transfer:li,primaries:eR,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[PR]:{transfer:QC,primaries:tR,toReference:r=>r.applyMatrix3(Ane),fromReference:r=>r.applyMatrix3(Ene)},[OB]:{transfer:li,primaries:tR,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Ane),fromReference:r=>r.applyMatrix3(Ene).convertLinearToSRGB()}},ECe=new Set([Vh,PR]),ti={enabled:!0,_workingColorSpace:Vh,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!ECe.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=wC[e].toReference,n=wC[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 wC[r].primaries},getTransfer:function(r){return r===Ch?QC:wC[r].transfer}};function by(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function MF(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var ry,nR=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{ry===void 0&&(ry=dM("canvas")),ry.width=e.width,ry.height=e.height;let i=ry.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=ry}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]=by(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(by(t[i]/255)*255):t[i]=by(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}},ACe=0,aR=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ACe++}),this.uuid=Gh(),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(bF(n[o].image)):a.push(bF(n[o]))}else a=bF(n);i.url=a}return t||(e.images[this.uuid]=i),i}};function bF(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?nR.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 CCe=0,ko=(()=>{class r extends Nh{constructor(t=r.DEFAULT_IMAGE,i=r.DEFAULT_MAPPING,n=uo,a=uo,o=lo,s=kd,l=nl,u=Ph,c=r.DEFAULT_ANISOTROPY,f=Ch){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:CCe++}),this.uuid=Gh(),this.name="",this.source=new aR(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!==Xie)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ay:t.x=t.x-Math.floor(t.x);break;case uo:t.x=t.x<0?0:1;break;case QF: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 Ay:t.y=t.y-Math.floor(t.y);break;case uo:t.y=t.y<0?0:1;break;case QF: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=Xie,r.DEFAULT_ANISOTROPY=1,r})(),Ir=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}},rB=class extends Nh{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ir(0,0,e,t),this.scissorTest=!1,this.viewport=new Ir(0,0,e,t);let n={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:lo,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let a=new ko(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 aR(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"})}},qc=class extends rB{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},oR=class extends ko{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=Pn,this.minFilter=Pn,this.wrapR=uo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var iB=class extends ko{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=Pn,this.minFilter=Pn,this.wrapR=uo,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(Cne.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Cne.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 wF.copy(this).projectOnVector(e),this.sub(wF)}reflect(e){return this.sub(wF.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}},wF=new ye,Cne=new On,Uh=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(jl.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(jl.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=jl.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,jl):jl.fromBufferAttribute(a,o),jl.applyMatrix4(e.matrixWorld),this.expandByPoint(jl);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),TC.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),TC.copy(i.boundingBox)),TC.applyMatrix4(e.matrixWorld),this.union(TC)}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,jl),jl.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(nM),EC.subVectors(this.max,nM),iy.subVectors(e.a,nM),ny.subVectors(e.b,nM),ay.subVectors(e.c,nM),Mh.subVectors(ny,iy),bh.subVectors(ay,ny),Dd.subVectors(iy,ay);let t=[0,-Mh.z,Mh.y,0,-bh.z,bh.y,0,-Dd.z,Dd.y,Mh.z,0,-Mh.x,bh.z,0,-bh.x,Dd.z,0,-Dd.x,-Mh.y,Mh.x,0,-bh.y,bh.x,0,-Dd.y,Dd.x,0];return!TF(t,iy,ny,ay,EC)||(t=[1,0,0,0,1,0,0,0,1],!TF(t,iy,ny,ay,EC))?!1:(AC.crossVectors(Mh,bh),t=[AC.x,AC.y,AC.z],TF(t,iy,ny,ay,EC))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,jl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(jl).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:(Oc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Oc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Oc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Oc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Oc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Oc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Oc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Oc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Oc),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)}},Oc=[new ye,new ye,new ye,new ye,new ye,new ye,new ye,new ye],jl=new ye,TC=new Uh,iy=new ye,ny=new ye,ay=new ye,Mh=new ye,bh=new ye,Dd=new ye,nM=new ye,EC=new ye,AC=new ye,Pd=new ye;function TF(r,e,t,i,n){for(let a=0,o=r.length-3;a<=o;a+=3){Pd.fromArray(r,a);let s=n.x*Math.abs(Pd.x)+n.y*Math.abs(Pd.y)+n.z*Math.abs(Pd.z),l=e.dot(Pd),u=t.dot(Pd),c=i.dot(Pd);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var RCe=new Uh,aM=new ye,EF=new ye,Oh=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):RCe.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;aM.subVectors(e,this.center);let t=aM.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector(aM,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):(EF.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(aM.copy(e.center).add(EF)),this.expandByPoint(aM.copy(e.center).sub(EF))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},zc=new ye,AF=new ye,CC=new ye,wh=new ye,CF=new ye,RC=new ye,RF=new ye,mM=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,zc)),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=zc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(zc.copy(this.origin).addScaledVector(this.direction,t),zc.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){AF.copy(e).add(t).multiplyScalar(.5),CC.copy(t).sub(e).normalize(),wh.copy(this.origin).sub(AF);let a=e.distanceTo(t)*.5,o=-this.direction.dot(CC),s=wh.dot(this.direction),l=-wh.dot(CC),u=wh.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(AF).addScaledVector(CC,h),p}intersectSphere(e,t){zc.subVectors(e.center,this.origin);let i=zc.dot(this.direction),n=zc.dot(zc)-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,zc)!==null}intersectTriangle(e,t,i,n,a){CF.subVectors(t,e),RC.subVectors(i,e),RF.crossVectors(CF,RC);let o=this.direction.dot(RF),s;if(o>0){if(n)return null;s=1}else if(o<0)s=-1,o=-o;else return null;wh.subVectors(this.origin,e);let l=s*this.direction.dot(RC.crossVectors(wh,RC));if(l<0)return null;let u=s*this.direction.dot(CF.cross(wh));if(u<0||l+u>o)return null;let c=-s*wh.dot(RF);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)}},Xt=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/oy.setFromMatrixColumn(e,0).length(),a=1/oy.setFromMatrixColumn(e,1).length(),o=1/oy.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(LCe,e,DCe)}lookAt(e,t,i){let n=this.elements;return Fo.subVectors(e,t),Fo.lengthSq()===0&&(Fo.z=1),Fo.normalize(),Th.crossVectors(i,Fo),Th.lengthSq()===0&&(Math.abs(i.z)===1?Fo.x+=1e-4:Fo.z+=1e-4,Fo.normalize(),Th.crossVectors(i,Fo)),Th.normalize(),LC.crossVectors(Fo,Th),n[0]=Th.x,n[4]=LC.x,n[8]=Fo.x,n[1]=Th.y,n[5]=LC.y,n[9]=Fo.y,n[2]=Th.z,n[6]=LC.z,n[10]=Fo.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],P=n[6],U=n[10],B=n[14],z=n[3],k=n[7],G=n[11],Y=n[15];return a[0]=o*S+s*b+l*A+u*z,a[4]=o*w+s*E+l*P+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*z,a[5]=c*w+f*E+h*P+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*z,a[6]=d*w+g*E+m*P+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*z,a[7]=_*w+y*E+x*P+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=oy.set(n[0],n[1],n[2]).length(),o=oy.set(n[4],n[5],n[6]).length(),s=oy.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],Kl.copy(this);let u=1/a,c=1/o,f=1/s;return Kl.elements[0]*=u,Kl.elements[1]*=u,Kl.elements[2]*=u,Kl.elements[4]*=c,Kl.elements[5]*=c,Kl.elements[6]*=c,Kl.elements[8]*=f,Kl.elements[9]*=f,Kl.elements[10]*=f,t.setFromRotationMatrix(Kl),i.x=a,i.y=o,i.z=s,this}makePerspective(e,t,i,n,a,o,s=Xc){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===Xc)p=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(s===rR)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=Xc){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===Xc)d=(o+a)*f,g=-2*f;else if(s===rR)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}},oy=new ye,Kl=new Xt,LCe=new ye(0,0,0),DCe=new ye(1,1,1),Th=new ye,LC=new ye,Fo=new ye,Rne=new Xt,Lne=new On,zn=(()=>{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 Rne.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Rne,i,n)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return Lne.setFromEuler(this),this.setFromQuaternion(Lne,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})(),sR=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}},PCe=0,Dne=new ye,sy=new On,Fc=new Xt,DC=new ye,oM=new ye,ICe=new ye,NCe=new On,Pne=new ye(1,0,0),Ine=new ye(0,1,0),Nne=new ye(0,0,1),UCe={type:"added"},OCe={type:"removed"},LF={type:"childadded",child:null},DF={type:"childremoved",child:null},ea=(()=>{class r extends Nh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:PCe++}),this.uuid=Gh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new ye,i=new zn,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 Xt},normalMatrix:{value:new dr}}),this.matrix=new Xt,this.matrixWorld=new Xt,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new sR,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 sy.setFromAxisAngle(t,i),this.quaternion.multiply(sy),this}rotateOnWorldAxis(t,i){return sy.setFromAxisAngle(t,i),this.quaternion.premultiply(sy),this}rotateX(t){return this.rotateOnAxis(Pne,t)}rotateY(t){return this.rotateOnAxis(Ine,t)}rotateZ(t){return this.rotateOnAxis(Nne,t)}translateOnAxis(t,i){return Dne.copy(t).applyQuaternion(this.quaternion),this.position.add(Dne.multiplyScalar(i)),this}translateX(t){return this.translateOnAxis(Pne,t)}translateY(t){return this.translateOnAxis(Ine,t)}translateZ(t){return this.translateOnAxis(Nne,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Fc.copy(this.matrixWorld).invert())}lookAt(t,i,n){t.isVector3?DC.copy(t):DC.set(t,i,n);let a=this.parent;this.updateWorldMatrix(!0,!1),oM.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Fc.lookAt(oM,DC,this.up):Fc.lookAt(DC,oM,this.up),this.quaternion.setFromRotationMatrix(Fc),a&&(Fc.extractRotation(a.matrixWorld),sy.setFromRotationMatrix(Fc),this.quaternion.premultiply(sy.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(UCe),LF.child=t,this.dispatchEvent(LF),LF.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(OCe),DF.child=t,this.dispatchEvent(DF),DF.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),Fc.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Fc.multiply(t.parent.matrixWorld)),t.applyMatrix4(Fc),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(oM,t,ICe),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(oM,NCe,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})(),Jl=new ye,Bc=new ye,PF=new ye,kc=new ye,ly=new ye,uy=new ye,Une=new ye,IF=new ye,NF=new ye,UF=new ye,yy=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),Jl.subVectors(e,t),n.cross(Jl);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){Jl.subVectors(n,t),Bc.subVectors(i,t),PF.subVectors(e,t);let o=Jl.dot(Jl),s=Jl.dot(Bc),l=Jl.dot(PF),u=Bc.dot(Bc),c=Bc.dot(PF),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,kc)===null?!1:kc.x>=0&&kc.y>=0&&kc.x+kc.y<=1}static getInterpolation(e,t,i,n,a,o,s,l){return this.getBarycoord(e,t,i,n,kc)===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,kc.x),l.addScaledVector(o,kc.y),l.addScaledVector(s,kc.z),l)}static isFrontFacing(e,t,i,n){return Jl.subVectors(i,t),Bc.subVectors(e,t),Jl.cross(Bc).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 Jl.subVectors(this.c,this.b),Bc.subVectors(this.a,this.b),Jl.cross(Bc).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;ly.subVectors(n,i),uy.subVectors(a,i),IF.subVectors(e,i);let l=ly.dot(IF),u=uy.dot(IF);if(l<=0&&u<=0)return t.copy(i);NF.subVectors(e,n);let c=ly.dot(NF),f=uy.dot(NF);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(ly,o);UF.subVectors(e,a);let p=ly.dot(UF),d=uy.dot(UF);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(uy,s);let m=c*d-p*f;if(m<=0&&f-c>=0&&p-d>=0)return Une.subVectors(a,n),s=(f-c)/(f-c+(p-d)),t.copy(n).addScaledVector(Une,s);let v=1/(m+g+h);return o=g*v,s=h*v,t.copy(i).addScaledVector(ly,o).addScaledVector(uy,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Oae={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},Eh={h:0,s:0,l:0},PC={h:0,s:0,l:0};function OF(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 rr=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=wa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ti.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=ti.workingColorSpace){return this.r=e,this.g=t,this.b=i,ti.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=ti.workingColorSpace){if(e=zB(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=OF(o,a,e+1/3),this.g=OF(o,a,e),this.b=OF(o,a,e-1/3)}return ti.toWorkingColorSpace(this,n),this}setStyle(e,t=wa){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=wa){let i=Oae[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=by(e.r),this.g=by(e.g),this.b=by(e.b),this}copyLinearToSRGB(e){return this.r=MF(e.r),this.g=MF(e.g),this.b=MF(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=wa){return ti.fromWorkingColorSpace(Qn.copy(this),e),Math.round(In(Qn.r*255,0,255))*65536+Math.round(In(Qn.g*255,0,255))*256+Math.round(In(Qn.b*255,0,255))}getHexString(e=wa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ti.workingColorSpace){ti.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=ti.workingColorSpace){return ti.fromWorkingColorSpace(Qn.copy(this),t),e.r=Qn.r,e.g=Qn.g,e.b=Qn.b,e}getStyle(e=wa){ti.fromWorkingColorSpace(Qn.copy(this),e);let t=Qn.r,i=Qn.g,n=Qn.b;return e!==wa?`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(Eh),this.setHSL(Eh.h+e,Eh.s+t,Eh.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(Eh),e.getHSL(PC);let i=cM(Eh.h,PC.h,t),n=cM(Eh.s,PC.s,t),a=cM(Eh.l,PC.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 rr;rr.NAMES=Oae;var zCe=0,Zc=class extends Nh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zCe++}),this.uuid=Gh(),this.name="",this.type="Material",this.blending=My,this.side=Ih,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=KF,this.blendDst=JF,this.blendEquation=Fd,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new rr(0,0,0),this.blendAlpha=0,this.depthFunc=KC,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Sne,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ty,this.stencilZFail=ty,this.stencilZPass=ty,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!==My&&(i.blending=this.blending),this.side!==Ih&&(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!==KF&&(i.blendSrc=this.blendSrc),this.blendDst!==JF&&(i.blendDst=this.blendDst),this.blendEquation!==Fd&&(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!==KC&&(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!==Sne&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ty&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ty&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ty&&(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++}},lR=class extends Zc{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new rr(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 zn,this.combine=LR,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 Xi=new ye,IC=new yr,al=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=Mne,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ku,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return TCe("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++)IC.fromBufferAttribute(this,t),IC.applyMatrix3(e),this.setXY(t,IC.x,IC.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Xi.fromBufferAttribute(this,t),Xi.applyMatrix3(e),this.setXYZ(t,Xi.x,Xi.y,Xi.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Xi.fromBufferAttribute(this,t),Xi.applyMatrix4(e),this.setXYZ(t,Xi.x,Xi.y,Xi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Xi.fromBufferAttribute(this,t),Xi.applyNormalMatrix(e),this.setXYZ(t,Xi.x,Xi.y,Xi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Xi.fromBufferAttribute(this,t),Xi.transformDirection(e),this.setXYZ(t,Xi.x,Xi.y,Xi.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=gy(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ma(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=gy(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ma(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=gy(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ma(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=gy(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ma(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=gy(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ma(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Ma(t,this.array),i=Ma(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=Ma(t,this.array),i=Ma(i,this.array),n=Ma(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=Ma(t,this.array),i=Ma(i,this.array),n=Ma(n,this.array),a=Ma(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!==Mne&&(e.usage=this.usage),e}};var Ly=class extends al{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var uR=class extends al{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var Un=class extends al{constructor(e,t,i){super(new Float32Array(e),t,i)}},FCe=0,il=new Xt,zF=new ea,cy=new ye,Bo=new Uh,sM=new Uh,gn=new ye,ol=class r extends Nh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:FCe++}),this.uuid=Gh(),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(Uae(e)?uR:Ly)(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 il.makeRotationFromQuaternion(e),this.applyMatrix4(il),this}rotateX(e){return il.makeRotationX(e),this.applyMatrix4(il),this}rotateY(e){return il.makeRotationY(e),this.applyMatrix4(il),this}rotateZ(e){return il.makeRotationZ(e),this.applyMatrix4(il),this}translate(e,t,i){return il.makeTranslation(e,t,i),this.applyMatrix4(il),this}scale(e,t,i){return il.makeScale(e,t,i),this.applyMatrix4(il),this}lookAt(e){return zF.lookAt(e),zF.updateMatrix(),this.applyMatrix4(zF.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(cy).negate(),this.translate(cy.x,cy.y,cy.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 Uh);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];Bo.setFromBufferAttribute(a),this.morphTargetsRelative?(gn.addVectors(this.boundingBox.min,Bo.min),this.boundingBox.expandByPoint(gn),gn.addVectors(this.boundingBox.max,Bo.max),this.boundingBox.expandByPoint(gn)):(this.boundingBox.expandByPoint(Bo.min),this.boundingBox.expandByPoint(Bo.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 Oh);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(Bo.setFromBufferAttribute(e),t)for(let a=0,o=t.length;a<o;a++){let s=t[a];sM.setFromBufferAttribute(s),this.morphTargetsRelative?(gn.addVectors(Bo.min,sM.min),Bo.expandByPoint(gn),gn.addVectors(Bo.max,sM.max),Bo.expandByPoint(gn)):(Bo.expandByPoint(sM.min),Bo.expandByPoint(sM.max))}Bo.getCenter(i);let n=0;for(let a=0,o=e.count;a<o;a++)gn.fromBufferAttribute(e,a),n=Math.max(n,i.distanceToSquared(gn));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++)gn.fromBufferAttribute(s,u),l&&(cy.fromBufferAttribute(e,u),gn.add(cy)),n=Math.max(n,i.distanceToSquared(gn))}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 al(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 al(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++)gn.fromBufferAttribute(e,t),gn.normalize(),e.setXYZ(t,gn.x,gn.y,gn.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 al(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"})}},One=new Xt,Id=new mM,NC=new Oh,zne=new ye,fy=new ye,hy=new ye,py=new ye,FF=new ye,UC=new ye,OC=new yr,zC=new yr,FC=new yr,Fne=new ye,Bne=new ye,kne=new ye,BC=new ye,kC=new ye,co=class extends ea{constructor(e=new ol,t=new lR){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){UC.set(0,0,0);for(let l=0,u=a.length;l<u;l++){let c=s[l],f=a[l];c!==0&&(FF.fromBufferAttribute(f,e),o?UC.addScaledVector(FF,c):UC.addScaledVector(FF.sub(t),c))}t.add(UC)}return t}raycast(e,t){let i=this.geometry,n=this.material,a=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),NC.copy(i.boundingSphere),NC.applyMatrix4(a),Id.copy(e.ray).recast(e.near),!(NC.containsPoint(Id.origin)===!1&&(Id.intersectSphere(NC,zne)===null||Id.origin.distanceToSquared(zne)>(e.far-e.near)**2))&&(One.copy(a).invert(),Id.copy(e.ray).applyMatrix4(One),!(i.boundingBox!==null&&Id.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Id)))}_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=VC(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=VC(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=VC(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=VC(this,o,e,i,u,c,f,_,y,x),n&&(n.faceIndex=Math.floor(m/3),t.push(n))}}}};function BCe(r,e,t,i,n,a,o,s){let l;if(e.side===fo?l=i.intersectTriangle(o,a,n,!0,s):l=i.intersectTriangle(n,a,o,e.side===Ih,s),l===null)return null;kC.copy(s),kC.applyMatrix4(r.matrixWorld);let u=t.ray.origin.distanceTo(kC);return u<t.near||u>t.far?null:{distance:u,point:kC.clone(),object:r}}function VC(r,e,t,i,n,a,o,s,l,u){r.getVertexPosition(s,fy),r.getVertexPosition(l,hy),r.getVertexPosition(u,py);let c=BCe(r,e,t,i,fy,hy,py,BC);if(c){n&&(OC.fromBufferAttribute(n,s),zC.fromBufferAttribute(n,l),FC.fromBufferAttribute(n,u),c.uv=yy.getInterpolation(BC,fy,hy,py,OC,zC,FC,new yr)),a&&(OC.fromBufferAttribute(a,s),zC.fromBufferAttribute(a,l),FC.fromBufferAttribute(a,u),c.uv1=yy.getInterpolation(BC,fy,hy,py,OC,zC,FC,new yr)),o&&(Fne.fromBufferAttribute(o,s),Bne.fromBufferAttribute(o,l),kne.fromBufferAttribute(o,u),c.normal=yy.getInterpolation(BC,fy,hy,py,Fne,Bne,kne,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};yy.getNormal(fy,hy,py,f.normal),c.face=f}return c}var vM=class r extends ol{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,P=w+1,U=T+1,B=0,z=0,k=new ye;for(let G=0;G<U;G++){let Y=G*E-R;for(let J=0;J<P;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+P*G,Q=h+Y+P*(G+1),V=h+(Y+1)+P*(G+1),K=h+(Y+1)+P*G;l.push(J,Q,K),l.push(Q,V,K),z+=6}s.addGroup(p,z,C),p+=z,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 Dy(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 ba(r){let e={};for(let t=0;t<r.length;t++){let i=Dy(r[t]);for(let n in i)e[n]=i[n]}return e}function kCe(r){let e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function zae(r){return r.getRenderTarget()===null?r.outputColorSpace:ti.workingColorSpace}var VCe={clone:Dy,merge:ba},GCe=`void main() {
  6547. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  6548. }`,HCe=`void main() {
  6549. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  6550. }`,Vu=class extends Zc{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=GCe,this.fragmentShader=HCe,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=Dy(e.uniforms),this.uniformsGroups=kCe(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}},cR=class extends ea{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Xt,this.projectionMatrix=new Xt,this.projectionMatrixInverse=new Xt,this.coordinateSystem=Xc}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)}},Ah=new ye,Vne=new yr,Gne=new yr,Nn=class extends cR{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=Ry*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(uM*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ry*2*Math.atan(Math.tan(uM*.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){Ah.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ah.x,Ah.y).multiplyScalar(-e/Ah.z),Ah.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Ah.x,Ah.y).multiplyScalar(-e/Ah.z)}getViewSize(e,t){return this.getViewBounds(e,Vne,Gne),t.subVectors(Gne,Vne)}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(uM*.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}},dy=-90,my=1,nB=class extends ea{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new Nn(dy,my,e,t);n.layers=this.layers,this.add(n);let a=new Nn(dy,my,e,t);a.layers=this.layers,this.add(a);let o=new Nn(dy,my,e,t);o.layers=this.layers,this.add(o);let s=new Nn(dy,my,e,t);s.layers=this.layers,this.add(s);let l=new Nn(dy,my,e,t);l.layers=this.layers,this.add(l);let u=new Nn(dy,my,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===Xc)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===rR)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}},fR=class extends ko{constructor(e,t,i,n,a,o,s,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:Ty,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}},aB=class extends qc{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 fR(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:lo}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 vM(5,5,5),a=new Vu({name:"CubemapFromEquirect",uniforms:Dy(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:fo,blending:Lh});a.uniforms.tEquirect.value=t;let o=new co(n,a),s=t.minFilter;return t.minFilter===kd&&(t.minFilter=lo),new nB(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)}},BF=new ye,WCe=new ye,XCe=new dr,Hc=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=BF.subVectors(i,t).cross(WCe.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(BF),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||XCe.getNormalMatrix(e),n=this.coplanarPoint(BF).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)}},Nd=new Oh,GC=new ye,gM=class{constructor(e=new Hc,t=new Hc,i=new Hc,n=new Hc,a=new Hc,o=new Hc){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=Xc){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===Xc)i[5].setComponents(l+s,h+f,m+g,x+y).normalize();else if(t===rR)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(),Nd.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Nd.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Nd)}intersectsSprite(e){return Nd.center.set(0,0,0),Nd.radius=.7071067811865476,Nd.applyMatrix4(e.matrixWorld),this.intersectsSphere(Nd)}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(GC.x=n.normal.x>0?e.max.x:e.min.x,GC.y=n.normal.y>0?e.max.y:e.min.y,GC.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(GC)<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 Fae(){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 YCe(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 hR=class r extends ol{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)}},qCe=`#ifdef USE_ALPHAHASH
  6570. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  6571. #endif`,ZCe=`#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`,jCe=`#ifdef USE_ALPHAMAP
  6607. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  6608. #endif`,KCe=`#ifdef USE_ALPHAMAP
  6609. uniform sampler2D alphaMap;
  6610. #endif`,JCe=`#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`,$Ce=`#ifdef USE_ALPHATEST
  6618. uniform float alphaTest;
  6619. #endif`,QCe=`#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`,eRe=`#ifdef USE_AOMAP
  6633. uniform sampler2D aoMap;
  6634. uniform float aoMapIntensity;
  6635. #endif`,tRe=`#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`,rRe=`#ifdef USE_BATCHING
  6650. mat4 batchingMatrix = getBatchingMatrix( batchId );
  6651. #endif`,iRe=`vec3 transformed = vec3( position );
  6652. #ifdef USE_ALPHAHASH
  6653. vPosition = vec3( position );
  6654. #endif`,nRe=`vec3 objectNormal = vec3( normal );
  6655. #ifdef USE_TANGENT
  6656. vec3 objectTangent = vec3( tangent.xyz );
  6657. #endif`,aRe=`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`,oRe=`#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`,sRe=`#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`,lRe=`#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`,uRe=`#if NUM_CLIPPING_PLANES > 0
  6802. varying vec3 vClipPosition;
  6803. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  6804. #endif`,cRe=`#if NUM_CLIPPING_PLANES > 0
  6805. varying vec3 vClipPosition;
  6806. #endif`,fRe=`#if NUM_CLIPPING_PLANES > 0
  6807. vClipPosition = - mvPosition.xyz;
  6808. #endif`,hRe=`#if defined( USE_COLOR_ALPHA )
  6809. diffuseColor *= vColor;
  6810. #elif defined( USE_COLOR )
  6811. diffuseColor.rgb *= vColor;
  6812. #endif`,pRe=`#if defined( USE_COLOR_ALPHA )
  6813. varying vec4 vColor;
  6814. #elif defined( USE_COLOR )
  6815. varying vec3 vColor;
  6816. #endif`,dRe=`#if defined( USE_COLOR_ALPHA )
  6817. varying vec4 vColor;
  6818. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  6819. varying vec3 vColor;
  6820. #endif`,mRe=`#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`,vRe=`#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`,gRe=`#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`,yRe=`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`,_Re=`#ifdef USE_DISPLACEMENTMAP
  7031. uniform sampler2D displacementMap;
  7032. uniform float displacementScale;
  7033. uniform float displacementBias;
  7034. #endif`,xRe=`#ifdef USE_DISPLACEMENTMAP
  7035. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  7036. #endif`,SRe=`#ifdef USE_EMISSIVEMAP
  7037. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  7038. totalEmissiveRadiance *= emissiveColor.rgb;
  7039. #endif`,MRe=`#ifdef USE_EMISSIVEMAP
  7040. uniform sampler2D emissiveMap;
  7041. #endif`,bRe="gl_FragColor = linearToOutputTexel( gl_FragColor );",wRe=`
  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. }`,TRe=`#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`,ERe=`#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`,ARe=`#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`,CRe=`#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`,RRe=`#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`,LRe=`#ifdef USE_FOG
  7146. vFogDepth = - mvPosition.z;
  7147. #endif`,DRe=`#ifdef USE_FOG
  7148. varying float vFogDepth;
  7149. #endif`,PRe=`#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`,IRe=`#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`,NRe=`#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. }`,URe=`#ifdef USE_LIGHTMAP
  7178. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  7179. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  7180. reflectedLight.indirectDiffuse += lightMapIrradiance;
  7181. #endif`,ORe=`#ifdef USE_LIGHTMAP
  7182. uniform sampler2D lightMap;
  7183. uniform float lightMapIntensity;
  7184. #endif`,zRe=`LambertMaterial material;
  7185. material.diffuseColor = diffuseColor.rgb;
  7186. material.specularStrength = specularStrength;`,FRe=`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`,BRe=`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`,kRe=`#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`,VRe=`ToonMaterial material;
  7357. material.diffuseColor = diffuseColor.rgb;`,GRe=`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`,HRe=`BlinnPhongMaterial material;
  7370. material.diffuseColor = diffuseColor.rgb;
  7371. material.specularColor = specular;
  7372. material.specularShininess = shininess;
  7373. material.specularStrength = specularStrength;`,WRe=`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`,XRe=`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`,YRe=`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. }`,qRe=`
  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`,ZRe=`#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`,jRe=`#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`,KRe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  7913. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  7914. #endif`,JRe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  7915. uniform float logDepthBufFC;
  7916. varying float vFragDepth;
  7917. varying float vIsPerspective;
  7918. #endif`,$Re=`#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`,QRe=`#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`,eLe=`#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`,tLe=`#ifdef USE_MAP
  7942. uniform sampler2D map;
  7943. #endif`,rLe=`#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`,iLe=`#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`,nLe=`float metalnessFactor = metalness;
  7968. #ifdef USE_METALNESSMAP
  7969. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  7970. metalnessFactor *= texelMetalness.b;
  7971. #endif`,aLe=`#ifdef USE_METALNESSMAP
  7972. uniform sampler2D metalnessMap;
  7973. #endif`,oLe=`#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`,sLe=`#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`,lLe=`#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`,uLe=`#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`,cLe=`#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`,fLe=`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;`,hLe=`#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`,pLe=`#ifndef FLAT_SHADED
  8099. varying vec3 vNormal;
  8100. #ifdef USE_TANGENT
  8101. varying vec3 vTangent;
  8102. varying vec3 vBitangent;
  8103. #endif
  8104. #endif`,dLe=`#ifndef FLAT_SHADED
  8105. varying vec3 vNormal;
  8106. #ifdef USE_TANGENT
  8107. varying vec3 vTangent;
  8108. varying vec3 vBitangent;
  8109. #endif
  8110. #endif`,mLe=`#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`,vLe=`#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`,gLe=`#ifdef USE_CLEARCOAT
  8139. vec3 clearcoatNormal = nonPerturbedNormal;
  8140. #endif`,yLe=`#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`,_Le=`#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`,xLe=`#ifdef USE_IRIDESCENCEMAP
  8154. uniform sampler2D iridescenceMap;
  8155. #endif
  8156. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  8157. uniform sampler2D iridescenceThicknessMap;
  8158. #endif`,SLe=`#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 );`,MLe=`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. }`,bLe=`#ifdef PREMULTIPLIED_ALPHA
  8206. gl_FragColor.rgb *= gl_FragColor.a;
  8207. #endif`,wLe=`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;`,TLe=`#ifdef DITHERING
  8216. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  8217. #endif`,ELe=`#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`,ALe=`float roughnessFactor = roughness;
  8225. #ifdef USE_ROUGHNESSMAP
  8226. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  8227. roughnessFactor *= texelRoughness.g;
  8228. #endif`,CLe=`#ifdef USE_ROUGHNESSMAP
  8229. uniform sampler2D roughnessMap;
  8230. #endif`,RLe=`#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`,LLe=`#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`,DLe=`#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`,PLe=`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. }`,ILe=`#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`,NLe=`#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`,ULe=`#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`,OLe=`#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`,zLe=`float specularStrength;
  8549. #ifdef USE_SPECULARMAP
  8550. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  8551. specularStrength = texelSpecular.r;
  8552. #else
  8553. specularStrength = 1.0;
  8554. #endif`,FLe=`#ifdef USE_SPECULARMAP
  8555. uniform sampler2D specularMap;
  8556. #endif`,BLe=`#if defined( TONE_MAPPING )
  8557. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  8558. #endif`,kLe=`#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; }`,VLe=`#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`,GLe=`#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`,HLe=`#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`,WLe=`#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`,XLe=`#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`,YLe=`#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`,qLe=`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. }`,ZLe=`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. }`,jLe=`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. }`,KLe=`#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. }`,JLe=`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. }`,$Le=`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. }`,QLe=`#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. }`,e2e=`#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. }`,t2e=`#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. }`,r2e=`#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. }`,i2e=`varying vec3 vWorldDirection;
  9199. #include <common>
  9200. void main() {
  9201. vWorldDirection = transformDirection( position, modelMatrix );
  9202. #include <begin_vertex>
  9203. #include <project_vertex>
  9204. }`,n2e=`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. }`,a2e=`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. }`,o2e=`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. }`,s2e=`#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. }`,l2e=`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. }`,u2e=`#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. }`,c2e=`#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. }`,f2e=`#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. }`,h2e=`#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. }`,p2e=`#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. }`,d2e=`#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. }`,m2e=`#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. }`,v2e=`#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. }`,g2e=`#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. }`,y2e=`#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. }`,_2e=`#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. }`,x2e=`#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. }`,S2e=`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. }`,M2e=`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. }`,b2e=`#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. }`,w2e=`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. }`,T2e=`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. }`,E2e=`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:qCe,alphahash_pars_fragment:ZCe,alphamap_fragment:jCe,alphamap_pars_fragment:KCe,alphatest_fragment:JCe,alphatest_pars_fragment:$Ce,aomap_fragment:QCe,aomap_pars_fragment:eRe,batching_pars_vertex:tRe,batching_vertex:rRe,begin_vertex:iRe,beginnormal_vertex:nRe,bsdfs:aRe,iridescence_fragment:oRe,bumpmap_pars_fragment:sRe,clipping_planes_fragment:lRe,clipping_planes_pars_fragment:uRe,clipping_planes_pars_vertex:cRe,clipping_planes_vertex:fRe,color_fragment:hRe,color_pars_fragment:pRe,color_pars_vertex:dRe,color_vertex:mRe,common:vRe,cube_uv_reflection_fragment:gRe,defaultnormal_vertex:yRe,displacementmap_pars_vertex:_Re,displacementmap_vertex:xRe,emissivemap_fragment:SRe,emissivemap_pars_fragment:MRe,colorspace_fragment:bRe,colorspace_pars_fragment:wRe,envmap_fragment:TRe,envmap_common_pars_fragment:ERe,envmap_pars_fragment:ARe,envmap_pars_vertex:CRe,envmap_physical_pars_fragment:kRe,envmap_vertex:RRe,fog_vertex:LRe,fog_pars_vertex:DRe,fog_fragment:PRe,fog_pars_fragment:IRe,gradientmap_pars_fragment:NRe,lightmap_fragment:URe,lightmap_pars_fragment:ORe,lights_lambert_fragment:zRe,lights_lambert_pars_fragment:FRe,lights_pars_begin:BRe,lights_toon_fragment:VRe,lights_toon_pars_fragment:GRe,lights_phong_fragment:HRe,lights_phong_pars_fragment:WRe,lights_physical_fragment:XRe,lights_physical_pars_fragment:YRe,lights_fragment_begin:qRe,lights_fragment_maps:ZRe,lights_fragment_end:jRe,logdepthbuf_fragment:KRe,logdepthbuf_pars_fragment:JRe,logdepthbuf_pars_vertex:$Re,logdepthbuf_vertex:QRe,map_fragment:eLe,map_pars_fragment:tLe,map_particle_fragment:rLe,map_particle_pars_fragment:iLe,metalnessmap_fragment:nLe,metalnessmap_pars_fragment:aLe,morphinstance_vertex:oLe,morphcolor_vertex:sLe,morphnormal_vertex:lLe,morphtarget_pars_vertex:uLe,morphtarget_vertex:cLe,normal_fragment_begin:fLe,normal_fragment_maps:hLe,normal_pars_fragment:pLe,normal_pars_vertex:dLe,normal_vertex:mLe,normalmap_pars_fragment:vLe,clearcoat_normal_fragment_begin:gLe,clearcoat_normal_fragment_maps:yLe,clearcoat_pars_fragment:_Le,iridescence_pars_fragment:xLe,opaque_fragment:SLe,packing:MLe,premultiplied_alpha_fragment:bLe,project_vertex:wLe,dithering_fragment:TLe,dithering_pars_fragment:ELe,roughnessmap_fragment:ALe,roughnessmap_pars_fragment:CLe,shadowmap_pars_fragment:RLe,shadowmap_pars_vertex:LLe,shadowmap_vertex:DLe,shadowmask_pars_fragment:PLe,skinbase_vertex:ILe,skinning_pars_vertex:NLe,skinning_vertex:ULe,skinnormal_vertex:OLe,specularmap_fragment:zLe,specularmap_pars_fragment:FLe,tonemapping_fragment:BLe,tonemapping_pars_fragment:kLe,transmission_fragment:VLe,transmission_pars_fragment:GLe,uv_pars_fragment:HLe,uv_pars_vertex:WLe,uv_vertex:XLe,worldpos_vertex:YLe,background_vert:qLe,background_frag:ZLe,backgroundCube_vert:jLe,backgroundCube_frag:KLe,cube_vert:JLe,cube_frag:$Le,depth_vert:QLe,depth_frag:e2e,distanceRGBA_vert:t2e,distanceRGBA_frag:r2e,equirect_vert:i2e,equirect_frag:n2e,linedashed_vert:a2e,linedashed_frag:o2e,meshbasic_vert:s2e,meshbasic_frag:l2e,meshlambert_vert:u2e,meshlambert_frag:c2e,meshmatcap_vert:f2e,meshmatcap_frag:h2e,meshnormal_vert:p2e,meshnormal_frag:d2e,meshphong_vert:m2e,meshphong_frag:v2e,meshphysical_vert:g2e,meshphysical_frag:y2e,meshtoon_vert:_2e,meshtoon_frag:x2e,points_vert:S2e,points_frag:M2e,shadow_vert:b2e,shadow_frag:w2e,sprite_vert:T2e,sprite_frag:E2e},gt={common:{diffuse:{value:new rr(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 rr(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 rr(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 rr(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}}},Bu={basic:{uniforms:ba([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.fog]),vertexShader:vr.meshbasic_vert,fragmentShader:vr.meshbasic_frag},lambert:{uniforms:ba([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,gt.lights,{emissive:{value:new rr(0)}}]),vertexShader:vr.meshlambert_vert,fragmentShader:vr.meshlambert_frag},phong:{uniforms:ba([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,gt.lights,{emissive:{value:new rr(0)},specular:{value:new rr(1118481)},shininess:{value:30}}]),vertexShader:vr.meshphong_vert,fragmentShader:vr.meshphong_frag},standard:{uniforms:ba([gt.common,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.roughnessmap,gt.metalnessmap,gt.fog,gt.lights,{emissive:{value:new rr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:vr.meshphysical_vert,fragmentShader:vr.meshphysical_frag},toon:{uniforms:ba([gt.common,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.gradientmap,gt.fog,gt.lights,{emissive:{value:new rr(0)}}]),vertexShader:vr.meshtoon_vert,fragmentShader:vr.meshtoon_frag},matcap:{uniforms:ba([gt.common,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,{matcap:{value:null}}]),vertexShader:vr.meshmatcap_vert,fragmentShader:vr.meshmatcap_frag},points:{uniforms:ba([gt.points,gt.fog]),vertexShader:vr.points_vert,fragmentShader:vr.points_frag},dashed:{uniforms:ba([gt.common,gt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vr.linedashed_vert,fragmentShader:vr.linedashed_frag},depth:{uniforms:ba([gt.common,gt.displacementmap]),vertexShader:vr.depth_vert,fragmentShader:vr.depth_frag},normal:{uniforms:ba([gt.common,gt.bumpmap,gt.normalmap,gt.displacementmap,{opacity:{value:1}}]),vertexShader:vr.meshnormal_vert,fragmentShader:vr.meshnormal_frag},sprite:{uniforms:ba([gt.sprite,gt.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:ba([gt.common,gt.displacementmap,{referencePosition:{value:new ye},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:vr.distanceRGBA_vert,fragmentShader:vr.distanceRGBA_frag},shadow:{uniforms:ba([gt.lights,gt.fog,{color:{value:new rr(0)},opacity:{value:1}}]),vertexShader:vr.shadow_vert,fragmentShader:vr.shadow_frag}};Bu.physical={uniforms:ba([Bu.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 rr(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 rr(0)},specularColor:{value:new rr(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 HC={r:0,b:0,g:0},Ud=new zn,A2e=new Xt;function C2e(r,e,t,i,n,a,o){let s=new rr(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===DR)?(c===void 0&&(c=new co(new vM(1,1,1),new Vu({name:"BackgroundCubeMaterial",uniforms:Dy(Bu.backgroundCube.uniforms),vertexShader:Bu.backgroundCube.vertexShader,fragmentShader:Bu.backgroundCube.fragmentShader,side:fo,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)),Ud.copy(v.backgroundRotation),Ud.x*=-1,Ud.y*=-1,Ud.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Ud.y*=-1,Ud.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(A2e.makeRotationFromEuler(Ud)),c.material.toneMapped=ti.getTransfer(y.colorSpace)!==li,(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 co(new hR(2,2),new Vu({name:"BackgroundMaterial",uniforms:Dy(Bu.background.uniforms),vertexShader:Bu.background.vertexShader,fragmentShader:Bu.background.fragmentShader,side:Ih,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=ti.getTransfer(y.colorSpace)!==li,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(HC,zae(r)),i.buffers.color.setClear(HC.r,HC.g,HC.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 R2e(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,P,U,B,z){let k=!1;if(o){let G=g(B,U,P);u!==G&&(u=G,p(u.object)),k=v(A,B,U,z),k&&_(A,B,U,z)}else{let G=P.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)}z!==null&&t.update(z,r.ELEMENT_ARRAY_BUFFER),(k||c)&&(c=!1,T(A,P,U,B),z!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(z).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,P,U){let B=U.wireframe===!0,z=s[A.id];z===void 0&&(z={},s[A.id]=z);let k=z[P.id];k===void 0&&(k={},z[P.id]=k);let G=k[B];return G===void 0&&(G=m(h()),k[B]=G),G}function m(A){let P=[],U=[],B=[];for(let z=0;z<n;z++)P[z]=0,U[z]=0,B[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:P,enabledAttributes:U,attributeDivisors:B,object:A,attributes:{},index:null}}function v(A,P,U,B){let z=u.attributes,k=P.attributes,G=0,Y=U.getAttributes();for(let J in Y)if(Y[J].location>=0){let V=z[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,P,U,B){let z={},k=P.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),z[J]=K,G++}u.attributes=z,u.attributesNum=G,u.index=B}function y(){let A=u.newAttributes;for(let P=0,U=A.length;P<U;P++)A[P]=0}function x(A){M(A,0)}function M(A,P){let U=u.newAttributes,B=u.enabledAttributes,z=u.attributeDivisors;U[A]=1,B[A]===0&&(r.enableVertexAttribArray(A),B[A]=1),z[A]!==P&&((i.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](A,P),z[A]=P)}function S(){let A=u.newAttributes,P=u.enabledAttributes;for(let U=0,B=P.length;U<B;U++)P[U]!==A[U]&&(r.disableVertexAttribArray(U),P[U]=0)}function w(A,P,U,B,z,k,G){G===!0?r.vertexAttribIPointer(A,P,U,z,k):r.vertexAttribPointer(A,P,U,B,z,k)}function T(A,P,U,B){if(i.isWebGL2===!1&&(A.isInstancedMesh||B.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();let z=B.attributes,k=U.getAttributes(),G=P.defaultAttributeValues;for(let Y in k){let J=k[Y];if(J.location>=0){let Q=z[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===Aae);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 P=s[A];for(let U in P){let B=P[U];for(let z in B)d(B[z].object),delete B[z];delete P[U]}delete s[A]}}function b(A){if(s[A.id]===void 0)return;let P=s[A.id];for(let U in P){let B=P[U];for(let z in B)d(B[z].object),delete B[z];delete P[U]}delete s[A.id]}function E(A){for(let P in s){let U=s[P];if(U[A.id]===void 0)continue;let B=U[A.id];for(let z in B)d(B[z].object),delete B[z];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 L2e(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 D2e(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 P2e(r){let e=this,t=null,i=0,n=!1,a=!1,o=new Hc,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 I2e(r){let e=new WeakMap;function t(o,s){return s===hM?o.mapping=Ty:s===$F&&(o.mapping=Ey),o}function i(o){if(o&&o.isTexture){let s=o.mapping;if(s===hM||s===$F)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 aB(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 Py=class extends cR{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}},_y=4,Hne=[.125,.215,.35,.446,.526,.582],Bd=20,kF=new Py,Wne=new rr,VF=null,GF=0,HF=0,zd=(1+Math.sqrt(5))/2,vy=1/zd,Xne=[new ye(1,1,1),new ye(-1,1,1),new ye(1,1,-1),new ye(-1,1,-1),new ye(0,zd,vy),new ye(0,zd,-vy),new ye(vy,0,zd),new ye(-vy,0,zd),new ye(zd,vy,0),new ye(-zd,vy,0)],pR=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){VF=this._renderer.getRenderTarget(),GF=this._renderer.getActiveCubeFace(),HF=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=Zne(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=qne(),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(VF,GF,HF),e.scissorTest=!1,WC(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ty||e.mapping===Ey?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),VF=this._renderer.getRenderTarget(),GF=this._renderer.getActiveCubeFace(),HF=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:lo,minFilter:lo,generateMipmaps:!1,type:pM,format:nl,colorSpace:Vh,depthBuffer:!1},n=Yne(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Yne(e,t,i);let{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=N2e(a)),this._blurMaterial=U2e(a,e,t)}return n}_compileMaterial(e){let t=new co(this._lodPlanes[0],e);this._renderer.compile(t,kF)}_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(Wne),c.toneMapping=Dh,c.autoClear=!1;let p=new lR({name:"PMREM.Background",side:fo,depthWrite:!1,depthTest:!1}),d=new co(new vM,p),g=!1,m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,g=!0):(p.color.copy(Wne),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;WC(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===Ty||e.mapping===Ey;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=Zne()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=qne());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new co(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let l=this._cubeSize;WC(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,kF)}_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=Xne[(n-1)%Xne.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 co(this._lodPlanes[n],u),h=u.uniforms,p=this._sizeLods[i]-1,d=isFinite(a)?Math.PI/(2*p):2*Math.PI/(2*Bd-1),g=a/d,m=isFinite(a)?1+Math.floor(c*g):Bd;m>Bd&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Bd}`);let v=[],_=0;for(let w=0;w<Bd;++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-_y?n-y+_y:0),S=4*(this._cubeSize-x);WC(t,M,S,3*x,2*x),l.setRenderTarget(t),l.render(f,kF)}};function N2e(r){let e=[],t=[],i=[],n=r,a=r-_y+1+Hne.length;for(let o=0;o<a;o++){let s=Math.pow(2,n);t.push(s);let l=1/s;o>r-_y?l=Hne[o-r+_y-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 ol;M.setAttribute("position",new al(_,g)),M.setAttribute("uv",new al(y,m)),M.setAttribute("faceIndex",new al(x,v)),e.push(M),n>_y&&n--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function Yne(r,e,t){let i=new qc(r,e,t);return i.texture.mapping=DR,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function WC(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function U2e(r,e,t){let i=new Float32Array(Bd),n=new ye(0,1,0);return new Vu({name:"SphericalGaussianBlur",defines:{n:Bd,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:FB(),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:Lh,depthTest:!1,depthWrite:!1})}function qne(){return new Vu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:FB(),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:Lh,depthTest:!1,depthWrite:!1})}function Zne(){return new Vu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:FB(),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:Lh,depthTest:!1,depthWrite:!1})}function FB(){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 O2e(r){let e=new WeakMap,t=null;function i(s){if(s&&s.isTexture){let l=s.mapping,u=l===hM||l===$F,c=l===Ty||l===Ey;if(u||c)if(s.isRenderTargetTexture&&s.needsPMREMUpdate===!0){s.needsPMREMUpdate=!1;let f=e.get(s);return t===null&&(t=new pR(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 pR(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 z2e(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 F2e(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(Uae(h)?uR:Ly)(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 B2e(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 k2e(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 V2e(r,e){return r[0]-e[0]}function G2e(r,e){return Math.abs(e[1])-Math.abs(r[1])}function H2e(r,e,t){let i={},n=new Float32Array(8),a=new WeakMap,o=new Ir,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 oR(b,T,C,g);E.type=ku,E.needsUpdate=!0;let I=w*4;for(let A=0;A<g;A++){let P=x[A],U=M[A],B=S[A],z=T*C*4*A;for(let k=0;k<P.count;k++){let G=k*I;v===!0&&(o.fromBufferAttribute(P,k),b[z+G+0]=o.x,b[z+G+1]=o.y,b[z+G+2]=o.z,b[z+G+3]=0),_===!0&&(o.fromBufferAttribute(U,k),b[z+G+4]=o.x,b[z+G+5]=o.y,b[z+G+6]=o.z,b[z+G+7]=0),y===!0&&(o.fromBufferAttribute(B,k),b[z+G+8]=o.x,b[z+G+9]=o.y,b[z+G+10]=o.z,b[z+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(G2e);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(V2e);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 W2e(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 dR=class extends ko{constructor(e,t,i,n,a,o,s,l,u,c){if(c=c!==void 0?c:Gd,c!==Gd&&c!==Cy)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===Gd&&(i=Rh),i===void 0&&c===Cy&&(i=Vd),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:Pn,this.minFilter=l!==void 0?l:Pn,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}},Bae=new ko,kae=new dR(1,1);kae.compareFunction=Nae;var Vae=new oR,Gae=new iB,Hae=new fR,jne=[],Kne=[],Jne=new Float32Array(16),$ne=new Float32Array(9),Qne=new Float32Array(4);function zy(r,e,t){let i=r[0];if(i<=0||i>0)return r;let n=e*t,a=jne[n];if(a===void 0&&(a=new Float32Array(n),jne[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 ln(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 un(r,e){for(let t=0,i=e.length;t<i;t++)r[t]=e[t]}function IR(r,e){let t=Kne[e];t===void 0&&(t=new Int32Array(e),Kne[e]=t);for(let i=0;i!==e;++i)t[i]=r.allocateTextureUnit();return t}function X2e(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function Y2e(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(ln(t,e))return;r.uniform2fv(this.addr,e),un(t,e)}}function q2e(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(ln(t,e))return;r.uniform3fv(this.addr,e),un(t,e)}}function Z2e(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(ln(t,e))return;r.uniform4fv(this.addr,e),un(t,e)}}function j2e(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(ln(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),un(t,e)}else{if(ln(t,i))return;Qne.set(i),r.uniformMatrix2fv(this.addr,!1,Qne),un(t,i)}}function K2e(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(ln(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),un(t,e)}else{if(ln(t,i))return;$ne.set(i),r.uniformMatrix3fv(this.addr,!1,$ne),un(t,i)}}function J2e(r,e){let t=this.cache,i=e.elements;if(i===void 0){if(ln(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),un(t,e)}else{if(ln(t,i))return;Jne.set(i),r.uniformMatrix4fv(this.addr,!1,Jne),un(t,i)}}function $2e(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function Q2e(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(ln(t,e))return;r.uniform2iv(this.addr,e),un(t,e)}}function eDe(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(ln(t,e))return;r.uniform3iv(this.addr,e),un(t,e)}}function tDe(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(ln(t,e))return;r.uniform4iv(this.addr,e),un(t,e)}}function rDe(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function iDe(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(ln(t,e))return;r.uniform2uiv(this.addr,e),un(t,e)}}function nDe(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(ln(t,e))return;r.uniform3uiv(this.addr,e),un(t,e)}}function aDe(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(ln(t,e))return;r.uniform4uiv(this.addr,e),un(t,e)}}function oDe(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?kae:Bae;t.setTexture2D(e||a,n)}function sDe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||Gae,n)}function lDe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTextureCube(e||Hae,n)}function uDe(r,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||Vae,n)}function cDe(r){switch(r){case 5126:return X2e;case 35664:return Y2e;case 35665:return q2e;case 35666:return Z2e;case 35674:return j2e;case 35675:return K2e;case 35676:return J2e;case 5124:case 35670:return $2e;case 35667:case 35671:return Q2e;case 35668:case 35672:return eDe;case 35669:case 35673:return tDe;case 5125:return rDe;case 36294:return iDe;case 36295:return nDe;case 36296:return aDe;case 35678:case 36198:case 36298:case 36306:case 35682:return oDe;case 35679:case 36299:case 36307:return sDe;case 35680:case 36300:case 36308:case 36293:return lDe;case 36289:case 36303:case 36311:case 36292:return uDe}}function fDe(r,e){r.uniform1fv(this.addr,e)}function hDe(r,e){let t=zy(e,this.size,2);r.uniform2fv(this.addr,t)}function pDe(r,e){let t=zy(e,this.size,3);r.uniform3fv(this.addr,t)}function dDe(r,e){let t=zy(e,this.size,4);r.uniform4fv(this.addr,t)}function mDe(r,e){let t=zy(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function vDe(r,e){let t=zy(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function gDe(r,e){let t=zy(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function yDe(r,e){r.uniform1iv(this.addr,e)}function _De(r,e){r.uniform2iv(this.addr,e)}function xDe(r,e){r.uniform3iv(this.addr,e)}function SDe(r,e){r.uniform4iv(this.addr,e)}function MDe(r,e){r.uniform1uiv(this.addr,e)}function bDe(r,e){r.uniform2uiv(this.addr,e)}function wDe(r,e){r.uniform3uiv(this.addr,e)}function TDe(r,e){r.uniform4uiv(this.addr,e)}function EDe(r,e,t){let i=this.cache,n=e.length,a=IR(t,n);ln(i,a)||(r.uniform1iv(this.addr,a),un(i,a));for(let o=0;o!==n;++o)t.setTexture2D(e[o]||Bae,a[o])}function ADe(r,e,t){let i=this.cache,n=e.length,a=IR(t,n);ln(i,a)||(r.uniform1iv(this.addr,a),un(i,a));for(let o=0;o!==n;++o)t.setTexture3D(e[o]||Gae,a[o])}function CDe(r,e,t){let i=this.cache,n=e.length,a=IR(t,n);ln(i,a)||(r.uniform1iv(this.addr,a),un(i,a));for(let o=0;o!==n;++o)t.setTextureCube(e[o]||Hae,a[o])}function RDe(r,e,t){let i=this.cache,n=e.length,a=IR(t,n);ln(i,a)||(r.uniform1iv(this.addr,a),un(i,a));for(let o=0;o!==n;++o)t.setTexture2DArray(e[o]||Vae,a[o])}function LDe(r){switch(r){case 5126:return fDe;case 35664:return hDe;case 35665:return pDe;case 35666:return dDe;case 35674:return mDe;case 35675:return vDe;case 35676:return gDe;case 5124:case 35670:return yDe;case 35667:case 35671:return _De;case 35668:case 35672:return xDe;case 35669:case 35673:return SDe;case 5125:return MDe;case 36294:return bDe;case 36295:return wDe;case 36296:return TDe;case 35678:case 36198:case 36298:case 36306:case 35682:return EDe;case 35679:case 36299:case 36307:return ADe;case 35680:case 36300:case 36308:case 36293:return CDe;case 36289:case 36303:case 36311:case 36292:return RDe}}var oB=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=cDe(t.type)}},sB=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=LDe(t.type)}},lB=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)}}},WF=/(\w+)(\])?(\[|\.)?/g;function eae(r,e){r.seq.push(e),r.map[e.id]=e}function DDe(r,e,t){let i=r.name,n=i.length;for(WF.lastIndex=0;;){let a=WF.exec(i),o=WF.lastIndex,s=a[1],l=a[2]==="]",u=a[3];if(l&&(s=s|0),u===void 0||u==="["&&o+2===n){eae(t,u===void 0?new oB(s,r,e):new sB(s,r,e));break}else{let f=t.map[s];f===void 0&&(f=new lB(s),eae(t,f)),t=f}}}var wy=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);DDe(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 tae(r,e,t){let i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}var PDe=37297,IDe=0;function NDe(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 UDe(r){let e=ti.getPrimaries(ti.workingColorSpace),t=ti.getPrimaries(r),i;switch(e===t?i="":e===tR&&t===eR?i="LinearDisplayP3ToLinearSRGB":e===eR&&t===tR&&(i="LinearSRGBToLinearDisplayP3"),r){case Vh:case PR:return[i,"LinearTransferOETF"];case wa:case OB:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[i,"LinearTransferOETF"]}}function rae(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. `+NDe(r.getShaderSource(e),o)}else return n}function ODe(r,e){let t=UDe(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function zDe(r,e){let t;switch(e){case zAe:t="Linear";break;case FAe:t="Reinhard";break;case BAe:t="OptimizedCineon";break;case kAe:t="ACESFilmic";break;case GAe:t="AgX";break;case HAe:t="Neutral";break;case VAe:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function FDe(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(xy).join(`
  10167. `)}function BDe(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(xy).join(`
  10168. `)}function kDe(r){let e=[];for(let t in r){let i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
  10169. `)}function VDe(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 xy(r){return r!==""}function iae(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 nae(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var GDe=/^[ \t]*#include +<([\w\d./]+)>/gm;function uB(r){return r.replace(GDe,WDe)}var HDe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function WDe(r,e){let t=vr[e];if(t===void 0){let i=HDe.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 uB(t)}var XDe=/#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 aae(r){return r.replace(XDe,YDe)}function YDe(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 oae(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 qDe(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Eae?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===fAe?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Gc&&(e="SHADOWMAP_TYPE_VSM"),e}function ZDe(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Ty:case Ey:e="ENVMAP_TYPE_CUBE";break;case DR:e="ENVMAP_TYPE_CUBE_UV";break}return e}function jDe(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Ey:e="ENVMAP_MODE_REFRACTION";break}return e}function KDe(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case LR:e="ENVMAP_BLENDING_MULTIPLY";break;case UAe:e="ENVMAP_BLENDING_MIX";break;case OAe:e="ENVMAP_BLENDING_ADD";break}return e}function JDe(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 $De(r,e,t,i){let n=r.getContext(),a=t.defines,o=t.vertexShader,s=t.fragmentShader,l=qDe(t),u=ZDe(t),c=jDe(t),f=KDe(t),h=JDe(t),p=t.isWebGL2?"":FDe(t),d=BDe(t),g=kDe(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(xy).join(`
  10191. `),v.length>0&&(v+=`
  10192. `),_=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(xy).join(`
  10193. `),_.length>0&&(_+=`
  10194. `)):(v=[oae(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(xy).join(`
  10196. `),_=[p,oae(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!==Dh?"#define TONE_MAPPING":"",t.toneMapping!==Dh?vr.tonemapping_pars_fragment:"",t.toneMapping!==Dh?zDe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",vr.colorspace_pars_fragment,ODe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
  10197. `].filter(xy).join(`
  10198. `)),o=uB(o),o=iae(o,t),o=nae(o,t),s=uB(s),s=iae(s,t),s=nae(s,t),o=aae(o),s=aae(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===bne?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===bne?"":"#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=tae(n,n.VERTEX_SHADER,x),w=tae(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(),P=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 z=rae(n,S,"vertex"),k=rae(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. `+z+`
  10208. `+k)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(A===""||P==="")&&(B=!1);B&&(I.diagnostics={runnable:U,programLog:R,vertexShader:{log:A,prefix:v},fragmentShader:{log:P,prefix:_}})}n.deleteShader(S),n.deleteShader(w),C=new wy(n,m),b=VDe(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,PDe)),E},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=IDe++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=w,this}var QDe=0,cB=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 fB(e),t.set(e,i)),i}},fB=class{constructor(e){this.id=QDe++,this.code=e,this.usedTimes=0}};function ePe(r,e,t,i,n,a,o){let s=new sR,l=new cB,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 P=R.fog,U=A.geometry,B=b.isMeshStandardMaterial?R.environment:null,z=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),k=z&&z.mapping===DR?z.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 kt=Bu[G];V=kt.vertexShader,K=kt.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=!!z,_e=!!b.aoMap,xe=!!b.lightMap,Le=!!b.bumpMap,Ue=!!b.normalMap,Ne=!!b.displacementMap,Ve=!!b.emissiveMap,ct=!!b.metalnessMap,F=!!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,Fe=!!b.specularMap,we=!!b.specularColorMap,Ie=!!b.specularIntensityMap,st=he&&!!b.transmissionMap,Je=he&&!!b.thicknessMap,Gt=!!b.gradientMap,X=!!b.alphaMap,Te=b.alphaTest>0,te=!!b.alphaHash,Me=!!b.extensions,De=Dh;b.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(De=r.toneMapping);let St={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:Vh,alphaToCoverage:!!b.alphaToCoverage,map:q,matcap:H,envMap:We,envMapMode:We&&z.mapping,envMapCubeUVHeight:k,aoMap:_e,lightMap:xe,bumpMap:Le,normalMap:Ue,displacementMap:p&&Ne,emissiveMap:Ve,normalMapObjectSpace:Ue&&b.normalMapType===rCe,normalMapTangentSpace:Ue&&b.normalMapType===UB,metalnessMap:ct,roughnessMap:F,anisotropy:L,anisotropyMap:et,clearcoat:ne,clearcoatMap:Ke,clearcoatNormalMap:Se,clearcoatRoughnessMap:Ae,iridescence:le,iridescenceMap:nt,iridescenceThicknessMap:$,sheen:me,sheenColorMap:it,sheenRoughnessMap:Xe,specularMap:Fe,specularColorMap:we,specularIntensityMap:Ie,transmission:he,transmissionMap:st,thicknessMap:Je,gradientMap:Gt,opaque:b.transparent===!1&&b.blending===My&&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:F&&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:Fe&&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:!!P,useFog:b.fog===!0,fogExp2:!!P&&P.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:De,useLegacyLights:r._useLegacyLights,decodeVideoTexture:q&&b.map.isVideoTexture===!0&&ti.getTransfer(b.map.colorSpace)===li,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Wc,flipSided:b.side===fo,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 St.vertexUv1s=u.has(1),St.vertexUv2s=u.has(2),St.vertexUv3s=u.has(3),u.clear(),St}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=Bu[E];I=VCe.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 P=c[R];if(P.cacheKey===E){I=P,++I.usedTimes;break}}return I===void 0&&(I=new $De(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 tPe(){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 rPe(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 sae(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 lae(){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||rPe),i.length>1&&i.sort(h||sae),n.length>1&&n.sort(h||sae)}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 iPe(){let r=new WeakMap;function e(i,n){let a=r.get(i),o;return a===void 0?(o=new lae,r.set(i,[o])):n>=a.length?(o=new lae,a.push(o)):o=a[n],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function nPe(){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 rr};break;case"SpotLight":t={position:new ye,direction:new ye,color:new rr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ye,color:new rr,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ye,skyColor:new rr,groundColor:new rr};break;case"RectAreaLight":t={color:new rr,position:new ye,halfWidth:new ye,halfHeight:new ye};break}return r[e.id]=t,t}}}function aPe(){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 oPe=0;function sPe(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function lPe(r,e){let t=new nPe,i=aPe(),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 Xt,s=new Xt;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(sPe);let b=f===!0?Math.PI:1;for(let I=0,R=c.length;I<R;I++){let A=c[I],P=A.color,U=A.intensity,B=A.distance,z=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)h+=P.r*U*b,p+=P.g*U*b,d+=P.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]=z,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(P).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]=z,S++}v++}else if(A.isRectAreaLight){let k=t.get(A);k.color.copy(P).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]=z,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=gt.LTC_FLOAT_1,n.rectAreaLTC2=gt.LTC_FLOAT_2):(n.rectAreaLTC1=gt.LTC_HALF_1,n.rectAreaLTC2=gt.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=gt.LTC_FLOAT_1,n.rectAreaLTC2=gt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(n.rectAreaLTC1=gt.LTC_HALF_1,n.rectAreaLTC2=gt.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=oPe++)}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 uae(r,e){let t=new lPe(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 uPe(r,e){let t=new WeakMap;function i(a,o=0){let s=t.get(a),l;return s===void 0?(l=new uae(r,e),t.set(a,[l])):o>=s.length?(l=new uae(r,e),s.push(l)):l=s[o],l}function n(){t=new WeakMap}return{get:i,dispose:n}}var hB=class extends Zc{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=eCe,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}},pB=class extends Zc{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}},cPe=`void main() {
  10209. gl_Position = vec4( position, 1.0 );
  10210. }`,fPe=`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 hPe(r,e,t){let i=new gM,n=new yr,a=new yr,o=new Ir,s=new hB({depthPacking:tCe}),l=new pB,u={},c=t.maxTextureSize,f={[Ih]:fo,[fo]:Ih,[Wc]:Wc},h=new Vu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new yr},radius:{value:4}},vertexShader:cPe,fragmentShader:fPe}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let d=new ol;d.setAttribute("position",new al(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new co(d,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Eae;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(Lh),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);let R=v!==Gc&&this.type===Gc,A=v===Gc&&this.type!==Gc;for(let P=0,U=S.length;P<U;P++){let B=S[P],z=B.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;n.copy(z.mapSize);let k=z.getFrameExtents();if(n.multiply(k),a.copy(z.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/k.x),n.x=a.x*k.x,z.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/k.y),n.y=a.y*k.y,z.mapSize.y=a.y)),z.map===null||R===!0||A===!0){let Y=this.type!==Gc?{minFilter:Pn,magFilter:Pn}:{};z.map!==null&&z.map.dispose(),z.map=new qc(n.x,n.y,Y),z.map.texture.name=B.name+".shadowMap",z.camera.updateProjectionMatrix()}r.setRenderTarget(z.map),r.clear();let G=z.getViewportCount();for(let Y=0;Y<G;Y++){let J=z.getViewport(Y);o.set(a.x*J.x,a.y*J.y,a.x*J.z,a.y*J.w),I.viewport(o),z.updateMatrices(B,Y),i=z.getFrustum(),x(w,T,z.camera,B,this.type)}z.isPointLightShadow!==!0&&this.type===Gc&&_(z,T),z.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 qc(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 P=A[R];P===void 0&&(P=b.clone(),A[R]=P,w.addEventListener("dispose",M)),b=P}if(b.visible=w.visible,b.wireframe=w.wireframe,C===Gc?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===Gc)&&(!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 P=R.groups;for(let U=0,B=P.length;U<B;U++){let z=P[U],k=A[z.materialIndex];if(k&&k.visible){let G=y(S,k,C,b);S.onBeforeShadow(r,S,w,T,R,G,z),r.renderBufferDirect(T,null,R,G,S,z),S.onAfterShadow(r,S,w,T,R,G,z)}}}else if(A.visible){let P=y(S,A,C,b);S.onBeforeShadow(r,S,w,T,R,P,null),r.renderBufferDirect(T,null,R,P,S,null),S.onAfterShadow(r,S,w,T,R,P,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 pPe(r,e,t){let i=t.isWebGL2;function n(){let X=!1,Te=new Ir,te=null,Me=new Ir(0,0,0,0);return{setMask:function(De){te!==De&&!X&&(r.colorMask(De,De,De,De),te=De)},setLocked:function(De){X=De},setClear:function(De,St,kt,br,$r){$r===!0&&(De*=br,St*=br,kt*=br),Te.set(De,St,kt,br),Me.equals(Te)===!1&&(r.clearColor(De,St,kt,br),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(De){De?se(r.DEPTH_TEST):Ee(r.DEPTH_TEST)},setMask:function(De){Te!==De&&!X&&(r.depthMask(De),Te=De)},setFunc:function(De){if(te!==De){switch(De){case CAe:r.depthFunc(r.NEVER);break;case RAe:r.depthFunc(r.ALWAYS);break;case LAe:r.depthFunc(r.LESS);break;case KC:r.depthFunc(r.LEQUAL);break;case DAe:r.depthFunc(r.EQUAL);break;case PAe:r.depthFunc(r.GEQUAL);break;case IAe:r.depthFunc(r.GREATER);break;case NAe:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}te=De}},setLocked:function(De){X=De},setClear:function(De){Me!==De&&(r.clearDepth(De),Me=De)},reset:function(){X=!1,Te=null,te=null,Me=null}}}function o(){let X=!1,Te=null,te=null,Me=null,De=null,St=null,kt=null,br=null,$r=null;return{setTest:function(Ht){X||(Ht?se(r.STENCIL_TEST):Ee(r.STENCIL_TEST))},setMask:function(Ht){Te!==Ht&&!X&&(r.stencilMask(Ht),Te=Ht)},setFunc:function(Ht,Nr,ci){(te!==Ht||Me!==Nr||De!==ci)&&(r.stencilFunc(Ht,Nr,ci),te=Ht,Me=Nr,De=ci)},setOp:function(Ht,Nr,ci){(St!==Ht||kt!==Nr||br!==ci)&&(r.stencilOp(Ht,Nr,ci),St=Ht,kt=Nr,br=ci)},setLocked:function(Ht){X=Ht},setClear:function(Ht){$r!==Ht&&(r.clearStencil(Ht),$r=Ht)},reset:function(){X=!1,Te=null,te=null,Me=null,De=null,St=null,kt=null,br=null,$r=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 rr(0,0,0),b=0,E=!1,I=null,R=null,A=null,P=null,U=null,B=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),z=!1,k=0,G=r.getParameter(r.VERSION);G.indexOf("WebGL")!==-1?(k=parseFloat(/^WebGL (\d)/.exec(G)[1]),z=k>=1):G.indexOf("OpenGL ES")!==-1&&(k=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),z=k>=2);let Y=null,J={},Q=r.getParameter(r.SCISSOR_BOX),V=r.getParameter(r.VIEWPORT),K=new Ir().fromArray(Q),ae=new Ir().fromArray(V);function ve(X,Te,te,Me){let De=new Uint8Array(4),St=r.createTexture();r.bindTexture(X,St),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let kt=0;kt<te;kt++)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,De):r.texImage2D(Te+kt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,De);return St}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(KC),Ne(!1),Ve(Fie),se(r.CULL_FACE),Le(Lh);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 De=X.textures;if(te.length!==De.length||te[0]!==r.COLOR_ATTACHMENT0){for(let St=0,kt=De.length;St<kt;St++)te[St]=r.COLOR_ATTACHMENT0+St;te.length=De.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={[Fd]:r.FUNC_ADD,[pAe]:r.FUNC_SUBTRACT,[dAe]:r.FUNC_REVERSE_SUBTRACT};if(i)_e[Gie]=r.MIN,_e[Hie]=r.MAX;else{let X=e.get("EXT_blend_minmax");X!==null&&(_e[Gie]=X.MIN_EXT,_e[Hie]=X.MAX_EXT)}let xe={[mAe]:r.ZERO,[vAe]:r.ONE,[gAe]:r.SRC_COLOR,[KF]:r.SRC_ALPHA,[bAe]:r.SRC_ALPHA_SATURATE,[SAe]:r.DST_COLOR,[_Ae]:r.DST_ALPHA,[yAe]:r.ONE_MINUS_SRC_COLOR,[JF]:r.ONE_MINUS_SRC_ALPHA,[MAe]:r.ONE_MINUS_DST_COLOR,[xAe]:r.ONE_MINUS_DST_ALPHA,[wAe]:r.CONSTANT_COLOR,[TAe]:r.ONE_MINUS_CONSTANT_COLOR,[EAe]:r.CONSTANT_ALPHA,[AAe]:r.ONE_MINUS_CONSTANT_ALPHA};function Le(X,Te,te,Me,De,St,kt,br,$r,Ht){if(X===Lh){v===!0&&(Ee(r.BLEND),v=!1);return}if(v===!1&&(se(r.BLEND),v=!0),X!==hAe){if(X!==_||Ht!==E){if((y!==Fd||S!==Fd)&&(r.blendEquation(r.FUNC_ADD),y=Fd,S=Fd),Ht)switch(X){case My:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Bie:r.blendFunc(r.ONE,r.ONE);break;case kie:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Vie: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 My:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Bie:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case kie:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Vie: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=Ht}return}De=De||Te,St=St||te,kt=kt||Me,(Te!==y||De!==S)&&(r.blendEquationSeparate(_e[Te],_e[De]),y=Te,S=De),(te!==x||Me!==M||St!==w||kt!==T)&&(r.blendFuncSeparate(xe[te],xe[Me],xe[St],xe[kt]),x=te,M=Me,w=St,T=kt),(br.equals(C)===!1||$r!==b)&&(r.blendColor(br.r,br.g,br.b,$r),C.copy(br),b=$r),_=X,E=!1}function Ue(X,Te){X.side===Wc?Ee(r.CULL_FACE):se(r.CULL_FACE);let te=X.side===fo;Te&&(te=!te),Ne(te),X.blending===My&&X.transparent===!1?Le(Lh):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)),F(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!==uAe?(se(r.CULL_FACE),X!==R&&(X===Fie?r.cullFace(r.BACK):X===cAe?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Ee(r.CULL_FACE),R=X}function ct(X){X!==A&&(z&&r.lineWidth(X),A=X)}function F(X,Te,te){X?(se(r.POLYGON_OFFSET_FILL),(P!==Te||U!==te)&&(r.polygonOffset(Te,te),P=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 Fe(){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 Gt(){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 rr(0,0,0),b=0,E=!1,I=null,R=null,A=null,P=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:F,setScissorTest:L,activeTexture:ne,bindTexture:le,unbindTexture:me,compressedTexImage2D:he,compressedTexImage3D:et,texImage2D:Xe,texImage3D:Fe,updateUBOMapping:st,uniformBlockBinding:Je,texStorage2D:$,texStorage3D:it,texSubImage2D:Ke,texSubImage3D:Se,compressedTexSubImage2D:Ae,compressedTexSubImage3D:nt,scissor:we,viewport:Ie,reset:Gt}}function dPe(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(F,L){return d?new OffscreenCanvas(F,L):dM("canvas")}function m(F,L,ne,le){let me=1,he=ct(F);if((he.width>le||he.height>le)&&(me=le/Math.max(he.width,he.height)),me<1||L===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap||typeof VideoFrame<"u"&&F instanceof VideoFrame){let et=L?iR: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(F,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 F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),F;return F}function v(F){let L=ct(F);return tB(L.width)&&tB(L.height)}function _(F){return s?!1:F.wrapS!==uo||F.wrapT!==uo||F.minFilter!==Pn&&F.minFilter!==lo}function y(F,L){return F.generateMipmaps&&L&&F.minFilter!==Pn&&F.minFilter!==lo}function x(F){r.generateMipmap(F)}function M(F,L,ne,le,me=!1){if(s===!1)return L;if(F!==null){if(r[F]!==void 0)return r[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}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?QC:ti.getTransfer(le);ne===r.FLOAT&&(he=r.RGBA32F),ne===r.HALF_FLOAT&&(he=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(he=et===li?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(F,L,ne){return y(F,ne)===!0||F.isFramebufferTexture&&F.minFilter!==Pn&&F.minFilter!==lo?Math.log2(Math.max(L.width,L.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?L.mipmaps.length:1}function w(F){return F===Pn||F===Yie||F===iM?r.NEAREST:r.LINEAR}function T(F){let L=F.target;L.removeEventListener("dispose",T),b(L),L.isVideoTexture&&f.delete(L)}function C(F){let L=F.target;L.removeEventListener("dispose",C),I(L)}function b(F){let L=i.get(F);if(L.__webglInit===void 0)return;let ne=F.source,le=p.get(ne);if(le){let me=le[L.__cacheKey];me.usedTimes--,me.usedTimes===0&&E(F),Object.keys(le).length===0&&p.delete(ne)}i.remove(F)}function E(F){let L=i.get(F);r.deleteTexture(L.__webglTexture);let ne=F.source,le=p.get(ne);delete le[L.__cacheKey],o.memory.textures--}function I(F){let L=i.get(F);if(F.depthTexture&&F.depthTexture.dispose(),F.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=F.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(F)}let R=0;function A(){R=0}function P(){let F=R;return F>=n.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+n.maxTextures),R+=1,F}function U(F){let L=[];return L.push(F.wrapS),L.push(F.wrapT),L.push(F.wrapR||0),L.push(F.magFilter),L.push(F.minFilter),L.push(F.anisotropy),L.push(F.internalFormat),L.push(F.format),L.push(F.type),L.push(F.generateMipmaps),L.push(F.premultiplyAlpha),L.push(F.flipY),L.push(F.unpackAlignment),L.push(F.colorSpace),L.join()}function B(F,L){let ne=i.get(F);if(F.isVideoTexture&&Ne(F),F.isRenderTargetTexture===!1&&F.version>0&&ne.__version!==F.version){let le=F.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,F,L);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+L)}function z(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ae(ne,F,L);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+L)}function k(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ae(ne,F,L);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+L)}function G(F,L){let ne=i.get(F);if(F.version>0&&ne.__version!==F.version){ve(ne,F,L);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+L)}let Y={[Ay]:r.REPEAT,[uo]:r.CLAMP_TO_EDGE,[QF]:r.MIRRORED_REPEAT},J={[Pn]:r.NEAREST,[Yie]:r.NEAREST_MIPMAP_NEAREST,[iM]:r.NEAREST_MIPMAP_LINEAR,[lo]:r.LINEAR,[dF]:r.LINEAR_MIPMAP_NEAREST,[kd]:r.LINEAR_MIPMAP_LINEAR},Q={[iCe]:r.NEVER,[uCe]:r.ALWAYS,[nCe]:r.LESS,[Nae]:r.LEQUAL,[aCe]:r.EQUAL,[lCe]:r.GEQUAL,[oCe]:r.GREATER,[sCe]:r.NOTEQUAL};function V(F,L,ne){if(L.type===ku&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===lo||L.magFilter===dF||L.magFilter===iM||L.magFilter===kd||L.minFilter===lo||L.minFilter===dF||L.minFilter===iM||L.minFilter===kd)&&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(F,r.TEXTURE_WRAP_S,Y[L.wrapS]),r.texParameteri(F,r.TEXTURE_WRAP_T,Y[L.wrapT]),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,Y[L.wrapR]),r.texParameteri(F,r.TEXTURE_MAG_FILTER,J[L.magFilter]),r.texParameteri(F,r.TEXTURE_MIN_FILTER,J[L.minFilter])):(r.texParameteri(F,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(F,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(F===r.TEXTURE_3D||F===r.TEXTURE_2D_ARRAY)&&r.texParameteri(F,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(L.wrapS!==uo||L.wrapT!==uo)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(F,r.TEXTURE_MAG_FILTER,w(L.magFilter)),r.texParameteri(F,r.TEXTURE_MIN_FILTER,w(L.minFilter)),L.minFilter!==Pn&&L.minFilter!==lo&&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(F,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(F,r.TEXTURE_COMPARE_FUNC,Q[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===Pn||L.minFilter!==iM&&L.minFilter!==kd||L.type===ku&&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(F,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy}}}function K(F,L){let ne=!1;F.__webglInit===void 0&&(F.__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!==F.__cacheKey){me[he]===void 0&&(me[he]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),me[he].usedTimes++;let et=me[F.__cacheKey];et!==void 0&&(me[F.__cacheKey].usedTimes--,et.usedTimes===0&&E(L)),F.__cacheKey=he,F.__webglTexture=me[he].texture}return ne}function ae(F,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(F,L),he=L.source;t.bindTexture(le,F.__webglTexture,r.TEXTURE0+ne);let et=i.get(he);if(he.version!==et.__version||me===!0){t.activeTexture(r.TEXTURE0+ne);let Ke=ti.getPrimaries(ti.workingColorSpace),Se=L.colorSpace===Ch?null:ti.getPrimaries(L.colorSpace),Ae=L.colorSpace===Ch||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),Fe=a.convert(L.type),we=M(L.internalFormat,Xe,Fe,L.colorSpace,L.isVideoTexture);V(le,L,it);let Ie,st=L.mipmaps,Je=s&&L.isVideoTexture!==!0&&we!==Iae,Gt=et.__version===void 0||me===!0,X=he.dataReady,Te=S(L,$,it);if(L.isDepthTexture)we=r.DEPTH_COMPONENT,s?L.type===ku?we=r.DEPTH_COMPONENT32F:L.type===Rh?we=r.DEPTH_COMPONENT24:L.type===Vd?we=r.DEPTH24_STENCIL8:we=r.DEPTH_COMPONENT16:L.type===ku&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Gd&&we===r.DEPTH_COMPONENT&&L.type!==NB&&L.type!==Rh&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Rh,Fe=a.convert(L.type)),L.format===Cy&&we===r.DEPTH_COMPONENT&&(we=r.DEPTH_STENCIL,L.type!==Vd&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=Vd,Fe=a.convert(L.type))),Gt&&(Je?t.texStorage2D(r.TEXTURE_2D,1,we,$.width,$.height):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,Fe,null));else if(L.isDataTexture)if(st.length>0&&it){Je&&Gt&&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,Fe,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,Fe,Ie.data);L.generateMipmaps=!1}else Je?(Gt&&t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height),X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,$.width,$.height,Xe,Fe,$.data)):t.texImage2D(r.TEXTURE_2D,0,we,$.width,$.height,0,Xe,Fe,$.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){Je&&Gt&&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!==nl?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,Fe,Ie.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,we,Ie.width,Ie.height,$.depth,0,Xe,Fe,Ie.data)}else{Je&&Gt&&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!==nl?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,Fe,Ie.data):t.texImage2D(r.TEXTURE_2D,te,we,Ie.width,Ie.height,0,Xe,Fe,Ie.data)}else if(L.isDataArrayTexture)Je?(Gt&&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,Fe,$.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,we,$.width,$.height,$.depth,0,Xe,Fe,$.data);else if(L.isData3DTexture)Je?(Gt&&t.texStorage3D(r.TEXTURE_3D,Te,we,$.width,$.height,$.depth),X&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,Xe,Fe,$.data)):t.texImage3D(r.TEXTURE_3D,0,we,$.width,$.height,$.depth,0,Xe,Fe,$.data);else if(L.isFramebufferTexture){if(Gt)if(Je)t.texStorage2D(r.TEXTURE_2D,Te,we,$.width,$.height);else{let te=$.width,Me=$.height;for(let De=0;De<Te;De++)t.texImage2D(r.TEXTURE_2D,De,we,te,Me,0,Xe,Fe,null),te>>=1,Me>>=1}}else if(st.length>0&&it){if(Je&&Gt){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,Fe,Ie):t.texImage2D(r.TEXTURE_2D,te,we,Xe,Fe,Ie);L.generateMipmaps=!1}else if(Je){if(Gt){let te=ct($);t.texStorage2D(r.TEXTURE_2D,Te,we,te.width,te.height)}X&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Xe,Fe,$)}else t.texImage2D(r.TEXTURE_2D,0,we,Xe,Fe,$);y(L,it)&&x(le),et.__version=he.version,L.onUpdate&&L.onUpdate(L)}F.__version=L.version}function ve(F,L,ne){if(L.image.length!==6)return;let le=K(F,L),me=L.source;t.bindTexture(r.TEXTURE_CUBE_MAP,F.__webglTexture,r.TEXTURE0+ne);let he=i.get(me);if(me.version!==he.__version||le===!0){t.activeTexture(r.TEXTURE0+ne);let et=ti.getPrimaries(ti.workingColorSpace),Ke=L.colorSpace===Ch?null:ti.getPrimaries(L.colorSpace),Se=L.colorSpace===Ch||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,Fe=a.convert(L.format,L.colorSpace),we=a.convert(L.type),Ie=M(L.internalFormat,Fe,we,L.colorSpace),st=s&&L.isVideoTexture!==!0,Je=he.__version===void 0||le===!0,Gt=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 De=Te[Me];L.format!==nl?Fe!==null?st?Gt&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,De.width,De.height,Fe,De.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,De.width,De.height,0,De.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):st?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,0,0,De.width,De.height,Fe,we,De.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me,Ie,De.width,De.height,0,Fe,we,De.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?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,$[te].width,$[te].height,Fe,we,$[te].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,$[te].width,$[te].height,0,Fe,we,$[te].data);for(let Me=0;Me<Te.length;Me++){let St=Te[Me].image[te].image;st?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,St.width,St.height,Fe,we,St.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,St.width,St.height,0,Fe,we,St.data)}}else{st?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,0,0,Fe,we,$[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,0,Ie,Fe,we,$[te]);for(let Me=0;Me<Te.length;Me++){let De=Te[Me];st?Gt&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,0,0,Fe,we,De.image[te]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+te,Me+1,Ie,Fe,we,De.image[te])}}}y(L,Xe)&&x(r.TEXTURE_CUBE_MAP),he.__version=me.version,L.onUpdate&&L.onUpdate(L)}F.__version=L.version}function ue(F,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,F),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(F,L,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,F),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===ku?le=r.DEPTH_COMPONENT32F:me.type===Rh&&(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,F)}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,F)}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(F,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,F),!(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===Gd)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===Cy)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(F){let L=i.get(F),ne=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!L.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");Ee(L.__webglFramebuffer,F)}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],F,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer=r.createRenderbuffer(),se(L.__webglDepthbuffer,F,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function H(F,L,ne){let le=i.get(F);L!==void 0&&ue(le.__webglFramebuffer,F,F.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),ne!==void 0&&q(F)}function We(F){let L=F.texture,ne=i.get(F),le=i.get(L);F.addEventListener("dispose",C);let me=F.textures,he=F.isWebGLCubeRenderTarget===!0,et=me.length>1,Ke=v(F)||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&&F.samples>0&&Ue(F)===!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,F.isXRRenderTarget===!0),Xe=Le(F);r.renderbufferStorageMultisample(r.RENDERBUFFER,Xe,it,F.width,F.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Se,r.RENDERBUFFER,ne.__webglColorRenderbuffer[Se])}r.bindRenderbuffer(r.RENDERBUFFER,null),F.depthBuffer&&(ne.__webglDepthRenderbuffer=r.createRenderbuffer(),se(ne.__webglDepthRenderbuffer,F,!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],F,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Ae);else ue(ne.__webglFramebuffer[Se],F,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,F,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((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(s?Se=F.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],F,L,r.COLOR_ATTACHMENT0,Se,Ae);else ue(ne.__webglFramebuffer,F,L,r.COLOR_ATTACHMENT0,Se,0);y(L,Ke)&&x(Se),t.unbindTexture()}F.depthBuffer&&q(F)}function _e(F){let L=v(F)||s,ne=F.textures;for(let le=0,me=ne.length;le<me;le++){let he=ne[le];if(y(he,L)){let et=F.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ke=i.get(he).__webglTexture;t.bindTexture(et,Ke),x(et),t.unbindTexture()}}}function xe(F){if(s&&F.samples>0&&Ue(F)===!1){let L=F.textures,ne=F.width,le=F.height,me=r.COLOR_BUFFER_BIT,he=[],et=F.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ke=i.get(F),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),F.depthBuffer&&he.push(et);let nt=Ke.__ignoreDepthValues!==void 0?Ke.__ignoreDepthValues:!1;if(nt===!1&&(F.depthBuffer&&(me|=r.DEPTH_BUFFER_BIT),F.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(F){return Math.min(n.maxSamples,F.samples)}function Ue(F){let L=i.get(F);return s&&F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(F){let L=o.render.frame;f.get(F)!==L&&(f.set(F,L),F.update())}function Ve(F,L){let ne=F.colorSpace,le=F.format,me=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===eB||ne!==Vh&&ne!==Ch&&(ti.getTransfer(ne)===li?s===!1?e.has("EXT_sRGB")===!0&&le===nl?(F.format=eB,F.minFilter=lo,F.generateMipmaps=!1):L=nR.sRGBToLinear(L):(le!==nl||me!==Ph)&&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(F){return typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement?(c.width=F.naturalWidth||F.width,c.height=F.naturalHeight||F.height):typeof VideoFrame<"u"&&F instanceof VideoFrame?(c.width=F.displayWidth,c.height=F.displayHeight):(c.width=F.width,c.height=F.height),c}this.allocateTextureUnit=P,this.resetTextureUnits=A,this.setTexture2D=B,this.setTexture2DArray=z,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 mPe(r,e,t){let i=t.isWebGL2;function n(a,o=Ch){let s,l=ti.getTransfer(o);if(a===Ph)return r.UNSIGNED_BYTE;if(a===Cae)return r.UNSIGNED_SHORT_4_4_4_4;if(a===Rae)return r.UNSIGNED_SHORT_5_5_5_1;if(a===XAe)return r.BYTE;if(a===YAe)return r.SHORT;if(a===NB)return r.UNSIGNED_SHORT;if(a===Aae)return r.INT;if(a===Rh)return r.UNSIGNED_INT;if(a===ku)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===qAe)return r.ALPHA;if(a===nl)return r.RGBA;if(a===ZAe)return r.LUMINANCE;if(a===jAe)return r.LUMINANCE_ALPHA;if(a===Gd)return r.DEPTH_COMPONENT;if(a===Cy)return r.DEPTH_STENCIL;if(a===eB)return s=e.get("EXT_sRGB"),s!==null?s.SRGB_ALPHA_EXT:null;if(a===KAe)return r.RED;if(a===Lae)return r.RED_INTEGER;if(a===JAe)return r.RG;if(a===Dae)return r.RG_INTEGER;if(a===Pae)return r.RGBA_INTEGER;if(a===mF||a===vF||a===gF||a===yF)if(l===li)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(a===mF)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===vF)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===gF)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===yF)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(a===mF)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===vF)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===gF)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===yF)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===qie||a===Zie||a===jie||a===Kie)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(a===qie)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===Zie)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===jie)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===Kie)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===Iae)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===Jie||a===$ie)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(a===Jie)return l===li?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(a===$ie)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===Qie||a===ene||a===tne||a===rne||a===ine||a===nne||a===ane||a===one||a===sne||a===lne||a===une||a===cne||a===fne||a===hne)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(a===Qie)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===ene)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===tne)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===rne)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===ine)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===nne)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===ane)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===one)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===sne)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===lne)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===une)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===cne)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===fne)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===hne)return l===li?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===_F||a===pne||a===dne)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(a===_F)return l===li?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===pne)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===dne)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===$Ae||a===mne||a===vne||a===gne)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(a===_F)return s.COMPRESSED_RED_RGTC1_EXT;if(a===mne)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===vne)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===gne)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===Vd?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 dB=class extends Nn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},Yc=class extends ea{constructor(){super(),this.isGroup=!0,this.type="Group"}},vPe={type:"move"},fM=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Yc,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 Yc,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 Yc,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(vPe)))}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 Yc;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},gPe=`
  10237. void main() {
  10238. gl_Position = vec4( position, 1.0 );
  10239. }`,yPe=`
  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. }`,mB=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 ko,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 Vu({extensions:{fragDepth:!0},vertexShader:gPe,fragmentShader:yPe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new co(new hR(20,20),n)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}},vB=class extends Nh{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 mB,m=t.getContextAttributes(),v=null,_=null,y=[],x=[],M=new yr,S=null,w=new Nn;w.layers.enable(1),w.viewport=new Ir;let T=new Nn;T.layers.enable(2),T.viewport=new Ir;let C=[w,T],b=new dB;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 fM,y[V]=K),K.getTargetRaySpace()},this.getControllerGrip=function(V){let K=y[V];return K===void 0&&(K=new fM,y[V]=K),K.getGripSpace()},this.getHand=function(V){let K=y[V];return K===void 0&&(K=new fM,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",P);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 Eb(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",P),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 qc(p.framebufferWidth,p.framebufferHeight,{format:nl,type:Ph,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?Cy:Gd,ae=m.stencil?Vd:Rh);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 qc(h.textureWidth,h.textureHeight,{format:nl,type:Ph,depthTexture:new dR(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 P(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 z(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,F=q+Ne,L=Le-Ve,ne=Ue+(ve-Ve),le=H*q/F*ct,me=We*q/F*ct;V.projectionMatrix.makePerspective(L,ne,le,me,ct,F),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?z(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=Ry*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 Ir,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 Fae;Q.setAnimationLoop(J),this.setAnimationLoop=function(V){Y=V},this.dispose=function(){}}},Od=new zn,_Pe=new Xt;function xPe(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,zae(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===fo&&(m.bumpScale.value*=-1)),v.normalMap&&(m.normalMap.value=v.normalMap,t(v.normalMap,m.normalMapTransform),m.normalScale.value.copy(v.normalScale),v.side===fo&&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,Od.copy(x),Od.x*=-1,Od.y*=-1,Od.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Od.y*=-1,Od.z*=-1),m.envMapRotation.value.setFromMatrix4(_Pe.makeRotationFromEuler(Od)),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===fo&&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 SPe(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 P=0;P<R.length;P++){let U=R[P],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,P=R.length;A<P;A++){let U=R[A],B=g(U),z=x%M;z!==0&&M-z<B.boundary&&(x+=M-z),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 gB=class{constructor(e={}){let{canvas:t=wCe(),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=wa,this._useLegacyLights=!1,this.toneMapping=Dh,this.toneMappingExposure=1;let y=this,x=!1,M=0,S=0,w=null,T=-1,C=null,b=new Ir,E=new Ir,I=null,R=new rr(0),A=0,P=t.width,U=t.height,B=1,z=null,k=null,G=new Ir(0,0,P,U),Y=new Ir(0,0,P,U),J=!1,Q=new gM,V=!1,K=!1,ae=null,ve=new Xt,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],D=t.getContext(ie,j);if(D!==null)return D}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${IB}`),t.addEventListener("webglcontextlost",Gt,!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,F,L,ne,le,me,he,et,Ke,Se,Ae,nt,$,it,Xe,Fe,we,Ie;function st(){_e=new z2e(H),xe=new D2e(H,_e,e),_e.init(xe),Fe=new mPe(H,_e,xe),Le=new pPe(H,_e,xe),Ue=new k2e(H),Ne=new tPe,Ve=new dPe(H,_e,Le,Ne,xe,Fe,Ue),ct=new I2e(y),F=new O2e(y),L=new YCe(H,xe),we=new R2e(H,_e,L,xe),ne=new F2e(H,L,Ue,we),le=new W2e(H,ne,L,Ue),$=new H2e(H,xe,Ve),Se=new P2e(Ne),me=new ePe(y,ct,F,_e,xe,we,Se),he=new xPe(y,Ne),et=new iPe,Ke=new uPe(_e,xe),nt=new C2e(y,ct,F,Le,le,h,l),Ae=new hPe(y,le,xe),Ie=new SPe(H,Ue,xe,Le),it=new L2e(H,_e,Ue,xe),Xe=new B2e(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 vB(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(P,U,!1))},this.getSize=function(O){return O.set(P,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}P=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(P*B,U*B).floor()},this.setDrawingBufferSize=function(O,j,re){P=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){z=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 D=!1;if(w!==null){let W=w.texture.format;D=W===Pae||W===Dae||W===Lae}if(D){let W=w.texture.type,ee=W===Ph||W===Rh||W===NB||W===Vd||W===Cae||W===Rae,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",Gt,!1),t.removeEventListener("webglcontextrestored",X,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),et.dispose(),Ke.dispose(),Ne.dispose(),ct.dispose(),F.dispose(),le.dispose(),we.dispose(),Ie.dispose(),me.dispose(),Je.dispose(),Je.removeEventListener("sessionstart",$r),Je.removeEventListener("sessionend",Ht),ae&&(ae.dispose(),ae=null),Nr.stop()};function Gt(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,D=Ae.type;st(),Ue.autoReset=O,Ae.enabled=j,Ae.autoUpdate=re,Ae.needsUpdate=ie,Ae.type=D}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){De(O),Ne.remove(O)}function De(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,D,W){j===null&&(j=Ee);let ee=D.isMesh&&D.matrixWorld.determinant()<0,ge=L0(O,j,re,ie,D);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(D,ie,ge,re,ce);let at,Tt=it;if(ce!==null&&(at=L.get(ce),Tt=Xe,Tt.setIndex(at)),D.isMesh)ie.wireframe===!0?(Le.setLineWidth(ie.wireframeLinewidth*q()),Tt.setMode(H.LINES)):Tt.setMode(H.TRIANGLES);else if(D.isLine){let je=ie.linewidth;je===void 0&&(je=1),Le.setLineWidth(je*q()),D.isLineSegments?Tt.setMode(H.LINES):D.isLineLoop?Tt.setMode(H.LINE_LOOP):Tt.setMode(H.LINE_STRIP)}else D.isPoints?Tt.setMode(H.POINTS):D.isSprite&&Tt.setMode(H.TRIANGLES);if(D.isBatchedMesh)Tt.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else if(D.isInstancedMesh)Tt.renderInstances(pt,$e,D.count);else if(re.isInstancedBufferGeometry){let je=re._maxInstanceCount!==void 0?re._maxInstanceCount:1/0,vi=Math.min(re.instanceCount,je);Tt.renderInstances(pt,$e,vi)}else Tt.render(pt,$e)};function St(O,j,re){O.transparent===!0&&O.side===Wc&&O.forceSinglePass===!1?(O.side=fo,O.needsUpdate=!0,qo(O,j,re),O.side=Ih,O.needsUpdate=!0,qo(O,j,re),O.side=Wc):qo(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(D){D.isLight&&D.layers.test(j.layers)&&(m.pushLight(D),D.castShadow&&m.pushShadow(D))}),O!==re&&O.traverseVisible(function(D){D.isLight&&D.layers.test(j.layers)&&(m.pushLight(D),D.castShadow&&m.pushShadow(D))}),m.setupLights(y._useLegacyLights);let ie=new Set;return O.traverse(function(D){let W=D.material;if(W)if(Array.isArray(W))for(let ee=0;ee<W.length;ee++){let ge=W[ee];St(ge,re,D),ie.add(ge)}else St(W,re,D),ie.add(W)}),_.pop(),m=null,ie},this.compileAsync=function(O,j,re=null){let ie=this.compile(O,j,re);return new Promise(D=>{function W(){if(ie.forEach(function(ee){Ne.get(ee).currentProgram.isReady()&&ie.delete(ee)}),ie.size===0){D(O);return}setTimeout(W,10)}_e.get("KHR_parallel_shader_compile")!==null?W():setTimeout(W,10)})};let kt=null;function br(O){kt&&kt(O)}function $r(){Nr.stop()}function Ht(){Nr.start()}let Nr=new Fae;Nr.setAnimationLoop(br),typeof self<"u"&&Nr.setContext(self),this.setAnimationLoop=function(O){kt=O,Je.setAnimationLoop(O),O===null?Nr.stop():Nr.start()},Je.addEventListener("sessionstart",$r),Je.addEventListener("sessionend",Ht),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),ci(O,j,0,y.sortObjects),g.finish(),y.sortObjects===!0&&g.sort(z,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 D=0,W=ie.length;D<W;D++){let ee=ie[D];Kh(g,O,ee,ee.viewport)}}else Kh(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 ci(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++)ci(W[ee],j,re,ie)}function Kh(O,j,re,ie){let D=O.opaque,W=O.transmissive,ee=O.transparent;m.setupLightsView(re),V===!0&&Se.setGlobalState(y.clippingPlanes,re),W.length>0&&R0(D,W,j,re),ie&&Le.viewport(b.copy(ie)),D.length>0&&dl(D,j,re),W.length>0&&dl(W,j,re),ee.length>0&&dl(ee,j,re),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function R0(O,j,re,ie){if((re.isScene===!0?re.overrideMaterial:null)!==null)return;let W=xe.isWebGL2;ae===null&&(ae=new qc(1,1,{generateMipmaps:!0,type:_e.has("EXT_color_buffer_half_float")?pM:Ph,minFilter:kd,samples:W?4:0})),y.getDrawingBufferSize(ue),W?ae.setSize(ue.x,ue.y):ae.setSize(iR(ue.x),iR(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=Dh,dl(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===Wc&&pt.layers.test(ie.layers)){let Tt=$e.side;$e.side=fo,$e.needsUpdate=!0,Jh(pt,re,ie,mt,$e,at),$e.side=Tt,$e.needsUpdate=!0,ce=!0}}ce===!0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),y.setRenderTarget(ee),y.setClearColor(R,A),y.toneMapping=ge}function dl(O,j,re){let ie=j.isScene===!0?j.overrideMaterial:null;for(let D=0,W=O.length;D<W;D++){let ee=O[D],ge=ee.object,ce=ee.geometry,Oe=ie===null?ee.material:ie,Ge=ee.group;ge.layers.test(re.layers)&&Jh(ge,j,re,ce,Oe,Ge)}}function Jh(O,j,re,ie,D,W){O.onBeforeRender(y,j,re,ie,D,W),O.modelViewMatrix.multiplyMatrices(re.matrixWorldInverse,O.matrixWorld),O.normalMatrix.getNormalMatrix(O.modelViewMatrix),D.onBeforeRender(y,j,re,ie,O,W),D.transparent===!0&&D.side===Wc&&D.forceSinglePass===!1?(D.side=fo,D.needsUpdate=!0,y.renderBufferDirect(re,j,ie,D,O,W),D.side=Ih,D.needsUpdate=!0,y.renderBufferDirect(re,j,ie,D,O,W),D.side=Wc):y.renderBufferDirect(re,j,ie,D,O,W),O.onAfterRender(y,j,re,ie,D,W)}function qo(O,j,re){j.isScene!==!0&&(j=Ee);let ie=Ne.get(O),D=m.state.lights,W=m.state.shadowsArray,ee=D.state.version,ge=me.getParameters(O,D.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?F: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 nf(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),nf(O,ge),ie.needsLights=P0(O),ie.lightsStateVersion=ee,ie.needsLights&&(Re.ambientLightColor.value=D.state.ambient,Re.lightProbe.value=D.state.probe,Re.directionalLights.value=D.state.directional,Re.directionalLightShadows.value=D.state.directionalShadow,Re.spotLights.value=D.state.spot,Re.spotLightShadows.value=D.state.spotShadow,Re.rectAreaLights.value=D.state.rectArea,Re.ltc_1.value=D.state.rectAreaLTC1,Re.ltc_2.value=D.state.rectAreaLTC2,Re.pointLights.value=D.state.point,Re.pointLightShadows.value=D.state.pointShadow,Re.hemisphereLights.value=D.state.hemi,Re.directionalShadowMap.value=D.state.directionalShadowMap,Re.directionalShadowMatrix.value=D.state.directionalShadowMatrix,Re.spotShadowMap.value=D.state.spotShadowMap,Re.spotLightMatrix.value=D.state.spotLightMatrix,Re.spotLightMap.value=D.state.spotLightMap,Re.pointShadowMap.value=D.state.pointShadowMap,Re.pointShadowMatrix.value=D.state.pointShadowMatrix),ie.currentProgram=Ge,ie.uniformsList=null,Ge}function $h(O){if(O.uniformsList===null){let j=O.currentProgram.getUniforms();O.uniformsList=wy.seqWithValue(j.seq,O.uniforms)}return O.uniformsList}function nf(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 L0(O,j,re,ie,D){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:Vh,ce=(ie.isMeshStandardMaterial?F: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=Dh;ie.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&($e=y.toneMapping);let at=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Tt=at!==void 0?at.length:0,je=Ne.get(ie),vi=m.state.lights;if(V===!0&&(K===!0||O!==C)){let Qr=O===C&&ie.id===T;Se.setState(ie,O,Qr)}let Ft=!1;ie.version===je.__version?(je.needsLights&&je.lightsStateVersion!==vi.state.version||je.outputColorSpace!==ge||D.isBatchedMesh&&je.batching===!1||!D.isBatchedMesh&&je.batching===!0||D.isInstancedMesh&&je.instancing===!1||!D.isInstancedMesh&&je.instancing===!0||D.isSkinnedMesh&&je.skinning===!1||!D.isSkinnedMesh&&je.skinning===!0||D.isInstancedMesh&&je.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&je.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&je.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&je.instancingMorph===!1&&D.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!==Tt)&&(Ft=!0):(Ft=!0,je.__version=ie.version);let Lr=je.currentProgram;Ft===!0&&(Lr=qo(ie,j,D));let Yi=!1,bt=!1,wi=!1,lr=Lr.getUniforms(),fn=je.uniforms;if(Le.useProgram(Lr.program)&&(Yi=!0,bt=!0,wi=!0),ie.id!==T&&(T=ie.id,bt=!0),Yi||C!==O){lr.setValue(H,"projectionMatrix",O.projectionMatrix),lr.setValue(H,"viewMatrix",O.matrixWorldInverse);let Qr=lr.map.cameraPosition;Qr!==void 0&&Qr.setValue(H,se.setFromMatrixPosition(O.matrixWorld)),xe.logarithmicDepthBuffer&&lr.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&lr.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),C!==O&&(C=O,bt=!0,wi=!0)}if(D.isSkinnedMesh){lr.setOptional(H,D,"bindMatrix"),lr.setOptional(H,D,"bindMatrixInverse");let Qr=D.skeleton;Qr&&(xe.floatVertexTextures?(Qr.boneTexture===null&&Qr.computeBoneTexture(),lr.setValue(H,"boneTexture",Qr.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."))}D.isBatchedMesh&&(lr.setOptional(H,D,"batchingTexture"),lr.setValue(H,"batchingTexture",D._matricesTexture,Ve));let qu=re.morphAttributes;if((qu.position!==void 0||qu.normal!==void 0||qu.color!==void 0&&xe.isWebGL2===!0)&&$.update(D,re,Lr),(bt||je.receiveShadow!==D.receiveShadow)&&(je.receiveShadow=D.receiveShadow,lr.setValue(H,"receiveShadow",D.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(fn.envMap.value=ce,fn.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),bt&&(lr.setValue(H,"toneMappingExposure",y.toneMappingExposure),je.needsLights&&D0(fn,wi),W&&ie.fog===!0&&he.refreshFogUniforms(fn,W),he.refreshMaterialUniforms(fn,ie,B,U,ae),wy.upload(H,$h(je),fn,Ve)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(wy.upload(H,$h(je),fn,Ve),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&lr.setValue(H,"center",D.center),lr.setValue(H,"modelViewMatrix",D.modelViewMatrix),lr.setValue(H,"normalMatrix",D.normalMatrix),lr.setValue(H,"modelMatrix",D.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){let Qr=ie.uniformsGroups;for(let Zu=0,Qh=Qr.length;Zu<Qh;Zu++)if(xe.isWebGL2){let ep=Qr[Zu];Ie.update(ep,Lr),Ie.bind(ep,Lr)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Lr}function D0(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 P0(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,D=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])?D=Ge[j][re]:D=Ge[j],W=!0):xe.isWebGL2&&O.samples>0&&Ve.useMultisampledRTT(O)===!1?D=Ne.get(O).__webglMultisampledFramebuffer:Array.isArray(Ge)?D=Ge[re]:D=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,D)&&xe.drawBuffers&&ie&&Le.drawBuffers(O,D),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,D,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!==nl&&Fe.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!==Ph&&Fe.convert(Ge)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===ku&&(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-D&&H.readPixels(j,re,ie,D,Fe.convert(Oe),Fe.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),D=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,D,W),Le.unbindTexture()},this.copyTextureToTexture=function(O,j,re,ie=0){let D=j.image.width,W=j.image.height,ee=Fe.convert(re.format),ge=Fe.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,D,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,D=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=Fe.convert(ie.format),Oe=Fe.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),Tt=re.isCompressedTexture?re.mipmaps[D]:re.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,Tt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Tt.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,D,j.x,j.y,j.z,W,ee,ge,ce,Oe,Tt.data):ie.isCompressedArrayTexture?H.compressedTexSubImage3D(Ge,D,j.x,j.y,j.z,W,ee,ge,ce,Tt.data):H.texSubImage3D(Ge,D,j.x,j.y,j.z,W,ee,ge,ce,Oe,Tt),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),D===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 Xc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===OB?"display-p3":"srgb",t.unpackColorSpace=ti.workingColorSpace===PR?"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}},yB=class extends gB{};yB.prototype.isWebGL1Renderer=!0;var cae=new ye,fae=new Ir,hae=new Ir,MPe=new ye,pae=new Xt,XC=new ye,XF=new Oh,dae=new Xt,YF=new mM,mR=class extends co{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Wie,this.bindMatrix=new Xt,this.bindMatrixInverse=new Xt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Uh),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,XC),this.boundingBox.expandByPoint(XC)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Oh),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,XC),this.boundingSphere.expandByPoint(XC)}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(),XF.copy(this.boundingSphere),XF.applyMatrix4(n),e.ray.intersectsSphere(XF)!==!1&&(dae.copy(n).invert(),YF.copy(e.ray).applyMatrix4(dae),!(this.boundingBox!==null&&YF.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,YF)))}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 Ir,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===Wie?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===WAe?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let i=this.skeleton,n=this.geometry;fae.fromBufferAttribute(n.attributes.skinIndex,e),hae.fromBufferAttribute(n.attributes.skinWeight,e),cae.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let a=0;a<4;a++){let o=hae.getComponent(a);if(o!==0){let s=fae.getComponent(a);pae.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(MPe.copy(cae).applyMatrix4(pae),o)}}return t.applyMatrix4(this.bindMatrixInverse)}},Iy=class extends ea{constructor(){super(),this.isBone=!0,this.type="Bone"}},_B=class extends ko{constructor(e=null,t=1,i=1,n,a,o,s,l,u=Pn,c=Pn,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}},mae=new Xt,bPe=new Xt,vR=class r{constructor(e=[],t=[]){this.uuid=Gh(),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 Xt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let i=new Xt;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:bPe;mae.multiplyMatrices(s,t[a]),mae.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 _B(t,e,e,nl,ku);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 Iy),this.bones.push(o),this.boneInverses.push(new Xt().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 yM=class extends Zc{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new rr(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}},vae=new ye,gae=new ye,yae=new Xt,qF=new mM,YC=new Oh,gR=class extends ea{constructor(e=new ol,t=new yM){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++)vae.fromBufferAttribute(t,n-1),gae.fromBufferAttribute(t,n),i[n]=i[n-1],i[n]+=vae.distanceTo(gae);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(),YC.copy(i.boundingSphere),YC.applyMatrix4(n),YC.radius+=a,e.ray.intersectsSphere(YC)===!1)return;yae.copy(n).invert(),qF.copy(e.ray).applyMatrix4(yae);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),qF.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),qF.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 yR=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 Xt;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 wPe={triangulate:function(r,e,t=2){let i=e&&e.length,n=i?e[0]*t:r.length,a=Wae(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=RPe(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 _M(a,o,t,s,l,p,0),o}};function Wae(r,e,t,i,n){let a,o;if(n===kPe(r,e,t,i)>0)for(a=e;a<t;a+=i)o=_ae(a,r[a],r[a+1],o);else for(a=t-i;a>=e;a-=i)o=_ae(a,r[a],r[a+1],o);return o&&NR(o,o.next)&&(SM(o),o=o.next),o}function Hd(r,e){if(!r)return r;e||(e=r);let t=r,i;do if(i=!1,!t.steiner&&(NR(t,t.next)||Mi(t.prev,t,t.next)===0)){if(SM(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function _M(r,e,t,i,n,a,o){if(!r)return;!o&&a&&NPe(r,i,n,a);let s=r,l,u;for(;r.prev!==r.next;){if(l=r.prev,u=r.next,a?EPe(r,i,n,a):TPe(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),SM(r),r=u.next,s=u.next;continue}if(r=u,r===s){o?o===1?(r=APe(Hd(r),e,t),_M(r,e,t,i,n,a,2)):o===2&&CPe(r,e,t,i,n,a):_M(Hd(r),e,t,i,n,a,1);break}}}function TPe(r){let e=r.prev,t=r,i=r.next;if(Mi(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&&Sy(n,s,a,l,o,u,d.x,d.y)&&Mi(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function EPe(r,e,t,i){let n=r.prev,a=r,o=r.next;if(Mi(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=xB(p,d,e,t,i),_=xB(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&&Sy(s,c,l,f,u,h,y.x,y.y)&&Mi(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&&Sy(s,c,l,f,u,h,x.x,x.y)&&Mi(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&&Sy(s,c,l,f,u,h,y.x,y.y)&&Mi(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&&Sy(s,c,l,f,u,h,x.x,x.y)&&Mi(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function APe(r,e,t){let i=r;do{let n=i.prev,a=i.next.next;!NR(n,a)&&Xae(n,i,i.next,a)&&xM(n,a)&&xM(a,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(a.i/t|0),SM(i),SM(i.next),i=r=a),i=i.next}while(i!==r);return Hd(i)}function CPe(r,e,t,i,n,a){let o=r;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&zPe(o,s)){let l=Yae(o,s);o=Hd(o,o.next),l=Hd(l,l.next),_M(o,e,t,i,n,a,0),_M(l,e,t,i,n,a,0);return}s=s.next}o=o.next}while(o!==r)}function RPe(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=Wae(r,s,l,i,!1),u===u.next&&(u.steiner=!0),n.push(OPe(u));for(n.sort(LPe),a=0;a<n.length;a++)t=DPe(n[a],t);return t}function LPe(r,e){return r.x-e.x}function DPe(r,e){let t=PPe(r,e);if(!t)return e;let i=Yae(t,r);return Hd(i,i.next),Hd(t,t.next)}function PPe(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&&Sy(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),xM(t,r)&&(f<c||f===c&&(t.x>n.x||t.x===n.x&&IPe(n,t)))&&(n=t,c=f)),t=t.next;while(t!==s);return n}function IPe(r,e){return Mi(r.prev,r,e.prev)<0&&Mi(e.next,r,r.next)<0}function NPe(r,e,t,i){let n=r;do n.z===0&&(n.z=xB(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,UPe(n)}function UPe(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 xB(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 OPe(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 Sy(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 zPe(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!FPe(r,e)&&(xM(r,e)&&xM(e,r)&&BPe(r,e)&&(Mi(r.prev,r,e.prev)||Mi(r,e.prev,e))||NR(r,e)&&Mi(r.prev,r,r.next)>0&&Mi(e.prev,e,e.next)>0)}function Mi(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function NR(r,e){return r.x===e.x&&r.y===e.y}function Xae(r,e,t,i){let n=ZC(Mi(r,e,t)),a=ZC(Mi(r,e,i)),o=ZC(Mi(t,i,r)),s=ZC(Mi(t,i,e));return!!(n!==a&&o!==s||n===0&&qC(r,t,e)||a===0&&qC(r,i,e)||o===0&&qC(t,r,i)||s===0&&qC(t,e,i))}function qC(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 ZC(r){return r>0?1:r<0?-1:0}function FPe(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&&Xae(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function xM(r,e){return Mi(r.prev,r,r.next)<0?Mi(r,e,r.next)>=0&&Mi(r,r.prev,e)>=0:Mi(r,e,r.prev)<0||Mi(r,r.next,e)<0}function BPe(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 Yae(r,e){let t=new SB(r.i,r.x,r.y),i=new SB(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 _ae(r,e,t,i){let n=new SB(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 SM(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 SB(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 kPe(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 _R=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=[];xae(e),Sae(i,e);let o=e.length;t.forEach(xae);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,Sae(i,t[l]);let s=wPe.triangulate(i,n);for(let l=0;l<s.length;l+=3)a.push(s.slice(l,l+3));return a}};function xae(r){let e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Sae(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}var Ny=class extends Zc{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new rr(16777215),this.specular=new rr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=UB,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 zn,this.combine=LR,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 xR=class extends Zc{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new rr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=UB,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 zn,this.combine=LR,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 jC(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 VPe(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function GPe(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 Mae(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 qae(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 Uy=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_(){}},MB=class extends Uy{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:yne,endingEnd:yne}}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 _ne:a=e,s=2*t-i;break;case xne: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 _ne:o=e,l=2*i-t;break;case xne: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}},bB=class extends Uy{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}},wB=class extends Uy{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}},sl=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=jC(t,this.TimeBufferType),this.values=jC(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:jC(e.times,Array),values:jC(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(i.interpolation=n)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new wB(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new bB(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new MB(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case JC:t=this.InterpolantFactoryMethodDiscrete;break;case $C:t=this.InterpolantFactoryMethodLinear;break;case xF: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 JC;case this.InterpolantFactoryMethodLinear:return $C;case this.InterpolantFactoryMethodSmooth:return xF}}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&&VPe(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()===xF,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}};sl.prototype.TimeBufferType=Float32Array;sl.prototype.ValueBufferType=Float32Array;sl.prototype.DefaultInterpolation=$C;var zh=class extends sl{};zh.prototype.ValueTypeName="bool";zh.prototype.ValueBufferType=Array;zh.prototype.DefaultInterpolation=JC;zh.prototype.InterpolantFactoryMethodLinear=void 0;zh.prototype.InterpolantFactoryMethodSmooth=void 0;var SR=class extends sl{};SR.prototype.ValueTypeName="color";var Fh=class extends sl{};Fh.prototype.ValueTypeName="number";var TB=class extends Uy{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}},Gu=class extends sl{InterpolantFactoryMethodLinear(e){return new TB(this.times,this.values,this.getValueSize(),e)}};Gu.prototype.ValueTypeName="quaternion";Gu.prototype.DefaultInterpolation=$C;Gu.prototype.InterpolantFactoryMethodSmooth=void 0;var Bh=class extends sl{};Bh.prototype.ValueTypeName="string";Bh.prototype.ValueBufferType=Array;Bh.prototype.DefaultInterpolation=JC;Bh.prototype.InterpolantFactoryMethodLinear=void 0;Bh.prototype.InterpolantFactoryMethodSmooth=void 0;var kh=class extends sl{};kh.prototype.ValueTypeName="vector";var MR=class{constructor(e,t=-1,i,n=QAe){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=Gh(),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(WPe(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(sl.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=GPe(l);l=Mae(l,1,c),u=Mae(u,1,c),!n&&l[0]===0&&(l.push(a),u.push(u[0])),o.push(new Fh(".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=[];qae(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 Fh(".morphTargetInfluence["+g+"]",m,v))}l=p.length*o}else{let p=".bones["+t[f].name+"]";i(kh,p+".position",h,"pos",n),i(Gu,p+".quaternion",h,"rot",n),i(kh,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 HPe(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Fh;case"vector":case"vector2":case"vector3":case"vector4":return kh;case"color":return SR;case"quaternion":return Gu;case"bool":case"boolean":return zh;case"string":return Bh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function WPe(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=HPe(r.type);if(r.times===void 0){let t=[],i=[];qae(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 bR={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={}}},EB=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}}},XPe=new EB,Wd=(()=>{class r{constructor(t){this.manager=t!==void 0?t:XPe,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})(),Vc={},AB=class extends Error{constructor(e,t){super(e),this.response=t}},wR=class extends Wd{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=bR.get(e);if(a!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0),a;if(Vc[e]!==void 0){Vc[e].push({onLoad:t,onProgress:i,onError:n});return}Vc[e]=[],Vc[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=Vc[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 AB(`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=>{bR.add(e,u);let c=Vc[e];delete Vc[e];for(let f=0,h=c.length;f<h;f++){let p=c[f];p.onLoad&&p.onLoad(u)}}).catch(u=>{let c=Vc[e];if(c===void 0)throw this.manager.itemError(e),u;delete Vc[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 CB=class extends Wd{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=bR.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(),bR.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 TR=class extends Wd{constructor(e){super(e)}load(e,t,i,n){let a=new ko,o=new CB(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}},Oy=class extends ea{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new rr(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 ZF=new Xt,bae=new ye,wae=new ye,MM=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 Xt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new gM,this._frameExtents=new yr(1,1),this._viewportCount=1,this._viewports=[new Ir(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;bae.setFromMatrixPosition(e.matrixWorld),t.position.copy(bae),wae.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(wae),t.updateMatrixWorld(),ZF.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ZF),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ZF)}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}},RB=class extends MM{constructor(){super(new Nn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=Ry*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}},ER=class extends Oy{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(ea.DEFAULT_UP),this.updateMatrix(),this.target=new ea,this.distance=i,this.angle=n,this.penumbra=a,this.decay=o,this.map=null,this.shadow=new RB}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}},Tae=new Xt,lM=new ye,jF=new ye,LB=class extends MM{constructor(){super(new Nn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new yr(4,2),this._viewportCount=6,this._viewports=[new Ir(2,1,1,1),new Ir(0,1,1,1),new Ir(3,1,1,1),new Ir(1,1,1,1),new Ir(3,0,1,1),new Ir(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()),lM.setFromMatrixPosition(e.matrixWorld),i.position.copy(lM),jF.copy(i.position),jF.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(jF),i.updateMatrixWorld(),n.makeTranslation(-lM.x,-lM.y,-lM.z),Tae.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Tae)}},bM=class extends Oy{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 LB}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}},DB=class extends MM{constructor(){super(new Py(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},AR=class extends Oy{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ea.DEFAULT_UP),this.updateMatrix(),this.target=new ea,this.shadow=new DB}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},CR=class extends Oy{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var RR=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 BB="\\[\\]\\.:\\/",YPe=new RegExp("["+BB+"]","g"),kB="[^"+BB+"]",qPe="[^"+BB.replace("\\.","")+"]",ZPe=/((?:WC+[\/:])*)/.source.replace("WC",kB),jPe=/(WCOD+)?/.source.replace("WCOD",qPe),KPe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",kB),JPe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",kB),$Pe=new RegExp("^"+ZPe+jPe+KPe+JPe+"$"),QPe=["material","materials","bones","map"],PB=class{constructor(e,t,i){let n=i||oi.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()}},oi=(()=>{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(YPe,"")}static parseTrackName(t){let i=$Pe.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);QPe.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=PB,r})();oi.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};oi.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};oi.prototype.GetterByBindingType=[oi.prototype._getValue_direct,oi.prototype._getValue_array,oi.prototype._getValue_arrayElement,oi.prototype._getValue_toArray];oi.prototype.SetterByBindingTypeAndVersioning=[[oi.prototype._setValue_direct,oi.prototype._setValue_direct_setNeedsUpdate,oi.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[oi.prototype._setValue_array,oi.prototype._setValue_array_setNeedsUpdate,oi.prototype._setValue_array_setMatrixWorldNeedsUpdate],[oi.prototype._setValue_arrayElement,oi.prototype._setValue_arrayElement_setNeedsUpdate,oi.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[oi.prototype._setValue_fromArray,oi.prototype._setValue_fromArray_setNeedsUpdate,oi.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var GDt=new Float32Array(1);typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:IB}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=IB);var Zae=function(r){return URL.createObjectURL(new Blob([r],{type:"text/javascript"}))},eIe=function(r){return new Worker(r)};try{URL.revokeObjectURL(Zae(""))}catch{Zae=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},eIe=function(e){return new Worker(e,{type:"module"})}}var ll=Uint8Array,Hh=Uint16Array,HB=Uint32Array,jae=new ll([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]),Kae=new ll([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]),tIe=new ll([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jae=function(r,e){for(var t=new Hh(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];for(var n=new HB(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]},$ae=Jae(jae,2),Qae=$ae[0],rIe=$ae[1];Qae[28]=258,rIe[258]=28;var eoe=Jae(Kae,0),iIe=eoe[0],XDt=eoe[1],WB=new Hh(32768);for(Vr=0;Vr<32768;++Vr)jc=(Vr&43690)>>>1|(Vr&21845)<<1,jc=(jc&52428)>>>2|(jc&13107)<<2,jc=(jc&61680)>>>4|(jc&3855)<<4,WB[Vr]=((jc&65280)>>>8|(jc&255)<<8)>>>1;var jc,Vr,wM=function(r,e,t){for(var i=r.length,n=0,a=new Hh(e);n<i;++n)++a[r[n]-1];var o=new Hh(e);for(n=0;n<e;++n)o[n]=o[n-1]+a[n-1]<<1;var s;if(t){s=new Hh(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[WB[f]>>>l]=u}else for(s=new Hh(i),n=0;n<i;++n)r[n]&&(s[n]=WB[o[r[n]-1]++]>>>15-r[n]);return s},TM=new ll(288);for(Vr=0;Vr<144;++Vr)TM[Vr]=8;var Vr;for(Vr=144;Vr<256;++Vr)TM[Vr]=9;var Vr;for(Vr=256;Vr<280;++Vr)TM[Vr]=7;var Vr;for(Vr=280;Vr<288;++Vr)TM[Vr]=8;var Vr,toe=new ll(32);for(Vr=0;Vr<32;++Vr)toe[Vr]=5;var Vr;var nIe=wM(TM,9,1);var aIe=wM(toe,5,1),VB=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},GB=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},oIe=function(r){return(r/8|0)+(r&7&&1)},sIe=function(r,e,t){(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Hh?Hh:r instanceof HB?HB:ll)(t-e);return i.set(r.subarray(e,t)),i},lIe=function(r,e,t){var i=r.length;if(!i||t&&!t.l&&i<5)return e||new ll(0);var n=!e||t,a=!t||t.i;t||(t={}),e||(e=new ll(i*3));var o=function(ae){var ve=e.length;if(ae>ve){var ue=new ll(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=nIe,f=aIe,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 ll(M),w=new ll(19),T=0;T<x;++T)w[tIe[T]]=$l(r,l+T*3,7);l+=x*3;for(var C=VB(w),b=(1<<C)-1,E=wM(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 P=S.subarray(0,y),U=S.subarray(y);h=VB(P),p=VB(U),c=wM(P,h,1),f=wM(U,p,1)}else throw"invalid block type";else{var m=oIe(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,z=(1<<p)-1,k=l;;k=l){var R=c[GB(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=jae[T];Y=$l(r,l,(1<<J)-1)+Qae[T],l+=J}var Q=f[GB(r,l)&z],V=Q>>>4;if(!Q)throw"invalid distance";l+=Q&15;var U=iIe[V];if(V>3){var J=Kae[V];U+=GB(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:sIe(e,0,u)};var uIe=new ll(0);var cIe=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 roe(r,e){return lIe((cIe(r),r.subarray(2,-4)),e)}var fIe=typeof TextDecoder<"u"&&new TextDecoder,hIe=0;try{fIe.decode(uIe,{stream:!0}),hIe=1}catch{}function ioe(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 dIe(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 noe(r,e,t,i){let n=ioe(r,i,e),a=dIe(n,i,r,e),o=new Ir(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 mIe(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 vIe(r,e,t,i,n){let a=n<r?n:r,o=[],s=ioe(r,i,e),l=mIe(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 Ir(0,0,0);return o}function gIe(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 yIe(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(gIe(a,s)*i[s]));n[a]=o.divideScalar(i[0])}return n}function aoe(r,e,t,i,n){let a=vIe(r,e,t,i,n);return yIe(a)}var UR=class extends yR{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 Ir(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=noe(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=aoe(this.degree,this.knots,this.controlPoints,n,1);return i.copy(a[1]).normalize(),i}};var _r,zi,Ta,zR=class extends Wd{constructor(e){super(e)}load(e,t,i,n){let a=this,o=a.path===""?RR.extractUrlBase(e):a.path,s=new wR(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(xIe(e))_r=new JB().parse(e);else{let n=uoe(e);if(!SIe(n))throw new Error("THREE.FBXLoader: Unknown format.");if(ooe(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+ooe(n));_r=new KB().parse(n)}let i=new TR(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new qB(i,this.manager).parse(_r)}},qB=class{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){zi=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),n=this.parseDeformers(),a=new ZB().parse(n);return this.parseScene(n,a,i),Ta}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?Ay:uo,i.wrapT=s===0?Ay:uo,"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=zi.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 ko):(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 ko):(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 ko):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),!zi.has(i))return null;let o=this.parseParameters(e,t,i),s;switch(a.toLowerCase()){case"phong":s=new Ny;break;case"lambert":s=new xR;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),s=new Ny;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 rr().fromArray(e.Diffuse.value).convertSRGBToLinear():e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=new rr().fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=new rr().fromArray(e.Emissive.value).convertSRGBToLinear():e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=new rr().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 rr().fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=new rr().fromArray(e.SpecularColor.value).convertSRGBToLinear());let a=this;return zi.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=wa);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=wa);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=hM,n.envMap.colorSpace=wa);break;case"SpecularColor":n.specularMap=a.getTexture(t,o.ID),n.specularMap!==void 0&&(n.specularMap.colorSpace=wa);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=zi.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=zi.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 Xt().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=zi.get(parseInt(a.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,i.push(s)}return i}parseScene(e,t,i){Ta=new Yc;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),zi.get(l.ID).parents.forEach(function(f){let h=n.get(f.ID);h!==void 0&&h.add(l)}),l.parent===null&&Ta.add(l)}),this.bindSkeleton(e.skeletons,t,n),this.addGlobalSceneSettings(),Ta.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=soe(l.userData.transformData);l.applyMatrix4(u),l.updateWorldMatrix()}});let s=new jB().parse();Ta.children.length===1&&Ta.children[0].isGroup&&(Ta.children[0].animations=s,Ta=Ta.children[0]),Ta.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=zi.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 Iy;break;case"Null":default:c=new Yc;break}c.name=l.attrName?oi.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 Iy,a.matrixWorld.copy(u.transformLink),a.name=n?oi.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 ea;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 Py(-s/2,s/2,l/2,-l/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new ea;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 ea;else{let n;i.LightType===void 0?n=0:n=i.LightType.value;let a=16777215;i.Color!==void 0&&(a=new rr().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 bM(a,o,s,l);break;case 1:t=new AR(a,o);break;case 2:let u=Math.PI/3;i.InnerAngle!==void 0&&(u=ta.degToRad(i.InnerAngle.value));let c=0;i.OuterAngle!==void 0&&(c=ta.degToRad(i.OuterAngle.value),c=Math.max(c,1)),t=new ER(a,o,s,u,c,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new bM(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 Ny({name:Wd.DEFAULT_MATERIAL_NAME,color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach(function(l){l.vertexColors=!0}),a.FBX_Deformer?(n=new mR(a,o),n.normalizeSkinWeights()):n=new co(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 yM({name:Wd.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new gR(i,n)}getTransformData(e,t){let i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=loe(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&&zi.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),Ta.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];zi.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){let u=l.ID;zi.get(u).parents.forEach(function(f){i.has(f.ID)&&i.get(f.ID).bind(new vR(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 Xt().fromArray(a.Matrix.a)}):e[n.Node]=new Xt().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 rr(t,i,n).convertSRGBToLinear();Ta.add(new CR(a,1))}}"UnitScaleFactor"in _r.GlobalSettings&&(Ta.userData.unitScaleFactor=_r.GlobalSettings.UnitScaleFactor.value)}}},ZB=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=zi.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=loe(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=soe(u);return this.genGeometry(t,s,a,c)}genGeometry(e,t,i,n){let a=new ol;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 Ly(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=OR(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=OR(d,i,p,e.normal);s.push(y[0],y[1],y[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=OR(d,i,p,e.material)[0],g<0&&(h.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(y,x){let M=OR(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=_R.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 rr;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 ol;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 Ir().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 UR(i,n,a,s,l).getPoints(a.length*12);return new ol().setFromPoints(c)}},jB=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(MIe),values:t[i].KeyValueFloat.a},a=zi.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=zi.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=zi.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?oi.sanitizeNodeName(h.attrName):"",ID:h.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Ta.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 Xt),"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=zi.get(l.ID).parents.filter(function(v){return v.relationship!==void 0})[0].ID,h=zi.get(f).parents[0].ID,p=zi.get(h).parents[0].ID,d=zi.get(p).parents[0].ID,g=_r.Objects.Model[d],m={modelName:g.attrName?oi.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=zi.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 MR(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 kh(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(ta.degToRad),i.push(a),i=new zn().fromArray(i),i=new On().setFromEuler(i)),n!==void 0&&(n=n.map(ta.degToRad),n.push(a),n=new zn().fromArray(n),n=new On().setFromEuler(n).invert());let l=new On,u=new zn,c=[];if(!s||!o)return new Gu(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 Gu(e+".quaternion",o,c)}generateMorphTrack(e){let t=e.DeformPercent.curves.morph,i=t.values.map(function(a){return a/100}),n=Ta.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Fh(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(ta.degToRad(e.values[0])),o.push(ta.degToRad(t.values[0])),o.push(ta.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(ta.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(ta.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 zn(...u,n),v=new zn(...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 zn;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(ta.degToRad(e.values[s])),o.push(ta.degToRad(t.values[s])),o.push(ta.degToRad(i.values[s]))}return[a,o]}},KB=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 BR,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],wIe(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=YB(a))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=YB(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=YB(u);break}this.getPrevNode()[a]={type:o,type2:s,flag:l,value:u},this.setCurrentProp(this.getPrevNode(),a)}},JB=class{parse(e){let t=new FR(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 BR;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=roe(new Uint8Array(e.getArrayBuffer(o))),l=new FR(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)}}},FR=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)}},BR=class{add(e,t){this[e]=t}};function xIe(r){let e="Kaydara FBX Binary \0";return r.byteLength>=e.length&&e===uoe(r,0,e.length)}function SIe(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 ooe(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 MIe(r){return r/46186158e3}var bIe=[];function OR(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 TIe(bIe,i.buffer,a,o)}var XB=new zn,Fy=new ye;function soe(r){let e=new Xt,t=new Xt,i=new Xt,n=new Xt,a=new Xt,o=new Xt,s=new Xt,l=new Xt,u=new Xt,c=new Xt,f=new Xt,h=new Xt,p=r.inheritType?r.inheritType:0;if(r.translation&&e.setPosition(Fy.fromArray(r.translation)),r.preRotation){let b=r.preRotation.map(ta.degToRad);b.push(r.eulerOrder||zn.DEFAULT_ORDER),t.makeRotationFromEuler(XB.fromArray(b))}if(r.rotation){let b=r.rotation.map(ta.degToRad);b.push(r.eulerOrder||zn.DEFAULT_ORDER),i.makeRotationFromEuler(XB.fromArray(b))}if(r.postRotation){let b=r.postRotation.map(ta.degToRad);b.push(r.eulerOrder||zn.DEFAULT_ORDER),n.makeRotationFromEuler(XB.fromArray(b)),n.invert()}r.scale&&a.scale(Fy.fromArray(r.scale)),r.scalingOffset&&s.setPosition(Fy.fromArray(r.scalingOffset)),r.scalingPivot&&o.setPosition(Fy.fromArray(r.scalingPivot)),r.rotationOffset&&l.setPosition(Fy.fromArray(r.rotationOffset)),r.rotationPivot&&u.setPosition(Fy.fromArray(r.rotationPivot)),r.parentMatrixWorld&&(f.copy(r.parentMatrix),c.copy(r.parentMatrixWorld));let d=t.clone().multiply(i).multiply(n),g=new Xt;g.extractRotation(c);let m=new Xt;m.copyPosition(c);let v=m.clone().invert().multiply(c),_=g.clone().invert().multiply(v),y=a,x=new Xt;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 Xt().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 Xt().copyPosition(w),C=c.clone().multiply(T);return h.copyPosition(C),w=h.clone().multiply(x),w.premultiply(c.invert()),w}function loe(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 YB(r){return r.split(",").map(function(t){return parseFloat(t)})}function uoe(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=r.byteLength),new TextDecoder().decode(new Uint8Array(r,e,t))}function wIe(r,e){for(let t=0,i=r.length,n=e.length;t<n;t++,i++)r[i]=e[t]}function TIe(r,e,t,i){for(let n=t,a=0;n<i;n++,a++)r[a]=e[n];return r}var Fse=Hse(Ose());var p3e=["Three"],d3e=new rM,zse,Bse=(()=>{let e=class e{constructor(){this.http=sa(lf),this.modal=sa(sf),this.titleService=sa(Pb),this.animate=()=>{requestAnimationFrame(this.animate);let i=d3e.getDelta();zse&&zse.update(i),this.renderer.render(this.scene,this.camera)}}ngOnInit(){this.titleService.setTitle("\u91CD\u78C53D"),this.initThreeJs(),this.animate()}initThreeJs(){this.camera=new Wi(40,window.innerWidth/window.innerHeight,1,2e4),this.camera.position.set(2200,300,-3100),this.scene=new QS,this.scene.background=new nr(263446);let i=new eM(16777215,4473924,5);i.position.set(0,200,0),this.scene.add(i);let n=new tM(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 zR().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 $S({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 SC(s,l),c=new Nc({color:16711680}),f=new an(u,c);f.position.set(850,100,-2e3),this.scene.add(f);let h=new Fse.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=zr({type:e,selectors:[["app-data-v-t1"]],viewQuery:function(n,a){if(n&1&&Ca(p3e,7),n&2){let o;Pi(o=Ii())&&(a.container=o.first)}},standalone:!0,features:[Fr],decls:3,vars:0,consts:[[2,"display","flex","flex-direction","column","height","100vh"],[2,"flex-grow","1"],["Three",""]],template:function(n,a){n&1&&(Dt(0,"div",0),mr(1,"div",1,2),Pt())},dependencies:[es,ts,ys,hs,xs,Ss,_s,vs,Qo,us,fs,Ts,ms,ps,La,Ko,ss,ls,Ms,ws,as,Da,ds,ns,cs,os,bs,$o,Jo,gs,is,jo,rs,Ra],encapsulation:2});let r=e;return r})();var kse=(()=>{let e=class e{constructor(){this.http=sa(lf),this.modal=sa(sf)}ngOnInit(){}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=zr({type:e,selectors:[["app-data-v-threejs"]],standalone:!0,features:[Fr],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&&mr(0,"iframe",0)},dependencies:[es,ts,ys,hs,xs,Ss,_s,vs,Qo,us,fs,Ts,ms,ps,La,Ko,ss,ls,Ms,ws,as,Da,ds,ns,cs,os,bs,$o,Jo,gs,is,jo,rs,Ra]});let r=e;return r})();var SPt=[{path:"s1/:id",component:A$,data:{menu:null}},{path:"second1/:id",component:R$,data:{menu:null}},{path:"threejs/:id",component:kse},{path:"t1/:id",component:Bse},{path:"lj-table",component:GL},{path:"lj-table",component:GL},{path:"lj-dashboard",component:_A},{path:"lj-textDashboard",component:yA},{path:"ljCarInfoTable",component:gA}];export{SPt as routes};