PageSourceSearch

https://www.beewatec.com/hubfs/3D%20Viewer/o3dv.min.js

js beewatec.com collected 2026-10-10 02:36:11 UTC 994,669 bytes, 3,285 lines download raw bytes

1var OV=(()=>{var Jh=Object.defineProperty;var $x=Object.getOwnPropertyDescriptor;var Qx=Object.getOwnPropertyNames;var ey=Object.prototype.hasOwnProperty;var Zp=(r,e)=>{for(var t in e)Jh(r,t,{get:e[t],enumerable:!0})},ty=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qx(e))!ey.call(r,i)&&i!==t&&Jh(r,i,{get:()=>e[i],enumerable:!(n=$x(e,i))||n.enumerable});return r};var ny=r=>ty(Jh({},"__esModule",{value:!0}),r);var $w={};Zp($w,{AddCoord2D:()=>rm,AddCoord3D:()=>Jc,AddDiv:()=>Dx,AddDomElement:()=>Bp,ArrayBufferToAsciiString:()=>cm,ArrayBufferToUtf8String:()=>hn,ArrayToCoord3D:()=>is,ArrayToQuaternion:()=>No,ArrayToRGBColor:()=>am,AsciiStringToArrayBuffer:()=>um,Base64DataURIToArrayBuffer:()=>Gs,BezierTweenFunction:()=>pm,BigEps:()=>tm,BinaryReader:()=>Kn,BinaryWriter:()=>Hi,BoundingBoxCalculator3D:()=>Bo,Box3D:()=>Hs,CalculateSurfaceArea:()=>Lx,CalculateTriangleNormal:()=>Vs,CalculateVolume:()=>Fp,Camera:()=>Bi,CameraIsEqual3D:()=>Gh,CameraMode:()=>Wn,CameraValidator:()=>Rc,CheckModel:()=>y0,ClearDomElement:()=>kx,ClickDetector:()=>Ic,ColorComponentFromFloat:()=>Sn,ColorComponentToFloat:()=>Us,ColorToMaterialConverter:()=>li,ConvertColorToThreeColor:()=>ai,ConvertMeshToMeshBuffer:()=>Co,ConvertModelToThreeObject:()=>Vh,ConvertThreeColorToColor:()=>Ca,ConvertThreeGeometryToMesh:()=>Ki,Coord2D:()=>wt,Coord3D:()=>Ve,Coord4D:()=>mi,CoordDistance2D:()=>vl,CoordDistance3D:()=>qn,CoordIsEqual2D:()=>zi,CoordIsEqual3D:()=>pi,CopyObjectAttributes:()=>bo,CreateDiv:()=>jx,CreateDomElement:()=>qh,CreateModelUrlParameters:()=>Ox,CreateObjectUrl:()=>zs,CreateObjectUrlWithMimeType:()=>Qc,CreateUrlBuilder:()=>Up,CreateUrlParser:()=>Nx,CrossVector3D:()=>Vi,DegRad:()=>sr,Direction:()=>ct,DisposeThreeObjects:()=>dh,DotVector3D:()=>bl,EdgeSettings:()=>$r,EmbeddedViewer:()=>Lc,EnvironmentSettings:()=>es,Eps:()=>em,EscapeHtmlChars:()=>Gc,EventNotifier:()=>zc,ExportedFile:()=>qt,Exporter:()=>su,Exporter3dm:()=>Ro,ExporterBase:()=>An,ExporterBim:()=>Po,ExporterGltf:()=>Lo,ExporterModel:()=>Oo,ExporterObj:()=>Do,ExporterOff:()=>ko,ExporterPly:()=>Fo,ExporterSettings:()=>wl,ExporterStl:()=>Uo,FaceMaterial:()=>Eo,FileFormat:()=>nn,FileSource:()=>Gi,FinalizeModel:()=>ph,FlipMeshTrianglesOrientation:()=>ru,GenerateCone:()=>Op,GenerateCuboid:()=>Cx,GenerateCylinder:()=>Ix,GeneratePlatonicSolid:()=>Px,GenerateSphere:()=>Rx,Generator:()=>Ns,GeneratorHelper:()=>ol,GeneratorParams:()=>Tc,GetBoundingBox:()=>Qh,GetDefaultCamera:()=>Xh,GetDomElementClientCoordinates:()=>Qr,GetDomElementExternalHeight:()=>Wh,GetDomElementExternalWidth:()=>Hh,GetDomElementInnerDimensions:()=>jh,GetDomElementOuterHeight:()=>Vx,GetDomElementOuterWidth:()=>zx,GetExternalLibPath:()=>ks,GetFileExtension:()=>rr,GetFileExtensionFromMimeType:()=>rs,GetFileName:()=>xn,GetIntegerFromStyle:()=>On,GetMeshType:()=>ss,GetShadingType:()=>fh,GetShadingTypeOfObject:()=>Vp,GetTetrahedronSignedVolume:()=>kp,GetTopology:()=>ef,GetTriangleArea:()=>Dp,HasDefaultMaterial:()=>gm,HasHighpDriverIssue:()=>hh,HexStringToRGBColor:()=>om,ImportError:()=>Ls,ImportErrorCode:()=>Ar,ImportResult:()=>_c,ImportSettings:()=>rl,Importer:()=>sl,Importer3dm:()=>Ia,Importer3ds:()=>Ra,ImporterBase:()=>zt,ImporterBim:()=>Ua,ImporterFcstd:()=>il,ImporterFile:()=>js,ImporterFileAccessor:()=>bc,ImporterFileList:()=>qs,ImporterGltf:()=>Pa,ImporterIfc:()=>La,ImporterObj:()=>Na,ImporterOcct:()=>ka,ImporterOff:()=>Oa,ImporterPly:()=>Da,ImporterStl:()=>Fa,ImporterThree3mf:()=>nl,ImporterThreeBase:()=>Sr,ImporterThreeDae:()=>el,ImporterThreeFbx:()=>Qa,ImporterThreeSvg:()=>Bh,ImporterThreeWrl:()=>tl,Init3DViewerElement:()=>Hp,Init3DViewerElements:()=>qx,InputFile:()=>Vo,InputFilesFromFileObjects:()=>lu,InputFilesFromUrls:()=>au,InsertDomElementAfter:()=>Ux,InsertDomElementBefore:()=>Fx,IntegerToHexString:()=>yn,IsDefined:()=>_o,IsDomElementVisible:()=>Gx,IsEqual:()=>Rt,IsEqualEps:()=>im,IsGreater:()=>Zc,IsGreaterOrEqual:()=>So,IsLower:()=>Mo,IsLowerOrEqual:()=>wo,IsModelEmpty:()=>Wo,IsNegative:()=>Rr,IsObjectEmpty:()=>Bc,IsPositive:()=>wi,IsPowerOfTwo:()=>Ld,IsTwoManifold:()=>tf,IsUrl:()=>Qp,IsZero:()=>Fs,LinearToSRGB:()=>Bs,LinearTweenFunction:()=>mm,LoadExternalLibrary:()=>ir,MaterialBase:()=>_l,MaterialType:()=>Dn,Matrix:()=>Gt,MatrixIsEqual:()=>iu,Mesh:()=>jt,MeshBuffer:()=>Ml,MeshInstance:()=>Xs,MeshInstanceId:()=>Lr,MeshPrimitiveBuffer:()=>Tl,MeshType:()=>lr,Model:()=>hr,ModelObject3D:()=>ur,ModelToThreeConversionOutput:()=>cl,ModelToThreeConversionParams:()=>ll,MouseInteraction:()=>Ac,NameFromLine:()=>Tr,Navigation:()=>hl,NavigationType:()=>$n,NextPowerOfTwo:()=>v0,Node:()=>In,NodeType:()=>gi,Object3D:()=>Sl,Octree:()=>Go,OctreeNode:()=>Ws,ParabolicTweenFunction:()=>ou,ParameterConverter:()=>sn,ParameterListBuilder:()=>Mc,ParameterListParser:()=>wc,ParametersFromLine:()=>Ji,PhongMaterial:()=>un,PhysicalMaterial:()=>ns,Property:()=>Xt,PropertyGroup:()=>Cn,PropertyToString:()=>tu,PropertyType:()=>Ht,Quaternion:()=>Xn,QuaternionFromAxisAngle:()=>nu,QuaternionFromXYZ:()=>fm,QuaternionIsEqual:()=>hm,RGBAColor:()=>or,RGBAColorToHexString:()=>sm,RGBColor:()=>dt,RGBColorFromFloatComponents:()=>di,RGBColorIsEqual:()=>Pr,RGBColorToHexString:()=>Kc,RadDeg:()=>nm,ReadFile:()=>Xc,ReadLines:()=>Ni,ReplaceDefaultMaterialColor:()=>xm,RequestUrl:()=>qc,RevokeObjectUrl:()=>eu,RunTaskAsync:()=>xl,RunTasks:()=>Vc,RunTasksBatch:()=>Hc,SRGBToLinear:()=>ar,SetDomElementHeight:()=>zp,SetDomElementOuterHeight:()=>Wx,SetDomElementOuterWidth:()=>Hx,SetDomElementWidth:()=>Gp,SetExternalLibLocation:()=>$p,SetThreeMeshPolygonOffset:()=>zh,ShadingModel:()=>fl,ShadingType:()=>Hn,ShowDomElement:()=>Bx,SubCoord2D:()=>yl,SubCoord3D:()=>En,TaskRunner:()=>To,TextWriter:()=>ii,TextureIsEqual:()=>lm,TextureMap:()=>ni,TextureMapIsEqual:()=>ts,ThreeConversionStateHandler:()=>Sc,ThreeModelLoader:()=>ul,ThreeNodeTree:()=>Ec,Topology:()=>Ho,TopologyEdge:()=>Al,TopologyTriangle:()=>Il,TopologyTriangleEdge:()=>Cl,TopologyVertex:()=>El,TouchInteraction:()=>Cc,TransformFileHostUrls:()=>Yc,TransformMesh:()=>cr,Transformation:()=>Yt,TransformationIsEqual:()=>dm,TraverseThreeObject:()=>Yh,Triangle:()=>Bt,TweenCoord3D:()=>zo,UpVector:()=>Pc,UpdateMaterialTransparency:()=>ci,Utf8StringToArrayBuffer:()=>Io,ValueOrDefault:()=>Kp,VectorAngle3D:()=>$c,VectorLength3D:()=>Ao,Viewer:()=>dl,ViewerMainModel:()=>al,ViewerModel:()=>Os,WaitWhile:()=>Wc});function _o(r){return r!=null}function Kp(r,e){return r??e}function bo(r,e){if(_o(r))for(let t of Object.keys(r))_o(r[t])&&(e[t]=r[t])}function Bc(r){return Object.keys(r).length===0}function Gc(r){return r.replace(/</g,"&lt;").replace(/>/g,"&gt;")}var zc=class{constructor(){this.eventListeners=new Map}AddEventListener(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,[]),this.eventListeners.get(e).push(t)}HasEventListener(e){return this.eventListeners.has(e)}GetEventNotifier(e){return()=>{this.NotifyEventListeners(e)}}NotifyEventListeners(e,...t){if(!this.eventListeners.has(e))return;let n=this.eventListeners.get(e);for(let i of n)i(...t)}};var To=class{constructor(){this.count=null,this.current=null,this.callbacks=null}Run(e,t){this.count=e,this.current=0,this.callbacks=t,e===0?this.TaskReady():this.RunOnce()}
1RunBatch(e,t,n){let i=0;e>0&&(i=parseInt((e-1)/t,10)+1),this.Run(i,{runTask:(s,o)=>{let a=s*t,c=Math.min((s+1)*t,e)-1;n.runTask(a,c,o)},onReady:n.onReady})}RunOnce(){setTimeout(()=>{this.callbacks.runTask(this.current,this.TaskReady.bind(this))},0)}TaskReady(){this.current+=1,this.current<this.count?this.RunOnce():this.callbacks.onReady&&this.callbacks.onReady()}};function xl(r){setTimeout(()=>{r()},10)}function Vc(r,e){new To().Run(r,e)}function Hc(r,e,t){new To().RunBatch(r,e,t)}function Wc(r){function e(t){t()&&setTimeout(()=>{e(t)},10)}e(r)}var jc=null,Jp=new Set;function $p(r){jc=r}function ks(r){return jc===null?null:jc+"/"+r}function ir(r){return new Promise((e,t)=>{if(jc===null){t();return}if(Jp.has(r)){e();return}let n=document.createElement("script");n.type="text/javascript",n.src=ks(r),n.onload=()=>{Jp.add(r),e()},n.onerror=()=>{t()},document.head.appendChild(n)})}var Gi={Url:1,File:2,Decompressed:3},nn={Text:1,Binary:2};function xn(r){let e=r.lastIndexOf("/");e===-1&&(e=r.lastIndexOf("\\"));let t=r;e!==-1&&(t=r.substring(e+1));let n=t.indexOf("?");return n!==-1&&(t=t.substring(0,n)),decodeURI(t)}function rr(r){let e=xn(r),t=e.lastIndexOf(".");return t===-1?"":e.substring(t+1).toLowerCase()}function qc(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),i.onprogress=s=>{e(s.loaded,s.total)},i.onload=()=>{i.status===200?t(i.response):n()},i.onerror=()=>{n()},i.responseType="arraybuffer",i.send(null)})}function Xc(r,e){return new Promise((t,n)=>{let i=new FileReader;i.onprogress=s=>{e(s.loaded,s.total)},i.onloadend=s=>{s.target.readyState===FileReader.DONE&&t(s.target.result)},i.onerror=()=>{n()},i.readAsArrayBuffer(r)})}function Yc(r){for(let e=0;e<r.length;e++){let t=r[e];if(t.search(/www\.dropbox\.com/u)!==-1){t=t.replace("www.dropbox.com","dl.dropbox.com");let n=t.indexOf("?");n!==-1&&(t=t.substring(0,n)),r[e]=t}else if(t.search(/github\.com/u)!==-1){t=t.replace("github.com","raw.githubusercontent.com"),t=t.replace("/blob","");let n=t.indexOf("?");n!==-1&&(t=t.substring(0,n)),r[e]=t}}}function Qp(r){let e=/^https?:\/\/\S+$/g;return r.match(e)!==null}var em=1e-8,tm=1e-4,nm=57.29577951308232,sr=.017453292519943;function Fs(r){return Math.abs(r)<1e-8}function Mo(r,e){return e-r>1e-8}function Zc(r,e){return r-e>1e-8}function wo(r,e){return e-r>-1e-8}function So(r,e){return r-e>-1e-8}function Rt(r,e){return Math.abs(e-r)<1e-8}function im(r,e,t){return Math.abs(e-r)<t}function wi(r){return r>1e-8}function Rr(r){return r<-1e-8}var ct={X:1,Y:2,Z:3};var wt=class{constructor(e,t){this.x=e,this.y=t}Clone(){return new wt(this.x,this.y)}};function zi(r,e){return Rt(r.x,e.x)&&Rt(r.y,e.y)}function rm(r,e){return new wt(r.x+e.x,r.y+e.y)}function yl(r,e){return new wt(r.x-e.x,r.y-e.y)}function vl(r,e){return Math.sqrt((r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y))}var dt=class{constructor(e,t,n){this.r=e,this.g=t,this.b=n}Set(e,t,n){this.r=e,this.g=t,this.b=n}Clone(){return new dt(this.r,this.g,this.b)}},or=class{constructor(e,t,n,i){this.r=e,this.g=t,this.b=n,this.a=i}Set(e,t,n,i){this.r=e,this.g=t,this.b=n,this.a=i}Clone(){return new or(this.r,this.g,this.b,this.a)}};function Sn(r){return parseInt(Math.round(r*255),10)}function Us(r){return r/255}function di(r,e,t){return new dt(Sn(r),Sn(e),Sn(t))}function ar(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Bs(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}function yn(r){let e=parseInt(r,10).toString(16);for(;e.length<2;)e="0"+e;return e}function Kc(r){let e=yn(r.r),t=yn(r.g),n=yn(r.b);return e+t+n}function sm(r){let e=yn(r.r),t=yn(r.g),n=yn(r.b),i=yn(r.a);return e+t+n+i}function om(r){if(r.length!==6)return null;let e=parseInt(r.substring(0,2),16),t=parseInt(r.substring(2,4),16),n=parseInt(r.substring(4,6),16);return new dt(e,t,n)}function am(r){return new dt(r[0],r[1],r[2])}function Pr(r,e){return r.r===e.r&&r.g===e.g&&r.b===e.b}var ni=class{constructor(){this.name=null,this.mimeType=null,this.buffer=null,this.offset=new wt(0,0),this.scale=new wt(1,1),this.rotation=0}IsValid(){return this.name!==null&&this.buffer!==null}HasTransformation(){return!zi(this.offset,new wt(0,0))||!zi(this.scale,new wt(1,1))||!Rt(this.rotation,0)}IsEqual(e){return!(this.name!==e.name||this.mimeType!==e.mimeType||!zi(this.offset,e.offset)||!zi(this.scale,e.scale)||!Rt(this.rotation,e.rotation))}};function ts(r,e){return r===null&&e===null?!0:r===null||e===null?!1:r.IsEqual(e)}var Dn={Phong:1,Physical:2},_l=class{constructor(e){this.type=e,this.isDefault=!1,this.name="",this.color=new dt(0,0,0),this.vertexColors=!1}IsEqual(e){return!(this.type!==e.type||this.isDefault!==e.isDefault||this.name!==e.name||!Pr(this.color,e.color)||this.vertexColors!==e.vertexColors)}},Eo=class extends _l{constructor(e){super(e),this.emissive=new dt(0,0,0),this.opacity=1,this.transparent=!1,this.diffuseMap=null,this.bumpMap=null,this.normalMap=null,this.emissiveMap=null,this.alphaTest=0,this.multiplyDiffuseMap=!1}IsEqual(e){return!(!super.IsEqual(e)||!Pr(this.emissive,e.emissive)||!Rt(this.opacity,e.opacity)||this.transparent!==e.transparent||!ts(this.diffuseMap,e.diffuseMap)||!ts(this.bumpMap,e.bumpMap)||!ts(this.normalMap,e.normalMap)||!ts(this.emissiveMap,e.emissiveMap)||!Rt(this.alphaTest,e.alphaTest)||this.multiplyDiffuseMap!==e.multiplyDiffuseMap)}}
1,un=class extends Eo{constructor(){super(Dn.Phong),this.ambient=new dt(0,0,0),this.specular=new dt(0,0,0),this.shininess=0,this.specularMap=null}IsEqual(e){return!(!super.IsEqual(e)||!Pr(this.ambient,e.ambient)||!Pr(this.specular,e.specular)||!Rt(this.shininess,e.shininess)||!ts(this.specularMap,e.specularMap))}},ns=class extends Eo{constructor(){super(Dn.Physical),this.metalness=0,this.roughness=1,this.metalnessMap=null}IsEqual(e){return!(!super.IsEqual(e)||!Rt(this.metalness,e.metalness)||!Rt(this.roughness,e.roughness)||!ts(this.metalnessMap,e.metalnessMap))}};function lm(r,e){return!(r.name!==e.name||r.mimeType!==e.mimeType||!zi(r.offset,e.offset)||!zi(r.scale,e.scale)||!Rt(r.rotation,e.rotation))}var Ve=class{constructor(e,t,n){this.x=e,this.y=t,this.z=n}Length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}MultiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}Normalize(){let e=this.Length();return e>0&&this.MultiplyScalar(1/e),this}Offset(e,t){let n=e.Clone().Normalize();return this.x+=n.x*t,this.y+=n.y*t,this.z+=n.z*t,this}Rotate(e,t,n){let i=e.Clone().Normalize(),s=i.x,o=i.y,a=i.z,c=this.x-n.x,l=this.y-n.y,u=this.z-n.z,h=Math.sin(t),f=Math.cos(t);return this.x=-s*(-s*c-o*l-a*u)*(1-f)+c*f+(-a*l+o*u)*h,this.y=-o*(-s*c-o*l-a*u)*(1-f)+l*f+(a*c-s*u)*h,this.z=-a*(-s*c-o*l-a*u)*(1-f)+u*f+(-o*c+s*l)*h,this.x+=n.x,this.y+=n.y,this.z+=n.z,this}Clone(){return new Ve(this.x,this.y,this.z)}};function pi(r,e){return Rt(r.x,e.x)&&Rt(r.y,e.y)&&Rt(r.z,e.z)}function Jc(r,e){return new Ve(r.x+e.x,r.y+e.y,r.z+e.z)}function En(r,e){return new Ve(r.x-e.x,r.y-e.y,r.z-e.z)}function qn(r,e){return Math.sqrt((r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y)+(r.z-e.z)*(r.z-e.z))}function bl(r,e){return r.x*e.x+r.y*e.y+r.z*e.z}function $c(r,e){let t=r.Clone().Normalize(),n=e.Clone().Normalize();if(pi(t,n))return 0;let i=bl(t,n);return Math.acos(i)}function Vi(r,e){let t=new Ve(0,0,0);return t.x=r.y*e.z-r.z*e.y,t.y=r.z*e.x-r.x*e.z,t.z=r.x*e.y-r.y*e.x,t}function Ao(r,e,t){return Math.sqrt(r*r+e*e+t*t)}function is(r){return new Ve(r[0],r[1],r[2])}var Tl=class{constructor(){this.indices=[],this.vertices=[],this.colors=[],this.normals=[],this.uvs=[],this.material=null}GetBounds(){let e=[1/0,1/0,1/0],t=[-1/0,-1/0,-1/0];for(let n=0;n<this.vertices.length/3;n++)for(let i=0;i<3;i++)e[i]=Math.min(e[i],this.vertices[n*3+i]),t[i]=Math.max(t[i],this.vertices[n*3+i]);return{min:e,max:t}}GetByteLength(e,t){let n=this.indices.length,i=this.vertices.length+this.colors.length+this.normals.length+this.uvs.length;return n*e+i*t}},Ml=class{constructor(){this.primitives=[]}PrimitiveCount(){return this.primitives.length}GetPrimitive(e){return this.primitives[e]}GetByteLength(e,t){let n=0;for(let i=0;i<this.primitives.length;i++){let s=this.primitives[i];n+=s.GetByteLength(e,t)}return n}};function Co(r){function e(a,c,l,u){function h(m,d,x){return d!==null?m.GetVertexColor(d):x?new dt(0,0,0):null}function f(m,d,x){return d!==null?m.GetTextureUV(d):x?new wt(0,0):null}function p(m,d,x){let _=m.VertexColorCount()>0,v=m.TextureUVCount()>0,y=m.GetVertex(d.vertex),w=m.GetNormal(d.normal),L=x.vertices.length/3;x.indices.push(L),x.vertices.push(y.x,y.y,y.z);let C=h(m,d.color,_);C!==null&&x.colors.push(C.r/255,C.g/255,C.b/255),x.normals.push(w.x,w.y,w.z);let b=f(m,d.uv,v);return b!==null&&x.uvs.push(b.x,b.y),{index:L,color:C,normal:w,uv:b}}function g(m,d,x){function _(w,L,C){if(C===null&&L===null)return!0;let b=h(w,L,!0);return Pr(C,b)}function v(w,L,C){let b=w.GetNormal(L);return pi(C,b)}function y(w,L,C){if(C===null&&L===null)return!0;let b=f(w,L,!0);return zi(C,b)}for(let w=0;w<d.length;w++){let L=d[w],C=_(m,x.color,L.color),b=v(m,x.normal,L.normal),A=y(m,x.uv,L.uv);if(C&&b&&A)return L}return null}if(u.has(c.vertex)){let m=u.get(c.vertex),d=g(a,m,c);if(d!==null)l.indices.push(d.index);else{let x=p(a,c,l);m.push(x)}}else{let m=p(a,c,l);u.set(c.vertex,[m])}}let t=new Ml,n=r.TriangleCount();if(n===0)return null;let i=[];for(let a=0;a<n;a++)i.push(a);i.sort((a,c)=>{let l=r.GetTriangle(a),u=r.GetTriangle(c);return l.mat-u.mat});let s=null,o=null;for(let a=0;a<i.length;
1a++){let c=i[a],l=r.GetTriangle(c);(s===null||s.material!==l.mat)&&(s=new Tl,s.material=l.mat,o=new Map,t.primitives.push(s));let u={vertex:l.v0,color:l.c0,normal:l.n0,uv:l.u0},h={vertex:l.v1,color:l.c1,normal:l.n1,uv:l.u1},f={vertex:l.v2,color:l.c2,normal:l.n2,uv:l.u2};e(r,u,s,o),e(r,h,s,o),e(r,f,s,o)}return t}function hn(r){return new TextDecoder("utf-8").decode(r)}function cm(r){let e="",t=new Uint8Array(r);for(let n=0;n<t.byteLength;n++)e+=String.fromCharCode(t[n]);return e}function um(r){let e=new ArrayBuffer(r.length),t=new Uint8Array(e);for(let n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return e}function Io(r){return new TextEncoder().encode(r).buffer}function Gs(r){let e="data:";if(!r.startsWith(e))return null;let t=r.indexOf(";");if(t===-1)return null;let n=r.indexOf(",");if(n===-1)return null;let i=r.substring(e.length,e.length+t-5),s=atob(r.substring(n+1)),o=new ArrayBuffer(s.length),a=new Uint8Array(o);for(let c=0;c<s.length;c++)a[c]=s.charCodeAt(c);return{mimeType:i,buffer:o}}function rs(r){if(r==null)return"";let e=r.split("/");return e.length===0?"":e[e.length-1]}function zs(r){let e=new Blob([r]);return URL.createObjectURL(e)}function Qc(r,e){let t=new Blob([r],{type:e});return URL.createObjectURL(t)}function eu(r){URL.revokeObjectURL(r)}var qt=class{constructor(e){this.name=e,this.content=null}GetName(){return this.name}SetName(e){this.name=e}GetTextContent(){return hn(this.content)}GetBufferContent(){return this.content}SetTextContent(e){let t=Io(e);this.content=t}SetBufferContent(e){this.content=e}},An=class{constructor(){}CanExport(e,t){return!1}Export(e,t,n){let i=[];this.ExportContent(e,t,i,()=>{n(i)})}ExportContent(e,t,n,i){}GetExportedMaterialName(e){return this.GetExportedName(e,"Material")}GetExportedMeshName(e){return this.GetExportedName(e,"Mesh")}GetExportedName(e,t){return e.length===0?t:e}};var Ro=class extends An{constructor(){super(),this.rhino=null}CanExport(e,t){return e===nn.Binary&&t==="3dm"}ExportContent(e,t,n,i){this.rhino===null?ir("loaders/rhino3dm.min.js").then(()=>{rhino3dm().then(s=>{this.rhino=s,this.ExportRhinoContent(e,n,i)})}).catch(()=>{i()}):this.ExportRhinoContent(e,n,i)}ExportRhinoContent(e,t,n){function i(l){return{r:l.r,g:l.g,b:l.b,a:255}}let s=new qt("model.3dm");t.push(s);let o=new this.rhino.File3dm;e.EnumerateTransformedMeshes(l=>{let u=Co(l);for(let h=0;h<u.PrimitiveCount();h++){let f=u.GetPrimitive(h),p={data:{attributes:{position:{itemSize:3,type:"Float32Array",array:f.vertices},normal:{itemSize:3,type:"Float32Array",array:f.normals}},index:{type:"Uint16Array",array:f.indices}}},g=e.GetMaterial(f.material),m=new this.rhino.Material;m.name=this.GetExportedMaterialName(g.name),g.type===Dn.Phong&&(m.ambientColor=i(g.ambient),m.specularColor=i(g.specular)),m.diffuseColor=i(g.color),m.transparency=1-g.opacity;let d=o.materials().count();o.materials().add(m);let x=new this.rhino.Mesh.createFromThreejsJSON(p),_=new this.rhino.ObjectAttributes;_.name=this.GetExportedMeshName(l.GetName()),_.materialSource=this.rhino.ObjectMaterialSource.MaterialFromObject,_.materialIndex=d,o.objects().add(x,_)}});let a=new this.rhino.File3dmWriteOptions;a.version=6;let c=o.toByteArray(a);s.SetBufferContent(c),n()}};var Ht={Text:1,Integer:2,Number:3,Boolean:4,Percent:5,Color:6},Xt=class{constructor(e,t,n){this.type=e,this.name=t,this.value=n}Clone(){return this.type===Ht.Color?new Xt(this.type,this.name,this.value.Clone()):new Xt(this.type,this.name,this.value)}},Cn=class{constructor(e){this.name=e,this.properties=[]}PropertyCount(){return this.properties.length}AddProperty(e){this.properties.push(e)}GetProperty(e){return this.properties[e]}Clone(){let e=new Cn(this.name);for(let t of this.properties)e.AddProperty(t.Clone());return e}};function tu(r){return r.type===Ht.Text?Gc(r.value):r.type===Ht.Integer?r.value.toLocaleString():r.type===
1Ht.Number?r.value.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):r.type===Ht.Boolean?r.value?"True":"False":r.type===Ht.Percent?parseInt(r.value*100,10).toString()+"%":r.type===Ht.Color?"#"+Kc(r.value):null}function iy(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Po=class extends An{constructor(){super()}CanExport(e,t){return e===nn.Text&&t==="bim"}ExportContent(e,t,n,i){let s={schema_version:"1.0.0",meshes:[],elements:[],info:{}};this.ExportProperties(e.GetModel(),s.info);let o=0;e.EnumerateTransformedMeshes(c=>{let l={mesh_id:o,coordinates:[],indices:[]};c.EnumerateVertices(g=>{l.coordinates.push(g.x,g.y,g.z)}),c.EnumerateTriangleVertexIndices((g,m,d)=>{l.indices.push(g,m,d)});let u={mesh_id:o,type:"Other",color:{r:200,g:200,b:200,a:255},vector:{x:0,y:0,z:0},rotation:{qx:0,qy:0,qz:0,qw:1},guid:iy(),info:{}},h=null,f=!0,p=[];for(let g=0;g<c.TriangleCount();g++){let m=c.GetTriangle(g),d=e.GetMaterial(m.mat),x={r:d.color.r,g:d.color.g,b:d.color.b,a:Sn(d.opacity)};p.push(x.r,x.g,x.b,x.a),f&&(h===null?h=x:(h.r!==x.r||h.g!==x.g||h.b!==x.b||h.a!==x.a)&&(f=!1,h=null))}f?u.color=h:u.face_colors=p,u.info.Name=c.GetName(),this.ExportProperties(c,u.info),s.meshes.push(l),s.elements.push(u),o+=1});let a=new qt("model.bim");a.SetTextContent(JSON.stringify(s,null,4)),n.push(a),i()}ExportProperties(e,t){for(let n=0;n<e.PropertyGroupCount();n++){let i=e.GetPropertyGroup(n);for(let s=0;s<i.PropertyCount();s++){let o=i.GetProperty(s);t[o.name]=tu(o)}}}};var Hi=class{constructor(e,t){this.arrayBuffer=new ArrayBuffer(e),this.dataView=new DataView(this.arrayBuffer),this.isLittleEndian=t,this.position=0}GetPosition(){return this.position}SetPosition(e){this.position=e}End(){return this.position>=this.arrayBuffer.byteLength}GetBuffer(){return this.arrayBuffer}WriteArrayBuffer(e){let t=new Uint8Array(e);new Uint8Array(this.arrayBuffer).set(t,this.position),this.position+=e.byteLength}WriteBoolean8(e){this.dataView.setInt8(this.position,e?1:0),this.position=this.position+1}WriteCharacter8(e){this.dataView.setInt8(this.position,e),this.position=this.position+1}WriteUnsignedCharacter8(e){this.dataView.setUint8(this.position,e),this.position=this.position+1}WriteInteger16(e){this.dataView.setInt16(this.position,e,this.isLittleEndian),this.position=this.position+2}WriteUnsignedInteger16(e){this.dataView.setUint16(this.position,e,this.isLittleEndian),this.position=this.position+2}WriteInteger32(e){this.dataView.setInt32(this.position,e,this.isLittleEndian),this.position=this.position+4}WriteUnsignedInteger32(e){this.dataView.setUint32(this.position,e,this.isLittleEndian),this.position=this.position+4}WriteFloat32(e){this.dataView.setFloat32(this.position,e,this.isLittleEndian),this.position=this.position+4}WriteDouble64(e){this.dataView.setFloat64(this.position,e,this.isLittleEndian),this.position=this.position+8}};var Lo=class extends An{constructor(){super(),this.components={index:{type:5125,size:4},number:{type:5126,size:4}}}CanExport(e,t){return e===nn.Text&&t==="gltf"||e===nn.Binary&&t==="glb"}ExportContent(e,t,n,i){t===nn.Text?this.ExportAsciiContent(e,n):t===nn.Binary&&this.ExportBinaryContent(e,n),i()}ExportAsciiContent(e,t){let n=new qt("model.gltf"),i=new qt("model.bin");t.push(n),t.push(i);let s=this.GetMeshData(e),o=this.GetMainBuffer(s),a=this.GetMainJson(s);a.buffers.push({uri:i.GetName(),byteLength:o.byteLength});let c=new Map;this.ExportMaterials(e,a,l=>{let u=xn(l.name);if(c.has(u))return c.get(u);{let h=new qt(u);h.SetBufferContent(l.buffer),t.push(h);let f=a.textures.length;return c.set(u,f),a.images.push({uri:u}),a.textures.push({source:f}),f}}),n.SetTextContent(JSON.stringify(a,null,4)),i.SetBufferContent(o)}ExportBinaryContent(e,t){function n(y){let w=y%4;return w===0?y:y+(4-w)}function i(y,w,L){for(let C=0;C<L;C++)y.WriteUnsignedCharacter8(w)}let s=new qt("model.glb");t.push(s);let o=this.GetMeshData(e),a=this.GetMainBuffer(o),c=this.GetMainJson(o),l=[],u=a.byteLength,h=new Map;this.ExportMaterials(e,c,y=>{let w=xn(y.name),L=rr(y.name);if(h.has(w))return h.get(w);{let C=c.bufferViews.length,b=c.textures.length;h.set(w,b);let A=y.buffer;return l.push(A),c.bufferViews.push({buffer:0,byteOffset:u,byteLength:A.byteLength}),u+=A.byteLength,c.images.push({bufferView:C,mimeType:"image/"+L}),c.textures.push({source:b}),b}});let f=a.byteLength;for(let y=0;y<l.length;y++){let w=l[y];f+=w.byteLength}let p=n(f);c.buffers.push({byteLength:p});
1let g=JSON.stringify(c),m=Io(g),d=m.byteLength,x=n(d),_=12+8+x+8+p,v=new Hi(_,!0);v.WriteUnsignedInteger32(1179937895),v.WriteUnsignedInteger32(2),v.WriteUnsignedInteger32(_),v.WriteUnsignedInteger32(x),v.WriteUnsignedInteger32(1313821514),v.WriteArrayBuffer(m),i(v,32,x-d),v.WriteUnsignedInteger32(p),v.WriteUnsignedInteger32(5130562),v.WriteArrayBuffer(a);for(let y=0;y<l.length;y++){let w=l[y];v.WriteArrayBuffer(w)}i(v,0,p-f),s.SetBufferContent(v.GetBuffer())}GetMeshData(e){let t=[];return e.EnumerateTransformedMeshes(n=>{let i=Co(n);t.push({name:n.GetName(),buffer:i,offsets:[],sizes:[]})}),t}GetMainBuffer(e){let t=0;for(let i=0;i<e.length;i++){let s=e[i];t+=s.buffer.GetByteLength(this.components.index.size,this.components.number.size)}let n=new Hi(t,!0);for(let i=0;i<e.length;i++){let s=e[i];for(let o=0;o<s.buffer.PrimitiveCount();o++){let a=s.buffer.GetPrimitive(o),c=n.GetPosition();for(let l=0;l<a.indices.length;l++)n.WriteUnsignedInteger32(a.indices[l]);for(let l=0;l<a.vertices.length;l++)n.WriteFloat32(a.vertices[l]);for(let l=0;l<a.colors.length;l++)n.WriteFloat32(ar(a.colors[l]));for(let l=0;l<a.normals.length;l++)n.WriteFloat32(a.normals[l]);for(let l=0;l<a.uvs.length;l++){let u=a.uvs[l];l%2===1&&(u*=-1),n.WriteFloat32(u)}s.offsets.push(c),s.sizes.push(n.GetPosition()-c)}}return n.GetBuffer()}GetMainJson(e){class t{constructor(s,o){this.mainJson=s,this.byteOffset=o}AddBufferView(s){return this.mainJson.bufferViews.push({buffer:0,byteOffset:this.byteOffset,byteLength:s}),this.byteOffset+=s,this.mainJson.bufferViews.length-1}}let n={asset:{generator:"https://3dviewer.net",version:"2.0"},scene:0,scenes:[{nodes:[]}],nodes:[],materials:[],meshes:[],buffers:[],bufferViews:[],accessors:[]};for(let i=0;i<e.length;i++){let s=e[i];n.scenes[0].nodes.push(i),n.nodes.push({mesh:i});let o={name:this.GetExportedMeshName(s.name),primitives:[]},a=s.buffer.primitives;for(let c=0;c<a.length;c++){let l=a[c],u=new t(n,s.offsets[c]),h=u.AddBufferView(l.indices.length*this.components.index.size),f=u.AddBufferView(l.vertices.length*this.components.number.size),p=null;l.colors.length>0&&(p=u.AddBufferView(l.colors.length*this.components.number.size));let g=u.AddBufferView(l.normals.length*this.components.number.size),m=null;l.uvs.length>0&&(m=u.AddBufferView(l.uvs.length*this.components.number.size));let d={attributes:{},mode:4,material:l.material},x=l.GetBounds();n.accessors.push({bufferView:h,byteOffset:0,componentType:this.components.index.type,count:l.indices.length,type:"SCALAR"}),d.indices=n.accessors.length-1,n.accessors.push({bufferView:f,byteOffset:0,componentType:this.components.number.type,count:l.vertices.length/3,min:x.min,max:x.max,type:"VEC3"}),d.attributes.POSITION=n.accessors.length-1,p!==null&&(n.accessors.push({bufferView:p,byteOffset:0,componentType:this.components.number.type,count:l.colors.length/3,type:"VEC3"}),d.attributes.COLOR_0=n.accessors.length-1),n.accessors.push({bufferView:g,byteOffset:0,componentType:this.components.number.type,count:l.normals.length/3,type:"VEC3"}),d.attributes.NORMAL=n.accessors.length-1,m!==null&&(n.accessors.push({bufferView:m,byteOffset:0,componentType:this.components.number.type,count:l.uvs.length/2,type:"VEC2"}),d.attributes.TEXCOORD_0=n.accessors.length-1),o.primitives.push(d)}n.meshes.push(o)}return n}ExportMaterials(e,t,n){function i(s,o,a,c){function l(d,x){return[ar(d.r/255),ar(d.g/255),ar(d.b/255),x]}function u(d){return[ar(d.r/255),ar(d.g/255),ar(d.b/255)]}function h(d,x,_){if(x===null||!x.IsValid())return null;d.images===void 0&&(d.images=[]),d.textures===void 0&&(d.textures=[]);let y={index:_(x)};if(x.HasTransformation()){let w="KHR_texture_transform";d.extensionsUsed===void 0&&(d.extensionsUsed=[]),d.extensionsUsed.indexOf(w)===-1&&d.extensionsUsed.push(w),y.extensions={KHR_texture_transform:{offset:[x.offset.x,-x.offset.y],scale:[x.scale.x,x.scale.y],rotation:-x.rotation}}}return y}let f={name:s.GetExportedMaterialName(a.name),pbrMetallicRoughness:{baseColorFactor:l(a.color,a.opacity)},emissiveFactor:u(a.emissive),doubleSided:!0,alphaMode:"OPAQUE"};a.transparent&&(f.alphaMode="BLEND");let p=h(o,a.diffuseMap,c);if(p!==null&&(a.multiplyDiffuseMap||(f.pbrMetallicRoughness.baseColorFactor=l(new dt(255,255,255),a.opacity)),f.pbrMetallicRoughness.baseColorTexture=p),a.type===Dn.Physical){let d=h(o,a.metalnessMap,c
1);d!==null?f.pbrMetallicRoughness.metallicRoughnessTexture=d:(f.pbrMetallicRoughness.metallicFactor=a.metalness,f.pbrMetallicRoughness.roughnessFactor=a.roughness)}let g=h(o,a.normalMap,c);g!==null&&(f.normalTexture=g);let m=h(o,a.emissiveMap,c);m!==null&&(f.emissiveTexture=m),o.materials.push(f)}for(let s=0;s<e.MaterialCount();s++){let o=e.GetMaterial(s);i(this,t,o,n)}}};var mi=class{constructor(e,t,n,i){this.x=e,this.y=t,this.z=n,this.w=i}Clone(){return new mi(this.x,this.y,this.z,this.w)}};var Xn=class{constructor(e,t,n,i){this.x=e,this.y=t,this.z=n,this.w=i}};function hm(r,e){return Rt(r.x,e.x)&&Rt(r.y,e.y)&&Rt(r.z,e.z)&&Rt(r.w,e.w)}function No(r){return new Xn(r[0],r[1],r[2],r[3])}function nu(r,e){let t=e/2,n=Math.sin(t);return new Xn(r.x*n,r.y*n,r.z*n,Math.cos(t))}function fm(r,e,t,n){let i=Math.cos(r/2),s=Math.cos(e/2),o=Math.cos(t/2),a=Math.sin(r/2),c=Math.sin(e/2),l=Math.sin(t/2),u=new Xn(0,0,0,1);if(n==="XYZ")u.x=a*s*o+i*c*l,u.y=i*c*o-a*s*l,u.z=i*s*l+a*c*o,u.w=i*s*o-a*c*l;else if(n==="YXZ")u.x=a*s*o+i*c*l,u.y=i*c*o-a*s*l,u.z=i*s*l-a*c*o,u.w=i*s*o+a*c*l;else if(n==="ZXY")u.x=a*s*o-i*c*l,u.y=i*c*o+a*s*l,u.z=i*s*l+a*c*o,u.w=i*s*o-a*c*l;else if(n==="ZYX")u.x=a*s*o-i*c*l,u.y=i*c*o+a*s*l,u.z=i*s*l-a*c*o,u.w=i*s*o+a*c*l;else if(n==="YZX")u.x=a*s*o+i*c*l,u.y=i*c*o+a*s*l,u.z=i*s*l-a*c*o,u.w=i*s*o-a*c*l;else if(n==="XZY")u.x=a*s*o-i*c*l,u.y=i*c*o-a*s*l,u.z=i*s*l+a*c*o,u.w=i*s*o+a*c*l;else return null;return u}var Gt=class{constructor(e){this.matrix=null,e!=null&&(this.matrix=e)}IsValid(){return this.matrix!==null}Set(e){return this.matrix=e,this}Get(){return this.matrix}Clone(){let e=[this.matrix[0],this.matrix[1],this.matrix[2],this.matrix[3],this.matrix[4],this.matrix[5],this.matrix[6],this.matrix[7],this.matrix[8],this.matrix[9],this.matrix[10],this.matrix[11],this.matrix[12],this.matrix[13],this.matrix[14],this.matrix[15]];return new Gt(e)}CreateIdentity(){return this.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this}IsIdentity(){let e=new Gt().CreateIdentity().Get();for(let t=0;t<16;t++)if(!Rt(this.matrix[t],e[t]))return!1;return!0}CreateTranslation(e,t,n){return this.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,e,t,n,1],this}CreateRotation(e,t,n,i){let s=e+e,o=t+t,a=n+n,c=e*s,l=e*o,u=e*a,h=t*o,f=t*a,p=n*a,g=i*s,m=i*o,d=i*a;return this.matrix=[1-(h+p),l+d,u-m,0,l-d,1-(c+p),f+g,0,u+m,f-g,1-(c+h),0,0,0,0,1],this}CreateRotationAxisAngle(e,t){let n=nu(e,t);return this.CreateRotation(n.x,n.y,n.z,n.w)}CreateScale(e,t,n){return this.matrix=[e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1],this}ComposeTRS(e,t,n){let i=e.x,s=e.y,o=e.z,a=t.x,c=t.y,l=t.z,u=t.w,h=n.x,f=n.y,p=n.z,g=a+a,m=c+c,d=l+l,x=a*g,_=a*m,v=a*d,y=c*m,w=c*d,L=l*d,C=u*g,b=u*m,A=u*d;return this.matrix=[(1-(y+L))*h,(_+A)*h,(v-b)*h,0,(_-A)*f,(1-(x+L))*f,(w+C)*f,0,(v+b)*p,(w-C)*p,(1-(x+y))*p,0,i,s,o,1],this}DecomposeTRS(){let e=new Ve(this.matrix[12],this.matrix[13],this.matrix[14]),t=Ao(this.matrix[0],this.matrix[1],this.matrix[2]),n=Ao(this.matrix[4],this.matrix[5],this.matrix[6]),i=Ao(this.matrix[8],this.matrix[9],this.matrix[10]),s=this.Determinant();Rr(s)&&(t*=-1);let o=new Ve(t,n,i),a=this.matrix[0]/t,c=this.matrix[4]/n,l=this.matrix[8]/i,u=this.matrix[1]/t,h=this.matrix[5]/n,f=this.matrix[9]/i,p=this.matrix[2]/t,g=this.matrix[6]/n,m=this.matrix[10]/i,d=null,x=a+h+m;if(x>0){let _=Math.sqrt(x+1)*2;d=new Xn((g-f)/_,(l-p)/_,(u-c)/_,.25*_)}else if(a>h&&a>m){let _=Math.sqrt(1+a-h-m)*2;d=new Xn(.25*_,(c+u)/_,(l+p)/_,(g-f)/_)}else if(h>m){let _=Math.sqrt(1+h-a-m)*2;d=new Xn((c+u)/_,.25*_,(f+g)/_,(l-p)/_)}else{let _=Math.sqrt(1+m-a-h)*2;d=new Xn((l+p)/_,(f+g)/_,.25*_,(u-c)/_)}return{translation:e,rotation:d,scale:o}}Determinant(){let e=this.matrix[0],t=this.matrix[1],n=this.matrix[2],i=this.matrix[3],s=this.matrix[4],o=this.matrix[5],a=this.matrix[6],c=this.matrix[7],l=this.matrix[8],u=this.matrix[9],h=this.matrix[10],f=this.matrix[11],p=this.matrix[12],g=this.matrix[13],m=this.matrix[14],d=this.matrix[15],x=e*o-t*s,_=e*a-n*s,v=e*c-i*s,y=t*a-n*o,w=t*c-i*o,L=n*c-i*a,C=l*g-u*p,b=l*m-h*p,A=l*d-f*p,N=u*m-h*g,G=u*d-f*g,F=h*d-f*m;return x*F-_*G+v*N+y*A-w*b+L*C}
1Invert(){let e=this.matrix[0],t=this.matrix[1],n=this.matrix[2],i=this.matrix[3],s=this.matrix[4],o=this.matrix[5],a=this.matrix[6],c=this.matrix[7],l=this.matrix[8],u=this.matrix[9],h=this.matrix[10],f=this.matrix[11],p=this.matrix[12],g=this.matrix[13],m=this.matrix[14],d=this.matrix[15],x=e*o-t*s,_=e*a-n*s,v=e*c-i*s,y=t*a-n*o,w=t*c-i*o,L=n*c-i*a,C=l*g-u*p,b=l*m-h*p,A=l*d-f*p,N=u*m-h*g,G=u*d-f*g,F=h*d-f*m,U=x*F-_*G+v*N+y*A-w*b+L*C;if(Rt(U,0))return null;let P=[(o*F-a*G+c*N)/U,(n*G-t*F-i*N)/U,(g*L-m*w+d*y)/U,(h*w-u*L-f*y)/U,(a*A-s*F-c*b)/U,(e*F-n*A+i*b)/U,(m*v-p*L-d*_)/U,(l*L-h*v+f*_)/U,(s*G-o*A+c*C)/U,(t*A-e*G-i*C)/U,(p*w-g*v+d*x)/U,(u*v-l*w-f*x)/U,(o*b-s*N-a*C)/U,(e*N-t*b+n*C)/U,(g*_-p*y-m*x)/U,(l*y-u*_+h*x)/U];return new Gt(P)}Transpose(){let e=[this.matrix[0],this.matrix[4],this.matrix[8],this.matrix[12],this.matrix[1],this.matrix[5],this.matrix[9],this.matrix[13],this.matrix[2],this.matrix[6],this.matrix[10],this.matrix[14],this.matrix[3],this.matrix[7],this.matrix[11],this.matrix[15]];return new Gt(e)}InvertTranspose(){let e=this.Invert();return e===null?null:e.Transpose()}MultiplyVector(e){let t=e.x,n=e.y,i=e.z,s=e.w,o=this.matrix[0],a=this.matrix[1],c=this.matrix[2],l=this.matrix[3],u=this.matrix[4],h=this.matrix[5],f=this.matrix[6],p=this.matrix[7],g=this.matrix[8],m=this.matrix[9],d=this.matrix[10],x=this.matrix[11],_=this.matrix[12],v=this.matrix[13],y=this.matrix[14],w=this.matrix[15];return new mi(t*o+n*u+i*g+s*_,t*a+n*h+i*m+s*v,t*c+n*f+i*d+s*y,t*l+n*p+i*x+s*w)}MultiplyMatrix(e){let t=this.matrix[0],n=this.matrix[1],i=this.matrix[2],s=this.matrix[3],o=this.matrix[4],a=this.matrix[5],c=this.matrix[6],l=this.matrix[7],u=this.matrix[8],h=this.matrix[9],f=this.matrix[10],p=this.matrix[11],g=this.matrix[12],m=this.matrix[13],d=this.matrix[14],x=this.matrix[15],_=e.matrix[0],v=e.matrix[1],y=e.matrix[2],w=e.matrix[3],L=e.matrix[4],C=e.matrix[5],b=e.matrix[6],A=e.matrix[7],N=e.matrix[8],G=e.matrix[9],F=e.matrix[10],U=e.matrix[11],P=e.matrix[12],$=e.matrix[13],H=e.matrix[14],Z=e.matrix[15],W=[t*_+n*L+i*N+s*P,t*v+n*C+i*G+s*$,t*y+n*b+i*F+s*H,t*w+n*A+i*U+s*Z,o*_+a*L+c*N+l*P,o*v+a*C+c*G+l*$,o*y+a*b+c*F+l*H,o*w+a*A+c*U+l*Z,u*_+h*L+f*N+p*P,u*v+h*C+f*G+p*$,u*y+h*b+f*F+p*H,u*w+h*A+f*U+p*Z,g*_+m*L+d*N+x*P,g*v+m*C+d*G+x*$,g*y+m*b+d*F+x*H,g*w+m*A+d*U+x*Z];return new Gt(W)}};function iu(r,e){let t=r.Get(),n=e.Get();for(let i=0;i<16;i++)if(!Rt(t[i],n[i]))return!1;return!0}var Yt=class{constructor(e){e!=null?this.matrix=e:(this.matrix=new Gt,this.matrix.CreateIdentity())}SetMatrix(e){return this.matrix=e,this}GetMatrix(){return this.matrix}IsIdentity(){return this.matrix.IsIdentity()}AppendMatrix(e){return this.matrix=this.matrix.MultiplyMatrix(e),this}Append(e){return this.AppendMatrix(e.GetMatrix()),this}TransformCoord3D(e){let t=new mi(e.x,e.y,e.z,1),n=this.matrix.MultiplyVector(t);return new Ve(n.x,n.y,n.z)}Clone(){let e=this.matrix.Clone();return new Yt(e)}};function dm(r,e){return iu(r.GetMatrix(),e.GetMatrix())}var lr={Empty:0,TriangleMesh:1};function ss(r){return r.TriangleCount()>0?lr.TriangleMesh:lr.Empty}function Vs(r,e,t){let n=En(e,r),i=En(t,r),s=Vi(n,i);return s.Normalize(),s}function cr(r,e){if(!e.IsIdentity()){for(let t=0;t<r.VertexCount();t++){let n=r.GetVertex(t),i=e.TransformCoord3D(n);n.x=i.x,n.y=i.y,n.z=i.z}if(r.NormalCount()>0){let t=e.GetMatrix().InvertTranspose();if(t!==null){let n=new Yt(t);for(let i=0;i<r.NormalCount();i++){let s=r.GetNormal(i),o=n.TransformCoord3D(s);s.x=o.x,s.y=o.y,s.z=o.z}}}}}function ru(r){for(let e=0;e<r.TriangleCount();e++){let t=r.GetTriangle(e),n=t.v1;t.v1=t.v2,t.v2=n}}var wl=class{constructor(e){this.transformation=new Yt,this.isMeshVisible=t=>!0,bo(e,this)}},Oo=class{constructor(e,t){this.model=e,this.settings=t||new wl}GetModel(){return this.model}MaterialCount(){return this.model.MaterialCount()}GetMaterial(e){return this.model.GetMaterial(e)}VertexCount(){let e=0;return this.EnumerateMeshInstances(t=>{e+=t.VertexCount()}),e}TriangleCount(){let e=0;return this.EnumerateMeshInstances(t=>{e+=t.TriangleCount()}),e}MeshInstanceCount(){let e=0;return this.EnumerateMeshInstances(t=>{e+=1}),e}EnumerateMeshInstances(e){this.model.EnumerateMeshInstances(t=>{this.settings.isMeshVisible(t.GetId())&&e(t)})}EnumerateTransformedMeshes(e){this.EnumerateMeshInstances(t=>{let n=t.GetTransformation();this.settings.transformation.IsIdentity()||n.Append(this.settings.transformation);let s=t.GetMesh().Clone();n.IsIdentity()||cr(s,n),e(s)})}EnumerateVerticesAndTriangles(e){let t=[];this.EnumerateTransformedMeshes(i=>{t.push(i)});for(let i of t)i.EnumerateVertices(s=>{e.onVertex(s.x,s.y,s.z)});let n=0;for(let i of t)i.EnumerateTriangleVertexIndices((s,o,a)=>{e.onTriangle(s+n,o+n,a+n)}),n+=i.VertexCount()}EnumerateTrianglesWithNormals(e){this.EnumerateTransformedMeshes(t=>{t.EnumerateTriangleVertices((n,i,s)=>{let o=Vs(n,i,s);e(n,i,s,o)})})}};var ii=class{constructor(){this.text="",this.indentation=0}GetText(){return this.text}Indent(e){this.indentation+=e}WriteArrayLine(e){this.WriteLine(e.join(" "))}WriteLine(e){this.WriteIndentation(),this.Write(e+`
2`)}WriteIndentation(){for(let e=0;e<this.indentation;e++)this.Write("  ")}Write(e){this.text+=e}};var Do=class extends An{constructor(){super()}CanExport(e,t){return e===nn.Text&&t==="obj"}ExportContent(e,t,n,i){function s(g,m,d,x){if(d===null||!d.IsValid())return;let _=xn(d.name);if(g.WriteArrayLine([m,_]),x.findIndex(y=>y.GetName()===_)===-1){let y=new qt(_);y.SetBufferContent(d.buffer),x.push(y)}}let o=new qt("model.mtl"),a=new qt("model.obj");n.push(o),n.push(a);let c=new ii;c.WriteLine(this.GetHeaderText());for(let g=0;g<e.MaterialCount();g++){let m=e.GetMaterial(g);c.WriteArrayLine(["newmtl",this.GetExportedMaterialName(m.name)]),c.WriteArrayLine(["Kd",m.color.r/255,m.color.g/255,m.color.b/255]),c.WriteArrayLine(["d",m.opacity]),m.type===Dn.Phong&&(c.WriteArrayLine(["Ka",m.ambient.r/255,m.ambient.g/255,m.ambient.b/255]),c.WriteArrayLine(["Ks",m.specular.r/255,m.specular.g/255,m.specular.b/255]),c.WriteArrayLine(["Ns",m.shininess*1e3])),s(c,"map_Kd",m.diffuseMap,n),m.type===Dn.Phong&&s(c,"map_Ks",m.specularMap,n),s(c,"bump",m.bumpMap,n)}o.SetTextContent(c.GetText());let l=new ii;l.WriteLine(this.GetHeaderText()),l.WriteArrayLine(["mtllib",o.GetName()]);let u=0,h=0,f=0,p=null;e.EnumerateTransformedMeshes(g=>{l.WriteArrayLine(["g",this.GetExportedMeshName(g.GetName())]);for(let m=0;m<g.VertexCount();m++){let d=g.GetVertex(m);l.WriteArrayLine(["v",d.x,d.y,d.z])}for(let m=0;m<g.NormalCount();m++){let d=g.GetNormal(m);l.WriteArrayLine(["vn",d.x,d.y,d.z])}for(let m=0;m<g.TextureUVCount();m++){let d=g.GetTextureUV(m);l.WriteArrayLine(["vt",d.x,d.y])}for(let m=0;m<g.TriangleCount();
2m++){let d=g.GetTriangle(m),x=d.v0+u+1,_=d.v1+u+1,v=d.v2+u+1,y=d.n0+h+1,w=d.n1+h+1,L=d.n2+h+1;if(d.mat!==null){let N=e.GetMaterial(d.mat),G=this.GetExportedMaterialName(N.name);G!==p&&(l.WriteArrayLine(["usemtl",G]),p=G)}let C="",b="",A="";d.HasTextureUVs()&&(C=d.u0+f+1,b=d.u1+f+1,A=d.u2+f+1),l.WriteArrayLine(["f",[x,C,y].join("/"),[_,b,w].join("/"),[v,A,L].join("/")])}u+=g.VertexCount(),h+=g.NormalCount(),f+=g.TextureUVCount()}),a.SetTextContent(l.GetText()),i()}GetHeaderText(){return"# exported by https://3dviewer.net"}};var ko=class extends An{constructor(){super()}CanExport(e,t){return e===nn.Text&&t==="off"}ExportContent(e,t,n,i){let s=new qt("model.off");n.push(s);let o=new ii;o.WriteLine("OFF"),o.WriteArrayLine([e.VertexCount(),e.TriangleCount(),0]),e.EnumerateVerticesAndTriangles({onVertex:function(a,c,l){o.WriteArrayLine([a,c,l])},onTriangle:function(a,c,l){o.WriteArrayLine([3,a,c,l])}}),s.SetTextContent(o.GetText()),i()}};var Fo=class extends An{constructor(){super()}CanExport(e,t){return(e===nn.Text||e===nn.Binary)&&t==="ply"}ExportContent(e,t,n,i){t===nn.Text?this.ExportText(e,n):this.ExportBinary(e,n),i()}ExportText(e,t){let n=new qt("model.ply");t.push(n);let i=new ii,s=e.VertexCount(),o=e.TriangleCount(),a=this.GetHeaderText("ascii",s,o);i.Write(a),e.EnumerateVerticesAndTriangles({onVertex:function(c,l,u){i.WriteArrayLine([c,l,u])},onTriangle:function(c,l,u){i.WriteArrayLine([3,c,l,u])}}),n.SetTextContent(i.GetText())}ExportBinary(e,t){let n=new qt("model.ply");t.push(n);let i=e.VertexCount(),s=e.TriangleCount(),o=this.GetHeaderText("binary_little_endian",i,s),a=o.length+i*3*4+s*(1+3*4),c=new Hi(a,!0);for(let l=0;l<o.length;l++)c.WriteUnsignedCharacter8(o.charCodeAt(l));e.EnumerateVerticesAndTriangles({onVertex:function(l,u,h){c.WriteFloat32(l),c.WriteFloat32(u),c.WriteFloat32(h)},onTriangle:function(l,u,h){c.WriteUnsignedCharacter8(3),c.WriteInteger32(l),c.WriteInteger32(u),c.WriteInteger32(h)}}),n.SetBufferContent(c.GetBuffer())}GetHeaderText(e,t,n){let i=new ii;return i.WriteLine("ply"),i.WriteLine("format "+e+" 1.0"),i.WriteLine("element vertex "+t),i.WriteLine("property float x"),i.WriteLine("property float y"),i.WriteLine("property float z"),i.WriteLine("element face "+n),i.WriteLine("property list uchar int vertex_index"),i.WriteLine("end_header"),i.GetText()}};var Uo=class extends An{constructor(){super()}CanExport(e,t){return(e===nn.Text||e===nn.Binary)&&t==="stl"}ExportContent(e,t,n,i){t===nn.Text?this.ExportText(e,n):this.ExportBinary(e,n),i()}ExportText(e,t){let n=new qt("model.stl");t.push(n);let i=new ii;i.WriteLine("solid Model"),e.EnumerateTrianglesWithNormals((s,o,a,c)=>{i.WriteArrayLine(["facet","normal",c.x,c.y,c.z]),i.Indent(1),i.WriteLine("outer loop"),i.Indent(1),i.WriteArrayLine(["vertex",s.x,s.y,s.z]),i.WriteArrayLine(["vertex",o.x,o.y,o.z]),i.WriteArrayLine(["vertex",a.x,a.y,a.z]),i.Indent(-1),i.WriteLine("endloop"),i.Indent(-1),i.WriteLine("endfacet")}),i.WriteLine("endsolid Model"),n.SetTextContent(i.GetText())}ExportBinary(e,t){let n=new qt("model.stl");t.push(n);let i=e.TriangleCount(),s=80,o=s+4+i*50,a=new Hi(o,!0);for(let c=0;c<s;c++)a.WriteUnsignedCharacter8(0);a.WriteUnsignedInteger32(i),e.EnumerateTrianglesWithNormals((c,l,u,h)=>{a.WriteFloat32(h.x),a.WriteFloat32(h.y),a.WriteFloat32(h.z),a.WriteFloat32(c.x),a.WriteFloat32(c.y),a.WriteFloat32(c.z),a.WriteFloat32(l.x),a.WriteFloat32(l.y),a.WriteFloat32(l.z),a.WriteFloat32(u.x),a.WriteFloat32(u.y),a.WriteFloat32(u.z),a.WriteUnsignedInteger16(0)}),n.SetBufferContent(a.GetBuffer())}};var su=class{constructor(){this.exporters=[new Do,new Uo,new Fo,new ko,new Lo,new Ro,new Po]}AddExporter(e){this.exporters.push(e)}Export(e,t,n,i,s){let o=null;for(let c=0;c<this.exporters.length;c++){let l=this.exporters[c];if(l.CanExport(n,i)){o=l;break}}if(o===null){s.onError();return}let a=new Oo(e,t);o.Export(a,n,c=>{c.length===0?s.onError():s.onSuccess(c)})}};var Hs=class{constructor(e,t){this.min=e,this.max=t}GetMin(){return this.min}GetMax(){return this.max}GetCenter(){return new Ve((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,(this.min.z+this.max.z)/2)}},Bo=class{constructor(){this.box=new Hs(new Ve(1/0,1/0,1/0),new Ve(-1/0,-1/0,-1/0)),this.isValid=!1}GetBox(){return this.isValid?this.box:null}AddPoint(e){this.box.min.x=Math.min(this.box.min.x,e.x),this.box.min.y=Math.min(this.box.min.y,e.y),this.box.min.z=Math.min(this.box.min.z,e.z),this.box.max.x=Math.max(this.box.max.x,e.x),this.box.max.y=Math.max(this.box.max.y,e.y),this.box.max.z=Math.max(this.box.max.z,e.z),this.isValid=!0}};var Ws=class{constructor(e,t){this.boundingBox=e,this.level=t,this.pointItems=[],this.childNodes=[]}AddPoint(e,t,n){let i=this.FindNodeForPoint(e);if(i===null||i.FindPointDirectly(e)!==null)return!1;if(i.pointItems.length<n.maxPointsPerNode||i.level>=n.maxTreeDepth)return i.AddPointDirectly(e,t),!0;{i.CreateChildNodes();let s=i.pointItems;i.pointItems=[];for(let o=0;o<s.length;o++){let a=s[o];if(!i.AddPoint(a.point,a.data,n))return!1}return i.AddPoint(e,t,n)}}FindPoint(e){let t=this.FindNodeForPoint(e);return t===null?null:t.FindPointDirectly(e)}AddPointDirectly(e,t){this.pointItems.push({point:e,data:t})}FindPointDirectly(e){for(let t=0;t<this.pointItems.length;t++){let n=this.pointItems[t];if(pi(e,n.point))return n.data}return null}FindNodeForPoint(e){if(!this.IsPointInBounds(e))return null;if(this.childNodes.length===0)return this;for(let t=0;t<this.childNodes.length;t++){let i=this.childNodes[t].FindNodeForPoint(e);if(i!==null)return i}return null}CreateChildNodes(){function e(a,c,l,u,h,f,p){let g=new Hs(new Ve(c,l,u),new Ve(c+h,l+f,u+p));a.childNodes.push(new Ws(g,a.level+1))}let t=this.boundingBox.min,n=this.boundingBox.GetCenter(),i=(this.boundingBox.max.x-this.boundingBox.min.x)/2,s=(this.boundingBox.max.y-this.boundingBox.min.y)/2,o=(this.boundingBox.max.z-this.boundingBox.min.z)/2;e(this,t.x,t.y,t.z,i,s,o),e(this,n.x,t.y,t.z,i,s,o),e(this,t.x,n.y,t.z,i,s,o),e(this,n.x,n.y,t.z,i,s,o),e(this,t.x,t.y,n.z,i,s,o),e(this,n.x,t.y,n.z,i,s,o),e(this,t.x,n.y,n.z,i,s,o),e(this,n.x,n.y,n.z,i,s,o)}IsPointInBounds(e){return So(e.x,this.boundingBox.min.x)&&So(e.y,this.boundingBox.min.y)&&So(e.z,this.boundingBox.min.z)&&wo(e.x,this.boundingBox.max.x)&&wo(e.y,this.boundingBox.max.y)&&wo(e.z,this.boundingBox.max.z)}},Go=class{constructor(e,t){this.options={maxPointsPerNode:10,maxTreeDepth:10},t!==void 0&&(t.maxPointsPerNode!==void 0&&(this.options.maxPointsPerNode=t.maxPointsPerNode),t.maxTreeDepth!==void 0&&(this.options.maxTreeDepth=t.maxTreeDepth)),this.rootNode=new Ws(e,0)}AddPoint(e,t){return this.rootNode.AddPoint(e,t,this.options)}FindPoint(e){return this.rootNode.FindPoint(e)}};function pm(r,e,t){let n=e/t;return r*(n*n*(3-2*n))}function mm(r,e,t){return e*r/t}function ou(r,e,t){let n=e/t,i=n*n;return r*(i/(2*(i-n)+1))}function zo(r,e,t,n){let i=En(e,r).Normalize(),s=qn(r,e),o=[];for(let a=0;a<t;a++){let c=n(s,a,t-1);o.push(r.Clone().Offset(i,c))}return o}var Vo=class{constructor(e,t,n){this.name=e,this.source=t,this.data=n}};function au(r){let e=[];for(let t of r){let n=xn(t);e.push(new Vo(n,Gi.Url,t))}return e}function lu(r){let e=[];for(let t of r){let n=xn(t.name);e.push(new Vo(n,Gi.File,t))}return e}var js=class{constructor(e,t,n){this.name=xn(e),this.extension=rr(e),this.source=t,this.data=n,this.content=null}SetContent(e){this.content=e}},qs=class{constructor(){this.files=[]}FillFromInputFiles(e){this.files=[];for(let t of e){let n=new js(t.name,t.source,t.data);this.files.push(n)}}ExtendFromFileList(e){let t=e.GetFiles();for(let n=0;n<t.length;n++){let i=t[n];this.ContainsFileByPath(i.name)||this.files.push(i)}}GetFiles(){return this.files}GetContent(e){Vc(this.files.length,{runTask:(t,n)=>{e.onFileListProgress(t,this.files.length),this.GetFileContent(this.files[t],{onReady:n,onProgress:e.onFileLoadProgress})},onReady:e.onReady})}ContainsFileByPath(e){return this.FindFileByPath(e)!==null}FindFileByPath(e){let t=xn(e).toLowerCase();for(let n=0;n<this.files.length;n++){let i=this.files[n];if(i.name.toLowerCase()===t)return i}return null}
2IsOnlyUrlSource(){if(this.files.length===0)return!1;for(let e=0;e<this.files.length;e++){let t=this.files[e];if(t.source!==Gi.Url&&t.source!==Gi.Decompressed)return!1}return!0}AddFile(e){this.files.push(e)}GetFileContent(e,t){if(e.content!==null){t.onReady();return}let n=null;if(e.source===Gi.Url)n=qc(e.data,t.onProgress);else if(e.source===Gi.File)n=Xc(e.data,t.onProgress);else{t.onReady();return}n.then(i=>{e.SetContent(i)}).catch(()=>{}).finally(()=>{t.onReady()})}};var Sl=class{constructor(){}VertexCount(){return 0}VertexColorCount(){return 0}NormalCount(){return 0}TextureUVCount(){return 0}TriangleCount(){return 0}EnumerateVertices(e){}EnumerateTriangleVertexIndices(e){}EnumerateTriangleVertices(e){}},ur=class extends Sl{constructor(){super(),this.name="",this.propertyGroups=[]}GetName(){return this.name}SetName(e){this.name=e}PropertyGroupCount(){return this.propertyGroups.length}AddPropertyGroup(e){return this.propertyGroups.push(e),this.propertyGroups.length-1}GetPropertyGroup(e){return this.propertyGroups[e]}CloneProperties(e){for(let t of this.propertyGroups)e.AddPropertyGroup(t.Clone())}};var Lr=class{constructor(e,t){this.nodeId=e,this.meshIndex=t}IsEqual(e){return this.nodeId===e.nodeId&&this.meshIndex===e.meshIndex}
2GetKey(){return this.nodeId.toString()+":"+this.meshIndex.toString()}},Xs=class extends ur{constructor(e,t,n){super(),this.id=e,this.node=t,this.mesh=n}GetId(){return this.id}GetTransformation(){return this.node.GetWorldTransformation()}GetMesh(){return this.mesh}VertexCount(){return this.mesh.VertexCount()}VertexColorCount(){return this.mesh.VertexColorCount()}NormalCount(){return this.mesh.NormalCount()}TextureUVCount(){return this.mesh.TextureUVCount()}TriangleCount(){return this.mesh.TriangleCount()}EnumerateVertices(e){let t=this.node.GetWorldTransformation();t.IsIdentity()?this.mesh.EnumerateVertices(e):this.mesh.EnumerateVertices(n=>{let i=t.TransformCoord3D(n);e(i)})}EnumerateTriangleVertexIndices(e){this.mesh.EnumerateTriangleVertexIndices(e)}EnumerateTriangleVertices(e){let t=this.node.GetWorldTransformation();t.IsIdentity()?this.mesh.EnumerateTriangleVertices(e):this.mesh.EnumerateTriangleVertices((n,i,s)=>{let o=t.TransformCoord3D(n),a=t.TransformCoord3D(i),c=t.TransformCoord3D(s);e(o,a,c)})}PropertyGroupCount(){return this.mesh.PropertyGroupCount()}AddPropertyGroup(e){return this.mesh.AddPropertyGroup(e)}GetPropertyGroup(e){return this.mesh.GetPropertyGroup(e)}GetTransformedMesh(){let e=this.node.GetWorldTransformation(),t=this.mesh.Clone();return cr(t,e),t}};var $h=class{constructor(){this.nextId=0}GenerateId(){let e=this.nextId;return this.nextId+=1,e}},gi={GroupNode:0,MeshNode:1},In=class{constructor(){this.type=gi.GroupNode,this.name="",this.parent=null,this.transformation=new Yt,this.childNodes=[],this.meshIndices=[],this.idGenerator=new $h,this.id=this.idGenerator.GenerateId()}IsEmpty(){return this.childNodes.length===0&&this.meshIndices.length===0}GetType(){return this.type}SetType(e){this.type=e}GetId(){return this.id}GetName(){return this.name}SetName(e){this.name=e}HasParent(){return this.parent!==null}GetParent(){return this.parent}GetTransformation(){return this.transformation}GetWorldTransformation(){let e=this.transformation.Clone(),t=this.parent;for(;t!==null;)e.Append(t.transformation),t=t.parent;return e}SetTransformation(e){this.transformation=e}AddChildNode(e){return e.parent=this,e.idGenerator=this.idGenerator,e.id=e.idGenerator.GenerateId(),this.childNodes.push(e),this.childNodes.length-1}RemoveChildNode(e){e.parent=null;let t=this.childNodes.indexOf(e);this.childNodes.splice(t,1)}GetChildNodes(){return this.childNodes}ChildNodeCount(){return this.childNodes.length}GetChildNode(e){return this.childNodes[e]}AddMeshIndex(e){return this.meshIndices.push(e),this.meshIndices.length-1}MeshIndexCount(){return this.meshIndices.length}GetMeshIndex(e){return this.meshIndices[e]}GetMeshIndices(){return this.meshIndices}Enumerate(e){e(this);for(let t of this.childNodes)t.Enumerate(e)}EnumerateChildren(e){for(let t of this.childNodes)e(t),t.EnumerateChildren(e)}EnumerateMeshIndices(e){for(let t of this.meshIndices)e(t);for(let t of this.childNodes)t.EnumerateMeshIndices(e)}};var hr=class extends ur{constructor(){super(),this.root=new In,this.materials=[],this.meshes=[]}GetRootNode(){return this.root}MaterialCount(){return this.materials.length}MeshCount(){return this.meshes.length}MeshInstanceCount(){let e=0;return this.root.Enumerate(t=>{e+=t.MeshIndexCount()}),e}VertexCount(){let e=0;return this.EnumerateMeshInstances(t=>{e+=t.VertexCount()}),e}VertexColorCount(){let e=0;return this.EnumerateMeshInstances(t=>{e+=t.VertexColorCount()}),e}NormalCount(){let e=0;return this.EnumerateMeshInstances(t=>{e+=t.NormalCount()}),e}TextureUVCount(){let e=0;return this.EnumerateMeshInstances(t=>{e+=t.TextureUVCount()}),e}TriangleCount(){let e=0;return this.EnumerateMeshInstances(t=>{e+=t.TriangleCount()}),e}AddMaterial(e){return this.materials.push(e),this.materials.length-1}GetMaterial(e){return this.materials[e]}AddMesh(e){return this.meshes.push(e),this.meshes.length-1}AddMeshToRootNode(e){let t=this.AddMesh(e);return this.root.AddMeshIndex(t),t}RemoveMesh(e){this.meshes.splice(e,1),this.root.Enumerate(t=>{for(let n=0;n<t.meshIndices.length;n++)t.meshIndices[n]===e?(t.meshIndices.splice(n,1),n-=1):t.meshIndices[n]>e&&(t.meshIndices[n]-=1)})}GetMesh(e){return this.meshes[e]}GetMeshInstance(e){let t=null;if(this.root.Enumerate(o=>{o.GetId()===e.nodeId&&(t=o)}
2),t===null||t.GetMeshIndices().indexOf(e.meshIndex)===-1)return null;let i=this.GetMesh(e.meshIndex),s=new Lr(t.GetId(),e.meshIndex);return new Xs(s,t,i)}EnumerateMeshes(e){for(let t of this.meshes)e(t)}EnumerateMeshInstances(e){this.root.Enumerate(t=>{for(let n of t.GetMeshIndices()){let i=new Lr(t.GetId(),n),s=this.GetMesh(n),o=new Xs(i,t,s);e(o)}})}EnumerateTransformedMeshes(e){this.EnumerateMeshInstances(t=>{let n=t.GetTransformedMesh();e(n)})}EnumerateVertices(e){this.EnumerateMeshInstances(t=>{t.EnumerateVertices(e)})}EnumerateTriangleVertexIndices(e){this.EnumerateMeshInstances(t=>{t.EnumerateTriangleVertexIndices(e)})}EnumerateTriangleVertices(e){this.EnumerateMeshInstances(t=>{t.EnumerateTriangleVertices(e)})}};var El=class{constructor(){this.edges=[],this.triangles=[]}},Al=class{constructor(e,t){this.vertex1=e,this.vertex2=t,this.triangles=[]}},Cl=class{constructor(e,t){this.edge=e,this.reversed=t}},Il=class{constructor(){this.triEdge1=null,this.triEdge2=null,this.triEdge3=null}},Ho=class{constructor(){this.vertices=[],this.edges=[],this.triangleEdges=[],this.triangles=[],this.edgeStartToEndVertexMap=new Map}AddVertex(){return this.vertices.push(new El),this.vertices.length-1}AddTriangle(e,t,n){function i(l,u,h){l[u].triangles.push(h)}function s(l,u,h,f){let p=l[h],g=u[f];p.edges.push(g.edge)}function o(l,u,h,f){let p=u[h];l[p.edge].triangles.push(f)}let a=this.triangles.length,c=new Il;c.triEdge1=this.AddTriangleEdge(e,t),c.triEdge2=this.AddTriangleEdge(t,n),c.triEdge3=this.AddTriangleEdge(n,e),i(this.vertices,e,a),i(this.vertices,t,a),i(this.vertices,n,a),s(this.vertices,this.triangleEdges,e,c.triEdge1),s(this.vertices,this.triangleEdges,t,c.triEdge2),s(this.vertices,this.triangleEdges,n,c.triEdge3),o(this.edges,this.triangleEdges,c.triEdge1,a),o(this.edges,this.triangleEdges,c.triEdge2,a),o(this.edges,this.triangleEdges,c.triEdge3,a),this.triangles.push(c)}AddTriangleEdge(e,t){let n=e,i=t,s=!1;t<e&&(n=t,i=e,s=!0);let o=this.AddEdge(n,i);return this.triangleEdges.push(new Cl(o,s)),this.triangleEdges.length-1}AddEdge(e,t){this.edgeStartToEndVertexMap.has(e)||this.edgeStartToEndVertexMap.set(e,[]);let n=this.edgeStartToEndVertexMap.get(e);for(let s=0;s<n.length;s++){let o=n[s];if(o.endVertex===t)return o.edgeIndex}let i=this.edges.length;return n.push({endVertex:t,edgeIndex:i}),this.edges.push(new Al(e,t)),i}};function Wo(r){let e=!0;return r.EnumerateMeshInstances(t=>{ss(t)!==lr.Empty&&(e=!1)}),e}function Qh(r){let e=new Bo;return r.EnumerateVertices(t=>{e.AddPoint(t)}),e.GetBox()}function ef(r){function e(s,o,a){let c=o.FindPoint(s);return c===null&&(c=a.AddVertex(),o.AddPoint(s,c)),c}let t=Qh(r),n=new Go(t),i=new Ho;return r.EnumerateTriangleVertices((s,o,a)=>{let c=e(s,n,i),l=e(o,n,i),u=e(a,n,i);i.AddTriangle(c,l,u)}),i}function tf(r){function e(t,n,i){let s=t.triangles[n],o=t.triangleEdges[s.triEdge1],a=t.triangleEdges[s.triEdge2],c=t.triangleEdges[s.triEdge3];return o.edge===i?o.reversed:a.edge===i?a.reversed:c.edge===i?c.reversed:null}if(r instanceof hr){let t=!0;return r.EnumerateMeshInstances(n=>{t&&(t=tf(n))}),t}else{let t=ef(r);for(let n=0;n<t.edges.length;n++){let i=t.edges[n];if(i.triangles.length!==2)return!1;let s=e(t,i.triangles[0],n),o=e(t,i.triangles[1],n);if(s===null||o===null||s===o)return!1}return!0}}function gm(r){for(let e=0;e<r.MaterialCount();e++){let t=r.GetMaterial(e);if(t.isDefault&&!t.vertexColors)return!0}return!1}function xm(r,e){for(let t=0;t<r.MaterialCount();t++){let n=r.GetMaterial(t);n.isDefault&&(n.color=e)}}var jt=class extends ur{constructor(){super(),this.vertices=[],this.vertexColors=[],this.normals=[],this.uvs=[],this.triangles=[]}VertexCount(){return this.vertices.length}VertexColorCount(){return this.vertexColors.length}NormalCount(){return this.normals.length}TextureUVCount(){return this.uvs.length}TriangleCount(){return this.triangles.length}AddVertex(e){return this.vertices.push(e),this.vertices.length-1}SetVertex(e,t){this.vertices[e]=t}GetVertex(e){return this.vertices[e]}AddVertexColor(e){return this.vertexColors.push(e),this.vertexColors.length-1}SetVertexColor(e,t){this.vertexColors[e]=t}GetVertexColor(e){return this.vertexColors[e]}AddNormal(e){return this.normals.push(e),this.normals.length-1}SetNormal(e,t){this.normals[e]=t}GetNormal(e){return this.normals[e]}AddTextureUV(e){return this.uvs.push(e),this.uvs.length-1}SetTextureUV(e,t){this.uvs[e]=t}GetTextureUV(e){return this.uvs[e]}AddTriangle(e){return this.triangles.push(e),this.triangles.length-1}GetTriangle(e){return this.triangles[e]}EnumerateVertices(e){for(let t of this.vertices)e(t)}EnumerateTriangleVertexIndices(e){for(let t of this.triangles)e(t.v0,t.v1,t.v2)}EnumerateTriangleVertices(e){for(let t of this.triangles){let n=this.vertices[t.v0],i=this.vertices[t.v1],s=this.vertices[t.v2];e(n,i,s)}}Clone(){let e=new jt;e.SetName(this.GetName()),this.CloneProperties(e);for(let t=0;t<this.VertexCount();t++){let n=this.GetVertex(t);e.AddVertex(n.Clone())}for(let t=0;t<this.VertexColorCount();t++){let n=this.GetVertexColor(t);e.AddVertexColor(n.Clone())}for(let t=0;t<this.NormalCount();t++){let n=this.GetNormal(t);e.AddNormal(n.Clone())}for(let t=0;t<this.TextureUVCount();t++){let n=this.GetTextureUV(t);e.AddTextureUV(n.Clone())}for(let t=0;t<this.TriangleCount();t++){let n=this.GetTriangle(t);e.AddTriangle(n.Clone())}return e}};var Bt=class{constructor(e,t,n){this.v0=e,this.v1=t,this.v2=n,this.c0=null,this.c1=null,this.c2=null,this.n0=null,this.n1=null,this.n2=null,this.u0=null,this.u1=null,this.u2=null,this.mat=null,this.curve=null}HasVertices(){return this.v0!==null&&this.v1!==null&&this.v2!==null}HasVertexColors(){return this.c0!==null&&this.c1!==null&&this.c2!==null}HasNormals(){return this.n0!==null&&this.n1!==null&&this.n2!==null}HasTextureUVs(){return this.u0!==null&&this.u1!==null&&this.u2!==null}SetVertices(e,t,n){return this.v0=e,this.v1=t,this.v2=n,this}
vendor: 7,140 bytes, line 2
2SetVertexColors(e,t,n){return this.c0=e,this.c1=t,this.c2=n,this}SetNormals(e,t,n){return this.n0=e,this.n1=t,this.n2=n,this}SetTextureUVs(e,t,n){return this.u0=e,this.u1=t,this.u2=n,this}SetMaterial(e){return this.mat=e,this}SetCurve(e){return this.curve=e,this}Clone(){let e=new Bt(this.v0,this.v1,this.v2);return e.SetVertexColors(this.c0,this.c1,this.c2),e.SetNormals(this.n0,this.n1,this.n2),e.SetTextureUVs(this.u0,this.u1,this.u2),e.SetMaterial(this.mat),e.SetCurve(this.curve),e}};var Sd="147";var ry=0,ym=1,sy=2;var $g=1,oy=2,Dl=3,pr=0,Pn=1,kn=2,ms=0,la=1,vm=2,_m=3,bm=4,ay=5,sa=100,ly=101,cy=102,Tm=103,Mm=104,uy=200,hy=201,fy=202,dy=203,Qg=204,e0=205,py=206,my=207,gy=208,xy=209,yy=210,vy=0,_y=1,by=2,zf=3,Ty=4,My=5,wy=6,Sy=7,oh=0,Ey=1,Ay=2,Gr=0,Cy=1,Iy=2,Ry=3,Py=4,Ly=5,t0=300,fa=301,da=302,Vl=303,Vf=304,ah=306,$t=1e3,Wt=1001,pa=1002,_n=1003,wm=1004;var Sm=1005;var dn=1006,Ny=1007;var br=1008;var no=1009,Oy=1010,Dy=1011,n0=1012,ky=1013,Qs=1014,ps=1015,Hl=1016,Fy=1017,Uy=1018,ca=1020,By=1021,Gy=1022,Ei=1023,zy=1024,Vy=1025,eo=1026,ma=1027,Hy=1028,Wy=1029,jy=1030,qy=1031,Xy=1033,nf=33776,rf=33777,sf=33778,of=33779,Em=35840,Am=35841,Cm=35842,Im=35843,Yy=36196,Rm=37492,Pm=37496,Lm=37808,Nm=37809,Om=37810,Dm=37811,km=37812,Fm=37813,Um=37814,Bm=37815,Gm=37816,zm=37817,Vm=37818,Hm=37819,Wm=37820,jm=37821,qm=36492;var Gu=2300,zu=2301,af=2302,Xm=2400,Ym=2401,Zm=2402,Zy=2500;var io=3e3,It=3001,Ky=3200,Jy=3201,lh=0,$y=1;var fr="srgb",Wl="srgb-linear";var lf=7680;var Qy=519,Km=35044;var Jm="300 es",Hf=1035,xs=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let i=this._listeners[e];if(i!==void 0){let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let n=this._listeners[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}},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"],$m=1234567,ua=Math.PI/180,jl=180/Math.PI;function qr(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=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[n&255]+zn[n>>8&255]+zn[n>>16&255]+zn[n>>24&255]).toLowerCase()}function Vn(r,e,t){return Math.max(e,Math.min(t,r))}function Ed(r,e){return(r%e+e)%e}function ev(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function tv(r,e,t){return r!==e?(t-r)/(e-r):0}function Ul(r,e,t){return(1-t)*r+t*e}function nv(r,e,t,n){return Ul(r,e,1-Math.exp(-t*n))}function iv(r,e=1){return e-Math.abs(Ed(r,e*2)-e)}function rv(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function sv(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function ov(r,e){return r+Math.floor(Math.random()*(e-r+1))}function av(r,e){return r+Math.random()*(e-r)}function lv(r){return r*(.5-Math.random())}function cv(r){r!==void 0&&($m=r);let e=$m+=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 uv(r){return r*ua}function hv(r){return r*jl}function Wf(r){return(r&r-1)===0&&r!==0}function i0(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Vu(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function fv(r,e,t,n,i){let s=Math.cos,o=Math.sin,a=s(t/2),c=o(t/2),l=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),f=o((e-n)/2),p=s((n-e)/2),g=o((n-e)/2);switch(i){case"XYX":r.set(a*u,c*h,c*f,a*l);break;case"YZY":r.set(c*f,a*u,c*h,a*l);break;case"ZXZ":r.set(c*h,c*f,a*u,a*l);break;case"XZX":r.set(a*u,c*g,c*p,a*l);break;case"YXY":r.set(c*p,a*u,c*g,a*l);break;case"ZYZ":r.set(c*g,c*p,a*u,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function kl(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function ri(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var Bn=Object.freeze({__proto__:null,DEG2RAD:ua,RAD2DEG:jl,generateUUID:qr,clamp:Vn,euclideanModulo:Ed,mapLinear:ev,inverseLerp:tv,lerp:Ul,damp:nv,pingpong:iv,smoothstep:rv,smootherstep:sv,randInt:ov,randFloat:av,randFloatSpread:lv,seededRandom:cv,degToRad:uv,radToDeg:hv,isPowerOfTwo:Wf,ceilPowerOfTwo:i0,floorPowerOfTwo:Vu,setQuaternionFromProperEuler:fv,normalize:ri,denormalize:kl}),Ee=class{constructor(e=0,t=0){Ee.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}
vendor: 5,447 bytes, line 2
2sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,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 n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Jt=class{constructor(){Jt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,i,s,o,a,c,l){let u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=c,u[6]=n,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],u=n[4],h=n[7],f=n[2],p=n[5],g=n[8],m=i[0],d=i[3],x=i[6],_=i[1],v=i[4],y=i[7],w=i[2],L=i[5],C=i[8];return s[0]=o*m+a*_+c*w,s[3]=o*d+a*v+c*L,s[6]=o*x+a*y+c*C,s[1]=l*m+u*_+h*w,s[4]=l*d+u*v+h*L,s[7]=l*x+u*y+h*C,s[2]=f*m+p*_+g*w,s[5]=f*d+p*v+g*L,s[8]=f*x+p*y+g*C,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return t*o*u-t*a*l-n*s*u+n*a*c+i*s*l-i*o*c}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,f=a*c-u*s,p=l*s-o*c,g=t*h+n*f+i*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/g;return e[0]=h*m,e[1]=(i*l-u*n)*m,e[2]=(a*n-i*o)*m,e[3]=f*m,e[4]=(u*t-i*c)*m,e[5]=(i*s-a*t)*m,e[6]=p*m,e[7]=(n*c-l*t)*m,e[8]=(o*t-n*s)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,o,a){let c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-i*l,i*c,-i*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(cf.makeScale(e,t)),this}rotate(e){return this.premultiply(cf.makeRotation(-e)),this}translate(e,t){return this.premultiply(cf.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}
vendor: 8,004 bytes, line 2
2,cf=new Jt;function r0(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function ql(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function to(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Bu(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var uf={[fr]:{[Wl]:to},[Wl]:{[fr]:Bu}},Yn={legacyMode:!0,get workingColorSpace(){return Wl},set workingColorSpace(r){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(r,e,t){if(this.legacyMode||e===t||!e||!t)return r;if(uf[e]&&uf[e][t]!==void 0){let n=uf[e][t];return r.r=n(r.r),r.g=n(r.g),r.b=n(r.b),r}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)}},s0={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},vn={r:0,g:0,b:0},Wi={h:0,s:0,l:0},cu={h:0,s:0,l:0};function hf(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}function uu(r,e){return e.r=r.r,e.g=r.g,e.b=r.b,e}var $e=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Yn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Yn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Yn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Yn.workingColorSpace){if(e=Ed(e,1),t=Vn(t,0,1),n=Vn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=hf(o,s,e+1/3),this.g=hf(o,s,e),this.b=hf(o,s,e-1/3)}return Yn.toWorkingColorSpace(this,i),this}setStyle(e,t=fr){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s,o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,Yn.toWorkingColorSpace(this,t),n(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,Yn.toWorkingColorSpace(this,t),n(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){let c=parseFloat(s[1])/360,l=parseFloat(s[2])/100,u=parseFloat(s[3])/100;return n(s[4]),this.setHSL(c,l,u,t)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=i[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,Yn.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,Yn.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=fr){let n=s0[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=to(e.r),this.g=to(e.g),this.b=to(e.b),this}copyLinearToSRGB(e){return this.r=Bu(e.r),this.g=Bu(e.g),this.b=Bu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=fr){return Yn.fromWorkingColorSpace(uu(this,vn),e),Vn(vn.r*255,0,255)<<16^Vn(vn.g*255,0,255)<<8^Vn(vn.b*255,0,255)<<0}getHexString(e=fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Yn.workingColorSpace){Yn.fromWorkingColorSpace(uu(this,vn),t);let n=vn.r,i=vn.g,s=vn.b,o=Math.max(n,i,s),a=Math.min(n,i,s),c,l,u=(a+o)/2;if(a===o)c=0,l=0;else{let h=o-a;switch(l=u<=.5?h/(o+a):h/(2-o-a),o){case n:c=(i-s)/h+(i<s?6:0);break;case i:c=(s-n)/h+2;break;case s:c=(n-i)/h+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,t=Yn.workingColorSpace){return Yn.fromWorkingColorSpace(uu(this,vn),t),e.r=vn.r,e.g=vn.g,e.b=vn.b,e}getStyle(e=fr){return Yn.fromWorkingColorSpace(uu(this,vn),e),e!==fr?`color(${e} ${vn.r} ${vn.g} ${vn.b})`:`rgb(${vn.r*255|0},${vn.g*255|0},${vn.b*255|0})`}offsetHSL(e,t,n){return this.getHSL(Wi),Wi.h+=e,Wi.s+=t,Wi.l+=n,this.setHSL(Wi.h,Wi.s,Wi.l),this}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}
vendor: 4,962 bytes, line 2
2lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Wi),e.getHSL(cu);let n=Ul(Wi.h,cu.h,t),i=Ul(Wi.s,cu.s,t),s=Ul(Wi.l,cu.l,t);return this.setHSL(n,i,s),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}};$e.NAMES=s0;var jo,ro=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{jo===void 0&&(jo=ql("canvas")),jo.width=e.width,jo.height=e.height;let n=jo.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=jo}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=ql("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=to(s[o]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(to(t[n]/255)*255):t[n]=to(t[n]);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}},Hu=class{constructor(e=null){this.isSource=!0,this.uuid=qr(),this.data=e,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 n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(ff(i[o].image)):s.push(ff(i[o]))}else s=ff(i);n.url=s}return t||(e.images[this.uuid]=n),n}};function ff(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?ro.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 dv=0,pn=class extends xs{constructor(e=pn.DEFAULT_IMAGE,t=pn.DEFAULT_MAPPING,n=Wt,i=Wt,s=dn,o=br,a=Ei,c=no,l=pn.DEFAULT_ANISOTROPY,u=io){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:dv++}),this.uuid=qr(),this.name="",this.source=new Hu(e),this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new Ee(0,0),this.repeat=new Ee(1,1),this.center=new Ee(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Jt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.t
vendor: 4,788 bytes, line 2
2ype,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==t0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case $t:e.x=e.x-Math.floor(e.x);break;case Wt:e.x=e.x<0?0:1;break;case pa:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case $t:e.y=e.y-Math.floor(e.y);break;case Wt:e.y=e.y<0?0:1;break;case pa:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}};pn.DEFAULT_IMAGE=null;pn.DEFAULT_MAPPING=t0;pn.DEFAULT_ANISOTROPY=1;var St=class{constructor(e=0,t=0,n=0,i=1){St.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s,c=e.elements,l=c[0],u=c[4],h=c[8],f=c[1],p=c[5],g=c[9],m=c[2],d=c[6],x=c[10];if(Math.abs(u-f)<.01&&Math.abs(h-m)<.01&&Math.abs(g-d)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+m)<.1&&Math.abs(g+d)<.1&&Math.abs(l+p+x-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let v=(l+1)/2,y=(p+1)/2,w=(x+1)/2,L=(u+f)/4,C=(h+m)/4,b=(g+d)/4;return v>y&&v>w?v<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(v),i=L/n,s=C/n):y>w?y<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(y),n=L/i,s=b/i):w<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(w),n=C/s,i=b/s),this.set(n,i,s,t),this}let _=Math.sqrt((d-g)*(d-g)+(h-m)*(h-m)+(f-u)*(f-u));return Math.abs(_)<.001&&(_=1),this.x=(d-g)/_,this.y=(h-m)/_,this.z=(f-u)/_,this.w=Math.acos((l+p+x-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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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}
vendor: 10,442 bytes, line 2
2round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,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}},zr=class extends xs{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new St(0,0,e,t),this.scissorTest=!1,this.viewport=new St(0,0,e,t);let i={width:e,height:t,depth:1};this.texture=new pn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:dn,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,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.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new Hu(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"})}},Wu=class extends pn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=_n,this.minFilter=_n,this.wrapR=Wt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var jf=class extends pn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=_n,this.minFilter=_n,this.wrapR=Wt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var mn=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,o,a){let c=n[i+0],l=n[i+1],u=n[i+2],h=n[i+3],f=s[o+0],p=s[o+1],g=s[o+2],m=s[o+3];if(a===0){e[t+0]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=p,e[t+2]=g,e[t+3]=m;return}if(h!==m||c!==f||l!==p||u!==g){let d=1-a,x=c*f+l*p+u*g+h*m,_=x>=0?1:-1,v=1-x*x;if(v>Number.EPSILON){let w=Math.sqrt(v),L=Math.atan2(w,x*_);d=Math.sin(d*L)/w,a=Math.sin(a*L)/w}let y=a*_;if(c=c*d+f*y,l=l*d+p*y,u=u*d+g*y,h=h*d+m*y,d===1-a){let w=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=w,l*=w,u*=w,h*=w}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,o){let a=n[i],c=n[i+1],l=n[i+2],u=n[i+3],h=s[o],f=s[o+1],p=s[o+2],g=s[o+3];return e[t]=a*g+u*h+c*p-l*f,e[t+1]=c*g+u*f+l*h-a*p,e[t+2]=l*g+u*p+a*f-c*h,e[t+3]=u*g-a*h-c*f-l*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,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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){let n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),u=a(i/2),h=a(s/2),f=c(n/2),p=c(i/2),g=c(s/2);switch(o){case"XYZ":this._x=f*u*h+l*p*g,this._y=l*p*h-f*u*g,this._z=l*u*g+f*p*h,this._w=l*u*h-f*p*g;break;case"YXZ":this._x=f*u*h+l*p*g,this._y=l*p*h-f*u*g,this._z=l*u*g-f*p*h,this._w=l*u*h+f*p*g;break;case"ZXY":this._x=f*u*h-l*p*g,this._y=l*p*h+f*u*g,this._z=l*u*g+f*p*h,this._w=l*u*h-f*p*g;break;case"ZYX":this._x=f*u*h-l*p*g,this._y=l*p*h+f*u*g,this._z=l*u*g-f*p*h,this._w=l*u*h+f*p*g;break;case"YZX":this._x=f*u*h+l*p*g,this._y=l*p*h+f*u*g,this._z=l*u*g-f*p*h,this._w=l*u*h-f*p*g;break;case"XZY":this._x=f*u*h-l*p*g,this._y=l*p*h-f*u*g,this._z=l*u*g+f*p*h,this._w=l*u*h+f*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],c=t[9],l=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){let p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(u-c)*p,this._y=(s-l)*p,this._z=(o-i)*p}else if(n>a&&n>h){let p=2*Math.sqrt(1+n-a-h);this._w=(u-c)/p,this._x=.25*p,this._y=(i+o)/p,this._z=(s+l)/p}else if(a>h){let p=2*Math.sqrt(1+a-n-h);this._w=(s-l)/p,this._x=(i+o)/p,this._y=.25*p,this._z=(c+u)/p}else{let p=2*Math.sqrt(1+h-n-a);this._w=(o-i)/p,this._x=(s+l)/p,this._y=(c+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Vn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),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 n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,c=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+i*l-s*c,this._y=i*u+o*c+s*a-n*l,this._z=s*u+o*l+n*c-i*a,this._w=o*u-n*a-i*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,i=this._y,s=this._z,o=this._w,a=o*e._w+n*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=s,this;let c=1-a*a;if(c<=Number.EPSILON){let p=1-t;return this._w=p*o+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*s+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(c),u=Math.atan2(l,a),h=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=o*h+this._w*f,this._x=n*h+this._x*f,this._y=i*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},ae=class{constructor(e=0,t=0,n=0){ae.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw 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}
vendor: 10,684 bytes, line 2
2sub(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(Qm.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qm.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,c=e.w,l=c*t+o*i-a*n,u=c*n+a*t-s*i,h=c*i+s*n-o*t,f=-s*t-o*n-a*i;return this.x=l*c+f*-s+u*-a-h*-o,this.y=u*c+f*-o+h*-s-l*-a,this.z=h*c+f*-a+l*-o-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-s*a,this.y=s*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return df.copy(this).projectOnVector(e),this.sub(df)}reflect(e){return this.sub(df.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 n=this.dot(e)/t;return Math.acos(Vn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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}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()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},df=new ae,Qm=new mn,mr=class{constructor(e=new ae(1/0,1/0,1/0),t=new ae(-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){let t=1/0,n=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let c=0,l=e.length;c<l;c+=3){let u=e[c],h=e[c+1],f=e[c+2];u<t&&(t=u),h<n&&(n=h),f<i&&(i=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,n,i),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let c=0,l=e.count;c<l;c++){let u=e.getX(c),h=e.getY(c),f=e.getZ(c);u<t&&(t=u),h<n&&(n=h),f<i&&(i=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,n,i),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Ys.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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 n=e.geometry;if(n!==void 0)if(t&&n.attributes!=null&&n.attributes.position!==void 0){let s=n.attributes.position;for(let o=0,a=s.count;o<a;o++)Ys.fromBufferAttribute(s,o).applyMatrix4(e.matrixWorld),this.expandByPoint(Ys)}else n.boundingBox===null&&n.computeBoundingBox(),pf.copy(n.boundingBox),pf.applyMatrix4(e.matrixWorld),this.union(pf);let i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],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,Ys),Ys.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Rl),hu.subVectors(this.max,Rl),qo.subVectors(e.a,Rl),Xo.subVectors(e.b,Rl),Yo.subVectors(e.c,Rl),os.subVectors(Xo,qo),as.subVectors(Yo,Xo),Zs.subVectors(qo,Yo);let t=[0,-os.z,os.y,0,-as.z,as.y,0,-Zs.z,Zs.y,os.z,0,-os.x,as.z,0,-as.x,Zs.z,0,-Zs.x,-os.y,os.x,0,-as.y,as.x,0,-Zs.y,Zs.x,0];return!mf(t,qo,Xo,Yo,hu)||(t=[1,0,0,0,1,0,0,0,1],!mf(t,qo,Xo,Yo,hu))?!1:(fu.crossVectors(os,as),t=[fu.x,fu.y,fu.z],mf(t,qo,Xo,Yo,hu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ys.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Ys).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:(Nr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Nr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Nr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Nr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Nr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Nr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Nr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Nr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Nr),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)}},Nr=[new ae,new ae,new ae,new ae,new ae,new ae,new ae,new ae],Ys=new ae,pf=new mr,qo=new ae,Xo=new ae,Yo=new ae,os=new ae,as=new ae,Zs=new ae,Rl=new ae,hu=new ae,fu=new ae,Ks=new ae;function mf(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Ks.fromArray(r,s);let a=i.x*Math.abs(Ks.x)+i.y*Math.abs(Ks.y)+i.z*Math.abs(Ks.z),c=e.dot(Ks),l=t.dot(Ks),u=n.dot(Ks);
vendor: 4,195 bytes, line 2
2if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}var pv=new mr,Pl=new ae,gf=new ae,Vr=class{constructor(e=new ae,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):pv.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(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;Pl.subVectors(e,this.center);let t=Pl.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Pl,i/n),this.radius+=i}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):(gf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Pl.copy(e.center).add(gf)),this.expandByPoint(Pl.copy(e.center).sub(gf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},Or=new ae,xf=new ae,du=new ae,ls=new ae,yf=new ae,pu=new ae,vf=new ae,ga=class{constructor(e=new ae,t=new ae(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.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Or)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Or.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Or.copy(this.direction).multiplyScalar(t).add(this.origin),Or.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){xf.copy(e).add(t).multiplyScalar(.5),du.copy(t).sub(e).normalize(),ls.copy(this.origin).sub(xf);let s=e.distanceTo(t)*.5,o=-this.direction.dot(du),a=ls.dot(this.direction),c=-ls.dot(du),l=ls.lengthSq(),u=Math.abs(1-o*o),h,f,p,g;if(u>0)if(h=o*c-a,f=o*a-c,g=s*u,h>=0)if(f>=-g)if(f<=g){let m=1/u;h*=m,f*=m,p=h*(h+o*f+2*a)+f*(o*h+f+2*c)+l}else f=s,h=Math.max(0,-(o*f+a)),p=-h*h+f*(f+2*c)+l;else f=-s,h=Math.max(0,-(o*f+a)),p=-h*h+f*(f+2*c)+l;else f<=-g?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-c),s),p=-h*h+f*(f+2*c)+l):f<=g?(h=0,f=Math.min(Math.max(-s,-c),s),p=f*(f+2*c)+l):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-c),s),p=-h*h+f*(f+2*c)+l);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),p=-h*h+f*(f+2*c)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(du).multiplyScalar(f).add(xf),p}intersectSphere(e,t){Or.subVectors(e.center,this.origin);let n=Or.dot(this.direction),i=Or.dot(Or)-n*n,s=e.radius*e.radius;if(i>s)return null;let o=Math.sqrt(s-i),a=n-o,c=n+o;return a<0&&c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radiu
vendor: 14,516 bytes, line 2
2s}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,c,l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return l>=0?(n=(e.min.x-f.x)*l,i=(e.max.x-f.x)*l):(n=(e.max.x-f.x)*l,i=(e.min.x-f.x)*l),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o<i||isNaN(i))&&(i=o),h>=0?(a=(e.min.z-f.z)*h,c=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,c=(e.min.z-f.z)*h),n>c||a>i)||((a>n||n!==n)&&(n=a),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Or)!==null}intersectTriangle(e,t,n,i,s){yf.subVectors(t,e),pu.subVectors(n,e),vf.crossVectors(yf,pu);let o=this.direction.dot(vf),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ls.subVectors(this.origin,e);let c=a*this.direction.dot(pu.crossVectors(ls,pu));if(c<0)return null;let l=a*this.direction.dot(yf.cross(ls));if(l<0||c+l>o)return null;let u=-a*ls.dot(vf);return u<0?null:this.at(u/o,s)}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)}},Xe=class{constructor(){Xe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,i,s,o,a,c,l,u,h,f,p,g,m,d){let x=this.elements;return x[0]=e,x[4]=t,x[8]=n,x[12]=i,x[1]=s,x[5]=o,x[9]=a,x[13]=c,x[2]=l,x[6]=u,x[10]=h,x[14]=f,x[3]=p,x[7]=g,x[11]=m,x[15]=d,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 Xe().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,i=1/Zo.setFromMatrixColumn(e,0).length(),s=1/Zo.setFromMatrixColumn(e,1).length(),o=1/Zo.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),l=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){let f=o*u,p=o*h,g=a*u,m=a*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=p+g*l,t[5]=f-m*l,t[9]=-a*c,t[2]=m-f*l,t[6]=g+p*l,t[10]=o*c}else if(e.order==="YXZ"){let f=c*u,p=c*h,g=l*u,m=l*h;t[0]=f+m*a,t[4]=g*a-p,t[8]=o*l,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=p*a-g,t[6]=m+f*a,t[10]=o*c}else if(e.order==="ZXY"){let f=c*u,p=c*h,g=l*u,m=l*h;t[0]=f-m*a,t[4]=-o*h,t[8]=g+p*a,t[1]=p+g*a,t[5]=o*u,t[9]=m-f*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){let f=o*u,p=o*h,g=a*u,m=a*h;t[0]=c*u,t[4]=g*l-p,t[8]=f*l+m,t[1]=c*h,t[5]=m*l+f,t[9]=p*l-g,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){let f=o*c,p=o*l,g=a*c,m=a*l;t[0]=c*u,t[4]=m-f*h,t[8]=g*h+p,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=p*h+g,t[10]=f-m*h}else if(e.order==="XZY"){let f=o*c,p=o*l,g=a*c,m=a*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=f*h+m,t[5]=o*u,t[9]=p*h-g,t[2]=g*h-p,t[6]=a*u,t[10]=m*h+f}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(mv,e,gv)}lookAt(e,t,n){let i=this.elements;return xi.subVectors(e,t),xi.lengthSq()===0&&(xi.z=1),xi.normalize(),cs.crossVectors(n,xi),cs.lengthSq()===0&&(Math.abs(n.z)===1?xi.x+=1e-4:xi.z+=1e-4,xi.normalize(),cs.crossVectors(n,xi)),cs.normalize(),mu.crossVectors(xi,cs),i[0]=cs.x,i[4]=mu.x,i[8]=xi.x,i[1]=cs.y,i[5]=mu.y,i[9]=xi.y,i[2]=cs.z,i[6]=mu.z,i[10]=xi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],u=n[1],h=n[5],f=n[9],p=n[13],g=n[2],m=n[6],d=n[10],x=n[14],_=n[3],v=n[7],y=n[11],w=n[15],L=i[0],C=i[4],b=i[8],A=i[12],N=i[1],G=i[5],F=i[9],U=i[13],P=i[2],$=i[6],H=i[10],Z=i[14],W=i[3],oe=i[7],ue=i[11],ne=i[15];return s[0]=o*L+a*N+c*P+l*W,s[4]=o*C+a*G+c*$+l*oe,s[8]=o*b+a*F+c*H+l*ue,s[12]=o*A+a*U+c*Z+l*ne,s[1]=u*L+h*N+f*P+p*W,s[5]=u*C+h*G+f*$+p*oe,s[9]=u*b+h*F+f*H+p*ue,s[13]=u*A+h*U+f*Z+p*ne,s[2]=g*L+m*N+d*P+x*W,s[6]=g*C+m*G+d*$+x*oe,s[10]=g*b+m*F+d*H+x*ue,s[14]=g*A+m*U+d*Z+x*ne,s[3]=_*L+v*N+y*P+w*W,s[7]=_*C+v*G+y*$+w*oe,s[11]=_*b+v*F+y*H+w*ue,s[15]=_*A+v*U+y*Z+w*ne,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],f=e[10],p=e[14],g=e[3],m=e[7],d=e[11],x=e[15];return g*(+s*c*h-i*l*h-s*a*f+n*l*f+i*a*p-n*c*p)+m*(+t*c*p-t*l*f+s*o*f-i*o*p+i*l*u-s*c*u)+d*(+t*l*h-t*a*p-s*o*h+n*o*p+s*a*u-n*l*u)+x*(-i*a*u-t*c*h+t*a*f+i*o*h-n*o*f+n*c*u)}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,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],f=e[10],p=e[11],g=e[12],m=e[13],d=e[14],x=e[15],_=h*d*l-m*f*l+m*c*p-a*d*p-h*c*x+a*f*x,v=g*f*l-u*d*l-g*c*p+o*d*p+u*c*x-o*f*x,y=u*m*l-g*h*l+g*a*p-o*m*p-u*a*x+o*h*x,w=g*h*c-u*m*c-g*a*f+o*m*f+u*a*d-o*h*d,L=t*_+n*v+i*y+s*w;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let C=1/L;return e[0]=_*C,e[1]=(m*f*s-h*d*s-m*i*p+n*d*p+h*i*x-n*f*x)*C,e[2]=(a*d*s-m*c*s+m*i*l-n*d*l-a*i*x+n*c*x)*C,e[3]=(h*c*s-a*f*s-h*i*l+n*f*l+a*i*p-n*c*p)*C,e[4]=v*C,e[5]=(u*d*s-g*f*s+g*i*p-t*d*p-u*i*x+t*f*x)*C,e[6]=(g*c*s-o*d*s-g*i*l+t*d*l+o*i*x-t*c*x)*C,e[7]=(o*f*s-u*c*s+u*i*l-t*f*l-o*i*p+t*c*p)*C,e[8]=y*C,e[9]=(g*h*s-u*m*s-g*n*p+t*m*p+u*n*x-t*h*x)*C,e[10]=(o*m*s-g*a*s+g*n*l-t*m*l-o*n*x+t*a*x)*C,e[11]=(u*a*s-o*h*s-u*n*l+t*h*l+o*n*p-t*a*p)*C,e[12]=w*C,e[13]=(u*m*i-g*h*i+g*n*f-t*m*f-u*n*d+t*h*d)*C,e[14]=(g*a*i-o*m*i-g*n*c+t*m*c+o*n*d-t*a*d)*C,e[15]=(o*h*i-u*a*i+u*n*c-t*h*c-o*n*f+t*a*f)*C,this}scale(e){let t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,c=e.z,l=s*o,u=s*a;return this.set(l*o+n,l*a-i*c,l*c+i*a,0,l*a+i*c,u*a+n,u*c-i*o,0,l*c-i*a,u*c+i*o,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,s=t._x,o=t._y,a=t._z,c=t._w,l=s+s,u=o+o,h=a+a,f=s*l,p=s*u,g=s*h,m=o*u,d=o*h,x=a*h,_=c*l,v=c*u,y=c*h,w=n.x,L=n.y,C=n.z;return i[0]=(1-(m+x))*w,i[1]=(p+y)*w,i[2]=(g-v)*w,i[3]=0,i[4]=(p-y)*L,i[5]=(1-(f+x))*L,i[6]=(d+_)*L,i[7]=0,i[8]=(g+v)*C,i[9]=(d-_)*C,i[10]=(1-(f+m))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements,s=Zo.set(i[0],i[1],i[2]).length(),o=Zo.set(i[4],i[5],i[6]).length(),a=Zo.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],ji.copy(this);let l=1/s,u=1/o,h=1/a;return ji.elements[0]*=l,ji.elements[1]*=l,ji.elements[2]*=l,ji.elements[4]*=u,ji.elements[5]*=u,ji.elements[6]*=u,ji.elements[8]*=h,ji.elements[9]*=h,ji.elements[10]*=h,t.setFromRotationMatrix(ji),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o){let a=this.elements,c=2*s/(t-e),l=2*s/(n-i),u=(t+e)/(t-e),h=(n+i)/(n-i),f=-(o+s)/(o-s),p=-2*o*s/(o-s);return a[0]=c,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=f,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,s,o){let a=this.elements,c=1/(t-e),l=1/(n-i),u=1/(o-s),h=(t+e)*c,f=(n+i)*l,p=(o+s)*u;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-f,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Zo=new ae,ji=new Xe,mv=new ae(0,0,0),gv=new ae(1,1,1),cs=new ae,mu=new ae,xi=new ae,eg=new Xe,tg=new mn,Ln=class{constructor(e=0,t=0,n=0,i=Ln.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,s=i[0],o=i[4],a=i[8],c=i[1],l=i[5],u=i[9],h=i[2],f=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(Vn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Vn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Vn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Vn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Vn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Vn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return eg.makeRotationFromQuaternion(e),this.setFromRotationMatrix(eg,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return tg.setFromEuler(this),this.setFromQuaternion(tg,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[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._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}};Ln.DefaultOrder="XYZ";Ln.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Xl=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}},xv=0,ng=new ae,Ko=new mn,Dr=new Xe,gu=new ae,Ll=new ae,yv=new ae,vv=new mn,ig=new ae(1,0,0),rg=new ae(0,1,0),sg=new ae(0,0,1),_v={type:"added"},og={type:"removed"},xt=class extends xs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:xv++}),this.uuid=qr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=xt.DefaultUp.clone();let e=new ae,t=new Ln,n=new mn,i=new ae(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Xe},normalMatrix:{value:new Jt}}),this.matrix=new Xe,this.matrixWorld=new Xe,this.matrixAutoUpdate=xt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=xt.DefaultMatrixWorldAutoUpdate,this.layers=new Xl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
2setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ko.setFromAxisAngle(e,t),this.quaternion.multiply(Ko),this}rotateOnWorldAxis(e,t){return Ko.setFromAxisAngle(e,t),this.quaternion.premultiply(Ko),this}rotateX(e){return this.rotateOnAxis(ig,e)}rotateY(e){return this.rotateOnAxis(rg,e)}rotateZ(e){return this.rotateOnAxis(sg,e)}translateOnAxis(e,t){return ng.copy(e).applyQuaternion(this.quaternion),this.position.add(ng.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ig,e)}translateY(e){return this.translateOnAxis(rg,e)}translateZ(e){return this.translateOnAxis(sg,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(Dr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?gu.copy(e):gu.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),Ll.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Dr.lookAt(Ll,gu,this.up):Dr.lookAt(gu,Ll,this.up),this.quaternion.setFromRotationMatrix(Dr),i&&(Dr.extractRotation(i.matrixWorld),Ko.setFromRotationMatrix(Dr),this.quaternion.premultiply(Ko.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(_v)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(og)),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(og)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Dr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Dr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Dr),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ll,e,yv),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ll,vv,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++){let s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let n=this.parent;if(e===!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),t===!0){let i=this.children;for(let s=0,o=i.length;s<o;s++){let a=i[s];a.matrixWorldAutoUpdate===!0&&a.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let i={};
vendor: 7,746 bytes, line 2
2i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){let h=c[l];s(e.shapes,h)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(s(e.materials,this.material[c]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let c=this.animations[a];i.animations.push(s(e.animations,c))}}if(t){let a=o(e.geometries),c=o(e.materials),l=o(e.textures),u=o(e.images),h=o(e.shapes),f=o(e.skeletons),p=o(e.animations),g=o(e.nodes);a.length>0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=i,n;function o(a){let c=[];for(let l in a){let u=a[l];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};xt.DefaultUp=new ae(0,1,0);xt.DefaultMatrixAutoUpdate=!0;xt.DefaultMatrixWorldAutoUpdate=!0;var qi=new ae,kr=new ae,_f=new ae,Fr=new ae,Jo=new ae,$o=new ae,ag=new ae,bf=new ae,Tf=new ae,Mf=new ae,Ai=class{constructor(e=new ae,t=new ae,n=new ae){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),qi.subVectors(e,t),i.cross(qi);let s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){qi.subVectors(i,t),kr.subVectors(n,t),_f.subVectors(e,t);let o=qi.dot(qi),a=qi.dot(kr),c=qi.dot(_f),l=kr.dot(kr),u=kr.dot(_f),h=o*l-a*a;if(h===0)return s.set(-2,-1,-1);let f=1/h,p=(l*c-a*u)*f,g=(o*u-a*c)*f;return s.set(1-p-g,g,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Fr),Fr.x>=0&&Fr.y>=0&&Fr.x+Fr.y<=1}static getUV(e,t,n,i,s,o,a,c){return this.getBarycoord(e,t,n,i,Fr),c.set(0,0),c.addScaledVector(s,Fr.x),c.addScaledVector(o,Fr.y),c.addScaledVector(a,Fr.z),c}static isFrontFacing(e,t,n,i){return qi.subVectors(n,t),kr.subVectors(e,t),qi.cross(kr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 qi.subVectors(this.c,this.b),kr.subVectors(this.a,this.b),qi.cross(kr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ai.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ai.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return Ai.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Ai.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ai.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,s=this.c,o,a;Jo.subVectors(i,n),$o.subVectors(s,n),bf.subVectors(e,n);let c=Jo.dot(bf),l=$o.dot(bf);if(c<=0&&l<=0)return t.copy(n);Tf.subVectors(e,i);let u=Jo.dot(Tf),h=$o.dot(Tf);if(u>=0&&h<=u)return t.copy(i);let f=c*h-u*l;if(f<=0&&c>=0&&u<=0)return o=c/(c-u),t.copy(n).addScaledVector(Jo,o);Mf.subVectors(e,s);let p=Jo.dot(Mf),g=$o.dot(Mf);if(g>=0&&p<=g)return t.copy(s);let m=p*l-c*g;if(m<=0&&l>=0&&g<=0)return a=l/(l-g),t.copy(n).addScaledVector($o,a);let d=u*g-p*h;if(d<=0&&h-u>=0&&p-g>=0)return ag.subVectors(s,i),a=(h-u)/(h-u+(p-g)),t.copy(i).addScaledVector(ag,a);let x=1/(d+m+f);return o=m*x,a=f*x,t.copy(n).addScaledVector(Jo,o).addScaledVector($o,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},bv=0,Xi=class extends xs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:bv++}),this.uuid=qr(),this.name="",this.type="Material",this.blending=la,this.side=pr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Qg,this.blendDst=e0,this.blendEquation=sa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=zf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Qy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lf,this.stencilZFail=lf,this.stencilZPass=lf,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.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 n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}let i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};
vendor: 7,551 bytes, line 2
2n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==la&&(n.blending=this.blending),this.side!==pr&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(s){let o=[];for(let a in s){let c=s[a];delete c.metadata,o.push(c)}return o}if(t){let s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,389 bytes, line 2
2adows,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.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,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++}},Ii=class extends Xi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new $e(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=oh,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.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}},fn=new ae,xu=new Ee,Fn=class{constructor(e,t,n){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=n===!0,this.usage=Km,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)xu.fromBufferAttribute(this,t),xu.applyMatrix3(e),this.setXY(t,xu.x,xu.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)fn.fromBufferAttribute(this,t),fn.applyMatrix3(e),this.setXYZ(t,fn.x,fn.y,fn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)fn.fromBufferAttribute(this,t),fn.applyMatrix4(e),this.setXYZ(t,fn.x,fn.y,fn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)fn.fromBufferAttribute(this,t),fn.applyNormalMatrix(e),this.setXYZ(t,fn.x,fn.y,fn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)fn.fromBufferAttribute(this,t),fn.transformDirection(e),this.setXYZ(t,fn.x,fn.y,fn.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=kl(t,this.array)),t}setX(e,t){return this.normalized&&(t=ri(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=kl(t,this.array)),t}setY(e,t){return this.normalized&&(t=ri(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=kl(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ri(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=kl(t,this.array)),t}setW(e,t){return this.normalized&&(t=ri(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ri(t,this.array),n=ri(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ri(t,this.array),n=ri(n,this.array),i=ri(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=ri(t,this.array),n=ri(n,this.array),i=ri(i,this.array),s=ri(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}
vendor: 3,480 bytes, line 2
2onUpload(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!==Km&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}};var xa=class extends Fn{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var ju=class extends Fn{constructor(e,t,n){super(new Uint32Array(e),t,n)}};var je=class extends Fn{constructor(e,t,n){super(new Float32Array(e),t,n)}};var Tv=0,Si=new Xe,wf=new xt,Qo=new ae,yi=new mr,Nl=new mr,Rn=new ae,yt=class extends xs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Tv++}),this.uuid=qr(),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(r0(e)?ju:xa)(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,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Jt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Si.makeRotationFromQuaternion(e),this.applyMatrix4(Si),this}rotateX(e){return Si.makeRotationX(e),this.applyMatrix4(Si),this}rotateY(e){return Si.makeRotationY(e),this.applyMatrix4(Si),this}rotateZ(e){return Si.makeRotationZ(e),this.applyMatrix4(Si),this}translate(e,t,n){return Si.makeTranslation(e,t,n),this.applyMatrix4(Si),this}scale(e,t,n){return Si.makeScale(e,t,n),this.applyMatrix4(Si),this}lookAt(e){return wf.lookAt(e),wf.updateMatrix(),this.applyMatrix4(wf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qo).negate(),this.translate(Qo.x,Qo.y,Qo.z),this}setFromPoints(e){let t=[];for(let n=0,i=e.length;n<i;n++){let s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new je(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new mr);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
2se".',this),this.boundingBox.set(new ae(-1/0,-1/0,-1/0),new ae(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let s=t[n];yi.setFromBufferAttribute(s),this.morphTargetsRelative?(Rn.addVectors(this.boundingBox.min,yi.min),this.boundingBox.expandByPoint(Rn),Rn.addVectors(this.boundingBox.max,yi.max),this.boundingBox.expandByPoint(Rn)):(this.boundingBox.expandByPoint(yi.min),this.boundingBox.expandByPoint(yi.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 Vr);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
2se".',this),this.boundingSphere.set(new ae,1/0);return}if(e){let n=this.boundingSphere.center;if(yi.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];Nl.setFromBufferAttribute(a),this.morphTargetsRelative?(Rn.addVectors(yi.min,Nl.min),yi.expandByPoint(Rn),Rn.addVectors(yi.max,Nl.max),yi.expandByPoint(Rn)):(yi.expandByPoint(Nl.min),yi.expandByPoint(Nl.max))}yi.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)Rn.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Rn));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],c=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)Rn.fromBufferAttribute(a,l),c&&(Qo.fromBufferAttribute(e,l),Rn.add(Qo)),i=Math.max(i,n.distanceToSquared(Rn))}this.boundingSphere.radius=Math.sqrt(i),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 n=e.array,i=t.position.array,s=t.normal.array,o=t.uv.array,a=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Fn(new Float32Array(4*a),4));let c=this.getAttribute("tangent").array,l=[],u=[];for(let N=0;N<a;N++)l[N]=new ae,u[N]=new ae;let h=new ae,f=new ae,p=new ae,g=new Ee,m=new Ee,d=new Ee,x=new ae,_=new ae;function v(N,G,F){h.fromArray(i,N*3),f.fromArray(i,G*3),p.fromArray(i,F*3),g.fromArray(o,N*2),m.fromArray(o,G*2),d.fromArray(o,F*2),f.sub(h),p.sub(h),m.sub(g),d.sub(g);let U=1/(m.x*d.y-d.x*m.y);isFinite(U)&&(x.copy(f).multiplyScalar(d.y).addScaledVector(p,-m.y).multiplyScalar(U),_.copy(p).multiplyScalar(m.x).addScaledVector(f,-d.x).multiplyScalar(U),l[N].add(x),l[G].add(x),l[F].add(x),u[N].add(_),u[G].add(_),u[F].add(_))}let y=this.groups;y.length===0&&(y=[{start:0,count:n.length}]);for(let N=0,G=y.length;N<G;++N){let F=y[N],U=F.start,P=F.count;for(let $=U,H=U+P;$<H;$+=3)v(n[$+0],n[$+1],n[$+2])}let w=new ae,L=new ae,C=new ae,b=new ae;function A(N){C.fromArray(s,N*3),b.copy(C);let G=l[N];w.copy(G),w.sub(C.multiplyScalar(C.dot(G))).normalize(),L.crossVectors(b,G);let U=L.dot(u[N])<0?-1:1;c[N*4]=w.x,c[N*4+1]=w.y,c[N*4+2]=w.z,c[N*4+3]=U}for(let N=0,G=y.length;N<G;++N){let F=y[N],U=F.start,P=F.count;for(let $=U,H=U+P;$<H;$+=3)A(n[$+0]),A(n[$+1]),A(n[$+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Fn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,p=n.count;f<p;f++)n.setXYZ(f,0,0,0);let i=new ae,s=new ae,o=new ae,a=new ae,c=new ae,l=new ae,u=new ae,h=new ae;if(e)for(let f=0,p=e.count;f<p;f+=3){let g=e.getX(f+0),m=e.getX(f+1),d=e.getX(f+2);i.fromBufferAttribute(t,g),s.fromBufferAttribute(t,m),o.fromBufferAttribute(t,d),u.subVectors(o,s),h.subVectors(i,s),u.cross(h),a.fromBufferAttribute(n,g),c.fromBufferAttribute(n,m),l.fromBufferAttribute(n,d),a.add(u),c.add(u),l.add(u),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(m,c.x,c.y,c.z),n.setXYZ(d,l.x,l.y,l.z)}else for(let f=0,p=t.count;f<p;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,s),h.subVectors(i,s),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Rn.fromBufferAttribute(e,t),Rn.normalize(),e.setXYZ(t,Rn.x,Rn.y,Rn.z)}toNonIndexed(){function e(a,c){let l=a.array,u=a.itemSize,h=a.normalized,f=new l.constructor(c.length*u),p=0,g=0;for(let m=0,d=c.length;m<d;m++){a.isInterleavedBufferAttribute?p=c[m]*a.data.stride+a.offset:p=c[m]*u;for(let x=0;x<u;x++)f[g++]=l[p++]}return new Fn(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new yt,n=this.index.array,i=this.attributes;for(let a in i){let c=i[a],l=e(c,n);t.setAttribute(a,l)}let s=this.morphAttributes;for(let a in s){let c=[],l=s[a];for(let u=0,h=l.length;u<h;u++){let f=l[u],p=e(f,n);c.push(p)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,c=o.length;a<c;a++){let l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 4,420 bytes, line 2
2if(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 c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);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 n=this.attributes;for(let c in n){let l=n[c];e.data.attributes[c]=l.toJSON(e.data)}let i={},s=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],u=[];for(let h=0,f=l.length;h<f;h++){let p=l[h];u.push(p.toJSON(e.data))}u.length>0&&(i[c]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 n=e.index;n!==null&&this.setIndex(n.clone(t));let i=e.attributes;for(let l in i){let u=i[l];this.setAttribute(l,u.clone(t))}let s=e.morphAttributes;for(let l in s){let u=[],h=s[l];for(let f=0,p=h.length;f<p;f++)u.push(h[f].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let l=0,u=o.length;l<u;l++){let h=o[l];this.addGroup(h.start,h.count,h.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}},lg=new Xe,ea=new ga,Sf=new Vr,us=new ae,hs=new ae,fs=new ae,Ef=new ae,Af=new ae,Cf=new ae,yu=new ae,vu=new ae,_u=new ae,bu=new Ee,Tu=new Ee,Mu=new Ee,If=new ae,wu=new ae,kt=class extends xt{constructor(e=new yt,t=new Ii){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=e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}raycast(e,t){let n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),Sf.copy(n.boundingSphere),Sf.applyMatrix4(s),e.ray.intersectsSphere(Sf)===!1)||(lg.copy(s).invert(),ea.copy(e.ray).applyMatrix4(lg),n.boundingBox!==null&&ea.intersectsBox(n.boundingBox)===!1))return;let o,a=n.index,c=n.attributes.position,l=n.morphAttributes.position,u=n.morphTargetsRelative,h=n.attributes.uv,f=n.attributes.uv2,p=n.groups,g=n.drawRange;if(a!==null)if(Array.isArray(i))for(let m=0,d=p.length;m<d;m++){let x=p[m],_=i[x.materialIndex],v=Math.max(x.start,g.start),y=Math.min(a.count,Math.min(x.start+x.count,g.start+g.count));for(let w=v,L=y;w<L;w+=3){let C=a.getX(w),b=a.getX(w+1),A=a.getX(w+2);o=Su(this,_,e,ea,c,l,u,h,f,C,b,A),o&&(o.faceIndex=Math.floor(w/3),o.face.materialIndex=x.materialIndex,t.push(o))}}else{let m=Math.max(0,g.start),d=Math.min(a.count,g.start+g.count);for(let x=m,_=d;x<_;x+=3){let v=a.getX(x),y=a.getX(x+1),w=a.getX(x+2);o=Su(this,i,e,ea,c,l,u,h,f,v,y,w),o&&(o.faceIndex=Math.floor(x/3),t.push(o))}}else if(c!==void 0)if(Array.isArray(i))for(let m=0,d=p.length;m<d;m++){let x=p[m],_=i[x.materialIndex],v=Math.max(x.start,g.start),y=Math.min(c.count,Math.min(x.start+x.count,g.start+g.count));for(let w=v,L=y;w<L;w+=3){let C=w,b=w+1,A=w+2;o=Su(this,_,e,ea,c,l,u,h,f,C,b,A),o&&(o.faceIndex=Math.floor(w/3),o.face.materialIndex=x.materialIndex,t.push(o))}}else{let m=Math.max(0,g.start),d=Math.min(c.count,g.start+g.count);for(let x=m,_=d;x<_;x+=3){let v=x,y=x+1,w=x+2;o=Su(this,i,e,ea,c,l,u,h,f,v,y,w),o&&(o.faceIndex=Math.floor(x/3),t.pu
vendor: 6,558 bytes, lines 2-6
2sh(o))}}}};function Mv(r,e,t,n,i,s,o,a){let c;if(e.side===Pn?c=n.intersectTriangle(o,s,i,!0,a):c=n.intersectTriangle(i,s,o,e.side!==kn,a),c===null)return null;wu.copy(a),wu.applyMatrix4(r.matrixWorld);let l=t.ray.origin.distanceTo(wu);return l<t.near||l>t.far?null:{distance:l,point:wu.clone(),object:r}}function Su(r,e,t,n,i,s,o,a,c,l,u,h){us.fromBufferAttribute(i,l),hs.fromBufferAttribute(i,u),fs.fromBufferAttribute(i,h);let f=r.morphTargetInfluences;if(s&&f){yu.set(0,0,0),vu.set(0,0,0),_u.set(0,0,0);for(let g=0,m=s.length;g<m;g++){let d=f[g],x=s[g];d!==0&&(Ef.fromBufferAttribute(x,l),Af.fromBufferAttribute(x,u),Cf.fromBufferAttribute(x,h),o?(yu.addScaledVector(Ef,d),vu.addScaledVector(Af,d),_u.addScaledVector(Cf,d)):(yu.addScaledVector(Ef.sub(us),d),vu.addScaledVector(Af.sub(hs),d),_u.addScaledVector(Cf.sub(fs),d)))}us.add(yu),hs.add(vu),fs.add(_u)}r.isSkinnedMesh&&(r.boneTransform(l,us),r.boneTransform(u,hs),r.boneTransform(h,fs));let p=Mv(r,e,t,n,us,hs,fs,If);if(p){a&&(bu.fromBufferAttribute(a,l),Tu.fromBufferAttribute(a,u),Mu.fromBufferAttribute(a,h),p.uv=Ai.getUV(If,us,hs,fs,bu,Tu,Mu,new Ee)),c&&(bu.fromBufferAttribute(c,l),Tu.fromBufferAttribute(c,u),Mu.fromBufferAttribute(c,h),p.uv2=Ai.getUV(If,us,hs,fs,bu,Tu,Mu,new Ee));let g={a:l,b:u,c:h,normal:new ae,materialIndex:0};Ai.getNormal(us,hs,fs,g.normal),p.face=g}return p}var Hr=class extends yt{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};let a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);let c=[],l=[],u=[],h=[],f=0,p=0;g("z","y","x",-1,-1,n,t,e,o,s,0),g("z","y","x",1,-1,n,t,-e,o,s,1),g("x","z","y",1,1,e,n,t,i,o,2),g("x","z","y",1,-1,e,n,-t,i,o,3),g("x","y","z",1,-1,e,t,n,i,s,4),g("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new je(l,3)),this.setAttribute("normal",new je(u,3)),this.setAttribute("uv",new je(h,2));function g(m,d,x,_,v,y,w,L,C,b,A){let N=y/C,G=w/b,F=y/2,U=w/2,P=L/2,$=C+1,H=b+1,Z=0,W=0,oe=new ae;for(let ue=0;ue<H;ue++){let ne=ue*G-U;for(let le=0;le<$;le++){let he=le*N-F;oe[m]=he*_,oe[d]=ne*v,oe[x]=P,l.push(oe.x,oe.y,oe.z),oe[m]=0,oe[d]=0,oe[x]=L>0?1:-1,u.push(oe.x,oe.y,oe.z),h.push(le/C),h.push(1-ue/b),Z+=1}}for(let ue=0;ue<b;ue++)for(let ne=0;ne<C;ne++){let le=f+ne+$*ue,he=f+ne+$*(ue+1),I=f+(ne+1)+$*(ue+1),M=f+(ne+1)+$*ue;c.push(le,he,M),c.push(he,I,M),W+=6}a.addGroup(p,W,A),p+=W,f+=Z}}static fromJSON(e){return new Hr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function ya(r){let e={};for(let t in r){e[t]={};for(let n in r[t]){let i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Zn(r){let e={};for(let t=0;t<r.length;t++){let n=ya(r[t]);for(let i in n)e[i]=n[i]}return e}function wv(r){let e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function o0(r){return r.getRenderTarget()===null&&r.outputEncoding===It?fr:Wl}var Sv={clone:ya,merge:Zn},Ev=`void main() {
3	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4}`,Av=`void main() {
5	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
6}`,Wr=class extends Xi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Ev,this.fragmentShader=Av,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ya(e.uniforms),this.uniformsGroups=wv(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 i in this.uniforms){let o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},qu=class extends xt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Xe,this.projectionMatrix=new Xe,this.projectionMatrixInverse=new Xe}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}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)}},Zt=class extends qu{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=jl*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(ua*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,950 bytes, lines 6-41
6getEffectiveFOV(){return jl*2*Math.atan(Math.tan(ua*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,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=n,this.view.offsetY=i,this.view.width=s,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(ua*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i,o=this.view;if(this.view!==null&&this.view.enabled){let c=o.fullWidth,l=o.fullHeight;s+=o.offsetX*i/c,t-=o.offsetY*n/l,i*=o.width/c,n*=o.height/l}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far),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}},ta=-90,na=1,qf=class extends xt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;let i=new Zt(ta,na,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);let s=new Zt(ta,na,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);let o=new Zt(ta,na,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);let a=new Zt(ta,na,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);let c=new Zt(ta,na,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,1),this.add(c);let l=new Zt(ta,na,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,t){this.parent===null&&this.updateMatrixWorld();let n=this.renderTarget,[i,s,o,a,c,l]=this.children,u=e.getRenderTarget(),h=e.toneMapping,f=e.xr.enabled;e.toneMapping=Gr,e.xr.enabled=!1;let p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,c),n.texture.generateMipmaps=p,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}},Yl=class extends pn{constructor(e,t,n,i,s,o,a,c,l,u){e=e!==void 0?e:[],t=t!==void 0?t:fa,super(e,t,n,i,s,o,a,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},Xf=class extends zr{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Yl(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:dn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
7
8				varying vec3 vWorldDirection;
9
10				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
11
12					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
13
14				}
15
16				void main() {
17
18					vWorldDirection = transformDirection( position, modelMatrix );
19
20					#include <begin_vertex>
21					#include <project_vertex>
22
23				}
24			`,fragmentShader:`
25
26				uniform sampler2D tEquirect;
27
28				varying vec3 vWorldDirection;
29
30				#include <common>
31
32				void main() {
33
34					vec3 direction = normalize( vWorldDirection );
35
36					vec2 sampleUV = equirectUv( direction );
37
38					gl_FragColor = texture2D( tEquirect, sampleUV );
39
40				}
41			`},i=new Hr(5,5,5),s=new Wr({name:"CubemapFromEquirect",uniforms:ya(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Pn,blending:ms});s.uniforms.tEquirect.value=t;let o=new kt(i,s),a=t.minFilter;return t.minFilter===br&&(t.minFilter=dn),new qf(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}},Rf=new ae,Cv=new ae,Iv=new Jt,Br=class{constructor(e=new ae(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}
vendor: 5,769 bytes, lines 41-42
41setFromCoplanarPoints(e,t,n){let i=Rf.subVectors(n,t).cross(Cv.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let n=e.delta(Rf),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Iv.getNormalMatrix(e),i=this.coplanarPoint(Rf).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),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)}},ia=new Vr,Eu=new ae,Zl=class{constructor(e=new Br,t=new Br,n=new Br,i=new Br,s=new Br,o=new Br){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=this.planes,n=e.elements,i=n[0],s=n[1],o=n[2],a=n[3],c=n[4],l=n[5],u=n[6],h=n[7],f=n[8],p=n[9],g=n[10],m=n[11],d=n[12],x=n[13],_=n[14],v=n[15];return t[0].setComponents(a-i,h-c,m-f,v-d).normalize(),t[1].setComponents(a+i,h+c,m+f,v+d).normalize(),t[2].setComponents(a+s,h+l,m+p,v+x).normalize(),t[3].setComponents(a-s,h-l,m-p,v-x).normalize(),t[4].setComponents(a-o,h-u,m-g,v-_).normalize(),t[5].setComponents(a+o,h+u,m+g,v+_).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),ia.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ia)}intersectsSprite(e){return ia.center.set(0,0,0),ia.radius=.7071067811865476,ia.applyMatrix4(e.matrixWorld),this.intersectsSphere(ia)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(Eu.x=i.normal.x>0?e.max.x:e.min.x,Eu.y=i.normal.y>0?e.max.y:e.min.y,Eu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Eu)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function a0(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Rv(r,e){let t=e.isWebGL2,n=new WeakMap;function i(l,u){let h=l.array,f=l.usage,p=r.createBuffer();r.bindBuffer(u,p),r.bufferData(u,h,f),l.onUploadCallback();let g;if(h instanceof Float32Array)g=5126;else if(h instanceof Uint16Array)if(l.isFloat16BufferAttribute)if(t)g=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=5123;else if(h instanceof Int16Array)g=5122;else if(h instanceof Uint32Array)g=5125;else if(h instanceof Int32Array)g=5124;else if(h instanceof Int8Array)g=5120;else if(h instanceof Uint8Array)g=5121;else if(h instanceof Uint8ClampedArray)g=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:p,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version}}function s(l,u,h){let f=u.array,p=u.updateRange;r.bindBuffer(h,l),p.count===-1?r.bufferSubData(h,0,f):(t?r.bufferSubData(h,p.offset*f.BYTES_PER_ELEMENT,f,p.offset,p.count):r.bufferSubData(h,p.offset*f.BYTES_PER_ELEMENT,f.subarray(p.offset,p.offset+p.count)),p.count=-1),u.onUploadCallback()}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),n.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);let u=n.get(l);u&&(r.deleteBuffer(u.buffer),n.delete(l))}function c(l,u){if(l.isGLBufferAttribute){let f=n.get(l);(!f||f.version<l.version)&&n.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}l.isInterleavedBufferAttribute&&(l=l.data);let h=n.get(l);h===void 0?n.set(l,i(l,u)):h.version<l.version&&(s(h.buffer,l,u),h.version=l.version)}return{get:o,remove:a,update:c}}var so=class extends yt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let s=e/2,o=t/2,a=Math.floor(n),c=Math.floor(i),l=a+1,u=c+1,h=e/a,f=t/c,p=[],g=[],m=[],d=[];for(let x=0;x<u;x++){let _=x*f-o;for(let v=0;v<l;v++){let y=v*h-s;g.push(y,-_,0),m.push(0,0,1),d.push(v/a),d.push(1-x/c)}}for(let x=0;x<c;x++)for(let _=0;_<a;_++){let v=_+l*x,y=_+l*(x+1),w=_+1+l*(x+1),L=_+1+l*x;p.push(v,y,L),p.push(y,w,L)}this.setIndex(p),this.setAttribute("position",new je(g,3)),this.setAttribute("normal",new je(m,3)),this.setAttribute("uv",new je(d,2))}static fromJSON(e){return new so(e.width,e.height,e.widthSegments,e.heightSegments)}},Pv=`#ifdef USE_ALPHAMAP
42	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
43#endif`,Lv=`#ifdef USE_ALPHAMAP
44	uniform sampler2D alphaMap;
45#endif`,Nv=`#ifdef USE_ALPHATEST
46	if ( diffuseColor.a < alphaTest ) discard;
47#endif`,Ov=`#ifdef USE_ALPHATEST
48	uniform float alphaTest;
49#endif`,Dv=`#ifdef USE_AOMAP
50	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
51	reflectedLight.indirectDiffuse *= ambientOcclusion;
52	#if defined( USE_ENVMAP ) && defined( STANDARD )
53		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
54		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
55	#endif
56#endif`,kv=`#ifdef USE_AOMAP
57	uniform sampler2D aoMap;
58	uniform float aoMapIntensity;
59#endif`,Fv="vec3 transformed = vec3( position );",Uv=`vec3 objectNormal = vec3( normal );
60#ifdef USE_TANGENT
61	vec3 objectTangent = vec3( tangent.xyz );
62#endif`,Bv=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
63	return RECIPROCAL_PI * diffuseColor;
64}
65vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
66	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
67	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
68}
69float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
70	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
71	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
72}
73vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
74    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
75    float x2 = x * x;
76    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
77    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
78}
79float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
80	float a2 = pow2( alpha );
81	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
82	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
83	return 0.5 / max( gv + gl, EPSILON );
84}
85float D_GGX( const in float alpha, const in float dotNH ) {
86	float a2 = pow2( alpha );
87	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
88	return RECIPROCAL_PI * a2 / pow2( denom );
89}
90vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
91	float alpha = pow2( roughness );
92	vec3 halfDir = normalize( lightDir + viewDir );
93	float dotNL = saturate( dot( normal, lightDir ) );
94	float dotNV = saturate( dot( normal, viewDir ) );
95	float dotNH = saturate( dot( normal, halfDir ) );
96	float dotVH = saturate( dot( viewDir, halfDir ) );
97	vec3 F = F_Schlick( f0, f90, dotVH );
98	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
99	float D = D_GGX( alpha, dotNH );
100	return F * ( V * D );
101}
102#ifdef USE_IRIDESCENCE
103	vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {
104		float alpha = pow2( roughness );
105		vec3 halfDir = normalize( lightDir + viewDir );
106		float dotNL = saturate( dot( normal, lightDir ) );
107		float dotNV = saturate( dot( normal, viewDir ) );
108		float dotNH = saturate( dot( normal, halfDir ) );
109		float dotVH = saturate( dot( viewDir, halfDir ) );
110		vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );
111		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
112		float D = D_GGX( alpha, dotNH );
113		return F * ( V * D );
114	}
115#endif
116vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
117	const float LUT_SIZE = 64.0;
118	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
119	const float LUT_BIAS = 0.5 / LUT_SIZE;
120	float dotNV = saturate( dot( N, V ) );
121	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
122	uv = uv * LUT_SCALE + LUT_BIAS;
123	return uv;
124}
125float LTC_ClippedSphereFormFactor( const in vec3 f ) {
126	float l = length( f );
127	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
128}
129vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
130	float x = dot( v1, v2 );
131	float y = abs( x );
132	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
133	float b = 3.4175940 + ( 4.1616724 + y ) * y;
134	float v = a / b;
135	float theta_sintheta = ( x >
135 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
136	return cross( v1, v2 ) * theta_sintheta;
137}
138vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
139	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
140	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
141	vec3 lightNormal = cross( v1, v2 );
142	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
143	vec3 T1, T2;
144	T1 = normalize( V - N * dot( V, N ) );
145	T2 = - cross( N, T1 );
146	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
147	vec3 coords[ 4 ];
148	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
149	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
150	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
151	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
152	coords[ 0 ] = normalize( coords[ 0 ] );
153	coords[ 1 ] = normalize( coords[ 1 ] );
154	coords[ 2 ] = normalize( coords[ 2 ] );
155	coords[ 3 ] = normalize( coords[ 3 ] );
156	vec3 vectorFormFactor = vec3( 0.0 );
157	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
158	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
159	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
160	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
161	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
162	return vec3( result );
163}
164float G_BlinnPhong_Implicit( ) {
165	return 0.25;
166}
167float D_BlinnPhong( const in float shininess, const in float dotNH ) {
168	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
169}
170vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
171	vec3 halfDir = normalize( lightDir + viewDir );
172	float dotNH = saturate( dot( normal, halfDir ) );
173	float dotVH = saturate( dot( viewDir, halfDir ) );
174	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
175	float G = G_BlinnPhong_Implicit( );
176	float D = D_BlinnPhong( shininess, dotNH );
177	return F * ( G * D );
178}
179#if defined( USE_SHEEN )
180float D_Charlie( float roughness, float dotNH ) {
181	float alpha = pow2( roughness );
182	float invAlpha = 1.0 / alpha;
183	float cos2h = dotNH * dotNH;
184	float sin2h = max( 1.0 - cos2h, 0.0078125 );
185	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
186}
187float V_Neubelt( float dotNV, float dotNL ) {
188	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
189}
190vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
191	vec3 halfDir = normalize( lightDir + viewDir );
192	float dotNL = saturate( dot( normal, lightDir ) );
193	float dotNV = saturate( dot( normal, viewDir ) );
194	float dotNH = saturate( dot( normal, halfDir ) );
195	float D = D_Charlie( sheenRoughness, dotNH );
196	float V = V_Neubelt( dotNV, dotNL );
197	return sheenColor * ( D * V );
198}
199#endif`,Gv=`#ifdef USE_IRIDESCENCE
200	const mat3 XYZ_TO_REC709 = mat3(
201		 3.2404542, -0.9692660,  0.0556434,
202		-1.5371385,  1.8760108, -0.2040259,
203		-0.4985314,  0.0415560,  1.0572252
204	);
205	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
206		vec3 sqrtF0 = sqrt( fresnel0 );
207		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
208	}
209	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
210		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
211	}
212	float IorToFresnel0( float transmittedIor, float incidentIor ) {
213		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
214	}
215	vec3 evalSensitivity( float OPD, vec3 shift ) {
216		float phase = 2.0 * PI * OPD * 1.0e-9;
217		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
218		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
219		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
220		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
221		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 ) );
222		xyz /= 1.0685e-7;
223		vec3 rgb = XYZ_TO_REC709 * xyz;
224		return rgb;
225	}
226	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
227		vec3 I;
228		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
229		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
230		float cosTheta2Sq = 1.0 - sinTheta2Sq;
231		if ( cosTheta2Sq < 0.0 ) {
232			 return vec3( 1.0 );
233		}
234		float cosTheta2 = sqrt( cosTheta2Sq );
235		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
236		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
237		float R21 = R12;
238		float T121 = 1.0 - R12;
239		float phi12 = 0.0;
240		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
241		float phi21 = PI - phi12;
242		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
243		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
244		vec3 phi23 = vec3( 0.0 );
245		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
246		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
247		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
248		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
249		vec3 phi = vec3( phi21 ) + phi23;
250		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
251		vec3 r123 = sqrt( R123 );
252		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
253		vec3 C0 = R12 + Rs;
254		I = C0;
255		vec3 Cm = Rs - T121;
256		for ( int m = 1; m <= 2; ++ m ) {
257			Cm *= r123;
258			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
259			I += Cm * Sm;
260		}
261		return max( I, vec3( 0.0 ) );
262	}
263#endif`,zv=`#ifdef USE_BUMPMAP
264	uniform sampler2D bumpMap;
265	uniform float bumpScale;
266	vec2 dHdxy_fwd() {
267		vec2 dSTdx = dFdx( vUv );
268		vec2 dSTdy = dFdy( vUv );
269		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
270		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
271		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
272		return vec2( dBx, dBy );
273	}
274	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
275		vec3 vSigmaX = dFdx( surf_pos.xyz );
276		vec3 vSigmaY = dFdy( surf_pos.xyz );
277		vec3 vN = surf_norm;
278		vec3 R1 = cross( vSigmaY, vN );
279		vec3 R2 = cross( vN, vSigmaX );
280		float fDet = dot( vSigmaX, R1 ) * faceDirection;
281		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
282		return normalize( abs( fDet ) * surf_norm - vGrad );
283	}
284#endif`,Vv=`#if NUM_CLIPPING_PLANES > 0
285	vec4 plane;
286	#pragma unroll_loop_start
287	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
288		plane = clippingPlanes[ i ];
289		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
290	}
291	#pragma unroll_loop_end
292	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
293		bool clipped = true;
294		#pragma unroll_loop_start
295		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
296			plane = clippingPlanes[ i ];
297			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
298		}
299		#pragma unroll_loop_end
300		if ( clipped ) discard;
301	#endif
302#endif`,Hv=`#if NUM_CLIPPING_PLANES > 0
303	varying vec3 vClipPosition;
304	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
305#endif`,Wv=`#if NUM_CLIPPING_PLANES > 0
306	varying vec3 vClipPosition;
307#endif`,jv=`#if NUM_CLIPPING_PLANES > 0
308	vClipPosition = - mvPosition.xyz;
309#endif`,qv=`#if defined( USE_COLOR_ALPHA )
310	diffuseColor *= vColor;
311#elif defined( USE_COLOR )
312	diffuseColor.rgb *= vColor;
313#endif`,Xv=`#if defined( USE_COLOR_ALPHA )
314	varying vec4 vColor;
315#elif defined( USE_COLOR )
316	varying vec3 vColor;
317#endif`,Yv=`#if defined( USE_COLOR_ALPHA )
318	varying vec4 vColor;
319#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
320	varying vec3 vColor;
321#endif`,Zv=`#if defined( USE_COLOR_ALPHA )
322	vColor = vec4( 1.0 );
323#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
324	vColor = vec3( 1.0 );
325#endif
326#ifdef USE_COLOR
327	vColor *= color;
328#endif
329#ifdef USE_INSTANCING_COLOR
330	vColor.xyz *= instanceColor.xyz;
331#endif`,Kv=`#define PI 3.141592653589793
332#define PI2 6.283185307179586
333#define PI_HALF 1.5707963267948966
334#define RECIPROCAL_PI 0.3183098861837907
335#define RECIPROCAL_PI2 0.15915494309189535
336#define EPSILON 1e-6
337#ifndef saturate
338#define saturate( a ) clamp( a, 0.0, 1.0 )
339#endif
340#define whiteComplement( a ) ( 1.0 - saturate( a ) )
341float pow2( const in float x ) { return x*x; }
342vec3 pow2( const in vec3 x ) { return x*x; }
343float pow3( const in float x ) { return x*x*x; }
344float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
345float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
346float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
347highp float rand( const in vec2 uv ) {
348	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
349	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
350	return fract( sin( sn ) * c );
351}
352#ifdef HIGH_PRECISION
353	float precisionSafeLength( vec3 v ) { return length( v ); }
354#else
355	float precisionSafeLength( vec3 v ) {
356		float maxComponent = max3( abs( v ) );
357		return length( v / maxComponent ) * maxComponent;
358	}
359#endif
360struct IncidentLight {
361	vec3 color;
362	vec3 direction;
363	bool visible;
364};
365struct ReflectedLight {
366	vec3 directDiffuse;
367	vec3 directSpecular;
368	vec3 indirectDiffuse;
369	vec3 indirectSpecular;
370};
371struct GeometricContext {
372	vec3 position;
373	vec3 normal;
374	vec3 viewDir;
375#ifdef USE_CLEARCOAT
376	vec3 clearcoatNormal;
377#endif
378};
379vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
380	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
381}
382vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
383	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
384}
385mat3 transposeMat3( const in mat3 m ) {
386	mat3 tmp;
387	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
388	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
389	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
390	return tmp;
391}
392float luminance( const in vec3 rgb ) {
393	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
394	return dot( weights, rgb );
395}
396bool isPerspectiveMatrix( mat4 m ) {
397	return m[ 2 ][ 3 ] == - 1.0;
398}
399vec2 equirectUv( in vec3 dir ) {
400	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
401	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
402	return vec2( u, v );
403}`,Jv=`#ifdef ENVMAP_TYPE_CUBE_UV
404	#define cubeUV_minMipLevel 4.0
405	#define cubeUV_minTileSize 16.0
406	float getFace( vec3 direction ) {
407		vec3 absDirection = abs( direction );
408		float face = - 1.0;
409		if ( absDirection.x > absDirection.z ) {
410			if ( absDirection.x > absDirection.y )
411				face = direction.x > 0.0 ? 0.0 : 3.0;
412			else
413				face = direction.y > 0.0 ? 1.0 : 4.0;
414		} else {
415			if ( absDirection.z > absDirection.y )
416				face = direction.z > 0.0 ? 2.0 : 5.0;
417			else
418				face = direction.y > 0.0 ? 1.0 : 4.0;
419		}
420		return face;
421	}
422	vec2 getUV( vec3 direction, float face ) {
423		vec2 uv;
424		if ( face == 0.0 ) {
425			uv = vec2( direction.z, direction.y ) / abs( direction.x );
426		} else if ( face == 1.0 ) {
427			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
428		} else if ( face == 2.0 ) {
429			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
430		} else if ( face == 3.0 ) {
431			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
432		} else if ( face == 4.0 ) {
433			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
434		} else {
435			uv = vec2( direction.x, direction.y ) / abs( direction.z );
436		}
437		return 0.5 * ( uv + 1.0 );
438	}
439	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
440		float face = getFace( direction );
441		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
442		mipInt = max( mipInt, cubeUV_minMipLevel );
443		float faceSize = exp2( mipInt );
444		vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
445		if ( face > 2.0 ) {
446			uv.y += faceSize;
447			face -= 3.0;
448		}
449		uv.x += face * faceSize;
450		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
451		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
452		uv.x *= CUBEUV_TEXEL_WIDTH;
453		uv.y *= CUBEUV_TEXEL_HEIGHT;
454		#ifdef texture2DGradEXT
455			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
456		#else
457			return texture2D( envMap, uv ).rgb;
458		#endif
459	}
460	#define cubeUV_r0 1.0
461	#define cubeUV_v0 0.339
462	#define cubeUV_m0 - 2.0
463	#define cubeUV_r1 0.8
464	#define cubeUV_v1 0.276
465	#define cubeUV_m1 - 1.0
466	#define cubeUV_r4 0.4
467	#define cubeUV_v4 0.046
468	#define cubeUV_m4 2.0
469	#define cubeUV_r5 0.305
470	#define cubeUV_v5 0.016
471	#define cubeUV_m5 3.0
472	#define cubeUV_r6 0.21
473	#define cubeUV_v6 0.0038
474	#define cubeUV_m6 4.0
475	float roughnessToMip( float roughness ) {
476		float mip = 0.0;
477		if ( roughness >= cubeUV_r1 ) {
478			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
479		} else if ( roughness >= cubeUV_r4 ) {
480			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
481		} else if ( roughness >= cubeUV_r5 ) {
482			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
483		} else if ( roughness >= cubeUV_r6 ) {
484			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
485		} else {
486			mip = - 2.0 * log2( 1.16 * roughness );		}
487		return mip;
488	}
489	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
490		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
491		float mipF = fract( mip );
492		float mipInt = floor( mip );
493		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
494		if ( mipF == 0.0 ) {
495			return vec4( color0, 1.0 );
496		} else {
497			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
498			return vec4( mix( color0, color1, mipF ), 1.0 );
499		}
500	}
501#endif`,$v=`vec3 transformedNormal = objectNormal;
502#ifdef USE_INSTANCING
503	mat3 m = mat3( instanceMatrix );
504	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
505	transformedNormal = m * transformedNormal;
506#endif
507transformedNormal = normalMatrix * transformedNormal;
508#ifdef FLIP_SIDED
509	transformedNormal = - transformedNormal;
510#endif
511#ifdef USE_TANGENT
512	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
513	#ifdef FLIP_SIDED
514		transformedTangent = - transformedTangent;
515	#endif
516#endif`,Qv=`#ifdef USE_DISPLACEMENTMAP
517	uniform sampler2D displacementMap;
518	uniform float displacementScale;
519	uniform float displacementBias;
520#endif`,e_=`#ifdef USE_DISPLACEMENTMAP
521	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + dis
521placementBias );
522#endif`,t_=`#ifdef USE_EMISSIVEMAP
523	vec4 emissiveColor = texture2D( emissiveMap, vUv );
524	totalEmissiveRadiance *= emissiveColor.rgb;
525#endif`,n_=`#ifdef USE_EMISSIVEMAP
526	uniform sampler2D emissiveMap;
527#endif`,i_="gl_FragColor = linearToOutputTexel( gl_FragColor );",r_=`vec4 LinearToLinear( in vec4 value ) {
528	return value;
529}
530vec4 LinearTosRGB( in vec4 value ) {
531	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 );
532}`,s_=`#ifdef USE_ENVMAP
533	#ifdef ENV_WORLDPOS
534		vec3 cameraToFrag;
535		if ( isOrthographic ) {
536			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
537		} else {
538			cameraToFrag = normalize( vWorldPosition - cameraPosition );
539		}
540		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
541		#ifdef ENVMAP_MODE_REFLECTION
542			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
543		#else
544			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
545		#endif
546	#else
547		vec3 reflectVec = vReflect;
548	#endif
549	#ifdef ENVMAP_TYPE_CUBE
550		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
551	#else
552		vec4 envColor = vec4( 0.0 );
553	#endif
554	#ifdef ENVMAP_BLENDING_MULTIPLY
555		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
556	#elif defined( ENVMAP_BLENDING_MIX )
557		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
558	#elif defined( ENVMAP_BLENDING_ADD )
559		outgoingLight += envColor.xyz * specularStrength * reflectivity;
560	#endif
561#endif`,o_=`#ifdef USE_ENVMAP
562	uniform float envMapIntensity;
563	uniform float flipEnvMap;
564	#ifdef ENVMAP_TYPE_CUBE
565		uniform samplerCube envMap;
566	#else
567		uniform sampler2D envMap;
568	#endif
569	
570#endif`,a_=`#ifdef USE_ENVMAP
571	uniform float reflectivity;
572	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
573		#define ENV_WORLDPOS
574	#endif
575	#ifdef ENV_WORLDPOS
576		varying vec3 vWorldPosition;
577		uniform float refractionRatio;
578	#else
579		varying vec3 vReflect;
580	#endif
581#endif`,l_=`#ifdef USE_ENVMAP
582	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
583		#define ENV_WORLDPOS
584	#endif
585	#ifdef ENV_WORLDPOS
586		
587		varying vec3 vWorldPosition;
588	#else
589		varying vec3 vReflect;
590		uniform float refractionRatio;
591	#endif
592#endif`,c_=`#ifdef USE_ENVMAP
593	#ifdef ENV_WORLDPOS
594		vWorldPosition = worldPosition.xyz;
595	#else
596		vec3 cameraToVertex;
597		if ( isOrthographic ) {
598			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
599		} else {
600			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
601		}
602		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
603		#ifdef ENVMAP_MODE_REFLECTION
604			vReflect = reflect( cameraToVertex, worldNormal );
605		#else
606			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
607		#endif
608	#endif
609#endif`,u_=`#ifdef USE_FOG
610	vFogDepth = - mvPosition.z;
611#endif`,h_=`#ifdef USE_FOG
612	varying float vFogDepth;
613#endif`,f_=`#ifdef USE_FOG
614	#ifdef FOG_EXP2
615		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
616	#else
617		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
618	#endif
619	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
620#endif`,d_=`#ifdef USE_FOG
621	uniform vec3 fogColor;
622	varying float vFogDepth;
623	#ifdef FOG_EXP2
624		uniform float fogDensity;
625	#else
626		uniform float fogNear;
627		uniform float fogFar;
628	#endif
629#endif`,p_=`#ifdef USE_GRADIENTMAP
630	uniform sampler2D gradientMap;
631#endif
632vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
633	float dotNL = dot( normal, lightDirection );
634	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
635	#ifdef USE_GRADIENTMAP
636		return vec3( texture2D( gradientMap, coord ).r );
637	#else
638		vec2 fw = fwidth( coord ) * 0.5;
639		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
640	#endif
641}`,m_=`#ifdef USE_LIGHTMAP
642	vec4 lightMapTexel = texture2D( lightMap, vUv2 );
643	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
644	reflectedLight.indirectDiffuse += lightMapIrradiance;
645#endif`,g_=`#ifdef USE_LIGHTMAP
646	uniform sampler2D lightMap;
647	uniform float lightMapIntensity;
648#endif`,x_=`LambertMaterial material;
649material.diffuseColor = diffuseColor.rgb;
650material.specularStrength = specularStrength;`,y_=`varying vec3 vViewPosition;
651struct LambertMaterial {
652	vec3 diffuseColor;
653	float specularStrength;
654};
655void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
656	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
657	vec3 irradiance = dotNL * directLight.color;
658	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
659}
660void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
661	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
662}
663#define RE_Direct				RE_Direct_Lambert
664#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,v_=`uniform bool receiveShadow;
665uniform vec3 ambientLightColor;
666uniform vec3 lightProbe[ 9 ];
667vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
668	float x = normal.x, y = normal.y, z = normal.z;
669	vec3 result = shCoefficients[ 0 ] * 0.886227;
670	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
671	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
672	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
673	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
674	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
675	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
676	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
677	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
678	return result;
679}
680vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
681	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
682	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
683	return irradiance;
684}
685vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
686	vec3 irradiance = ambientLightColor;
687	return irradiance;
688}
689float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
690	#if defined ( PHYSICALLY_CORRECT_LIGHTS )
691		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
692		if ( cutoffDistance > 0.0 ) {
693			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
694		}
695		return distanceFalloff;
696	#else
697		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
698			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
699		}
700		return 1.0;
701	#endif
702}
703float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
704	return smoothstep( coneCosine, penumbraCosine, angleCosine );
705}
706#if NUM_DIR_LIGHTS > 0
707	struct DirectionalLight {
708		vec3 direction;
709		vec3 color;
710	};
711	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
712	void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
713		light.color = directionalLight.color;
714		light.direction = directionalLight.direction;
715		light.visible = true;
716	}
717#endif
718#if NUM_POINT_LIGHTS > 0
719	struct PointLight {
720		vec3 position;
721		vec3 color;
722		float distance;
723		float decay;
724	};
725	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
726	void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
727		vec3 lVector = pointLight.position - geometry.position;
728		light.direction = normalize( lVector );
729		float lightDistance = length( lVector );
730		light.color = pointLight.color;
731		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
732		light.visible = ( light.color != vec3( 0.0 ) );
733	}
734#endif
735#if NUM_SPOT_LIGHTS > 0
736	struct SpotLight {
737		vec3 position;
738		vec3 direction;
739		vec3 color;
740		float distance;
741		float decay;
742		float coneCos;
743		float penumbraCos;
744	};
745	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
746	void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
747		vec3 lVector = spotLight.position - geometry.position;
748		light.direction = normalize( lVector );
749		float angleCos = dot( light.direction, spotLight.direction );
750		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
751		if ( spotAttenuation > 0.0 ) {
752			float lightDistance = length( lVector );
753			light.color = spotLight.color * spotAttenuation;
754			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
755			light.visible = ( light.color != vec3( 0.0 ) );
756		} else {
757			light.color = vec3( 0.0 );
758			light.visible = false;
759		}
760	}
761#endif
762#if NUM_RECT_AREA_LIGHTS > 0
763	struct RectAreaLight {
764		vec3 color;
765		vec3 position;
766		vec3 halfWidth;
767		vec3 halfHeight;
768	};
769	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
770	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
771#endif
772#if NUM_HEMI_LIGHTS > 0
773	struct HemisphereLight {
774		vec3 direction;
775		vec3 skyColor;
776		vec3 groundColor;
777	};
778	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
779	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
780		float dotNL = dot( normal, hemiLight.direction );
781		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
782		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
783		return irradiance;
784	}
785#endif`,__=`#if defined( USE_ENVMAP )
786	vec3 getIBLIrradiance( const in vec3 normal ) {
787		#if defined( ENVMAP_TYPE_CUBE_UV )
788			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
789			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
790			return PI * envMapColor.rgb * envMapIntensity;
791		#else
792			return vec3( 0.0 );
793		#endif
794	}
795	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
796		#if defined( ENVMAP_TYPE_CUBE_UV )
797			vec3 reflectVec = reflect( - viewDir, normal );
798			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
799			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
800			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
801			return envMapColor.rgb * envMapIntensity;
802		#else
803			return vec3( 0.0 );
804		#endif
805	}
806#endif`,b_=`ToonMaterial material;
807material.diffuseColor = diffuseColor.rgb;`,T_=`varying vec3 vViewPosition;
808struct ToonMaterial {
809	vec3 diffuseColor;
810};
811void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
812	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
813	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
814}
815void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
816	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
817}
818#define RE_Direct				RE_Direct_Toon
819#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,M_=`BlinnPhongMaterial material;
820material.diffuseColor = diffuseColor.rgb;
821material.specularColor = specular;
822material.specularShininess = shininess;
823material.specularStrength = specularStrength;`,w_=`varying vec3 vViewPosition;
824struct BlinnPhongMaterial {
825	vec3 diffuseColor;
826	vec3 specularColor;
827	float specularShininess;
828	float specularStrength;
829};
830void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
831	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
832	vec3 irradiance = dotNL * directLight.color;
833	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
834	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
835}
836void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
837	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
838}
839#define RE_Direct				RE_Direct_BlinnPhong
840#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,S_=`PhysicalMaterial material;
841material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
842vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
843float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
844material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
845material.roughness = min( material.roughness, 1.0 );
846#ifdef IOR
847	material.ior = ior;
848	#ifdef SPECULAR
849		float specularIntensityFactor = specularIntensity;
850		vec3 specularColorFactor = specularColor;
851		#ifdef USE_SPECULARINTENSITYMAP
852			specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
853		#endif
854		#ifdef USE_SPECULARCOLORMAP
855			specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
856		#endif
857		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
858	#else
859		float specularIntensityFactor = 1.0;
860		vec3 specularColorFactor = vec3( 1.0 );
861		material.specularF90 = 1.0;
862	#endif
863	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
864#else
865	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
866	material.specularF90 = 1.0;
867#endif
868#ifdef USE_CLEARCOAT
869	material.clearcoat = clearcoat;
870	material.clearcoatRoughness = clearcoatRoughness;
871	material.clearcoatF0 = vec3( 0.04 );
872	material.clearcoatF90 = 1.0;
873	#ifdef USE_CLEARCOATMAP
874		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
875	#endif
876	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
877		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
878	#endif
879	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
880	material.clearcoatRoughness += geometryRoughness;
881	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
882#endif
883#ifdef USE_IRIDESCENCE
884	material.iridescence = iridescence;
885	material.iridescenceIOR = iridescenceIOR;
886	#ifdef USE_IRIDESCENCEMAP
887		material.iridescence *= texture2D( iridescenceMap, vUv ).r;
888	#endif
889	#ifdef USE_IRIDESCENCE_THICKNESSMAP
890		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
891	#else
892		material.iridescenceThickness = iridescenceThicknessMaximum;
893	#endif
894#endif
895#ifdef USE_SHEEN
896	material.sheenColor = sheenColor;
897	#ifdef USE_SHEENCOLORMAP
898		material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
899	#endif
900	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
901	#ifdef USE_SHEENROUGHNESSMAP
902		material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
903	#endif
904#endif`,E_=`struct PhysicalMaterial {
905	vec3 diffuseColor;
906	float roughness;
907	vec3 specularColor;
908	float specularF90;
909	#ifdef USE_CLEARCOAT
910		float clearcoat;
911		float clearcoatRoughness;
912		vec3 clearcoatF0;
913		float clearcoatF90;
914	#endif
915	#ifdef USE_IRIDESCENCE
916		float iridescence;
917		float iridescenceIOR;
918		float iridescenceThickness;
919		vec3 iridescenceFresnel;
920		vec3 iridescenceF0;
921	#endif
922	#ifdef USE_SHEEN
923		vec3 sheenColor;
924		float sheenRoughness;
925	#endif
926	#ifdef IOR
927		float ior;
928	#endif
929	#ifdef USE_TRANSMISSION
930		float transmission;
931		float transmissionAlpha;
932		float thickness;
933		float attenuationDistance;
934		vec3 attenuationColor;
935	#endif
936};
937vec3 clearcoatSpecular = vec3( 0.0 );
938vec3 sheenSpecular = vec3( 0.0 );
939float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
940	float dotNV = saturate( dot( normal, viewDir ) );
941	float r2 = roughness * roughness;
942	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
943	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
944	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
945	return saturate( DG * RECIPROCAL_PI );
946}
947vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
948	float dotNV = saturate( dot( normal, viewDir ) );
949	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
950	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
951	vec4 r = roughness * c0 + c1;
952	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
953	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
954	return fab;
955}
956vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
957	vec2 fab = DFGApprox( normal, viewDir, roughness );
958	return specularColor * fab.x + specularF90 * fab.y;
959}
960#ifdef USE_IRIDESCENCE
961void 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 ) {
962#else
963void 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 ) {
964#endif
965	vec2 fab = DFGApprox( normal, viewDir, roughness );
966	#ifdef USE_IRIDESCENCE
967		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
968	#else
969		vec3 Fr = specularColor;
970	#endif
971	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
972	float Ess = fab.x + fab.y;
973	float Ems = 1.0 - Ess;
974	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
975	singleScatter += FssEss;
976	multiScatter += Fms * Ems;
977}
978#if NUM_RECT_AREA_LIGHTS > 0
979	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
980		vec3 normal = geometry.normal;
981		vec3 viewDir = geometry.viewDir;
982		vec3 position = geometry.position;
983		vec3 lightPos = rectAreaLight.position;
984		vec3 halfWidth = rectAreaLight.halfWidth;
985		vec3 halfHeight = rectAreaLight.halfHeight;
986		vec3 lightColor = rectAreaLight.color;
987		float roughness = material.roughness;
988		vec3 rectCoords[ 4 ];
989		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
990		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
991		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
992		vec2 uv = LTC_Uv( normal, viewDir, roughness );
993		vec4 t1 = texture2D( ltc_1, uv );
994		vec4 t2 = texture2D( ltc_2, uv );
995		mat3 mInv = mat3(
996			vec3( t1.x, 0, t1.y ),
997			vec3(    0, 1,    0 ),
998			vec3( t1.z, 0, t1.w )
999		);
1000		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1001		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1002		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1003	}
1004#endif
1005void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1006	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
1007	vec3 irradiance = dotNL * directLight.color;
1008	#ifdef USE_CLEARCOAT
1009		float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
1010		vec3 ccIrradiance = dotNLcc * directLight.color;
1011		clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1012	#endif
1013	#ifdef USE_SHEEN
1014		sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
1015	#endif
1016	#ifdef USE_IRIDESCENCE
1017		reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
1018	#else
1019		reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
1020	#endif
1021	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1022}
1023void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1024	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1025}
1026void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1027	#ifdef USE_CLEARCOAT
1028		clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1029	#endif
1030	#ifdef USE_SHEEN
1031		sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
1032	#endif
1033	vec3 singleScattering = vec3( 0.0 );
1034	vec3 multiScattering = vec3( 0.0 );
1035	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1036	#ifdef USE_IRIDESCENCE
1037		computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1038	#else
1039		computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1040	#endif
1041	vec3 totalScattering = singleScattering + multiScattering;
1042	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1043	reflectedLight.indirectSpecular += radiance * singleScattering;
1044	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1045	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1046}
1047#define RE_Direct				RE_Direct_Physical
1048#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1049#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1050#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1051float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1052	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1053}`,A_=`
1054GeometricContext geometry;
1055geometry.position = - vViewPosition;
1056geometry.normal = normal;
1057geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1058#ifdef USE_CLEARCOAT
1059	geometry.clearcoatNormal = clearcoatNormal;
1060#endif
1061#ifdef USE_IRIDESCENCE
1062	float dotNVi = saturate( dot( normal, geometry.viewDir ) );
1063	if ( material.iridescenceThickness == 0.0 ) {
1064		material.iridescence = 0.0;
1065	} else {
1066		material.iridescence = saturate( material.iridescence );
1067	}
1068	if ( material.iridescence > 0.0 ) {
1069		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1070		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1071	}
1072#endif
1073IncidentLight directLight;
1074#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1075	PointLight pointLight;
1076	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1077	PointLightShadow pointLightShadow;
1078	#endif
1079	#pragma unroll_loop_start
1080	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1081		pointLight = pointLights[ i ];
1082		getPointLightInfo( pointLight, geometry, directLight );
1083		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1084		pointLightShadow = pointLightShadows[ i ];
1085		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1086		#endif
1087		RE_Direct( directLight, geometry, material, reflectedLight );
1088	}
1089	#pragma unroll_loop_end
1090#endif
1091#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1092	SpotLight spotLight;
1093	vec4 spotColor;
1094	vec3 spotLightCoord;
1095	bool inSpotLightMap;
1096	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1097	SpotLightShadow spotLightShadow;
1098	#endif
1099	#pragma unroll_loop_start
1100	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1101		spotLight = spotLights[ i ];
1102		getSpotLightInfo( spotLight, geometry, directLight );
1103		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1104		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1105		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1106		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1107		#else
1108		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1109		#endif
1110		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1111			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1112			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1113			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1114			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1115		#endif
1116		#undef SPOT_LIGHT_MAP_INDEX
1117		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1118		spotLightShadow = spotLightShadows[ i ];
1119		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1120		#endif
1121		RE_Direct( directLight, geometry, material, reflectedLight );
1122	}
1123	#pragma unroll_loop_end
1124#endif
1125#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1126	DirectionalLight directionalLight;
1127	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1128	DirectionalLightShadow directionalLightShadow;
1129	#endif
1130	#pragma unroll_loop_start
1131	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1132		directionalLight = directionalLights[ i ];
1133		getDirectionalLightInfo( directionalLight, geometry, directLight );
1134		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1135		directionalLightShadow = directionalLightShadows[ i ];
1136		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1137		#endif
1138		RE_Direct( directLight, geometry, material, reflectedLight );
1139	}
1140	#pragma unroll_loop_end
1141#endif
1142#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1143	RectAreaLight rectAreaLight;
1144	#pragma unroll_loop_start
1145	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1146		rectAreaLight = rectAreaLights[ i ];
1147		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
1148	}
1149	#pragma unroll_loop_end
1150#endif
1151#if defined( RE_IndirectDiffuse )
1152	vec3 iblIrradiance = vec3( 0.0 );
1153	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1154	irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
1155	#if ( NUM_HEMI_LIGHTS > 0 )
1156		#pragma unroll_loop_start
1157		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1158			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
1159		}
1160		#pragma unroll_loop_end
1161	#endif
1162#endif
1163#if defined( RE_IndirectSpecular )
1164	vec3 radiance = vec3( 0.0 );
1165	vec3 clearcoatRadiance = vec3( 0.0 );
1166#endif`,C_=`#if defined( RE_IndirectDiffuse )
1167	#ifdef USE_LIGHTMAP
1168		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
1169		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1170		irradiance += lightMapIrradiance;
1171	#endif
1172	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1173		iblIrradiance += getIBLIrradiance( geometry.normal );
1174	#endif
1175#endif
1176#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1177	radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
1178	#ifdef USE_CLEARCOAT
1179		clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
1180	#endif
1181#endif`,I_=`#if defined( RE_IndirectDiffuse )
1182	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
1183#endif
1184#if defined( RE_IndirectSpecular )
1185	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
1186#endif`,R_=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1187	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1188#endif`,P_=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1189	uniform float logDepthBufFC;
1190	varying float vFragDepth;
1191	varying float vIsPerspective;
1192#endif`,L_=`#ifdef USE_LOGDEPTHBUF
1193	#ifdef USE_LOGDEPTHBUF_EXT
1194		varying float vFragDepth;
1195		varying float vIsPerspective;
1196	#else
1197		uniform float logDepthBufFC;
1198	#endif
1199#endif`,N_=`#ifdef USE_LOGDEPTHBUF
1200	#ifdef USE_LOGDEPTHBUF_EXT
1201		vFragDepth = 1.0 + gl_Position.w;
1202		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1203	#else
1204		if ( isPerspectiveMatrix( projectionMatrix ) ) {
1205			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
1206			gl_Position.z *= gl_Position.w;
1207		}
1208	#endif
1209#endif`,O_=`#ifdef USE_MAP
1210	vec4 sampledDiffuseColor = texture2D( map, vUv );
1211	#ifdef DECODE_VIDEO_TEXTURE
1212		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 );
1213	#endif
1214	diffuseColor *= sampledDiffuseColor;
1215#endif`,D_=`#ifdef USE_MAP
1216	uniform sampler2D map;
1217#endif`,k_=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1218	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1219#endif
1220#ifdef USE_MAP
1221	diffuseColor *= texture2D( map, uv );
1222#endif
1223#ifdef USE_ALPHAMAP
1224	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1225#endif`,F_=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1226	uniform mat3 uvTransform;
1227#endif
1228#ifdef USE_MAP
1229	uniform sampler2D map;
1230#endif
1231#ifdef USE_ALPHAMAP
1232	uniform sampler2D alphaMap;
1233#endif`,U_=`float metalnessFactor = metalness;
1234#ifdef USE_METALNESSMAP
1235	vec4 texelMetalness = texture2D( metalnessMap, vUv );
1236	metalnessFactor *= texelMetalness.b;
1237#endif`,B_=`#ifdef USE_METALNESSMAP
1238	uniform sampler2D metalnessMap;
1239#endif`,G_=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
1240	vColor *= morphTargetBaseInfluence;
1241	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1242		#if defined( USE_COLOR_ALPHA )
1243			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1244		#elif defined( USE_COLOR )
1245			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1246		#endif
1247	}
1248#endif`,z_=`#ifdef USE_MORPHNORMALS
1249	objectNormal *= morphTargetBaseInfluence;
1250	#ifdef MORPHTARGETS_TEXTURE
1251		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1252			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1253		}
1254	#else
1255		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
1256		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
1257		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
1258		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
1259	#endif
1260#endif`,V_=`#ifdef USE_MORPHTARGETS
1261	uniform float morphTargetBaseInfluence;
1262	#ifdef MORPHTARGETS_TEXTURE
1263		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1264		uniform sampler2DArray morphTargetsTexture;
1265		uniform ivec2 morphTargetsTextureSize;
1266		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1267			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1268			int y = texelIndex / morphTargetsTextureSize.x;
1269			int x = texelIndex - y * morphTargetsTextureSize.x;
1270			ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1271			return texelFetch( morphTargetsTexture, morphUV, 0 );
1272		}
1273	#else
1274		#ifndef USE_MORPHNORMALS
1275			uniform float morphTargetInfluences[ 8 ];
1276		#else
1277			uniform float morphTargetInfluences[ 4 ];
1278		#endif
1279	#endif
1280#endif`,H_=`#ifdef USE_MORPHTARGETS
1281	transformed *= morphTargetBaseInfluence;
1282	#ifdef MORPHTARGETS_TEXTURE
1283		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1284			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1285		}
1286	#else
1287		transformed += morphTarget0 * morphTargetInfluences[ 0 ];
1288		transformed += morphTarget1 * morphTargetInfluences[ 1 ];
1289		transformed += morphTarget2 * morphTargetInfluences[ 2 ];
1290		transformed += morphTarget3 * morphTargetInfluences[ 3 ];
1291		#ifndef USE_MORPHNORMALS
1292			transformed += morphTarget4 * morphTargetInfluences[ 4 ];
1293			transformed += morphTarget5 * morphTargetInfluences[ 5 ];
1294			transformed += morphTarget6 * morphTargetInfluences[ 6 ];
1295			transformed += morphTarget7 * morphTargetInfluences[ 7 ];
1296		#endif
1297	#endif
1298#endif`,W_=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1299#ifdef FLAT_SHADED
1300	vec3 fdx = dFdx( vViewPosition );
1301	vec3 fdy = dFdy( vViewPosition );
1302	vec3 normal = normalize( cross( fdx, fdy ) );
1303#else
1304	vec3 normal = normalize( vNormal );
1305	#ifdef DOUBLE_SIDED
1306		normal = normal * faceDirection;
1307	#endif
1308	#ifdef USE_TANGENT
1309		vec3 tangent = normalize( vTangent );
1310		vec3 bitangent = normalize( vBitangent );
1311		#ifdef DOUBLE_SIDED
1312			tangent = tangent * faceDirection;
1313			bitangent = bitangent * faceDirection;
1314		#endif
1315		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
1316			mat3 vTBN = mat3( tangent, bitangent, normal );
1317		#endif
1318	#endif
1319#endif
1320vec3 geometryNormal = normal;`,j_=`#ifdef OBJECTSPACE_NORMALMAP
1321	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1322	#ifdef FLIP_SIDED
1323		normal = - normal;
1324	#endif
1325	#ifdef DOUBLE_SIDED
1326		normal = normal * faceDirection;
1327	#endif
1328	normal = normalize( normalMatrix * normal );
1329#elif defined( TANGENTSPACE_NORMALMAP )
1330	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1331	mapN.xy *= normalScale;
1332	#ifdef USE_TANGENT
1333		normal = normalize( vTBN * mapN );
1334	#else
1335		normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
1336	#endif
1337#elif defined( USE_BUMPMAP )
1338	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1339#endif`,q_=`#ifndef FLAT_SHADED
1340	varying vec3 vNormal;
1341	#ifdef USE_TANGENT
1342		varying vec3 vTangent;
1343		varying vec3 vBitangent;
1344	#endif
1345#endif`,X_=`#ifndef FLAT_SHADED
1346	varying vec3 vNormal;
1347	#ifdef USE_TANGENT
1348		varying vec3 vTangent;
1349		varying vec3 vBitangent;
1350	#endif
1351#endif`,Y_=`#ifndef FLAT_SHADED
1352	vNormal = normalize( transformedNormal );
1353	#ifdef USE_TANGENT
1354		vTangent = normalize( transformedTangent );
1355		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1356	#endif
1357#endif`,Z_=`#ifdef USE_NORMALMAP
1358	uniform sampler2D normalMap;
1359	uniform vec2 normalScale;
1360#endif
1361#ifdef OBJECTSPACE_NORMALMAP
1362	uniform mat3 normalMatrix;
1363#endif
1364#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
1365	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
1366		vec3 q0 = dFdx( eye_pos.xyz );
1367		vec3 q1 = dFdy( eye_pos.xyz );
1368		vec2 st0 = dFdx( vUv.st );
1369		vec2 st1 = dFdy( vUv.st );
1370		vec3 N = surf_norm;
1371		vec3 q1perp = cross( q1, N );
1372		vec3 q0perp = cross( N, q0 );
1373		vec3 T = q1perp * st0.x + q0perp * st1.x;
1374		vec3 B = q1perp * st0.y + q0perp * st1.y;
1375		float det = max( dot( T, T ), dot( B, B ) );
1376		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
1377		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
1378	}
1379#endif`,K_=`#ifdef USE_CLEARCOAT
1380	vec3 clearcoatNormal = geometryNormal;
1381#endif`,J_=`#ifdef USE_CLEARCOAT_NORMALMAP
1382	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
1383	clearcoatMapN.xy *= clearcoatNormalScale;
1384	#ifdef USE_TANGENT
1385		clearcoatNormal = normalize( vTBN * clearcoatMapN );
1386	#else
1387		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
1388	#endif
1389#endif`,$_=`#ifdef USE_CLEARCOATMAP
1390	uniform sampler2D clearcoatMap;
1391#endif
1392#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1393	uniform sampler2D clearcoatRoughnessMap;
1394#endif
1395#ifdef USE_CLEARCOAT_NORMALMAP
1396	uniform sampler2D clearcoatNormalMap;
1397	uniform vec2 clearcoatNormalScale;
1398#endif`,Q_=`#ifdef USE_IRIDESCENCEMAP
1399	uniform sampler2D iridescenceMap;
1400#endif
1401#ifdef USE_IRIDESCENCE_THICKNESSMAP
1402	uniform sampler2D iridescenceThicknessMap;
1403#endif`,eb=`#ifdef OPAQUE
1404diffuseColor.a = 1.0;
1405#endif
1406#ifdef USE_TRANSMISSION
1407diffuseColor.a *= material.transmissionAlpha + 0.1;
1408#endif
1409gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,tb=`vec3 packNormalToRGB( const in vec3 normal ) {
1410	return normalize( normal ) * 0.5 + 0.5;
1411}
1412vec3 unpackRGBToNormal( const in vec3 rgb ) {
1413	return 2.0 * rgb.xyz - 1.0;
1414}
1415const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
1416const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1417const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1418const float ShiftRight8 = 1. / 256.;
1419vec4 packDepthToRGBA( const in float v ) {
1420	vec4 r = vec4( fract( v * PackFactors ), v );
1421	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
1422}
1423float unpackRGBAToDepth( const in vec4 v ) {
1424	return dot( v, UnpackFactors );
1425}
1426vec2 packDepthToRG( in highp float v ) {
1427	return packDepthToRGBA( v ).yx;
1428}
1429float unpackRGToDepth( const in highp vec2 v ) {
1430	return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
1431}
1432vec4 pack2HalfToRGBA( vec2 v ) {
1433	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1434	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1435}
1436vec2 unpackRGBATo2Half( vec4 v ) {
1437	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1438}
1439float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1440	return ( viewZ + near ) / ( near - far );
1441}
1442float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
1443	return linearClipZ * ( near - far ) - near;
1444}
1445float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1446	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1447}
1448float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
1449	return ( near * far ) / ( ( far - near ) * invClipZ - far );
1450}`,nb=`#ifdef PREMULTIPLIED_ALPHA
1451	gl_FragColor.rgb *= gl_FragColor.a;
1452#endif`,ib=`vec4 mvPosition = vec4( transformed, 1.0 );
1453#ifdef USE_INSTANCING
1454	mvPosition = instanceMatrix * mvPosition;
1455#endif
1456mvPosition = modelViewMatrix * mvPosition;
1457gl_Position = projectionMatrix * mvPosition;`,rb=`#ifdef DITHERING
1458	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1459#endif`,sb=`#ifdef DITHERING
1460	vec3 dithering( vec3 color ) {
1461		float grid_position = rand( gl_FragCoord.xy );
1462		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1463		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1464		return color + dither_shift_RGB;
1465	}
1466#endif`,ob=`float roughnessFactor = roughness;
1467#ifdef USE_ROUGHNESSMAP
1468	vec4 texelRoughness = texture2D( roughnessMap, vUv );
1469	roughnessFactor *= texelRoughness.g;
1470#endif`,ab=`#ifdef USE_ROUGHNESSMAP
1471	uniform sampler2D roughnessMap;
1472#endif`,lb=`#if NUM_SPOT_LIGHT_COORDS > 0
1473  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1474#endif
1475#if NUM_SPOT_LIGHT_MAPS > 0
1476  uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1477#endif
1478#ifdef USE_SHADOWMAP
1479	#if NUM_DIR_LIGHT_SHADOWS > 0
1480		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1481		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1482		struct DirectionalLightShadow {
1483			float shadowBias;
1484			float shadowNormalBias;
1485			float shadowRadius;
1486			vec2 shadowMapSize;
1487		};
1488		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1489	#endif
1490	#if NUM_SPOT_LIGHT_SHADOWS > 0
1491		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1492		struct SpotLightShadow {
1493			float shadowBias;
1494			float shadowNormalBias;
1495			float shadowRadius;
1496			vec2 shadowMapSize;
1497		};
1498		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1499	#endif
1500	#if NUM_POINT_LIGHT_SHADOWS > 0
1501		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1502		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1503		struct PointLightShadow {
1504			float shadowBias;
1505			float shadowNormalBias;
1506			float shadowRadius;
1507			vec2 shadowMapSize;
1508			float shadowCameraNear;
1509			float shadowCameraFar;
1510		};
1511		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1512	#endif
1513	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1514		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1515	}
1516	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1517		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1518	}
1519	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1520		float occlusion = 1.0;
1521		vec2 distribution = texture2DDistribution( shadow, uv );
1522		float hard_shadow = step( compare , distribution.x );
1523		if (hard_shadow != 1.0 ) {
1524			float distance = compare - distribution.x ;
1525			float variance = max( 0.00000, distribution.y * distribution.y );
1526			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 );
1527		}
1528		return occlusion;
1529	}
1530	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1531		float shadow = 1.0;
1532		shadowCoord.xyz /= shadowCoord.w;
1533		shadowCoord.z += shadowBias;
1534		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
1535		bool inFrustum = all( inFrustumVec );
1536		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
1537		bool frustumTest = all( frustumTestVec );
1538		if ( frustumTest ) {
1539		#if defined( SHADOWMAP_TYPE_PCF )
1540			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1541			float dx0 = - texelSize.x * shadowRadius;
1542			float dy0 = - texelSize.y * shadowRadius;
1543			float dx1 = + texelSize.x * shadowRadius;
1544			float dy1 = + texelSize.y * shadowRadius;
1545			float dx2 = dx0 / 2.0;
1546			float dy2 = dy0 / 2.0;
1547			float dx3 = dx1 / 2.0;
1548			float dy3 = dy1 / 2.0;
1549			shadow = (
1550				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1551				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1552				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1553				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1554				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1555				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1556				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1557				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1558				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1559				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1560				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1561				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1562				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1563				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1564				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1565				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1566				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1567			) * ( 1.0 / 17.0 );
1568		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1569			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1570			float dx = texelSize.x;
1571			float dy = texelSize.y;
1572			vec2 uv = shadowCoord.xy;
1573			vec2 f = fract( uv * shadowMapSize + 0.5 );
1574			uv -= f * texelSize;
1575			shadow = (
1576				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1577				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1578				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1579				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1580				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1581					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1582					 f.x ) +
1583				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1584					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1585					 f.x ) +
1586				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1587					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1588					 f.y ) +
1589				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1590					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1591					 f.y ) +
1592				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1593						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1594						  f.x ),
1595					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1596						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1597						  f.x ),
1598					 f.y )
1599			) * ( 1.0 / 9.0 );
1600		#elif defined( SHADOWMAP_TYPE_VSM )
1601			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1602		#else
1603			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1604		#endif
1605		}
1606		return shadow;
1607	}
1608	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1609		vec3 absV = abs( v );
1610		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1611		absV *= scaleToCube;
1612		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1613		vec2 planar = v.xy;
1614		float almostATexel = 1.5 * texelSizeY;
1615		float almostOne = 1.0 - almostATexel;
1616		if ( absV.z >= almostOne ) {
1617			if ( v.z > 0.0 )
1618				planar.x = 4.0 - v.x;
1619		} else if ( absV.x >= almostOne ) {
1620			float signX = sign( v.x );
1621			planar.x = v.z * signX + 2.0 * signX;
1622		} else if ( absV.y >= almostOne ) {
1623			float signY = sign( v.y );
1624			planar.x = v.x + 2.0 * signY + 2.0;
1625			planar.y = v.z * signY - 2.0;
1626		}
1627		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1628	}
1629	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1630		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1631		vec3 lightToPosition = shadowCoord.xyz;
1632		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
1633		vec3 bd3D = normalize( lightToPosition );
1634		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1635			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1636			return (
1637				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1638				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1639				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1640				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1641				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1642				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1643				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1644				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1645				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1646			) * ( 1.0 / 9.0 );
1647		#else
1648			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1649		#endif
1650	}
1651#endif`,cb=`#if NUM_SPOT_LIGHT_COORDS > 0
1652  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1653  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1654#endif
1655#ifdef USE_SHADOWMAP
1656	#if NUM_DIR_LIGHT_SHADOWS > 0
1657		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1658		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1659		struct DirectionalLightShadow {
1660			float shadowBias;
1661			float shadowNormalBias;
1662			float shadowRadius;
1663			vec2 shadowMapSize;
1664		};
1665		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1666	#endif
1667	#if NUM_SPOT_LIGHT_SHADOWS > 0
1668		struct SpotLightShadow {
1669			float shadowBias;
1670			float shadowNormalBias;
1671			float shadowRadius;
1672			vec2 shadowMapSize;
1673		};
1674		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1675	#endif
1676	#if NUM_POINT_LIGHT_SHADOWS > 0
1677		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1678		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1679		struct PointLightShadow {
1680			float shadowBias;
1681			float shadowNormalBias;
1682			float shadowRadius;
1683			vec2 shadowMapSize;
1684			float shadowCameraNear;
1685			float shadowCameraFar;
1686		};
1687		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1688	#endif
1689#endif`,ub=`#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1690	#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
1691		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1692		vec4 shadowWorldPosition;
1693	#endif
1694	#if NUM_DIR_LIGHT_SHADOWS > 0
1695	#pragma unroll_loop_start
1696	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1697		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1698		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1699	}
1700	#pragma unroll_loop_end
1701	#endif
1702	#if NUM_SPOT_LIGHT_COORDS > 0
1703	#pragma unroll_loop_start
1704	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1705		shadowWorldPosition = worldPosition;
1706		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1707			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1708		#endif
1709		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1710	}
1711	#pragma unroll_loop_end
1712	#endif
1713	#if NUM_POINT_LIGHT_SHADOWS > 0
1714	#pragma unroll_loop_start
1715	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1716		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1717		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1718	}
1719	#pragma unroll_loop_end
1720	#endif
1721#endif`,hb=`float getShadowMask() {
1722	float shadow = 1.0;
1723	#ifdef USE_SHADOWMAP
1724	#if NUM_DIR_LIGHT_SHADOWS > 0
1725	DirectionalLightShadow directionalLight;
1726	#pragma unroll_loop_start
1727	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1728		directionalLight = directionalLightShadows[ i ];
1729		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1730	}
1731	#pragma unroll_loop_end
1732	#endif
1733	#if NUM_SPOT_LIGHT_SHADOWS > 0
1734	SpotLightShadow spotLight;
1735	#pragma unroll_loop_start
1736	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1737		spotLight = spotLightShadows[ i ];
1738		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1739	}
1740	#pragma unroll_loop_end
1741	#endif
1742	#if NUM_POINT_LIGHT_SHADOWS > 0
1743	PointLightShadow pointLight;
1744	#pragma unroll_loop_start
1745	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1746		pointLight = pointLightShadows[ i ];
1747		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1748	}
1749	#pragma unroll_loop_end
1750	#endif
1751	#endif
1752	return shadow;
1753}`,fb=`#ifdef USE_SKINNING
1754	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1755	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1756	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1757	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1758#endif`,db=`#ifdef USE_SKINNING
1759	uniform mat4 bindMatrix;
1760	uniform mat4 bindMatrixInverse;
1761	uniform highp sampler2D boneTexture;
1762	uniform int boneTextureSize;
1763	mat4 getBoneMatrix( const in float i ) {
1764		float j = i * 4.0;
1765		float x = mod( j, float( boneTextureSize ) );
1766		float y = floor( j / float( boneTextureSize ) );
1767		float dx = 1.0 / float( boneTextureSize );
1768		float dy = 1.0 / float( boneTextureSize );
1769		y = dy * ( y + 0.5 );
1770		vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
1771		vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
1772		vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
1773		vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
1774		mat4 bone = mat4( v1, v2, v3, v4 );
1775		return bone;
1776	}
1777#endif`,pb=`#ifdef USE_SKINNING
1778	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
1779	vec4 skinned = vec4( 0.0 );
1780	skinned += boneMatX * skinVertex * skinWeight.x;
1781	skinned += boneMatY * skinVertex * skinWeight.y;
1782	skinned += boneMatZ * skinVertex * skinWeight.z;
1783	skinned += boneMatW * skinVertex * skinWeight.w;
1784	transformed = ( bindMatrixInverse * skinned ).xyz;
1785#endif`,mb=`#ifdef USE_SKINNING
1786	mat4 skinMatrix = mat4( 0.0 );
1787	skinMatrix += skinWeight.x * boneMatX;
1788	skinMatrix += skinWeight.y * boneMatY;
1789	skinMatrix += skinWeight.z * boneMatZ;
1790	skinMatrix += skinWeight.w * boneMatW;
1791	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
1792	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
1793	#ifdef USE_TANGENT
1794		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
1795	#endif
1796#endif`,gb=`float specularStrength;
1797#ifdef USE_SPECULARMAP
1798	vec4 texelSpecular = texture2D( specularMap, vUv );
1799	specularStrength = texelSpecular.r;
1800#else
1801	specularStrength = 1.0;
1802#endif`,xb=`#ifdef USE_SPECULARMAP
1803	uniform sampler2D specularMap;
1804#endif`,yb=`#if defined( TONE_MAPPING )
1805	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
1806#endif`,vb=`#ifndef saturate
1807#define saturate( a ) clamp( a, 0.0, 1.0 )
1808#endif
1809uniform float toneMappingExposure;
1810vec3 LinearToneMapping( vec3 color ) {
1811	return toneMappingExposure * color;
1812}
1813vec3 ReinhardToneMapping( vec3 color ) {
1814	color *= toneMappingExposure;
1815	return saturate( color / ( vec3( 1.0 ) + color ) );
1816}
1817vec3 OptimizedCineonToneMapping( vec3 color ) {
1818	color *= toneMappingExposure;
1819	color = max( vec3( 0.0 ), color - 0.004 );
1820	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
1821}
1822vec3 RRTAndODTFit( vec3 v ) {
1823	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
1824	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
1825	return a / b;
1826}
1827vec3 ACESFilmicToneMapping( vec3 color ) {
1828	const mat3 ACESInputMat = mat3(
1829		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
1830		vec3( 0.04823, 0.01566, 0.83777 )
1831	);
1832	const mat3 ACESOutputMat = mat3(
1833		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
1834		vec3( -0.07367, -0.00605,  1.07602 )
1835	);
1836	color *= toneMappingExposure / 0.6;
1837	color = ACESInputMat * color;
1838	color = RRTAndODTFit( color );
1839	color = ACESOutputMat * color;
1840	return saturate( color );
1841}
1842vec3 CustomToneMapping( vec3 color ) { return color; }`,_b=`#ifdef USE_TRANSMISSION
1843	material.transmission = transmission;
1844	material.transmissionAlpha = 1.0;
1845	material.thickness = thickness;
1846	material.attenuationDistance = attenuationDistance;
1847	material.attenuationColor = attenuationColor;
1848	#ifdef USE_TRANSMISSIONMAP
1849		material.transmission *= texture2D( transmissionMap, vUv ).r;
1850	#endif
1851	#ifdef USE_THICKNESSMAP
1852		material.thickness *= texture2D( thicknessMap, vUv ).g;
1853	#endif
1854	vec3 pos = vWorldPosition;
1855	vec3 v = normalize( cameraPosition - pos );
1856	vec3 n = inverseTransformDirection( normal, viewMatrix );
1857	vec4 transmission = getIBLVolumeRefraction(
1858		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
1859		pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
1860		material.attenuationColor, material.attenuationDistance );
1861	material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );
1862	totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
1863#endif`,bb=`#ifdef USE_TRANSMISSION
1864	uniform float transmission;
1865	uniform float thickness;
1866	uniform float attenuationDistance;
1867	uniform vec3 attenuationColor;
1868	#ifdef USE_TRANSMISSIONMAP
1869		uniform sampler2D transmissionMap;
1870	#endif
1871	#ifdef USE_THICKNESSMAP
1872		uniform sampler2D thicknessMap;
1873	#endif
1874	uniform vec2 transmissionSamplerSize;
1875	uniform sampler2D transmissionSamplerMap;
1876	uniform mat4 modelMatrix;
1877	uniform mat4 projectionMatrix;
1878	varying vec3 vWorldPosition;
1879	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
1880		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
1881		vec3 modelScale;
1882		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
1883		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
1884		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
1885		return normalize( refractionVector ) * thickness * modelScale;
1886	}
1887	float applyIorToRoughness( const in float roughness, const in float ior ) {
1888		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
1889	}
1890	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
1891		float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
1892		#ifdef texture2DLodEXT
1893			return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
1894		#else
1895			return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
1896		#endif
1897	}
1898	vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
1899		if ( isinf( attenuationDistance ) ) {
1900			return radiance;
1901		} else {
1902			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
1903			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance * radiance;
1904		}
1905	}
1906	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
1907		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
1908		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
1909		const in vec3 attenuationColor, const in float attenuationDistance ) {
1910		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
1911		vec3 refractedRayExit = position + transmissionRay;
1912		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
1913		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
1914		refractionCoords += 1.0;
1915		refractionCoords /= 2.0;
1916		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
1917		vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
1918		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
1919		return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
1920	}
1921#endif`,Tb=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
1922	varying vec2 vUv;
1923#endif`,Mb=`#ifdef USE_UV
1924	#ifdef UVS_VERTEX_ONLY
1925		vec2 vUv;
1926	#else
1927		varying vec2 vUv;
1928	#endif
1929	uniform mat3 uvTransform;
1930#endif`,wb=`#ifdef USE_UV
1931	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1932#endif`,Sb=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1933	varying vec2 vUv2;
1934#endif`,Eb=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1935	attribute vec2 uv2;
1936	varying vec2 vUv2;
1937	uniform mat3 uv2Transform;
1938#endif`,Ab=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1939	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
1940#endif`,Cb=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
1940IGHT_COORDS > 0
1941	vec4 worldPosition = vec4( transformed, 1.0 );
1942	#ifdef USE_INSTANCING
1943		worldPosition = instanceMatrix * worldPosition;
1944	#endif
1945	worldPosition = modelMatrix * worldPosition;
1946#endif`,Ib=`varying vec2 vUv;
1947uniform mat3 uvTransform;
1948void main() {
1949	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1950	gl_Position = vec4( position.xy, 1.0, 1.0 );
1951}`,Rb=`uniform sampler2D t2D;
1952uniform float backgroundIntensity;
1953varying vec2 vUv;
1954void main() {
1955	vec4 texColor = texture2D( t2D, vUv );
1956	#ifdef DECODE_VIDEO_TEXTURE
1957		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 );
1958	#endif
1959	texColor.rgb *= backgroundIntensity;
1960	gl_FragColor = texColor;
1961	#include <tonemapping_fragment>
1962	#include <encodings_fragment>
1963}`,Pb=`varying vec3 vWorldDirection;
1964#include <common>
1965void main() {
1966	vWorldDirection = transformDirection( position, modelMatrix );
1967	#include <begin_vertex>
1968	#include <project_vertex>
1969	gl_Position.z = gl_Position.w;
1970}`,Lb=`#ifdef ENVMAP_TYPE_CUBE
1971	uniform samplerCube envMap;
1972#elif defined( ENVMAP_TYPE_CUBE_UV )
1973	uniform sampler2D envMap;
1974#endif
1975uniform float flipEnvMap;
1976uniform float backgroundBlurriness;
1977uniform float backgroundIntensity;
1978varying vec3 vWorldDirection;
1979#include <cube_uv_reflection_fragment>
1980void main() {
1981	#ifdef ENVMAP_TYPE_CUBE
1982		vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
1983	#elif defined( ENVMAP_TYPE_CUBE_UV )
1984		vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
1985	#else
1986		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
1987	#endif
1988	texColor.rgb *= backgroundIntensity;
1989	gl_FragColor = texColor;
1990	#include <tonemapping_fragment>
1991	#include <encodings_fragment>
1992}`,Nb=`varying vec3 vWorldDirection;
1993#include <common>
1994void main() {
1995	vWorldDirection = transformDirection( position, modelMatrix );
1996	#include <begin_vertex>
1997	#include <project_vertex>
1998	gl_Position.z = gl_Position.w;
1999}`,Ob=`uniform samplerCube tCube;
2000uniform float tFlip;
2001uniform float opacity;
2002varying vec3 vWorldDirection;
2003void main() {
2004	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2005	gl_FragColor = texColor;
2006	gl_FragColor.a *= opacity;
2007	#include <tonemapping_fragment>
2008	#include <encodings_fragment>
2009}`,Db=`#include <common>
2010#include <uv_pars_vertex>
2011#include <displacementmap_pars_vertex>
2012#include <morphtarget_pars_vertex>
2013#include <skinning_pars_vertex>
2014#include <logdepthbuf_pars_vertex>
2015#include <clipping_planes_pars_vertex>
2016varying vec2 vHighPrecisionZW;
2017void main() {
2018	#include <uv_vertex>
2019	#include <skinbase_vertex>
2020	#ifdef USE_DISPLACEMENTMAP
2021		#include <beginnormal_vertex>
2022		#include <morphnormal_vertex>
2023		#include <skinnormal_vertex>
2024	#endif
2025	#include <begin_vertex>
2026	#include <morphtarget_vertex>
2027	#include <skinning_vertex>
2028	#include <displacementmap_vertex>
2029	#include <project_vertex>
2030	#include <logdepthbuf_vertex>
2031	#include <clipping_planes_vertex>
2032	vHighPrecisionZW = gl_Position.zw;
2033}`,kb=`#if DEPTH_PACKING == 3200
2034	uniform float opacity;
2035#endif
2036#include <common>
2037#include <packing>
2038#include <uv_pars_fragment>
2039#include <map_pars_fragment>
2040#include <alphamap_pars_fragment>
2041#include <alphatest_pars_fragment>
2042#include <logdepthbuf_pars_fragment>
2043#include <clipping_planes_pars_fragment>
2044varying vec2 vHighPrecisionZW;
2045void main() {
2046	#include <clipping_planes_fragment>
2047	vec4 diffuseColor = vec4( 1.0 );
2048	#if DEPTH_PACKING == 3200
2049		diffuseColor.a = opacity;
2050	#endif
2051	#include <map_fragment>
2052	#include <alphamap_fragment>
2053	#include <alphatest_fragment>
2054	#include <logdepthbuf_fragment>
2055	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2056	#if DEPTH_PACKING == 3200
2057		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2058	#elif DEPTH_PACKING == 3201
2059		gl_FragColor = packDepthToRGBA( fragCoordZ );
2060	#endif
2061}`,Fb=`#define DISTANCE
2062varying vec3 vWorldPosition;
2063#include <common>
2064#include <uv_pars_vertex>
2065#include <displacementmap_pars_vertex>
2066#include <morphtarget_pars_vertex>
2067#include <skinning_pars_vertex>
2068#include <clipping_planes_pars_vertex>
2069void main() {
2070	#include <uv_vertex>
2071	#include <skinbase_vertex>
2072	#ifdef USE_DISPLACEMENTMAP
2073		#include <beginnormal_vertex>
2074		#include <morphnormal_vertex>
2075		#include <skinnormal_vertex>
2076	#endif
2077	#include <begin_vertex>
2078	#include <morphtarget_vertex>
2079	#include <skinning_vertex>
2080	#include <displacementmap_vertex>
2081	#include <project_vertex>
2082	#include <worldpos_vertex>
2083	#include <clipping_planes_vertex>
2084	vWorldPosition = worldPosition.xyz;
2085}`,Ub=`#define DISTANCE
2086uniform vec3 referencePosition;
2087uniform float nearDistance;
2088uniform float farDistance;
2089varying vec3 vWorldPosition;
2090#include <common>
2091#include <packing>
2092#include <uv_pars_fragment>
2093#include <map_pars_fragment>
2094#include <alphamap_pars_fragment>
2095#include <alphatest_pars_fragment>
2096#include <clipping_planes_pars_fragment>
2097void main () {
2098	#include <clipping_planes_fragment>
2099	vec4 diffuseColor = vec4( 1.0 );
2100	#include <map_fragment>
2101	#include <alphamap_fragment>
2102	#include <alphatest_fragment>
2103	float dist = length( vWorldPosition - referencePosition );
2104	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2105	dist = saturate( dist );
2106	gl_FragColor = packDepthToRGBA( dist );
2107}`,Bb=`varying vec3 vWorldDirection;
2108#include <common>
2109void main() {
2110	vWorldDirection = transformDirection( position, modelMatrix );
2111	#include <begin_vertex>
2112	#include <project_vertex>
2113}`,Gb=`uniform sampler2D tEquirect;
2114varying vec3 vWorldDirection;
2115#include <common>
2116void main() {
2117	vec3 direction = normalize( vWorldDirection );
2118	vec2 sampleUV = equirectUv( direction );
2119	gl_FragColor = texture2D( tEquirect, sampleUV );
2120	#include <tonemapping_fragment>
2121	#include <encodings_fragment>
2122}`,zb=`uniform float scale;
2123attribute float lineDistance;
2124varying float vLineDistance;
2125#include <common>
2126#include <color_pars_vertex>
2127#include <fog_pars_vertex>
2128#include <morphtarget_pars_vertex>
2129#include <logdepthbuf_pars_vertex>
2130#include <clipping_planes_pars_vertex>
2131void main() {
2132	vLineDistance = scale * lineDistance;
2133	#include <color_vertex>
2134	#include <morphcolor_vertex>
2135	#include <begin_vertex>
2136	#include <morphtarget_vertex>
2137	#include <project_vertex>
2138	#include <logdepthbuf_vertex>
2139	#include <clipping_planes_vertex>
2140	#include <fog_vertex>
2141}`,Vb=`uniform vec3 diffuse;
2142uniform float opacity;
2143uniform float dashSize;
2144uniform float totalSize;
2145varying float vLineDistance;
2146#include <common>
2147#include <color_pars_fragment>
2148#include <fog_pars_fragment>
2149#include <logdepthbuf_pars_fragment>
2150#include <clipping_planes_pars_fragment>
2151void main() {
2152	#include <clipping_planes_fragment>
2153	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2154		discard;
2155	}
2156	vec3 outgoingLight = vec3( 0.0 );
2157	vec4 diffuseColor = vec4( diffuse, opacity );
2158	#include <logdepthbuf_fragment>
2159	#include <color_fragment>
2160	outgoingLight = diffuseColor.rgb;
2161	#include <output_fragment>
2162	#include <tonemapping_fragment>
2163	#include <encodings_fragment>
2164	#include <fog_fragment>
2165	#include <premultiplied_alpha_fragment>
2166}`,Hb=`#include <common>
2167#include <uv_pars_vertex>
2168#include <uv2_pars_vertex>
2169#include <envmap_pars_vertex>
2170#include <color_pars_vertex>
2171#include <fog_pars_vertex>
2172#include <morphtarget_pars_vertex>
2173#include <skinning_pars_vertex>
2174#include <logdepthbuf_pars_vertex>
2175#include <clipping_planes_pars_vertex>
2176void main() {
2177	#include <uv_vertex>
2178	#include <uv2_vertex>
2179	#include <color_vertex>
2180	#include <morphcolor_vertex>
2181	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2182		#include <beginnormal_vertex>
2183		#include <morphnormal_vertex>
2184		#include <skinbase_vertex>
2185		#include <skinnormal_vertex>
2186		#include <defaultnormal_vertex>
2187	#endif
2188	#include <begin_vertex>
2189	#include <morphtarget_vertex>
2190	#include <skinning_vertex>
2191	#include <project_vertex>
2192	#include <logdepthbuf_vertex>
2193	#include <clipping_planes_vertex>
2194	#include <worldpos_vertex>
2195	#include <envmap_vertex>
2196	#include <fog_vertex>
2197}`,Wb=`uniform vec3 diffuse;
2198uniform float opacity;
2199#ifndef FLAT_SHADED
2200	varying vec3 vNormal;
2201#endif
2202#include <common>
2203#include <dithering_pars_fragment>
2204#include <color_pars_fragment>
2205#include <uv_pars_fragment>
2206#include <uv2_pars_fragment>
2207#include <map_pars_fragment>
2208#include <alphamap_pars_fragment>
2209#include <alphatest_pars_fragment>
2210#include <aomap_pars_fragment>
2211#include <lightmap_pars_fragment>
2212#include <envmap_common_pars_fragment>
2213#include <envmap_pars_fragment>
2214#include <fog_pars_fragment>
2215#include <specularmap_pars_fragment>
2216#include <logdepthbuf_pars_fragment>
2217#include <clipping_planes_pars_fragment>
2218void main() {
2219	#include <clipping_planes_fragment>
2220	vec4 diffuseColor = vec4( diffuse, opacity );
2221	#include <logdepthbuf_fragment>
2222	#include <map_fragment>
2223	#include <color_fragment>
2224	#include <alphamap_fragment>
2225	#include <alphatest_fragment>
2226	#include <specularmap_fragment>
2227	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2228	#ifdef USE_LIGHTMAP
2229		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
2230		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2231	#else
2232		reflectedLight.indirectDiffuse += vec3( 1.0 );
2233	#endif
2234	#include <aomap_fragment>
2235	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2236	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2237	#include <envmap_fragment>
2238	#include <output_fragment>
2239	#include <tonemapping_fragment>
2240	#include <encodings_fragment>
2241	#include <fog_fragment>
2242	#include <premultiplied_alpha_fragment>
2243	#include <dithering_fragment>
2244}`,jb=`#define LAMBERT
2245varying vec3 vViewPosition;
2246#include <common>
2247#include <uv_pars_vertex>
2248#include <uv2_pars_vertex>
2249#include <displacementmap_pars_vertex>
2250#include <envmap_pars_vertex>
2251#include <color_pars_vertex>
2252#include <fog_pars_vertex>
2253#include <normal_pars_vertex>
2254#include <morphtarget_pars_vertex>
2255#include <skinning_pars_vertex>
2256#include <shadowmap_pars_vertex>
2257#include <logdepthbuf_pars_vertex>
2258#include <clipping_planes_pars_vertex>
2259void main() {
2260	#include <uv_vertex>
2261	#include <uv2_vertex>
2262	#include <color_vertex>
2263	#include <morphcolor_vertex>
2264	#include <beginnormal_vertex>
2265	#include <morphnormal_vertex>
2266	#include <skinbase_vertex>
2267	#include <skinnormal_vertex>
2268	#include <defaultnormal_vertex>
2269	#include <normal_vertex>
2270	#include <begin_vertex>
2271	#include <morphtarget_vertex>
2272	#include <skinning_vertex>
2273	#include <displacementmap_vertex>
2274	#include <project_vertex>
2275	#include <logdepthbuf_vertex>
2276	#include <clipping_planes_vertex>
2277	vViewPosition = - mvPosition.xyz;
2278	#include <worldpos_vertex>
2279	#include <envmap_vertex>
2280	#include <shadowmap_vertex>
2281	#include <fog_vertex>
2282}`,qb=`#define LAMBERT
2283uniform vec3 diffuse;
2284uniform vec3 emissive;
2285uniform float opacity;
2286#include <common>
2287#include <packing>
2288#include <dithering_pars_fragment>
2289#include <color_pars_fragment>
2290#include <uv_pars_fragment>
2291#include <uv2_pars_fragment>
2292#include <map_pars_fragment>
2293#include <alphamap_pars_fragment>
2294#include <alphatest_pars_fragment>
2295#include <aomap_pars_fragment>
2296#include <lightmap_pars_fragment>
2297#include <emissivemap_pars_fragment>
2298#include <envmap_common_pars_fragment>
2299#include <envmap_pars_fragment>
2300#include <fog_pars_fragment>
2301#include <bsdfs>
2302#include <lights_pars_begin>
2303#include <normal_pars_fragment>
2304#include <lights_lambert_pars_fragment>
2305#include <shadowmap_pars_fragment>
2306#include <bumpmap_pars_fragment>
2307#include <normalmap_pars_fragment>
2308#include <specularmap_pars_fragment>
2309#include <logdepthbuf_pars_fragment>
2310#include <clipping_planes_pars_fragment>
2311void main() {
2312	#include <clipping_planes_fragment>
2313	vec4 diffuseColor = vec4( diffuse, opacity );
2314	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2315	vec3 totalEmissiveRadiance = emissive;
2316	#include <logdepthbuf_fragment>
2317	#include <map_fragment>
2318	#include <color_fragment>
2319	#include <alphamap_fragment>
2320	#include <alphatest_fragment>
2321	#include <specularmap_fragment>
2322	#include <normal_fragment_begin>
2323	#include <normal_fragment_maps>
2324	#include <emissivemap_fragment>
2325	#include <lights_lambert_fragment>
2326	#include <lights_fragment_begin>
2327	#include <lights_fragment_maps>
2328	#include <lights_fragment_end>
2329	#include <aomap_fragment>
2330	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2331	#include <envmap_fragment>
2332	#include <output_fragment>
2333	#include <tonemapping_fragment>
2334	#include <encodings_fragment>
2335	#include <fog_fragment>
2336	#include <premultiplied_alpha_fragment>
2337	#include <dithering_fragment>
2338}`,Xb=`#define MATCAP
2339varying vec3 vViewPosition;
2340#include <common>
2341#include <uv_pars_vertex>
2342#include <color_pars_vertex>
2343#include <displacementmap_pars_vertex>
2344#include <fog_pars_vertex>
2345#include <normal_pars_vertex>
2346#include <morphtarget_pars_vertex>
2347#include <skinning_pars_vertex>
2348#include <logdepthbuf_pars_vertex>
2349#include <clipping_planes_pars_vertex>
2350void main() {
2351	#include <uv_vertex>
2352	#include <color_vertex>
2353	#include <morphcolor_vertex>
2354	#include <beginnormal_vertex>
2355	#include <morphnormal_vertex>
2356	#include <skinbase_vertex>
2357	#include <skinnormal_vertex>
2358	#include <defaultnormal_vertex>
2359	#include <normal_vertex>
2360	#include <begin_vertex>
2361	#include <morphtarget_vertex>
2362	#include <skinning_vertex>
2363	#include <displacementmap_vertex>
2364	#include <project_vertex>
2365	#include <logdepthbuf_vertex>
2366	#include <clipping_planes_vertex>
2367	#include <fog_vertex>
2368	vViewPosition = - mvPosition.xyz;
2369}`,Yb=`#define MATCAP
2370uniform vec3 diffuse;
2371uniform float opacity;
2372uniform sampler2D matcap;
2373varying vec3 vViewPosition;
2374#include <common>
2375#include <dithering_pars_fragment>
2376#include <color_pars_fragment>
2377#include <uv_pars_fragment>
2378#include <map_pars_fragment>
2379#include <alphamap_pars_fragment>
2380#include <alphatest_pars_fragment>
2381#include <fog_pars_fragment>
2382#include <normal_pars_fragment>
2383#include <bumpmap_pars_fragment>
2384#include <normalmap_pars_fragment>
2385#include <logdepthbuf_pars_fragment>
2386#include <clipping_planes_pars_fragment>
2387void main() {
2388	#include <clipping_planes_fragment>
2389	vec4 diffuseColor = vec4( diffuse, opacity );
2390	#include <logdepthbuf_fragment>
2391	#include <map_fragment>
2392	#include <color_fragment>
2393	#include <alphamap_fragment>
2394	#include <alphatest_fragment>
2395	#include <normal_fragment_begin>
2396	#include <normal_fragment_maps>
2397	vec3 viewDir = normalize( vViewPosition );
2398	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2399	vec3 y = cross( viewDir, x );
2400	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2401	#ifdef USE_MATCAP
2402		vec4 matcapColor = texture2D( matcap, uv );
2403	#else
2404		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
2405	#endif
2406	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2407	#include <output_fragment>
2408	#include <tonemapping_fragment>
2409	#include <encodings_fragment>
2410	#include <fog_fragment>
2411	#include <premultiplied_alpha_fragment>
2412	#include <dithering_fragment>
2413}`,Zb=`#define NORMAL
2414#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2415	varying vec3 vViewPosition;
2416#endif
2417#include <common>
2418#include <uv_pars_vertex>
2419#include <displacementmap_pars_vertex>
2420#include <normal_pars_vertex>
2421#include <morphtarget_pars_vertex>
2422#include <skinning_pars_vertex>
2423#include <logdepthbuf_pars_vertex>
2424#include <clipping_planes_pars_vertex>
2425void main() {
2426	#include <uv_vertex>
2427	#include <beginnormal_vertex>
2428	#include <morphnormal_vertex>
2429	#include <skinbase_vertex>
2430	#include <skinnormal_vertex>
2431	#include <defaultnormal_vertex>
2432	#include <normal_vertex>
2433	#include <begin_vertex>
2434	#include <morphtarget_vertex>
2435	#include <skinning_vertex>
2436	#include <displacementmap_vertex>
2437	#include <project_vertex>
2438	#include <logdepthbuf_vertex>
2439	#include <clipping_planes_vertex>
2440#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2441	vViewPosition = - mvPosition.xyz;
2442#endif
2443}`,Kb=`#define NORMAL
2444uniform float opacity;
2445#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2446	varying vec3 vViewPosition;
2447#endif
2448#include <packing>
2449#include <uv_pars_fragment>
2450#include <normal_pars_fragment>
2451#include <bumpmap_pars_fragment>
2452#include <normalmap_pars_fragment>
2453#include <logdepthbuf_pars_fragment>
2454#include <clipping_planes_pars_fragment>
2455void main() {
2456	#include <clipping_planes_fragment>
2457	#include <logdepthbuf_fragment>
2458	#include <normal_fragment_begin>
2459	#include <normal_fragment_maps>
2460	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
2461	#ifdef OPAQUE
2462		gl_FragColor.a = 1.0;
2463	#endif
2464}`,Jb=`#define PHONG
2465varying vec3 vViewPosition;
2466#include <common>
2467#include <uv_pars_vertex>
2468#include <uv2_pars_vertex>
2469#include <displacementmap_pars_vertex>
2470#include <envmap_pars_vertex>
2471#include <color_pars_vertex>
2472#include <fog_pars_vertex>
2473#include <normal_pars_vertex>
2474#include <morphtarget_pars_vertex>
2475#include <skinning_pars_vertex>
2476#include <shadowmap_pars_vertex>
2477#include <logdepthbuf_pars_vertex>
2478#include <clipping_planes_pars_vertex>
2479void main() {
2480	#include <uv_vertex>
2481	#include <uv2_vertex>
2482	#include <color_vertex>
2483	#include <morphcolor_vertex>
2484	#include <beginnormal_vertex>
2485	#include <morphnormal_vertex>
2486	#include <skinbase_vertex>
2487	#include <skinnormal_vertex>
2488	#include <defaultnormal_vertex>
2489	#include <normal_vertex>
2490	#include <begin_vertex>
2491	#include <morphtarget_vertex>
2492	#include <skinning_vertex>
2493	#include <displacementmap_vertex>
2494	#include <project_vertex>
2495	#include <logdepthbuf_vertex>
2496	#include <clipping_planes_vertex>
2497	vViewPosition = - mvPosition.xyz;
2498	#include <worldpos_vertex>
2499	#include <envmap_vertex>
2500	#include <shadowmap_vertex>
2501	#include <fog_vertex>
2502}`,$b=`#define PHONG
2503uniform vec3 diffuse;
2504uniform vec3 emissive;
2505uniform vec3 specular;
2506uniform float shininess;
2507uniform float opacity;
2508#include <common>
2509#include <packing>
2510#include <dithering_pars_fragment>
2511#include <color_pars_fragment>
2512#include <uv_pars_fragment>
2513#include <uv2_pars_fragment>
2514#include <map_pars_fragment>
2515#include <alphamap_pars_fragment>
2516#include <alphatest_pars_fragment>
2517#include <aomap_pars_fragment>
2518#include <lightmap_pars_fragment>
2519#include <emissivemap_pars_fragment>
2520#include <envmap_common_pars_fragment>
2521#include <envmap_pars_fragment>
2522#include <fog_pars_fragment>
2523#include <bsdfs>
2524#include <lights_pars_begin>
2525#include <normal_pars_fragment>
2526#include <lights_phong_pars_fragment>
2527#include <shadowmap_pars_fragment>
2528#include <bumpmap_pars_fragment>
2529#include <normalmap_pars_fragment>
2530#include <specularmap_pars_fragment>
2531#include <logdepthbuf_pars_fragment>
2532#include <clipping_planes_pars_fragment>
2533void main() {
2534	#include <clipping_planes_fragment>
2535	vec4 diffuseColor = vec4( diffuse, opacity );
2536	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2537	vec3 totalEmissiveRadiance = emissive;
2538	#include <logdepthbuf_fragment>
2539	#include <map_fragment>
2540	#include <color_fragment>
2541	#include <alphamap_fragment>
2542	#include <alphatest_fragment>
2543	#include <specularmap_fragment>
2544	#include <normal_fragment_begin>
2545	#include <normal_fragment_maps>
2546	#include <emissivemap_fragment>
2547	#include <lights_phong_fragment>
2548	#include <lights_fragment_begin>
2549	#include <lights_fragment_maps>
2550	#include <lights_fragment_end>
2551	#include <aomap_fragment>
2552	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2553	#include <envmap_fragment>
2554	#include <output_fragment>
2555	#include <tonemapping_fragment>
2556	#include <encodings_fragment>
2557	#include <fog_fragment>
2558	#include <premultiplied_alpha_fragment>
2559	#include <dithering_fragment>
2560}`,Qb=`#define STANDARD
2561varying vec3 vViewPosition;
2562#ifdef USE_TRANSMISSION
2563	varying vec3 vWorldPosition;
2564#endif
2565#include <common>
2566#include <uv_pars_vertex>
2567#include <uv2_pars_vertex>
2568#include <displacementmap_pars_vertex>
2569#include <color_pars_vertex>
2570#include <fog_pars_vertex>
2571#include <normal_pars_vertex>
2572#include <morphtarget_pars_vertex>
2573#include <skinning_pars_vertex>
2574#include <shadowmap_pars_vertex>
2575#include <logdepthbuf_pars_vertex>
2576#include <clipping_planes_pars_vertex>
2577void main() {
2578	#include <uv_vertex>
2579	#include <uv2_vertex>
2580	#include <color_vertex>
2581	#include <morphcolor_vertex>
2582	#include <beginnormal_vertex>
2583	#include <morphnormal_vertex>
2584	#include <skinbase_vertex>
2585	#include <skinnormal_vertex>
2586	#include <defaultnormal_vertex>
2587	#include <normal_vertex>
2588	#include <begin_vertex>
2589	#include <morphtarget_vertex>
2590	#include <skinning_vertex>
2591	#include <displacementmap_vertex>
2592	#include <project_vertex>
2593	#include <logdepthbuf_vertex>
2594	#include <clipping_planes_vertex>
2595	vViewPosition = - mvPosition.xyz;
2596	#include <worldpos_vertex>
2597	#include <shadowmap_vertex>
2598	#include <fog_vertex>
2599#ifdef USE_TRANSMISSION
2600	vWorldPosition = worldPosition.xyz;
2601#endif
2602}`,eT=`#define STANDARD
2603#ifdef PHYSICAL
2604	#define IOR
2605	#define SPECULAR
2606#endif
2607uniform vec3 diffuse;
2608uniform vec3 emissive;
2609uniform float roughness;
2610uniform float metalness;
2611uniform float opacity;
2612#ifdef IOR
2613	uniform float ior;
2614#endif
2615#ifdef SPECULAR
2616	uniform float specularIntensity;
2617	uniform vec3 specularColor;
2618	#ifdef USE_SPECULARINTENSITYMAP
2619		uniform sampler2D specularIntensityMap;
2620	#endif
2621	#ifdef USE_SPECULARCOLORMAP
2622		uniform sampler2D specularColorMap;
2623	#endif
2624#endif
2625#ifdef USE_CLEARCOAT
2626	uniform float clearcoat;
2627	uniform float clearcoatRoughness;
2628#endif
2629#ifdef USE_IRIDESCENCE
2630	uniform float iridescence;
2631	uniform float iridescenceIOR;
2632	uniform float iridescenceThicknessMinimum;
2633	uniform float iridescenceThicknessMaximum;
2634#endif
2635#ifdef USE_SHEEN
2636	uniform vec3 sheenColor;
2637	uniform float sheenRoughness;
2638	#ifdef USE_SHEENCOLORMAP
2639		uniform sampler2D sheenColorMap;
2640	#endif
2641	#ifdef USE_SHEENROUGHNESSMAP
2642		uniform sampler2D sheenRoughnessMap;
2643	#endif
2644#endif
2645varying vec3 vViewPosition;
2646#include <common>
2647#include <packing>
2648#include <dithering_pars_fragment>
2649#include <color_pars_fragment>
2650#include <uv_pars_fragment>
2651#include <uv2_pars_fragment>
2652#include <map_pars_fragment>
2653#include <alphamap_pars_fragment>
2654#include <alphatest_pars_fragment>
2655#include <aomap_pars_fragment>
2656#include <lightmap_pars_fragment>
2657#include <emissivemap_pars_fragment>
2658#include <bsdfs>
2659#include <iridescence_fragment>
2660#include <cube_uv_reflection_fragment>
2661#include <envmap_common_pars_fragment>
2662#include <envmap_physical_pars_fragment>
2663#include <fog_pars_fragment>
2664#include <lights_pars_begin>
2665#include <normal_pars_fragment>
2666#include <lights_physical_pars_fragment>
2667#include <transmission_pars_fragment>
2668#include <shadowmap_pars_fragment>
2669#include <bumpmap_pars_fragment>
2670#include <normalmap_pars_fragment>
2671#include <clearcoat_pars_fragment>
2672#include <iridescence_pars_fragment>
2673#include <roughnessmap_pars_fragment>
2674#include <metalnessmap_pars_fragment>
2675#include <logdepthbuf_pars_fragment>
2676#include <clipping_planes_pars_fragment>
2677void main() {
2678	#include <clipping_planes_fragment>
2679	vec4 diffuseColor = vec4( diffuse, opacity );
2680	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2681	vec3 totalEmissiveRadiance = emissive;
2682	#include <logdepthbuf_fragment>
2683	#include <map_fragment>
2684	#include <color_fragment>
2685	#include <alphamap_fragment>
2686	#include <alphatest_fragment>
2687	#include <roughnessmap_fragment>
2688	#include <metalnessmap_fragment>
2689	#include <normal_fragment_begin>
2690	#include <normal_fragment_maps>
2691	#include <clearcoat_normal_fragment_begin>
2692	#include <clearcoat_normal_fragment_maps>
2693	#include <emissivemap_fragment>
2694	#include <lights_physical_fragment>
2695	#include <lights_fragment_begin>
2696	#include <lights_fragment_maps>
2697	#include <lights_fragment_end>
2698	#include <aomap_fragment>
2699	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
2700	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
2701	#include <transmission_fragment>
2702	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
2703	#ifdef USE_SHEEN
2704		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
2705		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
2706	#endif
2707	#ifdef USE_CLEARCOAT
2708		float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
2709		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
2710		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
2711	#endif
2712	#include <output_fragment>
2713	#include <tonemapping_fragment>
2714	#include <encodings_fragment>
2715	#include <fog_fragment>
2716	#include <premultiplied_alpha_fragment>
2717	#include <dithering_fragment>
2718}`,tT=`#define TOON
2719varying vec3 vViewPosition;
2720#include <common>
2721#include <uv_pars_vertex>
2722#include <uv2_pars_vertex>
2723#include <displacementmap_pars_vertex>
2724#include <color_pars_vertex>
2725#include <fog_pars_vertex>
2726#include <normal_pars_vertex>
2727#include <morphtarget_pars_vertex>
2728#include <skinning_pars_vertex>
2729#include <shadowmap_pars_vertex>
2730#include <logdepthbuf_pars_vertex>
2731#include <clipping_planes_pars_vertex>
2732void main() {
2733	#include <uv_vertex>
2734	#include <uv2_vertex>
2735	#include <color_vertex>
2736	#include <morphcolor_vertex>
2737	#include <beginnormal_vertex>
2738	#include <morphnormal_vertex>
2739	#include <skinbase_vertex>
2740	#include <skinnormal_vertex>
2741	#include <defaultnormal_vertex>
2742	#include <normal_vertex>
2743	#include <begin_vertex>
2744	#include <morphtarget_vertex>
2745	#include <skinning_vertex>
2746	#include <displacementmap_vertex>
2747	#include <project_vertex>
2748	#include <logdepthbuf_vertex>
2749	#include <clipping_planes_vertex>
2750	vViewPosition = - mvPosition.xyz;
2751	#include <worldpos_vertex>
2752	#include <shadowmap_vertex>
2753	#include <fog_vertex>
2754}`,nT=`#define TOON
2755uniform vec3 diffuse;
2756uniform vec3 emissive;
2757uniform float opacity;
2758#include <common>
2759#include <packing>
2760#include <dithering_pars_fragment>
2761#include <color_pars_fragment>
2762#include <uv_pars_fragment>
2763#include <uv2_pars_fragment>
2764#include <map_pars_fragment>
2765#include <alphamap_pars_fragment>
2766#include <alphatest_pars_fragment>
2767#include <aomap_pars_fragment>
2768#include <lightmap_pars_fragment>
2769#include <emissivemap_pars_fragment>
2770#include <gradientmap_pars_fragment>
2771#include <fog_pars_fragment>
2772#include <bsdfs>
2773#include <lights_pars_begin>
2774#include <normal_pars_fragment>
2775#include <lights_toon_pars_fragment>
2776#include <shadowmap_pars_fragment>
2777#include <bumpmap_pars_fragment>
2778#include <normalmap_pars_fragment>
2779#include <logdepthbuf_pars_fragment>
2780#include <clipping_planes_pars_fragment>
2781void main() {
2782	#include <clipping_planes_fragment>
2783	vec4 diffuseColor = vec4( diffuse, opacity );
2784	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2785	vec3 totalEmissiveRadiance = emissive;
2786	#include <logdepthbuf_fragment>
2787	#include <map_fragment>
2788	#include <color_fragment>
2789	#include <alphamap_fragment>
2790	#include <alphatest_fragment>
2791	#include <normal_fragment_begin>
2792	#include <normal_fragment_maps>
2793	#include <emissivemap_fragment>
2794	#include <lights_toon_fragment>
2795	#include <lights_fragment_begin>
2796	#include <lights_fragment_maps>
2797	#include <lights_fragment_end>
2798	#include <aomap_fragment>
2799	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2800	#include <output_fragment>
2801	#include <tonemapping_fragment>
2802	#include <encodings_fragment>
2803	#include <fog_fragment>
2804	#include <premultiplied_alpha_fragment>
2805	#include <dithering_fragment>
2806}`,iT=`uniform float size;
2807uniform float scale;
2808#include <common>
2809#include <color_pars_vertex>
2810#include <fog_pars_vertex>
2811#include <morphtarget_pars_vertex>
2812#include <logdepthbuf_pars_vertex>
2813#include <clipping_planes_pars_vertex>
2814void main() {
2815	#include <color_vertex>
2816	#include <morphcolor_vertex>
2817	#include <begin_vertex>
2818	#include <morphtarget_vertex>
2819	#include <project_vertex>
2820	gl_PointSize = size;
2821	#ifdef USE_SIZEATTENUATION
2822		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2823		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
2824	#endif
2825	#include <logdepthbuf_vertex>
2826	#include <clipping_planes_vertex>
2827	#include <worldpos_vertex>
2828	#include <fog_vertex>
2829}`,rT=`uniform vec3 diffuse;
2830uniform float opacity;
2831#include <common>
2832#include <color_pars_fragment>
2833#include <map_particle_pars_fragment>
2834#include <alphatest_pars_fragment>
2835#include <fog_pars_fragment>
2836#include <logdepthbuf_pars_fragment>
2837#include <clipping_planes_pars_fragment>
2838void main() {
2839	#include <clipping_planes_fragment>
2840	vec3 outgoingLight = vec3( 0.0 );
2841	vec4 diffuseColor = vec4( diffuse, opacity );
2842	#include <logdepthbuf_fragment>
2843	#include <map_particle_fragment>
2844	#include <color_fragment>
2845	#include <alphatest_fragment>
2846	outgoingLight = diffuseColor.rgb;
2847	#include <output_fragment>
2848	#include <tonemapping_fragment>
2849	#include <encodings_fragment>
2850	#include <fog_fragment>
2851	#include <premultiplied_alpha_fragment>
2852}`,sT=`#include <common>
2853#include <fog_pars_vertex>
2854#include <morphtarget_pars_vertex>
2855#include <skinning_pars_vertex>
2856#include <shadowmap_pars_vertex>
2857void main() {
2858	#include <beginnormal_vertex>
2859	#include <morphnormal_vertex>
2860	#include <skinbase_vertex>
2861	#include <skinnormal_vertex>
2862	#include <defaultnormal_vertex>
2863	#include <begin_vertex>
2864	#include <morphtarget_vertex>
2865	#include <skinning_vertex>
2866	#include <project_vertex>
2867	#include <worldpos_vertex>
2868	#include <shadowmap_vertex>
2869	#include <fog_vertex>
2870}`,oT=`uniform vec3 color;
2871uniform float opacity;
2872#include <common>
2873#include <packing>
2874#include <fog_pars_fragment>
2875#include <bsdfs>
2876#include <lights_pars_begin>
2877#include <shadowmap_pars_fragment>
2878#include <shadowmask_pars_fragment>
2879void main() {
2880	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
2881	#include <tonemapping_fragment>
2882	#include <encodings_fragment>
2883	#include <fog_fragment>
2884}`,aT=`uniform float rotation;
2885uniform vec2 center;
2886#include <common>
2887#include <uv_pars_vertex>
2888#include <fog_pars_vertex>
2889#include <logdepthbuf_pars_vertex>
2890#include <clipping_planes_pars_vertex>
2891void main() {
2892	#include <uv_vertex>
2893	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
2894	vec2 scale;
2895	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
2896	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
2897	#ifndef USE_SIZEATTENUATION
2898		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2899		if ( isPerspective ) scale *= - mvPosition.z;
2900	#endif
2901	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
2902	vec2 rotatedPosition;
2903	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
2904	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
2905	mvPosition.xy += rotatedPosition;
2906	gl_Position = projectionMatrix * mvPosition;
2907	#include <logdepthbuf_vertex>
2908	#include <clipping_planes_vertex>
2909	#include <fog_vertex>
2910}`,lT=`uniform vec3 diffuse;
2911uniform float opacity;
2912#include <common>
2913#include <uv_pars_fragment>
2914#include <map_pars_fragment>
2915#include <alphamap_pars_fragment>
2916#include <alphatest_pars_fragment>
2917#include <fog_pars_fragment>
2918#include <logdepthbuf_pars_fragment>
2919#include <clipping_planes_pars_fragment>
2920void main() {
2921	#include <clipping_planes_fragment>
2922	vec3 outgoingLight = vec3( 0.0 );
2923	vec4 diffuseColor = vec4( diffuse, opacity );
2924	#include <logdepthbuf_fragment>
2925	#include <map_fragment>
2926	#include <alphamap_fragment>
2927	#include <alphatest_fragment>
2928	outgoingLight = diffuseColor.rgb;
2929	#include <output_fragment>
2930	#include <tonemapping_fragment>
2931	#include <encodings_fragment>
2932	#include <fog_fragment>
2933}`,gt={alphamap_fragment:Pv,alphamap_pars_fragment:Lv,alphatest_fragment:Nv,alphatest_pars_fragment:Ov,aomap_fragment:Dv,aomap_pars_fragment:kv,begin_vertex:Fv,beginnormal_vertex:Uv,bsdfs:Bv,iridescence_fragment:Gv,bumpmap_pars_fragment:zv,clipping_planes_fragment:Vv,clipping_planes_pars_fragment:Hv,clipping_planes_pars_vertex:Wv,clipping_planes_vertex:jv,color_fragment:qv,color_pars_fragment:Xv,color_pars_vertex:Yv,color_vertex:Zv,common:Kv,cube_uv_reflection_fragment:Jv,defaultnormal_vertex:$v,displacementmap_pars_vertex:Qv,displacementmap_vertex:e_,emissivemap_fragment:t_,emissivemap_pars_fragment:n_,encodings_fragment:i_,encodings_pars_fragment:r_,envmap_fragment:s_,envmap_common_pars_fragment:o_,envmap_pars_fragment:a_,envmap_pars_vertex:l_,envmap_physical_pars_fragment:__,envmap_vertex:c_,fog_vertex:u_,fog_pars_vertex:h_,fog_fragment:f_,fog_pars_fragment:d_,gradientmap_pars_fragment:p_,lightmap_fragment:m_,lightmap_pars_fragment:g_,lights_lambert_fragment:x_,lights_lambert_pars_fragment:y_,lights_pars_begin:v_,lights_toon_fragment:b_,lights_toon_pars_fragment:T_,lights_phong_fragment:M_,lights_phong_pars_fragment:w_,lights_physical_fragment:S_,lights_physical_pars_fragment:E_,lights_fragment_begin:A_,lights_fragment_maps:C_,lights_fragment_end:I_,logdepthbuf_fragment:R_,logdepthbuf_pars_fragment:P_,logdepthbuf_pars_vertex:L_,logdepthbuf_vertex:N_,map_fragment:O_,map_pars_fragment:D_,map_particle_fragment:k_,map_particle_pars_fragment:F_,metalnessmap_fragment:U_,metalnessmap_pars_fragment:B_,morphcolor_vertex:G_,morphnormal_vertex:z_,morphtarget_pars_vertex:V_,morphtarget_vertex:H_,n
vendor: 5,276 bytes, line 2933
2933ormal_fragment_begin:W_,normal_fragment_maps:j_,normal_pars_fragment:q_,normal_pars_vertex:X_,normal_vertex:Y_,normalmap_pars_fragment:Z_,clearcoat_normal_fragment_begin:K_,clearcoat_normal_fragment_maps:J_,clearcoat_pars_fragment:$_,iridescence_pars_fragment:Q_,output_fragment:eb,packing:tb,premultiplied_alpha_fragment:nb,project_vertex:ib,dithering_fragment:rb,dithering_pars_fragment:sb,roughnessmap_fragment:ob,roughnessmap_pars_fragment:ab,shadowmap_pars_fragment:lb,shadowmap_pars_vertex:cb,shadowmap_vertex:ub,shadowmask_pars_fragment:hb,skinbase_vertex:fb,skinning_pars_vertex:db,skinning_vertex:pb,skinnormal_vertex:mb,specularmap_fragment:gb,specularmap_pars_fragment:xb,tonemapping_fragment:yb,tonemapping_pars_fragment:vb,transmission_fragment:_b,transmission_pars_fragment:bb,uv_pars_fragment:Tb,uv_pars_vertex:Mb,uv_vertex:wb,uv2_pars_fragment:Sb,uv2_pars_vertex:Eb,uv2_vertex:Ab,worldpos_vertex:Cb,background_vert:Ib,background_frag:Rb,backgroundCube_vert:Pb,backgroundCube_frag:Lb,cube_vert:Nb,cube_frag:Ob,depth_vert:Db,depth_frag:kb,distanceRGBA_vert:Fb,distanceRGBA_frag:Ub,equirect_vert:Bb,equirect_frag:Gb,linedashed_vert:zb,linedashed_frag:Vb,meshbasic_vert:Hb,meshbasic_frag:Wb,meshlambert_vert:jb,meshlambert_frag:qb,meshmatcap_vert:Xb,meshmatcap_frag:Yb,meshnormal_vert:Zb,meshnormal_frag:Kb,meshphong_vert:Jb,meshphong_frag:$b,meshphysical_vert:Qb,meshphysical_frag:eT,meshtoon_vert:tT,meshtoon_frag:nT,points_vert:iT,points_frag:rT,shadow_vert:sT,shadow_frag:oT,sprite_vert:aT,sprite_frag:lT},Ge={common:{diffuse:{value:new $e(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Jt},uv2Transform:{value:new Jt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},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 Ee(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 $e(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 $e(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Jt}},sprite:{diffuse:{value:new $e(16777215)},opacity:{value:1},center:{value:new Ee(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Jt}}},dr={basic:{uniforms:Zn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:gt.meshbasic_vert,fragmentShader:gt.meshbasic_frag},lambert:{uniforms:Zn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new $e(0)}}]),vertexShader:gt.meshlambert_vert,fragmentShader:gt.meshlambert_frag},phong:{uniforms:Zn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new $e(0)},specular:{value:new $e(1118481)},shininess:{value:30}}]),vertexShader:gt.meshphong_vert,fragmentShader:gt.meshphong_frag},standard:{uniforms:Zn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new $e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag},toon:{uniforms:Zn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new $e(0)}}]),vertexShader:gt.meshtoon_vert,fragmentShader:gt.meshtoon_frag},matcap:{uniforms:Zn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matc
vendor: 2,828 bytes, line 2933
2933ap:{value:null}}]),vertexShader:gt.meshmatcap_vert,fragmentShader:gt.meshmatcap_frag},points:{uniforms:Zn([Ge.points,Ge.fog]),vertexShader:gt.points_vert,fragmentShader:gt.points_frag},dashed:{uniforms:Zn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gt.linedashed_vert,fragmentShader:gt.linedashed_frag},depth:{uniforms:Zn([Ge.common,Ge.displacementmap]),vertexShader:gt.depth_vert,fragmentShader:gt.depth_frag},normal:{uniforms:Zn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:gt.meshnormal_vert,fragmentShader:gt.meshnormal_frag},sprite:{uniforms:Zn([Ge.sprite,Ge.fog]),vertexShader:gt.sprite_vert,fragmentShader:gt.sprite_frag},background:{uniforms:{uvTransform:{value:new Jt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:gt.background_vert,fragmentShader:gt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:gt.backgroundCube_vert,fragmentShader:gt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:gt.cube_vert,fragmentShader:gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gt.equirect_vert,fragmentShader:gt.equirect_frag},distanceRGBA:{uniforms:Zn([Ge.common,Ge.displacementmap,{referencePosition:{value:new ae},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gt.distanceRGBA_vert,fragmentShader:gt.distanceRGBA_frag},shadow:{uniforms:Zn([Ge.lights,Ge.fog,{color:{value:new $e(0)},opacity:{value:1}}]),vertexShader:gt.shadow_vert,fragmentShader:gt.shadow_frag}};dr.physical={uniforms:Zn([dr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ee(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new $e(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ee},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new $e(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new $e(1,1,1)},specularColorMap:{value:null}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag};var Au={r:0,b:0,g:0};function cT(r,e,t,n,i,s,o){let a=new $e(0),c=s===!0?0:1,l,u,h=null,f=0,p=null;function g(d,x){let _=!1,v=x.isScene===!0?x.background:null;
2933v&&v.isTexture&&(v=(x.backgroundBlurriness>0?t:e).get(v));let y=r.xr,w=y.getSession&&y.getSession();w&&w.environmentBlendMode==="additive"&&(v=null),v===null?m(a,c):v&&v.isColor&&(m(v,1),_=!0),(r.autoClear||_)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),v&&(v.isCubeTexture||v.mapping===ah)?(u===void 0&&(u=new kt(new Hr(1,1,1),new Wr({name:"BackgroundCubeMaterial",uniforms:ya(dr.backgroundCube.uniforms),vertexShader:dr.backgroundCube.vertexShader,fragmentShader:dr.backgroundCube.fragmentShader,side:Pn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(L,C,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,(h!==v||f!==v.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,h=v,f=v.version,p=r.toneMapping),u.layers.enableAll(),d.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(l===void 0&&(l=new kt(new so(2,2),new Wr({name:"BackgroundMaterial",uniforms:ya(dr.background.uniforms),vertexShader:dr.background.vertexShader,fragmentShader:dr.background.fragmentShader,side:pr,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=v,l.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,v.matrixAutoUpdate===!0&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),(h!==v||f!==v.version||p!==r.toneMapping)&&(l.material.needsUpdate=!0,h=v,f=v.version,p=r.toneMapping),l.layers.enableAll(),d.unshift(l,l.geometry,l.material,0,0,null))}function m(d,x){d.getRGB(Au,o0(r)),n.buffers.color.setClear(Au.r,Au.g,Au.b,x,o)}return{getClearColor:function(){return a},setClearColor:function(d,x=1){a.set(d),c=x,m(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(d){c=d,m(a,c)},render:g}}function uT(r,e,t,n){let i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},c=d(null),l=c,u=!1;function h(P,$,H,Z,W){let oe=!1;if(o){let ue=m(Z,H,$);l!==ue&&(l=ue,p(l.object)),oe=x(P,Z,H,W),oe&&_(P,Z,H,W)}else{let ue=$.wireframe===!0;(l.geometry!==Z.id||l.program!==H.id||l.wireframe!==ue)&&(l.geometry=Z.id,l.program=H.id,l.wireframe=ue,oe=!0)}W!==null&&t.update(W,34963),(oe||u)&&(u=!1,b(P,$,H,Z),W!==null&&r.bindBuffer(34963,t.get(W).buffer))}function f(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function p(P){return n.isWebGL2?r.bindVertexArray(P):s.bindVertexArrayOES(P)}function g(P){return n.isWebGL2?r.deleteVertexArray(P):s.deleteVertexArrayOES(P)}function m(P,$,H){let Z=H.wireframe===!0,W=a[P.id];W===void 0&&(W={},a[P.id]=W);let oe=W[$.id];oe===void 0&&(oe={},W[$.id]=oe);let ue=oe[Z];return ue===void 0&&(ue=d(f()),oe[Z]=ue),ue}function d(P){let $=[],H=[],Z=[];for(let W=0;W<i;W++)$[W]=0,H[W]=0,Z[W]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:$,enabledAttributes:H,attributeDivisors:Z,object:P,attributes:{},index:null}}function x(P,$,H,Z){let W=l.attributes,oe=$.attributes,ue=0,ne=H.getAttributes();for(let le in ne)if(ne[le].location>=0){let I=W[le],M=oe[le];if(M===void 0&&(le==="instanceMatrix"&&P.instanceMatrix&&(M=P.instanceMatrix),le==="instanceColor"&&P.instanceColor&&(M=P.instanceColor)),I===void 0||I.attribute!==M||M&&I.data!==M.data)return!0;ue++}return l.attributesNum!==ue||l.index!==Z}function _(P,$,H,Z){let W={},oe=$.attributes,ue=0,ne=H.getAttributes();for(let le in ne)if(ne[le].location>=0){let I=oe[le];I===void 0&&(le==="instanceMatrix"&&P.instanceMatrix&&(I=P.instanceMatrix),le==="instanceColor"&&P.instanceColor&&(I=P.instanceColor));let M={};M.attribute=I,I&&I.data&&(M.data=I.data),W[le]=M,ue++}l.attributes=W,l.attributesNum=ue,l.index=Z}function v(){let P=l.newAttributes;for(let $=0,H=P.length;$<H;$++)P[$]=0}function y(P){w(P,0)}function w(P,$){let H=l.newAttributes,Z=l.enabledAttributes,W=l.attributeDivisors;H[P]=1,Z[P]===0&&(r.enableVertexAttribArray(P),Z[P]=1),W[P]!==$&&((n.isWebG
2933L2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](P,$),W[P]=$)}function L(){let P=l.newAttributes,$=l.enabledAttributes;for(let H=0,Z=$.length;H<Z;H++)$[H]!==P[H]&&(r.disableVertexAttribArray(H),$[H]=0)}function C(P,$,H,Z,W,oe){n.isWebGL2===!0&&(H===5124||H===5125)?r.vertexAttribIPointer(P,$,H,W,oe):r.vertexAttribPointer(P,$,H,Z,W,oe)}function b(P,$,H,Z){if(n.isWebGL2===!1&&(P.isInstancedMesh||Z.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;v();let W=Z.attributes,oe=H.getAttributes(),ue=$.defaultAttributeValues;for(let ne in oe){let le=oe[ne];if(le.location>=0){let he=W[ne];if(he===void 0&&(ne==="instanceMatrix"&&P.instanceMatrix&&(he=P.instanceMatrix),ne==="instanceColor"&&P.instanceColor&&(he=P.instanceColor)),he!==void 0){let I=he.normalized,M=he.itemSize,T=t.get(he);if(T===void 0)continue;let S=T.buffer,B=T.type,j=T.bytesPerElement;if(he.isInterleavedBufferAttribute){let z=he.data,fe=z.stride,q=he.offset;if(z.isInstancedInterleavedBuffer){for(let re=0;re<le.locationSize;re++)w(le.location+re,z.meshPerAttribute);P.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=z.meshPerAttribute*z.count)}else for(let re=0;re<le.locationSize;re++)y(le.location+re);r.bindBuffer(34962,S);for(let re=0;re<le.locationSize;re++)C(le.location+re,M/le.locationSize,B,I,fe*j,(q+M/le.locationSize*re)*j)}else{if(he.isInstancedBufferAttribute){for(let z=0;z<le.locationSize;z++)w(le.location+z,he.meshPerAttribute);P.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let z=0;z<le.locationSize;z++)y(le.location+z);r.bindBuffer(34962,S);for(let z=0;z<le.locationSize;z++)C(le.location+z,M/le.locationSize,B,I,M*j,M/le.locationSize*z*j)}}else if(ue!==void 0){let I=ue[ne];if(I!==void 0)switch(I.length){case 2:r.vertexAttrib2fv(le.location,I);break;case 3:r.vertexAttrib3fv(le.location,I);break;case 4:r.vertexAttrib4fv(le.location,I);break;default:r.vertexAttrib1fv(le.location,I)}}}}L()}function A(){F();for(let P in a){let $=a[P];for(let H in $){let Z=$[H];for(let W in Z)g(Z[W].object),delete Z[W];delete $[H]}delete a[P]}}function N(P){if(a[P.id]===void 0)return;let $=a[P.id];for(let H in $){let Z=$[H];for(let W in Z)g(Z[W].object),delete Z[W];delete $[H]}delete a[P.id]}function G(P){for(let $ in a){let H=a[$];if(H[P.id]===void 0)continue;let Z=H[P.id];for(let W in Z)g(Z[W].object),delete Z[W];delete H[P.id]}}function F(){U(),u=!0,l!==c&&(l=c,p(l.object))}function U(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:h,reset:F,resetDefaultState:U,dispose:A,releaseStatesOfGeometry:N,releaseStatesOfProgram:G,initAttributes:v,enableAttribute:y,disableUnusedAttributes:L}}function hT(r,e,t,n){let i=n.isWebGL2,s;function o(l){s=l}function a(l,u){r.drawArrays(s,l,u),t.update(u,s,1)}function c(l,u,h){if(h===0)return;let f,p;if(i)f=r,p="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[p](s,l,u,h),t.update(u,s,h)}this.setMode=o,this.render=a,this.renderInstances=c}function fT(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){let C=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(C){if(C==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";C="mediump"}return C==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext<"u"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&r instanceof WebGL2ComputeRenderingContext,a=t.precision!==void 0?t.precision:"highp",c=s(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);let l=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=r.getParameter(34930),f=r.getParameter(35660),p=r.getParameter(3379),g=r.getParameter(34076),m=r.getParameter(34921),d=r.getParameter(36347),x=r.getParameter(36348),_=r.getParameter(36349),v=f>0,y=o||e.has("OES_texture_float"),w=v&&y,L=o?r.getParameter(36183):0;return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:d,maxVaryings:x,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:w,maxSamples:L}}function dT(r){let e=this,t=null,n=0,i=!1,s=!1,o=new Br,a=new Jt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f,p){let g=h.length!==0||f||n!==0||i;return i=f,t=u(h,p,0),n=h.length,g},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,l()},this.setState=function(h,f,p){let g=h.clippingPlanes,m=h.clipIntersection,d=h.clipShadows,x=r.get(h);if(!i||g===null||g.length===0||s&&!d)s?u(null):l();else{let _=s?0:n,v=_*4,y=x.clippingState||null;c.value=y,y=u(g,f,v,p);for(let w=0;w!==v;++w)y[w]=t[w];x.clippingState=y,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=_}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,p,g){let m=h!==null?h.length:0,d=null;if(m!==0){if(d=c.value,g!==!0||d===null){let x=p+m*4,_=f.matrixWorldInverse;a.getNormalMatrix(_),(d===null||d.length<x)&&(d=new Float32Array(x)
vendor: 10,587 bytes, lines 2933-3008
2933);for(let v=0,y=p;v!==m;++v,y+=4)o.copy(h[v]).applyMatrix4(_,a),o.normal.toArray(d,y),d[y+3]=o.constant}c.value=d,c.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,d}}function pT(r){let e=new WeakMap;function t(o,a){return a===Vl?o.mapping=fa:a===Vf&&(o.mapping=da),o}function n(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){let a=o.mapping;if(a===Vl||a===Vf)if(e.has(o)){let c=e.get(o).texture;return t(c,o.mapping)}else{let c=o.image;if(c&&c.height>0){let l=new Xf(c.height/2);return l.fromEquirectangularTexture(r,o),e.set(o,l),o.addEventListener("dispose",i),t(l.texture,o.mapping)}else return null}}return o}function i(o){let a=o.target;a.removeEventListener("dispose",i);let c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}var gr=class extends qu{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,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,n,i,s,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=n,this.view.offsetY=i,this.view.width=s,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,s=n-e,o=n+e,a=i+t,c=i-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,o=s+l*this.view.width,a-=u*this.view.offsetY,c=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,c,this.near,this.far),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}},oa=4,cg=[.125,.215,.35,.446,.526,.582],$s=20,Pf=new gr,ug=new $e,Lf=null,Js=(1+Math.sqrt(5))/2,ra=1/Js,hg=[new ae(1,1,1),new ae(-1,1,1),new ae(1,1,-1),new ae(-1,1,-1),new ae(0,Js,ra),new ae(0,Js,-ra),new ae(ra,0,Js),new ae(-ra,0,Js),new ae(Js,ra,0),new ae(-Js,ra,0)],Xu=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,n=.1,i=100){Lf=this._renderer.getRenderTarget(),this._setSize(256);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=pg(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=dg(),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(Lf),e.scissorTest=!1,Cu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===fa||e.mapping===da?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Lf=this._renderer.getRenderTarget();let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:dn,minFilter:dn,generateMipmaps:!1,type:Hl,format:Ei,encoding:io,depthBuffer:!1},i=fg(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=fg(e,t,n);let{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=mT(s)),this._blurMaterial=gT(s,e,t)}return i}_compileMaterial(e){let t=new kt(this._lodPlanes[0],e);this._renderer.compile(t,Pf)}_sceneToCubeUV(e,t,n,i){let a=new Zt(90,1,t,n),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(ug),u.toneMapping=Gr,u.autoClear=!1;let p=new Ii({name:"PMREM.Background",side:Pn,depthWrite:!1,depthTest:!1}),g=new kt(new Hr,p),m=!1,d=e.background;d?d.isColor&&(p.color.copy(d),e.background=null,m=!0):(p.color.copy(ug),m=!0);for(let x=0;x<6;x++){let _=x%3;_===0?(a.up.set(0,c[x],0),a.lookAt(l[x],0,0)):_===1?(a.up.set(0,0,c[x]),a.lookAt(0,l[x],0)):(a.up.set(0,c[x],0),a.lookAt(0,0,l[x]));let v=this._cubeSize;Cu(i,_*v,x>2?v:0,v,v),u.setRenderTarget(i),m&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=d}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===fa||e.mapping===da;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=pg()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=dg());let s=i?this._cubemapMaterial:this._equirectMaterial,o=new kt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;let c=this._cubeSize;Cu(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(o,Pf)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){let s=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),o=hg[(i-1)%hg.length];this._blur(e,i-1,i,s,o)}t.autoClear=n}_blur(e,t,n,i,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,a){let c=this._renderer,l=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let u=3,h=new kt(this._lodPlanes[i],l),f=l.uniforms,p=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*$s-1),m=s/g,d=isFinite(s)?1+Math.floor(u*m):$s;d>$s&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${d} samples when the maximum is set to ${$s}`);let x=[],_=0;for(let C=0;C<$s;++C){let b=C/m,A=Math.exp(-b*b/2);x.push(A),C===0?_+=A:C<d&&(_+=2*A)}for(let C=0;C<x.length;C++)x[C]=x[C]/_;f.envMap.value=e.texture,f.samples.value=d,f.weights.value=x,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);let{_lodMax:v}=this;f.dTheta.value=g,f.mipInt.value=v-n;let y=this._sizeLods[i],w=3*y*(i>v-oa?i-v+oa:0),L=4*(this._cubeSize-y);Cu(t,w,L,3*y,2*y),c.setRenderTarget(t),c.render(h,Pf)}};function mT(r){let e=[],t=[],n=[],i=r,s=r-oa+1+cg.length;for(let o=0;o<s;o++){let a=Math.pow(2,i);t.push(a);let c=1/a;o>r-oa?c=cg[o-r+oa-1]:o===0&&(c=0),n.push(c);let l=1/(a-2),u=-l,h=1+l,f=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,g=6,m=3,d=2,x=1,_=new Float32Array(m*g*p),v=new Float32Array(d*g*p),y=new Float32Array(x*g*p);for(let L=0;L<p;L++){let C=L%3*2/3-1,b=L>2?0:-1,A=[C,b,0,C+2/3,b,0,C+2/3,b+1,0,C,b,0,C+2/3,b+1,0,C,b+1,0];_.set(A,m*g*L),v.set(f,d*g*L);let N=[L,L,L,L,L,L];y.set(N,x*g*L)}let w=new yt;w.setAttribute("position",new Fn(_,m)),w.setAttribute("uv",new Fn(v,d)),w.setAttribute("faceIndex",new Fn(y,x)),e.push(w),i>oa&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function fg(r,e,t){let n=new zr(r,e,t);return n.texture.mapping=ah,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Cu(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function gT(r,e,t){let n=new Float32Array($s),i=new ae(0,1,0);return new Wr({name:"SphericalGaussianBlur",defines:{n:$s,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Ad(),fragmentShader:`
2934
2935			precision mediump float;
2936			precision mediump int;
2937
2938			varying vec3 vOutputDirection;
2939
2940			uniform sampler2D envMap;
2941			uniform int samples;
2942			uniform float weights[ n ];
2943			uniform bool latitudinal;
2944			uniform float dTheta;
2945			uniform float mipInt;
2946			uniform vec3 poleAxis;
2947
2948			#define ENVMAP_TYPE_CUBE_UV
2949			#include <cube_uv_reflection_fragment>
2950
2951			vec3 getSample( float theta, vec3 axis ) {
2952
2953				float cosTheta = cos( theta );
2954				// Rodrigues' axis-angle rotation
2955				vec3 sampleDirection = vOutputDirection * cosTheta
2956					+ cross( axis, vOutputDirection ) * sin( theta )
2957					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
2958
2959				return bilinearCubeUV( envMap, sampleDirection, mipInt );
2960
2961			}
2962
2963			void main() {
2964
2965				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
2966
2967				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
2968
2969					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
2970
2971				}
2972
2973				axis = normalize( axis );
2974
2975				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2976				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
2977
2978				for ( int i = 1; i < n; i++ ) {
2979
2980					if ( i >= samples ) {
2981
2982						break;
2983
2984					}
2985
2986					float theta = dTheta * float( i );
2987					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
2988					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
2989
2990				}
2991
2992			}
2993		`,blending:ms,depthTest:!1,depthWrite:!1})}function dg(){return new Wr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ad(),fragmentShader:`
2994
2995			precision mediump float;
2996			precision mediump int;
2997
2998			varying vec3 vOutputDirection;
2999
3000			uniform sampler2D envMap;
3001
3002			#include <common>
3003
3004			void main() {
3005
3006				vec3 outputDirection = normalize( vOutputDirection );
3007				vec2 uv = equirectUv( outputDirection );
3008
3009				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3010
3011			}
3012		`,blending:ms,depthTest:!1,depthWrite:!1})}function pg(){return new Wr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ad(),fragmentShader:`
3013
3014			precision mediump float;
3015			precision mediump int;
3016
3017			uniform float flipEnvMap;
3018
3019			varying vec3 vOutputDirection;
3020
3021			uniform samplerCube envMap;
3022
3023			void main() {
3024
3025				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3026
3027			}
3028		`,blending:ms,depthTest:!1,depthWrite:!1})}function Ad(){return`
3029
3030		precision mediump float;
3031		precision mediump int;
3032
3033		attribute float faceIndex;
3034
3035		varying vec3 vOutputDirection;
3036
3037		// RH coordinate system; PMREM face-indexing convention
3038		vec3 getDirection( vec2 uv, float face ) {
3039
3040			uv = 2.0 * uv - 1.0;
3041
3042			vec3 direction = vec3( uv, 1.0 );
3043
3044			if ( face == 0.0 ) {
3045
3046				direction = direction.zyx; // ( 1, v, u ) pos x
3047
3048			} else if ( face == 1.0 ) {
3049
3050				direction = direction.xzy;
3051				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3052
3053			} else if ( face == 2.0 ) {
3054
3055				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3056
3057			} else if ( face == 3.0 ) {
3058
3059				direction = direction.zyx;
3060				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3061
3062			} else if ( face == 4.0 ) {
3063
3064				direction = direction.xzy;
3065				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3066
3067			} else if ( face == 5.0 ) {
3068
3069				direction.z *= -1.0; // ( u, v, -1 ) neg z
3070
3071			}
3072
3073			return direction;
3074
3075		}
3076
3077		void main() {
3078
3079			vOutputDirection = getDirection( uv, faceIndex );
3080			gl_Position = vec4( position, 1.0 );
3081
3082		}
3083	`}function xT(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){let c=a.mapping,l=c===Vl||c===Vf,u=c===fa||c===da;if(l||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new Xu(r)),h=l?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{let h=a.image;if(l&&h&&h.height>0||u&&h&&i(h)){t===null&&(t=new Xu(r));let f=l?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function i(a){let c=0,l=6;for(let u=0;u<l;u++)a[u]!==void 0&&c++;return c===l}function s(a){let c=a.target;c.removeEventListener("dispose",s);let l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function yT(r){let e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){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;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(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(n){let i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function vT(r,e,t,n){let i={},s=new WeakMap;function o(h){let f=h.target;f.index!==null&&e.remove(f.index);for(let g in f.attributes)e.remove(f.attributes[g]);f.removeEventListener("dispose",o),delete i[f.id];let p=s.get(f);p&&(e.remove(p),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return i[f.id]===!0||(f.addEventListener("dispose",o),i[f.id]=!0,t.memory.geometries++),f}function c(h){let f=h.attributes;for(let g in f)e.update(f[g],34962);let p=h.morphAttributes;for(let g in p){let m=p[g];for(let d=0,x=m.length;d<x;d++)e.update(m[d],34962)}}function l(h){let f=[],p=h.index,g=h.attributes.position,m=0;if(p!==null){let _=p.array;m=p.version;for(let v=0,y=_.length;v<y;
vendor: 4,907 bytes, line 3083
3083v+=3){let w=_[v+0],L=_[v+1],C=_[v+2];f.push(w,L,L,C,C,w)}}else{let _=g.array;m=g.version;for(let v=0,y=_.length/3-1;v<y;v+=3){let w=v+0,L=v+1,C=v+2;f.push(w,L,L,C,C,w)}}let d=new(r0(f)?ju:xa)(f,1);d.version=m;let x=s.get(h);x&&e.remove(x),s.set(h,d)}function u(h){let f=s.get(h);if(f){let p=h.index;p!==null&&f.version<p.version&&l(h)}else l(h);return s.get(h)}return{get:a,update:c,getWireframeAttribute:u}}function _T(r,e,t,n){let i=n.isWebGL2,s;function o(f){s=f}let a,c;function l(f){a=f.type,c=f.bytesPerElement}function u(f,p){r.drawElements(s,p,a,f*c),t.update(p,s,1)}function h(f,p,g){if(g===0)return;let m,d;if(i)m=r,d="drawElementsInstanced";else if(m=e.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[d](s,p,a,f*c,g),t.update(p,s,g)}this.setMode=o,this.setIndex=l,this.render=u,this.renderInstances=h}function bT(r){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case 4:t.triangles+=a*(s/3);break;case 1:t.lines+=a*(s/2);break;case 3:t.lines+=a*(s-1);break;case 2:t.lines+=a*s;break;case 0:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function TT(r,e){return r[0]-e[0]}function MT(r,e){return Math.abs(e[1])-Math.abs(r[1])}function wT(r,e,t){let n={},i=new Float32Array(8),s=new WeakMap,o=new St,a=[];for(let l=0;l<8;l++)a[l]=[l,0];function c(l,u,h,f){let p=l.morphTargetInfluences;if(e.isWebGL2===!0){let g=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,m=g!==void 0?g.length:0,d=s.get(u);if(d===void 0||d.count!==m){let $=function(){U.dispose(),s.delete(u),u.removeEventListener("dispose",$)};d!==void 0&&d.texture.dispose();let v=u.morphAttributes.position!==void 0,y=u.morphAttributes.normal!==void 0,w=u.morphAttributes.color!==void 0,L=u.morphAttributes.position||[],C=u.morphAttributes.normal||[],b=u.morphAttributes.color||[],A=0;v===!0&&(A=1),y===!0&&(A=2),w===!0&&(A=3);let N=u.attributes.position.count*A,G=1;N>e.maxTextureSize&&(G=Math.ceil(N/e.maxTextureSize),N=e.maxTextureSize);let F=new Float32Array(N*G*4*m),U=new Wu(F,N,G,m);U.type=ps,U.needsUpdate=!0;let P=A*4;for(let H=0;H<m;H++){let Z=L[H],W=C[H],oe=b[H],ue=N*G*4*H;for(let ne=0;ne<Z.count;ne++){let le=ne*P;v===!0&&(o.fromBufferAttribute(Z,ne),F[ue+le+0]=o.x,F[ue+le+1]=o.y,F[ue+le+2]=o.z,F[ue+le+3]=0),y===!0&&(o.fromBufferAttribute(W,ne),F[ue+le+4]=o.x,F[ue+le+5]=o.y,F[ue+le+6]=o.z,F[ue+le+7]=0),w===!0&&(o.fromBufferAttribute(oe,ne),F[ue+le+8]=o.x,F[ue+le+9]=o.y,F[ue+le+10]=o.z,F[ue+le+11]=oe.itemSize===4?o.w:1)}}d={count:m,texture:U,size:new Ee(N,G)},s.set(u,d),u.addEventListener("dispose",$)}let x=0;for(let v=0;v<p.length;v++)x+=p[v];let _=u.morphTargetsRelative?1:1-x;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",p),f.getUniforms().setValue(r,"morphTargetsTexture",d.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}else{let g=p===void 0?0:p.length,m=n[u.id];if(m===void 0||m.length!==g){m=[];for(let y=0;y<g;y++)m[y]=[y,0];n[u.id]=m}for(let y=0;y<g;y++){let w=m[y];w[0]=y,w[1]=p[y]}m.sort(MT);for(let y=0;y<8;y++)y<g&&m[y][1]?(a[y][0]=m[y][0],a[y][1]=m[y][1]):(a[y][0]=Number.MAX_SAFE_INTEGER,a[y][1]=0);a.sort(TT);let d=u.morphAttributes.position,x=u.morphAttributes.normal,_=0;for(let y=0;y<8;y++){let w=a[y],L=w[0],C=w[1];L!==Number.MAX_SAFE_INTEGER&&C?(d&&u.getAttribute("morphTarget"+y)!==d[L]&&u.setAttribute("morphTarget"+y,d[L]),x&&u.getAttribute("morphNormal"+y)!==x[L]&&u.setAttribute("morphNormal"+y,x[L]),i[y]=C,_+=C):(d&&u.hasAttribute("morphTarget"+y)===!0&&u.deleteAttribute("morphTarget"+y),x&&u.hasAttribute("morphNormal"+y)===!0&&u.deleteAttribute("morphNormal"+y),i[y]=0)}let v=u.morphTargetsRelative?1:1-_;f.getUniforms().setValue(r,"morphTargetBaseInfluence",v),f.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:c}}function ST(r,e,t,n){let i=new WeakMap;function s(c){let l=n.render.frame,u=c.geometry,h=e.get(c,u);return i.get(h)!==l&&(e.update(h),i.set(h,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",a)===!1&&c.addEventListener("dispose",a),t.update(c.instanceMatrix,34962),c.instanceColor!==null&&t.update(c.instanceColor,34962)),h}function o(){i=new WeakMap}function a(c){let l=c.target;l.removeEventListener("dispose",a),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:s,dispose:o}}var l0=new pn,c0=new Wu,u0=new jf,h0=new Yl,mg=[],gg=[],xg=new Float32Array(16),yg=new Float32Array(9),vg=new Float32Array(4);function Aa(r,e,t){let n=r[0];if(n<=0||n>0)return r;
vendor: 8,207 bytes, lines 3083-3085
3083let i=e*t,s=mg[i];if(s===void 0&&(s=new Float32Array(i),mg[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Tn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Mn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function ch(r,e){let t=gg[e];t===void 0&&(t=new Int32Array(e),gg[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function ET(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function AT(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(Tn(t,e))return;r.uniform2fv(this.addr,e),Mn(t,e)}}function CT(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(Tn(t,e))return;r.uniform3fv(this.addr,e),Mn(t,e)}}function IT(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(Tn(t,e))return;r.uniform4fv(this.addr,e),Mn(t,e)}}function RT(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(Tn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Mn(t,e)}else{if(Tn(t,n))return;vg.set(n),r.uniformMatrix2fv(this.addr,!1,vg),Mn(t,n)}}function PT(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(Tn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Mn(t,e)}else{if(Tn(t,n))return;yg.set(n),r.uniformMatrix3fv(this.addr,!1,yg),Mn(t,n)}}function LT(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(Tn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Mn(t,e)}else{if(Tn(t,n))return;xg.set(n),r.uniformMatrix4fv(this.addr,!1,xg),Mn(t,n)}}function NT(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function OT(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(Tn(t,e))return;r.uniform2iv(this.addr,e),Mn(t,e)}}function DT(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(Tn(t,e))return;r.uniform3iv(this.addr,e),Mn(t,e)}}function kT(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(Tn(t,e))return;r.uniform4iv(this.addr,e),Mn(t,e)}}function FT(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function UT(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(Tn(t,e))return;r.uniform2uiv(this.addr,e),Mn(t,e)}}function BT(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(Tn(t,e))return;r.uniform3uiv(this.addr,e),Mn(t,e)}}function GT(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(Tn(t,e))return;r.uniform4uiv(this.addr,e),Mn(t,e)}}function zT(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2D(e||l0,i)}function VT(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||u0,i)}function HT(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||h0,i)}function WT(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||c0,i)}function jT(r){switch(r){case 5126:return ET;case 35664:return AT;case 35665:return CT;case 35666:return IT;case 35674:return RT;case 35675:return PT;case 35676:return LT;case 5124:case 35670:return NT;case 35667:case 35671:return OT;case 35668:case 35672:return DT;case 35669:case 35673:return kT;case 5125:return FT;case 36294:return UT;case 36295:return BT;case 36296:return GT;case 35678:case 36198:case 36298:case 36306:case 35682:return zT;case 35679:case 36299:case 36307:return VT;case 35680:case 36300:case 36308:case 36293:return HT;case 36289:case 36303:case 36311:case 36292:return WT}}function qT(r,e){r.uniform1fv(this.addr,e)}function XT(r,e){let t=Aa(e,this.size,2);r.uniform2fv(this.addr,t)}function YT(r,e){let t=Aa(e,this.size,3);r.uniform3fv(this.addr,t)}function ZT(r,e){let t=Aa(e,this.size,4);r.uniform4fv(this.addr,t)}function KT(r,e){let t=Aa(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function JT(r,e){let t=Aa(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function $T(r,e){let t=Aa(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function QT(r,e){r.uniform1iv(this.addr,e)}function eM(r,e){r.uniform2iv(this.addr,e)}function tM(r,e){r.uniform3iv(this.addr,e)}function nM(r,e){r.uniform4iv(this.addr,e)}function iM(r,e){r.uniform1uiv(this.addr,e)}function rM(r,e){r.uniform2uiv(this.addr,e)}function sM(r,e){r.uniform3uiv(this.addr,e)}function oM(r,e){r.uniform4uiv(this.addr,e)}function aM(r,e,t){let n=this.cache,i=e.length,s=ch(t,i);Tn(n,s)||(r.uniform1iv(this.addr,s),Mn(n,s));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||l0,s[o])}function lM(r,e,t){let n=this.cache,i=e.length,s=ch(t,i);Tn(n,s)||(r.uniform1iv(this.addr,s),Mn(n,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||u0,s[o])}function cM(r,e,t){let n=this.cache,i=e.length,s=ch(t,i);Tn(n,s)||(r.uniform1iv(this.addr,s),Mn(n,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||h0,s[o])}function uM(r,e,t){let n=this.cache,i=e.length,s=ch(t,i);Tn(n,s)||(r.uniform1iv(this.addr,s),Mn(n,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||c0,s[o])}function hM(r){switch(r){case 5126:return qT;case 35664:return XT;case 35665:return YT;case 35666:return ZT;case 35674:return KT;case 35675:return JT;case 35676:return $T;case 5124:case 35670:return QT;case 35667:case 35671:return eM;case 35668:case 35672:return tM;case 35669:case 35673:return nM;case 5125:return iM;case 36294:return rM;case 36295:return sM;case 36296:return oM;case 35678:case 36198:case 36298:case 36306:case 35682:return aM;case 35679:case 36299:case 36307:return lM;case 35680:case 36300:case 36308:case 36293:return cM;case 36289:case 36303:case 36311:case 36292:return uM}}var Yf=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=jT(t.type)}},Zf=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=hM(t.type)}},Kf=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let s=0,o=i.length;s!==o;++s){let a=i[s];a.setValue(e,t[a.id],n)}}},Nf=/(\w+)(\])?(\[|\.)?/g;function _g(r,e){r.seq.push(e),r.map[e.id]=e}function fM(r,e,t){let n=r.name,i=n.length;for(Nf.lastIndex=0;;){let s=Nf.exec(n),o=Nf.lastIndex,a=s[1],c=s[2]==="]",l=s[3];if(c&&(a=a|0),l===void 0||l==="["&&o+2===i){_g(t,l===void 0?new Yf(a,r,e):new Zf(a,r,e));break}else{let h=t.map[a];h===void 0&&(h=new Kf(a),_g(t,h)),t=h}}}var ha=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,35718);for(let i=0;i<n;++i){let s=e.getActiveUniform(t,i),o=e.getUniformLocation(t,s.name);fM(s,o,this)}}setValue(e,t,n,i){let s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,o=t.length;s!==o;++s){let a=t[s],c=n[a.id];c.needsUpdate!==!1&&a.setValue(e,c.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,s=e.length;i!==s;++i){let o=e[i];o.id in t&&n.push(o)}return n}};function bg(r,e,t){let n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}var dM=0;function pM(r,e){let t=r.split(`
3084`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=i;o<s;o++){let a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(`
3085`)}function mM(r){switch(r){case io:return["Linear","( value )"];case It:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}
3085function Tg(r,e,t){let n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";let s=/ERROR: 0:(\d+)/.exec(i);if(s){let o=parseInt(s[1]);return t.toUpperCase()+`
3086
3087`+i+`
3088
3089`+pM(r.getShaderSource(e),o)}else return i}function gM(r,e){let t=mM(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function xM(r,e){let t;switch(e){case Cy:t="Linear";break;case Iy:t="Reinhard";break;case Ry:t="OptimizedCineon";break;case Py:t="ACESFilmic";break;case Ly:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function yM(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.tangentSpaceNormalMap||r.clearcoatNormalMap||r.flatShading||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(Fl).join(`
3090`)}function vM(r){let e=[];for(let t in r){let n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3091`)}function _M(r,e){let t={},n=r.getProgramParameter(e,35721);for(let i=0;i<n;i++){let s=r.getActiveAttrib(e,i),o=s.name,a=1;s.type===35674&&(a=2),s.type===35675&&(a=3),s.type===35676&&(a=4),t[o]={type:s.type,location:r.getAttribLocation(e,o),locationSize:a}}return t}function Fl(r){return r!==""}function Mg(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 wg(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var bM=/^[ \t]*#include +<([\w\d./]+)>/gm;function Jf(r){return r.replace(bM,TM)}function TM(r,e){let t=gt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Jf(t)}var MM=/#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 Sg(r){return r.replace(MM,wM)}function wM(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Eg(r){let e="precision "+r.precision+` float;
3092precision `+r.precision+" int;";return r.precision==="highp"?e+=`
3093#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
3094#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
3095#define LOW_PRECISION`),e}function SM(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===$g?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===oy?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Dl&&(e="SHADOWMAP_TYPE_VSM"),e}function EM(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case fa:case da:e="ENVMAP_TYPE_CUBE";break;case ah:e="ENVMAP_TYPE_CUBE_UV";break}return e}function AM(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case da:e="ENVMAP_MODE_REFRACTION";break}return e}function CM(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case oh:e="ENVMAP_BLENDING_MULTIPLY";break;case Ey:e="ENVMAP_BLENDING_MIX";break;case Ay:e="ENVMAP_BLENDING_ADD";break}return e}function IM(r){let e=r.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function RM(r,e,t,n){let i=r.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,c=SM(t),l=EM(t),u=AM(t),h=CM(t),f=IM(t),p=t.isWebGL2?"":yM(t),g=vM(s),m=i.createProgram(),d,x,_=t.glslVersion?"#version "+t.glslVersion+`
3096`:"";t.isRawShaderMaterial?(d=[g].filter(Fl).join(`
3097`),d.length>0&&(d+=`
3098`),x=[p,g].filter(Fl).join(`
3099`),x.length>0&&(x+=`
3100`)):(d=[Eg(t),"#define SHADER_NAME "+t.shaderName,g,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",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 "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IR
3100IDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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",`
3101`].filter(Fl).join(`
3102`),x=[p,Eg(t),"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",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.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Gr?"#define TONE_MAPPING":"",t.toneMapping!==Gr?gt.tonemapping_pars_fragment:"",t.toneMapping!==Gr?xM("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",gt.encodings_pars_fragment,gM("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3103`].filter(Fl).join(`
3104`)),o=Jf(o),o=Mg(o,t),o=wg(o,t),a=Jf(a),a=Mg(a,t),a=wg(a,t),o=Sg(o),a=Sg(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(_=`#version 300 es
3105`,d=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
3106`)+`
3107`+d,x=["#define varying in",t.glslVersion===Jm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Jm?"":"#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(`
3108`)+`
3109`+x);let v=_+d+o,y=_+x+a,w=bg(i,35633,v),L=bg(i,35632,y);if(i.attachShader(m,w),i.attachShader(m,L),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),r.debug.checkSha
3109derErrors){let A=i.getProgramInfoLog(m).trim(),N=i.getShaderInfoLog(w).trim(),G=i.getShaderInfoLog(L).trim(),F=!0,U=!0;if(i.getProgramParameter(m,35714)===!1){F=!1;let P=Tg(i,w,"vertex"),$=Tg(i,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,35715)+`
3110
3111Program Info Log: `+A+`
3112`+P+`
3113`+$)}else A!==""?console.warn("THREE.WebGLProgram: Program Info Log:",A):(N===""||G==="")&&(U=!1);U&&(this.diagnostics={runnable:F,programLog:A,vertexShader:{log:N,prefix:d},fragmentShader:{log:G,prefix:x}})}i.deleteShader(w),i.deleteShader(L);let C;this.getUniforms=function(){return C===void 0&&(C=new ha(i,m)),C};let b;return this.getAttributes=function(){return b===void 0&&(b=_M(i,m)),b},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=dM++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=w,this.fragmentShader=L,this}var PM=0,$f=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Qf(e),t.set(e,n)),n}},Qf=class{constructor(e){this.id=PM++,this.code=e,this.usedTimes=0}};function LM(r,e,t,n,i,s,o){let a=new Xl,c=new $f,l=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.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,A,N,G,F){let U=G.fog,P=F.geometry,$=b.isMeshStandardMaterial?G.environment:null,H=(b.isMeshStandardMaterial?t:e).get(b.envMap||$),Z=H&&H.mapping===ah?H.image.height:null,W=g[b.type];b.precision!==null&&(p=i.getMaxPrecision(b.precision),p!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",p,"instead."));let oe=P.morphAttributes.position||P.morphAttributes.normal||P.morphAttributes.color,ue=oe!==void 0?oe.length:0,ne=0;P.morphAttributes.position!==void 0&&(ne=1),P.morphAttributes.normal!==void 0&&(ne=2),P.morphAttributes.color!==void 0&&(ne=3);let le,he,I,M;if(W){let fe=dr[W];le=fe.vertexShader,he=fe.fragmentShader}else le=b.vertexShader,he=b.fragmentShader,c.update(b),I=c.getVertexShaderID(b),M=c.getFragmentShaderID(b);let T=r.getRenderTarget(),S=b.alphaTest>0,B=b.clearcoat>0,j=b.iridescence>0;return{isWebGL2:u,shaderID:W,shaderName:b.type,vertexShader:le,fragmentShader:he,defines:b.defines,customVertexShaderID:I,customFragmentShaderID:M,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:p,instancing:F.isInstancedMesh===!0,instancingColor:F.isInstancedMesh===!0&&F.instanceColor!==null,supportsVertexTextures:f,outputEncoding:T===null?r.outputEncoding:T.isXRRenderTarget===!0?T.texture.encoding:io,map:!!b.map,matcap:!!b.matcap,envMap:!!H,envMapMode:H&&H.mapping,envMapCubeUVHeight:Z,lightMap:!!b.lightMap,aoMap:!!b.aoMap,emissiveMap:!!b.emissiveMap,bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:b.normalMapType===$y,tangentSpaceNormalMap:b.normalMapType===lh,decodeVideoTexture:!!b.map&&b.map.isVideoTexture===!0&&b.map.encoding===It,clearcoat:B,clearcoatMap:B&&!!b.clearcoatMap,clearcoatRoughnessMap:B&&!!b.clearcoatRoughnessMap,clearcoatNormalMap:B&&!!b.clearcoatNormalMap,iridescence:j,iridescenceMap:j&&!!b.iridescenceMap,iridescenceThicknessMap:j&&!!b.iridescenceThicknessMap,displacementMap:!!b.displacementMap,roughnessMap:!!b.roughnessMap,metalnessMap:!!b.metalnessMap,specularMap:!!b.specularMap,specularIntensityMap:!!b.specularIntensityMap,specularColorMap:!!b.specularColorMap,opaque:b.transparent===!1&&b.blending===la,alphaMap:!!b.alphaMap,alphaTest:S,gradientMap:!!b.gradientMap,sheen:b.sheen>0,sheenColorMap:!!b.sheenColorMap,sheenRoughnessMap:!!b.sheenRoughnessMap,transmission:b.transmission>0,transmissionMap:!!b.transmissionMap,thicknessMap:!!b.thicknessMap,combine:b.combine,vertexTangents:!!b.normalMap&&!!P.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!P.attributes.color&&P.attributes.color.itemSize===4,vertexUvs:!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatMap||!!b.clearcoatRoughnessMap||!!b.clearcoatNormalMap||!!b.iridescenceMap||!!b.iridescenceThicknessMap||!!b.displacementMap||!!b.transmissionMap||!!b.thicknessMap||!!b.specularIntensityMap||!!b.specularColorMap||!!b.sheenColorMap||!!b.sheenRoughnessMap,uvsVertexOnly:!(b.map||b.bumpMap||b.normalMap||b.specularMap||b.alphaMap||b.emissiveMap||b.roughnessMap||b.metalnessMap||b.clearcoatNormalMap||b.iridescenceMap||b.iridescenceThicknessMap||b.transmission>0||b.transmissionMap||b.thicknessMap||b.specularIntensityMap||b.specularColorMap||b.sheen>0||b.sheenColorMap||b.sheenRoughnessMap)&&!!b.displacementMap,fog:!!U,useFog:b.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:!!b.flatShading,sizeAttenuation:b.sizeAttenuation,logarithmicDepthBuffer:h,skinning:F.isSkinnedMesh===!0,morphTargets:P.morphAttributes.position!==void 0,morphNormals:P.morphAttributes.normal!==void 0,morphColors:P.morphAttributes.color!==void 0,morphTargetsCount:ue,morphTextureStride:ne,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&N.length>0,shadowMapType:r.shadowMap.type,toneMapping:b.toneMapped?r.toneMapping:Gr,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===kn,flipSided:b.side===Pn,useDepthPacking:!!b.depthPacking,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:b.extensions&&b.extensions.derivatives,extensionFragDepth:b.extensions&&b.extensions.fragDepth,extensionDrawBuffers:b.extensions&&b.extensions.drawBuffers,extensionShaderTextureLOD:b.extensions&&b.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function d(b){let A=[];
vendor: 4,779 bytes, line 3113
3113if(b.shaderID?A.push(b.shaderID):(A.push(b.customVertexShaderID),A.push(b.customFragmentShaderID)),b.defines!==void 0)for(let N in b.defines)A.push(N),A.push(b.defines[N]);return b.isRawShaderMaterial===!1&&(x(A,b),_(A,b),A.push(r.outputEncoding)),A.push(b.customProgramCacheKey),A.join()}function x(b,A){b.push(A.precision),b.push(A.outputEncoding),b.push(A.envMapMode),b.push(A.envMapCubeUVHeight),b.push(A.combine),b.push(A.vertexUvs),b.push(A.fogExp2),b.push(A.sizeAttenuation),b.push(A.morphTargetsCount),b.push(A.morphAttributeCount),b.push(A.numDirLights),b.push(A.numPointLights),b.push(A.numSpotLights),b.push(A.numSpotLightMaps),b.push(A.numHemiLights),b.push(A.numRectAreaLights),b.push(A.numDirLightShadows),b.push(A.numPointLightShadows),b.push(A.numSpotLightShadows),b.push(A.numSpotLightShadowsWithMaps),b.push(A.shadowMapType),b.push(A.toneMapping),b.push(A.numClippingPlanes),b.push(A.numClipIntersection),b.push(A.depthPacking)}function _(b,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.map&&a.enable(4),A.matcap&&a.enable(5),A.envMap&&a.enable(6),A.lightMap&&a.enable(7),A.aoMap&&a.enable(8),A.emissiveMap&&a.enable(9),A.bumpMap&&a.enable(10),A.normalMap&&a.enable(11),A.objectSpaceNormalMap&&a.enable(12),A.tangentSpaceNormalMap&&a.enable(13),A.clearcoat&&a.enable(14),A.clearcoatMap&&a.enable(15),A.clearcoatRoughnessMap&&a.enable(16),A.clearcoatNormalMap&&a.enable(17),A.iridescence&&a.enable(18),A.iridescenceMap&&a.enable(19),A.iridescenceThicknessMap&&a.enable(20),A.displacementMap&&a.enable(21),A.specularMap&&a.enable(22),A.roughnessMap&&a.enable(23),A.metalnessMap&&a.enable(24),A.gradientMap&&a.enable(25),A.alphaMap&&a.enable(26),A.alphaTest&&a.enable(27),A.vertexColors&&a.enable(28),A.vertexAlphas&&a.enable(29),A.vertexUvs&&a.enable(30),A.vertexTangents&&a.enable(31),A.uvsVertexOnly&&a.enable(32),b.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.physicallyCorrectLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.specularIntensityMap&&a.enable(15),A.specularColorMap&&a.enable(16),A.transmission&&a.enable(17),A.transmissionMap&&a.enable(18),A.thicknessMap&&a.enable(19),A.sheen&&a.enable(20),A.sheenColorMap&&a.enable(21),A.sheenRoughnessMap&&a.enable(22),A.decodeVideoTexture&&a.enable(23),A.opaque&&a.enable(24),b.push(a.mask)}function v(b){let A=g[b.type],N;if(A){let G=dr[A];N=Sv.clone(G.uniforms)}else N=b.uniforms;return N}function y(b,A){let N;for(let G=0,F=l.length;G<F;G++){let U=l[G];if(U.cacheKey===A){N=U,++N.usedTimes;break}}return N===void 0&&(N=new RM(r,A,b,s),l.push(N)),N}function w(b){if(--b.usedTimes===0){let A=l.indexOf(b);l[A]=l[l.length-1],l.pop(),b.destroy()}}function L(b){c.remove(b)}function C(){c.dispose()}return{getParameters:m,getProgramCacheKey:d,getUniforms:v,acquireProgram:y,releaseProgram:w,releaseShaderCache:L,programs:l,dispose:C}}function NM(){let r=new WeakMap;function e(s){let o=r.get(s);return o===void 0&&(o={},r.set(s,o)),o}function t(s){r.delete(s)}function n(s,o,a){r.get(s)[o]=a}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function OM(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 Ag(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 Cg(){let r=[],e=0,t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(h,f,p,g,m,d){let x=r[e];return x===void 0?(x={id:h.id,object:h,geometry:f,material:p,groupOrder:g,renderOrder:h.renderOrder,z:m,group:d},r[e]=x):(x.id=h.id,x.object=h,x.geometry=f,x.material=p,x.groupOrder=g,x.renderOrder=h.renderOrder,x.z=m,x.group=d),e++,x}function a(h,f,p,g,m,d){let x=o(h,f,p,g,m,d);p.transmission>0?n.push(x):p.transparent===!0?i.push(x):t.push(x)}function c(h,f,p,g,m,d){let x=o(h,f,p,g,m,d);p.transmission>0?n.unshift(x):p.transparent===!0?i.unshift(x):t.unshift(x)}function l(h,f){t.length>1&&t.sort(h||OM),n.length>1&&n.sort(f||Ag),i.length>1&&i.sort(f||Ag)}function u(){for(let h=e,f=r.length;h<f;h++){let p=r[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:a,unshift:c,finish:u,sort:l}}
3113function DM(){let r=new WeakMap;function e(n,i){let s=r.get(n),o;return s===void 0?(o=new Cg,r.set(n,[o])):i>=s.length?(o=new Cg,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function kM(){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 ae,color:new $e};break;case"SpotLight":t={position:new ae,direction:new ae,color:new $e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ae,color:new $e,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ae,skyColor:new $e,groundColor:new $e};break;case"RectAreaLight":t={color:new $e,position:new ae,halfWidth:new ae,halfHeight:new ae};break}return r[e.id]=t,t}}}function FM(){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 Ee};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ee};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ee,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var UM=0;function BM(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function GM(r,e){let t=new kM,n=FM(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let u=0;u<9;u++)i.probe.push(new ae);let s=new ae,o=new Xe,a=new Xe;function c(u,h){let f=0,p=0,g=0;for(let G=0;G<9;G++)i.probe[G].set(0,0,0);let m=0,d=0,x=0,_=0,v=0,y=0,w=0,L=0,C=0,b=0;u.sort(BM);let A=h!==!0?Math.PI:1;for(let G=0,F=u.length;G<F;G++){let U=u[G],P=U.color,$=U.intensity,H=U.distance,Z=U.shadow&&U.shadow.map?U.shadow.map.texture:null;if(U.isAmbientLight)f+=P.r*$*A,p+=P.g*$*A,g+=P.b*$*A;else if(U.isLightProbe)for(let W=0;W<9;W++)i.probe[W].addScaledVector(U.sh.coefficients[W],$);else if(U.isDirectionalLight){let W=t.get(U);if(W.color.copy(U.color).multiplyScalar(U.intensity*A),U.castShadow){let oe=U.shadow,ue=n.get(U);ue.shadowBias=oe.bias,ue.shadowNormalBias=oe.normalBias,ue.shadowRadius=oe.radius,ue.shadowMapSize=oe.mapSize,i.directionalShadow[m]=ue,i.directionalShadowMap[m]=Z,i.directionalShadowMatrix[m]=U.shadow.matrix,y++}i.directional[m]=W,m++}else if(U.isSpotLight){let W=t.get(U);W.position.setFromMatrixPosition(U.matrixWorld),W.color.copy(P).multiplyScalar($*A),W.distance=H,W.coneCos=Math.cos(U.angle),W.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),W.decay=U.decay,i.spot[x]=W;let oe=U.shadow;if(U.map&&(i.spotLightMap[C]=U.map,C++,oe.updateMatrices(U),U.castShadow&&b++),i.spotLightMatrix[x]=oe.matrix,U.castShadow){let ue=n.get(U);ue.shadowBias=oe.bias,ue.shadowNormalBias=oe.normalBias,ue.shadowRadius=oe.radius,ue.shadowMapSize=oe.mapSize,i.spotShadow[x]=ue,i.spotShadowMap[x]=Z,L++}x++}else if(U.isRectAreaLight){let W=t.get(U);W.color.copy(P).multiplyScalar($),W.halfWidth.set(U.width*.5,0,0),W.halfHeight.set(0,U.height*.5,0),i.rectArea[_]=W,_++}else if(U.isPointLight){let W=t.get(U);if(W.color.copy(U.color).multiplyScalar(U.intensity*A),W.distance=U.distance,W.decay=U.decay,U.castShadow){let oe=U.shadow,ue=n.get(U);ue.shadowBias=oe.bias,ue.shadowNormalBias=oe.normalBias,ue.shadowRadius=oe.radius,ue.shadowMapSize=oe.mapSize,ue.shadowCameraNear=oe.camera.near,ue.shadowCameraFar=oe.camera.far,i.pointShadow[d]=ue,i.pointShadowMap[d]=Z,i.pointShadowMatrix[d]=U.shadow.matrix,w++}i.point[d]=W,d++}else if(U.isHemisphereLight){let W=t.get(U);W.skyColor.copy(U.color).multiplyScalar($*A),W.groundColor.copy(U.groundColor).multiplyScalar($*A),i.hemi[v]=W,v++}}_>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ge.LTC_FLOAT_1,i.rectAreaLTC2=Ge.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Ge.LTC_HALF_1,i.rectAreaLTC2=Ge.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=p,i.ambient[2]=g;let N=i.hash;(N.directionalLength!==m||N.pointLength!==d||N.spotLength!==x||N.rectAreaLength!==_||N.hemiLength!==v||N.numDirectionalShadows!==y||N.numPointShadows!==w||N.numSpotShadows!==L||N.numSpotMaps!==C)&&(i.directional.length=m,i.spot.length=x,i.rectArea.length=_,i.point.length=d,i.hemi.length=v,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=L,i.spotShadowMap.length=L,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=L+C-b,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=b,N.directionalLength=m,N.pointLength=d,N.spotLength=x,N.rectAreaLength=_,N.hemiLength=v,N.numDirectionalShadows=y,N.numPointShadows=w,N.numSpotShadows=L,N.numSpotMaps=C,i.version=UM++)}function l(u,h){let f=0,p=0,g=0,m=0,d=0,x=h.matrixWorldInverse;for(let _=0,v=u.length;_<v;_++){let y=u[_];
3113if(y.isDirectionalLight){let w=i.directional[f];w.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(x),f++}else if(y.isSpotLight){let w=i.spot[g];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(x),w.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(x),g++}else if(y.isRectAreaLight){let w=i.rectArea[m];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(x),a.identity(),o.copy(y.matrixWorld),o.premultiply(x),a.extractRotation(o),w.halfWidth.set(y.width*.5,0,0),w.halfHeight.set(0,y.height*.5,0),w.halfWidth.applyMatrix4(a),w.halfHeight.applyMatrix4(a),m++}else if(y.isPointLight){let w=i.point[p];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(x),p++}else if(y.isHemisphereLight){let w=i.hemi[d];w.direction.setFromMatrixPosition(y.matrixWorld),w.direction.transformDirection(x),d++}}}return{setup:c,setupView:l,state:i}}function Ig(r,e){let t=new GM(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function c(h){t.setup(n,h)}function l(h){t.setupView(n,h)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:c,setupLightsView:l,pushLight:o,pushShadow:a}}function zM(r,e){let t=new WeakMap;function n(s,o=0){let a=t.get(s),c;return a===void 0?(c=new Ig(r,e),t.set(s,[c])):o>=a.length?(c=new Ig(r,e),a.push(c)):c=a[o],c}function i(){t=new WeakMap}return{get:n,dispose:i}}var ed=class extends Xi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ky,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}},td=class extends Xi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new ae,this.nearDistance=1,this.farDistance=1e3,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.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},VM=`void main() {
3114	gl_Position = vec4( position, 1.0 );
3115}`,HM=`uniform sampler2D shadow_pass;
3116uniform vec2 resolution;
3117uniform float radius;
3118#include <packing>
3119void main() {
3120	const float samples = float( VSM_SAMPLES );
3121	float mean = 0.0;
3122	float squared_mean = 0.0;
3123	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3124	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3125	for ( float i = 0.0; i < samples; i ++ ) {
3126		float uvOffset = uvStart + i * uvStride;
3127		#ifdef HORIZONTAL_PASS
3128			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3129			mean += distribution.x;
3130			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3131		#else
3132			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3133			mean += depth;
3134			squared_mean += depth * depth;
3135		#endif
3136	}
3137	mean = mean / samples;
3138	squared_mean = squared_mean / samples;
3139	float std_dev = sqrt( squared_mean - mean * mean );
3140	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3141}`;function WM(r,e,t){let n=new Zl,i=new Ee,s=new Ee,o=new St,a=new ed({depthPacking:Jy}),c=new td,l={},u=t.maxTextureSize,h={0:Pn,1:pr,2:kn}
vendor: 4,600 bytes, line 3141
3141,f=new Wr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ee},radius:{value:4}},vertexShader:VM,fragmentShader:HM}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let g=new yt;g.setAttribute("position",new Fn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new kt(g,f),d=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=$g,this.render=function(y,w,L){if(d.enabled===!1||d.autoUpdate===!1&&d.needsUpdate===!1||y.length===0)return;let C=r.getRenderTarget(),b=r.getActiveCubeFace(),A=r.getActiveMipmapLevel(),N=r.state;N.setBlending(ms),N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);for(let G=0,F=y.length;G<F;G++){let U=y[G],P=U.shadow;if(P===void 0){console.warn("THREE.WebGLShadowMap:",U,"has no shadow.");continue}if(P.autoUpdate===!1&&P.needsUpdate===!1)continue;i.copy(P.mapSize);let $=P.getFrameExtents();if(i.multiply($),s.copy(P.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/$.x),i.x=s.x*$.x,P.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/$.y),i.y=s.y*$.y,P.mapSize.y=s.y)),P.map===null){let Z=this.type!==Dl?{minFilter:_n,magFilter:_n}:{};P.map=new zr(i.x,i.y,Z),P.map.texture.name=U.name+".shadowMap",P.camera.updateProjectionMatrix()}r.setRenderTarget(P.map),r.clear();let H=P.getViewportCount();for(let Z=0;Z<H;Z++){let W=P.getViewport(Z);o.set(s.x*W.x,s.y*W.y,s.x*W.z,s.y*W.w),N.viewport(o),P.updateMatrices(U,Z),n=P.getFrustum(),v(w,L,P.camera,U,this.type)}P.isPointLightShadow!==!0&&this.type===Dl&&x(P,L),P.needsUpdate=!1}d.needsUpdate=!1,r.setRenderTarget(C,b,A)};function x(y,w){let L=e.update(m);f.defines.VSM_SAMPLES!==y.blurSamples&&(f.defines.VSM_SAMPLES=y.blurSamples,p.defines.VSM_SAMPLES=y.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),y.mapPass===null&&(y.mapPass=new zr(i.x,i.y)),f.uniforms.shadow_pass.value=y.map.texture,f.uniforms.resolution.value=y.mapSize,f.uniforms.radius.value=y.radius,r.setRenderTarget(y.mapPass),r.clear(),r.renderBufferDirect(w,null,L,f,m,null),p.uniforms.shadow_pass.value=y.mapPass.texture,p.uniforms.resolution.value=y.mapSize,p.uniforms.radius.value=y.radius,r.setRenderTarget(y.map),r.clear(),r.renderBufferDirect(w,null,L,p,m,null)}function _(y,w,L,C,b,A){let N=null,G=L.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(G!==void 0?N=G:N=L.isPointLight===!0?c:a,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 F=N.uuid,U=w.uuid,P=l[F];P===void 0&&(P={},l[F]=P);let $=P[U];$===void 0&&($=N.clone(),P[U]=$),N=$}return N.visible=w.visible,N.wireframe=w.wireframe,A===Dl?N.side=w.shadowSide!==null?w.shadowSide:w.side:N.side=w.shadowSide!==null?w.shadowSide:h[w.side],N.alphaMap=w.alphaMap,N.alphaTest=w.alphaTest,N.map=w.map,N.clipShadows=w.clipShadows,N.clippingPlanes=w.clippingPlanes,N.clipIntersection=w.clipIntersection,N.displacementMap=w.displacementMap,N.displacementScale=w.displacementScale,N.displacementBias=w.displacementBias,N.wireframeLinewidth=w.wireframeLinewidth,N.linewidth=w.linewidth,L.isPointLight===!0&&N.isMeshDistanceMaterial===!0&&(N.referencePosition.setFromMatrixPosition(L.matrixWorld),N.nearDistance=C,N.farDistance=b),N}function v(y,w,L,C,b){if(y.visible===!1)return;if(y.layers.test(w.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&b===Dl)&&(!y.frustumCulled||n.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,y.matrixWorld);let G=e.update(y),F=y.material;if(Array.isArray(F)){let U=G.groups;for(let P=0,$=U.length;P<$;P++){let H=U[P],Z=F[H.materialIndex];if(Z&&Z.visible){let W=_(y,Z,C,L.near,L.far,b);r.renderBufferDirect(L,null,G,W,y,H)}}}else if(F.visible){let U=_(y,F,C,L.near,L.far,b);r.renderBufferDirect(L,null,G,U,y,null)}}let N=y.children;for(let G=0,F=N.length;G<F;G++)v(N[G],w,L,C,b)}}function jM(r,e,t){let n=t.isWebGL2;function i(){let de=!1,be=new St,Se=null,De=new St(0,0,0,0);return{setMask:function(Fe){Se!==Fe&&!de&&(r.colorMask(Fe,Fe,Fe,Fe),Se=Fe)},setLocked:function(Fe){de=Fe},setClear:function(Fe,at,vt,rt,Ye){Ye===!0&&(Fe*=rt,at*=rt,vt*=rt),be.set(Fe,at,vt,rt),De.equals(be)===!1&&(r.clearColor(Fe,at,vt,rt),De.copy(be))},reset:function(){de=!1,Se=null,De.set(-1,0,0,0)}}}function s(){let de=!1,be=null,Se=null,De=null;return{setTest:function(Fe){Fe?S(2929):B(2929)},setMask:function(Fe){be!==Fe&&!de&&(r.depthMask(Fe),be=Fe)},setFunc:function(Fe){if(Se!==Fe){switch(Fe){case vy:r.depthFunc(512);break;case _y:r.depthFunc(519);break;case by:r.depthFunc(513);break;
3141case zf:r.depthFunc(515);break;case Ty:r.depthFunc(514);break;case My:r.depthFunc(518);break;case wy:r.depthFunc(516);break;case Sy:r.depthFunc(517);break;default:r.depthFunc(515)}Se=Fe}},setLocked:function(Fe){de=Fe},setClear:function(Fe){De!==Fe&&(r.clearDepth(Fe),De=Fe)},reset:function(){de=!1,be=null,Se=null,De=null}}}function o(){let de=!1,be=null,Se=null,De=null,Fe=null,at=null,vt=null,rt=null,Ye=null;return{setTest:function(Oe){de||(Oe?S(2960):B(2960))},setMask:function(Oe){be!==Oe&&!de&&(r.stencilMask(Oe),be=Oe)},setFunc:function(Oe,Be,We){(Se!==Oe||De!==Be||Fe!==We)&&(r.stencilFunc(Oe,Be,We),Se=Oe,De=Be,Fe=We)},setOp:function(Oe,Be,We){(at!==Oe||vt!==Be||rt!==We)&&(r.stencilOp(Oe,Be,We),at=Oe,vt=Be,rt=We)},setLocked:function(Oe){de=Oe},setClear:function(Oe){Ye!==Oe&&(r.clearStencil(Oe),Ye=Oe)},reset:function(){de=!1,be=null,Se=null,De=null,Fe=null,at=null,vt=null,rt=null,Ye=null}}}let a=new i,c=new s,l=new o,u=new WeakMap,h=new WeakMap,f={},p={},g=new WeakMap,m=[],d=null,x=!1,_=null,v=null,y=null,w=null,L=null,C=null,b=null,A=!1,N=null,G=null,F=null,U=null,P=null,$=r.getParameter(35661),H=!1,Z=0,W=r.getParameter(7938);W.indexOf("WebGL")!==-1?(Z=parseFloat(/^WebGL (\d)/.exec(W)[1]),H=Z>=1):W.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(W)[1]),H=Z>=2);let oe=null,ue={},ne=r.getParameter(3088),le=r.getParameter(2978),he=new St().fromArray(ne),I=new St().fromArray(le);function M(de,be,Se){let De=new Uint8Array(4),Fe=r.createTexture();r.bindTexture(de,Fe),r.texParameteri(de,10241,9728),r.texParameteri(de,10240,9728);for(let at=0;at<Se;at++)r.texImage2D(be+at,0,6408,1,1,0,6408,5121,De);return Fe}let T={};T[3553]=M(3553,3553,1),T[34067]=M(34067,34069,6),a.setClear(0,0,0,1),c.setClear(1),l.setClear(0),S(2929),c.setFunc(zf),xe(!1),we(ym),S(2884),te(ms);function S(de){f[de]!==!0&&(r.enable(de),f[de]=!0)}function B(de){f[de]!==!1&&(r.disable(de),f[de]=!1)}function j(de,be){return p[de]!==be?(r.bindFramebuffer(de,be),p[de]=be,n&&(de===36009&&(p[36160]=be),de===36160&&(p[36009]=be)),!0):!1}function z(de,be){let Se=m,De=!1;if(de)if(Se=g.get(be),Se===void 0&&(Se=[],g.set(be,Se)),de.isWebGLMultipleRenderTargets){let Fe=de.texture;if(Se.length!==Fe.length||Se[0]!==36064){for(let at=0,vt=Fe.length;at<vt;at++)Se[at]=36064+at;Se.length=Fe.length,De=!0}}else Se[0]!==36064&&(Se[0]=36064,De=!0);else Se[0]!==1029&&(Se[0]=1029,De=!0);De&&(t.isWebGL2?r.drawBuffers(Se):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Se))}function fe(de){return d!==de?(r.useProgram(de),d=de,!0):!1}let q={[sa]:32774,[ly]:32778,[cy]:32779};if(n)q[Tm]=32775,q[Mm]=32776;else{let de=e.get("EXT_blend_minmax");de!==null&&(q[Tm]=de.MIN_EXT,q[Mm]=de.MAX_EXT)}let re={[uy]:0,[hy]:1,[fy]:768,[Qg]:770,[yy]:776,[gy]:774,[py]:772,[dy]:769,[e0]:771,[xy]:775,[my]:773};function te(de,be,Se,De,Fe,at,vt,rt){if(de===ms){x===!0&&(B(3042),x=!1);return}if(x===!1&&(S(3042),x=!0),de!==ay){if(de!==_||rt!==A){if((v!==sa||L!==sa)&&(r.blendEquation(32774),v=sa,L=sa),rt)switch(de){case la:r.blendFuncSeparate(1,771,1,771);break;case vm:r.blendFunc(1,1);break;case _m:r.blendFuncSeparate(0,769,0,1);break;case bm:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",de);break}else switch(de){case la:r.blendFuncSeparate(770,771,1,771);break;case vm:r.blendFunc(770,1);break;case _m:r.blendFuncSeparate(0,769,0,1);break;case bm:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",de);break}y=null,w=null,C=null,b=null,_=de,A=rt}return}Fe=Fe||be,at=at||Se,vt=vt||De,(be!==v||Fe!==L)&&(r.blendEquationSeparate(q[be],q[Fe]),v=be,L=Fe),(Se!==y||De!==w||at!==C||vt!==b)&&(r.blendFuncSeparate(re[Se],re[De],re[at],re[vt]),y=Se,w=De,C=at,b=vt),_=de,A=!1}function ge(de,be){de.side===kn?B(2884):S(2884);let Se=de.side===Pn;be&&(Se=!Se),xe(Se),de.blending===la&&de.transparent===!1?te(ms):te(de.blending,de.blendEquation,de.blendSrc,de.blendDst,de.blendEquationAlpha,de.blendSrcAlpha,de.blendDstAlpha,de.premultipliedAlpha),c.setFunc(de.depthFunc),c.setTest(de.depthTest),c.setMask(de.depthWrite),a.setMask(de.colorWrite);let De=de.stencilWrite;
vendor: 4,107 bytes, line 3141
3141l.setTest(De),De&&(l.setMask(de.stencilWriteMask),l.setFunc(de.stencilFunc,de.stencilRef,de.stencilFuncMask),l.setOp(de.stencilFail,de.stencilZFail,de.stencilZPass)),J(de.polygonOffset,de.polygonOffsetFactor,de.polygonOffsetUnits),de.alphaToCoverage===!0?S(32926):B(32926)}function xe(de){N!==de&&(de?r.frontFace(2304):r.frontFace(2305),N=de)}function we(de){de!==ry?(S(2884),de!==G&&(de===ym?r.cullFace(1029):de===sy?r.cullFace(1028):r.cullFace(1032))):B(2884),G=de}function se(de){de!==F&&(H&&r.lineWidth(de),F=de)}function J(de,be,Se){de?(S(32823),(U!==be||P!==Se)&&(r.polygonOffset(be,Se),U=be,P=Se)):B(32823)}function Ae(de){de?S(3089):B(3089)}function Le(de){de===void 0&&(de=33984+$-1),oe!==de&&(r.activeTexture(de),oe=de)}function R(de,be,Se){Se===void 0&&(oe===null?Se=33984+$-1:Se=oe);let De=ue[Se];De===void 0&&(De={type:void 0,texture:void 0},ue[Se]=De),(De.type!==de||De.texture!==be)&&(oe!==Se&&(r.activeTexture(Se),oe=Se),r.bindTexture(de,be||T[de]),De.type=de,De.texture=be)}function E(){let de=ue[oe];de!==void 0&&de.type!==void 0&&(r.bindTexture(de.type,null),de.type=void 0,de.texture=void 0)}function k(){try{r.compressedTexImage2D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function Q(){try{r.compressedTexImage3D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function K(){try{r.texSubImage2D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function ce(){try{r.texSubImage3D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function me(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function pe(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function ie(){try{r.texStorage2D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function ve(){try{r.texStorage3D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function Te(){try{r.texImage2D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function Pe(){try{r.texImage3D.apply(r,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function ke(de){he.equals(de)===!1&&(r.scissor(de.x,de.y,de.z,de.w),he.copy(de))}function ze(de){I.equals(de)===!1&&(r.viewport(de.x,de.y,de.z,de.w),I.copy(de))}function Ke(de,be){let Se=h.get(be);Se===void 0&&(Se=new WeakMap,h.set(be,Se));let De=Se.get(de);De===void 0&&(De=r.getUniformBlockIndex(be,de.name),Se.set(de,De))}function qe(de,be){let De=h.get(be).get(de);u.get(de)!==De&&(r.uniformBlockBinding(be,De,de.__bindingPointIndex),u.set(de,De))}function Qe(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,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),f={},oe=null,ue={},p={},g=new WeakMap,m=[],d=null,x=!1,_=null,v=null,y=null,w=null,L=null,C=null,b=null,A=!1,N=null,G=null,F=null,U=null,P=null,he.set(0,0,r.canvas.width,r.canvas.height),I.set(0,0,r.canvas.width,r.canvas.height),a.reset(),c.reset(),l.reset()}return{buffers:{color:a,depth:c,stencil:l},enable:S,disable:B,bindFramebuffer:j,drawBuffers:z,useProgram:fe,setBlending:te,setMaterial:ge,setFlipSided:xe,setCullFace:we,setLineWidth:se,setPolygonOffset:J,setScissorTest:Ae,activeTexture:Le,bindTexture:R,unbindTexture:E,compressedTexImage2D:k,compressedTexImage3D:Q,texImage2D:Te,texImage3D:Pe,updateUBOMapping:Ke,uniformBlockBinding:qe,texStorage2D:ie,texStorage3D:ve,texSubImage2D:K,texSubImage3D:ce,compressedTexSubImage2D:me,compressedTexSubImage3D:pe,scissor:ke,viewport:ze,reset:Qe}}
3141function qM(r,e,t,n,i,s,o){let a=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap,m,d=new WeakMap,x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(R,E){return x?new OffscreenCanvas(R,E):ql("canvas")}function v(R,E,k,Q){let K=1;if((R.width>Q||R.height>Q)&&(K=Q/Math.max(R.width,R.height)),K<1||E===!0)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap){let ce=E?Vu:Math.floor,me=ce(K*R.width),pe=ce(K*R.height);m===void 0&&(m=_(me,pe));let ie=k?_(me,pe):m;return ie.width=me,ie.height=pe,ie.getContext("2d").drawImage(R,0,0,me,pe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+R.width+"x"+R.height+") to ("+me+"x"+pe+")."),ie}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+R.width+"x"+R.height+")."),R;return R}function y(R){return Wf(R.width)&&Wf(R.height)}function w(R){return a?!1:R.wrapS!==Wt||R.wrapT!==Wt||R.minFilter!==_n&&R.minFilter!==dn}function L(R,E){return R.generateMipmaps&&E&&R.minFilter!==_n&&R.minFilter!==dn}function C(R){r.generateMipmap(R)}function b(R,E,k,Q,K=!1){if(a===!1)return E;if(R!==null){if(r[R]!==void 0)return r[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let ce=E;return E===6403&&(k===5126&&(ce=33326),k===5131&&(ce=33325),k===5121&&(ce=33321)),E===33319&&(k===5126&&(ce=33328),k===5131&&(ce=33327),k===5121&&(ce=33323)),E===6408&&(k===5126&&(ce=34836),k===5131&&(ce=34842),k===5121&&(ce=Q===It&&K===!1?35907:32856),k===32819&&(ce=32854),k===32820&&(ce=32855)),(ce===33325||ce===33326||ce===33327||ce===33328||ce===34842||ce===34836)&&e.get("EXT_color_buffer_float"),ce}function A(R,E,k){return L(R,k)===!0||R.isFramebufferTexture&&R.minFilter!==_n&&R.minFilter!==dn?Math.log2(Math.max(E.width,E.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?E.mipmaps.length:1}function N(R){return R===_n||R===wm||R===Sm?9728:9729}function G(R){let E=R.target;E.removeEventListener("dispose",G),U(E),E.isVideoTexture&&g.delete(E)}function F(R){let E=R.target;E.removeEventListener("dispose",F),$(E)}function U(R){let E=n.get(R);if(E.__webglInit===void 0)return;let k=R.source,Q=d.get(k);if(Q){let K=Q[E.__cacheKey];K.usedTimes--,K.usedTimes===0&&P(R),Object.keys(Q).length===0&&d.delete(k)}n.remove(R)}function P(R){let E=n.get(R);r.deleteTexture(E.__webglTexture);let k=R.source,Q=d.get(k);delete Q[E.__cacheKey],o.memory.textures--}function $(R){let E=R.texture,k=n.get(R),Q=n.get(E);if(Q.__webglTexture!==void 0&&(r.deleteTexture(Q.__webglTexture),o.memory.textures--),R.depthTexture&&R.depthTexture.dispose(),R.isWebGLCubeRenderTarget)for(let K=0;K<6;K++)r.deleteFramebuffer(k.__webglFramebuffer[K]),k.__webglDepthbuffer&&r.deleteRenderbuffer(k.__webglDepthbuffer[K]);else{if(r.deleteFramebuffer(k.__webglFramebuffer),k.__webglDepthbuffer&&r.deleteRenderbuffer(k.__webglDepthbuffer),k.__webglMultisampledFramebuffer&&r.deleteFramebuffer(k.__webglMultisampledFramebuffer),k.__webglColorRenderbuffer)for(let K=0;K<k.__webglColorRenderbuffer.length;K++)k.__webglColorRenderbuffer[K]&&r.deleteRenderbuffer(k.__webglColorRenderbuffer[K]);k.__webglDepthRenderbuffer&&r.deleteRenderbuffer(k.__webglDepthRenderbuffer)}if(R.isWebGLMultipleRenderTargets)for(let K=0,ce=E.length;K<ce;K++){let me=n.get(E[K]);me.__webglTexture&&(r.deleteTexture(me.__webglTexture),o.memory.textures--),n.remove(E[K])}n.remove(E),n.remove(R)}let H=0;function Z(){H=0}function W(){let R=H;return R>=c&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+c),H+=1,R}function oe(R){let E=[];return E.push(R.wrapS),E.push(R.wrapT),E.push(R.wrapR||0),E.push(R.magFilter),E.push(R.minFilter),E.push(R.anisotropy),E.push(R.internalFormat),E.push(R.format),E.push(R.type),E.push(R.generateMipmaps),E.push(R.premultiplyAlpha),E.push(R.flipY),E.push(R.unpackAlignment),E.push(R.encoding),E.join()}function ue(R,E){let k=n.get(R);if(R.isVideoTexture&&Ae(R),R.isRenderTargetTexture===!1&&R.version>0&&k.__version!==R.version){let Q=R.image;if(Q===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{B(k,R,E);return}}t.bindTexture(3553,k.__webglTexture,33984+E)}function ne(R,E){let k=n.get(R);if(R.version>0&&k.__version!==R.version){B(k,R,E);return}t.bindTexture(35866,k.__webglTexture,33984+E)}function le(R,E){let k=n.get(R);if(R.version>0&&k.__version!==R.version){B(k,R,E);return}t.bindTexture(32879,k.__webglTexture,33984+E)}function he(R,E){let k=n.get(R);if(R.version>0&&k.__version!==R.version){j(k,R,E);return}t.bindTexture(34067,k.__webglTexture,33984+E)}let I={[$t]:10497,[Wt]:33071,[pa]:33648},M={[_n]:9728,[wm]:9984,[Sm]:9986,[dn]:9729,[Ny]:9985,[br]:9987};function T(R,E,k){if(k?(r.texParameteri(R,10242,I[E.wrapS]),r.texParameteri(R,10243,I[E.wrapT]),(R===32879||R===35866)&&r.texParameteri(R,32882,I[E.wrapR]),r.texParameteri(R,10240,M[E.magFilter]),r.texParameteri(R,10241,M[E.minFilter])):(r.texParameteri(R,10242,33071),r.texParameteri(R,10243,33071),(R===32879||R===35866)&&r.texParameteri(R,32882,33071),(E.wrapS!==Wt||E.wrapT!==Wt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(R,10240,N(E.magFilter)),r.texParameteri(R,10241,N(E.minFilter)),E.minFilter!==_n&&E.minFilter!==dn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){let Q=e.get("EXT_texture_filter_anisotropic");if(E.type===ps&&e.has("OES_texture_float_linear")===!1||a===!1&&E.type===Hl&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||n.get(E).__currentAnisotropy)&&(r.texParameterf(R,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,i.getMaxAnisotropy())),n.get(E).__currentAnisotropy=E.anisotropy)}}function S(R,E){let k=!1;R.__webglInit===void 0&&(R.__webglInit=!0,E.addEventListener("dispose",G));let Q=E.source,K=d.get(Q);K===void 0&&(K={},d.set(Q,K));let ce=oe(E);if(ce!==R.__cacheKey){K[ce]===void 0&&(K[ce]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,k=!0),K[ce].usedTimes++;let me=K[R.__cacheKey];me!==void 0&&(K[R.__cacheKey].usedTimes--,me.usedTimes===0&&P(E)),R.__cacheKey=ce,R.__webglTexture=K[ce].texture}return k}
3141function B(R,E,k){let Q=3553;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(Q=35866),E.isData3DTexture&&(Q=32879);let K=S(R,E),ce=E.source;t.bindTexture(Q,R.__webglTexture,33984+k);let me=n.get(ce);if(ce.version!==me.__version||K===!0){t.activeTexture(33984+k),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);let pe=w(E)&&y(E.image)===!1,ie=v(E.image,pe,!1,u);ie=Le(E,ie);let ve=y(ie)||a,Te=s.convert(E.format,E.encoding),Pe=s.convert(E.type),ke=b(E.internalFormat,Te,Pe,E.encoding,E.isVideoTexture);T(Q,E,ve);let ze,Ke=E.mipmaps,qe=a&&E.isVideoTexture!==!0,Qe=me.__version===void 0||K===!0,de=A(E,ie,ve);if(E.isDepthTexture)ke=6402,a?E.type===ps?ke=36012:E.type===Qs?ke=33190:E.type===ca?ke=35056:ke=33189:E.type===ps&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===eo&&ke===6402&&E.type!==n0&&E.type!==Qs&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=Qs,Pe=s.convert(E.type)),E.format===ma&&ke===6402&&(ke=34041,E.type!==ca&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=ca,Pe=s.convert(E.type))),Qe&&(qe?t.texStorage2D(3553,1,ke,ie.width,ie.height):t.texImage2D(3553,0,ke,ie.width,ie.height,0,Te,Pe,null));else if(E.isDataTexture)if(Ke.length>0&&ve){qe&&Qe&&t.texStorage2D(3553,de,ke,Ke[0].width,Ke[0].height);for(let be=0,Se=Ke.length;be<Se;be++)ze=Ke[be],qe?t.texSubImage2D(3553,be,0,0,ze.width,ze.height,Te,Pe,ze.data):t.texImage2D(3553,be,ke,ze.width,ze.height,0,Te,Pe,ze.data);E.generateMipmaps=!1}else qe?(Qe&&t.texStorage2D(3553,de,ke,ie.width,ie.height),t.texSubImage2D(3553,0,0,0,ie.width,ie.height,Te,Pe,ie.data)):t.texImage2D(3553,0,ke,ie.width,ie.height,0,Te,Pe,ie.data);else if(E.isCompressedTexture)if(E.isCompressedArrayTexture){qe&&Qe&&t.texStorage3D(35866,de,ke,Ke[0].width,Ke[0].height,ie.depth);for(let be=0,Se=Ke.length;be<Se;be++)ze=Ke[be],E.format!==Ei?Te!==null?qe?t.compressedTexSubImage3D(35866,be,0,0,0,ze.width,ze.height,ie.depth,Te,ze.data,0,0):t.compressedTexImage3D(35866,be,ke,ze.width,ze.height,ie.depth,0,ze.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe?t.texSubImage3D(35866,be,0,0,0,ze.width,ze.height,ie.depth,Te,Pe,ze.data):t.texImage3D(35866,be,ke,ze.width,ze.height,ie.depth,0,Te,Pe,ze.data)}else{qe&&Qe&&t.texStorage2D(3553,de,ke,Ke[0].width,Ke[0].height);for(let be=0,Se=Ke.length;be<Se;be++)ze=Ke[be],E.format!==Ei?Te!==null?qe?t.compressedTexSubImage2D(3553,be,0,0,ze.width,ze.height,Te,ze.data):t.compressedTexImage2D(3553,be,ke,ze.width,ze.height,0,ze.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qe?t.texSubImage2D(3553,be,0,0,ze.width,ze.height,Te,Pe,ze.data):t.texImage2D(3553,be,ke,ze.width,ze.height,0,Te,Pe,ze.data)}else if(E.isDataArrayTexture)qe?(Qe&&t.texStorage3D(35866,de,ke,ie.width,ie.height,ie.depth),t.texSubImage3D(35866,0,0,0,0,ie.width,ie.height,ie.depth,Te,Pe,ie.data)):t.texImage3D(35866,0,ke,ie.width,ie.height,ie.depth,0,Te,Pe,ie.data);else if(E.isData3DTexture)qe?(Qe&&t.texStorage3D(32879,de,ke,ie.width,ie.height,ie.depth),t.texSubImage3D(32879,0,0,0,0,ie.width,ie.height,ie.depth,Te,Pe,ie.data)):t.texImage3D(32879,0,ke,ie.width,ie.height,ie.depth,0,Te,Pe,ie.data);else if(E.isFramebufferTexture){if(Qe)if(qe)t.texStorage2D(3553,de,ke,ie.width,ie.height);else{let be=ie.width,Se=ie.height;for(let De=0;De<de;De++)t.texImage2D(3553,De,ke,be,Se,0,Te,Pe,null),be>>=1,Se>>=1}}else if(Ke.length>0&&ve){qe&&Qe&&t.texStorage2D(3553,de,ke,Ke[0].width,Ke[0].height);for(let be=0,Se=Ke.length;be<Se;be++)ze=Ke[be],qe?t.texSubImage2D(3553,be,0,0,Te,Pe,ze):t.texImage2D(3553,be,ke,Te,Pe,ze);E.generateMipmaps=!1}else qe?(Qe&&t.texStorage2D(3553,de,ke,ie.width,ie.height),t.texSubImage2D(3553,0,0,0,Te,Pe,ie)):t.texImage2D(3553,0,ke,Te,Pe,ie);L(E,ve)&&C(Q),me.__version=ce.version,E.onUpdate&&E.onUpdate(E)}R.__version=E.version}function j(R,E,k){if(E.image.length!==6)return;let Q=S(R,E),K=E.source;t.bindTexture(34067,R.__webglTexture,33984+k);let ce=n.get(K);if(K.version!==ce.__version||Q===!0){t.activeTexture(33984+k),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);let me=E.isCompressedTexture||E.image[0].isCompressedTexture,pe=E.image[0]&&E.image[0].isDataTexture,ie=[];for(let be=0;be<6;be++)!me&&!pe?ie[be]=v(E.image[be],!1,!0,l):ie[be]=pe?E.image[be].image:E.image[be],ie[be]=Le(E,ie[be]);let ve=ie[0],Te=y(ve)||a,Pe=s.convert(E.format,E.encoding),ke=s.convert(E.type),ze=b(E.internalFormat,Pe,ke,E.encoding),Ke=a&&E.isVideoTexture!==!0,qe=ce.__version===void 0||Q===!0,Qe=A(E,ve,Te);T(34067,E,Te);let de;if(me){Ke&&qe&&t.texStorage2D(34067,Qe,ze,ve.width,ve.height);for(let be=0;be<6;be++){de=ie[be].mipmaps;for(let Se=0;Se<de.length;Se++){let De=de[Se];E.format!==Ei?Pe!==null?Ke?t.compressedTexSubImage2D(34069+be,Se,0,0,De.width,De.height,Pe,De.data):t.compressedTexImage2D(34069+be,Se,ze,De.width,De.height,0,De.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ke?t.texSubImage2D(34069+be,Se,0,0,De.width,De.height,Pe,ke,De.data):t.texImage2D(34069+be,Se,ze,De.width,De.height,0,Pe,ke,De.data)}}}else{de=E.mipmaps,Ke&&qe&&(de.length>0&&Qe++,t.texStorage2D(34067,Qe,ze,ie[0].width,ie[0].height));for(let be=0;be<6;be++)if(pe){Ke?t.texSubImage2D(34069+be,0,0,0,ie[be].width,ie[be].height,Pe,ke,ie[be].data):t.texImage2D(34069+be,0,ze,ie[be].width,ie[be].height,0,Pe,ke,ie[be].data);for(let Se=0;Se<de.length;Se++){let Fe=de[Se].image[be].image;Ke?t.texSubImage2D(34069+be,Se+1,0,0,Fe.width,Fe.height,Pe,ke,Fe.data):t.texImage2D(34069+be,Se+1,ze,Fe.width,Fe.height,0,Pe,ke,Fe.data)}}else{Ke?t.texSubImage2D(34069+be,0,0,0,Pe,ke,ie[be]):t.texImage2D(34069+be,0,ze,Pe,ke,ie[be]);for(let Se=0;Se<de.length;Se++){let De=de[Se];Ke?t.texSubImage2D(34069+be,Se+1,0,0,Pe,ke,De.image[be]):t.texImage2D(34069+be,Se+1,ze,Pe,ke,De.image[be])}}}
vendor: 6,857 bytes, line 3141
3141L(E,Te)&&C(34067),ce.__version=K.version,E.onUpdate&&E.onUpdate(E)}R.__version=E.version}function z(R,E,k,Q,K){let ce=s.convert(k.format,k.encoding),me=s.convert(k.type),pe=b(k.internalFormat,ce,me,k.encoding);n.get(E).__hasExternalTextures||(K===32879||K===35866?t.texImage3D(K,0,pe,E.width,E.height,E.depth,0,ce,me,null):t.texImage2D(K,0,pe,E.width,E.height,0,ce,me,null)),t.bindFramebuffer(36160,R),J(E)?f.framebufferTexture2DMultisampleEXT(36160,Q,K,n.get(k).__webglTexture,0,se(E)):(K===3553||K>=34069&&K<=34074)&&r.framebufferTexture2D(36160,Q,K,n.get(k).__webglTexture,0),t.bindFramebuffer(36160,null)}function fe(R,E,k){if(r.bindRenderbuffer(36161,R),E.depthBuffer&&!E.stencilBuffer){let Q=33189;if(k||J(E)){let K=E.depthTexture;K&&K.isDepthTexture&&(K.type===ps?Q=36012:K.type===Qs&&(Q=33190));let ce=se(E);J(E)?f.renderbufferStorageMultisampleEXT(36161,ce,Q,E.width,E.height):r.renderbufferStorageMultisample(36161,ce,Q,E.width,E.height)}else r.renderbufferStorage(36161,Q,E.width,E.height);r.framebufferRenderbuffer(36160,36096,36161,R)}else if(E.depthBuffer&&E.stencilBuffer){let Q=se(E);k&&J(E)===!1?r.renderbufferStorageMultisample(36161,Q,35056,E.width,E.height):J(E)?f.renderbufferStorageMultisampleEXT(36161,Q,35056,E.width,E.height):r.renderbufferStorage(36161,34041,E.width,E.height),r.framebufferRenderbuffer(36160,33306,36161,R)}else{let Q=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let K=0;K<Q.length;K++){let ce=Q[K],me=s.convert(ce.format,ce.encoding),pe=s.convert(ce.type),ie=b(ce.internalFormat,me,pe,ce.encoding),ve=se(E);k&&J(E)===!1?r.renderbufferStorageMultisample(36161,ve,ie,E.width,E.height):J(E)?f.renderbufferStorageMultisampleEXT(36161,ve,ie,E.width,E.height):r.renderbufferStorage(36161,ie,E.width,E.height)}}r.bindRenderbuffer(36161,null)}function q(R,E){if(E&&E.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,R),!(E.depthTexture&&E.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(E.depthTexture).__webglTexture||E.depthTexture.image.width!==E.width||E.depthTexture.image.height!==E.height)&&(E.depthTexture.image.width=E.width,E.depthTexture.image.height=E.height,E.depthTexture.needsUpdate=!0),ue(E.depthTexture,0);let Q=n.get(E.depthTexture).__webglTexture,K=se(E);if(E.depthTexture.format===eo)J(E)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,Q,0,K):r.framebufferTexture2D(36160,36096,3553,Q,0);else if(E.depthTexture.format===ma)J(E)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,Q,0,K):r.framebufferTexture2D(36160,33306,3553,Q,0);else throw new Error("Unknown depthTexture format")}function re(R){let E=n.get(R),k=R.isWebGLCubeRenderTarget===!0;if(R.depthTexture&&!E.__autoAllocateDepthBuffer){if(k)throw new Error("target.depthTexture not supported in Cube render targets");q(E.__webglFramebuffer,R)}else if(k){E.__webglDepthbuffer=[];for(let Q=0;Q<6;Q++)t.bindFramebuffer(36160,E.__webglFramebuffer[Q]),E.__webglDepthbuffer[Q]=r.createRenderbuffer(),fe(E.__webglDepthbuffer[Q],R,!1)}else t.bindFramebuffer(36160,E.__webglFramebuffer),E.__webglDepthbuffer=r.createRenderbuffer(),fe(E.__webglDepthbuffer,R,!1);t.bindFramebuffer(36160,null)}function te(R,E,k){let Q=n.get(R);E!==void 0&&z(Q.__webglFramebuffer,R,R.texture,36064,3553),k!==void 0&&re(R)}function ge(R){let E=R.texture,k=n.get(R),Q=n.get(E);R.addEventListener("dispose",F),R.isWebGLMultipleRenderTargets!==!0&&(Q.__webglTexture===void 0&&(Q.__webglTexture=r.createTexture()),Q.__version=E.version,o.memory.textures++);let K=R.isWebGLCubeRenderTarget===!0,ce=R.isWebGLMultipleRenderTargets===!0,me=y(R)||a;if(K){k.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)k.__webglFramebuffer[pe]=r.createFramebuffer()}else{if(k.__webglFramebuffer=r.createFramebuffer(),ce)if(i.drawBuffers){let pe=R.texture;for(let ie=0,ve=pe.length;ie<ve;ie++){let Te=n.get(pe[ie]);Te.__webglTexture===void 0&&(Te.__webglTexture=r.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&R.samples>0&&J(R)===!1){let pe=ce?E:[E];k.__webglMultisampledFramebuffer=r.createFramebuffer(),k.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,k.__webglMultisampledFramebuffer);for(let ie=0;ie<pe.length;ie++){let ve=pe[ie];k.__webglColorRenderbuffer[ie]=r.createRenderbuffer(),r.bindRenderbuffer(36161,k.__webglColorRenderbuffer[ie]);let Te=s.convert(ve.format,ve.encoding),Pe=s.convert(ve.type),ke=b(ve.internalFormat,Te,Pe,ve.encoding,R.isXRRenderTarget===!0),ze=se(R);r.renderbufferStorageMultisample(36161,ze,ke,R.width,R.height),r.framebufferRenderbuffer(36160,36064+ie,36161,k.__webglColorRenderbuffer[ie])}r.bindRenderbuffer(36161,null),R.depthBuffer&&(k.__webglDepthRenderbuffer=r.createRenderbuffer(),fe(k.__webglDepthRenderbuffer,R,!0)),t.bindFramebuffer(36160,null)}}if(K){t.bindTexture(34067,Q.__webglTexture),T(34067,E,me);for(let pe=0;pe<6;pe++)z(k.__webglFramebuffer[pe],R,E,36064,34069+pe);L(E,me)&&C(34067),t.unbindTexture()}else if(ce){let pe=R.texture;for(let ie=0,ve=pe.length;ie<ve;ie++){let Te=pe[ie],Pe=n.get(Te);t.bindTexture(3553,Pe.__webglTexture),T(3553,Te,me),z(k.__webglFramebuffer,R,Te,36064+ie,3553),L(Te,me)&&C(3553)}t.unbindTexture()}else{let pe=3553;(R.isWebGL3DRenderTarget||R.isWebGLArrayRenderTarget)&&(a?pe=R.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(pe,Q.__webglTexture),T(pe,E,me),z(k.__webglFramebuffer,R,E,36064,pe),L(E,me)&&C(pe),t.unbindTexture()}R.depthBuffer&&re(R)}function xe(R){let E=y(R)||a,k=R.isWebGLMultipleRenderTargets===!0?R.texture:[R.texture];for(let Q=0,K=k.length;Q<K;Q++){let ce=k[Q];if(L(ce,E)){let me=R.isWebGLCubeRenderTarget?34067:3553,pe=n.get(ce).__webglTexture;t.bindTexture(me,pe),C(me),t.unbindTexture()}}}function we(R){if(a&&R.samples>0&&J(R)===!1){let E=R.isWebGLMultipleRenderTargets?R.texture:[R.texture],k=R.width,Q=R.height,K=16384,ce=[],me=R.stencilBuffer?33306:36096,pe=n.get(R),ie=R.isWebGLMultipleRenderTargets===!0;if(ie)for(let ve=0;ve<E.length;ve++)t.bindFramebuffer(36160,pe.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064+ve,36161,null),t.bindFramebuffer(36160,pe.__webglFramebuffer),r.framebufferTexture2D(36009,36064+ve,3553,null,0);t.bindFramebuffer(36008,pe.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,pe.__webglFramebuffer);for(let ve=0;ve<E.length;ve++){ce.push(36064+ve),R.depthBuffer&&ce.push(me);let Te=pe.__ignoreDepthValues!==void 0?pe.__ignoreDepthValues:!1;if(Te===!1&&(R.depthBuffer&&(K|=256),R.stencilBuffer&&(K|=1024)),ie&&r.framebufferRenderbuffer(36008,36064,36161,pe.__webglColorRenderbuffer[ve]),Te===!0&&(r.invali
3141dateFramebuffer(36008,[me]),r.invalidateFramebuffer(36009,[me])),ie){let Pe=n.get(E[ve]).__webglTexture;r.framebufferTexture2D(36009,36064,3553,Pe,0)}r.blitFramebuffer(0,0,k,Q,0,0,k,Q,K,9728),p&&r.invalidateFramebuffer(36008,ce)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),ie)for(let ve=0;ve<E.length;ve++){t.bindFramebuffer(36160,pe.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064+ve,36161,pe.__webglColorRenderbuffer[ve]);let Te=n.get(E[ve]).__webglTexture;t.bindFramebuffer(36160,pe.__webglFramebuffer),r.framebufferTexture2D(36009,36064+ve,3553,Te,0)}t.bindFramebuffer(36009,pe.__webglMultisampledFramebuffer)}}function se(R){return Math.min(h,R.samples)}function J(R){let E=n.get(R);return a&&R.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function Ae(R){let E=o.render.frame;g.get(R)!==E&&(g.set(R,E),R.update())}function Le(R,E){let k=R.encoding,Q=R.format,K=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||R.format===Hf||k!==io&&(k===It?a===!1?e.has("EXT_sRGB")===!0&&Q===Ei?(R.format=Hf,R.minFilter=dn,R.generateMipmaps=!1):E=ro.sRGBToLinear(E):(Q!==Ei||K!==no)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",k)),E}this.allocateTextureUnit=W,this.resetTextureUnits=Z,this.setTexture2D=ue,this.setTexture2DArray=ne,this.setTexture3D=le,this.setTextureCube=he,this.rebindTextures=te,this.setupRenderTarget=ge,this.updateRenderTargetMipmap=xe,this.updateMultisampleRenderTarget=we,this.setupDepthRenderbuffer=re,this.setupFrameBufferTexture=z,this.useMultisampledRTT=J}function XM(r,e,t){let n=t.isWebGL2;function i(s,o=null){let a;if(s===no)return 5121;if(s===Fy)return 32819;if(s===Uy)return 32820;if(s===Oy)return 5120;if(s===Dy)return 5122;if(s===n0)return 5123;if(s===ky)return 5124;if(s===Qs)return 5125;if(s===ps)return 5126;if(s===Hl)return n?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===By)return 6406;if(s===Ei)return 6408;if(s===zy)return 6409;if(s===Vy)return 6410;if(s===eo)return 6402;if(s===ma)return 34041;if(s===Gy)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===Hf)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Hy)return 6403;if(s===Wy)return 36244;if(s===jy)return 33319;if(s===qy)return 33320;if(s===Xy)return 36249;if(s===nf||s===rf||s===sf||s===of)if(o===It)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===nf)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===rf)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===sf)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===of)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===nf)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===rf)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===sf)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===of)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Em||s===Am||s===Cm||s===Im)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Em)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Am)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Cm)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Im)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Yy)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Rm||s===Pm)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Rm)return o===It?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Pm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Lm||s===Nm||s===Om||s===Dm||s===km||s===Fm||s===Um||s===Bm||s===Gm||s===zm||s===Vm||s===Hm||s===Wm||s===jm)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Lm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Nm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Om)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Dm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===km)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Fm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Um)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Bm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Gm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===zm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Vm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Hm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Wm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===jm)return o===It?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===qm)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===qm)return o===It?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===ca?n?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}var nd=class extends Zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},bn=class extends xt{constructor(){super(),this.isGroup=!0,this.type="Group"}},YM={type:"move"},Bl=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bn,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 bn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ae,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ae),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ae,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ae),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 n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),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,n){let i=null,s=null,o=null,a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(let m of e.hand.values()){let d=t.getJointPose(m,n),x=this._getHandJoint(l,m);d!==null&&(x.matrix.fromArray(d.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.jointRadius=d.radius),x.visible=d!==null}let u=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],f=u.position.distanceTo(h.position),p=.02,g=.005;l.inputState.pinching&&f>p+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=p-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(YM))
3141)}return a!==null&&(a.visible=i!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new bn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},id=class extends pn{constructor(e,t,n,i,s,o,a,c,l,u){if(u=u!==void 0?u:eo,u!==eo&&u!==ma)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===eo&&(n=Qs),n===void 0&&u===ma&&(n=ca),super(null,i,s,o,a,c,u,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:_n,this.minFilter=c!==void 0?c:_n,this.flipY=!1,this.generateMipmaps=!1}},rd=class extends xs{constructor(e,t){super();let n=this,i=null,s=1,o=null,a="local-floor",c=null,l=null,u=null,h=null,f=null,p=null,g=t.getContextAttributes(),m=null,d=null,x=[],_=[],v=new Set,y=new Map,w=new Zt;w.layers.enable(1),w.viewport=new St;let L=new Zt;L.layers.enable(2),L.viewport=new St;let C=[w,L],b=new nd;b.layers.enable(1),b.layers.enable(2);let A=null,N=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let le=x[ne];return le===void 0&&(le=new Bl,x[ne]=le),le.getTargetRaySpace()},this.getControllerGrip=function(ne){let le=x[ne];return le===void 0&&(le=new Bl,x[ne]=le),le.getGripSpace()},this.getHand=function(ne){let le=x[ne];return le===void 0&&(le=new Bl,x[ne]=le),le.getHandSpace()};function G(ne){let le=_.indexOf(ne.inputSource);if(le===-1)return;let he=x[le];he!==void 0&&he.dispatchEvent({type:ne.type,data:ne.inputSource})}function F(){i.removeEventListener("select",G),i.removeEventListener("selectstart",G),i.removeEventListener("selectend",G),i.removeEventListener("squeeze",G),i.removeEventListener("squeezestart",G),i.removeEventListener("squeezeend",G),i.removeEventListener("end",F),i.removeEventListener("inputsourceschange",U);for(let ne=0;ne<x.length;ne++){let le=_[ne];le!==null&&(_[ne]=null,x[ne].disconnect(le))}A=null,N=null,e.setRenderTarget(m),f=null,h=null,u=null,i=null,d=null,ue.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){s=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){a=ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(ne){c=ne},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(ne){if(i=ne,i!==null){if(m=e.getRenderTarget(),i.addEventListener("select",G),i.addEventListener("selectstart",G),i.addEventListener("selectend",G),i.addEventListener("squeeze",G),i.addEventListener("squeezestart",G),i.addEventListener("squeezeend",G),i.addEventListener("end",F),i.addEventListener("inputsourceschange",U),g.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let le={antialias:i.renderState.layers===void 0?g.antialias:!0,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,le),i.updateRenderState({baseLayer:f}),d=new zr(f.framebufferWidth,f.framebufferHeight,{format:Ei,type:no,encoding:e.outputEncoding,stencilBuffer:g.stencil})}else{let le=null,he=null,I=null;g.depth&&(I=g.stencil?35056:33190,le=g.stencil?ma:eo,he=g.stencil?ca:Qs);let M={colorFormat:32856,depthFormat:I,scaleFactor:s};u=new XRWebGLBinding(i,t),h=u.createProjectionLayer(M),i.updateRenderState({layers:[h]}),d=new zr(h.textureWidth,h.textureHeight,{format:Ei,type:no,depthTexture:new id(h.textureWidth,h.textureHeight,he,void 0,void 0,void 0,void 0,void 0,void 0,le),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:g.antialias?4:0});let T=e.properties.get(d);T.__ignoreDepthValues=h.ignoreDepthValues}d.isXRRenderTarget=!0,this.setFoveation(1),c=null,o=await i.requestReferenceSpace(a),ue.setContext(i),ue.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function U(ne){for(let le=0;le<ne.removed.length;le++){let he=ne.removed[le],I=_.indexOf(he);I>=0&&(_[I]=null,x[I].disconnect(he))}for(let le=0;le<ne.added.length;le++){let he=ne.added[le],I=_.indexOf(he);if(I===-1){for(let T=0;T<x.length;T++)if(T>=_.length){_.push(he),I=T;break}else if(_[T]===null){_[T]=he,I=T;break}if(I===-1)break}let M=x[I];M&&M.connect(he)}}let P=new ae,$=new ae;function H(ne,le,he){P.setFromMatrixPosition(le.matrixWorld),$.setFromMatrixPosition(he.matrixWorld);let I=P.distanceTo($),M=le.projectionMatrix.elements,T=he.projectionMatrix.elements,S=M[14]/(M[10]-1),B=M[14]/(M[10]+1),j=(M[9]+1)/M[5],z=(M[9]-1)/M[5],fe=(M[8]-1)/M[0],q=(T[8]+1)/T[0],re=S*fe,te=S*q,ge=I/(-fe+q),xe=ge*-fe;le.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(xe),ne.translateZ(ge),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert();let we=S+ge,se=B+ge,J=re-xe,Ae=te+(I-xe),Le=j*B/se*we,R=z*B/se*we;ne.projectionMatrix.makePerspective(J,Ae,Le,R,we,se)}function Z(ne,le){le===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(le.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;b.near=L.near=w.near=ne.near,b.far=L.far=w.far=ne.far,(A!==b.near||N!==b.far)&&(i.updateRenderState({depthNear:b.near,depthFar:b.far}),A=b.near,N=b.far);let le=ne.parent,he=b.cameras;Z(b,le);for(let M=0;M<he.length;M++)Z(he[M],le);b.matrixWorld.decompose(b.position,b.quaternion,b.scale),ne.matrix.copy(b.matrix),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale);let I=ne.children;for(let M=0,T=I.length;M<T;M++)I[M].updateMatrixWorld(!0);he.length===2?H(b,w,L):b.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return b},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(ne){h!==null&&(h.fixedFoveation=ne),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=ne)},this.getPlanes=function(){return v};let W=null;function oe(ne,le){if(l=le.getViewerPose(c||o),p=le,l!==null){let he=l.views;f!==null&&(e.setRenderTargetFramebuffer(d,f.framebuffer),e.setRenderTarget(d));let I=!1;he.length!==b.cameras.length&&(b.cameras.length=0,I=!0);for(let M=0;M<he.length;M++){let T=he[M],S=null;if(f!==null)S=f.getViewport(T);else{let j=u.getViewSubImage(h,T);S=j.viewport,M===0&&(e.setRenderTargetTextures(d,j.colorTexture,h.ignoreDepthValues?void 0:j.depthStencilTexture),e.setRenderTarget(d))}let B=C[M];B===void 0&&(B=new Zt,B.layers.enable(M),B.viewport=new St,C[M]=B),B.matrix.fromArray(T.transform.matrix),B.projectionMatrix.fromArray(T.projectionMatrix),B.viewport.set(S.x,S.y,S.width,S.height),M===0&&b.matrix.copy(B.matrix),I===!0&&b.cameras.push(B)}}for(let he=0;he<x.length;he++){let I=_[he],M=x[he];I!==null&&M!==void 0&&M.update(I,le,c||o)}if(W&&W(ne,le),le.detectedPlanes){n.dispatchEvent({type:"planesdetected",data:le.detectedPlanes});let he=null;for(let I of v)le.detectedPlanes.has(I)||(he===null&&(he=[]),he.push(I));if(he!==null)for(let I of he)v.delete(I),y.delete(I),n.dispatchEvent({type:"planeremoved",data:I});for(let I of le.detectedPlanes)if(!v.has(I))v.add(I),y.set(I,le.lastChangedTime),n.dispatchEvent({type:"planeadded",data:I});else{let M=y.get(I);I.lastChangedTime>M&&(y.set(I,I.lastChangedTime),n.dispatchEvent({type:"planechanged",data:I}))}}p=null}let ue=new a0;ue.setAnimationLoop(oe),this.setAnimationLoop=function(ne){W=ne},this.dispose=function(){}}};function ZM(r,e){function t(m,d){d.color.getRGB(m.fogColor.value,o0(r)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function n(m,d,x,_,v){d.isMeshBasicMaterial||d.isMeshLambertMaterial?i(m,d):d.isMeshToonMaterial?(i(m,d),u(m,d)):d.isMeshPhongMaterial?(i(m,d),l(m,d)):d.isMeshStandardMaterial?(i(m,d),h(m,d),d.isMeshPhysicalMaterial&&f(m,d,v)):d.isMeshMat
vendor: 4,661 bytes, line 3141
3141capMaterial?(i(m,d),p(m,d)):d.isMeshDepthMaterial?i(m,d):d.isMeshDistanceMaterial?(i(m,d),g(m,d)):d.isMeshNormalMaterial?i(m,d):d.isLineBasicMaterial?(s(m,d),d.isLineDashedMaterial&&o(m,d)):d.isPointsMaterial?a(m,d,x,_):d.isSpriteMaterial?c(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function i(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.bumpMap&&(m.bumpMap.value=d.bumpMap,m.bumpScale.value=d.bumpScale,d.side===Pn&&(m.bumpScale.value*=-1)),d.displacementMap&&(m.displacementMap.value=d.displacementMap,m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap),d.normalMap&&(m.normalMap.value=d.normalMap,m.normalScale.value.copy(d.normalScale),d.side===Pn&&m.normalScale.value.negate()),d.specularMap&&(m.specularMap.value=d.specularMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);let x=e.get(d).envMap;if(x&&(m.envMap.value=x,m.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap){m.lightMap.value=d.lightMap;let y=r.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=d.lightMapIntensity*y}d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity);let _;d.map?_=d.map:d.specularMap?_=d.specularMap:d.displacementMap?_=d.displacementMap:d.normalMap?_=d.normalMap:d.bumpMap?_=d.bumpMap:d.roughnessMap?_=d.roughnessMap:d.metalnessMap?_=d.metalnessMap:d.alphaMap?_=d.alphaMap:d.emissiveMap?_=d.emissiveMap:d.clearcoatMap?_=d.clearcoatMap:d.clearcoatNormalMap?_=d.clearcoatNormalMap:d.clearcoatRoughnessMap?_=d.clearcoatRoughnessMap:d.iridescenceMap?_=d.iridescenceMap:d.iridescenceThicknessMap?_=d.iridescenceThicknessMap:d.specularIntensityMap?_=d.specularIntensityMap:d.specularColorMap?_=d.specularColorMap:d.transmissionMap?_=d.transmissionMap:d.thicknessMap?_=d.thicknessMap:d.sheenColorMap?_=d.sheenColorMap:d.sheenRoughnessMap&&(_=d.sheenRoughnessMap),_!==void 0&&(_.isWebGLRenderTarget&&(_=_.texture),_.matrixAutoUpdate===!0&&_.updateMatrix(),m.uvTransform.value.copy(_.matrix));let v;d.aoMap?v=d.aoMap:d.lightMap&&(v=d.lightMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uv2Transform.value.copy(v.matrix))}function s(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity}function o(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function a(m,d,x,_){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*x,m.scale.value=_*.5,d.map&&(m.map.value=d.map),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);let v;d.map?v=d.map:d.alphaMap&&(v=d.alphaMap),v!==void 0&&(v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uvTransform.value.copy(v.matrix))}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);let x;d.map?x=d.map:d.alphaMap&&(x=d.alphaMap),x!==void 0&&(x.matrixAutoUpdate===!0&&x.updateMatrix(),m.uvTransform.value.copy(x.matrix))}function l(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function u(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function h(m,d){m.roughness.value=d.roughness,m.metalness.value=d.metalness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap),d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap),e.get(d).envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function f(m,d,x){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap)),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap),d.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),m.clearcoatNormalMap.value=d.clearcoatNormalMap,d.side===Pn&&m.clearcoatNormalScale.value.negate())),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.
3141iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap)),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=x.texture,m.transmissionSamplerSize.value.set(x.width,x.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap)}function p(m,d){d.matcap&&(m.matcap.value=d.matcap)}function g(m,d){m.referencePosition.value.copy(d.referencePosition),m.nearDistance.value=d.nearDistance,m.farDistance.value=d.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function KM(r,e,t,n){let i={},s={},o=[],a=t.isWebGL2?r.getParameter(35375):0;function c(_,v){let y=v.program;n.uniformBlockBinding(_,y)}function l(_,v){let y=i[_.id];y===void 0&&(g(_),y=u(_),i[_.id]=y,_.addEventListener("dispose",d));let w=v.program;n.updateUBOMapping(_,w);let L=e.render.frame;s[_.id]!==L&&(f(_),s[_.id]=L)}function u(_){let v=h();_.__bindingPointIndex=v;let y=r.createBuffer(),w=_.__size,L=_.usage;return r.bindBuffer(35345,y),r.bufferData(35345,w,L),r.bindBuffer(35345,null),r.bindBufferBase(35345,v,y),y}function h(){for(let _=0;_<a;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(_){let v=i[_.id],y=_.uniforms,w=_.__cache;r.bindBuffer(35345,v);for(let L=0,C=y.length;L<C;L++){let b=y[L];if(p(b,L,w)===!0){let A=b.value,N=b.__offset;typeof A=="number"?(b.__data[0]=A,r.bufferSubData(35345,N,b.__data)):(b.value.isMatrix3?(b.__data[0]=b.value.elements[0],b.__data[1]=b.value.elements[1],b.__data[2]=b.value.elements[2],b.__data[3]=b.value.elements[0],b.__data[4]=b.value.elements[3],b.__data[5]=b.value.elements[4],b.__data[6]=b.value.elements[5],b.__data[7]=b.value.elements[0],b.__data[8]=b.value.elements[6],b.__data[9]=b.value.elements[7],b.__data[10]=b.value.elements[8],b.__data[11]=b.value.elements[0]):A.toArray(b.__data),r.bufferSubData(35345,N,b.__data))}}r.bindBuffer(35345,null)}function p(_,v,y){let w=_.value;if(y[v]===void 0)return typeof w=="number"?y[v]=w:y[v]=w.clone(),!0;if(typeof w=="number"){if(y[v]!==w)return y[v]=w,!0}else{let L=y[v];if(L.equals(w)===!1)return L.copy(w),!0}return!1}function g(_){let v=_.uniforms,y=0,w=16,L=0;for(let C=0,b=v.length;C<b;C++){let A=v[C],N=m(A);if(A.__data=new Float32Array(N.storage/Float32Array.BYTES_PER_ELEMENT),A.__offset=y,C>0){L=y%w;let G=w-L;L!==0&&G-N.boundary<0&&(y+=w-L,A.__offset=y)}y+=N.storage}return L=y%w,L>0&&(y+=w-L),_.__size=y,_.__cache={},this}function m(_){let v=_.value,y={boundary:0,storage:0};return typeof v=="number"?(y.boundary=4,y.storage=4):v.isVector2?(y.boundary=8,y.storage=8):v.isVector3||v.isColor?(y.boundary=16,y.storage=12):v.isVector4?(y.boundary=16,y.storage=16):v.isMatrix3?(y.boundary=48,y.storage=48):v.isMatrix4?(y.boundary=64,y.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),y}function d(_){let v=_.target;v.removeEventListener("dispose",d);let y=o.indexOf(v.__bindingPointIndex);o.splice(y,1),r.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function x(){for(let _ in i)r.deleteBuffer(i[_]);o=[],i={},s={}}return{bind:c,update:l,dispose:x}}function JM(){let r=ql("canvas");return r.style.display="block",r}function rc(r={}){this.isWebGLRenderer=!0;let e=r.canvas!==void 0?r.canvas:JM(),t=r.context!==void 0?r.context:null,n=r.depth!==void 0?r.depth:!0,i=r.stencil!==void 0?r.stencil:!0,s=r.antialias!==void 0?r.antialias:!1,o=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,a=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,c=r.powerPreference!==void 0?r.powerPreference:"default",l=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1,u;t!==null?u=t.getContextAttributes().alpha:u=r.alpha!==void 0?r.alpha:!1;let h=null,f=null,p=[],g=[];
3141this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=io,this.physicallyCorrectLights=!1,this.toneMapping=Gr,this.toneMappingExposure=1;let m=this,d=!1,x=0,_=0,v=null,y=-1,w=null,L=new St,C=new St,b=null,A=e.width,N=e.height,G=1,F=null,U=null,P=new St(0,0,A,N),$=new St(0,0,A,N),H=!1,Z=new Zl,W=!1,oe=!1,ue=null,ne=new Xe,le=new Ee,he=new ae,I={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function M(){return v===null?G:1}let T=t;function S(ee,_e){for(let Ce=0;Ce<ee.length;Ce++){let ye=ee[Ce],Re=e.getContext(ye,_e);if(Re!==null)return Re}return null}try{let ee={alpha:!0,depth:n,stencil:i,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:c,failIfMajorPerformanceCaveat:l};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Sd}`),e.addEventListener("webglcontextlost",ke,!1),e.addEventListener("webglcontextrestored",ze,!1),e.addEventListener("webglcontextcreationerror",Ke,!1),T===null){let _e=["webgl2","webgl","experimental-webgl"];if(m.isWebGL1Renderer===!0&&_e.shift(),T=S(_e,ee),T===null)throw S(_e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}T.getShaderPrecisionFormat===void 0&&(T.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(ee){throw console.error("THREE.WebGLRenderer: "+ee.message),ee}let B,j,z,fe,q,re,te,ge,xe,we,se,J,Ae,Le,R,E,k,Q,K,ce,me,pe,ie,ve;function Te(){B=new yT(T),j=new fT(T,B,r),B.init(j),pe=new XM(T,B,j),z=new jM(T,B,j),fe=new bT,q=new NM,re=new qM(T,B,z,q,j,pe,fe),te=new pT(m),ge=new xT(m),xe=new Rv(T,j),ie=new uT(T,B,xe,j),we=new vT(T,xe,fe,ie),se=new ST(T,we,xe,fe),K=new wT(T,j,re),E=new dT(q),J=new LM(m,te,ge,B,j,ie,E),Ae=new ZM(m,q),Le=new DM,R=new zM(B,j),Q=new cT(m,te,ge,z,se,u,o),k=new WM(m,se,j),ve=new KM(T,fe,j,z),ce=new hT(T,B,fe,j),me=new _T(T,B,fe,j),fe.programs=J.programs,m.capabilities=j,m.extensions=B,m.properties=q,m.renderLists=Le,m.shadowMap=k,m.state=z,m.info=fe}Te();let Pe=new rd(m,T);this.xr=Pe,this.getContext=function(){return T},this.getContextAttributes=function(){return T.getContextAttributes()},this.forceContextLoss=function(){let ee=B.get("WEBGL_lose_context");ee&&ee.loseContext()},this.forceContextRestore=function(){let ee=B.get("WEBGL_lose_context");ee&&ee.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(ee){ee!==void 0&&(G=ee,this.setSize(A,N,!1))},this.getSize=function(ee){return ee.set(A,N)},this.setSize=function(ee,_e,Ce){if(Pe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}A=ee,N=_e,e.width=Math.floor(ee*G),e.height=Math.floor(_e*G),Ce!==!1&&(e.style.width=ee+"px",e.style.height=_e+"px"),this.setViewport(0,0,ee,_e)},this.getDrawingBufferSize=function(ee){return ee.set(A*G,N*G).floor()},this.setDrawingBufferSize=function(ee,_e,Ce){A=ee,N=_e,G=Ce,e.width=Math.floor(ee*Ce),e.height=Math.floor(_e*Ce),this.setViewport(0,0,ee,_e)},this.getCurrentViewport=function(ee){return ee.copy(L)},this.getViewport=function(ee){return ee.copy(P)},this.setViewport=function(ee,_e,Ce,ye){ee.isVector4?P.set(ee.x,ee.y,ee.z,ee.w):P.set(ee,_e,Ce,ye),z.viewport(L.copy(P).multiplyScalar(G).floor())},this.getScissor=function(ee){return ee.copy($)},this.setScissor=function(ee,_e,Ce,ye){ee.isVector4?$.set(ee.x,ee.y,ee.z,ee.w):$.set(ee,_e,Ce,ye),z.scissor(C.copy($).multiplyScalar(G).floor())},this.getScissorTest=function(){return H},this.setScissorTest=function(ee){z.setScissorTest(H=ee)},this.setOpaqueSort=function(ee){F=ee},this.setTransparentSort=function(ee){U=ee},this.getClearColor=function(ee){return ee.copy(Q.getClearColor())},this.setClearColor=function(){Q.setClearColor.apply(Q,arguments)},this.getClearAlpha=function(){return Q.getClearAlpha()},this.setClearAlpha=function(){Q.setClearAlpha.apply(Q,arguments)},this.clear=function(ee=!0,_e=!0,Ce=!0){let ye=0;ee&&(ye|=16384),_e&&(ye|=256),Ce&&(ye|=1024),T.clear(ye)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",ke,!1),e.removeEventListener("webglcontextrestored",ze,!1),e.removeEventListener("webglcontextcreationerror",Ke,!1),Le.dispose(),R.dispose(),q.dispose(),te.dispose(),ge.dispose(),se.dispose(),ie.dispose(),ve.dispose(),J.dispose(),Pe.dispose(),Pe.removeEventListener("sessionstart",De),Pe.removeEventListener("sessionend",Fe),ue&&(ue.dispose(),ue=null),at.stop()};function ke(ee){ee.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),d=!0}function ze(){console.log("THREE.WebGLRenderer: Context Restored."),d=!1;let ee=fe.autoReset,_e=k.enabled,Ce=k.autoUpdate,ye=k.needsUpdate,Re=k.type;Te(),fe.autoReset=ee,k.enabled=_e,k.autoUpdate=Ce,k.needsUpdate=ye,k.type=Re}function Ke(ee){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",ee.statusMessage)}function qe(ee){let _e=ee.target;_e.removeEventListener("dispose",qe),Qe(_e)}function Qe(ee){de(ee),q.remove(ee)}function de(ee){let _e=q.get(ee).programs;_e!==void 0&&(_e.forEach(function(Ce){J.releaseProgram(Ce)}),ee.isShaderMaterial&&J.releaseShaderCache(ee))}this.renderBufferDirect=function(ee,_e,Ce,ye,Re,st){_e===null&&(_e=I);let ut=Re.isMesh&&Re.matrixWorld.determinant()<0,pt=Vt(ee,_e,Ce,ye,Re);z.setMaterial(ye,ut);let mt=Ce.index,Ct=1;ye.wireframe===!0&&(mt=we.getWireframeAttribute(Ce),Ct=2);let Tt=Ce.drawRange,Mt=Ce.attributes.position,on=Tt.start*Ct,jn=(Tt.start+Tt.count)*Ct;
3141st!==null&&(on=Math.max(on,st.start*Ct),jn=Math.min(jn,(st.start+st.count)*Ct)),mt!==null?(on=Math.max(on,0),jn=Math.min(jn,mt.count)):Mt!=null&&(on=Math.max(on,0),jn=Math.min(jn,Mt.count));let en=jn-on;if(en<0||en===1/0)return;ie.setup(Re,ye,pt,Ce,mt);let Qn,Kt=ce;if(mt!==null&&(Qn=xe.get(mt),Kt=me,Kt.setIndex(Qn)),Re.isMesh)ye.wireframe===!0?(z.setLineWidth(ye.wireframeLinewidth*M()),Kt.setMode(1)):Kt.setMode(4);else if(Re.isLine){let _t=ye.linewidth;_t===void 0&&(_t=1),z.setLineWidth(_t*M()),Re.isLineSegments?Kt.setMode(1):Re.isLineLoop?Kt.setMode(2):Kt.setMode(3)}else Re.isPoints?Kt.setMode(0):Re.isSprite&&Kt.setMode(4);if(Re.isInstancedMesh)Kt.renderInstances(on,en,Re.count);else if(Ce.isInstancedBufferGeometry){let _t=Ce._maxInstanceCount!==void 0?Ce._maxInstanceCount:1/0,pl=Math.min(Ce.instanceCount,_t);Kt.renderInstances(on,en,pl)}else Kt.render(on,en)},this.compile=function(ee,_e){function Ce(ye,Re,st){ye.transparent===!0&&ye.side===kn?(ye.side=Pn,ye.needsUpdate=!0,We(ye,Re,st),ye.side=pr,ye.needsUpdate=!0,We(ye,Re,st),ye.side=kn):We(ye,Re,st)}f=R.get(ee),f.init(),g.push(f),ee.traverseVisible(function(ye){ye.isLight&&ye.layers.test(_e.layers)&&(f.pushLight(ye),ye.castShadow&&f.pushShadow(ye))}),f.setupLights(m.physicallyCorrectLights),ee.traverse(function(ye){let Re=ye.material;if(Re)if(Array.isArray(Re))for(let st=0;st<Re.length;st++){let ut=Re[st];Ce(ut,ee,ye)}else Ce(Re,ee,ye)}),g.pop(),f=null};let be=null;function Se(ee){be&&be(ee)}function De(){at.stop()}function Fe(){at.start()}let at=new a0;at.setAnimationLoop(Se),typeof self<"u"&&at.setContext(self),this.setAnimationLoop=function(ee){be=ee,Pe.setAnimationLoop(ee),ee===null?at.stop():at.start()},Pe.addEventListener("sessionstart",De),Pe.addEventListener("sessionend",Fe),this.render=function(ee,_e){if(_e!==void 0&&_e.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(d===!0)return;ee.matrixWorldAutoUpdate===!0&&ee.updateMatrixWorld(),_e.parent===null&&_e.matrixWorldAutoUpdate===!0&&_e.updateMatrixWorld(),Pe.enabled===!0&&Pe.isPresenting===!0&&(Pe.cameraAutoUpdate===!0&&Pe.updateCamera(_e),_e=Pe.getCamera()),ee.isScene===!0&&ee.onBeforeRender(m,ee,_e,v),f=R.get(ee,g.length),f.init(),g.push(f),ne.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),Z.setFromProjectionMatrix(ne),oe=this.localClippingEnabled,W=E.init(this.clippingPlanes,oe,_e),h=Le.get(ee,p.length),h.init(),p.push(h),vt(ee,_e,0,m.sortObjects),h.finish(),m.sortObjects===!0&&h.sort(F,U),W===!0&&E.beginShadows();let Ce=f.state.shadowsArray;if(k.render(Ce,ee,_e),W===!0&&E.endShadows(),this.info.autoReset===!0&&this.info.reset(),Q.render(h,ee),f.setupLights(m.physicallyCorrectLights),_e.isArrayCamera){let ye=_e.cameras;for(let Re=0,st=ye.length;Re<st;Re++){let ut=ye[Re];rt(h,ee,ut,ut.viewport)}}else rt(h,ee,_e);v!==null&&(re.updateMultisampleRenderTarget(v),re.updateRenderTargetMipmap(v)),ee.isScene===!0&&ee.onAfterRender(m,ee,_e),ie.resetDefaultState(),y=-1,w=null,g.pop(),g.length>0?f=g[g.length-1]:f=null,p.pop(),p.length>0?h=p[p.length-1]:h=null};function vt(ee,_e,Ce,ye){if(ee.visible===!1)return;if(ee.layers.test(_e.layers)){if(ee.isGroup)Ce=ee.renderOrder;else if(ee.isLOD)ee.autoUpdate===!0&&ee.update(_e);else if(ee.isLight)f.pushLight(ee),ee.castShadow&&f.pushShadow(ee);else if(ee.isSprite){if(!ee.frustumCulled||Z.intersectsSprite(ee)){ye&&he.setFromMatrixPosition(ee.matrixWorld).applyMatrix4(ne);let ut=se.update(ee),pt=ee.material;pt.visible&&h.push(ee,ut,pt,Ce,he.z,null)}}else if((ee.isMesh||ee.isLine||ee.isPoints)&&(ee.isSkinnedMesh&&ee.skeleton.frame!==fe.render.frame&&(ee.skeleton.update(),ee.skeleton.frame=fe.render.frame),!ee.frustumCulled||Z.intersectsObject(ee))){ye&&he.setFromMatrixPosition(ee.matrixWorld).applyMatrix4(ne);let ut=se.update(ee),pt=ee.material;if(Array.isArray(pt)){let mt=ut.groups;for(let Ct=0,Tt=mt.length;Ct<Tt;Ct++){let Mt=mt[Ct],on=pt[Mt.materialIndex];on&&on.visible&&h.push(ee,ut,on,Ce,he.z,Mt)}}else pt.visible&&h.push(ee,ut,pt,Ce,he.z,null)}}let st=ee.children;for(let ut=0,pt=st.length;ut<pt;ut++)vt(st[ut],_e,Ce,ye)}function rt(ee,_e,Ce,ye){let Re=ee.opaque,st=ee.transmissive,ut=ee.transparent;f.setupLightsView(Ce),st.length>0&&Ye(Re,_e,Ce),ye&&z.viewport(L.copy(ye)),Re.length>0&&Oe(Re,_e,Ce),st.length>0&&Oe(st,_e,Ce),ut.length>0&&Oe(ut,_e,Ce),z.buffers.depth.setTest(!0),z.buffers.depth.setMask(!0),z.buffers.color.setMask(!0),z.setPolygonOffset(!1)}
3141function Ye(ee,_e,Ce){let ye=j.isWebGL2;ue===null&&(ue=new zr(1,1,{generateMipmaps:!0,type:B.has("EXT_color_buffer_half_float")?Hl:no,minFilter:br,samples:ye&&s===!0?4:0})),m.getDrawingBufferSize(le),ye?ue.setSize(le.x,le.y):ue.setSize(Vu(le.x),Vu(le.y));let Re=m.getRenderTarget();m.setRenderTarget(ue),m.clear();let st=m.toneMapping;m.toneMapping=Gr,Oe(ee,_e,Ce),m.toneMapping=st,re.updateMultisampleRenderTarget(ue),re.updateRenderTargetMipmap(ue),m.setRenderTarget(Re)}function Oe(ee,_e,Ce){let ye=_e.isScene===!0?_e.overrideMaterial:null;for(let Re=0,st=ee.length;Re<st;Re++){let ut=ee[Re],pt=ut.object,mt=ut.geometry,Ct=ye===null?ut.material:ye,Tt=ut.group;pt.layers.test(Ce.layers)&&Be(pt,_e,Ce,mt,Ct,Tt)}}function Be(ee,_e,Ce,ye,Re,st){ee.onBeforeRender(m,_e,Ce,ye,Re,st),ee.modelViewMatrix.multiplyMatrices(Ce.matrixWorldInverse,ee.matrixWorld),ee.normalMatrix.getNormalMatrix(ee.modelViewMatrix),Re.onBeforeRender(m,_e,Ce,ye,ee,st),Re.transparent===!0&&Re.side===kn?(Re.side=Pn,Re.needsUpdate=!0,m.renderBufferDirect(Ce,_e,ye,Re,ee,st),Re.side=pr,Re.needsUpdate=!0,m.renderBufferDirect(Ce,_e,ye,Re,ee,st),Re.side=kn):m.renderBufferDirect(Ce,_e,ye,Re,ee,st),ee.onAfterRender(m,_e,Ce,ye,Re,st)}function We(ee,_e,Ce){_e.isScene!==!0&&(_e=I);let ye=q.get(ee),Re=f.state.lights,st=f.state.shadowsArray,ut=Re.state.version,pt=J.getParameters(ee,Re.state,st,_e,Ce),mt=J.getProgramCacheKey(pt),Ct=ye.programs;ye.environment=ee.isMeshStandardMaterial?_e.environment:null,ye.fog=_e.fog,ye.envMap=(ee.isMeshStandardMaterial?ge:te).get(ee.envMap||ye.environment),Ct===void 0&&(ee.addEventListener("dispose",qe),Ct=new Map,ye.programs=Ct);let Tt=Ct.get(mt);if(Tt!==void 0){if(ye.currentProgram===Tt&&ye.lightsStateVersion===ut)return nt(ee,pt),Tt}else pt.uniforms=J.getUniforms(ee),ee.onBuild(Ce,pt,m),ee.onBeforeCompile(pt,m),Tt=J.acquireProgram(pt,mt),Ct.set(mt,Tt),ye.uniforms=pt.uniforms;let Mt=ye.uniforms;(!ee.isShaderMaterial&&!ee.isRawShaderMaterial||ee.clipping===!0)&&(Mt.clippingPlanes=E.uniform),nt(ee,pt),ye.needsLights=Mi(ee),ye.lightsStateVersion=ut,ye.needsLights&&(Mt.ambientLightColor.value=Re.state.ambient,Mt.lightProbe.value=Re.state.probe,Mt.directionalLights.value=Re.state.directional,Mt.directionalLightShadows.value=Re.state.directionalShadow,Mt.spotLights.value=Re.state.spot,Mt.spotLightShadows.value=Re.state.spotShadow,Mt.rectAreaLights.value=Re.state.rectArea,Mt.ltc_1.value=Re.state.rectAreaLTC1,Mt.ltc_2.value=Re.state.rectAreaLTC2,Mt.pointLights.value=Re.state.point,Mt.pointLightShadows.value=Re.state.pointShadow,Mt.hemisphereLights.value=Re.state.hemi,Mt.directionalShadowMap.value=Re.state.directionalShadowMap,Mt.directionalShadowMatrix.value=Re.state.directionalShadowMatrix,Mt.spotShadowMap.value=Re.state.spotShadowMap,Mt.spotLightMatrix.value=Re.state.spotLightMatrix,Mt.spotLightMap.value=Re.state.spotLightMap,Mt.pointShadowMap.value=Re.state.pointShadowMap,Mt.pointShadowMatrix.value=Re.state.pointShadowMatrix);let on=Tt.getUniforms(),jn=ha.seqWithValue(on.seq,Mt);return ye.currentProgram=Tt,ye.uniformsList=jn,Tt}function nt(ee,_e){let Ce=q.get(ee);Ce.outputEncoding=_e.outputEncoding,Ce.instancing=_e.instancing,Ce.skinning=_e.skinning,Ce.morphTargets=_e.morphTargets,Ce.morphNormals=_e.morphNormals,Ce.morphColors=_e.morphColors,Ce.morphTargetsCount=_e.morphTargetsCount,Ce.numClippingPlanes=_e.numClippingPlanes,Ce.numIntersection=_e.numClipIntersection,Ce.vertexAlphas=_e.vertexAlphas,Ce.vertexTangents=_e.vertexTangents,Ce.toneMapping=_e.toneMapping}function Vt(ee,_e,Ce,ye,Re){_e.isScene!==!0&&(_e=I),re.resetTextureUnits();let st=_e.fog,ut=ye.isMeshStandardMaterial?_e.environment:null,pt=v===null?m.outputEncoding:v.isXRRenderTarget===!0?v.texture.encoding:io,mt=(ye.isMeshStandardMaterial?ge:te).get(ye.envMap||ut),Ct=ye.vertexColors===!0&&!!Ce.attributes.color&&Ce.attributes.color.itemSize===4,Tt=!!ye.normalMap&&!!Ce.attributes.tangent,Mt=!!Ce.morphAttributes.position,on=!!Ce.morphAttributes.normal,jn=!!Ce.morphAttributes.color,en=ye.toneMapped?m.toneMapping:Gr,Qn=Ce.morphAttributes.position||Ce.morphAttributes.normal||Ce.morphAttributes.color,Kt=Qn!==void 0?Qn.length:0,_t=q.get(ye),pl=f.state.lights;if(W===!0&&(oe===!0||ee!==w)){let Gn=ee===w&&ye.id===y;E.setState(ye,ee,Gn)}let an=!1;ye.version===_t.__version?(_t.needsLights&&_t.lightsStateVersion!==pl.state.ver
vendor: 3,032 bytes, line 3141
3141sion||_t.outputEncoding!==pt||Re.isInstancedMesh&&_t.instancing===!1||!Re.isInstancedMesh&&_t.instancing===!0||Re.isSkinnedMesh&&_t.skinning===!1||!Re.isSkinnedMesh&&_t.skinning===!0||_t.envMap!==mt||ye.fog===!0&&_t.fog!==st||_t.numClippingPlanes!==void 0&&(_t.numClippingPlanes!==E.numPlanes||_t.numIntersection!==E.numIntersection)||_t.vertexAlphas!==Ct||_t.vertexTangents!==Tt||_t.morphTargets!==Mt||_t.morphNormals!==on||_t.morphColors!==jn||_t.toneMapping!==en||j.isWebGL2===!0&&_t.morphTargetsCount!==Kt)&&(an=!0):(an=!0,_t.__version=ye.version);let Cr=_t.currentProgram;an===!0&&(Cr=We(ye,_e,Re));let Nc=!1,Ds=!1,yo=!1,wn=Cr.getUniforms(),ei=_t.uniforms;if(z.useProgram(Cr.program)&&(Nc=!0,Ds=!0,yo=!0),ye.id!==y&&(y=ye.id,Ds=!0),Nc||w!==ee){if(wn.setValue(T,"projectionMatrix",ee.projectionMatrix),j.logarithmicDepthBuffer&&wn.setValue(T,"logDepthBufFC",2/(Math.log(ee.far+1)/Math.LN2)),w!==ee&&(w=ee,Ds=!0,yo=!0),ye.isShaderMaterial||ye.isMeshPhongMaterial||ye.isMeshToonMaterial||ye.isMeshStandardMaterial||ye.envMap){let Gn=wn.map.cameraPosition;Gn!==void 0&&Gn.setValue(T,he.setFromMatrixPosition(ee.matrixWorld))}(ye.isMeshPhongMaterial||ye.isMeshToonMaterial||ye.isMeshLambertMaterial||ye.isMeshBasicMaterial||ye.isMeshStandardMaterial||ye.isShaderMaterial)&&wn.setValue(T,"isOrthographic",ee.isOrthographicCamera===!0),(ye.isMeshPhongMaterial||ye.isMeshToonMaterial||ye.isMeshLambertMaterial||ye.isMeshBasicMaterial||ye.isMeshStandardMaterial||ye.isShaderMaterial||ye.isShadowMaterial||Re.isSkinnedMesh)&&wn.setValue(T,"viewMatrix",ee.matrixWorldInverse)}if(Re.isSkinnedMesh){wn.setOptional(T,Re,"bindMatrix"),wn.setOptional(T,Re,"bindMatrixInverse");let Gn=Re.skeleton;Gn&&(j.floatVertexTextures?(Gn.boneTexture===null&&Gn.computeBoneTexture(),wn.setValue(T,"boneTexture",Gn.boneTexture,re),wn.setValue(T,"boneTextureSize",Gn.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let ml=Ce.morphAttributes;if((ml.position!==void 0||ml.normal!==void 0||ml.color!==void 0&&j.isWebGL2===!0)&&K.update(Re,Ce,ye,Cr),(Ds||_t.receiveShadow!==Re.receiveShadow)&&(_t.receiveShadow=Re.receiveShadow,wn.setValue(T,"receiveShadow",Re.receiveShadow)),ye.isMeshGouraudMaterial&&ye.envMap!==null&&(ei.envMap.value=mt,ei.flipEnvMap.value=mt.isCubeTexture&&mt.isRenderTargetTexture===!1?-1:1),Ds&&(wn.setValue(T,"toneMappingExposure",m.toneMappingExposure),_t.needsLights&&Ti(ei,yo),st&&ye.fog===!0&&Ae.refreshFogUniforms(ei,st),Ae.refreshMaterialUniforms(ei,ye,G,N,ue),ha.upload(T,_t.uniformsList,ei,re)),ye.isShaderMaterial&&ye.uniformsNeedUpdate===!0&&(ha.upload(T,_t.uniformsList,ei,re),ye.uniformsNeedUpdate=!1),ye.isSpriteMaterial&&wn.setValue(T,"center",Re.center),wn.setValue(T,"modelViewMatrix",Re.modelViewMatrix),wn.setValue(T,"normalMatrix",Re.normalMatrix),wn.setValue(T,"modelMatrix",Re.matrixWorld),ye.isShaderMaterial||ye.isRawShaderMaterial){let Gn=ye.uniformsGroups;for(let gl=0,Oc=Gn.length;gl<Oc;
3141gl++)if(j.isWebGL2){let Dc=Gn[gl];ve.update(Dc,Cr),ve.bind(Dc,Cr)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Cr}function Ti(ee,_e){ee.ambientLightColor.needsUpdate=_e,ee.lightProbe.needsUpdate=_e,ee.directionalLights.needsUpdate=_e,ee.directionalLightShadows.needsUpdate=_e,ee.pointLights.needsUpdate=_e,ee.pointLightShadows.needsUpdate=_e,ee.spotLights.needsUpdate=_e,ee.spotLightShadows.needsUpdate=_e,ee.rectAreaLights.needsUpdate=_e,ee.hemisphereLights.needsUpdate=_e}function Mi(ee){return ee.isMeshLambertMaterial||ee.isMeshToonMaterial||ee.isMeshPhongMaterial||ee.isMeshStandardMaterial||ee.isShadowMaterial||ee.isShaderMaterial&&ee.lights===!0}this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return v},this.setRenderTargetTextures=function(ee,_e,Ce){q.get(ee.texture).__webglTexture=_e,q.get(ee.depthTexture).__webglTexture=Ce;let ye=q.get(ee);ye.__hasExternalTextures=!0,ye.__hasExternalTextures&&(ye.__autoAllocateDepthBuffer=Ce===void 0,ye.__autoAllocateDepthBuffer||B.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ye.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(ee,_e){let Ce=q.get(ee);Ce.__webglFramebuffer=_e,Ce.__useDefaultFramebuffer=_e===void 0},this.setRenderTarget=function(ee,_e=0,Ce=0){v=ee,x=_e,_=Ce;let ye=!0,Re=null,st=!1,ut=!1;if(ee){let mt=q.get(ee);mt.__useDefaultFramebuffer!==void 0?(z.bindFramebuffer(36160,null),ye=!1):mt.__webglFramebuffer===void 0?re.setupRenderTarget(ee):mt.__hasExternalTextures&&re.rebindTextures(ee,q.get(ee.texture).__webglTexture,q.get(ee.depthTexture).__webglTexture);let Ct=ee.texture;(Ct.isData3DTexture||Ct.isDataArrayTexture||Ct.isCompressedArrayTexture)&&(ut=!0);let Tt=q.get(ee).__webglFramebuffer;ee.isWebGLCubeRenderTarget?(Re=Tt[_e],st=!0):j.isWebGL2&&ee.samples>0&&re.useMultisampledRTT(ee)===!1?Re=q.get(ee).__webglMultisampledFramebuffer:Re=Tt,L.copy(ee.viewport),C.copy(ee.scissor),b=ee.scissorTest}else L.copy(P).multiplyScalar(G).floor(),C.copy($).multiplyScalar(G).floor(),b=H;if(z.bindFramebuffer(36160,Re)&&j.drawBuffers&&ye&&z.drawBuffers(ee,Re),z.viewport(L),z.scissor(C),z.setScissorTest(b),st){let mt=q.get(ee.texture);T.framebufferTexture2D(36160,36064,34069+_e,mt.__webglTexture,Ce)}else if(ut){let mt=q.get(ee.texture),Ct=_e||0;T.framebufferTextureLayer(36160,36064,mt.__webglTexture,Ce||0,Ct)}y=-1},this.readRenderTargetPixels=function(ee,_e,Ce,ye,Re,st,ut){if(!(ee&&ee.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let pt=q.get(ee).__webglFramebuffer;if(ee.isWebGLCubeRenderTarget&&ut!==void 0&&(pt=pt[ut]),pt){z.bindFramebuffer(36160,pt);try{let mt=ee.texture,Ct=mt.format,Tt=mt.type;if(Ct!==Ei&&pe.convert(Ct)!==T.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Mt=Tt===Hl&&(B.has("EXT_color_buffer_half_float")||j.isWebGL2&&B.has("EXT_color_buffer_float"));if(Tt!==no&&pe.convert(Tt)!==T.getParameter(35738)&&!(Tt===ps&&(j.isWebGL2||B.has("OES_texture_float")||B.has("WEBGL_color_buffer_float")))&&!Mt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}_e>=0&&_e<=ee.width-ye&&Ce>=0&&Ce<=ee.height-Re&&T.readPixels(_e,Ce,ye,Re,pe.convert(Ct),pe.convert(Tt),st)}finally{let mt=v!==null?q.get(v).__webglFramebuffer:null;z.bindFramebuffer(36160,mt)}}},this.copyFramebufferToTexture=function(ee,_e,Ce=0){let ye=Math.pow(2,-Ce),Re=Math.floor(_e.image.width*ye),st=Math.floor(_e.image.height*ye);re.setTexture2D(_e,0),T.copyTexSubImage2D(3553,Ce,0,0,ee.x,ee.y,Re,st),z.unbindTexture()},this.copyTextureToTexture=function(ee,_e,Ce,ye=0){let Re=_e.image.width,st=_e.image.height,ut=pe.convert(Ce.format),pt=pe.convert(Ce.type);re.setTexture2D(Ce,0),T.pixelStorei(37440,Ce.flipY),T.pixelStorei(37441,Ce.premultiplyAlpha),T.pixelStorei(3317,Ce.unpackAlignment),_e.isDataTexture?T.texSubImage2D(3553,ye,ee.x,ee.y,Re,st,ut,pt,_e.image.data):_e.isCompressedTexture?T.compressedTexSubImage2D(3553,ye,ee.x,ee.y,_e.mipmaps[0].width,_e.mipmaps[0].height,ut,_e.mipmaps[0].data):T.texSubImage2D(3553,ye,ee.x,ee.y,ut,pt,_e.image),ye===0&&Ce.generateMipmaps&&T.generateMipmap(3553),z.unbindTexture()},this.copyTextureToTexture3D=function(ee,_e,Ce,ye,Re=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let st=ee.max.x-ee.min.x+1,ut=ee.max.y-ee.min.y+1,pt=ee.max.z-ee.min.z+1,mt=pe.convert(ye.format),Ct=pe.convert(ye.type),Tt;if(ye.isData3DTexture)re.setTexture3D(ye,0),Tt=32879;else if(ye.isDataArrayTexture)re.setTexture2DArray(ye,0),Tt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}T.pixelStorei(37440,ye.flipY),T.pixelStorei(37441,ye.premultiplyAlpha),T.pixelStorei(3317,ye.unpackAlignment);let Mt=T.getParameter(3314),on=T.getParameter(32878),jn=T.getParameter(3316),en=T.getParameter(3315),Qn=T.getParameter(32877),Kt=Ce.isCompressedTexture?Ce.mipmaps[0]:Ce.image;T.pixelStorei(3314,Kt.width),T.pixelStorei(32878,Kt.height),T.pixelStorei(3316,ee.min.x),T.pixelStorei(3315,ee.min.y),T.pixelStorei(32877,ee.min.z),Ce.isDataTexture||Ce.isData3DTexture?T.texSubImage3D(Tt,Re,_e.x,_e.y,_e.z,st,ut,pt,mt,Ct,Kt.data):Ce.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),T.compressedTexSubImage3D(Tt,Re,_e.x,_e.y,_e.z,st,ut,pt,mt,Kt.data)):T.texSubImage3D(Tt,Re,_e.x,_e.y,_e.z,st,ut,pt,mt,Ct,Kt),T.pixelStorei(3314,Mt),T.pixelStorei(32878,on),T.pixelStorei(3316,jn),T.pixelStorei(3315,en),T.pixelStorei(32877,Qn),Re===0&&ye.generateMipmaps&&T.generateMipmap(Tt),z.unbindTexture()},this.initTexture=function(ee){ee.isCubeTexture?re.setTextureCube(ee,0):ee.isData3DTexture?re.setTexture3D(ee,0):ee.isDataArrayTexture||ee.isCompressedArrayTexture?re.setTexture2DArray(ee,0):re.setTexture2D(ee,0),z.unbindTexture()},this.resetState=function(){x=0,_=0,v=null,z.reset(),ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var sd=class extends rc{};sd.prototype.isWebGL1Renderer=!0;var xr=class extends xt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,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,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.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}};var Rg=new ae,Pg=new St,Lg=new St,$M=new ae,Ng=new Xe,va=class extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Xe,this.bindMatrixInverse=new Xe}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,this}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 St,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){let n=this.skeleton,i=this.geometry;Pg.fromBufferAttribute(i.attributes.skinIndex,e),Lg.fromBufferAttribute(i.attributes.skinWeight,e),Rg.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=Lg.getComponent(s);if(o!==0){let a=Pg.getComponent(s);Ng.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector($M.copy(Rg).applyMatrix4(Ng),o)}}
vendor: 4,477 bytes, line 3141
3141return t.applyMatrix4(this.bindMatrixInverse)}},ys=class extends xt{constructor(){super(),this.isBone=!0,this.type="Bone"}},_a=class extends pn{constructor(e=null,t=1,n=1,i,s,o,a,c,l=_n,u=_n,h,f){super(null,o,a,c,l,u,i,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Og=new Xe,QM=new Xe,vs=class{constructor(e=[],t=[]){this.uuid=qr(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,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 n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Xe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Xe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){let a=e[s]?e[s].matrixWorld:QM;Og.multiplyMatrices(a,t[s]),Og.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new vs(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=i0(e),e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new _a(t,e,e,Ei,ps);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let s=e.bones[n],o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new ys),this.bones.push(o),this.boneInverses.push(new Xe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){let o=t[i];e.bones.push(o.uuid);let a=n[i];e.boneInverses.push(a.toArray())}return e}};var Ri=class extends Xi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new $e(16777215),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.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Dg=new ae,kg=new ae,Fg=new Xe,Of=new ga,Iu=new Vr,oo=class extends xt{constructor(e=new yt,t=new Ri){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=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)Dg.fromBufferAttribute(t,i-1),kg.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Dg.distanceTo(kg);e.setAttribute("lineDistance",new je(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Iu.copy(n.boundingSphere),Iu.applyMatrix4(i),Iu.radius+=s,e.ray.intersectsSphere(Iu)===!1)return;Fg.copy(i).invert(),Of.copy(e.ray).applyMatrix4(Fg);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=new ae,u=new ae,h=new ae,f=new ae,p=this.isLineSegments?2:1,g=n.index,d=n.attributes.position;if(g!==null){let x=Math.max(0,o.start),_=Math.min(g.count,o.start+o.count);for(let v=x,y=_-1;v<y;v+=p){let w=g.getX(v),L=g.getX(v+1);if(l.fromBufferAttribute(d,w),u.fromBufferAttribute(d,L),Of.distanceSqToSegment(l,u,f,h)>c)continue;
vendor: 16,000 bytes, line 3141
3141f.applyMatrix4(this.matrixWorld);let b=e.ray.origin.distanceTo(f);b<e.near||b>e.far||t.push({distance:b,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{let x=Math.max(0,o.start),_=Math.min(d.count,o.start+o.count);for(let v=x,y=_-1;v<y;v+=p){if(l.fromBufferAttribute(d,v),u.fromBufferAttribute(d,v+1),Of.distanceSqToSegment(l,u,f,h)>c)continue;f.applyMatrix4(this.matrixWorld);let L=e.ray.origin.distanceTo(f);L<e.near||L>e.far||t.push({distance:L,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}},Ug=new ae,Bg=new ae,_s=class extends oo{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Ug.fromBufferAttribute(t,i),Bg.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Ug.distanceTo(Bg);e.setAttribute("lineDistance",new je(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var Kl=class extends Xi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new $e(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Gg=new Xe,od=new ga,Ru=new Vr,Pu=new ae,Yu=class extends xt{constructor(e=new yt,t=new Kl){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ru.copy(n.boundingSphere),Ru.applyMatrix4(i),Ru.radius+=s,e.ray.intersectsSphere(Ru)===!1)return;Gg.copy(i).invert(),od.copy(e.ray).applyMatrix4(Gg);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=n.index,h=n.attributes.position;if(l!==null){let f=Math.max(0,o.start),p=Math.min(l.count,o.start+o.count);for(let g=f,m=p;g<m;g++){let d=l.getX(g);Pu.fromBufferAttribute(h,d),zg(Pu,d,c,i,e,t,this)}}else{let f=Math.max(0,o.start),p=Math.min(h.count,o.start+o.count);for(let g=f,m=p;g<m;g++)Pu.fromBufferAttribute(h,g),zg(Pu,g,c,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function zg(r,e,t,n,i,s,o){let a=od.distanceSqToPoint(r);if(a<t){let c=new ae;od.closestPointToPoint(r,c),c.applyMatrix4(n);let l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:o})}}var si=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let n=this.getLengths(),i=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,c=s-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(s-1);let u=n[i],f=n[i+1]-u,p=(o-u)/f;return(i+p)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);let o=this.getPoint(i),a=this.getPoint(s),c=t||(o.isVector2?new Ee:new ae);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){let n=new ae,i=[],s=[],o=[],a=new ae,c=new Xe;for(let p=0;p<=e;p++){let g=p/e;i[p]=this.getTangentAt(g,new ae)}s[0]=new ae,o[0]=new ae;let l=Number.MAX_VALUE,u=Math.abs(i[0].x),h=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),f<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();let g=Math.acos(Vn(i[p-1].dot(i[p]),-1,1));s[p].applyMatrix4(c.makeRotationAxis(a,g))}o[p].crossVectors(i[p],s[p])}if(t===!0){let p=Math.acos(Vn(s[0].dot(s[e]),-1,1));p/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(p=-p);for(let g=1;g<=e;g++)s[g].applyMatrix4(c.makeRotationAxis(i[g],p*g)),o[g].crossVectors(i[g],s[g])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Jl=class extends si{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t){let n=t||new Ee,i=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);let a=this.aStartAngle+e*s,c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=c-this.aX,p=l-this.aY;c=f*u-p*h+this.aX,l=f*h+p*u+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},ad=class extends Jl{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function Cd(){let r=0,e=0,t=0,n=0;function i(s,o,a,c){r=s,e=a,t=-3*s+3*o-2*a-c,n=2*s-2*o+a+c}return{initCatmullRom:function(s,o,a,c,l){i(o,a,l*(a-s),l*(c-o))},initNonuniformCatmullRom:function(s,o,a,c,l,u,h){let f=(o-s)/l-(a-s)/(l+u)+(a-o)/u,p=(a-o)/u-(c-o)/(u+h)+(c-a)/h;f*=u,p*=u,i(o,a,f,p)},calc:function(s){let o=s*s,a=o*s;return r+e*s+t*o+n*a}}}var Lu=new ae,Df=new Cd,kf=new Cd,Ff=new Cd,ld=class extends si{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new ae){let n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let l,u;this.closed||a>0?l=i[(a-1)%s]:(Lu.subVectors(i[0],i[1]).add(i[0]),l=Lu);let h=i[a%s],f=i[(a+1)%s];if(this.closed||a+2<s?u=i[(a+2)%s]:(Lu.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=Lu),this.curveType==="centripetal"||this.curveType==="chordal"){let p=this.curveType==="chordal"?.5:.25,g=Math.pow(l.distanceToSquared(h),p),m=Math.pow(h.distanceToSquared(f),p),d=Math.pow(f.distanceToSquared(u),p);m<1e-4&&(m=1),g<1e-4&&(g=m),d<1e-4&&(d=m),Df.initNonuniformCatmullRom(l.x,h.x,f.x,u.x,g,m,d),kf.initNonuniformCatmullRom(l.y,h.y,f.y,u.y,g,m,d),Ff.initNonuniformCatmullRom(l.z,h.z,f.z,u.z,g,m,d)}else this.curveType==="catmullrom"&&(Df.initCatmullRom(l.x,h.x,f.x,u.x,this.tension),kf.initCatmullRom(l.y,h.y,f.y,u.y,this.tension),Ff.initCatmullRom(l.z,h.z,f.z,u.z,this.tension));return n.set(Df.calc(c),kf.calc(c),Ff.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(new ae().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function Vg(r,e,t,n,i){let s=(n-e)*.5,o=(i-t)*.5,a=r*r,c=r*a;return(2*t-2*n+s+o)*c+(-3*t+3*n-2*s-o)*a+s*r+t}function e1(r,e){let t=1-r;return t*t*e}function t1(r,e){return 2*(1-r)*r*e}function n1(r,e){return r*r*e}function Gl(r,e,t,n){return e1(r,e)+t1(r,t)+n1(r,n)}function i1(r,e){let t=1-r;return t*t*t*e}function r1(r,e){let t=1-r;return 3*t*t*r*e}function s1(r,e){return 3*(1-r)*r*r*e}function o1(r,e){return r*r*r*e}function zl(r,e,t,n,i){return i1(r,e)+r1(r,t)+s1(r,n)+o1(r,i)}var Zu=class extends si{constructor(e=new Ee,t=new Ee,n=new Ee,i=new Ee){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Ee){let n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(zl(e,i.x,s.x,o.x,a.x),zl(e,i.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},cd=class extends si{constructor(e=new ae,t=new ae,n=new ae,i=new ae){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ae){let n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(zl(e,i.x,s.x,o.x,a.x),zl(e,i.y,s.y,o.y,a.y),zl(e,i.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},$l=class extends si{constructor(e=new Ee,t=new Ee){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Ee){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let n=t||new Ee;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},ud=class extends si{constructor(e=new ae,t=new ae){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ae){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ku=class extends si{constructor(e=new Ee,t=new Ee,n=new Ee){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Ee){let n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(Gl(e,i.x,s.x,o.x),Gl(e,i.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},hd=class extends si{constructor(e=new ae,t=new ae,n=new ae){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ae){let n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(Gl(e,i.x,s.x,o.x),Gl(e,i.y,s.y,o.y),Gl(e,i.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ju=class extends si{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Ee){let n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,c=i[o===0?o:o-1],l=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Vg(a,c.x,l.x,u.x,h.x),Vg(a,c.y,l.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(new Ee().fromArray(i))}return this}},f0=Object.freeze({__proto__:null,ArcCurve:ad,CatmullRomCurve3:ld,CubicBezierCurve:Zu,CubicBezierCurve3:cd,EllipseCurve:Jl,LineCurve:$l,LineCurve3:ud,QuadraticBezierCurve:Ku,QuadraticBezierCurve3:hd,SplineCurve:Ju}),fd=class extends si{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new $l(t,e))}getPoint(e,t){let n=e*this.getLength(),i=this.getCurveLengths(),s=0;for(;s<i.length;){if(i[s]>=n){let o=i[s]-n,a=this.curves[s],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let i=0,s=this.curves;i<s.length;i++){let o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isS
vendor: 3,953 bytes, line 3141
3141plineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){let u=c[l];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let i=e.curves[t];this.curves.push(new f0[i.type]().fromJSON(i))}return this}},jr=class extends fd{constructor(e){super(),this.type="Path",this.currentPoint=new Ee,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new $l(this.currentPoint.clone(),new Ee(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){let s=new Ku(this.currentPoint.clone(),new Ee(e,t),new Ee(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){let a=new Zu(this.currentPoint.clone(),new Ee(e,t),new Ee(n,i),new Ee(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new Ju(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){let a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,c){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,s,o,a,c),this}absellipse(e,t,n,i,s,o,a,c){let l=new Jl(e,t,n,i,s,o,a,c);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};var ao=class extends yt{constructor(e=1,t=1,n=1,i=8,s=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:c};let l=this;i=Math.floor(i),s=Math.floor(s);let u=[],h=[],f=[],p=[],g=0,m=[],d=n/2,x=0;_(),o===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new je(h,3)),this.setAttribute("normal",new je(f,3)),this.setAttribute("uv",new je(p,2));function _(){let y=new ae,w=new ae,L=0,C=(t-e)/n;for(let b=0;b<=s;b++){let A=[],N=b/s,G=N*(t-e)+e;for(let F=0;F<=i;F++){let U=F/i,P=U*c+a,$=Math.sin(P),H=Math.cos(P);w.x=G*$,w.y=-N*n+d,w.z=G*H,h.push(w.x,w.y,w.z),y.set($,C,H).normalize(),f.push(y.x,y.y,y.z),p.push(U,1-N),A.push(g++)}m.push(A)}for(let b=0;b<i;b++)for(let A=0;A<s;A++){let N=m[A][b],G=m[A+1][b],F=m[A+1][b+1],U=m[A][b+1];u.push(N,G,U),u.push(G,F,U),L+=6}l.addGroup(x,L,0),x+=L}function v(y){let w=g,L=new Ee,C=new ae,b=0,A=y===!0?e:t,N=y===!0?1:-1;for(let F=1;F<=i;F++)h.push(0,d*N,0),f.push(0,N,0),p.push(.5,.5),g++;let G=g;for(let F=0;F<=i;F++){let P=F/i*c+a,$=Math.cos(P),H=Math.sin(P);C.x=A*H,C.y=d*N,C.z=A*$,h.push(C.x,C.y,C.z),f.push(0,N,0),L.x=$*.5+.5,L.y=H*.5*N+.5,p.push(L.x,L.y),g++}for(let F=0;F<i;F++){let U=w+F,P=G+F;y===!0?u.push(P,P+1,U):u.push(P+1,P,U),b+=3}l.addGroup(x,b,y===!0?1:2),x+=b}}static fromJSON(e){return new ao(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},ba=class extends ao{constructor(e=1,t=1,n=8,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a),this.type="C
3141oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new ba(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var Nu=new ae,Ou=new ae,Uf=new ae,Du=new Ai,$u=class extends yt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){let i=Math.pow(10,4),s=Math.cos(ua*t),o=e.getIndex(),a=e.getAttribute("position"),c=o?o.count:a.count,l=[0,0,0],u=["a","b","c"],h=new Array(3),f={},p=[];for(let g=0;g<c;g+=3){o?(l[0]=o.getX(g),l[1]=o.getX(g+1),l[2]=o.getX(g+2)):(l[0]=g,l[1]=g+1,l[2]=g+2);let{a:m,b:d,c:x}=Du;if(m.fromBufferAttribute(a,l[0]),d.fromBufferAttribute(a,l[1]),x.fromBufferAttribute(a,l[2]),Du.getNormal(Uf),h[0]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,h[1]=`${Math.round(d.x*i)},${Math.round(d.y*i)},${Math.round(d.z*i)}`,h[2]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let _=0;_<3;_++){let v=(_+1)%3,y=h[_],w=h[v],L=Du[u[_]],C=Du[u[v]],b=`${y}_${w}`,A=`${w}_${y}`;A in f&&f[A]?(Uf.dot(f[A].normal)<=s&&(p.push(L.x,L.y,L.z),p.push(C.x,C.y,C.z)),f[A]=null):b in f||(f[b]={index0:l[_],index1:l[v],normal:Uf.clone()})}}for(let g in f)if(f[g]){let{index0:m,index1:d}=f[g];Nu.fromBufferAttribute(a,m),Ou.fromBufferAttribute(a,d),p.push(Nu.x,Nu.y,Nu.z),p.push(Ou.x,Ou.y,Ou.z)}this.setAttribute("position",new je(p,3))}}},gs=class extends jr{constructor(e){super(e),this.uuid=qr(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let i=e.holes[t];this.holes.push(new jr().fromJSON(i))}return this}},a1={triangulate:function(r,e,t=2){let n=e&&e.length,i=n?e[0]*t:r.length,s=d0(r,0,i,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,c,l,u,h,f,p;if(n&&(s=f1(r,e,s,t)),r.length>80*t){a=l=r[0],c=u=r[1];for(let g=t;g<i;g+=t)h=r[g],f=r[g+1],h<a&&(a=h),f<c&&(c=f),h>l&&(l=h),f>u&&(u=f);p=Math.max(l-a,u-c),p=p!==0?32767/p:0}return Ql(s,o,t,a,c,p,0),o}};function d0(r,e,t,n,i){let s,o;if(i===M1(r,e,t,n)>0)for(s=e;s<t;s+=n)o=Hg(s,r[s],r[s+1],o);else for(s=t-n;s>=e;s-=n)o=Hg(s,r[s],r[s+1],o);return o&&uh(o,o.next)&&(tc(o),o=o.next),o}function lo(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(uh(t,t.next)||rn(t.prev,t,t.next)===0)){if(tc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ql(r,e,t,n,i,s,o){if(!r)return;!o&&s&&x1(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?c1(r,n,i,s):l1(r)){e.push(c.i/t|0),e.push(r.i/t|0),e.push(l.i/t|0),tc(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=u1(lo(r),e,t),Ql(r,e,t,n,i,s,2)):o===2&&h1(r,e,t,n,i,s):Ql(lo(r),e,t,n,i,s,1);break}}}function l1(r){let e=r.prev,t=r,n=r.next;if(rn(e,t,n)>=0)return!1;let i=e.x,s=t.x,o=n.x,a=e.y,c=t.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,f=i>s?i>o?i:o:s>o?s:o,p=a>c?a>l?a:l:c>l?c:l,g=n.next;for(;g!==e;){if(g.x>=u&&g.x<=f&&g.y>=h&&g.y<=p&&aa(i,a,s,c,o,l,g.x,g.y)&&rn(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function c1(r,e,t,n){let i=r.prev,s=r,o=r.next;if(rn(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,f=o.y,p=a<c?a<l?a:l:c<l?c:l,g=u<h?u<f?u:f:h<f?h:f,m=a>c?a>l?a:l:c>l?c:l,d=u>h?u>f?u:f:h>f?h:f,x=dd(p,g,e,t,n),_=dd(m,d,e,t,n),v=r.prevZ,y=r.nextZ;for(;v&&v.z>=x&&y&&y.z<=_;){if(v.x>=p&&v.x<=m&&v.y>=g&&v.y<=d&&v!==i&&v!==o&&aa(a,u,c,h,l,f,v.x,v.y)&&rn(v.prev,v,v.next)>=0||(v=v.prevZ,y.x>=p&&y.x<=m&&y.y>=g&&y.y<=d&&y!==i&&y!==o&&aa(a,u,c,h,l,f,y.x,y.y)&&rn(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;v&&v.z>=x;){if(v.x>=p&&v.x<=m&&v.y>=g&&v.y<=d&&v!==i&&v!==o&&aa(a,u,c,h,l,f,v.x,v.y)&&rn(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;y&&y.z<=_;){if(y.x>=p&&y.x<=m&&y.y>=g&&y.y<=d&&y!==i&&y!==o&&aa(a,u,c,h,l,f,y.x,y.y)&&rn(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function u1(r,e,t){let n=r;do{let i=n.prev,s=n.next.next;!uh(i,s)&&p0(i,n,n.next,s)&&ec(i,s)&&ec(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),tc(n),tc(n.next),n=r=s),n=n.next}while(n!==r);return lo(n)}function h1(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&_1(o,a)){let c=m0(o,a);o=lo(o,o.next),c=lo(c,c.next),Ql(o,e,t,n,i,s,0),Ql(c,e,t,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function f1(r,e,t,n){let i=[],s,o,a,c,l;
vendor: 22,728 bytes, line 3141
3141for(s=0,o=e.length;s<o;s++)a=e[s]*n,c=s<o-1?e[s+1]*n:r.length,l=d0(r,a,c,n,!1),l===l.next&&(l.steiner=!0),i.push(v1(l));for(i.sort(d1),s=0;s<i.length;s++)t=p1(i[s],t);return t}function d1(r,e){return r.x-e.x}function p1(r,e){let t=m1(r,e);if(!t)return e;let n=m0(t,r);return lo(n,n.next),lo(t,t.next)}function m1(r,e){let t=e,n=-1/0,i,s=r.x,o=r.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){let f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>n&&(n=f,i=t.x<t.next.x?t:t.next,f===s))return i}t=t.next}while(t!==e);if(!i)return null;let a=i,c=i.x,l=i.y,u=1/0,h;t=i;do s>=t.x&&t.x>=c&&s!==t.x&&aa(o<l?s:n,o,c,l,o<l?n:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),ec(t,r)&&(h<u||h===u&&(t.x>i.x||t.x===i.x&&g1(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function g1(r,e){return rn(r.prev,r,e.prev)<0&&rn(e.next,r,r.next)<0}function x1(r,e,t,n){let i=r;do i.z===0&&(i.z=dd(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,y1(i)}function y1(r){let e,t,n,i,s,o,a,c,l=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e<l&&(a++,n=n.nextZ,!!n);e++);for(c=l;a>0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,l*=2}while(o>1);return r}function dd(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|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 v1(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 aa(r,e,t,n,i,s,o,a){return(i-o)*(e-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(n-a)}function _1(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!b1(r,e)&&(ec(r,e)&&ec(e,r)&&T1(r,e)&&(rn(r.prev,r,e.prev)||rn(r,e.prev,e))||uh(r,e)&&rn(r.prev,r,r.next)>0&&rn(e.prev,e,e.next)>0)}function rn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function uh(r,e){return r.x===e.x&&r.y===e.y}function p0(r,e,t,n){let i=Fu(rn(r,e,t)),s=Fu(rn(r,e,n)),o=Fu(rn(t,n,r)),a=Fu(rn(t,n,e));return!!(i!==s&&o!==a||i===0&&ku(r,t,e)||s===0&&ku(r,n,e)||o===0&&ku(t,r,n)||a===0&&ku(t,e,n))}function ku(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 Fu(r){return r>0?1:r<0?-1:0}function b1(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&&p0(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function ec(r,e){return rn(r.prev,r,r.next)<0?rn(r,e,r.next)>=0&&rn(r,r.prev,e)>=0:rn(r,e,r.prev)<0||rn(r,r.next,e)<0}function T1(r,e){let t=r,n=!1,i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function m0(r,e){let t=new pd(r.i,r.x,r.y),n=new pd(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Hg(r,e,t,n){let i=new pd(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function tc(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 pd(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 M1(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}var Ci=class{static area(e){let t=e.length,n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return Ci.area(e)<0}static triangulateShape(e,t){let n=[],i=[],s=[];Wg(e),jg(n,e);let o=e.length;t.forEach(Wg);for(let c=0;c<t.length;c++)i.push(o),o+=t[c].length,jg(n,t[c]);let a=a1.triangulate(n,i);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}};function Wg(r){let e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function jg(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}var Ta=class extends yt{constructor(e=new gs([new Ee(.5,.5),new Ee(-.5,.5),new Ee(-.5,-.5),new Ee(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,i=[],s=[];for(let a=0,c=e.length;a<c;a++){let l=e[a];o(l)}this.setAttribute("position",new je(i,3)),this.setAttribute("uv",new je(s,2)),this.computeVertexNormals();function o(a){let c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:p-.1,m=t.bevelOffset!==void 0?t.bevelOffset:0,d=t.bevelSegments!==void 0?t.bevelSegments:3,x=t.extrudePath,_=t.UVGenerator!==void 0?t.UVGenerator:w1,v,y=!1,w,L,C,b;x&&(v=x.getSpacedPoints(u),y=!0,f=!1,w=x.computeFrenetFrames(u,!1),L=new ae,C=new ae,b=new ae),f||(d=0,p=0,g=0,m=0);let A=a.extractPoints(l),N=A.shape,G=A.holes;if(!Ci.isClockWise(N)){N=N.reverse();for(let q=0,re=G.length;q<re;q++){let te=G[q];Ci.isClockWise(te)&&(G[q]=te.reverse())}}let U=Ci.triangulateShape(N,G),P=N;for(let q=0,re=G.length;q<re;q++){let te=G[q];N=N.concat(te)}function $(q,re,te){return re||console.error("THREE.ExtrudeGeometry: vec does not exist"),re.clone().multiplyScalar(te).add(q)}let H=N.length,Z=U.length;function W(q,re,te){let ge,xe,we,se=q.x-re.x,J=q.y-re.y,Ae=te.x-q.x,Le=te.y-q.y,R=se*se+J*J,E=se*Le-J*Ae;if(Math.abs(E)>Number.EPSILON){let k=Math.sqrt(R),Q=Math.sqrt(Ae*Ae+Le*Le),K=re.x-J/k,ce=re.y+se/k,me=te.x-Le/Q,pe=te.y+Ae/Q,ie=((me-K)*Le-(pe-ce)*Ae)/(se*Le-J*Ae);ge=K+se*ie-q.x,xe=ce+J*ie-q.y;let ve=ge*ge+xe*xe;if(ve<=2)return new Ee(ge,xe);we=Math.sqrt(ve/2)}else{let k=!1;se>Number.EPSILON?Ae>Number.EPSILON&&(k=!0):se<-Number.EPSILON?Ae<-Number.EPSILON&&(k=!0):Math.sign(J)===Math.sign(Le)&&(k=!0),k?(ge=-J,xe=se,we=Math.sqrt(R)):(ge=se,xe=J,we=Math.sqrt(R/2))}return new Ee(ge/we,xe/we)}let oe=[];for(let q=0,re=P.length,te=re-1,ge=q+1;q<re;q++,te++,ge++)te===re&&(te=0),ge===re&&(ge=0),oe[q]=W(P[q],P[te],P[ge]);let ue=[],ne,le=oe.concat();for(let q=0,re=G.length;q<re;q++){let te=G[q];ne=[];for(let ge=0,xe=te.length,we=xe-1,se=ge+1;ge<xe;ge++,we++,se++)we===xe&&(we=0),se===xe&&(se=0),ne[ge]=W(te[ge],te[we],te[se]);ue.push(ne),le=le.concat(ne)}for(let q=0;q<d;q++){let re=q/d,te=p*Math.cos(re*Math.PI/2),ge=g*Math.sin(re*Math.PI/2)+m;for(let xe=0,we=P.length;xe<we;xe++){let se=$(P[xe],oe[xe],ge);S(se.x,se.y,-te)}for(let xe=0,we=G.length;xe<we;xe++){let se=G[xe];ne=ue[xe];for(let J=0,Ae=se.length;J<Ae;J++){let Le=$(se[J],ne[J],ge);S(Le.x,Le.y,-te)}}}let he=g+m;for(let q=0;q<H;q++){let re=f?$(N[q],le[q],he):N[q];y?(C.copy(w.normals[0]).multiplyScalar(re.x),L.copy(w.binormals[0]).multiplyScalar(re.y),b.copy(v[0]).add(C).add(L),S(b.x,b.y,b.z)):S(re.x,re.y,0)}for(let q=1;q<=u;q++)for(let re=0;re<H;re++){let te=f?$(N[re],le[re],he):N[re];y?(C.copy(w.normals[q]).multiplyScalar(te.x),L.copy(w.binormals[q]).multiplyScalar(te.y),b.copy(v[q]).add(C).add(L),S(b.x,b.y,b.z)):S(te.x,te.y,h/u*q)}for(let q=d-1;q>=0;q--){let re=q/d,te=p*Math.cos(re*Math.PI/2),ge=g*Math.sin(re*Math.PI/2)+m;for(let xe=0,we=P.length;xe<we;xe++){let se=$(P[xe],oe[xe],ge);S(se.x,se.y,h+te)}for(let xe=0,we=G.length;xe<we;xe++){let se=G[xe];ne=ue[xe];for(let J=0,Ae=se.length;J<Ae;J++){let Le=$(se[J],ne[J],ge);y?S(Le.x,Le.y+v[u-1].y,v[u-1].x+te):S(Le.x,Le.y,h+te)}}}I(),M();function I(){let q=i.length/3;if(f){let re=0,te=H*re;for(let ge=0;ge<Z;ge++){let xe=U[ge];B(xe[2]+te,xe[1]+te,xe[0]+te)}re=u+d*2,te=H*re;for(let ge=0;ge<Z;ge++){let xe=U[ge];B(xe[0]+te,xe[1]+te,xe[2]+te)}}else{for(let re=0;re<Z;re++){let te=U[re];B(te[2],te[1],te[0])}for(let re=0;re<Z;re++){let te=U[re];B(te[0]+H*u,te[1]+H*u,te[2]+H*u)}}n.addGroup(q,i.length/3-q,0)}function M(){let q=i.length/3,re=0;T(P,re),re+=P.length;for(let te=0,ge=G.length;te<ge;te++){let xe=G[te];T(xe,re),re+=xe.length}n.addGroup(q,i.length/3-q,1)}function T(q,re){let te=q.length;for(;--te>=0;){let ge=te,xe=te-1;xe<0&&(xe=q.length-1);for(let we=0,se=u+d*2;we<se;we++){let J=H*we,Ae=H*(we+1),Le=re+ge+J,R=re+xe+J,E=re+xe+Ae,k=re+ge+Ae;j(Le,R,E,k)}}}function S(q,re,te){c.push(q),c.push(re),c.push(te)}function B(q,re,te){z(q),z(re),z(te);let ge=i.length/3,xe=_.generateTopUV(n,i,ge-3,ge-2,ge-1);fe(xe[0]),fe(xe[1]),fe(xe[2])}function j(q,re,te,ge){z(q),z(re),z(ge),z(re),z(te),z(ge);let xe=i.length/3,we=_.generateSideWallUV(n,i,xe-6,xe-3,xe-2,xe-1);fe(we[0]),fe(we[1]),fe(we[3]),fe(we[1]),fe(we[2]),fe(we[3])}function z(q){i.push(c[q*3+0]),i.push(c[q*3+1]),i.push(c[q*3+2])}function fe(q){s.push(q.x),s.push(q.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return S1(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new f0[i.type]().fromJSON(i)),new Ta(n,e.options)}},w1={generateTopUV:function(r,e,t,n,i){let s=e[t*3],o=e[t*3+1],a=e[n*3],c=e[n*3+1],l=e[i*3],u=e[i*3+1];return[new Ee(s,o),new Ee(a,c),new Ee(l,u)]},generateSideWallUV:function(r,e,t,n,i,s){let o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[n*3],u=e[n*3+1],h=e[n*3+2],f=e[i*3],p=e[i*3+1],g=e[i*3+2],m=e[s*3],d=e[s*3+1],x=e[s*3+2];return Math.abs(a-u)<Math.abs(o-l)?[new Ee(o,1-c),new Ee(l,1-h),new Ee(f,1-g),new Ee(m,1-x)]:[new Ee(a,1-c),new Ee(u,1-h),new Ee(p,1-g),new Ee(d,1-x)]}};function S1(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){let s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var bs=class extends yt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let c=Math.min(o+a,Math.PI),l=0,u=[],h=new ae,f=new ae,p=[],g=[],m=[],d=[];for(let x=0;x<=n;x++){let _=[],v=x/n,y=0;x==0&&o==0?y=.5/t:x==n&&c==Math.PI&&(y=-.5/t);for(let w=0;w<=t;w++){let L=w/t;h.x=-e*Math.cos(i+L*s)*Math.sin(o+v*a),h.y=e*Math.cos(o+v*a),h.z=e*Math.sin(i+L*s)*Math.sin(o+v*a),g.push(h.x,h.y,h.z),f.copy(h).normalize(),m.push(f.x,f.y,f.z),d.push(L+y,1-v),_.push(l++)}u.push(_)}for(let x=0;x<n;x++)for(let _=0;_<t;_++){let v=u[x][_+1],y=u[x][_],w=u[x+1][_],L=u[x+1][_+1];(x!==0||o>0)&&p.push(v,y,L),(x!==n-1||c<Math.PI)&&p.push(y,w,L)}this.setIndex(p),this.setAttribute("position",new je(g,3)),this.setAttribute("normal",new je(m,3)),this.setAttribute("uv",new je(d,2))}static fromJSON(e){return new bs(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Ts=class extends Xi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new $e(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lh,this.normalScale=new Ee(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.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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.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 Qt=class extends Xi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new $e(16777215),this.specular=new $e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lh,this.normalScale=new Ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=oh,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.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 Ma=class extends Xi{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new $e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lh,this.normalScale=new Ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=oh,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.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 ds(r,e,t){return g0(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)}function Uu(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 g0(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function E1(r){function e(i,s){return r[i]-r[s]}let t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function qg(r,e,t){let n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){let a=t[s]*e;for(let c=0;c!==e;++c)i[o++]=r[a+c]}return i}function x0(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}var wa=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let c=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},md=class extends wa{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Xm,endingEnd:Xm}}intervalChanged_(e,t,n){let i=this.parameterPositions,s=e-2,o=e+1,a=i[s],c=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case Ym:s=e,a=2*t-n;break;case Zm:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Ym:o=e,c=2*n-t;break;case Zm:o=1,c=n+i[1]-i[0];break;default:o=e-1,c=t}let l=(n-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,i){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,p=this._weightNext,g=(n-t)/(i-t),m=g*g,d=m*g,x=-f*d+2*f*m-f*g,_=(1+f)*d+(-1.5-2*f)*m+(-.5+f)*g+1,v=(-1-p)*d+(1.5+p)*m+.5*g,y=p*d-p*m;for(let w=0;w!==a;++w)s[w]=x*o[u+w]+_*o[l+w]+v*o[c+w]+y*o[h+w];return s}},gd=class extends wa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(n-t)/(i-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[l+f]*h+o[c+f]*u;return s}},xd=class extends wa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},Pi=class{constructor(e,t,n,i){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=Uu(t,this.TimeBufferType),this.values=Uu(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Uu(e.times,Array),values:Uu(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new xd(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new gd(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new md(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Gu:t=this.InterpolantFactoryMethodDiscrete;break;case zu:t=this.InterpolantFactoryMethodLinear;break;case af:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let n="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(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Gu;case this.InterpolantFactoryMethodLinear:return zu;case this.InterpolantFactoryMethodSmooth:return af}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=ds(n,s,o),this.values=ds(this.values,s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&g0(i))for(let a=0,c=i.length;a!==c;++a){let l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){let e=ds(this.times),t=ds(this.values),n=this.getValueSize(),i=this.getInterpolation()===af,s=e.length-1,o=1;for(let a=1;a<s;++a){let c=!1,l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(i)c=!0;else{let h=a*n,f=h-n,p=h+n;for(let g=0;g!==n;++g){let m=t[h+g];if(m!==t[f+g]||m!==t[p+g]){c=!0;break}}}
vendor: 19,493 bytes, line 3141
3141if(c){if(a!==o){e[o]=e[a];let h=a*n,f=o*n;for(let p=0;p!==n;++p)t[f+p]=t[h+p]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=ds(e,0,o),this.values=ds(t,0,o*n)):(this.times=e,this.values=t),this}clone(){let e=ds(this.times,0),t=ds(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Pi.prototype.TimeBufferType=Float32Array;Pi.prototype.ValueBufferType=Float32Array;Pi.prototype.DefaultInterpolation=zu;var Ms=class extends Pi{};Ms.prototype.ValueTypeName="bool";Ms.prototype.ValueBufferType=Array;Ms.prototype.DefaultInterpolation=Gu;Ms.prototype.InterpolantFactoryMethodLinear=void 0;Ms.prototype.InterpolantFactoryMethodSmooth=void 0;var Qu=class extends Pi{};Qu.prototype.ValueTypeName="color";var ws=class extends Pi{};ws.prototype.ValueTypeName="number";var yd=class extends wa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t),l=e*a;for(let u=l+a;l!==u;l+=4)mn.slerpFlat(s,0,o,l-a,o,l,c);return s}},Yi=class extends Pi{InterpolantFactoryMethodLinear(e){return new yd(this.times,this.values,this.getValueSize(),e)}};Yi.prototype.ValueTypeName="quaternion";Yi.prototype.DefaultInterpolation=zu;Yi.prototype.InterpolantFactoryMethodSmooth=void 0;var Ss=class extends Pi{};Ss.prototype.ValueTypeName="string";Ss.prototype.ValueBufferType=Array;Ss.prototype.DefaultInterpolation=Gu;Ss.prototype.InterpolantFactoryMethodLinear=void 0;Ss.prototype.InterpolantFactoryMethodSmooth=void 0;var Zi=class extends Pi{};Zi.prototype.ValueTypeName="vector";var co=class{constructor(e,t=-1,n,i=Zy){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=qr(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(C1(n[o]).scale(i));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(Pi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let s=t.length,o=[];for(let a=0;a<s;a++){let c=[],l=[];c.push((a+s-1)%s,a,(a+1)%s),l.push(0,1,0);let u=E1(c);c=qg(c,1,u),l=qg(l,1,u),!i&&c[0]===0&&(c.push(s),l.push(l[0])),o.push(new ws(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){let l=e[a],u=l.name.match(s);if(u&&u.length>1){let h=u[1],f=i[h];f||(i[h]=f=[]),f.push(l)}}let o=[];for(let a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(h,f,p,g,m){if(p.length!==0){let d=[],x=[];x0(p,d,x,g),d.length!==0&&m.push(new h(f,d,x))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let h=0;h<l.length;h++){let f=l[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){let p={},g;for(g=0;g<f.length;g++)if(f[g].morphTargets)for(let m=0;m<f[g].morphTargets.length;m++)p[f[g].morphTargets[m]]=-1;for(let m in p){let d=[],x=[];for(let _=0;_!==f[g].morphTargets.length;++_){let v=f[g];d.push(v.time),x.push(v.morphTarget===m?1:0)}i.push(new ws(".morphTargetInfluence["+m+"]",d,x))}c=p.length*o}else{let p=".bones["+t[h].name+"]";n(Zi,p+".position",f,"pos",i),n(Yi,p+".quaternion",f,"rot",i),n(Zi,p+".scale",f,"scl",i)}}return i.length===0?null:new this(s,c,i,a)}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let s=this.tracks[n];t=Math.max(t,s.times[s.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 A1(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ws;case"vector":case"vector2":case"vector3":case"vector4":return Zi;case"color":return Qu;case"quaternion":return Yi;case"bool":case"boolean":return Ms;case"string":return Ss}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function C1(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=A1(r.type);if(r.times===void 0){let t=[],n=[];x0(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}var eh={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={}}},nc=class{constructor(e,t,n){let i=this,s=!1,o=0,a=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){let h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=l.length;h<f;h+=2){let p=l[h],g=l[h+1];if(p.global&&(p.lastIndex=0),p.test(u))return g}return null}}},I1=new nc,Un=class{constructor(e){this.manager=e!==void 0?e:I1,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},Ur={},vd=class extends Error{constructor(e,t){super(e),this.response=t}},vi=class extends Un{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=eh.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ur[e]!==void 0){Ur[e].push({onLoad:t,onProgress:n,onError:i});return}Ur[e]=[],Ur[e].push({onLoad:t,onProgress:n,onError:i});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let u=Ur[e],h=l.body.getReader(),f=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),p=f?parseInt(f):0,g=p!==0,m=0,d=new ReadableStream({start(x){_();function _(){h.read().then(({done:v,value:y})=>{if(v)x.close();else{m+=y.byteLength;let w=new ProgressEvent("progress",{lengthComputable:g,loaded:m,total:p});for(let L=0,C=u.length;L<C;L++){let b=u[L];b.onProgress&&b.onProgress(w)}x.enqueue(y),_()}})}}});return new Response(d)}else throw new vd(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{let h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(f);return l.arrayBuffer().then(g=>p.decode(g))}}}).then(l=>{eh.add(e,l);let u=Ur[e];delete Ur[e];for(let h=0,f=u.length;h<f;h++){let p=u[h];p.onLoad&&p.onLoad(l)}}).catch(l=>{let u=Ur[e];if(u===void 0)throw this.manager.itemError(e),l;delete Ur[e];for(let h=0,f=u.length;h<f;h++){let p=u[h];p.onError&&p.onError(l)}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 th=class extends Un{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=eh.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=ql("img");function c(){u(),eh.add(e,this),t&&t(this),s.manager.itemEnd(e)}function l(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},nh=class extends Un{constructor(e){super(e)}load(e,t,n,i){let s=new Yl,o=new th(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(l){o.load(e[l],function(u){s.images[l]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let l=0;l<e.length;++l)c(l);return s}},ih=class extends Un{constructor(e){super(e)}load(e,t,n,i){let s=this,o=new _a,a=new vi(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(c){let l=s.parse(c);l&&(l.image!==void 0?o.image=l.image:l.data!==void 0&&(o.image.width=l.width,o.image.height=l.height,o.image.data=l.data),o.wrapS=l.wrapS!==void 0?l.wrapS:Wt,o.wrapT=l.wrapT!==void 0?l.wrapT:Wt,o.magFilter=l.magFilter!==void 0?l.magFilter:dn,o.minFilter=l.minFilter!==void 0?l.minFilter:dn,o.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.encoding!==void 0&&(o.encoding=l.encoding),l.flipY!==void 0&&(o.flipY=l.flipY),l.format!==void 0&&(o.format=l.format),l.type!==void 0&&(o.type=l.type),l.mipmaps!==void 0&&(o.mipmaps=l.mipmaps,o.minFilter=br),l.mipmapCount===1&&(o.minFilter=dn),l.generateMipmaps!==void 0&&(o.generateMipmaps=l.generateMipmaps),o.needsUpdate=!0,t&&t(o,l))},n,i),o}},Li=class extends Un{constructor(e){super(e)}load(e,t,n,i){let s=new pn,o=new th(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}},Sa=class extends xt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new $e(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 Bf=new Xe,Xg=new ae,Yg=new ae,ic=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ee(512,512),this.map=null,this.mapPass=null,this.matrix=new Xe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Zl,this._frameExtents=new Ee(1,1),this._viewportCount=1,this._viewports=[new St(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;Xg.setFromMatrixPosition(e.matrixWorld),t.position.copy(Xg),Yg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Yg),t.updateMatrixWorld(),Bf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Bf),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Bf)}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}},_d=class extends ic{constructor(){super(new Zt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,n=jl*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},Ea=class extends Sa{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(xt.DefaultUp),this.updateMatrix(),this.target=new xt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new _d}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}},Zg=new Xe,Ol=new ae,Gf=new ae,bd=class extends ic{constructor(){super(new Zt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ee(4,2),this._viewportCount=6,this._viewports=[new St(2,1,1,1),new St(0,1,1,1),new St(3,1,1,1),new St(1,1,1,1),new St(3,0,1,1),new St(1,0,1,1)],this._cubeDirections=[new ae(1,0,0),new ae(-1,0,0),new ae(0,0,1),new ae(0,0,-1),new ae(0,1,0),new ae(0,-1,0)],this._cubeUps=[new ae(0,1,0),new ae(0,1,0),new ae(0,1,0),new ae(0,1,0),new ae(0,0,1),new ae(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Ol.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ol),Gf.copy(n.position),Gf.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Gf),n.updateMatrixWorld(),i.makeTranslation(-Ol.x,-Ol.y,-Ol.z),Zg.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Zg)}},uo=class extends Sa{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new bd}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}},Td=class extends ic{constructor(){super(new gr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},yr=class extends Sa{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(xt.DefaultUp),this.updateMatrix(),this.target=new xt,this.shadow=new Td}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},vr=class extends Sa{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var oi=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);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 Id="\\[\\]\\.:\\/",R1=new RegExp("["+Id+"]","g"),Rd="[^"+Id+"]",P1="[^"+Id.replace("\\.","")+"]",L1=/((?:WC+[\/:])*)/.source.replace("WC",Rd),N1=/(WCOD+)?/.source.replace("WCOD",P1),O1=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Rd),D1=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Rd),k1=new RegExp("^"+L1+N1+O1+D1+"$"),F1=["material","materials","bones","map"],Md=class{constructor(e,t,n){let i=n||At.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},At=class{constructor(e,t,n){this.path=t,this.parsedPath=n||At.parseTrackName(t),this.node=At.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new At.Composite(e,t,n):new At(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(R1,"")}static parseTrackName(e){let t=k1.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);F1.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let c=n(a.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}
vendor: 8,640 bytes, line 3141
3141_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,s=t.propertyIndex;if(e||(e=At.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===l){l=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let o=e[i];if(o===void 0){let l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};At.Composite=Md;At.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};At.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};At.prototype.GetterByBindingType=[At.prototype._getValue_direct,At.prototype._getValue_array,At.prototype._getValue_arrayElement,At.prototype._getValue_toArray];At.prototype.SetterByBindingTypeAndVersioning=[[At.prototype._setValue_direct,At.prototype._setValue_direct_setNeedsUpdate,At.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[At.prototype._setValue_array,At.prototype._setValue_array_setNeedsUpdate,At.prototype._setValue_array_setMatrixWorldNeedsUpdate],[At.prototype._setValue_arrayElement,At.prototype._setValue_arrayElement_setNeedsUpdate,At.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[At.prototype._setValue_fromArray,At.prototype._setValue_fromArray_setNeedsUpdate,At.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var xA=new Float32Array(1);var rh=class{constructor(e,t,n=0,i=1/0){this.ray=new ga(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Xl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return wd(e,this,n,t),n.sort(Kg),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)wd(e[i],this,n,t);return n.sort(Kg),n}};function Kg(r,e){return r.distance-e.distance}function wd(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){let i=r.children;for(let s=0,o=i.length;s<o;s++)wd(i[s],e,t,!0)}}var Jg=new Ee,sh=class{constructor(e=new Ee(1/0,1/0),t=new Ee(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Jg.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Jg.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};var _r=class{constructor(){this.type="ShapePath",this.color=new $e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new jr,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(x){let _=[];for(let v=0,y=x.length;v<y;v++){let w=x[v],L=new gs;L.curves=w.curves,_.push(L)}return _}function n(x,_){let v=_.length,y=!1;for(let w=v-1,L=0;L<v;w=L++){let C=_[w],b=_[L],A=b.x-C.x,N=b.y-C.y;if(Math.abs(N)>Number.EPSILON){if(N<0&&(C=_[L],A=-A,b=_[w],N=-N),x.y<C.y||x.y>b.y)continue;if(x.y===C.y){if(x.x===C.x)return!0}else{let G=N*(x.x-C.x)-A*(x.y-C.y);if(G===0)return!0;if(G<0)continue;y=!y}}else{if(x.y!==C.y)continue;if(b.x<=x.x&&x.x<=C.x||C.x<=x.x&&x.x<=b.x)return!0}}return y}let i=Ci.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,c,l=[];
3141if(s.length===1)return a=s[0],c=new gs,c.curves=a.curves,l.push(c),l;let u=!i(s[0].getPoints());u=e?!u:u;let h=[],f=[],p=[],g=0,m;f[g]=void 0,p[g]=[];for(let x=0,_=s.length;x<_;x++)a=s[x],m=a.getPoints(),o=i(m),o=e?!o:o,o?(!u&&f[g]&&g++,f[g]={s:new gs,p:m},f[g].s.curves=a.curves,u&&g++,p[g]=[]):p[g].push({h:a,p:m[0]});if(!f[0])return t(s);if(f.length>1){let x=!1,_=0;for(let v=0,y=f.length;v<y;v++)h[v]=[];for(let v=0,y=f.length;v<y;v++){let w=p[v];for(let L=0;L<w.length;L++){let C=w[L],b=!0;for(let A=0;A<f.length;A++)n(C.p,f[A].p)&&(v!==A&&_++,b?(b=!1,h[A].push(C)):x=!0);b&&h[v].push(C)}}_>0&&x===!1&&(p=h)}let d;for(let x=0,_=f.length;x<_;x++){c=f[x].s,l.push(c),d=p[x];for(let v=0,y=d.length;v<y;v++)c.holes.push(d[v].h)}return l}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Sd}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Sd);function hh(){let r=document.createElement("canvas");document.body.appendChild(r);let e={canvas:r,antialias:!0},t=new rc(e);t.setClearColor("#ffffff",1),t.setSize(10,10);let n=new xr,i=new vr(8947848);n.add(i);let s=new yr(8947848);s.position.set(0,0,1),n.add(s);let o=new Zt(45,1,.1,1e3);o.position.set(0,0,1),o.up.set(0,1,0),o.lookAt(new ae(0,0,0)),n.add(o);let a=new so(1,1),c=new kt(a,new Qt({color:13369344}));n.add(c),t.render(n,o);let l=t.getContext(),u=new Uint8Array(4);l.readPixels(5,5,1,1,l.RGBA,l.UNSIGNED_BYTE,u),document.body.removeChild(r);let h=50;return u[0]<h&&u[1]<h&&u[2]<h}var Hn={Phong:1,Physical:2};function fh(r){let e=0,t=0;for(let n=0;n<r.MaterialCount();n++){let i=r.GetMaterial(n);i.type===Dn.Phong?e+=1:i.type===Dn.Physical&&(t+=1)}return e>=t?Hn.Phong:Hn.Physical}function Ca(r){return di(r.r,r.g,r.b)}function ai(r){return new $e(r.r/255,r.g/255,r.b/255)}function Ki(r,e){let t=new jt,n=r.attributes.position.array,i=r.attributes.position.itemSize||3;for(let l=0;l<n.length;l+=i){let u=n[l],h=n[l+1],f=n[l+2];t.AddVertex(new Ve(u,h,f))}let s=r.attributes.color!==void 0;if(s){let l=r.attributes.color.array,u=r.attributes.color.itemSize||3;for(let h=0;h<l.length;h+=u){let f=new $e(l[h],l[h+1],l[h+2]);t.AddVertexColor(Ca(f))}}let o=r.attributes.normal!==void 0;if(o){let l=r.attributes.normal.array,u=r.attributes.normal.itemSize||3;for(let h=0;h<l.length;h+=u){let f=l[h],p=l[h+1],g=l[h+2];t.AddNormal(new Ve(f,p,g))}}let a=r.attributes.uv!==void 0;if(a){let l=r.attributes.uv.array,u=r.attributes.uv.itemSize||2;for(let h=0;h<l.length;h+=u){let f=l[h],p=l[h+1];t.AddTextureUV(new wt(f,p))}}let c=null;if(r.index!==null)c=r.index.array;else{c=[];for(let l=0;l<n.length/3;l++)c.push(l)}for(let l=0;l<c.length;l+=3){let u=c[l],h=c[l+1],f=c[l+2],p=new Bt(u,h,f);s&&p.SetVertexColors(u,h,f),o&&p.SetNormals(u,h,f),a&&p.SetTextureUVs(u,h,f),e!==null&&p.SetMaterial(e),t.AddTriangle(p)}return t}function dh(r){r!==null&&r.traverse(e=>{if(e.isMesh||e.isLineSegments){if(Array.isArray(e.material))for(let t of e.material)t.dispose();else e.material.dispose();e.geometry.dispose()}})}var Pd=class{constructor(e){this.params={getDefaultMaterialColor:()=>new dt(0,0,0)},bo(e,this.params),this.defaultMaterialIndex=null}Finalize(e){this.Reset(),this.FinalizeMeshes(e),this.FinalizeMaterials(e),this.FinalizeNodes(e)}FinalizeMaterials(e){if(e.VertexColorCount()===0)return;let t=new Map;for(let n=0;n<e.MeshCount();n++){let i=e.GetMesh(n);for(let s=0;s<i.TriangleCount();s++){let o=i.GetTriangle(s),a=o.HasVertexColors();t.has(o.mat)?a||t.set(o.mat,!1):t.set(o.mat,a)}}for(let[n,i]of t){let s=e.GetMaterial(n);s.vertexColors=i}}FinalizeMeshes(e){for(let t=0;t<e.MeshCount();t++){let n=e.GetMesh(t);if(ss(n)===lr.Empty){e.RemoveMesh(t),t=t-1;continue}this.FinalizeMesh(e,n)}}FinalizeMesh(e,t){function n(s){function o(l,u,h,f,p){function g(_,v){for(let y=0;y<_.length;y++){let w=_[y];if(pi(w,v))return!0}return!1}let m=[],d=p.get(h);for(let _=0;_<d.length;_++){let v=d[_],y=l.GetTriangle(v);if(u.curve===y.curve){let w=f[v];g(m,w)||m.push(w)}}let x=new Ve(0,0,0);for(let _=0;_<m.length;_++)x=Jc(x,m[_]);return x.MultiplyScalar(1/m.length),x.Normalize(),l.AddNormal(x)}let a=[],c=new Map;for(let l=0;l<s.VertexCount();l++)c.set(l,[]);for(let l=0;l<s.TriangleCount();l++){let u=s.GetTriangle(l),h=s.GetVertex(u.v0),f=s.GetVertex(u.v1),p=s.GetVertex(u.v2),g=Vs(h,f,p);a.push(g),c.get(u.v0).push(l),c.get(u.v1).push(l),c.get(u.v2).push(l)}for(let l=0;l<s.TriangleCount();l++){let u=s.GetTriangle(l);if(!u.HasNormals()){let h=o(s,u,u.v0,a,c),f=o(s,u,u.v1,a,c),p=o(s,u,u.v2,a,c);
3141u.SetNormals(h,f,p)}}}let i={calculateCurveNormals:!1};for(let s=0;s<t.TriangleCount();s++){let o=t.GetTriangle(s);this.FinalizeTriangle(t,o,i),o.mat===null&&(o.mat=this.GetDefaultMaterialIndex(e))}i.calculateCurveNormals&&n(t)}FinalizeTriangle(e,t,n){if(!t.HasNormals())if(t.curve===null||t.curve===0){let i=e.GetVertex(t.v0),s=e.GetVertex(t.v1),o=e.GetVertex(t.v2),a=Vs(i,s,o),c=e.AddNormal(a);t.SetNormals(c,c,c)}else n.calculateCurveNormals=!0;t.curve===null&&(t.curve=0)}FinalizeNodes(e){let t=e.GetRootNode(),n=[];t.EnumerateChildren(i=>{i.IsEmpty()&&n.push(i)});for(let i=0;i<n.length;i++){let s=n[i],o=s.GetParent();o!==null&&(o.RemoveChildNode(s),o.IsEmpty()&&n.push(o))}}GetDefaultMaterialIndex(e){if(this.defaultMaterialIndex===null){let t=this.params.getDefaultMaterialColor(),n=new un;n.color=t,n.isDefault=!0,this.defaultMaterialIndex=e.AddMaterial(n)}return this.defaultMaterialIndex}Reset(){this.defaultMaterialIndex=null}};function ph(r,e){new Pd(e).Finalize(r)}function y0(r){function e(s){return s!=null}function t(s){return!(!e(s)||isNaN(s))}function n(s,o){return!(!t(s)||s<0||s>=o)}function i(s,o){function a(c,l,u){return!(!n(u.v0,l.VertexCount())||!n(u.v1,l.VertexCount())||!n(u.v2,l.VertexCount())||u.HasVertexColors()&&(!n(u.c0,l.VertexColorCount())||!n(u.c1,l.VertexColorCount())||!n(u.c2,l.VertexColorCount()))||!n(u.n0,l.NormalCount())||!n(u.n1,l.NormalCount())||!n(u.n2,l.NormalCount())||u.HasTextureUVs()&&(!n(u.u0,l.TextureUVCount())||!n(u.u1,l.TextureUVCount())||!n(u.u2,l.TextureUVCount()))||!n(u.mat,c.MaterialCount())||!t(u.curve))}for(let c=0;c<o.VertexCount();c++){let l=o.GetVertex(c);if(!t(l.x)||!t(l.y)||!t(l.z))return!1}for(let c=0;c<o.VertexColorCount();c++){let l=o.GetVertexColor(c);if(!t(l.r)||!t(l.g)||!t(l.b))return!1}for(let c=0;c<o.NormalCount();c++){let l=o.GetNormal(c);if(!t(l.x)||!t(l.y)||!t(l.z))return!1}for(let c=0;c<o.TextureUVCount();c++){let l=o.GetTextureUV(c);if(!t(l.x)||!t(l.y))return!1}for(let c=0;c<o.TriangleCount();c++){let l=o.GetTriangle(c);if(!a(s,o,l))return!1}return!0}for(let s=0;s<r.MeshCount();s++){let o=r.GetMesh(s);if(!i(r,o))return!1}return!0}var zt=class{constructor(){this.name=null,this.extension=null,this.callbacks=null,this.model=null,this.error=null,this.message=null}Import(e,t,n,i){this.Clear(),this.name=e,this.extension=t,this.callbacks=i,this.model=new hr,this.error=!1,this.message=null,this.ResetContent(),this.ImportContent(n,()=>{this.CreateResult(i)})}Clear(){this.name=null,this.extension=null,this.callbacks=null,this.model=null,this.error=null,this.message=null,this.ClearContent()}CreateResult(e){if(this.error){e.onError(),e.onComplete();return}if(Wo(this.model)){this.SetError("The model doesn't contain any meshes."),e.onError(),e.onComplete();return}ph(this.model,{getDefaultMaterialColor:this.callbacks.getDefaultMaterialColor}),e.onSuccess(),e.onComplete()}CanImportExtension(e){return!1}GetUpDirection(){return ct.Z}ClearContent(){}ResetContent(){}ImportContent(e,t){}GetModel(){return this.model}SetError(e){this.error=!0,e!=null&&(this.message=e)}WasError(){return this.error}GetErrorMessage(){return this.message}};function Tr(r,e,t){let n=r.substring(e),i=n.indexOf(t);return i!==-1&&(n=n.substring(0,i)),n.trim()}function Ji(r,e){if(e!==null){let t=r.indexOf(e);t!==-1&&(r=r.substring(0,t).trim())}return r.split(/\s+/u)}function Ni(r,e){function t(s,o){let a=s.trim();a.length>0&&o(a)}let n=0,i=r.indexOf(`
3142`,n);for(;i!==-1;)t(r.substring(n,i),e),n=i+1,i=r.indexOf(`
3143`,n);t(r.substring(n),e)}function Ld(r){return(r&r-1)===0}function v0(r){if(Ld(r))return r;let e=Math.pow(2,Math.ceil(Math.log(r)/Math.log(2)));return parseInt(e,10)}function ci(r){r.transparent=!1,Mo(r.opacity,1)&&(r.transparent=!0)}var li=class{constructor(e){this.model=e,this.colorToMaterialIndex=new Map}GetMaterialIndex(e,t,n,i){let s=yn(e)+yn(t)+yn(n),o=i!=null;if(o&&(s+=yn(i)),this.colorToMaterialIndex.has(s))return this.colorToMaterialIndex.get(s);{let a=new un;a.name=s.toUpperCase(),a.color=new dt(e,t,n),o&&i<255&&(a.opacity=i/255,ci(a));let c=this.model.AddMaterial(a);return this.colorToMaterialIndex.set(s,c),c}}};var Ia=class extends zt{constructor(){super(),this.rhino=null}CanImportExtension(e){return e==="3dm"}GetUpDirection(){return ct.Z}ClearContent(){this.instanceIdToObject=null,this.instanceIdToDefinition=null}
3143ResetContent(){this.instanceIdToObject=new Map,this.instanceIdToDefinition=new Map}ImportContent(e,t){this.rhino===null?ir("loaders/rhino3dm.min.js").then(()=>{rhino3dm().then(n=>{this.rhino=n,this.ImportRhinoContent(e),t()})}).catch(()=>{this.SetError("Failed to load rhino3dm."),t()}):(this.ImportRhinoContent(e),t())}ImportRhinoContent(e){let t=this.rhino.File3dm.fromByteArray(e);if(t===null){this.SetError("Failed to read Rhino file.");return}this.ImportRhinoDocument(t),Wo(this.model)&&this.SetError("The model doesn't contain any 3D meshes. Try to save the model while you are in shaded view in Rhino.")}ImportRhinoDocument(e){this.InitRhinoInstances(e),this.ImportRhinoUserStrings(e),this.ImportRhinoGeometry(e)}InitRhinoInstances(e){let t=e.objects();for(let i=0;i<t.count;i++){let s=t.get(i),o=s.attributes();o.isInstanceDefinitionObject&&this.instanceIdToObject.set(o.id,s)}let n=e.instanceDefinitions();for(let i=0;i<n.count();i++){let s=n.get(i);this.instanceIdToDefinition.set(s.id,s)}}ImportRhinoUserStrings(e){let t=e.strings();if(t.count()>0){let n=new Cn("Document user texts");for(let i=0;i<t.count();i++){let s=t.get(i);n.AddProperty(new Xt(Ht.Text,s[0],s[1]))}this.model.AddPropertyGroup(n)}}ImportRhinoGeometry(e){let t=e.objects();for(let n=0;n<t.count;n++){let i=t.get(n);this.ImportRhinoGeometryObject(e,i,[])}}ImportRhinoGeometryObject(e,t,n){let i=t.geometry(),s=t.attributes(),o=i.objectType;if(s.isInstanceDefinitionObject&&n.length===0)return;let a=null,c=!1;if(o===this.rhino.ObjectType.Mesh)a=i,c=!1;else if(o===this.rhino.ObjectType.Extrusion)a=i.getMesh(this.rhino.MeshType.Any),c=!0;else if(o===this.rhino.ObjectType.Brep){a=new this.rhino.Mesh;let l=i.faces();for(let u=0;u<l.count;u++){let h=l.get(u),f=h.getMesh(this.rhino.MeshType.Any);f&&(a.append(f),f.delete()),h.delete()}l.delete(),a.compact(),c=!0}else if(o===this.rhino.ObjectType.SubD)i.subdivide(3),a=this.rhino.Mesh.createFromSubDControlNet(i),c=!0;else if(o===this.rhino.ObjectType.InstanceReference){let l=i.parentIdefId;if(this.instanceIdToDefinition.has(l)){let h=this.instanceIdToDefinition.get(l).getObjectIds();for(let f=0;f<h.length;f++){let p=h[f];if(this.instanceIdToObject.has(p)){let g=this.instanceIdToObject.get(p);n.push(t),this.ImportRhinoGeometryObject(e,g,n),n.pop()}}}}a!==null&&(this.ImportRhinoMesh(e,a,t,n),c&&a.delete())}ImportRhinoMesh(e,t,n,i){let s=n.attributes(),o=this.GetMaterialIndex(e,n,i),a=t.toThreejsJSON(),c=Ki(a.data,o);c.SetName(s.name);let l=s.getUserStrings();if(l.length>0){let u=new Cn("User texts");for(let h=0;h<l.length;h++){let f=l[h];u.AddProperty(new Xt(Ht.Text,f[0],f[1]))}c.AddPropertyGroup(u)}if(i.length!==0){let u=new Gt().CreateIdentity();for(let f=i.length-1;f>=0;f--){let m=i[f].geometry().xform.toFloatArray(!1),d=new Gt(m);u=u.MultiplyMatrix(d)}let h=new Yt(u);cr(c,h)}this.model.AddMeshToRootNode(c)}GetMaterialIndex(e,t,n){function i(c,l,u){let h=l.attributes();if(h.materialSource===c.ObjectMaterialSource.MaterialFromObject){let f=h.materialIndex;if(f>-1)return e.materials().get(f)}else if(h.materialSource===c.ObjectMaterialSource.MaterialFromLayer){let f=h.layerIndex;if(f>-1){let g=e.layers().get(f).renderMaterialIndex;if(g>-1)return e.materials().get(g)}}else if(h.materialSource===c.ObjectMaterialSource.MaterialFromParent&&u.length!==0)return i(c,u[0],[]);return null}function s(c,l){function u(d,x){d.Set(x.r,x.g,x.b)}function h(d){return d.r===0&&d.g===0&&d.b===0}function f(d){return d.r===255&&d.g===255&&d.b===255}let p=null,g=c.physicallyBased();g.supported?(p=new ns,p.metalness=g.metallic?1:0,p.roughness=g.roughness):(p=new un,u(p.ambient,c.ambientColor),u(p.specular,c.specularColor)),p.name=c.name,u(p.color,c.diffuseColor),p.opacity=1-c.transparency,ci(p),h(p.color)&&!f(c.reflectionColor)&&u(p.color,c.reflectionColor),h(p.color)&&!f(c.transparentColor)&&u(p.color,c.transparentColor);let m=c.getBitmapTexture();if(m){let d=new ni,x=xn(m.fileName),_=l.getFileBuffer(x);d.name=x,d.buffer=_,p.diffuseMap=d}return p}function o(c,l,u){let h=s(l,u);for(let f=0;f<c.MaterialCount();f++)if(c.GetMaterial(f).IsEqual(h))return f;return c.AddMaterial(h)}let a=i(this.rhino,t,n);return a===null?null:o(this.model,a,this.callbacks)}};var Kn=class{constructor(e,t){this.arrayBuffer=e,this.dataView=new DataView(e),this.isLittleEndian=t,this.position=0}GetPosition(){return this.position}SetPosition(e){this.position=e}GetByteLength(){return this.arrayBuffer.byteLength}Skip(e){this.position=this.position+e}End(){return this.position>=this.arrayBuffer.byteLength}ReadArrayBuffer(e){let t=new Uint8Array(this.arrayBuffer),n=new ArrayBuffer(e),i=new Uint8Array(n),s=t.subarray(this.position,this.position+e);return i.set(s,0),this.position+=e,n}ReadBoolean8(){let e=this.dataView.getInt8(this.position);return this.position=this.position+1,!!e}ReadCharacter8(){let e=this.dataView.getInt8(this.position);return this.position=this.position+1,e}ReadUnsignedCharacter8(){let e=this.dataView.getUint8(this.position);return this.position=this.position+1,e}ReadInteger16(){let e=this.dataView.getInt16(this.position,this.isLittleEndian);return this.position=this.position+2,e}ReadUnsignedInteger16(){let e=this.dataView.getUint16(this.position,this.isLittleEndian);return this.position=this.position+2,e}ReadInteger32(){let e=this.dataView.getInt32(this.position,this.isLittleEndian);return this.position=this.position+4,e}ReadUnsignedInteger32(){let e=this.dataView.getUint32(this.position,this.isLittleEndian);return this.position=this.position+4,e}ReadFloat32(){let e=this.dataView.getFloat32(this.position,this.isLittleEndian);return this.position=this.position+4,e}ReadDouble64(){let e=this.dataView.getFloat64(this.position,this.isLittleEndian);return this.position=this.position+8,e}};var ht={MAIN3DS:19789,EDIT3DS:15677,EDIT_MATERIAL:45055,MAT_NAME:40960,MAT_AMBIENT:40976,MAT_DIFFUSE:40992,MAT_SPECULAR:41008,MAT_SHININESS:41024,MAT_SHININESS_STRENGTH:41025,MAT_TRANSPARENCY:41040,MAT_COLOR_F:16,MAT_
3143COLOR:17,MAT_LIN_COLOR:18,MAT_LIN_COLOR_F:19,MAT_TEXMAP:41472,MAT_TEXMAP_NAME:41728,MAT_TEXMAP_UOFFSET:41816,MAT_TEXMAP_VOFFSET:41818,MAT_TEXMAP_USCALE:41812,MAT_TEXMAP_VSCALE:41814,MAT_TEXMAP_ROTATION:41820,PERCENTAGE:48,PERCENTAGE_F:49,EDIT_OBJECT:16384,OBJ_TRIMESH:16640,OBJ_LIGHT:17920,OBJ_CAMERA:18176,TRI_VERTEX:16656,TRI_TEXVERTEX:16704,TRI_FACE:16672,TRI_TRANSFORMATION:16736,TRI_MATERIAL:16688,TRI_SMOOTH:16720,KF3DS:45056,OBJECT_NODE:45058,OBJECT_HIERARCHY:45072,OBJECT_INSTANCE_NAME:45073,OBJECT_PIVOT:45075,OBJECT_POSITION:45088,OBJECT_ROTATION:45089,OBJECT_SCALE:45090,OBJECT_ID:45104},Nd=class{constructor(){this.id=-1,this.name="",this.flags=-1,this.parentId=-1,this.instanceName="",this.pivot=[0,0,0],this.positions=[],this.rotations=[],this.scales=[]}},Od=class{constructor(){this.nodes=[],this.nodeIdToNode=new Map}IsEmpty(){return this.nodes.length===0}AddNode(e){this.nodes.push(e),this.nodeIdToNode.set(e.nodeId,e)}GetNodes(){return this.nodes}},Ra=class extends zt{constructor(){super()}CanImportExtension(e){return e==="3ds"}GetUpDirection(){return ct.Z}ClearContent(){this.materialNameToIndex=null,this.meshNameToIndex=null,this.nodeList=null}ResetContent(){this.materialNameToIndex=new Map,this.meshNameToIndex=new Map,this.nodeList=new Od}ImportContent(e,t){this.ProcessBinary(e),t()}ProcessBinary(e){let t=new Kn(e,!0),n=t.GetByteLength();this.ReadChunks(t,n,(i,s)=>{i===ht.MAIN3DS?this.ReadMainChunk(t,s):this.SkipChunk(t,s)})}ReadMainChunk(e,t){let n=this.GetChunkEnd(e,t);this.ReadChunks(e,n,(i,s)=>{i===ht.EDIT3DS?this.ReadEditorChunk(e,s):i===ht.KF3DS?this.ReadKeyFrameChunk(e,s):this.SkipChunk(e,s)}),this.BuildNodeHierarchy()}ReadEditorChunk(e,t){let n=this.GetChunkEnd(e,t);this.ReadChunks(e,n,(i,s)=>{i===ht.EDIT_MATERIAL?this.ReadMaterialChunk(e,s):i===ht.EDIT_OBJECT?this.ReadObjectChunk(e,s):this.SkipChunk(e,s)})}ReadMaterialChunk(e,t){let n=new un,i=this.GetChunkEnd(e,t),s=null,o=null;this.ReadChunks(e,i,(c,l)=>{c===ht.MAT_NAME?n.name=this.ReadName(e):c===ht.MAT_AMBIENT?n.ambient=this.ReadColorChunk(e,l):c===ht.MAT_DIFFUSE?n.color=this.ReadColorChunk(e,l):c===ht.MAT_SPECULAR?n.specular=this.ReadColorChunk(e,l):c===ht.MAT_SHININESS?s=this.ReadPercentageChunk(e,l):c===ht.MAT_SHININESS_STRENGTH?o=this.ReadPercentageChunk(e,l):c===ht.MAT_TRANSPARENCY?(n.opacity=1-this.ReadPercentageChunk(e,l),ci(n)):c===ht.MAT_TEXMAP?(n.diffuseMap=this.ReadTextureMapChunk(e,l),ci(n)):this.SkipChunk(e,l)}),s!==null&&o!==null&&(n.shininess=s*o/10);let a=this.model.AddMaterial(n);this.materialNameToIndex.set(n.name,a)}ReadTextureMapChunk(e,t){let n=new ni,i=this.GetChunkEnd(e,t);return this.ReadChunks(e,i,(s,o)=>{if(s===ht.MAT_TEXMAP_NAME){let a=this.ReadName(e),c=this.callbacks.getFileBuffer(a);n.name=a,n.buffer=c}else s===ht.MAT_TEXMAP_UOFFSET?n.offset.x=e.ReadFloat32():s===ht.MAT_TEXMAP_VOFFSET?n.offset.y=e.ReadFloat32():s===ht.MAT_TEXMAP_USCALE?n.scale.x=e.ReadFloat32():s===ht.MAT_TEXMAP_VSCALE?n.scale.y=e.ReadFloat32():s===ht.MAT_TEXMAP_ROTATION?n.rotation=e.ReadFloat32()*sr:this.SkipChunk(e,o)}),n}ReadColorChunk(e,t){let n=new dt(0,0,0),i=this.GetChunkEnd(e,t),s=!1;return this.ReadChunks(e,i,(o,a)=>{o===ht.MAT_COLOR?s||(n.r=e.ReadUnsignedCharacter8(),n.g=e.ReadUnsignedCharacter8(),n.b=e.ReadUnsignedCharacter8()):o===ht.MAT_LIN_COLOR?(n.r=e.ReadUnsignedCharacter8(),n.g=e.ReadUnsignedCharacter8(),n.b=e.ReadUnsignedCharacter8(),s=!0):o===ht.MAT_COLOR_F?s||(n.r=Sn(e.ReadFloat32()),n.g=Sn(e.ReadFloat32()),n.b=Sn(e.ReadFloat32())):o===ht.MAT_LIN_COLOR_F?(n.r=Sn(e.ReadFloat32()),n.g=Sn(e.ReadFloat32()),n.b=Sn(e.ReadFloat32()),s=!0):this.SkipChunk(e,a)}),n}ReadPercentageChunk(e,t){let n=0,i=this.GetChunkEnd(e,t);return this.ReadChunks(e,i,(s,o)=>{s===ht.PERCENTAGE?n=e.ReadUnsignedInteger16()/100:s===ht.PERCENTAGE_F?n=e.ReadFloat32():this.SkipChunk(e,o)}),n}ReadObjectChunk(e,t){let n=this.GetChunkEnd(e,t),i=this.ReadName(e);this.ReadChunks(e,n,(s,o)=>{s===ht.OBJ_TRIMESH?this.ReadMeshChunk(e,o,i):this.SkipChunk(e,o)})}ReadMeshChunk(e,t,n){function i(u,h){if(!h.IsValid())return;let f=h.Determinant(),p=Rr(f);p&&(h=new Gt().CreateScale(-1,1,1).MultiplyMatrix(h));let g=h.Invert();if(g===null)return;let m=new Yt(g);cr(u,m),p&&ru(u)}let s=new jt;s.SetName(n);let o=this.GetChunkEnd(e,t),a=null;if(this.ReadChunks(e,o,(u,h)=>{u===ht.TRI_VERTEX?this.ReadVerticesChunk(s,e):u===ht.TRI_TEXVERTEX?this.ReadTextureVerticesChunk(s,e):u===ht.TRI_FACE?this.ReadFacesChunk(s,e,h):u===ht.TRI_TRANSFORMATION?a=this.ReadTransformationChunk(e):this.SkipChunk(e,h)}),s.VertexCount()===s.TextureUVCount())for(let u=0;u<s.TriangleCount();u++){let h=s.GetTriangle(u);h.SetTextureUVs(h.v0,h.v1,h.v2)}let c=new Gt(a);i(s,c);let l=this.model.AddMesh(s);this.meshNameToIndex.set(s.GetName(),l)}ReadVerticesChunk(e,t){let n=t.ReadUnsignedInteger16();for(let i=0;i<n;i++){let s=t.ReadFloat32(),o=t.ReadFloat32(),a=t.ReadFloat32();e.AddVertex(new Ve(s,o,a))}}ReadTextureVerticesChunk(e,t){let n=t.ReadUnsignedInteger16();for(let i=0;i<n;i++){let s=t.ReadFloat32(),o=t.ReadFloat32();e.AddTextureUV(new wt(s,o))}}ReadFacesChunk(e,t,n){let i=this.GetChunkEnd(t,n),s=t.ReadUnsignedInteger16();for(let o=0;o<s;o++){let a=t.ReadUnsignedInteger16(),c=t.ReadUnsignedInteger16(),l=t.ReadUnsignedInteger16();t.ReadUnsignedInteger16(),e.AddTriangle(new Bt(a,c,l))}this.ReadChunks(t,i,(o,a)=>{o===ht.TRI_MATERIAL?this.ReadFaceMaterialsChunk(e,t):o===ht.TRI_
3143SMOOTH?this.ReadFaceSmoothingGroupsChunk(e,s,t):this.SkipChunk(t,a)})}ReadFaceMaterialsChunk(e,t){let n=this.ReadName(t),i=this.materialNameToIndex.get(n),s=t.ReadUnsignedInteger16();for(let o=0;o<s;o++){let a=t.ReadUnsignedInteger16(),c=e.GetTriangle(a);i!==void 0&&(c.mat=i)}}ReadFaceSmoothingGroupsChunk(e,t,n){for(let i=0;i<t;i++){let s=n.ReadUnsignedInteger32(),o=e.GetTriangle(i);o.curve=s}}ReadTransformationChunk(e){let t=[];for(let n=0;n<4;n++){for(let i=0;i<3;i++)t.push(e.ReadFloat32());n<3?t.push(0):t.push(1)}return t}ReadKeyFrameChunk(e,t){let n=this.GetChunkEnd(e,t);this.ReadChunks(e,n,(i,s)=>{i===ht.OBJECT_NODE?this.ReadObjectNodeChunk(e,s):this.SkipChunk(e,s)})}BuildNodeHierarchy(){function e(n,i){function s(l){return l.positions.length===0?[0,0,0]:l.positions[0]}function o(l){function u(f){let p=[0,0,0,1],g=Math.sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2]);if(g>0){let m=f[3]*-.5,d=Math.sin(m)/g;p=[d*f[0],d*f[1],d*f[2],Math.cos(m)]}return p}if(l.rotations.length===0)return[0,0,0,1];let h=l.rotations[0];return u(h)}function a(l){return l.scales.length===0?[1,1,1]:l.scales[0]}let c=new Gt;if(c.ComposeTRS(is(s(n)),No(o(n)),is(a(n))),i){let l=n.pivot;c=new Gt().CreateTranslation(-l[0],-l[1],-l[2]).MultiplyMatrix(c)}return new Yt(c)}let t=this.model.GetRootNode();if(this.nodeList.IsEmpty())for(let n=0;n<this.model.MeshCount();n++)t.AddMeshIndex(n);else{let n=new Map;for(let i of this.nodeList.GetNodes()){let s=new In;i.name.length>0&&i.name!=="$$$DUMMY"&&(s.SetName(i.name),i.instanceName.length>0&&s.SetName(s.GetName()+" "+i.instanceName)),i.parentId===65535||!n.has(i.parentId)?t.AddChildNode(s):n.get(i.parentId).AddChildNode(s),n.set(i.id,s);let o=this.meshNameToIndex.has(i.name);s.SetTransformation(e(i,o)),o&&(s.SetType(gi.MeshNode),s.AddMeshIndex(this.meshNameToIndex.get(i.name)))}}}ReadObjectNodeChunk(e,t){function n(o,a,c){let l=[];a.Skip(10);let u=a.ReadInteger32();for(let h=0;h<u;h++){a.ReadInteger32(),a.ReadUnsignedInteger16()!==0&&a.ReadFloat32();let p=null;if(c===ht.OBJECT_ROTATION){let g=a.ReadFloat32();p=o.ReadVector(a),p[3]=g}else p=o.ReadVector(a);l.push(p)}return l}let i=new Nd,s=this.GetChunkEnd(e,t);this.ReadChunks(e,s,(o,a)=>{o===ht.OBJECT_HIERARCHY?(i.name=this.ReadName(e),i.flags=e.ReadUnsignedInteger32(),i.parentId=e.ReadUnsignedInteger16()):o===ht.OBJECT_INSTANCE_NAME?i.instanceName=this.ReadName(e):o===ht.OBJECT_PIVOT?i.pivot=this.ReadVector(e):o===ht.OBJECT_POSITION?i.positions=n(this,e,ht.OBJECT_POSITION):o===ht.OBJECT_ROTATION?i.rotations=n(this,e,ht.OBJECT_ROTATION):o===ht.OBJECT_SCALE?i.scales=n(this,e,ht.OBJECT_SCALE):o===ht.OBJECT_ID?i.id=e.ReadUnsignedInteger16():this.SkipChunk(e,a)}),this.nodeList.AddNode(i)}ReadName(e){let t="",n=0,i=0;for(;i<64&&(n=e.ReadCharacter8(),n!==0);)t=t+String.fromCharCode(n),i=i+1;return t}ReadVector(e){return[e.ReadFloat32(),e.ReadFloat32(),e.ReadFloat32()]}ReadChunks(e,t,n){for(;e.GetPosition()<=t-6;){let i=e.ReadUnsignedInteger16(),s=e.ReadUnsignedInteger32();n(i,s)}}GetChunkEnd(e,t){return e.GetPosition()+t-6}SkipChunk(e,t){e.Skip(t-6)}};var ui={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126},$i={SCALAR:0,VEC2:1,VEC3:2,VEC4:3,MAT2:4,MAT3:5,MAT4:6},ho={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Dd={GLTF_STRING:1179937895,JSON_CHUNK_TYPE:1313821514,BINARY_CHUNK_TYPE:5130562};function sc(r){return di(Bs(r[0]),Bs(r[1]),Bs(r[2]))}function U1(r,e){function t(n,i){let s=n;return i===ui.UNSIGNED_BYTE?s/=255:i===ui.UNSIGNED_SHORT&&(s/=65535),Sn(Bs(s))}return new dt(t(r[0],e),t(r[1],e),t(r[2],e))}var kd=class{constructor(e){this.reader=new Kn(e,!0),this.componentType=null,this.dataType=null,this.byteStride=null,this.dataCount=null,this.sparseReader=null}SetComponentType(e){this.componentType=e}SetDataType(e){e==="SCALAR"?this.dataType=$i.SCALAR:e==="VEC2"?this.dataType=$i.VEC2:e==="VEC3"?this.dataType=$i.VEC3:e==="VEC4"?this.dataType=$i.VEC4:e==="MAT2"?this.dataType=$i.MAT2:e==="MAT3"?this.dataType=$i.MAT3:e==="MAT4"&&(this.dataType=$i.MAT4)}SetByteStride(e){this.byteStride=e}SetDataCount(e){this.dataCount=e}SetSparseReader(e,t){this.sparseReader={indexReader:e,valueReader:t}}ReadArrayBuffer(e){return this.reader.ReadArrayBuffer(e)}GetDataCount(){return this.dataCount}ReadData(){if(this.dataType===null)return null;if(this.dataType===$i.SCALAR){let e=this.ReadComponent();return this.SkipBytesByStride(1),e}else if(this.dataType===$i.VEC2){let e=this.ReadComponent(),t=this.ReadComponent();return this.SkipBytesByStride(2),new wt(e,t)}else if(this.dataType===$i.VEC3){let e=this.ReadComponent(),t=this.ReadComponent(),n=this.ReadComponent();return this.SkipBytesByStride(3),new Ve(e,t,n)}else if(this.dataType===$i.VEC4){let e=this.ReadComponent(),t=this.ReadComponent(),n=this.ReadComponent(),i=this.ReadComponent();return this.SkipBytesByStride(4),new mi(e,t,n,i)}return null}EnumerateData(e){if(this.sparseReader===null)for(let t=0;t<this.dataCount;t++)e(this.ReadData());else{let t=[];for(let i=0;i<this.sparseReader.indexReader.GetDataCount();i++){let s=this.sparseReader.indexReader.ReadData(),o=this.sparseReader.valueReader.ReadData();t.push({index:s,value:o})}let n=0;for(let i=0;i<this.dataCount;i++){let s=this.ReadData();n<t.length&&t[n].index===i?(e(t[n].value),n+=1):e(s)}}}SkipBytes(e){this.reader.Skip(e)}ReadComponent(){return this.componentType===null?null:this.componentType===ui.BYTE?this.reader.ReadCharacter8():this.componentType===ui.UNSIGNED_BYTE?this.reader.ReadUnsignedCharacter8():this.componentType===ui.SHORT?this.reader.ReadInteger16():this.componentType===ui.UNSIGNED_SHORT?this.reader.ReadUnsignedInteger16():this.componentType===ui.UNSIGNED_INT?this.reader.ReadInteger32():this.componentType===ui.FLOAT?this.reader.ReadFloat32():null}SkipBytesByStride(e){if(this.byteStride===null)return;let t=e*this.GetComponentSize();this.reader.Skip(this.byteStride-t)}GetComponentSize(){return this.componentType===ui.BYTE||this.componentType===ui.UNSIGNED_BYTE?1:this.componentType===ui.SHORT||this.componentType===ui.UNSIGNED_SHORT?2:this.componentType===ui.UNSIGNED_INT||this.componentType===ui.FLOAT?4:0}},Fd=class{constructor(){this.supportedExtensions=["KHR_draco_mesh_compression","KHR_materials_pbrSpecularGlossiness","KHR_texture_transform"],this.draco=null}LoadLibraries(e,t){if(e===void 0){t.onSuccess();return}this.draco===null&&e.indexOf("KHR_draco_mesh_compression")!==-1?ir("loaders/draco_decoder.js").then(()=>{DracoDecoderModule().then(n=>{this.draco=n,t.onSuccess()})}).catch(()=>{t.onError("Failed to load draco decoder.")}):t.onSuccess()}GetUnsupportedExtensions(e){let t=[];if(e===void 0)return t;for(let n=0;n<e.length;n++){let i=e[n];this.supportedExtensions.indexOf(i)===-1&&t.push(i)}return t}ProcessMaterial(e,t,n){if(e.extensions===void 0)return null;let i=e.extensions.KHR_materials_pbrSpecularGlossiness;if(i===void 0)return null;let s=new un,o=i.diffuseFactor;o!==void 0&&(s.color=sc(o),s.opacity=o[3]);let a=i.diffuseTexture;a!==void 0&&(s.diffuseMap=n(a));let c=i.specularFactor;c!==void 0&&(s.specular=sc(c));let l=i.specularGlossinessTexture;l!==void 0&&(s.specularMap=n(l));let u=i.glossinessFactor;return u!==void 0&&(s.shininess=u),s}ProcessTexture(e,t){if(e.extensions===void 0)return;let n=e.extensions.KHR_texture_transform;n!==void 0&&(n.offset!==void 0&&(t.offset.x=n.offset[0],t.offset.y=-n.offset[1]),n.scale!==void 0&&(t.scale.x=n.scale[0],t.scale.y=n.scale[1]),n.rotation!==void 0&&(t.rotation=-n.rotation))}ProcessPrimitive(e,t,n,i){function s(F,U,P,$,H){let Z=U.GetAttributeByUniqueId(P,$),W=Z.num_components(),ue=P.num_points()*W,ne=ue*4,le=F._malloc(ne);U.GetAttributeDataArrayForAllPoints(P,Z,F.DT_FLOAT32,ne,le);let he=new Float32Array(F.HEAPF32.buffer,le,ue).slice();if(W===2)for(let I=0;I<he.length;I+=2)H(new wt(he[I+0],he[I+1]));else if(W===3)for(let I=0;I<he.length;I+=3)H(new Ve(he[I+0],he[I+1],he[I+2]));else if(W===4)for(let I=0;I<he.length;I+=4)H(new mi(he[I+0],he[I+1],he[I+2],he[I+3]));F._free(le)}if(this.draco===null||n.extensions===void 0||n.extensions.KHR_draco_mesh_compression===void 0)return!1;let o=new this.draco.Decoder,a=new this.draco.DecoderBuffer,c=n.extensions.KHR_draco_mesh_compression,l=t.bufferViews[c.bufferView],h=e.GetReaderFromBufferView(l).ReadArrayBuffer(l.byteLength);if(a.Init(new Int8Array(h),h.byteLength),o.GetEncodedGeometryType(a)!==this.draco.TRIANGULAR_MESH)return!0;let p=new this.draco.Mesh;if(!o.DecodeBufferToMesh(a,p).ok())return!0;let m=c.attributes.POSITION!==void 0,d=!1,x=c.attributes.NORMAL!==void 0,_=c.attributes.TEXCOORD_0!==void 0;if(!m)return!0;let v=i.VertexCount(),y=i.VertexColorCount(),w=i.NormalCount(),L=i.TextureUVCount();s(this.draco,o,p,c.attributes.POSITION,F=>{i.AddVertex(F)}),x&&s(this.draco,o,p,c.attributes.NORMAL,F=>{i.AddNormal(F)}),_&&s(this.draco,o,p,c.attributes.TEXCOORD_0,F=>{F.y=-F.y,i.AddTextureUV(F)});let b=p.num_faces()*3,A=b*4,N=this.draco._malloc(A);o.GetTrianglesUInt32Array(p,A,N);let G=new Uint32Array(this.draco.HEAPU32.buffer,N,b).slice();for(let F=0;F<G.length;F+=3){let U=G[F],P=G[F+1],$=G[F+2];e.AddTriangle(n,i,U,P,$,d,x,_,v,y,w,L)}return this.draco._free(N),!0}},Pa=class extends zt{constructor(){super(),this.gltfExtensions=new Fd}CanImportExtension(e){return e==="gltf"||e==="glb"}GetUpDirection(){return ct.Y}ClearContent(){this.bufferContents=null,this.imageIndexToTextureParam
3143s=null}ResetContent(){this.bufferContents=[],this.imageIndexToTextureParams=new Map}ImportContent(e,t){this.extension==="gltf"?this.ProcessGltf(e,t):this.extension==="glb"&&this.ProcessBinaryGltf(e,t)}ProcessGltf(e,t){let n=hn(e),i=JSON.parse(n);if(i.asset.version!=="2.0"){this.SetError("Invalid glTF version."),t();return}for(let s=0;s<i.buffers.length;s++){let o=null,a=i.buffers[s],c=Gs(a.uri);if(c!==null)o=c.buffer;else{let l=this.callbacks.getFileBuffer(a.uri);l!==null&&(o=l)}if(o===null){this.SetError("One of the requested buffers is missing."),t();return}this.bufferContents.push(o)}this.ProcessMainFile(i,t)}ProcessBinaryGltf(e,t){function n(l){let u=l.ReadUnsignedInteger32(),h=l.ReadUnsignedInteger32(),f=l.ReadArrayBuffer(u);return{type:h,buffer:f}}let i=new Kn(e,!0);if(i.ReadUnsignedInteger32()!==Dd.GLTF_STRING){this.SetError("Invalid glTF file."),t();return}if(i.ReadUnsignedInteger32()!==2){this.SetError("Invalid glTF version."),t();return}if(i.ReadUnsignedInteger32()!==i.GetByteLength()){this.SetError("Invalid glTF file."),t();return}let c=null;for(;!i.End();){let l=n(i);l.type===Dd.JSON_CHUNK_TYPE?c=hn(l.buffer):l.type===Dd.BINARY_CHUNK_TYPE&&this.bufferContents.push(l.buffer)}if(c!==null){let l=JSON.parse(c);this.ProcessMainFile(l,t)}}ProcessMainFile(e,t){let n=this.gltfExtensions.GetUnsupportedExtensions(e.extensionsRequired);if(n.length>0){this.SetError("Unsupported extension: "+n.join(", ")+"."),t();return}this.gltfExtensions.LoadLibraries(e.extensionsRequired,{onSuccess:()=>{this.ImportModel(e),t()},onError:i=>{this.SetError(i),t()}})}ImportModel(e){let t=e.materials;if(t!==void 0)for(let i of t)this.ImportMaterial(e,i);let n=e.meshes;if(n!==void 0)for(let i of n)this.ImportMesh(e,i);this.ImportNodes(e),this.ImportModelProperties(e)}ImportModelProperties(e){function t(n,i,s){let o=new Cn(i);for(let a in s)if(Object.prototype.hasOwnProperty.call(s,a)&&typeof s[a]=="string"){let c=new Xt(Ht.Text,a,s[a]);o.AddProperty(c)}return o.PropertyCount()>0&&n.AddPropertyGroup(o),o}t(this.model,"Asset properties",e.asset),e.asset.extras&&t(this.model,"Extras",e.asset.extras)}GetDefaultScene(e){let t=e.scene||0;return t>=e.scenes.length?null:e.scenes[t]}ImportMaterial(e,t){let n=new ns;if(t.name!==void 0&&(n.name=t.name),n.color=sc([1,1,1]),t.pbrMetallicRoughness!==void 0){let s=t.pbrMetallicRoughness.baseColorFactor;s!==void 0&&(n.color=sc(s),n.opacity=s[3]);let o=t.pbrMetallicRoughness.metallicFactor;o!==void 0&&(n.metalness=o);let a=t.pbrMetallicRoughness.roughnessFactor;a!==void 0&&(n.roughness=a);let c=t.emissiveFactor;c!==void 0&&(n.emissive=sc(c)),n.diffuseMap=this.ImportTexture(e,t.pbrMetallicRoughness.baseColorTexture),n.metalnessMap=this.ImportTexture(e,t.pbrMetallicRoughness.metallicRoughnessTexture),n.normalMap=this.ImportTexture(e,t.normalTexture),n.emissiveMap=this.ImportTexture(e,t.emissiveTexture),n.diffuseMap!==null&&(n.multiplyDiffuseMap=!0);let l=t.alphaMode;l!==void 0&&(l==="BLEND"?n.transparent=!0:l==="MASK"&&(n.transparent=!0,n.alphaTest=t.alphaCutoff||.5))}let i=this.gltfExtensions.ProcessMaterial(t,n,s=>this.ImportTexture(e,s));i!==null&&(n=i),this.model.AddMaterial(n)}ImportTexture(e,t){if(t==null)return null;let n=new ni,s=e.textures[t.index].source,o=e.images[s],a=null;if(this.imageIndexToTextureParams.has(s))a=this.imageIndexToTextureParams.get(s);else{a={name:null,mimeType:null,buffer:null};let c=s.toString();if(o.uri!==void 0){let l=Gs(o.uri);if(l!==null)a.name="Embedded_"+c+"."+rs(l.mimeType),a.mimeType=l.mimeType,a.buffer=l.buffer;else{let u=this.callbacks.getFileBuffer(o.uri);a.name=o.uri,a.buffer=u}}else if(o.bufferView!==void 0){let l=e.bufferViews[o.bufferView],u=this.GetReaderFromBufferView(l);if(u!==null){let h=u.ReadArrayBuffer(l.byteLength);a.name="Binary_"+c+"."+rs(o.mimeType),a.mimeType=o.mimeType,a.buffer=h}}this.imageIndexToTextureParams.set(s,a)}return n.name=a.name,n.mimeType=a.mimeType,n.buffer=a.buffer,this.gltfExtensions.ProcessTexture(t,n),n}ImportMesh(e,t){let n=new jt;this.model.AddMesh(n),t.name!==void 0&&n.SetName(t.name);for(let i=0;i<t.primitives.length;i++){let s=t.primitives[i];this.ImportPrimitive(e,s,n)}}ImportPrimitive(e,t,n){function i(d,x,_){let v=x.attributes[_];if(v===void 0)return!1;let y=d.accessors[v];return!(y===void 0||y.count===0)}if(this.gltfExtensions.ProcessPrimitive(this,e,t,n)||t.attributes===void 0)return;let s=i(e,t,"POSITION"),o=i(e,t,"COLOR_0"),a=i(e,t,"NORMAL"),c=i(e,t,"TEXCOORD_0"),l=t.indices!==void 0,u=ho.TRIANGLES;if(t.mode!==void 0&&(u=t.mode),u!==ho.TRIANGLES&&u!==ho.TRIANGLE_STRIP&&u!==ho.TRIANGLE_FAN)return;let h=n.VertexCount(),f=n.VertexColorCount(),p=n.NormalCount(),g=n.TextureUVCount();if(s){let d=e.accessors[t.attributes.POSITION],x=this.GetReaderFromAccessor(e,d);if(x===null)return;x.EnumerateData(_=>{n.AddVertex(_)})}else return;if(o){let d=e.accessors[t.attributes.COLOR_0],x=this.GetReaderFromAccessor(e,d);if(x===null)return;x.EnumerateData(_=>{let v=U1([_.x,_.y,_.z],x.componentType);n.AddVertexColor(v)})}if(a){let d=e.accessors[t.attributes.NORMAL],x=this.GetReaderFromAccessor(e,d);if(x===null)return;x.EnumerateData(_=>{n.AddNormal(_)})}if(c){let d=e.accessors[t.attributes.TEXCOORD_0],x=this.GetReaderFromAccessor(e,d);if(x===null)return;x.EnumerateData(_=>{_.y=-_.y,n.AddTextureUV(_)})}let m=[];
3143if(l){let d=e.accessors[t.indices],x=this.GetReaderFromAccessor(e,d);if(x===null)return;x.EnumerateData(_=>{m.push(_)})}else{let d=n.VertexCount()-h;for(let x=0;x<d;x++)m.push(x)}if(u===ho.TRIANGLES)for(let d=0;d<m.length;d+=3){let x=m[d],_=m[d+1],v=m[d+2];this.AddTriangle(t,n,x,_,v,o,a,c,h,f,p,g)}else if(u===ho.TRIANGLE_STRIP)for(let d=0;d<m.length-2;d++){let x=m[d],_=m[d+1],v=m[d+2];if(d%2===1){let y=_;_=v,v=y}this.AddTriangle(t,n,x,_,v,o,a,c,h,f,p,g)}else if(u===ho.TRIANGLE_FAN)for(let d=1;d<m.length-1;d++){let x=m[0],_=m[d],v=m[d+1];this.AddTriangle(t,n,x,_,v,o,a,c,h,f,p,g)}}AddTriangle(e,t,n,i,s,o,a,c,l,u,h,f){let p=new Bt(l+n,l+i,l+s);o&&p.SetVertexColors(u+n,u+i,u+s),a&&p.SetNormals(h+n,h+i,h+s),c&&p.SetTextureUVs(f+n,f+i,f+s),e.material!==void 0&&(p.mat=e.material),t.AddTriangle(p)}ImportNodes(e){let t=this.GetDefaultScene(e);if(t===null)return;let n=this.model.GetRootNode();for(let i of t.nodes){let s=e.nodes[i];this.ImportNode(e,s,n)}}ImportNode(e,t,n){function i(o){let a=new Gt().CreateIdentity();if(o.matrix!==void 0)a.Set(o.matrix);else{let c=[0,0,0],l=[0,0,0,1],u=[1,1,1];o.translation!==void 0&&(c=o.translation),o.rotation!==void 0&&(l=o.rotation),o.scale!==void 0&&(u=o.scale),a.ComposeTRS(is(c),No(l),is(u))}return new Yt(a)}if(t.children===void 0&&t.mesh===void 0)return;let s=new In;if(t.name!==void 0&&s.SetName(t.name),s.SetTransformation(i(t)),n.AddChildNode(s),t.children!==void 0)for(let o of t.children){let a=e.nodes[o];this.ImportNode(e,a,s)}t.mesh!==void 0&&((t.children===void 0||t.children.length===0)&&s.SetType(gi.MeshNode),s.AddMeshIndex(t.mesh))}GetReaderFromBufferView(e){let t=e.buffer||0,n=this.bufferContents[t];if(n==null)return null;let i=new kd(n);i.SkipBytes(e.byteOffset||0);let s=e.byteStride;return s!==void 0&&s!==0&&i.SetByteStride(s),i}GetReaderFromAccessor(e,t){let n=t.bufferView||0,i=e.bufferViews[n],s=this.GetReaderFromBufferView(i);if(s===null)return null;if(s.SetComponentType(t.componentType),s.SetDataType(t.type),s.SetDataCount(t.count),s.SkipBytes(t.byteOffset||0),t.sparse!==void 0){let o=this.GetReaderFromSparseAccessor(e,t.sparse.indices,t.sparse.indices.componentType,"SCALAR",t.sparse.count),a=this.GetReaderFromSparseAccessor(e,t.sparse.values,t.componentType,t.type,t.sparse.count);o!==null&&a!==null&&s.SetSparseReader(o,a)}return s}GetReaderFromSparseAccessor(e,t,n,i,s){if(t.bufferView===void 0)return null;let o=e.bufferViews[t.bufferView],a=this.GetReaderFromBufferView(o);return a===null?null:(a.SetComponentType(n),a.SetDataType(i),a.SetDataCount(s),a.SkipBytes(t.byteOffset||0),a)}};var La=class extends zt{constructor(){super(),this.ifc=null}CanImportExtension(e){return e==="ifc"}GetUpDirection(){return ct.Y}ClearContent(){this.expressIDToMesh=null,this.colorToMaterial=null}ResetContent(){this.expressIDToMesh=new Map,this.colorToMaterial=new li(this.model)}ImportContent(e,t){this.ifc===null?ir("loaders/web-ifc-api-browser.js").then(()=>{this.ifc=new WebIFC.IfcAPI,this.ifc.Init().then(()=>{this.ImportIfcContent(e),t()})}).catch(()=>{this.SetError("Failed to load web-ifc."),t()}):(this.ImportIfcContent(e),t())}ImportIfcContent(e){let t=new Uint8Array(e),n=this.ifc.OpenModel(t,{COORDINATE_TO_ORIGIN:!0}),i=this.ifc.LoadAllGeometry(n);for(let s=0;s<i.size();s++){let o=i.get(s);o.geometries.size()>0&&this.ImportIfcMesh(n,o)}this.ImportProperties(n),this.ifc.CloseModel(n)}ImportIfcMesh(e,t){let n=new jt;n.SetName("Mesh "+t.expressID.toString());let i=0,s=t.geometries;for(let o=0;o<s.size();o++){let a=s.get(o),c=this.ifc.GetGeometry(e,a.geometryExpressID),l=this.ifc.GetVertexArray(c.GetVertexData(),c.GetVertexDataSize()),u=this.ifc.GetIndexArray(c.GetIndexData(),c.GetIndexDataSize()),h=this.GetMaterialIndexByColor(a.color),f=new Gt(a.flatTransformation),p=new Yt(f);for(let g=0;g<l.length;g+=6){let m=l[g],d=l[g+1],x=l[g+2],_=new Ve(m,d,x),v=p.TransformCoord3D(_);n.AddVertex(v)}for(let g=0;g<u.length;g+=3){let m=u[g],d=u[g+1],x=u[g+2],_=new Bt(i+m,i+d,i+x);_.SetMaterial(h),n.AddTriangle(_)}i+=l.length/6}this.expressIDToMesh.set(t.expressID,n),this.model.AddMeshToRootNode(n)}ImportProperties(e){let t=this.ifc.GetLineIDsWithType(e,WebIFC.IFCRELDEFINESBYPROPERTIES);for(let n=0;n<t.size();n++){let i=t.get(n),s=this.ifc.GetLine(e,i);Array.isArray(s.RelatingPropertyDefinition)||s.RelatedObjects.forEac
3143h(o=>{let a=null;if(this.expressIDToMesh.has(o.value)?a=this.expressIDToMesh.get(o.value):this.ifc.GetLine(e,o.value,!0).type===WebIFC.IFCBUILDING&&(a=this.model),a===null)return;let c=s.RelatingPropertyDefinition,l=this.ifc.GetLine(e,c.value,!0);if(!l||!l.HasProperties)return;let u=new Cn(l.Name.value);l.HasProperties.forEach(h=>{if(!h||!h.Name||!h.NominalValue)return;let f=null,p=this.GetIFCString(h.Name.value),g=null;switch(h.NominalValue.label){case"IFCTEXT":case"IFCLABEL":case"IFCIDENTIFIER":f=new Xt(Ht.Text,p,this.GetIFCString(h.NominalValue.value));break;case"IFCBOOLEAN":case"IFCLOGICAL":g="Unknown",h.NominalValue.value==="T"?g="True":h.NominalValue.value==="F"&&(g="False"),f=new Xt(Ht.Text,p,g);break;case"IFCINTEGER":case"IFCCOUNTMEASURE":f=new Xt(Ht.Integer,p,h.NominalValue.value);break;case"IFCREAL":case"IFCLENGTHMEASURE":case"IFCPOSITIVELENGTHMEASURE":case"IFCAREAMEASURE":case"IFCVOLUMEMEASURE":case"IFCRATIOMEASURE":case"IFCPOSITIVERATIOMEASURE":case"IFCMASSMEASURE":case"IFCMASSPERLENGTHMEASURE":case"IFCPLANEANGLEMEASURE":case"IFCTHERMALTRANSMITTANCEMEASURE":f=new Xt(Ht.Number,p,h.NominalValue.value);break;default:console.log(h.NominalValue.label),console.log(h.NominalValue.value);break}f!==null&&u.AddProperty(f)}),u.PropertyCount()>0&&a.AddPropertyGroup(u)})}}GetMaterialIndexByColor(e){let t=di(e.x,e.y,e.z),n=parseInt(e.w*255,10);return this.colorToMaterial.GetMaterialIndex(t.r,t.g,t.b,n)}GetIFCString(e){let t=this.DecodeIFCString(e);return t.length===0&&(t="-"),t}DecodeIFCString(e){let t=/\\X2\\(.*?)\\X0\\/uig,n=e,i=t.exec(e);for(;i;){let s=String.fromCharCode(parseInt(i[1],16));n=n.replace(i[0],s),i=t.exec(e)}return n}};var Ud=class{constructor(e){this.mesh=e,this.globalToMeshVertices=new Map,this.globalToMeshVertexColors=new Map,this.globalToMeshNormals=new Map,this.globalToMeshUvs=new Map}AddVertex(e,t){return this.GetLocalIndex(e,t,this.globalToMeshVertices,n=>this.mesh.AddVertex(new Ve(n.x,n.y,n.z)))}AddVertexColor(e,t){return this.GetLocalIndex(e,t,this.globalToMeshVertexColors,n=>this.mesh.AddVertexColor(new dt(n.r,n.g,n.b)))}AddNormal(e,t){return this.GetLocalIndex(e,t,this.globalToMeshNormals,n=>this.mesh.AddNormal(new Ve(n.x,n.y,n.z)))}AddUV(e,t){return this.GetLocalIndex(e,t,this.globalToMeshUvs,n=>this.mesh.AddTextureUV(new wt(n.x,n.y)))}AddTriangle(e){this.mesh.AddTriangle(e)}GetLocalIndex(e,t,n,i){if(isNaN(e)||e<0||e>=t.length)return null;if(n.has(e))return n.get(e);{let s=t[e],o=i(s);return n.set(e,o),o}}};function mh(r,e,t){return di(parseFloat(r),parseFloat(e),parseFloat(t))}var Na=class extends zt{constructor(){super()}CanImportExtension(e){return e==="obj"}GetUpDirection(){return ct.Y}ClearContent(){this.globalVertices=null,this.globalVertexColors=null,this.globalNormals=null,this.globalUvs=null,this.currentMeshConverter=null,this.currentMaterial=null,this.currentMaterialIndex=null,this.meshNameToConverter=null,this.materialNameToIndex=null}ResetContent(){this.globalVertices=[],this.globalVertexColors=[],this.globalNormals=[],this.globalUvs=[],this.currentMeshConverter=null,this.currentMaterial=null,this.currentMaterialIndex=null,this.meshNameToConverter=new Map,this.materialNameToIndex=new Map}ImportContent(e,t){let n=hn(e);Ni(n,i=>{this.WasError()||this.ProcessLine(i)}),t()}ProcessLine(e){if(e[0]==="#")return;let t=Ji(e,"#");if(t.length===0)return;let n=t[0].toLowerCase();t.shift(),!this.ProcessMeshParameter(n,t,e)&&this.ProcessMaterialParameter(n,t,e)}AddNewMesh(e){if(this.meshNameToConverter.has(e))this.currentMeshConverter=this.meshNameToConverter.get(e);else{let t=new jt;t.SetName(e),this.model.AddMeshToRootNode(t),this.currentMeshConverter=new Ud(t),this.meshNameToConverter.set(e,this.currentMeshConverter)}}ProcessMeshParameter(e,t,n){if(e==="g"||e==="o"){if(t.length===0)return!0;let i=Tr(n,e.length,"#");return this.AddNewMesh(i),!0}else{if(e==="v")return t.length<3||(this.globalVertices.push(new Ve(parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2]))),t.length>=6&&this.globalVertexColors.push(mh(t[3],t[4],t[5]))),!0;if(e==="vn")return t.length<3||this.globalNormals.push(new Ve(parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2]))),!0;if(e==="vt")return t.length<2||this.globalUvs.push(new wt(parseFloat(t[0]),parseFloat(t[1]))),!0;if(e==="f")return t.length<3||this.ProcessFace(t),!0}return!1}ProcessMaterialParameter(e,t,n){function i(s,o,a){let c=new ni,l=Tr(o,s.length,"#"),u=a.getFileBuffer(l);return c.name=l,c.buffer=u,c}if(e==="newmtl"){if(t.length===0)return!0;let s=new un,o=Tr(n,e.length,"#"),a=this.model.AddMaterial(s);return s.name=o,this.currentMaterial=s,this.materialNameToIndex.set(o,a),!0}else if(e==="usemtl"){if(t.length===0)return!0;let s=Tr(n,e.length,"#");return this.materialNameToIndex.has(s)&&(this.currentMaterialIndex=this.materialNameToIndex.get(s)),!0}else if(e==="mtllib"){if(t.length===0)return!0;let s=Tr(n,e.length,"#"),o=this.callbacks.getFileBuffer(s);if(o!==null){let a=hn(o);Ni(a,c=>{this.WasError()||this.ProcessLine(c)})}return!0}else{if(e==="map_kd")return this.currentMaterial===null||t.length===0||(this.currentMaterial.diffuseMap=i(e,n,this.callbacks),ci(this.currentMaterial)),!0;if(e==="map_ks")return this.currentMaterial===null||t.length===0||(this.currentMaterial.specularMap=i(e,n,this.callbacks)),!0;if(e==="map_bump"||e==="bump")return this.currentMaterial===null||t.length===0||(this.currentMaterial.bumpMap=i(e,n,this.callbacks)),!0;if(e==="ka")return this.currentMaterial===null||t.length<3||(this.currentMaterial.ambient=mh(t[0],t[1],t[2])),!0;if(e==="kd")return this.currentMaterial===null||t.length<3||(this.currentMaterial.color=mh(t[0],t[1],t[2])),!0;if(e==="ks")return this.currentMaterial===null||t.length<3||(this.currentMaterial.specular=mh(t[0],t[1],t[2])),!0;if(e==="ns")return this.currentMaterial===null||t.length<1||(this.currentMaterial.shininess=parseFloat(t[0])/1e3),!0;if(e==="tr")return this.currentMaterial===null||t.length<1||(this.currentMaterial.opacity=1-parseFloat(t[0]),ci(this.currentMaterial)),!0;if(e==="d")return this.currentMaterial===null||t.length<1||(this.currentMaterial.opacity=parseFloat(t[0]),ci(this.currentMaterial)),!0}return!1}ProcessFace(e){function t(a,c){return a>0?a-1:c+a}let n=[],i=[],s=[],o=[];for(let a=0;a<e.length;a++){let c=e[a].split("/");n.push(t(parseInt(c[0],10),this.globalVertices.length)),this.globalVertices.length===this.globalVertexColors.length&&i.push(t(parseInt(c[0],10),this.globalVertices.length)),c.length>1&&c[1].length>0&&o.push(t(parseInt(c[1],10),this.globalUvs.length)),c.length>2&&c[2].length>0&&s.push(t(parseInt(c[2],10),this.globalNormals.length))}this.currentMeshConverter===null&&this.AddNewMesh("");for(let a=0;a<n.length-2;a++){let c=this.currentMeshConverter.AddVertex(n[0],this.globalVertices),l=this.currentMeshConverter.AddVertex(n[a+1],this.globalVertices),u=this.currentMeshConverter.AddVertex(n[a+2],this.globalVertices);if(c===null||l===null||u===null){this.SetError("Invalid vertex index.");break}let h=new Bt(c,l,u);if(i.length===n.length){let f=this.currentMeshConverter.AddVertexColor(i[0],this.globalVertexColors),p=this.currentMeshConverter.AddVertexColor(i[a+1],this.globalVertexColors),g=this.currentMeshConverter.AddVertexColor(i[a+2],this.globalVertexColors);if(f===null||p===null||g===null){this.SetError("Invalid vertex color index.");break}h.SetVertexColors(f,p,g)}if(s.length===n.length){let f=this.currentMeshConverter.AddNormal(s[0],this.globalNormals),p=this.currentMeshConverter.AddNormal(s[a+1],this.globalNormals),g=this.currentMeshConverter.AddNormal(s[a+2],this.globalNormals);if(f===null||p===null||g===null){this.SetError("Invalid normal index.");break}h.SetNormals(f,p,g)}if(o.length===n.length){let f=this.currentMeshConverter.AddUV(o[0],this.globalUvs),p=this.currentMeshConverter.AddUV(o[a+1],this.globalUvs),g=this.currentMeshConverter.AddUV(o[a+2],this.globalUvs);if(f===null||p===null||g===null){this.SetError("Invalid uv index.");break}h.SetTextureUVs(f,p,g)}this.currentMaterialIndex!==null&&(h.mat=this.currentMaterialIndex),this.currentMeshConverter.AddTriangle(h)}}};var Oa=class extends zt{constructor(){super()}CanImportExtension(e){return e==="off"}GetUpDirection(){return ct.Y}ClearContent(){this.mesh=null,this.status=null,this.colorToMaterial=null}ResetContent(){this.mesh=new jt,this.model.AddMeshToRootNode(this.mesh),this.status={vertexCount:0,faceCount:0,foundVertex:0,foundFace:0},this.colorToMaterial=new li(this.model)}ImportContent(e,t){let n=hn(e);Ni(n,i=>{this.WasError()||this.ProcessLine(i)}),t()}ProcessLine(e){function t(s){return s.indexOf(".")!==-1?Sn(parseFloat(s)):parseInt(s,10)}if(e[0]==="#")return;let n=Ji(e,"#");if(n.length===0||n[0]==="OFF")return;if(this.status.vertexCount===0&&this.status.faceCount===0){n.length>1&&(this.status.vertexCount=parseInt(n[0],10),this.status.faceCount=parseInt(n[1],10));return}if(this.status.foundVertex<this.status.vertexCount){n.length>=3&&(this.mesh.AddVertex(new Ve(parseFloat(n[0]),parseFloat(n[1]),parseFloat(n[2]))),this.status.foundVertex+=1),n.length>=6&&this.mesh.AddVertexColor(new dt(t(n[3]),t(n[4]),t(n[5])));return}let i=this.mesh.VertexCount()===this.mesh.VertexColorCount();if(this.status.foundFace<this.status.faceCount){if(n.length>=4){let s=parseInt(n[0],10);if(n.length<s+1)return;let o=null;if(!i&&n.length>=s+4){let a=new dt(t(n[s+1]),t(n[s+2]),t(n[s+3]));o=this.colorToMaterial.GetMaterialIndex(a.r,a.g,a.b)}for(let a=0;a<s-2;a++){let c=parseInt(n[1]),l=parseInt(n[a+2]),u=parseInt(n[a+3]),h=new Bt(c,l,u);i?h.SetVertexColors(c,l,u):h.SetMaterial(o),this.mesh.AddTriangle(h)}this.status.foundFace+=1}return}}};
3143var As={Ok:1,NoVertices:2,NoFaces:3,UnknownError:4},Bd=class{constructor(){this.format=null,this.elements=[]}SetFormat(e){this.format=e}AddElement(e,t){this.elements.push({name:e,count:t,format:[]})}GetElements(){return this.elements}AddSingleFormat(e,t){this.elements[this.elements.length-1].format.push({name:t,isSingle:!0,elemType:e})}AddListFormat(e,t,n){this.elements[this.elements.length-1].format.push({name:n,isSingle:!1,countType:e,elemType:t})}GetElement(e){for(let t=0;t<this.elements.length;t++){let n=this.elements[t];if(n.name===e)return n}return null}Check(){let e=this.GetElement("vertex");if(e===null||e.length===0||e.format.length<3)return As.NoVertices;let t=this.GetElement("face");if(this.format==="ascii"){if(t===null||t.count===0||t.format.length<0)return As.NoFaces}else if(this.format==="binary_little_endian"||this.format==="binary_big_endian"){let n=this.GetElement("tristrips"),i=t!==null&&t.count>0&&t.format.length>0,s=n!==null&&n.count>0&&n.format.length>0;if(!i&&!s)return As.NoFaces}else return As.UnknownError;return As.Ok}},Gd=class{constructor(e){this.model=e,this.colorToMaterial=new Map}GetMaterialIndexByColor(e){let t="Color "+yn(e[0])+yn(e[1])+yn(e[2])+yn(e[3]);if(this.colorToMaterial.has(t))return this.colorToMaterial.get(t);{let n=new un;n.name=t,n.color=new dt(e[0],e[1],e[2]),n.opacity=e[3]/255,ci(n);let i=this.model.AddMaterial(n);return this.colorToMaterial.set(t,i),i}}},Da=class extends zt{constructor(){super()}CanImportExtension(e){return e==="ply"}GetUpDirection(){return ct.Y}ClearContent(){this.mesh=null}ResetContent(){this.mesh=new jt,this.model.AddMeshToRootNode(this.mesh)}ImportContent(e,t){let n=this.GetHeaderContent(e),i=this.ReadHeader(n),s=i.Check();if(s===As.Ok)if(i.format==="ascii"){let o=hn(e);o=o.substring(n.length),this.ReadAsciiContent(i,o)}else(i.format==="binary_little_endian"||i.format==="binary_big_endian")&&this.ReadBinaryContent(i,e,n.length);else s===As.NoVertices?this.SetError("The model contains no vertices."):s===As.NoFaces?this.SetError("The model contains no faces."):this.SetError("Invalid header information.");t()}GetHeaderContent(e){let t="",n=new Uint8Array(e),i=0;for(i=0;i<e.byteLength&&(t+=String.fromCharCode(n[i]),!t.endsWith("end_header"));i++);for(i+=1;i<e.byteLength;){let s=String.fromCharCode(n[i]);if(t+=s,i+=1,s===`
3144`)break}return t}ReadHeader(e){let t=new Bd;return Ni(e,n=>{let i=Ji(n,null);i.length===0||i[0]==="comment"||i[0]!=="ply"&&(i[0]==="format"&&i.length>=2?t.SetFormat(i[1]):i[0]==="element"&&i.length>=3?t.AddElement(i[1],parseInt(i[2],10)):i[0]==="property"&&i.length>=3&&(i[1]==="list"&&i.length>=5?t.AddListFormat(i[2],i[3],i[4]):t.AddSingleFormat(i[1],i[2])))}),t}ReadAsciiContent(e,t){let n=e.GetElement("vertex"),i=e.GetElement("face"),s=0,o=0;Ni(t,a=>{if(this.WasError())return;let c=Ji(a,null);if(!(c.length===0||c[0]==="comment")){if(s<n.count){c.length>=3&&(this.mesh.AddVertex(new Ve(parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2]))),s+=1);return}if(i!==null&&o<i.count){if(c.length>=4){let l=parseInt(c[0],10);if(c.length<l+1)return;for(let u=0;u<l-2;u++){let h=parseInt(c[1]),f=parseInt(c[u+2]),p=parseInt(c[u+3]),g=new Bt(h,f,p);this.mesh.AddTriangle(g)}o+=1}return}}})}ReadBinaryContent(e,t,n){function i(u,h){function f(p,g){return g==="char"||g==="int8"?p.ReadCharacter8():g==="uchar"||g==="uint8"?p.ReadUnsignedCharacter8():g==="short"||g==="int16"?p.ReadInteger16():g==="ushort"||g==="uint16"?p.ReadUnsignedInteger16():g==="int"||g==="int32"?p.ReadInteger32():g==="uint"||g==="uint32"?p.ReadUnsignedInteger32():g==="float"||g==="float32"?p.ReadFloat32():g==="double"||g==="double64"?p.ReadDouble64():null}if(h.isSingle)return f(u,h.elemType);{let p=[],g=f(u,h.countType);for(let m=0;m<g;m++)p.push(f(u,h.elemType));return p}}function s(u,h,f){for(let p=f;p<h.length;p++)i(u,h[p])}function o(u,h,f){let p=null,g=null,m=null,d=255;for(let x=f;x<h.length;x++){let _=h[x],v=i(u,_);_.name==="red"?p=v:_.name==="green"?g=v:_.name==="blue"?m=v:_.name==="alpha"&&(d=v)}return p!==null&&g!==null&&m!==null?[p,g,m,d]:null}let a=null;if(e.format==="binary_little_endian")a=new Kn(t,!0);else if(e.format==="binary_big_endian")a=new Kn(t,!1);else return;a.Skip(n);let c=new Gd(this.model),l=e.GetElements();for(let u=0;u<l.length;u++){let h=l[u];if(h.name==="vertex")for(let f=0;f<h.count;f++){let p=i(a,h.format[0]),g=i(a,h.format[1]),m=i(a,h.format[2]),d=o(a,h.format,3);d!==null&&this.mesh.AddVertexColor(new dt(d[0],d[1],d[2])),this.mesh.AddVertex(new Ve(p,g,m))}else if(h.name==="face")for(let f=0;f<h.count;f++){let p=i(a,h.format[0]),g=o(a,h.format,1);for(let m=0;m<p.length-2;m++){let d=p[0],x=p[m+1],_=p[m+2],v=new Bt(d,x,_);g!==null?v.mat=c.GetMaterialIndexByColor(g):this.mesh.VertexColorCount()>0&&v.SetVertexColors(d,x,_),this.mesh.AddTriangle(v)}}else if(h.name==="tristrips")for(let f=0;f<h.count;f++){let p=i(a,h.format[0]);s(a,h.format,1);let g=!0;for(let m=0;m<p.length-2;m++){let d=p[m],x=p[m+1],_=p[m+2];if(_===-1){m+=2,g=!0;continue}if(!g){let y=x;x=_,_=y}g=!g;let v=new Bt(d,x,_);this.mesh.AddTriangle(v)}}else s(a,h.format,0)}}};var ka=class extends zt{constructor(){super(),this.worker=null}CanImportExtension(e){return e==="stp"||e==="step"||e==="igs"||e==="iges"||e==="brp"||e==="brep"}GetUpDirection(){return ct.Y}ClearContent(){this.worker!==null&&(this.worker.terminate(),this.worker=null)}ResetContent(){this.worker=null}ImportContent(e,t){let n=ks("loaders/occt-import-js-worker.js");this.worker=new Worker(n),this.worker.addEventListener("message",o=>{this.ImportResultJson(o.data,t)}),this.worker.addEventListener("error",o=>{this.SetError("Failed to load occt-import-js."),t()});let i=null;if(this.extension==="stp"||this.extension==="step")i="step";else if(this.extension==="igs"||this.extension==="iges")i="iges";else if(this.extension==="brp"||this.extension==="brep")i="brep";else{t();return}let s=new Uint8Array(e);this.worker.postMessage({format:i,buffer:s,params:null})}ImportResultJson(e,t){if(!e.success){t();return}let n=new li(this.model),i=this.model.GetRootNode();this.ImportNode(e,e.root,i,n),t()}ImportNode(e,t,n,i){for(let s of t.meshes){let o=e.meshes[s],a=this.ImportMesh(o,i),c=this.model.AddMesh(a);n.AddMeshIndex(c)}for(let s of t.children){let o=new In;o.SetName(s.name),n.AddChildNode(o),this.ImportNode(e,s,o,i)}}ImportMesh(e,t){let n=null;if(e.color){let s=di(e.color[0],e.color[1],e.color[2]);n=t.GetMaterialIndex(s.r,s.g,s.b,null)}let i=Ki(e,n);if(e.name&&i.SetName(e.name),e.face_colors)for(let s of e.face_colors){let o=di(s.color[0],s.color[1],s.color[2]),a=t.GetMaterialIndex(o.r,o.g,o.b,null);for(let c=s.first;c<=s.last;c++)i.GetTriangle(c).SetMaterial(a)}return i}};var Fa=class extends zt{constructor(){super()}CanImportExtension(e){return e==="stl"}GetUpDirection(){return ct.Z}ClearContent(){this.mesh=null,this.triangle=null}ResetContent(){this.mesh=new jt,this.model.AddMeshToRootNode(this.mesh),this.triangle=null}ImportContent(e,t){if(this.IsBinaryStlFile(e))this.ProcessBinary(e);else{let n=hn(e);Ni(n,i=>{this.WasError()||this.ProcessLine(i)})}t()}IsBinaryStlFile(e){let t=e.byteLength;if(t<84)return!1;let n=new Kn(e,!0);n.Skip(80);let i=n.ReadUnsignedInteger32();return t===i*50+84}ProcessLine(e){if(e[0]==="#")return;let t=Ji(e,"#");if(t.length===0)return;let n=t[0];if(n==="solid"){if(t.length>1){let i=Tr(e,n.length,"#");this.mesh.SetName(i)}return}if(n==="facet"){if(this.triangle=new Bt(-1,-1,-1),t.length>=5&&t[1]==="normal"){let i=new Ve(parseFloat(t[2]),parseFloat(t[3]),parseFloat(t[4]));if(wi(i.Length())){let s=this.mesh.AddNormal(i);this.triangle.SetNormals(s,s,s)}}return}if(n==="vertex"&&this.triangle!==null){if(t.length>=4){let i=this.mesh.AddVertex(new Ve(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])));this.triangle.v0===-1?this.triangle.v0=i:this.triangle.v1===-1?this.triangle.v1=i:this.triangle.v2===-1&&(this.triangle.v2=i)}return}if(n==="endfacet"&&this.triangle!==null){this.triangle.v0!==-1&&this.triangle.v1!==-1&&this.triangle.v2!==null&&this.mesh.AddTriangle(this.triangle),this.triangle=null;return}}ProcessBinary(e){function t(o){let a=new Ve;return a.x=o.ReadFloat32(),a.y=o.ReadFloat32(),a.z=o.ReadFloat32(),a}function n(o,a){let c=t(a);return o.AddVertex(c)}let i=new Kn(e,!0);i.Skip(80);let s=i.ReadUnsignedInteger32();for(let o=0;o<s;o++){let a=t(i),c=n(this.mesh,i),l=n(this.mesh,i),u=n(this.mesh,i);i.Skip(2);let h=new Bt(c,l,u);if(wi(a.Length())){let f=this.mesh.AddNormal(a);h.SetNormals(f,f,f)}this.mesh.AddTriangle(h)}}};var Ua=class extends zt{constructor(){super()}CanImportExtension(e){return e==="bim"}GetUpDirection(){return ct.Z}ClearContent(){this.meshIdToMesh=null,this.colorToMaterial=null}ResetContent(){this.meshIdToMesh=new Map,this.colorToMaterial=new li(this.model)}ImportContent(e,t){let n=hn(e),i=null;try{i=JSON.parse(n)}catch{this.SetError("Failed to parse bim file."),t();return}for(let s of i.meshes)this.meshIdToMesh.set(s.mesh_id,s);this.ImportProperties(i,this.model);for(let s of i.elements){let o=this.ImportElement(s);o.SetName(s.type),this.ImportProperties(s,o)}t()}ImportElement(e){let t=this.colorToMaterial.GetMaterialIndex(e.color.r,e.color.g,e.color.b,e.color.a),n=this.model.GetRootNode(),i=this.meshIdToMesh.get(e.mesh_id),s=this.ImportMesh(i,f=>e.face_colors?this.colorToMaterial.GetMaterialIndex(e.face_colors[f*4+0],e.face_colors[f*4+1],e.face_colors[f*4+2],e.face_colors[f*4+3]):t),o=this.model.AddMesh(s),a=new In;a.SetType(gi.MeshNode),a.AddMeshIndex(o);let c=new Ve(0,0,0);e.vector&&(c=new Ve(e.vector.x,e.vector.y,e.vector.z));let l=new Xn(0,0,0,1);e.rotation&&(l=new Xn(e.rotation.qx,e.rotation.qy,e.rotation.qz,e.rotation.qw));let u=new Ve(1,1,1),h=new Gt().ComposeTRS(c,l,u);return a.SetTransformation(new Yt(h)),n.AddChildNode(a),s}ImportMesh(e,t){let n=new jt;for(let i=0;i<e.coordinates.length;i+=3)n.AddVertex(new Ve(e.coordinates[i+0],e.coordinates[i+1],e.coordinates[i+2]));for(let i=0;i<e.indices.length;
3144i+=3){let s=new Bt(e.indices[i+0],e.indices[i+1],e.indices[i+2]);s.SetMaterial(t(i/3)),n.AddTriangle(s)}return n}ImportProperties(e,t){function n(o,a,c){if(c==null)return;let l=new Xt(Ht.Text,a,c);o.AddProperty(l)}if(!e.info||Bc(e.info))return;let i=e.info,s=new Cn("Info");n(s,"Guid",e.guid),n(s,"Type",e.type);for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&typeof i[o]=="string"&&n(s,o,i[o]);t.AddPropertyGroup(s)}};var Cs=class extends ih{constructor(e){super(e)}parse(e){function t(H){switch(H.image_type){case f:case m:(H.colormap_length>256||H.colormap_size!==24||H.colormap_type!==1)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case p:case g:case d:case x:H.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case h:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',H.image_type)}(H.width<=0||H.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),H.pixel_size!==8&&H.pixel_size!==16&&H.pixel_size!==24&&H.pixel_size!==32&&console.error('THREE.TGALoader: Invalid pixel size "%s".',H.pixel_size)}function n(H,Z,W,oe,ue){let ne,le,he=W.pixel_size>>3,I=W.width*W.height*he;if(Z&&(le=ue.subarray(oe,oe+=W.colormap_length*(W.colormap_size>>3))),H){ne=new Uint8Array(I);let M,T,S,B=0,j=new Uint8Array(he);for(;B<I;)if(M=ue[oe++],T=(M&127)+1,M&128){for(S=0;S<he;++S)j[S]=ue[oe++];for(S=0;S<T;++S)ne.set(j,B+S*he);B+=he*T}else{for(T*=he,S=0;S<T;++S)ne[B+S]=ue[oe++];B+=T}}else ne=ue.subarray(oe,oe+=Z?W.width*W.height:I);return{pixel_data:ne,palettes:le}}function i(H,Z,W,oe,ue,ne,le,he,I){let M=I,T,S=0,B,j,z=N.width;for(j=Z;j!==oe;j+=W)for(B=ue;B!==le;B+=ne,S++)T=he[S],H[(B+z*j)*4+3]=255,H[(B+z*j)*4+2]=M[T*3+0],H[(B+z*j)*4+1]=M[T*3+1],H[(B+z*j)*4+0]=M[T*3+2];return H}function s(H,Z,W,oe,ue,ne,le,he){let I,M=0,T,S,B=N.width;for(S=Z;S!==oe;S+=W)for(T=ue;T!==le;T+=ne,M+=2)I=he[M+0]+(he[M+1]<<8),H[(T+B*S)*4+0]=(I&31744)>>7,H[(T+B*S)*4+1]=(I&992)>>2,H[(T+B*S)*4+2]=(I&31)<<3,H[(T+B*S)*4+3]=I&32768?0:255;return H}function o(H,Z,W,oe,ue,ne,le,he){let I=0,M,T,S=N.width;for(T=Z;T!==oe;T+=W)for(M=ue;M!==le;M+=ne,I+=3)H[(M+S*T)*4+3]=255,H[(M+S*T)*4+2]=he[I+0],H[(M+S*T)*4+1]=he[I+1],H[(M+S*T)*4+0]=he[I+2];return H}function a(H,Z,W,oe,ue,ne,le,he){let I=0,M,T,S=N.width;for(T=Z;T!==oe;T+=W)for(M=ue;M!==le;M+=ne,I+=4)H[(M+S*T)*4+2]=he[I+0],H[(M+S*T)*4+1]=he[I+1],H[(M+S*T)*4+0]=he[I+2],H[(M+S*T)*4+3]=he[I+3];return H}function c(H,Z,W,oe,ue,ne,le,he){let I,M=0,T,S,B=N.width;for(S=Z;S!==oe;S+=W)for(T=ue;T!==le;T+=ne,M++)I=he[M],H[(T+B*S)*4+0]=I,H[(T+B*S)*4+1]=I,H[(T+B*S)*4+2]=I,H[(T+B*S)*4+3]=255;return H}function l(H,Z,W,oe,ue,ne,le,he){let I=0,M,T,S=N.width;for(T=Z;T!==oe;T+=W)for(M=ue;M!==le;M+=ne,I+=2)H[(M+S*T)*4+0]=he[I+0],H[(M+S*T)*4+1]=he[I+0],H[(M+S*T)*4+2]=he[I+0],H[(M+S*T)*4+3]=he[I+1];return H}function u(H,Z,W,oe,ue){let ne,le,he,I,M,T;switch((N.flags&_)>>v){default:case L:ne=0,he=1,M=Z,le=0,I=1,T=W;break;case y:ne=0,he=1,M=Z,le=W-1,I=-1,T=-1;break;case C:ne=Z-1,he=-1,M=-1,le=0,I=1,T=W;break;case w:ne=Z-1,he=-1,M=-1,le=W-1,I=-1,T=-1;break}if(U)switch(N.pixel_size){case 8:c(H,le,I,T,ne,he,M,oe);break;case 16:l(H,le,I,T,ne,he,M,oe);break;default:console.error("THREE.TGALoader: Format not supported.");break}else switch(N.pixel_size){case 8:i(H,le,I,T,ne,he,M,oe,ue);break;case 16:s(H,le,I,T,ne,he,M,oe);break;case 24:o(H,le,I,T,ne,he,M,oe);break;case 32:a(H,le,I,T,ne,he,M,oe);break;default:console.error("THREE.TGALoader: Format not supported.");break}return H}let h=0,f=1,p=2,g=3,m=9,d=10,x=11,_=48,v=4,y=0,w=1,L=2,C=3;e.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");let b=0,A=new Uint8Array(e),N={id_length:A[b++],colormap_type:A[b++],image_type:A[b++],colormap_index:A[b++]|A[b++]<<8,colormap_length:A[b++]|A[b++]<<8,colormap_size:A[b++],origin:[A[b++]|A[b++]<<8,A[b++]|A[b++]<<8],width:A[b++]|A[b++]<<8,height:A[b++]|A[b++]<<8,pixel_size:A[b++],flags:A[b++]};t(N),N.id_length+b>e.length&&console.error("THREE.TGALoader: No data."),b+=N.id_length;let G=!1,F=!1,U=!1;switch(N.image_type){case m:G=!0,F=!0;break;case f:F=!0;break;case d:G=!0;break;case p:break;case x:G=!0,U=!0;break;case g:U=!0;break}let P=new Uint8Array(N.width*N.height*4),$=n(G,F,N,b,A);return u(P,N.width,N.height,$.pixel_data,$.palettes),{data:P,width:N.width,height:N.height,flipY:!0,generateMipmaps:!0,minFilter:br}}};var Sh={};Zp(Sh,{AsyncCompress:()=>z1,AsyncDecompress:()=>j1,AsyncDeflate:()=>V0,AsyncGunzip:()=>W0,AsyncGzip:()=>z1,AsyncInflate:()=>sp,AsyncUnzipInflate:()=>nw,AsyncUnzlib:()=>q0,AsyncZipDeflate:()=>J1,AsyncZlib:()=>H1,Compress:()=>qd,DecodeUTF8:()=>Y1,Decompress:()=>Y0,Deflate:()=>wr,EncodeUTF8:()=>Z1,Gunzip:()=>Th,Gzip:()=>qd,Inflate:()=>hi,Unzip:()=>iw,UnzipInflate:()=>tw,UnzipPassThrough:()=>tx,Unzlib:()=>wh,Zip:()=>$1,ZipDeflate:()=>K1,ZipPassThrough:()=>cc,Zlib:()=>Yd,compress:()=>V1,compressSync:()=>Xd,decompress:()=>q1,decompressSync:()=>X1,deflate:()=>H0,deflateSync:()=>dc,gunzip:()=>j0,gunzipSync:()=>Mh,gzip:()=>V1,gzipSync:()=>Xd,inflate:()=>op,inflateSync:()=>Ja,strFromU8:()=>lp,strToU8:()=>Rs,unzip:()=>rw,unzipSync:()=>up,unzlib:()=>X0,unzlibSync:()=>Va,zip:()=>Q1,zipSync:()=>ew,zlib:()=>W1,zlibSync:()=>Zd});var _0={},Vd=function(r){return URL.createObjectURL(new Blob([r],{type:"text/javascript"}))},M0=function(r){return new Worker(r)};try{URL.revokeObjectURL(Vd(""))}catch{Vd=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},M0=function(e){return new Worker(e,{type:"module"})}}var B1=function(r,e,t,n,i){var s=M0(_0[e]||(_0[e]=Vd(r)));return s.onerror=function(o){return i(o.error,null)},s.onmessage=function(o){return i(null,o.data)},s.postMessage(t,n),s},Et=Uint8Array,Nn=Uint16Array,Zr=Uint32Array,Wa=new Et([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]),ja=new Et([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]),ac=new Et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),w0=function(r,e){for(var t=new Nn(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new Zr(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return[t,i]},S0=w0(Wa,2),Jd=S0[0],_h=S0[1];Jd[28]=258,_h[258]=28;var E0=w0(ja,0),A0=E0[0],Hd=E0[1],lc=new Nn(32768);for(Nt=0;Nt<32768;++Nt)Xr=(Nt&43690)>>>1|(Nt&21845)<<1,Xr=(Xr&52428)>>>2|(Xr&13107)<<2,Xr=(Xr&61680)>>>4|(Xr&3855)<<4,lc[Nt]=((Xr&65280)>>>8|(Xr&255)<<8)>>>1;var Xr,Nt,Di=function(r,e,t){for(var n=r.length,i=0,s=new Nn(e);i<n;++i)++s[r[i]-1];var o=new Nn(e);for(i=0;i<e;++i)o[i]=o[i-1]+s[i-1]<<1;var a;if(t){a=new Nn(1<<e);var c=15-e;for(i=0;i<n;++i)if(r[i])for(var l=i<<4|r[i],u=e-r[i],h=o[r[i]-1]++<<u,f=h|(1<<u)-1;h<=f;++h)a[lc[h]>>>c]=l}else for(a=new Nn(n),i=0;i<n;++i)r[i]&&(a[i]=lc[o[r[i]-1]++]>>>15-r[i]);return a},Kr=new Et(288);for(Nt=0;Nt<144;++Nt)Kr[Nt]=8;var Nt;for(Nt=144;Nt<256;++Nt)Kr[Nt]=9;var Nt;for(Nt=256;Nt<280;++Nt)Kr[Nt]=7;var Nt;for(Nt=280;Nt<288;++Nt)Kr[Nt]=8;var Nt,za=new Et(32);for(Nt=0;Nt<32;++Nt)za[Nt]=5;var Nt,C0=Di(Kr,9,0),I0=Di(Kr,9,1),R0=Di(za,5,0),P0=Di(za,5,1),xh=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},Oi=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t}
3144,yh=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},uc=function(r){return(r/8|0)+(r&7&&1)},ki=function(r,e,t){(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof Nn?Nn:r instanceof Zr?Zr:Et)(t-e);return n.set(r.subarray(e,t)),n},hc=function(r,e,t){var n=r.length;if(!n||t&&!t.l&&n<5)return e||new Et(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Et(n*3));var o=function(T){var S=e.length;if(T>S){var B=new Et(Math.max(S*2,T));B.set(e),e=B}},a=t.f||0,c=t.p||0,l=t.b||0,u=t.l,h=t.d,f=t.m,p=t.n,g=n*8;do{if(!u){t.f=a=Oi(r,c,1);var m=Oi(r,c+1,3);if(c+=3,m)if(m==1)u=I0,h=P0,f=9,p=5;else if(m==2){var v=Oi(r,c,31)+257,y=Oi(r,c+10,15)+4,w=v+Oi(r,c+5,31)+1;c+=14;for(var L=new Et(w),C=new Et(19),b=0;b<y;++b)C[ac[b]]=Oi(r,c+b*3,7);c+=y*3;for(var A=xh(C),N=(1<<A)-1,G=Di(C,A,1),b=0;b<w;){var F=G[Oi(r,c,N)];c+=F&15;var d=F>>>4;if(d<16)L[b++]=d;else{var U=0,P=0;for(d==16?(P=3+Oi(r,c,3),c+=2,U=L[b-1]):d==17?(P=3+Oi(r,c,7),c+=3):d==18&&(P=11+Oi(r,c,127),c+=7);P--;)L[b++]=U}}var $=L.subarray(0,v),H=L.subarray(v);f=xh($),p=xh(H),u=Di($,f,1),h=Di(H,p,1)}else throw"invalid block type";else{var d=uc(c)+4,x=r[d-4]|r[d-3]<<8,_=d+x;if(_>n){if(s)throw"unexpected EOF";break}i&&o(l+x),e.set(r.subarray(d,_),l),t.b=l+=x,t.p=c=_*8;continue}if(c>g){if(s)throw"unexpected EOF";break}}i&&o(l+131072);for(var Z=(1<<f)-1,W=(1<<p)-1,oe=c;;oe=c){var U=u[yh(r,c)&Z],ue=U>>>4;if(c+=U&15,c>g){if(s)throw"unexpected EOF";break}if(!U)throw"invalid length/literal";if(ue<256)e[l++]=ue;else if(ue==256){oe=c,u=null;break}else{var ne=ue-254;if(ue>264){var b=ue-257,le=Wa[b];ne=Oi(r,c,(1<<le)-1)+Jd[b],c+=le}var he=h[yh(r,c)&W],I=he>>>4;if(!he)throw"invalid distance";c+=he&15;var H=A0[I];if(I>3){var le=ja[I];H+=yh(r,c)&(1<<le)-1,c+=le}if(c>g){if(s)throw"unexpected EOF";break}i&&o(l+131072);for(var M=l+ne;l<M;l+=4)e[l]=e[l-H],e[l+1]=e[l+1-H],e[l+2]=e[l+2-H],e[l+3]=e[l+3-H];l=M}}t.l=u,t.p=oe,t.b=l,u&&(a=1,t.m=f,t.d=h,t.n=p)}while(!a);return l==e.length?e:ki(e,0,l)},Mr=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>>8},Ba=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>>8,r[n+2]|=t>>>16},vh=function(r,e){for(var t=[],n=0;n<r.length;++n)r[n]&&t.push({s:n,f:r[n]});var i=t.length,s=t.slice();if(!i)return[Yr,0];if(i==1){var o=new Et(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort(function(w,L){return w.f-L.f}),t.push({s:-1,f:25001});var a=t[0],c=t[1],l=0,u=1,h=2;for(t[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=i-1;)a=t[t[l].f<t[h].f?l++:h++],c=t[l!=u&&t[l].f<t[h].f?l++:h++],t[u++]={s:-1,f:a.f+c.f,l:a,r:c};for(var f=s[0].s,n=1;n<i;++n)s[n].s>f&&(f=s[n].s);var p=new Nn(f+1),g=bh(t[u-1],p,0);if(g>e){var n=0,m=0,d=g-e,x=1<<d;for(s.sort(function(L,C){return p[C.s]-p[L.s]||L.f-C.f});n<i;++n){var _=s[n].s;if(p[_]>e)m+=x-(1<<g-p[_]),p[_]=e;else break}for(m>>>=d;m>0;){var v=s[n].s;p[v]<e?m-=1<<e-p[v]++-1:++n}for(;n>=0&&m;--n){var y=s[n].s;p[y]==e&&(--p[y],++m)}g=e}return[new Et(p),g]},bh=function(r,e,t){return r.s==-1?Math.max(bh(r.l,e,t+1),bh(r.r,e,t+1)):e[r.s]=t},Wd=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new Nn(++e),n=0,i=r[0],s=1,o=function(c){t[n++]=c},a=1;a<=e;++a)if(r[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=r[a]}return[t.subarray(0,n),e]},Ga=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},oc=function(r,e,t){var n=t.length,i=uc(e+2);r[i]=n&255,r[i+1]=n>>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var s=0;s<n;++s)r[i+s+4]=t[s];return(i+4+n)*8},jd=function(r,e,t,n,i,s,o,a,c,l,u){Mr(e,u++,t),++i[256];for(var h=vh(i,15),f=h[0],p=h[1],g=vh(s,15),m=g[0],d=g[1],x=Wd(f),_=x[0],v=x[1],y=Wd(m),w=y[0],L=y[1],C=new Nn(19),b=0;b<_.length;++b)C[_[b]&31]++;for(var b=0;b<w.length;++b)C[w[b]&31]++;for(var A=vh(C,7),N=A[0],G=A[1],F=19;F>4&&!N[ac[F-1]];--F);var U=l+5<<3,P=Ga(i,Kr)+Ga(s,za)+o,$=Ga(i,f)+Ga(s,m)+o+14+3*F+Ga(C,N)+(2*C[16]+3*C[17]+7*C[18]);if(U<=P&&U<=$)return oc(e,u,r.subarray(c,c+l));var H,Z,W,oe;if(Mr(e,u,1+($<P)),u+=2,$<P){H=Di(f,p,0),Z=f,W=Di(m,d,0),oe=m;var ue=Di(N,G,0);Mr(e,u,v-257),Mr(e,u+5,L-1),Mr(e,u+10,F-4),u+=14;for(var b=0;b<F;++b)Mr(e,u+3*b,N[ac[b]]);u+=3*F;for(var ne=[_,w],le=0;le<2;++le)for(var he=ne[le],b=0;b<he.length;++b){var I=he[b]&31;Mr(e,u,ue[I]),u+=N[I],I>15&&(Mr(e,u,he[b]>>>5&127),u+=he[b]>>>12)}}else H=C0,Z=Kr,W=R0,oe=za;for(var b=0;b<a;++b)if(n[b]>255){var I=n[b]>>>18&31;Ba(e,u,H[I+257]),u+=Z[I+257],I>7&&(Mr(e,u,n[b]>>>23&31),u+=Wa[I]);var M=n[b]&31;Ba(e,u,W[M]),u+=oe[M],M>3&&(Ba(e,u,n[b]>>>5&8191),u+=ja[M])}else Ba(e,u,H[n[b]]),u+=Z[n[b]];return Ba(e,u,H[256]),u+Z[256]},L0=new Zr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yr=new Et(0),N0=function(r,e,t,n,i,s){var o=r.length,a=new Et(n+o+5*(1+Math.ceil(o/7e3))+i),c=a.subarray(n,a.length-i),l=0;if(!e||o<8)for(var u=0;u<=o;u+=65535){var h=u+65535;h<o?l=oc(c,l,r.subarray(u,h)):(c[u]=s,l=oc(c,l,r.subarray(u,o)))}else{for(var f=L0[e-1],p=f>>>13,g=f&8191,m=(1<<t)-1,d=new Nn(32768),x=new Nn(m+1),_=Math.ceil(t/3),v=2*_,y=function(te){return(r[te]^r[te+1]<<_^r[te+2]<<v)&m},w=new Zr(25e3),L=new Nn(288),C=new Nn(32),b=0,A=0,u=0,N=0,G=0,F=0;u<o;++u){var U=y(u),P=u&32767,$=x[U];if(d[P]=$,x[U]=P,G<=u){var H=o-u;if((b>7e3||N>24576)&&H>423){l=jd(r,c,0,w,L,C,A,N,F,u-F,l),N=b=A=0,F=u;for(var Z=0;Z<286;++Z)L[Z]=0;for(var Z=0;Z<30;++Z)C[Z]=0}var W=2,oe=0,ue=g,ne=P-$&32767;if(H>2&&U==y(u-ne))for(var le=Math.min(p,H)-1,he=Math.min(32767,u),I=Math.min(258,H);ne<=he&&--ue&&P!=$;){if(r[u+W]==r[u+W-ne]){for(var M=0;M<I&&r[u+M]==r[u+M-ne];++M);if(M>W){if(W=M,oe=ne,M>le)break;for(var T=Math.min(ne,M-2),S=0,Z=0;Z<T;++Z){var B=u-ne+Z+32768&32767,j=d[B],z=B-j+32768&32767;z>S&&(S=z,$=B)}}}P=$,$=d[P],ne+=P-$+32768&32767}if(oe){w[N++]=268435456|_h[W]<<18|Hd[oe];var fe=_h[W]&31,q=Hd[oe]&31;A+=Wa[fe]+ja[q],++L[257+fe],++C[q],G=u+W,++b}else w[N++]=r[u],++L[r[u]]}}l=jd(r,c,s,w,L,C,A,N,F,u-F,l),!s&&l&7&&(l=oc(c,l+1,Yr))}return ki(a,0,n+uc(l)+i)},O0=function(){for(var r=new Zr(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(t&1&&3988292384)^t>>>1;r[e]=t}return r}(),qa=function(){var r=-1;return{p:function(e){for(var t=r,n=0;n<e.length;++n)t=O0[t&255^e[n]]^t>>>8;r=t},d:function(){return~r}}},$d=function(){var r=1,e=0;return{p:function(t){for(var n=r,i=e,s=t.length,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)i+=n+=t[o];n=(n&65535)+15*(n>>16),i=(i&65535)+15*(i>>16)}r=n,e=i},d:function(){return r%=65521,e%=65521,(r&255)<<24|r>>>8<<16|(e&255)<<8|e>>>8}}},fo=function(r,e,t,n,i){return N0(r,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):12+e.mem,t,n,!i)},fc=function(r,e){var t={};for(var n in r)t[n]=r[n];for(var n in e)t[n]=e[n];return t},b0=function(r,e,t){for(var n=r(),i=r.toString(),s=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<n.length;++o){var a=n[o],c=s[o];if(typeof a=="function"){e+=";"+c+"=";var l=a.toString();if(a.prototype)if(l.indexOf("[native code]")!=-1){var u=l.indexOf(" ",8)+1;e+=l.slice(u,l.indexOf("(",u))}else{e+=l;for(var h in a.prototype)e+=";"+c+".prototype."+h+"="+a.prototype[h].toString()}else e+=l}else t[c]=a}return[e,t]},gh=[],G1=function(r){var e=[];for(var t in r)(r[t]instanceof Et||r[t]instanceof Nn||r[t]instanceof Zr)&&e.push((r[t]=new r[t].constructor(r[t])).buffer);return e},D0=function(r,e,t,n){var i;if(!gh[t]){for(var s="",o={},a=r.length-1,c=0;c<a;++c)i=b0(r[c],s,o),s=i[0],o=i[1];gh[t]=b0(r[a],s,o)}var l=fc({},gh[t][1]);return B1(gh[t][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",t,l,G1(l),n)},Xa=function(){return[Et,Nn,Zr,Wa,ja,ac,Jd,A0,I0,P0,lc,Di,xh,Oi,yh,uc,ki,hc,Ja,Ps,Qd]},Ya=function(){return[Et,Nn,Zr,Wa,ja,ac,_h,Hd,C0,Kr,R0,za,lc,L0,Yr,Di,Mr,Ba,vh,bh,Wd,Ga,oc,jd,uc,ki,N0,fo,dc,Ps]},k0=function(){return[ep,np,Ft,qa,O0]},F0=function(){return[tp,G0]},U0=function(){return[ip,Ft,$d]},B0=function(){return[z0]},Ps=function(r){return postMessage(r,[r.buffer])},Qd=function(r){return r&&r.size&&new Et(r.size)},Za=function(r,e,t,n,i,s){var o=D0(t,n,i,function(a,c){o.terminate(),s(a,c)});return o.postMessage([r,e],e.consume?[r.buffer]:[]),function(){o.terminate()}},Fi=function(r){return r.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(e){return r.push(e.data[0],e.data[1])}},Ka=function(r,e,t,n,i){var s,o=D0(r,n,i,function(a,c){a?(o.terminate(),e.ondata.call(e,a)):(c[1]&&o.terminate(),e.ondata.call(e,a,c[0],c[
31441]))});o.postMessage(t),e.push=function(a,c){if(s)throw"stream finished";if(!e.ondata)throw"no stream handler";o.postMessage([a,s=c],[a.buffer])},e.terminate=function(){o.terminate()}},Jn=function(r,e){return r[e]|r[e+1]<<8},ln=function(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0},zd=function(r,e){return ln(r,e)+ln(r,e+4)*4294967296},Ft=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8},ep=function(r,e){var t=e.filename;if(r[0]=31,r[1]=139,r[2]=8,r[8]=e.level<2?4:e.level==9?2:0,r[9]=3,e.mtime!=0&&Ft(r,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){r[3]=8;for(var n=0;n<=t.length;++n)r[n+10]=t.charCodeAt(n)}},tp=function(r){if(r[0]!=31||r[1]!=139||r[2]!=8)throw"invalid gzip data";var e=r[3],t=10;e&4&&(t+=r[10]|(r[11]<<8)+2);for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!r[t++]);return t+(e&2)},G0=function(r){var e=r.length;return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0},np=function(r){return 10+(r.filename&&r.filename.length+1||0)},ip=function(r,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;r[0]=120,r[1]=n<<6|(n?32-2*n:1)},z0=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 rp(r,e){return!e&&typeof r=="function"&&(e=r,r={}),this.ondata=e,r}var wr=function(){function r(e,t){!t&&typeof e=="function"&&(t=e,e={}),this.ondata=t,this.o=e||{}}return r.prototype.p=function(e,t){this.ondata(fo(e,this.o,0,0,!t),t)},r.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},r}();var V0=function(){function r(e,t){Ka([Ya,function(){return[Fi,wr]}],this,rp.call(this,e,t),function(n){var i=new wr(n.data);onmessage=Fi(i)},6)}return r}();function H0(r,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Za(r,e,[Ya],function(n){return Ps(dc(n.data[0],n.data[1]))},0,t)}function dc(r,e){return fo(r,e||{},0,0)}var hi=function(){function r(e){this.s={},this.p=new Et(0),this.ondata=e}return r.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,n=new Et(t+e.length);n.set(this.p),n.set(e,t),this.p=n},r.prototype.c=function(e){this.d=this.s.i=e||!1;var t=this.s.b,n=hc(this.p,this.o,this.s);this.ondata(ki(n,t,this.s.b),this.d),this.o=ki(n,this.s.b-32768),this.s.b=this.o.length,this.p=ki(this.p,this.s.p/8|0),this.s.p&=7},r.prototype.push=function(e,t){this.e(e),this.c(t)},r}();var sp=function(){function r(e){this.ondata=e,Ka([Xa,function(){return[Fi,hi]}],this,0,function(){var t=new hi;onmessage=Fi(t)},7)}return r}();function op(r,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Za(r,e,[Xa],function(n){return Ps(Ja(n.data[0],Qd(n.data[1])))},1,t)}function Ja(r,e){return hc(r,e)}var qd=function(){function r(e,t){this.c=qa(),this.l=0,this.v=1,wr.call(this,e,t)}return r.prototype.push=function(e,t){wr.prototype.push.call(this,e,t)},r.prototype.p=function(e,t){this.c.p(e),this.l+=e.length;var n=fo(e,this.o,this.v&&np(this.o),t&&8,!t);this.v&&(ep(n,this.o),this.v=0),t&&(Ft(n,n.length-8,this.c.d()),Ft(n,n.length-4,this.l)),this.ondata(n,t)},r}();var z1=function(){function r(e,t){Ka([Ya,k0,function(){return[Fi,wr,qd]}],this,rp.call(this,e,t),function(n){var i=new qd(n.data);onmessage=Fi(i)},8)}return r}();function V1(r,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Za(r,e,[Ya,k0,function(){return[Xd]}],function(n){return Ps(Xd(n.data[0],n.data[1]))},2,t)}function Xd(r,e){e||(e={});var t=qa(),n=r.length;t.p(r);var i=fo(r,e,np(e),8),s=i.length;return ep(i,e),Ft(i,s-8,t.d()),Ft(i,s-4,n),i}var Th=function(){function r(e){this.v=1,hi.call(this,e)}return r.prototype.push=function(e,t){if(hi.prototype.e.call(this,e),this.v){var n=this.p.length>3?tp(this.p):4;if(n>=this.p.length&&!t)return;this.p=this.p.subarray(n),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}hi.prototype.c.call(this,t)},r}();var W0=function(){function r(e){this.ondata=e,Ka([Xa,F0,function(){return[Fi,hi,Th]}],this,0,function(){var t=new Th;onmessage=Fi(t)},9)}return r}();function j0(r,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Za(r,e,[Xa,F0,function(){return[Mh]}],function(n){return Ps(Mh(n.data[0]))},3,t)}function Mh(r,e){return hc(r.subarray(tp(r),-8),e||new Et(G0(r)))}var Yd=function(){function r(e,t){this.c=$d(),this.v=1,wr.call(this,e,t)}return r.prototype.push=function(e,t){wr.prototype.push.call(this,e,t)},r.prototype.p=function(e,t){this.c.p(e);var n=fo(e,this.o,this.v&&2,t&&4,!t);this.v&&(ip(n,this.o),this.v=0),t&&Ft(n,n.length-4,this.c.d()),this.ondata(n,t)},r}();var H1=function(){function r(e,t){Ka([Ya,U0,function(){return[Fi,wr,Yd]}],this,rp.call(this,e,t),function(n){var i=new Yd(n.data);onmessage=Fi(i)},10)}return r}();function W1(r,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Za(r,e,[Ya,U0,function(){return[Zd]}],function(n){return Ps(Zd(n.data[0],n.data[1]))},4,t)}function Zd(r,e){e||(e={});var t=$d();t.p(r);var n=fo(r,e,2,4);return ip(n,e),Ft(n,n.length-4,t.d()),n}var wh=function(){function r(e){this.v=1,hi.call(this,e)}return r.prototype.push=function(e,t){if(hi.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}hi.prototype.c.call(this,t)},r}();var q0=function(){function r(e){this.ondata=e,Ka([Xa,B0,function(){return[Fi,hi,wh]}],this,0,function(){var t=new wh;onmessage=Fi(t)},11)}return r}();function X0(r,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return Za(r,e,[Xa,B0,function(){return[Va]}],function(n){return Ps(Va(n.data[0],Qd(n.data[1])))},5,t)}function Va(r,e){return hc((z0(r),r.subarray(2,-4)),e)}var Y0=function(){function r(e){this.G=Th,this.I=hi,this.Z=wh,this.ondata=e}return r.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new Et(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;if(this.p.length>2){var i=this,s=function(){i.ondata.apply(i,arguments)};this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(s):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(s):new this.Z(s),this.s.push(this.p,t),this.p=null}}},r}();var j1=function(){function r(e){this.G=W0,this.I=sp,this.Z=q0,this.ondata=e}return r.prototype.push=function(e,t){Y0.prototype.push.call(this,e,t)},r}();function q1(r,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";return r[0]==31&&r[1]==139&&r[2]==8?j0(r,e,t):(r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31?op(r,e,t):X0(r,e,t)}function X1(r,e){return r[0]==31&&r[1]==139&&r[2]==8?Mh(r,e):(r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31?Ja(r,e):Va(r,e)}var ap=function(r,e,t,n){for(var i in r){var s=r[i],o=e+i;s instanceof Et?t[o]=[s,n]:Array.isArray(s)?t[o]=[s[0],fc(n,s[1])]:ap(s,o+"/",t,n)}},T0=typeof TextEncoder<"u"&&new TextEncoder,Kd=typeof TextDecoder<"u"&&new TextDecoder,Z0=0;try{Kd.decode(Yr,{stream:!0}),Z0=1}catch{}var K0=function(r){for(var e="",t=0;;){var n=r[t++],i=(n>127)+(n>223)+(n>239);if(t+i>r.length)return[e,ki(r,t-1)];i?i==3?(n=((n&15)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,e+=String.fromCharCode(55296|n>>10,56320|n&1023)):i&1?e+=String.fromCharCode((n&31)<<6|r[t++]&63):e+=String.fromCharCode((n&15)<<12|(r[t++]&63)<<6|r[t++]&63):e+=String.fromCharCode(n)}},Y1=function(){function r(e){this.ondata=e,Z0?this.t=new TextDecoder:this.p=Yr}return r.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}return}if(!this.p)throw"stream finished";var n=new Et(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var i=K0(n),s=i[0],o=i[1];if(t){if(o.length)throw"invalid utf-8 data";this.p=null}else this.p=o;this.ondata(s,t)},r}();var Z1=function(){function r(e){this.ondata=e}return r.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(Rs(e),this.d=t||!1)},r}();function Rs(r,e){if(e){for(var t=new Et(r.length),n=0;n<r.length;++n)t[n]=r.charCodeAt(n);return t}if(T0)return T0.encode(r);for(var i=r.length,s=new Et(r.length+(r.length>>1)),o=0,a=function(u){s[o++]=u},n=0;n<i;++n){if(o+5>s.length){var c=new Et(o+8+(i-n<<1));c.set(s),s=c}
vendor: 5,904 bytes, line 3144
3144var l=r.charCodeAt(n);l<128||e?a(l):l<2048?(a(192|l>>6),a(128|l&63)):l>55295&&l<57344?(l=65536+(l&1023<<10)|r.charCodeAt(++n)&1023,a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|l&63)):(a(224|l>>12),a(128|l>>6&63),a(128|l&63))}return ki(s,0,o)}function lp(r,e){if(e){for(var t="",n=0;n<r.length;n+=16384)t+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return t}else{if(Kd)return Kd.decode(r);var i=K0(r),s=i[0],o=i[1];if(o.length)throw"invalid utf-8 data";return s}}var J0=function(r){return r==1?3:r<6?2:r==9?1:0},$0=function(r,e){return e+30+Jn(r,e+26)+Jn(r,e+28)},Q0=function(r,e,t){var n=Jn(r,e+28),i=lp(r.subarray(e+46,e+46+n),!(Jn(r,e+8)&2048)),s=e+46+n,o=ln(r,e+20),a=t&&o==4294967295?ex(r,s):[o,ln(r,e+24),ln(r,e+42)],c=a[0],l=a[1],u=a[2];return[Jn(r,e+10),c,l,i,s+Jn(r,e+30)+Jn(r,e+32),u]},ex=function(r,e){for(;Jn(r,e)!=1;e+=4+Jn(r,e+2));return[zd(r,e+12),zd(r,e+4),zd(r,e+20)]},Is=function(r){var e=0;if(r)for(var t in r){var n=r[t].length;if(n>65535)throw"extra field too long";e+=n+4}return e},Ha=function(r,e,t,n,i,s,o,a){var c=n.length,l=t.extra,u=a&&a.length,h=Is(l);Ft(r,e,o!=null?33639248:67324752),e+=4,o!=null&&(r[e++]=20,r[e++]=t.os),r[e]=20,e+=2,r[e++]=t.flag<<1|(s==null&&8),r[e++]=i&&8,r[e++]=t.compression&255,r[e++]=t.compression>>8;var f=new Date(t.mtime==null?Date.now():t.mtime),p=f.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(Ft(r,e,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>>1),e+=4,s!=null&&(Ft(r,e,t.crc),Ft(r,e+4,s),Ft(r,e+8,t.size)),Ft(r,e+12,c),Ft(r,e+14,h),e+=16,o!=null&&(Ft(r,e,u),Ft(r,e+6,t.attrs),Ft(r,e+10,o),e+=14),r.set(n,e),e+=c,h)for(var g in l){var m=l[g],d=m.length;Ft(r,e,+g),Ft(r,e+2,d),r.set(m,e+4),e+=4+d}return u&&(r.set(a,e),e+=u),e},cp=function(r,e,t,n,i){Ft(r,e,101010256),Ft(r,e+8,t),Ft(r,e+10,t),Ft(r,e+12,n),Ft(r,e+16,i)},cc=function(){function r(e){this.filename=e,this.c=qa(),this.size=0,this.compression=0}return r.prototype.process=function(e,t){this.ondata(null,e,t)},r.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},r}();var K1=function(){function r(e,t){var n=this;t||(t={}),cc.call(this,e),this.d=new wr(t,function(i,s){n.ondata(null,i,s)}),this.compression=8,this.flag=J0(t.level)}return r.prototype.process=function(e,t){try{this.d.push(e,t)}catch(n){this.ondata(n,null,t)}},r.prototype.push=function(e,t){cc.prototype.push.call(this,e,t)},r}();var J1=function(){function r(e,t){var n=this;t||(t={}),cc.call(this,e),this.d=new V0(t,function(i,s,o){n.ondata(i,s,o)}),this.compression=8,this.flag=J0(t.level),this.terminate=this.d.terminate}return r.prototype.process=function(e,t){this.d.push(e,t)},r.prototype.push=function(e,t){cc.prototype.push.call(this,e,t)},r}();var $1=function(){function r(e){this.ondata=e,this.u=[],this.d=1}return r.prototype.add=function(e){var t=this;if(this.d&2)throw"stream finished";var n=Rs(e.filename),i=n.length,s=e.comment,o=s&&Rs(s),a=i!=e.filename.length||o&&s.length!=o.length,c=i+Is(e.extra)+30;if(i>65535)throw"filename too long";var l=new Et(c);Ha(l,0,e,n,a);var u=[l],h=function(){for(var d=0,x=u;d<x.length;d++){var _=x[d];t.ondata(null,_,!1)}u=[]},f=this.d;this.d=0;var p=this.u.length,g=fc(e,{f:n,u:a,o,t:function(){e.terminate&&e.terminate()},r:function(){if(h(),f){var d=t.u[p+1];d?d.r():t.d=1}f=1}}),m=0;e.ondata=function(d,x,_){if(d)t.ondata(d,x,_),t.terminate();else if(m+=x.length,u.push(x),_){var v=new Et(16);Ft(v,0,134695760),Ft(v,4,e.crc),Ft(v,8,m),Ft(v,12,e.size),u.push(v),g.c=m,g.b=c+m+16,g.crc=e.crc,g.size=e.size,f&&g.r(),f=1}else f&&h()},this.u.push(g)},r.prototype.end=function(){var e=this;if(this.d&2)throw this.d&1?"stream finishing":"stream finished";this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},r.prototype.e=function(){for(var e=0,t=0,n=0,i=0,s=this.u;i<s.length;i++){var o=s[i];n+=46+o.f.length+Is(o.extra)+(o.o?o.o.length:0)}for(var a=new Et(n+22),c=0,l=this.u;c<l.length;c++){var o=l[c];Ha(a,e,o,o.f,o.u,o.c,t,o.o),e+=46+o.f.length+Is(o.extra)+(o.o?o.o.length:0),t+=o.b}cp(a,e,this.u.length,n,t),this.ondata(null,a,!0),this.d=2},r.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++){var n=t[e];n.t()}this.d=2},r}();function Q1(r,e,t){if(t||(t=e,e={}),typeof t!="function")throw"no callback";var n={};ap(r,"",n,e);var i=Object.keys(n),s=i.length,o=0,a=0,c=s,l=new Array(s),u=[],h=function(){for(var m=0;m<u.length;++m)u[m]()},f=function(){var m=new Et(a+22),d=o,x=a-o;a=0;for(var _=0;_<c;++_){var v=l[_];try{var y=v.c.length;Ha(m,a,v,v.f,v.u,y);var w=30+v.f.length+Is(v.extra),L=a+w;m.set(v.c,L),Ha(m,o,v,v.f,v.u,y,a,v.m),o+=16+w+(v.m?v.m.length:0),a=L+y}catch(C){return t(C,null)}}cp(m,o,l.length,x,d),t(null,m)};s||f();for(var p=function(m){var d=i[m],x=n[d],_=x[0],v=x[1],y=qa(),w=_.length;y.p(_);var L=Rs(d),C=L.length,b=v.comment,A=b&&Rs(b),N=A&&A.length,G=Is(v.extra),F=v.level==0?0:8,U=function(P,$){if(P)h(),t(P,null);else{var H=$.length;l[m]=fc(v,{size:w,crc:y.d(),c:$,f:L,m:A,u:C!=d.length||A&&b.length!=N,compression:F}),o+=30+C+G+H,a+=76+2*(C+G)+(N||0)+H,--s||f()}};if(C>65535&&U("filename too long",null),!F)U(null,_);else if(w<16e4)try{U(null,dc(_,v))}catch(P){U(P,null)}else u.push(H0(_,v,U))},g=0;g<c;++g)p(g);return h}function ew(r,e){e||(e={});var t={},n=[];ap(r,"",t,e);var i=0,s=0;for(var o in t){var a=t[o],c=a[0],l=a[1],u=l.level==0?0:8,h=Rs(o),f=h.length,p=l.comment,g=p&&Rs(p),m=g&&g.length,d=Is(l.extra);if(f>65535)throw"filename too long";var x=u?dc(c,l):c,_=x.length,v=qa();v.p(c),n.push(fc(l,{size:c.length,crc:v.d(),c:x,f:h,m:g,u:f!=o.length||g&&p.length!=m,o:i,compression:u})),i+=30+f+d+_,s+=76+2*(f+d)+(m||0)+_}for(var y=new Et(s+22),w=i,L=s-i,C=0;C<n.length;++C){var h=n[C];Ha(y,h.o,h,h.f,h.u,h.c.length);var b=30+h.f.length+Is(h.extra);
3144y.set(h.c,h.o+b),Ha(y,i,h,h.f,h.u,h.c.length,h.o,h.m),i+=16+b+(h.m?h.m.length:0)}return cp(y,i,n.length,L,w),y}var tx=function(){function r(){}return r.prototype.push=function(e,t){this.ondata(null,e,t)},r.compression=0,r}();var tw=function(){function r(){var e=this;this.i=new hi(function(t,n){e.ondata(null,t,n)})}return r.prototype.push=function(e,t){try{this.i.push(e,t)}catch(n){this.ondata(n,e,t)}},r.compression=8,r}();var nw=function(){function r(e,t){var n=this;t<32e4?this.i=new hi(function(i,s){n.ondata(null,i,s)}):(this.i=new sp(function(i,s,o){n.ondata(i,s,o)}),this.terminate=this.i.terminate)}return r.prototype.push=function(e,t){this.i.terminate&&(e=ki(e,0)),this.i.push(e,t)},r.compression=8,r}();var iw=function(){function r(e){this.onfile=e,this.k=[],this.o={0:tx},this.p=Yr}return r.prototype.push=function(e,t){var n=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(this.c>0){var i=Math.min(this.c,e.length),s=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(s,!this.c):this.k[0].push(s),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,a=0,c=void 0,l=void 0;this.p.length?e.length?(l=new Et(this.p.length+e.length),l.set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,h=this.c,f=h&&this.d,p=function(){var x,_=ln(l,a);if(_==67324752){o=1,c=a,g.d=null,g.c=0;var v=Jn(l,a+6),y=Jn(l,a+8),w=v&2048,L=v&8,C=Jn(l,a+26),b=Jn(l,a+28);if(u>a+30+C+b){var A=[];g.k.unshift(A),o=2;var N=ln(l,a+18),G=ln(l,a+22),F=lp(l.subarray(a+30,a+=30+C),!w);N==4294967295?(x=L?[-2]:ex(l,a),N=x[0],G=x[1]):L&&(N=-1),a+=b,g.c=N;var U,P={name:F,compression:y,start:function(){if(!P.ondata)throw"no callback";if(!N)P.ondata(null,Yr,!0);else{var $=n.o[y];if(!$)throw"unknown compression type "+y;U=N<0?new $(F):new $(F,N,G),U.ondata=function(oe,ue,ne){P.ondata(oe,ue,ne)};for(var H=0,Z=A;H<Z.length;H++){var W=Z[H];U.push(W,!1)}n.k[0]==A&&n.c?n.d=U:U.push(Yr,!0)}},terminate:function(){U&&U.terminate&&U.terminate()}};N>=0&&(P.size=N,P.originalSize=G),g.onfile(P)}return"break"}else if(h){if(_==134695760)return c=a+=12+(h==-2&&8),o=3,g.c=0,"break";if(_==33639248)return c=a-=4,o=3,g.c=0,"break"}},g=this;a<u-4;++a){var m=p();if(m==="break")break}if(this.p=Yr,h<0){var d=o?l.subarray(0,c-12-(h==-2&&8)-(ln(l,c-16)==134695760&&4)):l.subarray(0,a);f?f.push(d,!!o):this.k[+(o==2)].push(d)}if(o&2)return this.push(l.subarray(a),t);this.p=l.subarray(a)}if(t){if(this.c)throw"invalid zip file";this.p=null}},r.prototype.register=function(e){this.o[e.compression]=e},r}();function rw(r,e){if(typeof e!="function")throw"no callback";for(var t=[],n=function(){for(var f=0;f<t.length;++f)t[f]()},i={},s=r.length-22;ln(r,s)!=101010256;--s)if(!s||r.length-s>65558){e("invalid zip file",null);return}var o=Jn(r,s+8);o||e(null,{});var a=o,c=ln(r,s+16),l=c==4294967295;if(l){if(s=ln(r,s-12),ln(r,s)!=101075792){e("invalid zip file",null);return}a=o=ln(r,s+32),c=ln(r,s+48)}for(var u=function(f){var p=Q0(r,c,l),g=p[0],m=p[1],d=p[2],x=p[3],_=p[4],v=p[5],y=$0(r,v);c=_;var w=function(C,b){C?(n(),e(C,null)):(i[x]=b,--o||e(null,i))};if(!g)w(null,ki(r,y,y+m));else if(g==8){var L=r.subarray(y,y+m);if(m<32e4)try{w(null,Ja(L,new Et(d)))}catch(C){w(C,null)}else t.push(op(L,{size:d},w))}else w("unknown compression type "+g,null)},h=0;h<a;++h)u(h);return n}function up(r){for(var e={},t=r.length-22;ln(r,t)!=101010256;--t)if(!t||r.length-t>65558)throw"invalid zip file";var n=Jn(r,t+8);if(!n)return{};var i=ln(r,t+16),s=i==4294967295;if(s){if(t=ln(r,t-12),ln(r,t)!=101075792)throw"invalid zip file";n=ln(r,t+32),i=ln(r,t+48)}for(var o=0;o<n;++o){var a=Q0(r,i,s),c=a[0],l=a[1],u=a[2],h=a[3],f=a[4],p=a[5],g=$0(r,p);if(i=f,!c)e[h]=ki(r,g,g+l);else if(c==8)e[h]=Ja(r.subarray(g,g+l),new Et(u));else throw"unknown compression type "+c}return e}function nx(r,e,t){let n=t.length-r-1;if(e>=t[n])return n-1;if(e<=t[r])return r;let i=r,s=n,o=Math.floor((i+s)/2);for(;e<t[o]||e>=t[o+1];)e<t[o]?s=o:i=o,o=Math.floor((i+s)/2);return o}function sw(r,e,t,n){let i=[],s=[],o=[];i[0]=1;for(let a=1;a<=t;++a){s[a]=e-n[r+1-a],o[a]=n[r+a]-e;let c=0;for(let l=0;l<a;++l){let u=o[l+1],h=s[a-l],f=i[l]/(u+h);i[l]=c+u*f,c=h*f}i[a]=c}return i}function ix(r,e,t,n){let i=nx(r,n,e),s=sw(i,n,r,e),o=new St(0,0,0,0);for(let a=0;a<=r;++a){let c=t[i-r+a],l=s[a],u=c.w*l;o.x+=c.x*u,o.y+=c.y*u,o.z+=c.z*u,o.w+=c.w*l}return o}function ow(r,e,t,n,i){let s=[];for(let h=0;h<=t;++h)s[h]=0;let o=[];for(let h=0;h<=n;++h)o[h]=s.slice(0);let a=[];for(let h=0;h<=t;++h)a[h]=s.slice(0);a[0][0]=1;let c=s.slice(0),l=s.slice(0);for(let h=1;h<=t;++h){c[h]=e-i[r+1-h],l[h]=i[r+h]-e;let f=0;for(let p=0;p<h;++p){let g=l[p+1],m=c[h-p];a[h][p]=g+m;let d=a[p][h-1]/a[h][p];a[p][h]=f+g*d,f=m*d}a[h][h]=f}for(let h=0;h<=t;++h)o[0][h]=a[h][t];for(let h=0;h<=t;++h){let f=0,p=1,g=[];for(let m=0;m<=t;++m)g[m]=s.slice(0);g[0][0]=1;for(let m=1;m<=n;++m){let d=0,x=h-m,_=t-m;h>=m&&(g[p][0]=g[f][0]/a[_+1][x],d=g[p][0]*a[x][_]);let v=x>=-1?1:-x,y=h-1<=_?m-1:t-h;for(let L=v;L<=y;++L)g[p][L]=(g[f][L]-g[f][L-1])/a[_+1][x+L],d+=g[p][L]*a[x+L][_];h<=_&&(g[p][m]=-g[f][m-1]/a[_+1][h],d+=g[p][m]*a[h][_]),o[m][h]=d;let w=f;f=p,p=w}}let u=t;for(let h=1;h<=n;++h){for(let f=0;f<=t;++f)o[h][f]*=u;u*=t-h}return o}function aw(r,e,t,n,i){let s=i<r?i:r,o=[],a=nx(r,n,e),c=ow(a,n,r,s,e),l=[];for(let u=0;u<t.length;++u){let h=t[u].clone(),f=h.w;h.x*=f,h.y*=f,h.z*=f,l[u]=h}for(let u=0;u<=s;++u){let h=l[a-r].clone().multiplyScalar(c[u][0]);for(let f=1;f<=r;++f)h.add(l[a-r+f].clone().multiplyScalar(c[u][f]));o[u]=h}for(let u=s+1;u<=i+1;++u)o[u]=new St(0,0,0);return o}function lw(r,e){let t=1;for(let i=2;i<=r;++i)t*=i;let n=1;for(let i=2;i<=e;++i)n*=i;for(let i=2;i<=r-e;++i)n*=i;return t/n}function cw(r){let e=r.length,t=[],n=[];for(let s=0;s<e;++s){let o=r[s];t[s]=new ae(o.x,o.y,o.z),n[s]=o.w}let i=[];for(let s=0;s<e;++s){let o=t[s].clone();for(let a=1;a<=s;++a)o.sub(i[s-a].clone().multiplyScalar(lw(s,a)*n[a]));i[s]=o.divideScalar(n[0])}return i}function rx(r,e,t,n,i){let s=aw(r,e,t,n,i);return cw(s)}var pc=class extends si{constructor(e,t,n,i,s){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=i||0,this.endKnot=s||this.knots.length-1;for(let o=0;o<n.length;++o){let a=n[o];this.controlPoints[o]=new St(a.x,a.y,a.z,a.w)}}getPoint(e,t=new ae){let n=t,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=ix(this.degree,this.knots,this.controlPoints,i);return s.w!==1&&s.divideScalar(s.w),n.set(s.x,s.y,s.z)}
3144getTangent(e,t=new ae){let n=t,i=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=rx(this.degree,this.knots,this.controlPoints,i,1);return n.copy(s[1]).normalize(),n}};var bt,cn,fi,Ah=class extends Un{constructor(e){super(e)}load(e,t,n,i){let s=this,o=s.path===""?oi.extractUrlBase(e):s.path,a=new vi(this.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(c,o))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e,t){if(hw(e))bt=new xp().parse(e);else{let i=cx(e);if(!fw(i))throw new Error("THREE.FBXLoader: Unknown format.");if(sx(i)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+sx(i));bt=new gp().parse(i)}let n=new Li(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new dp(n,this.manager).parse(bt)}},dp=class{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){cn=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),i=this.parseDeformers(),s=new pp().parse(i);return this.parseScene(i,s,n),fi}parseConnections(){let e=new Map;return"Connections"in bt&&bt.Connections.connections.forEach(function(n){let i=n[0],s=n[1],o=n[2];e.has(i)||e.set(i,{parents:[],children:[]});let a={ID:s,relationship:o};e.get(i).parents.push(a),e.has(s)||e.set(s,{parents:[],children:[]});let c={ID:i,relationship:o};e.get(s).children.push(c)}),e}parseImages(){let e={},t={};if("Video"in bt.Objects){let n=bt.Objects.Video;for(let i in n){let s=n[i],o=parseInt(i);if(e[o]=s.RelativeFilename||s.Filename,"Content"in s){let a=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,c=typeof s.Content=="string"&&s.Content!=="";if(a||c){let l=this.parseImage(n[i]);t[s.RelativeFilename||s.Filename]=l}}}}for(let n in e){let i=e[n];t[i]!==void 0?e[n]=t[i]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase(),s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{let o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){let t=new Map;if("Texture"in bt.Objects){let n=bt.Objects.Texture;for(let i in n){let s=this.parseTexture(n[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){let n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;let i=e.WrapModeU,s=e.WrapModeV,o=i!==void 0?i.value:0,a=s!==void 0?s.value:0;if(n.wrapS=o===0?$t:Wt,n.wrapT=a===0?$t:Wt,"Scaling"in e){let c=e.Scaling.value;n.repeat.x=c[0],n.repeat.y=c[1]}if("Translation"in e){let c=e.Translation.value;n.offset.x=c[0],n.offset.y=c[1]}return n}loadTexture(e,t){let n,i=this.textureLoader.path,s=cn.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(n=t[s[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o,a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){let c=this.manager.getHandler(".tga");c===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new pn):(c.setPath(this.textureLoader.path),o=c.load(n))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new pn):o=this.textureLoader.load(n);return this.textureLoader.setPath(i),o}parseMaterials(e){let t=new Map;if("Material"in bt.Objects){let n=bt.Objects.Material;for(let i in n){let s=this.parseMaterial(n[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){let n=e.id,i=e.attrName,s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!cn.has(n))return null;let o=this.parseParameters(e,t,n),a;switch(s.toLowerCase()){case"phong":a=new Qt;break;case"lambert":a=new Ma;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new Qt;break}return a.setValues(o),a.name=i,a}parseParameters(e,t,n){let i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new $e().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new $e().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new $e().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new $e().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new $e().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new $e().fromArray(e.SpecularColor.value));let s=this;
3144return cn.get(n).children.forEach(function(o){let a=o.relationship;switch(a){case"Bump":i.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,o.ID),i.map!==void 0&&(i.map.encoding=It);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,o.ID),i.emissiveMap!==void 0&&(i.emissiveMap.encoding=It);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,o.ID),i.envMap!==void 0&&(i.envMap.mapping=Vl,i.envMap.encoding=It);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.encoding=It);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,o.ID),i.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.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in bt.Objects&&t in bt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=cn.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if("Deformer"in bt.Objects){let n=bt.Objects.Deformer;for(let i in n){let s=n[i],o=cn.get(parseInt(i));if(s.attrType==="Skin"){let a=this.parseSkeleton(o,n);a.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[i]=a}else if(s.attrType==="BlendShape"){let a={id:i};a.rawTargets=this.parseMorphTargets(o,n),a.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(i){let s=t[i.ID];if(s.attrType!=="Cluster")return;let o={ID:i.ID,indices:[],weights:[],transformLink:new Xe().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),n.push(o)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){let n=[];for(let i=0;i<e.children.length;i++){let s=e.children[i],o=t[s.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;a.geoID=cn.get(parseInt(s.ID)).children.filter(function(c){return c.relationship===void 0})[0].ID,n.push(a)}return n}parseScene(e,t,n){fi=new bn;let i=this.parseModels(e.skeletons,t,n),s=bt.Objects.Model,o=this;i.forEach(function(c){let l=s[c.ID];o.setLookAtProperties(c,l),cn.get(c.ID).parents.forEach(function(h){let f=i.get(h.ID);f!==void 0&&f.add(c)}),c.parent===null&&fi.add(c)}),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),fi.traverse(function(c){if(c.userData.transformData){c.parent&&(c.userData.transformData.parentMatrix=c.parent.matrix,c.userData.transformData.parentMatrixWorld=c.parent.matrixWorld);let l=ax(c.userData.transformData);c.applyMatrix4(l),c.updateWorldMatrix()}});let a=new mp().parse();fi.children.length===1&&fi.children[0].isGroup&&(fi.children[0].animations=a,fi=fi.children[0]),fi.animations=a}parseModels(e,t,n){let i=new Map,s=bt.Objects.Model;for(let o in s){let a=parseInt(o),c=s[o],l=cn.get(a),u=this.buildSkeleton(l,e,a,c.attrName);if(!u){switch(c.attrType){case"Camera":u=this.createCamera(l);break;case"Light":u=this.createLight(l);break;case"Mesh":u=this.createMesh(l,t,n);break;case"NurbsCurve":u=this.createCurve(l,t);break;case"LimbNode":case"Root":u=new ys;break;case"Null":default:u=new bn;break}u.name=c.attrName?At.sanitizeNodeName(c.attrName):"",u.ID=a}this.getTransformData(u,c),i.set(a,u)}return i}buildSkeleton(e,t,n,i){let s=null;return e.parents.forEach(function(o){for(let a in t){let c=t[a];c.rawBones.forEach(function(l,u){if(l.ID===o.ID){let h=s;s=new ys,s.matrixWorld.copy(l.transformLink),s.name=i?At.sanitizeNodeName(i):"",s.ID=n,c.bones[u]=s,h!==null&&s.add(h)}})}}),s}createCamera(e){let t,n;
3144if(e.children.forEach(function(i){let s=bt.Objects.NodeAttribute[i.ID];s!==void 0&&(n=s)}),n===void 0)t=new xt;else{let i=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(i=1);let s=1;n.NearPlane!==void 0&&(s=n.NearPlane.value/1e3);let o=1e3;n.FarPlane!==void 0&&(o=n.FarPlane.value/1e3);let a=window.innerWidth,c=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(a=n.AspectWidth.value,c=n.AspectHeight.value);let l=a/c,u=45;n.FieldOfView!==void 0&&(u=n.FieldOfView.value);let h=n.FocalLength?n.FocalLength.value:null;switch(i){case 0:t=new Zt(u,l,s,o),h!==null&&t.setFocalLength(h);break;case 1:t=new gr(-a/2,a/2,c/2,-c/2,s,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),t=new xt;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(i){let s=bt.Objects.NodeAttribute[i.ID];s!==void 0&&(n=s)}),n===void 0)t=new xt;else{let i;n.LightType===void 0?i=0:i=n.LightType.value;let s=16777215;n.Color!==void 0&&(s=new $e().fromArray(n.Color.value));let o=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(o=0);let a=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?a=0:a=n.FarAttenuationEnd.value);let c=1;switch(i){case 0:t=new uo(s,o,a,c);break;case 1:t=new yr(s,o);break;case 2:let l=Math.PI/3;n.InnerAngle!==void 0&&(l=Bn.degToRad(n.InnerAngle.value));let u=0;n.OuterAngle!==void 0&&(u=Bn.degToRad(n.OuterAngle.value),u=Math.max(u,1)),t=new Ea(s,o,a,l,u,c);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new uo(s,o);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let i,s=null,o=null,a=[];return e.children.forEach(function(c){t.has(c.ID)&&(s=t.get(c.ID)),n.has(c.ID)&&a.push(n.get(c.ID))}),a.length>1?o=a:a.length>0?o=a[0]:(o=new Qt({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(c){c.vertexColors=!0}),s.FBX_Deformer?(i=new va(s,o),i.normalizeSkinWeights()):i=new kt(s,o),i}createCurve(e,t){let n=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),i=new Ri({color:3342591,linewidth:1});return new oo(n,i)}getTransformData(e,t){let n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=lx(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&cn.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){let s=bt.Objects.Model[i.ID];if("Lcl_Translation"in s){let o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),fi.add(e.target)):e.lookAt(new ae().fromArray(o))}}})}bindSkeleton(e,t,n){let i=this.parsePoseNodes();for(let s in e){let o=e[s];cn.get(parseInt(o.ID)).parents.forEach(function(c){if(t.has(c.ID)){let l=c.ID;cn.get(l).parents.forEach(function(h){n.has(h.ID)&&n.get(h.ID).bind(new vs(o.bones),i[h.ID])})}})}}parsePoseNodes(){let e={};if("Pose"in bt.Objects){let t=bt.Objects.Pose;for(let n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){let i=t[n].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new Xe().fromArray(s.Matrix.a)}):e[i.Node]=new Xe().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in bt&&"AmbientColor"in bt.GlobalSettings){let e=bt.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],i=e[2];if(t!==0||n!==0||i!==0){let s=new $e(t,n,i);fi.add(new vr(s,1))}}}},pp=class{constructor(){this.negativeMaterialIndices=!1}parse(e){let t=new Map;if("Geometry"in bt.Objects){let n=bt.Objects.Geometry;for(let i in n){let s=cn.get(parseInt(i)),o=this.parseGeometry(s,n[i],e);t.set(parseInt(i),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invali
3144d (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){let i=n.skeletons,s=[],o=e.parents.map(function(h){return bt.Objects.Model[h.ID]});if(o.length===0)return;let a=e.children.reduce(function(h,f){return i[f.ID]!==void 0&&(h=i[f.ID]),h},null);e.children.forEach(function(h){n.morphTargets[h.ID]!==void 0&&s.push(n.morphTargets[h.ID])});let c=o[0],l={};"RotationOrder"in c&&(l.eulerOrder=lx(c.RotationOrder.value)),"InheritType"in c&&(l.inheritType=parseInt(c.InheritType.value)),"GeometricTranslation"in c&&(l.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(l.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(l.scale=c.GeometricScaling.value);let u=ax(l);return this.genGeometry(t,a,s,u)}genGeometry(e,t,n,i){let s=new yt;e.attrName&&(s.name=e.attrName);let o=this.parseGeoNode(e,t),a=this.genBuffers(o),c=new je(a.vertex,3);if(c.applyMatrix4(i),s.setAttribute("position",c),a.colors.length>0&&s.setAttribute("color",new je(a.colors,3)),t&&(s.setAttribute("skinIndex",new xa(a.weightsIndices,4)),s.setAttribute("skinWeight",new je(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){let l=new Jt().getNormalMatrix(i),u=new je(a.normal,3);u.applyNormalMatrix(l),s.setAttribute("normal",u)}
3144if(a.uvs.forEach(function(l,u){let h="uv"+(u+1).toString();u===0&&(h="uv"),s.setAttribute(h,new je(a.uvs[u],2))}),o.material&&o.material.mappingType!=="AllSame"){let l=a.materialIndex[0],u=0;if(a.materialIndex.forEach(function(h,f){h!==l&&(s.addGroup(u,f-u,l),l=h,u=f)}),s.groups.length>0){let h=s.groups[s.groups.length-1],f=h.start+h.count;f!==a.materialIndex.length&&s.addGroup(f,a.materialIndex.length-f,l)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,n,i),s}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(o,a){n.weightTable[o]===void 0&&(n.weightTable[o]=[]),n.weightTable[o].push({id:s,weight:i.weights[a]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,i=0,s=!1,o=[],a=[],c=[],l=[],u=[],h=[],f=this;return e.vertexIndices.forEach(function(p,g){let m,d=!1;p<0&&(p=p^-1,d=!0);let x=[],_=[];if(o.push(p*3,p*3+1,p*3+2),e.color){let v=Eh(g,n,p,e.color);c.push(v[0],v[1],v[2])}if(e.skeleton){if(e.weightTable[p]!==void 0&&e.weightTable[p].forEach(function(v){_.push(v.weight),x.push(v.id)}),_.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);let v=[0,0,0,0],y=[0,0,0,0];_.forEach(function(w,L){let C=w,b=x[L];y.forEach(function(A,N,G){if(C>A){G[N]=C,C=A;let F=v[N];v[N]=b,b=F}})}),x=v,_=y}for(;_.length<4;)_.push(0),x.push(0);for(let v=0;v<4;++v)u.push(_[v]),h.push(x[v])}if(e.normal){let v=Eh(g,n,p,e.normal);a.push(v[0],v[1],v[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=Eh(g,n,p,e.material)[0],m<0&&(f.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(v,y){let w=Eh(g,n,p,v);l[y]===void 0&&(l[y]=[]),l[y].push(w[0]),l[y].push(w[1])}),i++,d&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),f.genFace(t,e,o,m,a,c,l,u,h,i),n++,i=0,o=[],a=[],c=[],l=[],u=[],h=[])}),t}genFace(e,t,n,i,s,o,a,c,l,u){for(let h=2;h<u;h++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[(h-1)*3]]),e.vertex.push(t.vertexPositions[n[(h-1)*3+1]]),e.vertex.push(t.vertexPositions[n[(h-1)*3+2]]),e.vertex.push(t.vertexPositions[n[h*3]]),e.vertex.push(t.vertexPositions[n[h*3+1]]),e.vertex.push(t.vertexPositions[n[h*3+2]]),t.skeleton&&(e.vertexWeights.push(c[0]),e.vertexWeights.push(c[1]),e.vertexWeights.push(c[2]),e.vertexWeights.push(c[3]),e.vertexWeights.push(c[(h-1)*4]),e.vertexWeights.push(c[(h-1)*4+1]),e.vertexWeights.push(c[(h-1)*4+2]),e.vertexWeights.push(c[(h-1)*4+3]),e.vertexWeights.push(c[h*4]),e.vertexWeights.push(c[h*4+1]),e.vertexWeights.push(c[h*4+2]),e.vertexWeights.push(c[h*4+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.
3144weightsIndices.push(l[3]),e.weightsIndices.push(l[(h-1)*4]),e.weightsIndices.push(l[(h-1)*4+1]),e.weightsIndices.push(l[(h-1)*4+2]),e.weightsIndices.push(l[(h-1)*4+3]),e.weightsIndices.push(l[h*4]),e.weightsIndices.push(l[h*4+1]),e.weightsIndices.push(l[h*4+2]),e.weightsIndices.push(l[h*4+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[(h-1)*3]),e.colors.push(o[(h-1)*3+1]),e.colors.push(o[(h-1)*3+2]),e.colors.push(o[h*3]),e.colors.push(o[h*3+1]),e.colors.push(o[h*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(s[0]),e.normal.push(s[1]),e.normal.push(s[2]),e.normal.push(s[(h-1)*3]),e.normal.push(s[(h-1)*3+1]),e.normal.push(s[(h-1)*3+2]),e.normal.push(s[h*3]),e.normal.push(s[h*3+1]),e.normal.push(s[h*3+2])),t.uv&&t.uv.forEach(function(f,p){e.uvs[p]===void 0&&(e.uvs[p]=[]),e.uvs[p].push(a[p][0]),e.uvs[p].push(a[p][1]),e.uvs[p].push(a[p][(h-1)*2]),e.uvs[p].push(a[p][(h-1)*2+1]),e.uvs[p].push(a[p][h*2]),e.uvs[p].push(a[p][h*2+1])})}addMorphTargets(e,t,n,i){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];let s=this;n.forEach(function(o){o.rawTargets.forEach(function(a){let c=bt.Objects.Geometry[a.geoID];c!==void 0&&s.genMorphGeometry(e,t,c,i,a.name)})})}genMorphGeometry(e,t,n,i,s){let o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],a=n.Vertices!==void 0?n.Vertices.a:[],c=n.Indexes!==void 0?n.Indexes.a:[],l=e.attributes.position.count*3,u=new Float32Array(l);for(let g=0;g<c.length;g++){let m=c[g]*3;u[m]=a[g*3],u[m+1]=a[g*3+1],u[m+2]=a[g*3+2]}let h={vertexIndices:o,vertexPositions:u},f=this.genBuffers(h),p=new je(f.vertex,3);p.name=s||n.attrName,p.applyMatrix4(i),e.morphAttributes.position.push(p)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Normals.a,s=[];return n==="IndexToDirect"&&("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&&(s=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:s,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.UV.a,s=[];return n==="IndexToDirect"&&(s=e.UVIndex.a),{dataSize:2,buffer:i,indices:s,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Colors.a,s=[];return n==="IndexToDirect"&&(s=e.ColorIndex.a),{dataSize:4,buffer:i,indices:s,mappingType:t,referenceType:n}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};let i=e.Materials.a,s=[];for(let o=0;o<i.length;++o)s.push(o);return{dataSize:1,buffer:i,indices:s,mappingType:t,referenceType:n}}parseNurbsGeometry(e){if(pc===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new yt;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 yt;let n=t-1,i=e.KnotVector.a,s=[],o=e.Points.a;for(let h=0,f=o.length;h<f;h+=4)s.push(new St().fromArray(o,h));let a,c;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){a=n,c=i.length-1-a;for(let h=0;h<n;++h)s.push(s[h])}let u=new pc(n,i,s,a,c).getPoints(s.length*12);return new yt().setFromPoints(u)}},mp=class{parse(){let e=[],t=this.parseClips();if(t!==void 0)for(let n in t){let i=t[n],s=this.addClip(i);e.push(s)}return e}parseClips(){if(bt.Objects.AnimationCurve===void 0)return;let e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);let t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){let e=bt.Objects.AnimationCurveNode,t=new Map;for(let n in e){let i=e[n];if(i.attrName.match(/S|R|T|DeformPercent/)!==null){let s={id:i.id,attr:i.attrName,curves:{}};t.set(s.id,s)}}return t}parseAnimationCurves(e){let t=bt.Objects.AnimationCurve;for(let n in t){let i={id:t[n].id,times:t[n].KeyTime.a.map(dw),values:t[n].KeyValueFloat.a},s=cn.get(i.id);if(s!==void 0){let o=s.parents[0].ID,a=s.parents[0].relationship;a.match(/X/)?e.get(o).curves.x=i:a.match(/Y/)?e.get(o).curves.y=i:a.match(/Z/)?e.get(o).curves.z=i:a.match(/d|DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=i)}}}parseAnimationLayers(e){let t=bt.Objects.AnimationLayer,n=new Map;for(let i in t){let s=[],o=cn.get(parseInt(i));
3144o!==void 0&&(o.children.forEach(function(c,l){if(e.has(c.ID)){let u=e.get(c.ID);if(u.curves.x!==void 0||u.curves.y!==void 0||u.curves.z!==void 0){if(s[l]===void 0){let h=cn.get(c.ID).parents.filter(function(f){return f.relationship!==void 0})[0].ID;if(h!==void 0){let f=bt.Objects.Model[h.toString()];if(f===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",c);return}let p={modelName:f.attrName?At.sanitizeNodeName(f.attrName):"",ID:f.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};fi.traverse(function(g){g.ID===f.id&&(p.transform=g.matrix,g.userData.transformData&&(p.eulerOrder=g.userData.transformData.eulerOrder))}),p.transform||(p.transform=new Xe),"PreRotation"in f&&(p.preRotation=f.PreRotation.value),"PostRotation"in f&&(p.postRotation=f.PostRotation.value),s[l]=p}}s[l]&&(s[l][u.attr]=u)}else if(u.curves.morph!==void 0){if(s[l]===void 0){let h=cn.get(c.ID).parents.filter(function(x){return x.relationship!==void 0})[0].ID,f=cn.get(h).parents[0].ID,p=cn.get(f).parents[0].ID,g=cn.get(p).parents[0].ID,m=bt.Objects.Model[g],d={modelName:m.attrName?At.sanitizeNodeName(m.attrName):"",morphName:bt.Objects.Deformer[h].attrName};s[l]=d}s[l][u.attr]=u}}}),n.set(parseInt(i),s))}return n}parseAnimStacks(e){let t=bt.Objects.AnimationStack,n={};for(let i in t){let s=cn.get(parseInt(i)).children;s.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(s[0].ID);n[i]={name:t[i].attrName,layer:o}}return n}addClip(e){let t=[],n=this;return e.layer.forEach(function(i){t=t.concat(n.generateTracks(i))}),new co(e.name,-1,t)}generateTracks(e){let t=[],n=new ae,i=new mn,s=new ae;if(e.transform&&e.transform.decompose(n,i,s),n=n.toArray(),i=new Ln().setFromQuaternion(i,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){let o=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let o=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let o=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){let o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,n,i){let s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,n);return new Zi(e+"."+i,s,o)}generateRotationTrack(e,t,n,i,s,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Bn.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Bn.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Bn.degToRad));let a=this.getTimesForAllAxes(t),c=this.getKeyframeTrackValues(a,t,n);i!==void 0&&(i=i.map(Bn.degToRad),i.push(o),i=new Ln().fromArray(i),i=new mn().setFromEuler(i)),s!==void 0&&(s=s.map(Bn.degToRad),s.push(o),s=new Ln().fromArray(s),s=new mn().setFromEuler(s).invert());let l=new mn,u=new Ln,h=[];for(let f=0;f<c.length;f+=3)u.set(c[f],c[f+1],c[f+2],o),l.setFromEuler(u),i!==void 0&&l.premultiply(i),s!==void 0&&l.multiply(s),l.toArray(h,f/3*4);return new Yi(e+".quaternion",a,h)}generateMorphTrack(e){let t=e.DeformPercent.curves.morph,n=t.values.map(function(s){return s/100}),i=fi.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new ws(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}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(n,i){return n-i}),t.length>1){let n=1,i=t[0];for(let s=1;s<t.length;s++){let o=t[s];o!==i&&(t[n]=o,i=o,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){let i=n,s=[],o=-1,a=-1,c=-1;return e.forEach(function(l){if(t.x&&(o=t.x.times.indexOf(l)),t.y&&(a=t.y.times.indexOf(l)),t.z&&(c=t.z.times.indexOf(l)),o!==-1){let u=t.x.values[o];s.push(u),i[0]=u}else s.push(i[0]);if(a!==-1){let u=t.y.values[a];s.push(u),i[1]=u}else s.push(i[1]);if(c!==-1){let u=t.z.values[c];s.push(u),i[2]=u}else s.push(i[2])}),s}interpolateRotations(e){for(let t=1;t<e.values.length;t++){let n=e.values[t-1],i=e.values[t]-n,s=Math.abs(i);if(s>=180){let o=s/180,a=i/o,c=n+a,l=e.times[t-1],h=(e.times[t]-l)/o,f=l+h,p=[],g=[];for(;f<e.times[t];
3144)p.push(f),f+=h,g.push(c),c+=a;e.times=ox(e.times,t,p),e.values=ox(e.values,t,g)}}}},gp=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 Ih,this.nodeStack=[],this.currentProp=[],this.currentPropName="";let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(i,s){let o=i.match(/^[\s\t]*;/),a=i.match(/^[\s\t]*$/);if(o||a)return;let c=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),l=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=i.match("^\\t{"+(t.currentIndent-1)+"}}");c?t.parseNodeBegin(i,c):l?t.parseNodeProperty(i,l,n[++s]):u?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:n},o=this.parseNodeAttr(i),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,s):n in a?(n==="PoseNode"?a.PoseNode.push(s):a[n].id!==void 0&&(a[n]={},a[n][a[n].id]=a[n]),o.id!==""&&(a[n][o.id]=s)):typeof o.id=="number"?(a[n]={},a[n][o.id]=s):n!=="Properties70"&&(n==="PoseNode"?a[n]=[s]:a[n]=s),typeof o.id=="number"&&(s.id=o.id),o.name!==""&&(s.attrName=o.name),o.type!==""&&(s.attrType=o.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}}parseNodeProperty(e,t,n){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=n.replace(/"/g,"").replace(/,$/,"").trim());let o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){let c=s.split(",").slice(1),l=parseInt(c[0]),u=parseInt(c[1]),h=s.split(",").slice(3);h=h.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",s=[l,u],mw(s,h),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=s),i in o&&Array.isArray(o[i])?o[i].push(s):i!=="a"?o[i]=s:o.a=s,this.setCurrentProp(o,i),i==="a"&&s.slice(-1)!==","&&(o.a=fp(s))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=fp(t.a))}parseNodeSpecialProperty(e,t,n){let i=n.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],c=i[3],l=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=fp(l);break}this.getPrevNode()[s]={type:o,type2:a,flag:c,value:l},this.setCurrentProp(this.getPrevNode(),s)}},xp=class{parse(e){let t=new Ch(e);t.skip(23);let n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);let i=new Ih;for(;!this.endOfContent(t);){let s=this.parseNode(t,n);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let o=e.getUint8(),a=e.getString(o);if(i===0)return null;let c=[];for(let f=0;f<s;f++)c.push(this.parseProperty(e));let l=c.length>0?c[0]:"",u=c.length>1?c[1]:"",h=c.length>2?c[2]:"";for(n.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){let f=this.parseNode(e,t);f!==null&&this.parseSubNode(a,n,f)}return n.propertyList=c,typeof l=="number"&&(n.id=l),u!==""&&(n.attrName=u),h!==""&&(n.attrType=h),a!==""&&(n.name=a),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let i=n.propertyList[0];Array.isArray(i)?(t[n.name]=n,n.a=i):t[n.name]=i}else if(e==="Connections"&&n.name==="C"){let i=[];n.propertyList.forEach(function(s,o){o!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}
3144else if(n.name==="Properties70")Object.keys(n).forEach(function(s){t[s]=n[s]});else if(e==="Properties70"&&n.name==="P"){let i=n.propertyList[0],s=n.propertyList[1],o=n.propertyList[2],a=n.propertyList[3],c;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?c=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:c=n.propertyList[4],t[i]={type:s,type2:o,flag:a,value:c}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;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 n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":let i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}typeof Sh>"u"&&console.error("THREE.FBXLoader: External library fflate.min.js required.");let a=Va(new Uint8Array(e.getArrayBuffer(o))),c=new Ch(a.buffer);switch(t){case"b":case"c":return c.getBooleanArray(i);case"d":return c.getFloat64Array(i);case"f":return c.getFloat32Array(i);case"i":return c.getInt32Array(i);case"l":return c.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},Ch=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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=[];for(let i=0;i<e;i++)t[i]=this.getUint8();let n=t.indexOf(0);return n>=0&&(t=t.slice(0,n)),oi.decodeText(new Uint8Array(t))}},Ih=class{add(e,t){this[e]=t}};function hw(r){let e="Kaydara FBX Binary  \0";return r.byteLength>=e.length&&e===cx(r,0,e.length)}function fw(r){let e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],t=0;function n(i){let s=r[i-1];return r=r.slice(t+i),t++,s}for(let i=0;i<e.length;++i)if(n(1)===e[i])return!1;return!0}function sx(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 dw(r){return r/46186158e3}var pw=[];function Eh(r,e,t,n){let i;switch(n.mappingType){case"ByPolygonVertex":i=r;break;case"ByPolygon":i=e;break;
3144case"ByVertice":i=t;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(i=n.indices[i]);let s=i*n.dataSize,o=s+n.dataSize;return gw(pw,n.buffer,s,o)}var hp=new Ln,$a=new ae;function ax(r){let e=new Xe,t=new Xe,n=new Xe,i=new Xe,s=new Xe,o=new Xe,a=new Xe,c=new Xe,l=new Xe,u=new Xe,h=new Xe,f=new Xe,p=r.inheritType?r.inheritType:0;if(r.translation&&e.setPosition($a.fromArray(r.translation)),r.preRotation){let N=r.preRotation.map(Bn.degToRad);N.push(r.eulerOrder||Ln.DefaultOrder),t.makeRotationFromEuler(hp.fromArray(N))}if(r.rotation){let N=r.rotation.map(Bn.degToRad);N.push(r.eulerOrder||Ln.DefaultOrder),n.makeRotationFromEuler(hp.fromArray(N))}if(r.postRotation){let N=r.postRotation.map(Bn.degToRad);N.push(r.eulerOrder||Ln.DefaultOrder),i.makeRotationFromEuler(hp.fromArray(N)),i.invert()}r.scale&&s.scale($a.fromArray(r.scale)),r.scalingOffset&&a.setPosition($a.fromArray(r.scalingOffset)),r.scalingPivot&&o.setPosition($a.fromArray(r.scalingPivot)),r.rotationOffset&&c.setPosition($a.fromArray(r.rotationOffset)),r.rotationPivot&&l.setPosition($a.fromArray(r.rotationPivot)),r.parentMatrixWorld&&(h.copy(r.parentMatrix),u.copy(r.parentMatrixWorld));let g=t.clone().multiply(n).multiply(i),m=new Xe;m.extractRotation(u);let d=new Xe;d.copyPosition(u);let x=d.clone().invert().multiply(u),_=m.clone().invert().multiply(x),v=s,y=new Xe;if(p===0)y.copy(m).multiply(g).multiply(_).multiply(v);else if(p===1)y.copy(m).multiply(_).multiply(g).multiply(v);else{let G=new Xe().scale(new ae().setFromMatrixScale(h)).clone().invert(),F=_.clone().multiply(G);y.copy(m).multiply(g).multiply(F).multiply(v)}let w=l.clone().invert(),L=o.clone().invert(),C=e.clone().multiply(c).multiply(l).multiply(t).multiply(n).multiply(i).multiply(w).multiply(a).multiply(o).multiply(s).multiply(L),b=new Xe().copyPosition(C),A=u.clone().multiply(b);return f.copyPosition(A),C=f.clone().multiply(y),C.premultiply(u.invert()),C}function lx(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 fp(r){return r.split(",").map(function(t){return parseFloat(t)})}function cx(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=r.byteLength),oi.decodeText(new Uint8Array(r,e,t))}function mw(r,e){for(let t=0,n=r.length,i=e.length;t<i;t++,n++)r[n]=e[t]}function gw(r,e,t,n){for(let i=t,s=0;i<n;i++,s++)r[s]=e[i];return r}function ox(r,e,t){return r.slice(0,e).concat(t).concat(r.slice(e))}var Rh=class extends Un{constructor(e){super(e)}load(e,t,n,i){let s=this,o=s.path===""?oi.extractUrlBase(e):s.path,a=new vi(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(c,o))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e,t){function n(D,O){let X=[],V=D.childNodes;for(let Y=0,Me=V.length;Y<Me;Y++){let Ie=V[Y];Ie.nodeName===O&&X.push(Ie)}return X}function i(D){if(D.length===0)return[];let O=D.trim().split(/\s+/),X=new Array(O.length);for(let V=0,Y=O.length;V<Y;V++)X[V]=O[V];return X}function s(D){if(D.length===0)return[];let O=D.trim().split(/\s+/),X=new Array(O.length);for(let V=0,Y=O.length;V<Y;V++)X[V]=parseFloat(O[V]);return X}function o(D){if(D.length===0)return[];let O=D.trim().split(/\s+/),X=new Array(O.length);for(let V=0,Y=O.length;V<Y;V++)X[V]=parseInt(O[V]);return X}function a(D){return D.substring(1)}function c(){return"three_default_"+Kx++}function l(D){return Object.keys(D).length===0}function u(D){return{unit:h(n(D,"unit")[0]),upAxis:f(n(D,"up_axis")[0])}}function h(D){return D!==void 0&&D.hasAttribute("meter")===!0?parseFloat(D.getAttribute("meter")):1}function f(D){return D!==void 0?D.textContent:"Y_UP"}function p(D,O,X,V){let Y=n(D,O)[0];if(Y!==void 0){let Me=n(Y,X);for(let Ie=0;Ie<Me.length;Ie++)V(Me[Ie])}}function g(D,O){for(let X in D){let V=D[X];V.build=O(D[X])}}function m(D,O){return D.build!==void 0||(D.build=O(D)),D.build}function d(D){let O={sources:{},samplers:{},channels:{}},X=!1;
3144for(let V=0,Y=D.childNodes.length;V<Y;V++){let Me=D.childNodes[V];if(Me.nodeType!==1)continue;let Ie;switch(Me.nodeName){case"source":Ie=Me.getAttribute("id"),O.sources[Ie]=Se(Me);break;case"sampler":Ie=Me.getAttribute("id"),O.samplers[Ie]=x(Me);break;case"channel":Ie=Me.getAttribute("target"),O.channels[Ie]=_(Me);break;case"animation":d(Me),X=!0;break;default:console.log(Me)}}X===!1&&(lt.animations[D.getAttribute("id")||Bn.generateUUID()]=O)}function x(D){let O={inputs:{}};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"input":let Me=a(Y.getAttribute("source")),Ie=Y.getAttribute("semantic");O.inputs[Ie]=Me;break}}return O}function _(D){let O={},V=D.getAttribute("target").split("/"),Y=V.shift(),Me=V.shift(),Ie=Me.indexOf("(")!==-1,Ze=Me.indexOf(".")!==-1;if(Ze)V=Me.split("."),Me=V.shift(),O.member=V.shift();else if(Ie){let Ue=Me.split("(");Me=Ue.shift();for(let He=0;He<Ue.length;He++)Ue[He]=parseInt(Ue[He].replace(/\)/,""));O.indices=Ue}return O.id=Y,O.sid=Me,O.arraySyntax=Ie,O.memberSyntax=Ze,O.sampler=a(D.getAttribute("source")),O}function v(D){let O=[],X=D.channels,V=D.samplers,Y=D.sources;for(let Me in X)if(X.hasOwnProperty(Me)){let Ie=X[Me],Ze=V[Ie.sampler],Ue=Ze.inputs.INPUT,He=Ze.inputs.OUTPUT,tt=Y[Ue],Ne=Y[He],et=w(Ie,tt,Ne);N(et,O)}return O}function y(D){return m(lt.animations[D],v)}function w(D,O,X){let V=lt.nodes[D.id],Y=ei(V.id),Me=V.transforms[D.sid],Ie=V.matrix.clone().transpose(),Ze,Ue,He,tt,Ne,et,Je={};switch(Me){case"matrix":for(He=0,tt=O.array.length;He<tt;He++)if(Ze=O.array[He],Ue=He*X.stride,Je[Ze]===void 0&&(Je[Ze]={}),D.arraySyntax===!0){let tn=X.array[Ue],Ut=D.indices[0]+4*D.indices[1];Je[Ze][Ut]=tn}else for(Ne=0,et=X.stride;Ne<et;Ne++)Je[Ze][Ne]=X.array[Ue+Ne];break;case"translate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',Me);break;case"rotate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',Me);break;case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',Me);break}let ot=L(Je,Ie);return{name:Y.uuid,keyframes:ot}}function L(D,O){let X=[];for(let Y in D)X.push({time:parseFloat(Y),value:D[Y]});X.sort(V);for(let Y=0;Y<16;Y++)G(X,Y,O.elements[Y]);return X;function V(Y,Me){return Y.time-Me.time}}let C=new ae,b=new ae,A=new mn;function N(D,O){let X=D.keyframes,V=D.name,Y=[],Me=[],Ie=[],Ze=[];for(let Ue=0,He=X.length;Ue<He;Ue++){let tt=X[Ue],Ne=tt.time,et=tt.value;en.fromArray(et).transpose(),en.decompose(C,A,b),Y.push(Ne),Me.push(C.x,C.y,C.z),Ie.push(A.x,A.y,A.z,A.w),Ze.push(b.x,b.y,b.z)}return Me.length>0&&O.push(new Zi(V+".position",Y,Me)),Ie.length>0&&O.push(new Yi(V+".quaternion",Y,Ie)),Ze.length>0&&O.push(new Zi(V+".scale",Y,Ze)),O}function G(D,O,X){let V,Y=!0,Me,Ie;for(Me=0,Ie=D.length;Me<Ie;Me++)V=D[Me],V.value[O]===void 0?V.value[O]=null:Y=!1;if(Y===!0)for(Me=0,Ie=D.length;Me<Ie;Me++)V=D[Me],V.value[O]=X;else F(D,O)}function F(D,O){let X,V;for(let Y=0,Me=D.length;Y<Me;Y++){let Ie=D[Y];if(Ie.value[O]===null){if(X=U(D,Y,O),V=P(D,Y,O),X===null){Ie.value[O]=V.value[O];continue}if(V===null){Ie.value[O]=X.value[O];continue}$(Ie,X,V,O)}}}function U(D,O,X){for(;O>=0;){let V=D[O];if(V.value[X]!==null)return V;O--}return null}function P(D,O,X){for(;O<D.length;){let V=D[O];if(V.value[X]!==null)return V;O++}return null}function $(D,O,X,V){if(X.time-O.time===0){D.value[V]=O.value[V];return}D.value[V]=(D.time-O.time)*(X.value[V]-O.value[V])/(X.time-O.time)+O.value[V]}function H(D){let O={name:D.getAttribute("id")||"default",start:parseFloat(D.getAttribute("start")||0),end:parseFloat(D.getAttribute("end")||0),animations:[]};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"instance_animation":O.animations.push(a(Y.getAttribute("url")));break}}lt.clips[D.getAttribute("id")]=O}function Z(D){let O=[],X=D.name,V=D.end-D.start||-1,Y=D.animations;for(let Me=0,Ie=Y.length;Me<Ie;Me++){let Ze=y(Y[Me]);for(let Ue=0,He=Ze.length;Ue<He;Ue++)O.push(Ze[Ue])}return new co(X,V,O)}function W(D){return m(lt.clips[D],Z)}function oe(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"skin":O.id=a(Y.getAttribute("source")),O.skin=ue(Y);break;case"morph":O.id=a(Y.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.");break}}lt.controllers[D.getAttribute("id")]=O}function ue(D){let O={sources:{}};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"bind_shape_matrix":O.bindShapeMatrix=s(Y.textContent);break;case"source":let Me=Y.getAttribute("id");O.sources[Me]=Se(Y);break;case"joints":O.joints=ne(Y);break;case"vertex_weights":O.vertexWeights=le(Y);break}}return O}function ne(D){let O={inputs:{}};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"input":let Me=Y.getAttribute("semantic"),Ie=a(Y.getAttribute("source"));
3144O.inputs[Me]=Ie;break}}return O}function le(D){let O={inputs:{}};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"input":let Me=Y.getAttribute("semantic"),Ie=a(Y.getAttribute("source")),Ze=parseInt(Y.getAttribute("offset"));O.inputs[Me]={id:Ie,offset:Ze};break;case"vcount":O.vcount=o(Y.textContent);break;case"v":O.v=o(Y.textContent);break}}return O}function he(D){let O={id:D.id},X=lt.geometries[O.id];return D.skin!==void 0&&(O.skin=I(D.skin),X.sources.skinIndices=O.skin.indices,X.sources.skinWeights=O.skin.weights),O}function I(D){let X={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},V=D.sources,Y=D.vertexWeights,Me=Y.vcount,Ie=Y.v,Ze=Y.inputs.JOINT.offset,Ue=Y.inputs.WEIGHT.offset,He=D.sources[D.joints.inputs.JOINT],tt=D.sources[D.joints.inputs.INV_BIND_MATRIX],Ne=V[Y.inputs.WEIGHT.id].array,et=0,Je,ot,it;for(Je=0,it=Me.length;Je<it;Je++){let Ut=Me[Je],Pt=[];for(ot=0;ot<Ut;ot++){let Lt=Ie[et+Ze],Ir=Ie[et+Ue],ti=Ne[Ir];Pt.push({index:Lt,weight:ti}),et+=2}for(Pt.sort(tn),ot=0;ot<4;ot++){let Lt=Pt[ot];Lt!==void 0?(X.indices.array.push(Lt.index),X.weights.array.push(Lt.weight)):(X.indices.array.push(0),X.weights.array.push(0))}}for(D.bindShapeMatrix?X.bindMatrix=new Xe().fromArray(D.bindShapeMatrix).transpose():X.bindMatrix=new Xe().identity(),Je=0,it=He.array.length;Je<it;Je++){let Ut=He.array[Je],Pt=new Xe().fromArray(tt.array,Je*tt.stride).transpose();X.joints.push({name:Ut,boneInverse:Pt})}return X;function tn(Ut,Pt){return Pt.weight-Ut.weight}}function M(D){return m(lt.controllers[D],he)}function T(D){let O={init_from:n(D,"init_from")[0].textContent};lt.images[D.getAttribute("id")]=O}function S(D){return D.build!==void 0?D.build:D.init_from}function B(D){let O=lt.images[D];return O!==void 0?m(O,S):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",D),null)}function j(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"profile_COMMON":O.profile=z(Y);break}}lt.effects[D.getAttribute("id")]=O}function z(D){let O={surfaces:{},samplers:{}};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"newparam":fe(Y,O);break;case"technique":O.technique=te(Y);break;case"extra":O.extra=Ae(Y);break}}return O}function fe(D,O){let X=D.getAttribute("sid");for(let V=0,Y=D.childNodes.length;V<Y;V++){let Me=D.childNodes[V];if(Me.nodeType===1)switch(Me.nodeName){case"surface":O.surfaces[X]=q(Me);break;case"sampler2D":O.samplers[X]=re(Me);break}}}function q(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"init_from":O.init_from=Y.textContent;break}}return O}function re(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"source":O.source=Y.textContent;break}}return O}function te(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"constant":case"lambert":case"blinn":case"phong":O.type=Y.nodeName,O.parameters=ge(Y);break;case"extra":O.extra=Ae(Y);break}}return O}function ge(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":O[Y.nodeName]=xe(Y);break;case"transparent":O[Y.nodeName]={opaque:Y.hasAttribute("opaque")?Y.getAttribute("opaque"):"A_ONE",data:xe(Y)};break}}return O}function xe(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"color":O[Y.nodeName]=s(Y.textContent);break;case"float":O[Y.nodeName]=parseFloat(Y.textContent);break;case"texture":O[Y.nodeName]={id:Y.getAttribute("texture"),extra:we(Y)};break}}return O}function we(D){let O={technique:{}};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"extra":se(Y,O);break}}return O}function se(D,O){for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"technique":J(Y,O);break}}}function J(D,O){for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":O.technique[Y.nodeName]=parseFloat(Y.textContent);break;case"wrapU":case"wrapV":Y.textContent.toUpperCase()==="TRUE"?O.technique[Y.nodeName]=1:Y.textContent.toUpperCase()==="FALSE"?O.technique[Y.nodeName]=0:O.technique[Y.nodeName]=parseInt(Y.textContent);break;case"bump":O[Y.nodeName]=R(Y);break}}}function Ae(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"technique":O.technique=Le(Y);break}}return O}function Le(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"double_sided":O[Y.nodeName]=parseInt(Y.textContent);break;case"bump":O[Y.nodeName]=R(Y);break}}return O}function R(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"texture":O[Y.nodeName]={id:Y.getAttribute("texture"),texcoord:Y.getAttribute("texcoord"),extra:we(Y)};break}}return O}function E(D){return D}function k(D){return m(lt.effects[D],E)}function Q(D){let O={name:D.getAttribute("name")};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"instance_effect":O.url=a(Y.getAttribute("url"));break}}lt.materials[D.getAttribute("id")]=O}function K(D){let O,X=D.slice((D.lastIndexOf(".")-1>>>0)+2);switch(X=X.toLowerCase(),X){case"tga":O=Kh;break;default:O=qp}return O}function ce(D){let O=k(D.url),X=O.profile.technique,V;switch(X.type){case"phong":case"blinn":V=new Qt;break;case"lambert":V=new Ma;break;default:V=new Ii;break}V.name=D.name||"";function Y(Ue,He=null){let tt=O.profile.samplers[Ue.id],Ne=null;
3144if(tt!==void 0){let et=O.profile.surfaces[tt.source];Ne=B(et.init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),Ne=B(Ue.id);if(Ne!==null){let et=K(Ne);if(et!==void 0){let Je=et.load(Ne),ot=Ue.extra;if(ot!==void 0&&ot.technique!==void 0&&l(ot.technique)===!1){let it=ot.technique;Je.wrapS=it.wrapU?$t:Wt,Je.wrapT=it.wrapV?$t:Wt,Je.offset.set(it.offsetU||0,it.offsetV||0),Je.repeat.set(it.repeatU||1,it.repeatV||1)}else Je.wrapS=$t,Je.wrapT=$t;return He!==null&&(Je.encoding=He),Je}else return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",Ne),null}else return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",Ue.id),null}let Me=X.parameters;for(let Ue in Me){let He=Me[Ue];switch(Ue){case"diffuse":He.color&&V.color.fromArray(He.color),He.texture&&(V.map=Y(He.texture,It));break;case"specular":He.color&&V.specular&&V.specular.fromArray(He.color),He.texture&&(V.specularMap=Y(He.texture));break;case"bump":He.texture&&(V.normalMap=Y(He.texture));break;case"ambient":He.texture&&(V.lightMap=Y(He.texture,It));break;case"shininess":He.float&&V.shininess&&(V.shininess=He.float);break;case"emission":He.color&&V.emissive&&V.emissive.fromArray(He.color),He.texture&&(V.emissiveMap=Y(He.texture,It));break}}V.color.convertSRGBToLinear(),V.specular&&V.specular.convertSRGBToLinear(),V.emissive&&V.emissive.convertSRGBToLinear();let Ie=Me.transparent,Ze=Me.transparency;if(Ze===void 0&&Ie&&(Ze={float:1}),Ie===void 0&&Ze&&(Ie={opaque:"A_ONE",data:{color:[1,1,1,1]}}),Ie&&Ze)if(Ie.data.texture)V.transparent=!0;else{let Ue=Ie.data.color;switch(Ie.opaque){case"A_ONE":V.opacity=Ue[3]*Ze.float;break;case"RGB_ZERO":V.opacity=1-Ue[0]*Ze.float;break;case"A_ZERO":V.opacity=1-Ue[3]*Ze.float;break;case"RGB_ONE":V.opacity=Ue[0]*Ze.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',Ie.opaque)}V.opacity<1&&(V.transparent=!0)}if(X.extra!==void 0&&X.extra.technique!==void 0){let Ue=X.extra.technique;for(let He in Ue){let tt=Ue[He];switch(He){case"double_sided":V.side=tt===1?kn:pr;break;case"bump":V.normalMap=Y(tt.texture),V.normalScale=new Ee(1,1);break}}}return V}function me(D){return m(lt.materials[D],ce)}function pe(D){let O={name:D.getAttribute("name")};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"optics":O.optics=ie(Y);break}}lt.cameras[D.getAttribute("id")]=O}function ie(D){for(let O=0;O<D.childNodes.length;O++){let X=D.childNodes[O];switch(X.nodeName){case"technique_common":return ve(X)}}return{}}function ve(D){let O={};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];switch(V.nodeName){case"perspective":case"orthographic":O.technique=V.nodeName,O.parameters=Te(V);break}}return O}function Te(D){let O={};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];switch(V.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":O[V.nodeName]=parseFloat(V.textContent);break}}return O}function Pe(D){let O;switch(D.optics.technique){case"perspective":O=new Zt(D.optics.parameters.yfov,D.optics.parameters.aspect_ratio,D.optics.parameters.znear,D.optics.parameters.zfar);break;case"orthographic":let X=D.optics.parameters.ymag,V=D.optics.parameters.xmag,Y=D.optics.parameters.aspect_ratio;V=V===void 0?X*Y:V,X=X===void 0?V/Y:X,V*=.5,X*=.5,O=new gr(-V,V,X,-X,D.optics.parameters.znear,D.optics.parameters.zfar);break;default:O=new Zt;break}return O.name=D.name||"",O}function ke(D){let O=lt.cameras[D];return O!==void 0?m(O,Pe):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",D),null)}function ze(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"technique_common":O=Ke(Y);break}}lt.lights[D.getAttribute("id")]=O}function Ke(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"directional":case"point":case"spot":case"ambient":O.technique=Y.nodeName,O.parameters=qe(Y)}}return O}function qe(D){let O={};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"color":let Me=s(Y.textContent);O.color=new $e().fromArray(Me).convertSRGBToLinear();break;case"falloff_angle":O.falloffAngle=parseFloat(Y.textContent);break;case"quadratic_attenuation":let Ie=parseFloat(Y.textContent);O.distance=Ie?Math.sqrt(1/Ie):0;break}}return O}function Qe(D){let O;switch(D.technique){case"directional":O=new yr;break;case"point":O=new uo;break;case"spot":O=new Ea;break;case"ambient":O=new vr;break}return D.parameters.color&&O.color.copy(D.parameters.color),D.parameters.distance&&(O.distance=D.parameters.distance),O}function de(D){let O=lt.lights[D];return O!==void 0?m(O,Qe):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",D),null)}function be(D){let O={name:D.getAttribute("name"),sources:{},vertices:{},primitives:[]},X=n(D,"mesh")[0];if(X!==void 0){for(let V=0;V<X.childNodes.length;V++){let Y=X.childNodes[V];if(Y.nodeType!==1)continue;let Me=Y.getAttribute("id");switch(Y.nodeName){case"source":O.sources[Me]=Se(Y);break;case"vertices":O.vertices=De(Y);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",Y.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":O.primitives.push(Fe(Y));break;default:console.log(Y)}}lt.geometries[D.getAttribute("id")]=O}}function Se(D){let O={array:[],stride:3};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"float_array":O.array=s(V.textContent);break;case"Name_array":O.array=i(V.textContent);break;case"technique_common":let Y=n(V,"accessor")[0];Y!==void 0&&(O.stride=parseInt(Y.getAttribute("stride")));break}}return O}function De(D){let O={};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];V.nodeType===1&&(O[V.getAttribute("semantic")]=a(V.getAttribute("source")))}return O}function Fe(D){let O={type:D.nodeName,material:D.getAttribute("material"),count:parseInt(D.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let X=0,V=D.childNodes.length;X<V;X++){let Y=D.childNodes[X];if(Y.nodeType===1)switch(Y.nodeName){case"input":let Me=a(Y.getAttribute("source")),Ie=Y.getAttribute("semantic"),Ze=parseInt(Y.getAttribute("offset")),Ue=parseInt(Y.getAttribute("set")),He=Ue>0?Ie+Ue:Ie;O.inputs[He]={id:Me,offset:Ze},O.stride=Math.max(O.stride,Ze+1),Ie==="TEXCOORD"&&(O.hasUV=!0);break;case"vcount":O.vcount=o(Y.textContent);break;case"p":O.p=o(Y.textContent);break}}return O}function at(D){let O={};for(let X=0;X<D.length;X++){let V=D[X];O[V.type]===void 0&&(O[V.type]=[]),O[V.type].push(V)}return O}function vt(D){let O=0;for(let X=0,V=D.length;X<V;X++)D[X].hasUV===!0&&O++;O>0&&O<D.length&&(D.uvsNeedsFix=!0)}function rt(D){let O={},X=D.sources,V=D.vertices,Y=D.primitives;if(Y.length===0)return{};let Me=at(Y);for(let Ie in Me){let Ze=Me[Ie];vt(Ze),O[Ie]=Ye(Ze,X,V)}return O}function Ye(D,O,X){let V={},Y={array:[],stride:0},Me={array:[],stride:0},Ie={array:[],stride:0},Ze={array:[],stride:0},Ue={array:[],stride:0},He={array:[],stride:4},tt={array:[],stride:4},Ne=new yt,et=[],Je=0;for(let ot=0;ot<D.length;ot++){let it=D[ot],tn=it.inputs,Ut=0;switch(it.type){case"lines":case"linestrips":Ut=it.count*2;break;case"triangles":Ut=it.count*3;break;case"polylist":for(let Pt=0;Pt<it.count;Pt++){let Lt=it.vcount[Pt];switch(Lt){case 3:Ut+=3;break;case 4:Ut+=6;break;
3144default:Ut+=(Lt-2)*3;break}}break;default:console.warn("THREE.ColladaLoader: Unknow primitive type:",it.type)}Ne.addGroup(Je,Ut,ot),Je+=Ut,it.material&&et.push(it.material);for(let Pt in tn){let Lt=tn[Pt];switch(Pt){case"VERTEX":for(let Ir in X){let ti=X[Ir];switch(Ir){case"POSITION":let vo=Y.array.length;if(Oe(it,O[ti],Lt.offset,Y.array),Y.stride=O[ti].stride,O.skinWeights&&O.skinIndices&&(Oe(it,O.skinIndices,Lt.offset,He.array),Oe(it,O.skinWeights,Lt.offset,tt.array)),it.hasUV===!1&&D.uvsNeedsFix===!0){let Jx=(Y.array.length-vo)/Y.stride;for(let Yp=0;Yp<Jx;Yp++)Ie.array.push(0,0)}break;case"NORMAL":Oe(it,O[ti],Lt.offset,Me.array),Me.stride=O[ti].stride;break;case"COLOR":Oe(it,O[ti],Lt.offset,Ue.array),Ue.stride=O[ti].stride;break;case"TEXCOORD":Oe(it,O[ti],Lt.offset,Ie.array),Ie.stride=O[ti].stride;break;case"TEXCOORD1":Oe(it,O[ti],Lt.offset,Ze.array),Ie.stride=O[ti].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',Ir)}}break;case"NORMAL":Oe(it,O[Lt.id],Lt.offset,Me.array),Me.stride=O[Lt.id].stride;break;case"COLOR":Oe(it,O[Lt.id],Lt.offset,Ue.array,!0),Ue.stride=O[Lt.id].stride;break;case"TEXCOORD":Oe(it,O[Lt.id],Lt.offset,Ie.array),Ie.stride=O[Lt.id].stride;break;case"TEXCOORD1":Oe(it,O[Lt.id],Lt.offset,Ze.array),Ze.stride=O[Lt.id].stride;break}}}return Y.array.length>0&&Ne.setAttribute("position",new je(Y.array,Y.stride)),Me.array.length>0&&Ne.setAttribute("normal",new je(Me.array,Me.stride)),Ue.array.length>0&&Ne.setAttribute("color",new je(Ue.array,Ue.stride)),Ie.array.length>0&&Ne.setAttribute("uv",new je(Ie.array,Ie.stride)),Ze.array.length>0&&Ne.setAttribute("uv2",new je(Ze.array,Ze.stride)),He.array.length>0&&Ne.setAttribute("skinIndex",new je(He.array,He.stride)),tt.array.length>0&&Ne.setAttribute("skinWeight",new je(tt.array,tt.stride)),V.data=Ne,V.type=D[0].type,V.materialKeys=et,V}function Oe(D,O,X,V,Y=!1){let Me=D.p,Ie=D.stride,Ze=D.vcount;function Ue(Ne){let et=Me[Ne+X]*tt,Je=et+tt;for(;et<Je;et++)V.push(He[et]);if(Y){let ot=V.length-tt-1;kc.setRGB(V[ot+0],V[ot+1],V[ot+2]).convertSRGBToLinear(),V[ot+0]=kc.r,V[ot+1]=kc.g,V[ot+2]=kc.b}}let He=O.array,tt=O.stride;if(D.vcount!==void 0){let Ne=0;for(let et=0,Je=Ze.length;et<Je;et++){let ot=Ze[et];if(ot===4){let it=Ne+Ie*0,tn=Ne+Ie*1,Ut=Ne+Ie*2,Pt=Ne+Ie*3;Ue(it),Ue(tn),Ue(Pt),Ue(tn),Ue(Ut),Ue(Pt)}else if(ot===3){let it=Ne+Ie*0,tn=Ne+Ie*1,Ut=Ne+Ie*2;Ue(it),Ue(tn),Ue(Ut)}else if(ot>4)for(let it=1,tn=ot-2;it<=tn;it++){let Ut=Ne+Ie*0,Pt=Ne+Ie*it,Lt=Ne+Ie*(it+1);Ue(Ut),Ue(Pt),Ue(Lt)}Ne+=Ie*ot}}else for(let Ne=0,et=Me.length;Ne<et;Ne+=Ie)Ue(Ne)}function Be(D){return m(lt.geometries[D],rt)}function We(D){let O={name:D.getAttribute("name")||"",joints:{},links:[]};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"technique_common":Ti(V,O);break}}lt.kinematicsModels[D.getAttribute("id")]=O}function nt(D){return D.build!==void 0?D.build:D}function Vt(D){return m(lt.kinematicsModels[D],nt)}function Ti(D,O){for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"joint":O.joints[V.getAttribute("sid")]=Mi(V);break;case"link":O.links.push(_e(V));break}}}function Mi(D){let O;for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"prismatic":case"revolute":O=ee(V);break}}return O}function ee(D){let O={sid:D.getAttribute("sid"),name:D.getAttribute("name")||"",axis:new ae,limits:{min:0,max:0},type:D.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"axis":let Y=s(V.textContent);O.axis.fromArray(Y);break;case"limits":let Me=V.getElementsByTagName("max")[0],Ie=V.getElementsByTagName("min")[0];O.limits.max=parseFloat(Me.textContent),O.limits.min=parseFloat(Ie.textContent);break}}return O.limits.min>=O.limits.max&&(O.static=!0),O.middlePosition=(O.limits.min+O.limits.max)/2,O}function _e(D){let O={sid:D.getAttribute("sid"),name:D.getAttribute("name")||"",attachments:[],transforms:[]};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"attachment_full":O.attachments.push(Ce(V));break;case"matrix":case"translate":case"rotate":O.transforms.push(ye(V));break}}return O}function Ce(D){let O={joint:D.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"link":O.links.push(_e(V));break;case"matrix":case"translate":case"rotate":O.transforms.push(ye(V));break}}return O}function ye(D){let O={type:D.nodeName},X=s(D.textContent);switch(O.type){case"matrix":O.obj=new Xe,O.obj.fromArray(X).transpose();break;case"translate":O.obj=new ae,O.obj.fromArray(X);break;case"rotate":O.obj=new ae,O.obj.fromArray(X),O.angle=Bn.degToRad(X[3]);break}return O}function Re(D){let O={name:D.getAttribute("name")||"",rigidBodies:{}};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"rigid_body":O.rigidBodies[V.getAttribute("name")]={},st(V,O.rigidBodies[V.getAttribute("name")]);break}}lt.physicsModels[D.getAttribute("id")]=O}function st(D,O){for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"technique_common":ut(V,O);break}}}function ut(D,O){for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"inertia":O.inertia=s(V.textContent);break;case"mass":O.mass=s(V.textContent)[0];break}}}function pt(D){let O={bindJointAxis:[]};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"bind_joint_axis":O.bindJointAxis.push(mt(V));break}}lt.kinematicsScenes[a(D.getAttribute("url"))]=O}function mt(D){let O={target:D.getAttribute("target").split("/").pop()};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType===1)switch(V.nodeName){case"axis":let Y=V.getElementsByTagName("param")[0];O.axis=Y.textContent;let Me=O.axis.split("inst_").pop().split("axis")[0];O.jointIndex=Me.substring(0,Me.length-1);break}}return O}function Ct(D){return D.build!==void 0?D.build:D}function Tt(D){return m(lt.kinematicsScenes[D],Ct)}function Mt(){let D=Object.keys(lt.kinematicsModels)[0],O=Object.keys(lt.kinematicsScenes)[0],X=Object.keys(lt.visualScenes)[0];if(D===void 0||O===void 0)return;let V=Vt(D),Y=Tt(O),Me=Oc(X),Ie=Y.bindJointAxis,Ze={};for(let tt=0,Ne=Ie.length;tt<Ne;tt++){let et=Ie[tt],Je=gn.querySelector('[sid="'+et.target+'"]');if(Je){let ot=Je.parentElement;Ue(et.jointIndex,ot)}}function Ue(tt,Ne){let et=Ne.getAttribute("name"),Je=V.joints[tt];Me.traverse(function(ot){ot.name===et&&(Ze[tt]={object:ot,transforms:on(Ne),joint:Je,position:Je.zeroPosition})})}let He=new Xe;Xp={joints:V&&V.joints,getJointValue:function(tt){let Ne=Ze[tt];if(Ne)return Ne.position;console.warn("THREE.ColladaLoader: Joint "+tt+" doesn't exist.")},setJointValue:function(tt,Ne){let et=Ze[tt];if(et){let Je=et.joint;if(Ne>Je.limits.max||Ne<Je.limits.min)console.warn("THREE.ColladaLoader: Joint "+tt+" value "+Ne+" outside of limits (min: "+Je.limits.min+", max: "+Je.limits.max+").");else if(Je.static)console.warn("THREE.ColladaLoader: Joint "+tt+" is static.");else{let ot=et.object,it=Je.axis,tn=et.transforms;en.identity();for(let Ut=0;Ut<tn.length;Ut++){let Pt=tn[Ut];if(Pt.sid&&Pt.sid.indexOf(tt)!==-1)switch(Je.type){case"revolute":en.multiply(He.makeRotationAxis(it,Bn.degToRad(Ne)));break;case"prismatic":en.multiply(He.makeTranslation(it.x*Ne,it.y*Ne,it.z*Ne));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+Je.type);break}else switch(Pt.type){case"matrix":en.multiply(Pt.obj);break;case"translate":en.multiply(He.makeTranslation(Pt.obj.x,Pt.obj.y,Pt.obj.z));break;case"scale":en.scale(Pt.obj);break;case"rotate":en.multiply(He.makeRotationAxis(Pt.obj,Pt.angle));break}}ot.matrix.copy(en),ot.matrix.decompose(ot.position,ot.quaternion,ot.scale),Ze[tt].position=Ne}}else console.log("THREE.ColladaLoader: "+tt+" does not exist.")}}}function on(D){let O=[],X=gn.querySelector('[id="'+D.id+'"]');for(let V=0;V<X.childNodes.length;V++){let Y=X.childNodes[V];if(Y.nodeType!==1)continue;let Me,Ie;switch(Y.nodeName){case"matrix":Me=s(Y.textContent);let Ze=new Xe().fromArray(Me).transpose();O.push({sid:Y.getAttribute("sid"),type:Y.nodeName,obj:Ze});break;case"translate":case"scale":Me=s(Y.textContent),Ie=new ae().fromArray(Me),O.push({sid:Y.getAttribute("sid"),type:Y.nodeName,obj:Ie});break;case"rotate":Me=s(Y.textContent),Ie=new ae().fromArray(Me);let Ue=Bn.degToRad(Me[3]);O.push({sid:Y.getAttribute("sid"),type:Y.nodeName,obj:Ie,angle:Ue});break}}return O}function jn(D){let O=D.getElementsByTagName("node");for(let X=0;X<O.length;X++){let V=O[X];V.hasAttribute("id")===!1&&V.setAttribute("id",c())}}let en=new Xe,Qn=new ae;function Kt(D){let O={name:D.getAttribute("name")||"",type:D.getAttribute("type"),id:D.getAttribute("id"),sid:D.getAttribute("sid"),matrix:new Xe,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];if(V.nodeType!==1)continue;let Y;switch(V.nodeName){case"node":O.nodes.push(V.getAttribute("id")),Kt(V);break;case"instance_camera":O.instanceCameras.push(a(V.getAttribute("url")));break;case"instance_controller":O.instanceControllers.push(_t(V));break;case"instance_light":O.instanceLights.push(a(V.getAttribute("url")));break;case"instance_geometry":O.instanceGeometries.push(_t(V));break;case"instance_node":O.instanceNodes.push(a(V.getAttribute("url")));break;
3144case"matrix":Y=s(V.textContent),O.matrix.multiply(en.fromArray(Y).transpose()),O.transforms[V.getAttribute("sid")]=V.nodeName;break;case"translate":Y=s(V.textContent),Qn.fromArray(Y),O.matrix.multiply(en.makeTranslation(Qn.x,Qn.y,Qn.z)),O.transforms[V.getAttribute("sid")]=V.nodeName;break;case"rotate":Y=s(V.textContent);let Me=Bn.degToRad(Y[3]);O.matrix.multiply(en.makeRotationAxis(Qn.fromArray(Y),Me)),O.transforms[V.getAttribute("sid")]=V.nodeName;break;case"scale":Y=s(V.textContent),O.matrix.scale(Qn.fromArray(Y)),O.transforms[V.getAttribute("sid")]=V.nodeName;break;case"extra":break;default:console.log(V)}}return wn(O.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",O.id):lt.nodes[O.id]=O,O}function _t(D){let O={id:a(D.getAttribute("url")),materials:{},skeletons:[]};for(let X=0;X<D.childNodes.length;X++){let V=D.childNodes[X];switch(V.nodeName){case"bind_material":let Y=V.getElementsByTagName("instance_material");for(let Me=0;Me<Y.length;Me++){let Ie=Y[Me],Ze=Ie.getAttribute("symbol"),Ue=Ie.getAttribute("target");O.materials[Ze]=a(Ue)}break;case"skeleton":O.skeletons.push(a(V.textContent));break;default:break}}return O}function pl(D,O){let X=[],V=[],Y,Me,Ie;for(Y=0;Y<D.length;Y++){let He=D[Y],tt;if(wn(He))tt=ei(He),an(tt,O,X);else if(gl(He)){let et=lt.visualScenes[He].children;for(let Je=0;Je<et.length;Je++){let ot=et[Je];if(ot.type==="JOINT"){let it=ei(ot.id);an(it,O,X)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",He)}for(Y=0;Y<O.length;Y++)for(Me=0;Me<X.length;Me++)if(Ie=X[Me],Ie.bone.name===O[Y].name){V[Y]=Ie,Ie.processed=!0;break}for(Y=0;Y<X.length;Y++)Ie=X[Y],Ie.processed===!1&&(V.push(Ie),Ie.processed=!0);let Ze=[],Ue=[];for(Y=0;Y<V.length;Y++)Ie=V[Y],Ze.push(Ie.bone),Ue.push(Ie.boneInverse);return new vs(Ze,Ue)}function an(D,O,X){D.traverse(function(V){if(V.isBone===!0){let Y;for(let Me=0;Me<O.length;Me++){let Ie=O[Me];if(Ie.name===V.name){Y=Ie.boneInverse;break}}Y===void 0&&(Y=new Xe),X.push({bone:V,boneInverse:Y,processed:!1})}})}function Cr(D){let O=[],X=D.matrix,V=D.nodes,Y=D.type,Me=D.instanceCameras,Ie=D.instanceControllers,Ze=D.instanceLights,Ue=D.instanceGeometries,He=D.instanceNodes;for(let Ne=0,et=V.length;Ne<et;Ne++)O.push(ei(V[Ne]));for(let Ne=0,et=Me.length;Ne<et;Ne++){let Je=ke(Me[Ne]);Je!==null&&O.push(Je.clone())}for(let Ne=0,et=Ie.length;Ne<et;Ne++){let Je=Ie[Ne],ot=M(Je.id),it=Be(ot.id),tn=yo(it,Je.materials),Ut=Je.skeletons,Pt=ot.skin.joints,Lt=pl(Ut,Pt);for(let Ir=0,ti=tn.length;Ir<ti;Ir++){let vo=tn[Ir];vo.isSkinnedMesh&&(vo.bind(Lt,ot.skin.bindMatrix),vo.normalizeSkinWeights()),O.push(vo)}}for(let Ne=0,et=Ze.length;Ne<et;Ne++){let Je=de(Ze[Ne]);Je!==null&&O.push(Je.clone())}for(let Ne=0,et=Ue.length;Ne<et;Ne++){let Je=Ue[Ne],ot=Be(Je.id),it=yo(ot,Je.materials);for(let tn=0,Ut=it.length;tn<Ut;tn++)O.push(it[tn])}for(let Ne=0,et=He.length;Ne<et;Ne++)O.push(ei(He[Ne]).clone());let tt;if(V.length===0&&O.length===1)tt=O[0];else{tt=Y==="JOINT"?new ys:new bn;for(let Ne=0;Ne<O.length;Ne++)tt.add(O[Ne])}return tt.name=Y==="JOINT"?D.sid:D.name,tt.matrix.copy(X),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt}let Nc=new Ii({color:16711935});function Ds(D,O){let X=[];for(let V=0,Y=D.length;V<Y;V++){let Me=O[D[V]];Me===void 0?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",D[V]),X.push(Nc)):X.push(me(Me))}return X}function yo(D,O){let X=[];for(let V in D){let Y=D[V],Me=Ds(Y.materialKeys,O);if(Me.length===0&&(V==="lines"||V==="linestrips"?Me.push(new Ri):Me.push(new Qt)),V==="lines"||V==="linestrips")for(let He=0,tt=Me.length;He<tt;He++){let Ne=Me[He];if(Ne.isMeshPhongMaterial===!0||Ne.isMeshLambertMaterial===!0){let et=new Ri;et.color.copy(Ne.color),et.opacity=Ne.opacity,et.transparent=Ne.transparent,Me[He]=et}}let Ie=Y.data.attributes.skinIndex!==void 0,Ze=Me.length===1?Me[0]:Me,Ue;switch(V){case"lines":Ue=new _s(Y.data,Ze);break;case"linestrips":Ue=new oo(Y.data,Ze);break;case"triangles":case"polylist":Ie?Ue=new va(Y.data,Ze):Ue=new kt(Y.data,Ze);break}X.push(Ue)}return X}function wn(D){return lt.nodes[D]!==void 0}function ei(D){return m(lt.nodes[D],Cr)}function ml(D){let O={name:D.getAttribute("name"),children:[]};jn(D);let X=n(D,"node");for(let V=0;V<X.length;V++)O.children.push(Kt(X[V]));lt.visualScenes[D.getAttribute("id")]=O}function Gn(D){let O=new bn;O.name=D.name;let X=D.children;for(let V=0;V<X.length;V++){let Y=X[V];O.add(ei(Y.id))}return O}function gl(D){return lt.visualScenes[D]!==void 0}function Oc(D){return m(lt.visualScenes[D],Gn)}function Dc(D){let O=n(D,"instance_visual_scene")[0];return Oc(a(O.getAttribute("url")))}function Xx(){let D=lt.clips;if(l(D)===!0){if(l(lt.animations)===!1){let O=[];for(let X in lt.animations){let V=y(X);for(let Y=0,Me=V.length;Y<Me;Y++)O.push(V[Y])}Fc.push(new co("default",-1,O))}}else for(let O in D)Fc.push(W(O))}function Yx(D){let O="",X=[D];for(;X.length;){let V=X.shift();V.nodeType===Node.TEXT_NODE?O+=V.textContent:(O+=`
3145`,X.push.apply(X,V.childNodes))}return O.trim()}if(e.length===0)return{scene:new xr};let Wp=new DOMParser().parseFromString(e,"application/xml"),gn=n(Wp,"COLLADA")[0],Zh=Wp.getElementsByTagName("parsererror")[0];if(Zh!==void 0){let D=n(Zh,"div")[0],O;return D?O=D.textContent:O=Yx(Zh),console.error(`THREE.ColladaLoader: Failed to parse collada file.
3146`,O),null}let Zx=gn.getAttribute("version");console.log("THREE.ColladaLoader: File version",Zx);let jp=u(n(gn,"asset")[0]),qp=new Li(this.manager);qp.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);let Kh;Cs&&(Kh=new Cs(this.manager),Kh.setPath(this.resourcePath||t));let kc=new $e,Fc=[],Xp={},Kx=0,lt={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};p(gn,"library_animations","animation",d),p(gn,"library_animation_clips","animation_clip",H),p(gn,"library_controllers","controller",oe),p(gn,"library_images","image",T),p(gn,"library_effects","effect",j),p(gn,"library_materials","material",Q),p(gn,"library_cameras","camera",pe),p(gn,"library_lights","light",ze),p(gn,"library_geometries","geometry",be),p(gn,"library_nodes","no
3146de",Kt),p(gn,"library_visual_scenes","visual_scene",ml),p(gn,"library_kinematics_models","kinematics_model",We),p(gn,"library_physics_models","physics_model",Re),p(gn,"scene","instance_kinematics_scene",pt),g(lt.animations,v),g(lt.clips,Z),g(lt.controllers,he),g(lt.images,S),g(lt.effects,E),g(lt.materials,ce),g(lt.cameras,Pe),g(lt.lights,Qe),g(lt.geometries,rt),g(lt.visualScenes,Gn),Xx(),Mt();let Uc=Dc(n(gn,"scene")[0]);return Uc.animations=Fc,jp.upAxis==="Z_UP"&&(console.warn("THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289."),Uc.quaternion.setFromEuler(new Ln(-Math.PI/2,0,0))),Uc.scale.multiplyScalar(jp.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Fc},kinematics:Xp,library:lt,scene:Uc}}};var ft=(r,e)=>()=>(e||(e={exports:{}},r(e.exports,e)),e.exports),ux=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.VERSION=void 0,r.VERSION="9.0.1"}),Ot=ft((exports,module)=>{"use strict";var __spreadArray=exports&&exports.__spreadArray||function(r,e){for(var t=0,n=e.length,i=r.length;t<n;t++,i++)r[i]=e[t];return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.toFastProperties=exports.timer=exports.peek=exports.isES2015MapSupported=exports.PRINT_WARNING=exports.PRINT_ERROR=exports.packArray=exports.IDENTITY=exports.NOOP=exports.merge=exports.groupBy=exports.defaults=exports.assignNoOverwrite=exports.assign=exports.zipObject=exports.sortBy=exports.indexOf=exports.some=exports.difference=exports.every=exports.isObject=exports.isRegExp=exports.isArray=exports.partial=exports.uniq=exports.compact=exports.reduce=exports.findAll=exports.find=exports.cloneObj=exports.cloneArr=exports.contains=exports.has=exports.pick=exports.reject=exports.filter=exports.dropRight=exports.drop=exports.isFunction=exports.isUndefined=exports.isString=exports.forEach=exports.last=exports.first=exports.flatten=exports.map=exports.mapValues=exports.values=exports.keys=exports.isEmpty=void 0;function isEmpty(r){return r&&r.length===0}exports.isEmpty=isEmpty;function keys(r){return r==null?[]:Object.keys(r)}exports.keys=keys;function values(r){for(var e=[],t=Object.keys(r),n=0;n<t.length;n++)e.push(r[t[n]]);return e}exports.values=values;function mapValues(r,e){for(var t=[],n=keys(r),i=0;i<n.length;i++){var s=n[i];t.push(e.call(null,r[s],s))}return t}exports.mapValues=mapValues;function map(r,e){for(var t=[],n=0;n<r.length;n++)t.push(e.call(null,r[n],n));return t}exports.map=map;function flatten(r){for(var e=[],t=0;t<r.length;t++){var n=r[t];Array.isArray(n)?e=e.concat(flatten(n)):e.push(n)}return e}exports.flatten=flatten;function first(r){return isEmpty(r)?void 0:r[0]}exports.first=first;function last(r){var e=r&&r.length;return e?r[e-1]:void 0}exports.last=last;function forEach(r,e){if(Array.isArray(r))for(var t=0;t<r.length;t++)e.call(null,r[t],t);else if(isObject(r))for(var n=keys(r),t=0;t<n.length;t++){var i=n[t],s=r[i];e.call(null,s,i)}else throw Error("non exhaustive match")}exports.forEach=forEach;function isString(r){return typeof r=="string"}exports.isString=isString;function isUndefined(r){return r===void 0}exports.isUndefined=isUndefined;function isFunction(r){return r instanceof Function}exports.isFunction=isFunction;function drop(r,e){return e===void 0&&(e=1),r.slice(e,r.length)}exports.drop=drop;function dropRight(r,e){return e===void 0&&(e=1),r.slice(0,r.length-e)}exports.dropRight=dropRight;function filter(r,e){var t=[];if(Array.isArray(r))for(var n=0;n<r.length;n++){var i=r[n];e.call(null,i)&&t.push(i)}return t}exports.filter=filter;function reject(r,e){return filter(r,function(t){return!e(t)})}exports.reject=reject;function pick(r,e){for(var t=Object.keys(r),n={},i=0;i<t.length;i++){var s=t[i],o=r[s];e(o)&&(n[s]=o)}return n}exports.pick=pick;function has(r,e){return isObject(r)?r.hasOwnProperty(e):!1}exports.has=has;function contains(r,e){return find(r,function(t){return t===e})!==void 0}exports.contains=contains;function cloneArr(r){for(var e=[],t=0;t<r.length;t++)e.push(r[t]);return e}exports.cloneArr=cloneArr;function cloneObj(r){var e={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e}exports.cloneObj=cloneObj;function find(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(e.call(null,n))return n}}exports.find=find;function findAll(r,e){for(var t=[],n=0;n<r.length;n++){var i=r[n];
vendor: 118,838 bytes, lines 3146-3234
3146e.call(null,i)&&t.push(i)}return t}exports.findAll=findAll;function reduce(r,e,t){for(var n=Array.isArray(r),i=n?r:values(r),s=n?[]:keys(r),o=t,a=0;a<i.length;a++)o=e.call(null,o,i[a],n?a:s[a]);return o}exports.reduce=reduce;function compact(r){return reject(r,function(e){return e==null})}exports.compact=compact;function uniq(r,e){e===void 0&&(e=function(n){return n});var t=[];return reduce(r,function(n,i){var s=e(i);return contains(t,s)?n:(t.push(s),n.concat(i))},[])}exports.uniq=uniq;function partial(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];var n=[null],i=n.concat(e);return Function.bind.apply(r,i)}exports.partial=partial;function isArray(r){return Array.isArray(r)}exports.isArray=isArray;function isRegExp(r){return r instanceof RegExp}exports.isRegExp=isRegExp;function isObject(r){return r instanceof Object}exports.isObject=isObject;function every(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0}exports.every=every;function difference(r,e){return reject(r,function(t){return contains(e,t)})}exports.difference=difference;function some(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return!0;return!1}exports.some=some;function indexOf(r,e){for(var t=0;t<r.length;t++)if(r[t]===e)return t;return-1}exports.indexOf=indexOf;function sortBy(r,e){var t=cloneArr(r);return t.sort(function(n,i){return e(n)-e(i)}),t}exports.sortBy=sortBy;function zipObject(r,e){if(r.length!==e.length)throw Error("can't zipObject with different number of keys and values!");for(var t={},n=0;n<r.length;n++)t[r[n]]=e[n];return t}exports.zipObject=zipObject;function assign(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],s=keys(i),o=0;o<s.length;o++){var a=s[o];r[a]=i[a]}return r}exports.assign=assign;function assignNoOverwrite(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],s=keys(i),o=0;o<s.length;o++){var a=s[o];has(r,a)||(r[a]=i[a])}return r}exports.assignNoOverwrite=assignNoOverwrite;function defaults(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return assignNoOverwrite.apply(void 0,__spreadArray([{}],r))}exports.defaults=defaults;function groupBy(r,e){var t={};return forEach(r,function(n){var i=e(n),s=t[i];s?s.push(n):t[i]=[n]}),t}exports.groupBy=groupBy;function merge(r,e){for(var t=cloneObj(r),n=keys(e),i=0;i<n.length;i++){var s=n[i],o=e[s];t[s]=o}return t}exports.merge=merge;function NOOP(){}exports.NOOP=NOOP;function IDENTITY(r){return r}exports.IDENTITY=IDENTITY;function packArray(r){for(var e=[],t=0;t<r.length;t++){var n=r[t];e.push(n!==void 0?n:void 0)}return e}exports.packArray=packArray;function PRINT_ERROR(r){console&&console.error&&console.error("Error: "+r)}exports.PRINT_ERROR=PRINT_ERROR;function PRINT_WARNING(r){console&&console.warn&&console.warn("Warning: "+r)}exports.PRINT_WARNING=PRINT_WARNING;function isES2015MapSupported(){return typeof Map=="function"}exports.isES2015MapSupported=isES2015MapSupported;function peek(r){return r[r.length-1]}exports.peek=peek;function timer(r){var e=new Date().getTime(),t=r(),n=new Date().getTime(),i=n-e;return{time:i,value:t}}exports.timer=timer;function toFastProperties(toBecomeFast){function FakeConstructor(){}FakeConstructor.prototype=toBecomeFast;var fakeInstance=new FakeConstructor;function fakeAccess(){return typeof fakeInstance.bar}return fakeAccess(),fakeAccess(),toBecomeFast}exports.toFastProperties=toFastProperties}),yp=ft((r,e)=>{(function(t,n){typeof define=="function"&&define.amd?define([],n):typeof e=="object"&&e.exports?e.exports=n():t.regexpToAst=n()})(typeof self<"u"?self:r,function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(d){this.idx=d.idx,this.input=d.input,this.groupIdx=d.groupIdx},t.prototype.pattern=function(d){this.idx=0,this.input=d,this.groupIdx=0,this.consumeChar("/");var x=this.disjunction();this.consumeChar("/");for(var _={type:"Flags",loc:{begin:this.idx,end:d.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":c(_,"global");break;case"i":c(_,"ignoreCase");break;case"m":c(_,"multiLine");break;case"u":c(_,"unicode");break;case"y":c(_,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:_,value:x,loc:this.loc(0)}},t.prototype.disjunction=function(){var d=[],x=this.idx;for(d.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),d.push(this.alternative());return{type:"Disjunction",value:d,loc:this.loc(x)}},t.prototype.alternative=function(){for(var d=[],x=this.idx;this.isTerm();)d.push(this.term());return{type:"Alternative",value:d,loc:this.loc(x)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var d=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(d)};case"$":return{type:"EndAnchor",loc:this.loc(d)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(d)};case"B":return{type:"NonWordBoundary",loc:this.loc(d)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var x;switch(this.popChar()){case"=":x="Lookahead";break;case"!":x="NegativeLookahead";break}l(x);var _=this.disjunction();return this.consumeChar(")"),{type:x,value:_,loc:this.loc(d)}}u()},t.prototype.quantifier=function(d){var x,_=this.idx;switch(this.popChar()){case"*":x={atLeast:0,atMost:1/0};break;case"+":x={atLeast:1,atMost:1/0};break;case"?":x={atLeast:0,atMost:1};break;case"{":var v=this.integerIncludingZero();switch(this.popChar()){case"}":x={atLeast:v,atMost:v};break;case",":var y;this.isDigit()?(y=this.integerIncludingZero(),x={atLeast:v,atMost:y}):x={atLeast:v,atMost:1/0},this.consumeChar("}");break}if(d===!0&&x===void 0)return;l(x);break}if(!(d===!0&&x===void 0))return l(x),this.peekChar(0)==="?"?(this.consumeChar("?"),x.greedy=!1):x.greedy=!0,x.type="Quantifier",x.loc=this.loc(_),x},t.prototype.atom=function(){var d,x=this.idx;switch(this.peekChar()){case".":d=this.dotAll();break;case"\\":d=this.atomEscape();break;case"[":d=this.characterClass();break;case"(":d=this.group();break}return d===void 0&&this.isPatternCharacter()&&(d=this.patternCharacter()),l(d),d.loc=this.loc(x),this.isQuantifier()&&(d.quantifier=this.quantifier()),d},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[o(`
3147`),o("\r"),o("\u2028"),o("\u2029")]}},t.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},t.prototype.decimalEscapeAtom=function(){var d=this.positiveInteger();return{type:"GroupBackReference",value:d}},t.prototype.characterClassEscape=function(){var d,x=!1;switch(this.popChar()){case"d":d=f;break;case"D":d=f,x=!0;break;case"s":d=g;break;case"S":d=g,x=!0;break;case"w":d=p;break;case"W":d=p,x=!0;break}return l(d),{type:"Set",value:d,complement:x}},t.prototype.controlEscapeAtom=function(){var d;switch(this.popChar()){case"f":d=o("\f");break;case"n":d=o(`
3148`);break;case"r":d=o("\r");break;case"t":d=o("	");break;case"v":d=o("\v");break}return l(d),{type:"Character",value:d}},t.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var d=this.popChar();if(/[a-zA-Z]/.test(d)===!1)throw Error("Invalid ");var x=d.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:x}},t.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:o("\0")}},t.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},t.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},t.prototype.identityEscapeAtom=function(){var d=this.popChar();return{type:"Character",value:o(d)}},t.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
3149`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var d=this.popChar();return{type:"Character",value:o(d)}}},t.prototype.characterClass=function(){var d=[],x=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),x=!0);this.isClassAtom();){var _=this.classAtom(),v=_.type==="Character";if(v&&this.isRangeDash()){this.consumeChar("-");var y=this.classAtom(),w=y.type==="Character";if(w){if(y.value<_.value)throw Error("Range out of order in character class");d.push({from:_.value,to:y.value})}else a(_.value,d),d.push(o("-")),a(y.value,d)}else a(_.value,d)}return this.consumeChar("]"),{type:"Set",complement:x,value:d}},t.prototype.classAtom=function(){switch(this.peekChar()){case"]":case`
3150`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}},t.prototype.classEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:o("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},t.prototype.group=function(){var d=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),d=!1;break;default:this.groupIdx++;break}var x=this.disjunction();this.consumeChar(")");var _={type:"Group",capturing:d,value:x};return d&&(_.idx=this.groupIdx),_},t.prototype.positiveInteger=function(){var d=this.popChar();if(s.test(d)===!1)throw Error("Expecting a positive integer");for(;i.test(this.peekChar(0));)d+=this.popChar();return parseInt(d,10)},t.prototype.integerIncludingZero=function(){var d=this.popChar();if(i.test(d)===!1)throw Error("Expecting an integer");for(;i.test(this.peekChar(0));)d+=this.popChar();return parseInt(d,10)},t.prototype.patternCharacter=function(){var d=this.popChar();switch(d){case`
3151`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:o(d)}}},t.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},t.prototype.isRangeDash=function(){return this.peekChar()==="-"&&this.isClassAtom(1)},t.prototype.isDigit=function(){return i.test(this.peekChar(0))},t.prototype.isClassAtom=function(d){switch(d===void 0&&(d=0),this.peekChar(d)){case"]":case`
3152`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},t.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},t.prototype.isAssertion=function(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}},t.prototype.isQuantifier=function(){var d=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(d)}},t.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
3153`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.parseHexDigits=function(d){for(var x="",_=0;_<d;_++){var v=this.popChar();if(n.test(v)===!1)throw Error("Expecting a HexDecimal digits");x+=v}var y=parseInt(x,16);return{type:"Character",value:y}},t.prototype.peekChar=function(d){return d===void 0&&(d=0),this.input[this.idx+d]},t.prototype.popChar=function(){var d=this.peekChar(0);return this.consumeChar(),d},t.prototype.consumeChar=function(d){if(d!==void 0&&this.input[this.idx]!==d)throw Error("Expected: '"+d+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++},t.prototype.loc=function(d){return{begin:d,end:this.idx}};var n=/[0-9a-fA-F]/,i=/[0-9]/,s=/[1-9]/;function o(d){return d.charCodeAt(0)}function a(d,x){d.length!==void 0?d.forEach(function(_){x.push(_)}):x.push(d)}function c(d,x){if(d[x]===!0)throw"duplicate flag "+x;d[x]=!0}function l(d){if(d===void 0)throw Error("Internal Error - Should never get here!")}function u(){throw Error("Internal Error - Should never get here!")}var h,f=[];for(h=o("0");h<=o("9");h++)f.push(h);var p=[o("_")].concat(f);for(h=o("a");h<=o("z");h++)p.push(h);for(h=o("A");h<=o("Z");h++)p.push(h);var g=[o(" "),o("\f"),o(`
3154`),o("\r"),o("	"),o("\v"),o("	"),o("\xA0"),o("\u1680"),o("\u2000"),o("\u2001"),o("\u2002"),o("\u2003"),o("\u2004"),o("\u2005"),o("\u2006"),o("\u2007"),o("\u2008"),o("\u2009"),o("\u200A"),o("\u2028"),o("\u2029"),o("\u202F"),o("\u205F"),o("\u3000"),o("\uFEFF")];function m(){}return m.prototype.visitChildren=function(d){for(var x in d){var _=d[x];d.hasOwnProperty(x)&&(_.type!==void 0?this.visit(_):Array.isArray(_)&&_.forEach(function(v){this.visit(v)},this))}},m.prototype.visit=function(d){switch(d.type){case"Pattern":this.visitPattern(d);break;case"Flags":this.visitFlags(d);break;case"Disjunction":this.visitDisjunction(d);break;case"Alternative":this.visitAlternative(d);break;case"StartAnchor":this.visitStartAnchor(d);break;case"EndAnchor":this.visitEndAnchor(d);break;case"WordBoundary":this.visitWordBoundary(d);break;case"NonWordBoundary":this.visitNonWordBoundary(d);break;case"Lookahead":this.visitLookahead(d);break;case"NegativeLookahead":this.visitNegativeLookahead(d);break;case"Character":this.visitCharacter(d);break;case"Set":this.visitSet(d);break;case"Group":this.visitGroup(d);break;case"GroupBackReference":this.visitGroupBackReference(d);break;case"Quantifier":this.visitQuantifier(d);break}this.visitChildren(d)},m.prototype.visitPattern=function(d){},m.prototype.visitFlags=function(d){},m.prototype.visitDisjunction=function(d){},m.prototype.visitAlternative=function(d){},m.prototype.visitStartAnchor=function(d){},m.prototype.visitEndAnchor=function(d){},m.prototype.visitWordBoundary=function(d){},m.prototype.visitNonWordBoundary=function(d){},m.prototype.visitLookahead=function(d){},m.prototype.visitNegativeLookahead=function(d){},m.prototype.visitCharacter=function(d){},m.prototype.visitSet=function(d){},m.prototype.visitGroup=function(d){},m.prototype.visitGroupBackReference=function(d){},m.prototype.visitQuantifier=function(d){},{RegExpParser:t,BaseRegExpVisitor:m,VERSION:"0.5.0"}})}),vp=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.clearRegExpParserCache=r.getRegExpAst=void 0;var e=yp(),t={},n=new e.RegExpParser;function i(o){var a=o.toString();if(t.hasOwnProperty(a))return t[a];var c=n.pattern(a);return t[a]=c,c}r.getRegExpAst=i;function s(){t={}}r.clearRegExpParserCache=s}),xw=ft(r=>{"use strict";var e=r&&r.__extends||function(){var m=function(d,x){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,v){_.__proto__=v}||function(_,v){for(var y in v)Object.prototype.hasOwnProperty.call(v,y)&&(_[y]=v[y])},m(d,x)};return function(d,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");m(d,x);function _(){this.constructor=d}d.prototype=x===null?Object.create(x):(_.prototype=x.prototype,new _)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.canMatchCharCode=r.firstCharOptimizedIndices=r.getOptimizedStartCodesIndices=r.failedOptimizationPrefixMsg=void 0;var t=yp(),n=Ot(),i=vp(),s=hx(),o="Complement Sets are not supported for first char optimization";r.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
3155`;function a(m,d){d===void 0&&(d=!1);try{var x=i.getRegExpAst(m),_=c(x.value,{},x.flags.ignoreCase);return _}catch(y){if(y.message===o)d&&n.PRINT_WARNING(""+r.failedOptimizationPrefixMsg+("	Unable to optimize: < "+m.toString()+` >
3156`)+`	Complement Sets cannot be automatically optimized.
3157	This will disable the lexer's first char optimizations.
3158	See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var v="";d&&(v=`
3159	This will disable the lexer's first char optimizations.
3160	See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),n.PRINT_ERROR(r.failedOptimizationPrefixMsg+`
3161`+("	Failed parsing: < "+m.toString()+` >
3162`)+("	Using the regexp-to-ast library version: "+t.VERSION+`
3163`)+"	Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+v)}}return[]}r.getOptimizedStartCodesIndices=a;function c(m,d,x){switch(m.type){case"Disjunction":for(var _=0;_<m.value.length;_++)c(m.value[_],d,x);break;case"Alternative":for(var v=m.value,_=0;_<v.length;_++){var y=v[_];switch(y.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var w=y;switch(w.type){case"Character":l(w.value,d,x);break;case"Set":if(w.complement===!0)throw Error(o);n.forEach(w.value,function(b){if(typeof b=="number")l(b,d,x);else{var A=b;if(x===!0)for(var N=A.from;N<=A.to;N++)l(N,d,x);else{for(var N=A.from;N<=A.to&&N<s.minOptimizationVal;N++)l(N,d,x);if(A.to>=s.minOptimizationVal)for(var G=A.from>=s.minOptimizationVal?A.from:s.minOptimizationVal,F=A.to,U=s.charCodeToOptimizedIndex(G),P=s.charCodeToOptimizedIndex(F),$=U;$<=P;$++)d[$]=$}}});break;case"Group":c(w.value,d,x);break;default:throw Error("Non Exhaustive Match")}var L=w.quantifier!==void 0&&w.quantifier.atLeast===0;if(w.type==="Group"&&f(w)===!1||w.type!=="Group"&&L===!1)break}break;default:throw Error("non exhaustive match!")}return n.values(d)}r.firstCharOptimizedIndices=c;function l(m,d,x){var _=s.charCodeToOptimizedIndex(m);d[_]=_,x===!0&&u(m,d)}function u(m,d){var x=String.fromCharCode(m),_=x.toUpperCase();if(_!==x){var v=s.charCodeToOptimizedIndex(_.charCodeAt(0));d[v]=v}else{var y=x.toLowerCase();if(y!==x){var v=s.charCodeToOptimizedIndex(y.charCodeAt(0));d[v]=v}}}function h(m,d){return n.find(m.value,function(x){if(typeof x=="number")return n.contains(d,x);var _=x;return n.find(d,function(v){return _.from<=v&&v<=_.to})!==void 0})}function f(m){return m.quantifier&&m.quantifier.atLeast===0?!0:m.value?n.isArray(m.value)?n.every(m.value,f):f(m.value):!1}var p=function(m){e(d,m);function d(x){var _=m.call(this)||this;return _.targetCharCodes=x,_.found=!1,_}return d.prototype.visitChildren=function(x){if(this.found!==!0){switch(x.type){case"Lookahead":this.visitLookahead(x);return;case"NegativeLookahead":this.visitNegativeLookahead(x);return}m.prototype.visitChildren.call(this,x)}},d.prototype.visitCharacter=function(x){n.contains(this.targetCharCodes,x.value)&&(this.found=!0)},d.prototype.visitSet=function(x){x.complement?h(x,this.targetCharCodes)===void 0&&(this.found=!0):h(x,this.targetCharCodes)!==void 0&&(this.found=!0)},d}(t.BaseRegExpVisitor);function g(m,d){if(d instanceof RegExp){var x=i.getRegExpAst(d),_=new p(m);return _.visit(x),_.found}else return n.find(d,function(v){return n.contains(m,v.charCodeAt(0))})!==void 0}r.canMatchCharCode=g}),hx=ft(r=>{"use strict";var e=r&&r.__extends||function(){var M=function(T,S){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,j){B.__proto__=j}||function(B,j){for(var z in j)Object.prototype.hasOwnProperty.call(j,z)&&(B[z]=j[z])},M(T,S)};return function(T,S){if(typeof S!="function"&&S!==null)throw new TypeError("Class extends value "+String(S)+" is not a constructor or null");M(T,S);function B(){this.constructor=T}T.prototype=S===null?Object.create(S):(B.prototype=S.prototype,new B)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.charCodeToOptimizedIndex=r.minOptimizationVal=r.buildLineBreakIssueMessage=r.LineTerminatorOptimizedTester=r.isShortPattern=r.isCustomPattern=r.cloneEmptyGroups=r.performWarningRuntimeChecks=r.performRuntimeChecks=r.addStickyFlag=r.addStartOfInput=r.findUnreachablePatterns=r.findModesThatDoNotExist=r.findInvalidGroupType=r.findDuplicatePatterns=r.findUnsupportedFlags=r.findStartOfInputAnchor=r.findEmptyMatchRegExps=r.findEndOfInputAnchor=r.findInvalidPatterns=r.findMissingPatterns=r.validatePatterns=r.analyzeTokenTypes=r.enableSticky=r.disableSticky=r.SUPPORT_STICKY=r.MODES=r.DEFAULT_MODE=void 0;var t=yp(),n=Ph(),i=Ot(),s=xw(),o=vp(),a="PATTERN";r.DEFAULT_MODE="defaultMode",r.MODES="modes",r.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function c(){r.SUPPORT_STICKY=!1}r.disableSticky=c;function l(){r.SUPPORT_STICKY=!0}r.enableSticky=l;function u(M,T){T=i.defaults(T,{useSticky:r.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
3164`],tracer:function(E,k){return k()}});var S=T.tracer;S("initCharCodeToOptimizedIndexMap",function(){I()});var B;S("Reject Lexer.NA",function(){B=i.reject(M,function(E){return E[a]===n.Lexer.NA})});var j=!1,z;S("Transform Patterns",function(){j=!1,z=i.map(B,function(E){var k=E[a];if(i.isRegExp(k)){var Q=k.source;return Q.length===1&&Q!=="^"&&Q!=="$"&&Q!=="."&&!k.ignoreCase?Q:Q.length===2&&Q[0]==="\\"&&!i.contains(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],Q[1])?Q[1]:T.useSticky?F(k):G(k)}else{if(i.isFunction(k))return j=!0,{exec:k};if(i.has(k,"exec"))return j=!0,k;if(typeof k=="string"){if(k.length===1)return k;var K=k.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),ce=new RegExp(K);return T.useSticky?F(ce):G(ce)}else throw Error("non exhaustive match")}})});var fe,q,re,te,ge;S("misc mapping",function(){fe=i.map(B,function(E){return E.tokenTypeIdx}),q=i.map(B,function(E){var k=E.GROUP;if(k!==n.Lexer.SKIPPED){if(i.isString(k))return k;if(i.isUndefined(k))return!1;throw Error("non exhaustive match")}}),re=i.map(B,function(E){var k=E.LONGER_ALT;if(k){var Q=i.indexOf(B,k);return Q}}),te=i.map(B,function(E){return E.PUSH_MODE}),ge=i.map(B,function(E){return i.has(E,"POP_MODE")})});var xe;S("Line Terminator Handling",function(){var E=ue(T.lineTerminatorCharacters);xe=i.map(B,function(k){return!1}),T.positionTracking!=="onlyOffset"&&(xe=i.map(B,function(k){if(i.has(k,"LINE_BREAKS"))return k.LINE_BREAKS;if(W(k,E)===!1)return s.canMatchCharCode(E,k.PATTERN)}))});var we,se,J,Ae;S("Misc Mapping #2",function(){we=i.map(B,H),se=i.map(z,Z),J=i.reduce(B,function(E,k){var Q=k.GROUP;return i.isString(Q)&&Q!==n.Lexer.SKIPPED&&(E[Q]=[]),E},{}),Ae=i.map(z,function(E,k){return{pattern:z[k],longerAlt:re[k],canLineTerminator:xe[k],isCustom:we[k],short:se[k],group:q[k],push:te[k],pop:ge[k],tokenTypeIdx:fe[k],tokenType:B[k]}})});var Le=!0,R=[];return T.safeMode||S("First Char Optimization",function(){R=i.reduce(B,function(E,k,Q){if(typeof k.PATTERN=="string"){var K=k.PATTERN.charCodeAt(0),ce=he(K);ne(E,ce,Ae[Q])}else if(i.isArray(k.START_CHARS_HINT)){var me;i.forEach(k.START_CHARS_HINT,function(ie){var ve=typeof ie=="string"?ie.charCodeAt(0):ie,Te=he(ve);me!==Te&&(me=Te,ne(E,Te,Ae[Q]))})}else if(i.isRegExp(k.PATTERN))if(k.PATTERN.unicode)Le=!1,T.ensureOptimizations&&i.PRINT_ERROR(""+s.failedOptimizationPrefixMsg+("	Unable to analyze < "+k.PATTERN.toString()+` > pattern.
3165`)+`	The regexp unicode flag is not currently supported by the regexp-to-ast library.
3166	This will disable the lexer's first char optimizations.
3167	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var pe=s.getOptimizedStartCodesIndices(k.PATTERN,T.ensureOptimizations);i.isEmpty(pe)&&(Le=!1),i.forEach(pe,function(ie){ne(E,ie,Ae[Q])})}else T.ensureOptimizations&&i.PRINT_ERROR(""+s.failedOptimizationPrefixMsg+("	TokenType: <"+k.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
3168`)+`	This will disable the lexer's first char optimizations.
3169	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),Le=!1;return E},[])}),S("ArrayPacking",function(){R=i.packArray(R)}),{emptyGroups:J,patternIdxToConfig:Ae,charCodeToPatternIdxToConfig:R,hasCustom:j,canBeOptimized:Le}}r.analyzeTokenTypes=u;function h(M,T){var S=[],B=p(M);S=S.concat(B.errors);var j=g(B.valid),z=j.valid;return S=S.concat(j.errors),S=S.concat(f(z)),S=S.concat(L(z)),S=S.concat(C(z,T)),S=S.concat(b(z)),S}r.validatePatterns=h;function f(M){var T=[],S=i.filter(M,function(B){return i.isRegExp(B[a])});return T=T.concat(d(S)),T=T.concat(v(S)),T=T.concat(y(S)),T=T.concat(w(S)),T=T.concat(x(S)),T}function p(M){var T=i.filter(M,function(j){return!i.has(j,a)}),S=i.map(T,function(j){return{message:"Token Type: ->"+j.name+"<- missing static 'PATTERN' property",type:n.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[j]}}),B=i.difference(M,T);return{errors:S,valid:B}}r.findMissingPatterns=p;function g(M){var T=i.filter(M,function(j){var z=j[a];return!i.isRegExp(z)&&!i.isFunction(z)&&!i.has(z,"exec")&&!i.isString(z)}),S=i.map(T,function(j){return{message:"Token Type: ->"+j.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:n.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[j]}}),B=i.difference(M,T);return{errors:S,valid:B}}r.findInvalidPatterns=g;var m=/[^\\][\$]/;function d(M){var T=function(j){e(z,j);function z(){var fe=j!==null&&j.apply(this,arguments)||this;return fe.found=!1,fe}return z.prototype.visitEndAnchor=function(fe){this.found=!0},z}(t.BaseRegExpVisitor),S=i.filter(M,function(j){var z=j[a];try{var fe=o.getRegExpAst(z),q=new T;return q.visit(fe),q.found}catch{return m.test(z.source)}}),B=i.map(S,function(j){return{message:`Unexpected RegExp Anchor Error:
3170	Token Type: ->`+j.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
3171	See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.`,type:n.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[j]}});return B}r.findEndOfInputAnchor=d;function x(M){var T=i.filter(M,function(B){var j=B[a];return j.test("")}),S=i.map(T,function(B){return{message:"Token Type: ->"+B.name+"<- static 'PATTERN' must not match an empty string",type:n.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[B]}});return S}r.findEmptyMatchRegExps=x;var _=/[^\\[][\^]|^\^/;function v(M){var T=function(j){e(z,j);function z(){var fe=j!==null&&j.apply(this,arguments)||this;return fe.found=!1,fe}return z.prototype.visitStartAnchor=function(fe){this.found=!0},z}(t.BaseRegExpVisitor),S=i.filter(M,function(j){var z=j[a];try{var fe=o.getRegExpAst(z),q=new T;return q.visit(fe),q.found}catch{return _.test(z.source)}}),B=i.map(S,function(j){return{message:`Unexpected RegExp Anchor Error:
3172	Token Type: ->`+j.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
3173	See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.`,type:n.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[j]}});return B}r.findStartOfInputAnchor=v;function y(M){var T=i.filter(M,function(B){var j=B[a];return j instanceof RegExp&&(j.multiline||j.global)}),S=i.map(T,function(B){return{message:"Token Type: ->"+B.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:n.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[B]}});return S}r.findUnsupportedFlags=y;function w(M){var T=[],S=i.map(M,function(z){return i.reduce(M,function(fe,q){return z.PATTERN.source===q.PATTERN.source&&!i.contains(T,q)&&q.PATTERN!==n.Lexer.NA&&(T.push(q),fe.push(q)),fe},[])});S=i.compact(S);var B=i.filter(S,function(z){return z.length>1}),j=i.map(B,function(z){var fe=i.map(z,function(re){return re.name}),q=i.first(z).PATTERN;return{message:"The same RegExp pattern ->"+q+"<-"+("has been used in all of the following Token Types: "+fe.join(", ")+" <-"),type:n.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:z}});return j}r.findDuplicatePatterns=w;function L(M){var T=i.filter(M,function(B){if(!i.has(B,"GROUP"))return!1;var j=B.GROUP;return j!==n.Lexer.SKIPPED&&j!==n.Lexer.NA&&!i.isString(j)}),S=i.map(T,function(B){return{message:"Token Type: ->"+B.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:n.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[B]}});return S}r.findInvalidGroupType=L;function C(M,T){var S=i.filter(M,function(j){return j.PUSH_MODE!==void 0&&!i.contains(T,j.PUSH_MODE)}),B=i.map(S,function(j){var z="Token Type: ->"+j.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+j.PUSH_MODE+"<-which does not exist";return{message:z,type:n.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[j]}});return B}r.findModesThatDoNotExist=C;function b(M){var T=[],S=i.reduce(M,function(B,j,z){var fe=j.PATTERN;return fe===n.Lexer.NA||(i.isString(fe)?B.push({str:fe,idx:z,tokenType:j}):i.isRegExp(fe)&&N(fe)&&B.push({str:fe.source,idx:z,tokenType:j})),B},[]);return i.forEach(M,function(B,j){i.forEach(S,function(z){var fe=z.str,q=z.idx,re=z.tokenType;if(j<q&&A(fe,B.PATTERN)){var te="Token: ->"+re.name+`<- can never be matched.
3174`+("Because it appears AFTER the Token Type ->"+B.name+"<-")+`in the lexer's definition.
3175See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;T.push({message:te,type:n.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[B,re]})}})}),T}r.findUnreachablePatterns=b;function A(M,T){if(i.isRegExp(T)){var S=T.exec(M);return S!==null&&S.index===0}else{if(i.isFunction(T))return T(M,0,[],{});if(i.has(T,"exec"))return T.exec(M,0,[],{});if(typeof T=="string")return T===M;throw Error("non exhaustive match")}}function N(M){var T=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return i.find(T,function(S){return M.source.indexOf(S)!==-1})===void 0}function G(M){var T=M.ignoreCase?"i":"";return new RegExp("^(?:"+M.source+")",T)}r.addStartOfInput=G;function F(M){var T=M.ignoreCase?"iy":"y";return new RegExp(""+M.source,T)}r.addStickyFlag=F;function U(M,T,S){var B=[];return i.has(M,r.DEFAULT_MODE)||B.push({message:"A MultiMode Lexer cannot be initialized without a <"+r.DEFAULT_MODE+`> property in its definition
3176`,type:n.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),i.has(M,r.MODES)||B.push({message:"A MultiMode Lexer cannot be initialized without a <"+r.MODES+`> property in its definition
3177`,type:n.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),i.has(M,r.MODES)&&i.has(M,r.DEFAULT_MODE)&&!i.has(M.modes,M.defaultMode)&&B.push({message:"A MultiMode Lexer cannot be initialized with a "+r.DEFAULT_MODE+": <"+M.defaultMode+`>which does not exist
3178`,type:n.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),i.has(M,r.MODES)&&i.forEach(M.modes,function(j,z){i.forEach(j,function(fe,q){i.isUndefined(fe)&&B.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+z+"> at index: <"+q+`>
3179`),type:n.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),B}r.performRuntimeChecks=U;function P(M,T,S){var B=[],j=!1,z=i.compact(i.flatten(i.mapValues(M.modes,function(re){return re}))),fe=i.reject(z,function(re){return re[a]===n.Lexer.NA}),q=ue(S);return T&&i.forEach(fe,function(re){var te=W(re,q);if(te!==!1){var ge=oe(re,te),xe={message:ge,type:te.issue,tokenType:re};B.push(xe)}else i.has(re,"LINE_BREAKS")?re.LINE_BREAKS===!0&&(j=!0):s.canMatchCharCode(q,re.PATTERN)&&(j=!0)}),T&&!j&&B.push({message:`Warning: No LINE_BREAKS Found.
3180	This Lexer has been defined to track line and column information,
3181	But none of the Token Types can be identified as matching a line terminator.
3182	See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
3183	for details.`,type:n.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),B}r.performWarningRuntimeChecks=P;function $(M){var T={},S=i.keys(M);return i.forEach(S,function(B){var j=M[B];if(i.isArray(j))T[B]=[];else throw Error("non exhaustive match")}),T}r.cloneEmptyGroups=$;function H(M){var T=M.PATTERN;if(i.isRegExp(T))return!1;if(i.isFunction(T)||i.has(T,"exec"))return!0;if(i.isString(T))return!1;throw Error("non exhaustive match")}r.isCustomPattern=H;function Z(M){return i.isString(M)&&M.length===1?M.charCodeAt(0):!1}r.isShortPattern=Z,r.LineTerminatorOptimizedTester={test:function(M){for(var T=M.length,S=this.lastIndex;S<T;S++){var B=M.charCodeAt(S);if(B===10)return this.lastIndex=S+1,!0;if(B===13)return M.charCodeAt(S+1)===10?this.lastIndex=S+2:this.lastIndex=S+1,!0}return!1},lastIndex:0};function W(M,T){if(i.has(M,"LINE_BREAKS"))return!1;if(i.isRegExp(M.PATTERN)){try{s.canMatchCharCode(T,M.PATTERN)}catch(S){return{issue:n.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:S.message}}return!1}else{if(i.isString(M.PATTERN))return!1;if(H(M))return{issue:n.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function oe(M,T){if(T.issue===n.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
3184`+("	The problem is in the <"+M.name+`> Token Type
3185`)+("	 Root cause: "+T.errMsg+`.
3186`)+"	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(T.issue===n.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
3187`+("	The problem is in the <"+M.name+`> Token Type
3188`)+"	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}r.buildLineBreakIssueMessage=oe;function ue(M){var T=i.map(M,function(S){return i.isString(S)&&S.length>0?S.charCodeAt(0):S});return T}function ne(M,T,S){M[T]===void 0?M[T]=[S]:M[T].push(S)}r.minOptimizationVal=256;var le=[];function he(M){return M<r.minOptimizationVal?M:le[M]}r.charCodeToOptimizedIndex=he;function I(){if(i.isEmpty(le)){le=new Array(65536);for(var M=0;M<65536;M++)le[M]=M>255?255+~~(M/255):M}}}),mc=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isTokenType=r.hasExtendingTokensTypesMapProperty=r.hasExtendingTokensTypesProperty=r.hasCategoriesProperty=r.hasShortKeyProperty=r.singleAssignCategoriesToksMap=r.assignCategoriesMapProp=r.assignCategoriesTokensProp=r.assignTokenDefaultProps=r.expandCategories=r.augmentTokenTypes=r.tokenIdxToClass=r.tokenShortNameIdx=r.tokenStructuredMatcherNoCategories=r.tokenStructuredMatcher=void 0;var e=Ot();function t(m,d){var x=m.tokenTypeIdx;return x===d.tokenTypeIdx?!0:d.isParent===!0&&d.categoryMatchesMap[x]===!0}r.tokenStructuredMatcher=t;function n(m,d){return m.tokenTypeIdx===d.tokenTypeIdx}r.tokenStructuredMatcherNoCategories=n,r.tokenShortNameIdx=1,r.tokenIdxToClass={};function i(m){var d=s(m);o(d),c(d),a(d),e.forEach(d,function(x){x.isParent=x.categoryMatches.length>0})}r.augmentTokenTypes=i;function s(m){for(var d=e.cloneArr(m),x=m,_=!0;_;){x=e.compact(e.flatten(e.map(x,function(y){return y.CATEGORIES})));var v=e.difference(x,d);d=d.concat(v),e.isEmpty(v)?_=!1:x=v}return d}r.expandCategories=s;function o(m){e.forEach(m,function(d){u(d)||(r.tokenIdxToClass[r.tokenShortNameIdx]=d,d.tokenTypeIdx=r.tokenShortNameIdx++),h(d)&&!e.isArray(d.CATEGORIES)&&(d.CATEGORIES=[d.CATEGORIES]),h(d)||(d.CATEGORIES=[]),f(d)||(d.categoryMatches=[]),p(d)||(d.categoryMatchesMap={})})}r.assignTokenDefaultProps=o;function a(m){e.forEach(m,function(d){d.categoryMatches=[],e.forEach(d.categoryMatchesMap,function(x,_){d.categoryMatches.push(r.tokenIdxToClass[_].tokenTypeIdx)})})}r.assignCategoriesTokensProp=a;function c(m){e.forEach(m,function(d){l([],d)})}r.assignCategoriesMapProp=c;function l(m,d){e.forEach(m,function(x){d.categoryMatchesMap[x.tokenTypeIdx]=!0}),e.forEach(d.CATEGORIES,function(x){var _=m.concat(d);e.contains(_,x)||l(_,x)})}r.singleAssignCategoriesToksMap=l;function u(m){return e.has(m,"tokenTypeIdx")}r.hasShortKeyProperty=u;function h(m){return e.has(m,"CATEGORIES")}r.hasCategoriesProperty=h;function f(m){return e.has(m,"categoryMatches")}r.hasExtendingTokensTypesProperty=f;function p(m){return e.has(m,"categoryMatchesMap")}r.hasExtendingTokensTypesMapProperty=p;function g(m){return e.has(m,"tokenTypeIdx")}r.isTokenType=g}),fx=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.defaultLexerErrorProvider=void 0,r.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(e){return"Unable to pop Lexer Mode after encountering Token ->"+e.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(e,t,n,i,s){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+","+(" skipped "+n+" characters.")}}}),Ph=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Lexer=r.LexerDefinitionErrorType=void 0;var e=hx(),t=Ot(),n=mc(),i=fx(),s=vp(),o;(function(l){l[l.MISSING_PATTERN=0]="MISSING_PATTERN",l[l.INVALID_PATTERN=1]="INVALID_PATTERN",l[l.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",l[l.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",l[l.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",l[l.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",l[l.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",l[l.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",l[l.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",l[l.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",l[l.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",l[l.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",l[l.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",l[l.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",l[l.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",l[l.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",l[l.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(o=r.LexerDefinitionErrorType||(r.LexerDefinitionErrorType={}));var a={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
3189`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:i.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(a);var c=function(){function l(u,h){var f=this;if(h===void 0&&(h=a),this.lexerDefinition=u,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},typeof h=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
3190a boolean 2nd argument is no longer supported`);this.config=t.merge(a,h);var p=this.config.traceInitPerf;p===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof p=="number"&&(this.traceInitMaxIdent=p,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var g,m=!0;f.TRACE_INIT("Lexer Config handling",function(){if(f.config.lineTerminatorsPattern===a.lineTerminatorsPattern)f.config.lineTerminatorsPattern=e.LineTerminatorOptimizedTester;else if(f.config.lineTerminatorCharacters===a.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
3191	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(h.safeMode&&h.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');f.trackStartLines=/full|onlyStart/i.test(f.config.positionTracking),f.trackEndLines=/full/i.test(f.config.positionTracking),t.isArray(u)?(g={modes:{}},g.modes[e.DEFAULT_MODE]=t.cloneArr(u),g[e.DEFAULT_MODE]=e.DEFAULT_MODE):(m=!1,g=t.cloneObj(u))}),f.config.skipValidations===!1&&(f.TRACE_INIT("performRuntimeChecks",function(){f.lexerDefinitionErrors=f.lexerDefinitionErrors.concat(e.performRuntimeChecks(g,f.trackStartLines,f.config.lineTerminatorCharacters))}),f.TRACE_INIT("performWarningRuntimeChecks",function(){f.lexerDefinitionWarning=f.lexerDefinitionWarning.concat(e.performWarningRuntimeChecks(g,f.trackStartLines,f.config.lineTerminatorCharacters))})),g.modes=g.modes?g.modes:{},t.forEach(g.modes,function(v,y){g.modes[y]=t.reject(v,function(w){return t.isUndefined(w)})});var d=t.keys(g.modes);if(t.forEach(g.modes,function(v,y){f.TRACE_INIT("Mode: <"+y+"> processing",function(){if(f.modes.push(y),f.config.skipValidations===!1&&f.TRACE_INIT("validatePatterns",function(){f.lexerDefinitionErrors=f.lexerDefinitionErrors.concat(e.validatePatterns(v,d))}),t.isEmpty(f.lexerDefinitionErrors)){n.augmentTokenTypes(v);var w;f.TRACE_INIT("analyzeTokenTypes",function(){w=e.analyzeTokenTypes(v,{lineTerminatorCharacters:f.config.lineTerminatorCharacters,positionTracking:h.positionTracking,ensureOptimizations:h.ensureOptimizations,safeMode:h.safeMode,tracer:f.TRACE_INIT.bind(f)})}),f.patternIdxToConfig[y]=w.patternIdxToConfig,f.charCodeToPatternIdxToConfig[y]=w.charCodeToPatternIdxToConfig,f.emptyGroups=t.merge(f.emptyGroups,w.emptyGroups),f.hasCustom=w.hasCustom||f.hasCustom,f.canModeBeOptimized[y]=w.canBeOptimized}})}),f.defaultMode=g.defaultMode,!t.isEmpty(f.lexerDefinitionErrors)&&!f.config.deferDefinitionErrorsHandling){var x=t.map(f.lexerDefinitionErrors,function(v){return v.message}),_=x.join(`-----------------------
3192`);throw new Error(`Errors detected in definition of Lexer:
3193`+_)}t.forEach(f.lexerDefinitionWarning,function(v){t.PRINT_WARNING(v.message)}),f.TRACE_INIT("Choosing sub-methods implementations",function(){if(e.SUPPORT_STICKY?(f.chopInput=t.IDENTITY,f.match=f.matchWithTest):(f.updateLastIndex=t.NOOP,f.match=f.matchWithExec),m&&(f.handleModes=t.NOOP),f.trackStartLines===!1&&(f.computeNewColumn=t.IDENTITY),f.trackEndLines===!1&&(f.updateTokenEndLineColumnLocation=t.NOOP),/full/i.test(f.config.positionTracking))f.createTokenInstance=f.createFullToken;else if(/onlyStart/i.test(f.config.positionTracking))f.createTokenInstance=f.createStartOnlyToken;else if(/onlyOffset/i.test(f.config.positionTracking))f.createTokenInstance=f.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+f.config.positionTracking+'"');f.hasCustom?(f.addToken=f.addTokenUsingPush,f.handlePayload=f.handlePayloadWithCustom):(f.addToken=f.addTokenUsingMemberAccess,f.handlePayload=f.handlePayloadNoCustom)}),f.TRACE_INIT("Failed Optimization Warnings",function(){var v=t.reduce(f.canModeBeOptimized,function(y,w,L){return w===!1&&y.push(L),y},[]);if(h.ensureOptimizations&&!t.isEmpty(v))throw Error("Lexer Modes: < "+v.join(", ")+` > cannot be optimized.
3194	 Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
3195	 Or inspect the console log for details on how to resolve these issues.`)}),f.TRACE_INIT("clearRegExpParserCache",function(){s.clearRegExpParserCache()}),f.TRACE_INIT("toFastProperties",function(){t.toFastProperties(f)})})}return l.prototype.tokenize=function(u,h){if(h===void 0&&(h=this.defaultMode),!t.isEmpty(this.lexerDefinitionErrors)){var f=t.map(this.lexerDefinitionErrors,function(m){return m.message}),p=f.join(`-----------------------
3196`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
3197`+p)}var g=this.tokenizeInternal(u,h);return g},l.prototype.tokenizeInternal=function(u,h){var f=this,p,g,m,d,x,_,v,y,w,L,C,b,A,N,G,F=u,U=F.length,P=0,$=0,H=this.hasCustom?0:Math.floor(u.length/10),Z=new Array(H),W=[],oe=this.trackStartLines?1:void 0,ue=this.trackStartLines?1:void 0,ne=e.cloneEmptyGroups(this.emptyGroups),le=this.trackStartLines,he=this.config.lineTerminatorsPattern,I=0,M=[],T=[],S=[],B=[];Object.freeze(B);var j=void 0;function z(){return M}function fe(ie){var ve=e.charCodeToOptimizedIndex(ie),Te=T[ve];return Te===void 0?B:Te}var q=function(ie){if(S.length===1&&ie.tokenType.PUSH_MODE===void 0){var ve=f.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ie);W.push({offset:ie.startOffset,line:ie.startLine!==void 0?ie.startLine:void 0,column:ie.startColumn!==void 0?ie.startColumn:void 0,length:ie.image.length,message:ve})}else{S.pop();var Te=t.last(S);M=f.patternIdxToConfig[Te],T=f.charCodeToPatternIdxToConfig[Te],I=M.length;var Pe=f.canModeBeOptimized[Te]&&f.config.safeMode===!1;T&&Pe?j=fe:j=z}};function re(ie){S.push(ie),T=this.charCodeToPatternIdxToConfig[ie],M=this.patternIdxToConfig[ie],I=M.length,I=M.length;var ve=this.canModeBeOptimized[ie]&&this.config.safeMode===!1;T&&ve?j=fe:j=z}re.call(this,h);for(var te;P<U;){x=null;var ge=F.charCodeAt(P),xe=j(ge),we=xe.length;for(p=0;p<we;p++){te=xe[p];var se=te.pattern;_=null;var J=te.short;if(J!==!1?ge===J&&(x=se):te.isCustom===!0?(G=se.exec(F,P,Z,ne),G!==null?(x=G[0],G.payload!==void 0&&(_=G.payload)):x=null):(this.updateLastIndex(se,P),x=this.match(se,u,P)),x!==null){if(d=te.longerAlt,d!==void 0){var Ae=M[d],Le=Ae.pattern;v=null,Ae.isCustom===!0?(G=Le.exec(F,P,Z,ne),G!==null?(m=G[0],G.payload!==void 0&&(v=G.payload)):m=null):(this.updateLastIndex(Le,P),m=this.match(Le,u,P)),m&&m.length>x.length&&(x=m,_=v,te=Ae)}break}}if(x!==null){if(y=x.length,w=te.group,w!==void 0&&(L=te.tokenTypeIdx,C=this.createTokenInstance(x,P,L,te.tokenType,oe,ue,y),this.handlePayload(C,_),w===!1?$=this.addToken(Z,$,C):ne[w].push(C)),u=this.chopInput(u,y),P=P+y,ue=this.computeNewColumn(ue,y),le===!0&&te.canLineTerminator===!0){var R=0,E=void 0,k=void 0;he.lastIndex=0;do E=he.test(x),E===!0&&(k=he.lastIndex-1,R++);while(E===!0);R!==0&&(oe=oe+R,ue=y-k,this.updateTokenEndLineColumnLocation(C,w,k,R,oe,ue,y))}this.handleModes(te,q,re,C)}else{for(var Q=P,K=oe,ce=ue,me=!1;!me&&P<U;)for(A=F.charCodeAt(P),u=this.chopInput(u,1),P++,g=0;g<I;g++){var pe=M[g],se=pe.pattern,J=pe.short;if(J!==!1?F.charCodeAt(P)===J&&(me=!0):pe.isCustom===!0?me=se.exec(F,P,Z,ne)!==null:(this.updateLastIndex(se,P),me=se.exec(u)!==null),me===!0)break}b=P-Q,N=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(F,Q,b,K,ce),W.push({offset:Q,line:K,column:ce,length:b,message:N})}}return this.hasCustom||(Z.length=$),{tokens:Z,groups:ne,errors:W}},l.prototype.handleModes=function(u,h,f,p){if(u.pop===!0){var g=u.push;h(p),g!==void 0&&f.call(this,g)}else u.push!==void 0&&f.call(this,u.push)},l.prototype.chopInput=function(u,h){return u.substring(h)},l.prototype.updateLastIndex=function(u,h){u.lastIndex=h},l.prototype.updateTokenEndLineColumnLocation=function(u,h,f,p,g,m,d){var x,_;h!==void 0&&(x=f===d-1,_=x?-1:0,p===1&&x===!0||(u.endLine=g+_,u.endColumn=m-1+-_))},l.prototype.computeNewColumn=function(u,h){return u+h},l.prototype.createTokenInstance=function(){for(var u=[],h=0;h<arguments.length;h++)u[h]=arguments[h];return null},l.prototype.createOffsetOnlyToken=function(u,h,f,p){return{image:u,startOffset:h,tokenTypeIdx:f,tokenType:p}},l.prototype.createStartOnlyToken=function(u,h,f,p,g,m){return{image:u,startOffset:h,startLine:g,startColumn:m,tokenTypeIdx:f,tokenType:p}},l.prototype.createFullToken=function(u,h,f,p,g,m,d){return{image:u,startOffset:h,endOffset:h+d-1,startLine:g,endLine:g,startColumn:m,endColumn:m+d-1,tokenTypeIdx:f,tokenType:p}},l.prototype.addToken=function(u,h,f){return 666},l.prototype.addTokenUsingPush=function(u,h,f){return u.push(f),h},l.prototype.addTokenUsingMemberAccess=function(u,h,f){return u[h]=f,h++,h},l.prototype.handlePayload=function(u,h){},l.prototype.handlePayloadNoCustom=function(u,h){},l.prototype.handlePayloadWithCustom=function(u,h){h!==null&&(u.payload=h)},l.prototype.match=function(u,h,f){return null},l.prototype.matchWithTest=function(u,h,f){var p=u.test(h);return p===!0?h.substring(f,u.lastIndex):null},l.prototype.matchWithExec=function(u,h){var f=u.exec(h);return f!==null?f[0]:f},l.prototype.TRACE_INIT=function(u,h){if(this.traceInitPerf===!0){this.traceInitIndent++;var f=new Array(this.traceInitIndent+1).join("	");this.traceInitIndent<this.traceInitMaxIdent&&console.log(f+"--> <"+u+">");var p=t.timer(h),g=p.time,m=p.value,d=g>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&d(f+"<-- <"+u+"> time: "+g+"ms"),this.traceInitIndent--,m}else return h()},l.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",l.NA=/NOT_APPLICABLE/,l}();r.Lexer=c}),po=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.tokenMatcher=r.createTokenInstance=r.EOF=r.createToken=r.hasTokenLabel=r.tokenName=r.tokenLabel=void 0;var e=Ot(),t=Ph(),n=mc();function i(y){return o(y)?y.LABEL:y.name}r.tokenLabel=i;function s(y){return y.name}r.tokenName=s;function o(y){return e.isString(y.LABEL)&&y.LABEL!==""}r.hasTokenLabel=o;var a="parent",c="categories",l="label",u="group",h="push_mode",f="pop_mode",p="longer_alt",g="line_breaks",m="start_chars_hint";function d(y){return x(y)}r.createToken=d;function x(y){var w=y.pattern,L={};if(L.name=y.name,e.isUndefined(w)||(L.PATTERN=w),e.has(y,a))throw`The parent property is no longer supported.
3198See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return e.has(y,c)&&(L.CATEGORIES=y[c]),n.augmentTokenTypes([L]),e.has(y,l)&&(L.LABEL=y[l]),e.has(y,u)&&(L.GROUP=y[u]),e.has(y,f)&&(L.POP_MODE=y[f]),e.has(y,h)&&(L.PUSH_MODE=y[h]),e.has(y,p)&&(L.LONGER_ALT=y[p]),e.has(y,g)&&(L.LINE_BREAKS=y[g]),e.has(y,m)&&(L.START_CHARS_HINT=y[m]),L}r.EOF=d({name:"EOF",pattern:t.Lexer.NA}),n.augmentTokenTypes([r.EOF]);function _(y,w,L,C,b,A,N,G){return{image:w,startOffset:L,endOffset:C,startLine:b,endLine:A,startColumn:N,endColumn:G,tokenTypeIdx:y.tokenTypeIdx,tokenType:y}}r.createTokenInstance=_;function v(y,w){return n.tokenStructuredMatcher(y,w)}r.tokenMatcher=v}),_i=ft(r=>{"use strict";var e=r&&r.__extends||function(){var x=function(_,v){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,w){y.__proto__=w}||function(y,w){for(var L in w)Object.prototype.hasOwnProperty.call(w,L)&&(y[L]=w[L])},x(_,v)};return function(_,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");x(_,v);function y(){this.constructor=_}_.prototype=v===null?Object.create(v):(y.prototype=v.prototype,new y)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.serializeProduction=r.serializeGrammar=r.Terminal=r.Alternation=r.RepetitionWithSeparator=r.Repetition=r.RepetitionMandatoryWithSeparator=r.RepetitionMandatory=r.Option=r.Alternative=r.Rule=r.NonTerminal=r.AbstractProduction=void 0;var t=Ot(),n=po(),i=function(){function x(_){this._definition=_}return Object.defineProperty(x.prototype,"definition",{get:function(){return this._definition},set:function(_){this._definition=_},enumerable:!1,configurable:!0}),x.prototype.accept=function(_){_.visit(this),t.forEach(this.definition,function(v){v.accept(_)})},x}();r.AbstractProduction=i;var s=function(x){e(_,x);function _(v){var y=x.call(this,[])||this;return y.idx=1,t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return Object.defineProperty(_.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(v){},enumerable:!1,configurable:!0}),_.prototype.accept=function(v){v.visit(this)},_}(i);r.NonTerminal=s;var o=function(x){e(_,x);function _(v){var y=x.call(this,v.definition)||this;return y.orgText="",t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return _}(i);r.Rule=o;var a=function(x){e(_,x);function _(v){var y=x.call(this,v.definition)||this;return y.ignoreAmbiguities=!1,t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return _}(i);r.Alternative=a;var c=function(x){e(_,x);function _(v){var y=x.call(this,v.definition)||this;return y.idx=1,t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return _}(i);r.Option=c;var l=function(x){e(_,x);function _(v){var y=x.call(this,v.definition)||this;return y.idx=1,t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return _}(i);r.RepetitionMandatory=l;var u=function(x){e(_,x);function _(v){var y=x.call(this,v.definition)||this;return y.idx=1,t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return _}(i);r.RepetitionMandatoryWithSeparator=u;var h=function(x){e(_,x);function _(v){var y=x.call(this,v.definition)||this;return y.idx=1,t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return _}(i);r.Repetition=h;var f=function(x){e(_,x);function _(v){var y=x.call(this,v.definition)||this;return y.idx=1,t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return _}(i);r.RepetitionWithSeparator=f;var p=function(x){e(_,x);function _(v){var y=x.call(this,v.definition)||this;return y.idx=1,y.ignoreAmbiguities=!1,y.hasPredicates=!1,t.assign(y,t.pick(v,function(w){return w!==void 0})),y}return Object.defineProperty(_.prototype,"definition",{get:function(){return this._definition},set:function(v){this._definition=v},enumerable:!1,configurable:!0}),_}(i);r.Alternation=p;var g=function(){function x(_){this.idx=1,t.assign(this,t.pick(_,function(v){return v!==void 0}))}return x.prototype.accept=function(_){_.visit(this)},x}();r.Terminal=g;function m(x){return t.map(x,d)}r.serializeGrammar=m;function d(x){function _(w){return t.map(w,d)}if(x instanceof s)return{type:"NonTerminal",name:x.nonTerminalName,idx:x.idx};if(x instanceof a)return{type:"Alternative",definition:_(x.definition)};if(x instanceof c)return{type:"Option",idx:x.idx,definition:_(x.definition)};if(x instanceof l)return{type:"RepetitionMandatory",idx:x.idx,definition:_(x.definition)};if(x instanceof u)return{type:"RepetitionMandatoryWithSeparator",idx:x.idx,separator:d(new g({terminalType:x.separator})),definition:_(x.definition)};if(x instanceof f)return{type:"RepetitionWithSeparator",idx:x.idx,separator:d(new g({terminalType:x.separator})),definition:_(x.definition)};if(x instanceof h)return{type:"Repetition",idx:x.idx,definition:_(x.definition)};if(x instanceof p)return{type:"Alternation",idx:x.idx,definition:_(x.definition)};if(x instanceof g){var v={type:"Terminal",name:x.terminalType.name,label:n.tokenLabel(x.terminalType),idx:x.idx},y=x.terminalType.PATTERN;return x.terminalType.PATTERN&&(v.pattern=t.isRegExp(y)?y.source:y),v}else{if(x instanceof o)return{type:"Rule",name:x.name,orgText:x.orgText,definition:_(x.definition)};throw Error("non exhaustive match")}}r.serializeProduction=d}),_p=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RestWalker=void 0;var e=Ot(),t=_i(),n=function(){function s(){}return s.prototype.walk=function(o,a){var c=this;a===void 0&&(a=[]),e.forEach(o.definition,function(l,u){var h=e.drop(o.definition,u+1);if(l instanceof t.NonTerminal)c.walkProdRef(l,h,a);else if(l instanceof t.Terminal)c.walkTerminal(l,h,a);else if(l instanceof t.Alternative)c.walkFlat(l,h,a);else if(l instanceof t.Option)c.walkOption(l,h,a);else if(l instanceof t.RepetitionMandatory)c.walkAtLeastOne(l,h,a);else if(l instanceof t.RepetitionMandatoryWithSeparator)c.walkAtLeastOneSep(l,h,a);else if(l instanceof t.RepetitionWithSeparator)c.walkManySep(l,h,a);else if(l instanceof t.Repetition)c.walkMany(l,h,a);else if(l instanceof t.Alternation)c.walkOr(l,h,a);else throw Error("non exhaustive match")})},s.prototype.walkTerminal=function(o,a,c){},s.prototype.walkProdRef=function(o,a,c){},s.prototype.walkFlat=function(o,a,c){var l=a.concat(c);this.walk(o,l)},s.prototype.walkOption=function(o,a,c){var l=a.concat(c);this.walk(o,l)},s.prototype.walkAtLeastOne=function(o,a,c){var l=[new t.Option({definition:o.definition})].concat(a,c);this.walk(o,l)},s.prototype.walkAtLeastOneSep=function(o,a,c){var l=i(o,a,c);this.walk(o,l)},s.prototype.walkMany=function(o,a,c){var l=[new t.Option({definition:o.definition})].concat(a,c);this.walk(o,l)},s.prototype.walkManySep=function(o,a,c){var l=i(o,a,c);this.walk(o,l)},s.prototype.walkOr=function(o,a,c){var l=this,u=a.concat(c);e.forEach(o.definition,function(h){var f=new t.Alternative({definition:[h]});l.walk(f,u)})},s}();r.RestWalker=n;function i(s,o,a){var c=[new t.Option({definition:[new t.Terminal({terminalType:s.separator})].concat(s.definition)})],l=c.concat(o,a);return l}}),gc=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.GAstVisitor=void 0;var e=_i(),t=function(){function n(){}return n.prototype.visit=function(i){var s=i;switch(s.constructor){case e.NonTerminal:return this.visitNonTerminal(s);case e.Alternative:return this.visitAlternative(s);case e.Option:return this.visitOption(s);case e.RepetitionMandatory:return this.visitRepetitionMandatory(s);case e.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(s);case e.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(s);case e.Repetition:return this.visitRepetition(s);case e.Alternation:return this.visitAlternation(s);case e.Terminal:return this.visitTerminal(s);case e.Rule:return this.visitRule(s);default:throw Error("non exhaustive match")}},n.prototype.visitNonTerminal=function(i){},n.prototype.visitAlternative=function(i){},n.prototype.visitOption=function(i){},n.prototype.visitRepetition=function(i){},n.prototype.visitRepetitionMandatory=function(i){},n.prototype.visitRepetitionMandatoryWithSeparator=function(i){},n.prototype.visitRepetitionWithSeparator=function(i){},n.prototype.visitAlternation=function(i){},n.prototype.visitTerminal=function(i){},n.prototype.visitRule=function(i){},n}();r.GAstVisitor=t}),Lh=ft(r=>{"use strict";var e=r&&r.__extends||function(){var f=function(p,g){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,d){m.__proto__=d}||function(m,d){for(var x in d)Object.prototype.hasOwnProperty.call(d,x)&&(m[x]=d[x])},f(p,g)};return function(p,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");f(p,g);function m(){this.constructor=p}p.prototype=g===null?Object.create(g):(m.prototype=g.prototype,new m)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.collectMethods=r.DslMethodsCollectorVisitor=r.getProductionDslName=r.isBranchingProd=r.isOptionalProd=r.isSequenceProd=void 0;var t=Ot(),n=_i(),i=gc();function s(f){return f instanceof n.Alternative||f instanceof n.Option||f instanceof n.Repetition||f instanceof n.RepetitionMandatory||f instanceof n.RepetitionMandatoryWithSeparator||f instanceof n.RepetitionWithSeparator||f instanceof n.Terminal||f instanceof n.Rule}r.isSequenceProd=s;function o(f,p){p===void 0&&(p=[]);var g=f instanceof n.Option||f instanceof n.Repetition||f instanceof n.RepetitionWithSeparator;return g?!0:f instanceof n.Alternation?t.some(f.definition,function(m){return o(m,p)}):f instanceof n.NonTerminal&&t.contains(p,f)?!1:f instanceof n.AbstractProduction?(f instanceof n.NonTerminal&&p.push(f),t.every(f.definition,function(m){return o(m,p)})):!1}r.isOptionalProd=o;function a(f){return f instanceof n.Alternation}r.isBranchingProd=a;function c(f){if(f instanceof n.NonTerminal)return"SUBRULE";if(f instanceof n.Option)return"OPTION";if(f instanceof n.Alternation)return"OR";if(f instanceof n.RepetitionMandatory)return"AT_LEAST_ONE";if(f instanceof n.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(f instanceof n.RepetitionWithSeparator)return"MANY_SEP";if(f instanceof n.Repetition)return"MANY";if(f instanceof n.Terminal)return"CONSUME";throw Error("non exhaustive match")}r.getProductionDslName=c;var l=function(f){e(p,f);function p(){var g=f!==null&&f.apply(this,arguments)||this;return g.separator="-",g.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},g}return p.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},p.prototype.visitTerminal=function(g){var m=g.terminalType.name+this.separator+"Terminal";t.has(this.dslMethods,m)||(this.dslMethods[m]=[]),this.dslMethods[m].push(g)},p.prototype.visitNonTerminal=function(g){var m=g.nonTerminalName+this.separator+"Terminal";t.has(this.dslMethods,m)||(this.dslMethods[m]=[]),this.dslMethods[m].push(g)},p.prototype.visitOption=function(g){this.dslMethods.option.push(g)},p.prototype.visitRepetitionWithSeparator=function(g){this.dslMethods.repetitionWithSeparator.push(g)},p.prototype.visitRepetitionMandatory=function(g){this.dslMethods.repetitionMandatory.push(g)},p.prototype.visitRepetitionMandatoryWithSeparator=function(g){this.dslMethods.repetitionMandatoryWithSeparator.push(g)},p.prototype.visitRepetition=function(g){this.dslMethods.repetition.push(g)},p.prototype.visitAlternation=function(g){this.dslMethods.alternation.push(g)},p}(i.GAstVisitor);r.DslMethodsCollectorVisitor=l;var u=new l;function h(f){u.reset(),f.accept(u);var p=u.dslMethods;return u.reset(),p}r.collectMethods=h}),dx=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.firstForTerminal=r.firstForBranching=r.firstForSequence=r.first=void 0;var e=Ot(),t=_i(),n=Lh();function i(c){if(c instanceof t.NonTerminal)return i(c.referencedRule);if(c instanceof t.Terminal)return a(c);if(n.isSequenceProd(c))return s(c);if(n.isBranchingProd(c))return o(c);throw Error("non exhaustive match")}r.first=i;function s(c){for(var l=[],u=c.definition,h=0,f=u.length>h,p,g=!0;f&&g;)p=u[h],g=n.isOptionalProd(p),l=l.concat(i(p)),h=h+1,f=u.length>h;return e.uniq(l)}r.firstForSequence=s;function o(c){var l=e.map(c.definition,function(u){return i(u)});return e.uniq(e.flatten(l))}r.firstForBranching=o;function a(c){return[c.terminalType]}r.firstForTerminal=a}),px=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.IN=void 0,r.IN="_~IN~_"}),yw=ft(r=>{"use strict";var e=r&&r.__extends||function(){var h=function(f,p){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,m){g.__proto__=m}||function(g,m){for(var d in m)Object.prototype.hasOwnProperty.call(m,d)&&(g[d]=m[d])},h(f,p)};return function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");h(f,p);function g(){this.constructor=f}f.prototype=p===null?Object.create(p):(g.prototype=p.prototype,new g)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.buildInProdFollowPrefix=r.buildBetweenProdsFollowPrefix=r.computeAllProdsFollows=r.ResyncFollowsWalker=void 0;var t=_p(),n=dx(),i=Ot(),s=px(),o=_i(),a=function(h){e(f,h);function f(p){var g=h.call(this)||this;return g.topProd=p,g.follows={},g}return f.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},f.prototype.walkTerminal=function(p,g,m){},f.prototype.walkProdRef=function(p,g,m){var d=l(p.referencedRule,p.idx)+this.topProd.name,x=g.concat(m),_=new o.Alternative({definition:x}),v=n.first(_);this.follows[d]=v},f}(t.RestWalker);r.ResyncFollowsWalker=a;function c(h){var f={};return i.forEach(h,function(p){var g=new a(p).startWalking();i.assign(f,g)}),f}r.computeAllProdsFollows=c;function l(h,f){return h.name+f+s.IN}r.buildBetweenProdsFollowPrefix=l;function u(h){var f=h.terminalType.name;return f+h.idx+s.IN}r.buildInProdFollowPrefix=u}),Nh=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.defaultGrammarValidatorErrorProvider=r.defaultGrammarResolverErrorProvider=r.defaultParserErrorProvider=void 0;var e=po(),t=Ot(),n=Ot(),i=_i(),s=Lh();r.defaultParserErrorProvider={buildMismatchTokenMessage:function(o){var a=o.expected,c=o.actual,l=o.previous,u=o.ruleName,h=e.hasTokenLabel(a),f=h?"--> "+e.tokenLabel(a)+" <--":"token of type --> "+a.name+" <--",p="Expecting "+f+" but found --> '"+c.image+"' <--";return p},buildNotAllInputParsedMessage:function(o){var a=o.firstRedundant,c=o.ruleName;return"Redundant input, expecting EOF but found: "+a.image},buildNoViableAltMessage:function(o){var a=o.expectedPathsPerAlt,c=o.actual,l=o.previous,u=o.customUserDescription,h=o.ruleName,f="Expecting: ",p=n.first(c).image,g=`
3199but found: '`+p+"'";if(u)return f+u+g;var m=n.reduce(a,function(v,y){return v.concat(y)},[]),d=n.map(m,function(v){return"["+n.map(v,function(y){return e.tokenLabel(y)}).join(", ")+"]"}),x=n.map(d,function(v,y){return"  "+(y+1)+". "+v}),_=`one of these possible Token sequences:
3200`+x.join(`
3201`);return f+_+g},buildEarlyExitMessage:function(o){var a=o.expectedIterationPaths,c=o.actual,l=o.customUserDescription,u=o.ruleName,h="Expecting: ",f=n.first(c).image,p=`
3202but found: '`+f+"'";if(l)return h+l+p;var g=n.map(a,function(d){return"["+n.map(d,function(x){return e.tokenLabel(x)}).join(",")+"]"}),m=`expecting at least one iteration which starts with one of these possible Token sequences::
3203  `+("<"+g.join(" ,")+">");return h+m+p}},Object.freeze(r.defaultParserErrorProvider),r.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(o,a){var c="Invalid grammar, reference to a rule which is not defined: ->"+a.nonTerminalName+`<-
3204inside top level rule: ->`+o.name+"<-";return c}},r.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(o,a){function c(d){return d instanceof i.Terminal?d.terminalType.name:d instanceof i.NonTerminal?d.nonTerminalName:""}var l=o.name,u=n.first(a),h=u.idx,f=s.getProductionDslName(u),p=c(u),g=h>0,m="->"+f+(g?h:"")+"<- "+(p?"with argument: ->"+p+"<-":"")+`
3205                  appears more than once (`+a.length+" times) in the top level rule: ->"+l+`<-.
3206                  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
3207                  `;return m=m.replace(/[ \t]+/g," "),m=m.replace(/\s\s+/g,`
3208`),m},buildNamespaceConflictError:function(o){var a=`Namespace conflict found in grammar.
3209`+("The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+o.name+`>.
3210`)+`To resolve this make sure each Terminal and Non-Terminal names are unique
3211This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
3212and Non-Terminal names start with a lower case letter.`;return a},buildAlternationPrefixAmbiguityError:function(o){var a=n.map(o.prefixPath,function(u){return e.tokenLabel(u)}).join(", "),c=o.alternation.idx===0?"":o.alternation.idx,l="Ambiguous alternatives: <"+o.ambiguityIndices.join(" ,")+`> due to common lookahead prefix
3213`+("in <OR"+c+"> inside <"+o.topLevelRule.name+`> Rule,
3214`)+("<"+a+`> may appears as a prefix path in all these alternatives.
3215`)+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
3216For Further details.`;return l},buildAlternationAmbiguityError:function(o){var a=n.map(o.prefixPath,function(u){return e.tokenLabel(u)}).join(", "),c=o.alternation.idx===0?"":o.alternation.idx,l="Ambiguous Alternatives Detected: <"+o.ambiguityIndices.join(" ,")+"> in <OR"+c+">"+(" inside <"+o.topLevelRule.name+`> Rule,
3217`)+("<"+a+`> may appears as a prefix path in all these alternatives.
3218`);return l=l+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
3219For Further details.`,l},buildEmptyRepetitionError:function(o){var a=s.getProductionDslName(o.repetition);o.repetition.idx!==0&&(a+=o.repetition.idx);var c="The repetition <"+a+"> within Rule <"+o.topLevelRule.name+`> can never consume any tokens.
3220This could lead to an infinite loop.`;return c},buildTokenNameError:function(o){return"deprecated"},buildEmptyAlternationError:function(o){var a="Ambiguous empty alternative: <"+(o.emptyChoiceIdx+1)+">"+(" in <OR"+o.alternation.idx+"> inside <"+o.topLevelRule.name+`> Rule.
3221`)+"Only the last alternative may be an empty alternative.";return a},buildTooManyAlternativesError:function(o){var a=`An Alternation cannot have more than 256 alternatives:
3222`+("<OR"+o.alternation.idx+"> inside <"+o.topLevelRule.name+`> Rule.
3223 has `+(o.alternation.definition.length+1)+" alternatives.");return a},buildLeftRecursionError:function(o){var a=o.topLevelRule.name,c=t.map(o.leftRecursionPath,function(h){return h.name}),l=a+" --> "+c.concat([a]).join(" --> "),u=`Left Recursion found in grammar.
3224`+("rule: <"+a+`> can be invoked from itself (directly or indirectly)
3225`)+(`without consuming any Tokens. The grammar path that causes this is:
3226 `+l+`
3227`)+` To fix this refactor your grammar to remove the left recursion.
3228see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return u},buildInvalidRuleNameError:function(o){return"deprecated"},buildDuplicateRuleNameError:function(o){var a;o.topLevelRule instanceof i.Rule?a=o.topLevelRule.name:a=o.topLevelRule;var c="Duplicate definition, rule: ->"+a+"<- is already defined in the grammar: ->"+o.grammarName+"<-";return c}}}),vw=ft(r=>{"use strict";var e=r&&r.__extends||function(){var a=function(c,l){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,h){u.__proto__=h}||function(u,h){for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(u[f]=h[f])},a(c,l)};return function(c,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");a(c,l);function u(){this.constructor=c}c.prototype=l===null?Object.create(l):(u.prototype=l.prototype,new u)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.GastRefResolverVisitor=r.resolveGrammar=void 0;var t=Ui(),n=Ot(),i=gc();function s(a,c){var l=new o(a,c);return l.resolveRefs(),l.errors}r.resolveGrammar=s;var o=function(a){e(c,a);function c(l,u){var h=a.call(this)||this;return h.nameToTopRule=l,h.errMsgProvider=u,h.errors=[],h}return c.prototype.resolveRefs=function(){var l=this;n.forEach(n.values(this.nameToTopRule),function(u){l.currTopLevel=u,u.accept(l)})},c.prototype.visitNonTerminal=function(l){var u=this.nameToTopRule[l.nonTerminalName];if(u)l.referencedRule=u;else{var h=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,l);this.errors.push({message:h,type:t.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:l.nonTerminalName})}},c}(i.GAstVisitor);r.GastRefResolverVisitor=o}),Oh=ft(r=>{"use strict";var e=r&&r.__extends||function(){var d=function(x,_){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,y){v.__proto__=y}||function(v,y){for(var w in y)Object.prototype.hasOwnProperty.call(y,w)&&(v[w]=y[w])},d(x,_)};return function(x,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");d(x,_);function v(){this.constructor=x}x.prototype=_===null?Object.create(_):(v.prototype=_.prototype,new v)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.nextPossibleTokensAfter=r.possiblePathsFrom=r.NextTerminalAfterAtLeastOneSepWalker=r.NextTerminalAfterAtLeastOneWalker=r.NextTerminalAfterManySepWalker=r.NextTerminalAfterManyWalker=r.AbstractNextTerminalAfterProductionWalker=r.NextAfterTokenWalker=r.AbstractNextPossibleTokensWalker=void 0;var t=_p(),n=Ot(),i=dx(),s=_i(),o=function(d){e(x,d);function x(_,v){var y=d.call(this)||this;return y.topProd=_,y.path=v,y.possibleTokTypes=[],y.nextProductionName="",y.nextProductionOccurrence=0,y.found=!1,y.isAtEndOfPath=!1,y}return x.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=n.cloneArr(this.path.ruleStack).reverse(),this.occurrenceStack=n.cloneArr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},x.prototype.walk=function(_,v){v===void 0&&(v=[]),this.found||d.prototype.walk.call(this,_,v)},x.prototype.walkProdRef=function(_,v,y){if(_.referencedRule.name===this.nextProductionName&&_.idx===this.nextProductionOccurrence){var w=v.concat(y);this.updateExpectedNext(),this.walk(_.referencedRule,w)}},x.prototype.updateExpectedNext=function(){n.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},x}(t.RestWalker);r.AbstractNextPossibleTokensWalker=o;var a=function(d){e(x,d);function x(_,v){var y=d.call(this,_,v)||this;return y.path=v,y.nextTerminalName="",y.nextTerminalOccurrence=0,y.nextTerminalName=y.path.lastTok.name,y.nextTerminalOccurrence=y.path.lastTokOccurrence,y}return x.prototype.walkTerminal=function(_,v,y){if(this.isAtEndOfPath&&_.terminalType.name===this.nextTerminalName&&_.idx===this.nextTerminalOccurrence&&!this.found){var w=v.concat(y),L=new s.Alternative({definition:w});this.possibleTokTypes=i.first(L),this.found=!0}},x}(o);r.NextAfterTokenWalker=a;var c=function(d){e(x,d);function x(_,v){var y=d.call(this)||this;return y.topRule=_,y.occurrence=v,y.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},y}return x.prototype.startWalking=function(){return this.walk(this.topRule),this.result},x}(t.RestWalker);r.AbstractNextTerminalAfterProductionWalker=c;var l=function(d){e(x,d);function x(){return d!==null&&d.apply(this,arguments)||this}return x.prototype.walkMany=function(_,v,y){if(_.idx===this.occurrence){var w=n.first(v.concat(y));this.result.isEndOfRule=w===void 0,w instanceof s.Terminal&&(this.result.token=w.terminalType,this.result.occurrence=w.idx)}else d.prototype.walkMany.call(this,_,v,y)},x}(c);r.NextTerminalAfterManyWalker=l;var u=function(d){e(x,d);function x(){return d!==null&&d.apply(this,arguments)||this}return x.prototype.walkManySep=function(_,v,y){if(_.idx===this.occurrence){var w=n.first(v.concat(y));this.result.isEndOfRule=w===void 0,w instanceof s.Terminal&&(this.result.token=w.terminalType,this.result.occurrence=w.idx)}else d.prototype.walkManySep.call(this,_,v,y)},x}(c);r.NextTerminalAfterManySepWalker=u;var h=function(d){e(x,d);function x(){return d!==null&&d.apply(this,arguments)||this}return x.prototype.walkAtLeastOne=function(_,v,y){if(_.idx===this.occurrence){var w=n.first(v.concat(y));this.result.isEndOfRule=w===void 0,w instanceof s.Terminal&&(this.result.token=w.terminalType,this.result.occurrence=w.idx)}else d.prototype.walkAtLeastOne.call(this,_,v,y)},x}(c);r.NextTerminalAfterAtLeastOneWalker=h;var f=function(d){e(x,d);function x(){return d!==null&&d.apply(this,arguments)||this}return x.prototype.walkAtLeastOneSep=function(_,v,y){if(_.idx===this.occurrence){var w=n.first(v.concat(y));this.result.isEndOfRule=w===void 0,w instanceof s.Terminal&&(this.result.token=w.terminalType,this.result.occurrence=w.idx)}else d.prototype.walkAtLeastOneSep.call(this,_,v,y)},x}(c);r.NextTerminalAfterAtLeastOneSepWalker=f;function p(d,x,_){_===void 0&&(_=[]),_=n.cloneArr(_);var v=[],y=0;function w(A){return A.concat(n.drop(d,y+1))}function L(A){var N=p(w(A),x,_);return v.concat(N)}for(;_.length<x&&y<d.length;){var C=d[y];if(C instanceof s.Alternative||C instanceof s.NonTerminal)return L(C.definition);if(C instanceof s.Option)v=L(C.definition);else if(C instanceof s.RepetitionMandatory){var b=C.definition.concat([new s.Repetition({definition:C.definition})]);return L(b)}else if(C instanceof s.RepetitionMandatoryWithSeparator){var b=[new s.Alternative({definition:C.definition}),new s.Repetition({definition:[new s.Terminal({terminalType:C.separator})].concat(C.definition)})];return L(b)}else if(C instanceof s.RepetitionWithSeparator){var b=C.definition.concat([new s.Repetition({definition:[new s.Terminal({terminalType:C.separator})].concat(C.definition)})]);v=L(b)}else if(C instanceof s.Repetition){var b=C.definition.concat([new s.Repetition({definition:C.definition})]);v=L(b)}else{if(C instanceof s.Alternation)return n.forEach(C.definition,function(A){n.isEmpty(A.definition)===!1&&(v=L(A.definition))}),v;if(C instanceof s.Terminal)_.push(C.terminalType);else throw Error("non exhaustive match")}y++}return v.push({partialPath:_,suffixDef:n.drop(d,y)}),v}r.possiblePathsFrom=p;function g(d,x,_,v){var y="EXIT_NONE_TERMINAL",w=[y],L="EXIT_ALTERNATIVE",C=!1,b=x.length,A=b-v-1,N=[],G=[];for(G.push({idx:-1,def:d,ruleStack:[],occurrenceStack:[]});!n.isEmpty(G);){var F=G.pop();if(F===L){C&&n.last(G).idx<=A&&G.pop();continue}var U=F.def,P=F.idx,$=F.ruleStack,H=F.occurrenceStack;if(!n.isEmpty(U)){var Z=U[0];if(Z===y){var W={idx:P,def:n.drop(U),ruleStack:n.dropRight($),occurrenceStack:n.dropRight(H)};G.push(W)}else if(Z instanceof s.Terminal)if(P<b-1){var oe=P+1,ue=x[oe];if(_(ue,Z.terminalType)){var W={idx:oe,def:n.drop(U),ruleStack:$,occurrenceStack:H};G.push(W)}}else if(P===b-1)N.push({nextTokenType:Z.terminalType,nextTokenOccurrence:Z.idx,ruleStack:$,occurrenceStack:H}),C=!0;else throw Error("non exhaustive match");else if(Z instanceof s.NonTerminal){var ne=n.cloneArr($);ne.push(Z.nonTerminalName);var le=n.cloneArr(H);le.push(Z.idx);var W={idx:P,def:Z.definition.concat(w,n.drop(U)),ruleStack:ne,occurrenceStack:le};G.push(W)}else if(Z instanceof s.Option){var he={idx:P,def:n.drop(U),ruleStack:$,occurrenceStack:H};G.push(he),G.push(L);var I={idx:P,def:Z.definition.concat(n.drop(U)),ruleStack:$,occurrenceStack:H};G.push(I)}else if(Z instanceof s.RepetitionMandatory){var M=new s.Repetition({definition:Z.definition,idx:Z.idx}),T=Z.definition.concat([M],n.drop(U)),W={idx:P,def:T,ruleStack:$,occurrenceStack:H};G.push(W)}else if(Z instanceof s.RepetitionMandatoryWithSeparator){var S=new s.Terminal({terminalType:Z.separator}),M=new s.Repetition({definition:[S].concat(Z.definition),idx:Z.idx}),T=Z.definition.concat([M],n.drop(U)),W={idx:P,def:T,ruleStack:$,occurrenceStack:H};G.push(W)}else if(Z instanceof s.RepetitionWithSeparator){var he={idx:P,def:n.drop(U),ruleStack:$,occurrenceStack:H};G.push(he),G.push(L);var S=new s.Terminal({terminalType:Z.separator}),B=new s.Repetition({definition:[S].concat(Z.definition),idx:Z.idx}),T=Z.definition.concat([B],n.drop(U)),I={idx:P,def:T,ruleStack:$,occurrenceStack:H};G.push(I)}else if(Z instanceof s.Repetition){var he={idx:P,def:n.drop(U),ruleStack:$,occurrenceStack:H};G.push(he),G.push(L);var B=new s.Repetition({definition:Z.definition,idx:Z.idx}),T=Z.definition.concat([B],n.drop(U)),I={idx:P,def:T,ruleStack:$,occurrenceStack:H};G.push(I)}else if(Z instanceof s.Alternation)for(var j=Z.definition.length-1;j>=0;j--){var z=Z.definition[j],fe={idx:P,def:z.definition.concat(n.drop(U)),ruleStack:$,occurrenceStack:H};G.push(fe),G.push(L)}else if(Z instanceof s.Alternative)G.push({idx:P,def:Z.definition.concat(n.drop(U)),ruleStack:$,occurrenceStack:H});else if(Z instanceof s.Rule)G.push(m(Z,P,$,H));else throw Error("non exhaustive match")}}return N}r.nextPossibleTokensAfter=g;function m(d,x,_,v){var y=n.cloneArr(_);y.push(d.name);var w=n.cloneArr(v);return w.push(1),{idx:x,def:d.definition,ruleStack:y,occurrenceStack:w}}}),Dh=ft(r=>{"use strict";var e=r&&r.__extends||function(){var A=function(N,G){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,U){F.__proto__=U}||function(F,U){for(var P in U)Object.prototype.hasOwnProperty.call(U,P)&&(F[P]=U[P])},A(N,G)};return function(N,G){if(typeof G!="function"&&G!==null)throw new TypeError("Class extends value "+String(G)+" is not a constructor or null");A(N,G);function F(){this.constructor=N}N.prototype=G===null?Object.create(G):(F.prototype=G.prototype,new F)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.areTokenCategoriesNotUsed=r.isStrictPrefixOfPath=r.containsPath=r.getLookaheadPathsForOptionalProd=r.getLookaheadPathsForOr=r.lookAheadSequenceFromAlternatives=r.buildSingleAlternativeLookaheadFunction=r.buildAlternativesLookAheadFunc=r.buildLookaheadFuncForOptionalProd=r.buildLookaheadFuncForOr=r.getProdType=r.PROD_TYPE=void 0;var t=Ot(),n=Oh(),i=_p(),s=mc(),o=_i(),a=gc(),c;(function(A){A[A.OPTION=0]="OPTION",A[A.REPETITION=1]="REPETITION",A[A.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",A[A.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",A[A.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",A[A.ALTERNATION=5]="ALTERNATION"})(c=r.PROD_TYPE||(r.PROD_TYPE={}));function l(A){if(A instanceof o.Option)return c.OPTION;if(A instanceof o.Repetition)return c.REPETITION;if(A instanceof o.RepetitionMandatory)return c.REPETITION_MANDATORY;if(A instanceof o.RepetitionMandatoryWithSeparator)return c.REPETITION_MANDATORY_WITH_SEPARATOR;if(A instanceof o.RepetitionWithSeparator)return c.REPETITION_WITH_SEPARATOR;if(A instanceof o.Alternation)return c.ALTERNATION;throw Error("non exhaustive match")}r.getProdType=l;function u(A,N,G,F,U,P){var $=y(A,N,G),H=b($)?s.tokenStructuredMatcherNoCategories:s.tokenStructuredMatcher;return P($,F,H,U)}r.buildLookaheadFuncForOr=u;function h(A,N,G,F,U,P){var $=w(A,N,U,G),H=b($)?s.tokenStructuredMatcherNoCategories:s.tokenStructuredMatcher;return P($[0],H,F)}r.buildLookaheadFuncForOptionalProd=h;function f(A,N,G,F){var U=A.length,P=t.every(A,function(Z){return t.every(Z,function(W){return W.length===1})});if(N)return function(Z){for(var W=t.map(Z,function(B){return B.GATE}),oe=0;oe<U;oe++){var ue=A[oe],ne=ue.length,le=W[oe];if(le!==void 0&&le.call(this)===!1)continue;e:for(var he=0;he<ne;he++){for(var I=ue[he],M=I.length,T=0;T<M;T++){var S=this.LA(T+1);if(G(S,I[T])===!1)continue e}return oe}}};if(P&&!F){var $=t.map(A,function(Z){return t.flatten(Z)}),H=t.reduce($,function(Z,W,oe){return t.forEach(W,function(ue){t.has(Z,ue.tokenTypeIdx)||(Z[ue.tokenTypeIdx]=oe),t.forEach(ue.categoryMatches,function(ne){t.has(Z,ne)||(Z[ne]=oe)})}),Z},[]);return function(){var Z=this.LA(1);return H[Z.tokenTypeIdx]}}else return function(){for(var Z=0;Z<U;Z++){var W=A[Z],oe=W.length;e:for(var ue=0;ue<oe;ue++){for(var ne=W[ue],le=ne.length,he=0;he<le;he++){var I=this.LA(he+1);if(G(I,ne[he])===!1)continue e}return Z}}}}r.buildAlternativesLookAheadFunc=f;function p(A,N,G){var F=t.every(A,function(W){return W.length===1}),U=A.length;if(F&&!G){var P=t.flatten(A);if(P.length===1&&t.isEmpty(P[0].categoryMatches)){var $=P[0],H=$.tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===H}}else{var Z=t.reduce(P,function(W,oe,ue){return W[oe.tokenTypeIdx]=!0,t.forEach(oe.categoryMatches,function(ne){W[ne]=!0}),W},[]);return function(){var W=this.LA(1);return Z[W.tokenTypeIdx]===!0}}}else return function(){e:for(var W=0;W<U;W++){for(var oe=A[W],ue=oe.length,ne=0;ne<ue;ne++){var le=this.LA(ne+1);if(N(le,oe[ne])===!1)continue e}return!0}return!1}}r.buildSingleAlternativeLookaheadFunction=p;var g=function(A){e(N,A);function N(G,F,U){var P=A.call(this)||this;return P.topProd=G,P.targetOccurrence=F,P.targetProdType=U,P}return N.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},N.prototype.checkIsTarget=function(G,F,U,P){return G.idx===this.targetOccurrence&&this.targetProdType===F?(this.restDef=U.concat(P),!0):!1},N.prototype.walkOption=function(G,F,U){this.checkIsTarget(G,c.OPTION,F,U)||A.prototype.walkOption.call(this,G,F,U)},N.prototype.walkAtLeastOne=function(G,F,U){this.checkIsTarget(G,c.REPETITION_MANDATORY,F,U)||A.prototype.walkOption.call(this,G,F,U)},N.prototype.walkAtLeastOneSep=function(G,F,U){this.checkIsTarget(G,c.REPETITION_MANDATORY_WITH_SEPARATOR,F,U)||A.prototype.walkOption.call(this,G,F,U)},N.prototype.walkMany=function(G,F,U){this.checkIsTarget(G,c.REPETITION,F,U)||A.prototype.walkOption.call(this,G,F,U)},N.prototype.walkManySep=function(G,F,U){this.checkIsTarget(G,c.REPETITION_WITH_SEPARATOR,F,U)||A.prototype.walkOption.call(this,G,F,U)},N}(i.RestWalker),m=function(A){e(N,A);function N(G,F,U){var P=A.call(this)||this;return P.targetOccurrence=G,P.targetProdType=F,P.targetRef=U,P.result=[],P}return N.prototype.checkIsTarget=function(G,F){G.idx===this.targetOccurrence&&this.targetProdType===F&&(this.targetRef===void 0||G===this.targetRef)&&(this.result=G.definition)},N.prototype.visitOption=function(G){this.checkIsTarget(G,c.OPTION)},N.prototype.visitRepetition=function(G){this.checkIsTarget(G,c.REPETITION)},N.prototype.visitRepetitionMandatory=function(G){this.checkIsTarget(G,c.REPETITION_MANDATORY)},N.prototype.visitRepetitionMandatoryWithSeparator=function(G){this.checkIsTarget(G,c.REPETITION_MANDATORY_WITH_SEPARATOR)},N.prototype.visitRepetitionWithSeparator=function(G){this.checkIsTarget(G,c.REPETITION_WITH_SEPARATOR)},N.prototype.visitAlternation=function(G){this.checkIsTarget(G,c.ALTERNATION)},N}(a.GAstVisitor);function d(A){for(var N=new Array(A),G=0;G<A;G++)N[G]=[];return N}function x(A){for(var N=[""],G=0;G<A.length;G++){for(var F=A[G],U=[],P=0;P<N.length;P++){var $=N[P];U.push($+"_"+F.tokenTypeIdx);for(var H=0;H<F.categoryMatches.length;H++){var Z="_"+F.categoryMatches[H];U.push($+Z)}}N=U}return N}function _(A,N,G){for(var F=0;F<A.length;F++)if(F!==G)for(var U=A[F],P=0;P<N.length;P++){var $=N[P];if(U[$]===!0)return!1}return!0}function v(A,N){for(var G=t.map(A,function(oe){return n.possiblePathsFrom([oe],1)}),F=d(G.length),U=t.map(G,function(oe){var ue={};return t.forEach(oe,function(ne){var le=x(ne.partialPath);t.forEach(le,function(he){ue[he]=!0})}),ue}),P=G,$=1;$<=N;$++){var H=P;P=d(H.length);for(var Z=function(oe){for(var ue=H[oe],ne=0;ne<ue.length;ne++){var le=ue[ne].partialPath,he=ue[ne].suffixDef,I=x(le),M=_(U,I,oe);if(M||t.isEmpty(he)||le.length===N){var T=F[oe];if(L(T,le)===!1){T.push(le);for(var S=0;S<I.length;S++){var B=I[S];U[oe][B]=!0}}}else{var j=n.possiblePathsFrom(he,$+1,le);P[oe]=P[oe].concat(j),t.forEach(j,function(z){var fe=x(z.partialPath);t.forEach(fe,function(q){U[oe][q]=!0})})}}},W=0;W<H.length;W++)Z(W)}return F}r.lookAheadSequenceFromAlternatives=v;function y(A,N,G,F){var U=new m(A,c.ALTERNATION,F);return N.accept(U),v(U.result,G)}r.getLookaheadPathsForOr=y;function w(A,N,G,F){var U=new m(A,G);N.accept(U);var P=U.result,$=new g(N,A,G),H=$.startWalking(),Z=new o.Alternative({definition:P}),W=new o.Alternative({definition:H});return v([Z,W],F)}r.getLookaheadPathsForOptionalProd=w;function L(A,N){e:for(var G=0;G<A.length;G++){var F=A[G];if(F.length===N.length){for(var U=0;U<F.length;U++){var P=N[U],$=F[U],H=P===$||$.categoryMatchesMap[P.tokenTypeIdx]!==void 0;if(H===!1)continue e}return!0}}return!1}r.containsPath=L;function C(A,N){return A.length<N.length&&t.every(A,function(G,F){var U=N[F];return G===U||U.categoryMatchesMap[G.tokenTypeIdx]})}r.isStrictPrefixOfPath=C;function b(A){return t.every(A,function(N){return t.every(N,function(G){return t.every(G,function(F){return t.isEmpty(F.categoryMatches)})})})}r.areTokenCategoriesNotUsed=b}),mx=ft(r=>{"use strict";var e=r&&r.__extends||function(){var F=function(U,P){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function($,H){$.__proto__=H}||function($,H){for(var Z in H)Object.prototype.hasOwnProperty.call(H,Z)&&($[Z]=H[Z])},F(U,P)};return function(U,P){if(typeof P!="function"&&P!==null)throw new TypeError("Class extends value "+String(P)+" is not a constructor or null");F(U,P);function $(){this.constructor=U}U.prototype=P===null?Object.create(P):($.prototype=P.prototype,new $)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.checkPrefixAlternativesAmbiguities=r.validateSomeNonEmptyLookaheadPath=r.validateTooManyAlts=r.RepetionCollector=r.validateAmbiguousAlternationAlternatives=r.validateEmptyOrAlternative=r.getFirstNoneTerminal=r.validateNoLeftRecursion=r.validateRuleIsOverridden=r.validateRuleDoesNotAlreadyExist=r.OccurrenceValidationCollector=r.identifyProductionForDuplicates=r.validateGrammar=void 0;var t=Ot(),n=Ot(),i=Ui(),s=Lh(),o=Dh(),a=Oh(),c=_i(),l=gc();function u(F,U,P,$,H){var Z=t.map(F,function(M){return h(M,$)}),W=t.map(F,function(M){return x(M,M,$)}),oe=[],ue=[],ne=[];n.every(W,n.isEmpty)&&(oe=n.map(F,function(M){return y(M,$)}),ue=n.map(F,function(M){return w(M,U,$)}),ne=b(F,U,$));var le=G(F,P,$),he=n.map(F,function(M){return C(M,$)}),I=n.map(F,function(M){return m(M,F,H,$)});return t.flatten(Z.concat(ne,W,oe,ue,le,he,I))}r.validateGrammar=u;function h(F,U){var P=new g;F.accept(P);var $=P.allProductions,H=t.groupBy($,f),Z=t.pick(H,function(oe){return oe.length>1}),W=t.map(t.values(Z),function(oe){var ue=t.first(oe),ne=U.buildDuplicateFoundError(F,oe),le=s.getProductionDslName(ue),he={message:ne,type:i.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:F.name,dslName:le,occurrence:ue.idx},I=p(ue);return I&&(he.parameter=I),he});return W}function f(F){return s.getProductionDslName(F)+"_#_"+F.idx+"_#_"+p(F)}r.identifyProductionForDuplicates=f;function p(F){return F instanceof c.Terminal?F.terminalType.name:F instanceof c.NonTerminal?F.nonTerminalName:""}var g=function(F){e(U,F);function U(){var P=F!==null&&F.apply(this,arguments)||this;return P.allProductions=[],P}return U.prototype.visitNonTerminal=function(P){this.allProductions.push(P)},U.prototype.visitOption=function(P){this.allProductions.push(P)},U.prototype.visitRepetitionWithSeparator=function(P){this.allProductions.push(P)},U.prototype.visitRepetitionMandatory=function(P){this.allProductions.push(P)},U.prototype.visitRepetitionMandatoryWithSeparator=function(P){this.allProductions.push(P)},U.prototype.visitRepetition=function(P){this.allProductions.push(P)},U.prototype.visitAlternation=function(P){this.allProductions.push(P)},U.prototype.visitTerminal=function(P){this.allProductions.push(P)},U}(l.GAstVisitor);r.OccurrenceValidationCollector=g;function m(F,U,P,$){var H=[],Z=n.reduce(U,function(oe,ue){return ue.name===F.name?oe+1:oe},0);if(Z>1){var W=$.buildDuplicateRuleNameError({topLevelRule:F,grammarName:P});H.push({message:W,type:i.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:F.name})}return H}r.validateRuleDoesNotAlreadyExist=m;function d(F,U,P){var $=[],H;return t.contains(U,F)||(H="Invalid rule override, rule: ->"+F+"<- cannot be overridden in the grammar: ->"+P+"<-as it is not defined in any of the super grammars ",$.push({message:H,type:i.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:F})),$}r.validateRuleIsOverridden=d;function x(F,U,P,$){$===void 0&&($=[]);var H=[],Z=_(U.definition);if(t.isEmpty(Z))return[];var W=F.name,oe=t.contains(Z,F);oe&&H.push({message:P.buildLeftRecursionError({topLevelRule:F,leftRecursionPath:$}),type:i.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:W});var ue=t.difference(Z,$.concat([F])),ne=t.map(ue,function(le){var he=t.cloneArr($);return he.push(le),x(F,le,P,he)});return H.concat(t.flatten(ne))}r.validateNoLeftRecursion=x;function _(F){var U=[];if(t.isEmpty(F))return U;var P=t.first(F);if(P instanceof c.NonTerminal)U.push(P.referencedRule);else if(P instanceof c.Alternative||P instanceof c.Option||P instanceof c.RepetitionMandatory||P instanceof c.RepetitionMandatoryWithSeparator||P instanceof c.RepetitionWithSeparator||P instanceof c.Repetition)U=U.concat(_(P.definition));else if(P instanceof c.Alternation)U=t.flatten(t.map(P.definition,function(W){return _(W.definition)}));else if(!(P instanceof c.Terminal))throw Error("non exhaustive match");var $=s.isOptionalProd(P),H=F.length>1;if($&&H){var Z=t.drop(F);return U.concat(_(Z))}else return U}r.getFirstNoneTerminal=_;var v=function(F){e(U,F);function U(){var P=F!==null&&F.apply(this,arguments)||this;return P.alternations=[],P}return U.prototype.visitAlternation=function(P){this.alternations.push(P)},U}(l.GAstVisitor);function y(F,U){var P=new v;F.accept(P);var $=P.alternations,H=t.reduce($,function(Z,W){var oe=t.dropRight(W.definition),ue=t.map(oe,function(ne,le){var he=a.nextPossibleTokensAfter([ne],[],null,1);return t.isEmpty(he)?{message:U.buildEmptyAlternationError({topLevelRule:F,alternation:W,emptyChoiceIdx:le}),type:i.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:F.name,occurrence:W.idx,alternative:le+1}:null});return Z.concat(t.compact(ue))},[]);return H}r.validateEmptyOrAlternative=y;function w(F,U,P){var $=new v;F.accept($);var H=$.alternations;H=n.reject(H,function(W){return W.ignoreAmbiguities===!0});var Z=t.reduce(H,function(W,oe){var ue=oe.idx,ne=oe.maxLookahead||U,le=o.getLookaheadPathsForOr(ue,F,ne,oe),he=A(le,oe,F,P),I=N(le,oe,F,P);return W.concat(he,I)},[]);return Z}r.validateAmbiguousAlternationAlternatives=w;var L=function(F){e(U,F);function U(){var P=F!==null&&F.apply(this,arguments)||this;return P.allProductions=[],P}return U.prototype.visitRepetitionWithSeparator=function(P){this.allProductions.push(P)},U.prototype.visitRepetitionMandatory=function(P){this.allProductions.push(P)},U.prototype.visitRepetitionMandatoryWithSeparator=function(P){this.allProductions.push(P)},U.prototype.visitRepetition=function(P){this.allProductions.push(P)},U}(l.GAstVisitor);r.RepetionCollector=L;function C(F,U){var P=new v;F.accept(P);var $=P.alternations,H=t.reduce($,function(Z,W){return W.definition.length>255&&Z.push({message:U.buildTooManyAlternativesError({topLevelRule:F,alternation:W}),type:i.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:F.name,occurrence:W.idx}),Z},[]);return H}r.validateTooManyAlts=C;function b(F,U,P){var $=[];return n.forEach(F,function(H){var Z=new L;H.accept(Z);var W=Z.allProductions;n.forEach(W,function(oe){var ue=o.getProdType(oe),ne=oe.maxLookahead||U,le=oe.idx,he=o.getLookaheadPathsForOptionalProd(le,H,ue,ne),I=he[0];if(n.isEmpty(n.flatten(I))){var M=P.buildEmptyRepetitionError({topLevelRule:H,repetition:oe});$.push({message:M,type:i.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:H.name})}})}),$}r.validateSomeNonEmptyLookaheadPath=b;function A(F,U,P,$){var H=[],Z=n.reduce(F,function(oe,ue,ne){return U.definition[ne].ignoreAmbiguities===!0||n.forEach(ue,function(le){var he=[ne];n.forEach(F,function(I,M){ne!==M&&o.containsPath(I,le)&&U.definition[M].ignoreAmbiguities!==!0&&he.push(M)}),he.length>1&&!o.containsPath(H,le)&&(H.push(le),oe.push({alts:he,path:le}))}),oe},[]),W=t.map(Z,function(oe){var ue=n.map(oe.alts,function(le){return le+1}),ne=$.buildAlternationAmbiguityError({topLevelRule:P,alternation:U,ambiguityIndices:ue,prefixPath:oe.path});return{message:ne,type:i.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:P.name,occurrence:U.idx,alternatives:[oe.alts]}});return W}function N(F,U,P,$){var H=[],Z=n.reduce(F,function(W,oe,ue){var ne=n.map(oe,function(le){return{idx:ue,path:le}});return W.concat(ne)},[]);return n.forEach(Z,function(W){var oe=U.definition[W.idx];if(oe.ignoreAmbiguities!==!0){var ue=W.idx,ne=W.path,le=n.findAll(Z,function(I){return U.definition[I.idx].ignoreAmbiguities!==!0&&I.idx<ue&&o.isStrictPrefixOfPath(I.path,ne)}),he=n.map(le,function(I){var M=[I.idx+1,ue+1],T=U.idx===0?"":U.idx,S=$.buildAlternationPrefixAmbiguityError({topLevelRule:P,alternation:U,ambiguityIndices:M,prefixPath:I.path});return{message:S,type:i.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:P.name,occurrence:T,alternatives:M}});H=H.concat(he)}}),H}r.checkPrefixAlternativesAmbiguities=N;function G(F,U,P){var $=[],H=n.map(U,function(Z){return Z.name});return n.forEach(F,function(Z){var W=Z.name;if(n.contains(H,W)){var oe=P.buildNamespaceConflictError(Z);$.push({message:oe,type:i.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:W})}}),$}}),_w=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateGrammar=r.resolveGrammar=void 0;var e=Ot(),t=vw(),n=mx(),i=Nh();function s(a){a=e.defaults(a,{errMsgProvider:i.defaultGrammarResolverErrorProvider});var c={};return e.forEach(a.rules,function(l){c[l.name]=l}),t.resolveGrammar(c,a.errMsgProvider)}r.resolveGrammar=s;function o(a){return a=e.defaults(a,{errMsgProvider:i.defaultGrammarValidatorErrorProvider}),n.validateGrammar(a.rules,a.maxLookahead,a.tokenTypes,a.errMsgProvider,a.grammarName)}r.validateGrammar=o}),xc=ft(r=>{"use strict";var e=r&&r.__extends||function(){var g=function(m,d){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,_){x.__proto__=_}||function(x,_){for(var v in _)Object.prototype.hasOwnProperty.call(_,v)&&(x[v]=_[v])},g(m,d)};return function(m,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");g(m,d);function x(){this.constructor=m}m.prototype=d===null?Object.create(d):(x.prototype=d.prototype,new x)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.EarlyExitException=r.NotAllInputParsedException=r.NoViableAltException=r.MismatchedTokenException=r.isRecognitionException=void 0;var t=Ot(),n="MismatchedTokenException",i="NoViableAltException",s="EarlyExitException",o="NotAllInputParsedException",a=[n,i,s,o];Object.freeze(a);function c(g){return t.contains(a,g.name)}r.isRecognitionException=c;var l=function(g){e(m,g);function m(d,x){var _=this.constructor,v=g.call(this,d)||this;return v.token=x,v.resyncedTokens=[],Object.setPrototypeOf(v,_.prototype),Error.captureStackTrace&&Error.captureStackTrace(v,v.constructor),v}return m}(Error),u=function(g){e(m,g);function m(d,x,_){var v=g.call(this,d,x)||this;return v.previousToken=_,v.name=n,v}return m}(l);r.MismatchedTokenException=u;var h=function(g){e(m,g);function m(d,x,_){var v=g.call(this,d,x)||this;return v.previousToken=_,v.name=i,v}return m}(l);r.NoViableAltException=h;var f=function(g){e(m,g);function m(d,x){var _=g.call(this,d,x)||this;return _.name=o,_}return m}(l);r.NotAllInputParsedException=f;var p=function(g){e(m,g);function m(d,x,_){var v=g.call(this,d,x)||this;return v.previousToken=_,v.name=s,v}return m}(l);r.EarlyExitException=p}),gx=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.attemptInRepetitionRecovery=r.Recoverable=r.InRuleRecoveryException=r.IN_RULE_RECOVERY_EXCEPTION=r.EOF_FOLLOW_KEY=void 0;var e=po(),t=Ot(),n=xc(),i=px(),s=Ui();r.EOF_FOLLOW_KEY={},r.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function o(l){this.name=r.IN_RULE_RECOVERY_EXCEPTION,this.message=l}r.InRuleRecoveryException=o,o.prototype=Error.prototype;var a=function(){function l(){}return l.prototype.initRecoverable=function(u){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=t.has(u,"recoveryEnabled")?u.recoveryEnabled:s.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=c)},l.prototype.getTokenToInsert=function(u){var h=e.createTokenInstance(u,"",NaN,NaN,NaN,NaN,NaN,NaN);return h.isInsertedInRecovery=!0,h},l.prototype.canTokenTypeBeInsertedInRecovery=function(u){return!0},l.prototype.tryInRepetitionRecovery=function(u,h,f,p){for(var g=this,m=this.findReSyncTokenType(),d=this.exportLexerState(),x=[],_=!1,v=this.LA(1),y=this.LA(1),w=function(){var L=g.LA(0),C=g.errorMessageProvider.buildMismatchTokenMessage({expected:p,actual:v,previous:L,ruleName:g.getCurrRuleFullName()}),b=new n.MismatchedTokenException(C,v,g.LA(0));b.resyncedTokens=t.dropRight(x),g.SAVE_ERROR(b)};!_;)if(this.tokenMatcher(y,p)){w();return}else if(f.call(this)){w(),u.apply(this,h);return}else this.tokenMatcher(y,m)?_=!0:(y=this.SKIP_TOKEN(),this.addToResyncTokens(y,x));this.importLexerState(d)},l.prototype.shouldInRepetitionRecoveryBeTried=function(u,h,f){return!(f===!1||u===void 0||h===void 0||this.tokenMatcher(this.LA(1),u)||this.isBackTracking()||this.canPerformInRuleRecovery(u,this.getFollowsForInRuleRecovery(u,h)))},l.prototype.getFollowsForInRuleRecovery=function(u,h){var f=this.getCurrentGrammarPath(u,h),p=this.getNextPossibleTokenTypes(f);return p},l.prototype.tryInRuleRecovery=function(u,h){if(this.canRecoverWithSingleTokenInsertion(u,h)){var f=this.getTokenToInsert(u);return f}if(this.canRecoverWithSingleTokenDeletion(u)){var p=this.SKIP_TOKEN();return this.consumeToken(),p}throw new o("sad sad panda")},l.prototype.canPerformInRuleRecovery=function(u,h){return this.canRecoverWithSingleTokenInsertion(u,h)||this.canRecoverWithSingleTokenDeletion(u)},l.prototype.canRecoverWithSingleTokenInsertion=function(u,h){var f=this;if(!this.canTokenTypeBeInsertedInRecovery(u)||t.isEmpty(h))return!1;var p=this.LA(1),g=t.find(h,function(m){return f.tokenMatcher(p,m)})!==void 0;return g},l.prototype.canRecoverWithSingleTokenDeletion=function(u){var h=this.tokenMatcher(this.LA(2),u);return h},l.prototype.isInCurrentRuleReSyncSet=function(u){var h=this.getCurrFollowKey(),f=this.getFollowSetFromFollowKey(h);return t.contains(f,u)},l.prototype.findReSyncTokenType=function(){for(var u=this.flattenFollowSet(),h=this.LA(1),f=2;;){var p=h.tokenType;if(t.contains(u,p))return p;h=this.LA(f),f++}},l.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return r.EOF_FOLLOW_KEY;var u=this.getLastExplicitRuleShortName(),h=this.getLastExplicitRuleOccurrenceIndex(),f=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(u),idxInCallingRule:h,inRule:this.shortRuleNameToFullName(f)}},l.prototype.buildFullFollowKeyStack=function(){var u=this,h=this.RULE_STACK,f=this.RULE_OCCURRENCE_STACK;return t.map(h,function(p,g){return g===0?r.EOF_FOLLOW_KEY:{ruleName:u.shortRuleNameToFullName(p),idxInCallingRule:f[g],inRule:u.shortRuleNameToFullName(h[g-1])}})},l.prototype.flattenFollowSet=function(){var u=this,h=t.map(this.buildFullFollowKeyStack(),function(f){return u.getFollowSetFromFollowKey(f)});return t.flatten(h)},l.prototype.getFollowSetFromFollowKey=function(u){if(u===r.EOF_FOLLOW_KEY)return[e.EOF];var h=u.ruleName+u.idxInCallingRule+i.IN+u.inRule;return this.resyncFollows[h]},l.prototype.addToResyncTokens=function(u,h){return this.tokenMatcher(u,e.EOF)||h.push(u),h},l.prototype.reSyncTo=function(u){for(var h=[],f=this.LA(1);this.tokenMatcher(f,u)===!1;)f=this.SKIP_TOKEN(),this.addToResyncTokens(f,h);return t.dropRight(h)},l.prototype.attemptInRepetitionRecovery=function(u,h,f,p,g,m,d){},l.prototype.getCurrentGrammarPath=function(u,h){var f=this.getHumanReadableRuleStack(),p=t.cloneArr(this.RULE_OCCURRENCE_STACK),g={ruleStack:f,occurrenceStack:p,lastTok:u,lastTokOccurrence:h};return g},l.prototype.getHumanReadableRuleStack=function(){var u=this;return t.map(this.RULE_STACK,function(h){return u.shortRuleNameToFullName(h)})},l}();r.Recoverable=a;function c(l,u,h,f,p,g,m){var d=this.getKeyForAutomaticLookahead(f,p),x=this.firstAfterRepMap[d];if(x===void 0){var _=this.getCurrRuleFullName(),v=this.getGAstProductions()[_],y=new g(v,p);x=y.startWalking(),this.firstAfterRepMap[d]=x}var w=x.token,L=x.occurrence,C=x.isEndOfRule;this.RULE_STACK.length===1&&C&&w===void 0&&(w=e.EOF,L=1),this.shouldInRepetitionRecoveryBeTried(w,L,m)&&this.tryInRepetitionRecovery(l,u,h,w)}r.attemptInRepetitionRecovery=c}),bp=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getKeyForAutomaticLookahead=r.AT_LEAST_ONE_SEP_IDX=r.MANY_SEP_IDX=r.AT_LEAST_ONE_IDX=r.MANY_IDX=r.OPTION_IDX=r.OR_IDX=r.BITS_FOR_ALT_IDX=r.BITS_FOR_RULE_IDX=r.BITS_FOR_OCCURRENCE_IDX=r.BITS_FOR_METHOD_TYPE=void 0,r.BITS_FOR_METHOD_TYPE=4,r.BITS_FOR_OCCURRENCE_IDX=8,r.BITS_FOR_RULE_IDX=12,r.BITS_FOR_ALT_IDX=8,r.OR_IDX=1<<r.BITS_FOR_OCCURRENCE_IDX,r.OPTION_IDX=2<<r.BITS_FOR_OCCURRENCE_IDX,r.MANY_IDX=3<<r.BITS_FOR_OCCURRENCE_IDX,r.AT_LEAST_ONE_IDX=4<<r.BITS_FOR_OCCURRENCE_IDX,r.MANY_SEP_IDX=5<<r.BITS_FOR_OCCURRENCE_IDX,r.AT_LEAST_ONE_SEP_IDX=6<<r.BITS_FOR_OCCURRENCE_IDX;function e(n,i,s){return s|i|n}r.getKeyForAutomaticLookahead=e;var t=32-r.BITS_FOR_ALT_IDX}),bw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.LooksAhead=void 0;var e=Dh(),t=Ot(),n=Ui(),i=bp(),s=Lh(),o=function(){function a(){}return a.prototype.initLooksAhead=function(c){this.dynamicTokensEnabled=t.has(c,"dynamicTokensEnabled")?c.dynamicTokensEnabled:n.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=t.has(c,"maxLookahead")?c.maxLookahead:n.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=t.isES2015MapSupported()?new Map:[],t.isES2015MapSupported()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},a.prototype.preComputeLookaheadFunctions=function(c){var l=this;t.forEach(c,function(u){l.TRACE_INIT(u.name+" Rule Lookahead",function(){var h=s.collectMethods(u),f=h.alternation,p=h.repetition,g=h.option,m=h.repetitionMandatory,d=h.repetitionMandatoryWithSeparator,x=h.repetitionWithSeparator;t.forEach(f,function(_){var v=_.idx===0?"":_.idx;l.TRACE_INIT(""+s.getProductionDslName(_)+v,function(){var y=e.buildLookaheadFuncForOr(_.idx,u,_.maxLookahead||l.maxLookahead,_.hasPredicates,l.dynamicTokensEnabled,l.lookAheadBuilderForAlternatives),w=i.getKeyForAutomaticLookahead(l.fullRuleNameToShort[u.name],i.OR_IDX,_.idx);l.setLaFuncCache(w,y)})}),t.forEach(p,function(_){l.computeLookaheadFunc(u,_.idx,i.MANY_IDX,e.PROD_TYPE.REPETITION,_.maxLookahead,s.getProductionDslName(_))}),t.forEach(g,function(_){l.computeLookaheadFunc(u,_.idx,i.OPTION_IDX,e.PROD_TYPE.OPTION,_.maxLookahead,s.getProductionDslName(_))}),t.forEach(m,function(_){l.computeLookaheadFunc(u,_.idx,i.AT_LEAST_ONE_IDX,e.PROD_TYPE.REPETITION_MANDATORY,_.maxLookahead,s.getProductionDslName(_))}),t.forEach(d,function(_){l.computeLookaheadFunc(u,_.idx,i.AT_LEAST_ONE_SEP_IDX,e.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,_.maxLookahead,s.getProductionDslName(_))}),t.forEach(x,function(_){l.computeLookaheadFunc(u,_.idx,i.MANY_SEP_IDX,e.PROD_TYPE.REPETITION_WITH_SEPARATOR,_.maxLookahead,s.getProductionDslName(_))})})})},a.prototype.computeLookaheadFunc=function(c,l,u,h,f,p){var g=this;this.TRACE_INIT(""+p+(l===0?"":l),function(){var m=e.buildLookaheadFuncForOptionalProd(l,c,f||g.maxLookahead,g.dynamicTokensEnabled,h,g.lookAheadBuilderForOptional),d=i.getKeyForAutomaticLookahead(g.fullRuleNameToShort[c.name],u,l);g.setLaFuncCache(d,m)})},a.prototype.lookAheadBuilderForOptional=function(c,l,u){return e.buildSingleAlternativeLookaheadFunction(c,l,u)},a.prototype.lookAheadBuilderForAlternatives=function(c,l,u,h){return e.buildAlternativesLookAheadFunc(c,l,u,h)},a.prototype.getKeyForAutomaticLookahead=function(c,l){var u=this.getLastExplicitRuleShortName();return i.getKeyForAutomaticLookahead(u,c,l)},a.prototype.getLaFuncFromCache=function(c){},a.prototype.getLaFuncFromMap=function(c){return this.lookAheadFuncsCache.get(c)},a.prototype.getLaFuncFromObj=function(c){return this.lookAheadFuncsCache[c]},a.prototype.setLaFuncCache=function(c,l){},a.prototype.setLaFuncCacheUsingMap=function(c,l){this.lookAheadFuncsCache.set(c,l)},a.prototype.setLaFuncUsingObj=function(c,l){this.lookAheadFuncsCache[c]=l},a}();r.LooksAhead=o}),Tw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.addNoneTerminalToCst=r.addTerminalToCst=r.setNodeLocationFull=r.setNodeLocationOnlyOffset=void 0;function e(s,o){isNaN(s.startOffset)===!0?(s.startOffset=o.startOffset,s.endOffset=o.endOffset):s.endOffset<o.endOffset&&(s.endOffset=o.endOffset)}r.setNodeLocationOnlyOffset=e;function t(s,o){isNaN(s.startOffset)===!0?(s.startOffset=o.startOffset,s.startColumn=o.startColumn,s.startLine=o.startLine,s.endOffset=o.endOffset,s.endColumn=o.endColumn,s.endLine=o.endLine):s.endOffset<o.endOffset&&(s.endOffset=o.endOffset,s.endColumn=o.endColumn,s.endLine=o.endLine)}r.setNodeLocationFull=t;function n(s,o,a){s.children[a]===void 0?s.children[a]=[o]:s.children[a].push(o)}r.addTerminalToCst=n;function i(s,o,a){s.children[o]===void 0?s.children[o]=[a]:s.children[o].push(a)}r.addNoneTerminalToCst=i}),xx=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.defineNameProp=r.functionName=r.classNameFromInstance=void 0;var e=Ot();function t(o){return i(o.constructor)}r.classNameFromInstance=t;var n="name";function i(o){var a=o.name;return a||"anonymous"}r.functionName=i;function s(o,a){var c=Object.getOwnPropertyDescriptor(o,n);return e.isUndefined(c)||c.configurable?(Object.defineProperty(o,n,{enumerable:!1,configurable:!0,writable:!1,value:a}),!0):!1}r.defineNameProp=s}),Mw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateRedundantMethods=r.validateMissingCstMethods=r.validateVisitor=r.CstVisitorDefinitionError=r.createBaseVisitorConstructorWithDefaults=r.createBaseSemanticVisitorConstructor=r.defaultVisit=void 0;var e=Ot(),t=xx();function n(h,f){for(var p=e.keys(h),g=p.length,m=0;m<g;m++)for(var d=p[m],x=h[d],_=x.length,v=0;v<_;v++){var y=x[v];y.tokenTypeIdx===void 0&&this[y.name](y.children,f)}}r.defaultVisit=n;function i(h,f){var p=function(){};t.defineNameProp(p,h+"BaseSemantics");var g={visit:function(m,d){if(e.isArray(m)&&(m=m[0]),!e.isUndefined(m))return this[m.name](m.children,d)},validateVisitor:function(){var m=a(this,f);if(!e.isEmpty(m)){var d=e.map(m,function(x){return x.msg});throw Error("Errors Detected in CST Visitor <"+t.functionName(this.constructor)+`>:
3229	`+(""+d.join(`
3230
3231`).replace(/\n/g,`
3232	`)))}}};return p.prototype=g,p.prototype.constructor=p,p._RULE_NAMES=f,p}r.createBaseSemanticVisitorConstructor=i;function s(h,f,p){var g=function(){};t.defineNameProp(g,h+"BaseSemanticsWithDefaults");var m=Object.create(p.prototype);return e.forEach(f,function(d){m[d]=n}),g.prototype=m,g.prototype.constructor=g,g}r.createBaseVisitorConstructorWithDefaults=s;var o;(function(h){h[h.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",h[h.MISSING_METHOD=1]="MISSING_METHOD"})(o=r.CstVisitorDefinitionError||(r.CstVisitorDefinitionError={}));function a(h,f){var p=c(h,f),g=u(h,f);return p.concat(g)}r.validateVisitor=a;function c(h,f){var p=e.map(f,function(g){if(!e.isFunction(h[g]))return{msg:"Missing visitor method: <"+g+"> on "+t.functionName(h.constructor)+" CST Visitor.",type:o.MISSING_METHOD,methodName:g}});return e.compact(p)}r.validateMissingCstMethods=c;var l=["constructor","visit","validateVisitor"];function u(h,f){var p=[];for(var g in h)e.isFunction(h[g])&&!e.contains(l,g)&&!e.contains(f,g)&&p.push({msg:"Redundant visitor method: <"+g+"> on "+t.functionName(h.constructor)+` CST Visitor
3233There is no Grammar Rule corresponding to this method's name.
3234`,type:o.REDUNDANT_METHOD,methodName:g});return p}r.validateRedundantMethods=u}),ww=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TreeBuilder=void 0;var e=Tw(),t=Ot(),n=Mw(),i=Ui(),s=function(){function o(){}return o.prototype.initTreeBuilder=function(a){if(this.CST_STACK=[],this.outputCst=a.outputCst,this.nodeLocationTracking=t.has(a,"nodeLocationTracking")?a.nodeLocationTracking:i.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=t.NOOP,this.cstFinallyStateUpdate=t.NOOP,this.cstPostTerminal=t.NOOP,this.cstPostNonTerminal=t.NOOP,this.cstPostRule=t.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationFull,this.setNodeLocationFromNode=e.setNodeLocationFull,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=e.setNodeLocationOnlyOffset,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=t.NOOP;else throw Error('Invalid <nodeLocationTracking> config option: "'+a.nodeLocationTracking+'"')},o.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(a){a.location={startOffset:NaN,endOffset:NaN}},o.prototype.setInitialNodeLocationOnlyOffsetRegular=function(a){a.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},o.prototype.setInitialNodeLocationFullRecovery=function(a){a.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},o.prototype.setInitialNodeLocationFullRegular=function(a){var c=this.LA(1);a.location={startOffset:c.startOffset,startLine:c.startLine,startColumn:c.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},o.prototype.cstInvocationStateUpdate=function(a,c){var l={name:a,children:{}};this.setInitialNodeLocation(l),this.CST_STACK.push(l)},o.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},o.prototype.cstPostRuleFull=function(a){var c=this.LA(0),l=a.location;l.startOffset<=c.startOffset?(l.endOffset=c.endOffset,l.endLine=c.endLine,l.endColumn=c.endColumn):(l.startOffset=NaN,l.startLine=NaN,l.startColumn=NaN)},o.prototype.cstPostRuleOnlyOffset=function(a){var c=this.LA(0),l=a.location;l.startOffset<=c.startOffset?l.endOffset=c.endOffset:l.startOffset=NaN},o.prototype.cstPostTerminal=function(a,c){var l=this.CST_STACK[this.CST_STACK.length-1];e.addTerminalToCst(l,c,a),this.setNodeLocationFromToken(l.location,c)},o.prototype.cstPostNonTerminal=function(a,c){var l=this.CST_STACK[this.CST_STACK.length-1];e.addNoneTerminalToCst(l,c,a),this.setNodeLocationFromNode(l.location,a.location)},o.prototype.getBaseCstVisitorConstructor=function(){if(t.isUndefined(this.baseCstVisitorConstructor)){var a=n.createBaseSemanticVisitorConstructor(this.className,t.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=a,a}return this.baseCstVisitorConstructor},o.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(t.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var a=n.createBaseVisitorConstructorWithDefaults(this.className,t.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=a,a}return this.baseCstVisitorWithDefaultsConstructor},o.prototype.getLastExplicitRuleShortName=function(){var a=this.RULE_STACK;return a[a.length-1]},o.prototype.getPreviousExplicitRuleShortName=function(){var a=this.RULE_STACK;return a[a.length-2]},o.prototype.getLastExplicitRuleOccurrenceIndex=function(){var a=this.RULE_OCCURRENCE_STACK;return a[a.length-1]},o}();r.TreeBuilder=s}),Sw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.LexerAdapter=void 0;var e=Ui(),t=function(){function n(){}return n.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(n.prototype,"input",{get:function(){return this.tokVector},set:function(i){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=i,this.tokVectorLength=i.length},enumerable:!1,configurable:!0}),n.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):e.END_OF_FILE},n.prototype.LA=function(i){var s=this.currIdx+i;return s<0||this.tokVectorLength<=s?e.END_OF_FILE:this.tokVector[s]},n.prototype.consumeToken=function(){this.currIdx++},n.prototype.exportLexerState=function(){return this.currIdx},n.prototype.importLexerState=function(i){this.currIdx=i},n.prototype.resetLexerState=function(){this.currIdx=-1},n.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},n.prototype.getLexerPosition=function(){return this.exportLexerState()},n}();r.LexerAdapter=t}),Ew=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RecognizerApi=void 0;var e=Ot(),t=xc(),n=Ui(),i=Nh(),s=mx(),o=_i(),a=function(){function c(){}return c.prototype.ACTION=function(l){return l.call(this)},c.prototype.consume=function(l,u,h){return this.consumeInternal(u,l,h)},c.prototype.subrule=function(l,u,h){return this.subruleInternal(u,l,h)},c.prototype.option=function(l,u){return this.optionInternal(u,l)},c.prototype.or=function(l,u){return this.orInternal(u,l)},c.prototype.many=function(l,u){return this.manyInternal(l,u)},c.prototype.atLeastOne=function(l,u){return this.atLeastOneInternal(l,u)},c.prototype.CONSUME=function(l,u){return this.consumeInternal(l,0,u)},c.prototype.CONSUME1=function(l,u){return this.consumeInternal(l,1,u)},c.prototype.CONSUME2=function(l,u){return this.consumeInternal(l,2,u)},c.prototype.CONSUME3=function(l,u){return this.consumeInternal(l,3,u)},c.prototype.CONSUME4=function(l,u){return this.consumeInternal(l,4,u)},c.prototype.CONSUME5=function(l,u){return this.consumeInternal(l,5,u)},c.prototype.CONSUME6=function(l,u){return this.consumeInternal(l,6,u)},c.prototype.CONSUME7=function(l,u){return this.consumeInternal(l,7,u)},c.prototype.CONSUME8=function(l,u){return this.consumeInternal(l,8,u)},c.prototype.CONSUME9=function(l,u){return this.consumeInternal(l,9,u)},c.prototype.SUBRULE=function(l,u){return this.subruleInternal(l,0,u)},c.prototype.SUBRULE1=function(l,u){return this.subruleInternal(l,1,u)},c.prototype.SUBRULE2=function(l,u){return this.subruleInternal(l,2,u)},c.prototype.SUBRULE3=function(l,u){return this.subruleInternal(l,3,u)},c.prototype.SUBRULE4=function(l,u){return this.subruleInternal(l,4,u)},c.prototype.SUBRULE5=function(l,u){return this.subruleInternal(l,5,u)},c.prototype.SUBRULE6=function(l,u){return this.subruleInternal(l,6,u)},c.prototype.SUBRULE7=function(l,u){return this.subruleInternal(l,7,u)},c.prototype.SUBRULE8=function(l,u){return this.subruleInternal(l,8,u)},c.prototype.SUBRULE9=function(l,u){return this.subruleInternal(l,9,u)},c.prototype.OPTION=function(l){return this.optionInternal(l,0)},c.prototype.OPTION1=function(l){return this.optionInternal(l,1)},c.prototype.OPTION2=function(l){return this.optionInternal(l,2)},c.prototype.OPTION3=function(l){return this.optionInternal(l,3)},c.prototype.OPTION4=function(l){return this.optionInternal(l,4)},c.prototype.OPTION5=function(l){return this.optionInternal(l,5)},c.prototype.OPTION6=function(l){return this.optionInternal(l,6)},c.prototype.OPTION7=function(l){return this.optionInternal(l,7)},c.prototype.OPTION8=function(l){return this.optionInternal(l,8)},c.prototype.OPTION9=function(l){return this.optionInternal(l,9)},c.prototype.OR=function(l){return this.orInternal(l,0)},c.prototype.OR1=function(l){return this.orInternal(l,1)},c.prototype.OR2=function(l){return this.orInternal(l,2)},c.prototype.OR3=function(l){return this.orInternal(l,3)},c.prototype.OR4=function(l){return this.orInternal(l,4)},c.prototype.OR5=function(l){return this.orInternal(l,5)},c.prototype.OR6=function(l){return this.orInternal(l,6)},c.prototype.OR7=function(l){return this.orInternal(l,7)},c.prototype.OR8=function(l){return this.orInternal(l,8)},c.prototype.OR9=function(l){return this.orInternal(l,9)},c.prototype.MANY=function(l){this.manyInternal(0,l)},c.prototype.MANY1=function(l){this.manyInternal(1,l)},c.prototype.MANY2=function(l){this.manyInternal(2,l)},c.prototype.MANY3=function(l){this.manyInternal(3,l)}
3234,c.prototype.MANY4=function(l){this.manyInternal(4,l)},c.prototype.MANY5=function(l){this.manyInternal(5,l)},c.prototype.MANY6=function(l){this.manyInternal(6,l)},c.prototype.MANY7=function(l){this.manyInternal(7,l)},c.prototype.MANY8=function(l){this.manyInternal(8,l)},c.prototype.MANY9=function(l){this.manyInternal(9,l)},c.prototype.MANY_SEP=function(l){this.manySepFirstInternal(0,l)},c.prototype.MANY_SEP1=function(l){this.manySepFirstInternal(1,l)},c.prototype.MANY_SEP2=function(l){this.manySepFirstInternal(2,l)},c.prototype.MANY_SEP3=function(l){this.manySepFirstInternal(3,l)},c.prototype.MANY_SEP4=function(l){this.manySepFirstInternal(4,l)},c.prototype.MANY_SEP5=function(l){this.manySepFirstInternal(5,l)},c.prototype.MANY_SEP6=function(l){this.manySepFirstInternal(6,l)},c.prototype.MANY_SEP7=function(l){this.manySepFirstInternal(7,l)},c.prototype.MANY_SEP8=function(l){this.manySepFirstInternal(8,l)},c.prototype.MANY_SEP9=function(l){this.manySepFirstInternal(9,l)},c.prototype.AT_LEAST_ONE=function(l){this.atLeastOneInternal(0,l)},c.prototype.AT_LEAST_ONE1=function(l){return this.atLeastOneInternal(1,l)},c.prototype.AT_LEAST_ONE2=function(l){this.atLeastOneInternal(2,l)},c.prototype.AT_LEAST_ONE3=function(l){this.atLeastOneInternal(3,l)},c.prototype.AT_LEAST_ONE4=function(l){this.atLeastOneInternal(4,l)},c.prototype.AT_LEAST_ONE5=function(l){this.atLeastOneInternal(5,l)},c.prototype.AT_LEAST_ONE6=function(l){this.atLeastOneInternal(6,l)},c.prototype.AT_LEAST_ONE7=function(l){this.atLeastOneInternal(7,l)},c.prototype.AT_LEAST_ONE8=function(l){this.atLeastOneInternal(8,l)},c.prototype.AT_LEAST_ONE9=function(l){this.atLeastOneInternal(9,l)},c.prototype.AT_LEAST_ONE_SEP=function(l){this.atLeastOneSepFirstInternal(0,l)},c.prototype.AT_LEAST_ONE_SEP1=function(l){this.atLeastOneSepFirstInternal(1,l)},c.prototype.AT_LEAST_ONE_SEP2=function(l){this.atLeastOneSepFirstInternal(2,l)},c.prototype.AT_LEAST_ONE_SEP3=function(l){this.atLeastOneSepFirstInternal(3,l)},c.prototype.AT_LEAST_ONE_SEP4=function(l){this.atLeastOneSepFirstInternal(4,l)},c.prototype.AT_LEAST_ONE_SEP5=function(l){this.atLeastOneSepFirstInternal(5,l)},c.prototype.AT_LEAST_ONE_SEP6=function(l){this.atLeastOneSepFirstInternal(6,l)},c.prototype.AT_LEAST_ONE_SEP7=function(l){this.atLeastOneSepFirstInternal(7,l)},c.prototype.AT_LEAST_ONE_SEP8=function(l){this.atLeastOneSepFirstInternal(8,l)},c.prototype.AT_LEAST_ONE_SEP9=function(l){this.atLeastOneSepFirstInternal(9,l)},c.prototype.RULE=function(l,u,h){if(h===void 0&&(h=n.DEFAULT_RULE_CONFIG),e.contains(this.definedRulesNames,l)){var f=i.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:l,grammarName:this.className}),p={message:f,type:n.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:l};this.definitionErrors.push(p)}this.definedRulesNames.push(l);var g=this.defineRule(l,u,h);return this[l]=g,g},c.prototype.OVERRIDE_RULE=function(l,u,h){h===void 0&&(h=n.DEFAULT_RULE_CONFIG);var f=[];
vendor: 16,466 bytes, lines 3234-3245
3234f=f.concat(s.validateRuleIsOverridden(l,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(f);var p=this.defineRule(l,u,h);return this[l]=p,p},c.prototype.BACKTRACK=function(l,u){return function(){this.isBackTrackingStack.push(1);var h=this.saveRecogState();try{return l.apply(this,u),!0}catch(f){if(t.isRecognitionException(f))return!1;throw f}finally{this.reloadRecogState(h),this.isBackTrackingStack.pop()}}},c.prototype.getGAstProductions=function(){return this.gastProductionsCache},c.prototype.getSerializedGastProductions=function(){return o.serializeGrammar(e.values(this.gastProductionsCache))},c}();r.RecognizerApi=a}),Aw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RecognizerEngine=void 0;var e=Ot(),t=bp(),n=xc(),i=Dh(),s=Oh(),o=Ui(),a=gx(),c=po(),l=mc(),u=xx(),h=function(){function f(){}return f.prototype.initRecognizerEngine=function(p,g){if(this.className=u.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=l.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},e.has(g,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
3235	See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
3236	For Further details.`);if(e.isArray(p)){if(e.isEmpty(p))throw Error(`A Token Vocabulary cannot be empty.
3237	Note that the first argument for the parser constructor
3238	is no longer a Token vector (since v4.0).`);if(typeof p[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
3239	See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
3240	For Further details.`)}if(e.isArray(p))this.tokensMap=e.reduce(p,function(_,v){return _[v.name]=v,_},{});else if(e.has(p,"modes")&&e.every(e.flatten(e.values(p.modes)),l.isTokenType)){var m=e.flatten(e.values(p.modes)),d=e.uniq(m);this.tokensMap=e.reduce(d,function(_,v){return _[v.name]=v,_},{})}else if(e.isObject(p))this.tokensMap=e.cloneObj(p);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=c.EOF;var x=e.every(e.values(p),function(_){return e.isEmpty(_.categoryMatches)});this.tokenMatcher=x?l.tokenStructuredMatcherNoCategories:l.tokenStructuredMatcher,l.augmentTokenTypes(e.values(this.tokensMap))},f.prototype.defineRule=function(p,g,m){if(this.selfAnalysisDone)throw Error("Grammar rule <"+p+`> may not be defined after the 'performSelfAnalysis' method has been called'
3241Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var d=e.has(m,"resyncEnabled")?m.resyncEnabled:o.DEFAULT_RULE_CONFIG.resyncEnabled,x=e.has(m,"recoveryValueFunc")?m.recoveryValueFunc:o.DEFAULT_RULE_CONFIG.recoveryValueFunc,_=this.ruleShortNameIdx<<t.BITS_FOR_METHOD_TYPE+t.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[_]=p,this.fullRuleNameToShort[p]=_;function v(L){try{if(this.outputCst===!0){g.apply(this,L);var C=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(C),C}else return g.apply(this,L)}catch(b){return this.invokeRuleCatch(b,d,x)}finally{this.ruleFinallyStateUpdate()}}var y=function(L,C){return L===void 0&&(L=0),this.ruleInvocationStateUpdate(_,p,L),v.call(this,C)},w="ruleName";return y[w]=p,y.originalGrammarAction=g,y},f.prototype.invokeRuleCatch=function(p,g,m){var d=this.RULE_STACK.length===1,x=g&&!this.isBackTracking()&&this.recoveryEnabled;if(n.isRecognitionException(p)){var _=p;if(x){var v=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(v))if(_.resyncedTokens=this.reSyncTo(v),this.outputCst){var y=this.CST_STACK[this.CST_STACK.length-1];return y.recoveredNode=!0,y}else return m();else{if(this.outputCst){var y=this.CST_STACK[this.CST_STACK.length-1];y.recoveredNode=!0,_.partialCstResult=y}throw _}}else{if(d)return this.moveToTerminatedState(),m();throw _}}else throw p},f.prototype.optionInternal=function(p,g){var m=this.getKeyForAutomaticLookahead(t.OPTION_IDX,g);return this.optionInternalLogic(p,g,m)},f.prototype.optionInternalLogic=function(p,g,m){var d=this,x=this.getLaFuncFromCache(m),_,v;if(p.DEF!==void 0){if(_=p.DEF,v=p.GATE,v!==void 0){var y=x;x=function(){return v.call(d)&&y.call(d)}}}else _=p;if(x.call(this)===!0)return _.call(this)},f.prototype.atLeastOneInternal=function(p,g){var m=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_IDX,p);return this.atLeastOneInternalLogic(p,g,m)},f.prototype.atLeastOneInternalLogic=function(p,g,m){var d=this,x=this.getLaFuncFromCache(m),_,v;if(g.DEF!==void 0){if(_=g.DEF,v=g.GATE,v!==void 0){var y=x;x=function(){return v.call(d)&&y.call(d)}}}else _=g;if(x.call(this)===!0)for(var w=this.doSingleRepetition(_);x.call(this)===!0&&w===!0;)w=this.doSingleRepetition(_);else throw this.raiseEarlyExitException(p,i.PROD_TYPE.REPETITION_MANDATORY,g.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[p,g],x,t.AT_LEAST_ONE_IDX,p,s.NextTerminalAfterAtLeastOneWalker)},f.prototype.atLeastOneSepFirstInternal=function(p,g){var m=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_SEP_IDX,p);this.atLeastOneSepFirstInternalLogic(p,g,m)},f.prototype.atLeastOneSepFirstInternalLogic=function(p,g,m){var d=this,x=g.DEF,_=g.SEP,v=this.getLaFuncFromCache(m);if(v.call(this)===!0){x.call(this);for(var y=function(){return d.tokenMatcher(d.LA(1),_)};this.tokenMatcher(this.LA(1),_)===!0;)this.CONSUME(_),x.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,_,y,x,s.NextTerminalAfterAtLeastOneSepWalker],y,t.AT_LEAST_ONE_SEP_IDX,p,s.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(p,i.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,g.ERR_MSG)},f.prototype.manyInternal=function(p,g){var m=this.getKeyForAutomaticLookahead(t.MANY_IDX,p);return this.manyInternalLogic(p,g,m)},f.prototype.manyInternalLogic=function(p,g,m){var d=this,x=this.getLaFuncFromCache(m),_,v;if(g.DEF!==void 0){if(_=g.DEF,v=g.GATE,v!==void 0){var y=x;x=function(){return v.call(d)&&y.call(d)}}}else _=g;for(var w=!0;x.call(this)===!0&&w===!0;)w=this.doSingleRepetition(_);this.attemptInRepetitionRecovery(this.manyInternal,[p,g],x,t.MANY_IDX,p,s.NextTerminalAfterManyWalker,w)},f.prototype.manySepFirstInternal=function(p,g){var m=this.getKeyForAutomaticLookahead(t.MANY_SEP_IDX,p);this.manySepFirstInternalLogic(p,g,m)},f.prototype.manySepFirstInternalLogic=function(p,g,m){var d=this,x=g.DEF,_=g.SEP,v=this.getLaFuncFromCache(m);if(v.call(this)===!0){x.call(this);for(var y=function(){return d.tokenMatcher(d.LA(1),_)};this.tokenMatcher(this.LA(1),_)===!0;)this.CONSUME(_),x.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,_,y,x,s.NextTerminalAfterManySepWalker],y,t.MANY_SEP_IDX,p,s.NextTerminalAfterManySepWalker)}},f.prototype.repetitionSepSecondInternal=function(p,g,m,d,x){for(;m();)this.CONSUME(g),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[p,g,m,d,x],m,t.AT_LEAST_ONE_SEP_IDX,p,x)},f.prototype.doSingleRepetition=function(p){var g=this.getLexerPosition();p.call(this);var m=this.getLexerPosition();return m>g},f.prototype.orInternal=function(p,g){var m=this.getKeyForAutomaticLookahead(t.OR_IDX,g),d=e.isArray(p)?p:p.DEF,x=this.getLaFuncFromCache(m),_=x.call(this,d);if(_!==void 0){var v=d[_];return v.ALT.call(this)}this.raiseNoAltException(g,p.ERR_MSG)},f.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var p=this.LA(1),g=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:p,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new n.NotAllInputParsedException(g,p))}},f.prototype.subruleInternal=function(p,g,m){var d;try{var x=m!==void 0?m.ARGS:void 0;return d=p.call(this,g,x),this.cstPostNonTerminal(d,m!==void 0&&m.LABEL!==void 0?m.LABEL:p.ruleName),d}catch(_){this.subruleInternalError(_,m,p.ruleName)}},f.prototype.subruleInternalError=function(p,g,m){throw n.isRecognitionException(p)&&p.partialCstResult!==void 0&&(this.cstPostNonTerminal(p.partialCstResult,g!==void 0&&g.LABEL!==void 0?g.LABEL:m),delete p.partialCstResult),p},f.prototype.consumeInternal=function(p,g,m){var d;try{var x=this.LA(1);this.tokenMatcher(x,p)===!0?(this.consumeToken(),d=x):this.consumeInternalError(p,x,m)}catch(_){d=this.consumeInternalRecovery(p,g,_)}return this.cstPostTerminal(m!==void 0&&m.LABEL!==void 0?m.LABEL:p.name,d),d},f.prototype.consumeInternalError=function(p,g,m){var d,x=this.LA(0);throw m!==void 0&&m.ERR_MSG?d=m.ERR_MSG:d=this.errorMessageProvider.buildMismatchTokenMessage({expected:p,actual:g,previous:x,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new n.MismatchedTokenException(d,g,x))},f.prototype.consumeInternalRecovery=function(p,g,m){if(this.recoveryEnabled&&m.name==="MismatchedTokenException"&&!this.isBackTracking()){var d=this.getFollowsForInRuleRecovery(p,g);try{return this.tryInRuleRecovery(p,d)}catch(x){throw x.name===a.IN_RULE_RECOVERY_EXCEPTION?m:x}}else throw m},f.prototype.saveRecogState=function(){var p=this.errors,g=e.cloneArr(this.RULE_STACK);return{errors:p,lexerState:this.exportLexerState(),RULE_STACK:g,CST_STACK:this.CST_STACK}},f.prototype.reloadRecogState=function(p){this.errors=p.errors,this.importLexerState(p.lexerState),this.RULE_STACK=p.RULE_STACK},f.prototype.ruleInvocationStateUpdate=function(p,g,m){this.RULE_OCCURRENCE_STACK.push(m),this.RULE_STACK.push(p),this.cstInvocationStateUpdate(g,p)},f.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},f.prototype.getCurrRuleFullName=function(){var p=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[p]},f.prototype.shortRuleNameToFullName=function(p){return this.shortRuleNameToFull[p]},f.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),c.EOF)},f.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},f}();r.RecognizerEngine=h}),Cw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ErrorHandler=void 0;var e=xc(),t=Ot(),n=Dh(),i=Ui(),s=function(){function o(){}return o.prototype.initErrorHandler=function(a){this._errors=[],this.errorMessageProvider=t.has(a,"errorMessageProvider")?a.errorMessageProvider:i.DEFAULT_PARSER_CONFIG.errorMessageProvider},o.prototype.SAVE_ERROR=function(a){if(e.isRecognitionException(a))return a.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:t.cloneArr(this.RULE_OCCURRENCE_STACK)},this._errors.push(a),a;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(o.prototype,"errors",{get:function(){return t.cloneArr(this._errors)},set:function(a){this._errors=a},enumerable:!1,configurable:!0}),o.prototype.raiseEarlyExitException=function(a,c,l){for(var u=this.getCurrRuleFullName(),h=this.getGAstProductions()[u],f=n.getLookaheadPathsForOptionalProd(a,h,c,this.maxLookahead),p=f[0],g=[],m=1;m<=this.maxLookahead;m++)g.push(this.LA(m));var d=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:p,actual:g,previous:this.LA(0),customUserDescription:l,ruleName:u});throw this.SAVE_ERROR(new e.EarlyExitException(d,this.LA(1),this.LA(0)))},o.prototype.raiseNoAltException=function(a,c){for(var l=this.getCurrRuleFullName(),u=this.getGAstProductions()[l],h=n.getLookaheadPathsForOr(a,u,this.maxLookahead),f=[],p=1;p<=this.maxLookahead;p++)f.push(this.LA(p));var g=this.LA(0),m=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:h,actual:f,previous:g,customUserDescription:c,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new e.NoViableAltException(m,this.LA(1),g))},o}();r.ErrorHandler=s}),Iw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ContentAssist=void 0;var e=Oh(),t=Ot(),n=function(){function i(){}return i.prototype.initContentAssist=function(){},i.prototype.computeContentAssist=function(s,o){var a=this.gastProductionsCache[s];if(t.isUndefined(a))throw Error("Rule ->"+s+"<- does not exist in this grammar.");return e.nextPossibleTokensAfter([a],o,this.tokenMatcher,this.maxLookahead)},i.prototype.getNextPossibleTokenTypes=function(s){var o=t.first(s.ruleStack),a=this.getGAstProductions(),c=a[o],l=new e.NextAfterTokenWalker(c,s).startWalking();return l},i}();r.ContentAssist=n}),Rw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.GastRecorder=void 0;var e=Ot(),t=_i(),n=Ph(),i=mc(),s=po(),o=Ui(),a=bp(),c={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(c);var l=!0,u=Math.pow(2,a.BITS_FOR_OCCURRENCE_IDX)-1,h=s.createToken({name:"RECORDING_PHASE_TOKEN",pattern:n.Lexer.NA});i.augmentTokenTypes([h]);var f=s.createTokenInstance(h,`This IToken indicates the Parser is in Recording Phase
3242	See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(f);var p={name:`This CSTNode indicates the Parser is in Recording Phase
3243	See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},g=function(){function v(){}return v.prototype.initGastRecorder=function(y){this.recordingProdStack=[],this.RECORDING_PHASE=!1},v.prototype.enableRecording=function(){var y=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var w=function(C){var b=C>0?C:"";y["CONSUME"+b]=function(A,N){return this.consumeInternalRecord(A,C,N)},y["SUBRULE"+b]=function(A,N){return this.subruleInternalRecord(A,C,N)},y["OPTION"+b]=function(A){return this.optionInternalRecord(A,C)},y["OR"+b]=function(A){return this.orInternalRecord(A,C)},y["MANY"+b]=function(A){this.manyInternalRecord(C,A)},y["MANY_SEP"+b]=function(A){this.manySepFirstInternalRecord(C,A)},y["AT_LEAST_ONE"+b]=function(A){this.atLeastOneInternalRecord(C,A)},y["AT_LEAST_ONE_SEP"+b]=function(A){this.atLeastOneSepFirstInternalRecord(C,A)}},L=0;L<10;L++)w(L);y.consume=function(C,b,A){return this.consumeInternalRecord(b,C,A)},y.subrule=function(C,b,A){return this.subruleInternalRecord(b,C,A)},y.option=function(C,b){return this.optionInternalRecord(b,C)},y.or=function(C,b){return this.orInternalRecord(b,C)},y.many=function(C,b){this.manyInternalRecord(C,b)},y.atLeastOne=function(C,b){this.atLeastOneInternalRecord(C,b)},y.ACTION=y.ACTION_RECORD,y.BACKTRACK=y.BACKTRACK_RECORD,y.LA=y.LA_RECORD})},v.prototype.disableRecording=function(){var y=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var w=0;w<10;w++){var L=w>0?w:"";delete y["CONSUME"+L],delete y["SUBRULE"+L],delete y["OPTION"+L],delete y["OR"+L],delete y["MANY"+L],delete y["MANY_SEP"+L],delete y["AT_LEAST_ONE"+L],delete y["AT_LEAST_ONE_SEP"+L]}delete y.consume,delete y.subrule,delete y.option,delete y.or,delete y.many,delete y.atLeastOne,delete y.ACTION,delete y.BACKTRACK,delete y.LA})},v.prototype.ACTION_RECORD=function(y){},v.prototype.BACKTRACK_RECORD=function(y,w){return function(){return!0}},v.prototype.LA_RECORD=function(y){return o.END_OF_FILE},v.prototype.topLevelRuleRecord=function(y,w){try{var L=new t.Rule({definition:[],name:y});return L.name=y,this.recordingProdStack.push(L),w.call(this),this.recordingProdStack.pop(),L}catch(C){if(C.KNOWN_RECORDER_ERROR!==!0)try{C.message=C.message+`
3244	 This error was thrown during the "grammar recording phase" For more info see:
3245	https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw C}throw C}},v.prototype.optionInternalRecord=function(y,w){return m.call(this,t.Option,y,w)},v.prototype.atLeastOneInternalRecord=function(y,w){m.call(this,t.RepetitionMandatory,w,y)},v.prototype.atLeastOneSepFirstInternalRecord=function(y,w){m.call(this,t.RepetitionMandatoryWithSeparator,w,y,l)},v.prototype.manyInternalRecord=function(y,w){m.call(this,t.Repetition,w,y)},v.prototype.manySepFirstInternalRecord=function(y,w){m.call(this,t.RepetitionWithSeparator,w,y,l)},v.prototype.orInternalRecord=function(y,w){return d.call(this,y,w)},v.prototype.subruleInternalRecord=function(y,w,L){if(_(w),!y||e.has(y,"ruleName")===!1){var C=new Error("<SUBRULE"+x(w)+">
3245 argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(y)+">")+(`
3246 inside top level rule: <`+this.recordingProdStack[0].name+">"));throw C.KNOWN_RECORDER_ERROR=!0,C}var b=e.peek(this.recordingProdStack),A=y.ruleName,N=new t.NonTerminal({idx:w,nonTerminalName:A,referencedRule:void 0});return b.definition.push(N),this.outputCst?p:c},v.prototype.consumeInternalRecord=function(y,w,L){if(_(w),!i.hasShortKeyProperty(y)){var C=new Error("<CONSUME"+x(w)+"> argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(y)+">")+(`
3247 inside top level rule: <`+this.recordingProdStack[0].name+">"));throw C.KNOWN_RECORDER_ERROR=!0,C}var b=e.peek(this.recordingProdStack),A=new t.Terminal({idx:w,terminalType:y});return b.definition.push(A),f},v}();r.GastRecorder=g;function m(v,y,w,L){L===void 0&&(L=!1),_(w);var C=e.peek(this.recordingProdStack),b=e.isFunction(y)?y:y.DEF,A=new v({definition:[],idx:w});return L&&(A.separator=y.SEP),e.has(y,"MAX_LOOKAHEAD")&&(A.maxLookahead=y.MAX_LOOKAHEAD),this.recordingProdStack.push(A),b.call(this),C.definition.push(A),this.recordingProdStack.pop(),c}function d(v,y){var w=this;_(y);var L=e.peek(this.recordingProdStack),C=e.isArray(v)===!1,b=C===!1?v:v.DEF,A=new t.Alternation({definition:[],idx:y,ignoreAmbiguities:C&&v.IGNORE_AMBIGUITIES===!0});e.has(v,"MAX_LOOKAHEAD")&&(A.maxLookahead=v.MAX_LOOKAHEAD);var N=e.some(b,function(G){return e.isFunction(G.GATE)});return A.hasPredicates=N,L.definition.push(A),e.forEach(b,function(G){var F=new t.Alternative({definition:[]});A.definition.push(F),e.has(G,"IGNORE_AMBIGUITIES")?F.ignoreAmbiguities=G.IGNORE_AMBIGUITIES:e.has(G,"GATE")&&(F.ignoreAmbiguities=!0),w.recordingProdStack.push(F),G.ALT.call(w),w.recordingProdStack.pop()}),c}function x(v){return v===0?"":""+v}function _(v){if(v<0||v>u){var y=new Error("Invalid DSL Method idx value: <"+v+`>
3248	`+("Idx value must be a none negative value smaller than "+(u+1)));throw y.KNOWN_RECORDER_ERROR=!0,y}}}),Pw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.PerformanceTracer=void 0;var e=Ot(),t=Ui(),n=function(){function i(){}return i.prototype.initPerformanceTracer=function(s){if(e.has(s,"traceInitPerf")){var o=s.traceInitPerf,a=typeof o=="number";this.traceInitMaxIdent=a?o:1/0,this.traceInitPerf=a?o>0:o}else this.traceInitMaxIdent=0,this.traceInitPerf=t.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},i.prototype.TRACE_INIT=function(s,o){if(this.traceInitPerf===!0){this.traceInitIndent++;var a=new Array(this.traceInitIndent+1).join("	");this.traceInitIndent<this.traceInitMaxIdent&&console.log(a+"--> <"+s+">");var c=e.timer(o),l=c.time,u=c.value,h=l>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&h(a+"<-- <"+s+"> time: "+l+"ms"),this.traceInitIndent--,u}else return o()},i}();r.PerformanceTracer=n}),Lw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.applyMixins=void 0;function e(t,n){n.forEach(function(i){var s=i.prototype;Object.getOwnPropertyNames(s).forEach(function(o){if(o!=="constructor"){var a=Object.getOwnPropertyDescriptor(s,o);a&&(a.get||a.set)?Object.defineProperty(t.prototype,o,a):t.prototype[o]=i.prototype[o]}})})}r.applyMixins=e}),Ui=ft(r=>{"use strict";var e=r&&r.__extends||function(){var C=function(b,A){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(N,G){N.__proto__=G}||function(N,G){for(var F in G)Object.prototype.hasOwnProperty.call(G,F)&&(N[F]=G[F])},C(b,A)};return function(b,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");C(b,A);function N(){this.constructor=b}b.prototype=A===null?Object.create(A):(N.prototype=A.prototype,new N)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.EmbeddedActionsParser=r.CstParser=r.Parser=r.EMPTY_ALT=r.ParserDefinitionErrorType=r.DEFAULT_RULE_CONFIG=r.DEFAULT_PARSER_CONFIG=r.END_OF_FILE=void 0;var t=Ot(),n=yw(),i=po(),s=Nh(),o=_w(),a=gx(),c=bw(),l=ww(),u=Sw(),h=Ew(),f=Aw(),p=Cw(),g=Iw(),m=Rw(),d=Pw(),x=Lw();r.END_OF_FILE=i.createTokenInstance(i.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(r.END_OF_FILE),r.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:s.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),r.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});var _;(function(C){C[C.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",C[C.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",C[C.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",C[C.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",C[C.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",C[C.LEFT_RECURSION=5]="LEFT_RECURSION",C[C.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",C[C.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",C[C.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",C[C.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",C[C.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",C[C.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",C[C.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(_=r.ParserDefinitionErrorType||(r.ParserDefinitionErrorType={}));function v(C){return C===void 0&&(C=void 0),function(){return C}}r.EMPTY_ALT=v;var y=function(){function C(b,A){this.definitionErrors=[],this.selfAnalysisDone=!1;var N=this;if(N.initErrorHandler(A),N.initLexerAdapter(),N.initLooksAhead(A),N.initRecognizerEngine(b,A),N.initRecoverable(A),N.initTreeBuilder(A),N.initContentAssist(),N.initGastRecorder(A),N.initPerformanceTracer(A),t.has(A,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
3249	Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
3250	See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
3251	For further details.`);this.skipValidations=t.has(A,"skipValidations")?A.skipValidations:r.DEFAULT_PARSER_CONFIG.skipValidations}return C.performSelfAnalysis=function(b){throw Error("The **static** `performSelfAnalysis` method has been deprecated.	\nUse the **instance** method with the same name instead.")},C.prototype.performSelfAnalysis=function(){var b=this;this.TRACE_INIT("performSelfAnalysis",function(){var A;b.selfAnalysisDone=!0;var N=b.className;b.TRACE_INIT("toFastProps",function(){t.toFastProperties(b)}),b.TRACE_INIT("Grammar Recording",function(){try{b.enableRecording(),t.forEach(b.definedRulesNames,function(F){var U=b[F],P=U.originalGrammarAction,$=void 0;b.TRACE_INIT(F+" Rule",function(){$=b.topLevelRuleRecord(F,P)}),b.gastProductionsCache[F]=$})}finally{b.disableRecording()}});var G=[];if(b.TRACE_INIT("Grammar Resolving",function(){G=o.resolveGrammar({rules:t.values(b.gastProductionsCache)}),b.definitionErrors=b.definitionErrors.concat(G)}),b.TRACE_INIT("Grammar Validations",function(){if(t.isEmpty(G)&&b.skipValidations===!1){var F=o.val
vendor: 7,302 bytes, lines 3251-3285
3251idateGrammar({rules:t.values(b.gastProductionsCache),maxLookahead:b.maxLookahead,tokenTypes:t.values(b.tokensMap),errMsgProvider:s.defaultGrammarValidatorErrorProvider,grammarName:N});b.definitionErrors=b.definitionErrors.concat(F)}}),t.isEmpty(b.definitionErrors)&&(b.recoveryEnabled&&b.TRACE_INIT("computeAllProdsFollows",function(){var F=n.computeAllProdsFollows(t.values(b.gastProductionsCache));b.resyncFollows=F}),b.TRACE_INIT("ComputeLookaheadFunctions",function(){b.preComputeLookaheadFunctions(t.values(b.gastProductionsCache))})),!C.DEFER_DEFINITION_ERRORS_HANDLING&&!t.isEmpty(b.definitionErrors))throw A=t.map(b.definitionErrors,function(F){return F.message}),new Error(`Parser Definition Errors detected:
3252 `+A.join(`
3253-------------------------------
3254`))})},C.DEFER_DEFINITION_ERRORS_HANDLING=!1,C}();r.Parser=y,x.applyMixins(y,[a.Recoverable,c.LooksAhead,l.TreeBuilder,u.LexerAdapter,f.RecognizerEngine,h.RecognizerApi,p.ErrorHandler,g.ContentAssist,m.GastRecorder,d.PerformanceTracer]);var w=function(C){e(b,C);function b(A,N){N===void 0&&(N=r.DEFAULT_PARSER_CONFIG);var G=this,F=t.cloneObj(N);return F.outputCst=!0,G=C.call(this,A,F)||this,G}return b}(y);r.CstParser=w;var L=function(C){e(b,C);function b(A,N){N===void 0&&(N=r.DEFAULT_PARSER_CONFIG);var G=this,F=t.cloneObj(N);return F.outputCst=!1,G=C.call(this,A,F)||this,G}return b}(y);r.EmbeddedActionsParser=L}),Nw=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createSyntaxDiagramsCode=void 0;var e=ux();function t(n,i){var s=i===void 0?{}:i,o=s.resourceBase,a=o===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/":o,c=s.css,l=c===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/diagrams.css":c,u=`
3255<!-- This is a generated file -->
3256<!DOCTYPE html>
3257<meta charset="utf-8">
3258<style>
3259  body {
3260    background-color: hsl(30, 20%, 95%)
3261  }
3262</style>
3263
3264`,h=`
3265<link rel='stylesheet' href='`+l+`'>
3266`,f=`
3267<script src='`+a+`vendor/railroad-diagrams.js'><\/script>
3268<script src='`+a+`src/diagrams_builder.js'><\/script>
3269<script src='`+a+`src/diagrams_behavior.js'><\/script>
3270<script src='`+a+`src/main.js'><\/script>
3271`,p=`
3272<div id="diagrams" align="center"></div>
3273`,g=`
3274<script>
3275    window.serializedGrammar = `+JSON.stringify(n,null,"  ")+`;
3276<\/script>
3277`,m=`
3278<script>
3279    var diagramsDiv = document.getElementById("diagrams");
3280    main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
3281<\/script>
3282`;return u+h+f+p+g+m}r.createSyntaxDiagramsCode=t}),Ow=ft(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Parser=r.createSyntaxDiagramsCode=r.clearCache=r.GAstVisitor=r.serializeProduction=r.serializeGrammar=r.Terminal=r.Rule=r.RepetitionWithSeparator=r.RepetitionMandatoryWithSeparator=r.RepetitionMandatory=r.Repetition=r.Option=r.NonTerminal=r.Alternative=r.Alternation=r.defaultLexerErrorProvider=r.NoViableAltException=r.NotAllInputParsedException=r.MismatchedTokenException=r.isRecognitionException=r.EarlyExitException=r.defaultParserErrorProvider=r.tokenName=r.tokenMatcher=r.tokenLabel=r.EOF=r.createTokenInstance=r.createToken=r.LexerDefinitionErrorType=r.Lexer=r.EMPTY_ALT=r.ParserDefinitionErrorType=r.EmbeddedActionsParser=r.CstParser=r.VERSION=void 0;var e=ux();Object.defineProperty(r,"VERSION",{enumerable:!0,get:function(){return e.VERSION}});var t=Ui();Object.defineProperty(r,"CstParser",{enumerable:!0,get:function(){return t.CstParser}}),Object.defineProperty(r,"EmbeddedActionsParser",{enumerable:!0,get:function(){return t.EmbeddedActionsParser}}),Object.defineProperty(r,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return t.ParserDefinitionErrorType}}),Object.defineProperty(r,"EMPTY_ALT",{enumerable:!0,get:function(){return t.EMPTY_ALT}});var n=Ph();Object.defineProperty(r,"Lexer",{enumerable:!0,get:function(){return n.Lexer}}),Object.defineProperty(r,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return n.LexerDefinitionErrorType}});var i=po();Object.defineProperty(r,"createToken",{enumerable:!0,get:function(){return i.createToken}}),Object.defineProperty(r,"createTokenInstance",{enumerable:!0,get:function(){return i.createTokenInstance}}),Object.defineProperty(r,"EOF",{enumerable:!0,get:function(){return i.EOF}}),Object.defineProperty(r,"tokenLabel",{enumerable:!0,get:function(){return i.tokenLabel}}),Object.defineProperty(r,"tokenMatcher",{enumerable:!0,get:function(){return i.tokenMatcher}}),Object.defineProperty(r,"tokenName",{enumerable:!0,get:function(){return i.tokenName}});var s=Nh();Object.defineProperty(r,"defaultParserErrorProvider",{enumerable:!0,get:function(){return s.defaultParserErrorProvider}});var o=xc();Object.defineProperty(r,"EarlyExitException",{enumerable:!0,get:function(){return o.EarlyExitException}}),Object.defineProperty(r,"isRecognitionException",{enumerable:!0,get:function(){return o.isRecognitionException}}),Object.defineProperty(r,"MismatchedTokenException",{enumerable:!0,get:function(){return o.MismatchedTokenException}}),Object.defineProperty(r,"NotAllInputParsedException",{enumerable:!0,get:function(){return o.NotAllInputParsedException}}),Object.defineProperty(r,"NoViableAltException",{enumerable:!0,get:function(){return o.NoViableAltException}});var a=fx();Object.defineProperty(r,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return a.defaultLexerErrorProvider}});var c=_i();Object.defineProperty(r,"Alternation",{enumerable:!0,get:function(){return c.Alternation}}),Object.defineProperty(r,"Alternative",{enumerable:!0,get:function(){return c.Alternative}}),Object.defineProperty(r,"NonTerminal",{enumerable:!0,get:function(){return c.NonTerminal}}),Object.defineProperty(r,"Option",{enumerable:!0,get:function(){return c.Option}}),Object.defineProperty(r,"Repetition",{enumerable:!0,get:function(){return c.Repetition}}),Object.defineProperty(r,"RepetitionMandatory",{enumerable:!0,get:function(){return c.RepetitionMandatory}}),Object.defineProperty(r,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return c.RepetitionMandatoryWithSeparator}}),Object.defineProperty(r,"RepetitionWithSeparator",{enumerable:!0,get:function(){return c.RepetitionWithSeparator}}),Object.defineProperty(r,"Rule",{enumerable:!0,get:function(){return c.Rule}}),Object.defineProperty(r,"Terminal",{enumerable:!0,get:function(){return c.Terminal}});var l=_i();Object.defineProperty(r,"serializeGrammar",{enumerable:!0,get:function(){return l.serializeGrammar}}),Object.defineProperty(r,"serializeProduction",{enumerable:!0,get:function(){return l.serializeProduction}});var u=gc();Object.defineProperty(r,"GAstVisitor",{enumerable:!0,get:function(){return u.GAstVisitor}});function h(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
3283	 It performs no action other than printing this message.
3284	 Please avoid using it as it will be completely removed in the future`)}r.clearCache=h;var f=Nw();Object.defineProperty(r,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return f.createSyntaxDiagramsCode}});var p=function(){function g(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
3285See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return g}();r.Parser=p}),mo=Ow();var kh=class extends Un{constructor(e){if(super(e),typeof mo>
3285"u")throw Error("THREE.VRMLLoader: External library chevrotain.min.js required.")}load(e,t,n,i){let s=this,o=s.path===""?oi.extractUrlBase(e):s.path,a=new vi(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(c,o))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e,t){let n={};function i(R){let E=s(),k=new Tp(E.tokens),Q=new Mp(E.tokenVocabulary),K=o(Q.getBaseCstVisitorConstructor()),ce=k.lex(R);Q.input=ce.tokens;let me=Q.vrml();if(Q.errors.length>0)throw console.error(Q.errors),Error("THREE.VRMLLoader: Parsing errors detected.");return K.visit(me)}function s(){let R=mo.createToken,E=R({name:"RouteIdentifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/}),k=R({name:"Identifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/,longer_alt:E}),Q=["Anchor","Billboard","Collision","Group","Transform","Inline","LOD","Switch","AudioClip","DirectionalLight","PointLight","Script","Shape","Sound","SpotLight","WorldInfo","CylinderSensor","PlaneSensor","ProximitySensor","SphereSensor","TimeSensor","TouchSensor","VisibilitySensor","Box","Cone","Cylinder","ElevationGrid","Extrusion","IndexedFaceSet","IndexedLineSet","PointSet","Sphere","Color","Coordinate","Normal","TextureCoordinate","Appearance","FontStyle","ImageTexture","Material","MovieTexture","PixelTexture","TextureTransform","ColorInterpolator","CoordinateInterpolator","NormalInterpolator","OrientationInterpolator","PositionInterpolator","ScalarInterpolator","Background","Fog","NavigationInfo","Viewpoint","Text"],K=R({name:"Version",pattern:/#VRML.*/,longer_alt:k}),ce=R({name:"NodeName",pattern:new RegExp(Q.join("|")),longer_alt:k}),me=R({name:"DEF",pattern:/DEF/,longer_alt:k}),pe=R({name:"USE",pattern:/USE/,longer_alt:k}),ie=R({name:"ROUTE",pattern:/ROUTE/,longer_alt:k}),ve=R({name:"TO",pattern:/TO/,longer_alt:k}),Te=R({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),Pe=R({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),ke=R({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),ze=R({name:"TrueLiteral",pattern:/TRUE/}),Ke=R({name:"FalseLiteral",pattern:/FALSE/}),qe=R({name:"NullLiteral",pattern:/NULL/}),Qe=R({name:"LSquare",pattern:/\[/}),de=R({name:"RSquare",pattern:/]/}),be=R({name:"LCurly",pattern:/{/}),Se=R({name:"RCurly",pattern:/}/}),De=R({name:"Comment",pattern:/#.*/,group:mo.Lexer.SKIPPED}),at=[R({name:"WhiteSpace",pattern:/[ ,\s]/,group:mo.Lexer.SKIPPED}),ce,me,pe,ie,ve,ze,Ke,qe,K,k,E,Te,Pe,ke,Qe,de,be,Se,De],vt={};for(let rt=0,Ye=at.length;rt<Ye;rt++){let Oe=at[rt];vt[Oe.name]=Oe}return{tokens:at,tokenVocabulary:vt}}function o(R){class E extends R{constructor(){super(),this.validateVisitor()}vrml(K){let ce={version:this.visit(K.version),nodes:[],routes:[]};for(let me=0,pe=K.node.length;me<pe;me++){let ie=K.node[me];ce.nodes.push(this.visit(ie))}if(K.route)for(let me=0,pe=K.route.length;me<pe;me++){let ie=K.route[me];ce.routes.push(this.visit(ie))}return ce}version(K){return K.Version[0].image}node(K){let ce={name:K.NodeName[0].image,fields:[]};if(K.field)for(let me=0,pe=K.field.length;me<pe;me++){let ie=K.field[me];ce.fields.push(this.visit(ie))}return K.def&&(ce.DEF=this.visit(K.def[0])),ce}field(K){let ce={name:K.Identifier[0].image,type:null,values:null},me;return K.singleFieldValue&&(me=this.visit(K.singleFieldValue[0])),K.multiFieldValue&&(me=this.visit(K.multiFieldValue[0])),ce.type=me.type,ce.values=me.values,ce}def(K){return(K.Identifier||K.NodeName)[0].image}use(K){return{USE:(K.Identifier||K.NodeName)[0].image}}singleFieldValue(K){return k(this,K)}multiFieldValue(K){return k(this,K)}route(K){return{FROM:K.RouteIdentifier[0].image,TO:K.RouteIdentifier[1].image}}}function k(Q,K){let ce={type:null,values:[]};if(K.node){ce.type="node";for(let me=0,pe=K.node.length;me<pe;me++){let ie=K.node[me];ce.values.push(Q.visit(ie))}}if(K.use){ce.type="use";for(let me=0,pe=K.use.length;me<pe;me++){let ie=K.use[me];ce.values.push(Q.visit(ie))}}if(K.StringLiteral){ce.type="string";for(let me=0,pe=K.StringLiteral.length;me<pe;me++){let ie=K.StringLiteral[me];ce.values.push(ie.image.replace(/'|"/g,""))}}if(K.NumberLiteral){ce.type="number";for(let me=0,pe=K.NumberLiteral.length;me<pe;me++){let ie=K.NumberLiteral[me];ce.values.push(parseFloat(ie.image))}}if(K.HexLiteral){ce.type="hex";
3285for(let me=0,pe=K.HexLiteral.length;me<pe;me++){let ie=K.HexLiteral[me];ce.values.push(ie.image)}}if(K.TrueLiteral){ce.type="boolean";for(let me=0,pe=K.TrueLiteral.length;me<pe;me++)K.TrueLiteral[me].image==="TRUE"&&ce.values.push(!0)}if(K.FalseLiteral){ce.type="boolean";for(let me=0,pe=K.FalseLiteral.length;me<pe;me++)K.FalseLiteral[me].image==="FALSE"&&ce.values.push(!1)}return K.NullLiteral&&(ce.type="null",K.NullLiteral.forEach(function(){ce.values.push(null)})),ce}return new E}function a(R){let E=R.nodes,k=new xr;for(let Q=0,K=E.length;Q<K;Q++){let ce=E[Q];c(ce)}for(let Q=0,K=E.length;Q<K;Q++){let ce=E[Q],me=l(ce);me instanceof xt&&k.add(me),ce.name==="WorldInfo"&&(k.userData.worldInfo=me)}return k}function c(R){R.DEF&&(n[R.DEF]=R);let E=R.fields;for(let k=0,Q=E.length;k<Q;k++){let K=E[k];if(K.type==="node"){let ce=K.values;for(let me=0,pe=ce.length;me<pe;me++)c(ce[me])}}}function l(R){return R.USE?H(R.USE):(R.build!==void 0||(R.build=u(R)),R.build)}function u(R){let E=R.name,k;switch(E){case"Anchor":case"Group":case"Transform":case"Collision":k=h(R);break;case"Background":k=f(R);break;case"Shape":k=p(R);break;case"Appearance":k=g(R);break;case"Material":k=m(R);break;case"ImageTexture":k=v(R);break;case"PixelTexture":k=_(R);break;case"TextureTransform":k=y(R);break;case"IndexedFaceSet":k=C(R);break;case"IndexedLineSet":k=b(R);break;case"PointSet":k=A(R);break;case"Box":k=N(R);break;case"Cone":k=G(R);break;case"Cylinder":k=F(R);break;case"Sphere":k=U(R);break;case"ElevationGrid":k=P(R);break;case"Extrusion":k=$(R);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":k=w(R);break;case"WorldInfo":k=L(R);break;case"Billboard":case"Inline":case"LOD":case"Switch":case"AudioClip":case"DirectionalLight":case"PointLight":case"Script":case"Sound":case"SpotLight":case"CylinderSensor":case"PlaneSensor":case"ProximitySensor":case"SphereSensor":case"TimeSensor":case"TouchSensor":case"VisibilitySensor":case"Text":case"FontStyle":case"MovieTexture":case"ColorInterpolator":case"CoordinateInterpolator":case"NormalInterpolator":case"OrientationInterpolator":case"PositionInterpolator":case"ScalarInterpolator":case"Fog":case"NavigationInfo":case"Viewpoint":break;default:console.warn("THREE.VRMLLoader: Unknown node:",E);break}return k!==void 0&&R.DEF!==void 0&&k.hasOwnProperty("name")===!0&&(k.name=R.DEF),k}function h(R){let E=new bn,k=R.fields;for(let Q=0,K=k.length;Q<K;Q++){let ce=k[Q],me=ce.name,pe=ce.values;switch(me){case"bboxCenter":break;case"bboxSize":break;case"center":break;case"children":Z(pe,E);break;case"description":break;case"collide":break;case"parameter":break;case"rotation":let ie=new ae(pe[0],pe[1],pe[2]),ve=pe[3];E.quaternion.setFromAxisAngle(ie,ve);break;case"scale":E.scale.set(pe[0],pe[1],pe[2]);break;case"scaleOrientation":break;case"translation":E.position.set(pe[0],pe[1],pe[2]);break;case"proxy":break;case"url":break;default:console.warn("THREE.VRMLLoader: Unknown field:",me);break}}return E}function f(R){let E=new bn,k,Q,K,ce,me=R.fields;for(let ie=0,ve=me.length;ie<ve;ie++){let Te=me[ie],Pe=Te.name,ke=Te.values;switch(Pe){case"groundAngle":k=ke;break;case"groundColor":Q=ke;break;case"backUrl":break;case"bottomUrl":break;case"frontUrl":break;case"leftUrl":break;case"rightUrl":break;case"topUrl":break;case"skyAngle":K=ke;break;case"skyColor":ce=ke;break;default:console.warn("THREE.VRMLLoader: Unknown field:",Pe);break}}let pe=1e4;if(ce){let ie=new bs(pe,32,16),ve=new Ii({fog:!1,side:Pn,depthWrite:!1,depthTest:!1});ce.length>3?(se(ie,pe,K,we(ce),!0),ve.vertexColors=!0):ve.color.setRGB(ce[0],ce[1],ce[2]);let Te=new kt(ie,ve);E.add(Te)}if(Q&&Q.length>0){let ie=new bs(pe,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),ve=new Ii({fog:!1,side:Pn,vertexColors:!0,depthWrite:!1,depthTest:!1});se(ie,pe,k,we(Q),!1);let Te=new kt(ie,ve);E.add(Te)}return E.renderOrder=-1/0,E}function p(R){let E=R.fields,k=new Ii({color:0}),Q;for(let ce=0,me=E.length;ce<me;ce++){let pe=E[ce],ie=pe.name,ve=pe.values;switch(ie){case"appearance":ve[0]!==null&&(k=l(ve[0]));break;case"geometry":ve[0]!==null&&(Q=l(ve[0]));break;
3285default:console.warn("THREE.VRMLLoader: Unknown field:",ie);break}}let K;if(Q&&Q.attributes.position){let ce=Q._type;if(ce==="points"){let me=new Kl({color:16777215});Q.attributes.color!==void 0?me.vertexColors=!0:k.isMeshPhongMaterial&&me.color.copy(k.emissive),K=new Yu(Q,me)}else if(ce==="line"){let me=new Ri({color:16777215});Q.attributes.color!==void 0?me.vertexColors=!0:k.isMeshPhongMaterial&&me.color.copy(k.emissive),K=new _s(Q,me)}else Q._solid!==void 0&&(k.side=Q._solid?pr:kn),Q.attributes.color!==void 0&&(k.vertexColors=!0),K=new kt(Q,k)}else K=new xt,K.visible=!1;return K}function g(R){let E=new Qt,k,Q=R.fields;for(let K=0,ce=Q.length;K<ce;K++){let me=Q[K],pe=me.name,ie=me.values;switch(pe){case"material":if(ie[0]!==null){let Te=l(ie[0]);Te.diffuseColor&&E.color.copy(Te.diffuseColor),Te.emissiveColor&&E.emissive.copy(Te.emissiveColor),Te.shininess&&(E.shininess=Te.shininess),Te.specularColor&&E.specular.copy(Te.specularColor),Te.transparency&&(E.opacity=1-Te.transparency),Te.transparency>0&&(E.transparent=!0)}else E=new Ii({color:0});break;case"texture":let ve=ie[0];ve!==null&&(ve.name==="ImageTexture"||ve.name==="PixelTexture")&&(E.map=l(ve));break;case"textureTransform":ie[0]!==null&&(k=l(ie[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",pe);break}}if(E.map){if(E.map.__type){switch(E.map.__type){case Qi.INTENSITY_ALPHA:E.opacity=1;break;case Qi.RGB:E.color.set(16777215);break;case Qi.RGBA:E.color.set(16777215),E.opacity=1;break;default:}delete E.map.__type}k&&(E.map.center.copy(k.center),E.map.rotation=k.rotation,E.map.repeat.copy(k.scale),E.map.offset.copy(k.translation))}return E}function m(R){let E={},k=R.fields;for(let Q=0,K=k.length;Q<K;Q++){let ce=k[Q],me=ce.name,pe=ce.values;switch(me){case"ambientIntensity":break;case"diffuseColor":E.diffuseColor=new $e(pe[0],pe[1],pe[2]);break;case"emissiveColor":E.emissiveColor=new $e(pe[0],pe[1],pe[2]);break;case"shininess":E.shininess=pe[0];break;case"specularColor":E.emissiveColor=new $e(pe[0],pe[1],pe[2]);break;case"transparency":E.transparency=pe[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",me);break}}return E}function d(R,E,k){let Q;switch(E){case Qi.INTENSITY:Q=parseInt(R),k.r=Q,k.g=Q,k.b=Q,k.a=1;break;case Qi.INTENSITY_ALPHA:Q=parseInt("0x"+R.substring(2,4)),k.r=Q,k.g=Q,k.b=Q,k.a=parseInt("0x"+R.substring(4,6));break;case Qi.RGB:k.r=parseInt("0x"+R.substring(2,4)),k.g=parseInt("0x"+R.substring(4,6)),k.b=parseInt("0x"+R.substring(6,8)),k.a=1;break;case Qi.RGBA:k.r=parseInt("0x"+R.substring(2,4)),k.g=parseInt("0x"+R.substring(4,6)),k.b=parseInt("0x"+R.substring(6,8)),k.a=parseInt("0x"+R.substring(8,10));break;default:}}function x(R){let E;switch(R){case 1:E=Qi.INTENSITY;break;case 2:E=Qi.INTENSITY_ALPHA;break;case 3:E=Qi.RGB;break;case 4:E=Qi.RGBA;break;default:}return E}function _(R){let E,k=$t,Q=$t,K=R.fields;for(let ce=0,me=K.length;ce<me;ce++){let pe=K[ce],ie=pe.name,ve=pe.values;switch(ie){case"image":let Te=ve[0],Pe=ve[1],ke=ve[2],ze=x(ke),Ke=new Uint8Array(4*Te*Pe),qe={r:0,g:0,b:0,a:0};for(let Qe=3,de=0,be=ve.length;Qe<be;Qe++,de++){d(ve[Qe],ze,qe);let Se=de*4;Ke[Se+0]=qe.r,Ke[Se+1]=qe.g,Ke[Se+2]=qe.b,Ke[Se+3]=qe.a}E=new _a(Ke,Te,Pe),E.needsUpdate=!0,E.__type=ze;break;case"repeatS":ve[0]===!1&&(k=Wt);break;case"repeatT":ve[0]===!1&&(Q=Wt);break;default:console.warn("THREE.VRMLLoader: Unknown field:",ie);break}}return E&&(E.wrapS=k,E.wrapT=Q),E}function v(R){let E,k=$t,Q=$t,K=R.fields;for(let ce=0,me=K.length;ce<me;ce++){let pe=K[ce],ie=pe.name,ve=pe.values;switch(ie){case"url":let Te=ve[0];Te&&(E=J.load(Te));break;case"repeatS":ve[0]===!1&&(k=Wt);break;case"repeatT":ve[0]===!1&&(Q=Wt);break;default:console.warn("THREE.VRMLLoader: Unknown field:",ie);break}}return E&&(E.wrapS=k,E.wrapT=Q),E}function y(R){let E={center:new Ee,rotation:new Ee,scale:new Ee,translation:new Ee},k=R.fields;for(let Q=0,K=k.length;Q<K;Q++){let ce=k[Q],me=ce.name,pe=ce.values;switch(me){case"center":E.center.set(pe[0],pe[1]);break;case"rotation":E.rotation=pe[0];break;case"scale":E.scale.set(pe[0],pe[1]);break;case"translation":E.translation.set(pe[0],pe[1]);break;
3285default:console.warn("THREE.VRMLLoader: Unknown field:",me);break}}return E}function w(R){return R.fields[0].values}function L(R){let E={},k=R.fields;for(let Q=0,K=k.length;Q<K;Q++){let ce=k[Q],me=ce.name,pe=ce.values;switch(me){case"title":E.title=pe[0];break;case"info":E.info=pe;break;default:console.warn("THREE.VRMLLoader: Unknown field:",me);break}}return E}function C(R){let E,k,Q,K,ce=!0,me=!0,pe=0,ie,ve,Te,Pe,ke=!0,ze=!0,Ke=R.fields;for(let Fe=0,at=Ke.length;Fe<at;Fe++){let vt=Ke[Fe],rt=vt.name,Ye=vt.values;switch(rt){case"color":let Oe=Ye[0];Oe!==null&&(E=l(Oe));break;case"coord":let Be=Ye[0];Be!==null&&(k=l(Be));break;case"normal":let We=Ye[0];We!==null&&(Q=l(We));break;case"texCoord":let nt=Ye[0];nt!==null&&(K=l(nt));break;case"ccw":ce=Ye[0];break;case"colorIndex":ie=Ye;break;case"colorPerVertex":ke=Ye[0];break;case"convex":break;case"coordIndex":ve=Ye;break;case"creaseAngle":pe=Ye[0];break;case"normalIndex":Te=Ye;break;case"normalPerVertex":ze=Ye[0];break;case"solid":me=Ye[0];break;case"texCoordIndex":Pe=Ye;break;default:console.warn("THREE.VRMLLoader: Unknown field:",rt);break}}if(ve===void 0)return console.warn("THREE.VRMLLoader: Missing coordIndex."),new yt;let qe=W(ve,ce),Qe,de,be;if(E)if(ke===!0)if(ie&&ie.length>0){let Fe=W(ie,ce);Qe=j(qe,Fe,E,3)}else Qe=q(qe,new je(E,3));else if(ie&&ie.length>0){let Fe=ue(E,ie),at=oe(Fe,ve);Qe=z(qe,at)}else{let Fe=oe(E,ve);Qe=z(qe,Fe)}if(Q)if(ze===!0)if(Te&&Te.length>0){let Fe=W(Te,ce);de=j(qe,Fe,Q,3)}else de=q(qe,new je(Q,3));else if(Te&&Te.length>0){let Fe=ue(Q,Te),at=oe(Fe,ve);de=z(qe,at)}else{let Fe=oe(Q,ve);de=z(qe,Fe)}else de=ge(qe,k,pe);if(K)if(Pe&&Pe.length>0){let Fe=W(Pe,ce);be=j(qe,Fe,K,2)}else be=q(qe,new je(K,2));let Se=new yt,De=q(qe,new je(k,3));return Se.setAttribute("position",De),Se.setAttribute("normal",de),Qe&&Se.setAttribute("color",Qe),be&&Se.setAttribute("uv",be),Se._solid=me,Se._type="mesh",Se}function b(R){let E,k,Q,K,ce=!0,me=R.fields;for(let Pe=0,ke=me.length;Pe<ke;Pe++){let ze=me[Pe],Ke=ze.name,qe=ze.values;switch(Ke){case"color":let Qe=qe[0];Qe!==null&&(E=l(Qe));break;case"coord":let de=qe[0];de!==null&&(k=l(de));break;case"colorIndex":Q=qe;break;case"colorPerVertex":ce=qe[0];break;case"coordIndex":K=qe;break;default:console.warn("THREE.VRMLLoader: Unknown field:",Ke);break}}let pe,ie=ne(K);if(E)if(ce===!0)if(Q.length>0){let Pe=ne(Q);pe=j(ie,Pe,E,3)}else pe=q(ie,new je(E,3));else if(Q.length>0){let Pe=ue(E,Q),ke=le(Pe,K);pe=fe(ie,ke)}else{let Pe=le(E,K);pe=fe(ie,Pe)}let ve=new yt,Te=q(ie,new je(k,3));return ve.setAttribute("position",Te),pe&&ve.setAttribute("color",pe),ve._type="line",ve}function A(R){let E,k,Q=R.fields;for(let ce=0,me=Q.length;ce<me;ce++){let pe=Q[ce],ie=pe.name,ve=pe.values;switch(ie){case"color":let Te=ve[0];Te!==null&&(E=l(Te));break;case"coord":let Pe=ve[0];Pe!==null&&(k=l(Pe));break;default:console.warn("THREE.VRMLLoader: Unknown field:",ie);break}}let K=new yt;return K.setAttribute("position",new je(k,3)),E&&K.setAttribute("color",new je(E,3)),K._type="points",K}function N(R){let E=new ae(2,2,2),k=R.fields;for(let K=0,ce=k.length;K<ce;K++){let me=k[K],pe=me.name,ie=me.values;switch(pe){case"size":E.x=ie[0],E.y=ie[1],E.z=ie[2];break;default:console.warn("THREE.VRMLLoader: Unknown field:",pe);break}}return new Hr(E.x,E.y,E.z)}function G(R){let E=1,k=2,Q=!1,K=R.fields;for(let me=0,pe=K.length;me<pe;me++){let ie=K[me],ve=ie.name,Te=ie.values;switch(ve){case"bottom":Q=!Te[0];break;case"bottomRadius":E=Te[0];break;case"height":k=Te[0];break;case"side":break;default:console.warn("THREE.VRMLLoader: Unknown field:",ve);break}}return new ba(E,k,16,1,Q)}function F(R){let E=1,k=2,Q=R.fields;for(let ce=0,me=Q.length;ce<me;ce++){let pe=Q[ce],ie=pe.name,ve=pe.values;switch(ie){case"bottom":break;case"radius":E=ve[0];break;case"height":k=ve[0];break;case"side":break;case"top":break;default:console.warn("THREE.VRMLLoader: Unknown field:",ie);break}}return new ao(E,E,k,16,1)}function U(R){let E=1,k=R.fields;for(let K=0,ce=k.length;K<ce;K++){let me=k[K],pe=me.name,ie=me.values;switch(pe){case"radius":E=ie[0];break;
3285default:console.warn("THREE.VRMLLoader: Unknown field:",pe);break}}return new bs(E,16,16)}function P(R){let E,k,Q,K,ce=!0,me=!0,pe=!0,ie=!0,ve=0,Te=2,Pe=2,ke=1,ze=1,Ke=R.fields;for(let Ye=0,Oe=Ke.length;Ye<Oe;Ye++){let Be=Ke[Ye],We=Be.name,nt=Be.values;switch(We){case"color":let Vt=nt[0];Vt!==null&&(E=l(Vt));break;case"normal":let Ti=nt[0];Ti!==null&&(k=l(Ti));break;case"texCoord":let Mi=nt[0];Mi!==null&&(Q=l(Mi));break;case"height":K=nt;break;case"ccw":ie=nt[0];break;case"colorPerVertex":ce=nt[0];break;case"creaseAngle":ve=nt[0];break;case"normalPerVertex":me=nt[0];break;case"solid":pe=nt[0];break;case"xDimension":Te=nt[0];break;case"xSpacing":ke=nt[0];break;case"zDimension":Pe=nt[0];break;case"zSpacing":ze=nt[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",We);break}}let qe=[],Qe=[],de=[],be=[];for(let Ye=0;Ye<Pe;Ye++)for(let Oe=0;Oe<Te;Oe++){let Be=Ye*Te+Oe,We=ke*Ye,nt=K[Be],Vt=ze*Oe;if(qe.push(We,nt,Vt),E&&ce===!0){let Ti=E[Be*3+0],Mi=E[Be*3+1],ee=E[Be*3+2];de.push(Ti,Mi,ee)}if(k&&me===!0){let Ti=k[Be*3+0],Mi=k[Be*3+1],ee=k[Be*3+2];Qe.push(Ti,Mi,ee)}if(Q){let Ti=Q[Be*2+0],Mi=Q[Be*2+1];be.push(Ti,Mi)}else be.push(Ye/(Te-1),Oe/(Pe-1))}let Se=[];for(let Ye=0;Ye<Te-1;Ye++)for(let Oe=0;Oe<Pe-1;Oe++){let Be=Ye+Oe*Te,We=Ye+(Oe+1)*Te,nt=Ye+1+(Oe+1)*Te,Vt=Ye+1+Oe*Te;ie===!0?(Se.push(Be,nt,We),Se.push(nt,Be,Vt)):(Se.push(Be,We,nt),Se.push(nt,Vt,Be))}let De=q(Se,new je(qe,3)),Fe=q(Se,new je(be,2)),at,vt;if(E)if(ce===!1){for(let Ye=0;Ye<Te-1;Ye++)for(let Oe=0;Oe<Pe-1;Oe++){let Be=Ye+Oe*(Te-1),We=E[Be*3+0],nt=E[Be*3+1],Vt=E[Be*3+2];de.push(We,nt,Vt),de.push(We,nt,Vt),de.push(We,nt,Vt),de.push(We,nt,Vt),de.push(We,nt,Vt),de.push(We,nt,Vt)}at=new je(de,3)}else at=q(Se,new je(de,3));if(k)if(me===!1){for(let Ye=0;Ye<Te-1;Ye++)for(let Oe=0;Oe<Pe-1;Oe++){let Be=Ye+Oe*(Te-1),We=k[Be*3+0],nt=k[Be*3+1],Vt=k[Be*3+2];Qe.push(We,nt,Vt),Qe.push(We,nt,Vt),Qe.push(We,nt,Vt),Qe.push(We,nt,Vt),Qe.push(We,nt,Vt),Qe.push(We,nt,Vt)}vt=new je(Qe,3)}else vt=q(Se,new je(Qe,3));else vt=ge(Se,qe,ve);let rt=new yt;return rt.setAttribute("position",De),rt.setAttribute("normal",vt),rt.setAttribute("uv",Fe),at&&rt.setAttribute("color",at),rt._solid=pe,rt._type="mesh",rt}function $(R){let E=[1,1,1,-1,-1,-1,-1,1,1,1],k=[0,0,0,0,1,0],Q,K,ce=!0,me=!0,pe=0,ie=!0,ve=!0,Te=R.fields;for(let rt=0,Ye=Te.length;rt<Ye;rt++){let Oe=Te[rt],Be=Oe.name,We=Oe.values;switch(Be){case"beginCap":ce=We[0];break;case"ccw":me=We[0];break;case"convex":break;case"creaseAngle":pe=We[0];break;case"crossSection":E=We;break;case"endCap":ie=We[0];break;case"orientation":K=We;break;case"scale":Q=We;break;case"solid":ve=We[0];break;case"spine":k=We;break;default:console.warn("THREE.VRMLLoader: Unknown field:",Be);break}}let Pe=E[0]===E[E.length-2]&&E[1]===E[E.length-1],ke=[],ze=new ae,Ke=new ae,qe=new ae,Qe=new ae,de=new mn;for(let rt=0,Ye=0,Oe=0,Be=k.length;rt<Be;rt+=3,Ye+=2,Oe+=4){ze.fromArray(k,rt),Ke.x=Q?Q[Ye+0]:1,Ke.y=1,Ke.z=Q?Q[Ye+1]:1,qe.x=K?K[Oe+0]:0,qe.y=K?K[Oe+1]:0,qe.z=K?K[Oe+2]:1;let We=K?K[Oe+3]:0;for(let nt=0,Vt=E.length;nt<Vt;nt+=2)Qe.x=E[nt+0],Qe.y=0,Qe.z=E[nt+1],Qe.multiply(Ke),de.setFromAxisAngle(qe,We),Qe.applyQuaternion(de),Qe.add(ze),ke.push(Qe.x,Qe.y,Qe.z)}let be=[],Se=k.length/3,De=E.length/2;for(let rt=0;rt<Se-1;rt++)for(let Ye=0;Ye<De-1;Ye++){let Oe=Ye+rt*De,Be=Ye+1+rt*De,We=Ye+(rt+1)*De,nt=Ye+1+(rt+1)*De;Ye===De-2&&Pe===!0&&(Be=rt*De,nt=(rt+1)*De),me===!0?(be.push(Oe,Be,We),be.push(We,Be,nt)):(be.push(Oe,We,Be),be.push(We,nt,Be))}if(ce===!0||ie===!0){let rt=[];for(let Be=0,We=E.length;Be<We;Be+=2)rt.push(new Ee(E[Be],E[Be+1]));let Ye=Ci.triangulateShape(rt,[]),Oe=[];for(let Be=0,We=Ye.length;Be<We;Be++){let nt=Ye[Be];Oe.push(nt[0],nt[1],nt[2])}if(ce===!0)for(let Be=0,We=Oe.length;Be<We;Be+=3)me===!0?be.push(Oe[Be+0],Oe[Be+1],Oe[Be+2]):be.push(Oe[Be+0],Oe[Be+2],Oe[Be+1]);if(ie===!0){let Be=De*(Se-1);for(let We=0,nt=Oe.length;We<nt;We+=3)me===!0?be.push(Be+Oe[We+0],Be+Oe[We+2],Be+Oe[We+1]):be.push(Be+Oe[We+0],Be+Oe[We+1],Be+Oe[We+2])}}let Fe=q(be,new je(ke,3)),at=ge(be,ke,pe),vt=new yt;return vt.setAttribute("position",Fe),vt.setAttribute("normal",at),vt._solid=ve,vt._type="mesh",vt}function H(R){let E=n[R],k=l(E);return k.isObject3D||k.isMaterial?k.clone():k}function Z(R,E){for(let k=0,Q=R.length;k<Q;k++){let K=l(R[k]);K instanceof xt&&E.add(K)}}function W(R,E){let k=[],Q=0;for(let K=0,ce=R.length;K<ce;K++){let me=R[Q],pe=R[K+(E?1:2)],ie=R[K+(E?2:1)];k.push(me,pe,ie),(R[K+3]===-1||K+3>=ce)&&(K+=3,Q=K+1)}return k}function oe(R,E){let k=[],Q=0;for(let K=0,ce=E.length;K<ce;K++){let me=Q*3,pe=R[me],ie=R[me+1],ve=R[me+2];k.push(pe,ie,ve),(E[K+3]===-1||K+3>=ce)&&(K+=3,Q++)}return k}function ue(R,E){let k=[];for(let Q=0,K=E.length;Q<K;Q++){let me=E[Q]*3,pe=R[me],ie=R[me+1],ve=R[me+2];k.push(pe,ie,ve)}return k}function ne(R){let E=[];for(let k=0,Q=R.length;k<Q;k++){let K=R[k],ce=R[k+1];E.push(K,ce),(R[k+2]===-1||k+2>=Q)&&(k+=2)}return E}function le(R,E){let k=[],Q=0;for(let K=0,ce=E.length;K<ce;K++){let me=Q*3,pe=R[me],ie=R[me+1],ve=R[me+2];k.push(pe,ie,ve),(E[K+2]===-1||K+2>=ce)&&(K+=2,Q++)}return k}let he=new ae,I=new ae,M=new ae,T=new Ee,S=new Ee,B=new Ee;function j(R,E,k,Q){let K=[];for(let ce=0,me=R.length;ce<me;ce+=3){let pe=E[ce],ie=E[ce+1],ve=E[ce+2];Q===2?(T.fromArray(k,pe*Q),S.fromArray(k,ie*Q),B.fromArray(k,ve*Q),K.push(T.x,T.y),K.push(S.x,S.y),K.push(B.x,B.y)):(he.fromArray(k,pe*Q),I.fromArray(k,ie*Q),M.fromArray(k,ve*Q),K.push(he.x,he.y,he.z),K.push(I.x,I.y,I.z),K.push(M.x,M.y,M.z))}return new je(K,Q)}function z(R,E){let k=[];for(let Q=0,K=0,ce=R.length;Q<ce;Q+=3,K++)he.fromArray(E,K*3),k.push(he.x,he.y,he.z),k.push(he.x,he.y,he.z),k.push(he.x,he.y,he.z);return new je(k,3)}function fe(R,E){let k=[];for(let Q=0,K=0,ce=R.length;Q<ce;Q+=2,K++)he.fromArray(E,K*3),k.push(he.x,he.y,he.z),k.push(he.x,he.y,he.z);return new je(k,3)}function q(R,E){let k=E.array,Q=E.itemSize,K=new k.constructor(R.length*Q),ce=0,me=0;for(let pe=0,ie=R.length;pe<ie;pe++){ce=R[pe]*Q;for(let ve=0;ve<Q;ve++)K[me++]=k[ce++]}return new je(K,Q)}let re=new ae,te=new ae;function ge(R,E,k){let Q=[],K={};for(let me=0,pe=R.length;me<pe;me+=3){let ie=R[me],ve=R[me+1],Te=R[me+2],Pe=new wp(ie,ve,Te);he.fromArray(E,ie*3),I.fromArray(E,ve*3),M.fromArray(E,Te*3),te.subVectors(M,I),re.subVectors(he,I),te.cross(re),te.normalize(),Pe.normal.copy(te),K[ie]===void 0&&(K[ie]=[]),K[ve]===void 0&&(K[ve]=[]),K[Te]===void 0&&(K[Te]=[]),K[ie].push(Pe.normal),K[ve].push(Pe.normal),K[Te].push(Pe.normal),Q.push(Pe)}let ce=[];for(let me=0,pe=Q.length;me<pe;me++){let ie=Q[me],ve=xe(K[ie.a],ie.normal,k),Te=xe(K[ie.b],ie.normal,k),Pe=xe(K[ie.c],ie.normal,k);he.fromArray(E,ie.a*3),I.fromArray(E,ie.b*3),M.fromArray(E,ie.c*3),ce.push(ve.x,ve.y,ve.z),ce.push(Te.x,Te.y,Te.z),ce.push(Pe.x,Pe.y,Pe.z)}return new je(ce,3)}function xe(R,E,k){let Q=new ae;if(k===0)Q.copy(E);else for(let K=0,ce=R.length;K<ce;K++)R[K].angleTo(E)<k&&Q.add(R[K]);return Q.normalize()}
3285function we(R){let E=[];for(let k=0,Q=R.length;k<Q;k+=3)E.push(new $e(R[k],R[k+1],R[k+2]));return E}function se(R,E,k,Q,K){let ce=[],me=K===!0?0:Math.PI;for(let ke=0,ze=Q.length;ke<ze;ke++){let Ke=ke===0?0:k[ke-1];Ke=K===!0?Ke:me-Ke;let qe=new ae;qe.setFromSphericalCoords(E,Ke,0),ce.push(qe)}let pe=R.index,ie=R.attributes.position,ve=new Fn(new Float32Array(R.attributes.position.count*3),3),Te=new ae,Pe=new $e;for(let ke=0;ke<pe.count;ke++){let ze=pe.getX(ke);Te.fromBufferAttribute(ie,ze);let Ke,qe,Qe=1;for(let Se=1;Se<ce.length;Se++){Ke=Se-1,qe=Se;let De=ce[Ke],Fe=ce[qe];if(K===!0){if(Te.y<=De.y&&Te.y>Fe.y){Qe=Math.abs(De.y-Te.y)/Math.abs(De.y-Fe.y);break}}else if(Te.y>=De.y&&Te.y<Fe.y){Qe=Math.abs(De.y-Te.y)/Math.abs(De.y-Fe.y);break}}let de=Q[Ke],be=Q[qe];Pe.copy(de).lerp(be,Qe),ve.setXYZ(ze,Pe.r,Pe.g,Pe.b)}R.setAttribute("color",ve)}let J=new Li(this.manager);if(J.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),e.indexOf("#VRML V2.0")===-1)throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");let Ae=i(e);return a(Ae)}},Tp=class{constructor(e){this.lexer=new mo.Lexer(e)}lex(e){let t=this.lexer.tokenize(e);if(t.errors.length>0)throw console.error(t.errors),Error("THREE.VRMLLexer: Lexing errors detected.");return t}},Dw=mo.CstParser,Mp=class extends Dw{constructor(e){super(e);let t=this,n=e.Version,i=e.LCurly,s=e.RCurly,o=e.LSquare,a=e.RSquare,c=e.Identifier,l=e.RouteIdentifier,u=e.StringLiteral,h=e.HexLiteral,f=e.NumberLiteral,p=e.TrueLiteral,g=e.FalseLiteral,m=e.NullLiteral,d=e.DEF,x=e.USE,_=e.ROUTE,v=e.TO,y=e.NodeName;t.RULE("vrml",function(){t.SUBRULE(t.version),t.AT_LEAST_ONE(function(){t.SUBRULE(t.node)}),t.MANY(function(){t.SUBRULE(t.route)})}),t.RULE("version",function(){t.CONSUME(n)}),t.RULE("node",function(){t.OPTION(function(){t.SUBRULE(t.def)}),t.CONSUME(y),t.CONSUME(i),t.MANY(function(){t.SUBRULE(t.field)}),t.CONSUME(s)}),t.RULE("field",function(){t.CONSUME(c),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])}),t.RULE("def",function(){t.CONSUME(d),t.OR([{ALT:function(){t.CONSUME(c)}},{ALT:function(){t.CONSUME(y)}}])}),t.RULE("use",function(){t.CONSUME(x),t.OR([{ALT:function(){t.CONSUME(c)}},{ALT:function(){t.CONSUME(y)}}])}),t.RULE("singleFieldValue",function(){t.AT_LEAST_ONE(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(f)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(g)}},{ALT:function(){t.CONSUME(m)}}])})}),t.RULE("multiFieldValue",function(){t.CONSUME(o),t.MANY(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(f)}},{ALT:function(){t.CONSUME(m)}}])}),t.CONSUME(a)}),t.RULE("route",function(){t.CONSUME(_),t.CONSUME(l),t.CONSUME(v),t.CONSUME2(l)}),this.performSelfAnalysis()}},wp=class{constructor(e,t,n){this.a=e,this.b=t,this.c=n,this.normal=new ae}},Qi={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};var Fh=class extends Un{constructor(e){super(e),this.availableExtensions=[]}load(e,t,n,i){let s=this,o=new vi(s.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(a))}catch(c){i?i(c):console.error(c),s.manager.itemError(e)}},n,i)}parse(e){let t=this,n=new Li(this.manager);function i(I){let M=null,T=null,S,B,j=[],z=[],fe,q={},re={},te={};try{M=up(new Uint8Array(I))}catch(se){if(se instanceof ReferenceError)return console.error("THREE.3MFLoader: fflate missing and file is compressed."),null}for(T in M)T.match(/\_rels\/.rels$/)?S=T:T.match(/3D\/_rels\/.*\.model\.rels$/)?B=T:T.match(/^3D\/.*\.model$/)?j.push(T):T.match(/^3D\/Textures?\/.*/)&&z.push(T);let ge=M[S],xe=oi.decodeText(ge),we=s(xe);if(B){let se=M[B],J=oi.decodeText(se);fe=s(J)}for(let se=0;se<j.length;se++){let J=j[se],Ae=M[J],Le=oi.decodeText(Ae),R=new DOMParser().parseFromString(Le,"application/xml");R.documentElement.nodeName.toLowerCase()!=="model"&&console.error("THREE.3MFLoader: Error loading 3MF - no 3MF document found: ",J);let E=R.querySelector("model"),k={};for(let K=0;K<E.attributes.length;K++){let ce=E.attributes[K];ce.name.match(/^xmlns:(.+)$/)&&(k[ce.value]=RegExp.$1)}let Q=y(E);Q.xml=E,0<Object.keys(k).length&&(Q.extensions=k),q[J]=Q}for(let se=0;se<z.length;se++){let J=z[se];te[J]=M[J].buffer}return{rels:we,modelRels:fe,model:q,printTicket:re,texture:te}}function s(I){let M=[],S=new DOMParser().parseFromString(I,"application/xml").querySelectorAll("Relationship");for(let B=0;B<S.length;B++){let j=S[B],z={target:j.getAttribute("Target"),id:j.getAttribute("Id"),type:j.getAttribute("Type")};M.push(z)}return M}function o(I){let M={};for(let T=0;T<I.length;T++){let S=I[T],B=S.getAttribute("name");0<=["Title","Designer","Description","Copyright","LicenseTerms","Rating","CreationDate","ModificationDate"].indexOf(B)&&(M[B]=S.textContent)}return M}function a(I){let M={id:I.getAttribute("id"),basematerials:[]},T=I.querySelectorAll("base");for(let S=0;S<T.length;S++){let B=T[S],j=f(B);j.index=S,M.basematerials.push(j)}return M}function c(I){return{id:I.getAttribute("id"),path:I.getAttribute("path"),contenttype:I.getAttribute("contenttype"),tilestyleu:I.getAttribute("tilestyleu"),tilestylev:I.getAttribute("tilestylev"),filter:I.getAttribute("filter")}}
3285function l(I){let M={id:I.getAttribute("id"),texid:I.getAttribute("texid"),displaypropertiesid:I.getAttribute("displaypropertiesid")},T=I.querySelectorAll("tex2coord"),S=[];for(let B=0;B<T.length;B++){let j=T[B],z=j.getAttribute("u"),fe=j.getAttribute("v");S.push(parseFloat(z),parseFloat(fe))}return M.uvs=new Float32Array(S),M}function u(I){let M={id:I.getAttribute("id"),displaypropertiesid:I.getAttribute("displaypropertiesid")},T=I.querySelectorAll("color"),S=[],B=new $e;for(let j=0;j<T.length;j++){let fe=T[j].getAttribute("color");B.setStyle(fe.substring(0,7)),B.convertSRGBToLinear(),S.push(B.r,B.g,B.b)}return M.colors=new Float32Array(S),M}function h(I){let M={id:I.getAttribute("id")},T=I.querySelectorAll("pbmetallic"),S=[];for(let B=0;B<T.length;B++){let j=T[B];S.push({name:j.getAttribute("name"),metallicness:parseFloat(j.getAttribute("metallicness")),roughness:parseFloat(j.getAttribute("roughness"))})}return M.data=S,M}function f(I){let M={};return M.name=I.getAttribute("name"),M.displaycolor=I.getAttribute("displaycolor"),M.displaypropertiesid=I.getAttribute("displaypropertiesid"),M}function p(I){let M={},T=[],S=I.querySelectorAll("vertices vertex");for(let fe=0;fe<S.length;fe++){let q=S[fe],re=q.getAttribute("x"),te=q.getAttribute("y"),ge=q.getAttribute("z");T.push(parseFloat(re),parseFloat(te),parseFloat(ge))}M.vertices=new Float32Array(T);let B=[],j=[],z=I.querySelectorAll("triangles triangle");for(let fe=0;fe<z.length;fe++){let q=z[fe],re=q.getAttribute("v1"),te=q.getAttribute("v2"),ge=q.getAttribute("v3"),xe=q.getAttribute("p1"),we=q.getAttribute("p2"),se=q.getAttribute("p3"),J=q.getAttribute("pid"),Ae={};Ae.v1=parseInt(re,10),Ae.v2=parseInt(te,10),Ae.v3=parseInt(ge,10),j.push(Ae.v1,Ae.v2,Ae.v3),xe&&(Ae.p1=parseInt(xe,10)),we&&(Ae.p2=parseInt(we,10)),se&&(Ae.p3=parseInt(se,10)),J&&(Ae.pid=J),0<Object.keys(Ae).length&&B.push(Ae)}return M.triangleProperties=B,M.triangles=new Uint32Array(j),M}function g(I){let M=[],T=I.querySelectorAll("component");for(let S=0;S<T.length;S++){let B=T[S],j=m(B);M.push(j)}return M}function m(I){let M={};M.objectId=I.getAttribute("objectid");let T=I.getAttribute("transform");return T&&(M.transform=d(T)),M}function d(I){let M=[];I.split(" ").forEach(function(S){M.push(parseFloat(S))});let T=new Xe;return T.set(M[0],M[3],M[6],M[9],M[1],M[4],M[7],M[10],M[2],M[5],M[8],M[11],0,0,0,1),T}function x(I){let M={type:I.getAttribute("type")},T=I.getAttribute("id");T&&(M.id=T);let S=I.getAttribute("pid");S&&(M.pid=S);let B=I.getAttribute("pindex");B&&(M.pindex=B);let j=I.getAttribute("thumbnail");j&&(M.thumbnail=j);let z=I.getAttribute("partnumber");z&&(M.partnumber=z);let fe=I.getAttribute("name");fe&&(M.name=fe);let q=I.querySelector("mesh");q&&(M.mesh=p(q));let re=I.querySelector("components");return re&&(M.components=g(re)),M}function _(I){let M={};M.basematerials={};let T=I.querySelectorAll("basematerials");for(let q=0;q<T.length;q++){let re=T[q],te=a(re);M.basematerials[te.id]=te}M.texture2d={};let S=I.querySelectorAll("texture2d");for(let q=0;q<S.length;q++){let re=S[q],te=c(re);M.texture2d[te.id]=te}M.colorgroup={};let B=I.querySelectorAll("colorgroup");for(let q=0;q<B.length;q++){let re=B[q],te=u(re);M.colorgroup[te.id]=te}M.pbmetallicdisplayproperties={};let j=I.querySelectorAll("pbmetallicdisplayproperties");for(let q=0;q<j.length;q++){let re=j[q],te=h(re);M.pbmetallicdisplayproperties[te.id]=te}M.texture2dgroup={};let z=I.querySelectorAll("texture2dgroup");for(let q=0;q<z.length;q++){let re=z[q],te=l(re);M.texture2dgroup[te.id]=te}M.object={};let fe=I.querySelectorAll("object");for(let q=0;q<fe.length;q++){let re=fe[q],te=x(re);M.object[te.id]=te}return M}function v(I){let M=[],T=I.querySelectorAll("item");for(let S=0;S<T.length;S++){let B=T[S],j={objectId:B.getAttribute("objectid")},z=B.getAttribute("transform");z&&(j.transform=d(z)),M.push(j)}return M}function y(I){let M={unit:I.getAttribute("unit")||"millimeter"},T=I.querySelectorAll("metadata");T&&(M.metadata=o(T));let S=I.querySelector("resources");S&&(M.resources=_(S));let B=I.querySelector("build");return B&&(M.build=v(B)),M}function w(I,M,T,S){let B=I.texid,z=T.resources.texture2d[B];if(z){let fe=S[z.path],q=z.contenttype,re=new Blob([fe],{type:q}),te=URL.createObjectURL(re),ge=n.load(te,function(){URL.revokeObjectURL(te)});switch(ge.encoding=It,z.tilestyleu){case"wrap":ge.wrapS=$t;break;case"mirror":ge.wrapS=pa;break;case"none":case"clamp":ge.wrapS=Wt;break;default:ge.wrapS=$t}switch(z.tilestylev){case"wrap":ge.wrapT=$t;break;case"mirror":ge.wrapT=pa;break;case"none":case"clamp":ge.wrapT=Wt;break;default:ge.wrapT=$t}switch(z.filter){case"auto":ge.magFilter=dn,ge.minFilter=br;break;case"linear":ge.magFilter=dn,ge.minFilter=dn;break;case"nearest":ge.magFilter=_n,ge.minFilter=_n;break;default:ge.magFilter=dn,ge.minFilter=br}return ge}else return null}function L(I,M,T,S,B,j,z){let fe=z.pindex,q={};for(let ge=0,xe=M.length;ge<xe;ge++){let we=M[ge],se=we.p1!==void 0?we.p1:fe;q[se]===void 0&&(q[se]=[]),q[se].push(we)}let re=Object.keys(q),te=[];for(let ge=0,xe=re.length;ge<xe;
3285ge++){let we=re[ge],se=q[we],J=I.basematerials[we],Ae=$(J,S,B,j,z,H),Le=new yt,R=[],E=T.vertices;for(let Q=0,K=se.length;Q<K;Q++){let ce=se[Q];R.push(E[ce.v1*3+0]),R.push(E[ce.v1*3+1]),R.push(E[ce.v1*3+2]),R.push(E[ce.v2*3+0]),R.push(E[ce.v2*3+1]),R.push(E[ce.v2*3+2]),R.push(E[ce.v3*3+0]),R.push(E[ce.v3*3+1]),R.push(E[ce.v3*3+2])}Le.setAttribute("position",new je(R,3));let k=new kt(Le,Ae);te.push(k)}return te}function C(I,M,T,S,B,j,z){let fe=new yt,q=[],re=[],te=T.vertices,ge=I.uvs;for(let J=0,Ae=M.length;J<Ae;J++){let Le=M[J];q.push(te[Le.v1*3+0]),q.push(te[Le.v1*3+1]),q.push(te[Le.v1*3+2]),q.push(te[Le.v2*3+0]),q.push(te[Le.v2*3+1]),q.push(te[Le.v2*3+2]),q.push(te[Le.v3*3+0]),q.push(te[Le.v3*3+1]),q.push(te[Le.v3*3+2]),re.push(ge[Le.p1*2+0]),re.push(ge[Le.p1*2+1]),re.push(ge[Le.p2*2+0]),re.push(ge[Le.p2*2+1]),re.push(ge[Le.p3*2+0]),re.push(ge[Le.p3*2+1])}fe.setAttribute("position",new je(q,3)),fe.setAttribute("uv",new je(re,2));let xe=$(I,S,B,j,z,w),we=new Qt({map:xe,flatShading:!0});return new kt(fe,we)}function b(I,M,T,S){let B=new yt,j=[],z=[],fe=T.vertices,q=I.colors;for(let ge=0,xe=M.length;ge<xe;ge++){let we=M[ge],se=we.v1,J=we.v2,Ae=we.v3;j.push(fe[se*3+0]),j.push(fe[se*3+1]),j.push(fe[se*3+2]),j.push(fe[J*3+0]),j.push(fe[J*3+1]),j.push(fe[J*3+2]),j.push(fe[Ae*3+0]),j.push(fe[Ae*3+1]),j.push(fe[Ae*3+2]);let Le=we.p1!==void 0?we.p1:S.pindex,R=we.p2!==void 0?we.p2:Le,E=we.p3!==void 0?we.p3:Le;z.push(q[Le*3+0]),z.push(q[Le*3+1]),z.push(q[Le*3+2]),z.push(q[R*3+0]),z.pu
3285sh(q[R*3+1]),z.push(q[R*3+2]),z.push(q[E*3+0]),z.push(q[E*3+1]),z.push(q[E*3+2])}B.setAttribute("position",new je(j,3)),B.setAttribute("color",new je(z,3));let re=new Qt({vertexColors:!0,flatShading:!0});return new kt(B,re)}function A(I){let M=new yt;M.setIndex(new Fn(I.triangles,1)),M.setAttribute("position",new Fn(I.vertices,3));let T=new Qt({color:16777215,flatShading:!0});return new kt(M,T)}function N(I,M,T,S,B,j){let z=Object.keys(I),fe=[];for(let q=0,re=z.length;q<re;q++){let te=z[q],ge=I[te];switch(G(te,S)){case"material":let we=S.resources.basematerials[te],se=L(we,ge,M,T,S,B,j);for(let Le=0,R=se.length;Le<R;Le++)fe.push(se[Le]);break;case"texture":let J=S.resources.texture2dgroup[te];fe.push(C(J,ge,M,T,S,B,j));break;case"vertexColors":let Ae=S.resources.colorgroup[te];fe.push(b(Ae,ge,M,j));break;case"default":fe.push(A(M));break;default:console.error("THREE.3MFLoader: Unsupported resource type.")}}if(j.name)for(let q=0;q<fe.length;q++)fe[q].name=j.name;return fe}function G(I,M){return M.resources.texture2dgroup[I]!==void 0?"texture":M.resources.basematerials[I]!==void 0?"material":M.resources.colorgroup[I]!==void 0?"vertexColors":I==="default"?"default":void 0}function F(I,M){let T={},S=I.triangleProperties,B=M.pid;for(let j=0,z=S.length;j<z;j++){let fe=S[j],q=fe.pid!==void 0?fe.pid:B;q===void 0&&(q="default"),T[q]===void 0&&(T[q]=[]),T[q].push(fe)}return T}function U(I,M,T,S,B){let j=new bn,z=F(I,B),fe=N(z,I,M,T,S,B);for(let q=0,re=fe.length;q<re;q++)j.add(fe[q]);return j}function P(I,M,T){if(!I)return;let S=[],B=Object.keys(I);for(let j=0;j<B.length;j++){let z=B[j];for(let fe=0;fe<t.availableExtensions.length;fe++){let q=t.availableExtensions[fe];q.ns===z&&S.push(q)}}for(let j=0;j<S.length;j++){let z=S[j];z.apply(T,I[z.ns],M)}}function $(I,M,T,S,B,j){return I.build!==void 0||(I.build=j(I,M,T,S,B)),I.build}function H(I,M,T){let S,B=I.displaypropertiesid,j=T.resources.pbmetallicdisplayproperties;if(B!==null&&j[B]!==void 0){let re=j[B].data[I.index];S=new Ts({flatShading:!0,roughness:re.roughness,metalness:re.metallicness})}else S=new Qt({flatShading:!0});S.name=I.name;let z=I.displaycolor,fe=z.substring(0,7);return S.color.setStyle(fe),S.color.convertSRGBToLinear(),z.length===9&&(S.opacity=parseInt(z.charAt(7)+z.charAt(8),16)/255),S}function Z(I,M,T,S){let B=new bn;for(let j=0;j<I.length;j++){let z=I[j],fe=M[z.objectId];fe===void 0&&(W(z.objectId,M,T,S),fe=M[z.objectId]);let q=fe.clone(),re=z.transform;re&&q.applyMatrix4(re),B.add(q)}return B}function W(I,M,T,S){let B=T.resources.object[I];if(B.mesh){let j=B.mesh,z=T.extensions,fe=T.xml;P(z,j,fe),M[B.id]=$(j,M,T,S,B,U)}else{let j=B.components;M[B.id]=$(j,M,T,S,B,Z)}B.name&&(M[B.id].name=B.name)}function oe(I){let M=I.model,T=I.modelRels,S={},B=Object.keys(M),j={};if(T)for(let z=0,fe=T.length;z<fe;z++){let q=T[z],re=q.target.substring(1);I.texture[re]&&(j[q.target]=I.texture[re])}for(let z=0;z<B.length;z++){let fe=B[z],q=M[fe],re=Object.keys(q.resources.object);for(let te=0;te<re.length;te++){let ge=re[te];W(ge,S,q,j)}}return S}function ue(I){for(let M=0;M<I.length;M++){let T=I[M];if(T.target.split(".").pop().toLowerCase()==="model")return T}}function ne(I,M){let T=new bn,S=ue(M.rels),B=M.model[S.target.substring(1)].build;for(let j=0;j<B.length;j++){let z=B[j],fe=I[z.objectId].clone(),q=z.transform;q&&fe.applyMatrix4(q),T.add(fe)}return T}let le=i(e),he=oe(le);return ne(he,le)}addExtension(e){this.availableExtensions.push(e)}};var Sr=class extends zt{constructor(){super()}CreateLoader(e){return null}GetMainObject(e){return e}IsMeshVisible(e){return!0}ClearContent(){this.loader=null,this.materialIdToIndex=null,this.objectUrlToFileName=null}ResetContent(){this.loader=null,this.materialIdToIndex=new Map,this.objectUrlToFileName=new Map}ImportContent(e,t){this.LoadModel(e,t)}LoadModel(e,t){let n=!1,i=new nc(()=>{n=!0}),s=zs(e);i.setURLModifier(a=>{if(a===s)return a;let c=xn(a);if(rr(a).length>0){let u=this.callbacks.getFileBuffer(a);if(u!==null){let h=zs(u);return this.objectUrlToFileName.set(h,c),h}}return a});let o=this.CreateLoader(i);if(o===null){t();return}o.load(s,a=>{Wc(()=>n?(this.OnThreeObjectsLoaded(a,t),!1):!0)},()=>{},a=>{this.SetError(a),t()})}OnThreeObjectsLoaded(e,t){function n(a){let c=new Gt().CreateIdentity();return a.updateMatrix(),a.matrix!==void 0&&a.matrix!==null&&c.Set(a.matrix.elements),new Yt(c)}function i(a,c,l,u){let h=new In;l.name!==void 0&&h.SetName(l.name),h.SetTransformation(n(l)),u.AddChildNode(h);for(let f of l.children)i(a,c,f,h);if(l.isMesh&&a.IsMeshVisible(l)){l.children.length===0&&h.SetType(gi.MeshNode);let f=a.ConvertThreeMesh(l),p=c.AddMesh(f);h.AddMeshIndex(p)}}let s=this.GetMainObject(e),o=this.model.GetRootNode();o.SetTransformation(n(s));for(let a of s.children)i(this,this.model,a,o);t()}ConvertThreeMesh(e){let t=null;if(Array.isArray(e.material)){if(t=Ki(e.geometry,null),e.geometry.attributes.color===void 0||e.geometry.attributes.color===null){let n=[];for(let i=0;i<e.material.length;i++){let s=e.material[i],o=this.FindOrCreateMaterial(s);n.push(o)}for(let i=0;i<e.geometry.groups.length;i++){let s=e.geometry.groups[i],o=null;s.count===1/0?o=t.TriangleCount():o=s.start/3+s.count/3;for(let a=s.start/3;a<o;a++)t.GetTriangle(a).SetMaterial(n[s.materialIndex])}}}else{let n=this.FindOrCreateMaterial(e.material);t=Ki(e.geometry,n)}return e.name!==void 0&&e.name!==null&&t.SetName(e.name),t}FindOrCreateMaterial(e){if(this.materialIdToIndex.has(e.id))return this.materialIdToIndex.get(e.id);let t=this.ConvertThreeMaterial(e),n=this.model.AddMaterial(t);return this.materialIdToIndex.set(e.id,n),n}ConvertThreeMaterial(e){function t(i,s){function o(a){if(a.data!==void 0&&a.data!==null){let c=new ImageData(a.width,a.height),l=a.width*a.height*4;for(let u=0;u<l;u++)c.data[u]=a.data[u];return ro.getDataURL(c)}else return ro.getDataURL(a)}if(i==null||i.image===void 0||i.image===null)return null;try{let a=o(i.image),c=Gs(a),l=new ni,u=null;return s.has(i.image.src)?u=s.get(i.image.src):i.name!==void 0&&i.name!==null?u=i.name+"."+rs(c.mimeType):u="Embedded_"+i.id.toString()+"."+rs(c.mimeType),l.name=u,l.mimeType=c.mimeType,l.buffer=c.buffer,l.rotation=i.rotation,l.offset.x=i.offset.x,l.offset.y=i.offset.y,l.scale.x=i.repeat.x,l.scale.y=i.repeat.y,l}catch{return null}}let n=new un;return n.name=e.name,n.color=Ca(e.color),n.opacity=e.opacity,n.transparent=e.transparent,n.alphaTest=e.alphaTest,e.type==="MeshPhongMaterial"&&(n.specular=Ca(e.specular),n.shininess=e.shininess/100),n.diffuseMap=t(e.map,this.objectUrlToFileName),n.normalMap=t(e.normalMap,this.objectUrlToFileName),n.bumpMap=t(e.bumpMap,this.objectUrlToFileName),n}},Qa=class extends Sr{constructor(){super()}CanImportExtension(e){return e==="fbx"}GetUpDirection(){return ct.Y}CreateLoader(e){return e.addHandler(/\.tga$/i,new Cs(e)),new Ah(e)}GetMainObject(e){return e}},el=class extends Sr{constructor(){super()}CanImportExtension(e){return e==="dae"}GetUpDirection(){return ct.Y}CreateLoader(e){return e.addHandler(/\.tga$/i,new Cs(e)),new Rh(e)}
3285GetMainObject(e){return e.scene}},tl=class extends Sr{constructor(){super()}CanImportExtension(e){return e==="wrl"}GetUpDirection(){return ct.Y}CreateLoader(e){return new kh(e)}GetMainObject(e){return e}IsMeshVisible(e){let t=!0;if(Array.isArray(e.material)){for(let n=0;n<e.material.length;n++)if(e.material[n].side===Pn){t=!1;break}}else t=e.material.side!==Pn;return t}},nl=class extends Sr{constructor(){super()}CanImportExtension(e){return e==="3mf"}GetUpDirection(){return ct.Z}CreateLoader(e){return new Fh(e)}GetMainObject(e){return e}};var bi=Uint8Array,go=Uint16Array,yx=Uint32Array,vx=new bi([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]),_x=new bi([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]),kw=new bi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bx=function(r,e){for(var t=new go(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new yx(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return[t,i]},Tx=bx(vx,2),Mx=Tx[0],Fw=Tx[1];Mx[28]=258,Fw[258]=28;var wx=bx(_x,0),Uw=wx[0],OR=wx[1],Cp=new go(32768);for(Dt=0;Dt<32768;++Dt)Jr=(Dt&43690)>>>1|(Dt&21845)<<1,Jr=(Jr&52428)>>>2|(Jr&13107)<<2,Jr=(Jr&61680)>>>4|(Jr&3855)<<4,Cp[Dt]=((Jr&65280)>>>8|(Jr&255)<<8)>>>1;var Jr,Dt,yc=function(r,e,t){for(var n=r.length,i=0,s=new go(e);i<n;++i)r[i]&&++s[r[i]-1];var o=new go(e);for(i=0;i<e;++i)o[i]=o[i-1]+s[i-1]<<1;var a;if(t){a=new go(1<<e);var c=15-e;for(i=0;i<n;++i)if(r[i])for(var l=i<<4|r[i],u=e-r[i],h=o[r[i]-1]++<<u,f=h|(1<<u)-1;h<=f;++h)a[Cp[h]>>>c]=l}else for(a=new go(n),i=0;i<n;++i)r[i]&&(a[i]=Cp[o[r[i]-1]++]>>>15-r[i]);return a},vc=new bi(288);for(Dt=0;Dt<144;++Dt)vc[Dt]=8;var Dt;for(Dt=144;Dt<256;++Dt)vc[Dt]=9;var Dt;for(Dt=256;Dt<280;++Dt)vc[Dt]=7;var Dt;for(Dt=280;Dt<288;++Dt)vc[Dt]=8;var Dt,Sx=new bi(32);for(Dt=0;Dt<32;++Dt)Sx[Dt]=5;var Dt;var Bw=yc(vc,9,1);var Gw=yc(Sx,5,1),Sp=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},er=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t},Ep=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},zw=function(r){return(r+7)/8|0},Rp=function(r,e,t){(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var n=new(r.BYTES_PER_ELEMENT==2?go:r.BYTES_PER_ELEMENT==4?yx:bi)(t-e);return n.set(r.subarray(e,t)),n};
3285var Vw=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],tr=function(r,e,t){var n=new Error(e||Vw[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,tr),!t)throw n;return n},Hw=function(r,e,t){var n=r.length;if(!n||t&&t.f&&!t.l)return e||new bi(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new bi(n*3));var o=function(T){var S=e.length;if(T>S){var B=new bi(Math.max(S*2,T));B.set(e),e=B}},a=t.f||0,c=t.p||0,l=t.b||0,u=t.l,h=t.d,f=t.m,p=t.n,g=n*8;do{if(!u){a=er(r,c,1);var m=er(r,c+1,3);if(c+=3,m)if(m==1)u=Bw,h=Gw,f=9,p=5;else if(m==2){var v=er(r,c,31)+257,y=er(r,c+10,15)+4,w=v+er(r,c+5,31)+1;c+=14;for(var L=new bi(w),C=new bi(19),b=0;b<y;++b)C[kw[b]]=er(r,c+b*3,7);c+=y*3;for(var A=Sp(C),N=(1<<A)-1,G=yc(C,A,1),b=0;b<w;){var F=G[er(r,c,N)];c+=F&15;var d=F>>>4;if(d<16)L[b++]=d;else{var U=0,P=0;for(d==16?(P=3+er(r,c,3),c+=2,U=L[b-1]):d==17?(P=3+er(r,c,7),c+=3):d==18&&(P=11+er(r,c,127),c+=7);P--;)L[b++]=U}}var $=L.subarray(0,v),H=L.subarray(v);f=Sp($),p=Sp(H),u=yc($,f,1),h=yc(H,p,1)}else tr(1);else{var d=zw(c)+4,x=r[d-4]|r[d-3]<<8,_=d+x;if(_>n){s&&tr(0);break}i&&o(l+x),e.set(r.subarray(d,_),l),t.b=l+=x,t.p=c=_*8,t.f=a;continue}if(c>g){s&&tr(0);break}}i&&o(l+131072);for(var Z=(1<<f)-1,W=(1<<p)-1,oe=c;;oe=c){var U=u[Ep(r,c)&Z],ue=U>>>4;if(c+=U&15,c>g){s&&tr(0);break}if(U||tr(2),ue<256)e[l++]=ue;else if(ue==256){oe=c,u=null;break}else{var ne=ue-254;if(ue>264){var b=ue-257,le=vx[b];ne=er(r,c,(1<<le)-1)+Mx[b],c+=le}var he=h[Ep(r,c)&W],I=he>>>4;he||tr(3),c+=he&15;var H=Uw[I];if(I>3){var le=_x[I];H+=Ep(r,c)&(1<<le)-1,c+=le}if(c>g){s&&tr(0);break}i&&o(l+131072);for(var M=l+ne;l<M;l+=4)e[l]=e[l-H],e[l+1]=e[l+1-H],e[l+2]=e[l+2-H],e[l+3]=e[l+3-H];l=M}}t.l=u,t.p=oe,t.b=l,t.f=a,u&&(a=1,t.m=f,t.d=h,t.n=p)}while(!a);return l==e.length?e:Rp(e,0,l)};var Ww=new bi(0);var Er=function(r,e){return r[e]|r[e+1]<<8},nr=function(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0},Ap=function(r,e){return nr(r,e)+nr(r,e+4)*4294967296};function jw(r,e){return Hw(r,e)}var Ip=typeof TextDecoder<"u"&&new TextDecoder,qw=0;try{Ip.decode(Ww,{stream:!0}),qw=1}catch{}var Xw=function(r){for(var e="",t=0;;){var n=r[t++],i=(n>127)+(n>223)+(n>239);if(t+i>r.length)return[e,Rp(r,t-1)];i?i==3?(n=((n&15)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,e+=String.fromCharCode(55296|n>>10,56320|n&1023)):i&1?e+=String.fromCharCode((n&31)<<6|r[t++]&63):e+=String.fromCharCode((n&15)<<12|(r[t++]&63)<<6|r[t++]&63):e+=String.fromCharCode(n)}};function Yw(r,e){if(e){for(var t="",n=0;n<r.length;n+=16384)t+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return t}else{if(Ip)return Ip.decode(r);var i=Xw(r),s=i[0],o=i[1];return o.length&&tr(8),s}}var Zw=function(r,e){return e+30+Er(r,e+26)+Er(r,e+28)},Kw=function(r,e,t){var n=Er(r,e+28),i=Yw(r.subarray(e+46,e+46+n),!(Er(r,e+8)&2048)),s=e+46+n,o=nr(r,e+20),a=t&&o==4294967295?Jw(r,s):[o,nr(r,e+24),nr(r,e+42)],c=a[0],l=a[1],u=a[2];return[Er(r,e+10),c,l,i,s+Er(r,e+30)+Er(r,e+32),u]},Jw=function(r,e){for(;Er(r,e)!=1;e+=4+Er(r,e+2));return[Ap(r,e+12),Ap(r,e+4),Ap(r,e+20)]};function Uh(r,e){for(var t={},n=r.length-22;nr(r,n)!=101010256;--n)(!n||r.length-n>65558)&&tr(13);var i=Er(r,n+8);if(!i)return{};var s=nr(r,n+16),o=s==4294967295||i==65535;if(o){var a=nr(r,n-12);o=nr(r,a)==101075792,o&&(i=nr(r,a+32),s=nr(r,a+48))}for(var c=e&&e.filter,l=0;l<i;++l){var u=Kw(r,s,o),h=u[0],f=u[1],p=u[2],g=u[3],m=u[4],d=u[5],x=Zw(r,d);s=m,(!c||c({name:g,size:f,originalSize:p,compression:h}))&&(h?h==8?t[g]=jw(r.subarray(x,x+f),new bi(p)):tr(14,"unknown compression type "+h):t[g]=Rp(r,x,x+f))}return t}var Pp={Success:0,NoDocumentXml:1},Lp=class{constructor(e,t){this.name=e,this.type=t,this.shapeName=null,this.isVisible=!1,this.color=null,this.fileName=null,this.fileContent=null,this.inLinkCount=0,this.properties=null}IsConvertible(){return!(this.fileName===null||this.fileContent===null||!this.isVisible||this.inLinkCount>0)}},Np=class{constructor(){this.files=null,this.properties=null,this.objectNames=[],this.objectData=new Map}Init(e){let t=new Uint8Array(e);return this.files=Uh(t),this.LoadDocumentXml()?(this.LoadGuiDocumentXml(),Pp.Success):Pp.NoDocumentXml}GetObjectListToConvert(){let e=[];for(let t of this.objectNames){let n=this.objectData.get(t);n.IsConvertible()&&e.push(n)}return e}IsSupportedType(e){return!(!e.startsWith("Part::")&&!e.startsWith("PartDesign::")||e.indexOf("Part2D")!==-1)}HasFile(e){return e in this.files}LoadDocumentXml(){let e=this.GetXMLContent("Document.xml");
3285if(e===null)return!1;this.properties=new Cn("Properties");let t=e.getElementsByTagName("Document");for(let s of t)for(let o of s.childNodes)o.tagName==="Properties"&&this.GetPropertiesFromElement(o,this.properties);let n=e.getElementsByTagName("Objects");for(let s of n){let o=s.getElementsByTagName("Object");for(let a of o){let c=a.getAttribute("name"),l=a.getAttribute("type");if(!this.IsSupportedType(l))continue;let u=new Lp(c,l);this.objectNames.push(c),this.objectData.set(c,u)}}let i=e.getElementsByTagName("ObjectData");for(let s of i){let o=s.getElementsByTagName("Object");for(let a of o){let c=a.getAttribute("name");if(!this.objectData.has(c))continue;let l=this.objectData.get(c);l.properties=new Cn("Properties");for(let f of a.childNodes)f.tagName==="Properties"&&this.GetPropertiesFromElement(f,l.properties);let u=a.getElementsByTagName("Property");for(let f of u){let p=f.getAttribute("name");if(p==="Label")l.shapeName=this.GetFirstChildValue(f,"String","value");else if(p==="Visibility"){let g=this.GetFirstChildValue(f,"Bool","value");l.isVisible=g==="true"}else if(p==="Visible"){let g=this.GetFirstChildValue(f,"Bool","value");l.isVisible=g==="true"}else if(p==="Shape"){let g=this.GetFirstChildValue(f,"Part","file");if(!this.HasFile(g))continue;let m=rr(g);if(m!=="brp"&&m!=="brep")continue;l.fileName=g,l.fileContent=this.files[g]}}let h=a.getElementsByTagName("Link");for(let f of h){let p=f.getAttribute("value");if(this.objectData.has(p)){let g=this.objectData.get(p);g.inLinkCount+=1}}}}return!0}LoadGuiDocumentXml(){let e=this.GetXMLContent("GuiDocument.xml");if(e===null)return!1;let t=e.getElementsByTagName("ViewProvider");for(let n of t){let i=n.getAttribute("name");if(!this.objectData.has(i))continue;let s=this.objectData.get(i),o=n.getElementsByTagName("Property");for(let a of o){let c=a.getAttribute("name");if(c==="Visibility"){let l=this.GetFirstChildValue(a,"Bool","value");s.isVisible=l==="true"}else if(c==="ShapeColor"){let l=this.GetFirstChildValue(a,"PropertyColor","value"),u=parseInt(l,10);s.color=new or(u>>24&255,u>>16&255,u>>8&255,255)}}}return!0}GetPropertiesFromElement(e,t){let n=e.getElementsByTagName("Property");for(let i of n){let s=i.getAttribute("name"),o=i.getAttribute("type"),a=null;if(o==="App::PropertyBool"){let c=this.GetFirstChildValue(i,"String","bool");c!==null&&c.length>0&&(a=new Xt(Ht.Boolean,s,c==="true"))}else if(o==="App::PropertyInteger"){let c=this.GetFirstChildValue(i,"Integer","value");c!==null&&c.length>0&&(a=new Xt(Ht.Integer,s,parseInt(c)))}else if(o==="App::PropertyString"){let c=this.GetFirstChildValue(i,"String","value");c!==null&&c.length>0&&(a=new Xt(Ht.Text,s,c))}else if(o==="App::PropertyUUID"){let c=this.GetFirstChildValue(i,"Uuid","value");c!==null&&c.length>0&&(a=new Xt(Ht.Text,s,c))}else if(o==="App::PropertyFloat"||o==="App::PropertyLength"||o==="App::PropertyDistance"||o==="App::PropertyArea"||o==="App::PropertyVolume"){let c=this.GetFirstChildValue(i,"Float","value");c!==null&&c.length>0&&(a=new Xt(Ht.Number,s,parseFloat(c)))}a!==null&&t.AddProperty(a)}}GetXMLContent(e){if(!this.HasFile(e))return null;let t=new DOMParser,n=hn(this.files[e]);return t.parseFromString(n,"text/xml")}GetFirstChildValue(e,t,n){let i=e.getElementsByTagName(t);return i.length===0?null:i[0].getAttribute(n)}},il=class extends zt{constructor(){super(),this.worker=null,this.document=null}CanImportExtension(e){return e==="fcstd"}GetUpDirection(){return ct.Z}ClearContent(){this.worker!==null&&(this.worker.terminate(),this.worker=null),this.document=null}ResetContent(){this.worker=null,this.document=new Np}ImportContent(e,t){if(this.document.Init(e)===Pp.NoDocumentXml){this.SetError("No Document.xml found."),t();return}this.document.properties!==null&&this.document.properties.PropertyCount()>0&&this.model.AddPropertyGroup(this.document.properties);let i=this.document.GetObjectListToConvert();if(i.length===0){this.SetError("No importable object found."),t();return}this.ConvertObjects(i,t)}ConvertObjects(e,t){let n=ks("loaders/occt-import-js-worker.js");this.worker=new Worker(n);let i=0,s=new li(this.model),o=c=>{if(c!==null){let l=e[i];this.OnFileConverted(l,c,s)}if(i+=1,i===e.length)t();else{let l=e[i];this.worker.postMessage({format:"brep",buffer:l.fileContent})}};this.worker.addEventListener("message",c=>{o(c.data)}),this.worker.addEventListener("error",c=>{o(null)});let a=e[i];this.worker.postMessage({format:"brep",buffer:a.fileContent})}
3285OnFileConverted(e,t,n){if(!t.success||t.meshes.length===0)return;let i=new In;i.SetType(gi.GroupNode),e.shapeName!==null&&i.SetName(e.shapeName);let s=1;for(let a of t.meshes){let c=null;e.color!==null&&(c=n.GetMaterialIndex(e.color.r,e.color.g,e.color.b,e.color.a));let l=Ki(a,c);if(e.shapeName!==null){let h=s.toString().padStart(3,"0");l.SetName(e.shapeName+" "+h)}e.properties!==null&&e.properties.PropertyCount()>0&&l.AddPropertyGroup(e.properties);let u=this.model.AddMesh(l);i.AddMeshIndex(u),s+=1}this.model.GetRootNode().AddChildNode(i)}};var rl=class{constructor(){this.defaultColor=new dt(200,200,200)}},Ar={NoImportableFile:1,FailedToLoadFile:2,ImportFailed:3,UnknownError:4},Ls=class{constructor(e){this.code=e,this.mainFile=null,this.message=null}},_c=class{constructor(){this.model=null,this.mainFile=null,this.upVector=null,this.usedFiles=null,this.missingFiles=null}},bc=class{constructor(e){this.getBufferCallback=e,this.fileBuffers=new Map}GetFileBuffer(e){let t=xn(e);if(this.fileBuffers.has(t))return this.fileBuffers.get(t);let n=this.getBufferCallback(t);return this.fileBuffers.set(t,n),n}},sl=class{constructor(){this.importers=[new Na,new Fa,new Oa,new Da,new Ra,new Pa,new Ua,new Ia,new La,new ka,new il,new Qa,new el,new tl,new nl],this.fileList=new qs,this.model=null,this.usedFiles=[],this.missingFiles=[]}AddImporter(e){this.importers.push(e)}ImportFiles(e,t,n){n.onLoadStart(),this.LoadFiles(e,{onReady:()=>{n.onImportStart(),xl(()=>{this.DecompressArchives(this.fileList,()=>{this.ImportLoadedFiles(t,n)})})},onFileListProgress:n.onFileListProgress,onFileLoadProgress:n.onFileLoadProgress})}LoadFiles(e,t){let n=new qs;n.FillFromInputFiles(e);let i=!1;if(this.HasImportableFile(n))i=!0;else{let s=!1;for(let o=0;o<this.missingFiles.length;o++){let a=this.missingFiles[o];n.ContainsFileByPath(a)&&(s=!0)}s?(this.fileList.ExtendFromFileList(n),i=!1):i=!0}i&&(this.fileList=n),this.fileList.GetContent({onReady:t.onReady,onFileListProgress:t.onFileListProgress,onFileLoadProgress:t.onFileLoadProgress})}ImportLoadedFiles(e,t){let n=this.GetImportableFiles(this.fileList);if(n.length===0){t.onImportError(new Ls(Ar.NoImportableFile));return}if(n.length===1||!t.onSelectMainFile){let i=n[0];this.ImportLoadedMainFile(i,e,t)}else{let i=n.map(s=>s.file.name);t.onSelectMainFile(i,s=>{if(s===null){t.onImportError(new Ls(Ar.NoImportableFile));return}xl(()=>{let o=n[s];this.ImportLoadedMainFile(o,e,t)})})}}ImportLoadedMainFile(e,t,n){if(e===null||e.file===null||e.file.content===null){let o=new Ls(Ar.FailedToLoadFile);e!==null&&e.file!==null&&(o.mainFile=e.file.name),n.onImportError(o);return}this.model=null,this.usedFiles=[],this.missingFiles=[],this.usedFiles.push(e.file.name);let i=e.importer,s=new bc(o=>{let a=null,c=this.fileList.FindFileByPath(o);return c===null||c.content===null?(this.missingFiles.push(o),a=null):(this.usedFiles.push(o),a=c.content),a});i.Import(e.file.name,e.file.extension,e.file.content,{getDefaultMaterialColor:()=>t.defaultColor,getFileBuffer:o=>s.GetFileBuffer(o),onSuccess:()=>{this.model=i.GetModel();let o=new _c;o.mainFile=e.file.name,o.model=this.model,o.usedFiles=this.usedFiles,o.missingFiles=this.missingFiles,o.upVector=i.GetUpDirection(),n.onImportSuccess(o)},onError:()=>{let o=new Ls(Ar.ImportFailed);o.mainFile=e.file.name,o.message=i.GetErrorMessage(),n.onImportError(o)},onComplete:()=>{i.Clear()}})}DecompressArchives(e,t){let n=e.GetFiles(),i=[];for(let s of n)s.extension==="zip"&&i.push(s);if(i.length===0){t();return}for(let s=0;s<i.length;s++){let o=i[s],a=new Uint8Array(o.content),c=Uh(a);for(let l in c)if(Object.prototype.hasOwnProperty.call(c,l)){let u=new js(l,Gi.Decompressed,null);u.SetContent(c[l].buffer),e.AddFile(u)}}t()}GetFileList(){return this.fileList}HasImportableFile(e){return this.GetImportableFiles(e).length>0}GetImportableFiles(e){function t(s,o){for(let a=0;a<o.length;a++){let c=o[a];if(c.CanImportExtension(s.extension))return c}return null}let n=[],i=e.GetFiles();for(let s=0;s<i.length;s++){let o=i[s],a=t(o,this.importers);a!==null&&n.push({file:o,importer:a})}return n}};var xo=class extends Un{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,n,i){let s=this,o=new vi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(a))}catch(c){i?i(c):console.error(c),s.manager.itemError(e)}},n,i)}parse(e){let t=this;function n(I,M){if(I.nodeType!==1)return;let T=y(I),S=!1,B=null;switch(I.nodeName){case"svg":M=g(I,M);break;case"style":s(I);break;case"g":M=g(I,M);break;case"path":M=g(I,M),I.hasAttribute("d")&&(B=i(I));break;
3285case"rect":M=g(I,M),B=c(I);break;case"polygon":M=g(I,M),B=l(I);break;case"polyline":M=g(I,M),B=u(I);break;case"circle":M=g(I,M),B=h(I);break;case"ellipse":M=g(I,M),B=f(I);break;case"line":M=g(I,M),B=p(I);break;case"defs":S=!0;break;case"use":M=g(I,M);let fe=(I.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),q=I.viewportElement.getElementById(fe);q?n(q,M):console.warn("SVGLoader: 'use node' references non-existent node id: "+fe);break;default:}B&&(M.fill!==void 0&&M.fill!=="none"&&B.color.setStyle(M.fill),L(B,ne),F.push(B),B.userData={node:I,style:M});let j=I.childNodes;for(let z=0;z<j.length;z++){let fe=j[z];S&&fe.nodeName!=="style"&&fe.nodeName!=="defs"||n(fe,M)}T&&(P.pop(),P.length>0?ne.copy(P[P.length-1]):ne.identity())}function i(I){let M=new _r,T=new Ee,S=new Ee,B=new Ee,j=!0,z=!1,q=I.getAttribute("d").match(/[a-df-z][^a-df-z]*/ig);for(let re=0,te=q.length;re<te;re++){let ge=q[re],xe=ge.charAt(0),we=ge.slice(1).trim();j===!0&&(z=!0,j=!1);let se;switch(xe){case"M":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=2)T.x=se[J+0],T.y=se[J+1],S.x=T.x,S.y=T.y,J===0?M.moveTo(T.x,T.y):M.lineTo(T.x,T.y),J===0&&B.copy(T);break;case"H":se=d(we);for(let J=0,Ae=se.length;J<Ae;J++)T.x=se[J],S.x=T.x,S.y=T.y,M.lineTo(T.x,T.y),J===0&&z===!0&&B.copy(T);break;case"V":se=d(we);for(let J=0,Ae=se.length;J<Ae;J++)T.y=se[J],S.x=T.x,S.y=T.y,M.lineTo(T.x,T.y),J===0&&z===!0&&B.copy(T);break;case"L":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=2)T.x=se[J+0],T.y=se[J+1],S.x=T.x,S.y=T.y,M.lineTo(T.x,T.y),J===0&&z===!0&&B.copy(T);break;case"C":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=6)M.bezierCurveTo(se[J+0],se[J+1],se[J+2],se[J+3],se[J+4],se[J+5]),S.x=se[J+2],S.y=se[J+3],T.x=se[J+4],T.y=se[J+5],J===0&&z===!0&&B.copy(T);break;case"S":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=4)M.bezierCurveTo(m(T.x,S.x),m(T.y,S.y),se[J+0],se[J+1],se[J+2],se[J+3]),S.x=se[J+0],S.y=se[J+1],T.x=se[J+2],T.y=se[J+3],J===0&&z===!0&&B.copy(T);break;case"Q":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=4)M.quadraticCurveTo(se[J+0],se[J+1],se[J+2],se[J+3]),S.x=se[J+0],S.y=se[J+1],T.x=se[J+2],T.y=se[J+3],J===0&&z===!0&&B.copy(T);break;case"T":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=2){let Le=m(T.x,S.x),R=m(T.y,S.y);M.quadraticCurveTo(Le,R,se[J+0],se[J+1]),S.x=Le,S.y=R,T.x=se[J+0],T.y=se[J+1],J===0&&z===!0&&B.copy(T)}break;case"A":se=d(we,[3,4],7);for(let J=0,Ae=se.length;J<Ae;J+=7){if(se[J+5]==T.x&&se[J+6]==T.y)continue;let Le=T.clone();T.x=se[J+5],T.y=se[J+6],S.x=T.x,S.y=T.y,o(M,se[J],se[J+1],se[J+2],se[J+3],se[J+4],Le,T),J===0&&z===!0&&B.copy(T)}break;case"m":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=2)T.x+=se[J+0],T.y+=se[J+1],S.x=T.x,S.y=T.y,J===0?M.moveTo(T.x,T.y):M.lineTo(T.x,T.y),J===0&&B.copy(T);break;case"h":se=d(we);for(let J=0,Ae=se.length;J<Ae;J++)T.x+=se[J],S.x=T.x,S.y=T.y,M.lineTo(T.x,T.y),J===0&&z===!0&&B.copy(T);break;case"v":se=d(we);for(let J=0,Ae=se.length;J<Ae;J++)T.y+=se[J],S.x=T.x,S.y=T.y,M.lineTo(T.x,T.y),J===0&&z===!0&&B.copy(T);break;case"l":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=2)T.x+=se[J+0],T.y+=se[J+1],S.x=T.x,S.y=T.y,M.lineTo(T.x,T.y),J===0&&z===!0&&B.copy(T);break;case"c":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=6)M.bezierCurveTo(T.x+se[J+0],T.y+se[J+1],T.x+se[J+2],T.y+se[J+3],T.x+se[J+4],T.y+se[J+5]),S.x=T.x+se[J+2],S.y=T.y+se[J+3],T.x+=se[J+4],T.y+=se[J+5],J===0&&z===!0&&B.copy(T);break;case"s":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=4)M.bezierCurveTo(m(T.x,S.x),m(T.y,S.y),T.x+se[J+0],T.y+se[J+1],T.x+se[J+2],T.y+se[J+3]),S.x=T.x+se[J+0],S.y=T.y+se[J+1],T.x+=se[J+2],T.y+=se[J+3],J===0&&z===!0&&B.copy(T);break;case"q":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=4)M.quadraticCurveTo(T.x+se[J+0],T.y+se[J+1],T.x+se[J+2],T.y+se[J+3]),S.x=T.x+se[J+0],S.y=T.y+se[J+1],T.x+=se[J+2],T.y+=se[J+3],J===0&&z===!0&&B.copy(T);break;case"t":se=d(we);for(let J=0,Ae=se.length;J<Ae;J+=2){let Le=m(T.x,S.x),R=m(T.y,S.y);M.quadraticCurveTo(Le,R,T.x+se[J+0],T.y+se[J+1]),S.x=Le,S.y=R,T.x=T.x+se[J+0],T.y=T.y+se[J+1],J===0&&z===!0&&B.copy(T)}break;case"a":se=d(we,[3,4],7);for(let J=0,Ae=se.length;J<Ae;J+=7){if(se[J+5]==0&&se[J+6]==0)continue;let Le=T.clone();T.x+=se[J+5],T.y+=se[J+6],S.x=T.x,S.y=T.y,o(M,se[J],se[J+1],se[J+2],se[J+3],se[J+4],Le,T),J===0&&z===!0&&B.copy(T)}break;case"Z":case"z":M.currentPath.autoClose=!0,M.currentPath.curves.length>0&&(T.copy(B),M.currentPath.currentPoint.copy(T),j=!0);break;default:console.warn(ge)}z=!1}return M}function s(I){if(!(!I.sheet||!I.sheet.cssRules||!I.sheet.cssRules.length))for(let M=0;M<I.sheet.cssRules.length;M++){let T=I.sheet.cssRules[M];if(T.type!==1)continue;
3285let S=T.selectorText.split(/,/gm).filter(Boolean).map(B=>B.trim());for(let B=0;B<S.length;B++){let j=Object.fromEntries(Object.entries(T.style).filter(([,z])=>z!==""));U[S[B]]=Object.assign(U[S[B]]||{},j)}}}function o(I,M,T,S,B,j,z,fe){if(M==0||T==0){I.lineTo(fe.x,fe.y);return}S=S*Math.PI/180,M=Math.abs(M),T=Math.abs(T);let q=(z.x-fe.x)/2,re=(z.y-fe.y)/2,te=Math.cos(S)*q+Math.sin(S)*re,ge=-Math.sin(S)*q+Math.cos(S)*re,xe=M*M,we=T*T,se=te*te,J=ge*ge,Ae=se/xe+J/we;if(Ae>1){let ie=Math.sqrt(Ae);M=ie*M,T=ie*T,xe=M*M,we=T*T}let Le=xe*J+we*se,R=(xe*we-Le)/Le,E=Math.sqrt(Math.max(0,R));B===j&&(E=-E);let k=E*M*ge/T,Q=-E*T*te/M,K=Math.cos(S)*k-Math.sin(S)*Q+(z.x+fe.x)/2,ce=Math.sin(S)*k+Math.cos(S)*Q+(z.y+fe.y)/2,me=a(1,0,(te-k)/M,(ge-Q)/T),pe=a((te-k)/M,(ge-Q)/T,(-te-k)/M,(-ge-Q)/T)%(Math.PI*2);I.currentPath.absellipse(K,ce,M,T,me,me+pe,j===0,S)}function a(I,M,T,S){let B=I*T+M*S,j=Math.sqrt(I*I+M*M)*Math.sqrt(T*T+S*S),z=Math.acos(Math.max(-1,Math.min(1,B/j)));return I*S-M*T<0&&(z=-z),z}function c(I){let M=v(I.getAttribute("x")||0),T=v(I.getAttribute("y")||0),S=v(I.getAttribute("rx")||I.getAttribute("ry")||0),B=v(I.getAttribute("ry")||I.getAttribute("rx")||0),j=v(I.getAttribute("width")),z=v(I.getAttribute("height")),fe=1-.551915024494,q=new _r;return q.moveTo(M+S,T),q.lineTo(M+j-S,T),(S!==0||B!==0)&&q.bezierCurveTo(M+j-S*fe,T,M+j,T+B*fe,M+j,T+B),q.lineTo(M+j,T+z-B),(S!==0||B!==0)&&q.bezierCurveTo(M+j,T+z-B*fe,M+j-S*fe,T+z,M+j-S,T+z),q.lineTo(M+S,T+z),(S!==0||B!==0)&&q.bezierCurveTo(M+S*fe,T+z,M,T+z-B*fe,M,T+z-B),q.lineTo(M,T+B),(S!==0||B!==0)&&q.bezierCurveTo(M,T+B*fe,M+S*fe,T,M+S,T),q}function l(I){function M(j,z,fe){let q=v(z),re=v(fe);B===0?S.moveTo(q,re):S.lineTo(q,re),B++}let T=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,S=new _r,B=0;return I.getAttribute("points").replace(T,M),S.currentPath.autoClose=!0,S}function u(I){function M(j,z,fe){let q=v(z),re=v(fe);B===0?S.moveTo(q,re):S.lineTo(q,re),B++}let T=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,S=new _r,B=0;return I.getAttribute("points").replace(T,M),S.currentPath.autoClose=!1,S}function h(I){let M=v(I.getAttribute("cx")||0),T=v(I.getAttribute("cy")||0),S=v(I.getAttribute("r")||0),B=new jr;B.absarc(M,T,S,0,Math.PI*2);let j=new _r;return j.subPaths.push(B),j}function f(I){let M=v(I.getAttribute("cx")||0),T=v(I.getAttribute("cy")||0),S=v(I.getAttribute("rx")||0),B=v(I.getAttribute("ry")||0),j=new jr;j.absellipse(M,T,S,B,0,Math.PI*2);let z=new _r;return z.subPaths.push(j),z}function p(I){let M=v(I.getAttribute("x1")||0),T=v(I.getAttribute("y1")||0),S=v(I.getAttribute("x2")||0),B=v(I.getAttribute("y2")||0),j=new _r;return j.moveTo(M,T),j.lineTo(S,B),j.currentPath.autoClose=!1,j}function g(I,M){M=Object.assign({},M);let T={};if(I.hasAttribute("class")){let z=I.getAttribute("class").split(/\s/).filter(Boolean).map(fe=>fe.trim());for(let fe=0;fe<z.length;fe++)T=Object.assign(T,U["."+z[fe]])}I.hasAttribute("id")&&(T=Object.assign(T,U["#"+I.getAttribute("id")]));function S(z,fe,q){q===void 0&&(q=function(te){return te.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),te}),I.hasAttribute(z)&&(M[fe]=q(I.getAttribute(z))),T[z]&&(M[fe]=q(T[z])),I.style&&I.style[z]!==""&&(M[fe]=q(I.style[z]))}function B(z){return Math.max(0,Math.min(1,v(z)))}function j(z){return Math.max(0,v(z))}return S("fill","fill"),S("fill-opacity","fillOpacity",B),S("fill-rule","fillRule"),S("opacity","opacity",B),S("stroke","stroke"),S("stroke-opacity","strokeOpacity",B),S("stroke-width","strokeWidth",j),S("stroke-linejoin","strokeLineJoin"),S("stroke-linecap","strokeLineCap"),S("stroke-miterlimit","strokeMiterLimit",j),S("visibility","visibility"),M}function m(I,M){return I-(M-I)}function d(I,M,T){if(typeof I!="string")throw new TypeError("Invalid input: "+typeof I);let S={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},B=0,j=1,z=2,fe=3,q=B,re=!0,te="",ge="",xe=[];function we(Le,R,E){let k=new SyntaxError('Unexpected character "'+Le+'" at index '+R+".");throw k.partial=E,k}function se(){te!==""&&(ge===""?xe.push(Number(te)):xe.push(Number(te)*Math.pow(10,Number(ge)))),te="",ge=""}let J,Ae=I.length;for(let Le=0;Le<Ae;Le++){if(J=I[Le],Array.isArray(M)&&M.includes(xe.length%T)&&S.FLAGS.test(J)){q=j,te=J,se();continue}
3285if(q===B){if(S.WHITESPACE.test(J))continue;if(S.DIGIT.test(J)||S.SIGN.test(J)){q=j,te=J;continue}if(S.POINT.test(J)){q=z,te=J;continue}S.COMMA.test(J)&&(re&&we(J,Le,xe),re=!0)}if(q===j){if(S.DIGIT.test(J)){te+=J;continue}if(S.POINT.test(J)){te+=J,q=z;continue}if(S.EXP.test(J)){q=fe;continue}S.SIGN.test(J)&&te.length===1&&S.SIGN.test(te[0])&&we(J,Le,xe)}if(q===z){if(S.DIGIT.test(J)){te+=J;continue}if(S.EXP.test(J)){q=fe;continue}S.POINT.test(J)&&te[te.length-1]==="."&&we(J,Le,xe)}if(q===fe){if(S.DIGIT.test(J)){ge+=J;continue}if(S.SIGN.test(J)){if(ge===""){ge+=J;continue}ge.length===1&&S.SIGN.test(ge)&&we(J,Le,xe)}}S.WHITESPACE.test(J)?(se(),q=B,re=!1):S.COMMA.test(J)?(se(),q=B,re=!0):S.SIGN.test(J)?(se(),q=j,te=J):S.POINT.test(J)?(se(),q=z,te=J):we(J,Le,xe)}return se(),xe}let x=["mm","cm","in","pt","pc","px"],_={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function v(I){let M="px";if(typeof I=="string"||I instanceof String)for(let S=0,B=x.length;S<B;S++){let j=x[S];if(I.endsWith(j)){M=j,I=I.substring(0,I.length-j.length);break}}let T;return M==="px"&&t.defaultUnit!=="px"?T=_.in[t.defaultUnit]/t.defaultDPI:(T=_[M][t.defaultUnit],T<0&&(T=_[M].in*t.defaultDPI)),T*parseFloat(I)}function y(I){if(!(I.hasAttribute("transform")||I.nodeName==="use"&&(I.hasAttribute("x")||I.hasAttribute("y"))))return null;let M=w(I);return P.length>0&&M.premultiply(P[P.length-1]),ne.copy(M),P.push(M),M}function w(I){let M=new Jt,T=$;if(I.nodeName==="use"&&(I.hasAttribute("x")||I.hasAttribute("y"))){let S=v(I.getAttribute("x")),B=v(I.getAttribute("y"));M.translate(S,B)}if(I.hasAttribute("transform")){let S=I.getAttribute("transform").split(")");for(let B=S.length-1;B>=0;B--){let j=S[B].trim();if(j==="")continue;let z=j.indexOf("("),fe=j.length;if(z>0&&z<fe){let q=j.slice(0,z),re=d(j.slice(z+1));switch(T.identity(),q){case"translate":if(re.length>=1){let te=re[0],ge=0;re.length>=2&&(ge=re[1]),T.translate(te,ge)}break;case"rotate":if(re.length>=1){let te=0,ge=0,xe=0;te=re[0]*Math.PI/180,re.length>=3&&(ge=re[1],xe=re[2]),H.makeTranslation(-ge,-xe),Z.makeRotation(te),W.multiplyMatrices(Z,H),H.makeTranslation(ge,xe),T.multiplyMatrices(H,W)}break;case"scale":if(re.length>=1){let te=re[0],ge=te;re.length>=2&&(ge=re[1]),T.scale(te,ge)}break;case"skewX":re.length===1&&T.set(1,Math.tan(re[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":re.length===1&&T.set(1,0,0,Math.tan(re[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":re.length===6&&T.set(re[0],re[2],re[4],re[1],re[3],re[5],0,0,1);break}}M.premultiply(T)}}return M}function L(I,M){function T(z){ue.set(z.x,z.y,1).applyMatrix3(M),z.set(ue.x,ue.y)}function S(z){let fe=z.xRadius,q=z.yRadius,re=Math.cos(z.aRotation),te=Math.sin(z.aRotation),ge=new ae(fe*re,fe*te,0),xe=new ae(-q*te,q*re,0),we=ge.applyMatrix3(M),se=xe.applyMatrix3(M),J=$.set(we.x,se.x,0,we.y,se.y,0,0,0,1),Ae=H.copy(J).invert(),E=Z.copy(Ae).transpose().multiply(Ae).elements,k=G(E[0],E[1],E[4]),Q=Math.sqrt(k.rt1),K=Math.sqrt(k.rt2);if(z.xRadius=1/Q,z.yRadius=1/K,z.aRotation=Math.atan2(k.sn,k.cs),!((z.aEndAngle-z.aStartAngle)%(2*Math.PI)<Number.EPSILON)){let me=H.set(Q,0,0,0,K,0,0,0,1),pe=Z.set(k.cs,k.sn,0,-k.sn,k.cs,0,0,0,1),ie=me.multiply(pe).multiply(J),ve=Te=>{let{x:Pe,y:ke}=new ae(Math.cos(Te),Math.sin(Te),0).applyMatrix3(ie);return Math.atan2(ke,Pe)};z.aStartAngle=ve(z.aStartAngle),z.aEndAngle=ve(z.aEndAngle),C(M)&&(z.aClockwise=!z.aClockwise)}}function B(z){let fe=A(M),q=N(M);z.xRadius*=fe,z.yRadius*=q;let re=fe>Number.EPSILON?Math.atan2(M.elements[1],M.elements[0]):Math.atan2(-M.elements[3],M.elements[4]);z.aRotation+=re,C(M)&&(z.aStartAngle*=-1,z.aEndAngle*=-1,z.aClockwise=!z.aClockwise)}let j=I.subPaths;for(let z=0,fe=j.length;z<fe;z++){let re=j[z].curves;for(let te=0;te<re.length;te++){let ge=re[te];ge.isLineCurve?(T(ge.v1),T(ge.v2)):ge.isCubicBezierCurve?(T(ge.v0),T(ge.v1),T(ge.v2),T(ge.v3)):ge.isQuadraticBezierCurve?(T(ge.v0),T(ge.v1),T(ge.v2)):ge.isEllipseCurve&&(oe.set(ge.aX,ge.aY),T(oe),ge.aX=oe.x,ge.aY=oe.y,b(M)?S(ge):B(ge))}}}function C(I){let M=I.elements;return M[0]*M[4]-M[1]*M[3]<0}
3285function b(I){let M=I.elements,T=M[0]*M[3]+M[1]*M[4];if(T===0)return!1;let S=A(I),B=N(I);return Math.abs(T/(S*B))>Number.EPSILON}function A(I){let M=I.elements;return Math.sqrt(M[0]*M[0]+M[1]*M[1])}function N(I){let M=I.elements;return Math.sqrt(M[3]*M[3]+M[4]*M[4])}function G(I,M,T){let S,B,j,z,fe,q=I+T,re=I-T,te=Math.sqrt(re*re+4*M*M);return q>0?(S=.5*(q+te),fe=1/S,B=I*fe*T-M*fe*M):q<0?B=.5*(q-te):(S=.5*te,B=-.5*te),re>0?j=re+te:j=re-te,Math.abs(j)>2*Math.abs(M)?(fe=-2*M/j,z=1/Math.sqrt(1+fe*fe),j=fe*z):Math.abs(M)===0?(j=1,z=0):(fe=-.5*j/M,j=1/Math.sqrt(1+fe*fe),z=fe*j),re>0&&(fe=j,j=-z,z=fe),{rt1:S,rt2:B,cs:j,sn:z}}let F=[],U={},P=[],$=new Jt,H=new Jt,Z=new Jt,W=new Jt,oe=new Ee,ue=new ae,ne=new Jt,le=new DOMParser().parseFromString(e,"image/svg+xml");return n(le.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:F,xml:le.documentElement}}static createShapes(e){let n={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},i={loc:n.ORIGIN,t:0};function s(d,x,_,v){let y=d.x,w=x.x,L=_.x,C=v.x,b=d.y,A=x.y,N=_.y,G=v.y,F=(C-L)*(b-N)-(G-N)*(y-L),U=(w-y)*(b-N)-(A-b)*(y-L),P=(G-N)*(w-y)-(C-L)*(A-b),$=F/P,H=U/P;if(P===0&&F!==0||$<=0||$>=1||H<0||H>1)return null;if(F===0&&P===0){for(let Z=0;Z<2;Z++)if(o(Z===0?_:v,d,x),i.loc==n.ORIGIN){let W=Z===0?_:v;return{x:W.x,y:W.y,t:i.t}}else if(i.loc==n.BETWEEN){let W=+(y+i.t*(w-y)).toPrecision(10),oe=+(b+i.t*(A-b)).toPrecision(10);return{x:W,y:oe,t:i.t}}return null}else{for(let oe=0;oe<2;oe++)if(o(oe===0?_:v,d,x),i.loc==n.ORIGIN){let ue=oe===0?_:v;return{x:ue.x,y:ue.y,t:i.t}}let Z=+(y+$*(w-y)).toPrecision(10),W=+(b+$*(A-b)).toPrecision(10);return{x:Z,y:W,t:$}}}function o(d,x,_){let v=_.x-x.x,y=_.y-x.y,w=d.x-x.x,L=d.y-x.y,C=v*L-w*y;if(d.x===x.x&&d.y===x.y){i.loc=n.ORIGIN,i.t=0;return}if(d.x===_.x&&d.y===_.y){i.loc=n.DESTINATION,i.t=1;return}if(C<-Number.EPSILON){i.loc=n.LEFT;return}if(C>Number.EPSILON){i.loc=n.RIGHT;return}if(v*w<0||y*L<0){i.loc=n.BEHIND;return}if(Math.sqrt(v*v+y*y)<Math.sqrt(w*w+L*L)){i.loc=n.BEYOND;return}let b;v!==0?b=w/v:b=L/y,i.loc=n.BETWEEN,i.t=b}function a(d,x){let _=[],v=[];for(let y=1;y<d.length;y++){let w=d[y-1],L=d[y];for(let C=1;C<x.length;C++){let b=x[C-1],A=x[C],N=s(w,L,b,A);N!==null&&_.find(G=>G.t<=N.t+Number.EPSILON&&G.t>=N.t-Number.EPSILON)===void 0&&(_.push(N),v.push(new Ee(N.x,N.y)))}}return v}function c(d,x,_){let v=new Ee;x.getCenter(v);let y=[];return _.forEach(w=>{w.boundingBox.containsPoint(v)&&a(d,w.points).forEach(C=>{y.push({identifier:w.identifier,isCW:w.isCW,point:C})})}),y.sort((w,L)=>w.point.x-L.point.x),y}function l(d,x,_,v,y){(y==null||y==="")&&(y="nonzero");let w=new Ee;d.boundingBox.getCenter(w);let L=[new Ee(_,w.y),new Ee(v,w.y)],C=c(L,d.boundingBox,x);C.sort((U,P)=>U.point.x-P.point.x);let b=[],A=[];C.forEach(U=>{U.identifier===d.identifier?b.push(U):A.push(U)});let N=b[0].point.x,G=[],F=0;for(;F<A.length&&A[F].point.x<N;)G.length>0&&G[G.length-1]===A[F].identifier?G.pop():G.push(A[F].identifier),F++;
3285if(G.push(d.identifier),y==="evenodd"){let U=G.length%2===0,P=G[G.length-2];return{identifier:d.identifier,isHole:U,for:P}}else if(y==="nonzero"){let U=!0,P=null,$=null;for(let H=0;H<G.length;H++){let Z=G[H];U?($=x[Z].isCW,U=!1,P=Z):$!==x[Z].isCW&&($=x[Z].isCW,U=!0)}return{identifier:d.identifier,isHole:U,for:P}}else console.warn('fill-rule: "'+y+'" is currently not implemented.')}let u=0,h=999999999,f=-999999999,p=e.subPaths.map(d=>{let x=d.getPoints(),_=-999999999,v=999999999,y=-999999999,w=999999999;for(let L=0;L<x.length;L++){let C=x[L];C.y>_&&(_=C.y),C.y<v&&(v=C.y),C.x>y&&(y=C.x),C.x<w&&(w=C.x)}return f<=y&&(f=y+1),h>=w&&(h=w-1),{curves:d.curves,points:x,isCW:Ci.isClockWise(x),identifier:u++,boundingBox:new sh(new Ee(w,v),new Ee(y,_))}});p=p.filter(d=>d.points.length>1);let g=p.map(d=>l(d,p,h,f,e.userData?.style.fillRule)),m=[];return p.forEach(d=>{if(!g[d.identifier].isHole){let _=new gs;_.curves=d.curves,g.filter(y=>y.isHole&&y.for===d.identifier).forEach(y=>{let w=p[y.identifier],L=new jr;L.curves=w.curves,_.holes.push(L)}),m.push(_)}}),m}static getStrokeStyle(e,t,n,i,s){return e=e!==void 0?e:1,t=t!==void 0?t:"#000",n=n!==void 0?n:"miter",i=i!==void 0?i:"butt",s=s!==void 0?s:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:i,strokeMiterLimit:s}}static pointsToStroke(e,t,n,i){let s=[],o=[],a=[];if(xo.pointsToStrokeWithBuffers(e,t,n,i,s,o,a)===0)return null;let c=new yt;return c.setAttribute("position",new je(s,3)),c.setAttribute("normal",new je(o,3)),c.setAttribute("uv",new je(a,2)),c}static pointsToStrokeWithBuffers(e,t,n,i,s,o,a,c){let l=new Ee,u=new Ee,h=new Ee,f=new Ee,p=new Ee,g=new Ee,m=new Ee,d=new Ee,x=new Ee,_=new Ee,v=new Ee,y=new Ee,w=new Ee,L=new Ee,C=new Ee,b=new Ee,A=new Ee;n=n!==void 0?n:12,i=i!==void 0?i:.001,c=c!==void 0?c:0,e=re(e);let N=e.length;if(N<2)return 0;let G=e[0].equals(e[N-1]),F,U=e[0],P,$=t.strokeWidth/2,H=1/(N-1),Z=0,W,oe,ue,ne,le=!1,he=0,I=c*3,M=c*2;T(e[0],e[1],l).multiplyScalar($),d.copy(e[0]).sub(l),x.copy(e[0]).add(l),_.copy(d),v.copy(x);for(let te=1;te<N;te++){F=e[te],te===N-1?G?P=e[1]:P=void 0:P=e[te+1];let ge=l;if(T(U,F,ge),h.copy(ge).multiplyScalar($),y.copy(F).sub(h),w.copy(F).add(h),W=Z+H,oe=!1,P!==void 0){T(F,P,u),h.copy(u).multiplyScalar($),L.copy(F).sub(h),C.copy(
3285F).add(h),ue=!0,h.subVectors(P,U),ge.dot(h)<0&&(ue=!1),te===1&&(le=ue),h.subVectors(P,F),h.normalize();let xe=Math.abs(ge.dot(h));if(xe>Number.EPSILON){let we=$/xe;h.multiplyScalar(-we),f.subVectors(F,U),p.copy(f).setLength(we).add(h),b.copy(p).negate();let se=p.length(),J=f.length();f.divideScalar(J),g.subVectors(P,F);let Ae=g.length();switch(g.divideScalar(Ae),f.dot(b)<J&&g.dot(b)<Ae&&(oe=!0),A.copy(p).add(F),b.add(F),ne=!1,oe?ue?(C.copy(b),w.copy(b)):(L.copy(b),y.copy(b)):j(),t.strokeLineJoin){case"bevel":z(ue,oe,W);break;case"round":fe(ue,oe),ue?B(F,y,L,W,0):B(F,C,w,W,1);break;case"miter":case"miter-clip":default:let Le=$*t.strokeMiterLimit/se;if(Le<1)if(t.strokeLineJoin!=="miter-clip"){z(ue,oe,W);break}else fe(ue,oe),ue?(g.subVectors(A,y).multiplyScalar(Le).add(y),m.subVectors(A,L).multiplyScalar(Le).add(L),S(y,W,0),S(g,W,0),S(F,W,.5),S(F,W,.5),S(g,W,0),S(m,W,0),S(F,W,.5),S(m,W,0),S(L,W,0)):(g.subVectors(A,w).multiplyScalar(Le).add(w),m.subVectors(A,C).multiplyScalar(Le).add(C),S(w,W,1),S(g,W,1),S(F,W,.5),S(F,W,.5),S(g,W,1),S(m,W,1),S(F,W,.5),S(m,W,1),S(C,W,1));else oe?(ue?(S(x,Z,1),S(d,Z,0),S(A,W,0),S(x,Z,1),S(A,W,0),S(b,W,1)):(S(x,Z,1),S(d,Z,0),S(A,W,1),S(d,Z,0),S(b,W,0),S(A,W,1)),ue?L.copy(A):C.copy(A)):ue?(S(y,W,0),S(A,W,0),S(F,W,.5),S(F,W,.5),S(A,W,0),S(L,W,0)):(S(w,W,1),S(A,W,1),S(F,W,.5),S(F,W,.5),S(A,W,1),S(C,W,1)),ne=!0;break}}else j()}else j();!G&&te===N-1&&q(e[0],_,v,ue,!0,Z),Z=W,U=F,d.copy(L),x.copy(C)}if(!G)q(F,y,w,ue,!1,W);else if(oe&&s){let te=A,ge=b;le!==ue&&(te=b,ge=A),ue?(ne||le)&&(ge.toArray(s,0*3),ge.toArray(s,3*3),ne&&te.toArray(s,1*3)):(ne||!le)&&(ge.toArray(s,1*3),ge.toArray(s,3*3),ne&&te.toArray(s,0*3))}return he;function T(te,ge,xe){return xe.subVectors(ge,te),xe.set(-xe.y,xe.x).normalize()}function S(te,ge,xe){s&&(s[I]=te.x,s[I+1]=te.y,s[I+2]=0,o&&(o[I]=0,o[I+1]=0,o[I+2]=1),I+=3,a&&(a[M]=ge,a[M+1]=xe,M+=2)),he+=3}function B(te,ge,xe,we,se){l.copy(ge).sub(te).normalize(),u.copy(xe).sub(te).normalize();let J=Math.PI,Ae=l.dot(u);Math.abs(Ae)<1&&(J=Math.abs(Math.acos(Ae))),J/=n,h.copy(ge);for(let Le=0,R=n-1;Le<R;Le++)f.copy(h).rotateAround(te,J),S(h,we,se),S(f,we,se),S(te,we,.5),h.copy(f);S(f,we,se),S(xe,we,se),S(te,we,.5)}function j(){S(x,Z,1),S(d,Z,0),S(y,W,0),S(x,Z,1),S(y,W,1),S(w,W,0)}function z(te,ge,xe){ge?te?(S(x,Z,1),S(d,Z,0),S(y,W,0),S(x,Z,1),S(y,W,0),S(b,W,1),S(y,xe,0),S(L,xe,0),S(b,xe,.5)):(S(x,Z,1),S(d,Z,0),S(w,W,1),S(d,Z,0),S(b,W,0),S(w,W,1),S(w,xe,1),S(C,xe,0),S(b,xe,.5)):te?(S(y,xe,0),S(L,xe,0),S(F,xe,.5)):(S(w,xe,1),S(C,xe,0),S(F,xe,.5))}function fe(te,ge){ge&&(te?(S(x,Z,1),S(d,Z,0),S(y,W,0),S(x,Z,1),S(y,W,0),S(b,W,1),S(y,Z,0),S(F,W,.5),S(b,W,1),S(F,W,.5),S(L,Z,0),S(b,W,1)):(S(x,Z,1),S(d,Z,0),S(w,W,1),S(d,Z,0),S(b,W,0),S(w,W,1),S(w,Z,1),S(b,W,0),S(F,W,.5),S(F,W,.5),S(b,W,0),S(C,Z,1)))}function q(te,ge,xe,we,se,J){switch(t.strokeLineCap){case"round":se?B(te,xe,ge,J,.5):B(te,ge,xe,J,.5);break;case"square":if(se)l.subVectors(ge,te),u.set(l.y,-l.x),h.addVectors(l,u).add(te),f.subVectors(u,l).add(te),we?(h.toArray(s,1*3),f.toArray(s,0*3),f.toArray(s,3*3)):(h.toArray(s,1*3),h.toArray(s,3*3),f.toArray(s,0*3));else{l.subVectors(xe,te),u.set(l.y,-l.x),h.addVectors(l,u).add(te),f.subVectors(u,l).add(te);let Ae=s.length;we?(h.toArray(s,Ae-1*3),f.toArray(s,Ae-2*3),f.toArray(s,Ae-4*3)):(h.toArray(s,Ae-2*3),f.toArray(s,Ae-1*3),f.toArray(s,Ae-4*3))}break;case"butt":default:break}}function re(te){let ge=!1;for(let we=1,se=te.length-1;we<se;we++)if(te[we].distanceTo(te[we+1])<i){ge=!0;break}if(!ge)return te;let xe=[];xe.push(te[0]);for(let we=1,se=te.length-1;we<se;we++)te[we].distanceTo(te[we+1])>=i&&xe.push(te[we]);return xe.push(te[te.length-1]),xe}}};var Bh=class extends Sr{constructor(){super()}CanImportExtension(e){return e==="svg"}GetUpDirection(){return ct.Z}CreateLoader(e){return new xo(e)}GetMainObject(e){function t(o){let a=o.userData.style;return!(a.fill===void 0||a.fill==="none")}function n(o,a,c){let l=null;for(let u of o)if(u.style===a&&u.opacity===c){l=u.material;break}return l===null&&(l=new Qt({color:new $e().setStyle(a),opacity:c,transparent:c<1}),o.push({style:a,opacity:c,material:l})),l}let i=[],s=new xt;s.rotation.x=Math.PI;for(let o of e.paths){let a=xo.createShapes(o);if(t(o)){let c=o.userData.style,l=n(i,c.fill,c.opacity);for(let u of a){let h=new Ta(u,{depth:10,bevelEnabled:!1}),f=new kt(h,l);f.name=o.userData.node.id,s.add(f)}}}return s}};var Tc=class{constructor(){this.name=null,this.material=null}SetName(e){return this.name=e,this}SetMaterial(e){return this.material=e,this}},Ns=class{constructor(e){this.params=e||new Tc,this.mesh=new jt,this.params.name!==null&&this.mesh.SetName(this.params.name),this.curve=null}GetMesh(){return this.mesh}AddVertex(e,t,n){let i=new Ve(e,t,n);return this.mesh.AddVertex(i)}AddVertices(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n];t.push(this.AddVertex(i.x,i.y,i.z))}return t}SetCurve(e){this.curve=e}ResetCurve(){this.curve=null}AddTriangle(e,t,n){let i=new Bt(e,t,n);return this.params.material!==null&&(i.mat=this.params.material),this.curve!==null&&i.SetCurve(this.curve),this.mesh.AddTriangle(i)}AddTriangleInverted(e,t,n){this.AddTriangle(e,n,t)}AddConvexPolygon(e){for(let t=0;t<e.length-2;t++)this.AddTriangle(e[0],e[t+1],e[t+2])}AddConvexPolygonInverted(e){for(let t=0;t<e.length-2;t++)this.AddTriangleInverted(e[0],e[t+1],e[t+2])}},ol=class{constructor(e){this.generator=e}GenerateSurfaceBetweenPolygons(e,t){if(e.length!==t.length)return;let n=e.length;for(let i=0;i<n;i++){let s=i,o=i<n-1?s+1:0;this.generator.AddConvexPolygon([e[s],e[o],t[o],t[s]])}}GenerateTriangleFan(e,t){let n=e.length;for(let i=0;i<n;i++){let s=i,o=i<n-1?s+1:0;this.generator.AddTriangle(t,e[s],e[o])}}};function Ax(r,e){return new wt(r*Math.cos(e),r*Math.sin(e))}function Cx(r,e,t,n){if(!wi(e)||!wi(t)||!wi(n))return null;let i=new Ns(r);return i.AddVertex(0,0,0),i.AddVertex(e,0,0),i.AddVertex(e,t,0),i.AddVertex(0,t,0),i.AddVertex(0,0,n),i.AddVertex(e,0,n),i.AddVertex(e,t,n),i.AddVertex(0,t,n),i.AddConvexPolygon([0,3,2,1]),i.AddConvexPolygon([0,1,5,4]),i.AddConvexPolygon([1,2,6,5]),i.AddConvexPolygon([2,3,7,6]),i.AddConvexPolygon([3,0,4,7]),i.AddConvexPolygon([4,5,6,7]),i.GetMesh()}function Op(r,e,t,n,i,s){if(Rr(e)||Rr(t)||!wi(n)||i<3)return null;let o=Fs(e),a=Fs(t);
3285if(o&&a)return null;let c=new Ns(r),l=new ol(c),u=2*Math.PI/i,h=s?1:null,f=[];if(o)f.push(c.AddVertex(0,0,n));else for(let g=0;g<i;g++){let m=Ax(e,g*u);f.push(c.AddVertex(m.x,m.y,n))}let p=[];if(a)p.push(c.AddVertex(0,0,0));else for(let g=0;g<i;g++){let m=Ax(t,g*u);p.push(c.AddVertex(m.x,m.y,0))}return o?(c.SetCurve(h),l.GenerateTriangleFan(p,f[0]),c.ResetCurve(),c.AddConvexPolygonInverted(p)):a?(c.SetCurve(h),l.GenerateTriangleFan(f.slice().reverse(),p[0]),c.ResetCurve(),c.AddConvexPolygon(f)):(c.SetCurve(h),l.GenerateSurfaceBetweenPolygons(p,f),c.ResetCurve(),c.AddConvexPolygonInverted(p),c.AddConvexPolygon(f)),c.GetMesh()}function Ix(r,e,t,n,i){return Op(r,e,e,t,n,i)}function Rx(r,e,t,n){function i(p,g,m){return new Ve(p*Math.sin(g)*Math.cos(m),p*Math.sin(g)*Math.sin(m),p*Math.cos(g))}if(!wi(e)||t<3)return null;let s=new Ns(r),o=new ol(s);s.SetCurve(n?1:null);let a=[],c=t+1,l=Math.PI/t,u=2*Math.PI/t;for(let p=1;p<c-1;p++){let g=[],m=p*l;for(let d=0;d<t;d++){let x=d*u,_=i(e,m,-x);g.push(s.AddVertex(_.x,_.y,_.z))}p>1&&o.GenerateSurfaceBetweenPolygons(a[a.length-1],g),a.push(g)}let h=s.AddVertex(0,0,e),f=s.AddVertex(0,0,-e);return o.GenerateTriangleFan(a[0].slice().reverse(),h),o.GenerateTriangleFan(a[a.length-1],f),s.ResetCurve(),s.GetMesh()}function Px(r,e,t){function n(s,o,a,c,l){let u=new Ve(a,c,l);u.MultiplyScalar(o/u.Length()),s.AddVertex(u.x,u.y,u.z)}if(!wi(t))return null;let i=new Ns(r);if(e==="tetrahedron"){let s=1;n(i,t,+s,+s,+s),n(i,t,-s,-s,+s),n(i,t,-s,+s,-s),n(i,t,+s,-s,-s),i.AddTriangle(0,1,3),i.AddTriangle(0,2,1),i.AddTriangle(0,3,2),i.AddTriangle(1,2,3)}else if(e==="hexahedron"){let s=1;n(i,t,+s,+s,+s),n(i,t,+s,+s,-s),n(i,t,+s,-s,+s),n(i,t,+s,-s,-s),n(i,t,-s,+s,+s),n(i,t,-s,+s,-s),n(i,t,-s,-s,+s),n(i,t,-s,-s,-s),i.AddConvexPolygon([0,1,5,4]),i.AddConvexPolygon([0,2,3,1]),i.AddConvexPolygon([0,4,6,2]),i.AddConvexPolygon([1,3,7,5]),i.AddConvexPolygon([2,6,7,3]),i.AddConvexPolygon([4,5,7,6])}else if(e==="octahedron"){let s=1,o=0;n(i,t,+s,+o,+o),n(i,t,-s,+o,+o),n(i,t,+o,+s,+o),n(i,t,+o,-s,+o),n(i,t,+o,+o,+s),n(i,t,+o,+o,-s),i.AddTriangle(0,2,4),i.AddTriangle(0,3,5),i.AddTriangle(0,4,3),i.AddTriangle(0,5,2),i.AddTriangle(1,2,5),i.AddTriangle(1,3,4),i.AddTriangle(1,4,2),i.AddTriangle(1,5,3)}else if(e==="dodecahedron"){let s=1,o=0,a=(1+Math.sqrt(5))/2,c=1/a;n(i,t,+s,+s,+s),n(i,t,+s,+s,-s),n(i,t,+s,-s,+s),n(i,t,-s,+s,+s),n(i,t,+s,-s,-s),n(i,t,-s,+s,-s),n(i,t,-s,-s,+s),n(i,t,-s,-s,-s),n(i,t,+o,+c,+a),n(i,t,+o,+c,-a),n(i,t,+o,-c,+a),n(i,t,+o,-c,-a),n(i,t,+c,+a,+o),n(i,t,+c,-a,+o),n(i,t,-c,+a,+o),n(i,t,-c,-a,+o),n(i,t,+a,+o,+c),n(i,t,-a,+o,+c),n(i,t,+a,+o,-c),n(i,t,-a,+o,-c),i.AddConvexPolygon([0,8,10,2,16]),i.AddConvexPolygon([0,16,18,1,12]),i.AddConvexPolygon([0,12,14,3,8]),i.AddConvexPolygon([1,9,5,14,12]),i.AddConvexPolygon([1,18,4,11,9]),i.AddConvexPolygon([2,10,6,15,13]),i.AddConvexPolygon([2,13,4,18,16]),i.AddConvexPolygon([3,14,5,19,17]),i.AddConvexPolygon([3,17,6,10,8]),i.AddConvexPolygon([4,13,15,7,11]),i.AddConvexPolygon([5,9,11,7,19]),i.AddConvexPolygon([6,17,19,7,15])}else if(e==="icosahedron"){let s=1,o=0,a=(1+Math.sqrt(5))/2;n(i,t,+o,+s,+a),n(i,t,+o,+s,-a),n(i,t,+o,-s,+a),n(i,t,+o,-s,-a),n(i,t,+s,+a,+o),n(i,t,+s,-a,+o),n(i,t,-s,+a,+o),n(i,t,-s,-a,+o),n(i,t,+a,+o,+s),n(i,t,+a,+o,-s),n(i,t,-a,+o,+s),n(i,t,-a,+o,-s),i.AddTriangle(0,2,8),i.AddTriangle(0,4,6),i.AddTriangle(0,6,10),i.AddTriangle(0,8,4),i.AddTriangle(0,10,2),i.AddTriangle(1,3,11),i.AddTriangle(1,4,9),i.AddTriangle(1,6,4),i.AddTriangle(1,9,3),i.AddTriangle(1,11,6),i.AddTriangle(2,5,8),i.AddTriangle(2,7,5),i.AddTriangle(2,10,7),i.AddTriangle(3,5,7),i.AddTriangle(3,7,11),i.AddTriangle(3,9,5),i.AddTriangle(4,8,9),i.AddTriangle(5,9,8),i.AddTriangle(6,11,10),i.AddTriangle(7,10,11)}return i.GetMesh()}function Dp(r,e,t){let n=qn(r,e),i=qn(e,t),s=qn(r,t),o=(n+i+s)/2,a=o*(o-n)*(o-i)*(o-s);return a<0?0:Math.sqrt(a)}function kp(r,e,t){return bl(r,Vi(e,t))/6}function Fp(r){if(r instanceof hr){let e=0;return r.EnumerateMeshInstances(t=>{e+=Fp(t)}),e}else{let e=0;return r.EnumerateTriangleVertices((t,n,i)=>{e+=kp(t,n,i)}),e}}function Lx(r){let e=0;return r.EnumerateTriangleVertices((t,n,i)=>{e+=Dp(t,n,i)}),e}
3285var Wn={Perspective:1,Orthographic:2},Bi=class{constructor(e,t,n,i){this.eye=e,this.center=t,this.up=n,this.fov=i}Clone(){return new Bi(this.eye.Clone(),this.center.Clone(),this.up.Clone(),this.fov)}};function Gh(r,e){return pi(r.eye,e.eye)&&pi(r.center,e.center)&&pi(r.up,e.up)&&Rt(r.fov,e.fov)}function zh(r,e){function t(n,i){for(let s of n)s.polygonOffset=i,s.polygonOffsetUnit=1,s.polygonOffsetFactor=1}t(r.material,e),r.userData.threeMaterials&&t(r.userData.threeMaterials,e)}var Os=class{constructor(e){this.scene=e,this.rootObject=null}IsEmpty(){return this.rootObject===null}SetRootObject(e){this.rootObject!==null&&this.Clear(),this.rootObject=e,this.scene.add(this.rootObject)}GetRootObject(){return this.rootObject}AddObject(e){if(this.rootObject===null){let t=new xt;this.SetRootObject(t)}this.rootObject.add(e)}Traverse(e){this.rootObject!==null&&this.rootObject.traverse(t=>{e(t)})}UpdateWorldMatrix(){this.rootObject!==null&&this.rootObject.updateWorldMatrix(!0,!0)}Clear(){dh(this.rootObject),this.scene.remove(this.rootObject),this.rootObject=null}},$r=class{constructor(e,t,n){this.showEdges=e,this.edgeColor=t,this.edgeThreshold=n}Clone(){return new $r(this.showEdges,this.edgeColor.Clone(),this.edgeThreshold)}},al=class{constructor(e){this.scene=e,this.mainModel=new Os(this.scene),this.edgeModel=new Os(this.scene),this.edgeSettings=new $r(!1,new dt(0,0,0),1)}SetMainObject(e){this.mainModel.SetRootObject(e),this.edgeSettings.showEdges&&this.GenerateEdgeModel()}UpdateWorldMatrix(){this.mainModel.UpdateWorldMatrix(),this.edgeModel.UpdateWorldMatrix()}SetEdgeSettings(e){let t=!1;if(e.showEdges&&(!this.edgeSettings.showEdges||this.edgeSettings.edgeThreshold!==e.edgeThreshold)&&(t=!0),this.edgeSettings=e,!this.mainModel.IsEmpty())if(this.edgeSettings.showEdges)if(t)this.ClearEdgeModel(),this.GenerateEdgeModel();else{let n=ai(this.edgeSettings.edgeColor);this.EnumerateEdges(i=>{i.material.color=n})}else this.ClearEdgeModel()}GenerateEdgeModel(){let e=ai(this.edgeSettings.edgeColor);this.UpdateWorldMatrix(),this.EnumerateMeshes(t=>{zh(t,!0);let n=new $u(t.geometry,this.edgeSettings.edgeThreshold),i=new _s(n,new Ri({color:e}));i.applyMatrix4(t.matrixWorld),i.userData=t.userData,i.visible=t.visible,this.edgeModel.AddObject(i)})}GetBoundingBox(e){let t=!1,n=new mr;return this.EnumerateMeshes(i=>{e(i.userData)&&(n.union(new mr().setFromObject(i)),t=!0)}),t?n:null}GetBoundingSphere(e){let t=this.GetBoundingBox(e);if(t===null)return null;let n=new Vr;return t.getBoundingSphere(n),n}Clear(){this.mainModel.Clear(),this.ClearEdgeModel()}ClearEdgeModel(){this.edgeModel.IsEmpty()||(this.EnumerateMeshes(e=>{zh(e,!1)}),this.edgeModel.Clear())}EnumerateMeshes(e){this.mainModel.Traverse(t=>{t.isMesh&&e(t)})}EnumerateEdges(e){this.edgeModel.Traverse(t=>{t.isLineSegments&&e(t)})}GetMeshIntersectionUnderMouse(e,t,n,i){if(this.mainModel.IsEmpty()||e.x<0||e.x>n||e.y<0||e.y>i)return null;let s=new rh,o=new Ee;o.x=e.x/n*2-1,o.y=-(e.y/i)*2+1,s.setFromCamera(o,t);let a=s.intersectObject(this.mainModel.GetRootObject(),!0);for(let c=0;c<a.length;c++){let l=a[c];if(l.object.isMesh&&l.object.visible)return l}return null}};var sn={IntegerToString(r){return r.toString()},StringToInteger(r){return parseInt(r,10)},NumberToString(r){let e=5;return r.toFixed(e)},StringToNumber(r){return parseFloat(r)},ModelUrlsToString:function(r){return r===null?null:r.join(",")},StringToModelUrls:function(r){return r===null||r.length===0?null:r.split(",")},CameraToString:function(r){return r===null?null:[this.NumberToString(r.eye.x),this.NumberToString(r.eye.y),this.NumberToString(r.eye.z),this.NumberToString(r.center.x),this.NumberToString(r.center.y),this.NumberToString(r.center.z),this.NumberToString(r.up.x),this.NumberToString(r.up.y),this.NumberToString(r.up.z),this.NumberToString(r.fov)].join(",")},CameraModeToString:function(r){return r===Wn.Perspective?"perspective":r===Wn.Orthogra
3285phic?"orthographic":null},StringToCamera:function(r){if(r===null||r.length===0)return null;let e=r.split(",");if(e.length!==9&&e.length!==10)return null;let t=45;return e.length>=10&&(t=this.StringToNumber(e[9])),new Bi(new Ve(this.StringToNumber(e[0]),this.StringToNumber(e[1]),this.StringToNumber(e[2])),new Ve(this.StringToNumber(e[3]),this.StringToNumber(e[4]),this.StringToNumber(e[5])),new Ve(this.StringToNumber(e[6]),this.StringToNumber(e[7]),this.StringToNumber(e[8])),t)},StringToCameraMode:function(r){return r==="perspective"?Wn.Perspective:r==="orthographic"?Wn.Orthographic:null},RGBColorToString:function(r){return r===null?null:[this.IntegerToString(r.r),this.IntegerToString(r.g),this.IntegerToString(r.b)].join(",")},RGBAColorToString:function(r){return r===null?null:[this.IntegerToString(r.r),this.IntegerToString(r.g),this.IntegerToString(r.b),this.IntegerToString(r.a)].join(",")},StringToRGBColor:function(r){if(r===null||r.length===0)return null;let e=r.split(",");return e.length!==3?null:new dt(this.StringToInteger(e[0]),this.StringToInteger(e[1]),this.StringToInteger(e[2]))},StringToRGBAColor:function(r){if(r===null||r.length===0)return null;let e=r.split(",");if(e.length!==3&&e.length!==4)return null;let t=new or(this.StringToInteger(e[0]),this.StringToInteger(e[1]),this.StringToInteger(e[2]),255);return e.length===4&&(t.a=this.StringToInteger(e[3])),t},EnvironmentSettingsToString(r){return r===null?null:[r.environmentMapName,r.backgroundIsEnvMap?"on":"off"].join(",")},StringToEnvironmentSettings:function(r){if(r===null||r.length===0)return null;let e=r.split(",");return e.length!==2?null:{environmentMapName:e[0],backgroundIsEnvMap:e[1]==="on"}},EdgeSettingsToString:function(r){return r===null?null:[r.showEdges?"on":"off",this.RGBColorToString(r.edgeColor),this.IntegerToString(r.edgeThreshold)].join(",")},StringToEdgeSettings:function(r){if(r===null||r.length===0)return null;let e=r.split(",");return e.length!==5?null:new $r(e[0]==="on",new dt(this.StringToInteger(e[1]),this.StringToInteger(e[2]),this.StringToInteger(e[3])),this.StringToInteger(e[4]))}},Mc=class{constructor(e){this.separator=e,this.paramList=""}AddModelUrls(e){return this.AddUrlPart("model",sn.ModelUrlsToString(e)),this}AddCamera(e){return this.AddUrlPart("camera",sn.CameraToString(e)),this}AddCameraMode(e){return this.AddUrlPart("cameramode",sn.CameraModeToString(e)),this}AddEnvironmentSettings(e){return this.AddUrlPart("envsettings",sn.EnvironmentSettingsToString(e)),this}AddBackgroundColor(e){return this.AddUrlPart("backgroundcolor",sn.RGBAColorToString(e)),this}AddDefaultColor(e){return this.AddUrlPart("defaultcolor",sn.RGBColorToString(e)),this}AddEdgeSettings(e){return this.AddUrlPart("edgesettings",sn.EdgeSettingsToString(e)),this}AddUrlPart(e,t){e===null||t===null||(this.paramList.length>0&&(this.paramList+=this.separator),this.paramList+=e+"="+t)}GetParameterList(){return this.paramList}},wc=class{constructor(e,t){this.separator=t,this.paramList=e}GetModelUrls(){if(this.paramList.indexOf("=")===-1)return this.paramList.split(",");let e=this.GetKeywordParams("model");return sn.StringToModelUrls(e)}GetCamera(){let e=this.GetKeywordParams("camera");return sn.StringToCamera(e)}GetCameraMode(){let e=this.GetKeywordParams("cameramode");return sn.StringToCameraMode(e)}GetEnvironmentSettings(){let e=this.GetKeywordParams("envsettings");return sn.StringToEnvironmentSettings(e)}GetBackgroundColor(){let e=this.GetKeywordParams("backgroundcolor");return sn.StringToRGBAColor(e)}GetDefaultColor(){let e=this.GetKeywordParams("defaultcolor");return sn.StringToRGBColor(e)}GetEdgeSettings(){let e=this.GetKeywordParams("edgesettings");return sn.StringToEdgeSettings(e)}GetKeywordParams(e){if(this.paramList===null||this.paramList.length===0)return null;let t=e+"=",n=this.paramList.split(this.separator);for(let i=0;i<n.length;i++){let s=n[i];if(s.startsWith(t))return s.substring(t.length)}return null}};function Up(){return new Mc("$")}function Nx(r){return new wc(r,"$")}function Ox(r){let e=Up();return e.AddModelUrls(r),e.GetParameterList()}var ll=class{constructor(){this.forceMediumpForMaterials=!1}},cl=class{constructor(){this.defaultMaterial=null,this.objectUrls=[]}},Sc=class{constructor(e){this.callbacks=e,this.texturesNeeded=0,this.texturesLoaded=0,this.threeObject=null}OnTextureNeeded(){this.texturesNeeded+=1}OnTextureLoaded(){this.texturesLoaded+=1,this.callbacks.onTextureLoaded(),this.Finish()}
3285OnModelLoaded(e){this.threeObject=e,this.Finish()}Finish(){this.threeObject!==null&&this.texturesNeeded===this.texturesLoaded&&this.callbacks.onModelLoaded(this.threeObject)}},Ec=class{constructor(e,t){this.meshInstances=[],this.AddNode(e,t)}AddNode(e,t){let n=e.GetTransformation().GetMatrix(),i=new Xe().fromArray(n.Get());t.applyMatrix4(i);for(let s of e.GetChildNodes()){let o=new xt;t.add(o),this.AddNode(s,o)}for(let s of e.GetMeshIndices())this.meshInstances.push({node:e,threeNode:t,meshIndex:s})}GetMeshInstances(){return this.meshInstances}};function Vh(r,e,t,n){function i(f,p,g,m,d,x){function _(A,N){N.wrapS=$t,N.wrapT=$t,N.rotation=A.rotation,N.offset.x=A.offset.x,N.offset.y=A.offset.y,N.repeat.x=A.scale.x,N.repeat.y=A.scale.y}function v(A,N,G,F,U){if(G===null||!G.IsValid())return;let P=new Li;A.OnTextureNeeded();let $=null;G.mimeType!==null?$=Qc(G.buffer,G.mimeType):$=zs(G.buffer),F.objectUrls.push($),P.load($,H=>{_(G,H),N.needsUpdate=!0,U(H),A.OnTextureLoaded()},null,H=>{A.OnTextureLoaded()})}let y=p.GetMaterial(g),w=ai(y.color);y.vertexColors&&w.setRGB(1,1,1);let L={color:w,vertexColors:y.vertexColors,opacity:y.opacity,transparent:y.transparent,alphaTest:y.alphaTest,side:kn};d.forceMediumpForMaterials&&(L.precision="mediump");let C=null;if(m===Hn.Phong){if(C=new Qt(L),y.type===Dn.Phong){let A=ai(y.specular);Rt(y.shininess,0)&&A.setRGB(0,0,0),C.specular=A,C.shininess=y.shininess*100,v(f,C,y.specularMap,x,N=>{C.specularMap=N})}}else m===Hn.Physical&&(C=new Ts(L),y.type===Dn.Physical&&(C.metalness=y.metalness,C.roughness=y.roughness,v(f,C,y.metalnessMap,x,A=>{C.metalness=1,C.roughness=1,C.metalnessMap=A,C.roughnessMap=A})));let b=ai(y.emissive);return C.emissive=b,v(f,C,y.diffuseMap,x,A=>{y.multiplyDiffuseMap||C.color.setRGB(1,1,1),C.map=A}),v(f,C,y.bumpMap,x,A=>{C.bumpMap=A}),v(f,C,y.normalMap,x,A=>{C.normalMap=A}),v(f,C,y.emissiveMap,x,A=>{C.emissiveMap=A}),y.isDefault&&(x.defaultMaterial=C),C}function s(f,p,g){let m=f.GetMesh(p.meshIndex),d=m.TriangleCount(),x=[];for(let P=0;P<d;P++)x.push(P);x.sort((P,$)=>{let H=m.GetTriangle(P),Z=m.GetTriangle($);return H.mat-Z.mat});let _=new yt,v=[],y=[],w=new Map,L=[],C=[],b=[],A=[],N=[];N.push({start:0,end:-1});let G=m.VertexColorCount()>0,F=m.TextureUVCount()>0;for(let P=0;P<x.length;P++){let $=x[P],H=m.GetTriangle($),Z=m.GetVertex(H.v0),W=m.GetVertex(H.v1),oe=m.GetVertex(H.v2);if(L.push(Z.x,Z.y,Z.z,W.x,W.y,W.z,oe.x,oe.y,oe.z),H.HasVertexColors()){let I=ai(m.GetVertexColor(H.c0)),M=ai(m.GetVertexColor(H.c1)),T=ai(m.GetVertexColor(H.c2));C.push(I.r,I.g,I.b,M.r,M.g,M.b,T.r,T.g,T.b)}else G&&C.push(0,0,0,0,0,0,0,0,0);let ue=m.GetNormal(H.n0),ne=m.GetNormal(H.n1),le=m.GetNormal(H.n2);if(b.push(ue.x,ue.y,ue.z,ne.x,ne.y,ne.z,le.x,le.y,le.z),H.HasTextureUVs()){let I=m.GetTextureUV(H.u0),M=m.GetTextureUV(H.u1),T=m.GetTextureUV(H.u2);A.push(I.x,I.y,M.x,M.y,T.x,T.y)}else F&&A.push(0,0,0,0,0,0);let he=H.mat;w.has(he)||(w.set(he,v.length),v.push(g[he]),y.push(he),P>0&&(N[N.length-1].end=P-1,N.push({start:N[N.length-1].end+1,end:-1})))}N[N.length-1].end=d-1,_.setAttribute("position",new je(L,3)),C.length!==0&&_.setAttribute("color",new je(C,3)),_.setAttribute("normal",new je(b,3)),A.length!==0&&_.setAttribute("uv",new je(A,2));for(let P=0;P<N.length;P++){let $=N[P];_.addGroup($.start*3,($.end-$.start+1)*3,P)}let U=new kt(_,v);return U.name=m.GetName(),U.userData={originalMeshId:p,originalMaterials:y,threeMaterials:null},U}function o(f,p,g,m){let d=p.GetMesh(g.meshIndex);if(ss(d)===lr.TriangleMesh){let _=s(p,g,m);f.add(_)}}function a(f,p,g,m){let d=p.GetRootNode(),_=new Ec(d,f).GetMeshInstances();Hc(_.length,100,{runTask:(v,y,w)=>{for(let L=v;L<=y;L++){let C=_[L],b=C.node,A=C.threeNode,N=new Lr(b.GetId(),C.meshIndex);o(A,p,N,g)}w()},onReady:()=>{m.OnModelLoaded(f)}})}let c=new Sc(n),l=fh(r),u=[];for(let f=0;f<r.MaterialCount();f++){let p=i(c,r,f,l,e,t);u.push(p)}let h=new xt;a(h,r,u,c)}var ul=class{constructor(){this.importer=new sl,this.inProgress=!1,this.defaultMaterial=null,this.objectUrls=null,this.hasHighpDriverIssue=hh()}InProgress(){return this.inProgress}LoadModel(e,t,n){this.inProgress||(this.inProgress=!0,this.RevokeObjectUrls(),this.importer.ImportFiles(e,t,{onLoadStart:()=>{n.onLoadStart()},onFileListProgress:(i,s)=>{n.onFileListProgress(i,s)},onFileLoadProgress:(i,s)=>{n.onFileLoadProgress(i,s)},onImportStart:()=>{n.onImportStart()},onSelectMainFile:(i,s)=>{n.onSelectMainFile?n.onSelectMainFile(i,s):s(0)},onImportSuccess:i=>{n.onVisualizationStart();let s=new ll;s.forceMediumpForMaterials=this.hasHighpDriverIssue;let o=new cl;Vh(i.model,s,o,{onTextureLoaded:()=>{n.onTextureLoaded()},onModelLoaded:a=>{if(this.defaultMaterial=o.defaultMaterial,this.objectUrls=o.objectUrls,i.upVector===ct.X){let c=new mn().setFromAxisAngle(new ae(0,0,1),Math.PI/2);a.quaternion.multiply(c)}else if(i.upVector===ct.Z){let c=new mn().setFromAxisAngle(new ae(1,0,0),-Math.PI/2);a.quaternion.multiply(c)}n.onModelFinished(i,a),this.inProgress=!1}})},onImportError:i=>{n.onLoadError(i),this.inProgress=!1}}))}GetImporter(){return this.importer}GetDefaultMaterial(){return this.defaultMaterial}ReplaceDefaultMaterialColor(e){this.defaultMaterial!==null&&!this.defaultMaterial.vertexColors&&(this.defaultMaterial.color=ai(e))}RevokeObjectUrls(){if(this.objectUrls!==null){for(let e of this.objectUrls)eu(e);this.objectUrls=null}}Destroy(){this.RevokeObjectUrls(),this.importer=null}};function On(r){return Math.round(parseFloat(r))}function Hh(r){let e=On(r.paddingLeft)+On(r.paddingRight),t=On(r.borderLeftWidth)+On(r.borderRightWidth),n=On(r.marginLeft)+On(r.marginRight);return e+t+n}function Wh(r){let e=On(r.paddingTop)+On(r.paddingBottom),t=On(r.borderTopWidth)+On(r.borderBottomWidth),n=On(r.marginTop)+On(r.marginBottom);return e+t+n}function jh(r,e,t){let n=getComputedStyle(r),i=e-Hh(n),s=t-Wh(n);return{width:i,height:s}}function Qr(r,e,t){if(r.getBoundingClientRect){let n=r.getBoundingClientRect();e-=n.left,t-=n.top}return window.pageXOffset&&window.pageYOffset&&(e+=window.pageXOffset,t+=window.pageYOffset),new wt(e,t)}function qh(r,e,t){let n=document.createElement(r);return e&&(n.className=e),t&&(n.innerHTML=t),n}function Bp(r,e,t,n){let i=qh(e,t,n);return r.appendChild(i),i}function Dx(r,e,t){return Bp(r,"div",e,t)}function kx(r){for(;r.firstChild;)r.removeChild(r.firstChild)}function Fx(r,e){e.parentNode.insertBefore(r,e)}function Ux(r,e){e.parentNode.insertBefore(r,e.nextSibling)}function Bx(r,e){e?r.style.display="block":r.style.display="none"}function Gx(r){return r.offsetParent!==null}function Gp(r,e){r.style.width=e.toString()+"px"}function zp(r,e){r.style.height=e.toString()+"px"}function zx(r){let e=getComputedStyle(r);return r.offsetWidth+On(e.marginLeft)+On(e.marginRight)}function Vx(r){let e=getComputedStyle(r);return r.offsetHeight+On(e.marginTop)+On(e.marginBottom)}function Hx(r,e){let t=getComputedStyle(r);Gp(r,e-Hh(t))}function Wx(r,e){let t=getComputedStyle(r);zp(r,e-Wh(t))}function jx(r,e){return qh("div",r,e)}var Ac=class{constructor(){this.prev=new wt(0,0),this.curr=new wt(0,0),this.diff=new wt(0,0),this.buttons=[]}Down(e,t){this.buttons.push(t.which),this.curr=this.GetPositionFromEvent(e,t),this.prev=this.curr.Clone()}Move(e,t){this.curr=this.GetPositionFromEvent(e,t),this.diff=yl(this.curr,this.prev),this.prev=this.curr.Clone()}Up(e,t){let n=this.buttons.indexOf(t.which);n!==-1&&this.buttons.splice(n,1),this.curr=this.GetPositionFromEvent(e,t)}
3285Leave(e,t){this.buttons=[],this.curr=this.GetPositionFromEvent(e,t)}IsButtonDown(){return this.buttons.length>0}GetButton(){let e=this.buttons.length;return e===0?0:this.buttons[e-1]}GetPosition(){return this.curr}GetMoveDiff(){return this.diff}GetPositionFromEvent(e,t){return Qr(e,t.clientX,t.clientY)}},Cc=class{constructor(){this.prevPos=new wt(0,0),this.currPos=new wt(0,0),this.diffPos=new wt(0,0),this.prevDist=0,this.currDist=0,this.diffDist=0,this.fingers=0}Start(e,t){t.touches.length!==0&&(this.fingers=t.touches.length,this.currPos=this.GetPositionFromEvent(e,t),this.prevPos=this.currPos.Clone(),this.currDist=this.GetTouchDistanceFromEvent(e,t),this.prevDist=this.currDist)}Move(e,t){t.touches.length!==0&&(this.currPos=this.GetPositionFromEvent(e,t),this.diffPos=yl(this.currPos,this.prevPos),this.prevPos=this.currPos.Clone(),this.currDist=this.GetTouchDistanceFromEvent(e,t),this.diffDist=this.currDist-this.prevDist,this.prevDist=this.currDist)}End(e,t){t.touches.length!==0&&(this.fingers=0,this.currPos=this.GetPositionFromEvent(e,t),this.currDist=this.GetTouchDistanceFromEvent(e,t))}IsFingerDown(){return this.fingers!==0}GetFingerCount(){return this.fingers}GetPosition(){return this.currPos}GetMoveDiff(){return this.diffPos}GetDistanceDiff(){return this.diffDist}GetPositionFromEvent(e,t){let n=null;if(t.touches.length!==0){let i=t.touches[0];n=Qr(e,i.pageX,i.pageY)}return n}GetTouchDistanceFromEvent(e,t){if(t.touches.length!==2)return 0;let n=t.touches[0],i=t.touches[1];return vl(Qr(e,n.pageX,n.pageY),Qr(e,i.pageX,i.pageY))}},Ic=class{constructor(){this.isClick=!1,this.startPosition=null}Start(e){this.isClick=!0,this.startPosition=e}Move(e){this.isClick&&(this.startPosition!==null?vl(this.startPosition,e)>3&&this.Cancel():this.Cancel())}End(){this.startPosition=null}Cancel(){this.isClick=!1,this.startPosition=null}IsClick(){return this.isClick}},$n={None:0,Orbit:1,Pan:2,Zoom:3},hl=class{constructor(e,t,n){this.canvas=e,this.camera=t,this.callbacks=n,this.fixUpVector=!0,this.mouse=new Ac,this.touch=new Cc,this.clickDetector=new Ic,this.onMouseClick=null,this.onMouseMove=null,this.onContext=null,this.canvas.addEventListener&&(this.canvas.addEventListener("mousedown",this.OnMouseDown.bind(this)),this.canvas.addEventListener("wheel",this.OnMouseWheel.bind(this)),this.canvas.addEventListener("touchstart",this.OnTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.OnTouchMove.bind(this)),this.canvas.addEventListener("touchcancel",this.OnTouchEnd.bind(this)),this.canvas.addEventListener("touchend",this.OnTouchEnd.bind(this)),this.canvas.addEventListener("contextmenu",this.OnContextMenu.bind(this))),document.addEventListener&&(document.addEventListener("mousemove",this.OnMouseMove.bind(this)),document.addEventListener("mouseup",this.OnMouseUp.bind(this)),document.addEventListener("mouseleave",this.OnMouseLeave.bind(this)))}SetMouseClickHandler(e){this.onMouseClick=e}SetMouseMoveHandler(e){this.onMouseMove=e}SetContextMenuHandler(e){this.onContext=e}IsFixUpVector(){return this.fixUpVector}SetFixUpVector(e){this.fixUpVector=e}GetCamera(){return this.camera}SetCamera(e){this.camera=e}MoveCamera(e,t){function n(i,s,o,a){i.camera.eye=s.eye[a],i.camera.center=s.center[a],i.camera.up=s.up[a],i.Update(),a<o-1&&requestAnimationFrame(()=>{n(i,s,o,a+1)})}if(e!==null){if(t===0||Gh(this.camera,e))this.camera=e;else{let i=ou,s={eye:zo(this.camera.eye,e.eye,t,i),center:zo(this.camera.center,e.center,t,i),up:zo(this.camera.up,e.up,t,i)};requestAnimationFrame(()=>{n(this,s,t,0)})}this.Update()}}GetFitToSphereCamera(e,t){if(Fs(t))return null;let n=this.camera.Clone(),i=En(n.center,e);n.eye=En(n.eye,i),n.center=e.Clone();let s=En(n.eye,n.center).Normalize(),o=this.camera.fov/2;this.canvas.width<this.canvas.height&&(o=o*this.canvas.width/this.canvas.height);let a=t/Math.sin(o*sr);return n.eye=n.center.Clone().Offset(s,a),n}OnMouseDown(e){e.preventDefault(),this.mouse.Down(this.canvas,e),this.clickDetector.Start(this.mouse.GetPosition())}OnMouseMove(e){if(this.mouse.Move(this.canvas,e),this.clickDetector.Move(this.mouse.GetPosition()),this.onMouseMove){let s=Qr(this.canvas,e.clientX,e.clientY);this.onMouseMove(s)}if(!this.mouse.IsButtonDown())return;let t=this.mouse.GetMoveDiff(),n=this.mouse.GetButton(),i=$n.None;if(n===1?e.ctrlKey?i=$n.Zoom:e.shiftKey?i=$n.Pan:i=$n.Orbit:(n===2||n===3)&&(i=$n.Pan),i===$n.Orbit){let s=.5;this.Orbit(t.x*s,t.y*s)}else if(i===$n.Pan){let o=.001*qn(this.camera.eye,this.camera.center);this.Pan(t.x*o,t.y*o)}else if(i===$n.Zoom){let s=.005;this.Zoom(-t.y*s)}this.Update()}OnMouseUp(e){if(this.mouse.Up(this.canvas,e),this.clickDetector.End(),this.clickDetector.IsClick()){let t=this.mouse.GetPosition();this.Click(e.which,t)}}OnMouseLeave(e){this.mouse.Leave(this.canvas,e),this.clickDetector.Cancel()}OnTouchStart(e){e.preventDefault(),this.touch.Start(this.canvas,e),this.clickDetector.Start(this.touch.GetPosition())}OnTouchMove(e){if(e.preventDefault(),this.touch.Move(this.canvas,e),this.clickDetector.Move(this.touch.GetPosition()),!this.touch.IsFingerDown())return;let t=this.touch.GetMoveDiff(),n=this.touch.GetDistanceDiff(),i=this.touch.GetFingerCount(),s=$n.None;if(i===1?s=$n.Orbit:i===2&&(s=$n.Pan),s===$n.Orbit){let o=.5;this.Orbit(t.x*o,t.y*o)}else if(s===$n.Pan){let o=.005;this.Zoom(n*o);let a=.001*qn(this.camera.eye,this.camera.center);this.Pan(t.x*a,t.y*a)}this.Update()}OnTouchEnd(e){if(e.preventDefault(),this.touch.End(this.canvas,e),this.clickDetector.End(),this.clickDetector.IsClick()){let t=this.touch.GetPosition();this.touch.GetFingerCount()===1&&this.Click(1,t)}}OnMouseWheel(e){let t=e||window.event;t.preventDefault();let n=-t.deltaY/40,i=.1;n<0&&(i=i*-1),this.Zoom(i),this.Update()}OnContextMenu(e){e.preventDefault(),this.clickDetector.IsClick()&&(this.Context(e.clientX,e.clientY),this.clickDetector.Cancel())}Orbit(e,t){let n=e*sr,i=t*sr,s=En(this.camera.center,this.camera.eye).Normalize(),o=Vi(s,this.camera.up).Normalize();if(this.fixUpVector){let c=$c(s,this.camera.up)+i;
3285Zc(c,0)&&Mo(c,Math.PI)&&this.camera.eye.Rotate(o,-i,this.camera.center),this.camera.eye.Rotate(this.camera.up,-n,this.camera.center)}else{let a=Vi(o,s).Normalize();this.camera.eye.Rotate(o,-i,this.camera.center),this.camera.eye.Rotate(a,-n,this.camera.center),this.camera.up=a}}Pan(e,t){let n=En(this.camera.center,this.camera.eye).Normalize(),i=Vi(n,this.camera.up).Normalize(),s=Vi(i,n).Normalize();this.camera.eye.Offset(i,-e),this.camera.center.Offset(i,-e),this.camera.eye.Offset(s,t),this.camera.center.Offset(s,t)}Zoom(e){let t=En(this.camera.center,this.camera.eye),i=t.Length()*e;this.camera.eye.Offset(t,i)}Update(){this.callbacks.onUpdate()}Click(e,t){this.onMouseClick&&this.onMouseClick(e,t)}Context(e,t){if(this.onContext){let n={x:e,y:t},i=Qr(this.canvas,e,t);this.onContext(n,i)}}};var es=class{constructor(e,t){this.textureNames=e,this.backgroundIsEnvMap=t}Clone(){let e=null;if(this.textureNames!==null){e=[];for(let t of this.textureNames)e.push(t)}return new es(e,this.backgroundIsEnvMap)}},fl=class{constructor(e){this.scene=e,this.type=Hn.Phong,this.cameraMode=Wn.Perspective,this.ambientLight=new vr(8947848),this.directionalLight=new yr(8947848),this.environmentSettings=new es(null,!1),this.environment=null,this.scene.add(this.ambientLight),this.scene.add(this.directionalLight)}SetShadingType(e){this.type=e,this.UpdateShading()}SetCameraMode(e){this.cameraMode=e,this.UpdateShading()}UpdateShading(){this.type===Hn.Phong?(this.ambientLight.color.set(8947848),this.directionalLight.color.set(8947848),this.scene.environment=null):this.type===Hn.Physical&&(this.ambientLight.color.set(0),this.directionalLight.color.set(5592405),this.scene.environment=this.environment),this.environmentSettings.backgroundIsEnvMap&&this.cameraMode===Wn.Perspective?this.scene.background=this.environment:this.scene.background=null}SetEnvironmentMapSettings(e,t){let n=new nh;this.environment=n.load(e.textureNames,()=>{t()}),this.environmentSettings=e}UpdateByCamera(e){let t=En(e.eye,e.center);this.directionalLight.position.set(t.x,t.y,t.z)}CreateHighlightMaterial(e,t){let n=null;return this.type===Hn.Phong?n=new Qt({color:e,side:kn}):this.type===Hn.Physical&&(n=new Ts({color:e,side:kn})),n!==null&&t&&(n.polygonOffset=!0,n.polygonOffsetUnit=1,n.polygonOffsetFactor=1),n}};function Xh(r){let e=45;return r===ct.X?new Bi(new Ve(2,-3,1.5),new Ve(0,0,0),new Ve(1,0,0),e):r===ct.Y?new Bi(new Ve(-1.5,2,3),new Ve(0,0,0),new Ve(0,1,0),e):r===ct.Z?new Bi(new Ve(-1.5,-3,2),new Ve(0,0,0),new Ve(0,0,1),e):null}function Yh(r,e){if(!e(r))return!1;for(let t of r.children)if(!Yh(t,e))return!1;return!0}function Vp(r){let e=null;return Yh(r,t=>{if(t.isMesh)for(let n of t.material)return n.type==="MeshPhongMaterial"?e=Hn.Phong:n.type==="MeshStandardMaterial"&&(e=Hn.Physical),!1;return!0}),e}var Rc=class{constructor(){this.eyeCenterDistance=0,this.forceUpdate=!0}ForceUpdate(){this.forceUpdate=!0}ValidatePerspective(){return this.forceUpdate?(this.forceUpdate=!1,!1):!0}
3285ValidateOrthographic(e){return this.forceUpdate||!Rt(this.eyeCenterDistance,e)?(this.eyeCenterDistance=e,this.forceUpdate=!1,!1):!0}},Pc=class{constructor(){this.direction=ct.Z,this.isFixed=!0,this.isFlipped=!1}SetDirection(e,t){this.direction=e,this.isFlipped=!1;let n=Xh(this.direction),i=En(n.eye,n.center),s=qn(t.center,t.eye),o=t.center.Clone().Offset(i,s),a=t.Clone();return this.direction===ct.X?(a.up=new Ve(1,0,0),a.eye=o):this.direction===ct.Y?(a.up=new Ve(0,1,0),a.eye=o):this.direction===ct.Z&&(a.up=new Ve(0,0,1),a.eye=o),a}SetFixed(e,t){return this.isFixed=e,this.isFixed?this.SetDirection(this.direction,t):null}Flip(e){this.isFlipped=!this.isFlipped;let t=e.Clone();return t.up.MultiplyScalar(-1),t}},dl=class{constructor(){this.canvas=null,this.renderer=null,this.scene=null,this.mainModel=null,this.extraModel=null,this.camera=null,this.cameraMode=null,this.cameraValidator=null,this.shadingModel=null,this.navigation=null,this.upVector=null,this.settings={animationSteps:40}}Init(e){this.canvas=e,this.canvas.id="viewer";let t={canvas:this.canvas,antialias:!0};this.renderer=new rc(t),window.devicePixelRatio&&this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setClearColor("#ffffff",1),this.renderer.setSize(this.canvas.width,this.canvas.height),this.scene=new xr,this.mainModel=new al(this.scene),this.extraModel=new Os(this.scene),this.InitNavigation(),this.InitShading(),this.Render()}SetMouseClickHandler(e){this.navigation.SetMouseClickHandler(e)}SetMouseMoveHandler(e){this.navigation.SetMouseMoveHandler(e)}SetContextMenuHandler(e){this.navigation.SetContextMenuHandler(e)}SetEdgeSettings(e){let t=e.Clone();this.mainModel.SetEdgeSettings(t),this.Render()}SetEnvironmentMapSettings(e){let t=e.Clone();this.shadingModel.SetEnvironmentMapSettings(t,()=>{this.Render()}),this.shadingModel.UpdateShading(),this.Render()}SetBackgroundColor(e){let t=new $e(Us(e.r),Us(e.g),Us(e.b)),n=Us(e.a);this.renderer.setClearColor(t,n),this.Render()}GetCanvas(){return this.canvas}GetCamera(){return this.navigation.GetCamera()}GetCameraMode(){return this.cameraMode}SetCamera(e){this.navigation.SetCamera(e),this.cameraValidator.ForceUpdate(),this.Render()}SetCameraMode(e){this.cameraMode!==e&&(this.scene.remove(this.camera),e===Wn.Perspective?this.camera=new Zt(45,1,.1,1e3):e===Wn.Orthogra
3285phic&&(this.camera=new gr(-1,1,1,-1,.1,1e3)),this.scene.add(this.camera),this.cameraMode=e,this.shadingModel.SetCameraMode(e),this.cameraValidator.ForceUpdate(),this.AdjustClippingPlanes(),this.Render())}Resize(e,t){let n=jh(this.canvas,e,t);this.ResizeRenderer(n.width,n.height)}ResizeRenderer(e,t){window.devicePixelRatio&&this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(e,t),this.cameraValidator.ForceUpdate(),this.Render()}FitSphereToWindow(e,t){if(e===null)return;let n=new Ve(e.center.x,e.center.y,e.center.z),i=e.radius,s=this.navigation.GetFitToSphereCamera(n,i);this.navigation.MoveCamera(s,t?this.settings.animationSteps:0)}AdjustClippingPlanes(){let e=this.GetBoundingSphere(t=>!0);this.AdjustClippingPlanesToSphere(e)}AdjustClippingPlanesToSphere(e){e!==null&&(e.radius<10?(this.camera.near=.01,this.camera.far=100):e.radius<100?(this.camera.near=.1,this.camera.far=1e3):e.radius<1e3?(this.camera.near=10,this.camera.far=1e4):(this.camera.near=100,this.camera.far=1e6),this.cameraValidator.ForceUpdate(),this.Render())}IsFixUpVector(){return this.navigation.IsFixUpVector()}SetFixUpVector(e){let t=this.navigation.GetCamera(),n=this.upVector.SetFixed(e,t);this.navigation.SetFixUpVector(e),n!==null&&this.navigation.MoveCamera(n,this.settings.animationSteps),this.Render()}SetUpVector(e,t){let n=this.navigation.GetCamera(),i=this.upVector.SetDirection(e,n),s=t?this.settings.animationSteps:0;this.navigation.MoveCamera(i,s),this.Render()}FlipUpVector(){let e=this.navigation.GetCamera(),t=this.upVector.Flip(e);this.navigation.MoveCamera(t,0),this.Render()}Render(){let e=this.navigation.GetCamera();if(this.camera.position.set(e.eye.x,e.eye.y,e.eye.z),this.camera.up.set(e.up.x,e.up.y,e.up.z),this.camera.lookAt(new ae(e.center.x,e.center.y,e.center.z)),this.cameraMode===Wn.Perspective)this.cameraValidator.ValidatePerspective()||(this.camera.aspect=this.canvas.width/this.canvas.height,this.camera.fov=e.fov,this.camera.updateProjectionMatrix());
3285else if(this.cameraMode===Wn.Orthographic){let t=qn(e.eye,e.center);if(!this.cameraValidator.ValidateOrthographic(t)){let n=this.canvas.width/this.canvas.height,s=qn(e.eye,e.center)*Math.tan(.5*e.fov*sr);this.camera.left=-s*n,this.camera.right=s*n,this.camera.top=s,this.camera.bottom=-s,this.camera.updateProjectionMatrix()}}this.shadingModel.UpdateByCamera(e),this.renderer.render(this.scene,this.camera)}SetMainObject(e){let t=Vp(e);this.mainModel.SetMainObject(e),this.shadingModel.SetShadingType(t),this.Render()}AddExtraObject(e){this.extraModel.AddObject(e),this.Render()}Clear(){this.mainModel.Clear(),this.extraModel.Clear(),this.Render()}ClearExtra(){this.extraModel.Clear(),this.Render()}SetMeshesVisibility(e){this.mainModel.EnumerateMeshes(t=>{let n=e(t.userData);t.visible!==n&&(t.visible=n)}),this.mainModel.EnumerateEdges(t=>{let n=e(t.userData);t.visible!==n&&(t.visible=n)}),this.Render()}SetMeshesHighlight(e,t){function n(s,o){let a=[];for(let c=0;c<s.length;c++)a.push(o);return a}let i=this.CreateHighlightMaterial(e);this.mainModel.EnumerateMeshes(s=>{t(s.userData)?s.userData.threeMaterials===null&&(s.userData.threeMaterials=s.material,s.material=n(s.material,i)):s.userData.threeMaterials!==null&&(s.material=s.userData.threeMaterials,s.userData.threeMaterials=null)}),this.Render()}CreateHighlightMaterial(e){let t=this.mainModel.edgeSettings.showEdges;return this.shadingModel.CreateHighlightMaterial(e,t)}GetMeshUserDataUnderMouse(e){let t=this.GetMeshIntersectionUnderMouse(e);return t===null?null:t.object.userData}GetMeshIntersectionUnderMouse(e){let t=this.GetCanvasSize(),n=this.mainModel.GetMeshIntersectionUnderMouse(e,this.camera,t.width,t.height);return n===null?null:n}GetBoundingBox(e){return this.mainModel.GetBoundingBox(e)}GetBoundingSphere(e){return this.mainModel.GetBoundingSphere(e)}EnumerateMeshesUserData(e){this.mainModel.EnumerateMeshes(t=>{e(t.userData)})}InitNavigation(){let e=Xh(ct.Z);this.camera=new Zt(45,1,.1,1e3),this.cameraMode=Wn.Perspective,this.cameraValidator=new Rc,this.scene.add(this.camera);let t=this.renderer.domElement;this.navigation=new hl(t,e,{onUpdate:()=>{this.Render()}}),this.upVector=new Pc}InitShading(){this.shadingModel=new fl(this.scene)}GetShadingType(){return this.shadingModel.type}GetImageSize(){let e=new Ee;return this.renderer.getSize(e),{width:parseInt(e.x,10),height:parseInt(e.y,10)}}GetCanvasSize(){let e=this.canvas.width,t=this.canvas.height;return window.devicePixelRatio&&(e/=window.devicePixelRatio,t/=window.devicePixelRatio),{width:e,height:t}}GetImageAsDataUrl(e,t){let n=this.GetImageSize(),i=e,s=t;window.devicePixelRatio&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),this.ResizeRenderer(i,s),this.Render();let o=this.renderer.domElement.toDataURL();return this.ResizeRenderer(n.width,n.height),o}Destroy(){this.Clear(),this.renderer.dispose()}};var Lc=class{constructor(e,t){this.parentElement=e,this.parameters={},_o(t)&&(this.parameters=t),this.canvas=document.createElement("canvas"),this.parentElement.appendChild(this.canvas),this.viewer=new dl,this.viewer.Init(this.canvas);let n=this.parentElement.clientWidth,i=this.parentElement.clientHeight;this.viewer.Resize(n,i),this.parameters.cameraMode&&this.viewer.SetCameraMode(this.parameters.cameraMode),this.parameters.backgroundColor&&this.viewer.SetBackgroundColor(this.parameters.backgroundColor),this.parameters.edgeSettings&&this.viewer.SetEdgeSettings(this.parameters.edgeSettings),this.parameters.environmentSettings&&this.viewer.SetEnvironmentMapSettings(this.parameters.environmentSettings),this.model=null,this.modelLoader=new ul,window.addEventListener("resize",()=>{this.Resize()})}LoadModelFromUrlList(e){Yc(e);let t=au(e);this.LoadModelFromInputFiles(t)}LoadModelFromFileList(e){let t=lu(e);this.LoadModelFromInputFiles(t)}LoadModelFromInputFiles(e){if(e===null||e.length===0)return;this.viewer.Clear();let t=new rl;this.parameters.defaultColor&&(t.defaultColor=this.parameters.defaultColor),this.model=null;let n=null;this.modelLoader.LoadModel(e,t,{onLoadStart:()=>{this.canvas.style.display="none",n=document.createElement("div"),n.innerHTML="Loading model...",this.parentElement.appendChild(n)},onFileListProgress:(i,s)=>{},onFileLoadProgress:(i,s)=>{},onImportStart:()=>{n.innerHTML="Importing model..."},onVisualizationStart:()=>{n.innerHTML="Visualizing model..."},onModelFinished:(i,s)=>{this.parentElement.removeChild(n),this.canvas.style.display="inherit",this.viewer.SetMainObject(s);let o=this.viewer.GetBoundingSphere(a=>!0);this.viewer.AdjustClippingPlanesToSphere(o),this.parameters.camera?this.viewer.SetCamera(this.parameters.camera):(this.viewer.SetUpVector(ct.Y,!1),this.viewer.FitSphereToWindow(o,!1)),this.model=i.model,this.parameters.onModelLoaded&&this.parameters.onModelLoaded()},onTextureLoaded:()=>{this.viewer.Render()},onLoadError:i=>{let s="Unknown error.";
3285i.code===Ar.NoImportableFile?s="No importable file found.":i.code===Ar.FailedToLoadFile?s="Failed to load file for import.":i.code===Ar.ImportFailed&&(s="Failed to import model."),i.message!==null&&(s+=" ("+i.message+")"),n.innerHTML=s}})}GetViewer(){return this.viewer}GetModel(){return this.model}Resize(){let e=this.parentElement.clientWidth,t=this.parentElement.clientHeight;this.viewer.Resize(e,t)}Destroy(){this.modelLoader.Destroy(),this.viewer.Destroy(),this.model=null}};function Hp(r,e,t){let n=new Lc(r,t);return n.LoadModelFromUrlList(e),n}function qx(r){function e(n){let i=null,s=n.getAttribute("camera");s&&(i=sn.StringToCamera(s));let o=null,a=n.getAttribute("cameramode");a&&(o=sn.StringToCameraMode(a));let c=null,l=n.getAttribute("backgroundcolor");l&&(c=sn.StringToRGBAColor(l));let u=null,h=n.getAttribute("defaultcolor");h&&(u=sn.StringToRGBColor(h));let f=null,p=n.getAttribute("edgesettings");p&&(f=sn.StringToEdgeSettings(p));let g=null,m=n.getAttribute("environmentmap");if(m){let _=m.split(",");if(_.length===6){let v=!1,y=n.getAttribute("environmentmapbg");y&&y==="true"&&(v=!0),g=new es(_,v)}}let d=null,x=n.getAttribute("model");return x&&(d=sn.StringToModelUrls(x)),Hp(n,d,{camera:i,cameraMode:o,backgroundColor:c,defaultColor:u,edgeSettings:f,environmentSettings:g})}let t=[];window.addEventListener("load",()=>{let n=document.getElementsByClassName("online_3d_viewer");for(let i=0;i<n.length;i++){let s=n[i],o=e(s);t.push(o)}r?.(t)})}return ny($w);})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.